From 964e9551b9eb9d63501087feb2467f8a45cf374b Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Mon, 23 Oct 2023 15:46:47 +0100 Subject: [PATCH] chore(deps): bump artalk from 2.6.3 to 2.6.4 (#1083) Co-authored-by: GitHub --- assets/lib/artalk/Artalk.css | 2 +- assets/lib/artalk/Artalk.js | 2 +- assets/lib/artalk/ArtalkLite.css | 2 +- assets/lib/artalk/ArtalkLite.js | 2 +- dependencies.json | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/assets/lib/artalk/Artalk.css b/assets/lib/artalk/Artalk.css index a2ed5ac35..e4f9e425c 100644 --- a/assets/lib/artalk/Artalk.css +++ b/assets/lib/artalk/Artalk.css @@ -1 +1 @@ -@charset "UTF-8";.artalk,.atk-layer-wrap{--at-color-font: #2a2e2e;--at-color-deep: #2a2e2e;--at-color-sub: #757575;--at-color-grey: #747474;--at-color-meta: #697182;--at-color-border: #eceff2;--at-color-light: #4285f4;--at-color-bg: #FFF;--at-color-bg-transl: rgba(255, 255, 255, .94);--at-color-bg-grey: #f3f4f5;--at-color-bg-grey-transl: rgba(244, 244, 244, .75);--at-color-bg-light: rgba(29, 161, 242, .1);--at-color-main: #0083ff;--at-color-red: #ff5652;--at-color-pink: #fa5a57;--at-color-yellow: #ff7c37;--at-color-green: #4caf50;--at-color-gradient: linear-gradient(180deg, transparent, rgba(255, 255, 255))}.artalk.atk-dark-mode,.atk-layer-wrap.atk-dark-mode{--at-color-font: #fff;--at-color-deep: #e7e7e7;--at-color-sub: #e7e7e7;--at-color-grey: #fff;--at-color-meta: #fff;--at-color-border: #2d3235;--at-color-light: #687a86;--at-color-bg: #1e2224;--at-color-bg-transl: rgba(30, 34, 36, .95);--at-color-bg-grey: #46494e;--at-color-bg-grey-transl: rgba(8, 8, 8, .95);--at-color-bg-light: rgba(29, 161, 242, .1);--at-color-main: #0083ff;--at-color-red: #ff5652;--at-color-pink: #fa5a57;--at-color-yellow: #ff7c37;--at-color-green: #4caf50;--at-color-gradient: linear-gradient(180deg, transparent, rgba(30, 34, 36, 1))}.atk-comment-wrap{overflow:hidden;position:relative;border-bottom:1px solid transparent}.atk-comment-wrap.atk-flash-once{animation:atkFlashOnce 1s ease-in-out 0s}@keyframes atkFlashOnce{0%{background:rgba(0,131,255,.2)}to{background:transparent}}.atk-comment-wrap.atk-unread:before{content:" ";position:absolute;left:0;top:10%;width:3px;height:80%;background:var(--at-color-main)}.atk-comment-wrap.atk-openable{cursor:pointer}.atk-comment-wrap.atk-openable:hover{background:var(--at-color-bg-grey)}.atk-comment-wrap.atk-openable .atk-height-limit:after{background:transparent!important}.atk-comment-wrap:last-child{border-bottom:none}.atk-comment{display:block;padding:12px 10px}.atk-comment>.atk-avatar{display:block;padding:2px 0;float:left}.atk-comment>.atk-avatar img{width:50px;height:50px;border-radius:3px}.atk-comment>.atk-main{display:block;margin-left:63px}.atk-comment>.atk-main>.atk-header{line-height:1.5;font-size:13px;margin-bottom:.5em;overflow:hidden;position:relative;display:flex;flex-wrap:wrap;align-items:center}.atk-comment>.atk-main>.atk-header .atk-item{display:flex;align-items:center;margin-top:2px;margin-bottom:2px;color:var(--at-color-meta)}.atk-comment>.atk-main>.atk-header .atk-item:not(:last-child){margin-right:6px}.atk-comment>.atk-main>.atk-header .atk-item.atk-nick,.atk-comment>.atk-main>.atk-header .atk-item.atk-nick a{font-size:14px;color:var(--at-color-main);text-decoration:none}.atk-comment>.atk-main>.atk-header .atk-item.atk-reply-at{margin-left:2px}.atk-comment>.atk-main>.atk-header .atk-item.atk-reply-at>.atk-arrow:before{content:"";vertical-align:middle;transform:rotate(90deg);border-bottom:4px solid var(--at-color-grey);border-left:3px solid transparent;border-right:3px solid transparent;display:inline-block;margin-top:-1px}.atk-comment>.atk-main>.atk-header .atk-item.atk-reply-at>.atk-nick{color:var(--at-color-main);cursor:pointer;margin-left:6px}.atk-comment>.atk-main>.atk-header .badge,.atk-comment>.atk-main>.atk-header .atk-ua,.atk-comment>.atk-main>.atk-header .atk-pinned-badge,.atk-comment>.atk-main>.atk-header .atk-region-badge,.atk-comment>.atk-main>.atk-header .atk-badge{display:inline-block;color:var(--at-color-meta);background:var(--at-color-bg-grey);padding:0 6px;line-height:17px;border-radius:3px}.atk-comment>.atk-main>.atk-header .badge:not(:last-child),.atk-comment>.atk-main>.atk-header .atk-ua:not(:last-child),.atk-comment>.atk-main>.atk-header .atk-pinned-badge:not(:last-child),.atk-comment>.atk-main>.atk-header .atk-region-badge:not(:last-child),.atk-comment>.atk-main>.atk-header .atk-badge:not(:last-child){margin-right:6px}.atk-comment>.atk-main>.atk-header .atk-badge-wrap>*:last-child{margin-right:6px}.atk-comment>.atk-main>.atk-header .atk-badge{color:#fff}.atk-comment>.atk-main>.atk-header .atk-pinned-badge{color:#fff;background:#f44336}@media only screen and (max-width: 768px){.atk-comment>.atk-main>.atk-header .atk-ua-wrap{display:block}}.atk-comment>.atk-main>.atk-body{display:block;overflow:hidden;position:relative}.atk-comment>.atk-main>.atk-body img{max-width:100%}.atk-comment>.atk-main>.atk-body>.atk-content{word-break:break-all}.atk-comment>.atk-main>.atk-body>.atk-content.atk-type-collapsed{border:3px solid var(--at-color-bg-grey);border-bottom:0;padding:5px 10px;border-radius:6px 6px 0 0;margin-bottom:-5px}.atk-comment>.atk-main>.atk-body>.atk-content>*:first-child{margin-top:0}.atk-comment>.atk-main>.atk-body>.atk-content>*:last-child{margin-bottom:0}.atk-comment>.atk-main>.atk-body>.atk-content .atk-height-limit-btn{bottom:5px}.atk-comment>.atk-main>.atk-body>.atk-pending{color:var(--at-color-meta);margin:3px 0;font-size:13px;padding:10px 18px;display:block;background:var(--at-color-bg-grey);border-left:4px solid #f44336}.atk-comment>.atk-main>.atk-body>.atk-reply-to{padding:5px 15px;border-left:3px solid var(--at-color-border);margin-bottom:10px;position:relative;margin-top:10px}.atk-comment>.atk-main>.atk-body>.atk-reply-to .atk-meta{font-size:15px}.atk-comment>.atk-main>.atk-body>.atk-reply-to .atk-meta .atk-nick{color:var(--at-color-main)}.atk-comment>.atk-main>.atk-body>.atk-reply-to .atk-content{margin-top:5px}.atk-comment>.atk-main>.atk-body>.atk-collapsed{margin:3px 0;font-size:13px;padding:10px 18px;display:block;background:var(--at-color-bg-grey);border-radius:6px}.atk-comment>.atk-main>.atk-body>.atk-collapsed .atk-text{color:var(--at-color-meta)}.atk-comment>.atk-main>.atk-body>.atk-collapsed .atk-show-btn{color:var(--at-color-main);cursor:pointer;-webkit-user-select:none;-moz-user-select:none;user-select:none;margin-left:3px}.atk-comment>.atk-main>.atk-body>.atk-collapsed .atk-show-btn:hover{color:var(--at-color-main)}.atk-comment>.atk-main>.atk-footer{margin-top:12px}.atk-comment>.atk-main>.atk-footer .atk-actions{display:flex;flex-direction:row;align-items:center;flex-wrap:wrap;margin-bottom:-15px}.atk-comment>.atk-main>.atk-footer .atk-actions>span{color:var(--at-color-meta);font-size:13px;line-height:15px;display:inline-flex;cursor:pointer;-webkit-user-select:none;-moz-user-select:none;user-select:none;margin-bottom:15px}.atk-comment>.atk-main>.atk-footer .atk-actions>span.atk-error,.atk-comment>.atk-main>.atk-footer .atk-actions>span.atk-error:hover{color:var(--at-color-red)}.atk-comment>.atk-main>.atk-footer .atk-actions>span:not(:last-child):not(.atk-hide){margin-right:16px}.atk-comment>.atk-main>.atk-footer .atk-actions>span:hover{color:var(--at-color-deep)}.atk-comment .atk-height-limit:after{position:absolute;z-index:1;display:block;overflow:hidden;width:100%;content:" ";bottom:0;height:80px;background:var(--at-color-gradient)}.atk-comment .atk-height-limit-btn{z-index:2;position:absolute;left:50%;bottom:10px;transform:translate(-50%);cursor:pointer;border:1px solid var(--at-color-border);border-radius:6px;background:var(--at-color-bg);padding:1px 20px;font-size:15px;color:var(--at-color-meta);-webkit-user-select:none;-moz-user-select:none;user-select:none}.atk-comment .atk-height-limit-btn:hover{background:var(--at-color-bg-grey)}.atk-comment .atk-height-limit .atk-height-limit .atk-height-limit-btn{display:none}.atk-comment .atk-height-limit-scroll{margin-top:10px;overflow-y:auto;background:linear-gradient(var(--at-color-bg) 1px,transparent 1px calc(100% - 1px)) center top,linear-gradient(transparent calc(100% - 1px),var(--at-color-bg) calc(100% - 1px) 1px) center bottom,linear-gradient(var(--at-color-border) 1px,transparent 1px calc(100% - 1px)) center top,linear-gradient(transparent calc(100% - 1px),var(--at-color-border) calc(100% - 1px) 1px) center bottom;background-repeat:no-repeat;background-color:transparent;background-size:100% 1px,100% 1px,100% 1px,100% 1px;background-attachment:local,local,scroll,scroll}.atk-comment-children>.atk-comment-wrap{margin-top:10px;border-left:1px dashed transparent;border-bottom-color:transparent}.atk-comment-children>.atk-comment-wrap:not(:last-child){margin-bottom:5px}.atk-comment-children>.atk-comment-wrap>.atk-comment{padding:4px 0}.atk-comment-children>.atk-comment-wrap>.atk-comment>.atk-avatar img{width:36px;height:36px}.atk-comment-children>.atk-comment-wrap>.atk-comment>.atk-main{margin-left:47px}.artalk>.atk-list{position:relative}.artalk>.atk-list>.atk-list-header{display:flex;flex-direction:row;padding:10px 17px}.artalk>.atk-list>.atk-list-header .atk-text{display:inline-block}.artalk>.atk-list>.atk-list-header .atk-dropdown-wrap{position:relative;cursor:pointer}.artalk>.atk-list>.atk-list-header .atk-dropdown-wrap .atk-arrow-down-icon{cursor:pointer;vertical-align:middle;border-top:5px solid var(--at-color-grey);border-left:3px solid transparent;border-right:3px solid transparent;margin-top:-1px;margin-left:.8rem;display:inline-block}.artalk>.atk-list>.atk-list-header .atk-dropdown-wrap:hover .atk-dropdown{display:block}.artalk>.atk-list>.atk-list-header .atk-dropdown-wrap .atk-dropdown{z-index:3;display:none;height:auto!important;max-height:calc(100vh - 2.7rem);overflow-y:auto;position:absolute;top:100%;right:0;width:100%;background-color:var(--at-color-bg);padding:.6rem 0;border:1px solid var(--at-color-border);text-align:center;border-radius:6px;white-space:nowrap;margin:0;list-style:none}.artalk>.atk-list>.atk-list-header .atk-dropdown-wrap .atk-dropdown-item span,.artalk>.atk-list>.atk-list-header .atk-dropdown-wrap .atk-dropdown-item a{display:block;line-height:2rem;position:relative;border-bottom:none;font-weight:400;padding:0 1.5rem}.artalk>.atk-list>.atk-list-header .atk-dropdown-wrap .atk-dropdown-item span:hover,.artalk>.atk-list>.atk-list-header .atk-dropdown-wrap .atk-dropdown-item a:hover{color:var(--at-color-main)}.artalk>.atk-list>.atk-list-header .atk-dropdown-wrap .atk-dropdown-item.active span,.artalk>.atk-list>.atk-list-header .atk-dropdown-wrap .atk-dropdown-item a{color:var(--at-color-main)}.artalk>.atk-list>.atk-list-header .atk-comment-count{font-size:15px}.artalk>.atk-list>.atk-list-header .atk-comment-count .atk-comment-count-num{font-size:22px;margin-right:4px}.artalk>.atk-list>.atk-list-header .atk-right-action{display:flex;flex:1;flex-direction:row;align-items:center;justify-content:flex-end}.artalk>.atk-list>.atk-list-header .atk-right-action>span{font-size:14px;color:var(--at-color-meta);cursor:pointer;-webkit-user-select:none;-moz-user-select:none;user-select:none;position:relative}.artalk>.atk-list>.atk-list-header .atk-right-action>span.atk-on,.artalk>.atk-list>.atk-list-header .atk-right-action>span.atk-on *{color:var(--at-color-main)}.artalk>.atk-list>.atk-list-header .atk-right-action>span:not(:last-child):not(.atk-hide){margin-right:10px;padding-right:10px}.artalk>.atk-list>.atk-list-header .atk-right-action>span .atk-unread-badge{position:absolute;top:-5px;left:-6px;color:#fff;background:var(--at-color-pink);text-align:center;min-width:16px;height:16px;padding:0 3px;border-radius:8px;line-height:16px;font-size:12px}.artalk>.atk-list>.atk-list-body{min-height:150px}.artalk>.atk-list>.atk-list-footer{z-index:1;position:absolute;bottom:5px;right:0}@media only screen and (max-width: 768px){.artalk>.atk-list>.atk-list-footer{position:relative;margin-top:10px;text-align:center}}.artalk>.atk-list>.atk-list-footer .atk-copyright{display:block;font-size:12px;color:var(--at-color-meta);padding-right:15px;margin-top:5px}.artalk>.atk-list>.atk-list-footer .atk-copyright a{color:var(--at-color-main);text-decoration:none}.atk-list-no-comment{height:150px;display:flex;font-size:19px;justify-content:center;align-items:center;word-break:break-word;text-align:center}.atk-list-read-more{border-top:1px dashed var(--at-color-border);margin-top:28px;padding-bottom:25px}@media only screen and (max-width: 768px){.atk-list-read-more{padding-bottom:10px}}.atk-list-read-more.atk-err .atk-text{color:var(--at-color-red)!important}.atk-list-read-more .atk-list-read-more-inner{cursor:pointer;-webkit-user-select:none;-moz-user-select:none;user-select:none;padding:0 15px;font-size:14px;border-radius:6px;border:1px solid transparent;display:flex;height:30px;flex-direction:row;place-content:center;align-items:center;width:120px;margin:-15px auto 0;background:var(--at-color-bg);border-color:var(--at-color-border)}.atk-list-read-more .atk-list-read-more-inner>.atk-loading-icon{height:15px;width:15px}.atk-list-read-more .atk-list-read-more-inner>.atk-text{color:var(--at-color-meta)}.atk-list-read-more .atk-list-read-more-inner:hover{background:var(--at-color-bg-grey)}.atk-pagination{display:flex;flex-direction:row;justify-content:center;padding:10px 0;position:relative}.atk-pagination>.atk-btn,.atk-pagination>.atk-input{font-size:15px;height:30px;border:1px solid var(--at-color-border);border-radius:3px;padding:0 5px;text-align:center;background:var(--at-color-bg)}.atk-pagination>.atk-btn{-webkit-user-select:none;-moz-user-select:none;user-select:none;width:70px;cursor:pointer;display:flex;justify-content:center;align-items:center}.atk-pagination>.atk-btn:hover{background:var(--at-color-bg-grey)}.atk-pagination>.atk-btn.atk-disabled{color:var(--at-color-sub)}.atk-pagination>.atk-btn.atk-disabled:hover{cursor:default;background:initial}.atk-pagination>.atk-input{background:transparent;color:var(--at-color-font);font-size:18px;width:60px;outline:none}.atk-pagination>.atk-input:focus{border-color:var(--at-color-main)}.atk-pagination>*:not(:last-child){margin-right:10px}.atk-main-editor{position:relative;overflow:hidden;background:var(--at-color-bg);border:1px solid var(--at-color-border);border-radius:6px;margin-bottom:10px}@media only screen and (max-width: 768px){.atk-main-editor{margin-bottom:7px}}.atk-main-editor>.atk-header{display:flex;flex-direction:row;padding:10px 14px 0}.atk-main-editor>.atk-header input{flex:1;width:100%;font-size:14px;background:transparent;border:2px solid transparent;border-radius:3px;padding:6px 5px;resize:none;outline:none}.atk-main-editor>.atk-header input:not(:last-child){margin-right:2px}.atk-main-editor>.atk-textarea-wrap{position:relative}.atk-main-editor>.atk-textarea-wrap>.atk-textarea{display:block;overflow:hidden;color:var(--at-color-font);font-size:15px;background-color:var(--at-color-bg);border:2px solid transparent;border-radius:3px;width:100%;min-height:120px;margin-top:2px;padding:10px 20px;resize:none;word-wrap:break-word;outline:none}.atk-main-editor>.atk-textarea-wrap>.atk-comment-closed{pointer-events:none;color:var(--at-color-meta);font-size:12px;background-color:var(--at-color-bg);border-top:1px solid var(--at-color-border);padding:5px 15px;margin-top:10px}.atk-main-editor>.atk-textarea-wrap>.atk-send-reply{z-index:2;position:absolute;right:7px;bottom:2px;max-width:calc(100% - 20px);height:30px;line-height:30px;font-size:14px;background:var(--at-color-bg-grey-transl);padding:0 30px 0 10px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;cursor:pointer;border-radius:3px}.atk-main-editor>.atk-textarea-wrap>.atk-send-reply .atk-cancel{position:absolute;right:0;bottom:0;height:30px;text-align:center;width:30px;line-height:30px;font-weight:700}.atk-main-editor>.atk-textarea-wrap>.atk-send-reply .atk-cancel:hover{color:var(--at-color-deep)}.atk-main-editor>.atk-plug-panel-wrap{position:relative;height:180px;width:100%;overflow:hidden;border-top:1px solid var(--at-color-border);animation:.3s both atkFadeIn;transition:.2s height ease-in-out}.atk-main-editor>.atk-bottom{display:flex;flex-direction:row;justify-content:space-between;padding:5px 5px 5px 10px}.atk-main-editor>.atk-bottom>.atk-item{display:flex;flex-direction:row;align-items:center}.atk-main-editor>.atk-bottom .atk-plug-btn{padding:0 8px;line-height:24px;cursor:pointer;color:var(--at-color-grey);font-size:14px;-webkit-user-select:none;-moz-user-select:none;user-select:none;border-radius:3px}.atk-main-editor>.atk-bottom .atk-plug-btn:not(:last-child){margin-right:2px}.atk-main-editor>.atk-bottom .atk-plug-btn:hover{background:var(--at-color-bg-grey)}.atk-main-editor>.atk-bottom .atk-plug-btn.active{color:var(--at-color-main)}.atk-main-editor>.atk-bottom .atk-plug-btn.active svg.markdown path{fill:var(--at-color-main)}.atk-main-editor>.atk-bottom .atk-plug-btn i{color:var(--at-color-grey);display:inline-flex;vertical-align:sub;margin-left:4px}.atk-main-editor>.atk-bottom .atk-plug-btn i svg.markdown path{fill:var(--at-color-grey)}.atk-main-editor>.atk-bottom .atk-send-btn{background:var(--at-color-main);color:#fff;font-size:14px;border:none;margin:0;height:30px;width:8em;cursor:pointer;transition:opacity .3s ease-in-out;outline:none;border-radius:3px}.atk-main-editor>.atk-bottom .atk-send-btn:active{opacity:.9}.atk-main-editor>.atk-notify-wrap{z-index:3;position:absolute;right:-2px;bottom:40px;width:225px;opacity:.83}.atk-sidebar-layer{position:fixed;z-index:99999;top:0;right:0;width:430px;height:100%;background:var(--at-color-bg);transition:transform .45s cubic-bezier(.23,1,.32,1) 0ms;transform:translate(430px)}@media only screen and (max-width: 430px){.atk-sidebar-layer{width:100%}}.atk-sidebar-layer .atk-sidebar-inner{position:relative;height:100%}.atk-sidebar-layer .atk-sidebar-header{position:absolute;top:0;right:0;display:flex;flex-direction:row;align-items:center;z-index:99999}.atk-sidebar-layer .atk-sidebar-header .atk-sidebar-close{display:flex;flex-direction:column;width:60px;height:60px;align-items:center;place-content:center;cursor:pointer;-webkit-user-select:none;-moz-user-select:none;user-select:none;margin-left:10px}.atk-sidebar-layer .atk-sidebar-header .atk-sidebar-close:hover .atk-icon-close{background-color:#e81123e6}.atk-sidebar-layer .atk-sidebar-iframe-wrap{height:100%;position:relative}.atk-sidebar-layer .atk-sidebar-iframe-wrap iframe{border:0;width:100%;height:100%}.atk-sidebar-layer .atk-sidebar-iframe-wrap .atk-err-alert{z-index:9999;top:50%;left:50%;transform:translate(-50%,-50%);position:absolute;background:var(--at-color-bg);padding:40px 30px;width:80%;text-align:center;border-radius:4px}.atk-sidebar-layer .atk-sidebar-iframe-wrap .atk-err-alert .atk-title{font-size:1.4em;margin-bottom:20px;color:var(--at-color-font)}.atk-sidebar-layer .atk-sidebar-iframe-wrap .atk-err-alert .atk-text{color:var(--at-color-font)}.atk-sidebar-layer .atk-sidebar-iframe-wrap .atk-err-alert .atk-text span{cursor:pointer;color:var(--at-color-main)}.artalk{position:relative;width:100%;min-height:200px}.artalk,.atk-layer-wrap{color:var(--at-color-font);word-wrap:break-word;word-break:break-word}.artalk *,.atk-layer-wrap *{box-sizing:border-box}.artalk input,.artalk textarea,.artalk button,.artalk optgroup,.artalk select,.atk-layer-wrap input,.atk-layer-wrap textarea,.atk-layer-wrap button,.atk-layer-wrap optgroup,.atk-layer-wrap select{font-family:inherit;color:inherit;font-size:inherit}.artalk code,.atk-layer-wrap code{font-family:source code pro,Consolas,Monaco,Menlo,sans-serif;margin:0 .05em;padding:0 .4em;display:inline-block;vertical-align:middle;font-size:.9em;background-color:var(--at-color-bg-grey);color:var(--at-color-font);border-radius:2px}.artalk pre,.atk-layer-wrap pre{margin:10px 0 0;padding:0;line-height:0}.artalk pre code,.atk-layer-wrap pre code{line-height:1.6em;display:block;padding:10px 15px;white-space:pre-wrap!important;background-color:var(--at-color-bg-grey);color:var(--at-color-font);margin:0}.artalk pre code *,.atk-layer-wrap pre code *{font-family:source code pro,Consolas,Monaco,Menlo,sans-serif}.artalk a,.atk-layer-wrap a{color:var(--at-color-main);text-decoration:none}.artalk blockquote,.atk-layer-wrap blockquote{position:static;margin:10px 0;padding:10px 20px;background:var(--at-color-bg-grey);border-left:4px solid #687a86;color:var(--at-color-font)}.artalk p:first-child,.atk-layer-wrap p:first-child{margin-top:0}.artalk p:last-child,.atk-layer-wrap p:last-child{margin-bottom:0}.artalk img,.atk-layer-wrap img{max-width:100%}.artalk table,.atk-layer-wrap table{width:100%;border-collapse:collapse;border-spacing:0;margin-bottom:1.5em;font-size:.96em}.artalk td,.artalk th,.atk-layer-wrap td,.atk-layer-wrap th{text-align:left;padding:4px 8px 4px 10px;border:1px solid var(--at-color-border)}.artalk td,.atk-layer-wrap td{vertical-align:top}.artalk tr:nth-child(2n),.atk-layer-wrap tr:nth-child(2n){background-color:var(--at-color-bg-grey)}.artalk ul,.atk-layer-wrap ul{list-style:disc}.artalk ol,.atk-layer-wrap ol{list-style:decimal}.artalk li+li,.atk-layer-wrap li+li{margin-top:8px}.artalk li>ol,.artalk li>ul,.atk-layer-wrap li>ol,.atk-layer-wrap li>ul{margin:8px 0 0}.atk-hide{display:none!important}.atk-full-layer,.atk-layer-dialog-wrap,.atk-error-layer,.atk-loading{width:100%;height:100%;position:absolute;top:0;left:0;background:var(--at-color-bg);z-index:4;align-items:center;justify-content:center;flex-flow:column;display:flex}.atk-loading-spinner{position:relative;width:50px;height:50px}.atk-loading-spinner svg{animation:atkRotate 2s linear infinite;transform-origin:center center;width:100%;height:100%;position:absolute;top:0;left:0}.atk-loading-spinner svg circle{stroke-dasharray:1,200;stroke-dashoffset:0;animation:atkDash 1.5s ease-in-out infinite,atkColor 6s ease-in-out infinite;stroke-linecap:round}@keyframes atkRotate{to{transform:rotate(360deg)}}@keyframes atkDash{0%{stroke-dasharray:1,200;stroke-dashoffset:0}50%{stroke-dasharray:89,200;stroke-dashoffset:-35px}to{stroke-dasharray:89,200;stroke-dashoffset:-124px}}@keyframes atkColor{0%,to{stroke:#ff5652}40%{stroke:#2196f3}66%{stroke:#32c787}80%,90%{stroke:#ffc107}}@keyframes atkLoadingIconRotate{0%{transform:rotate(0)}to{transform:rotate(360deg)}}.atk-loading-icon{width:18px;height:18px;box-sizing:border-box;border:solid 1px transparent;border-top-color:#29d;border-left-color:#29d;border-radius:50%;animation:atkLoadingIconRotate .4s linear infinite}.atk-fade-in{animation:atkFadeIn both .3s}.atk-fade-out{animation:atkFadeOut both .2s}.atk-rotate{animation:atkRotate 2s linear infinite}@keyframes atkFadeIn{0%{opacity:0}to{opacity:1}}@keyframes atkFadeOut{to{opacity:0}}@keyframes atkRotate{0%{transform:rotate(0)}to{transform:rotate(360deg)}}i.atk-icon{width:20px;height:20px;background-color:var(--at-color-deep);background-size:contain;background-repeat:no-repeat;-webkit-mask-repeat:no-repeat;mask-repeat:no-repeat;-webkit-mask-position:center;mask-position:center;-webkit-mask-size:contain;mask-size:contain}.atk-icon-sync{-webkit-mask-image:url("data:image/svg+xml,%3Csvg width='20' height='20' viewBox='0 0 20 20' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M4.99133 4.87635C2.22512 7.64257 2.22512 12.1275 4.99133 14.8937C6.04677 15.9491 7.3524 16.6019 8.71732 16.8519' stroke='%234E5969' stroke-width='2'/%3E%3Cpath d='M14.4179 15.4815L15.0072 14.8922C17.7734 12.126 17.7734 7.64107 15.0072 4.87486C13.9518 3.81942 12.6461 3.16668 11.2812 2.91664' stroke='%234E5969' stroke-width='2'/%3E%3Cpath d='M6.17106 4.99252L5.58181 4.40327L4.99255 3.81401H6.17106V4.99252Z' fill='%23C4C4C4' stroke='%234E5969' stroke-width='2'/%3E%3Cpath d='M13.8299 15.0084L14.4192 15.5976L15.0084 16.1869H13.8299V15.0084Z' fill='%23C4C4C4' stroke='%234E5969' stroke-width='2'/%3E%3C/svg%3E");mask-image:url("data:image/svg+xml,%3Csvg width='20' height='20' viewBox='0 0 20 20' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M4.99133 4.87635C2.22512 7.64257 2.22512 12.1275 4.99133 14.8937C6.04677 15.9491 7.3524 16.6019 8.71732 16.8519' stroke='%234E5969' stroke-width='2'/%3E%3Cpath d='M14.4179 15.4815L15.0072 14.8922C17.7734 12.126 17.7734 7.64107 15.0072 4.87486C13.9518 3.81942 12.6461 3.16668 11.2812 2.91664' stroke='%234E5969' stroke-width='2'/%3E%3Cpath d='M6.17106 4.99252L5.58181 4.40327L4.99255 3.81401H6.17106V4.99252Z' fill='%23C4C4C4' stroke='%234E5969' stroke-width='2'/%3E%3Cpath d='M13.8299 15.0084L14.4192 15.5976L15.0084 16.1869H13.8299V15.0084Z' fill='%23C4C4C4' stroke='%234E5969' stroke-width='2'/%3E%3C/svg%3E")}.atk-icon-del{background-color:var(--at-color-red)!important;-webkit-mask-image:url("data:image/svg+xml,%3Csvg width='22' height='22' viewBox='0 0 22 22' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M2.29167 5.04166L4.81251 5.04166M4.81251 5.04166L4.81251 18.3333C4.81251 18.5865 5.01771 18.7917 5.27084 18.7917L16.7292 18.7917C16.9823 18.7917 17.1875 18.5865 17.1875 18.3333V5.04166M4.81251 5.04166L7.33334 5.04166M17.1875 5.04166L19.7083 5.04166M17.1875 5.04166L14.6667 5.04166M7.33334 5.04166V3.20833L14.6667 3.20833V5.04166M7.33334 5.04166L14.6667 5.04166' stroke='%23D06565' stroke-width='2'/%3E%3Cpath d='M9.16667 8.25V15.125M12.8333 8.25V15.125' stroke='%23D06565' stroke-width='2'/%3E%3C/svg%3E");mask-image:url("data:image/svg+xml,%3Csvg width='22' height='22' viewBox='0 0 22 22' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M2.29167 5.04166L4.81251 5.04166M4.81251 5.04166L4.81251 18.3333C4.81251 18.5865 5.01771 18.7917 5.27084 18.7917L16.7292 18.7917C16.9823 18.7917 17.1875 18.5865 17.1875 18.3333V5.04166M4.81251 5.04166L7.33334 5.04166M17.1875 5.04166L19.7083 5.04166M17.1875 5.04166L14.6667 5.04166M7.33334 5.04166V3.20833L14.6667 3.20833V5.04166M7.33334 5.04166L14.6667 5.04166' stroke='%23D06565' stroke-width='2'/%3E%3Cpath d='M9.16667 8.25V15.125M12.8333 8.25V15.125' stroke='%23D06565' stroke-width='2'/%3E%3C/svg%3E")}.atk-icon-edit{-webkit-mask-image:url("data:image/svg+xml,%3Csvg width='16' height='17' viewBox='0 0 16 17' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M9.70618 4.08515L12.6081 7.06376M1.00041 13.021L11.7376 2L14.6392 4.97861L3.90274 16H1L1.00041 13.021Z' stroke='%234E5969' stroke-width='1.5'/%3E%3C/svg%3E");mask-image:url("data:image/svg+xml,%3Csvg width='16' height='17' viewBox='0 0 16 17' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M9.70618 4.08515L12.6081 7.06376M1.00041 13.021L11.7376 2L14.6392 4.97861L3.90274 16H1L1.00041 13.021Z' stroke='%234E5969' stroke-width='1.5'/%3E%3C/svg%3E")}.atk-icon-no,.atk-icon-close{-webkit-mask-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='25' height='25' viewBox='0 0 25 25' fill='none'%3E%3Cpath d='M19.8657 5.13431L12.5 12.5L5.13431 19.8657' stroke='%234E5969'/%3E%3Cpath d='M5.13431 5.13432L12.5 12.5L19.8657 19.8657' stroke='%234E5969'/%3E%3C/svg%3E");mask-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='25' height='25' viewBox='0 0 25 25' fill='none'%3E%3Cpath d='M19.8657 5.13431L12.5 12.5L5.13431 19.8657' stroke='%234E5969'/%3E%3Cpath d='M5.13431 5.13432L12.5 12.5L19.8657 19.8657' stroke='%234E5969'/%3E%3C/svg%3E")}.atk-icon-yes{-webkit-mask-image:url("data:image/svg+xml,%3Csvg width='25' height='25' viewBox='0 0 25 25' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M21.7071 5.75533L9.92197 17.5404L3.29285 10.9113' stroke='%234E5969'/%3E%3C/svg%3E");mask-image:url("data:image/svg+xml,%3Csvg width='25' height='25' viewBox='0 0 25 25' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M21.7071 5.75533L9.92197 17.5404L3.29285 10.9113' stroke='%234E5969'/%3E%3C/svg%3E")}.atk-icon-plus{-webkit-mask-image:url("data:image/svg+xml,%3Csvg width='20' height='20' viewBox='0 0 20 20' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M2.08331 10H17.9166' stroke='%234E5969' stroke-width='2'/%3E%3Cpath d='M10 2.08334L10 17.9167' stroke='%234E5969' stroke-width='2'/%3E%3C/svg%3E");mask-image:url("data:image/svg+xml,%3Csvg width='20' height='20' viewBox='0 0 20 20' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M2.08331 10H17.9166' stroke='%234E5969' stroke-width='2'/%3E%3Cpath d='M10 2.08334L10 17.9167' stroke='%234E5969' stroke-width='2'/%3E%3C/svg%3E")}.atk-error-layer{background-color:var(--at-color-bg-transl)}.atk-error-layer .atk-error-title{color:var(--at-color-red)}.atk-error-layer .atk-warn-title{color:var(--at-color-yellow)}.atk-error-layer .atk-error-title,.atk-error-layer .atk-warn-title{display:inline-block;padding:0 15px;margin-bottom:20px;font-size:20px;letter-spacing:-.5px}.atk-error-layer .atk-error-text{text-align:center;padding:0 20px}.atk-error-layer .atk-error-text *{color:var(--at-color-deep)}.atk-error-layer .atk-error-text a{color:var(--at-color-meta)}.atk-layer-dialog-wrap{background-color:var(--at-color-bg-transl)}.atk-layer-dialog-wrap>.atk-layer-dialog{width:25%}.atk-layer-dialog-wrap>.atk-layer-dialog>.atk-layer-dialog-content .atk-captcha-img{cursor:pointer;width:170px;height:auto;margin-right:10px;padding-right:10px;border-right:1px solid var(--at-color-border);vertical-align:bottom}.atk-layer-dialog-wrap>.atk-layer-dialog>.atk-layer-dialog-content input{width:100%;line-height:34px;background-color:var(--at-color-bg);border:1px solid var(--at-color-border);border-radius:3px;outline:none;padding:0 6px;display:block;margin-top:10px;margin-bottom:5px;text-align:center}.atk-layer-dialog-wrap>.atk-layer-dialog>.atk-layer-dialog-actions{display:flex;flex-direction:row}.atk-layer-dialog-wrap>.atk-layer-dialog>.atk-layer-dialog-actions button{flex:1;display:block;cursor:pointer;border:1px solid var(--at-color-main);background:transparent;color:var(--at-color-main);border-radius:3px;padding:0 15px;line-height:30px;outline:none}.atk-layer-dialog-wrap>.atk-layer-dialog>.atk-layer-dialog-actions button:active{color:#fff;background:var(--at-color-main)}.atk-layer-dialog-wrap>.atk-layer-dialog>.atk-layer-dialog-actions button:not(:last-child){margin-right:5px}.atk-layer-dialog-wrap>.atk-layer-dialog>.atk-layer-dialog-actions button.error{color:#fff;background:#ff5652;border-color:#ff5652}.atk-layer-dialog-wrap>.atk-layer-dialog .atk-checker-iframe-wrap{position:fixed;z-index:999998;left:0;top:0;height:100vh;width:100vw}.atk-layer-dialog-wrap>.atk-layer-dialog .atk-checker-iframe-wrap>iframe{width:100%;height:100%;border:0}.atk-layer-dialog-wrap>.atk-layer-dialog .atk-checker-iframe-wrap .atk-close-btn{z-index:999999;position:fixed;top:20px;right:20px;display:flex;flex-direction:column;width:50px;height:50px;align-items:center;place-content:center;cursor:pointer;-webkit-user-select:none;-moz-user-select:none;user-select:none;margin-left:10px}.atk-layer-dialog-wrap>.atk-layer-dialog .atk-checker-iframe-wrap .atk-close-btn:hover .atk-icon-close{background-color:#e81123e6}@media only screen and (max-width: 768px){.atk-layer-dialog-wrap>.atk-layer-dialog{width:90%!important}}.atk-notify{display:block;overflow:hidden;background-color:#2c2c2c;color:#fff;border-radius:3px;cursor:pointer;font-size:14px;padding:5px 15px}.atk-notify:not(:last-child){margin-bottom:3px}.atk-notify .atk-notify-content{color:#fff}.atk-layer-wrap .atk-layer-mask{position:fixed;top:0;left:0;width:100%;height:100%;z-index:99998;background:rgba(0,0,0,.3)}.atk-layer-wrap .atk-layer-item{position:fixed;z-index:99999;top:0;right:0;width:100%;height:100%}.atk-common-action-btn.atk-btn-confirm,.atk-common-action-btn.atk-btn-warn{color:var(--at-color-yellow)!important}.atk-common-action-btn.atk-btn-error{color:var(--at-color-red)!important}.atk-common-action-btn.atk-btn-success{color:var(--at-color-green)!important}img[atk-emoticon]{max-height:60px;display:initial}.atk-slim-scrollbar::-webkit-scrollbar,.atk-editor-plug-emoticons>.atk-grp-wrap::-webkit-scrollbar{width:4px;height:4px;background:transparent}.atk-slim-scrollbar::-webkit-scrollbar-thumb,.atk-editor-plug-emoticons>.atk-grp-wrap::-webkit-scrollbar-thumb,.atk-slim-scrollbar::-webkit-scrollbar-thumb:window-inactive{background:rgba(86,86,86,.3)}.atk-slim-scrollbar::-webkit-scrollbar-thumb:vertical:hover,.atk-editor-plug-emoticons>.atk-grp-wrap::-webkit-scrollbar-thumb:vertical:hover{background:rgba(65,74,82,.77)}.atk-slim-scrollbar::-webkit-scrollbar-thumb:vertical:active,.atk-editor-plug-emoticons>.atk-grp-wrap::-webkit-scrollbar-thumb:vertical:active{background:rgba(41,47,53,.77)}.atk-editor-plug-emoticons{height:100%;width:100%}.atk-editor-plug-emoticons>.atk-grp-wrap{overflow-y:scroll;overflow-x:hidden;height:100%;width:100%}.atk-editor-plug-emoticons>.atk-grp-wrap>.atk-grp{display:flex;flex-wrap:wrap;flex-direction:row;padding:5px 10px 35px}.atk-editor-plug-emoticons>.atk-grp-wrap>.atk-grp[data-type=image]>.atk-item{height:63px;width:63px}.atk-editor-plug-emoticons>.atk-grp-wrap>.atk-grp>.atk-item{display:flex;align-items:center;justify-content:center;padding:5px;cursor:pointer;-webkit-user-select:none;-moz-user-select:none;user-select:none;border-radius:3px;font-size:15px;min-width:35px;margin:2px}.atk-editor-plug-emoticons>.atk-grp-wrap>.atk-grp>.atk-item>img{max-height:100%;width:auto}.atk-editor-plug-emoticons>.atk-grp-wrap>.atk-grp>.atk-item:hover{background:var(--at-color-bg-grey)}.atk-editor-plug-emoticons>.atk-grp-switcher{position:absolute;bottom:0;left:0;width:100%;background:var(--at-color-bg-transl);height:30px;border-top:1px solid var(--at-color-border);border-bottom:1px solid var(--at-color-border)}.atk-editor-plug-emoticons>.atk-grp-switcher>span{-webkit-user-select:none;-moz-user-select:none;user-select:none;padding:0 10px;line-height:30px;float:left;display:block;cursor:pointer;font-size:14px}.atk-editor-plug-emoticons>.atk-grp-switcher>span:hover,.atk-editor-plug-emoticons>.atk-grp-switcher>span.active{background:var(--at-color-bg-grey)}.atk-slim-scrollbar::-webkit-scrollbar{width:4px;height:4px;background:transparent}.atk-slim-scrollbar::-webkit-scrollbar-thumb,.atk-slim-scrollbar::-webkit-scrollbar-thumb:window-inactive{background:rgba(86,86,86,.3)}.atk-slim-scrollbar::-webkit-scrollbar-thumb:vertical:hover{background:rgba(65,74,82,.77)}.atk-slim-scrollbar::-webkit-scrollbar-thumb:vertical:active{background:rgba(41,47,53,.77)}.atk-editor-plug-preview{overflow-y:scroll;overflow-x:hidden;height:100%;width:100%;padding:10px 15px} +@charset "UTF-8";.artalk,.atk-layer-wrap{--at-color-font: #2a2e2e;--at-color-deep: #2a2e2e;--at-color-sub: #757575;--at-color-grey: #747474;--at-color-meta: #697182;--at-color-border: #eceff2;--at-color-light: #4285f4;--at-color-bg: #FFF;--at-color-bg-transl: rgba(255, 255, 255, .94);--at-color-bg-grey: #f3f4f5;--at-color-bg-grey-transl: rgba(244, 244, 244, .75);--at-color-bg-light: rgba(29, 161, 242, .1);--at-color-main: #0083ff;--at-color-red: #ff5652;--at-color-pink: #fa5a57;--at-color-yellow: #ff7c37;--at-color-green: #4caf50;--at-color-gradient: linear-gradient(180deg, transparent, rgba(255, 255, 255))}.artalk.atk-dark-mode,.atk-layer-wrap.atk-dark-mode{--at-color-font: #fff;--at-color-deep: #e7e7e7;--at-color-sub: #e7e7e7;--at-color-grey: #fff;--at-color-meta: #fff;--at-color-border: #2d3235;--at-color-light: #687a86;--at-color-bg: #1e2224;--at-color-bg-transl: rgba(30, 34, 36, .95);--at-color-bg-grey: #46494e;--at-color-bg-grey-transl: rgba(8, 8, 8, .95);--at-color-bg-light: rgba(29, 161, 242, .1);--at-color-main: #0083ff;--at-color-red: #ff5652;--at-color-pink: #fa5a57;--at-color-yellow: #ff7c37;--at-color-green: #4caf50;--at-color-gradient: linear-gradient(180deg, transparent, rgba(30, 34, 36, 1))}.atk-comment-wrap{overflow:hidden;position:relative;border-bottom:1px solid transparent}.atk-comment-wrap.atk-flash-once{animation:atkFlashOnce 1s ease-in-out 0s}@keyframes atkFlashOnce{0%{background:rgba(0,131,255,.2)}to{background:transparent}}.atk-comment-wrap.atk-unread:before{content:" ";position:absolute;left:0;top:10%;width:3px;height:80%;background:var(--at-color-main)}.atk-comment-wrap.atk-openable{cursor:pointer}.atk-comment-wrap.atk-openable:hover{background:var(--at-color-bg-grey)}.atk-comment-wrap.atk-openable .atk-height-limit:after{background:transparent!important}.atk-comment-wrap:last-child{border-bottom:none}.atk-comment{display:block;padding:12px 10px}.atk-comment>.atk-avatar{display:block;padding:2px 0;float:left}.atk-comment>.atk-avatar img{width:50px;height:50px;border-radius:3px}.atk-comment>.atk-main{display:block;margin-left:63px}.atk-comment>.atk-main>.atk-header{line-height:1.5;font-size:13px;margin-bottom:.5em;overflow:hidden;position:relative;display:flex;flex-wrap:wrap;align-items:center}.atk-comment>.atk-main>.atk-header .atk-item{display:flex;align-items:center;margin-top:2px;margin-bottom:2px;color:var(--at-color-meta)}.atk-comment>.atk-main>.atk-header .atk-item:not(:last-child){margin-right:6px}.atk-comment>.atk-main>.atk-header .atk-item.atk-nick,.atk-comment>.atk-main>.atk-header .atk-item.atk-nick a{font-size:14px;color:var(--at-color-main);text-decoration:none}.atk-comment>.atk-main>.atk-header .atk-item.atk-reply-at{margin-left:2px}.atk-comment>.atk-main>.atk-header .atk-item.atk-reply-at>.atk-arrow:before{content:"";vertical-align:middle;transform:rotate(90deg);border-bottom:4px solid var(--at-color-grey);border-left:3px solid transparent;border-right:3px solid transparent;display:inline-block;margin-top:-1px}.atk-comment>.atk-main>.atk-header .atk-item.atk-reply-at>.atk-nick{color:var(--at-color-main);cursor:pointer;margin-left:6px}.atk-comment>.atk-main>.atk-header .badge,.atk-comment>.atk-main>.atk-header .atk-ua,.atk-comment>.atk-main>.atk-header .atk-pinned-badge,.atk-comment>.atk-main>.atk-header .atk-region-badge,.atk-comment>.atk-main>.atk-header .atk-badge{display:inline-block;color:var(--at-color-meta);background:var(--at-color-bg-grey);padding:0 6px;line-height:17px;border-radius:3px}.atk-comment>.atk-main>.atk-header .badge:not(:last-child),.atk-comment>.atk-main>.atk-header .atk-ua:not(:last-child),.atk-comment>.atk-main>.atk-header .atk-pinned-badge:not(:last-child),.atk-comment>.atk-main>.atk-header .atk-region-badge:not(:last-child),.atk-comment>.atk-main>.atk-header .atk-badge:not(:last-child){margin-right:6px}.atk-comment>.atk-main>.atk-header .atk-badge-wrap>*:last-child{margin-right:6px}.atk-comment>.atk-main>.atk-header .atk-badge{color:#fff}.atk-comment>.atk-main>.atk-header .atk-pinned-badge{color:#fff;background:#f44336}@media only screen and (max-width: 768px){.atk-comment>.atk-main>.atk-header .atk-ua-wrap{display:block}}.atk-comment>.atk-main>.atk-body{display:block;overflow:hidden;position:relative}.atk-comment>.atk-main>.atk-body img{max-width:100%}.atk-comment>.atk-main>.atk-body>.atk-content{word-break:break-all}.atk-comment>.atk-main>.atk-body>.atk-content.atk-type-collapsed{border:3px solid var(--at-color-bg-grey);border-bottom:0;padding:5px 10px;border-radius:6px 6px 0 0;margin-bottom:-5px}.atk-comment>.atk-main>.atk-body>.atk-content>*:first-child{margin-top:0}.atk-comment>.atk-main>.atk-body>.atk-content>*:last-child{margin-bottom:0}.atk-comment>.atk-main>.atk-body>.atk-content .atk-height-limit-btn{bottom:5px}.atk-comment>.atk-main>.atk-body>.atk-pending{color:var(--at-color-meta);margin:3px 0;font-size:13px;padding:10px 18px;display:block;background:var(--at-color-bg-grey);border-left:4px solid #f44336}.atk-comment>.atk-main>.atk-body>.atk-reply-to{padding:5px 15px;border-left:3px solid var(--at-color-border);margin-bottom:10px;position:relative;margin-top:10px}.atk-comment>.atk-main>.atk-body>.atk-reply-to .atk-meta{font-size:15px}.atk-comment>.atk-main>.atk-body>.atk-reply-to .atk-meta .atk-nick{color:var(--at-color-main)}.atk-comment>.atk-main>.atk-body>.atk-reply-to .atk-content{margin-top:5px}.atk-comment>.atk-main>.atk-body>.atk-collapsed{margin:3px 0;font-size:13px;padding:10px 18px;display:block;background:var(--at-color-bg-grey);border-radius:6px}.atk-comment>.atk-main>.atk-body>.atk-collapsed .atk-text{color:var(--at-color-meta)}.atk-comment>.atk-main>.atk-body>.atk-collapsed .atk-show-btn{color:var(--at-color-main);cursor:pointer;-webkit-user-select:none;-moz-user-select:none;user-select:none;margin-left:3px}.atk-comment>.atk-main>.atk-body>.atk-collapsed .atk-show-btn:hover{color:var(--at-color-main)}.atk-comment>.atk-main>.atk-footer{margin-top:12px}.atk-comment>.atk-main>.atk-footer .atk-actions{display:flex;flex-direction:row;align-items:center;flex-wrap:wrap;margin-bottom:-15px}.atk-comment>.atk-main>.atk-footer .atk-actions>span{color:var(--at-color-meta);font-size:13px;line-height:15px;display:inline-flex;cursor:pointer;-webkit-user-select:none;-moz-user-select:none;user-select:none;margin-bottom:15px}.atk-comment>.atk-main>.atk-footer .atk-actions>span.atk-error,.atk-comment>.atk-main>.atk-footer .atk-actions>span.atk-error:hover{color:var(--at-color-red)}.atk-comment>.atk-main>.atk-footer .atk-actions>span:not(:last-child):not(.atk-hide){margin-right:16px}.atk-comment>.atk-main>.atk-footer .atk-actions>span:hover{color:var(--at-color-deep)}.atk-comment .atk-height-limit:after{position:absolute;z-index:1;display:block;overflow:hidden;width:100%;content:" ";bottom:0;height:80px;background:var(--at-color-gradient)}.atk-comment .atk-height-limit-btn{z-index:2;position:absolute;left:50%;bottom:10px;transform:translate(-50%);cursor:pointer;border:1px solid var(--at-color-border);border-radius:6px;background:var(--at-color-bg);padding:1px 20px;font-size:15px;color:var(--at-color-meta);-webkit-user-select:none;-moz-user-select:none;user-select:none}.atk-comment .atk-height-limit-btn:hover{background:var(--at-color-bg-grey)}.atk-comment .atk-height-limit .atk-height-limit .atk-height-limit-btn{display:none}.atk-comment .atk-height-limit-scroll{margin-top:10px;overflow-y:auto;background:linear-gradient(var(--at-color-bg) 1px,transparent 1px calc(100% - 1px)) center top,linear-gradient(transparent calc(100% - 1px),var(--at-color-bg) calc(100% - 1px) 1px) center bottom,linear-gradient(var(--at-color-border) 1px,transparent 1px calc(100% - 1px)) center top,linear-gradient(transparent calc(100% - 1px),var(--at-color-border) calc(100% - 1px) 1px) center bottom;background-repeat:no-repeat;background-color:transparent;background-size:100% 1px,100% 1px,100% 1px,100% 1px;background-attachment:local,local,scroll,scroll}.atk-comment-children>.atk-comment-wrap{margin-top:10px;border-left:1px dashed transparent;border-bottom-color:transparent}.atk-comment-children>.atk-comment-wrap:not(:last-child){margin-bottom:5px}.atk-comment-children>.atk-comment-wrap>.atk-comment{padding:4px 0}.atk-comment-children>.atk-comment-wrap>.atk-comment>.atk-avatar img{width:36px;height:36px}.atk-comment-children>.atk-comment-wrap>.atk-comment>.atk-main{margin-left:47px}.artalk>.atk-list{position:relative}.artalk>.atk-list>.atk-list-header{display:flex;flex-direction:row;padding:10px 17px}.artalk>.atk-list>.atk-list-header .atk-text{display:inline-block}.artalk>.atk-list>.atk-list-header .atk-dropdown-wrap{position:relative;cursor:pointer}.artalk>.atk-list>.atk-list-header .atk-dropdown-wrap .atk-arrow-down-icon{cursor:pointer;vertical-align:middle;border-top:5px solid var(--at-color-grey);border-left:3px solid transparent;border-right:3px solid transparent;margin-top:-1px;margin-left:.8rem;display:inline-block}.artalk>.atk-list>.atk-list-header .atk-dropdown-wrap:hover .atk-dropdown{display:block}.artalk>.atk-list>.atk-list-header .atk-dropdown-wrap .atk-dropdown{z-index:3;display:none;height:auto!important;max-height:calc(100vh - 2.7rem);overflow-y:auto;position:absolute;top:100%;right:0;width:100%;background-color:var(--at-color-bg);padding:.6rem 0;border:1px solid var(--at-color-border);text-align:center;border-radius:6px;white-space:nowrap;margin:0;list-style:none}.artalk>.atk-list>.atk-list-header .atk-dropdown-wrap .atk-dropdown-item span,.artalk>.atk-list>.atk-list-header .atk-dropdown-wrap .atk-dropdown-item a{display:block;line-height:2rem;position:relative;border-bottom:none;font-weight:400;padding:0 1.5rem}.artalk>.atk-list>.atk-list-header .atk-dropdown-wrap .atk-dropdown-item span:hover,.artalk>.atk-list>.atk-list-header .atk-dropdown-wrap .atk-dropdown-item a:hover{color:var(--at-color-main)}.artalk>.atk-list>.atk-list-header .atk-dropdown-wrap .atk-dropdown-item.active span,.artalk>.atk-list>.atk-list-header .atk-dropdown-wrap .atk-dropdown-item a{color:var(--at-color-main)}.artalk>.atk-list>.atk-list-header .atk-comment-count{font-size:15px}.artalk>.atk-list>.atk-list-header .atk-comment-count .atk-comment-count-num{font-size:22px;margin-right:4px}.artalk>.atk-list>.atk-list-header .atk-right-action{display:flex;flex:1;flex-direction:row;align-items:center;justify-content:flex-end}.artalk>.atk-list>.atk-list-header .atk-right-action>span{font-size:14px;color:var(--at-color-meta);cursor:pointer;-webkit-user-select:none;-moz-user-select:none;user-select:none;position:relative}.artalk>.atk-list>.atk-list-header .atk-right-action>span.atk-on,.artalk>.atk-list>.atk-list-header .atk-right-action>span.atk-on *{color:var(--at-color-main)}.artalk>.atk-list>.atk-list-header .atk-right-action>span:not(:last-child):not(.atk-hide){margin-right:10px;padding-right:10px}.artalk>.atk-list>.atk-list-header .atk-right-action>span .atk-unread-badge{position:absolute;top:-5px;left:-6px;color:#fff;background:var(--at-color-pink);text-align:center;min-width:16px;height:16px;padding:0 3px;border-radius:8px;line-height:16px;font-size:12px}.artalk>.atk-list>.atk-list-body{min-height:150px}.artalk>.atk-list>.atk-list-footer{float:right}@media only screen and (max-width: 768px){.artalk>.atk-list>.atk-list-footer{float:initial;text-align:center}}.artalk>.atk-list>.atk-list-footer .atk-copyright{display:block;font-size:12px;color:var(--at-color-meta);padding-right:15px}.artalk>.atk-list>.atk-list-footer .atk-copyright a{color:var(--at-color-main);text-decoration:none}.atk-list-no-comment{height:150px;display:flex;font-size:19px;justify-content:center;align-items:center;word-break:break-word;text-align:center}.atk-list-read-more{border-top:1px dashed var(--at-color-border);margin-top:28px;padding-bottom:25px}@media only screen and (max-width: 768px){.atk-list-read-more{padding-bottom:10px}}.atk-list-read-more.atk-err .atk-text{color:var(--at-color-red)!important}.atk-list-read-more .atk-list-read-more-inner{cursor:pointer;-webkit-user-select:none;-moz-user-select:none;user-select:none;padding:0 15px;font-size:14px;border-radius:6px;border:1px solid transparent;display:flex;height:30px;flex-direction:row;place-content:center;align-items:center;width:120px;margin:-15px auto 0;background:var(--at-color-bg);border-color:var(--at-color-border)}.atk-list-read-more .atk-list-read-more-inner>.atk-loading-icon{height:15px;width:15px}.atk-list-read-more .atk-list-read-more-inner>.atk-text{color:var(--at-color-meta)}.atk-list-read-more .atk-list-read-more-inner:hover{background:var(--at-color-bg-grey)}.atk-pagination{display:flex;flex-direction:row;justify-content:center;padding:10px 0;position:relative}.atk-pagination>.atk-btn,.atk-pagination>.atk-input{font-size:15px;height:30px;border:1px solid var(--at-color-border);border-radius:3px;padding:0 5px;text-align:center;background:var(--at-color-bg)}.atk-pagination>.atk-btn{-webkit-user-select:none;-moz-user-select:none;user-select:none;width:70px;cursor:pointer;display:flex;justify-content:center;align-items:center}.atk-pagination>.atk-btn:hover{background:var(--at-color-bg-grey)}.atk-pagination>.atk-btn.atk-disabled{color:var(--at-color-sub)}.atk-pagination>.atk-btn.atk-disabled:hover{cursor:default;background:initial}.atk-pagination>.atk-input{background:transparent;color:var(--at-color-font);font-size:18px;width:60px;outline:none}.atk-pagination>.atk-input:focus{border-color:var(--at-color-main)}.atk-pagination>*:not(:last-child){margin-right:10px}.atk-main-editor{position:relative;overflow:hidden;background:var(--at-color-bg);border:1px solid var(--at-color-border);border-radius:6px;margin-bottom:10px}@media only screen and (max-width: 768px){.atk-main-editor{margin-bottom:7px}}.atk-main-editor>.atk-header{display:flex;flex-direction:row;padding:10px 14px 0}.atk-main-editor>.atk-header input{flex:1;width:100%;font-size:14px;background:transparent;border:2px solid transparent;border-radius:3px;padding:6px 5px;resize:none;outline:none}.atk-main-editor>.atk-header input:not(:last-child){margin-right:2px}.atk-main-editor>.atk-textarea-wrap{position:relative}.atk-main-editor>.atk-textarea-wrap>.atk-textarea{display:block;overflow:hidden;color:var(--at-color-font);font-size:15px;background-color:var(--at-color-bg);border:2px solid transparent;border-radius:3px;width:100%;min-height:120px;margin-top:2px;padding:10px 20px;resize:none;word-wrap:break-word;outline:none}.atk-main-editor>.atk-textarea-wrap>.atk-comment-closed{pointer-events:none;color:var(--at-color-meta);font-size:12px;background-color:var(--at-color-bg);border-top:1px solid var(--at-color-border);padding:5px 15px;margin-top:10px}.atk-main-editor>.atk-textarea-wrap>.atk-send-reply{z-index:2;position:absolute;right:7px;bottom:2px;max-width:calc(100% - 20px);height:30px;line-height:30px;font-size:14px;background:var(--at-color-bg-grey-transl);padding:0 30px 0 10px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;cursor:pointer;border-radius:3px}.atk-main-editor>.atk-textarea-wrap>.atk-send-reply .atk-cancel{position:absolute;right:0;bottom:0;height:30px;text-align:center;width:30px;line-height:30px;font-weight:700}.atk-main-editor>.atk-textarea-wrap>.atk-send-reply .atk-cancel:hover{color:var(--at-color-deep)}.atk-main-editor>.atk-plug-panel-wrap{position:relative;height:180px;width:100%;overflow:hidden;border-top:1px solid var(--at-color-border);animation:.3s both atkFadeIn;transition:.2s height ease-in-out}.atk-main-editor>.atk-bottom{display:flex;flex-direction:row;justify-content:space-between;padding:5px 5px 5px 10px}.atk-main-editor>.atk-bottom>.atk-item{display:flex;flex-direction:row;align-items:center}.atk-main-editor>.atk-bottom .atk-plug-btn{padding:0 8px;line-height:24px;cursor:pointer;color:var(--at-color-grey);font-size:14px;-webkit-user-select:none;-moz-user-select:none;user-select:none;border-radius:3px}.atk-main-editor>.atk-bottom .atk-plug-btn:not(:last-child){margin-right:2px}.atk-main-editor>.atk-bottom .atk-plug-btn:hover{background:var(--at-color-bg-grey)}.atk-main-editor>.atk-bottom .atk-plug-btn.active{color:var(--at-color-main)}.atk-main-editor>.atk-bottom .atk-plug-btn.active svg.markdown path{fill:var(--at-color-main)}.atk-main-editor>.atk-bottom .atk-plug-btn i{color:var(--at-color-grey);display:inline-flex;vertical-align:sub;margin-left:4px}.atk-main-editor>.atk-bottom .atk-plug-btn i svg.markdown path{fill:var(--at-color-grey)}.atk-main-editor>.atk-bottom .atk-send-btn{background:var(--at-color-main);color:#fff;font-size:14px;border:none;margin:0;height:30px;width:8em;cursor:pointer;transition:opacity .3s ease-in-out;outline:none;border-radius:3px}.atk-main-editor>.atk-bottom .atk-send-btn:active{opacity:.9}.atk-main-editor>.atk-notify-wrap{z-index:3;position:absolute;right:-2px;bottom:40px;width:225px;opacity:.83}.atk-sidebar-layer{position:fixed;z-index:99999;top:0;right:0;width:430px;height:100%;background:var(--at-color-bg);transition:transform .45s cubic-bezier(.23,1,.32,1) 0ms;transform:translate(430px)}@media only screen and (max-width: 430px){.atk-sidebar-layer{width:100%}}.atk-sidebar-layer .atk-sidebar-inner{position:relative;height:100%}.atk-sidebar-layer .atk-sidebar-header{position:absolute;top:0;right:0;display:flex;flex-direction:row;align-items:center;z-index:99999}.atk-sidebar-layer .atk-sidebar-header .atk-sidebar-close{display:flex;flex-direction:column;width:60px;height:60px;align-items:center;place-content:center;cursor:pointer;-webkit-user-select:none;-moz-user-select:none;user-select:none;margin-left:10px}.atk-sidebar-layer .atk-sidebar-header .atk-sidebar-close:hover .atk-icon-close{background-color:#e81123e6}.atk-sidebar-layer .atk-sidebar-iframe-wrap{height:100%;position:relative}.atk-sidebar-layer .atk-sidebar-iframe-wrap iframe{border:0;width:100%;height:100%}.atk-sidebar-layer .atk-sidebar-iframe-wrap .atk-err-alert{z-index:9999;top:50%;left:50%;transform:translate(-50%,-50%);position:absolute;background:var(--at-color-bg);padding:40px 30px;width:80%;text-align:center;border-radius:4px}.atk-sidebar-layer .atk-sidebar-iframe-wrap .atk-err-alert .atk-title{font-size:1.4em;margin-bottom:20px;color:var(--at-color-font)}.atk-sidebar-layer .atk-sidebar-iframe-wrap .atk-err-alert .atk-text{color:var(--at-color-font)}.atk-sidebar-layer .atk-sidebar-iframe-wrap .atk-err-alert .atk-text span{cursor:pointer;color:var(--at-color-main)}.artalk{position:relative;width:100%;min-height:200px}.artalk,.atk-layer-wrap{color:var(--at-color-font);word-wrap:break-word;word-break:break-word}.artalk *,.atk-layer-wrap *{box-sizing:border-box}.artalk input,.artalk textarea,.artalk button,.artalk optgroup,.artalk select,.atk-layer-wrap input,.atk-layer-wrap textarea,.atk-layer-wrap button,.atk-layer-wrap optgroup,.atk-layer-wrap select{font-family:inherit;color:inherit;font-size:inherit}.artalk code,.atk-layer-wrap code{font-family:source code pro,Consolas,Monaco,Menlo,sans-serif;margin:0 .05em;padding:0 .4em;display:inline-block;vertical-align:middle;font-size:.9em;background-color:var(--at-color-bg-grey);color:var(--at-color-font);border-radius:2px}.artalk pre,.atk-layer-wrap pre{margin:10px 0 0;padding:0;line-height:0}.artalk pre code,.atk-layer-wrap pre code{line-height:1.6em;display:block;padding:10px 15px;white-space:pre-wrap!important;background-color:var(--at-color-bg-grey);color:var(--at-color-font);margin:0}.artalk pre code *,.atk-layer-wrap pre code *{font-family:source code pro,Consolas,Monaco,Menlo,sans-serif}.artalk a,.atk-layer-wrap a{color:var(--at-color-main);text-decoration:none}.artalk blockquote,.atk-layer-wrap blockquote{position:static;margin:10px 0;padding:10px 20px;background:var(--at-color-bg-grey);border-left:4px solid #687a86;color:var(--at-color-font)}.artalk p:first-child,.atk-layer-wrap p:first-child{margin-top:0}.artalk p:last-child,.atk-layer-wrap p:last-child{margin-bottom:0}.artalk img,.atk-layer-wrap img{max-width:100%}.artalk table,.atk-layer-wrap table{width:100%;border-collapse:collapse;border-spacing:0;margin-bottom:1.5em;font-size:.96em}.artalk td,.artalk th,.atk-layer-wrap td,.atk-layer-wrap th{text-align:left;padding:4px 8px 4px 10px;border:1px solid var(--at-color-border)}.artalk td,.atk-layer-wrap td{vertical-align:top}.artalk tr:nth-child(2n),.atk-layer-wrap tr:nth-child(2n){background-color:var(--at-color-bg-grey)}.artalk ul,.atk-layer-wrap ul{list-style:disc}.artalk ol,.atk-layer-wrap ol{list-style:decimal}.artalk li+li,.atk-layer-wrap li+li{margin-top:8px}.artalk li>ol,.artalk li>ul,.atk-layer-wrap li>ol,.atk-layer-wrap li>ul{margin:8px 0 0}.atk-hide{display:none!important}.atk-full-layer,.atk-layer-dialog-wrap,.atk-error-layer,.atk-loading{width:100%;height:100%;position:absolute;top:0;left:0;background:var(--at-color-bg);z-index:4;align-items:center;justify-content:center;flex-flow:column;display:flex}.atk-loading-spinner{position:relative;width:50px;height:50px}.atk-loading-spinner svg{animation:atkRotate 2s linear infinite;transform-origin:center center;width:100%;height:100%;position:absolute;top:0;left:0}.atk-loading-spinner svg circle{stroke-dasharray:1,200;stroke-dashoffset:0;animation:atkDash 1.5s ease-in-out infinite,atkColor 6s ease-in-out infinite;stroke-linecap:round}@keyframes atkRotate{to{transform:rotate(360deg)}}@keyframes atkDash{0%{stroke-dasharray:1,200;stroke-dashoffset:0}50%{stroke-dasharray:89,200;stroke-dashoffset:-35px}to{stroke-dasharray:89,200;stroke-dashoffset:-124px}}@keyframes atkColor{0%,to{stroke:#ff5652}40%{stroke:#2196f3}66%{stroke:#32c787}80%,90%{stroke:#ffc107}}@keyframes atkLoadingIconRotate{0%{transform:rotate(0)}to{transform:rotate(360deg)}}.atk-loading-icon{width:18px;height:18px;box-sizing:border-box;border:solid 1px transparent;border-top-color:#29d;border-left-color:#29d;border-radius:50%;animation:atkLoadingIconRotate .4s linear infinite}.atk-fade-in{animation:atkFadeIn both .3s}.atk-fade-out{animation:atkFadeOut both .2s}.atk-rotate{animation:atkRotate 2s linear infinite}@keyframes atkFadeIn{0%{opacity:0}to{opacity:1}}@keyframes atkFadeOut{to{opacity:0}}@keyframes atkRotate{0%{transform:rotate(0)}to{transform:rotate(360deg)}}i.atk-icon{width:20px;height:20px;background-color:var(--at-color-deep);background-size:contain;background-repeat:no-repeat;-webkit-mask-repeat:no-repeat;mask-repeat:no-repeat;-webkit-mask-position:center;mask-position:center;-webkit-mask-size:contain;mask-size:contain}.atk-icon-sync{-webkit-mask-image:url("data:image/svg+xml,%3Csvg width='20' height='20' viewBox='0 0 20 20' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M4.99133 4.87635C2.22512 7.64257 2.22512 12.1275 4.99133 14.8937C6.04677 15.9491 7.3524 16.6019 8.71732 16.8519' stroke='%234E5969' stroke-width='2'/%3E%3Cpath d='M14.4179 15.4815L15.0072 14.8922C17.7734 12.126 17.7734 7.64107 15.0072 4.87486C13.9518 3.81942 12.6461 3.16668 11.2812 2.91664' stroke='%234E5969' stroke-width='2'/%3E%3Cpath d='M6.17106 4.99252L5.58181 4.40327L4.99255 3.81401H6.17106V4.99252Z' fill='%23C4C4C4' stroke='%234E5969' stroke-width='2'/%3E%3Cpath d='M13.8299 15.0084L14.4192 15.5976L15.0084 16.1869H13.8299V15.0084Z' fill='%23C4C4C4' stroke='%234E5969' stroke-width='2'/%3E%3C/svg%3E");mask-image:url("data:image/svg+xml,%3Csvg width='20' height='20' viewBox='0 0 20 20' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M4.99133 4.87635C2.22512 7.64257 2.22512 12.1275 4.99133 14.8937C6.04677 15.9491 7.3524 16.6019 8.71732 16.8519' stroke='%234E5969' stroke-width='2'/%3E%3Cpath d='M14.4179 15.4815L15.0072 14.8922C17.7734 12.126 17.7734 7.64107 15.0072 4.87486C13.9518 3.81942 12.6461 3.16668 11.2812 2.91664' stroke='%234E5969' stroke-width='2'/%3E%3Cpath d='M6.17106 4.99252L5.58181 4.40327L4.99255 3.81401H6.17106V4.99252Z' fill='%23C4C4C4' stroke='%234E5969' stroke-width='2'/%3E%3Cpath d='M13.8299 15.0084L14.4192 15.5976L15.0084 16.1869H13.8299V15.0084Z' fill='%23C4C4C4' stroke='%234E5969' stroke-width='2'/%3E%3C/svg%3E")}.atk-icon-del{background-color:var(--at-color-red)!important;-webkit-mask-image:url("data:image/svg+xml,%3Csvg width='22' height='22' viewBox='0 0 22 22' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M2.29167 5.04166L4.81251 5.04166M4.81251 5.04166L4.81251 18.3333C4.81251 18.5865 5.01771 18.7917 5.27084 18.7917L16.7292 18.7917C16.9823 18.7917 17.1875 18.5865 17.1875 18.3333V5.04166M4.81251 5.04166L7.33334 5.04166M17.1875 5.04166L19.7083 5.04166M17.1875 5.04166L14.6667 5.04166M7.33334 5.04166V3.20833L14.6667 3.20833V5.04166M7.33334 5.04166L14.6667 5.04166' stroke='%23D06565' stroke-width='2'/%3E%3Cpath d='M9.16667 8.25V15.125M12.8333 8.25V15.125' stroke='%23D06565' stroke-width='2'/%3E%3C/svg%3E");mask-image:url("data:image/svg+xml,%3Csvg width='22' height='22' viewBox='0 0 22 22' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M2.29167 5.04166L4.81251 5.04166M4.81251 5.04166L4.81251 18.3333C4.81251 18.5865 5.01771 18.7917 5.27084 18.7917L16.7292 18.7917C16.9823 18.7917 17.1875 18.5865 17.1875 18.3333V5.04166M4.81251 5.04166L7.33334 5.04166M17.1875 5.04166L19.7083 5.04166M17.1875 5.04166L14.6667 5.04166M7.33334 5.04166V3.20833L14.6667 3.20833V5.04166M7.33334 5.04166L14.6667 5.04166' stroke='%23D06565' stroke-width='2'/%3E%3Cpath d='M9.16667 8.25V15.125M12.8333 8.25V15.125' stroke='%23D06565' stroke-width='2'/%3E%3C/svg%3E")}.atk-icon-edit{-webkit-mask-image:url("data:image/svg+xml,%3Csvg width='16' height='17' viewBox='0 0 16 17' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M9.70618 4.08515L12.6081 7.06376M1.00041 13.021L11.7376 2L14.6392 4.97861L3.90274 16H1L1.00041 13.021Z' stroke='%234E5969' stroke-width='1.5'/%3E%3C/svg%3E");mask-image:url("data:image/svg+xml,%3Csvg width='16' height='17' viewBox='0 0 16 17' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M9.70618 4.08515L12.6081 7.06376M1.00041 13.021L11.7376 2L14.6392 4.97861L3.90274 16H1L1.00041 13.021Z' stroke='%234E5969' stroke-width='1.5'/%3E%3C/svg%3E")}.atk-icon-no,.atk-icon-close{-webkit-mask-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='25' height='25' viewBox='0 0 25 25' fill='none'%3E%3Cpath d='M19.8657 5.13431L12.5 12.5L5.13431 19.8657' stroke='%234E5969'/%3E%3Cpath d='M5.13431 5.13432L12.5 12.5L19.8657 19.8657' stroke='%234E5969'/%3E%3C/svg%3E");mask-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='25' height='25' viewBox='0 0 25 25' fill='none'%3E%3Cpath d='M19.8657 5.13431L12.5 12.5L5.13431 19.8657' stroke='%234E5969'/%3E%3Cpath d='M5.13431 5.13432L12.5 12.5L19.8657 19.8657' stroke='%234E5969'/%3E%3C/svg%3E")}.atk-icon-yes{-webkit-mask-image:url("data:image/svg+xml,%3Csvg width='25' height='25' viewBox='0 0 25 25' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M21.7071 5.75533L9.92197 17.5404L3.29285 10.9113' stroke='%234E5969'/%3E%3C/svg%3E");mask-image:url("data:image/svg+xml,%3Csvg width='25' height='25' viewBox='0 0 25 25' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M21.7071 5.75533L9.92197 17.5404L3.29285 10.9113' stroke='%234E5969'/%3E%3C/svg%3E")}.atk-icon-plus{-webkit-mask-image:url("data:image/svg+xml,%3Csvg width='20' height='20' viewBox='0 0 20 20' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M2.08331 10H17.9166' stroke='%234E5969' stroke-width='2'/%3E%3Cpath d='M10 2.08334L10 17.9167' stroke='%234E5969' stroke-width='2'/%3E%3C/svg%3E");mask-image:url("data:image/svg+xml,%3Csvg width='20' height='20' viewBox='0 0 20 20' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M2.08331 10H17.9166' stroke='%234E5969' stroke-width='2'/%3E%3Cpath d='M10 2.08334L10 17.9167' stroke='%234E5969' stroke-width='2'/%3E%3C/svg%3E")}.atk-error-layer{background-color:var(--at-color-bg-transl)}.atk-error-layer .atk-error-title{color:var(--at-color-red)}.atk-error-layer .atk-warn-title{color:var(--at-color-yellow)}.atk-error-layer .atk-error-title,.atk-error-layer .atk-warn-title{display:inline-block;padding:0 15px;margin-bottom:20px;font-size:20px;letter-spacing:-.5px}.atk-error-layer .atk-error-text{text-align:center;padding:0 20px}.atk-error-layer .atk-error-text *{color:var(--at-color-deep)}.atk-error-layer .atk-error-text a{color:var(--at-color-meta)}.atk-layer-dialog-wrap{background-color:var(--at-color-bg-transl)}.atk-layer-dialog-wrap>.atk-layer-dialog{width:25%}.atk-layer-dialog-wrap>.atk-layer-dialog>.atk-layer-dialog-content .atk-captcha-img{cursor:pointer;width:170px;height:auto;margin-right:10px;padding-right:10px;border-right:1px solid var(--at-color-border);vertical-align:bottom}.atk-layer-dialog-wrap>.atk-layer-dialog>.atk-layer-dialog-content input{width:100%;line-height:34px;background-color:var(--at-color-bg);border:1px solid var(--at-color-border);border-radius:3px;outline:none;padding:0 6px;display:block;margin-top:10px;margin-bottom:5px;text-align:center}.atk-layer-dialog-wrap>.atk-layer-dialog>.atk-layer-dialog-actions{display:flex;flex-direction:row}.atk-layer-dialog-wrap>.atk-layer-dialog>.atk-layer-dialog-actions button{flex:1;display:block;cursor:pointer;border:1px solid var(--at-color-main);background:transparent;color:var(--at-color-main);border-radius:3px;padding:0 15px;line-height:30px;outline:none}.atk-layer-dialog-wrap>.atk-layer-dialog>.atk-layer-dialog-actions button:active{color:#fff;background:var(--at-color-main)}.atk-layer-dialog-wrap>.atk-layer-dialog>.atk-layer-dialog-actions button:not(:last-child){margin-right:5px}.atk-layer-dialog-wrap>.atk-layer-dialog>.atk-layer-dialog-actions button.error{color:#fff;background:#ff5652;border-color:#ff5652}.atk-layer-dialog-wrap>.atk-layer-dialog .atk-checker-iframe-wrap{position:fixed;z-index:999998;left:0;top:0;height:100vh;width:100vw}.atk-layer-dialog-wrap>.atk-layer-dialog .atk-checker-iframe-wrap>iframe{width:100%;height:100%;border:0}.atk-layer-dialog-wrap>.atk-layer-dialog .atk-checker-iframe-wrap .atk-close-btn{z-index:999999;position:fixed;top:20px;right:20px;display:flex;flex-direction:column;width:50px;height:50px;align-items:center;place-content:center;cursor:pointer;-webkit-user-select:none;-moz-user-select:none;user-select:none;margin-left:10px}.atk-layer-dialog-wrap>.atk-layer-dialog .atk-checker-iframe-wrap .atk-close-btn:hover .atk-icon-close{background-color:#e81123e6}@media only screen and (max-width: 768px){.atk-layer-dialog-wrap>.atk-layer-dialog{width:90%!important}}.atk-notify{display:block;overflow:hidden;background-color:#2c2c2c;color:#fff;border-radius:3px;cursor:pointer;font-size:14px;padding:5px 15px}.atk-notify:not(:last-child){margin-bottom:3px}.atk-notify .atk-notify-content{color:#fff}.atk-layer-wrap .atk-layer-mask{position:fixed;top:0;left:0;width:100%;height:100%;z-index:99998;background:rgba(0,0,0,.3)}.atk-layer-wrap .atk-layer-item{position:fixed;z-index:99999;top:0;right:0;width:100%;height:100%}.atk-common-action-btn.atk-btn-confirm,.atk-common-action-btn.atk-btn-warn{color:var(--at-color-yellow)!important}.atk-common-action-btn.atk-btn-error{color:var(--at-color-red)!important}.atk-common-action-btn.atk-btn-success{color:var(--at-color-green)!important}img[atk-emoticon]{max-height:60px;display:initial}.atk-slim-scrollbar::-webkit-scrollbar,.atk-editor-plug-emoticons>.atk-grp-wrap::-webkit-scrollbar{width:4px;height:4px;background:transparent}.atk-slim-scrollbar::-webkit-scrollbar-thumb,.atk-editor-plug-emoticons>.atk-grp-wrap::-webkit-scrollbar-thumb,.atk-slim-scrollbar::-webkit-scrollbar-thumb:window-inactive{background:rgba(86,86,86,.3)}.atk-slim-scrollbar::-webkit-scrollbar-thumb:vertical:hover,.atk-editor-plug-emoticons>.atk-grp-wrap::-webkit-scrollbar-thumb:vertical:hover{background:rgba(65,74,82,.77)}.atk-slim-scrollbar::-webkit-scrollbar-thumb:vertical:active,.atk-editor-plug-emoticons>.atk-grp-wrap::-webkit-scrollbar-thumb:vertical:active{background:rgba(41,47,53,.77)}.atk-editor-plug-emoticons{height:100%;width:100%}.atk-editor-plug-emoticons>.atk-grp-wrap{overflow-y:scroll;overflow-x:hidden;height:100%;width:100%}.atk-editor-plug-emoticons>.atk-grp-wrap>.atk-grp{display:flex;flex-wrap:wrap;flex-direction:row;padding:5px 10px 35px}.atk-editor-plug-emoticons>.atk-grp-wrap>.atk-grp[data-type=image]>.atk-item{height:63px;width:63px}.atk-editor-plug-emoticons>.atk-grp-wrap>.atk-grp>.atk-item{display:flex;align-items:center;justify-content:center;padding:5px;cursor:pointer;-webkit-user-select:none;-moz-user-select:none;user-select:none;border-radius:3px;font-size:15px;min-width:35px;margin:2px}.atk-editor-plug-emoticons>.atk-grp-wrap>.atk-grp>.atk-item>img{max-height:100%;width:auto}.atk-editor-plug-emoticons>.atk-grp-wrap>.atk-grp>.atk-item:hover{background:var(--at-color-bg-grey)}.atk-editor-plug-emoticons>.atk-grp-switcher{position:absolute;bottom:0;left:0;width:100%;background:var(--at-color-bg-transl);height:30px;border-top:1px solid var(--at-color-border);border-bottom:1px solid var(--at-color-border)}.atk-editor-plug-emoticons>.atk-grp-switcher>span{-webkit-user-select:none;-moz-user-select:none;user-select:none;padding:0 10px;line-height:30px;float:left;display:block;cursor:pointer;font-size:14px}.atk-editor-plug-emoticons>.atk-grp-switcher>span:hover,.atk-editor-plug-emoticons>.atk-grp-switcher>span.active{background:var(--at-color-bg-grey)}.atk-slim-scrollbar::-webkit-scrollbar{width:4px;height:4px;background:transparent}.atk-slim-scrollbar::-webkit-scrollbar-thumb,.atk-slim-scrollbar::-webkit-scrollbar-thumb:window-inactive{background:rgba(86,86,86,.3)}.atk-slim-scrollbar::-webkit-scrollbar-thumb:vertical:hover{background:rgba(65,74,82,.77)}.atk-slim-scrollbar::-webkit-scrollbar-thumb:vertical:active{background:rgba(41,47,53,.77)}.atk-editor-plug-preview{overflow-y:scroll;overflow-x:hidden;height:100%;width:100%;padding:10px 15px} diff --git a/assets/lib/artalk/Artalk.js b/assets/lib/artalk/Artalk.js index 7dedfafcf..bdbb71fc3 100644 --- a/assets/lib/artalk/Artalk.js +++ b/assets/lib/artalk/Artalk.js @@ -1 +1 @@ -var __defProp=Object.defineProperty,__defProps=Object.defineProperties,__getOwnPropDescs=Object.getOwnPropertyDescriptors,__getOwnPropSymbols=Object.getOwnPropertySymbols,__hasOwnProp=Object.prototype.hasOwnProperty,__propIsEnum=Object.prototype.propertyIsEnumerable,__defNormalProp=(e,t,n)=>t in e?__defProp(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,__spreadValues=(e,t)=>{for(var n in t||(t={}))__hasOwnProp.call(t,n)&&__defNormalProp(e,n,t[n]);if(__getOwnPropSymbols)for(var n of __getOwnPropSymbols(t))__propIsEnum.call(t,n)&&__defNormalProp(e,n,t[n]);return e},__spreadProps=(e,t)=>__defProps(e,__getOwnPropDescs(t)),__publicField=(e,t,n)=>(__defNormalProp(e,"symbol"!=typeof t?t+"":t,n),n),__accessCheck=(e,t,n)=>{if(!t.has(e))throw TypeError("Cannot "+n)},__privateAdd=(e,t,n)=>{if(t.has(e))throw TypeError("Cannot add the same private member more than once");t instanceof WeakSet?t.add(e):t.set(e,n)},__privateMethod=(e,t,n)=>(__accessCheck(e,t,"access private method"),n),__async=(e,t,n)=>new Promise(((i,s)=>{var r=e=>{try{o(n.next(e))}catch(t){s(t)}},a=e=>{try{o(n.throw(e))}catch(t){s(t)}},o=e=>e.done?i(e.value):Promise.resolve(e.value).then(r,a);o((n=n.apply(e,t)).next())}));!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):(e="undefined"!=typeof globalThis?globalThis:e||self).Artalk=t()}(this,(function(){var e,t,n,i;function s(e=""){const t=document.createElement("div");return t.innerHTML=e.trim(),t.firstElementChild||t}function r(e){return parseFloat(getComputedStyle(e,null).height.replace("px",""))}function a(e){const t=RegExp(`[?&]${e}=([^&]*)`).exec(window.location.search);return t&&decodeURIComponent(t[1].replace(/\+/g," "))}function o(e){const t=e.getBoundingClientRect();return{top:t.top+window.scrollY,left:t.left+window.scrollX}}function l(e,t){let n=e.toString();for(;n.length=13?e.replace(/Windows NT 10.0/,"Windows NT 11.0"):"macOS"===t.platform&&i>=11?e.replace(/(Mac OS X \d+_\d+_\d+|Mac OS X)/,`Mac OS X ${n.platformVersion.replace(/\./g,"_")}`):e}))}function h(e){let t;try{t=new URL(e)}catch(n){return!1}return"http:"===t.protocol||"https:"===t.protocol}function u(e,t){return function(e,t){return`${e.replace(/\/$/,"")}/${t.replace(/^\//,"")}`}(e.conf.server,t)}function p(e,t){const n=e=>e&&"object"==typeof e;return n(e)&&n(t)?(Object.keys(t).forEach((i=>{const s=e[i],r=t[i];Array.isArray(s)&&Array.isArray(r)?e[i]=s.concat(r):n(s)&&n(r)?e[i]=p(__spreadValues({},s),r):e[i]=r})),e):t}class m{constructor(e){__publicField(this,"$el"),__publicField(this,"ctx"),__publicField(this,"conf"),this.ctx=e,this.conf=e.conf}$t(e,t={}){return this.ctx.$t(e,t)}}function g(e,t){let n=e.querySelector(":scope > .atk-loading");n||(n=s(''),(null==t?void 0:t.transparentBg)&&(n.style.background="transparent"),e.appendChild(n)),n.style.display="";const i=n.querySelector(".atk-loading-spinner");i&&(i.style.display="none",window.setTimeout((()=>{i.style.display=""}),500))}function f(e){const t=e.querySelector(":scope > .atk-loading");t&&(t.style.display="none")}function k(e,t=!0){const n=o(e).top+r(e)/2-document.documentElement.clientHeight/2;t?window.scroll({top:n>0?n:0,left:0}):window.scroll(0,n>0?n:0)}function y(e,t,n){const i=s(`
`);i.querySelector(".atk-notify-content").innerHTML=function(e){const t=document.createElement("div");return t.innerText=e,t.innerHTML}(t).replace("\n","
"),e.appendChild(i);const r=()=>{i.classList.add("atk-fade-out"),setTimeout((()=>{i.remove()}),200)};let a;a=window.setTimeout((()=>{r()}),3e3),i.addEventListener("click",(()=>{r(),window.clearTimeout(a)}))}function b(e,t){!function(e,t,n="in"){e.classList.add(`atk-fade-${n}`);const i=()=>{e.classList.remove(`atk-fade-${n}`),e.removeEventListener("animationend",i),t&&t()};e.addEventListener("animationend",i)}(e,t,"in")}function _(e,t,n='Artalk Error'){let i=e.querySelector(".atk-error-layer");if(null===t)return void(null!==i&&i.remove());i||(i=s(`
${n}
`),e.appendChild(i));const r=i.querySelector(".atk-error-text");r.innerHTML="",null!==t&&(t instanceof HTMLElement?r.appendChild(t):r.innerText=t)}const $=class e extends m{constructor(e,t,n){super(e),__publicField(this,"name"),__publicField(this,"$wrap"),__publicField(this,"$mask"),__publicField(this,"maskClickHideEnable",!0),__publicField(this,"afterHide"),this.name=t;const{$wrap:i,$mask:r}=v();this.$wrap=i,this.$mask=r,this.$el=this.$wrap.querySelector(`[data-layer-name="${t}"].atk-layer-item`),null===this.$el&&(n?this.$el=n:(this.$el=s(),this.$el.classList.add("atk-layer-item"))),this.$el.setAttribute("data-layer-name",t),this.$el.style.display="none",this.$wrap.append(this.$el)}getName(){return this.name}getWrapEl(){return this.$wrap}getEl(){return this.$el}show(){this.fireAllActionTimer(),this.$wrap.style.display="block",this.$mask.style.display="block",this.$mask.classList.add("atk-fade-in"),this.$el.style.display="",this.$mask.onclick=()=>{this.maskClickHideEnable&&this.hide()},this.pageBodyScrollBarHide()}hide(){this.afterHide&&this.afterHide(),this.$wrap.classList.add("atk-fade-out"),this.$el.style.display="none",this.pageBodyScrollBarShow(),this.newActionTimer((()=>{this.$wrap.style.display="none",this.checkCleanLayer()}),450),this.newActionTimer((()=>{this.$wrap.style.display="none",this.$wrap.classList.remove("atk-fade-out")}),200)}setMaskClickHide(e){this.maskClickHideEnable=e}pageBodyScrollBarHide(){document.body.style.overflow="hidden";const e=parseInt(window.getComputedStyle(document.body,null).getPropertyValue("padding-right"),10);document.body.style.paddingRight=`${function(){const e=document.createElement("p");e.style.width="100%",e.style.height="200px";const t=document.createElement("div");t.style.position="absolute",t.style.top="0px",t.style.left="0px",t.style.visibility="hidden",t.style.width="200px",t.style.height="150px",t.style.overflow="hidden",t.appendChild(e),document.body.appendChild(t);const n=e.offsetWidth;t.style.overflow="scroll";let i=e.offsetWidth;return n===i&&(i=t.clientWidth),document.body.removeChild(t),n-i}()+e||0}px`}pageBodyScrollBarShow(){document.body.style.overflow=e.BodyOrgOverflow,document.body.style.paddingRight=e.BodyOrgPaddingRight}newActionTimer(t,n){const i=()=>{t(),e.actionTimers=e.actionTimers.filter((e=>e.act!==i))},s=window.setTimeout((()=>i()),n);e.actionTimers.push({act:i,tid:s})}fireAllActionTimer(){e.actionTimers.forEach((e=>{clearTimeout(e.tid),e.act()}))}disposeNow(){this.$el.remove(),this.pageBodyScrollBarShow(),this.checkCleanLayer()}dispose(){this.hide(),this.$el.remove(),this.checkCleanLayer()}checkCleanLayer(){0===this.getWrapEl().querySelectorAll(".atk-layer-item").length&&(this.$wrap.style.display="none")}};__publicField($,"BodyOrgOverflow"),__publicField($,"BodyOrgPaddingRight"),__publicField($,"actionTimers",[]);let x=$;function v(){let e=document.querySelector(".atk-layer-wrap");e||(e=s(''),document.body.appendChild(e));const t=e.querySelector(".atk-layer-mask");return{$wrap:e,$mask:t}}const w=window.matchMedia("(prefers-color-scheme: dark)");let C;function S(e){T(e,e.conf.darkMode,!1)}function T(e,t,n=!0){const i=t=>{!function(e,t){t?e.$root.classList.add(E):e.$root.classList.remove(E);const{$wrap:n}=v();n&&(t?n.classList.add(E):n.classList.remove(E))}(e,t),n&&function(e,t){e.conf.darkMode=t}(e,t)};"auto"===t?(C||(C=e=>i(e.matches),w.addEventListener("change",C)),i(w.matches)):(C&&w.removeEventListener("change",C),i(t))}const E="atk-dark-mode";function L(){return{async:!1,baseUrl:null,breaks:!1,extensions:null,gfm:!0,headerIds:!1,headerPrefix:"",highlight:null,hooks:null,langPrefix:"language-",mangle:!1,pedantic:!1,renderer:null,sanitize:!1,sanitizer:null,silent:!1,smartypants:!1,tokenizer:null,walkTokens:null,xhtml:!1}}let A={async:!1,baseUrl:null,breaks:!1,extensions:null,gfm:!0,headerIds:!1,headerPrefix:"",highlight:null,hooks:null,langPrefix:"language-",mangle:!1,pedantic:!1,renderer:null,sanitize:!1,sanitizer:null,silent:!1,smartypants:!1,tokenizer:null,walkTokens:null,xhtml:!1};function F(e){A=e}const O=/[&<>"']/,M=new RegExp(O.source,"g"),R=/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/,P=new RegExp(R.source,"g"),B={"&":"&","<":"<",">":">",'"':""","'":"'"},I=e=>B[e];function U(e,t){if(t){if(O.test(e))return e.replace(M,I)}else if(R.test(e))return e.replace(P,I);return e}const D=/&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/gi;function q(e){return e.replace(D,((e,t)=>"colon"===(t=t.toLowerCase())?":":"#"===t.charAt(0)?"x"===t.charAt(1)?String.fromCharCode(parseInt(t.substring(2),16)):String.fromCharCode(+t.substring(1)):""))}const z=/(^|[^\[])\^/g;function j(e,t){e="string"==typeof e?e:e.source,t=t||"";const n={replace:(t,i)=>(i=(i="object"==typeof i&&"source"in i?i.source:i).replace(z,"$1"),e=e.replace(t,i),n),getRegex:()=>new RegExp(e,t)};return n}const W=/[^\w:]/g,N=/^$|^[a-z][a-z0-9+.-]*:|^[?#]/i;function H(e,t,n){if(e){let e;try{e=decodeURIComponent(q(n)).replace(W,"").toLowerCase()}catch(i){return null}if(0===e.indexOf("javascript:")||0===e.indexOf("vbscript:")||0===e.indexOf("data:"))return null}t&&!N.test(n)&&(n=function(e,t){V[" "+e]||(Q.test(e)?V[" "+e]=e+"/":V[" "+e]=X(e,"/",!0));e=V[" "+e];const n=-1===e.indexOf(":");return"//"===t.substring(0,2)?n?t:e.replace(Z,"$1")+t:"/"===t.charAt(0)?n?t:e.replace(G,"$1")+t:e+t}(t,n));try{n=encodeURI(n).replace(/%25/g,"%")}catch(i){return null}return n}const V={},Q=/^[^:]+:\/*[^/]*$/,Z=/^([^:]+:)[\s\S]*$/,G=/^([^:]+:\/*[^/]*)[\s\S]*$/;const K={exec:()=>null};function Y(e,t){const n=e.replace(/\|/g,((e,t,n)=>{let i=!1,s=t;for(;--s>=0&&"\\"===n[s];)i=!i;return i?"|":" |"})).split(/ \|/);let i=0;if(n[0].trim()||n.shift(),n.length>0&&!n[n.length-1].trim()&&n.pop(),t)if(n.length>t)n.splice(t);else for(;n.length0)return{type:"space",raw:t[0]}}code(e){const t=this.rules.block.code.exec(e);if(t){const e=t[0].replace(/^ {1,4}/gm,"");return{type:"code",raw:t[0],codeBlockStyle:"indented",text:this.options.pedantic?e:X(e,"\n")}}}fences(e){const t=this.rules.block.fences.exec(e);if(t){const e=t[0],n=function(e,t){const n=e.match(/^(\s+)(?:```)/);if(null===n)return t;const i=n[1];return t.split("\n").map((e=>{const t=e.match(/^\s+/);if(null===t)return e;const[n]=t;return n.length>=i.length?e.slice(i.length):e})).join("\n")}(e,t[3]||"");return{type:"code",raw:e,lang:t[2]?t[2].trim().replace(this.rules.inline._escapes,"$1"):t[2],text:n}}}heading(e){const t=this.rules.block.heading.exec(e);if(t){let e=t[2].trim();if(/#$/.test(e)){const t=X(e,"#");this.options.pedantic?e=t.trim():t&&!/ $/.test(t)||(e=t.trim())}return{type:"heading",raw:t[0],depth:t[1].length,text:e,tokens:this.lexer.inline(e)}}}hr(e){const t=this.rules.block.hr.exec(e);if(t)return{type:"hr",raw:t[0]}}blockquote(e){const t=this.rules.block.blockquote.exec(e);if(t){const e=t[0].replace(/^ *>[ \t]?/gm,""),n=this.lexer.state.top;this.lexer.state.top=!0;const i=this.lexer.blockTokens(e);return this.lexer.state.top=n,{type:"blockquote",raw:t[0],tokens:i,text:e}}}list(e){let t=this.rules.block.list.exec(e);if(t){let n=t[1].trim();const i=n.length>1,s={type:"list",raw:"",ordered:i,start:i?+n.slice(0,-1):"",loose:!1,items:[]};n=i?`\\d{1,9}\\${n.slice(-1)}`:`\\${n}`,this.options.pedantic&&(n=i?n:"[*+-]");const r=new RegExp(`^( {0,3}${n})((?:[\t ][^\\n]*)?(?:\\n|$))`);let a="",o="",l=!1;for(;e;){let n=!1;if(!(t=r.exec(e)))break;if(this.rules.block.hr.test(e))break;a=t[0],e=e.substring(a.length);let i=t[2].split("\n",1)[0].replace(/^\t+/,(e=>" ".repeat(3*e.length))),c=e.split("\n",1)[0],d=0;this.options.pedantic?(d=2,o=i.trimLeft()):(d=t[2].search(/[^ ]/),d=d>4?1:d,o=i.slice(d),d+=t[1].length);let h=!1;if(!i&&/^ *$/.test(c)&&(a+=c+"\n",e=e.substring(c.length+1),n=!0),!n){const t=new RegExp(`^ {0,${Math.min(3,d-1)}}(?:[*+-]|\\d{1,9}[.)])((?:[ \t][^\\n]*)?(?:\\n|$))`),n=new RegExp(`^ {0,${Math.min(3,d-1)}}((?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$)`),s=new RegExp(`^ {0,${Math.min(3,d-1)}}(?:\`\`\`|~~~)`),r=new RegExp(`^ {0,${Math.min(3,d-1)}}#`);for(;e;){const l=e.split("\n",1)[0];if(c=l,this.options.pedantic&&(c=c.replace(/^ {1,4}(?=( {4})*[^ ])/g," ")),s.test(c))break;if(r.test(c))break;if(t.test(c))break;if(n.test(e))break;if(c.search(/[^ ]/)>=d||!c.trim())o+="\n"+c.slice(d);else{if(h)break;if(i.search(/[^ ]/)>=4)break;if(s.test(i))break;if(r.test(i))break;if(n.test(i))break;o+="\n"+c}h||c.trim()||(h=!0),a+=l+"\n",e=e.substring(l.length+1),i=c.slice(d)}}s.loose||(l?s.loose=!0:/\n *\n *$/.test(a)&&(l=!0));let u,p=null;this.options.gfm&&(p=/^\[[ xX]\] /.exec(o),p&&(u="[ ] "!==p[0],o=o.replace(/^\[[ xX]\] +/,""))),s.items.push({type:"list_item",raw:a,task:!!p,checked:u,loose:!1,text:o,tokens:[]}),s.raw+=a}s.items[s.items.length-1].raw=a.trimRight(),s.items[s.items.length-1].text=o.trimRight(),s.raw=s.raw.trimRight();for(let e=0;e"space"===e.type)),n=t.length>0&&t.some((e=>/\n.*\n/.test(e.raw)));s.loose=n}if(s.loose)for(let e=0;e$/,"$1").replace(this.rules.inline._escapes,"$1"):"",i=t[3]?t[3].substring(1,t[3].length-1).replace(this.rules.inline._escapes,"$1"):t[3];return{type:"def",tag:e,raw:t[0],href:n,title:i}}}table(e){const t=this.rules.block.table.exec(e);if(t){const e={type:"table",raw:t[0],header:Y(t[1]).map((e=>({text:e,tokens:[]}))),align:t[2].replace(/^ *|\| *$/g,"").split(/ *\| */),rows:t[3]&&t[3].trim()?t[3].replace(/\n[ \t]*$/,"").split("\n"):[]};if(e.header.length===e.align.length){let t,n,i,s,r=e.align.length;for(t=0;t({text:e,tokens:[]})));for(r=e.header.length,n=0;n/i.test(t[0])&&(this.lexer.state.inLink=!1),!this.lexer.state.inRawBlock&&/^<(pre|code|kbd|script)(\s|>)/i.test(t[0])?this.lexer.state.inRawBlock=!0:this.lexer.state.inRawBlock&&/^<\/(pre|code|kbd|script)(\s|>)/i.test(t[0])&&(this.lexer.state.inRawBlock=!1),{type:this.options.sanitize?"text":"html",raw:t[0],inLink:this.lexer.state.inLink,inRawBlock:this.lexer.state.inRawBlock,block:!1,text:this.options.sanitize?this.options.sanitizer?this.options.sanitizer(t[0]):U(t[0]):t[0]}}link(e){const t=this.rules.inline.link.exec(e);if(t){const e=t[2].trim();if(!this.options.pedantic&&/^$/.test(e))return;const t=X(e.slice(0,-1),"\\");if((e.length-t.length)%2==0)return}else{const e=function(e,t){if(-1===e.indexOf(t[1]))return-1;let n=0;for(let i=0;i-1){const n=(0===t[0].indexOf("!")?5:4)+t[1].length+e;t[2]=t[2].substring(0,e),t[0]=t[0].substring(0,n).trim(),t[3]=""}}let n=t[2],i="";if(this.options.pedantic){const e=/^([^'"]*[^\s])\s+(['"])(.*)\2/.exec(n);e&&(n=e[1],i=e[3])}else i=t[3]?t[3].slice(1,-1):"";return n=n.trim(),/^$/.test(e)?n.slice(1):n.slice(1,-1)),J(t,{href:n?n.replace(this.rules.inline._escapes,"$1"):n,title:i?i.replace(this.rules.inline._escapes,"$1"):i},t[0],this.lexer)}}reflink(e,t){let n;if((n=this.rules.inline.reflink.exec(e))||(n=this.rules.inline.nolink.exec(e))){let e=(n[2]||n[1]).replace(/\s+/g," ");if(e=t[e.toLowerCase()],!e){const e=n[0].charAt(0);return{type:"text",raw:e,text:e}}return J(n,e,n[0],this.lexer)}}emStrong(e,t,n=""){let i=this.rules.inline.emStrong.lDelim.exec(e);if(!i)return;if(i[3]&&n.match(/[\p{L}\p{N}]/u))return;if(!(i[1]||i[2]||"")||!n||this.rules.inline.punctuation.exec(n)){const n=[...i[0]].length-1;let s,r,a=n,o=0;const l="*"===i[0][0]?this.rules.inline.emStrong.rDelimAst:this.rules.inline.emStrong.rDelimUnd;for(l.lastIndex=0,t=t.slice(-1*e.length+n);null!=(i=l.exec(t));){if(s=i[1]||i[2]||i[3]||i[4]||i[5]||i[6],!s)continue;if(r=[...s].length,i[3]||i[4]){a+=r;continue}if((i[5]||i[6])&&n%3&&!((n+r)%3)){o+=r;continue}if(a-=r,a>0)continue;r=Math.min(r,r+a+o);const t=[...e].slice(0,n+i.index+r+1).join("");if(Math.min(n,r)%2){const e=t.slice(1,-1);return{type:"em",raw:t,text:e,tokens:this.lexer.inlineTokens(e)}}const l=t.slice(2,-2);return{type:"strong",raw:t,text:l,tokens:this.lexer.inlineTokens(l)}}}}codespan(e){const t=this.rules.inline.code.exec(e);if(t){let e=t[2].replace(/\n/g," ");const n=/[^ ]/.test(e),i=/^ /.test(e)&&/ $/.test(e);return n&&i&&(e=e.substring(1,e.length-1)),e=U(e,!0),{type:"codespan",raw:t[0],text:e}}}br(e){const t=this.rules.inline.br.exec(e);if(t)return{type:"br",raw:t[0]}}del(e){const t=this.rules.inline.del.exec(e);if(t)return{type:"del",raw:t[0],text:t[2],tokens:this.lexer.inlineTokens(t[2])}}autolink(e,t){const n=this.rules.inline.autolink.exec(e);if(n){let e,i;return"@"===n[2]?(e=U(this.options.mangle?t(n[1]):n[1]),i="mailto:"+e):(e=U(n[1]),i=e),{type:"link",raw:n[0],text:e,href:i,tokens:[{type:"text",raw:e,text:e}]}}}url(e,t){let n;if(n=this.rules.inline.url.exec(e)){let e,i;if("@"===n[2])e=U(this.options.mangle?t(n[0]):n[0]),i="mailto:"+e;else{let t;do{t=n[0],n[0]=this.rules.inline._backpedal.exec(n[0])[0]}while(t!==n[0]);e=U(n[0]),i="www."===n[1]?"http://"+n[0]:n[0]}return{type:"link",raw:n[0],text:e,href:i,tokens:[{type:"text",raw:e,text:e}]}}}inlineText(e,t){const n=this.rules.inline.text.exec(e);if(n){let e;return e=this.lexer.state.inRawBlock?this.options.sanitize?this.options.sanitizer?this.options.sanitizer(n[0]):U(n[0]):n[0]:U(this.options.smartypants?t(n[0]):n[0]),{type:"text",raw:n[0],text:e}}}}const te={newline:/^(?: *(?:\n|$))+/,code:/^( {4}[^\n]+(?:\n(?: *(?:\n|$))*)?)+/,fences:/^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/,hr:/^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/,heading:/^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/,blockquote:/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/,list:/^( {0,3}bull)([ \t][^\n]+?)?(?:\n|$)/,html:"^ {0,3}(?:<(script|pre|style|textarea)[\\s>][\\s\\S]*?(?:[^\\n]*\\n+|$)|comment[^\\n]*(\\n+|$)|<\\?[\\s\\S]*?(?:\\?>\\n*|$)|\\n*|$)|\\n*|$)|)[\\s\\S]*?(?:(?:\\n *)+\\n|$)|<(?!script|pre|style|textarea)([a-z][\\w-]*)(?:attribute)*? */?>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n *)+\\n|$)|(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n *)+\\n|$))",def:/^ {0,3}\[(label)\]: *(?:\n *)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n *)?| *\n *)(title))? *(?:\n+|$)/,table:K,lheading:/^((?:(?!^bull ).|\n(?!\n|bull ))+?)\n {0,3}(=+|-+) *(?:\n+|$)/,_paragraph:/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table| +\n)[^\n]+)*)/,text:/^[^\n]+/,_label:/(?!\s*\])(?:\\.|[^\[\]\\])+/,_title:/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/};te.def=j(te.def).replace("label",te._label).replace("title",te._title).getRegex(),te.bullet=/(?:[*+-]|\d{1,9}[.)])/,te.listItemStart=j(/^( *)(bull) */).replace("bull",te.bullet).getRegex(),te.list=j(te.list).replace(/bull/g,te.bullet).replace("hr","\\n+(?=\\1?(?:(?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$))").replace("def","\\n+(?="+te.def.source+")").getRegex(),te._tag="address|article|aside|base|basefont|blockquote|body|caption|center|col|colgroup|dd|details|dialog|dir|div|dl|dt|fieldset|figcaption|figure|footer|form|frame|frameset|h[1-6]|head|header|hr|html|iframe|legend|li|link|main|menu|menuitem|meta|nav|noframes|ol|optgroup|option|p|param|section|source|summary|table|tbody|td|tfoot|th|thead|title|tr|track|ul",te._comment=/|$)/,te.html=j(te.html,"i").replace("comment",te._comment).replace("tag",te._tag).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),te.lheading=j(te.lheading).replace(/bull/g,te.bullet).getRegex(),te.paragraph=j(te._paragraph).replace("hr",te.hr).replace("heading"," {0,3}#{1,6} ").replace("|lheading","").replace("|table","").replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html",")|<(?:script|pre|style|textarea|!--)").replace("tag",te._tag).getRegex(),te.blockquote=j(te.blockquote).replace("paragraph",te.paragraph).getRegex(),te.normal=__spreadValues({},te),te.gfm=__spreadProps(__spreadValues({},te.normal),{table:"^ *([^\\n ].*\\|.*)\\n {0,3}(?:\\| *)?(:?-+:? *(?:\\| *:?-+:? *)*)(?:\\| *)?(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)"}),te.gfm.table=j(te.gfm.table).replace("hr",te.hr).replace("heading"," {0,3}#{1,6} ").replace("blockquote"," {0,3}>").replace("code"," {4}[^\\n]").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html",")|<(?:script|pre|style|textarea|!--)").replace("tag",te._tag).getRegex(),te.gfm.paragraph=j(te._paragraph).replace("hr",te.hr).replace("heading"," {0,3}#{1,6} ").replace("|lheading","").replace("table",te.gfm.table).replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html",")|<(?:script|pre|style|textarea|!--)").replace("tag",te._tag).getRegex(),te.pedantic=__spreadProps(__spreadValues({},te.normal),{html:j("^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+? *(?:\\n{2,}|\\s*$)|\\s]*)*?/?> *(?:\\n{2,}|\\s*$))").replace("comment",te._comment).replace(/tag/g,"(?!(?:a|em|strong|small|s|cite|q|dfn|abbr|data|time|code|var|samp|kbd|sub|sup|i|b|u|mark|ruby|rt|rp|bdi|bdo|span|br|wbr|ins|del|img)\\b)\\w+(?!:|[^\\w\\s@]*@)\\b").getRegex(),def:/^ *\[([^\]]+)\]: *]+)>?(?: +(["(][^\n]+[")]))? *(?:\n+|$)/,heading:/^(#{1,6})(.*)(?:\n+|$)/,fences:K,lheading:/^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,paragraph:j(te.normal._paragraph).replace("hr",te.hr).replace("heading"," *#{1,6} *[^\n]").replace("lheading",te.lheading).replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").getRegex()});const ne={escape:/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,autolink:/^<(scheme:[^\s\x00-\x1f<>]*|email)>/,url:K,tag:"^comment|^|^<[a-zA-Z][\\w-]*(?:attribute)*?\\s*/?>|^<\\?[\\s\\S]*?\\?>|^|^",link:/^!?\[(label)\]\(\s*(href)(?:\s+(title))?\s*\)/,reflink:/^!?\[(label)\]\[(ref)\]/,nolink:/^!?\[(ref)\](?:\[\])?/,reflinkSearch:"reflink|nolink(?!\\()",emStrong:{lDelim:/^(?:\*+(?:((?!\*)[punct])|[^\s*]))|^_+(?:((?!_)[punct])|([^\s_]))/,rDelimAst:/^[^_*]*?__[^_*]*?\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\*)[punct](\*+)(?=[\s]|$)|[^punct\s](\*+)(?!\*)(?=[punct\s]|$)|(?!\*)[punct\s](\*+)(?=[^punct\s])|[\s](\*+)(?!\*)(?=[punct])|(?!\*)[punct](\*+)(?!\*)(?=[punct])|[^punct\s](\*+)(?=[^punct\s])/,rDelimUnd:/^[^_*]*?\*\*[^_*]*?_[^_*]*?(?=\*\*)|[^_]+(?=[^_])|(?!_)[punct](_+)(?=[\s]|$)|[^punct\s](_+)(?!_)(?=[punct\s]|$)|(?!_)[punct\s](_+)(?=[^punct\s])|[\s](_+)(?!_)(?=[punct])|(?!_)[punct](_+)(?!_)(?=[punct])/},code:/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,br:/^( {2,}|\\)\n(?!\s*$)/,del:K,text:/^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\.5?"x"+e.charCodeAt(n).toString(16):e.charCodeAt(n).toString())+";"}return t}ne._punctuation="\\p{P}$+<=>`^|~",ne.punctuation=j(ne.punctuation,"u").replace(/punctuation/g,ne._punctuation).getRegex(),ne.blockSkip=/\[[^[\]]*?\]\([^\(\)]*?\)|`[^`]*?`|<[^<>]*?>/g,ne.anyPunctuation=/\\[punct]/g,ne._escapes=/\\([punct])/g,ne._comment=j(te._comment).replace("(?:--\x3e|$)","--\x3e").getRegex(),ne.emStrong.lDelim=j(ne.emStrong.lDelim,"u").replace(/punct/g,ne._punctuation).getRegex(),ne.emStrong.rDelimAst=j(ne.emStrong.rDelimAst,"gu").replace(/punct/g,ne._punctuation).getRegex(),ne.emStrong.rDelimUnd=j(ne.emStrong.rDelimUnd,"gu").replace(/punct/g,ne._punctuation).getRegex(),ne.anyPunctuation=j(ne.anyPunctuation,"gu").replace(/punct/g,ne._punctuation).getRegex(),ne._escapes=j(ne._escapes,"gu").replace(/punct/g,ne._punctuation).getRegex(),ne._scheme=/[a-zA-Z][a-zA-Z0-9+.-]{1,31}/,ne._email=/[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+(@)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)+(?![-_])/,ne.autolink=j(ne.autolink).replace("scheme",ne._scheme).replace("email",ne._email).getRegex(),ne._attribute=/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/,ne.tag=j(ne.tag).replace("comment",ne._comment).replace("attribute",ne._attribute).getRegex(),ne._label=/(?:\[(?:\\.|[^\[\]\\])*\]|\\.|`[^`]*`|[^\[\]\\`])*?/,ne._href=/<(?:\\.|[^\n<>\\])+>|[^\s\x00-\x1f]*/,ne._title=/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/,ne.link=j(ne.link).replace("label",ne._label).replace("href",ne._href).replace("title",ne._title).getRegex(),ne.reflink=j(ne.reflink).replace("label",ne._label).replace("ref",te._label).getRegex(),ne.nolink=j(ne.nolink).replace("ref",te._label).getRegex(),ne.reflinkSearch=j(ne.reflinkSearch,"g").replace("reflink",ne.reflink).replace("nolink",ne.nolink).getRegex(),ne.normal=__spreadValues({},ne),ne.pedantic=__spreadProps(__spreadValues({},ne.normal),{strong:{start:/^__|\*\*/,middle:/^__(?=\S)([\s\S]*?\S)__(?!_)|^\*\*(?=\S)([\s\S]*?\S)\*\*(?!\*)/,endAst:/\*\*(?!\*)/g,endUnd:/__(?!_)/g},em:{start:/^_|\*/,middle:/^()\*(?=\S)([\s\S]*?\S)\*(?!\*)|^_(?=\S)([\s\S]*?\S)_(?!_)/,endAst:/\*(?!\*)/g,endUnd:/_(?!_)/g},link:j(/^!?\[(label)\]\((.*?)\)/).replace("label",ne._label).getRegex(),reflink:j(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label",ne._label).getRegex()}),ne.gfm=__spreadProps(__spreadValues({},ne.normal),{escape:j(ne.escape).replace("])","~|])").getRegex(),_extended_email:/[A-Za-z0-9._+-]+(@)[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![-_])/,url:/^((?:ftp|https?):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/,_backpedal:/(?:[^?!.,:;*_'"~()&]+|\([^)]*\)|&(?![a-zA-Z0-9]+;$)|[?!.,:;*_'"~)]+(?!$))+/,del:/^(~~?)(?=[^\s~])([\s\S]*?[^\s~])\1(?=[^~]|$)/,text:/^([`~]+|[^`~])(?:(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\t+" ".repeat(n.length)));e;)if(!(this.options.extensions&&this.options.extensions.block&&this.options.extensions.block.some((i=>!!(n=i.call({lexer:this},e,t))&&(e=e.substring(n.raw.length),t.push(n),!0)))))if(n=this.tokenizer.space(e))e=e.substring(n.raw.length),1===n.raw.length&&t.length>0?t[t.length-1].raw+="\n":t.push(n);else if(n=this.tokenizer.code(e))e=e.substring(n.raw.length),i=t[t.length-1],!i||"paragraph"!==i.type&&"text"!==i.type?t.push(n):(i.raw+="\n"+n.raw,i.text+="\n"+n.text,this.inlineQueue[this.inlineQueue.length-1].src=i.text);else if(n=this.tokenizer.fences(e))e=e.substring(n.raw.length),t.push(n);else if(n=this.tokenizer.heading(e))e=e.substring(n.raw.length),t.push(n);else if(n=this.tokenizer.hr(e))e=e.substring(n.raw.length),t.push(n);else if(n=this.tokenizer.blockquote(e))e=e.substring(n.raw.length),t.push(n);else if(n=this.tokenizer.list(e))e=e.substring(n.raw.length),t.push(n);else if(n=this.tokenizer.html(e))e=e.substring(n.raw.length),t.push(n);else if(n=this.tokenizer.def(e))e=e.substring(n.raw.length),i=t[t.length-1],!i||"paragraph"!==i.type&&"text"!==i.type?this.tokens.links[n.tag]||(this.tokens.links[n.tag]={href:n.href,title:n.title}):(i.raw+="\n"+n.raw,i.text+="\n"+n.raw,this.inlineQueue[this.inlineQueue.length-1].src=i.text);else if(n=this.tokenizer.table(e))e=e.substring(n.raw.length),t.push(n);else if(n=this.tokenizer.lheading(e))e=e.substring(n.raw.length),t.push(n);else{if(s=e,this.options.extensions&&this.options.extensions.startBlock){let t=1/0;const n=e.slice(1);let i;this.options.extensions.startBlock.forEach((e=>{i=e.call({lexer:this},n),"number"==typeof i&&i>=0&&(t=Math.min(t,i))})),t<1/0&&t>=0&&(s=e.substring(0,t+1))}if(this.state.top&&(n=this.tokenizer.paragraph(s)))i=t[t.length-1],r&&"paragraph"===i.type?(i.raw+="\n"+n.raw,i.text+="\n"+n.text,this.inlineQueue.pop(),this.inlineQueue[this.inlineQueue.length-1].src=i.text):t.push(n),r=s.length!==e.length,e=e.substring(n.raw.length);else if(n=this.tokenizer.text(e))e=e.substring(n.raw.length),i=t[t.length-1],i&&"text"===i.type?(i.raw+="\n"+n.raw,i.text+="\n"+n.text,this.inlineQueue.pop(),this.inlineQueue[this.inlineQueue.length-1].src=i.text):t.push(n);else if(e){const t="Infinite loop on byte: "+e.charCodeAt(0);if(this.options.silent){console.error(t);break}throw new Error(t)}}return this.state.top=!0,t}inline(e,t=[]){return this.inlineQueue.push({src:e,tokens:t}),t}inlineTokens(e,t=[]){let n,i,s,r,a,o,l=e;if(this.tokens.links){const e=Object.keys(this.tokens.links);if(e.length>0)for(;null!=(r=this.tokenizer.rules.inline.reflinkSearch.exec(l));)e.includes(r[0].slice(r[0].lastIndexOf("[")+1,-1))&&(l=l.slice(0,r.index)+"["+"a".repeat(r[0].length-2)+"]"+l.slice(this.tokenizer.rules.inline.reflinkSearch.lastIndex))}for(;null!=(r=this.tokenizer.rules.inline.blockSkip.exec(l));)l=l.slice(0,r.index)+"["+"a".repeat(r[0].length-2)+"]"+l.slice(this.tokenizer.rules.inline.blockSkip.lastIndex);for(;null!=(r=this.tokenizer.rules.inline.anyPunctuation.exec(l));)l=l.slice(0,r.index)+"++"+l.slice(this.tokenizer.rules.inline.anyPunctuation.lastIndex);for(;e;)if(a||(o=""),a=!1,!(this.options.extensions&&this.options.extensions.inline&&this.options.extensions.inline.some((i=>!!(n=i.call({lexer:this},e,t))&&(e=e.substring(n.raw.length),t.push(n),!0)))))if(n=this.tokenizer.escape(e))e=e.substring(n.raw.length),t.push(n);else if(n=this.tokenizer.tag(e))e=e.substring(n.raw.length),i=t[t.length-1],i&&"text"===n.type&&"text"===i.type?(i.raw+=n.raw,i.text+=n.text):t.push(n);else if(n=this.tokenizer.link(e))e=e.substring(n.raw.length),t.push(n);else if(n=this.tokenizer.reflink(e,this.tokens.links))e=e.substring(n.raw.length),i=t[t.length-1],i&&"text"===n.type&&"text"===i.type?(i.raw+=n.raw,i.text+=n.text):t.push(n);else if(n=this.tokenizer.emStrong(e,l,o))e=e.substring(n.raw.length),t.push(n);else if(n=this.tokenizer.codespan(e))e=e.substring(n.raw.length),t.push(n);else if(n=this.tokenizer.br(e))e=e.substring(n.raw.length),t.push(n);else if(n=this.tokenizer.del(e))e=e.substring(n.raw.length),t.push(n);else if(n=this.tokenizer.autolink(e,se))e=e.substring(n.raw.length),t.push(n);else if(this.state.inLink||!(n=this.tokenizer.url(e,se))){if(s=e,this.options.extensions&&this.options.extensions.startInline){let t=1/0;const n=e.slice(1);let i;this.options.extensions.startInline.forEach((e=>{i=e.call({lexer:this},n),"number"==typeof i&&i>=0&&(t=Math.min(t,i))})),t<1/0&&t>=0&&(s=e.substring(0,t+1))}if(n=this.tokenizer.inlineText(s,ie))e=e.substring(n.raw.length),"_"!==n.raw.slice(-1)&&(o=n.raw.slice(-1)),a=!0,i=t[t.length-1],i&&"text"===i.type?(i.raw+=n.raw,i.text+=n.text):t.push(n);else if(e){const t="Infinite loop on byte: "+e.charCodeAt(0);if(this.options.silent){console.error(t);break}throw new Error(t)}}else e=e.substring(n.raw.length),t.push(n);return t}}class ae{constructor(e){__publicField(this,"options"),this.options=e||A}code(e,t,n){var i;const s=null==(i=(t||"").match(/^\S*/))?void 0:i[0];if(this.options.highlight){const t=this.options.highlight(e,s);null!=t&&t!==e&&(n=!0,e=t)}return e=e.replace(/\n$/,"")+"\n",s?'
'+(n?e:U(e,!0))+"
\n":"
"+(n?e:U(e,!0))+"
\n"}blockquote(e){return`
\n${e}
\n`}html(e,t){return e}heading(e,t,n,i){if(this.options.headerIds){return`${e}\n`}return`${e}\n`}hr(){return this.options.xhtml?"
\n":"
\n"}list(e,t,n){const i=t?"ol":"ul";return"<"+i+(t&&1!==n?' start="'+n+'"':"")+">\n"+e+"\n"}listitem(e,t,n){return`
  • ${e}
  • \n`}checkbox(e){return" "}paragraph(e){return`

    ${e}

    \n`}table(e,t){return t&&(t=`${t}`),"\n\n"+e+"\n"+t+"
    \n"}tablerow(e){return`\n${e}\n`}tablecell(e,t){const n=t.header?"th":"td";return(t.align?`<${n} align="${t.align}">`:`<${n}>`)+e+`\n`}strong(e){return`${e}`}em(e){return`${e}`}codespan(e){return`${e}`}br(){return this.options.xhtml?"
    ":"
    "}del(e){return`${e}`}link(e,t,n){const i=H(this.options.sanitize,this.options.baseUrl,e);if(null===i)return n;let s='",s}image(e,t,n){const i=H(this.options.sanitize,this.options.baseUrl,e);if(null===i)return n;let s=`${n}":">",s}text(e){return e}}class oe{strong(e){return e}em(e){return e}codespan(e){return e}del(e){return e}html(e){return e}text(e){return e}link(e,t,n){return""+n}image(e,t,n){return""+n}br(){return""}}class le{constructor(){__publicField(this,"seen"),this.seen={}}serialize(e){return e.toLowerCase().trim().replace(/<[!\/a-z].*?>/gi,"").replace(/[\u2000-\u206F\u2E00-\u2E7F\\'!"#$%&()*+,./:;<=>?@[\]^`{|}~]/g,"").replace(/\s/g,"-")}getNextSafeSlug(e,t){let n=e,i=0;if(this.seen.hasOwnProperty(n)){i=this.seen[e];do{i++,n=e+"-"+i}while(this.seen.hasOwnProperty(n))}return t||(this.seen[e]=i,this.seen[n]=0),n}slug(e,t={}){const n=this.serialize(e);return this.getNextSafeSlug(n,t.dryrun)}}class ce{constructor(e){__publicField(this,"options"),__publicField(this,"renderer"),__publicField(this,"textRenderer"),__publicField(this,"slugger"),this.options=e||A,this.options.renderer=this.options.renderer||new ae,this.renderer=this.options.renderer,this.renderer.options=this.options,this.textRenderer=new oe,this.slugger=new le}static parse(e,t){return new ce(t).parse(e)}static parseInline(e,t){return new ce(t).parseInline(e)}parse(e,t=!0){let n="";for(let i=0;i0&&"paragraph"===t.tokens[0].type?(t.tokens[0].text=e+" "+t.tokens[0].text,t.tokens[0].tokens&&t.tokens[0].tokens.length>0&&"text"===t.tokens[0].tokens[0].type&&(t.tokens[0].tokens[0].text=e+" "+t.tokens[0].tokens[0].text)):t.tokens.unshift({type:"text",text:e}):o+=e}o+=this.parse(t.tokens,r),a+=this.renderer.listitem(o,s,!!i)}n+=this.renderer.list(a,t,i);continue}case"html":{const e=s;n+=this.renderer.html(e.text,e.block);continue}case"paragraph":{const e=s;n+=this.renderer.paragraph(this.parseInline(e.tokens));continue}case"text":{let r=s,a=r.tokens?this.parseInline(r.tokens):r.text;for(;i+1{"function"==typeof r&&(a=r,r=null);const o=__spreadValues({},r),l=__spreadValues(__spreadValues({},this.defaults),o);!0===this.defaults.async&&!1===o.async&&(l.silent||console.warn("marked(): The async option was set to true by an extension. The async: false option sent to parse will be ignored."),l.async=!0);const c=__privateMethod(this,n,i).call(this,!!l.silent,!!l.async,a);if(null==s)return c(new Error("marked(): input parameter is undefined or null"));if("string"!=typeof s)return c(new Error("marked(): input parameter is of type "+Object.prototype.toString.call(s)+", string expected"));if(function(e,t){e&&!e.silent&&(t&&console.warn("marked(): callback is deprecated since version 5.0.0, should not be used and will be removed in the future. Read more here: https://marked.js.org/using_pro#async"),(e.sanitize||e.sanitizer)&&console.warn("marked(): sanitize and sanitizer parameters are deprecated since version 0.7.0, should not be used and will be removed in the future. Read more here: https://marked.js.org/#/USING_ADVANCED.md#options"),(e.highlight||"language-"!==e.langPrefix)&&console.warn("marked(): highlight and langPrefix parameters are deprecated since version 5.0.0, should not be used and will be removed in the future. Instead use https://www.npmjs.com/package/marked-highlight."),e.mangle&&console.warn("marked(): mangle parameter is enabled by default, but is deprecated since version 5.0.0, and will be removed in the future. To clear this warning, install https://www.npmjs.com/package/marked-mangle, or disable by setting `{mangle: false}`."),e.baseUrl&&console.warn("marked(): baseUrl parameter is deprecated since version 5.0.0, should not be used and will be removed in the future. Instead use https://www.npmjs.com/package/marked-base-url."),e.smartypants&&console.warn("marked(): smartypants parameter is deprecated since version 5.0.0, should not be used and will be removed in the future. Instead use https://www.npmjs.com/package/marked-smartypants."),e.xhtml&&console.warn("marked(): xhtml parameter is deprecated since version 5.0.0, should not be used and will be removed in the future. Instead use https://www.npmjs.com/package/marked-xhtml."),(e.headerIds||e.headerPrefix)&&console.warn("marked(): headerIds and headerPrefix parameters enabled by default, but are deprecated since version 5.0.0, and will be removed in the future. To clear this warning, install https://www.npmjs.com/package/marked-gfm-heading-id, or disable by setting `{headerIds: false}`."))}(l,a),l.hooks&&(l.hooks.options=l),a){const n=a,i=l.highlight;let r;try{l.hooks&&(s=l.hooks.preprocess(s)),r=e(s,l)}catch(d){return c(d)}const o=e=>{let s;if(!e)try{l.walkTokens&&this.walkTokens(r,l.walkTokens),s=t(r,l),l.hooks&&(s=l.hooks.postprocess(s))}catch(d){e=d}return l.highlight=i,e?c(e):n(null,s)};if(!i||i.length<3)return o();if(delete l.highlight,!r.length)return o();let h=0;return this.walkTokens(r,(e=>{"code"===e.type&&(h++,setTimeout((()=>{i(e.text,e.lang,((t,n)=>{if(t)return o(t);null!=n&&n!==e.text&&(e.text=n,e.escaped=!0),h--,0===h&&o()}))}),0))})),void(0===h&&o())}if(l.async)return Promise.resolve(l.hooks?l.hooks.preprocess(s):s).then((t=>e(t,l))).then((e=>l.walkTokens?Promise.all(this.walkTokens(e,l.walkTokens)).then((()=>e)):e)).then((e=>t(e,l))).then((e=>l.hooks?l.hooks.postprocess(e):e)).catch(c);try{l.hooks&&(s=l.hooks.preprocess(s));const n=e(s,l);l.walkTokens&&this.walkTokens(n,l.walkTokens);let i=t(n,l);return l.hooks&&(i=l.hooks.postprocess(i)),i}catch(d){return c(d)}}},n=new WeakSet,i=function(e,t,n){return i=>{if(i.message+="\nPlease report this to https://github.com/markedjs/marked.",e){const e="

    An error occurred:

    "+U(i.message+"",!0)+"
    ";return t?Promise.resolve(e):n?void n(null,e):e}if(t)return Promise.reject(i);if(!n)throw i;n(i)}};const he=new class{constructor(...i){__privateAdd(this,e),__privateAdd(this,n),__publicField(this,"defaults",{async:!1,baseUrl:null,breaks:!1,extensions:null,gfm:!0,headerIds:!1,headerPrefix:"",highlight:null,hooks:null,langPrefix:"language-",mangle:!1,pedantic:!1,renderer:null,sanitize:!1,sanitizer:null,silent:!1,smartypants:!1,tokenizer:null,walkTokens:null,xhtml:!1}),__publicField(this,"options",this.setOptions),__publicField(this,"parse",__privateMethod(this,e,t).call(this,re.lex,ce.parse)),__publicField(this,"parseInline",__privateMethod(this,e,t).call(this,re.lexInline,ce.parseInline)),__publicField(this,"Parser",ce),__publicField(this,"parser",ce.parse),__publicField(this,"Renderer",ae),__publicField(this,"TextRenderer",oe),__publicField(this,"Lexer",re),__publicField(this,"lexer",re.lex),__publicField(this,"Tokenizer",ee),__publicField(this,"Slugger",le),__publicField(this,"Hooks",de),this.use(...i)}walkTokens(e,t){var n,i;let s=[];for(const r of e)switch(s=s.concat(t.call(this,r)),r.type){case"table":{const e=r;for(const n of e.header)s=s.concat(this.walkTokens(n.tokens,t));for(const n of e.rows)for(const e of n)s=s.concat(this.walkTokens(e.tokens,t));break}case"list":{const e=r;s=s.concat(this.walkTokens(e.items,t));break}default:{const e=r;(null==(i=null==(n=this.defaults.extensions)?void 0:n.childTokens)?void 0:i[e.type])?this.defaults.extensions.childTokens[e.type].forEach((n=>{s=s.concat(this.walkTokens(e[n],t))})):e.tokens&&(s=s.concat(this.walkTokens(e.tokens,t)))}}return s}use(...e){const t=this.defaults.extensions||{renderers:{},childTokens:{}};return e.forEach((e=>{const n=__spreadValues({},e);if(n.async=this.defaults.async||n.async||!1,e.extensions&&(e.extensions.forEach((e=>{if(!e.name)throw new Error("extension name required");if("renderer"in e){const n=t.renderers[e.name];t.renderers[e.name]=n?function(...t){let i=e.renderer.apply(this,t);return!1===i&&(i=n.apply(this,t)),i}:e.renderer}if("tokenizer"in e){if(!e.level||"block"!==e.level&&"inline"!==e.level)throw new Error("extension level must be 'block' or 'inline'");const n=t[e.level];n?n.unshift(e.tokenizer):t[e.level]=[e.tokenizer],e.start&&("block"===e.level?t.startBlock?t.startBlock.push(e.start):t.startBlock=[e.start]:"inline"===e.level&&(t.startInline?t.startInline.push(e.start):t.startInline=[e.start]))}"childTokens"in e&&e.childTokens&&(t.childTokens[e.name]=e.childTokens)})),n.extensions=t),e.renderer){const t=this.defaults.renderer||new ae(this.defaults);for(const n in e.renderer){const i=e.renderer[n],s=n,r=t[s];t[s]=(...e)=>{let n=i.apply(t,e);return!1===n&&(n=r.apply(t,e)),n||""}}n.renderer=t}if(e.tokenizer){const t=this.defaults.tokenizer||new ee(this.defaults);for(const n in e.tokenizer){const i=e.tokenizer[n],s=n,r=t[s];t[s]=(...e)=>{let n=i.apply(t,e);return!1===n&&(n=r.apply(t,e)),n}}n.tokenizer=t}if(e.hooks){const t=this.defaults.hooks||new de;for(const n in e.hooks){const i=e.hooks[n],s=n,r=t[s];de.passThroughHooks.has(n)?t[s]=e=>{if(this.defaults.async)return Promise.resolve(i.call(t,e)).then((e=>r.call(t,e)));const n=i.call(t,e);return r.call(t,n)}:t[s]=(...e)=>{let n=i.apply(t,e);return!1===n&&(n=r.apply(t,e)),n}}n.hooks=t}if(e.walkTokens){const t=this.defaults.walkTokens,i=e.walkTokens;n.walkTokens=function(e){let n=[];return n.push(i.call(this,e)),t&&(n=n.concat(t.call(this,e))),n}}this.defaults=__spreadValues(__spreadValues({},this.defaults),n)})),this}setOptions(e){return this.defaults=__spreadValues(__spreadValues({},this.defaults),e),this}};function ue(e,t,n){return he.parse(e,t,n)}ue.options=ue.setOptions=function(e){return he.setOptions(e),ue.defaults=he.defaults,F(ue.defaults),ue},ue.getDefaults=L,ue.defaults=A,ue.use=function(...e){return he.use(...e),ue.defaults=he.defaults,F(ue.defaults),ue},ue.walkTokens=function(e,t){return he.walkTokens(e,t)},ue.parseInline=he.parseInline,ue.Parser=ce,ue.parser=ce.parse,ue.Renderer=ae,ue.TextRenderer=oe,ue.Lexer=re,ue.lexer=re.lex,ue.Tokenizer=ee,ue.Slugger=le,ue.Hooks=de,ue.parse=ue,ue.options,ue.setOptions,ue.use,ue.walkTokens,ue.parseInline;var pe="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function me(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var ge={"&":"&","<":"<",">":">",'"':""","'":"'"},fe={"&":"&","<":"<",">":">",""":'"',"'":"'"},ke=/(&|<|>|"|')/g,ye=/[&<>"']/g;function be(e){return ge[e]}function _e(e){return fe[e]}function $e(e){return null==e?"":String(e).replace(ye,be)}function xe(e){return null==e?"":String(e).replace(ke,_e)}$e.options=xe.options={};var ve={encode:$e,escape:$e,decode:xe,unescape:xe,version:"1.0.0-browser"};var we=function e(t){for(var n,i,s=Array.prototype.slice.call(arguments,1);s.length;)for(i in n=s.shift())n.hasOwnProperty(i)&&("[object Object]"===Object.prototype.toString.call(t[i])?t[i]=e(t[i],n[i]):t[i]=n[i]);return t},Ce=function(e){return"string"==typeof e?e.toLowerCase():e};function Se(e,t){return e[t]=!0,e}var Te=function(e){return e.reduce(Se,{})},Ee={uris:Te(["background","base","cite","href","longdesc","src","usemap"])},Le={voids:Te(["area","br","col","hr","img","wbr","input","base","basefont","link","meta"])},Ae=ve,Fe=Ce,Oe=Le,Me=/^<\s*([\w:-]+)((?:\s+[\w:-]+(?:\s*=\s*(?:(?:"[^"]*")|(?:'[^']*')|[^>\s]+))?)*)\s*(\/?)\s*>/,Re=/^<\s*\/\s*([\w:-]+)[^>]*>/,Pe=/([\w:-]+)(?:\s*=\s*(?:(?:"((?:[^"])*)")|(?:'((?:[^'])*)')|([^>\s]+)))?/g,Be=/^=0&&(t.comment&&t.comment(e.substring(4,i)),e=e.substring(i+3),n=!1):Ie.test(e)?a(Re,l):Be.test(e)&&a(Me,o);var i;!function(){if(!n)return;var i,s=e.indexOf("<");s>=0?(i=e.substring(0,s),e=e.substring(s)):(i=e,e="");t.chars&&t.chars(i)}()}();var i=e===s;s=e,i&&(e="")}function a(t,i){var s=e.match(t);s&&(e=e.substring(s[0].length),s[0].replace(t,i),n=!1)}function o(e,n,s,r){var a={},o=Fe(n),l=Oe.voids[o]||!!r;s.replace(Pe,(function(e,t,n,i,s){a[t]=void 0===n&&void 0===i&&void 0===s?void 0:Ae.decode(n||i||s||"")})),l||i.push(o),t.start&&t.start(o,a,l)}function l(e,n){var s,r=0,a=Fe(n);if(a)for(r=i.length-1;r>=0&&i[r]!==a;r--);if(r>=0){for(s=i.length-1;s>=r;s--)t.end&&t.end(i[s]);i.length=r}}l()},Ne=function(e,t){var n,i=t||{};return o(),{start:function(e,t,a){var o=De(e);if(n.ignoring)return void r(o);if(-1===(i.allowedTags||[]).indexOf(o))return void r(o);if(i.filter&&!i.filter({tag:o,attrs:t}))return void r(o);s("<"),s(o),Object.keys(t).forEach((function(e){var n=t[e],r=(i.allowedClasses||{})[o]||[],a=(i.allowedAttributes||{})[o]||[],l=De(e);("class"===l&&-1===a.indexOf(l)?(n=n.split(" ").filter((function(e){return r&&-1!==r.indexOf(e)})).join(" ").trim()).length:-1!==a.indexOf(l)&&(!0!==qe.uris[l]||function(e){var t=e[0];if("#"===t||"/"===t)return!0;var n=e.indexOf(":");if(-1===n)return!0;var s=e.indexOf("?");if(-1!==s&&n>s)return!0;var r=e.indexOf("#");return-1!==r&&n>r||i.allowedSchemes.some(a);function a(t){return 0===e.indexOf(t+":")}}(n)))&&(s(" "),s(e),"string"==typeof n&&(s('="'),s(Ue.encode(n)),s('"')))})),s(a?"/>":">")},end:function(e){var t=De(e);-1!==(i.allowedTags||[]).indexOf(t)&&!1===n.ignoring?(s("")):a(t)},chars:function(e){!1===n.ignoring&&s(i.transformText?i.transformText(e):e)}};function s(t){e.push(t)}function r(e){ze.voids[e]||(!1===n.ignoring?n={ignoring:e,depth:1}:n.ignoring===e&&n.depth++)}function a(e){n.ignoring===e&&--n.depth<=0&&o()}function o(){n={ignoring:!1,depth:0}}},He={allowedAttributes:{a:["href","name","target","title","aria-label"],iframe:["allowfullscreen","frameborder","src"],img:["src","alt","title","aria-label"]},allowedClasses:{},allowedSchemes:["http","https","mailto"],allowedTags:["a","abbr","article","b","blockquote","br","caption","code","del","details","div","em","h1","h2","h3","h4","h5","h6","hr","i","img","ins","kbd","li","main","mark","ol","p","pre","section","span","strike","strong","sub","summary","sup","table","tbody","td","th","thead","tr","u","ul"],filter:null};function Ve(e,t,n){var i=[],s=!0===n?t:je({},He,t),r=Ne(i,s);return We(e,r),i.join("")}Ve.defaults=He;const Qe=me(Ve);var Ze={exports:{}};Ze.exports=function(){function e(e,t){return e(t={exports:{}},t.exports),t.exports}var t=e((function(e){var t=e.exports=function(){return new RegExp("(?:"+t.line().source+")|(?:"+t.block().source+")","gm")};t.line=function(){return/(?:^|\s)\/\/(.+?)$/gm},t.block=function(){return/\/\*([\S\s]*?)\*\//gm}})),n=["23AC69","91C132","F19726","E8552D","1AAB8E","E1147F","2980C1","1BA1E6","9FA0A0","F19726","E30B20","E30B20","A3338B"];function i(e){return''+e+""}return function(e,s){void 0===s&&(s={});var r=s.colors;void 0===r&&(r=n);var a=0,o={},l=new RegExp("("+/[\u4E00-\u9FFF\u3400-\u4dbf\uf900-\ufaff\u3040-\u309f\uac00-\ud7af\u0400-\u04FF]+|\w+/.source+"|"+/'+t+"";return a=++a%r.length,l}))}}();const Ge=me(Ze.exports);let Ke;function Ye(){return Ke}function Xe(e,t){var n;let i=null==(n=Ye())?void 0:n.parse(t);i||(i=t.replace(/```\s*([^]+?.*?[^]+?[^]+?)```/g,((e,t)=>`
    ${Ge(t)}
    `)).replace(/!\[(.*?)\]\((.*?)\)/g,((e,t,n)=>`${t}`)).replace(/\[(.*?)\]\((.*?)\)/g,((e,t,n)=>`
    ${t}`)).replace(/\n/g,"
    "));let s=Qe(i,{allowedClasses:{},allowedSchemes:["http","https","mailto","data"],allowedTags:["a","abbr","article","b","blockquote","br","caption","code","del","details","div","em","h1","h2","h3","h4","h5","h6","hr","i","img","ins","kbd","li","main","mark","ol","p","pre","section","span","strike","strong","sub","summary","sup","table","tbody","td","th","thead","tr","u","ul"],allowedAttributes:{"*":["title","accesskey"],a:["href","name","target","aria-label","rel"],img:["src","alt","title","atk-emoticon","aria-label"],code:["class"],span:["class","style"]},filter:e=>([["code",/^hljs\W+language-(.*)$/],["span",/^(hljs-.*)$/]].forEach((([t,n])=>{e.tag===t&&e.attrs.class&&!n.test(e.attrs.class)&&delete e.attrs.class})),"span"===e.tag&&e.attrs.style&&!/^color:(\W+)?#[0-9a-f]{3,6};?$/i.test(e.attrs.style)&&delete e.attrs.style,!0)});return e.markedReplacers.forEach((e=>{"function"==typeof e&&(s=e(s))})),s}const Je={placeholder:"Leave a comment",noComment:"No Comment",send:"Send",save:"Save",nick:"Nickname",email:"Email",link:"Website",emoticon:"Emoji",preview:"Preview",image:"Image",uploadFail:"Upload Failed",commentFail:"Failed to comment",restoredMsg:"Content has been restored",onlyAdminCanReply:"Only admin can reply",uploadLoginMsg:"Please fill in your name and email to upload",counter:"{count} Comments",sortLatest:"Latest",sortOldest:"Oldest",sortBest:"Best",sortAuthor:"Author",openComment:"Open Comment",closeComment:"Close Comment",listLoadFailMsg:"Failed to load comments",listRetry:"Click to retry",loadMore:"Load More",admin:"Admin",reply:"Reply",voteUp:"Up",voteDown:"Down",voteFail:"Vote Failed",readMore:"Read More",actionConfirm:"Confirm",collapse:"Collapse",collapsed:"Collapsed",collapsedMsg:"This comment has been collapsed",expand:"Expand",approved:"Approved",pending:"Pending",pendingMsg:"Pending, visible only to commenter.",edit:"Edit",editCancel:"Cancel Edit",delete:"Delete",deleteConfirm:"Confirm",pin:"Pin",unpin:"Unpin",seconds:"seconds ago",minutes:"minutes ago",hours:"hours ago",days:"days ago",now:"just now",adminCheck:"Enter admin password:",captchaCheck:"Enter the CAPTCHA to continue:",confirm:"Confirm",cancel:"Cancel",msgCenter:"Messages",ctrlCenter:"Admin",frontend:"Frontend",backend:"Backend",loading:"Loading",loadFail:"Load Failed",editing:"Editing",editFail:"Edit Failed",deleting:"Deleting",deleteFail:"Delete Failed",reqGot:"Request got",reqAborted:"Request timed out or terminated unexpectedly"},et="ArtalkI18n",tt={en:Je,"en-US":Je,"zh-CN":{placeholder:"键入内容...",noComment:"「此时无声胜有声」",send:"发送评论",save:"保存评论",nick:"昵称",email:"邮箱",link:"网址",emoticon:"表情",preview:"预览",image:"图片",uploadFail:"上传失败",commentFail:"评论失败",restoredMsg:"内容已自动恢复",onlyAdminCanReply:"仅管理员可评论",uploadLoginMsg:"填入你的名字邮箱才能上传哦",counter:"{count} 条评论",sortLatest:"最新",sortOldest:"最早",sortBest:"最热",sortAuthor:"作者",openComment:"打开评论",closeComment:"关闭评论",listLoadFailMsg:"无法获取评论列表数据",listRetry:"点击重新获取",loadMore:"加载更多",admin:"管理员",reply:"回复",voteUp:"赞同",voteDown:"反对",voteFail:"投票失败",readMore:"阅读更多",actionConfirm:"确认操作",collapse:"折叠",collapsed:"已折叠",collapsedMsg:"该评论已被系统或管理员折叠",expand:"展开",approved:"已审",pending:"待审",pendingMsg:"审核中,仅本人可见。",edit:"编辑",editCancel:"取消编辑",delete:"删除",deleteConfirm:"确认删除",pin:"置顶",unpin:"取消置顶",seconds:"秒前",minutes:"分钟前",hours:"小时前",days:"天前",now:"刚刚",adminCheck:"键入密码来验证管理员身份:",captchaCheck:"键入验证码继续:",confirm:"确认",cancel:"取消",msgCenter:"通知中心",ctrlCenter:"控制中心",frontend:"前端",backend:"后端",loading:"加载中",loadFail:"加载失败",editing:"修改中",editFail:"修改失败",deleting:"删除中",deleteFail:"删除失败",reqGot:"请求响应",reqAborted:"请求超时或意外终止"}};function nt(e){return e=e.replace(/^([a-zA-Z]+)(-[a-zA-Z]+)?$/,((e,t,n)=>t.toLowerCase()+(n||"").toUpperCase())),tt[e]?tt[e]:window[et]&&window[et][e]?window[et][e]:tt.en}let it="en",st=nt(it);function rt(e){e!==it&&(it=e,st="string"==typeof e?nt(e):e)}function at(e,t={}){let n=(null==st?void 0:st[e])||e;return n=n.replace(/\{\s*(\w+?)\s*\}/g,((e,n)=>t[n]||"")),n}const ot="2.6.3";const lt=new class{constructor(){__publicField(this,"ctx"),__publicField(this,"data");const e=JSON.parse(window.localStorage.getItem("ArtalkUser")||"{}");this.data={nick:e.nick||"",email:e.email||"",link:e.link||"",token:e.token||"",isAdmin:e.isAdmin||!1}}setContext(e){this.ctx=e}update(e={}){var t;Object.entries(e).forEach((([e,t])=>{this.data[e]=t})),window.localStorage.setItem("ArtalkUser",JSON.stringify(this.data)),null==(t=this.ctx)||t.trigger("user-changed",this.data)}logout(){this.update({token:"",isAdmin:!1})}checkHasBasicUserInfo(){return!!this.data.nick&&!!this.data.email}},ct=window||{},dt=navigator||{};class ht{constructor(e){__publicField(this,"comment"),__publicField(this,"$el"),__publicField(this,"$main"),__publicField(this,"$header"),__publicField(this,"$headerNick"),__publicField(this,"$headerBadgeWrap"),__publicField(this,"$body"),__publicField(this,"$content"),__publicField(this,"$childrenWrap"),__publicField(this,"$actions"),__publicField(this,"voteBtnUp"),__publicField(this,"voteBtnDown"),__publicField(this,"$replyTo"),__publicField(this,"$replyAt"),this.comment=e}get ctx(){return this.comment.ctx}get data(){return this.comment.getData()}get conf(){return this.comment.conf}get cConf(){return this.comment.getConf()}}function ut(e){if(e.$headerNick=e.$el.querySelector(".atk-nick"),e.data.link){const t=s('');t.innerText=e.data.nick,t.href=h(e.data.link)?e.data.link:`https://${e.data.link}`,e.$headerNick.append(t)}else e.$headerNick.innerText=e.data.nick}function pt(e){e.$headerBadgeWrap=e.$el.querySelector(".atk-badge-wrap"),e.$headerBadgeWrap.innerHTML="";const t=e.data.badge_name,n=e.data.badge_color;if(t){const i=s('');i.innerText=t.replace("管理员",e.ctx.$t("admin")),i.style.backgroundColor=n||"",e.$headerBadgeWrap.append(i)}if(e.data.is_pinned){const t=s(`${e.ctx.$t("pin")}`);e.$headerBadgeWrap.append(t)}}function mt(e){const t=e.$el.querySelector(".atk-date");t.innerText=e.comment.getDateFormatted(),t.setAttribute("data-atk-comment-date",String(+new Date(e.data.date)))}function gt(e){if(!e.ctx.conf.uaBadge&&!e.data.ip_region)return;let t=e.$header.querySelector("atk-ua-wrap");if(t||(t=s(''),e.$header.append(t)),t.innerHTML="",e.data.ip_region){const n=s('');n.innerText=e.data.ip_region,t.append(n)}if(e.ctx.conf.uaBadge){const{browser:n,os:i}=e.comment.getUserUA();if(String(n).trim()){const e=s('');e.innerText=n,t.append(e)}if(String(i).trim()){const e=s('');e.innerText=i,t.append(e)}}}class ft{constructor(e,t){__publicField(this,"ctx"),__publicField(this,"conf"),__publicField(this,"$el"),__publicField(this,"isLoading",!1),__publicField(this,"msgRecTimer"),__publicField(this,"msgRecTimerFunc"),__publicField(this,"isConfirming",!1),__publicField(this,"confirmRecTimer"),this.ctx=e,this.$el=s(''),this.conf="object"!=typeof t?{text:t}:t,this.$el.innerText=this.getText(),this.conf.adminOnly&&this.$el.setAttribute("atk-only-admin-show","")}get isMessaging(){return!!this.msgRecTimer}appendTo(e){return e.append(this.$el),this}getText(){return"string"==typeof this.conf.text?this.conf.text:this.conf.text()}setClick(e){this.$el.onclick=t=>{if(t.stopPropagation(),!this.isLoading){if(this.conf.confirm&&!this.isMessaging){const e=()=>{this.isConfirming=!1,this.$el.classList.remove("atk-btn-confirm"),this.$el.innerText=this.getText()};if(!this.isConfirming)return this.isConfirming=!0,this.$el.classList.add("atk-btn-confirm"),this.$el.innerText=this.conf.confirmText||this.ctx.$t("actionConfirm"),void(this.confirmRecTimer=window.setTimeout((()=>e()),5e3));this.confirmRecTimer&&window.clearTimeout(this.confirmRecTimer),e()}if(this.msgRecTimer)return this.fireMsgRecTimer(),void this.clearMsgRecTimer();e()}}}updateText(e){e&&(this.conf.text=e),this.setLoading(!1),this.$el.innerText=this.getText()}setLoading(e,t){this.isLoading!==e&&(this.isLoading=e,e?(this.$el.classList.add("atk-btn-loading"),this.$el.innerText=t||`${this.ctx.$t("loading")}...`):(this.$el.classList.remove("atk-btn-loading"),this.$el.innerText=this.getText()))}setError(e){this.setMsg(e,"atk-btn-error")}setWarn(e){this.setMsg(e,"atk-btn-warn")}setSuccess(e){this.setMsg(e,"atk-btn-success")}setMsg(e,t,n,i){this.setLoading(!1),t&&this.$el.classList.add(t),this.$el.innerText=e,this.setMsgRecTimer((()=>{this.$el.innerText=this.getText(),t&&this.$el.classList.remove(t),i&&i()}),n||2500)}setMsgRecTimer(e,t){this.fireMsgRecTimer(),this.clearMsgRecTimer(),this.msgRecTimerFunc=e,this.msgRecTimer=window.setTimeout((()=>{e(),this.clearMsgRecTimer()}),t)}fireMsgRecTimer(){this.msgRecTimerFunc&&this.msgRecTimerFunc()}clearMsgRecTimer(){this.msgRecTimer&&window.clearTimeout(this.msgRecTimer),this.msgRecTimer=void 0,this.msgRecTimerFunc=void 0}}function kt(e){e.ctx.conf.vote&&(e.voteBtnUp=new ft(e.ctx,(()=>`${e.ctx.$t("voteUp")} (${e.data.vote_up||0})`)).appendTo(e.$actions),e.voteBtnUp.setClick((()=>{e.comment.getActions().vote("up")})),e.ctx.conf.voteDown&&(e.voteBtnDown=new ft(e.ctx,(()=>`${e.ctx.$t("voteDown")} (${e.data.vote_down||0})`)).appendTo(e.$actions),e.voteBtnDown.setClick((()=>{e.comment.getActions().vote("down")}))))}function yt(e){if(!e.data.is_allow_reply)return;const t=s(`${e.ctx.$t("reply")}`);e.$actions.append(t),t.addEventListener("click",(t=>{t.stopPropagation(),e.cConf.onReplyBtnClick?e.cConf.onReplyBtnClick():e.ctx.replyComment(e.data,e.$el)}))}function bt(e){const t=new ft(e.ctx,{text:()=>e.data.is_collapsed?e.ctx.$t("expand"):e.ctx.$t("collapse"),adminOnly:!0});t.appendTo(e.$actions),t.setClick((()=>{e.comment.getActions().adminEdit("collapsed",t)}))}function _t(e){const t=new ft(e.ctx,{text:()=>e.data.is_pending?e.ctx.$t("pending"):e.ctx.$t("approved"),adminOnly:!0});t.appendTo(e.$actions),t.setClick((()=>{e.comment.getActions().adminEdit("pending",t)}))}function $t(e){const t=new ft(e.ctx,{text:()=>e.data.is_pinned?e.ctx.$t("unpin"):e.ctx.$t("pin"),adminOnly:!0});t.appendTo(e.$actions),t.setClick((()=>{e.comment.getActions().adminEdit("pinned",t)}))}function xt(e){const t=new ft(e.ctx,{text:e.ctx.$t("edit"),adminOnly:!0});t.appendTo(e.$actions),t.setClick((()=>{e.ctx.editComment(e.data,e.$el)}))}function vt(e){const t=new ft(e.ctx,{text:e.ctx.$t("delete"),confirm:!0,confirmText:e.ctx.$t("deleteConfirm"),adminOnly:!0});t.appendTo(e.$actions),t.setClick((()=>{e.comment.getActions().adminDelete(t)}))}const wt={Avatar:function(e){const t=e.$el.querySelector(".atk-avatar"),n=s(""),i=e.conf.avatarURLBuilder;if(n.src=i?i(e.data):e.comment.getGravatarURL(),e.data.link){const i=s('');i.href=h(e.data.link)?e.data.link:`https://${e.data.link}`,i.append(n),t.append(i)}else t.append(n)},Header:function(e){Object.entries({renderNick:ut,renderVerifyBadge:pt,renderDate:mt,renderUABadge:gt}).forEach((([t,n])=>{n(e)}))},Content:function(e){if(!e.data.is_collapsed)return e.$content.innerHTML=e.comment.getContentMarked(),void e.$content.classList.remove("atk-hide","atk-collapsed");e.$content.classList.add("atk-hide","atk-type-collapsed");const t=s(`\n
    \n ${e.ctx.$t("collapsedMsg")}\n ${e.ctx.$t("expand")}\n
    `);e.$body.insertAdjacentElement("beforeend",t);const n=t.querySelector(".atk-show-btn");n.addEventListener("click",(t=>{t.stopPropagation(),e.$content.classList.contains("atk-hide")?(e.$content.innerHTML=e.comment.getContentMarked(),e.$content.classList.remove("atk-hide"),b(e.$content),n.innerHTML=e.ctx.$t("collapse")):(e.$content.innerHTML="",e.$content.classList.add("atk-hide"),n.innerHTML=e.ctx.$t("expand"))}))},ReplyAt:function(e){e.cConf.isFlatMode||0===e.data.rid||e.cConf.replyTo&&(e.$replyAt=s(''),e.$replyAt.querySelector(".atk-nick").innerText=`${e.cConf.replyTo.nick}`,e.$replyAt.onclick=()=>{e.comment.getActions().goToReplyComment()},e.$headerBadgeWrap.insertAdjacentElement("afterend",e.$replyAt))},ReplyTo:function(e){if(!e.cConf.isFlatMode)return;if(!e.cConf.replyTo)return;e.$replyTo=s(`\n
    \n
    ${e.ctx.$t("reply")} :
    \n
    \n
    `);const t=e.$replyTo.querySelector(".atk-nick");t.innerText=`@${e.cConf.replyTo.nick}`,t.onclick=()=>{e.comment.getActions().goToReplyComment()};let n=Xe(e.ctx,e.cConf.replyTo.content);e.cConf.replyTo.is_collapsed&&(n=`[${e.ctx.$t("collapsed")}]`),e.$replyTo.querySelector(".atk-content").innerHTML=n,e.$body.prepend(e.$replyTo)},Pending:function(e){if(!e.data.is_pending)return;const t=s(`
    ${e.ctx.$t("pendingMsg")}
    `);e.$body.prepend(t)},Actions:function(e){Object.entries({renderVote:kt,renderReply:yt,renderCollapse:bt,renderModerator:_t,renderPin:$t,renderEdit:xt,renderDel:vt}).forEach((([t,n])=>{n(e)}))}};function Ct(e,t){t.forEach((({el:t,max:n,imgContains:i})=>{const a=()=>{t&&(e.scrollable?function(e){if(!e.el)return;if(e.el.classList.contains(Et))return;e.el.classList.add(Et),e.el.style.height=`${e.maxHeight}px`}({el:t,maxHeight:n}):function(e){if(!e.el)return;if(!e.maxHeight)return;if(e.el.classList.contains(St))return;e.el.classList.add(St),e.el.style.height=`${e.maxHeight}px`,e.el.style.overflow="hidden";const t=s(`
    ${at("readMore")}`);t.onclick=t=>{t.stopPropagation(),Tt(e.el),e.postBtnClick&&e.postBtnClick(t)},e.el.append(t)}({el:t,maxHeight:n,postBtnClick:e.postExpandBtnClick}))},o=()=>{t&&r(t)>n&&a()};o(),i&&t&&function(e,t){if(!e)return;const n=e.getElementsByTagName("img");if(!n.length)return;let i=n.length;for(let s=0;s{i--,0===i&&t()})),0===i&&t()}(t,(()=>o()))}))}const St="atk-height-limit";function Tt(e){e&&e.classList.contains(St)&&(e.classList.remove(St),Array.from(e.children).forEach((e=>{e.classList.contains("atk-height-limit-btn")&&e.remove()})),e.style.height="",e.style.overflow="")}const Et="atk-height-limit-scroll";class Lt extends ht{constructor(e){super(e)}render(){var e;return this.$el=s('
    \n
    \n
    \n
    \n
    \n \n \n \n
    \n
    \n
    \n
    \n \n
    \n
    \n
    \n'),this.$main=this.$el.querySelector(".atk-main"),this.$header=this.$el.querySelector(".atk-header"),this.$body=this.$el.querySelector(".atk-body"),this.$content=this.$body.querySelector(".atk-content"),this.$actions=this.$el.querySelector(".atk-actions"),this.$el.setAttribute("id",`atk-comment-${this.data.id}`),e=this,Object.entries(wt).forEach((([t,n])=>{n(e)})),this.recoveryChildrenWrap(),this.$el}checkHeightLimit(){const e=this.ctx.conf.heightLimit;if(!e||!e.content||!e.children)return;const t=e.content,n=e.children;Ct({postExpandBtnClick:()=>{const e=this.comment.getChildren();1===e.length&&Tt(e[0].getRender().$content)},scrollable:e.scrollable},[{el:this.$content,max:t,imgContains:!0},{el:this.$replyTo,max:t,imgContains:!0},{el:this.$childrenWrap,max:n,imgContains:!1}])}heightLimitRemoveForChildren(){this.$childrenWrap&&Tt(this.$childrenWrap)}playFadeAnim(){b(this.comment.getRender().$el)}playFadeAnimForBody(){b(this.comment.getRender().$body)}getChildrenWrap(){return this.$childrenWrap}renderChildrenWrap(){return this.$childrenWrap||(this.$childrenWrap=s('
    '),this.$main.append(this.$childrenWrap)),this.$childrenWrap}recoveryChildrenWrap(){this.$childrenWrap&&this.$main.append(this.$childrenWrap)}setUnread(e){e?this.$el.classList.add("atk-unread"):this.$el.classList.remove("atk-unread")}setOpenable(e){e?this.$el.classList.add("atk-openable"):this.$el.classList.remove("atk-openable")}setOpenURL(e){this.setOpenable(!0),this.$el.onclick=t=>{t.preventDefault(),window.open(e),this.cConf.openEvt&&this.cConf.openEvt()}}setOpenAction(e){this.setOpenable(!0),this.$el.onclick=t=>{t.preventDefault(),e()}}}class At{constructor(e){__publicField(this,"comment"),this.comment=e}get ctx(){return this.comment.ctx}get data(){return this.comment.getData()}get cConf(){return this.comment.getConf()}vote(e){const t="up"===e?this.comment.getRender().voteBtnUp:this.comment.getRender().voteBtnDown;this.ctx.getApi().comment.vote(this.data.id,`comment_${e}`).then((e=>{var t,n;this.data.vote_up=e.up,this.data.vote_down=e.down,null==(t=this.comment.getRender().voteBtnUp)||t.updateText(),null==(n=this.comment.getRender().voteBtnDown)||n.updateText()})).catch((e=>{null==t||t.setError(this.ctx.$t("voteFail")),console.log(e)}))}adminEdit(e,t){if(t.isLoading)return;t.setLoading(!0,`${this.ctx.$t("editing")}...`);const n=__spreadValues({},this.data);"collapsed"===e?n.is_collapsed=!n.is_collapsed:"pending"===e?n.is_pending=!n.is_pending:"pinned"===e&&(n.is_pinned=!n.is_pinned),this.ctx.getApi().comment.commentEdit(n).then((e=>{t.setLoading(!1),this.comment.setData(e),this.ctx.listRefreshUI()})).catch((e=>{console.error(e),t.setError(this.ctx.$t("editFail"))}))}adminDelete(e){e.isLoading||(e.setLoading(!0,`${this.ctx.$t("deleting")}...`),this.ctx.getApi().comment.commentDel(this.data.id,this.data.site_name).then((()=>{e.setLoading(!1),this.cConf.onDelete&&this.cConf.onDelete(this.comment)})).catch((t=>{console.error(t),e.setError(this.ctx.$t("deleteFail"))})))}goToReplyComment(){const e=window.location.hash,t=`#atk-comment-${this.data.rid}`;window.location.hash=t,t===e&&window.dispatchEvent(new Event("hashchange"))}}class Ft extends m{constructor(e,t,n){super(e),__publicField(this,"renderInstance"),__publicField(this,"actionInstance"),__publicField(this,"data"),__publicField(this,"cConf"),__publicField(this,"parent"),__publicField(this,"children",[]),__publicField(this,"nestCurt"),__publicField(this,"nestMax"),this.nestMax=e.conf.nestMax||3,this.cConf=n,this.data=__spreadValues({},t),this.data.date=this.data.date.replace(/-/g,"/"),this.parent=null,this.nestCurt=1,this.actionInstance=new At(this),this.renderInstance=new Lt(this)}render(){const e=this.renderInstance.render();this.$el&&this.$el.replaceWith(e),this.$el=e,this.cConf.afterRender&&this.cConf.afterRender()}getActions(){return this.actionInstance}getRender(){return this.renderInstance}getData(){return this.data}setData(e){this.data=e,this.render(),this.getRender().playFadeAnimForBody()}getParent(){return this.parent}getChildren(){return this.children}getNestCurt(){return this.nestCurt}getIsRoot(){return 0===this.data.rid}getID(){return this.data.id}putChild(e,t="append"){e.parent=this,e.nestCurt=this.nestCurt+1,this.children.push(e);const n=this.getChildrenEl();"append"===t?n.append(e.getEl()):"prepend"===t&&n.prepend(e.getEl()),e.getRender().playFadeAnim(),e.getRender().checkHeightLimit()}getChildrenEl(){let e=this.getRender().getChildrenWrap();return e||(e=this.nestCurt{n.parent&&(e.push(n.parent),t(n.parent))};return t(this),e}getEl(){return this.$el}getGravatarURL(){return function(e,t){const{mirror:n,params:i}=e.conf.gravatar;return`${n.replace(/\/$/,"")}/${t}?${i.replace(/^\?/,"")}`}(this.ctx,this.data.email_encrypted)}getContentMarked(){return Xe(this.ctx,this.data.content)}getDateFormatted(){return c(new Date(this.data.date),this.ctx)}getUserUA(){const e=function(e){const t=String(e||dt.userAgent),n={os:"",osVersion:"",engine:"",browser:"",device:"",language:"",version:""},i={Trident:t.includes("Trident")||t.includes("NET CLR"),Presto:t.includes("Presto"),WebKit:t.includes("AppleWebKit"),Gecko:t.includes("Gecko/")},s={Safari:t.includes("Safari"),Chrome:t.includes("Chrome")||t.includes("CriOS"),IE:t.includes("MSIE")||t.includes("Trident"),Edge:t.includes("Edge")||t.includes("Edg"),Firefox:t.includes("Firefox")||t.includes("FxiOS"),"Firefox Focus":t.includes("Focus"),Chromium:t.includes("Chromium"),Opera:t.includes("Opera")||t.includes("OPR"),Vivaldi:t.includes("Vivaldi"),Yandex:t.includes("YaBrowser"),Kindle:t.includes("Kindle")||t.includes("Silk/"),360:t.includes("360EE")||t.includes("360SE"),UC:t.includes("UC")||t.includes(" UBrowser"),QQBrowser:t.includes("QQBrowser"),QQ:t.includes("QQ/"),Baidu:t.includes("Baidu")||t.includes("BIDUBrowser"),Maxthon:t.includes("Maxthon"),Sogou:t.includes("MetaSr")||t.includes("Sogou"),LBBROWSER:t.includes("LBBROWSER"),"2345Explorer":t.includes("2345Explorer"),TheWorld:t.includes("TheWorld"),MIUI:t.includes("MiuiBrowser"),Quark:t.includes("Quark"),Qiyu:t.includes("Qiyu"),Wechat:t.includes("MicroMessenger"),Taobao:t.includes("AliApp(TB"),Alipay:t.includes("AliApp(AP"),Weibo:t.includes("Weibo"),Douban:t.includes("com.douban.frodo"),Suning:t.includes("SNEBUY-APP"),iQiYi:t.includes("IqiyiApp")},r={Windows:t.includes("Windows"),Linux:t.includes("Linux")||t.includes("X11"),macOS:t.includes("Macintosh"),Android:t.includes("Android")||t.includes("Adr"),Ubuntu:t.includes("Ubuntu"),FreeBSD:t.includes("FreeBSD"),Debian:t.includes("Debian"),"Windows Phone":t.includes("IEMobile")||t.includes("Windows Phone"),BlackBerry:t.includes("BlackBerry")||t.includes("RIM"),MeeGo:t.includes("MeeGo"),Symbian:t.includes("Symbian"),iOS:t.includes("like Mac OS X"),"Chrome OS":t.includes("CrOS"),WebOS:t.includes("hpwOS")},a={Mobile:t.includes("Mobi")||t.includes("iPh")||t.includes("480"),Tablet:t.includes("Tablet")||t.includes("Pad")||t.includes("Nexus 7")};a.Mobile?a.Mobile=!t.includes("iPad"):s.Chrome&&t.includes("Edg")?(s.Chrome=!1,s.Edge=!0):ct.showModalDialog&&ct.chrome&&(s.Chrome=!1,s[360]=!0),n.device="PC",n.language=(()=>{const e=(dt.browserLanguage||dt.language).split("-");return e[1]&&(e[1]=e[1].toUpperCase()),e.join("_")})();const o={engine:i,browser:s,os:r,device:a};Object.entries(o).forEach((([e,t])=>{Object.entries(t).forEach((([t,i])=>{!0===i&&(n[e]=t)}))}));const l={Windows:()=>{const e=t.replace(/^.*Windows NT ([\d.]+);.*$/,"$1");return{6.4:"10",6.3:"8.1",6.2:"8",6.1:"7","6.0":"Vista",5.2:"XP",5.1:"XP","5.0":"2000","10.0":"10","11.0":"11"}[e]||e},Android:()=>t.replace(/^.*Android ([\d.]+);.*$/,"$1"),iOS:()=>t.replace(/^.*OS ([\d_]+) like.*$/,"$1").replace(/_/g,"."),Debian:()=>t.replace(/^.*Debian\/([\d.]+).*$/,"$1"),"Windows Phone":()=>t.replace(/^.*Windows Phone( OS)? ([\d.]+);.*$/,"$2"),macOS:()=>t.replace(/^.*Mac OS X ([\d_]+).*$/,"$1").replace(/_/g,"."),WebOS:()=>t.replace(/^.*hpwOS\/([\d.]+);.*$/,"$1")};n.osVersion="",l[n.os]&&(n.osVersion=l[n.os](),n.osVersion===t&&(n.osVersion=""));const c={Safari:()=>t.replace(/^.*Version\/([\d.]+).*$/,"$1"),Chrome:()=>t.replace(/^.*Chrome\/([\d.]+).*$/,"$1").replace(/^.*CriOS\/([\d.]+).*$/,"$1"),IE:()=>t.replace(/^.*MSIE ([\d.]+).*$/,"$1").replace(/^.*rv:([\d.]+).*$/,"$1"),Edge:()=>t.replace(/^.*(Edge|Edg|Edg[A-Z]{1})\/([\d.]+).*$/,"$2"),Firefox:()=>t.replace(/^.*Firefox\/([\d.]+).*$/,"$1").replace(/^.*FxiOS\/([\d.]+).*$/,"$1"),"Firefox Focus":()=>t.replace(/^.*Focus\/([\d.]+).*$/,"$1"),Chromium:()=>t.replace(/^.*Chromium\/([\d.]+).*$/,"$1"),Opera:()=>t.replace(/^.*Opera\/([\d.]+).*$/,"$1").replace(/^.*OPR\/([\d.]+).*$/,"$1"),Vivaldi:()=>t.replace(/^.*Vivaldi\/([\d.]+).*$/,"$1"),Yandex:()=>t.replace(/^.*YaBrowser\/([\d.]+).*$/,"$1"),Kindle:()=>t.replace(/^.*Version\/([\d.]+).*$/,"$1"),Maxthon:()=>t.replace(/^.*Maxthon\/([\d.]+).*$/,"$1"),QQBrowser:()=>t.replace(/^.*QQBrowser\/([\d.]+).*$/,"$1"),QQ:()=>t.replace(/^.*QQ\/([\d.]+).*$/,"$1"),Baidu:()=>t.replace(/^.*BIDUBrowser[\s/]([\d.]+).*$/,"$1"),UC:()=>t.replace(/^.*UC?Browser\/([\d.]+).*$/,"$1"),Sogou:()=>t.replace(/^.*SE ([\d.X]+).*$/,"$1").replace(/^.*SogouMobileBrowser\/([\d.]+).*$/,"$1"),"2345Explorer":()=>t.replace(/^.*2345Explorer\/([\d.]+).*$/,"$1"),TheWorld:()=>t.replace(/^.*TheWorld ([\d.]+).*$/,"$1"),MIUI:()=>t.replace(/^.*MiuiBrowser\/([\d.]+).*$/,"$1"),Quark:()=>t.replace(/^.*Quark\/([\d.]+).*$/,"$1"),Qiyu:()=>t.replace(/^.*Qiyu\/([\d.]+).*$/,"$1"),Wechat:()=>t.replace(/^.*MicroMessenger\/([\d.]+).*$/,"$1"),Taobao:()=>t.replace(/^.*AliApp\(TB\/([\d.]+).*$/,"$1"),Alipay:()=>t.replace(/^.*AliApp\(AP\/([\d.]+).*$/,"$1"),Weibo:()=>t.replace(/^.*weibo__([\d.]+).*$/,"$1"),Douban:()=>t.replace(/^.*com.douban.frodo\/([\d.]+).*$/,"$1"),Suning:()=>t.replace(/^.*SNEBUY-APP([\d.]+).*$/,"$1"),iQiYi:()=>t.replace(/^.*IqiyiVersion\/([\d.]+).*$/,"$1")};return n.version="",c[n.browser]&&(n.version=c[n.browser](),n.version===t&&(n.version="")),n.version.indexOf(".")&&(n.version=n.version.substring(0,n.version.indexOf("."))),"iOS"===n.os&&t.includes("iPad")?n.os="iPadOS":"Edge"!==n.browser||t.includes("Edg")?"MIUI"===n.browser?n.os="Android":"Chrome"===n.browser&&Number(n.version)>27||"Opera"===n.browser&&Number(n.version)>12||"Yandex"===n.browser?n.engine="Blink":void 0===n.browser&&(n.browser="Unknow App"):n.engine="EdgeHTML",n}(this.data.ua);return{browser:`${e.browser} ${e.version}`,os:`${e.os} ${e.osVersion}`}}getConf(){return this.cConf}}class Ot{constructor(e,t){__publicField(this,"conf"),__publicField(this,"total"),__publicField(this,"$el"),__publicField(this,"$input"),__publicField(this,"inputTimer"),__publicField(this,"$prevBtn"),__publicField(this,"$nextBtn"),__publicField(this,"page",1),this.total=e,this.conf=t,this.$el=s('
    \n
    \n
    Prev
    \n \n
    Next
    \n
    \n
    '),this.$input=this.$el.querySelector(".atk-input"),this.$input.value=`${this.page}`,this.$input.oninput=()=>this.input(),this.$input.onkeydown=e=>this.keydown(e),this.$prevBtn=this.$el.querySelector(".atk-btn-prev"),this.$nextBtn=this.$el.querySelector(".atk-btn-next"),this.$prevBtn.onclick=()=>this.prev(),this.$nextBtn.onclick=()=>this.next(),this.checkDisabled()}get pageSize(){return this.conf.pageSize}get offset(){return this.pageSize*(this.page-1)}get maxPage(){return Math.ceil(this.total/this.pageSize)}update(e,t){this.page=Math.ceil(e/this.pageSize)+1,this.total=t,this.setInput(this.page),this.checkDisabled()}setInput(e){this.$input.value=`${e}`}input(e=!1){window.clearTimeout(this.inputTimer);const t=this.$input.value.trim(),n=()=>{if(""===t)return void this.setInput(this.page);let e=Number(t);Number.isNaN(e)||e<1?this.setInput(this.page):(e>this.maxPage&&(this.setInput(this.maxPage),e=this.maxPage),this.change(e))};e?n():this.inputTimer=window.setTimeout((()=>n()),800)}prev(){const e=this.page-1;e<1||this.change(e)}next(){const e=this.page+1;e>this.maxPage||this.change(e)}change(e){this.page=e,this.conf.onChange(this.offset),this.setInput(e),this.checkDisabled()}checkDisabled(){this.page+1>this.maxPage?this.$nextBtn.classList.add("atk-disabled"):this.$nextBtn.classList.remove("atk-disabled"),this.page-1<1?this.$prevBtn.classList.add("atk-disabled"):this.$prevBtn.classList.remove("atk-disabled")}keydown(e){const t=e.keyCode||e.which;if(38===t){const e=Number(this.$input.value)+1;if(e>this.maxPage)return;this.setInput(e),this.input()}else if(40===t){const e=Number(this.$input.value)-1;if(e<1)return;this.setInput(e),this.input()}else 13===t&&this.input(!0)}setLoading(e){e?g(this.$el):f(this.$el)}}const Mt={createInstance(e){const t=new Ot(e.total,{pageSize:e.pageSize,onChange:t=>__async(this,null,(function*(){if(!0===e.list.conf.editorTravel&&e.list.ctx.editorTravelBack(),yield e.list.fetchComments(t),e.list.repositionAt){(e.list.scrollListenerAt||window).scroll({top:e.list.repositionAt?o(e.list.repositionAt).top:0,left:0})}}))});return[t,t.$el]},setLoading(e){this.instance.setLoading(e)},update(e,t){this.instance.update(e,t)},next(){this.instance.next()}};class Rt{constructor(e){__publicField(this,"conf"),__publicField(this,"$el"),__publicField(this,"$loading"),__publicField(this,"$text"),__publicField(this,"offset",0),__publicField(this,"total",0),__publicField(this,"origText","Load More"),this.conf=e,this.origText=this.conf.text||this.origText,this.$el=s(``),this.$loading=this.$el.querySelector(".atk-loading-icon"),this.$text=this.$el.querySelector(".atk-text"),this.$el.onclick=()=>{this.click()}}get hasMore(){return this.total>this.offset+this.conf.pageSize}click(){this.hasMore&&this.conf.onClick(this.offset+this.conf.pageSize),this.checkDisabled()}show(){this.$el.style.display=""}hide(){this.$el.style.display="none"}setLoading(e){this.$loading.style.display=e?"":"none",this.$text.style.display=e?"none":""}showErr(e){this.setLoading(!1),this.$text.innerText=e,this.$el.classList.add("atk-err"),window.setTimeout((()=>{this.$text.innerText=this.origText,this.$el.classList.remove("atk-err")}),2e3)}update(e,t){this.offset=e,this.total=t,this.checkDisabled()}checkDisabled(){this.hasMore?this.show():this.hide()}}const Pt={pagination:Mt,"read-more":{createInstance(e){const t=new Rt({pageSize:e.pageSize,onClick:t=>__async(this,null,(function*(){yield e.list.fetchComments(t)})),text:at("loadMore")});if(e.list.conf.pagination.autoLoad){const n=e.list.scrollListenerAt||document;this.autoLoadScrollEvent&&n.removeEventListener("scroll",this.autoLoadScrollEvent),this.autoLoadScrollEvent=()=>{if("read-more"!==e.mode||!(null==t?void 0:t.hasMore)||e.list.getLoading())return;const n=e.list.$el.querySelector(".atk-list-comments-wrap > .atk-comment-wrap:nth-last-child(3)");n&&function(e,t=document.documentElement){const n=t.clientHeight,i=t.scrollTop,s=i+n,r=e.getBoundingClientRect();return r.top+i+r.height<=s}(n,e.list.scrollListenerAt)&&t.click()},n.addEventListener("scroll",this.autoLoadScrollEvent)}return[t,t.$el]},setLoading(e){this.instance.setLoading(e)},update(e,t){this.instance.update(e,t)},showErr(e){this.instance.showErr(e)},next(){this.instance.click()}}};class Bt{constructor(e){__publicField(this,"conf"),this.conf=e,this.init()}getAdaptor(){return Pt[this.conf.mode]}init(){const e=this.getAdaptor(),[t,n]=e.createInstance(this.conf);e.instance=t,e.el=n,this.conf.list.$el.append(e.el)}setLoading(e){this.getAdaptor().setLoading(e)}update(e,t){this.getAdaptor().update(e,t)}getEl(){return this.getAdaptor().el}showErr(e){const t=this.getAdaptor(),n=t.showErr;n&&n.bind(t)(e)}setMode(e){e!==this.conf.mode&&(this.getEl().remove(),this.conf.mode=e,this.init())}next(){this.getAdaptor().next()}}function It(e,t,n){const i=function(e,t){const n=e.split("."),i=t.split(".");for(let s=0;s<3;s++){const e=Number(n[s]),t=Number(i[s]);if(e>t)return 1;if(t>e)return-1;if(!Number.isNaN(e)&&Number.isNaN(t))return 1;if(Number.isNaN(e)&&!Number.isNaN(t))return-1}return 0}(t,n);if(0!==i){const r=s(`
    请更新 Artalk ${at(i<0?"frontend":"backend")}以获得完整体验 (帮助文档)

    当前版本:${at("frontend")} ${t} / ${at("backend")} ${n}

    `),a=s('忽略');return a.onclick=()=>{_(e.$el.parentElement,null),e.ctx.conf.versionCheck=!1,e.fetchComments(0)},r.append(a),_(e.$el.parentElement,r,'Artalk Warn'),!0}return!1}function Ut(e){const{$dropdownWrap:t,dropdownList:n}=e;if(t.querySelector(".atk-dropdown"))return;t.classList.add("atk-dropdown-wrap"),t.append(s(''));let i=0;const r=s('
      ');n.forEach(((e,t)=>{const n=e[0],a=e[1],o=s('
    • '),l=o.querySelector("span");l.innerText=n,l.onclick=()=>{((e,t,n,s)=>{s(),i=e,r.querySelectorAll(".active").forEach((e=>{e.classList.remove("active")})),t.classList.add("active"),r.style.display="none",setTimeout((()=>{r.style.display=""}),80)})(t,o,0,a)},r.append(o),t===i&&o.classList.add("active")})),t.append(r)}const Dt={el:"",pageKey:"",pageTitle:"",server:"",site:"",placeholder:"",noComment:"",sendBtn:"",darkMode:!1,editorTravel:!0,flatMode:"auto",nestMax:2,nestSort:"DATE_ASC",emoticons:"https://cdn.jsdelivr.net/gh/ArtalkJS/Emoticons/grps/default.json",vote:!0,voteDown:!1,uaBadge:!0,listSort:!0,preview:!0,countEl:"#ArtalkCount",pvEl:"#ArtalkPV",gravatar:{mirror:"https://cravatar.cn/avatar/",params:"d=mp&s=240"},pagination:{pageSize:20,readMore:!0,autoLoad:!0},heightLimit:{content:300,children:400,scrollable:!1},imgUpload:!0,reqTimeout:15e3,versionCheck:!0,useBackendConf:!0,locale:"zh-CN"};function qt(e){const t=p(Dt,e);if("string"==typeof t.el&&t.el)try{const e=document.querySelector(t.el);if(!e)throw Error(`Target element "${t.el}" was not found.`);t.el=e}catch(n){throw console.error(n),new Error("Please check your Artalk `el` config.")}return t.server=t.server.replace(/\/$/,"").replace(/\/api\/?$/,""),t.pageKey||(t.pageKey=`${window.location.pathname}`),t.pageTitle||(t.pageTitle=`${document.title}`),"auto"===t.locale&&(t.locale=navigator.language),t}function zt(e){const t=["el","pageKey","pageTitle","server","site","darkMode"];return Object.keys(e).forEach((n=>{t.includes(n)&&delete e[n]})),e.emoticons&&"string"==typeof e.emoticons&&(e.emoticons=e.emoticons.trim(),e.emoticons.startsWith("[")||e.emoticons.startsWith("{")?e.emoticons=JSON.parse(e.emoticons):"false"===e.emoticons&&(e.emoticons=!1)),e}class jt extends m{constructor(e){super(e),__publicField(this,"$commentsWrap"),__publicField(this,"data"),__publicField(this,"isLoading",!1),__publicField(this,"confLoaded",!1),__publicField(this,"noCommentText"),__publicField(this,"_nestSortBy"),__publicField(this,"_flatMode"),__publicField(this,"_pageMode"),__publicField(this,"pgHolder"),__publicField(this,"_pageSize"),__publicField(this,"scrollListenerAt"),__publicField(this,"repositionAt"),__publicField(this,"renderComment"),__publicField(this,"paramsEditor"),__publicField(this,"onAfterLoad"),__publicField(this,"unread",[]),__publicField(this,"unreadHighlight"),this.$el=s('
      \n
      \n
      '),this.$commentsWrap=this.$el.querySelector(".atk-list-comments-wrap"),window.setInterval((()=>{this.$el.querySelectorAll("[data-atk-comment-date]").forEach((e=>{const t=e.getAttribute("data-atk-comment-date");e.innerText=c(new Date(Number(t)),this.ctx)}))}),3e4),this.ctx.on("conf-loaded",(()=>{}))}get nestSortBy(){return this._nestSortBy||this.ctx.conf.nestSort||"DATE_ASC"}set nestSortBy(e){this._nestSortBy=e}get flatMode(){return void 0!==this._flatMode?this._flatMode:!0===this.ctx.conf.flatMode||Number(this.ctx.conf.nestMax)<=1||!("auto"!==this.ctx.conf.flatMode||!window.matchMedia("(max-width: 768px)").matches)}set flatMode(e){this._flatMode=e}get pageMode(){return this._pageMode||(this.conf.pagination.readMore?"read-more":"pagination")}set pageMode(e){var t;this._pageMode=e,null==(t=this.pgHolder)||t.setMode(this._pageMode)}get pageSize(){return this._pageSize||this.conf.pagination.pageSize}set pageSize(e){this._pageSize=e}getData(){return this.data}clearData(){this.data=void 0}getLoading(){return this.isLoading}getCommentsWrapEl(){return this.$commentsWrap}setLoading(e,t=!1){var n;this.isLoading=e,t?function(e,t){e?g(t):f(t)}(e,this.$el):null==(n=this.pgHolder)||n.setLoading(e)}fetchComments(e){return __async(this,null,(function*(){if(this.isLoading)return;const t=0===e,n=e=>this.setLoading(e,t);let i;n(!0),this.ctx.trigger("list-load"),("read-more"===this.pageMode&&t||"pagination"===this.pageMode)&&this.ctx.clearAllComments();try{i=yield this.ctx.getApi().comment.get(e,this.pageSize,this.flatMode,this.paramsEditor)}catch(s){throw this.onError(s.msg||String(s),e,s.data),s}finally{n(!1)}_(this.$el,null);try{this.onLoad(i,e)}catch(s){throw this.onError(String(s),e),s}finally{n(!1)}}))}onLoad(e,t){if(this.data=e,!this.confLoaded){const t=zt(e.conf.frontend_conf);this.conf.useBackendConf?this.ctx.updateConf(t):this.ctx.updateConf({}),this.confLoaded=!0}this.ctx.conf.versionCheck&&It(this,ot,e.api_version.version)||(this.importComments(e.comments),this.refreshPagination(t,this.flatMode?e.total:e.total_roots),this.refreshUI(),this.ctx.updateNotifies(e.unread||[]),this.ctx.trigger("list-loaded"),this.onAfterLoad&&this.onAfterLoad(e))}refreshPagination(e,t){var n;this.pgHolder||(this.pgHolder=new Bt({list:this,mode:this.pageMode,pageSize:this.pageSize,total:t})),null==(n=this.pgHolder)||n.update(e,t)}onError(e,t,n){var i;this.confLoaded||this.ctx.updateConf({}),e=String(e),console.error(e),0===t||"read-more"!==this.pageMode?_(this.$el,function(e,t,n){const i=s(`${t},${at("listLoadFailMsg")}
      `),r=s(`${at("listRetry")}`);r.onclick=()=>e.fetchComments(0),i.appendChild(r);const a=s(' | 打开控制台');i.appendChild(a),lt.data.isAdmin||a.classList.add("atk-hide");let o="";if(null==n?void 0:n.err_no_site){const t={create_name:e.ctx.conf.site,create_urls:`${window.location.protocol}//${window.location.host}`};o=`sites|${JSON.stringify(t)}`}return a.onclick=()=>e.ctx.showSidebar({view:o}),i}(this,e,n)):null==(i=this.pgHolder)||i.showErr(this.$t("loadFail"))}refreshUI(){!function(e){const t=e.ctx.getCommentList().length<=0;let n=e.getCommentsWrapEl().querySelector(".atk-list-no-comment");t?n||(n=s('
      '),n.innerHTML=e.noCommentText||e.ctx.conf.noComment||e.ctx.$t("noComment"),e.getCommentsWrapEl().appendChild(n)):null==n||n.remove(),e.ctx.checkAdminShowEl()}(this)}reload(){this.fetchComments(0)}createComment(e,t){t||(t=this.ctx.getCommentDataList());const n=new Ft(this.ctx,e,{isFlatMode:this.flatMode,afterRender:()=>{this.renderComment&&this.renderComment(n)},onDelete:e=>{this.ctx.deleteComment(e),this.refreshUI()},replyTo:e.rid?t.find((t=>t.id===e.rid)):void 0});return n.render(),this.ctx.getCommentList().push(n),n}importComments(e){this.flatMode?e.forEach((t=>{this.putCommentFlatMode(t,e,"append")})):this.importCommentsNest(e)}importCommentsNest(e){const t=function(e,t="DATE_DESC",n=2){const i=[];e.filter((e=>0===e.rid)).forEach((t=>{const s={id:t.id,comment:t,children:[],level:1};s.parent=s,i.push(s),function t(i){const s=e.filter((e=>e.rid===i.id));0!==s.length&&(i.level>=n&&(i=i.parent),s.forEach((e=>{const n={id:e.id,comment:e,children:[],parent:i,level:i.level+1};i.children.push(n),t(n)})))}(s)}));const s=(n,i)=>{let s=n.id-i.id;return"DATE_ASC"===t?s=+new Date(n.comment.date)-+new Date(i.comment.date):"DATE_DESC"===t?s=+new Date(i.comment.date)-+new Date(n.comment.date):"SRC_INDEX"===t?s=e.indexOf(n.comment)-e.indexOf(i.comment):"VOTE_UP_DESC"===t&&(s=i.comment.vote_up-n.comment.vote_up),s};return function e(t){t.forEach((t=>{t.children=t.children.sort(s),e(t.children)}))}(i),i}(e,this.nestSortBy,this.conf.nestMax);t.forEach((t=>{const n=this.createComment(t.comment,e);this.$commentsWrap.appendChild(n.getEl()),n.getRender().playFadeAnim();const i=this;!function t(n,s){s.children.forEach((s=>{const r=s.comment,a=i.createComment(r,e);n.putChild(a),t(a,s)}))}(n,t),n.getRender().checkHeightLimit()}))}putCommentFlatMode(e,t,n){e.is_collapsed&&(e.is_allow_reply=!1);const i=this.createComment(e,t);return e.visible&&("append"===n&&this.$commentsWrap.append(i.getEl()),"prepend"===n&&this.$commentsWrap.prepend(i.getEl()),i.getRender().playFadeAnim()),i.getRender().checkHeightLimit(),i}insertComment(e){if(this.flatMode){k(this.putCommentFlatMode(e,this.ctx.getCommentDataList(),"prepend").getEl())}else{const t=this.createComment(e);if(0===e.rid)this.$commentsWrap.prepend(t.getEl());else{const n=this.ctx.findComment(e.rid);n&&(n.putChild(t,"DATE_ASC"===this.nestSortBy?"append":"prepend"),t.getParents().forEach((e=>{e.getRender().heightLimitRemoveForChildren()})))}t.getRender().checkHeightLimit(),k(t.getEl()),t.getRender().playFadeAnim()}this.data&&(this.data.total+=1),this.refreshUI(),this.ctx.trigger("list-loaded"),this.ctx.trigger("list-inserted",e)}updateComment(e){const t=this.ctx.findComment(e.id);t&&t.setData(e)}updateUnread(e){this.unread=e,!0===this.unreadHighlight&&this.ctx.getCommentList().forEach((e=>{const t=this.unread.find((t=>t.comment_id===e.getID()));t?(e.getRender().setUnread(!0),e.getRender().setOpenAction((()=>{window.open(t.read_link),this.unread=this.unread.filter((t=>t.comment_id!==e.getID())),this.ctx.updateNotifies(this.unread)}))):e.getRender().setUnread(!1)}))}}class Wt extends jt{constructor(e){const t=s('
      \n
      \n
      \n
      \n
      \n
      \n \n \n \n
      \n
      \n
      \n
      \n
      \n \n
      \n');super(e),__publicField(this,"$closeCommentBtn"),__publicField(this,"$openSidebarBtn"),__publicField(this,"$unreadBadge"),__publicField(this,"$commentCount"),__publicField(this,"$commentCountNum"),__publicField(this,"$dropdownWrap"),__publicField(this,"goToCommentFounded",!1),__publicField(this,"goToCommentDelay",!0),t.querySelector(".atk-list-body").append(this.$el),this.$el=t,this.repositionAt=this.$el,this.initListActionBtn();this.$commentCount=this.$el.querySelector(".atk-comment-count");const n=()=>{this.$commentCount.innerHTML=this.$t("counter",{count:'0'}),this.$commentCountNum=this.$commentCount.querySelector(".atk-comment-count-num")};n(),this.$el.querySelector(".atk-copyright").innerHTML=`Powered By Artalk`,this.ctx.on("conf-loaded",(()=>{n(),this.refreshUI()}))}initListActionBtn(){this.$openSidebarBtn=this.$el.querySelector('[data-action="open-sidebar"]'),this.$closeCommentBtn=this.$el.querySelector('[data-action="admin-close-comment"]'),this.$unreadBadge=this.$el.querySelector(".atk-unread-badge"),this.$openSidebarBtn.addEventListener("click",(()=>{this.ctx.showSidebar()})),this.$closeCommentBtn.addEventListener("click",(()=>{this.data&&(this.data.page.admin_only=!this.data.page.admin_only,this.adminPageEditSave())}))}refreshUI(){var e;super.refreshUI(),this.$commentCountNum.innerText=String(Number(null==(e=this.data)?void 0:e.total)||0),lt.data.nick&<.data.email?this.$openSidebarBtn.classList.remove("atk-hide"):this.$openSidebarBtn.classList.add("atk-hide"),this.$openSidebarBtn.querySelector(".atk-text").innerText=lt.data.isAdmin?this.$t("ctrlCenter"):this.$t("msgCenter"),this.data&&this.data.page&&!0===this.data.page.admin_only?(this.ctx.editorClose(),this.$closeCommentBtn.innerHTML=this.$t("openComment")):(this.ctx.editorOpen(),this.$closeCommentBtn.innerHTML=this.$t("closeComment")),this.ctx.conf.listSort?this.initDropdown():function(e){var t,n;const{$dropdownWrap:i}=e;i.classList.remove("atk-dropdown-wrap"),null==(t=i.querySelector(".atk-arrow-down-icon"))||t.remove(),null==(n=i.querySelector(".atk-dropdown"))||n.remove()}({$dropdownWrap:this.$commentCount})}onLoad(e,t){super.onLoad(e,t),this.goToCommentFounded||this.checkGoToCommentByUrlHash(),!0===this.ctx.conf.editorTravel&&this.ctx.editorTravelBack()}checkGoToCommentByUrlHash(){var e;let t=Number(a("atk_comment"));if(!t){const e=window.location.hash.match(/#atk-comment-([0-9]+)/);if(!e||!e[1]||Number.isNaN(Number(e[1])))return;t=Number(e[1])}if(!t)return;const n=this.ctx.findComment(t);if(!n)return void(null==(e=this.pgHolder)||e.next());const i=a("atk_notify_key");i&&this.ctx.getApi().user.markRead(t,i).then((()=>{this.unread=this.unread.filter((e=>e.comment_id!==t)),this.updateUnread(this.unread)})),n.getParents().forEach((e=>{e.getRender().heightLimitRemoveForChildren()}));const s=()=>{k(n.getEl(),!1),n.getEl().classList.remove("atk-flash-once"),window.setTimeout((()=>{n.getEl().classList.add("atk-flash-once")}),150)};this.goToCommentDelay?window.setTimeout((()=>s()),350):s(),this.goToCommentFounded=!0,this.goToCommentDelay=!0}adminPageEditSave(){this.data&&this.data.page&&(this.ctx.editorShowLoading(),this.ctx.getApi().page.pageEdit(this.data.page).then((e=>{this.data&&(this.data.page=__spreadValues({},e)),this.refreshUI()})).catch((e=>{this.ctx.editorShowNotify(`${this.$t("editFail")}: ${e.msg||String(e)}`,"e")})).finally((()=>{this.ctx.editorHideLoading()})))}showUnreadBadge(e){e>0?(this.$unreadBadge.innerText=`${Number(e||0)}`,this.$unreadBadge.style.display="block"):this.$unreadBadge.style.display="none"}initDropdown(){const e=e=>{this.paramsEditor=e,this.fetchComments(0)};Ut({$dropdownWrap:this.$commentCount,dropdownList:[[this.$t("sortLatest"),()=>{e((e=>{e.sort_by="date_desc"}))}],[this.$t("sortBest"),()=>{e((e=>{e.sort_by="vote"}))}],[this.$t("sortOldest"),()=>{e((e=>{e.sort_by="date_asc"}))}],[this.$t("sortAuthor"),()=>{e((e=>{e.view_only_admin=!0}))}]]})}updateUnread(e){super.updateUnread(e),this.showUnreadBadge((null==e?void 0:e.length)||0)}}class Nt{constructor(e,t){__publicField(this,"conf"),__publicField(this,"$root"),__publicField(this,"markedReplacers",[]),__publicField(this,"commentList",[]),__publicField(this,"eventList",[]),this.conf=e,this.$root=t||document.createElement("div"),this.$root.classList.add("artalk"),this.$root.innerHTML=""}inject(e,t){this[e]=t}get(e){return this[e]}getApi(){return this.api}getCommentList(){return this.commentList}getCommentDataList(){return this.commentList.map((e=>e.getData()))}findComment(e){return this.commentList.find((t=>t.getData().id===e))}deleteComment(e){let t;if("number"==typeof e){const n=this.findComment(e);if(!n)throw Error(`Comment ${e} cannot be found`);t=n}else t=e;if(t.getEl().remove(),this.commentList.splice(this.commentList.indexOf(t),1),this.list){const e=this.list.getData();e&&(e.total-=1),this.list.refreshUI()}}clearAllComments(){this.list&&(this.list.getCommentsWrapEl().innerHTML="",this.list.clearData()),this.commentList=[]}insertComment(e){var t;null==(t=this.list)||t.insertComment(e)}updateComment(e){var t;null==(t=this.list)||t.updateComment(e)}replyComment(e,t,n){this.editor.setReply(e,t,n)}cancelReplyComment(){this.editor.cancelReply()}editComment(e,t){this.editor.setEditComment(e,t)}cancelEditComment(){this.editor.cancelEditComment()}updateNotifies(e){var t;null==(t=this.list)||t.updateUnread(e)}listReload(){var e;null==(e=this.list)||e.reload()}reload(){this.listReload()}listRefreshUI(){var e;null==(e=this.list)||e.refreshUI()}listHashGotoCheck(){if(!(this.list&&this.list instanceof Wt))return;const e=this.list;e.goToCommentDelay=!1,e.checkGoToCommentByUrlHash()}editorOpen(){this.editor.open()}editorClose(){this.editor.close()}editorShowLoading(){this.editor.showLoading()}editorHideLoading(){this.editor.hideLoading()}editorShowNotify(e,t){this.editor.showNotify(e,t)}editorTravel(e){this.editor.travel(e)}editorTravelBack(){this.editor.travelBack()}showSidebar(e){this.sidebarLayer.show(e)}hideSidebar(){this.sidebarLayer.hide()}checkAdmin(e){this.checkerLauncher.checkAdmin(e)}checkCaptcha(e){this.checkerLauncher.checkCaptcha(e)}checkAdminShowEl(){const e=[];this.$root.querySelectorAll("[atk-only-admin-show]").forEach((t=>e.push(t)));const{$wrap:t}=v();t&&t.querySelectorAll("[atk-only-admin-show]").forEach((t=>e.push(t)));const n=document.querySelector(".atk-sidebar");n&&n.querySelectorAll("[atk-only-admin-show]").forEach((t=>e.push(t))),e.forEach((e=>{this.user.data.isAdmin?e.classList.remove("atk-hide"):e.classList.add("atk-hide")}))}on(e,t,n="internal"){this.eventList.push({name:e,handler:t,scope:n})}off(e,t,n="internal"){this.eventList=this.eventList.filter((i=>t?!(i.name===e&&i.handler===t&&i.scope===n):!(i.name===e&&i.scope===n)))}trigger(e,t,n){this.eventList.filter((t=>t.name===e&&(!n||t.scope===n))).map((e=>e.handler)).forEach((e=>e(t)))}$t(e,t={}){return at(e,t)}setDarkMode(e){T(this,e)}updateConf(e){this.conf=p(this.conf,e),this.trigger("conf-loaded")}getMarkedInstance(){return Ye()}}class Ht{constructor(e,t){return __publicField(this,"ctx"),__publicField(this,"$el"),__publicField(this,"$content"),__publicField(this,"$actions"),this.ctx=e,this.$el=s('
      \n
      \n
      \n
      \n
      \n
      '),this.$actions=this.$el.querySelector(".atk-layer-dialog-actions"),this.$content=this.$el.querySelector(".atk-layer-dialog-content"),this.$content.appendChild(t),this}setYes(e){const t=s(``);return t.onclick=this.onBtnClick(e),this.$actions.appendChild(t),this}setNo(e){const t=s(``);return t.onclick=this.onBtnClick(e),this.$actions.appendChild(t),this}onBtnClick(e){return t=>{const n=e(t.currentTarget,this);void 0!==n&&!0!==n||this.$el.remove()}}}function Vt(e){const t=s('
      '),n=s('');n.style.display="none",g(t,{transparentBg:!0}),n.src=`${e.getCtx().conf.server}/api/captcha/get?t=${+new Date}`,n.onload=()=>{n.style.display="",f(t)},t.append(n);const i=s('
      ');t.append(i),e.hideInteractInput();let r=!1;return function t(){return __async(this,null,(function*(){var n;if(yield(n=1e3,new Promise((e=>{window.setTimeout((()=>{e(null)}),n)}))),r)return;let i=!1;try{i=(yield e.getCtx().getApi().captcha.captchaStatus()).is_pass}catch(s){i=!1}i?e.triggerSuccess():t()}))}(),i.onclick=()=>{r=!0,e.cancel()},t}const Qt={request:(e,t)=>e.getApi().captcha.captchaCheck(t),body:e=>e.get("iframe")?Vt(e):function(e){const t=s(`${e.getCtx().$t("captchaCheck")}`);return t.querySelector(".atk-captcha-img").onclick=()=>{const n=t.querySelector(".atk-captcha-img");e.getApi().captcha.captchaGet().then((e=>{n.setAttribute("src",e)})).catch((e=>{console.error("Failed to get captcha image ",e)}))},t}(e),onSuccess(e,t,n,i){e.set("val",n)},onError(e,t,n,i){i.querySelector(".atk-captcha-img").click(),i.querySelector('input[type="text"]').value=""}},Zt={inputType:"password",request(e,t){const n={name:lt.data.nick,email:lt.data.email,password:t};return(()=>__async(this,null,(function*(){return(yield e.getApi().user.login(n.name,n.email,n.password)).token})))()},body:e=>s(`${e.getCtx().$t("adminCheck")}`),onSuccess(e,t,n,i){lt.update({isAdmin:!0,token:t}),e.getCtx().trigger("user-changed",lt.data),e.getCtx().listReload()},onError(e,t,n,i){}};class Gt{constructor(e){__publicField(this,"ctx"),__publicField(this,"launched",[]),this.ctx=e}checkCaptcha(e){this.fire(Qt,e,(t=>{t.set("img_data",e.imgData),t.set("iframe",e.iframe)}))}checkAdmin(e){this.fire(Zt,e)}fire(e,t,n){if(this.launched.includes(e))return;this.launched.push(e);const i=new x(this.ctx,`checker-${(new Date).getTime()}`);i.setMaskClickHide(!1),i.show();const r={};let a=!1;const o={set:(e,t)=>{r[e]=t},get:e=>r[e],getCtx:()=>this.ctx,getApi:()=>this.ctx.getApi(),getLayer:()=>i,hideInteractInput:()=>{a=!0},triggerSuccess:()=>{this.close(e,i),e.onSuccess&&e.onSuccess(o,"","",l),t.onSuccess&&t.onSuccess("",h.$el)},cancel:()=>{this.close(e,i),t.onCancel&&t.onCancel()}};n&&n(o);const l=s();l.appendChild(e.body(o));const c=s(``);let d;l.appendChild(c),setTimeout((()=>c.focus()),80),c.onkeyup=e=>{"Enter"!==e.key&&13!==e.keyCode||(e.preventDefault(),i.getEl().querySelector('button[data-action="confirm"]').click())};const h=new Ht(this.ctx,l);h.setYes((n=>{const s=c.value.trim();d||(d=n.innerText);const r=()=>{n.innerText=d||"",n.classList.remove("error")};return n.innerText=`${this.ctx.$t("loading")}...`,e.request(o,s).then((n=>{this.close(e,i),e.onSuccess&&e.onSuccess(o,n,s,l),t.onSuccess&&t.onSuccess(s,h.$el)})).catch((t=>{var i;i=String(t.msg||String(t)),n.innerText=i,n.classList.add("error"),e.onError&&e.onError(o,t,s,l);const a=setTimeout((()=>r()),3e3);c.onfocus=()=>{r(),clearTimeout(a)}})),!1})),h.setNo((()=>(this.close(e,i),t.onCancel&&t.onCancel(),!1))),a&&(c.style.display="none",h.$el.querySelector(".atk-layer-dialog-actions").style.display="none"),i.getEl().append(h.$el),t.onMount&&t.onMount(h.$el)}close(e,t){t.disposeNow(),this.launched=this.launched.filter((t=>t!==e))}}function Kt(e,t,n,i){return __async(this,null,(function*(){var s,r;if(lt.data.token){const e=new Headers(n.headers);e.set("Authorization",`Bearer ${lt.data.token}`),n.headers=e}const a=yield function(e,t,n,i){var s;const r=new AbortController;null==(s=i.signal)||s.addEventListener("abort",(()=>r.abort()));let a=fetch(t,__spreadProps(__spreadValues({},i),{signal:r.signal}));if(n>0){const e=setTimeout((()=>r.abort()),n);a.finally((()=>{clearTimeout(e)}))}return a=a.catch((e=>{throw"AbortError"===(e||{}).name?new Error(at("reqAborted")):e})),a}(0,t,i||e.conf.reqTimeout||15e3,n),o=a.status,l=[401,400].includes(o);if(!a.ok&&!l)throw new Error(`${at("reqGot")} ${o}`);let c=yield a.json();const d=(i,s)=>{Kt(e,t,n).then((e=>{i(e)})).catch((e=>{s(e)}))};if((null==(s=c.data)?void 0:s.need_captcha)?c=yield new Promise(((t,n)=>{e.checkCaptcha({imgData:c.data.img_data,iframe:c.data.iframe,onSuccess:()=>{d(t,n)},onCancel:()=>{n(c)}})})):((null==(r=c.data)?void 0:r.need_login)||l)&&(c=yield new Promise(((t,n)=>{e.checkAdmin({onSuccess:()=>{d(t,n)},onCancel:()=>{n(c)}})}))),!c.success)throw c;return c}))}function Yt(e){const t=new FormData;return Object.keys(e).forEach((n=>t.append(n,String(e[n])))),t}!function(){function e(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function t(e,t){for(var n=0;n({user:e.data.user,is_login:e.data.is_login,unread:e.data.unread||[],unread_count:e.data.unread_count||0}))),abort:()=>{n.abort()}}}loginStatus(){return __async(this,null,(function*(){return(yield this.POST("/login-status",{name:lt.data.nick,email:lt.data.email}))||{is_login:!1,is_admin:!1}}))}logout(){return __async(this,null,(function*(){return this.POST("/logout")}))}markRead(e,t,n=!1){const i={comment_id:e,notify_key:t};return n&&(delete i.comment_id,delete i.notify_key,i.read_all=!0,i.name=lt.data.nick,i.email=lt.data.email),this.POST("/mark-read",i)}userList(e,t,n){return __async(this,null,(function*(){const i={offset:e||0,limit:t||15};n&&(i.type=n);return yield this.POST("/admin/user-get",i)}))}userAdd(e,t){return __async(this,null,(function*(){const n={name:e.name||"",email:e.email||"",password:t||"",link:e.link||"",is_admin:e.is_admin||!1,site_names:e.site_names_raw||"",receive_email:e.receive_email||!0,badge_name:e.badge_name||"",badge_color:e.badge_color||""};return(yield this.POST("/admin/user-add",n)).user}))}userEdit(e,t){return __async(this,null,(function*(){const n={id:e.id,name:e.name||"",email:e.email||"",password:t||"",link:e.link||"",is_admin:e.is_admin||!1,site_names:e.site_names_raw||"",receive_email:e.receive_email||!0,badge_name:e.badge_name||"",badge_color:e.badge_color||""};return(yield this.POST("/admin/user-edit",n)).user}))}userDel(e){return this.POST("/admin/user-del",{id:String(e)})}},system:class extends Xt{conf(){return __async(this,null,(function*(){return zt((yield this.POST("/conf")).frontend_conf||{})}))}getSettings(){return __async(this,null,(function*(){return yield this.POST("/admin/setting-get")}))}saveSettings(e){return __async(this,null,(function*(){return yield this.POST("/admin/setting-save",{data:e})}))}version(){return __async(this,null,(function*(){const e=yield fetch(`${this.api.baseURL}/version`,{method:"POST"});return yield e.json()}))}},captcha:class extends Xt{captchaGet(){return __async(this,null,(function*(){return(yield this.POST("/captcha/refresh")).img_data||""}))}captchaCheck(e){return __async(this,null,(function*(){return(yield this.POST("/captcha/check",{value:e})).img_data||""}))}captchaStatus(){return __async(this,null,(function*(){return(yield this.POST("/captcha/status"))||{is_pass:!1}}))}},admin:class extends Xt{cacheFlushAll(){return this.POST("/admin/cache-flush",{flush_all:!0})}cacheWarmUp(){return this.POST("/admin/cache-warm",{})}},upload:class extends Xt{imgUpload(e){return __async(this,null,(function*(){const t=Yt({name:lt.data.nick,email:lt.data.email,page_key:this.ctx.conf.pageKey});t.set("file",e);const n={method:"POST",body:t};return(yield this.Fetch("/img-upload",n)).data||{}}))}}};class en{constructor(e){__publicField(this,"ctx"),this.ctx=e,Object.entries(Jt).forEach((([e,t])=>{this[e]=new t(this,this.ctx)}))}get baseURL(){return`${this.ctx.conf.server}/api`}}function tn(e){const t={editor:e,isMoved:!1,move:e=>function(e,t){if(e.isMoved)return;e.isMoved=!0;const n=e.editor.getUI().$el;n.after(s('
      '));const i=s("
      ");t.after(i),i.replaceWith(n),n.classList.add("atk-fade-in")}(t,e),back:()=>function(e){var t;if(!e.isMoved)return;e.isMoved=!1,null==(t=e.editor.ctx.$root.querySelector(".atk-editor-travel-placeholder"))||t.replaceWith(e.editor.getUI().$el),e.editor.cancelReply()}(t)};return t}class nn{constructor(e){__publicField(this,"editor"),__publicField(this,"$panel"),__publicField(this,"$btn"),__publicField(this,"onHeaderInput"),__publicField(this,"contentTransformer"),__publicField(this,"onContentUpdated"),this.editor=e}get ctx(){return this.editor.ctx}registerPanel(e="
      "){return this.$panel=s(e),this.$panel}registerBtn(e){return this.$btn=s(`${e}`),this.$btn}registerHeaderInputEvt(e){this.onHeaderInput=e}registerContentTransformer(e){this.contentTransformer=e}registerContentUpdatedEvt(e){this.onContentUpdated=e}getPanel(){return this.$panel}getBtn(){return this.$btn}}__publicField(nn,"Name");class sn extends nn{constructor(e){super(e),__publicField(this,"emoticons",[]),__publicField(this,"loadingTask",null),__publicField(this,"$grpWrap"),__publicField(this,"$grpSwitcher"),__publicField(this,"isListLoaded",!1),__publicField(this,"isImgLoaded",!1),this.editor=e,this.registerPanel('
      '),this.registerBtn(this.ctx.$t("emoticon")),this.registerContentTransformer((e=>this.transEmoticonImageText(e))),window.setTimeout((()=>{this.loadEmoticonsData()}),1e3)}onPanelShow(){(()=>{__async(this,null,(function*(){yield this.loadEmoticonsData(),this.isImgLoaded||(this.initEmoticonsList(),this.isImgLoaded=!0),setTimeout((()=>{this.changeListHeight()}),30)}))})()}onPanelHide(){this.$panel.parentElement.style.height=""}loadEmoticonsData(){return __async(this,null,(function*(){this.isListLoaded||(null===this.loadingTask?(this.loadingTask=(()=>__async(this,null,(function*(){g(this.$panel),this.emoticons=yield this.handleData(this.ctx.conf.emoticons),f(this.$panel),this.loadingTask=null,this.isListLoaded=!0})))(),yield this.loadingTask):yield this.loadingTask)}))}handleData(e){return __async(this,null,(function*(){if(!Array.isArray(e)&&["object","string"].includes(typeof e)&&(e=[e]),!Array.isArray(e))return _(this.$panel,"表情包数据必须为 Array/Object/String 类型"),f(this.$panel),[];const t=t=>{"object"==typeof t&&(t.name&&e.find((e=>e.name===t.name))||e.push(t))},n=e=>__async(this,null,(function*(){yield Promise.all(e.map(((e,i)=>__async(this,null,(function*(){if("object"!=typeof e||Array.isArray(e)){if(Array.isArray(e))yield n(e);else if("string"==typeof e){const i=yield this.remoteLoad(e);Array.isArray(i)?yield n(i):"object"==typeof i&&t(i)}}else t(e)})))))}));return yield n(e),e.forEach((e=>{if(this.isOwOFormat(e)){this.convertOwO(e).forEach((e=>{t(e)}))}else Array.isArray(e)&&e.forEach((e=>{t(e)}))})),e=e.filter((e=>"object"==typeof e&&!Array.isArray(e)&&!!e&&!!e.name)),this.solveNullKey(e),this.solveSameKey(e),e}))}remoteLoad(e){return __async(this,null,(function*(){if(!e)return[];try{const t=yield fetch(e);return yield t.json()}catch(t){return f(this.$panel),_(this.$panel,`表情加载失败 ${String(t)}`),[]}}))}solveNullKey(e){e.forEach((e=>{e.items.forEach(((t,n)=>{t.key||(t.key=`${e.name} ${n+1}`)}))}))}solveSameKey(e){const t={};e.forEach((e=>{e.items.forEach((e=>{e.key&&""!==String(e.key).trim()&&(t[e.key]?t[e.key]++:t[e.key]=1,t[e.key]>1&&(e.key=`${e.key} ${t[e.key]}`))}))}))}isOwOFormat(e){try{return"object"==typeof e&&!!Object.values(e).length&&Array.isArray(Object.keys(Object.values(e)[0].container))&&Object.keys(Object.values(e)[0].container[0]).includes("icon")}catch(t){return!1}}convertOwO(e){const t=[];return Object.entries(e).forEach((([e,n])=>{const i={name:e,type:n.type,items:[]};n.container.forEach(((t,n)=>{const s=t.icon;if(/<(img|IMG)/.test(s)){const e=/src=["'](.*?)["']/.exec(s);e&&e.length>1&&(t.icon=e[1])}i.items.push({key:t.text||`${e} ${n+1}`,val:t.icon})})),t.push(i)})),t}initEmoticonsList(){this.$grpWrap=s('
      '),this.$panel.append(this.$grpWrap),this.emoticons.forEach(((e,t)=>{const n=s('');this.$grpWrap.append(n),n.setAttribute("data-index",String(t)),n.setAttribute("data-grp-name",e.name),n.setAttribute("data-type",e.type),e.items.forEach((t=>{const i=s('');if(n.append(i),t.key&&!new RegExp(`^(${e.name})?\\s?[0-9]+$`).test(t.key)&&i.setAttribute("title",t.key),"image"===e.type){const e=document.createElement("img");e.src=t.val,e.alt=t.key,i.append(e)}else i.innerText=t.val;i.onclick=()=>{"image"===e.type?this.editor.insertContent(`:[${t.key}]`):this.editor.insertContent(t.val||"")}}))})),this.emoticons.length>1&&(this.$grpSwitcher=s('
      '),this.$panel.append(this.$grpSwitcher),this.emoticons.forEach(((e,t)=>{const n=s("");n.innerText=e.name,n.setAttribute("data-index",String(t)),n.onclick=()=>this.openGrp(t),this.$grpSwitcher.append(n)}))),this.emoticons.length>0&&this.openGrp(0)}openGrp(e){var t,n,i;Array.from(this.$grpWrap.children).forEach((t=>{const n=t;n.getAttribute("data-index")!==String(e)?n.style.display="none":n.style.display=""})),null==(t=this.$grpSwitcher)||t.querySelectorAll("span.active").forEach((e=>e.classList.remove("active"))),null==(i=null==(n=this.$grpSwitcher)?void 0:n.querySelector(`span[data-index="${e}"]`))||i.classList.add("active"),this.changeListHeight()}changeListHeight(){}transEmoticonImageText(e){return this.emoticons&&Array.isArray(this.emoticons)?(this.emoticons.forEach((t=>{"image"===t.type&&Object.entries(t.items).forEach((([t,n])=>{e=e.split(`:[${n.key}]`).join(``)}))})),e):e}}__publicField(sn,"Name","emoticons");class rn extends nn{constructor(e){super(e),__publicField(this,"$imgUploadInput"),__publicField(this,"allowImgExts",["png","jpg","jpeg","gif","bmp","svg","webp"]),this.$imgUploadInput=document.createElement("input"),this.$imgUploadInput.type="file",this.$imgUploadInput.style.display="none",this.$imgUploadInput.accept=this.allowImgExts.map((e=>`.${e}`)).join(",");const t=this.registerBtn(`${this.ctx.$t("image")}`);t.after(this.$imgUploadInput),t.onclick=()=>{const e=this.$imgUploadInput;e.onchange=()=>{(()=>{__async(this,null,(function*(){if(!e.files||0===e.files.length)return;const t=e.files[0];this.uploadImg(t)}))})()},e.click()},this.ctx.conf.imgUpload||this.getBtn().setAttribute("atk-only-admin-show","");const n=e=>{if(e)for(let t=0;t{e.stopPropagation(),e.preventDefault()})),this.editor.getUI().$textarea.addEventListener("drop",(e=>{var t;const i=null==(t=e.dataTransfer)?void 0:t.files;(null==i?void 0:i.length)&&(e.preventDefault(),n(i))})),this.editor.getUI().$textarea.addEventListener("paste",(e=>{var t;const i=null==(t=e.clipboardData)?void 0:t.files;(null==i?void 0:i.length)&&(e.preventDefault(),n(i))}))}uploadImg(e){return __async(this,null,(function*(){const t=/[^.]+$/.exec(e.name);if(!t||!this.allowImgExts.includes(t[0]))return;if(!lt.checkHasBasicUserInfo())return void this.editor.showNotify(this.ctx.$t("uploadLoginMsg"),"w");let n="\n";""===this.editor.getUI().$textarea.value.trim()&&(n="");const i=`${n}![](Uploading ${e.name}...)`;let s;this.editor.insertContent(i);try{s=this.ctx.conf.imgUploader?{img_url:yield this.ctx.conf.imgUploader(e)}:yield this.ctx.getApi().upload.imgUpload(e)}catch(r){console.error(r),this.editor.showNotify(`${this.ctx.$t("uploadFail")},${r.msg}`,"e")}if(s&&s.img_url){let e=s.img_url;h(e)||(e=u(this.ctx,e)),this.editor.setContent(this.editor.getUI().$textarea.value.replace(i,`${n}![](${e})`))}else this.editor.setContent(this.editor.getUI().$textarea.value.replace(i,""))}))}}__publicField(rn,"Name","upload");class an extends nn{constructor(e){super(e),__publicField(this,"isBind",!1),this.registerPanel('
      ');let t=this.editor.$t("preview");this.ctx.getMarkedInstance()&&(t+=' '),this.registerBtn(t),this.registerContentUpdatedEvt((e=>{this.updateContent()}))}onPanelShow(){if(this.updateContent(),!this.isBind){const e=()=>{this.updateContent()};this.editor.getUI().$textarea.addEventListener("input",e),this.editor.getUI().$textarea.addEventListener("change",e),this.isBind=!0}}updateContent(){"none"!==this.$panel.style.display&&(this.$panel.innerHTML=this.editor.getContentMarked())}}__publicField(an,"Name","preview");class on extends nn{constructor(e){super(e),__publicField(this,"queryUserInfo",{timeout:null,abortFunc:null}),this.registerHeaderInputEvt(((e,t)=>{"nick"!==e&&"email"!==e||this.fetchUserInfo()})),this.editor.getUI().$link.addEventListener("change",(()=>{const e=this.editor.getUI().$link.value.trim();e&&!/^(http|https):\/\//.test(e)&&(this.editor.getUI().$link.value=`https://${e}`,lt.update({link:this.editor.getUI().$link.value}))}))}fetchUserInfo(){lt.logout(),this.queryUserInfo.timeout&&window.clearTimeout(this.queryUserInfo.timeout),this.queryUserInfo.abortFunc&&this.queryUserInfo.abortFunc(),this.queryUserInfo.timeout=window.setTimeout((()=>{this.queryUserInfo.timeout=null;const{req:e,abort:t}=this.ctx.getApi().user.userGet(lt.data.nick,lt.data.email);this.queryUserInfo.abortFunc=t,e.then((e=>{var t;e.is_login||lt.logout(),this.ctx.updateNotifies(e.unread),lt.checkHasBasicUserInfo()&&!e.is_login&&(null==(t=e.user)?void 0:t.is_admin)&&this.showLoginDialog(),e.user&&e.user.link&&(this.editor.getUI().$link.value=e.user.link,lt.update({link:e.user.link}))})).catch((()=>{})).finally((()=>{this.queryUserInfo.abortFunc=null}))}),400)}showLoginDialog(){this.ctx.checkAdmin({onSuccess:()=>{}})}}__publicField(on,"Name","headerInput");const ln=[sn,rn,an,on];function cn(e){const t={editor:e,plugList:{},openedPlugName:null,openPlugPanel:e=>dn(t,e),closePlugPanel:()=>hn(t),triggerHeaderInputEvt:(e,n)=>function(e,t,n){Object.entries(e.plugList).forEach((([e,i])=>{i.onHeaderInput&&i.onHeaderInput(t,n)}))}(t,e,n),triggerContentUpdatedEvt:e=>function(e,t){Object.entries(e.plugList).forEach((([e,n])=>{n.onContentUpdated&&n.onContentUpdated(t)}))}(t,e),getTransformedContent:e=>function(e,t){let n=t;return Object.entries(e.plugList).forEach((([e,t])=>{t.contentTransformer&&(n=t.contentTransformer(n))})),n}(t,e)};e.getUI().$plugPanelWrap.innerHTML="",e.getUI().$plugPanelWrap.style.display="none",e.getUI().$plugBtnWrap.innerHTML="";const n=[{k:"upload",v:(i=e.conf).imgUpload},{k:"emoticons",v:i.emoticons},{k:"preview",v:i.preview}].filter((e=>!e.v)).flatMap((e=>e.k));var i;return ln.filter((e=>!n.includes(e.Name))).forEach((e=>{!function(e,t){const n=t.Name,i=new t(e.editor);e.plugList[n]=i,function(e,t,n){const i=n.getBtn();if(!i)return;e.editor.getUI().$plugBtnWrap.appendChild(i),i.onclick=i.onclick||(()=>{e.editor.getUI().$plugBtnWrap.querySelectorAll(".active").forEach((e=>e.classList.remove("active"))),t!==e.openedPlugName?(dn(e,t),i.classList.add("active")):hn(e)});const s=n.getPanel();s&&(s.setAttribute("data-plug-name",t),s.style.display="none",e.editor.getUI().$plugPanelWrap.appendChild(s))}(e,n,i)}(t,e)})),t}function dn(e,t){Object.entries(e.plugList).forEach((([e,n])=>{const i=n.getPanel();i&&(e===t?(i.style.display="",n.onPanelShow&&n.onPanelShow()):(i.style.display="none",n.onPanelHide&&n.onPanelHide()))})),e.editor.getUI().$plugPanelWrap.style.display="",e.openedPlugName=t}function hn(e){if(!e.openedPlugName)return;const t=e.plugList[e.openedPlugName];t&&(t.onPanelHide&&t.onPanelHide(),e.editor.getUI().$plugPanelWrap.style.display="none",e.openedPlugName=null)}function un(e){const t={editor:e,comment:void 0,setReply:(e,n,i)=>function(e,t,n,i=!0){e.editor.cancelEditComment(),pn(e);const r=e.editor.getUI();r.$sendReply||(r.$sendReply=s(`
      ${e.editor.$t("reply")} ×
      `),r.$sendReply.querySelector(".atk-text").innerText=`@${t.nick}`,r.$sendReply.addEventListener("click",(()=>{e.editor.cancelReply()})),r.$textareaWrap.append(r.$sendReply));e.comment=t,e.editor.travel(n),i&&k(r.$el);r.$textarea.focus()}(t,e,n,i),cancelReply:()=>pn(t)};return t}function pn(e){if(!e.comment)return;const t=e.editor.getUI();t.$sendReply&&(t.$sendReply.remove(),t.$sendReply=void 0),e.comment=void 0,e.editor.travelBack()}function mn(e){const t={editor:e,comment:void 0,setEdit:(e,n)=>function(e,t,n){gn(e),e.editor.cancelReply();const i=e.editor.getUI();if(!i.$editCancelBtn){const t=s(`
      ${e.editor.$t("editCancel")} ×
      `);t.onclick=()=>{gn(e)},i.$textareaWrap.append(t),i.$editCancelBtn=t}e.comment=t,i.$header.style.display="none",e.editor.travel(n),i.$nick.value=t.nick||"",i.$email.value=t.email||"",i.$link.value=t.link||"",e.editor.setContent(t.content),i.$textarea.focus(),e.editor.refreshSendBtnText()}(t,e,n),cancelEdit:()=>gn(t)};return function(e){e.editor.getSubmitManager().registerCustom({activeCond:()=>!!e.comment,req:()=>__async(this,null,(function*(){const t={content:e.editor.getFinalContent(),nick:e.editor.getUI().$nick.value,email:e.editor.getUI().$email.value,link:e.editor.getUI().$link.value};return yield e.editor.ctx.getApi().comment.commentEdit(__spreadValues(__spreadValues({},e.comment),t))})),post:t=>{e.editor.ctx.updateComment(t)}})}(t),t}function gn(e){if(!e.comment)return;const t=e.editor.getUI();t.$editCancelBtn&&(t.$editCancelBtn.remove(),t.$editCancelBtn=void 0),e.comment=void 0,e.editor.travelBack();const{nick:n,email:i,link:s}=lt.data;t.$nick.value=n,t.$email.value=i,t.$link.value=s,e.editor.setContent(""),e.editor.refreshSendBtnText(),t.$header.style.display=""}function fn(e){const t={editor:e,do:()=>function(e){return __async(this,null,(function*(){if(""===e.editor.getFinalContent().trim())return void e.editor.focus();const t=e.customs.find((e=>e.activeCond()));e.editor.ctx.trigger("editor-submit"),e.editor.showLoading();try{let n;(null==t?void 0:t.pre)&&t.pre(),n=(null==t?void 0:t.req)?yield t.req():yield function(e){return __async(this,null,(function*(){const t=yield e.editor.ctx.getApi().comment.add(__spreadValues({},function(e){var t;const{nick:n,email:i,link:s}=lt.data,r=e.editor.ctx.conf,a=null==(t=e.editor.getReplyManager())?void 0:t.comment;return{content:e.editor.getFinalContent(),nick:n,email:i,link:s,rid:a?a.id:0,page_key:a?a.page_key:r.pageKey,page_title:a?void 0:r.pageTitle,site_name:a?a.site_name:r.site}}(e)));return t}))}(e),(null==t?void 0:t.post)?t.post(n):function(e,t){const n=e.editor.getReplyManager(),i=e.editor.ctx.conf;(null==n?void 0:n.comment)&&n.comment.page_key!==i.pageKey&&window.open(`${n.comment.page_url}#atk-comment-${t.id}`);e.editor.ctx.insertComment(t)}(e,n)}catch(n){return console.error(n),void e.editor.showNotify(`${e.editor.$t("commentFail")},${n.msg||String(n)}`,"e")}finally{e.editor.hideLoading()}e.editor.reset(),e.editor.ctx.trigger("editor-submitted")}))}(t),customs:[],registerCustom:e=>{t.customs.push(e)}};return t}const kn={localStorage:function(e){const t=window.localStorage.getItem("ArtalkContent")||"";""!==t.trim()&&(e.showNotify(e.$t("restoredMsg"),"i"),e.setContent(t));e.getUI().$textarea.addEventListener("input",(()=>e.saveToLocalStorage()))},header:function(e){const t=e.getHeaderInputEls();Object.entries(t).forEach((([t,n])=>{n.value=lt.data[t]||"",n.addEventListener("input",(()=>function(e,t,n){var i;if(e.isEditMode)return;lt.update({[t]:n.value.trim()}),null==(i=e.getPlugs())||i.triggerHeaderInputEvt(t,n)}(e,t,n))),n.placeholder=`${e.$t(t)}`}))},textarea:function(e){e.getUI().$textarea.placeholder=e.ctx.conf.placeholder||e.$t("placeholder"),e.getUI().$textarea.addEventListener("keydown",(t=>{9===(t.keyCode||t.which)&&(t.preventDefault(),e.insertContent("\t"))})),e.getUI().$textarea.addEventListener("input",(()=>{e.adjustTextareaHeight()}))},submitBtn:function(e){e.refreshSendBtnText(),e.getUI().$submitBtn.addEventListener("click",(()=>e.submit()))},submitManager:function(e){e.setSubmitManager(fn(e))},plugs:function(e){e.setPlugs(cn(e))},mover:function(e){if(!e.conf.editorTravel)return;e.setMover(tn(e))},replyManager:function(e){e.setReplyManager(un(e))},editModeManager:function(e){e.setEditModeManager(mn(e))}};const yn={$header:".atk-header",$nick:'.atk-header [name="nick"]',$email:'.atk-header [name="email"]',$link:'.atk-header [name="link"]',$textareaWrap:".atk-textarea-wrap",$textarea:".atk-textarea",$bottom:".atk-bottom",$submitBtn:".atk-send-btn",$notifyWrap:".atk-notify-wrap",$plugBtnWrap:".atk-plug-btn-wrap",$plugPanelWrap:".atk-plug-panel-wrap"};class bn extends m{constructor(e){super(e),__publicField(this,"ui"),__publicField(this,"plugs"),__publicField(this,"mover"),__publicField(this,"reply"),__publicField(this,"editMode"),__publicField(this,"submitManager"),this.ui=function(){const e=s('
      \n
      \n \n \n \n
      \n
      \n \n
      \n \n
      \n
      \n
      \n \n
      \n
      \n
      \n
      \n'),t={$el:e};return Object.entries(yn).forEach((([n,i])=>{t[n]=e.querySelector(i)})),t}(),this.$el=this.ui.$el,this.ctx.on("conf-loaded",(()=>{var e;e=this,Object.entries(kn).forEach((([t,n])=>{n(e)}))}))}getUI(){return this.ui}getPlugs(){return this.plugs}setPlugs(e){this.plugs=e}setMover(e){this.mover=e}setReplyManager(e){this.reply=e}getReplyManager(){return this.reply}get isReplyMode(){var e;return!!(null==(e=this.reply)?void 0:e.comment)}setEditModeManager(e){this.editMode=e}get isEditMode(){var e;return!!(null==(e=this.editMode)?void 0:e.comment)}setSubmitManager(e){this.submitManager=e}getSubmitManager(){return this.submitManager}getHeaderInputEls(){return{nick:this.ui.$nick,email:this.ui.$email,link:this.ui.$link}}saveToLocalStorage(){window.localStorage.setItem("ArtalkContent",this.getContentOriginal().trim())}refreshSendBtnText(){this.isEditMode?this.ui.$submitBtn.innerText=this.$t("save"):this.ui.$submitBtn.innerText=this.ctx.conf.sendBtn||this.$t("send")}getFinalContent(){let e=this.getContentOriginal();return this.plugs&&(e=this.plugs.getTransformedContent(e)),e}getContentOriginal(){return this.ui.$textarea.value||""}getContentMarked(){return Xe(this.ctx,this.getFinalContent())}setContent(e){this.ui.$textarea.value=e,this.saveToLocalStorage(),this.plugs&&this.plugs.triggerContentUpdatedEvt(e),window.setTimeout((()=>{this.adjustTextareaHeight()}),80)}insertContent(e){if(document.selection)this.ui.$textarea.focus(),document.selection.createRange().text=e,this.ui.$textarea.focus();else if(this.ui.$textarea.selectionStart||0===this.ui.$textarea.selectionStart){const t=this.ui.$textarea.selectionStart,n=this.ui.$textarea.selectionEnd,i=this.ui.$textarea.scrollTop;this.setContent(this.ui.$textarea.value.substring(0,t)+e+this.ui.$textarea.value.substring(n,this.ui.$textarea.value.length)),this.ui.$textarea.focus(),this.ui.$textarea.selectionStart=t+e.length,this.ui.$textarea.selectionEnd=t+e.length,this.ui.$textarea.scrollTop=i}else this.ui.$textarea.focus(),this.ui.$textarea.value+=e}adjustTextareaHeight(){const e=this.ui.$textarea.offsetHeight-this.ui.$textarea.clientHeight;this.ui.$textarea.style.height="0px",this.ui.$textarea.style.height=`${this.ui.$textarea.scrollHeight+e}px`}focus(){this.ui.$textarea.focus()}reset(){this.setContent(""),this.cancelReply(),this.cancelEditComment()}setReply(e,t,n=!0){var i;null==(i=this.reply)||i.setReply(e,t,n)}cancelReply(){var e;null==(e=this.reply)||e.cancelReply()}setEditComment(e,t){var n;null==(n=this.editMode)||n.setEdit(e,t)}cancelEditComment(){var e;null==(e=this.editMode)||e.cancelEdit()}showNotify(e,t){y(this.ui.$notifyWrap,e,t)}showLoading(){g(this.ui.$el)}hideLoading(){f(this.ui.$el)}submit(){return __async(this,null,(function*(){this.submitManager&&(yield this.submitManager.do())}))}close(){this.ui.$textareaWrap.querySelector(".atk-comment-closed")||this.ui.$textareaWrap.prepend(s(`
      ${this.$t("onlyAdminCanReply")}
      `)),lt.data.isAdmin?(this.ui.$textarea.style.display="",this.ui.$bottom.style.display=""):(this.ui.$textarea.style.display="none",this.closePlugPanel(),this.ui.$bottom.style.display="none")}open(){var e;null==(e=this.ui.$textareaWrap.querySelector(".atk-comment-closed"))||e.remove(),this.ui.$textarea.style.display="",this.ui.$bottom.style.display=""}travel(e){var t;null==(t=this.mover)||t.move(e)}travelBack(){var e;null==(e=this.mover)||e.back()}openPlugPanel(e){var t;null==(t=this.plugs)||t.openPlugPanel(e)}closePlugPanel(){var e;null==(e=this.plugs)||e.closePlugPanel()}}class _n extends m{constructor(e){super(e),__publicField(this,"layer"),__publicField(this,"$header"),__publicField(this,"$closeBtn"),__publicField(this,"$iframeWrap"),__publicField(this,"$iframe"),__publicField(this,"firstShow",!0),this.$el=s('
      \n
      \n
      \n
      \n
      \n
      \n
      \n
      \n'),this.$header=this.$el.querySelector(".atk-sidebar-header"),this.$closeBtn=this.$header.querySelector(".atk-sidebar-close"),this.$iframeWrap=this.$el.querySelector(".atk-sidebar-iframe-wrap"),this.$closeBtn.onclick=()=>{this.hide()},this.ctx.on("user-changed",(()=>{this.firstShow=!0}))}show(){return __async(this,arguments,(function*(e={}){if(this.$el.style.transform="",null==this.layer&&(this.layer=new x(this.ctx,"sidebar",this.$el),this.layer.afterHide=()=>{!0===this.ctx.conf.editorTravel&&this.ctx.editorTravelBack()}),this.layer.show(),(()=>{__async(this,null,(function*(){var t;const n=yield this.ctx.getApi().user.loginStatus();n.is_admin&&!n.is_login&&(null==(t=this.layer)||t.hide(),this.firstShow=!0,this.ctx.checkAdmin({onSuccess:()=>{setTimeout((()=>{this.show(e)}),500)},onCancel:()=>{}}))}))})(),this.firstShow){this.$iframeWrap.innerHTML="",this.$iframe=s("");const t=u(this.ctx,"/sidebar/"),n={pageKey:this.conf.pageKey,site:this.conf.site||"",user:JSON.stringify(lt.data),time:+new Date};e.view&&(n.view=e.view),this.conf.darkMode&&(n.darkMode="1"),"string"==typeof this.conf.locale&&(n.locale=this.conf.locale);const i=new URLSearchParams(n);this.iframeLoad(`${t}?${i.toString()}`),this.$iframeWrap.append(this.$iframe),this.firstShow=!1}else{const e=this.$iframe.src.includes("darkMode=1");this.conf.darkMode&&!e&&this.iframeLoad(`${this.$iframe.src}&darkMode=1`),!this.conf.darkMode&&e&&this.iframeLoad(this.$iframe.src.replace("&darkMode=1",""))}setTimeout((()=>{this.$el.style.transform="translate(0, 0)"}),100),setTimeout((()=>{this.ctx.updateNotifies([])}),0),this.ctx.trigger("sidebar-show")}))}hide(){var e;this.$el.style.transform="",null==(e=this.layer)||e.hide(),this.ctx.trigger("sidebar-hide")}iframeLoad(e){this.$iframe&&(this.$iframe.src=e,g(this.$iframeWrap),this.$iframe.onload=()=>{f(this.$iframeWrap)})}}const $n={i18n(e){rt(e.conf.locale),e.on("conf-loaded",(()=>{rt(e.conf.locale)}))},markdown(){!function(){try{if(!ue.name)return}catch(i){return}const e=new ue.Renderer,t=e.link;e.link=(n,i,s)=>{const r=null==n?void 0:n.startsWith(`${window.location.protocol}//${window.location.hostname}`);return t.call(e,n,i,s).replace(/^{const n=t||"plaintext";let i=e;return window.hljs?n&&window.hljs.getLanguage(n)&&(i=window.hljs.highlight(n,e).value):i=Ge(e),`
      \n${i.replace(/&/g,"&")}\n
      `};const n=ue;ue.setOptions({renderer:e,pedantic:!1,gfm:!0,breaks:!0,smartLists:!0,smartypants:!0,xhtml:!1,sanitize:!1,silent:!0}),Ke=n}()},user:e=>(lt.setContext(e),lt),api:e=>new en(e),checkerLauncher:e=>new Gt(e),editor(e){const t=new bn(e);return e.$root.appendChild(t.$el),t},list(e){const t=new Wt(e);return e.$root.appendChild(t.$el),t.fetchComments(0),t},layer(e){x.BodyOrgOverflow=document.body.style.overflow,x.BodyOrgPaddingRight=document.body.style.paddingRight},sidebarLayer:e=>new _n(e),eventsDefault(e){window.addEventListener("hashchange",(()=>{e.listHashGotoCheck()})),e.on("user-changed",(()=>{e.checkAdminShowEl(),e.listRefreshUI()}))},darkMode(e){S(e),e.on("conf-loaded",(()=>{S(e)}))}};function xn(e){return __async(this,null,(function*(){const t=e.ctx.conf.countEl;t&&document.querySelector(t)&&vn(e,{api:"page_comment",countEl:t});const n=e.pvAdd?yield e.ctx.getApi().page.pv():void 0,i=e.ctx.conf.pvEl;i&&document.querySelector(i)&&vn(e,{api:"page_pv",countEl:i,curtPageCount:n})}))}function vn(e,t){return __async(this,null,(function*(){let n={};const i=e.ctx.conf.pageKey;t.curtPageCount&&(n[i]=t.curtPageCount);let s=Array.from(document.querySelectorAll(t.countEl)).map((e=>e.getAttribute("data-page-key")||i)).filter((e=>void 0===n[e]));if(s=[...new Set(s)],s.length>0){const i=yield e.ctx.getApi().page.stat(t.api,s);n=__spreadValues(__spreadValues({},n),i)}document.querySelectorAll(t.countEl).forEach((e=>{const t=e.getAttribute("data-page-key")||i;e.innerHTML=`${Number(n[t]||0)}`}))}))}const wn=class e{constructor(t){__publicField(this,"conf"),__publicField(this,"ctx"),__publicField(this,"$root"),e.instance&&e.destroy(),this.conf=qt(t),this.conf.el instanceof HTMLElement&&(this.$root=this.conf.el),this.ctx=new Nt(this.conf,this.$root),Object.entries($n).forEach((([t,n])=>{if(e.DisabledComponents.includes(t))return;const i=n(this.ctx);i&&this.ctx.inject(t,i)})),e.plugins.forEach((e=>{"function"==typeof e&&e(this.ctx)}))}static init(t){return this.instance&&e.destroy(),this.instance=new e(t),this.instance}use(t){e.plugins.push(t),"function"==typeof t&&t(this.ctx)}update(t){if(!e.instance)throw Error("cannot call `update` function before call `load`");return e.instance.ctx.updateConf(t),e.instance}reload(){this.ctx.listReload()}destroy(){if(!e.instance)throw Error("cannot call `destroy` function before call `load`");e.instance.$root.remove(),delete e.instance}on(e,t){this.ctx.on(e,t,"external")}off(e,t){this.ctx.off(e,t,"external")}trigger(e,t){this.ctx.trigger(e,t,"external")}setDarkMode(e){this.ctx.setDarkMode(e)}static use(e){this.plugins.push(e),this.instance&&"function"==typeof e&&e(this.instance.ctx)}static update(e){var t;return null==(t=this.instance)?void 0:t.update(e)}static reload(){var e;null==(e=this.instance)||e.reload()}static destroy(){var e;null==(e=this.instance)||e.destroy()}static on(e,t){var n;null==(n=this.instance)||n.on(e,t)}static off(e,t){var n;null==(n=this.instance)||n.off(e,t)}static trigger(e,t){var n;null==(n=this.instance)||n.trigger(e,t)}static setDarkMode(e){var t;null==(t=this.instance)||t.setDarkMode(e)}static loadCountWidget(e){const t=new Nt(qt(e));t.inject("api",new en(t)),xn({ctx:t,pvAdd:!1})}static LoadCountWidget(e){console.warn("The method `LoadCountWidget` is deprecated, please use `loadCountWidget` instead."),this.loadCountWidget(e)}};return __publicField(wn,"instance"),__publicField(wn,"ListLite",jt),__publicField(wn,"defaults",Dt),__publicField(wn,"plugins",[e=>{e.conf.useBackendConf?e.on("list-loaded",(()=>{xn({ctx:e,pvAdd:!0})})):xn({ctx:e,pvAdd:!0})}]),__publicField(wn,"DisabledComponents",[]),wn})); +var __defProp=Object.defineProperty,__defProps=Object.defineProperties,__getOwnPropDescs=Object.getOwnPropertyDescriptors,__getOwnPropSymbols=Object.getOwnPropertySymbols,__hasOwnProp=Object.prototype.hasOwnProperty,__propIsEnum=Object.prototype.propertyIsEnumerable,__defNormalProp=(e,t,n)=>t in e?__defProp(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,__spreadValues=(e,t)=>{for(var n in t||(t={}))__hasOwnProp.call(t,n)&&__defNormalProp(e,n,t[n]);if(__getOwnPropSymbols)for(var n of __getOwnPropSymbols(t))__propIsEnum.call(t,n)&&__defNormalProp(e,n,t[n]);return e},__spreadProps=(e,t)=>__defProps(e,__getOwnPropDescs(t)),__publicField=(e,t,n)=>(__defNormalProp(e,"symbol"!=typeof t?t+"":t,n),n),__accessCheck=(e,t,n)=>{if(!t.has(e))throw TypeError("Cannot "+n)},__privateAdd=(e,t,n)=>{if(t.has(e))throw TypeError("Cannot add the same private member more than once");t instanceof WeakSet?t.add(e):t.set(e,n)},__privateMethod=(e,t,n)=>(__accessCheck(e,t,"access private method"),n),__async=(e,t,n)=>new Promise(((i,s)=>{var r=e=>{try{o(n.next(e))}catch(t){s(t)}},a=e=>{try{o(n.throw(e))}catch(t){s(t)}},o=e=>e.done?i(e.value):Promise.resolve(e.value).then(r,a);o((n=n.apply(e,t)).next())}));!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):(e="undefined"!=typeof globalThis?globalThis:e||self).Artalk=t()}(this,(function(){var e,t,n,i;function s(e=""){const t=document.createElement("div");return t.innerHTML=e.trim(),t.firstElementChild||t}function r(e){return parseFloat(getComputedStyle(e,null).height.replace("px",""))}function a(e){const t=RegExp(`[?&]${e}=([^&]*)`).exec(window.location.search);return t&&decodeURIComponent(t[1].replace(/\+/g," "))}function o(e){const t=e.getBoundingClientRect();return{top:t.top+window.scrollY,left:t.left+window.scrollX}}function l(e,t){let n=e.toString();for(;n.length=13?e.replace(/Windows NT 10.0/,"Windows NT 11.0"):"macOS"===t.platform&&i>=11?e.replace(/(Mac OS X \d+_\d+_\d+|Mac OS X)/,`Mac OS X ${n.platformVersion.replace(/\./g,"_")}`):e}))}function h(e){let t;try{t=new URL(e)}catch(n){return!1}return"http:"===t.protocol||"https:"===t.protocol}function u(e,t){return function(e,t){return`${e.replace(/\/$/,"")}/${t.replace(/^\//,"")}`}(e.conf.server,t)}function p(e,t){const n=e=>e&&"object"==typeof e;return n(e)&&n(t)?(Object.keys(t).forEach((i=>{const s=e[i],r=t[i];Array.isArray(s)&&Array.isArray(r)?e[i]=s.concat(r):n(s)&&n(r)?e[i]=p(__spreadValues({},s),r):e[i]=r})),e):t}class m{constructor(e){__publicField(this,"$el"),__publicField(this,"ctx"),__publicField(this,"conf"),this.ctx=e,this.conf=e.conf}$t(e,t={}){return this.ctx.$t(e,t)}}function g(e,t){let n=e.querySelector(":scope > .atk-loading");n||(n=s(''),(null==t?void 0:t.transparentBg)&&(n.style.background="transparent"),e.appendChild(n)),n.style.display="";const i=n.querySelector(".atk-loading-spinner");i&&(i.style.display="none",window.setTimeout((()=>{i.style.display=""}),500))}function f(e){const t=e.querySelector(":scope > .atk-loading");t&&(t.style.display="none")}function k(e,t=!0){const n=o(e).top+r(e)/2-document.documentElement.clientHeight/2;t?window.scroll({top:n>0?n:0,left:0}):window.scroll(0,n>0?n:0)}function y(e,t,n){const i=s(`
      `);i.querySelector(".atk-notify-content").innerHTML=function(e){const t=document.createElement("div");return t.innerText=e,t.innerHTML}(t).replace("\n","
      "),e.appendChild(i);const r=()=>{i.classList.add("atk-fade-out"),setTimeout((()=>{i.remove()}),200)};let a;a=window.setTimeout((()=>{r()}),3e3),i.addEventListener("click",(()=>{r(),window.clearTimeout(a)}))}function b(e,t){!function(e,t,n="in"){e.classList.add(`atk-fade-${n}`);const i=()=>{e.classList.remove(`atk-fade-${n}`),e.removeEventListener("animationend",i),t&&t()};e.addEventListener("animationend",i)}(e,t,"in")}function _(e,t,n='Artalk Error'){let i=e.querySelector(".atk-error-layer");if(null===t)return void(null!==i&&i.remove());i||(i=s(`
      ${n}
      `),e.appendChild(i));const r=i.querySelector(".atk-error-text");r.innerHTML="",null!==t&&(t instanceof HTMLElement?r.appendChild(t):r.innerText=t)}const $=class e extends m{constructor(e,t,n){super(e),__publicField(this,"name"),__publicField(this,"$wrap"),__publicField(this,"$mask"),__publicField(this,"maskClickHideEnable",!0),__publicField(this,"afterHide"),this.name=t;const{$wrap:i,$mask:r}=v();this.$wrap=i,this.$mask=r,this.$el=this.$wrap.querySelector(`[data-layer-name="${t}"].atk-layer-item`),null===this.$el&&(n?this.$el=n:(this.$el=s(),this.$el.classList.add("atk-layer-item"))),this.$el.setAttribute("data-layer-name",t),this.$el.style.display="none",this.$wrap.append(this.$el)}getName(){return this.name}getWrapEl(){return this.$wrap}getEl(){return this.$el}show(){this.fireAllActionTimer(),this.$wrap.style.display="block",this.$mask.style.display="block",this.$mask.classList.add("atk-fade-in"),this.$el.style.display="",this.$mask.onclick=()=>{this.maskClickHideEnable&&this.hide()},this.pageBodyScrollBarHide()}hide(){this.afterHide&&this.afterHide(),this.$wrap.classList.add("atk-fade-out"),this.$el.style.display="none",this.pageBodyScrollBarShow(),this.newActionTimer((()=>{this.$wrap.style.display="none",this.checkCleanLayer()}),450),this.newActionTimer((()=>{this.$wrap.style.display="none",this.$wrap.classList.remove("atk-fade-out")}),200)}setMaskClickHide(e){this.maskClickHideEnable=e}pageBodyScrollBarHide(){document.body.style.overflow="hidden";const e=parseInt(window.getComputedStyle(document.body,null).getPropertyValue("padding-right"),10);document.body.style.paddingRight=`${function(){const e=document.createElement("p");e.style.width="100%",e.style.height="200px";const t=document.createElement("div");t.style.position="absolute",t.style.top="0px",t.style.left="0px",t.style.visibility="hidden",t.style.width="200px",t.style.height="150px",t.style.overflow="hidden",t.appendChild(e),document.body.appendChild(t);const n=e.offsetWidth;t.style.overflow="scroll";let i=e.offsetWidth;return n===i&&(i=t.clientWidth),document.body.removeChild(t),n-i}()+e||0}px`}pageBodyScrollBarShow(){document.body.style.overflow=e.BodyOrgOverflow,document.body.style.paddingRight=e.BodyOrgPaddingRight}newActionTimer(t,n){const i=()=>{t(),e.actionTimers=e.actionTimers.filter((e=>e.act!==i))},s=window.setTimeout((()=>i()),n);e.actionTimers.push({act:i,tid:s})}fireAllActionTimer(){e.actionTimers.forEach((e=>{clearTimeout(e.tid),e.act()}))}disposeNow(){this.$el.remove(),this.pageBodyScrollBarShow(),this.checkCleanLayer()}dispose(){this.hide(),this.$el.remove(),this.checkCleanLayer()}checkCleanLayer(){0===this.getWrapEl().querySelectorAll(".atk-layer-item").length&&(this.$wrap.style.display="none")}};__publicField($,"BodyOrgOverflow"),__publicField($,"BodyOrgPaddingRight"),__publicField($,"actionTimers",[]);let x=$;function v(){let e=document.querySelector(".atk-layer-wrap");e||(e=s(''),document.body.appendChild(e));const t=e.querySelector(".atk-layer-mask");return{$wrap:e,$mask:t}}const w=window.matchMedia("(prefers-color-scheme: dark)");let C;function S(e){T(e,e.conf.darkMode,!1)}function T(e,t,n=!0){const i=t=>{!function(e,t){t?e.$root.classList.add(E):e.$root.classList.remove(E);const{$wrap:n}=v();n&&(t?n.classList.add(E):n.classList.remove(E))}(e,t),n&&function(e,t){e.conf.darkMode=t}(e,t)};"auto"===t?(C||(C=e=>i(e.matches),w.addEventListener("change",C)),i(w.matches)):(C&&w.removeEventListener("change",C),i(t))}const E="atk-dark-mode";function L(){return{async:!1,baseUrl:null,breaks:!1,extensions:null,gfm:!0,headerIds:!1,headerPrefix:"",highlight:null,hooks:null,langPrefix:"language-",mangle:!1,pedantic:!1,renderer:null,sanitize:!1,sanitizer:null,silent:!1,smartypants:!1,tokenizer:null,walkTokens:null,xhtml:!1}}let A={async:!1,baseUrl:null,breaks:!1,extensions:null,gfm:!0,headerIds:!1,headerPrefix:"",highlight:null,hooks:null,langPrefix:"language-",mangle:!1,pedantic:!1,renderer:null,sanitize:!1,sanitizer:null,silent:!1,smartypants:!1,tokenizer:null,walkTokens:null,xhtml:!1};function F(e){A=e}const O=/[&<>"']/,R=new RegExp(O.source,"g"),M=/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/,P=new RegExp(M.source,"g"),I={"&":"&","<":"<",">":">",'"':""","'":"'"},B=e=>I[e];function U(e,t){if(t){if(O.test(e))return e.replace(R,B)}else if(M.test(e))return e.replace(P,B);return e}const D=/&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/gi;function q(e){return e.replace(D,((e,t)=>"colon"===(t=t.toLowerCase())?":":"#"===t.charAt(0)?"x"===t.charAt(1)?String.fromCharCode(parseInt(t.substring(2),16)):String.fromCharCode(+t.substring(1)):""))}const z=/(^|[^\[])\^/g;function j(e,t){e="string"==typeof e?e:e.source,t=t||"";const n={replace:(t,i)=>(i=(i="object"==typeof i&&"source"in i?i.source:i).replace(z,"$1"),e=e.replace(t,i),n),getRegex:()=>new RegExp(e,t)};return n}const W=/[^\w:]/g,N=/^$|^[a-z][a-z0-9+.-]*:|^[?#]/i;function H(e,t,n){if(e){let e;try{e=decodeURIComponent(q(n)).replace(W,"").toLowerCase()}catch(i){return null}if(0===e.indexOf("javascript:")||0===e.indexOf("vbscript:")||0===e.indexOf("data:"))return null}t&&!N.test(n)&&(n=function(e,t){V[" "+e]||(Q.test(e)?V[" "+e]=e+"/":V[" "+e]=X(e,"/",!0));e=V[" "+e];const n=-1===e.indexOf(":");return"//"===t.substring(0,2)?n?t:e.replace(Z,"$1")+t:"/"===t.charAt(0)?n?t:e.replace(G,"$1")+t:e+t}(t,n));try{n=encodeURI(n).replace(/%25/g,"%")}catch(i){return null}return n}const V={},Q=/^[^:]+:\/*[^/]*$/,Z=/^([^:]+:)[\s\S]*$/,G=/^([^:]+:\/*[^/]*)[\s\S]*$/;const K={exec:()=>null};function Y(e,t){const n=e.replace(/\|/g,((e,t,n)=>{let i=!1,s=t;for(;--s>=0&&"\\"===n[s];)i=!i;return i?"|":" |"})).split(/ \|/);let i=0;if(n[0].trim()||n.shift(),n.length>0&&!n[n.length-1].trim()&&n.pop(),t)if(n.length>t)n.splice(t);else for(;n.length0)return{type:"space",raw:t[0]}}code(e){const t=this.rules.block.code.exec(e);if(t){const e=t[0].replace(/^ {1,4}/gm,"");return{type:"code",raw:t[0],codeBlockStyle:"indented",text:this.options.pedantic?e:X(e,"\n")}}}fences(e){const t=this.rules.block.fences.exec(e);if(t){const e=t[0],n=function(e,t){const n=e.match(/^(\s+)(?:```)/);if(null===n)return t;const i=n[1];return t.split("\n").map((e=>{const t=e.match(/^\s+/);if(null===t)return e;const[n]=t;return n.length>=i.length?e.slice(i.length):e})).join("\n")}(e,t[3]||"");return{type:"code",raw:e,lang:t[2]?t[2].trim().replace(this.rules.inline._escapes,"$1"):t[2],text:n}}}heading(e){const t=this.rules.block.heading.exec(e);if(t){let e=t[2].trim();if(/#$/.test(e)){const t=X(e,"#");this.options.pedantic?e=t.trim():t&&!/ $/.test(t)||(e=t.trim())}return{type:"heading",raw:t[0],depth:t[1].length,text:e,tokens:this.lexer.inline(e)}}}hr(e){const t=this.rules.block.hr.exec(e);if(t)return{type:"hr",raw:t[0]}}blockquote(e){const t=this.rules.block.blockquote.exec(e);if(t){const e=t[0].replace(/^ *>[ \t]?/gm,""),n=this.lexer.state.top;this.lexer.state.top=!0;const i=this.lexer.blockTokens(e);return this.lexer.state.top=n,{type:"blockquote",raw:t[0],tokens:i,text:e}}}list(e){let t=this.rules.block.list.exec(e);if(t){let n=t[1].trim();const i=n.length>1,s={type:"list",raw:"",ordered:i,start:i?+n.slice(0,-1):"",loose:!1,items:[]};n=i?`\\d{1,9}\\${n.slice(-1)}`:`\\${n}`,this.options.pedantic&&(n=i?n:"[*+-]");const r=new RegExp(`^( {0,3}${n})((?:[\t ][^\\n]*)?(?:\\n|$))`);let a="",o="",l=!1;for(;e;){let n=!1;if(!(t=r.exec(e)))break;if(this.rules.block.hr.test(e))break;a=t[0],e=e.substring(a.length);let i=t[2].split("\n",1)[0].replace(/^\t+/,(e=>" ".repeat(3*e.length))),c=e.split("\n",1)[0],d=0;this.options.pedantic?(d=2,o=i.trimLeft()):(d=t[2].search(/[^ ]/),d=d>4?1:d,o=i.slice(d),d+=t[1].length);let h=!1;if(!i&&/^ *$/.test(c)&&(a+=c+"\n",e=e.substring(c.length+1),n=!0),!n){const t=new RegExp(`^ {0,${Math.min(3,d-1)}}(?:[*+-]|\\d{1,9}[.)])((?:[ \t][^\\n]*)?(?:\\n|$))`),n=new RegExp(`^ {0,${Math.min(3,d-1)}}((?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$)`),s=new RegExp(`^ {0,${Math.min(3,d-1)}}(?:\`\`\`|~~~)`),r=new RegExp(`^ {0,${Math.min(3,d-1)}}#`);for(;e;){const l=e.split("\n",1)[0];if(c=l,this.options.pedantic&&(c=c.replace(/^ {1,4}(?=( {4})*[^ ])/g," ")),s.test(c))break;if(r.test(c))break;if(t.test(c))break;if(n.test(e))break;if(c.search(/[^ ]/)>=d||!c.trim())o+="\n"+c.slice(d);else{if(h)break;if(i.search(/[^ ]/)>=4)break;if(s.test(i))break;if(r.test(i))break;if(n.test(i))break;o+="\n"+c}h||c.trim()||(h=!0),a+=l+"\n",e=e.substring(l.length+1),i=c.slice(d)}}s.loose||(l?s.loose=!0:/\n *\n *$/.test(a)&&(l=!0));let u,p=null;this.options.gfm&&(p=/^\[[ xX]\] /.exec(o),p&&(u="[ ] "!==p[0],o=o.replace(/^\[[ xX]\] +/,""))),s.items.push({type:"list_item",raw:a,task:!!p,checked:u,loose:!1,text:o,tokens:[]}),s.raw+=a}s.items[s.items.length-1].raw=a.trimRight(),s.items[s.items.length-1].text=o.trimRight(),s.raw=s.raw.trimRight();for(let e=0;e"space"===e.type)),n=t.length>0&&t.some((e=>/\n.*\n/.test(e.raw)));s.loose=n}if(s.loose)for(let e=0;e$/,"$1").replace(this.rules.inline._escapes,"$1"):"",i=t[3]?t[3].substring(1,t[3].length-1).replace(this.rules.inline._escapes,"$1"):t[3];return{type:"def",tag:e,raw:t[0],href:n,title:i}}}table(e){const t=this.rules.block.table.exec(e);if(t){const e={type:"table",raw:t[0],header:Y(t[1]).map((e=>({text:e,tokens:[]}))),align:t[2].replace(/^ *|\| *$/g,"").split(/ *\| */),rows:t[3]&&t[3].trim()?t[3].replace(/\n[ \t]*$/,"").split("\n"):[]};if(e.header.length===e.align.length){let t,n,i,s,r=e.align.length;for(t=0;t({text:e,tokens:[]})));for(r=e.header.length,n=0;n/i.test(t[0])&&(this.lexer.state.inLink=!1),!this.lexer.state.inRawBlock&&/^<(pre|code|kbd|script)(\s|>)/i.test(t[0])?this.lexer.state.inRawBlock=!0:this.lexer.state.inRawBlock&&/^<\/(pre|code|kbd|script)(\s|>)/i.test(t[0])&&(this.lexer.state.inRawBlock=!1),{type:this.options.sanitize?"text":"html",raw:t[0],inLink:this.lexer.state.inLink,inRawBlock:this.lexer.state.inRawBlock,block:!1,text:this.options.sanitize?this.options.sanitizer?this.options.sanitizer(t[0]):U(t[0]):t[0]}}link(e){const t=this.rules.inline.link.exec(e);if(t){const e=t[2].trim();if(!this.options.pedantic&&/^$/.test(e))return;const t=X(e.slice(0,-1),"\\");if((e.length-t.length)%2==0)return}else{const e=function(e,t){if(-1===e.indexOf(t[1]))return-1;let n=0;for(let i=0;i-1){const n=(0===t[0].indexOf("!")?5:4)+t[1].length+e;t[2]=t[2].substring(0,e),t[0]=t[0].substring(0,n).trim(),t[3]=""}}let n=t[2],i="";if(this.options.pedantic){const e=/^([^'"]*[^\s])\s+(['"])(.*)\2/.exec(n);e&&(n=e[1],i=e[3])}else i=t[3]?t[3].slice(1,-1):"";return n=n.trim(),/^$/.test(e)?n.slice(1):n.slice(1,-1)),J(t,{href:n?n.replace(this.rules.inline._escapes,"$1"):n,title:i?i.replace(this.rules.inline._escapes,"$1"):i},t[0],this.lexer)}}reflink(e,t){let n;if((n=this.rules.inline.reflink.exec(e))||(n=this.rules.inline.nolink.exec(e))){let e=(n[2]||n[1]).replace(/\s+/g," ");if(e=t[e.toLowerCase()],!e){const e=n[0].charAt(0);return{type:"text",raw:e,text:e}}return J(n,e,n[0],this.lexer)}}emStrong(e,t,n=""){let i=this.rules.inline.emStrong.lDelim.exec(e);if(!i)return;if(i[3]&&n.match(/[\p{L}\p{N}]/u))return;if(!(i[1]||i[2]||"")||!n||this.rules.inline.punctuation.exec(n)){const n=[...i[0]].length-1;let s,r,a=n,o=0;const l="*"===i[0][0]?this.rules.inline.emStrong.rDelimAst:this.rules.inline.emStrong.rDelimUnd;for(l.lastIndex=0,t=t.slice(-1*e.length+n);null!=(i=l.exec(t));){if(s=i[1]||i[2]||i[3]||i[4]||i[5]||i[6],!s)continue;if(r=[...s].length,i[3]||i[4]){a+=r;continue}if((i[5]||i[6])&&n%3&&!((n+r)%3)){o+=r;continue}if(a-=r,a>0)continue;r=Math.min(r,r+a+o);const t=[...e].slice(0,n+i.index+r+1).join("");if(Math.min(n,r)%2){const e=t.slice(1,-1);return{type:"em",raw:t,text:e,tokens:this.lexer.inlineTokens(e)}}const l=t.slice(2,-2);return{type:"strong",raw:t,text:l,tokens:this.lexer.inlineTokens(l)}}}}codespan(e){const t=this.rules.inline.code.exec(e);if(t){let e=t[2].replace(/\n/g," ");const n=/[^ ]/.test(e),i=/^ /.test(e)&&/ $/.test(e);return n&&i&&(e=e.substring(1,e.length-1)),e=U(e,!0),{type:"codespan",raw:t[0],text:e}}}br(e){const t=this.rules.inline.br.exec(e);if(t)return{type:"br",raw:t[0]}}del(e){const t=this.rules.inline.del.exec(e);if(t)return{type:"del",raw:t[0],text:t[2],tokens:this.lexer.inlineTokens(t[2])}}autolink(e,t){const n=this.rules.inline.autolink.exec(e);if(n){let e,i;return"@"===n[2]?(e=U(this.options.mangle?t(n[1]):n[1]),i="mailto:"+e):(e=U(n[1]),i=e),{type:"link",raw:n[0],text:e,href:i,tokens:[{type:"text",raw:e,text:e}]}}}url(e,t){let n;if(n=this.rules.inline.url.exec(e)){let e,i;if("@"===n[2])e=U(this.options.mangle?t(n[0]):n[0]),i="mailto:"+e;else{let t;do{t=n[0],n[0]=this.rules.inline._backpedal.exec(n[0])[0]}while(t!==n[0]);e=U(n[0]),i="www."===n[1]?"http://"+n[0]:n[0]}return{type:"link",raw:n[0],text:e,href:i,tokens:[{type:"text",raw:e,text:e}]}}}inlineText(e,t){const n=this.rules.inline.text.exec(e);if(n){let e;return e=this.lexer.state.inRawBlock?this.options.sanitize?this.options.sanitizer?this.options.sanitizer(n[0]):U(n[0]):n[0]:U(this.options.smartypants?t(n[0]):n[0]),{type:"text",raw:n[0],text:e}}}}const te={newline:/^(?: *(?:\n|$))+/,code:/^( {4}[^\n]+(?:\n(?: *(?:\n|$))*)?)+/,fences:/^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/,hr:/^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/,heading:/^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/,blockquote:/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/,list:/^( {0,3}bull)([ \t][^\n]+?)?(?:\n|$)/,html:"^ {0,3}(?:<(script|pre|style|textarea)[\\s>][\\s\\S]*?(?:[^\\n]*\\n+|$)|comment[^\\n]*(\\n+|$)|<\\?[\\s\\S]*?(?:\\?>\\n*|$)|\\n*|$)|\\n*|$)|)[\\s\\S]*?(?:(?:\\n *)+\\n|$)|<(?!script|pre|style|textarea)([a-z][\\w-]*)(?:attribute)*? */?>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n *)+\\n|$)|(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n *)+\\n|$))",def:/^ {0,3}\[(label)\]: *(?:\n *)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n *)?| *\n *)(title))? *(?:\n+|$)/,table:K,lheading:/^((?:(?!^bull ).|\n(?!\n|bull ))+?)\n {0,3}(=+|-+) *(?:\n+|$)/,_paragraph:/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table| +\n)[^\n]+)*)/,text:/^[^\n]+/,_label:/(?!\s*\])(?:\\.|[^\[\]\\])+/,_title:/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/};te.def=j(te.def).replace("label",te._label).replace("title",te._title).getRegex(),te.bullet=/(?:[*+-]|\d{1,9}[.)])/,te.listItemStart=j(/^( *)(bull) */).replace("bull",te.bullet).getRegex(),te.list=j(te.list).replace(/bull/g,te.bullet).replace("hr","\\n+(?=\\1?(?:(?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$))").replace("def","\\n+(?="+te.def.source+")").getRegex(),te._tag="address|article|aside|base|basefont|blockquote|body|caption|center|col|colgroup|dd|details|dialog|dir|div|dl|dt|fieldset|figcaption|figure|footer|form|frame|frameset|h[1-6]|head|header|hr|html|iframe|legend|li|link|main|menu|menuitem|meta|nav|noframes|ol|optgroup|option|p|param|section|source|summary|table|tbody|td|tfoot|th|thead|title|tr|track|ul",te._comment=/|$)/,te.html=j(te.html,"i").replace("comment",te._comment).replace("tag",te._tag).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),te.lheading=j(te.lheading).replace(/bull/g,te.bullet).getRegex(),te.paragraph=j(te._paragraph).replace("hr",te.hr).replace("heading"," {0,3}#{1,6} ").replace("|lheading","").replace("|table","").replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html",")|<(?:script|pre|style|textarea|!--)").replace("tag",te._tag).getRegex(),te.blockquote=j(te.blockquote).replace("paragraph",te.paragraph).getRegex(),te.normal=__spreadValues({},te),te.gfm=__spreadProps(__spreadValues({},te.normal),{table:"^ *([^\\n ].*\\|.*)\\n {0,3}(?:\\| *)?(:?-+:? *(?:\\| *:?-+:? *)*)(?:\\| *)?(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)"}),te.gfm.table=j(te.gfm.table).replace("hr",te.hr).replace("heading"," {0,3}#{1,6} ").replace("blockquote"," {0,3}>").replace("code"," {4}[^\\n]").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html",")|<(?:script|pre|style|textarea|!--)").replace("tag",te._tag).getRegex(),te.gfm.paragraph=j(te._paragraph).replace("hr",te.hr).replace("heading"," {0,3}#{1,6} ").replace("|lheading","").replace("table",te.gfm.table).replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html",")|<(?:script|pre|style|textarea|!--)").replace("tag",te._tag).getRegex(),te.pedantic=__spreadProps(__spreadValues({},te.normal),{html:j("^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+? *(?:\\n{2,}|\\s*$)|\\s]*)*?/?> *(?:\\n{2,}|\\s*$))").replace("comment",te._comment).replace(/tag/g,"(?!(?:a|em|strong|small|s|cite|q|dfn|abbr|data|time|code|var|samp|kbd|sub|sup|i|b|u|mark|ruby|rt|rp|bdi|bdo|span|br|wbr|ins|del|img)\\b)\\w+(?!:|[^\\w\\s@]*@)\\b").getRegex(),def:/^ *\[([^\]]+)\]: *]+)>?(?: +(["(][^\n]+[")]))? *(?:\n+|$)/,heading:/^(#{1,6})(.*)(?:\n+|$)/,fences:K,lheading:/^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,paragraph:j(te.normal._paragraph).replace("hr",te.hr).replace("heading"," *#{1,6} *[^\n]").replace("lheading",te.lheading).replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").getRegex()});const ne={escape:/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,autolink:/^<(scheme:[^\s\x00-\x1f<>]*|email)>/,url:K,tag:"^comment|^|^<[a-zA-Z][\\w-]*(?:attribute)*?\\s*/?>|^<\\?[\\s\\S]*?\\?>|^|^",link:/^!?\[(label)\]\(\s*(href)(?:\s+(title))?\s*\)/,reflink:/^!?\[(label)\]\[(ref)\]/,nolink:/^!?\[(ref)\](?:\[\])?/,reflinkSearch:"reflink|nolink(?!\\()",emStrong:{lDelim:/^(?:\*+(?:((?!\*)[punct])|[^\s*]))|^_+(?:((?!_)[punct])|([^\s_]))/,rDelimAst:/^[^_*]*?__[^_*]*?\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\*)[punct](\*+)(?=[\s]|$)|[^punct\s](\*+)(?!\*)(?=[punct\s]|$)|(?!\*)[punct\s](\*+)(?=[^punct\s])|[\s](\*+)(?!\*)(?=[punct])|(?!\*)[punct](\*+)(?!\*)(?=[punct])|[^punct\s](\*+)(?=[^punct\s])/,rDelimUnd:/^[^_*]*?\*\*[^_*]*?_[^_*]*?(?=\*\*)|[^_]+(?=[^_])|(?!_)[punct](_+)(?=[\s]|$)|[^punct\s](_+)(?!_)(?=[punct\s]|$)|(?!_)[punct\s](_+)(?=[^punct\s])|[\s](_+)(?!_)(?=[punct])|(?!_)[punct](_+)(?!_)(?=[punct])/},code:/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,br:/^( {2,}|\\)\n(?!\s*$)/,del:K,text:/^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\.5?"x"+e.charCodeAt(n).toString(16):e.charCodeAt(n).toString())+";"}return t}ne._punctuation="\\p{P}$+<=>`^|~",ne.punctuation=j(ne.punctuation,"u").replace(/punctuation/g,ne._punctuation).getRegex(),ne.blockSkip=/\[[^[\]]*?\]\([^\(\)]*?\)|`[^`]*?`|<[^<>]*?>/g,ne.anyPunctuation=/\\[punct]/g,ne._escapes=/\\([punct])/g,ne._comment=j(te._comment).replace("(?:--\x3e|$)","--\x3e").getRegex(),ne.emStrong.lDelim=j(ne.emStrong.lDelim,"u").replace(/punct/g,ne._punctuation).getRegex(),ne.emStrong.rDelimAst=j(ne.emStrong.rDelimAst,"gu").replace(/punct/g,ne._punctuation).getRegex(),ne.emStrong.rDelimUnd=j(ne.emStrong.rDelimUnd,"gu").replace(/punct/g,ne._punctuation).getRegex(),ne.anyPunctuation=j(ne.anyPunctuation,"gu").replace(/punct/g,ne._punctuation).getRegex(),ne._escapes=j(ne._escapes,"gu").replace(/punct/g,ne._punctuation).getRegex(),ne._scheme=/[a-zA-Z][a-zA-Z0-9+.-]{1,31}/,ne._email=/[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+(@)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)+(?![-_])/,ne.autolink=j(ne.autolink).replace("scheme",ne._scheme).replace("email",ne._email).getRegex(),ne._attribute=/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/,ne.tag=j(ne.tag).replace("comment",ne._comment).replace("attribute",ne._attribute).getRegex(),ne._label=/(?:\[(?:\\.|[^\[\]\\])*\]|\\.|`[^`]*`|[^\[\]\\`])*?/,ne._href=/<(?:\\.|[^\n<>\\])+>|[^\s\x00-\x1f]*/,ne._title=/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/,ne.link=j(ne.link).replace("label",ne._label).replace("href",ne._href).replace("title",ne._title).getRegex(),ne.reflink=j(ne.reflink).replace("label",ne._label).replace("ref",te._label).getRegex(),ne.nolink=j(ne.nolink).replace("ref",te._label).getRegex(),ne.reflinkSearch=j(ne.reflinkSearch,"g").replace("reflink",ne.reflink).replace("nolink",ne.nolink).getRegex(),ne.normal=__spreadValues({},ne),ne.pedantic=__spreadProps(__spreadValues({},ne.normal),{strong:{start:/^__|\*\*/,middle:/^__(?=\S)([\s\S]*?\S)__(?!_)|^\*\*(?=\S)([\s\S]*?\S)\*\*(?!\*)/,endAst:/\*\*(?!\*)/g,endUnd:/__(?!_)/g},em:{start:/^_|\*/,middle:/^()\*(?=\S)([\s\S]*?\S)\*(?!\*)|^_(?=\S)([\s\S]*?\S)_(?!_)/,endAst:/\*(?!\*)/g,endUnd:/_(?!_)/g},link:j(/^!?\[(label)\]\((.*?)\)/).replace("label",ne._label).getRegex(),reflink:j(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label",ne._label).getRegex()}),ne.gfm=__spreadProps(__spreadValues({},ne.normal),{escape:j(ne.escape).replace("])","~|])").getRegex(),_extended_email:/[A-Za-z0-9._+-]+(@)[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![-_])/,url:/^((?:ftp|https?):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/,_backpedal:/(?:[^?!.,:;*_'"~()&]+|\([^)]*\)|&(?![a-zA-Z0-9]+;$)|[?!.,:;*_'"~)]+(?!$))+/,del:/^(~~?)(?=[^\s~])([\s\S]*?[^\s~])\1(?=[^~]|$)/,text:/^([`~]+|[^`~])(?:(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\t+" ".repeat(n.length)));e;)if(!(this.options.extensions&&this.options.extensions.block&&this.options.extensions.block.some((i=>!!(n=i.call({lexer:this},e,t))&&(e=e.substring(n.raw.length),t.push(n),!0)))))if(n=this.tokenizer.space(e))e=e.substring(n.raw.length),1===n.raw.length&&t.length>0?t[t.length-1].raw+="\n":t.push(n);else if(n=this.tokenizer.code(e))e=e.substring(n.raw.length),i=t[t.length-1],!i||"paragraph"!==i.type&&"text"!==i.type?t.push(n):(i.raw+="\n"+n.raw,i.text+="\n"+n.text,this.inlineQueue[this.inlineQueue.length-1].src=i.text);else if(n=this.tokenizer.fences(e))e=e.substring(n.raw.length),t.push(n);else if(n=this.tokenizer.heading(e))e=e.substring(n.raw.length),t.push(n);else if(n=this.tokenizer.hr(e))e=e.substring(n.raw.length),t.push(n);else if(n=this.tokenizer.blockquote(e))e=e.substring(n.raw.length),t.push(n);else if(n=this.tokenizer.list(e))e=e.substring(n.raw.length),t.push(n);else if(n=this.tokenizer.html(e))e=e.substring(n.raw.length),t.push(n);else if(n=this.tokenizer.def(e))e=e.substring(n.raw.length),i=t[t.length-1],!i||"paragraph"!==i.type&&"text"!==i.type?this.tokens.links[n.tag]||(this.tokens.links[n.tag]={href:n.href,title:n.title}):(i.raw+="\n"+n.raw,i.text+="\n"+n.raw,this.inlineQueue[this.inlineQueue.length-1].src=i.text);else if(n=this.tokenizer.table(e))e=e.substring(n.raw.length),t.push(n);else if(n=this.tokenizer.lheading(e))e=e.substring(n.raw.length),t.push(n);else{if(s=e,this.options.extensions&&this.options.extensions.startBlock){let t=1/0;const n=e.slice(1);let i;this.options.extensions.startBlock.forEach((e=>{i=e.call({lexer:this},n),"number"==typeof i&&i>=0&&(t=Math.min(t,i))})),t<1/0&&t>=0&&(s=e.substring(0,t+1))}if(this.state.top&&(n=this.tokenizer.paragraph(s)))i=t[t.length-1],r&&"paragraph"===i.type?(i.raw+="\n"+n.raw,i.text+="\n"+n.text,this.inlineQueue.pop(),this.inlineQueue[this.inlineQueue.length-1].src=i.text):t.push(n),r=s.length!==e.length,e=e.substring(n.raw.length);else if(n=this.tokenizer.text(e))e=e.substring(n.raw.length),i=t[t.length-1],i&&"text"===i.type?(i.raw+="\n"+n.raw,i.text+="\n"+n.text,this.inlineQueue.pop(),this.inlineQueue[this.inlineQueue.length-1].src=i.text):t.push(n);else if(e){const t="Infinite loop on byte: "+e.charCodeAt(0);if(this.options.silent){console.error(t);break}throw new Error(t)}}return this.state.top=!0,t}inline(e,t=[]){return this.inlineQueue.push({src:e,tokens:t}),t}inlineTokens(e,t=[]){let n,i,s,r,a,o,l=e;if(this.tokens.links){const e=Object.keys(this.tokens.links);if(e.length>0)for(;null!=(r=this.tokenizer.rules.inline.reflinkSearch.exec(l));)e.includes(r[0].slice(r[0].lastIndexOf("[")+1,-1))&&(l=l.slice(0,r.index)+"["+"a".repeat(r[0].length-2)+"]"+l.slice(this.tokenizer.rules.inline.reflinkSearch.lastIndex))}for(;null!=(r=this.tokenizer.rules.inline.blockSkip.exec(l));)l=l.slice(0,r.index)+"["+"a".repeat(r[0].length-2)+"]"+l.slice(this.tokenizer.rules.inline.blockSkip.lastIndex);for(;null!=(r=this.tokenizer.rules.inline.anyPunctuation.exec(l));)l=l.slice(0,r.index)+"++"+l.slice(this.tokenizer.rules.inline.anyPunctuation.lastIndex);for(;e;)if(a||(o=""),a=!1,!(this.options.extensions&&this.options.extensions.inline&&this.options.extensions.inline.some((i=>!!(n=i.call({lexer:this},e,t))&&(e=e.substring(n.raw.length),t.push(n),!0)))))if(n=this.tokenizer.escape(e))e=e.substring(n.raw.length),t.push(n);else if(n=this.tokenizer.tag(e))e=e.substring(n.raw.length),i=t[t.length-1],i&&"text"===n.type&&"text"===i.type?(i.raw+=n.raw,i.text+=n.text):t.push(n);else if(n=this.tokenizer.link(e))e=e.substring(n.raw.length),t.push(n);else if(n=this.tokenizer.reflink(e,this.tokens.links))e=e.substring(n.raw.length),i=t[t.length-1],i&&"text"===n.type&&"text"===i.type?(i.raw+=n.raw,i.text+=n.text):t.push(n);else if(n=this.tokenizer.emStrong(e,l,o))e=e.substring(n.raw.length),t.push(n);else if(n=this.tokenizer.codespan(e))e=e.substring(n.raw.length),t.push(n);else if(n=this.tokenizer.br(e))e=e.substring(n.raw.length),t.push(n);else if(n=this.tokenizer.del(e))e=e.substring(n.raw.length),t.push(n);else if(n=this.tokenizer.autolink(e,se))e=e.substring(n.raw.length),t.push(n);else if(this.state.inLink||!(n=this.tokenizer.url(e,se))){if(s=e,this.options.extensions&&this.options.extensions.startInline){let t=1/0;const n=e.slice(1);let i;this.options.extensions.startInline.forEach((e=>{i=e.call({lexer:this},n),"number"==typeof i&&i>=0&&(t=Math.min(t,i))})),t<1/0&&t>=0&&(s=e.substring(0,t+1))}if(n=this.tokenizer.inlineText(s,ie))e=e.substring(n.raw.length),"_"!==n.raw.slice(-1)&&(o=n.raw.slice(-1)),a=!0,i=t[t.length-1],i&&"text"===i.type?(i.raw+=n.raw,i.text+=n.text):t.push(n);else if(e){const t="Infinite loop on byte: "+e.charCodeAt(0);if(this.options.silent){console.error(t);break}throw new Error(t)}}else e=e.substring(n.raw.length),t.push(n);return t}}class ae{constructor(e){__publicField(this,"options"),this.options=e||A}code(e,t,n){var i;const s=null==(i=(t||"").match(/^\S*/))?void 0:i[0];if(this.options.highlight){const t=this.options.highlight(e,s);null!=t&&t!==e&&(n=!0,e=t)}return e=e.replace(/\n$/,"")+"\n",s?'
      '+(n?e:U(e,!0))+"
      \n":"
      "+(n?e:U(e,!0))+"
      \n"}blockquote(e){return`
      \n${e}
      \n`}html(e,t){return e}heading(e,t,n,i){if(this.options.headerIds){return`${e}\n`}return`${e}\n`}hr(){return this.options.xhtml?"
      \n":"
      \n"}list(e,t,n){const i=t?"ol":"ul";return"<"+i+(t&&1!==n?' start="'+n+'"':"")+">\n"+e+"\n"}listitem(e,t,n){return`
    • ${e}
    • \n`}checkbox(e){return" "}paragraph(e){return`

      ${e}

      \n`}table(e,t){return t&&(t=`${t}`),"\n\n"+e+"\n"+t+"
      \n"}tablerow(e){return`\n${e}\n`}tablecell(e,t){const n=t.header?"th":"td";return(t.align?`<${n} align="${t.align}">`:`<${n}>`)+e+`\n`}strong(e){return`${e}`}em(e){return`${e}`}codespan(e){return`${e}`}br(){return this.options.xhtml?"
      ":"
      "}del(e){return`${e}`}link(e,t,n){const i=H(this.options.sanitize,this.options.baseUrl,e);if(null===i)return n;let s='
      ",s}image(e,t,n){const i=H(this.options.sanitize,this.options.baseUrl,e);if(null===i)return n;let s=`${n}":">",s}text(e){return e}}class oe{strong(e){return e}em(e){return e}codespan(e){return e}del(e){return e}html(e){return e}text(e){return e}link(e,t,n){return""+n}image(e,t,n){return""+n}br(){return""}}class le{constructor(){__publicField(this,"seen"),this.seen={}}serialize(e){return e.toLowerCase().trim().replace(/<[!\/a-z].*?>/gi,"").replace(/[\u2000-\u206F\u2E00-\u2E7F\\'!"#$%&()*+,./:;<=>?@[\]^`{|}~]/g,"").replace(/\s/g,"-")}getNextSafeSlug(e,t){let n=e,i=0;if(this.seen.hasOwnProperty(n)){i=this.seen[e];do{i++,n=e+"-"+i}while(this.seen.hasOwnProperty(n))}return t||(this.seen[e]=i,this.seen[n]=0),n}slug(e,t={}){const n=this.serialize(e);return this.getNextSafeSlug(n,t.dryrun)}}class ce{constructor(e){__publicField(this,"options"),__publicField(this,"renderer"),__publicField(this,"textRenderer"),__publicField(this,"slugger"),this.options=e||A,this.options.renderer=this.options.renderer||new ae,this.renderer=this.options.renderer,this.renderer.options=this.options,this.textRenderer=new oe,this.slugger=new le}static parse(e,t){return new ce(t).parse(e)}static parseInline(e,t){return new ce(t).parseInline(e)}parse(e,t=!0){let n="";for(let i=0;i0&&"paragraph"===t.tokens[0].type?(t.tokens[0].text=e+" "+t.tokens[0].text,t.tokens[0].tokens&&t.tokens[0].tokens.length>0&&"text"===t.tokens[0].tokens[0].type&&(t.tokens[0].tokens[0].text=e+" "+t.tokens[0].tokens[0].text)):t.tokens.unshift({type:"text",text:e}):o+=e}o+=this.parse(t.tokens,r),a+=this.renderer.listitem(o,s,!!i)}n+=this.renderer.list(a,t,i);continue}case"html":{const e=s;n+=this.renderer.html(e.text,e.block);continue}case"paragraph":{const e=s;n+=this.renderer.paragraph(this.parseInline(e.tokens));continue}case"text":{let r=s,a=r.tokens?this.parseInline(r.tokens):r.text;for(;i+1{"function"==typeof r&&(a=r,r=null);const o=__spreadValues({},r),l=__spreadValues(__spreadValues({},this.defaults),o);!0===this.defaults.async&&!1===o.async&&(l.silent||console.warn("marked(): The async option was set to true by an extension. The async: false option sent to parse will be ignored."),l.async=!0);const c=__privateMethod(this,n,i).call(this,!!l.silent,!!l.async,a);if(null==s)return c(new Error("marked(): input parameter is undefined or null"));if("string"!=typeof s)return c(new Error("marked(): input parameter is of type "+Object.prototype.toString.call(s)+", string expected"));if(function(e,t){e&&!e.silent&&(t&&console.warn("marked(): callback is deprecated since version 5.0.0, should not be used and will be removed in the future. Read more here: https://marked.js.org/using_pro#async"),(e.sanitize||e.sanitizer)&&console.warn("marked(): sanitize and sanitizer parameters are deprecated since version 0.7.0, should not be used and will be removed in the future. Read more here: https://marked.js.org/#/USING_ADVANCED.md#options"),(e.highlight||"language-"!==e.langPrefix)&&console.warn("marked(): highlight and langPrefix parameters are deprecated since version 5.0.0, should not be used and will be removed in the future. Instead use https://www.npmjs.com/package/marked-highlight."),e.mangle&&console.warn("marked(): mangle parameter is enabled by default, but is deprecated since version 5.0.0, and will be removed in the future. To clear this warning, install https://www.npmjs.com/package/marked-mangle, or disable by setting `{mangle: false}`."),e.baseUrl&&console.warn("marked(): baseUrl parameter is deprecated since version 5.0.0, should not be used and will be removed in the future. Instead use https://www.npmjs.com/package/marked-base-url."),e.smartypants&&console.warn("marked(): smartypants parameter is deprecated since version 5.0.0, should not be used and will be removed in the future. Instead use https://www.npmjs.com/package/marked-smartypants."),e.xhtml&&console.warn("marked(): xhtml parameter is deprecated since version 5.0.0, should not be used and will be removed in the future. Instead use https://www.npmjs.com/package/marked-xhtml."),(e.headerIds||e.headerPrefix)&&console.warn("marked(): headerIds and headerPrefix parameters enabled by default, but are deprecated since version 5.0.0, and will be removed in the future. To clear this warning, install https://www.npmjs.com/package/marked-gfm-heading-id, or disable by setting `{headerIds: false}`."))}(l,a),l.hooks&&(l.hooks.options=l),a){const n=a,i=l.highlight;let r;try{l.hooks&&(s=l.hooks.preprocess(s)),r=e(s,l)}catch(d){return c(d)}const o=e=>{let s;if(!e)try{l.walkTokens&&this.walkTokens(r,l.walkTokens),s=t(r,l),l.hooks&&(s=l.hooks.postprocess(s))}catch(d){e=d}return l.highlight=i,e?c(e):n(null,s)};if(!i||i.length<3)return o();if(delete l.highlight,!r.length)return o();let h=0;return this.walkTokens(r,(e=>{"code"===e.type&&(h++,setTimeout((()=>{i(e.text,e.lang,((t,n)=>{if(t)return o(t);null!=n&&n!==e.text&&(e.text=n,e.escaped=!0),h--,0===h&&o()}))}),0))})),void(0===h&&o())}if(l.async)return Promise.resolve(l.hooks?l.hooks.preprocess(s):s).then((t=>e(t,l))).then((e=>l.walkTokens?Promise.all(this.walkTokens(e,l.walkTokens)).then((()=>e)):e)).then((e=>t(e,l))).then((e=>l.hooks?l.hooks.postprocess(e):e)).catch(c);try{l.hooks&&(s=l.hooks.preprocess(s));const n=e(s,l);l.walkTokens&&this.walkTokens(n,l.walkTokens);let i=t(n,l);return l.hooks&&(i=l.hooks.postprocess(i)),i}catch(d){return c(d)}}},n=new WeakSet,i=function(e,t,n){return i=>{if(i.message+="\nPlease report this to https://github.com/markedjs/marked.",e){const e="

      An error occurred:

      "+U(i.message+"",!0)+"
      ";return t?Promise.resolve(e):n?void n(null,e):e}if(t)return Promise.reject(i);if(!n)throw i;n(i)}};const he=new class{constructor(...i){__privateAdd(this,e),__privateAdd(this,n),__publicField(this,"defaults",{async:!1,baseUrl:null,breaks:!1,extensions:null,gfm:!0,headerIds:!1,headerPrefix:"",highlight:null,hooks:null,langPrefix:"language-",mangle:!1,pedantic:!1,renderer:null,sanitize:!1,sanitizer:null,silent:!1,smartypants:!1,tokenizer:null,walkTokens:null,xhtml:!1}),__publicField(this,"options",this.setOptions),__publicField(this,"parse",__privateMethod(this,e,t).call(this,re.lex,ce.parse)),__publicField(this,"parseInline",__privateMethod(this,e,t).call(this,re.lexInline,ce.parseInline)),__publicField(this,"Parser",ce),__publicField(this,"parser",ce.parse),__publicField(this,"Renderer",ae),__publicField(this,"TextRenderer",oe),__publicField(this,"Lexer",re),__publicField(this,"lexer",re.lex),__publicField(this,"Tokenizer",ee),__publicField(this,"Slugger",le),__publicField(this,"Hooks",de),this.use(...i)}walkTokens(e,t){var n,i;let s=[];for(const r of e)switch(s=s.concat(t.call(this,r)),r.type){case"table":{const e=r;for(const n of e.header)s=s.concat(this.walkTokens(n.tokens,t));for(const n of e.rows)for(const e of n)s=s.concat(this.walkTokens(e.tokens,t));break}case"list":{const e=r;s=s.concat(this.walkTokens(e.items,t));break}default:{const e=r;(null==(i=null==(n=this.defaults.extensions)?void 0:n.childTokens)?void 0:i[e.type])?this.defaults.extensions.childTokens[e.type].forEach((n=>{s=s.concat(this.walkTokens(e[n],t))})):e.tokens&&(s=s.concat(this.walkTokens(e.tokens,t)))}}return s}use(...e){const t=this.defaults.extensions||{renderers:{},childTokens:{}};return e.forEach((e=>{const n=__spreadValues({},e);if(n.async=this.defaults.async||n.async||!1,e.extensions&&(e.extensions.forEach((e=>{if(!e.name)throw new Error("extension name required");if("renderer"in e){const n=t.renderers[e.name];t.renderers[e.name]=n?function(...t){let i=e.renderer.apply(this,t);return!1===i&&(i=n.apply(this,t)),i}:e.renderer}if("tokenizer"in e){if(!e.level||"block"!==e.level&&"inline"!==e.level)throw new Error("extension level must be 'block' or 'inline'");const n=t[e.level];n?n.unshift(e.tokenizer):t[e.level]=[e.tokenizer],e.start&&("block"===e.level?t.startBlock?t.startBlock.push(e.start):t.startBlock=[e.start]:"inline"===e.level&&(t.startInline?t.startInline.push(e.start):t.startInline=[e.start]))}"childTokens"in e&&e.childTokens&&(t.childTokens[e.name]=e.childTokens)})),n.extensions=t),e.renderer){const t=this.defaults.renderer||new ae(this.defaults);for(const n in e.renderer){const i=e.renderer[n],s=n,r=t[s];t[s]=(...e)=>{let n=i.apply(t,e);return!1===n&&(n=r.apply(t,e)),n||""}}n.renderer=t}if(e.tokenizer){const t=this.defaults.tokenizer||new ee(this.defaults);for(const n in e.tokenizer){const i=e.tokenizer[n],s=n,r=t[s];t[s]=(...e)=>{let n=i.apply(t,e);return!1===n&&(n=r.apply(t,e)),n}}n.tokenizer=t}if(e.hooks){const t=this.defaults.hooks||new de;for(const n in e.hooks){const i=e.hooks[n],s=n,r=t[s];de.passThroughHooks.has(n)?t[s]=e=>{if(this.defaults.async)return Promise.resolve(i.call(t,e)).then((e=>r.call(t,e)));const n=i.call(t,e);return r.call(t,n)}:t[s]=(...e)=>{let n=i.apply(t,e);return!1===n&&(n=r.apply(t,e)),n}}n.hooks=t}if(e.walkTokens){const t=this.defaults.walkTokens,i=e.walkTokens;n.walkTokens=function(e){let n=[];return n.push(i.call(this,e)),t&&(n=n.concat(t.call(this,e))),n}}this.defaults=__spreadValues(__spreadValues({},this.defaults),n)})),this}setOptions(e){return this.defaults=__spreadValues(__spreadValues({},this.defaults),e),this}};function ue(e,t,n){return he.parse(e,t,n)}ue.options=ue.setOptions=function(e){return he.setOptions(e),ue.defaults=he.defaults,F(ue.defaults),ue},ue.getDefaults=L,ue.defaults=A,ue.use=function(...e){return he.use(...e),ue.defaults=he.defaults,F(ue.defaults),ue},ue.walkTokens=function(e,t){return he.walkTokens(e,t)},ue.parseInline=he.parseInline,ue.Parser=ce,ue.parser=ce.parse,ue.Renderer=ae,ue.TextRenderer=oe,ue.Lexer=re,ue.lexer=re.lex,ue.Tokenizer=ee,ue.Slugger=le,ue.Hooks=de,ue.parse=ue,ue.options,ue.setOptions,ue.use,ue.walkTokens,ue.parseInline;var pe="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function me(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var ge={"&":"&","<":"<",">":">",'"':""","'":"'"},fe={"&":"&","<":"<",">":">",""":'"',"'":"'"},ke=/(&|<|>|"|')/g,ye=/[&<>"']/g;function be(e){return ge[e]}function _e(e){return fe[e]}function $e(e){return null==e?"":String(e).replace(ye,be)}function xe(e){return null==e?"":String(e).replace(ke,_e)}$e.options=xe.options={};var ve={encode:$e,escape:$e,decode:xe,unescape:xe,version:"1.0.0-browser"};var we=function e(t){for(var n,i,s=Array.prototype.slice.call(arguments,1);s.length;)for(i in n=s.shift())n.hasOwnProperty(i)&&("[object Object]"===Object.prototype.toString.call(t[i])?t[i]=e(t[i],n[i]):t[i]=n[i]);return t},Ce=function(e){return"string"==typeof e?e.toLowerCase():e};function Se(e,t){return e[t]=!0,e}var Te=function(e){return e.reduce(Se,{})},Ee={uris:Te(["background","base","cite","href","longdesc","src","usemap"])},Le={voids:Te(["area","br","col","hr","img","wbr","input","base","basefont","link","meta"])},Ae=ve,Fe=Ce,Oe=Le,Re=/^<\s*([\w:-]+)((?:\s+[\w:-]+(?:\s*=\s*(?:(?:"[^"]*")|(?:'[^']*')|[^>\s]+))?)*)\s*(\/?)\s*>/,Me=/^<\s*\/\s*([\w:-]+)[^>]*>/,Pe=/([\w:-]+)(?:\s*=\s*(?:(?:"((?:[^"])*)")|(?:'((?:[^'])*)')|([^>\s]+)))?/g,Ie=/^=0&&(t.comment&&t.comment(e.substring(4,i)),e=e.substring(i+3),n=!1):Be.test(e)?a(Me,l):Ie.test(e)&&a(Re,o);var i;!function(){if(!n)return;var i,s=e.indexOf("<");s>=0?(i=e.substring(0,s),e=e.substring(s)):(i=e,e="");t.chars&&t.chars(i)}()}();var i=e===s;s=e,i&&(e="")}function a(t,i){var s=e.match(t);s&&(e=e.substring(s[0].length),s[0].replace(t,i),n=!1)}function o(e,n,s,r){var a={},o=Fe(n),l=Oe.voids[o]||!!r;s.replace(Pe,(function(e,t,n,i,s){a[t]=void 0===n&&void 0===i&&void 0===s?void 0:Ae.decode(n||i||s||"")})),l||i.push(o),t.start&&t.start(o,a,l)}function l(e,n){var s,r=0,a=Fe(n);if(a)for(r=i.length-1;r>=0&&i[r]!==a;r--);if(r>=0){for(s=i.length-1;s>=r;s--)t.end&&t.end(i[s]);i.length=r}}l()},Ne=function(e,t){var n,i=t||{};return o(),{start:function(e,t,a){var o=De(e);if(n.ignoring)return void r(o);if(-1===(i.allowedTags||[]).indexOf(o))return void r(o);if(i.filter&&!i.filter({tag:o,attrs:t}))return void r(o);s("<"),s(o),Object.keys(t).forEach((function(e){var n=t[e],r=(i.allowedClasses||{})[o]||[],a=(i.allowedAttributes||{})[o]||[],l=De(e);("class"===l&&-1===a.indexOf(l)?(n=n.split(" ").filter((function(e){return r&&-1!==r.indexOf(e)})).join(" ").trim()).length:-1!==a.indexOf(l)&&(!0!==qe.uris[l]||function(e){var t=e[0];if("#"===t||"/"===t)return!0;var n=e.indexOf(":");if(-1===n)return!0;var s=e.indexOf("?");if(-1!==s&&n>s)return!0;var r=e.indexOf("#");return-1!==r&&n>r||i.allowedSchemes.some(a);function a(t){return 0===e.indexOf(t+":")}}(n)))&&(s(" "),s(e),"string"==typeof n&&(s('="'),s(Ue.encode(n)),s('"')))})),s(a?"/>":">")},end:function(e){var t=De(e);-1!==(i.allowedTags||[]).indexOf(t)&&!1===n.ignoring?(s("")):a(t)},chars:function(e){!1===n.ignoring&&s(i.transformText?i.transformText(e):e)}};function s(t){e.push(t)}function r(e){ze.voids[e]||(!1===n.ignoring?n={ignoring:e,depth:1}:n.ignoring===e&&n.depth++)}function a(e){n.ignoring===e&&--n.depth<=0&&o()}function o(){n={ignoring:!1,depth:0}}},He={allowedAttributes:{a:["href","name","target","title","aria-label"],iframe:["allowfullscreen","frameborder","src"],img:["src","alt","title","aria-label"]},allowedClasses:{},allowedSchemes:["http","https","mailto"],allowedTags:["a","abbr","article","b","blockquote","br","caption","code","del","details","div","em","h1","h2","h3","h4","h5","h6","hr","i","img","ins","kbd","li","main","mark","ol","p","pre","section","span","strike","strong","sub","summary","sup","table","tbody","td","th","thead","tr","u","ul"],filter:null};function Ve(e,t,n){var i=[],s=!0===n?t:je({},He,t),r=Ne(i,s);return We(e,r),i.join("")}Ve.defaults=He;const Qe=me(Ve);var Ze={exports:{}};Ze.exports=function(){function e(e,t){return e(t={exports:{}},t.exports),t.exports}var t=e((function(e){var t=e.exports=function(){return new RegExp("(?:"+t.line().source+")|(?:"+t.block().source+")","gm")};t.line=function(){return/(?:^|\s)\/\/(.+?)$/gm},t.block=function(){return/\/\*([\S\s]*?)\*\//gm}})),n=["23AC69","91C132","F19726","E8552D","1AAB8E","E1147F","2980C1","1BA1E6","9FA0A0","F19726","E30B20","E30B20","A3338B"];function i(e){return''+e+""}return function(e,s){void 0===s&&(s={});var r=s.colors;void 0===r&&(r=n);var a=0,o={},l=new RegExp("("+/[\u4E00-\u9FFF\u3400-\u4dbf\uf900-\ufaff\u3040-\u309f\uac00-\ud7af\u0400-\u04FF]+|\w+/.source+"|"+/'+t+"
      ";return a=++a%r.length,l}))}}();const Ge=me(Ze.exports);let Ke;function Ye(){return Ke}function Xe(e,t){var n;let i=null==(n=Ye())?void 0:n.parse(t);i||(i=t.replace(/```\s*([^]+?.*?[^]+?[^]+?)```/g,((e,t)=>`
      ${Ge(t)}
      `)).replace(/!\[(.*?)\]\((.*?)\)/g,((e,t,n)=>`${t}`)).replace(/\[(.*?)\]\((.*?)\)/g,((e,t,n)=>`
      ${t}`)).replace(/\n/g,"
      "));let s=Qe(i,{allowedClasses:{},allowedSchemes:["http","https","mailto","data"],allowedTags:["a","abbr","article","b","blockquote","br","caption","code","del","details","div","em","h1","h2","h3","h4","h5","h6","hr","i","img","ins","kbd","li","main","mark","ol","p","pre","section","span","strike","strong","sub","summary","sup","table","tbody","td","th","thead","tr","u","ul"],allowedAttributes:{"*":["title","accesskey"],a:["href","name","target","aria-label","rel"],img:["src","alt","title","atk-emoticon","aria-label"],code:["class"],span:["class","style"]},filter:e=>([["code",/^hljs\W+language-(.*)$/],["span",/^(hljs-.*)$/]].forEach((([t,n])=>{e.tag===t&&e.attrs.class&&!n.test(e.attrs.class)&&delete e.attrs.class})),"span"===e.tag&&e.attrs.style&&!/^color:(\W+)?#[0-9a-f]{3,6};?$/i.test(e.attrs.style)&&delete e.attrs.style,!0)});return e.markedReplacers.forEach((e=>{"function"==typeof e&&(s=e(s))})),s}const Je={placeholder:"Leave a comment",noComment:"No Comment",send:"Send",save:"Save",nick:"Nickname",email:"Email",link:"Website",emoticon:"Emoji",preview:"Preview",image:"Image",uploadFail:"Upload Failed",commentFail:"Failed to comment",restoredMsg:"Content has been restored",onlyAdminCanReply:"Only admin can reply",uploadLoginMsg:"Please fill in your name and email to upload",counter:"{count} Comments",sortLatest:"Latest",sortOldest:"Oldest",sortBest:"Best",sortAuthor:"Author",openComment:"Open Comment",closeComment:"Close Comment",listLoadFailMsg:"Failed to load comments",listRetry:"Click to retry",loadMore:"Load More",admin:"Admin",reply:"Reply",voteUp:"Up",voteDown:"Down",voteFail:"Vote Failed",readMore:"Read More",actionConfirm:"Confirm",collapse:"Collapse",collapsed:"Collapsed",collapsedMsg:"This comment has been collapsed",expand:"Expand",approved:"Approved",pending:"Pending",pendingMsg:"Pending, visible only to commenter.",edit:"Edit",editCancel:"Cancel Edit",delete:"Delete",deleteConfirm:"Confirm",pin:"Pin",unpin:"Unpin",seconds:"seconds ago",minutes:"minutes ago",hours:"hours ago",days:"days ago",now:"just now",adminCheck:"Enter admin password:",captchaCheck:"Enter the CAPTCHA to continue:",confirm:"Confirm",cancel:"Cancel",msgCenter:"Messages",ctrlCenter:"Admin",frontend:"Frontend",backend:"Backend",loading:"Loading",loadFail:"Load Failed",editing:"Editing",editFail:"Edit Failed",deleting:"Deleting",deleteFail:"Delete Failed",reqGot:"Request got",reqAborted:"Request timed out or terminated unexpectedly"},et="ArtalkI18n",tt={en:Je,"en-US":Je,"zh-CN":{placeholder:"键入内容...",noComment:"「此时无声胜有声」",send:"发送评论",save:"保存评论",nick:"昵称",email:"邮箱",link:"网址",emoticon:"表情",preview:"预览",image:"图片",uploadFail:"上传失败",commentFail:"评论失败",restoredMsg:"内容已自动恢复",onlyAdminCanReply:"仅管理员可评论",uploadLoginMsg:"填入你的名字邮箱才能上传哦",counter:"{count} 条评论",sortLatest:"最新",sortOldest:"最早",sortBest:"最热",sortAuthor:"作者",openComment:"打开评论",closeComment:"关闭评论",listLoadFailMsg:"无法获取评论列表数据",listRetry:"点击重新获取",loadMore:"加载更多",admin:"管理员",reply:"回复",voteUp:"赞同",voteDown:"反对",voteFail:"投票失败",readMore:"阅读更多",actionConfirm:"确认操作",collapse:"折叠",collapsed:"已折叠",collapsedMsg:"该评论已被系统或管理员折叠",expand:"展开",approved:"已审",pending:"待审",pendingMsg:"审核中,仅本人可见。",edit:"编辑",editCancel:"取消编辑",delete:"删除",deleteConfirm:"确认删除",pin:"置顶",unpin:"取消置顶",seconds:"秒前",minutes:"分钟前",hours:"小时前",days:"天前",now:"刚刚",adminCheck:"键入密码来验证管理员身份:",captchaCheck:"键入验证码继续:",confirm:"确认",cancel:"取消",msgCenter:"通知中心",ctrlCenter:"控制中心",frontend:"前端",backend:"后端",loading:"加载中",loadFail:"加载失败",editing:"修改中",editFail:"修改失败",deleting:"删除中",deleteFail:"删除失败",reqGot:"请求响应",reqAborted:"请求超时或意外终止"}};function nt(e){return e=e.replace(/^([a-zA-Z]+)(-[a-zA-Z]+)?$/,((e,t,n)=>t.toLowerCase()+(n||"").toUpperCase())),tt[e]?tt[e]:window[et]&&window[et][e]?window[et][e]:tt.en}let it="en",st=nt(it);function rt(e){e!==it&&(it=e,st="string"==typeof e?nt(e):e)}function at(e,t={}){let n=(null==st?void 0:st[e])||e;return n=n.replace(/\{\s*(\w+?)\s*\}/g,((e,n)=>t[n]||"")),n}const ot="2.6.4";const lt=new class{constructor(){__publicField(this,"ctx"),__publicField(this,"data");const e=JSON.parse(window.localStorage.getItem("ArtalkUser")||"{}");this.data={nick:e.nick||"",email:e.email||"",link:e.link||"",token:e.token||"",isAdmin:e.isAdmin||!1}}setContext(e){this.ctx=e}update(e={}){var t;Object.entries(e).forEach((([e,t])=>{this.data[e]=t})),window.localStorage.setItem("ArtalkUser",JSON.stringify(this.data)),null==(t=this.ctx)||t.trigger("user-changed",this.data)}logout(){this.update({token:"",isAdmin:!1})}checkHasBasicUserInfo(){return!!this.data.nick&&!!this.data.email}},ct=window||{},dt=navigator||{};class ht{constructor(e){__publicField(this,"comment"),__publicField(this,"$el"),__publicField(this,"$main"),__publicField(this,"$header"),__publicField(this,"$headerNick"),__publicField(this,"$headerBadgeWrap"),__publicField(this,"$body"),__publicField(this,"$content"),__publicField(this,"$childrenWrap"),__publicField(this,"$actions"),__publicField(this,"voteBtnUp"),__publicField(this,"voteBtnDown"),__publicField(this,"$replyTo"),__publicField(this,"$replyAt"),this.comment=e}get ctx(){return this.comment.ctx}get data(){return this.comment.getData()}get conf(){return this.comment.conf}get cConf(){return this.comment.getConf()}}function ut(e){if(e.$headerNick=e.$el.querySelector(".atk-nick"),e.data.link){const t=s('');t.innerText=e.data.nick,t.href=h(e.data.link)?e.data.link:`https://${e.data.link}`,e.$headerNick.append(t)}else e.$headerNick.innerText=e.data.nick}function pt(e){e.$headerBadgeWrap=e.$el.querySelector(".atk-badge-wrap"),e.$headerBadgeWrap.innerHTML="";const t=e.data.badge_name,n=e.data.badge_color;if(t){const i=s('');i.innerText=t.replace("管理员",e.ctx.$t("admin")),i.style.backgroundColor=n||"",e.$headerBadgeWrap.append(i)}if(e.data.is_pinned){const t=s(`${e.ctx.$t("pin")}`);e.$headerBadgeWrap.append(t)}}function mt(e){const t=e.$el.querySelector(".atk-date");t.innerText=e.comment.getDateFormatted(),t.setAttribute("data-atk-comment-date",String(+new Date(e.data.date)))}function gt(e){if(!e.ctx.conf.uaBadge&&!e.data.ip_region)return;let t=e.$header.querySelector("atk-ua-wrap");if(t||(t=s(''),e.$header.append(t)),t.innerHTML="",e.data.ip_region){const n=s('');n.innerText=e.data.ip_region,t.append(n)}if(e.ctx.conf.uaBadge){const{browser:n,os:i}=e.comment.getUserUA();if(String(n).trim()){const e=s('');e.innerText=n,t.append(e)}if(String(i).trim()){const e=s('');e.innerText=i,t.append(e)}}}class ft{constructor(e,t){__publicField(this,"ctx"),__publicField(this,"conf"),__publicField(this,"$el"),__publicField(this,"isLoading",!1),__publicField(this,"msgRecTimer"),__publicField(this,"msgRecTimerFunc"),__publicField(this,"isConfirming",!1),__publicField(this,"confirmRecTimer"),this.ctx=e,this.$el=s(''),this.conf="object"!=typeof t?{text:t}:t,this.$el.innerText=this.getText(),this.conf.adminOnly&&this.$el.setAttribute("atk-only-admin-show","")}get isMessaging(){return!!this.msgRecTimer}appendTo(e){return e.append(this.$el),this}getText(){return"string"==typeof this.conf.text?this.conf.text:this.conf.text()}setClick(e){this.$el.onclick=t=>{if(t.stopPropagation(),!this.isLoading){if(this.conf.confirm&&!this.isMessaging){const e=()=>{this.isConfirming=!1,this.$el.classList.remove("atk-btn-confirm"),this.$el.innerText=this.getText()};if(!this.isConfirming)return this.isConfirming=!0,this.$el.classList.add("atk-btn-confirm"),this.$el.innerText=this.conf.confirmText||this.ctx.$t("actionConfirm"),void(this.confirmRecTimer=window.setTimeout((()=>e()),5e3));this.confirmRecTimer&&window.clearTimeout(this.confirmRecTimer),e()}if(this.msgRecTimer)return this.fireMsgRecTimer(),void this.clearMsgRecTimer();e()}}}updateText(e){e&&(this.conf.text=e),this.setLoading(!1),this.$el.innerText=this.getText()}setLoading(e,t){this.isLoading!==e&&(this.isLoading=e,e?(this.$el.classList.add("atk-btn-loading"),this.$el.innerText=t||`${this.ctx.$t("loading")}...`):(this.$el.classList.remove("atk-btn-loading"),this.$el.innerText=this.getText()))}setError(e){this.setMsg(e,"atk-btn-error")}setWarn(e){this.setMsg(e,"atk-btn-warn")}setSuccess(e){this.setMsg(e,"atk-btn-success")}setMsg(e,t,n,i){this.setLoading(!1),t&&this.$el.classList.add(t),this.$el.innerText=e,this.setMsgRecTimer((()=>{this.$el.innerText=this.getText(),t&&this.$el.classList.remove(t),i&&i()}),n||2500)}setMsgRecTimer(e,t){this.fireMsgRecTimer(),this.clearMsgRecTimer(),this.msgRecTimerFunc=e,this.msgRecTimer=window.setTimeout((()=>{e(),this.clearMsgRecTimer()}),t)}fireMsgRecTimer(){this.msgRecTimerFunc&&this.msgRecTimerFunc()}clearMsgRecTimer(){this.msgRecTimer&&window.clearTimeout(this.msgRecTimer),this.msgRecTimer=void 0,this.msgRecTimerFunc=void 0}}function kt(e){e.ctx.conf.vote&&(e.voteBtnUp=new ft(e.ctx,(()=>`${e.ctx.$t("voteUp")} (${e.data.vote_up||0})`)).appendTo(e.$actions),e.voteBtnUp.setClick((()=>{e.comment.getActions().vote("up")})),e.ctx.conf.voteDown&&(e.voteBtnDown=new ft(e.ctx,(()=>`${e.ctx.$t("voteDown")} (${e.data.vote_down||0})`)).appendTo(e.$actions),e.voteBtnDown.setClick((()=>{e.comment.getActions().vote("down")}))))}function yt(e){if(!e.data.is_allow_reply)return;const t=s(`${e.ctx.$t("reply")}`);e.$actions.append(t),t.addEventListener("click",(t=>{t.stopPropagation(),e.cConf.onReplyBtnClick?e.cConf.onReplyBtnClick():e.ctx.replyComment(e.data,e.$el)}))}function bt(e){const t=new ft(e.ctx,{text:()=>e.data.is_collapsed?e.ctx.$t("expand"):e.ctx.$t("collapse"),adminOnly:!0});t.appendTo(e.$actions),t.setClick((()=>{e.comment.getActions().adminEdit("collapsed",t)}))}function _t(e){const t=new ft(e.ctx,{text:()=>e.data.is_pending?e.ctx.$t("pending"):e.ctx.$t("approved"),adminOnly:!0});t.appendTo(e.$actions),t.setClick((()=>{e.comment.getActions().adminEdit("pending",t)}))}function $t(e){const t=new ft(e.ctx,{text:()=>e.data.is_pinned?e.ctx.$t("unpin"):e.ctx.$t("pin"),adminOnly:!0});t.appendTo(e.$actions),t.setClick((()=>{e.comment.getActions().adminEdit("pinned",t)}))}function xt(e){const t=new ft(e.ctx,{text:e.ctx.$t("edit"),adminOnly:!0});t.appendTo(e.$actions),t.setClick((()=>{e.ctx.editComment(e.data,e.$el)}))}function vt(e){const t=new ft(e.ctx,{text:e.ctx.$t("delete"),confirm:!0,confirmText:e.ctx.$t("deleteConfirm"),adminOnly:!0});t.appendTo(e.$actions),t.setClick((()=>{e.comment.getActions().adminDelete(t)}))}const wt={Avatar:function(e){const t=e.$el.querySelector(".atk-avatar"),n=s(""),i=e.conf.avatarURLBuilder;if(n.src=i?i(e.data):e.comment.getGravatarURL(),e.data.link){const i=s('');i.href=h(e.data.link)?e.data.link:`https://${e.data.link}`,i.append(n),t.append(i)}else t.append(n)},Header:function(e){Object.entries({renderNick:ut,renderVerifyBadge:pt,renderDate:mt,renderUABadge:gt}).forEach((([t,n])=>{n(e)}))},Content:function(e){if(!e.data.is_collapsed)return e.$content.innerHTML=e.comment.getContentMarked(),void e.$content.classList.remove("atk-hide","atk-collapsed");e.$content.classList.add("atk-hide","atk-type-collapsed");const t=s(`\n
      \n ${e.ctx.$t("collapsedMsg")}\n ${e.ctx.$t("expand")}\n
      `);e.$body.insertAdjacentElement("beforeend",t);const n=t.querySelector(".atk-show-btn");n.addEventListener("click",(t=>{t.stopPropagation(),e.$content.classList.contains("atk-hide")?(e.$content.innerHTML=e.comment.getContentMarked(),e.$content.classList.remove("atk-hide"),b(e.$content),n.innerHTML=e.ctx.$t("collapse")):(e.$content.innerHTML="",e.$content.classList.add("atk-hide"),n.innerHTML=e.ctx.$t("expand"))}))},ReplyAt:function(e){e.cConf.isFlatMode||0===e.data.rid||e.cConf.replyTo&&(e.$replyAt=s(''),e.$replyAt.querySelector(".atk-nick").innerText=`${e.cConf.replyTo.nick}`,e.$replyAt.onclick=()=>{e.comment.getActions().goToReplyComment()},e.$headerBadgeWrap.insertAdjacentElement("afterend",e.$replyAt))},ReplyTo:function(e){if(!e.cConf.isFlatMode)return;if(!e.cConf.replyTo)return;e.$replyTo=s(`\n
      \n
      ${e.ctx.$t("reply")} :
      \n
      \n
      `);const t=e.$replyTo.querySelector(".atk-nick");t.innerText=`@${e.cConf.replyTo.nick}`,t.onclick=()=>{e.comment.getActions().goToReplyComment()};let n=Xe(e.ctx,e.cConf.replyTo.content);e.cConf.replyTo.is_collapsed&&(n=`[${e.ctx.$t("collapsed")}]`),e.$replyTo.querySelector(".atk-content").innerHTML=n,e.$body.prepend(e.$replyTo)},Pending:function(e){if(!e.data.is_pending)return;const t=s(`
      ${e.ctx.$t("pendingMsg")}
      `);e.$body.prepend(t)},Actions:function(e){Object.entries({renderVote:kt,renderReply:yt,renderCollapse:bt,renderModerator:_t,renderPin:$t,renderEdit:xt,renderDel:vt}).forEach((([t,n])=>{n(e)}))}};function Ct(e,t){t.forEach((({el:t,max:n,imgContains:i})=>{const a=()=>{t&&(e.scrollable?function(e){if(!e.el)return;if(e.el.classList.contains(Et))return;e.el.classList.add(Et),e.el.style.height=`${e.maxHeight}px`}({el:t,maxHeight:n}):function(e){if(!e.el)return;if(!e.maxHeight)return;if(e.el.classList.contains(St))return;e.el.classList.add(St),e.el.style.height=`${e.maxHeight}px`,e.el.style.overflow="hidden";const t=s(`
      ${at("readMore")}`);t.onclick=t=>{t.stopPropagation(),Tt(e.el),e.postBtnClick&&e.postBtnClick(t)},e.el.append(t)}({el:t,maxHeight:n,postBtnClick:e.postExpandBtnClick}))},o=()=>{t&&r(t)>n&&a()};o(),i&&t&&function(e,t){if(!e)return;const n=e.getElementsByTagName("img");if(!n.length)return;let i=n.length;for(let s=0;s{i--,0===i&&t()})),0===i&&t()}(t,(()=>o()))}))}const St="atk-height-limit";function Tt(e){e&&e.classList.contains(St)&&(e.classList.remove(St),Array.from(e.children).forEach((e=>{e.classList.contains("atk-height-limit-btn")&&e.remove()})),e.style.height="",e.style.overflow="")}const Et="atk-height-limit-scroll";class Lt extends ht{constructor(e){super(e)}render(){var e;return this.$el=s('
      \n
      \n
      \n
      \n
      \n \n \n \n
      \n
      \n
      \n
      \n \n
      \n
      \n
      \n'),this.$main=this.$el.querySelector(".atk-main"),this.$header=this.$el.querySelector(".atk-header"),this.$body=this.$el.querySelector(".atk-body"),this.$content=this.$body.querySelector(".atk-content"),this.$actions=this.$el.querySelector(".atk-actions"),this.$el.setAttribute("id",`atk-comment-${this.data.id}`),e=this,Object.entries(wt).forEach((([t,n])=>{n(e)})),this.recoveryChildrenWrap(),this.$el}checkHeightLimit(){const e=this.ctx.conf.heightLimit;if(!e||!e.content||!e.children)return;const t=e.content,n=e.children;Ct({postExpandBtnClick:()=>{const e=this.comment.getChildren();1===e.length&&Tt(e[0].getRender().$content)},scrollable:e.scrollable},[{el:this.$content,max:t,imgContains:!0},{el:this.$replyTo,max:t,imgContains:!0},{el:this.$childrenWrap,max:n,imgContains:!1}])}heightLimitRemoveForChildren(){this.$childrenWrap&&Tt(this.$childrenWrap)}playFadeAnim(){b(this.comment.getRender().$el)}playFadeAnimForBody(){b(this.comment.getRender().$body)}getChildrenWrap(){return this.$childrenWrap}renderChildrenWrap(){return this.$childrenWrap||(this.$childrenWrap=s('
      '),this.$main.append(this.$childrenWrap)),this.$childrenWrap}recoveryChildrenWrap(){this.$childrenWrap&&this.$main.append(this.$childrenWrap)}setUnread(e){e?this.$el.classList.add("atk-unread"):this.$el.classList.remove("atk-unread")}setOpenable(e){e?this.$el.classList.add("atk-openable"):this.$el.classList.remove("atk-openable")}setOpenURL(e){this.setOpenable(!0),this.$el.onclick=t=>{t.preventDefault(),window.open(e),this.cConf.openEvt&&this.cConf.openEvt()}}setOpenAction(e){this.setOpenable(!0),this.$el.onclick=t=>{t.preventDefault(),e()}}}class At{constructor(e){__publicField(this,"comment"),this.comment=e}get ctx(){return this.comment.ctx}get data(){return this.comment.getData()}get cConf(){return this.comment.getConf()}vote(e){const t="up"===e?this.comment.getRender().voteBtnUp:this.comment.getRender().voteBtnDown;this.ctx.getApi().comment.vote(this.data.id,`comment_${e}`).then((e=>{var t,n;this.data.vote_up=e.up,this.data.vote_down=e.down,null==(t=this.comment.getRender().voteBtnUp)||t.updateText(),null==(n=this.comment.getRender().voteBtnDown)||n.updateText()})).catch((e=>{null==t||t.setError(this.ctx.$t("voteFail")),console.log(e)}))}adminEdit(e,t){if(t.isLoading)return;t.setLoading(!0,`${this.ctx.$t("editing")}...`);const n=__spreadValues({},this.data);"collapsed"===e?n.is_collapsed=!n.is_collapsed:"pending"===e?n.is_pending=!n.is_pending:"pinned"===e&&(n.is_pinned=!n.is_pinned),this.ctx.getApi().comment.commentEdit(n).then((e=>{t.setLoading(!1),this.comment.setData(e),this.ctx.listRefreshUI()})).catch((e=>{console.error(e),t.setError(this.ctx.$t("editFail"))}))}adminDelete(e){e.isLoading||(e.setLoading(!0,`${this.ctx.$t("deleting")}...`),this.ctx.getApi().comment.commentDel(this.data.id,this.data.site_name).then((()=>{e.setLoading(!1),this.cConf.onDelete&&this.cConf.onDelete(this.comment)})).catch((t=>{console.error(t),e.setError(this.ctx.$t("deleteFail"))})))}goToReplyComment(){const e=window.location.hash,t=`#atk-comment-${this.data.rid}`;window.location.hash=t,t===e&&window.dispatchEvent(new Event("hashchange"))}}class Ft extends m{constructor(e,t,n){super(e),__publicField(this,"renderInstance"),__publicField(this,"actionInstance"),__publicField(this,"data"),__publicField(this,"cConf"),__publicField(this,"parent"),__publicField(this,"children",[]),__publicField(this,"nestCurt"),__publicField(this,"nestMax"),this.nestMax=e.conf.nestMax||3,this.cConf=n,this.data=__spreadValues({},t),this.data.date=this.data.date.replace(/-/g,"/"),this.parent=null,this.nestCurt=1,this.actionInstance=new At(this),this.renderInstance=new Lt(this)}render(){const e=this.renderInstance.render();this.$el&&this.$el.replaceWith(e),this.$el=e,this.cConf.afterRender&&this.cConf.afterRender()}getActions(){return this.actionInstance}getRender(){return this.renderInstance}getData(){return this.data}setData(e){this.data=e,this.render(),this.getRender().playFadeAnimForBody()}getParent(){return this.parent}getChildren(){return this.children}getNestCurt(){return this.nestCurt}getIsRoot(){return 0===this.data.rid}getID(){return this.data.id}putChild(e,t="append"){e.parent=this,e.nestCurt=this.nestCurt+1,this.children.push(e);const n=this.getChildrenEl();"append"===t?n.append(e.getEl()):"prepend"===t&&n.prepend(e.getEl()),e.getRender().playFadeAnim(),e.getRender().checkHeightLimit()}getChildrenEl(){let e=this.getRender().getChildrenWrap();return e||(e=this.nestCurt{n.parent&&(e.push(n.parent),t(n.parent))};return t(this),e}getEl(){return this.$el}getGravatarURL(){return function(e,t){const{mirror:n,params:i}=e.conf.gravatar;return`${n.replace(/\/$/,"")}/${t}?${i.replace(/^\?/,"")}`}(this.ctx,this.data.email_encrypted)}getContentMarked(){return Xe(this.ctx,this.data.content)}getDateFormatted(){return c(new Date(this.data.date),this.ctx)}getUserUA(){const e=function(e){const t=String(e||dt.userAgent),n={os:"",osVersion:"",engine:"",browser:"",device:"",language:"",version:""},i={Trident:t.includes("Trident")||t.includes("NET CLR"),Presto:t.includes("Presto"),WebKit:t.includes("AppleWebKit"),Gecko:t.includes("Gecko/")},s={Safari:t.includes("Safari"),Chrome:t.includes("Chrome")||t.includes("CriOS"),IE:t.includes("MSIE")||t.includes("Trident"),Edge:t.includes("Edge")||t.includes("Edg"),Firefox:t.includes("Firefox")||t.includes("FxiOS"),"Firefox Focus":t.includes("Focus"),Chromium:t.includes("Chromium"),Opera:t.includes("Opera")||t.includes("OPR"),Vivaldi:t.includes("Vivaldi"),Yandex:t.includes("YaBrowser"),Kindle:t.includes("Kindle")||t.includes("Silk/"),360:t.includes("360EE")||t.includes("360SE"),UC:t.includes("UC")||t.includes(" UBrowser"),QQBrowser:t.includes("QQBrowser"),QQ:t.includes("QQ/"),Baidu:t.includes("Baidu")||t.includes("BIDUBrowser"),Maxthon:t.includes("Maxthon"),Sogou:t.includes("MetaSr")||t.includes("Sogou"),LBBROWSER:t.includes("LBBROWSER"),"2345Explorer":t.includes("2345Explorer"),TheWorld:t.includes("TheWorld"),MIUI:t.includes("MiuiBrowser"),Quark:t.includes("Quark"),Qiyu:t.includes("Qiyu"),Wechat:t.includes("MicroMessenger"),Taobao:t.includes("AliApp(TB"),Alipay:t.includes("AliApp(AP"),Weibo:t.includes("Weibo"),Douban:t.includes("com.douban.frodo"),Suning:t.includes("SNEBUY-APP"),iQiYi:t.includes("IqiyiApp")},r={Windows:t.includes("Windows"),Linux:t.includes("Linux")||t.includes("X11"),macOS:t.includes("Macintosh"),Android:t.includes("Android")||t.includes("Adr"),Ubuntu:t.includes("Ubuntu"),FreeBSD:t.includes("FreeBSD"),Debian:t.includes("Debian"),"Windows Phone":t.includes("IEMobile")||t.includes("Windows Phone"),BlackBerry:t.includes("BlackBerry")||t.includes("RIM"),MeeGo:t.includes("MeeGo"),Symbian:t.includes("Symbian"),iOS:t.includes("like Mac OS X"),"Chrome OS":t.includes("CrOS"),WebOS:t.includes("hpwOS")},a={Mobile:t.includes("Mobi")||t.includes("iPh")||t.includes("480"),Tablet:t.includes("Tablet")||t.includes("Pad")||t.includes("Nexus 7")};a.Mobile?a.Mobile=!t.includes("iPad"):s.Chrome&&t.includes("Edg")?(s.Chrome=!1,s.Edge=!0):ct.showModalDialog&&ct.chrome&&(s.Chrome=!1,s[360]=!0),n.device="PC",n.language=(()=>{const e=(dt.browserLanguage||dt.language).split("-");return e[1]&&(e[1]=e[1].toUpperCase()),e.join("_")})();const o={engine:i,browser:s,os:r,device:a};Object.entries(o).forEach((([e,t])=>{Object.entries(t).forEach((([t,i])=>{!0===i&&(n[e]=t)}))}));const l={Windows:()=>{const e=t.replace(/^.*Windows NT ([\d.]+);.*$/,"$1");return{6.4:"10",6.3:"8.1",6.2:"8",6.1:"7","6.0":"Vista",5.2:"XP",5.1:"XP","5.0":"2000","10.0":"10","11.0":"11"}[e]||e},Android:()=>t.replace(/^.*Android ([\d.]+);.*$/,"$1"),iOS:()=>t.replace(/^.*OS ([\d_]+) like.*$/,"$1").replace(/_/g,"."),Debian:()=>t.replace(/^.*Debian\/([\d.]+).*$/,"$1"),"Windows Phone":()=>t.replace(/^.*Windows Phone( OS)? ([\d.]+);.*$/,"$2"),macOS:()=>t.replace(/^.*Mac OS X ([\d_]+).*$/,"$1").replace(/_/g,"."),WebOS:()=>t.replace(/^.*hpwOS\/([\d.]+);.*$/,"$1")};n.osVersion="",l[n.os]&&(n.osVersion=l[n.os](),n.osVersion===t&&(n.osVersion=""));const c={Safari:()=>t.replace(/^.*Version\/([\d.]+).*$/,"$1"),Chrome:()=>t.replace(/^.*Chrome\/([\d.]+).*$/,"$1").replace(/^.*CriOS\/([\d.]+).*$/,"$1"),IE:()=>t.replace(/^.*MSIE ([\d.]+).*$/,"$1").replace(/^.*rv:([\d.]+).*$/,"$1"),Edge:()=>t.replace(/^.*(Edge|Edg|Edg[A-Z]{1})\/([\d.]+).*$/,"$2"),Firefox:()=>t.replace(/^.*Firefox\/([\d.]+).*$/,"$1").replace(/^.*FxiOS\/([\d.]+).*$/,"$1"),"Firefox Focus":()=>t.replace(/^.*Focus\/([\d.]+).*$/,"$1"),Chromium:()=>t.replace(/^.*Chromium\/([\d.]+).*$/,"$1"),Opera:()=>t.replace(/^.*Opera\/([\d.]+).*$/,"$1").replace(/^.*OPR\/([\d.]+).*$/,"$1"),Vivaldi:()=>t.replace(/^.*Vivaldi\/([\d.]+).*$/,"$1"),Yandex:()=>t.replace(/^.*YaBrowser\/([\d.]+).*$/,"$1"),Kindle:()=>t.replace(/^.*Version\/([\d.]+).*$/,"$1"),Maxthon:()=>t.replace(/^.*Maxthon\/([\d.]+).*$/,"$1"),QQBrowser:()=>t.replace(/^.*QQBrowser\/([\d.]+).*$/,"$1"),QQ:()=>t.replace(/^.*QQ\/([\d.]+).*$/,"$1"),Baidu:()=>t.replace(/^.*BIDUBrowser[\s/]([\d.]+).*$/,"$1"),UC:()=>t.replace(/^.*UC?Browser\/([\d.]+).*$/,"$1"),Sogou:()=>t.replace(/^.*SE ([\d.X]+).*$/,"$1").replace(/^.*SogouMobileBrowser\/([\d.]+).*$/,"$1"),"2345Explorer":()=>t.replace(/^.*2345Explorer\/([\d.]+).*$/,"$1"),TheWorld:()=>t.replace(/^.*TheWorld ([\d.]+).*$/,"$1"),MIUI:()=>t.replace(/^.*MiuiBrowser\/([\d.]+).*$/,"$1"),Quark:()=>t.replace(/^.*Quark\/([\d.]+).*$/,"$1"),Qiyu:()=>t.replace(/^.*Qiyu\/([\d.]+).*$/,"$1"),Wechat:()=>t.replace(/^.*MicroMessenger\/([\d.]+).*$/,"$1"),Taobao:()=>t.replace(/^.*AliApp\(TB\/([\d.]+).*$/,"$1"),Alipay:()=>t.replace(/^.*AliApp\(AP\/([\d.]+).*$/,"$1"),Weibo:()=>t.replace(/^.*weibo__([\d.]+).*$/,"$1"),Douban:()=>t.replace(/^.*com.douban.frodo\/([\d.]+).*$/,"$1"),Suning:()=>t.replace(/^.*SNEBUY-APP([\d.]+).*$/,"$1"),iQiYi:()=>t.replace(/^.*IqiyiVersion\/([\d.]+).*$/,"$1")};return n.version="",c[n.browser]&&(n.version=c[n.browser](),n.version===t&&(n.version="")),n.version.indexOf(".")&&(n.version=n.version.substring(0,n.version.indexOf("."))),"iOS"===n.os&&t.includes("iPad")?n.os="iPadOS":"Edge"!==n.browser||t.includes("Edg")?"MIUI"===n.browser?n.os="Android":"Chrome"===n.browser&&Number(n.version)>27||"Opera"===n.browser&&Number(n.version)>12||"Yandex"===n.browser?n.engine="Blink":void 0===n.browser&&(n.browser="Unknow App"):n.engine="EdgeHTML",n}(this.data.ua);return{browser:`${e.browser} ${e.version}`,os:`${e.os} ${e.osVersion}`}}getConf(){return this.cConf}}class Ot{constructor(e,t){__publicField(this,"conf"),__publicField(this,"total"),__publicField(this,"$el"),__publicField(this,"$input"),__publicField(this,"inputTimer"),__publicField(this,"$prevBtn"),__publicField(this,"$nextBtn"),__publicField(this,"page",1),this.total=e,this.conf=t,this.$el=s('
      \n
      \n
      Prev
      \n \n
      Next
      \n
      \n
      '),this.$input=this.$el.querySelector(".atk-input"),this.$input.value=`${this.page}`,this.$input.oninput=()=>this.input(),this.$input.onkeydown=e=>this.keydown(e),this.$prevBtn=this.$el.querySelector(".atk-btn-prev"),this.$nextBtn=this.$el.querySelector(".atk-btn-next"),this.$prevBtn.onclick=()=>this.prev(),this.$nextBtn.onclick=()=>this.next(),this.checkDisabled()}get pageSize(){return this.conf.pageSize}get offset(){return this.pageSize*(this.page-1)}get maxPage(){return Math.ceil(this.total/this.pageSize)}update(e,t){this.page=Math.ceil(e/this.pageSize)+1,this.total=t,this.setInput(this.page),this.checkDisabled()}setInput(e){this.$input.value=`${e}`}input(e=!1){window.clearTimeout(this.inputTimer);const t=this.$input.value.trim(),n=()=>{if(""===t)return void this.setInput(this.page);let e=Number(t);Number.isNaN(e)||e<1?this.setInput(this.page):(e>this.maxPage&&(this.setInput(this.maxPage),e=this.maxPage),this.change(e))};e?n():this.inputTimer=window.setTimeout((()=>n()),800)}prev(){const e=this.page-1;e<1||this.change(e)}next(){const e=this.page+1;e>this.maxPage||this.change(e)}change(e){this.page=e,this.conf.onChange(this.offset),this.setInput(e),this.checkDisabled()}checkDisabled(){this.page+1>this.maxPage?this.$nextBtn.classList.add("atk-disabled"):this.$nextBtn.classList.remove("atk-disabled"),this.page-1<1?this.$prevBtn.classList.add("atk-disabled"):this.$prevBtn.classList.remove("atk-disabled")}keydown(e){const t=e.keyCode||e.which;if(38===t){const e=Number(this.$input.value)+1;if(e>this.maxPage)return;this.setInput(e),this.input()}else if(40===t){const e=Number(this.$input.value)-1;if(e<1)return;this.setInput(e),this.input()}else 13===t&&this.input(!0)}setLoading(e){e?g(this.$el):f(this.$el)}}const Rt={createInstance(e){const t=new Ot(e.total,{pageSize:e.pageSize,onChange:t=>__async(this,null,(function*(){if(!0===e.list.conf.editorTravel&&e.list.ctx.editorTravelBack(),yield e.list.fetchComments(t),e.list.repositionAt){(e.list.scrollListenerAt||window).scroll({top:e.list.repositionAt?o(e.list.repositionAt).top:0,left:0})}}))});return[t,t.$el]},setLoading(e){this.instance.setLoading(e)},update(e,t){this.instance.update(e,t)},next(){this.instance.next()}};class Mt{constructor(e){__publicField(this,"conf"),__publicField(this,"$el"),__publicField(this,"$loading"),__publicField(this,"$text"),__publicField(this,"offset",0),__publicField(this,"total",0),__publicField(this,"origText","Load More"),this.conf=e,this.origText=this.conf.text||this.origText,this.$el=s(``),this.$loading=this.$el.querySelector(".atk-loading-icon"),this.$text=this.$el.querySelector(".atk-text"),this.$el.onclick=()=>{this.click()}}get hasMore(){return this.total>this.offset+this.conf.pageSize}click(){this.hasMore&&this.conf.onClick(this.offset+this.conf.pageSize),this.checkDisabled()}show(){this.$el.style.display=""}hide(){this.$el.style.display="none"}setLoading(e){this.$loading.style.display=e?"":"none",this.$text.style.display=e?"none":""}showErr(e){this.setLoading(!1),this.$text.innerText=e,this.$el.classList.add("atk-err"),window.setTimeout((()=>{this.$text.innerText=this.origText,this.$el.classList.remove("atk-err")}),2e3)}update(e,t){this.offset=e,this.total=t,this.checkDisabled()}checkDisabled(){this.hasMore?this.show():this.hide()}}const Pt={pagination:Rt,"read-more":{createInstance(e){const t=new Mt({pageSize:e.pageSize,onClick:t=>__async(this,null,(function*(){yield e.list.fetchComments(t)})),text:at("loadMore")});if(e.list.conf.pagination.autoLoad){const n=e.list.scrollListenerAt||document;this.autoLoadScrollEvent&&n.removeEventListener("scroll",this.autoLoadScrollEvent),this.autoLoadScrollEvent=()=>{if("read-more"!==e.mode||!(null==t?void 0:t.hasMore)||e.list.getLoading())return;const n=e.list.$el.querySelector(".atk-list-comments-wrap > .atk-comment-wrap:nth-last-child(3)");n&&function(e,t=document.documentElement){const n=t.clientHeight,i=t.scrollTop,s=i+n,r=e.getBoundingClientRect();return r.top+i+r.height<=s}(n,e.list.scrollListenerAt)&&t.click()},n.addEventListener("scroll",this.autoLoadScrollEvent)}return[t,t.$el]},setLoading(e){this.instance.setLoading(e)},update(e,t){this.instance.update(e,t)},showErr(e){this.instance.showErr(e)},next(){this.instance.click()}}};class It{constructor(e){__publicField(this,"conf"),this.conf=e,this.init()}getAdaptor(){return Pt[this.conf.mode]}init(){const e=this.getAdaptor(),[t,n]=e.createInstance(this.conf);e.instance=t,e.el=n,this.conf.list.$el.append(e.el)}setLoading(e){this.getAdaptor().setLoading(e)}update(e,t){this.getAdaptor().update(e,t)}getEl(){return this.getAdaptor().el}showErr(e){const t=this.getAdaptor(),n=t.showErr;n&&n.bind(t)(e)}setMode(e){e!==this.conf.mode&&(this.getEl().remove(),this.conf.mode=e,this.init())}next(){this.getAdaptor().next()}}function Bt(e,t,n){const i=function(e,t){const n=e.split("."),i=t.split(".");for(let s=0;s<3;s++){const e=Number(n[s]),t=Number(i[s]);if(e>t)return 1;if(t>e)return-1;if(!Number.isNaN(e)&&Number.isNaN(t))return 1;if(Number.isNaN(e)&&!Number.isNaN(t))return-1}return 0}(t,n);if(0!==i){const r=s(`
      请更新 Artalk ${at(i<0?"frontend":"backend")}以获得完整体验 (帮助文档)

      当前版本:${at("frontend")} ${t} / ${at("backend")} ${n}

      `),a=s('忽略');return a.onclick=()=>{_(e.$el.parentElement,null),e.ctx.conf.versionCheck=!1,e.fetchComments(0)},r.append(a),_(e.$el.parentElement,r,'Artalk Warn'),!0}return!1}function Ut(e){const{$dropdownWrap:t,dropdownList:n}=e;if(t.querySelector(".atk-dropdown"))return;t.classList.add("atk-dropdown-wrap"),t.append(s(''));let i=0;const r=s('
        ');n.forEach(((e,t)=>{const n=e[0],a=e[1],o=s('
      • '),l=o.querySelector("span");l.innerText=n,l.onclick=()=>{((e,t,n,s)=>{s(),i=e,r.querySelectorAll(".active").forEach((e=>{e.classList.remove("active")})),t.classList.add("active"),r.style.display="none",setTimeout((()=>{r.style.display=""}),80)})(t,o,0,a)},r.append(o),t===i&&o.classList.add("active")})),t.append(r)}const Dt={el:"",pageKey:"",pageTitle:"",server:"",site:"",placeholder:"",noComment:"",sendBtn:"",darkMode:!1,editorTravel:!0,flatMode:"auto",nestMax:2,nestSort:"DATE_ASC",emoticons:"https://cdn.jsdelivr.net/gh/ArtalkJS/Emoticons/grps/default.json",vote:!0,voteDown:!1,uaBadge:!0,listSort:!0,preview:!0,countEl:"#ArtalkCount",pvEl:"#ArtalkPV",gravatar:{mirror:"https://cravatar.cn/avatar/",params:"d=mp&s=240"},pagination:{pageSize:20,readMore:!0,autoLoad:!0},heightLimit:{content:300,children:400,scrollable:!1},imgUpload:!0,reqTimeout:15e3,versionCheck:!0,useBackendConf:!0,locale:"zh-CN"};function qt(e){const t=p(Dt,e);if("string"==typeof t.el&&t.el)try{const e=document.querySelector(t.el);if(!e)throw Error(`Target element "${t.el}" was not found.`);t.el=e}catch(n){throw console.error(n),new Error("Please check your Artalk `el` config.")}return t.server=t.server.replace(/\/$/,"").replace(/\/api\/?$/,""),t.pageKey||(t.pageKey=`${window.location.pathname}`),t.pageTitle||(t.pageTitle=`${document.title}`),"auto"===t.locale&&(t.locale=navigator.language),t}function zt(e){const t=["el","pageKey","pageTitle","server","site","darkMode"];return Object.keys(e).forEach((n=>{t.includes(n)&&delete e[n]})),e.emoticons&&"string"==typeof e.emoticons&&(e.emoticons=e.emoticons.trim(),e.emoticons.startsWith("[")||e.emoticons.startsWith("{")?e.emoticons=JSON.parse(e.emoticons):"false"===e.emoticons&&(e.emoticons=!1)),e}class jt extends m{constructor(e){super(e),__publicField(this,"$commentsWrap"),__publicField(this,"data"),__publicField(this,"isLoading",!1),__publicField(this,"confLoaded",!1),__publicField(this,"noCommentText"),__publicField(this,"_nestSortBy"),__publicField(this,"_flatMode"),__publicField(this,"_pageMode"),__publicField(this,"pgHolder"),__publicField(this,"_pageSize"),__publicField(this,"scrollListenerAt"),__publicField(this,"repositionAt"),__publicField(this,"renderComment"),__publicField(this,"paramsEditor"),__publicField(this,"onAfterLoad"),__publicField(this,"unread",[]),__publicField(this,"unreadHighlight"),this.$el=s('
        \n
        \n
        '),this.$commentsWrap=this.$el.querySelector(".atk-list-comments-wrap"),window.setInterval((()=>{this.$el.querySelectorAll("[data-atk-comment-date]").forEach((e=>{const t=e.getAttribute("data-atk-comment-date");e.innerText=c(new Date(Number(t)),this.ctx)}))}),3e4),this.ctx.on("conf-loaded",(()=>{}))}get nestSortBy(){return this._nestSortBy||this.ctx.conf.nestSort||"DATE_ASC"}set nestSortBy(e){this._nestSortBy=e}get flatMode(){return void 0!==this._flatMode?this._flatMode:!0===this.ctx.conf.flatMode||Number(this.ctx.conf.nestMax)<=1||!("auto"!==this.ctx.conf.flatMode||!window.matchMedia("(max-width: 768px)").matches)}set flatMode(e){this._flatMode=e}get pageMode(){return this._pageMode||(this.conf.pagination.readMore?"read-more":"pagination")}set pageMode(e){var t;this._pageMode=e,null==(t=this.pgHolder)||t.setMode(this._pageMode)}get pageSize(){return this._pageSize||this.conf.pagination.pageSize}set pageSize(e){this._pageSize=e}getData(){return this.data}clearData(){this.data=void 0}getLoading(){return this.isLoading}getCommentsWrapEl(){return this.$commentsWrap}setLoading(e,t=!1){var n;this.isLoading=e,t?function(e,t){e?g(t):f(t)}(e,this.$el):null==(n=this.pgHolder)||n.setLoading(e)}fetchComments(e){return __async(this,null,(function*(){if(this.isLoading)return;const t=0===e,n=e=>this.setLoading(e,t);let i;n(!0),this.ctx.trigger("list-load"),("read-more"===this.pageMode&&t||"pagination"===this.pageMode)&&this.ctx.clearAllComments();try{i=yield this.ctx.getApi().comment.get(e,this.pageSize,this.flatMode,this.paramsEditor)}catch(s){throw this.onError(s.msg||String(s),e,s.data),s}finally{n(!1)}_(this.$el,null);try{this.onLoad(i,e)}catch(s){throw this.onError(String(s),e),s}finally{n(!1)}}))}onLoad(e,t){if(this.data=e,!this.confLoaded){const t=zt(e.conf.frontend_conf);this.conf.useBackendConf?this.ctx.updateConf(t):this.ctx.updateConf({}),this.confLoaded=!0}this.ctx.conf.versionCheck&&Bt(this,ot,e.api_version.version)||(this.importComments(e.comments),this.refreshPagination(t,this.flatMode?e.total:e.total_roots),this.refreshUI(),this.ctx.updateNotifies(e.unread||[]),this.ctx.trigger("list-loaded"),this.onAfterLoad&&this.onAfterLoad(e))}refreshPagination(e,t){var n;this.pgHolder||(this.pgHolder=new It({list:this,mode:this.pageMode,pageSize:this.pageSize,total:t})),null==(n=this.pgHolder)||n.update(e,t)}onError(e,t,n){var i;this.confLoaded||this.ctx.updateConf({}),e=String(e),console.error(e),0===t||"read-more"!==this.pageMode?_(this.$el,function(e,t,n){const i=s(`${t},${at("listLoadFailMsg")}
        `),r=s(`${at("listRetry")}`);r.onclick=()=>e.fetchComments(0),i.appendChild(r);const a=s(' | 打开控制台');i.appendChild(a),lt.data.isAdmin||a.classList.add("atk-hide");let o="";if(null==n?void 0:n.err_no_site){const t={create_name:e.ctx.conf.site,create_urls:`${window.location.protocol}//${window.location.host}`};o=`sites|${JSON.stringify(t)}`}return a.onclick=()=>e.ctx.showSidebar({view:o}),i}(this,e,n)):null==(i=this.pgHolder)||i.showErr(this.$t("loadFail"))}refreshUI(){!function(e){const t=e.ctx.getCommentList().length<=0;let n=e.getCommentsWrapEl().querySelector(".atk-list-no-comment");t?n||(n=s('
        '),n.innerHTML=e.noCommentText||e.ctx.conf.noComment||e.ctx.$t("noComment"),e.getCommentsWrapEl().appendChild(n)):null==n||n.remove(),e.ctx.checkAdminShowEl()}(this)}reload(){this.fetchComments(0)}createComment(e,t){t||(t=this.ctx.getCommentDataList());const n=new Ft(this.ctx,e,{isFlatMode:this.flatMode,afterRender:()=>{this.renderComment&&this.renderComment(n)},onDelete:e=>{this.ctx.deleteComment(e),this.refreshUI()},replyTo:e.rid?t.find((t=>t.id===e.rid)):void 0});return n.render(),this.ctx.getCommentList().push(n),n}importComments(e){this.flatMode?e.forEach((t=>{this.putCommentFlatMode(t,e,"append")})):this.importCommentsNest(e)}importCommentsNest(e){const t=function(e,t="DATE_DESC",n=2){const i=[];e.filter((e=>0===e.rid)).forEach((t=>{const s={id:t.id,comment:t,children:[],level:1};s.parent=s,i.push(s),function t(i){const s=e.filter((e=>e.rid===i.id));0!==s.length&&(i.level>=n&&(i=i.parent),s.forEach((e=>{const n={id:e.id,comment:e,children:[],parent:i,level:i.level+1};i.children.push(n),t(n)})))}(s)}));const s=(n,i)=>{let s=n.id-i.id;return"DATE_ASC"===t?s=+new Date(n.comment.date)-+new Date(i.comment.date):"DATE_DESC"===t?s=+new Date(i.comment.date)-+new Date(n.comment.date):"SRC_INDEX"===t?s=e.indexOf(n.comment)-e.indexOf(i.comment):"VOTE_UP_DESC"===t&&(s=i.comment.vote_up-n.comment.vote_up),s};return function e(t){t.forEach((t=>{t.children=t.children.sort(s),e(t.children)}))}(i),i}(e,this.nestSortBy,this.conf.nestMax);t.forEach((t=>{const n=this.createComment(t.comment,e);this.$commentsWrap.appendChild(n.getEl()),n.getRender().playFadeAnim();const i=this;!function t(n,s){s.children.forEach((s=>{const r=s.comment,a=i.createComment(r,e);n.putChild(a),t(a,s)}))}(n,t),n.getRender().checkHeightLimit()}))}putCommentFlatMode(e,t,n){e.is_collapsed&&(e.is_allow_reply=!1);const i=this.createComment(e,t);return e.visible&&("append"===n&&this.$commentsWrap.append(i.getEl()),"prepend"===n&&this.$commentsWrap.prepend(i.getEl()),i.getRender().playFadeAnim()),i.getRender().checkHeightLimit(),i}insertComment(e){if(this.flatMode){k(this.putCommentFlatMode(e,this.ctx.getCommentDataList(),"prepend").getEl())}else{const t=this.createComment(e);if(0===e.rid)this.$commentsWrap.prepend(t.getEl());else{const n=this.ctx.findComment(e.rid);n&&(n.putChild(t,"DATE_ASC"===this.nestSortBy?"append":"prepend"),t.getParents().forEach((e=>{e.getRender().heightLimitRemoveForChildren()})))}t.getRender().checkHeightLimit(),k(t.getEl()),t.getRender().playFadeAnim()}this.data&&(this.data.total+=1),this.refreshUI(),this.ctx.trigger("list-loaded"),this.ctx.trigger("list-inserted",e)}updateComment(e){const t=this.ctx.findComment(e.id);t&&t.setData(e)}updateUnread(e){this.unread=e,!0===this.unreadHighlight&&this.ctx.getCommentList().forEach((e=>{const t=this.unread.find((t=>t.comment_id===e.getID()));t?(e.getRender().setUnread(!0),e.getRender().setOpenAction((()=>{window.open(t.read_link),this.unread=this.unread.filter((t=>t.comment_id!==e.getID())),this.ctx.updateNotifies(this.unread)}))):e.getRender().setUnread(!1)}))}}class Wt extends jt{constructor(e){const t=s('
        \n
        \n
        \n
        \n
        \n
        \n \n \n \n
        \n
        \n
        \n
        \n
        \n \n
        \n');super(e),__publicField(this,"$closeCommentBtn"),__publicField(this,"$openSidebarBtn"),__publicField(this,"$unreadBadge"),__publicField(this,"$commentCount"),__publicField(this,"$commentCountNum"),__publicField(this,"$dropdownWrap"),__publicField(this,"goToCommentFounded",!1),__publicField(this,"goToCommentDelay",!0),t.querySelector(".atk-list-body").append(this.$el),this.$el=t,this.repositionAt=this.$el,this.initListActionBtn();this.$commentCount=this.$el.querySelector(".atk-comment-count");const n=()=>{this.$commentCount.innerHTML=this.$t("counter",{count:'0'}),this.$commentCountNum=this.$commentCount.querySelector(".atk-comment-count-num")};n(),this.$el.querySelector(".atk-copyright").innerHTML=`Powered By Artalk`,this.ctx.on("conf-loaded",(()=>{n(),this.refreshUI()}))}initListActionBtn(){this.$openSidebarBtn=this.$el.querySelector('[data-action="open-sidebar"]'),this.$closeCommentBtn=this.$el.querySelector('[data-action="admin-close-comment"]'),this.$unreadBadge=this.$el.querySelector(".atk-unread-badge"),this.$openSidebarBtn.addEventListener("click",(()=>{this.ctx.showSidebar()})),this.$closeCommentBtn.addEventListener("click",(()=>{this.data&&(this.data.page.admin_only=!this.data.page.admin_only,this.adminPageEditSave())}))}refreshUI(){var e;super.refreshUI(),this.$commentCountNum.innerText=String(Number(null==(e=this.data)?void 0:e.total)||0),lt.data.nick&<.data.email?this.$openSidebarBtn.classList.remove("atk-hide"):this.$openSidebarBtn.classList.add("atk-hide"),this.$openSidebarBtn.querySelector(".atk-text").innerText=lt.data.isAdmin?this.$t("ctrlCenter"):this.$t("msgCenter"),this.data&&this.data.page&&!0===this.data.page.admin_only?(this.ctx.editorClose(),this.$closeCommentBtn.innerHTML=this.$t("openComment")):(this.ctx.editorOpen(),this.$closeCommentBtn.innerHTML=this.$t("closeComment")),this.ctx.conf.listSort?this.initDropdown():function(e){var t,n;const{$dropdownWrap:i}=e;i.classList.remove("atk-dropdown-wrap"),null==(t=i.querySelector(".atk-arrow-down-icon"))||t.remove(),null==(n=i.querySelector(".atk-dropdown"))||n.remove()}({$dropdownWrap:this.$commentCount})}onLoad(e,t){super.onLoad(e,t),this.goToCommentFounded||this.checkGoToCommentByUrlHash(),!0===this.ctx.conf.editorTravel&&this.ctx.editorTravelBack()}checkGoToCommentByUrlHash(){var e;let t=Number(a("atk_comment"));if(!t){const e=window.location.hash.match(/#atk-comment-([0-9]+)/);if(!e||!e[1]||Number.isNaN(Number(e[1])))return;t=Number(e[1])}if(!t)return;const n=this.ctx.findComment(t);if(!n)return void(null==(e=this.pgHolder)||e.next());const i=a("atk_notify_key");i&&this.ctx.getApi().user.markRead(t,i).then((()=>{this.unread=this.unread.filter((e=>e.comment_id!==t)),this.updateUnread(this.unread)})),n.getParents().forEach((e=>{e.getRender().heightLimitRemoveForChildren()}));const s=()=>{k(n.getEl(),!1),n.getEl().classList.remove("atk-flash-once"),window.setTimeout((()=>{n.getEl().classList.add("atk-flash-once")}),150)};this.goToCommentDelay?window.setTimeout((()=>s()),350):s(),this.goToCommentFounded=!0,this.goToCommentDelay=!0}adminPageEditSave(){this.data&&this.data.page&&(this.ctx.editorShowLoading(),this.ctx.getApi().page.pageEdit(this.data.page).then((e=>{this.data&&(this.data.page=__spreadValues({},e)),this.refreshUI()})).catch((e=>{this.ctx.editorShowNotify(`${this.$t("editFail")}: ${e.msg||String(e)}`,"e")})).finally((()=>{this.ctx.editorHideLoading()})))}showUnreadBadge(e){e>0?(this.$unreadBadge.innerText=`${Number(e||0)}`,this.$unreadBadge.style.display="block"):this.$unreadBadge.style.display="none"}initDropdown(){const e=e=>{this.paramsEditor=e,this.fetchComments(0)};Ut({$dropdownWrap:this.$commentCount,dropdownList:[[this.$t("sortLatest"),()=>{e((e=>{e.sort_by="date_desc"}))}],[this.$t("sortBest"),()=>{e((e=>{e.sort_by="vote"}))}],[this.$t("sortOldest"),()=>{e((e=>{e.sort_by="date_asc"}))}],[this.$t("sortAuthor"),()=>{e((e=>{e.view_only_admin=!0}))}]]})}updateUnread(e){super.updateUnread(e),this.showUnreadBadge((null==e?void 0:e.length)||0)}}class Nt{constructor(e,t){__publicField(this,"conf"),__publicField(this,"$root"),__publicField(this,"markedReplacers",[]),__publicField(this,"commentList",[]),__publicField(this,"eventList",[]),this.conf=e,this.$root=t||document.createElement("div"),this.$root.classList.add("artalk"),this.$root.innerHTML=""}inject(e,t){this[e]=t}get(e){return this[e]}getApi(){return this.api}getCommentList(){return this.commentList}getCommentDataList(){return this.commentList.map((e=>e.getData()))}findComment(e){return this.commentList.find((t=>t.getData().id===e))}deleteComment(e){let t;if("number"==typeof e){const n=this.findComment(e);if(!n)throw Error(`Comment ${e} cannot be found`);t=n}else t=e;if(t.getEl().remove(),this.commentList.splice(this.commentList.indexOf(t),1),this.list){const e=this.list.getData();e&&(e.total-=1),this.list.refreshUI()}}clearAllComments(){this.list&&(this.list.getCommentsWrapEl().innerHTML="",this.list.clearData()),this.commentList=[]}insertComment(e){var t;null==(t=this.list)||t.insertComment(e)}updateComment(e){var t;null==(t=this.list)||t.updateComment(e)}replyComment(e,t,n){this.editor.setReply(e,t,n)}cancelReplyComment(){this.editor.cancelReply()}editComment(e,t){this.editor.setEditComment(e,t)}cancelEditComment(){this.editor.cancelEditComment()}updateNotifies(e){var t;null==(t=this.list)||t.updateUnread(e)}listReload(){var e;null==(e=this.list)||e.reload()}reload(){this.listReload()}listRefreshUI(){var e;null==(e=this.list)||e.refreshUI()}listHashGotoCheck(){if(!(this.list&&this.list instanceof Wt))return;const e=this.list;e.goToCommentDelay=!1,e.checkGoToCommentByUrlHash()}editorOpen(){this.editor.open()}editorClose(){this.editor.close()}editorShowLoading(){this.editor.showLoading()}editorHideLoading(){this.editor.hideLoading()}editorShowNotify(e,t){this.editor.showNotify(e,t)}editorTravel(e){this.editor.travel(e)}editorTravelBack(){this.editor.travelBack()}showSidebar(e){this.sidebarLayer.show(e)}hideSidebar(){this.sidebarLayer.hide()}checkAdmin(e){this.checkerLauncher.checkAdmin(e)}checkCaptcha(e){this.checkerLauncher.checkCaptcha(e)}checkAdminShowEl(){const e=[];this.$root.querySelectorAll("[atk-only-admin-show]").forEach((t=>e.push(t)));const{$wrap:t}=v();t&&t.querySelectorAll("[atk-only-admin-show]").forEach((t=>e.push(t)));const n=document.querySelector(".atk-sidebar");n&&n.querySelectorAll("[atk-only-admin-show]").forEach((t=>e.push(t))),e.forEach((e=>{this.user.data.isAdmin?e.classList.remove("atk-hide"):e.classList.add("atk-hide")}))}on(e,t,n="internal"){this.eventList.push({name:e,handler:t,scope:n})}off(e,t,n="internal"){this.eventList=this.eventList.filter((i=>t?!(i.name===e&&i.handler===t&&i.scope===n):!(i.name===e&&i.scope===n)))}trigger(e,t,n){this.eventList.filter((t=>t.name===e&&(!n||t.scope===n))).map((e=>e.handler)).forEach((e=>e(t)))}$t(e,t={}){return at(e,t)}setDarkMode(e){T(this,e)}updateConf(e){this.conf=p(this.conf,e),this.trigger("conf-loaded")}getMarkedInstance(){return Ye()}}class Ht{constructor(e,t){return __publicField(this,"ctx"),__publicField(this,"$el"),__publicField(this,"$content"),__publicField(this,"$actions"),this.ctx=e,this.$el=s('
        \n
        \n
        \n
        \n
        \n
        '),this.$actions=this.$el.querySelector(".atk-layer-dialog-actions"),this.$content=this.$el.querySelector(".atk-layer-dialog-content"),this.$content.appendChild(t),this}setYes(e){const t=s(``);return t.onclick=this.onBtnClick(e),this.$actions.appendChild(t),this}setNo(e){const t=s(``);return t.onclick=this.onBtnClick(e),this.$actions.appendChild(t),this}onBtnClick(e){return t=>{const n=e(t.currentTarget,this);void 0!==n&&!0!==n||this.$el.remove()}}}function Vt(e){const t=s('
        '),n=s('');n.style.display="none",g(t,{transparentBg:!0}),n.src=`${e.getCtx().conf.server}/api/captcha/get?t=${+new Date}`,n.onload=()=>{n.style.display="",f(t)},t.append(n);const i=s('
        ');t.append(i),e.hideInteractInput();let r=!1;return function t(){return __async(this,null,(function*(){var n;if(yield(n=1e3,new Promise((e=>{window.setTimeout((()=>{e(null)}),n)}))),r)return;let i=!1;try{i=(yield e.getCtx().getApi().captcha.captchaStatus()).is_pass}catch(s){i=!1}i?e.triggerSuccess():t()}))}(),i.onclick=()=>{r=!0,e.cancel()},t}const Qt={request:(e,t)=>e.getApi().captcha.captchaCheck(t),body:e=>e.get("iframe")?Vt(e):function(e){const t=s(`${e.getCtx().$t("captchaCheck")}`);return t.querySelector(".atk-captcha-img").onclick=()=>{const n=t.querySelector(".atk-captcha-img");e.getApi().captcha.captchaGet().then((e=>{n.setAttribute("src",e)})).catch((e=>{console.error("Failed to get captcha image ",e)}))},t}(e),onSuccess(e,t,n,i){e.set("val",n)},onError(e,t,n,i){i.querySelector(".atk-captcha-img").click(),i.querySelector('input[type="text"]').value=""}},Zt={inputType:"password",request(e,t){const n={name:lt.data.nick,email:lt.data.email,password:t};return(()=>__async(this,null,(function*(){return(yield e.getApi().user.login(n.name,n.email,n.password)).token})))()},body:e=>s(`${e.getCtx().$t("adminCheck")}`),onSuccess(e,t,n,i){lt.update({isAdmin:!0,token:t}),e.getCtx().trigger("user-changed",lt.data),e.getCtx().listReload()},onError(e,t,n,i){}};class Gt{constructor(e){__publicField(this,"ctx"),__publicField(this,"launched",[]),this.ctx=e}checkCaptcha(e){this.fire(Qt,e,(t=>{t.set("img_data",e.imgData),t.set("iframe",e.iframe)}))}checkAdmin(e){this.fire(Zt,e)}fire(e,t,n){if(this.launched.includes(e))return;this.launched.push(e);const i=new x(this.ctx,`checker-${(new Date).getTime()}`);i.setMaskClickHide(!1),i.show();const r={};let a=!1;const o={set:(e,t)=>{r[e]=t},get:e=>r[e],getCtx:()=>this.ctx,getApi:()=>this.ctx.getApi(),getLayer:()=>i,hideInteractInput:()=>{a=!0},triggerSuccess:()=>{this.close(e,i),e.onSuccess&&e.onSuccess(o,"","",l),t.onSuccess&&t.onSuccess("",h.$el)},cancel:()=>{this.close(e,i),t.onCancel&&t.onCancel()}};n&&n(o);const l=s();l.appendChild(e.body(o));const c=s(``);let d;l.appendChild(c),setTimeout((()=>c.focus()),80),c.onkeyup=e=>{"Enter"!==e.key&&13!==e.keyCode||(e.preventDefault(),i.getEl().querySelector('button[data-action="confirm"]').click())};const h=new Ht(this.ctx,l);h.setYes((n=>{const s=c.value.trim();d||(d=n.innerText);const r=()=>{n.innerText=d||"",n.classList.remove("error")};return n.innerText=`${this.ctx.$t("loading")}...`,e.request(o,s).then((n=>{this.close(e,i),e.onSuccess&&e.onSuccess(o,n,s,l),t.onSuccess&&t.onSuccess(s,h.$el)})).catch((t=>{var i;i=String(t.msg||String(t)),n.innerText=i,n.classList.add("error"),e.onError&&e.onError(o,t,s,l);const a=setTimeout((()=>r()),3e3);c.onfocus=()=>{r(),clearTimeout(a)}})),!1})),h.setNo((()=>(this.close(e,i),t.onCancel&&t.onCancel(),!1))),a&&(c.style.display="none",h.$el.querySelector(".atk-layer-dialog-actions").style.display="none"),i.getEl().append(h.$el),t.onMount&&t.onMount(h.$el)}close(e,t){t.disposeNow(),this.launched=this.launched.filter((t=>t!==e))}}function Kt(e,t,n,i){return __async(this,null,(function*(){var s,r;if(lt.data.token){const e=new Headers(n.headers);e.set("Authorization",`Bearer ${lt.data.token}`),n.headers=e}const a=yield function(e,t,n,i){var s;const r=new AbortController;null==(s=i.signal)||s.addEventListener("abort",(()=>r.abort()));let a=fetch(t,__spreadProps(__spreadValues({},i),{signal:r.signal}));if(n>0){const e=setTimeout((()=>r.abort()),n);a.finally((()=>{clearTimeout(e)}))}return a=a.catch((e=>{throw"AbortError"===(e||{}).name?new Error(at("reqAborted")):e})),a}(0,t,i||e.conf.reqTimeout||15e3,n),o=a.status,l=[401,400].includes(o);if(!a.ok&&!l)throw new Error(`${at("reqGot")} ${o}`);let c=yield a.json();const d=(i,s)=>{Kt(e,t,n).then((e=>{i(e)})).catch((e=>{s(e)}))};if((null==(s=c.data)?void 0:s.need_captcha)?c=yield new Promise(((t,n)=>{e.checkCaptcha({imgData:c.data.img_data,iframe:c.data.iframe,onSuccess:()=>{d(t,n)},onCancel:()=>{n(c)}})})):((null==(r=c.data)?void 0:r.need_login)||l)&&(c=yield new Promise(((t,n)=>{e.checkAdmin({onSuccess:()=>{d(t,n)},onCancel:()=>{n(c)}})}))),!c.success)throw c;return c}))}function Yt(e){const t=new FormData;return Object.keys(e).forEach((n=>t.append(n,String(e[n])))),t}!function(){function e(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function t(e,t){for(var n=0;n({user:e.data.user,is_login:e.data.is_login,unread:e.data.unread||[],unread_count:e.data.unread_count||0}))),abort:()=>{n.abort()}}}loginStatus(){return __async(this,null,(function*(){return(yield this.POST("/login-status",{name:lt.data.nick,email:lt.data.email}))||{is_login:!1,is_admin:!1}}))}logout(){return __async(this,null,(function*(){return this.POST("/logout")}))}markRead(e,t,n=!1){const i={comment_id:e,notify_key:t};return n&&(delete i.comment_id,delete i.notify_key,i.read_all=!0,i.name=lt.data.nick,i.email=lt.data.email),this.POST("/mark-read",i)}userList(e,t,n){return __async(this,null,(function*(){const i={offset:e||0,limit:t||15};n&&(i.type=n);return yield this.POST("/admin/user-get",i)}))}userAdd(e,t){return __async(this,null,(function*(){const n={name:e.name||"",email:e.email||"",password:t||"",link:e.link||"",is_admin:e.is_admin||!1,site_names:e.site_names_raw||"",receive_email:e.receive_email||!0,badge_name:e.badge_name||"",badge_color:e.badge_color||""};return(yield this.POST("/admin/user-add",n)).user}))}userEdit(e,t){return __async(this,null,(function*(){const n={id:e.id,name:e.name||"",email:e.email||"",password:t||"",link:e.link||"",is_admin:e.is_admin||!1,site_names:e.site_names_raw||"",receive_email:e.receive_email||!0,badge_name:e.badge_name||"",badge_color:e.badge_color||""};return(yield this.POST("/admin/user-edit",n)).user}))}userDel(e){return this.POST("/admin/user-del",{id:String(e)})}},system:class extends Xt{conf(){return __async(this,null,(function*(){return zt((yield this.POST("/conf")).frontend_conf||{})}))}getSettings(){return __async(this,null,(function*(){return yield this.POST("/admin/setting-get")}))}saveSettings(e){return __async(this,null,(function*(){return yield this.POST("/admin/setting-save",{data:e})}))}version(){return __async(this,null,(function*(){const e=yield fetch(`${this.api.baseURL}/version`,{method:"POST"});return yield e.json()}))}},captcha:class extends Xt{captchaGet(){return __async(this,null,(function*(){return(yield this.POST("/captcha/refresh")).img_data||""}))}captchaCheck(e){return __async(this,null,(function*(){return(yield this.POST("/captcha/check",{value:e})).img_data||""}))}captchaStatus(){return __async(this,null,(function*(){return(yield this.POST("/captcha/status"))||{is_pass:!1}}))}},admin:class extends Xt{cacheFlushAll(){return this.POST("/admin/cache-flush",{flush_all:!0})}cacheWarmUp(){return this.POST("/admin/cache-warm",{})}},upload:class extends Xt{imgUpload(e){return __async(this,null,(function*(){const t=Yt({name:lt.data.nick,email:lt.data.email,page_key:this.ctx.conf.pageKey});t.set("file",e);const n={method:"POST",body:t};return(yield this.Fetch("/img-upload",n)).data||{}}))}}};class en{constructor(e){__publicField(this,"ctx"),this.ctx=e,Object.entries(Jt).forEach((([e,t])=>{this[e]=new t(this,this.ctx)}))}get baseURL(){return`${this.ctx.conf.server}/api`}}function tn(e){const t={editor:e,isMoved:!1,move:e=>function(e,t){if(e.isMoved)return;e.isMoved=!0;const n=e.editor.getUI().$el;n.after(s('
        '));const i=s("
        ");t.after(i),i.replaceWith(n),n.classList.add("atk-fade-in")}(t,e),back:()=>function(e){var t;if(!e.isMoved)return;e.isMoved=!1,null==(t=e.editor.ctx.$root.querySelector(".atk-editor-travel-placeholder"))||t.replaceWith(e.editor.getUI().$el),e.editor.cancelReply()}(t)};return t}class nn{constructor(e){__publicField(this,"editor"),__publicField(this,"$panel"),__publicField(this,"$btn"),__publicField(this,"onHeaderInput"),__publicField(this,"contentTransformer"),__publicField(this,"onContentUpdated"),this.editor=e}get ctx(){return this.editor.ctx}registerPanel(e="
        "){return this.$panel=s(e),this.$panel}registerBtn(e){return this.$btn=s(`${e}`),this.$btn}registerHeaderInputEvt(e){this.onHeaderInput=e}registerContentTransformer(e){this.contentTransformer=e}registerContentUpdatedEvt(e){this.onContentUpdated=e}getPanel(){return this.$panel}getBtn(){return this.$btn}}__publicField(nn,"Name");class sn extends nn{constructor(e){super(e),__publicField(this,"emoticons",[]),__publicField(this,"loadingTask",null),__publicField(this,"$grpWrap"),__publicField(this,"$grpSwitcher"),__publicField(this,"isListLoaded",!1),__publicField(this,"isImgLoaded",!1),this.editor=e,this.registerPanel('
        '),this.registerBtn(this.ctx.$t("emoticon")),this.registerContentTransformer((e=>this.transEmoticonImageText(e))),window.setTimeout((()=>{this.loadEmoticonsData()}),1e3)}onPanelShow(){(()=>{__async(this,null,(function*(){yield this.loadEmoticonsData(),this.isImgLoaded||(this.initEmoticonsList(),this.isImgLoaded=!0),setTimeout((()=>{this.changeListHeight()}),30)}))})()}onPanelHide(){this.$panel.parentElement.style.height=""}loadEmoticonsData(){return __async(this,null,(function*(){this.isListLoaded||(null===this.loadingTask?(this.loadingTask=(()=>__async(this,null,(function*(){g(this.$panel),this.emoticons=yield this.handleData(this.ctx.conf.emoticons),f(this.$panel),this.loadingTask=null,this.isListLoaded=!0})))(),yield this.loadingTask):yield this.loadingTask)}))}handleData(e){return __async(this,null,(function*(){if(!Array.isArray(e)&&["object","string"].includes(typeof e)&&(e=[e]),!Array.isArray(e))return _(this.$panel,"表情包数据必须为 Array/Object/String 类型"),f(this.$panel),[];const t=t=>{"object"==typeof t&&(t.name&&e.find((e=>e.name===t.name))||e.push(t))},n=e=>__async(this,null,(function*(){yield Promise.all(e.map(((e,i)=>__async(this,null,(function*(){if("object"!=typeof e||Array.isArray(e)){if(Array.isArray(e))yield n(e);else if("string"==typeof e){const i=yield this.remoteLoad(e);Array.isArray(i)?yield n(i):"object"==typeof i&&t(i)}}else t(e)})))))}));return yield n(e),e.forEach((e=>{if(this.isOwOFormat(e)){this.convertOwO(e).forEach((e=>{t(e)}))}else Array.isArray(e)&&e.forEach((e=>{t(e)}))})),e=e.filter((e=>"object"==typeof e&&!Array.isArray(e)&&!!e&&!!e.name)),this.solveNullKey(e),this.solveSameKey(e),e}))}remoteLoad(e){return __async(this,null,(function*(){if(!e)return[];try{const t=yield fetch(e);return yield t.json()}catch(t){return f(this.$panel),_(this.$panel,`表情加载失败 ${String(t)}`),[]}}))}solveNullKey(e){e.forEach((e=>{e.items.forEach(((t,n)=>{t.key||(t.key=`${e.name} ${n+1}`)}))}))}solveSameKey(e){const t={};e.forEach((e=>{e.items.forEach((e=>{e.key&&""!==String(e.key).trim()&&(t[e.key]?t[e.key]++:t[e.key]=1,t[e.key]>1&&(e.key=`${e.key} ${t[e.key]}`))}))}))}isOwOFormat(e){try{return"object"==typeof e&&!!Object.values(e).length&&Array.isArray(Object.keys(Object.values(e)[0].container))&&Object.keys(Object.values(e)[0].container[0]).includes("icon")}catch(t){return!1}}convertOwO(e){const t=[];return Object.entries(e).forEach((([e,n])=>{const i={name:e,type:n.type,items:[]};n.container.forEach(((t,n)=>{const s=t.icon;if(/<(img|IMG)/.test(s)){const e=/src=["'](.*?)["']/.exec(s);e&&e.length>1&&(t.icon=e[1])}i.items.push({key:t.text||`${e} ${n+1}`,val:t.icon})})),t.push(i)})),t}initEmoticonsList(){this.$grpWrap=s('
        '),this.$panel.append(this.$grpWrap),this.emoticons.forEach(((e,t)=>{const n=s('');this.$grpWrap.append(n),n.setAttribute("data-index",String(t)),n.setAttribute("data-grp-name",e.name),n.setAttribute("data-type",e.type),e.items.forEach((t=>{const i=s('');if(n.append(i),t.key&&!new RegExp(`^(${e.name})?\\s?[0-9]+$`).test(t.key)&&i.setAttribute("title",t.key),"image"===e.type){const e=document.createElement("img");e.src=t.val,e.alt=t.key,i.append(e)}else i.innerText=t.val;i.onclick=()=>{"image"===e.type?this.editor.insertContent(`:[${t.key}]`):this.editor.insertContent(t.val||"")}}))})),this.emoticons.length>1&&(this.$grpSwitcher=s('
        '),this.$panel.append(this.$grpSwitcher),this.emoticons.forEach(((e,t)=>{const n=s("");n.innerText=e.name,n.setAttribute("data-index",String(t)),n.onclick=()=>this.openGrp(t),this.$grpSwitcher.append(n)}))),this.emoticons.length>0&&this.openGrp(0)}openGrp(e){var t,n,i;Array.from(this.$grpWrap.children).forEach((t=>{const n=t;n.getAttribute("data-index")!==String(e)?n.style.display="none":n.style.display=""})),null==(t=this.$grpSwitcher)||t.querySelectorAll("span.active").forEach((e=>e.classList.remove("active"))),null==(i=null==(n=this.$grpSwitcher)?void 0:n.querySelector(`span[data-index="${e}"]`))||i.classList.add("active"),this.changeListHeight()}changeListHeight(){}transEmoticonImageText(e){return this.emoticons&&Array.isArray(this.emoticons)?(this.emoticons.forEach((t=>{"image"===t.type&&Object.entries(t.items).forEach((([t,n])=>{e=e.split(`:[${n.key}]`).join(``)}))})),e):e}}__publicField(sn,"Name","emoticons");class rn extends nn{constructor(e){super(e),__publicField(this,"$imgUploadInput"),__publicField(this,"allowImgExts",["png","jpg","jpeg","gif","bmp","svg","webp"]),this.$imgUploadInput=document.createElement("input"),this.$imgUploadInput.type="file",this.$imgUploadInput.style.display="none",this.$imgUploadInput.accept=this.allowImgExts.map((e=>`.${e}`)).join(",");const t=this.registerBtn(`${this.ctx.$t("image")}`);t.after(this.$imgUploadInput),t.onclick=()=>{const e=this.$imgUploadInput;e.onchange=()=>{(()=>{__async(this,null,(function*(){if(!e.files||0===e.files.length)return;const t=e.files[0];this.uploadImg(t)}))})()},e.click()},this.ctx.conf.imgUpload||this.getBtn().setAttribute("atk-only-admin-show","");const n=e=>{if(e)for(let t=0;t{e.stopPropagation(),e.preventDefault()})),this.editor.getUI().$textarea.addEventListener("drop",(e=>{var t;const i=null==(t=e.dataTransfer)?void 0:t.files;(null==i?void 0:i.length)&&(e.preventDefault(),n(i))})),this.editor.getUI().$textarea.addEventListener("paste",(e=>{var t;const i=null==(t=e.clipboardData)?void 0:t.files;(null==i?void 0:i.length)&&(e.preventDefault(),n(i))}))}uploadImg(e){return __async(this,null,(function*(){const t=/[^.]+$/.exec(e.name);if(!t||!this.allowImgExts.includes(t[0]))return;if(!lt.checkHasBasicUserInfo())return void this.editor.showNotify(this.ctx.$t("uploadLoginMsg"),"w");let n="\n";""===this.editor.getUI().$textarea.value.trim()&&(n="");const i=`${n}![](Uploading ${e.name}...)`;let s;this.editor.insertContent(i);try{s=this.ctx.conf.imgUploader?{img_url:yield this.ctx.conf.imgUploader(e)}:yield this.ctx.getApi().upload.imgUpload(e)}catch(r){console.error(r),this.editor.showNotify(`${this.ctx.$t("uploadFail")},${r.msg}`,"e")}if(s&&s.img_url){let e=s.img_url;h(e)||(e=u(this.ctx,e)),this.editor.setContent(this.editor.getUI().$textarea.value.replace(i,`${n}![](${e})`))}else this.editor.setContent(this.editor.getUI().$textarea.value.replace(i,""))}))}}__publicField(rn,"Name","upload");class an extends nn{constructor(e){super(e),__publicField(this,"isBind",!1),this.registerPanel('
        ');let t=this.editor.$t("preview");this.ctx.getMarkedInstance()&&(t+=' '),this.registerBtn(t),this.registerContentUpdatedEvt((e=>{this.updateContent()}))}onPanelShow(){if(this.updateContent(),!this.isBind){const e=()=>{this.updateContent()};this.editor.getUI().$textarea.addEventListener("input",e),this.editor.getUI().$textarea.addEventListener("change",e),this.isBind=!0}}updateContent(){"none"!==this.$panel.style.display&&(this.$panel.innerHTML=this.editor.getContentMarked())}}__publicField(an,"Name","preview");class on extends nn{constructor(e){super(e),__publicField(this,"queryUserInfo",{timeout:null,abortFunc:null}),this.registerHeaderInputEvt(((e,t)=>{"nick"!==e&&"email"!==e||this.fetchUserInfo()})),this.editor.getUI().$link.addEventListener("change",(()=>{const e=this.editor.getUI().$link.value.trim();e&&!/^(http|https):\/\//.test(e)&&(this.editor.getUI().$link.value=`https://${e}`,lt.update({link:this.editor.getUI().$link.value}))}))}fetchUserInfo(){lt.logout(),this.queryUserInfo.timeout&&window.clearTimeout(this.queryUserInfo.timeout),this.queryUserInfo.abortFunc&&this.queryUserInfo.abortFunc(),this.queryUserInfo.timeout=window.setTimeout((()=>{this.queryUserInfo.timeout=null;const{req:e,abort:t}=this.ctx.getApi().user.userGet(lt.data.nick,lt.data.email);this.queryUserInfo.abortFunc=t,e.then((e=>{var t;e.is_login||lt.logout(),this.ctx.updateNotifies(e.unread),lt.checkHasBasicUserInfo()&&!e.is_login&&(null==(t=e.user)?void 0:t.is_admin)&&this.showLoginDialog(),e.user&&e.user.link&&(this.editor.getUI().$link.value=e.user.link,lt.update({link:e.user.link}))})).catch((()=>{})).finally((()=>{this.queryUserInfo.abortFunc=null}))}),400)}showLoginDialog(){this.ctx.checkAdmin({onSuccess:()=>{}})}}__publicField(on,"Name","headerInput");const ln=[sn,rn,an,on];function cn(e){const t={editor:e,plugList:{},openedPlugName:null,openPlugPanel:e=>dn(t,e),closePlugPanel:()=>hn(t),triggerHeaderInputEvt:(e,n)=>function(e,t,n){Object.entries(e.plugList).forEach((([e,i])=>{i.onHeaderInput&&i.onHeaderInput(t,n)}))}(t,e,n),triggerContentUpdatedEvt:e=>function(e,t){Object.entries(e.plugList).forEach((([e,n])=>{n.onContentUpdated&&n.onContentUpdated(t)}))}(t,e),getTransformedContent:e=>function(e,t){let n=t;return Object.entries(e.plugList).forEach((([e,t])=>{t.contentTransformer&&(n=t.contentTransformer(n))})),n}(t,e)};e.getUI().$plugPanelWrap.innerHTML="",e.getUI().$plugPanelWrap.style.display="none",e.getUI().$plugBtnWrap.innerHTML="";const n=[{k:"upload",v:(i=e.conf).imgUpload},{k:"emoticons",v:i.emoticons},{k:"preview",v:i.preview}].filter((e=>!e.v)).flatMap((e=>e.k));var i;return ln.filter((e=>!n.includes(e.Name))).forEach((e=>{!function(e,t){const n=t.Name,i=new t(e.editor);e.plugList[n]=i,function(e,t,n){const i=n.getBtn();if(!i)return;e.editor.getUI().$plugBtnWrap.appendChild(i),i.onclick=i.onclick||(()=>{e.editor.getUI().$plugBtnWrap.querySelectorAll(".active").forEach((e=>e.classList.remove("active"))),t!==e.openedPlugName?(dn(e,t),i.classList.add("active")):hn(e)});const s=n.getPanel();s&&(s.setAttribute("data-plug-name",t),s.style.display="none",e.editor.getUI().$plugPanelWrap.appendChild(s))}(e,n,i)}(t,e)})),t}function dn(e,t){Object.entries(e.plugList).forEach((([e,n])=>{const i=n.getPanel();i&&(e===t?(i.style.display="",n.onPanelShow&&n.onPanelShow()):(i.style.display="none",n.onPanelHide&&n.onPanelHide()))})),e.editor.getUI().$plugPanelWrap.style.display="",e.openedPlugName=t}function hn(e){if(!e.openedPlugName)return;const t=e.plugList[e.openedPlugName];t&&(t.onPanelHide&&t.onPanelHide(),e.editor.getUI().$plugPanelWrap.style.display="none",e.openedPlugName=null)}function un(e){const t={editor:e,comment:void 0,setReply:(e,n,i)=>function(e,t,n,i=!0){e.editor.cancelEditComment(),pn(e);const r=e.editor.getUI();r.$sendReply||(r.$sendReply=s(`
        ${e.editor.$t("reply")} ×
        `),r.$sendReply.querySelector(".atk-text").innerText=`@${t.nick}`,r.$sendReply.addEventListener("click",(()=>{e.editor.cancelReply()})),r.$textareaWrap.append(r.$sendReply));e.comment=t,e.editor.travel(n),i&&k(r.$el);r.$textarea.focus()}(t,e,n,i),cancelReply:()=>pn(t)};return t}function pn(e){if(!e.comment)return;const t=e.editor.getUI();t.$sendReply&&(t.$sendReply.remove(),t.$sendReply=void 0),e.comment=void 0,e.editor.travelBack()}function mn(e){const t={editor:e,comment:void 0,setEdit:(e,n)=>function(e,t,n){gn(e),e.editor.cancelReply();const i=e.editor.getUI();if(!i.$editCancelBtn){const t=s(`
        ${e.editor.$t("editCancel")} ×
        `);t.onclick=()=>{gn(e)},i.$textareaWrap.append(t),i.$editCancelBtn=t}e.comment=t,i.$header.style.display="none",e.editor.travel(n),i.$nick.value=t.nick||"",i.$email.value=t.email||"",i.$link.value=t.link||"",e.editor.setContent(t.content),i.$textarea.focus(),e.editor.refreshSendBtnText()}(t,e,n),cancelEdit:()=>gn(t)};return function(e){const t=e.editor.getSubmitManager();if(!t)throw Error("submitManager not initialized");t.registerCustom({activeCond:()=>!!e.comment,req:()=>__async(this,null,(function*(){const t={content:e.editor.getFinalContent(),nick:e.editor.getUI().$nick.value,email:e.editor.getUI().$email.value,link:e.editor.getUI().$link.value};return yield e.editor.ctx.getApi().comment.commentEdit(__spreadValues(__spreadValues({},e.comment),t))})),post:t=>{e.editor.ctx.updateComment(t)}})}(t),t}function gn(e){if(!e.comment)return;const t=e.editor.getUI();t.$editCancelBtn&&(t.$editCancelBtn.remove(),t.$editCancelBtn=void 0),e.comment=void 0,e.editor.travelBack();const{nick:n,email:i,link:s}=lt.data;t.$nick.value=n,t.$email.value=i,t.$link.value=s,e.editor.setContent(""),e.editor.refreshSendBtnText(),t.$header.style.display=""}function fn(e){const t={editor:e,do:()=>function(e){return __async(this,null,(function*(){if(""===e.editor.getFinalContent().trim())return void e.editor.focus();const t=e.customs.find((e=>e.activeCond()));e.editor.ctx.trigger("editor-submit"),e.editor.showLoading();try{let n;(null==t?void 0:t.pre)&&t.pre(),n=(null==t?void 0:t.req)?yield t.req():yield function(e){return __async(this,null,(function*(){const t=yield e.editor.ctx.getApi().comment.add(__spreadValues({},function(e){var t;const{nick:n,email:i,link:s}=lt.data,r=e.editor.ctx.conf,a=null==(t=e.editor.getReplyManager())?void 0:t.comment;return{content:e.editor.getFinalContent(),nick:n,email:i,link:s,rid:a?a.id:0,page_key:a?a.page_key:r.pageKey,page_title:a?void 0:r.pageTitle,site_name:a?a.site_name:r.site}}(e)));return t}))}(e),(null==t?void 0:t.post)?t.post(n):function(e,t){const n=e.editor.getReplyManager(),i=e.editor.ctx.conf;(null==n?void 0:n.comment)&&n.comment.page_key!==i.pageKey&&window.open(`${n.comment.page_url}#atk-comment-${t.id}`);e.editor.ctx.insertComment(t)}(e,n)}catch(n){return console.error(n),void e.editor.showNotify(`${e.editor.$t("commentFail")},${n.msg||String(n)}`,"e")}finally{e.editor.hideLoading()}e.editor.reset(),e.editor.ctx.trigger("editor-submitted")}))}(t),customs:[],registerCustom:e=>{t.customs.push(e)}};return t}const kn={localStorage:function(e){const t=window.localStorage.getItem("ArtalkContent")||"";""!==t.trim()&&(e.showNotify(e.$t("restoredMsg"),"i"),e.setContent(t));const n=()=>{e.saveToLocalStorage()};return e.getUI().$textarea.addEventListener("input",n),()=>{e.getUI().$textarea.removeEventListener("input",n)}},header:function(e){const t=e.getHeaderInputEls(),n={};return Object.entries(t).forEach((([t,n])=>{n.placeholder=`${e.$t(t)}`,n.value=lt.data[t]||""})),Object.entries(t).forEach((([t,i])=>{i.addEventListener("input",n[t]=((t,n)=>()=>{var i;e.isEditMode||(lt.update({[n]:t.value.trim()}),null==(i=e.getPlugs())||i.triggerHeaderInputEvt(n,t))})(i,t))})),()=>{Object.entries(t).forEach((([e,t])=>{t.removeEventListener("input",n[e])}))}},textarea:function(e){e.getUI().$textarea.placeholder=e.ctx.conf.placeholder||e.$t("placeholder");const t=t=>{9===(t.keyCode||t.which)&&(t.preventDefault(),e.insertContent("\t"))},n=()=>{e.adjustTextareaHeight()};return e.getUI().$textarea.addEventListener("keydown",t),e.getUI().$textarea.addEventListener("input",n),()=>{e.getUI().$textarea.removeEventListener("keydown",t),e.getUI().$textarea.removeEventListener("input",n)}},submitBtn:function(e){e.refreshSendBtnText();const t=()=>{e.submit()};return e.getUI().$submitBtn.addEventListener("click",t),()=>{e.getUI().$submitBtn.removeEventListener("click",t)}},submitManager:function(e){e.setSubmitManager(fn(e)),e.setEditModeManager(mn(e))},mover:function(e){if(!e.conf.editorTravel)return;e.setMover(tn(e))},reply:function(e){e.setReplyManager(un(e))},plugs:function(e){e.setPlugs(cn(e))}};const yn={$header:".atk-header",$nick:'.atk-header [name="nick"]',$email:'.atk-header [name="email"]',$link:'.atk-header [name="link"]',$textareaWrap:".atk-textarea-wrap",$textarea:".atk-textarea",$bottom:".atk-bottom",$submitBtn:".atk-send-btn",$notifyWrap:".atk-notify-wrap",$plugBtnWrap:".atk-plug-btn-wrap",$plugPanelWrap:".atk-plug-panel-wrap"};class bn extends m{constructor(e){super(e),__publicField(this,"ui"),__publicField(this,"plugs"),__publicField(this,"mover"),__publicField(this,"reply"),__publicField(this,"editMode"),__publicField(this,"submitManager"),__publicField(this,"unmountFuncs",[]),this.ui=function(){const e=s('
        \n
        \n \n \n \n
        \n
        \n \n
        \n \n
        \n
        \n
        \n \n
        \n
        \n
        \n
        \n'),t={$el:e};return Object.entries(yn).forEach((([n,i])=>{t[n]=e.querySelector(i)})),t}(),this.$el=this.ui.$el,this.ctx.on("conf-loaded",(()=>{var e;null==(e=this.unmountFuncs)||e.forEach((e=>!!e&&e())),this.unmountFuncs=function(e){const t=[];return Object.entries(kn).forEach((([n,i])=>{const s=i(e);s&&t.push(s)})),t}(this)}))}getUI(){return this.ui}getPlugs(){return this.plugs}setPlugs(e){this.plugs=e}setMover(e){this.mover=e}setReplyManager(e){this.reply=e}getReplyManager(){return this.reply}get isReplyMode(){var e;return!!(null==(e=this.reply)?void 0:e.comment)}setEditModeManager(e){this.editMode=e}get isEditMode(){var e;return!!(null==(e=this.editMode)?void 0:e.comment)}setSubmitManager(e){this.submitManager=e}getSubmitManager(){return this.submitManager}getHeaderInputEls(){return{nick:this.ui.$nick,email:this.ui.$email,link:this.ui.$link}}saveToLocalStorage(){window.localStorage.setItem("ArtalkContent",this.getContentOriginal().trim())}refreshSendBtnText(){this.isEditMode?this.ui.$submitBtn.innerText=this.$t("save"):this.ui.$submitBtn.innerText=this.ctx.conf.sendBtn||this.$t("send")}getFinalContent(){let e=this.getContentOriginal();return this.plugs&&(e=this.plugs.getTransformedContent(e)),e}getContentOriginal(){return this.ui.$textarea.value||""}getContentMarked(){return Xe(this.ctx,this.getFinalContent())}setContent(e){this.ui.$textarea.value=e,this.saveToLocalStorage(),this.plugs&&this.plugs.triggerContentUpdatedEvt(e),window.setTimeout((()=>{this.adjustTextareaHeight()}),80)}insertContent(e){if(document.selection)this.ui.$textarea.focus(),document.selection.createRange().text=e,this.ui.$textarea.focus();else if(this.ui.$textarea.selectionStart||0===this.ui.$textarea.selectionStart){const t=this.ui.$textarea.selectionStart,n=this.ui.$textarea.selectionEnd,i=this.ui.$textarea.scrollTop;this.setContent(this.ui.$textarea.value.substring(0,t)+e+this.ui.$textarea.value.substring(n,this.ui.$textarea.value.length)),this.ui.$textarea.focus(),this.ui.$textarea.selectionStart=t+e.length,this.ui.$textarea.selectionEnd=t+e.length,this.ui.$textarea.scrollTop=i}else this.ui.$textarea.focus(),this.ui.$textarea.value+=e}adjustTextareaHeight(){const e=this.ui.$textarea.offsetHeight-this.ui.$textarea.clientHeight;this.ui.$textarea.style.height="0px",this.ui.$textarea.style.height=`${this.ui.$textarea.scrollHeight+e}px`}focus(){this.ui.$textarea.focus()}reset(){this.setContent(""),this.cancelReply(),this.cancelEditComment()}setReply(e,t,n=!0){var i;null==(i=this.reply)||i.setReply(e,t,n)}cancelReply(){var e;null==(e=this.reply)||e.cancelReply()}setEditComment(e,t){var n;null==(n=this.editMode)||n.setEdit(e,t)}cancelEditComment(){var e;null==(e=this.editMode)||e.cancelEdit()}showNotify(e,t){y(this.ui.$notifyWrap,e,t)}showLoading(){g(this.ui.$el)}hideLoading(){f(this.ui.$el)}submit(){return __async(this,null,(function*(){if(!this.submitManager)throw Error("submitManger not initialized");yield this.submitManager.do()}))}close(){this.ui.$textareaWrap.querySelector(".atk-comment-closed")||this.ui.$textareaWrap.prepend(s(`
        ${this.$t("onlyAdminCanReply")}
        `)),lt.data.isAdmin?(this.ui.$textarea.style.display="",this.ui.$bottom.style.display=""):(this.ui.$textarea.style.display="none",this.closePlugPanel(),this.ui.$bottom.style.display="none")}open(){var e;null==(e=this.ui.$textareaWrap.querySelector(".atk-comment-closed"))||e.remove(),this.ui.$textarea.style.display="",this.ui.$bottom.style.display=""}travel(e){var t;null==(t=this.mover)||t.move(e)}travelBack(){var e;null==(e=this.mover)||e.back()}openPlugPanel(e){var t;null==(t=this.plugs)||t.openPlugPanel(e)}closePlugPanel(){var e;null==(e=this.plugs)||e.closePlugPanel()}}class _n extends m{constructor(e){super(e),__publicField(this,"layer"),__publicField(this,"$header"),__publicField(this,"$closeBtn"),__publicField(this,"$iframeWrap"),__publicField(this,"$iframe"),__publicField(this,"firstShow",!0),this.$el=s('
        \n
        \n
        \n
        \n
        \n
        \n
        \n
        \n'),this.$header=this.$el.querySelector(".atk-sidebar-header"),this.$closeBtn=this.$header.querySelector(".atk-sidebar-close"),this.$iframeWrap=this.$el.querySelector(".atk-sidebar-iframe-wrap"),this.$closeBtn.onclick=()=>{this.hide()},this.ctx.on("user-changed",(()=>{this.firstShow=!0}))}show(){return __async(this,arguments,(function*(e={}){if(this.$el.style.transform="",null==this.layer&&(this.layer=new x(this.ctx,"sidebar",this.$el),this.layer.afterHide=()=>{!0===this.ctx.conf.editorTravel&&this.ctx.editorTravelBack()}),this.layer.show(),(()=>{__async(this,null,(function*(){var t;const n=yield this.ctx.getApi().user.loginStatus();n.is_admin&&!n.is_login&&(null==(t=this.layer)||t.hide(),this.firstShow=!0,this.ctx.checkAdmin({onSuccess:()=>{setTimeout((()=>{this.show(e)}),500)},onCancel:()=>{}}))}))})(),this.firstShow){this.$iframeWrap.innerHTML="",this.$iframe=s("");const t=u(this.ctx,"/sidebar/"),n={pageKey:this.conf.pageKey,site:this.conf.site||"",user:JSON.stringify(lt.data),time:+new Date};e.view&&(n.view=e.view),this.conf.darkMode&&(n.darkMode="1"),"string"==typeof this.conf.locale&&(n.locale=this.conf.locale);const i=new URLSearchParams(n);this.iframeLoad(`${t}?${i.toString()}`),this.$iframeWrap.append(this.$iframe),this.firstShow=!1}else{const e=this.$iframe.src.includes("darkMode=1");this.conf.darkMode&&!e&&this.iframeLoad(`${this.$iframe.src}&darkMode=1`),!this.conf.darkMode&&e&&this.iframeLoad(this.$iframe.src.replace("&darkMode=1",""))}setTimeout((()=>{this.$el.style.transform="translate(0, 0)"}),100),setTimeout((()=>{this.ctx.updateNotifies([])}),0),this.ctx.trigger("sidebar-show")}))}hide(){var e;this.$el.style.transform="",null==(e=this.layer)||e.hide(),this.ctx.trigger("sidebar-hide")}iframeLoad(e){this.$iframe&&(this.$iframe.src=e,g(this.$iframeWrap),this.$iframe.onload=()=>{f(this.$iframeWrap)})}}const $n={i18n(e){rt(e.conf.locale),e.on("conf-loaded",(()=>{rt(e.conf.locale)}))},markdown(){!function(){try{if(!ue.name)return}catch(i){return}const e=new ue.Renderer,t=e.link;e.link=(n,i,s)=>{const r=null==n?void 0:n.startsWith(`${window.location.protocol}//${window.location.hostname}`);return t.call(e,n,i,s).replace(/^{const n=t||"plaintext";let i=e;return window.hljs?n&&window.hljs.getLanguage(n)&&(i=window.hljs.highlight(n,e).value):i=Ge(e),`
        \n${i.replace(/&/g,"&")}\n
        `};const n=ue;ue.setOptions({renderer:e,pedantic:!1,gfm:!0,breaks:!0,smartLists:!0,smartypants:!0,xhtml:!1,sanitize:!1,silent:!0}),Ke=n}()},user:e=>(lt.setContext(e),lt),api:e=>new en(e),checkerLauncher:e=>new Gt(e),editor(e){const t=new bn(e);return e.$root.appendChild(t.$el),t},list(e){const t=new Wt(e);return e.$root.appendChild(t.$el),t.fetchComments(0),t},layer(e){x.BodyOrgOverflow=document.body.style.overflow,x.BodyOrgPaddingRight=document.body.style.paddingRight},sidebarLayer:e=>new _n(e),eventsDefault(e){window.addEventListener("hashchange",(()=>{e.listHashGotoCheck()})),e.on("user-changed",(()=>{e.checkAdminShowEl(),e.listRefreshUI()}))},darkMode(e){S(e),e.on("conf-loaded",(()=>{S(e)}))}};function xn(e){return __async(this,null,(function*(){const t=e.ctx.conf.countEl;t&&document.querySelector(t)&&vn(e,{api:"page_comment",countEl:t});const n=e.pvAdd?yield e.ctx.getApi().page.pv():void 0,i=e.ctx.conf.pvEl;i&&document.querySelector(i)&&vn(e,{api:"page_pv",countEl:i,curtPageCount:n})}))}function vn(e,t){return __async(this,null,(function*(){let n={};const i=e.ctx.conf.pageKey;t.curtPageCount&&(n[i]=t.curtPageCount);let s=Array.from(document.querySelectorAll(t.countEl)).map((e=>e.getAttribute("data-page-key")||i)).filter((e=>void 0===n[e]));if(s=[...new Set(s)],s.length>0){const i=yield e.ctx.getApi().page.stat(t.api,s);n=__spreadValues(__spreadValues({},n),i)}document.querySelectorAll(t.countEl).forEach((e=>{const t=e.getAttribute("data-page-key")||i;e.innerHTML=`${Number(n[t]||0)}`}))}))}const wn=class e{constructor(t){__publicField(this,"conf"),__publicField(this,"ctx"),__publicField(this,"$root"),e.instance&&e.destroy(),this.conf=qt(t),this.conf.el instanceof HTMLElement&&(this.$root=this.conf.el),this.ctx=new Nt(this.conf,this.$root),Object.entries($n).forEach((([t,n])=>{if(e.DisabledComponents.includes(t))return;const i=n(this.ctx);i&&this.ctx.inject(t,i)})),e.plugins.forEach((e=>{"function"==typeof e&&e(this.ctx)}))}static init(t){return this.instance&&e.destroy(),this.instance=new e(t),this.instance}use(t){e.plugins.push(t),"function"==typeof t&&t(this.ctx)}update(t){if(!e.instance)throw Error("cannot call `update` function before call `load`");return e.instance.ctx.updateConf(t),e.instance}reload(){this.ctx.listReload()}destroy(){if(!e.instance)throw Error("cannot call `destroy` function before call `load`");e.instance.$root.remove(),delete e.instance}on(e,t){this.ctx.on(e,t,"external")}off(e,t){this.ctx.off(e,t,"external")}trigger(e,t){this.ctx.trigger(e,t,"external")}setDarkMode(e){this.ctx.setDarkMode(e)}static use(e){this.plugins.push(e),this.instance&&"function"==typeof e&&e(this.instance.ctx)}static update(e){var t;return null==(t=this.instance)?void 0:t.update(e)}static reload(){var e;null==(e=this.instance)||e.reload()}static destroy(){var e;null==(e=this.instance)||e.destroy()}static on(e,t){var n;null==(n=this.instance)||n.on(e,t)}static off(e,t){var n;null==(n=this.instance)||n.off(e,t)}static trigger(e,t){var n;null==(n=this.instance)||n.trigger(e,t)}static setDarkMode(e){var t;null==(t=this.instance)||t.setDarkMode(e)}static loadCountWidget(e){const t=new Nt(qt(e));t.inject("api",new en(t)),xn({ctx:t,pvAdd:!1})}static LoadCountWidget(e){console.warn("The method `LoadCountWidget` is deprecated, please use `loadCountWidget` instead."),this.loadCountWidget(e)}};return __publicField(wn,"instance"),__publicField(wn,"ListLite",jt),__publicField(wn,"defaults",Dt),__publicField(wn,"plugins",[e=>{e.conf.useBackendConf?e.on("list-loaded",(()=>{xn({ctx:e,pvAdd:!0})})):xn({ctx:e,pvAdd:!0})}]),__publicField(wn,"DisabledComponents",[]),wn})); diff --git a/assets/lib/artalk/ArtalkLite.css b/assets/lib/artalk/ArtalkLite.css index a2ed5ac35..e4f9e425c 100644 --- a/assets/lib/artalk/ArtalkLite.css +++ b/assets/lib/artalk/ArtalkLite.css @@ -1 +1 @@ -@charset "UTF-8";.artalk,.atk-layer-wrap{--at-color-font: #2a2e2e;--at-color-deep: #2a2e2e;--at-color-sub: #757575;--at-color-grey: #747474;--at-color-meta: #697182;--at-color-border: #eceff2;--at-color-light: #4285f4;--at-color-bg: #FFF;--at-color-bg-transl: rgba(255, 255, 255, .94);--at-color-bg-grey: #f3f4f5;--at-color-bg-grey-transl: rgba(244, 244, 244, .75);--at-color-bg-light: rgba(29, 161, 242, .1);--at-color-main: #0083ff;--at-color-red: #ff5652;--at-color-pink: #fa5a57;--at-color-yellow: #ff7c37;--at-color-green: #4caf50;--at-color-gradient: linear-gradient(180deg, transparent, rgba(255, 255, 255))}.artalk.atk-dark-mode,.atk-layer-wrap.atk-dark-mode{--at-color-font: #fff;--at-color-deep: #e7e7e7;--at-color-sub: #e7e7e7;--at-color-grey: #fff;--at-color-meta: #fff;--at-color-border: #2d3235;--at-color-light: #687a86;--at-color-bg: #1e2224;--at-color-bg-transl: rgba(30, 34, 36, .95);--at-color-bg-grey: #46494e;--at-color-bg-grey-transl: rgba(8, 8, 8, .95);--at-color-bg-light: rgba(29, 161, 242, .1);--at-color-main: #0083ff;--at-color-red: #ff5652;--at-color-pink: #fa5a57;--at-color-yellow: #ff7c37;--at-color-green: #4caf50;--at-color-gradient: linear-gradient(180deg, transparent, rgba(30, 34, 36, 1))}.atk-comment-wrap{overflow:hidden;position:relative;border-bottom:1px solid transparent}.atk-comment-wrap.atk-flash-once{animation:atkFlashOnce 1s ease-in-out 0s}@keyframes atkFlashOnce{0%{background:rgba(0,131,255,.2)}to{background:transparent}}.atk-comment-wrap.atk-unread:before{content:" ";position:absolute;left:0;top:10%;width:3px;height:80%;background:var(--at-color-main)}.atk-comment-wrap.atk-openable{cursor:pointer}.atk-comment-wrap.atk-openable:hover{background:var(--at-color-bg-grey)}.atk-comment-wrap.atk-openable .atk-height-limit:after{background:transparent!important}.atk-comment-wrap:last-child{border-bottom:none}.atk-comment{display:block;padding:12px 10px}.atk-comment>.atk-avatar{display:block;padding:2px 0;float:left}.atk-comment>.atk-avatar img{width:50px;height:50px;border-radius:3px}.atk-comment>.atk-main{display:block;margin-left:63px}.atk-comment>.atk-main>.atk-header{line-height:1.5;font-size:13px;margin-bottom:.5em;overflow:hidden;position:relative;display:flex;flex-wrap:wrap;align-items:center}.atk-comment>.atk-main>.atk-header .atk-item{display:flex;align-items:center;margin-top:2px;margin-bottom:2px;color:var(--at-color-meta)}.atk-comment>.atk-main>.atk-header .atk-item:not(:last-child){margin-right:6px}.atk-comment>.atk-main>.atk-header .atk-item.atk-nick,.atk-comment>.atk-main>.atk-header .atk-item.atk-nick a{font-size:14px;color:var(--at-color-main);text-decoration:none}.atk-comment>.atk-main>.atk-header .atk-item.atk-reply-at{margin-left:2px}.atk-comment>.atk-main>.atk-header .atk-item.atk-reply-at>.atk-arrow:before{content:"";vertical-align:middle;transform:rotate(90deg);border-bottom:4px solid var(--at-color-grey);border-left:3px solid transparent;border-right:3px solid transparent;display:inline-block;margin-top:-1px}.atk-comment>.atk-main>.atk-header .atk-item.atk-reply-at>.atk-nick{color:var(--at-color-main);cursor:pointer;margin-left:6px}.atk-comment>.atk-main>.atk-header .badge,.atk-comment>.atk-main>.atk-header .atk-ua,.atk-comment>.atk-main>.atk-header .atk-pinned-badge,.atk-comment>.atk-main>.atk-header .atk-region-badge,.atk-comment>.atk-main>.atk-header .atk-badge{display:inline-block;color:var(--at-color-meta);background:var(--at-color-bg-grey);padding:0 6px;line-height:17px;border-radius:3px}.atk-comment>.atk-main>.atk-header .badge:not(:last-child),.atk-comment>.atk-main>.atk-header .atk-ua:not(:last-child),.atk-comment>.atk-main>.atk-header .atk-pinned-badge:not(:last-child),.atk-comment>.atk-main>.atk-header .atk-region-badge:not(:last-child),.atk-comment>.atk-main>.atk-header .atk-badge:not(:last-child){margin-right:6px}.atk-comment>.atk-main>.atk-header .atk-badge-wrap>*:last-child{margin-right:6px}.atk-comment>.atk-main>.atk-header .atk-badge{color:#fff}.atk-comment>.atk-main>.atk-header .atk-pinned-badge{color:#fff;background:#f44336}@media only screen and (max-width: 768px){.atk-comment>.atk-main>.atk-header .atk-ua-wrap{display:block}}.atk-comment>.atk-main>.atk-body{display:block;overflow:hidden;position:relative}.atk-comment>.atk-main>.atk-body img{max-width:100%}.atk-comment>.atk-main>.atk-body>.atk-content{word-break:break-all}.atk-comment>.atk-main>.atk-body>.atk-content.atk-type-collapsed{border:3px solid var(--at-color-bg-grey);border-bottom:0;padding:5px 10px;border-radius:6px 6px 0 0;margin-bottom:-5px}.atk-comment>.atk-main>.atk-body>.atk-content>*:first-child{margin-top:0}.atk-comment>.atk-main>.atk-body>.atk-content>*:last-child{margin-bottom:0}.atk-comment>.atk-main>.atk-body>.atk-content .atk-height-limit-btn{bottom:5px}.atk-comment>.atk-main>.atk-body>.atk-pending{color:var(--at-color-meta);margin:3px 0;font-size:13px;padding:10px 18px;display:block;background:var(--at-color-bg-grey);border-left:4px solid #f44336}.atk-comment>.atk-main>.atk-body>.atk-reply-to{padding:5px 15px;border-left:3px solid var(--at-color-border);margin-bottom:10px;position:relative;margin-top:10px}.atk-comment>.atk-main>.atk-body>.atk-reply-to .atk-meta{font-size:15px}.atk-comment>.atk-main>.atk-body>.atk-reply-to .atk-meta .atk-nick{color:var(--at-color-main)}.atk-comment>.atk-main>.atk-body>.atk-reply-to .atk-content{margin-top:5px}.atk-comment>.atk-main>.atk-body>.atk-collapsed{margin:3px 0;font-size:13px;padding:10px 18px;display:block;background:var(--at-color-bg-grey);border-radius:6px}.atk-comment>.atk-main>.atk-body>.atk-collapsed .atk-text{color:var(--at-color-meta)}.atk-comment>.atk-main>.atk-body>.atk-collapsed .atk-show-btn{color:var(--at-color-main);cursor:pointer;-webkit-user-select:none;-moz-user-select:none;user-select:none;margin-left:3px}.atk-comment>.atk-main>.atk-body>.atk-collapsed .atk-show-btn:hover{color:var(--at-color-main)}.atk-comment>.atk-main>.atk-footer{margin-top:12px}.atk-comment>.atk-main>.atk-footer .atk-actions{display:flex;flex-direction:row;align-items:center;flex-wrap:wrap;margin-bottom:-15px}.atk-comment>.atk-main>.atk-footer .atk-actions>span{color:var(--at-color-meta);font-size:13px;line-height:15px;display:inline-flex;cursor:pointer;-webkit-user-select:none;-moz-user-select:none;user-select:none;margin-bottom:15px}.atk-comment>.atk-main>.atk-footer .atk-actions>span.atk-error,.atk-comment>.atk-main>.atk-footer .atk-actions>span.atk-error:hover{color:var(--at-color-red)}.atk-comment>.atk-main>.atk-footer .atk-actions>span:not(:last-child):not(.atk-hide){margin-right:16px}.atk-comment>.atk-main>.atk-footer .atk-actions>span:hover{color:var(--at-color-deep)}.atk-comment .atk-height-limit:after{position:absolute;z-index:1;display:block;overflow:hidden;width:100%;content:" ";bottom:0;height:80px;background:var(--at-color-gradient)}.atk-comment .atk-height-limit-btn{z-index:2;position:absolute;left:50%;bottom:10px;transform:translate(-50%);cursor:pointer;border:1px solid var(--at-color-border);border-radius:6px;background:var(--at-color-bg);padding:1px 20px;font-size:15px;color:var(--at-color-meta);-webkit-user-select:none;-moz-user-select:none;user-select:none}.atk-comment .atk-height-limit-btn:hover{background:var(--at-color-bg-grey)}.atk-comment .atk-height-limit .atk-height-limit .atk-height-limit-btn{display:none}.atk-comment .atk-height-limit-scroll{margin-top:10px;overflow-y:auto;background:linear-gradient(var(--at-color-bg) 1px,transparent 1px calc(100% - 1px)) center top,linear-gradient(transparent calc(100% - 1px),var(--at-color-bg) calc(100% - 1px) 1px) center bottom,linear-gradient(var(--at-color-border) 1px,transparent 1px calc(100% - 1px)) center top,linear-gradient(transparent calc(100% - 1px),var(--at-color-border) calc(100% - 1px) 1px) center bottom;background-repeat:no-repeat;background-color:transparent;background-size:100% 1px,100% 1px,100% 1px,100% 1px;background-attachment:local,local,scroll,scroll}.atk-comment-children>.atk-comment-wrap{margin-top:10px;border-left:1px dashed transparent;border-bottom-color:transparent}.atk-comment-children>.atk-comment-wrap:not(:last-child){margin-bottom:5px}.atk-comment-children>.atk-comment-wrap>.atk-comment{padding:4px 0}.atk-comment-children>.atk-comment-wrap>.atk-comment>.atk-avatar img{width:36px;height:36px}.atk-comment-children>.atk-comment-wrap>.atk-comment>.atk-main{margin-left:47px}.artalk>.atk-list{position:relative}.artalk>.atk-list>.atk-list-header{display:flex;flex-direction:row;padding:10px 17px}.artalk>.atk-list>.atk-list-header .atk-text{display:inline-block}.artalk>.atk-list>.atk-list-header .atk-dropdown-wrap{position:relative;cursor:pointer}.artalk>.atk-list>.atk-list-header .atk-dropdown-wrap .atk-arrow-down-icon{cursor:pointer;vertical-align:middle;border-top:5px solid var(--at-color-grey);border-left:3px solid transparent;border-right:3px solid transparent;margin-top:-1px;margin-left:.8rem;display:inline-block}.artalk>.atk-list>.atk-list-header .atk-dropdown-wrap:hover .atk-dropdown{display:block}.artalk>.atk-list>.atk-list-header .atk-dropdown-wrap .atk-dropdown{z-index:3;display:none;height:auto!important;max-height:calc(100vh - 2.7rem);overflow-y:auto;position:absolute;top:100%;right:0;width:100%;background-color:var(--at-color-bg);padding:.6rem 0;border:1px solid var(--at-color-border);text-align:center;border-radius:6px;white-space:nowrap;margin:0;list-style:none}.artalk>.atk-list>.atk-list-header .atk-dropdown-wrap .atk-dropdown-item span,.artalk>.atk-list>.atk-list-header .atk-dropdown-wrap .atk-dropdown-item a{display:block;line-height:2rem;position:relative;border-bottom:none;font-weight:400;padding:0 1.5rem}.artalk>.atk-list>.atk-list-header .atk-dropdown-wrap .atk-dropdown-item span:hover,.artalk>.atk-list>.atk-list-header .atk-dropdown-wrap .atk-dropdown-item a:hover{color:var(--at-color-main)}.artalk>.atk-list>.atk-list-header .atk-dropdown-wrap .atk-dropdown-item.active span,.artalk>.atk-list>.atk-list-header .atk-dropdown-wrap .atk-dropdown-item a{color:var(--at-color-main)}.artalk>.atk-list>.atk-list-header .atk-comment-count{font-size:15px}.artalk>.atk-list>.atk-list-header .atk-comment-count .atk-comment-count-num{font-size:22px;margin-right:4px}.artalk>.atk-list>.atk-list-header .atk-right-action{display:flex;flex:1;flex-direction:row;align-items:center;justify-content:flex-end}.artalk>.atk-list>.atk-list-header .atk-right-action>span{font-size:14px;color:var(--at-color-meta);cursor:pointer;-webkit-user-select:none;-moz-user-select:none;user-select:none;position:relative}.artalk>.atk-list>.atk-list-header .atk-right-action>span.atk-on,.artalk>.atk-list>.atk-list-header .atk-right-action>span.atk-on *{color:var(--at-color-main)}.artalk>.atk-list>.atk-list-header .atk-right-action>span:not(:last-child):not(.atk-hide){margin-right:10px;padding-right:10px}.artalk>.atk-list>.atk-list-header .atk-right-action>span .atk-unread-badge{position:absolute;top:-5px;left:-6px;color:#fff;background:var(--at-color-pink);text-align:center;min-width:16px;height:16px;padding:0 3px;border-radius:8px;line-height:16px;font-size:12px}.artalk>.atk-list>.atk-list-body{min-height:150px}.artalk>.atk-list>.atk-list-footer{z-index:1;position:absolute;bottom:5px;right:0}@media only screen and (max-width: 768px){.artalk>.atk-list>.atk-list-footer{position:relative;margin-top:10px;text-align:center}}.artalk>.atk-list>.atk-list-footer .atk-copyright{display:block;font-size:12px;color:var(--at-color-meta);padding-right:15px;margin-top:5px}.artalk>.atk-list>.atk-list-footer .atk-copyright a{color:var(--at-color-main);text-decoration:none}.atk-list-no-comment{height:150px;display:flex;font-size:19px;justify-content:center;align-items:center;word-break:break-word;text-align:center}.atk-list-read-more{border-top:1px dashed var(--at-color-border);margin-top:28px;padding-bottom:25px}@media only screen and (max-width: 768px){.atk-list-read-more{padding-bottom:10px}}.atk-list-read-more.atk-err .atk-text{color:var(--at-color-red)!important}.atk-list-read-more .atk-list-read-more-inner{cursor:pointer;-webkit-user-select:none;-moz-user-select:none;user-select:none;padding:0 15px;font-size:14px;border-radius:6px;border:1px solid transparent;display:flex;height:30px;flex-direction:row;place-content:center;align-items:center;width:120px;margin:-15px auto 0;background:var(--at-color-bg);border-color:var(--at-color-border)}.atk-list-read-more .atk-list-read-more-inner>.atk-loading-icon{height:15px;width:15px}.atk-list-read-more .atk-list-read-more-inner>.atk-text{color:var(--at-color-meta)}.atk-list-read-more .atk-list-read-more-inner:hover{background:var(--at-color-bg-grey)}.atk-pagination{display:flex;flex-direction:row;justify-content:center;padding:10px 0;position:relative}.atk-pagination>.atk-btn,.atk-pagination>.atk-input{font-size:15px;height:30px;border:1px solid var(--at-color-border);border-radius:3px;padding:0 5px;text-align:center;background:var(--at-color-bg)}.atk-pagination>.atk-btn{-webkit-user-select:none;-moz-user-select:none;user-select:none;width:70px;cursor:pointer;display:flex;justify-content:center;align-items:center}.atk-pagination>.atk-btn:hover{background:var(--at-color-bg-grey)}.atk-pagination>.atk-btn.atk-disabled{color:var(--at-color-sub)}.atk-pagination>.atk-btn.atk-disabled:hover{cursor:default;background:initial}.atk-pagination>.atk-input{background:transparent;color:var(--at-color-font);font-size:18px;width:60px;outline:none}.atk-pagination>.atk-input:focus{border-color:var(--at-color-main)}.atk-pagination>*:not(:last-child){margin-right:10px}.atk-main-editor{position:relative;overflow:hidden;background:var(--at-color-bg);border:1px solid var(--at-color-border);border-radius:6px;margin-bottom:10px}@media only screen and (max-width: 768px){.atk-main-editor{margin-bottom:7px}}.atk-main-editor>.atk-header{display:flex;flex-direction:row;padding:10px 14px 0}.atk-main-editor>.atk-header input{flex:1;width:100%;font-size:14px;background:transparent;border:2px solid transparent;border-radius:3px;padding:6px 5px;resize:none;outline:none}.atk-main-editor>.atk-header input:not(:last-child){margin-right:2px}.atk-main-editor>.atk-textarea-wrap{position:relative}.atk-main-editor>.atk-textarea-wrap>.atk-textarea{display:block;overflow:hidden;color:var(--at-color-font);font-size:15px;background-color:var(--at-color-bg);border:2px solid transparent;border-radius:3px;width:100%;min-height:120px;margin-top:2px;padding:10px 20px;resize:none;word-wrap:break-word;outline:none}.atk-main-editor>.atk-textarea-wrap>.atk-comment-closed{pointer-events:none;color:var(--at-color-meta);font-size:12px;background-color:var(--at-color-bg);border-top:1px solid var(--at-color-border);padding:5px 15px;margin-top:10px}.atk-main-editor>.atk-textarea-wrap>.atk-send-reply{z-index:2;position:absolute;right:7px;bottom:2px;max-width:calc(100% - 20px);height:30px;line-height:30px;font-size:14px;background:var(--at-color-bg-grey-transl);padding:0 30px 0 10px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;cursor:pointer;border-radius:3px}.atk-main-editor>.atk-textarea-wrap>.atk-send-reply .atk-cancel{position:absolute;right:0;bottom:0;height:30px;text-align:center;width:30px;line-height:30px;font-weight:700}.atk-main-editor>.atk-textarea-wrap>.atk-send-reply .atk-cancel:hover{color:var(--at-color-deep)}.atk-main-editor>.atk-plug-panel-wrap{position:relative;height:180px;width:100%;overflow:hidden;border-top:1px solid var(--at-color-border);animation:.3s both atkFadeIn;transition:.2s height ease-in-out}.atk-main-editor>.atk-bottom{display:flex;flex-direction:row;justify-content:space-between;padding:5px 5px 5px 10px}.atk-main-editor>.atk-bottom>.atk-item{display:flex;flex-direction:row;align-items:center}.atk-main-editor>.atk-bottom .atk-plug-btn{padding:0 8px;line-height:24px;cursor:pointer;color:var(--at-color-grey);font-size:14px;-webkit-user-select:none;-moz-user-select:none;user-select:none;border-radius:3px}.atk-main-editor>.atk-bottom .atk-plug-btn:not(:last-child){margin-right:2px}.atk-main-editor>.atk-bottom .atk-plug-btn:hover{background:var(--at-color-bg-grey)}.atk-main-editor>.atk-bottom .atk-plug-btn.active{color:var(--at-color-main)}.atk-main-editor>.atk-bottom .atk-plug-btn.active svg.markdown path{fill:var(--at-color-main)}.atk-main-editor>.atk-bottom .atk-plug-btn i{color:var(--at-color-grey);display:inline-flex;vertical-align:sub;margin-left:4px}.atk-main-editor>.atk-bottom .atk-plug-btn i svg.markdown path{fill:var(--at-color-grey)}.atk-main-editor>.atk-bottom .atk-send-btn{background:var(--at-color-main);color:#fff;font-size:14px;border:none;margin:0;height:30px;width:8em;cursor:pointer;transition:opacity .3s ease-in-out;outline:none;border-radius:3px}.atk-main-editor>.atk-bottom .atk-send-btn:active{opacity:.9}.atk-main-editor>.atk-notify-wrap{z-index:3;position:absolute;right:-2px;bottom:40px;width:225px;opacity:.83}.atk-sidebar-layer{position:fixed;z-index:99999;top:0;right:0;width:430px;height:100%;background:var(--at-color-bg);transition:transform .45s cubic-bezier(.23,1,.32,1) 0ms;transform:translate(430px)}@media only screen and (max-width: 430px){.atk-sidebar-layer{width:100%}}.atk-sidebar-layer .atk-sidebar-inner{position:relative;height:100%}.atk-sidebar-layer .atk-sidebar-header{position:absolute;top:0;right:0;display:flex;flex-direction:row;align-items:center;z-index:99999}.atk-sidebar-layer .atk-sidebar-header .atk-sidebar-close{display:flex;flex-direction:column;width:60px;height:60px;align-items:center;place-content:center;cursor:pointer;-webkit-user-select:none;-moz-user-select:none;user-select:none;margin-left:10px}.atk-sidebar-layer .atk-sidebar-header .atk-sidebar-close:hover .atk-icon-close{background-color:#e81123e6}.atk-sidebar-layer .atk-sidebar-iframe-wrap{height:100%;position:relative}.atk-sidebar-layer .atk-sidebar-iframe-wrap iframe{border:0;width:100%;height:100%}.atk-sidebar-layer .atk-sidebar-iframe-wrap .atk-err-alert{z-index:9999;top:50%;left:50%;transform:translate(-50%,-50%);position:absolute;background:var(--at-color-bg);padding:40px 30px;width:80%;text-align:center;border-radius:4px}.atk-sidebar-layer .atk-sidebar-iframe-wrap .atk-err-alert .atk-title{font-size:1.4em;margin-bottom:20px;color:var(--at-color-font)}.atk-sidebar-layer .atk-sidebar-iframe-wrap .atk-err-alert .atk-text{color:var(--at-color-font)}.atk-sidebar-layer .atk-sidebar-iframe-wrap .atk-err-alert .atk-text span{cursor:pointer;color:var(--at-color-main)}.artalk{position:relative;width:100%;min-height:200px}.artalk,.atk-layer-wrap{color:var(--at-color-font);word-wrap:break-word;word-break:break-word}.artalk *,.atk-layer-wrap *{box-sizing:border-box}.artalk input,.artalk textarea,.artalk button,.artalk optgroup,.artalk select,.atk-layer-wrap input,.atk-layer-wrap textarea,.atk-layer-wrap button,.atk-layer-wrap optgroup,.atk-layer-wrap select{font-family:inherit;color:inherit;font-size:inherit}.artalk code,.atk-layer-wrap code{font-family:source code pro,Consolas,Monaco,Menlo,sans-serif;margin:0 .05em;padding:0 .4em;display:inline-block;vertical-align:middle;font-size:.9em;background-color:var(--at-color-bg-grey);color:var(--at-color-font);border-radius:2px}.artalk pre,.atk-layer-wrap pre{margin:10px 0 0;padding:0;line-height:0}.artalk pre code,.atk-layer-wrap pre code{line-height:1.6em;display:block;padding:10px 15px;white-space:pre-wrap!important;background-color:var(--at-color-bg-grey);color:var(--at-color-font);margin:0}.artalk pre code *,.atk-layer-wrap pre code *{font-family:source code pro,Consolas,Monaco,Menlo,sans-serif}.artalk a,.atk-layer-wrap a{color:var(--at-color-main);text-decoration:none}.artalk blockquote,.atk-layer-wrap blockquote{position:static;margin:10px 0;padding:10px 20px;background:var(--at-color-bg-grey);border-left:4px solid #687a86;color:var(--at-color-font)}.artalk p:first-child,.atk-layer-wrap p:first-child{margin-top:0}.artalk p:last-child,.atk-layer-wrap p:last-child{margin-bottom:0}.artalk img,.atk-layer-wrap img{max-width:100%}.artalk table,.atk-layer-wrap table{width:100%;border-collapse:collapse;border-spacing:0;margin-bottom:1.5em;font-size:.96em}.artalk td,.artalk th,.atk-layer-wrap td,.atk-layer-wrap th{text-align:left;padding:4px 8px 4px 10px;border:1px solid var(--at-color-border)}.artalk td,.atk-layer-wrap td{vertical-align:top}.artalk tr:nth-child(2n),.atk-layer-wrap tr:nth-child(2n){background-color:var(--at-color-bg-grey)}.artalk ul,.atk-layer-wrap ul{list-style:disc}.artalk ol,.atk-layer-wrap ol{list-style:decimal}.artalk li+li,.atk-layer-wrap li+li{margin-top:8px}.artalk li>ol,.artalk li>ul,.atk-layer-wrap li>ol,.atk-layer-wrap li>ul{margin:8px 0 0}.atk-hide{display:none!important}.atk-full-layer,.atk-layer-dialog-wrap,.atk-error-layer,.atk-loading{width:100%;height:100%;position:absolute;top:0;left:0;background:var(--at-color-bg);z-index:4;align-items:center;justify-content:center;flex-flow:column;display:flex}.atk-loading-spinner{position:relative;width:50px;height:50px}.atk-loading-spinner svg{animation:atkRotate 2s linear infinite;transform-origin:center center;width:100%;height:100%;position:absolute;top:0;left:0}.atk-loading-spinner svg circle{stroke-dasharray:1,200;stroke-dashoffset:0;animation:atkDash 1.5s ease-in-out infinite,atkColor 6s ease-in-out infinite;stroke-linecap:round}@keyframes atkRotate{to{transform:rotate(360deg)}}@keyframes atkDash{0%{stroke-dasharray:1,200;stroke-dashoffset:0}50%{stroke-dasharray:89,200;stroke-dashoffset:-35px}to{stroke-dasharray:89,200;stroke-dashoffset:-124px}}@keyframes atkColor{0%,to{stroke:#ff5652}40%{stroke:#2196f3}66%{stroke:#32c787}80%,90%{stroke:#ffc107}}@keyframes atkLoadingIconRotate{0%{transform:rotate(0)}to{transform:rotate(360deg)}}.atk-loading-icon{width:18px;height:18px;box-sizing:border-box;border:solid 1px transparent;border-top-color:#29d;border-left-color:#29d;border-radius:50%;animation:atkLoadingIconRotate .4s linear infinite}.atk-fade-in{animation:atkFadeIn both .3s}.atk-fade-out{animation:atkFadeOut both .2s}.atk-rotate{animation:atkRotate 2s linear infinite}@keyframes atkFadeIn{0%{opacity:0}to{opacity:1}}@keyframes atkFadeOut{to{opacity:0}}@keyframes atkRotate{0%{transform:rotate(0)}to{transform:rotate(360deg)}}i.atk-icon{width:20px;height:20px;background-color:var(--at-color-deep);background-size:contain;background-repeat:no-repeat;-webkit-mask-repeat:no-repeat;mask-repeat:no-repeat;-webkit-mask-position:center;mask-position:center;-webkit-mask-size:contain;mask-size:contain}.atk-icon-sync{-webkit-mask-image:url("data:image/svg+xml,%3Csvg width='20' height='20' viewBox='0 0 20 20' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M4.99133 4.87635C2.22512 7.64257 2.22512 12.1275 4.99133 14.8937C6.04677 15.9491 7.3524 16.6019 8.71732 16.8519' stroke='%234E5969' stroke-width='2'/%3E%3Cpath d='M14.4179 15.4815L15.0072 14.8922C17.7734 12.126 17.7734 7.64107 15.0072 4.87486C13.9518 3.81942 12.6461 3.16668 11.2812 2.91664' stroke='%234E5969' stroke-width='2'/%3E%3Cpath d='M6.17106 4.99252L5.58181 4.40327L4.99255 3.81401H6.17106V4.99252Z' fill='%23C4C4C4' stroke='%234E5969' stroke-width='2'/%3E%3Cpath d='M13.8299 15.0084L14.4192 15.5976L15.0084 16.1869H13.8299V15.0084Z' fill='%23C4C4C4' stroke='%234E5969' stroke-width='2'/%3E%3C/svg%3E");mask-image:url("data:image/svg+xml,%3Csvg width='20' height='20' viewBox='0 0 20 20' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M4.99133 4.87635C2.22512 7.64257 2.22512 12.1275 4.99133 14.8937C6.04677 15.9491 7.3524 16.6019 8.71732 16.8519' stroke='%234E5969' stroke-width='2'/%3E%3Cpath d='M14.4179 15.4815L15.0072 14.8922C17.7734 12.126 17.7734 7.64107 15.0072 4.87486C13.9518 3.81942 12.6461 3.16668 11.2812 2.91664' stroke='%234E5969' stroke-width='2'/%3E%3Cpath d='M6.17106 4.99252L5.58181 4.40327L4.99255 3.81401H6.17106V4.99252Z' fill='%23C4C4C4' stroke='%234E5969' stroke-width='2'/%3E%3Cpath d='M13.8299 15.0084L14.4192 15.5976L15.0084 16.1869H13.8299V15.0084Z' fill='%23C4C4C4' stroke='%234E5969' stroke-width='2'/%3E%3C/svg%3E")}.atk-icon-del{background-color:var(--at-color-red)!important;-webkit-mask-image:url("data:image/svg+xml,%3Csvg width='22' height='22' viewBox='0 0 22 22' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M2.29167 5.04166L4.81251 5.04166M4.81251 5.04166L4.81251 18.3333C4.81251 18.5865 5.01771 18.7917 5.27084 18.7917L16.7292 18.7917C16.9823 18.7917 17.1875 18.5865 17.1875 18.3333V5.04166M4.81251 5.04166L7.33334 5.04166M17.1875 5.04166L19.7083 5.04166M17.1875 5.04166L14.6667 5.04166M7.33334 5.04166V3.20833L14.6667 3.20833V5.04166M7.33334 5.04166L14.6667 5.04166' stroke='%23D06565' stroke-width='2'/%3E%3Cpath d='M9.16667 8.25V15.125M12.8333 8.25V15.125' stroke='%23D06565' stroke-width='2'/%3E%3C/svg%3E");mask-image:url("data:image/svg+xml,%3Csvg width='22' height='22' viewBox='0 0 22 22' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M2.29167 5.04166L4.81251 5.04166M4.81251 5.04166L4.81251 18.3333C4.81251 18.5865 5.01771 18.7917 5.27084 18.7917L16.7292 18.7917C16.9823 18.7917 17.1875 18.5865 17.1875 18.3333V5.04166M4.81251 5.04166L7.33334 5.04166M17.1875 5.04166L19.7083 5.04166M17.1875 5.04166L14.6667 5.04166M7.33334 5.04166V3.20833L14.6667 3.20833V5.04166M7.33334 5.04166L14.6667 5.04166' stroke='%23D06565' stroke-width='2'/%3E%3Cpath d='M9.16667 8.25V15.125M12.8333 8.25V15.125' stroke='%23D06565' stroke-width='2'/%3E%3C/svg%3E")}.atk-icon-edit{-webkit-mask-image:url("data:image/svg+xml,%3Csvg width='16' height='17' viewBox='0 0 16 17' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M9.70618 4.08515L12.6081 7.06376M1.00041 13.021L11.7376 2L14.6392 4.97861L3.90274 16H1L1.00041 13.021Z' stroke='%234E5969' stroke-width='1.5'/%3E%3C/svg%3E");mask-image:url("data:image/svg+xml,%3Csvg width='16' height='17' viewBox='0 0 16 17' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M9.70618 4.08515L12.6081 7.06376M1.00041 13.021L11.7376 2L14.6392 4.97861L3.90274 16H1L1.00041 13.021Z' stroke='%234E5969' stroke-width='1.5'/%3E%3C/svg%3E")}.atk-icon-no,.atk-icon-close{-webkit-mask-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='25' height='25' viewBox='0 0 25 25' fill='none'%3E%3Cpath d='M19.8657 5.13431L12.5 12.5L5.13431 19.8657' stroke='%234E5969'/%3E%3Cpath d='M5.13431 5.13432L12.5 12.5L19.8657 19.8657' stroke='%234E5969'/%3E%3C/svg%3E");mask-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='25' height='25' viewBox='0 0 25 25' fill='none'%3E%3Cpath d='M19.8657 5.13431L12.5 12.5L5.13431 19.8657' stroke='%234E5969'/%3E%3Cpath d='M5.13431 5.13432L12.5 12.5L19.8657 19.8657' stroke='%234E5969'/%3E%3C/svg%3E")}.atk-icon-yes{-webkit-mask-image:url("data:image/svg+xml,%3Csvg width='25' height='25' viewBox='0 0 25 25' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M21.7071 5.75533L9.92197 17.5404L3.29285 10.9113' stroke='%234E5969'/%3E%3C/svg%3E");mask-image:url("data:image/svg+xml,%3Csvg width='25' height='25' viewBox='0 0 25 25' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M21.7071 5.75533L9.92197 17.5404L3.29285 10.9113' stroke='%234E5969'/%3E%3C/svg%3E")}.atk-icon-plus{-webkit-mask-image:url("data:image/svg+xml,%3Csvg width='20' height='20' viewBox='0 0 20 20' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M2.08331 10H17.9166' stroke='%234E5969' stroke-width='2'/%3E%3Cpath d='M10 2.08334L10 17.9167' stroke='%234E5969' stroke-width='2'/%3E%3C/svg%3E");mask-image:url("data:image/svg+xml,%3Csvg width='20' height='20' viewBox='0 0 20 20' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M2.08331 10H17.9166' stroke='%234E5969' stroke-width='2'/%3E%3Cpath d='M10 2.08334L10 17.9167' stroke='%234E5969' stroke-width='2'/%3E%3C/svg%3E")}.atk-error-layer{background-color:var(--at-color-bg-transl)}.atk-error-layer .atk-error-title{color:var(--at-color-red)}.atk-error-layer .atk-warn-title{color:var(--at-color-yellow)}.atk-error-layer .atk-error-title,.atk-error-layer .atk-warn-title{display:inline-block;padding:0 15px;margin-bottom:20px;font-size:20px;letter-spacing:-.5px}.atk-error-layer .atk-error-text{text-align:center;padding:0 20px}.atk-error-layer .atk-error-text *{color:var(--at-color-deep)}.atk-error-layer .atk-error-text a{color:var(--at-color-meta)}.atk-layer-dialog-wrap{background-color:var(--at-color-bg-transl)}.atk-layer-dialog-wrap>.atk-layer-dialog{width:25%}.atk-layer-dialog-wrap>.atk-layer-dialog>.atk-layer-dialog-content .atk-captcha-img{cursor:pointer;width:170px;height:auto;margin-right:10px;padding-right:10px;border-right:1px solid var(--at-color-border);vertical-align:bottom}.atk-layer-dialog-wrap>.atk-layer-dialog>.atk-layer-dialog-content input{width:100%;line-height:34px;background-color:var(--at-color-bg);border:1px solid var(--at-color-border);border-radius:3px;outline:none;padding:0 6px;display:block;margin-top:10px;margin-bottom:5px;text-align:center}.atk-layer-dialog-wrap>.atk-layer-dialog>.atk-layer-dialog-actions{display:flex;flex-direction:row}.atk-layer-dialog-wrap>.atk-layer-dialog>.atk-layer-dialog-actions button{flex:1;display:block;cursor:pointer;border:1px solid var(--at-color-main);background:transparent;color:var(--at-color-main);border-radius:3px;padding:0 15px;line-height:30px;outline:none}.atk-layer-dialog-wrap>.atk-layer-dialog>.atk-layer-dialog-actions button:active{color:#fff;background:var(--at-color-main)}.atk-layer-dialog-wrap>.atk-layer-dialog>.atk-layer-dialog-actions button:not(:last-child){margin-right:5px}.atk-layer-dialog-wrap>.atk-layer-dialog>.atk-layer-dialog-actions button.error{color:#fff;background:#ff5652;border-color:#ff5652}.atk-layer-dialog-wrap>.atk-layer-dialog .atk-checker-iframe-wrap{position:fixed;z-index:999998;left:0;top:0;height:100vh;width:100vw}.atk-layer-dialog-wrap>.atk-layer-dialog .atk-checker-iframe-wrap>iframe{width:100%;height:100%;border:0}.atk-layer-dialog-wrap>.atk-layer-dialog .atk-checker-iframe-wrap .atk-close-btn{z-index:999999;position:fixed;top:20px;right:20px;display:flex;flex-direction:column;width:50px;height:50px;align-items:center;place-content:center;cursor:pointer;-webkit-user-select:none;-moz-user-select:none;user-select:none;margin-left:10px}.atk-layer-dialog-wrap>.atk-layer-dialog .atk-checker-iframe-wrap .atk-close-btn:hover .atk-icon-close{background-color:#e81123e6}@media only screen and (max-width: 768px){.atk-layer-dialog-wrap>.atk-layer-dialog{width:90%!important}}.atk-notify{display:block;overflow:hidden;background-color:#2c2c2c;color:#fff;border-radius:3px;cursor:pointer;font-size:14px;padding:5px 15px}.atk-notify:not(:last-child){margin-bottom:3px}.atk-notify .atk-notify-content{color:#fff}.atk-layer-wrap .atk-layer-mask{position:fixed;top:0;left:0;width:100%;height:100%;z-index:99998;background:rgba(0,0,0,.3)}.atk-layer-wrap .atk-layer-item{position:fixed;z-index:99999;top:0;right:0;width:100%;height:100%}.atk-common-action-btn.atk-btn-confirm,.atk-common-action-btn.atk-btn-warn{color:var(--at-color-yellow)!important}.atk-common-action-btn.atk-btn-error{color:var(--at-color-red)!important}.atk-common-action-btn.atk-btn-success{color:var(--at-color-green)!important}img[atk-emoticon]{max-height:60px;display:initial}.atk-slim-scrollbar::-webkit-scrollbar,.atk-editor-plug-emoticons>.atk-grp-wrap::-webkit-scrollbar{width:4px;height:4px;background:transparent}.atk-slim-scrollbar::-webkit-scrollbar-thumb,.atk-editor-plug-emoticons>.atk-grp-wrap::-webkit-scrollbar-thumb,.atk-slim-scrollbar::-webkit-scrollbar-thumb:window-inactive{background:rgba(86,86,86,.3)}.atk-slim-scrollbar::-webkit-scrollbar-thumb:vertical:hover,.atk-editor-plug-emoticons>.atk-grp-wrap::-webkit-scrollbar-thumb:vertical:hover{background:rgba(65,74,82,.77)}.atk-slim-scrollbar::-webkit-scrollbar-thumb:vertical:active,.atk-editor-plug-emoticons>.atk-grp-wrap::-webkit-scrollbar-thumb:vertical:active{background:rgba(41,47,53,.77)}.atk-editor-plug-emoticons{height:100%;width:100%}.atk-editor-plug-emoticons>.atk-grp-wrap{overflow-y:scroll;overflow-x:hidden;height:100%;width:100%}.atk-editor-plug-emoticons>.atk-grp-wrap>.atk-grp{display:flex;flex-wrap:wrap;flex-direction:row;padding:5px 10px 35px}.atk-editor-plug-emoticons>.atk-grp-wrap>.atk-grp[data-type=image]>.atk-item{height:63px;width:63px}.atk-editor-plug-emoticons>.atk-grp-wrap>.atk-grp>.atk-item{display:flex;align-items:center;justify-content:center;padding:5px;cursor:pointer;-webkit-user-select:none;-moz-user-select:none;user-select:none;border-radius:3px;font-size:15px;min-width:35px;margin:2px}.atk-editor-plug-emoticons>.atk-grp-wrap>.atk-grp>.atk-item>img{max-height:100%;width:auto}.atk-editor-plug-emoticons>.atk-grp-wrap>.atk-grp>.atk-item:hover{background:var(--at-color-bg-grey)}.atk-editor-plug-emoticons>.atk-grp-switcher{position:absolute;bottom:0;left:0;width:100%;background:var(--at-color-bg-transl);height:30px;border-top:1px solid var(--at-color-border);border-bottom:1px solid var(--at-color-border)}.atk-editor-plug-emoticons>.atk-grp-switcher>span{-webkit-user-select:none;-moz-user-select:none;user-select:none;padding:0 10px;line-height:30px;float:left;display:block;cursor:pointer;font-size:14px}.atk-editor-plug-emoticons>.atk-grp-switcher>span:hover,.atk-editor-plug-emoticons>.atk-grp-switcher>span.active{background:var(--at-color-bg-grey)}.atk-slim-scrollbar::-webkit-scrollbar{width:4px;height:4px;background:transparent}.atk-slim-scrollbar::-webkit-scrollbar-thumb,.atk-slim-scrollbar::-webkit-scrollbar-thumb:window-inactive{background:rgba(86,86,86,.3)}.atk-slim-scrollbar::-webkit-scrollbar-thumb:vertical:hover{background:rgba(65,74,82,.77)}.atk-slim-scrollbar::-webkit-scrollbar-thumb:vertical:active{background:rgba(41,47,53,.77)}.atk-editor-plug-preview{overflow-y:scroll;overflow-x:hidden;height:100%;width:100%;padding:10px 15px} +@charset "UTF-8";.artalk,.atk-layer-wrap{--at-color-font: #2a2e2e;--at-color-deep: #2a2e2e;--at-color-sub: #757575;--at-color-grey: #747474;--at-color-meta: #697182;--at-color-border: #eceff2;--at-color-light: #4285f4;--at-color-bg: #FFF;--at-color-bg-transl: rgba(255, 255, 255, .94);--at-color-bg-grey: #f3f4f5;--at-color-bg-grey-transl: rgba(244, 244, 244, .75);--at-color-bg-light: rgba(29, 161, 242, .1);--at-color-main: #0083ff;--at-color-red: #ff5652;--at-color-pink: #fa5a57;--at-color-yellow: #ff7c37;--at-color-green: #4caf50;--at-color-gradient: linear-gradient(180deg, transparent, rgba(255, 255, 255))}.artalk.atk-dark-mode,.atk-layer-wrap.atk-dark-mode{--at-color-font: #fff;--at-color-deep: #e7e7e7;--at-color-sub: #e7e7e7;--at-color-grey: #fff;--at-color-meta: #fff;--at-color-border: #2d3235;--at-color-light: #687a86;--at-color-bg: #1e2224;--at-color-bg-transl: rgba(30, 34, 36, .95);--at-color-bg-grey: #46494e;--at-color-bg-grey-transl: rgba(8, 8, 8, .95);--at-color-bg-light: rgba(29, 161, 242, .1);--at-color-main: #0083ff;--at-color-red: #ff5652;--at-color-pink: #fa5a57;--at-color-yellow: #ff7c37;--at-color-green: #4caf50;--at-color-gradient: linear-gradient(180deg, transparent, rgba(30, 34, 36, 1))}.atk-comment-wrap{overflow:hidden;position:relative;border-bottom:1px solid transparent}.atk-comment-wrap.atk-flash-once{animation:atkFlashOnce 1s ease-in-out 0s}@keyframes atkFlashOnce{0%{background:rgba(0,131,255,.2)}to{background:transparent}}.atk-comment-wrap.atk-unread:before{content:" ";position:absolute;left:0;top:10%;width:3px;height:80%;background:var(--at-color-main)}.atk-comment-wrap.atk-openable{cursor:pointer}.atk-comment-wrap.atk-openable:hover{background:var(--at-color-bg-grey)}.atk-comment-wrap.atk-openable .atk-height-limit:after{background:transparent!important}.atk-comment-wrap:last-child{border-bottom:none}.atk-comment{display:block;padding:12px 10px}.atk-comment>.atk-avatar{display:block;padding:2px 0;float:left}.atk-comment>.atk-avatar img{width:50px;height:50px;border-radius:3px}.atk-comment>.atk-main{display:block;margin-left:63px}.atk-comment>.atk-main>.atk-header{line-height:1.5;font-size:13px;margin-bottom:.5em;overflow:hidden;position:relative;display:flex;flex-wrap:wrap;align-items:center}.atk-comment>.atk-main>.atk-header .atk-item{display:flex;align-items:center;margin-top:2px;margin-bottom:2px;color:var(--at-color-meta)}.atk-comment>.atk-main>.atk-header .atk-item:not(:last-child){margin-right:6px}.atk-comment>.atk-main>.atk-header .atk-item.atk-nick,.atk-comment>.atk-main>.atk-header .atk-item.atk-nick a{font-size:14px;color:var(--at-color-main);text-decoration:none}.atk-comment>.atk-main>.atk-header .atk-item.atk-reply-at{margin-left:2px}.atk-comment>.atk-main>.atk-header .atk-item.atk-reply-at>.atk-arrow:before{content:"";vertical-align:middle;transform:rotate(90deg);border-bottom:4px solid var(--at-color-grey);border-left:3px solid transparent;border-right:3px solid transparent;display:inline-block;margin-top:-1px}.atk-comment>.atk-main>.atk-header .atk-item.atk-reply-at>.atk-nick{color:var(--at-color-main);cursor:pointer;margin-left:6px}.atk-comment>.atk-main>.atk-header .badge,.atk-comment>.atk-main>.atk-header .atk-ua,.atk-comment>.atk-main>.atk-header .atk-pinned-badge,.atk-comment>.atk-main>.atk-header .atk-region-badge,.atk-comment>.atk-main>.atk-header .atk-badge{display:inline-block;color:var(--at-color-meta);background:var(--at-color-bg-grey);padding:0 6px;line-height:17px;border-radius:3px}.atk-comment>.atk-main>.atk-header .badge:not(:last-child),.atk-comment>.atk-main>.atk-header .atk-ua:not(:last-child),.atk-comment>.atk-main>.atk-header .atk-pinned-badge:not(:last-child),.atk-comment>.atk-main>.atk-header .atk-region-badge:not(:last-child),.atk-comment>.atk-main>.atk-header .atk-badge:not(:last-child){margin-right:6px}.atk-comment>.atk-main>.atk-header .atk-badge-wrap>*:last-child{margin-right:6px}.atk-comment>.atk-main>.atk-header .atk-badge{color:#fff}.atk-comment>.atk-main>.atk-header .atk-pinned-badge{color:#fff;background:#f44336}@media only screen and (max-width: 768px){.atk-comment>.atk-main>.atk-header .atk-ua-wrap{display:block}}.atk-comment>.atk-main>.atk-body{display:block;overflow:hidden;position:relative}.atk-comment>.atk-main>.atk-body img{max-width:100%}.atk-comment>.atk-main>.atk-body>.atk-content{word-break:break-all}.atk-comment>.atk-main>.atk-body>.atk-content.atk-type-collapsed{border:3px solid var(--at-color-bg-grey);border-bottom:0;padding:5px 10px;border-radius:6px 6px 0 0;margin-bottom:-5px}.atk-comment>.atk-main>.atk-body>.atk-content>*:first-child{margin-top:0}.atk-comment>.atk-main>.atk-body>.atk-content>*:last-child{margin-bottom:0}.atk-comment>.atk-main>.atk-body>.atk-content .atk-height-limit-btn{bottom:5px}.atk-comment>.atk-main>.atk-body>.atk-pending{color:var(--at-color-meta);margin:3px 0;font-size:13px;padding:10px 18px;display:block;background:var(--at-color-bg-grey);border-left:4px solid #f44336}.atk-comment>.atk-main>.atk-body>.atk-reply-to{padding:5px 15px;border-left:3px solid var(--at-color-border);margin-bottom:10px;position:relative;margin-top:10px}.atk-comment>.atk-main>.atk-body>.atk-reply-to .atk-meta{font-size:15px}.atk-comment>.atk-main>.atk-body>.atk-reply-to .atk-meta .atk-nick{color:var(--at-color-main)}.atk-comment>.atk-main>.atk-body>.atk-reply-to .atk-content{margin-top:5px}.atk-comment>.atk-main>.atk-body>.atk-collapsed{margin:3px 0;font-size:13px;padding:10px 18px;display:block;background:var(--at-color-bg-grey);border-radius:6px}.atk-comment>.atk-main>.atk-body>.atk-collapsed .atk-text{color:var(--at-color-meta)}.atk-comment>.atk-main>.atk-body>.atk-collapsed .atk-show-btn{color:var(--at-color-main);cursor:pointer;-webkit-user-select:none;-moz-user-select:none;user-select:none;margin-left:3px}.atk-comment>.atk-main>.atk-body>.atk-collapsed .atk-show-btn:hover{color:var(--at-color-main)}.atk-comment>.atk-main>.atk-footer{margin-top:12px}.atk-comment>.atk-main>.atk-footer .atk-actions{display:flex;flex-direction:row;align-items:center;flex-wrap:wrap;margin-bottom:-15px}.atk-comment>.atk-main>.atk-footer .atk-actions>span{color:var(--at-color-meta);font-size:13px;line-height:15px;display:inline-flex;cursor:pointer;-webkit-user-select:none;-moz-user-select:none;user-select:none;margin-bottom:15px}.atk-comment>.atk-main>.atk-footer .atk-actions>span.atk-error,.atk-comment>.atk-main>.atk-footer .atk-actions>span.atk-error:hover{color:var(--at-color-red)}.atk-comment>.atk-main>.atk-footer .atk-actions>span:not(:last-child):not(.atk-hide){margin-right:16px}.atk-comment>.atk-main>.atk-footer .atk-actions>span:hover{color:var(--at-color-deep)}.atk-comment .atk-height-limit:after{position:absolute;z-index:1;display:block;overflow:hidden;width:100%;content:" ";bottom:0;height:80px;background:var(--at-color-gradient)}.atk-comment .atk-height-limit-btn{z-index:2;position:absolute;left:50%;bottom:10px;transform:translate(-50%);cursor:pointer;border:1px solid var(--at-color-border);border-radius:6px;background:var(--at-color-bg);padding:1px 20px;font-size:15px;color:var(--at-color-meta);-webkit-user-select:none;-moz-user-select:none;user-select:none}.atk-comment .atk-height-limit-btn:hover{background:var(--at-color-bg-grey)}.atk-comment .atk-height-limit .atk-height-limit .atk-height-limit-btn{display:none}.atk-comment .atk-height-limit-scroll{margin-top:10px;overflow-y:auto;background:linear-gradient(var(--at-color-bg) 1px,transparent 1px calc(100% - 1px)) center top,linear-gradient(transparent calc(100% - 1px),var(--at-color-bg) calc(100% - 1px) 1px) center bottom,linear-gradient(var(--at-color-border) 1px,transparent 1px calc(100% - 1px)) center top,linear-gradient(transparent calc(100% - 1px),var(--at-color-border) calc(100% - 1px) 1px) center bottom;background-repeat:no-repeat;background-color:transparent;background-size:100% 1px,100% 1px,100% 1px,100% 1px;background-attachment:local,local,scroll,scroll}.atk-comment-children>.atk-comment-wrap{margin-top:10px;border-left:1px dashed transparent;border-bottom-color:transparent}.atk-comment-children>.atk-comment-wrap:not(:last-child){margin-bottom:5px}.atk-comment-children>.atk-comment-wrap>.atk-comment{padding:4px 0}.atk-comment-children>.atk-comment-wrap>.atk-comment>.atk-avatar img{width:36px;height:36px}.atk-comment-children>.atk-comment-wrap>.atk-comment>.atk-main{margin-left:47px}.artalk>.atk-list{position:relative}.artalk>.atk-list>.atk-list-header{display:flex;flex-direction:row;padding:10px 17px}.artalk>.atk-list>.atk-list-header .atk-text{display:inline-block}.artalk>.atk-list>.atk-list-header .atk-dropdown-wrap{position:relative;cursor:pointer}.artalk>.atk-list>.atk-list-header .atk-dropdown-wrap .atk-arrow-down-icon{cursor:pointer;vertical-align:middle;border-top:5px solid var(--at-color-grey);border-left:3px solid transparent;border-right:3px solid transparent;margin-top:-1px;margin-left:.8rem;display:inline-block}.artalk>.atk-list>.atk-list-header .atk-dropdown-wrap:hover .atk-dropdown{display:block}.artalk>.atk-list>.atk-list-header .atk-dropdown-wrap .atk-dropdown{z-index:3;display:none;height:auto!important;max-height:calc(100vh - 2.7rem);overflow-y:auto;position:absolute;top:100%;right:0;width:100%;background-color:var(--at-color-bg);padding:.6rem 0;border:1px solid var(--at-color-border);text-align:center;border-radius:6px;white-space:nowrap;margin:0;list-style:none}.artalk>.atk-list>.atk-list-header .atk-dropdown-wrap .atk-dropdown-item span,.artalk>.atk-list>.atk-list-header .atk-dropdown-wrap .atk-dropdown-item a{display:block;line-height:2rem;position:relative;border-bottom:none;font-weight:400;padding:0 1.5rem}.artalk>.atk-list>.atk-list-header .atk-dropdown-wrap .atk-dropdown-item span:hover,.artalk>.atk-list>.atk-list-header .atk-dropdown-wrap .atk-dropdown-item a:hover{color:var(--at-color-main)}.artalk>.atk-list>.atk-list-header .atk-dropdown-wrap .atk-dropdown-item.active span,.artalk>.atk-list>.atk-list-header .atk-dropdown-wrap .atk-dropdown-item a{color:var(--at-color-main)}.artalk>.atk-list>.atk-list-header .atk-comment-count{font-size:15px}.artalk>.atk-list>.atk-list-header .atk-comment-count .atk-comment-count-num{font-size:22px;margin-right:4px}.artalk>.atk-list>.atk-list-header .atk-right-action{display:flex;flex:1;flex-direction:row;align-items:center;justify-content:flex-end}.artalk>.atk-list>.atk-list-header .atk-right-action>span{font-size:14px;color:var(--at-color-meta);cursor:pointer;-webkit-user-select:none;-moz-user-select:none;user-select:none;position:relative}.artalk>.atk-list>.atk-list-header .atk-right-action>span.atk-on,.artalk>.atk-list>.atk-list-header .atk-right-action>span.atk-on *{color:var(--at-color-main)}.artalk>.atk-list>.atk-list-header .atk-right-action>span:not(:last-child):not(.atk-hide){margin-right:10px;padding-right:10px}.artalk>.atk-list>.atk-list-header .atk-right-action>span .atk-unread-badge{position:absolute;top:-5px;left:-6px;color:#fff;background:var(--at-color-pink);text-align:center;min-width:16px;height:16px;padding:0 3px;border-radius:8px;line-height:16px;font-size:12px}.artalk>.atk-list>.atk-list-body{min-height:150px}.artalk>.atk-list>.atk-list-footer{float:right}@media only screen and (max-width: 768px){.artalk>.atk-list>.atk-list-footer{float:initial;text-align:center}}.artalk>.atk-list>.atk-list-footer .atk-copyright{display:block;font-size:12px;color:var(--at-color-meta);padding-right:15px}.artalk>.atk-list>.atk-list-footer .atk-copyright a{color:var(--at-color-main);text-decoration:none}.atk-list-no-comment{height:150px;display:flex;font-size:19px;justify-content:center;align-items:center;word-break:break-word;text-align:center}.atk-list-read-more{border-top:1px dashed var(--at-color-border);margin-top:28px;padding-bottom:25px}@media only screen and (max-width: 768px){.atk-list-read-more{padding-bottom:10px}}.atk-list-read-more.atk-err .atk-text{color:var(--at-color-red)!important}.atk-list-read-more .atk-list-read-more-inner{cursor:pointer;-webkit-user-select:none;-moz-user-select:none;user-select:none;padding:0 15px;font-size:14px;border-radius:6px;border:1px solid transparent;display:flex;height:30px;flex-direction:row;place-content:center;align-items:center;width:120px;margin:-15px auto 0;background:var(--at-color-bg);border-color:var(--at-color-border)}.atk-list-read-more .atk-list-read-more-inner>.atk-loading-icon{height:15px;width:15px}.atk-list-read-more .atk-list-read-more-inner>.atk-text{color:var(--at-color-meta)}.atk-list-read-more .atk-list-read-more-inner:hover{background:var(--at-color-bg-grey)}.atk-pagination{display:flex;flex-direction:row;justify-content:center;padding:10px 0;position:relative}.atk-pagination>.atk-btn,.atk-pagination>.atk-input{font-size:15px;height:30px;border:1px solid var(--at-color-border);border-radius:3px;padding:0 5px;text-align:center;background:var(--at-color-bg)}.atk-pagination>.atk-btn{-webkit-user-select:none;-moz-user-select:none;user-select:none;width:70px;cursor:pointer;display:flex;justify-content:center;align-items:center}.atk-pagination>.atk-btn:hover{background:var(--at-color-bg-grey)}.atk-pagination>.atk-btn.atk-disabled{color:var(--at-color-sub)}.atk-pagination>.atk-btn.atk-disabled:hover{cursor:default;background:initial}.atk-pagination>.atk-input{background:transparent;color:var(--at-color-font);font-size:18px;width:60px;outline:none}.atk-pagination>.atk-input:focus{border-color:var(--at-color-main)}.atk-pagination>*:not(:last-child){margin-right:10px}.atk-main-editor{position:relative;overflow:hidden;background:var(--at-color-bg);border:1px solid var(--at-color-border);border-radius:6px;margin-bottom:10px}@media only screen and (max-width: 768px){.atk-main-editor{margin-bottom:7px}}.atk-main-editor>.atk-header{display:flex;flex-direction:row;padding:10px 14px 0}.atk-main-editor>.atk-header input{flex:1;width:100%;font-size:14px;background:transparent;border:2px solid transparent;border-radius:3px;padding:6px 5px;resize:none;outline:none}.atk-main-editor>.atk-header input:not(:last-child){margin-right:2px}.atk-main-editor>.atk-textarea-wrap{position:relative}.atk-main-editor>.atk-textarea-wrap>.atk-textarea{display:block;overflow:hidden;color:var(--at-color-font);font-size:15px;background-color:var(--at-color-bg);border:2px solid transparent;border-radius:3px;width:100%;min-height:120px;margin-top:2px;padding:10px 20px;resize:none;word-wrap:break-word;outline:none}.atk-main-editor>.atk-textarea-wrap>.atk-comment-closed{pointer-events:none;color:var(--at-color-meta);font-size:12px;background-color:var(--at-color-bg);border-top:1px solid var(--at-color-border);padding:5px 15px;margin-top:10px}.atk-main-editor>.atk-textarea-wrap>.atk-send-reply{z-index:2;position:absolute;right:7px;bottom:2px;max-width:calc(100% - 20px);height:30px;line-height:30px;font-size:14px;background:var(--at-color-bg-grey-transl);padding:0 30px 0 10px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;cursor:pointer;border-radius:3px}.atk-main-editor>.atk-textarea-wrap>.atk-send-reply .atk-cancel{position:absolute;right:0;bottom:0;height:30px;text-align:center;width:30px;line-height:30px;font-weight:700}.atk-main-editor>.atk-textarea-wrap>.atk-send-reply .atk-cancel:hover{color:var(--at-color-deep)}.atk-main-editor>.atk-plug-panel-wrap{position:relative;height:180px;width:100%;overflow:hidden;border-top:1px solid var(--at-color-border);animation:.3s both atkFadeIn;transition:.2s height ease-in-out}.atk-main-editor>.atk-bottom{display:flex;flex-direction:row;justify-content:space-between;padding:5px 5px 5px 10px}.atk-main-editor>.atk-bottom>.atk-item{display:flex;flex-direction:row;align-items:center}.atk-main-editor>.atk-bottom .atk-plug-btn{padding:0 8px;line-height:24px;cursor:pointer;color:var(--at-color-grey);font-size:14px;-webkit-user-select:none;-moz-user-select:none;user-select:none;border-radius:3px}.atk-main-editor>.atk-bottom .atk-plug-btn:not(:last-child){margin-right:2px}.atk-main-editor>.atk-bottom .atk-plug-btn:hover{background:var(--at-color-bg-grey)}.atk-main-editor>.atk-bottom .atk-plug-btn.active{color:var(--at-color-main)}.atk-main-editor>.atk-bottom .atk-plug-btn.active svg.markdown path{fill:var(--at-color-main)}.atk-main-editor>.atk-bottom .atk-plug-btn i{color:var(--at-color-grey);display:inline-flex;vertical-align:sub;margin-left:4px}.atk-main-editor>.atk-bottom .atk-plug-btn i svg.markdown path{fill:var(--at-color-grey)}.atk-main-editor>.atk-bottom .atk-send-btn{background:var(--at-color-main);color:#fff;font-size:14px;border:none;margin:0;height:30px;width:8em;cursor:pointer;transition:opacity .3s ease-in-out;outline:none;border-radius:3px}.atk-main-editor>.atk-bottom .atk-send-btn:active{opacity:.9}.atk-main-editor>.atk-notify-wrap{z-index:3;position:absolute;right:-2px;bottom:40px;width:225px;opacity:.83}.atk-sidebar-layer{position:fixed;z-index:99999;top:0;right:0;width:430px;height:100%;background:var(--at-color-bg);transition:transform .45s cubic-bezier(.23,1,.32,1) 0ms;transform:translate(430px)}@media only screen and (max-width: 430px){.atk-sidebar-layer{width:100%}}.atk-sidebar-layer .atk-sidebar-inner{position:relative;height:100%}.atk-sidebar-layer .atk-sidebar-header{position:absolute;top:0;right:0;display:flex;flex-direction:row;align-items:center;z-index:99999}.atk-sidebar-layer .atk-sidebar-header .atk-sidebar-close{display:flex;flex-direction:column;width:60px;height:60px;align-items:center;place-content:center;cursor:pointer;-webkit-user-select:none;-moz-user-select:none;user-select:none;margin-left:10px}.atk-sidebar-layer .atk-sidebar-header .atk-sidebar-close:hover .atk-icon-close{background-color:#e81123e6}.atk-sidebar-layer .atk-sidebar-iframe-wrap{height:100%;position:relative}.atk-sidebar-layer .atk-sidebar-iframe-wrap iframe{border:0;width:100%;height:100%}.atk-sidebar-layer .atk-sidebar-iframe-wrap .atk-err-alert{z-index:9999;top:50%;left:50%;transform:translate(-50%,-50%);position:absolute;background:var(--at-color-bg);padding:40px 30px;width:80%;text-align:center;border-radius:4px}.atk-sidebar-layer .atk-sidebar-iframe-wrap .atk-err-alert .atk-title{font-size:1.4em;margin-bottom:20px;color:var(--at-color-font)}.atk-sidebar-layer .atk-sidebar-iframe-wrap .atk-err-alert .atk-text{color:var(--at-color-font)}.atk-sidebar-layer .atk-sidebar-iframe-wrap .atk-err-alert .atk-text span{cursor:pointer;color:var(--at-color-main)}.artalk{position:relative;width:100%;min-height:200px}.artalk,.atk-layer-wrap{color:var(--at-color-font);word-wrap:break-word;word-break:break-word}.artalk *,.atk-layer-wrap *{box-sizing:border-box}.artalk input,.artalk textarea,.artalk button,.artalk optgroup,.artalk select,.atk-layer-wrap input,.atk-layer-wrap textarea,.atk-layer-wrap button,.atk-layer-wrap optgroup,.atk-layer-wrap select{font-family:inherit;color:inherit;font-size:inherit}.artalk code,.atk-layer-wrap code{font-family:source code pro,Consolas,Monaco,Menlo,sans-serif;margin:0 .05em;padding:0 .4em;display:inline-block;vertical-align:middle;font-size:.9em;background-color:var(--at-color-bg-grey);color:var(--at-color-font);border-radius:2px}.artalk pre,.atk-layer-wrap pre{margin:10px 0 0;padding:0;line-height:0}.artalk pre code,.atk-layer-wrap pre code{line-height:1.6em;display:block;padding:10px 15px;white-space:pre-wrap!important;background-color:var(--at-color-bg-grey);color:var(--at-color-font);margin:0}.artalk pre code *,.atk-layer-wrap pre code *{font-family:source code pro,Consolas,Monaco,Menlo,sans-serif}.artalk a,.atk-layer-wrap a{color:var(--at-color-main);text-decoration:none}.artalk blockquote,.atk-layer-wrap blockquote{position:static;margin:10px 0;padding:10px 20px;background:var(--at-color-bg-grey);border-left:4px solid #687a86;color:var(--at-color-font)}.artalk p:first-child,.atk-layer-wrap p:first-child{margin-top:0}.artalk p:last-child,.atk-layer-wrap p:last-child{margin-bottom:0}.artalk img,.atk-layer-wrap img{max-width:100%}.artalk table,.atk-layer-wrap table{width:100%;border-collapse:collapse;border-spacing:0;margin-bottom:1.5em;font-size:.96em}.artalk td,.artalk th,.atk-layer-wrap td,.atk-layer-wrap th{text-align:left;padding:4px 8px 4px 10px;border:1px solid var(--at-color-border)}.artalk td,.atk-layer-wrap td{vertical-align:top}.artalk tr:nth-child(2n),.atk-layer-wrap tr:nth-child(2n){background-color:var(--at-color-bg-grey)}.artalk ul,.atk-layer-wrap ul{list-style:disc}.artalk ol,.atk-layer-wrap ol{list-style:decimal}.artalk li+li,.atk-layer-wrap li+li{margin-top:8px}.artalk li>ol,.artalk li>ul,.atk-layer-wrap li>ol,.atk-layer-wrap li>ul{margin:8px 0 0}.atk-hide{display:none!important}.atk-full-layer,.atk-layer-dialog-wrap,.atk-error-layer,.atk-loading{width:100%;height:100%;position:absolute;top:0;left:0;background:var(--at-color-bg);z-index:4;align-items:center;justify-content:center;flex-flow:column;display:flex}.atk-loading-spinner{position:relative;width:50px;height:50px}.atk-loading-spinner svg{animation:atkRotate 2s linear infinite;transform-origin:center center;width:100%;height:100%;position:absolute;top:0;left:0}.atk-loading-spinner svg circle{stroke-dasharray:1,200;stroke-dashoffset:0;animation:atkDash 1.5s ease-in-out infinite,atkColor 6s ease-in-out infinite;stroke-linecap:round}@keyframes atkRotate{to{transform:rotate(360deg)}}@keyframes atkDash{0%{stroke-dasharray:1,200;stroke-dashoffset:0}50%{stroke-dasharray:89,200;stroke-dashoffset:-35px}to{stroke-dasharray:89,200;stroke-dashoffset:-124px}}@keyframes atkColor{0%,to{stroke:#ff5652}40%{stroke:#2196f3}66%{stroke:#32c787}80%,90%{stroke:#ffc107}}@keyframes atkLoadingIconRotate{0%{transform:rotate(0)}to{transform:rotate(360deg)}}.atk-loading-icon{width:18px;height:18px;box-sizing:border-box;border:solid 1px transparent;border-top-color:#29d;border-left-color:#29d;border-radius:50%;animation:atkLoadingIconRotate .4s linear infinite}.atk-fade-in{animation:atkFadeIn both .3s}.atk-fade-out{animation:atkFadeOut both .2s}.atk-rotate{animation:atkRotate 2s linear infinite}@keyframes atkFadeIn{0%{opacity:0}to{opacity:1}}@keyframes atkFadeOut{to{opacity:0}}@keyframes atkRotate{0%{transform:rotate(0)}to{transform:rotate(360deg)}}i.atk-icon{width:20px;height:20px;background-color:var(--at-color-deep);background-size:contain;background-repeat:no-repeat;-webkit-mask-repeat:no-repeat;mask-repeat:no-repeat;-webkit-mask-position:center;mask-position:center;-webkit-mask-size:contain;mask-size:contain}.atk-icon-sync{-webkit-mask-image:url("data:image/svg+xml,%3Csvg width='20' height='20' viewBox='0 0 20 20' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M4.99133 4.87635C2.22512 7.64257 2.22512 12.1275 4.99133 14.8937C6.04677 15.9491 7.3524 16.6019 8.71732 16.8519' stroke='%234E5969' stroke-width='2'/%3E%3Cpath d='M14.4179 15.4815L15.0072 14.8922C17.7734 12.126 17.7734 7.64107 15.0072 4.87486C13.9518 3.81942 12.6461 3.16668 11.2812 2.91664' stroke='%234E5969' stroke-width='2'/%3E%3Cpath d='M6.17106 4.99252L5.58181 4.40327L4.99255 3.81401H6.17106V4.99252Z' fill='%23C4C4C4' stroke='%234E5969' stroke-width='2'/%3E%3Cpath d='M13.8299 15.0084L14.4192 15.5976L15.0084 16.1869H13.8299V15.0084Z' fill='%23C4C4C4' stroke='%234E5969' stroke-width='2'/%3E%3C/svg%3E");mask-image:url("data:image/svg+xml,%3Csvg width='20' height='20' viewBox='0 0 20 20' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M4.99133 4.87635C2.22512 7.64257 2.22512 12.1275 4.99133 14.8937C6.04677 15.9491 7.3524 16.6019 8.71732 16.8519' stroke='%234E5969' stroke-width='2'/%3E%3Cpath d='M14.4179 15.4815L15.0072 14.8922C17.7734 12.126 17.7734 7.64107 15.0072 4.87486C13.9518 3.81942 12.6461 3.16668 11.2812 2.91664' stroke='%234E5969' stroke-width='2'/%3E%3Cpath d='M6.17106 4.99252L5.58181 4.40327L4.99255 3.81401H6.17106V4.99252Z' fill='%23C4C4C4' stroke='%234E5969' stroke-width='2'/%3E%3Cpath d='M13.8299 15.0084L14.4192 15.5976L15.0084 16.1869H13.8299V15.0084Z' fill='%23C4C4C4' stroke='%234E5969' stroke-width='2'/%3E%3C/svg%3E")}.atk-icon-del{background-color:var(--at-color-red)!important;-webkit-mask-image:url("data:image/svg+xml,%3Csvg width='22' height='22' viewBox='0 0 22 22' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M2.29167 5.04166L4.81251 5.04166M4.81251 5.04166L4.81251 18.3333C4.81251 18.5865 5.01771 18.7917 5.27084 18.7917L16.7292 18.7917C16.9823 18.7917 17.1875 18.5865 17.1875 18.3333V5.04166M4.81251 5.04166L7.33334 5.04166M17.1875 5.04166L19.7083 5.04166M17.1875 5.04166L14.6667 5.04166M7.33334 5.04166V3.20833L14.6667 3.20833V5.04166M7.33334 5.04166L14.6667 5.04166' stroke='%23D06565' stroke-width='2'/%3E%3Cpath d='M9.16667 8.25V15.125M12.8333 8.25V15.125' stroke='%23D06565' stroke-width='2'/%3E%3C/svg%3E");mask-image:url("data:image/svg+xml,%3Csvg width='22' height='22' viewBox='0 0 22 22' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M2.29167 5.04166L4.81251 5.04166M4.81251 5.04166L4.81251 18.3333C4.81251 18.5865 5.01771 18.7917 5.27084 18.7917L16.7292 18.7917C16.9823 18.7917 17.1875 18.5865 17.1875 18.3333V5.04166M4.81251 5.04166L7.33334 5.04166M17.1875 5.04166L19.7083 5.04166M17.1875 5.04166L14.6667 5.04166M7.33334 5.04166V3.20833L14.6667 3.20833V5.04166M7.33334 5.04166L14.6667 5.04166' stroke='%23D06565' stroke-width='2'/%3E%3Cpath d='M9.16667 8.25V15.125M12.8333 8.25V15.125' stroke='%23D06565' stroke-width='2'/%3E%3C/svg%3E")}.atk-icon-edit{-webkit-mask-image:url("data:image/svg+xml,%3Csvg width='16' height='17' viewBox='0 0 16 17' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M9.70618 4.08515L12.6081 7.06376M1.00041 13.021L11.7376 2L14.6392 4.97861L3.90274 16H1L1.00041 13.021Z' stroke='%234E5969' stroke-width='1.5'/%3E%3C/svg%3E");mask-image:url("data:image/svg+xml,%3Csvg width='16' height='17' viewBox='0 0 16 17' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M9.70618 4.08515L12.6081 7.06376M1.00041 13.021L11.7376 2L14.6392 4.97861L3.90274 16H1L1.00041 13.021Z' stroke='%234E5969' stroke-width='1.5'/%3E%3C/svg%3E")}.atk-icon-no,.atk-icon-close{-webkit-mask-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='25' height='25' viewBox='0 0 25 25' fill='none'%3E%3Cpath d='M19.8657 5.13431L12.5 12.5L5.13431 19.8657' stroke='%234E5969'/%3E%3Cpath d='M5.13431 5.13432L12.5 12.5L19.8657 19.8657' stroke='%234E5969'/%3E%3C/svg%3E");mask-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='25' height='25' viewBox='0 0 25 25' fill='none'%3E%3Cpath d='M19.8657 5.13431L12.5 12.5L5.13431 19.8657' stroke='%234E5969'/%3E%3Cpath d='M5.13431 5.13432L12.5 12.5L19.8657 19.8657' stroke='%234E5969'/%3E%3C/svg%3E")}.atk-icon-yes{-webkit-mask-image:url("data:image/svg+xml,%3Csvg width='25' height='25' viewBox='0 0 25 25' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M21.7071 5.75533L9.92197 17.5404L3.29285 10.9113' stroke='%234E5969'/%3E%3C/svg%3E");mask-image:url("data:image/svg+xml,%3Csvg width='25' height='25' viewBox='0 0 25 25' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M21.7071 5.75533L9.92197 17.5404L3.29285 10.9113' stroke='%234E5969'/%3E%3C/svg%3E")}.atk-icon-plus{-webkit-mask-image:url("data:image/svg+xml,%3Csvg width='20' height='20' viewBox='0 0 20 20' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M2.08331 10H17.9166' stroke='%234E5969' stroke-width='2'/%3E%3Cpath d='M10 2.08334L10 17.9167' stroke='%234E5969' stroke-width='2'/%3E%3C/svg%3E");mask-image:url("data:image/svg+xml,%3Csvg width='20' height='20' viewBox='0 0 20 20' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M2.08331 10H17.9166' stroke='%234E5969' stroke-width='2'/%3E%3Cpath d='M10 2.08334L10 17.9167' stroke='%234E5969' stroke-width='2'/%3E%3C/svg%3E")}.atk-error-layer{background-color:var(--at-color-bg-transl)}.atk-error-layer .atk-error-title{color:var(--at-color-red)}.atk-error-layer .atk-warn-title{color:var(--at-color-yellow)}.atk-error-layer .atk-error-title,.atk-error-layer .atk-warn-title{display:inline-block;padding:0 15px;margin-bottom:20px;font-size:20px;letter-spacing:-.5px}.atk-error-layer .atk-error-text{text-align:center;padding:0 20px}.atk-error-layer .atk-error-text *{color:var(--at-color-deep)}.atk-error-layer .atk-error-text a{color:var(--at-color-meta)}.atk-layer-dialog-wrap{background-color:var(--at-color-bg-transl)}.atk-layer-dialog-wrap>.atk-layer-dialog{width:25%}.atk-layer-dialog-wrap>.atk-layer-dialog>.atk-layer-dialog-content .atk-captcha-img{cursor:pointer;width:170px;height:auto;margin-right:10px;padding-right:10px;border-right:1px solid var(--at-color-border);vertical-align:bottom}.atk-layer-dialog-wrap>.atk-layer-dialog>.atk-layer-dialog-content input{width:100%;line-height:34px;background-color:var(--at-color-bg);border:1px solid var(--at-color-border);border-radius:3px;outline:none;padding:0 6px;display:block;margin-top:10px;margin-bottom:5px;text-align:center}.atk-layer-dialog-wrap>.atk-layer-dialog>.atk-layer-dialog-actions{display:flex;flex-direction:row}.atk-layer-dialog-wrap>.atk-layer-dialog>.atk-layer-dialog-actions button{flex:1;display:block;cursor:pointer;border:1px solid var(--at-color-main);background:transparent;color:var(--at-color-main);border-radius:3px;padding:0 15px;line-height:30px;outline:none}.atk-layer-dialog-wrap>.atk-layer-dialog>.atk-layer-dialog-actions button:active{color:#fff;background:var(--at-color-main)}.atk-layer-dialog-wrap>.atk-layer-dialog>.atk-layer-dialog-actions button:not(:last-child){margin-right:5px}.atk-layer-dialog-wrap>.atk-layer-dialog>.atk-layer-dialog-actions button.error{color:#fff;background:#ff5652;border-color:#ff5652}.atk-layer-dialog-wrap>.atk-layer-dialog .atk-checker-iframe-wrap{position:fixed;z-index:999998;left:0;top:0;height:100vh;width:100vw}.atk-layer-dialog-wrap>.atk-layer-dialog .atk-checker-iframe-wrap>iframe{width:100%;height:100%;border:0}.atk-layer-dialog-wrap>.atk-layer-dialog .atk-checker-iframe-wrap .atk-close-btn{z-index:999999;position:fixed;top:20px;right:20px;display:flex;flex-direction:column;width:50px;height:50px;align-items:center;place-content:center;cursor:pointer;-webkit-user-select:none;-moz-user-select:none;user-select:none;margin-left:10px}.atk-layer-dialog-wrap>.atk-layer-dialog .atk-checker-iframe-wrap .atk-close-btn:hover .atk-icon-close{background-color:#e81123e6}@media only screen and (max-width: 768px){.atk-layer-dialog-wrap>.atk-layer-dialog{width:90%!important}}.atk-notify{display:block;overflow:hidden;background-color:#2c2c2c;color:#fff;border-radius:3px;cursor:pointer;font-size:14px;padding:5px 15px}.atk-notify:not(:last-child){margin-bottom:3px}.atk-notify .atk-notify-content{color:#fff}.atk-layer-wrap .atk-layer-mask{position:fixed;top:0;left:0;width:100%;height:100%;z-index:99998;background:rgba(0,0,0,.3)}.atk-layer-wrap .atk-layer-item{position:fixed;z-index:99999;top:0;right:0;width:100%;height:100%}.atk-common-action-btn.atk-btn-confirm,.atk-common-action-btn.atk-btn-warn{color:var(--at-color-yellow)!important}.atk-common-action-btn.atk-btn-error{color:var(--at-color-red)!important}.atk-common-action-btn.atk-btn-success{color:var(--at-color-green)!important}img[atk-emoticon]{max-height:60px;display:initial}.atk-slim-scrollbar::-webkit-scrollbar,.atk-editor-plug-emoticons>.atk-grp-wrap::-webkit-scrollbar{width:4px;height:4px;background:transparent}.atk-slim-scrollbar::-webkit-scrollbar-thumb,.atk-editor-plug-emoticons>.atk-grp-wrap::-webkit-scrollbar-thumb,.atk-slim-scrollbar::-webkit-scrollbar-thumb:window-inactive{background:rgba(86,86,86,.3)}.atk-slim-scrollbar::-webkit-scrollbar-thumb:vertical:hover,.atk-editor-plug-emoticons>.atk-grp-wrap::-webkit-scrollbar-thumb:vertical:hover{background:rgba(65,74,82,.77)}.atk-slim-scrollbar::-webkit-scrollbar-thumb:vertical:active,.atk-editor-plug-emoticons>.atk-grp-wrap::-webkit-scrollbar-thumb:vertical:active{background:rgba(41,47,53,.77)}.atk-editor-plug-emoticons{height:100%;width:100%}.atk-editor-plug-emoticons>.atk-grp-wrap{overflow-y:scroll;overflow-x:hidden;height:100%;width:100%}.atk-editor-plug-emoticons>.atk-grp-wrap>.atk-grp{display:flex;flex-wrap:wrap;flex-direction:row;padding:5px 10px 35px}.atk-editor-plug-emoticons>.atk-grp-wrap>.atk-grp[data-type=image]>.atk-item{height:63px;width:63px}.atk-editor-plug-emoticons>.atk-grp-wrap>.atk-grp>.atk-item{display:flex;align-items:center;justify-content:center;padding:5px;cursor:pointer;-webkit-user-select:none;-moz-user-select:none;user-select:none;border-radius:3px;font-size:15px;min-width:35px;margin:2px}.atk-editor-plug-emoticons>.atk-grp-wrap>.atk-grp>.atk-item>img{max-height:100%;width:auto}.atk-editor-plug-emoticons>.atk-grp-wrap>.atk-grp>.atk-item:hover{background:var(--at-color-bg-grey)}.atk-editor-plug-emoticons>.atk-grp-switcher{position:absolute;bottom:0;left:0;width:100%;background:var(--at-color-bg-transl);height:30px;border-top:1px solid var(--at-color-border);border-bottom:1px solid var(--at-color-border)}.atk-editor-plug-emoticons>.atk-grp-switcher>span{-webkit-user-select:none;-moz-user-select:none;user-select:none;padding:0 10px;line-height:30px;float:left;display:block;cursor:pointer;font-size:14px}.atk-editor-plug-emoticons>.atk-grp-switcher>span:hover,.atk-editor-plug-emoticons>.atk-grp-switcher>span.active{background:var(--at-color-bg-grey)}.atk-slim-scrollbar::-webkit-scrollbar{width:4px;height:4px;background:transparent}.atk-slim-scrollbar::-webkit-scrollbar-thumb,.atk-slim-scrollbar::-webkit-scrollbar-thumb:window-inactive{background:rgba(86,86,86,.3)}.atk-slim-scrollbar::-webkit-scrollbar-thumb:vertical:hover{background:rgba(65,74,82,.77)}.atk-slim-scrollbar::-webkit-scrollbar-thumb:vertical:active{background:rgba(41,47,53,.77)}.atk-editor-plug-preview{overflow-y:scroll;overflow-x:hidden;height:100%;width:100%;padding:10px 15px} diff --git a/assets/lib/artalk/ArtalkLite.js b/assets/lib/artalk/ArtalkLite.js index 0896fdcc2..612c6badc 100644 --- a/assets/lib/artalk/ArtalkLite.js +++ b/assets/lib/artalk/ArtalkLite.js @@ -1 +1 @@ -!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e(require("marked")):"function"==typeof define&&define.amd?define(["marked"],e):(t="undefined"!=typeof globalThis?globalThis:t||self).Artalk=e(t.marked)}(this,(function(t){"use strict";var e=Object.defineProperty,n=Object.defineProperties,i=Object.getOwnPropertyDescriptors,s=Object.getOwnPropertySymbols,a=Object.prototype.hasOwnProperty,r=Object.prototype.propertyIsEnumerable,o=(t,n,i)=>n in t?e(t,n,{enumerable:!0,configurable:!0,writable:!0,value:i}):t[n]=i,l=(t,e)=>{for(var n in e||(e={}))a.call(e,n)&&o(t,n,e[n]);if(s)for(var n of s(e))r.call(e,n)&&o(t,n,e[n]);return t},c=(t,e)=>n(t,i(e)),d=(t,e,n)=>(o(t,"symbol"!=typeof e?e+"":e,n),n),h=(t,e,n)=>new Promise(((i,s)=>{var a=t=>{try{o(n.next(t))}catch(e){s(e)}},r=t=>{try{o(n.throw(t))}catch(e){s(e)}},o=t=>t.done?i(t.value):Promise.resolve(t.value).then(a,r);o((n=n.apply(t,e)).next())}));function u(t=""){const e=document.createElement("div");return e.innerHTML=t.trim(),e.firstElementChild||e}function p(t){return parseFloat(getComputedStyle(t,null).height.replace("px",""))}function m(t){const e=RegExp(`[?&]${t}=([^&]*)`).exec(window.location.search);return e&&decodeURIComponent(e[1].replace(/\+/g," "))}function g(t){const e=t.getBoundingClientRect();return{top:e.top+window.scrollY,left:e.left+window.scrollX}}function f(t,e){let n=t.toString();for(;n.length=13?t.replace(/Windows NT 10.0/,"Windows NT 11.0"):"macOS"===e.platform&&i>=11?t.replace(/(Mac OS X \d+_\d+_\d+|Mac OS X)/,`Mac OS X ${n.platformVersion.replace(/\./g,"_")}`):t}))}function v(t){let e;try{e=new URL(t)}catch(n){return!1}return"http:"===e.protocol||"https:"===e.protocol}function k(t,e){return function(t,e){return`${t.replace(/\/$/,"")}/${e.replace(/^\//,"")}`}(t.conf.server,e)}function b(t,e){const n=t=>t&&"object"==typeof t;return n(t)&&n(e)?(Object.keys(e).forEach((i=>{const s=t[i],a=e[i];Array.isArray(s)&&Array.isArray(a)?t[i]=s.concat(a):n(s)&&n(a)?t[i]=b(l({},s),a):t[i]=a})),t):e}class w{constructor(t){d(this,"$el"),d(this,"ctx"),d(this,"conf"),this.ctx=t,this.conf=t.conf}$t(t,e={}){return this.ctx.$t(t,e)}}function x(t,e){let n=t.querySelector(":scope > .atk-loading");n||(n=u(''),(null==e?void 0:e.transparentBg)&&(n.style.background="transparent"),t.appendChild(n)),n.style.display="";const i=n.querySelector(".atk-loading-spinner");i&&(i.style.display="none",window.setTimeout((()=>{i.style.display=""}),500))}function C(t){const e=t.querySelector(":scope > .atk-loading");e&&(e.style.display="none")}function S(t,e=!0){const n=g(t).top+p(t)/2-document.documentElement.clientHeight/2;e?window.scroll({top:n>0?n:0,left:0}):window.scroll(0,n>0?n:0)}function E(t,e,n){const i=u(`
        `);i.querySelector(".atk-notify-content").innerHTML=function(t){const e=document.createElement("div");return e.innerText=t,e.innerHTML}(e).replace("\n","
        "),t.appendChild(i);const s=()=>{i.classList.add("atk-fade-out"),setTimeout((()=>{i.remove()}),200)};let a;a=window.setTimeout((()=>{s()}),3e3),i.addEventListener("click",(()=>{s(),window.clearTimeout(a)}))}function T(t,e){!function(t,e,n="in"){t.classList.add(`atk-fade-${n}`);const i=()=>{t.classList.remove(`atk-fade-${n}`),t.removeEventListener("animationend",i),e&&e()};t.addEventListener("animationend",i)}(t,e,"in")}function L(t,e,n='Artalk Error'){let i=t.querySelector(".atk-error-layer");if(null===e)return void(null!==i&&i.remove());i||(i=u(`
        ${n}
        `),t.appendChild(i));const s=i.querySelector(".atk-error-text");s.innerHTML="",null!==e&&(e instanceof HTMLElement?s.appendChild(e):s.innerText=e)}const A=class t extends w{constructor(t,e,n){super(t),d(this,"name"),d(this,"$wrap"),d(this,"$mask"),d(this,"maskClickHideEnable",!0),d(this,"afterHide"),this.name=e;const{$wrap:i,$mask:s}=O();this.$wrap=i,this.$mask=s,this.$el=this.$wrap.querySelector(`[data-layer-name="${e}"].atk-layer-item`),null===this.$el&&(n?this.$el=n:(this.$el=u(),this.$el.classList.add("atk-layer-item"))),this.$el.setAttribute("data-layer-name",e),this.$el.style.display="none",this.$wrap.append(this.$el)}getName(){return this.name}getWrapEl(){return this.$wrap}getEl(){return this.$el}show(){this.fireAllActionTimer(),this.$wrap.style.display="block",this.$mask.style.display="block",this.$mask.classList.add("atk-fade-in"),this.$el.style.display="",this.$mask.onclick=()=>{this.maskClickHideEnable&&this.hide()},this.pageBodyScrollBarHide()}hide(){this.afterHide&&this.afterHide(),this.$wrap.classList.add("atk-fade-out"),this.$el.style.display="none",this.pageBodyScrollBarShow(),this.newActionTimer((()=>{this.$wrap.style.display="none",this.checkCleanLayer()}),450),this.newActionTimer((()=>{this.$wrap.style.display="none",this.$wrap.classList.remove("atk-fade-out")}),200)}setMaskClickHide(t){this.maskClickHideEnable=t}pageBodyScrollBarHide(){document.body.style.overflow="hidden";const t=parseInt(window.getComputedStyle(document.body,null).getPropertyValue("padding-right"),10);document.body.style.paddingRight=`${function(){const t=document.createElement("p");t.style.width="100%",t.style.height="200px";const e=document.createElement("div");e.style.position="absolute",e.style.top="0px",e.style.left="0px",e.style.visibility="hidden",e.style.width="200px",e.style.height="150px",e.style.overflow="hidden",e.appendChild(t),document.body.appendChild(e);const n=t.offsetWidth;e.style.overflow="scroll";let i=t.offsetWidth;return n===i&&(i=e.clientWidth),document.body.removeChild(e),n-i}()+t||0}px`}pageBodyScrollBarShow(){document.body.style.overflow=t.BodyOrgOverflow,document.body.style.paddingRight=t.BodyOrgPaddingRight}newActionTimer(e,n){const i=()=>{e(),t.actionTimers=t.actionTimers.filter((t=>t.act!==i))},s=window.setTimeout((()=>i()),n);t.actionTimers.push({act:i,tid:s})}fireAllActionTimer(){t.actionTimers.forEach((t=>{clearTimeout(t.tid),t.act()}))}disposeNow(){this.$el.remove(),this.pageBodyScrollBarShow(),this.checkCleanLayer()}dispose(){this.hide(),this.$el.remove(),this.checkCleanLayer()}checkCleanLayer(){0===this.getWrapEl().querySelectorAll(".atk-layer-item").length&&(this.$wrap.style.display="none")}};d(A,"BodyOrgOverflow"),d(A,"BodyOrgPaddingRight"),d(A,"actionTimers",[]);let M=A;function O(){let t=document.querySelector(".atk-layer-wrap");t||(t=u(''),document.body.appendChild(t));const e=t.querySelector(".atk-layer-mask");return{$wrap:t,$mask:e}}const _=window.matchMedia("(prefers-color-scheme: dark)");let B;function P(t){R(t,t.conf.darkMode,!1)}function R(t,e,n=!0){const i=e=>{!function(t,e){e?t.$root.classList.add(I):t.$root.classList.remove(I);const{$wrap:n}=O();n&&(e?n.classList.add(I):n.classList.remove(I))}(t,e),n&&function(t,e){t.conf.darkMode=e}(t,e)};"auto"===e?(B||(B=t=>i(t.matches),_.addEventListener("change",B)),i(_.matches)):(B&&_.removeEventListener("change",B),i(e))}const I="atk-dark-mode";var U="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function D(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var q={"&":"&","<":"<",">":">",'"':""","'":"'"},W={"&":"&","<":"<",">":">",""":'"',"'":"'"},F=/(&|<|>|"|')/g,H=/[&<>"']/g;function N(t){return q[t]}function j(t){return W[t]}function z(t){return null==t?"":String(t).replace(H,N)}function V(t){return null==t?"":String(t).replace(F,j)}z.options=V.options={};var Q={encode:z,escape:z,decode:V,unescape:V,version:"1.0.0-browser"};var G=function t(e){for(var n,i,s=Array.prototype.slice.call(arguments,1);s.length;)for(i in n=s.shift())n.hasOwnProperty(i)&&("[object Object]"===Object.prototype.toString.call(e[i])?e[i]=t(e[i],n[i]):e[i]=n[i]);return e},K=function(t){return"string"==typeof t?t.toLowerCase():t};function Y(t,e){return t[e]=!0,t}var X=function(t){return t.reduce(Y,{})},J={uris:X(["background","base","cite","href","longdesc","src","usemap"])},Z={voids:X(["area","br","col","hr","img","wbr","input","base","basefont","link","meta"])},tt=Q,et=K,nt=Z,it=/^<\s*([\w:-]+)((?:\s+[\w:-]+(?:\s*=\s*(?:(?:"[^"]*")|(?:'[^']*')|[^>\s]+))?)*)\s*(\/?)\s*>/,st=/^<\s*\/\s*([\w:-]+)[^>]*>/,at=/([\w:-]+)(?:\s*=\s*(?:(?:"((?:[^"])*)")|(?:'((?:[^'])*)')|([^>\s]+)))?/g,rt=/^=0&&(e.comment&&e.comment(t.substring(4,i)),t=t.substring(i+3),n=!1):ot.test(t)?r(st,l):rt.test(t)&&r(it,o);var i;!function(){if(!n)return;var i,s=t.indexOf("<");s>=0?(i=t.substring(0,s),t=t.substring(s)):(i=t,t="");e.chars&&e.chars(i)}()}();var i=t===s;s=t,i&&(t="")}function r(e,i){var s=t.match(e);s&&(t=t.substring(s[0].length),s[0].replace(e,i),n=!1)}function o(t,n,s,a){var r={},o=et(n),l=nt.voids[o]||!!a;s.replace(at,(function(t,e,n,i,s){r[e]=void 0===n&&void 0===i&&void 0===s?void 0:tt.decode(n||i||s||"")})),l||i.push(o),e.start&&e.start(o,r,l)}function l(t,n){var s,a=0,r=et(n);if(r)for(a=i.length-1;a>=0&&i[a]!==r;a--);if(a>=0){for(s=i.length-1;s>=a;s--)e.end&&e.end(i[s]);i.length=a}}l()},mt=function(t,e){var n,i=e||{};return o(),{start:function(t,e,r){var o=ct(t);if(n.ignoring)return void a(o);if(-1===(i.allowedTags||[]).indexOf(o))return void a(o);if(i.filter&&!i.filter({tag:o,attrs:e}))return void a(o);s("<"),s(o),Object.keys(e).forEach((function(t){var n=e[t],a=(i.allowedClasses||{})[o]||[],r=(i.allowedAttributes||{})[o]||[],l=ct(t);("class"===l&&-1===r.indexOf(l)?(n=n.split(" ").filter((function(t){return a&&-1!==a.indexOf(t)})).join(" ").trim()).length:-1!==r.indexOf(l)&&(!0!==dt.uris[l]||function(t){var e=t[0];if("#"===e||"/"===e)return!0;var n=t.indexOf(":");if(-1===n)return!0;var s=t.indexOf("?");if(-1!==s&&n>s)return!0;var a=t.indexOf("#");return-1!==a&&n>a||i.allowedSchemes.some(r);function r(e){return 0===t.indexOf(e+":")}}(n)))&&(s(" "),s(t),"string"==typeof n&&(s('="'),s(lt.encode(n)),s('"')))})),s(r?"/>":">")},end:function(t){var e=ct(t);-1!==(i.allowedTags||[]).indexOf(e)&&!1===n.ignoring?(s("")):r(e)},chars:function(t){!1===n.ignoring&&s(i.transformText?i.transformText(t):t)}};function s(e){t.push(e)}function a(t){ht.voids[t]||(!1===n.ignoring?n={ignoring:t,depth:1}:n.ignoring===t&&n.depth++)}function r(t){n.ignoring===t&&--n.depth<=0&&o()}function o(){n={ignoring:!1,depth:0}}},gt={allowedAttributes:{a:["href","name","target","title","aria-label"],iframe:["allowfullscreen","frameborder","src"],img:["src","alt","title","aria-label"]},allowedClasses:{},allowedSchemes:["http","https","mailto"],allowedTags:["a","abbr","article","b","blockquote","br","caption","code","del","details","div","em","h1","h2","h3","h4","h5","h6","hr","i","img","ins","kbd","li","main","mark","ol","p","pre","section","span","strike","strong","sub","summary","sup","table","tbody","td","th","thead","tr","u","ul"],filter:null};function ft(t,e,n){var i=[],s=!0===n?e:ut({},gt,e),a=mt(i,s);return pt(t,a),i.join("")}ft.defaults=gt;const yt=D(ft);var $t={exports:{}};$t.exports=function(){function t(t,e){return t(e={exports:{}},e.exports),e.exports}var e=t((function(t){var e=t.exports=function(){return new RegExp("(?:"+e.line().source+")|(?:"+e.block().source+")","gm")};e.line=function(){return/(?:^|\s)\/\/(.+?)$/gm},e.block=function(){return/\/\*([\S\s]*?)\*\//gm}})),n=["23AC69","91C132","F19726","E8552D","1AAB8E","E1147F","2980C1","1BA1E6","9FA0A0","F19726","E30B20","E30B20","A3338B"];function i(t){return''+t+""}return function(t,s){void 0===s&&(s={});var a=s.colors;void 0===a&&(a=n);var r=0,o={},l=new RegExp("("+/[\u4E00-\u9FFF\u3400-\u4dbf\uf900-\ufaff\u3040-\u309f\uac00-\ud7af\u0400-\u04FF]+|\w+/.source+"|"+/'+e+"
        ";return r=++r%a.length,l}))}}();const vt=D($t.exports);let kt;function bt(){return kt}function wt(t,e){var n;let i=null==(n=bt())?void 0:n.parse(e);i||(i=e.replace(/```\s*([^]+?.*?[^]+?[^]+?)```/g,((t,e)=>`
        ${vt(e)}
        `)).replace(/!\[(.*?)\]\((.*?)\)/g,((t,e,n)=>`${e}`)).replace(/\[(.*?)\]\((.*?)\)/g,((t,e,n)=>`
        ${e}`)).replace(/\n/g,"
        "));let s=yt(i,{allowedClasses:{},allowedSchemes:["http","https","mailto","data"],allowedTags:["a","abbr","article","b","blockquote","br","caption","code","del","details","div","em","h1","h2","h3","h4","h5","h6","hr","i","img","ins","kbd","li","main","mark","ol","p","pre","section","span","strike","strong","sub","summary","sup","table","tbody","td","th","thead","tr","u","ul"],allowedAttributes:{"*":["title","accesskey"],a:["href","name","target","aria-label","rel"],img:["src","alt","title","atk-emoticon","aria-label"],code:["class"],span:["class","style"]},filter:t=>([["code",/^hljs\W+language-(.*)$/],["span",/^(hljs-.*)$/]].forEach((([e,n])=>{t.tag===e&&t.attrs.class&&!n.test(t.attrs.class)&&delete t.attrs.class})),"span"===t.tag&&t.attrs.style&&!/^color:(\W+)?#[0-9a-f]{3,6};?$/i.test(t.attrs.style)&&delete t.attrs.style,!0)});return t.markedReplacers.forEach((t=>{"function"==typeof t&&(s=t(s))})),s}const xt={placeholder:"Leave a comment",noComment:"No Comment",send:"Send",save:"Save",nick:"Nickname",email:"Email",link:"Website",emoticon:"Emoji",preview:"Preview",image:"Image",uploadFail:"Upload Failed",commentFail:"Failed to comment",restoredMsg:"Content has been restored",onlyAdminCanReply:"Only admin can reply",uploadLoginMsg:"Please fill in your name and email to upload",counter:"{count} Comments",sortLatest:"Latest",sortOldest:"Oldest",sortBest:"Best",sortAuthor:"Author",openComment:"Open Comment",closeComment:"Close Comment",listLoadFailMsg:"Failed to load comments",listRetry:"Click to retry",loadMore:"Load More",admin:"Admin",reply:"Reply",voteUp:"Up",voteDown:"Down",voteFail:"Vote Failed",readMore:"Read More",actionConfirm:"Confirm",collapse:"Collapse",collapsed:"Collapsed",collapsedMsg:"This comment has been collapsed",expand:"Expand",approved:"Approved",pending:"Pending",pendingMsg:"Pending, visible only to commenter.",edit:"Edit",editCancel:"Cancel Edit",delete:"Delete",deleteConfirm:"Confirm",pin:"Pin",unpin:"Unpin",seconds:"seconds ago",minutes:"minutes ago",hours:"hours ago",days:"days ago",now:"just now",adminCheck:"Enter admin password:",captchaCheck:"Enter the CAPTCHA to continue:",confirm:"Confirm",cancel:"Cancel",msgCenter:"Messages",ctrlCenter:"Admin",frontend:"Frontend",backend:"Backend",loading:"Loading",loadFail:"Load Failed",editing:"Editing",editFail:"Edit Failed",deleting:"Deleting",deleteFail:"Delete Failed",reqGot:"Request got",reqAborted:"Request timed out or terminated unexpectedly"},Ct="ArtalkI18n",St={en:xt,"en-US":xt,"zh-CN":{placeholder:"键入内容...",noComment:"「此时无声胜有声」",send:"发送评论",save:"保存评论",nick:"昵称",email:"邮箱",link:"网址",emoticon:"表情",preview:"预览",image:"图片",uploadFail:"上传失败",commentFail:"评论失败",restoredMsg:"内容已自动恢复",onlyAdminCanReply:"仅管理员可评论",uploadLoginMsg:"填入你的名字邮箱才能上传哦",counter:"{count} 条评论",sortLatest:"最新",sortOldest:"最早",sortBest:"最热",sortAuthor:"作者",openComment:"打开评论",closeComment:"关闭评论",listLoadFailMsg:"无法获取评论列表数据",listRetry:"点击重新获取",loadMore:"加载更多",admin:"管理员",reply:"回复",voteUp:"赞同",voteDown:"反对",voteFail:"投票失败",readMore:"阅读更多",actionConfirm:"确认操作",collapse:"折叠",collapsed:"已折叠",collapsedMsg:"该评论已被系统或管理员折叠",expand:"展开",approved:"已审",pending:"待审",pendingMsg:"审核中,仅本人可见。",edit:"编辑",editCancel:"取消编辑",delete:"删除",deleteConfirm:"确认删除",pin:"置顶",unpin:"取消置顶",seconds:"秒前",minutes:"分钟前",hours:"小时前",days:"天前",now:"刚刚",adminCheck:"键入密码来验证管理员身份:",captchaCheck:"键入验证码继续:",confirm:"确认",cancel:"取消",msgCenter:"通知中心",ctrlCenter:"控制中心",frontend:"前端",backend:"后端",loading:"加载中",loadFail:"加载失败",editing:"修改中",editFail:"修改失败",deleting:"删除中",deleteFail:"删除失败",reqGot:"请求响应",reqAborted:"请求超时或意外终止"}};function Et(t){return t=t.replace(/^([a-zA-Z]+)(-[a-zA-Z]+)?$/,((t,e,n)=>e.toLowerCase()+(n||"").toUpperCase())),St[t]?St[t]:window[Ct]&&window[Ct][t]?window[Ct][t]:St.en}let Tt="en",Lt=Et(Tt);function At(t){t!==Tt&&(Tt=t,Lt="string"==typeof t?Et(t):t)}function Mt(t,e={}){let n=(null==Lt?void 0:Lt[t])||t;return n=n.replace(/\{\s*(\w+?)\s*\}/g,((t,n)=>e[n]||"")),n}const Ot="2.6.3";const _t=new class{constructor(){d(this,"ctx"),d(this,"data");const t=JSON.parse(window.localStorage.getItem("ArtalkUser")||"{}");this.data={nick:t.nick||"",email:t.email||"",link:t.link||"",token:t.token||"",isAdmin:t.isAdmin||!1}}setContext(t){this.ctx=t}update(t={}){var e;Object.entries(t).forEach((([t,e])=>{this.data[t]=e})),window.localStorage.setItem("ArtalkUser",JSON.stringify(this.data)),null==(e=this.ctx)||e.trigger("user-changed",this.data)}logout(){this.update({token:"",isAdmin:!1})}checkHasBasicUserInfo(){return!!this.data.nick&&!!this.data.email}},Bt=window||{},Pt=navigator||{};class Rt{constructor(t){d(this,"comment"),d(this,"$el"),d(this,"$main"),d(this,"$header"),d(this,"$headerNick"),d(this,"$headerBadgeWrap"),d(this,"$body"),d(this,"$content"),d(this,"$childrenWrap"),d(this,"$actions"),d(this,"voteBtnUp"),d(this,"voteBtnDown"),d(this,"$replyTo"),d(this,"$replyAt"),this.comment=t}get ctx(){return this.comment.ctx}get data(){return this.comment.getData()}get conf(){return this.comment.conf}get cConf(){return this.comment.getConf()}}function It(t){if(t.$headerNick=t.$el.querySelector(".atk-nick"),t.data.link){const e=u('');e.innerText=t.data.nick,e.href=v(t.data.link)?t.data.link:`https://${t.data.link}`,t.$headerNick.append(e)}else t.$headerNick.innerText=t.data.nick}function Ut(t){t.$headerBadgeWrap=t.$el.querySelector(".atk-badge-wrap"),t.$headerBadgeWrap.innerHTML="";const e=t.data.badge_name,n=t.data.badge_color;if(e){const i=u('');i.innerText=e.replace("管理员",t.ctx.$t("admin")),i.style.backgroundColor=n||"",t.$headerBadgeWrap.append(i)}if(t.data.is_pinned){const e=u(`${t.ctx.$t("pin")}`);t.$headerBadgeWrap.append(e)}}function Dt(t){const e=t.$el.querySelector(".atk-date");e.innerText=t.comment.getDateFormatted(),e.setAttribute("data-atk-comment-date",String(+new Date(t.data.date)))}function qt(t){if(!t.ctx.conf.uaBadge&&!t.data.ip_region)return;let e=t.$header.querySelector("atk-ua-wrap");if(e||(e=u(''),t.$header.append(e)),e.innerHTML="",t.data.ip_region){const n=u('');n.innerText=t.data.ip_region,e.append(n)}if(t.ctx.conf.uaBadge){const{browser:n,os:i}=t.comment.getUserUA();if(String(n).trim()){const t=u('');t.innerText=n,e.append(t)}if(String(i).trim()){const t=u('');t.innerText=i,e.append(t)}}}class Wt{constructor(t,e){d(this,"ctx"),d(this,"conf"),d(this,"$el"),d(this,"isLoading",!1),d(this,"msgRecTimer"),d(this,"msgRecTimerFunc"),d(this,"isConfirming",!1),d(this,"confirmRecTimer"),this.ctx=t,this.$el=u(''),this.conf="object"!=typeof e?{text:e}:e,this.$el.innerText=this.getText(),this.conf.adminOnly&&this.$el.setAttribute("atk-only-admin-show","")}get isMessaging(){return!!this.msgRecTimer}appendTo(t){return t.append(this.$el),this}getText(){return"string"==typeof this.conf.text?this.conf.text:this.conf.text()}setClick(t){this.$el.onclick=e=>{if(e.stopPropagation(),!this.isLoading){if(this.conf.confirm&&!this.isMessaging){const t=()=>{this.isConfirming=!1,this.$el.classList.remove("atk-btn-confirm"),this.$el.innerText=this.getText()};if(!this.isConfirming)return this.isConfirming=!0,this.$el.classList.add("atk-btn-confirm"),this.$el.innerText=this.conf.confirmText||this.ctx.$t("actionConfirm"),void(this.confirmRecTimer=window.setTimeout((()=>t()),5e3));this.confirmRecTimer&&window.clearTimeout(this.confirmRecTimer),t()}if(this.msgRecTimer)return this.fireMsgRecTimer(),void this.clearMsgRecTimer();t()}}}updateText(t){t&&(this.conf.text=t),this.setLoading(!1),this.$el.innerText=this.getText()}setLoading(t,e){this.isLoading!==t&&(this.isLoading=t,t?(this.$el.classList.add("atk-btn-loading"),this.$el.innerText=e||`${this.ctx.$t("loading")}...`):(this.$el.classList.remove("atk-btn-loading"),this.$el.innerText=this.getText()))}setError(t){this.setMsg(t,"atk-btn-error")}setWarn(t){this.setMsg(t,"atk-btn-warn")}setSuccess(t){this.setMsg(t,"atk-btn-success")}setMsg(t,e,n,i){this.setLoading(!1),e&&this.$el.classList.add(e),this.$el.innerText=t,this.setMsgRecTimer((()=>{this.$el.innerText=this.getText(),e&&this.$el.classList.remove(e),i&&i()}),n||2500)}setMsgRecTimer(t,e){this.fireMsgRecTimer(),this.clearMsgRecTimer(),this.msgRecTimerFunc=t,this.msgRecTimer=window.setTimeout((()=>{t(),this.clearMsgRecTimer()}),e)}fireMsgRecTimer(){this.msgRecTimerFunc&&this.msgRecTimerFunc()}clearMsgRecTimer(){this.msgRecTimer&&window.clearTimeout(this.msgRecTimer),this.msgRecTimer=void 0,this.msgRecTimerFunc=void 0}}function Ft(t){t.ctx.conf.vote&&(t.voteBtnUp=new Wt(t.ctx,(()=>`${t.ctx.$t("voteUp")} (${t.data.vote_up||0})`)).appendTo(t.$actions),t.voteBtnUp.setClick((()=>{t.comment.getActions().vote("up")})),t.ctx.conf.voteDown&&(t.voteBtnDown=new Wt(t.ctx,(()=>`${t.ctx.$t("voteDown")} (${t.data.vote_down||0})`)).appendTo(t.$actions),t.voteBtnDown.setClick((()=>{t.comment.getActions().vote("down")}))))}function Ht(t){if(!t.data.is_allow_reply)return;const e=u(`${t.ctx.$t("reply")}`);t.$actions.append(e),e.addEventListener("click",(e=>{e.stopPropagation(),t.cConf.onReplyBtnClick?t.cConf.onReplyBtnClick():t.ctx.replyComment(t.data,t.$el)}))}function Nt(t){const e=new Wt(t.ctx,{text:()=>t.data.is_collapsed?t.ctx.$t("expand"):t.ctx.$t("collapse"),adminOnly:!0});e.appendTo(t.$actions),e.setClick((()=>{t.comment.getActions().adminEdit("collapsed",e)}))}function jt(t){const e=new Wt(t.ctx,{text:()=>t.data.is_pending?t.ctx.$t("pending"):t.ctx.$t("approved"),adminOnly:!0});e.appendTo(t.$actions),e.setClick((()=>{t.comment.getActions().adminEdit("pending",e)}))}function zt(t){const e=new Wt(t.ctx,{text:()=>t.data.is_pinned?t.ctx.$t("unpin"):t.ctx.$t("pin"),adminOnly:!0});e.appendTo(t.$actions),e.setClick((()=>{t.comment.getActions().adminEdit("pinned",e)}))}function Vt(t){const e=new Wt(t.ctx,{text:t.ctx.$t("edit"),adminOnly:!0});e.appendTo(t.$actions),e.setClick((()=>{t.ctx.editComment(t.data,t.$el)}))}function Qt(t){const e=new Wt(t.ctx,{text:t.ctx.$t("delete"),confirm:!0,confirmText:t.ctx.$t("deleteConfirm"),adminOnly:!0});e.appendTo(t.$actions),e.setClick((()=>{t.comment.getActions().adminDelete(e)}))}const Gt={Avatar:function(t){const e=t.$el.querySelector(".atk-avatar"),n=u(""),i=t.conf.avatarURLBuilder;if(n.src=i?i(t.data):t.comment.getGravatarURL(),t.data.link){const i=u('');i.href=v(t.data.link)?t.data.link:`https://${t.data.link}`,i.append(n),e.append(i)}else e.append(n)},Header:function(t){Object.entries({renderNick:It,renderVerifyBadge:Ut,renderDate:Dt,renderUABadge:qt}).forEach((([e,n])=>{n(t)}))},Content:function(t){if(!t.data.is_collapsed)return t.$content.innerHTML=t.comment.getContentMarked(),void t.$content.classList.remove("atk-hide","atk-collapsed");t.$content.classList.add("atk-hide","atk-type-collapsed");const e=u(`\n
        \n ${t.ctx.$t("collapsedMsg")}\n ${t.ctx.$t("expand")}\n
        `);t.$body.insertAdjacentElement("beforeend",e);const n=e.querySelector(".atk-show-btn");n.addEventListener("click",(e=>{e.stopPropagation(),t.$content.classList.contains("atk-hide")?(t.$content.innerHTML=t.comment.getContentMarked(),t.$content.classList.remove("atk-hide"),T(t.$content),n.innerHTML=t.ctx.$t("collapse")):(t.$content.innerHTML="",t.$content.classList.add("atk-hide"),n.innerHTML=t.ctx.$t("expand"))}))},ReplyAt:function(t){t.cConf.isFlatMode||0===t.data.rid||t.cConf.replyTo&&(t.$replyAt=u(''),t.$replyAt.querySelector(".atk-nick").innerText=`${t.cConf.replyTo.nick}`,t.$replyAt.onclick=()=>{t.comment.getActions().goToReplyComment()},t.$headerBadgeWrap.insertAdjacentElement("afterend",t.$replyAt))},ReplyTo:function(t){if(!t.cConf.isFlatMode)return;if(!t.cConf.replyTo)return;t.$replyTo=u(`\n
        \n
        ${t.ctx.$t("reply")} :
        \n
        \n
        `);const e=t.$replyTo.querySelector(".atk-nick");e.innerText=`@${t.cConf.replyTo.nick}`,e.onclick=()=>{t.comment.getActions().goToReplyComment()};let n=wt(t.ctx,t.cConf.replyTo.content);t.cConf.replyTo.is_collapsed&&(n=`[${t.ctx.$t("collapsed")}]`),t.$replyTo.querySelector(".atk-content").innerHTML=n,t.$body.prepend(t.$replyTo)},Pending:function(t){if(!t.data.is_pending)return;const e=u(`
        ${t.ctx.$t("pendingMsg")}
        `);t.$body.prepend(e)},Actions:function(t){Object.entries({renderVote:Ft,renderReply:Ht,renderCollapse:Nt,renderModerator:jt,renderPin:zt,renderEdit:Vt,renderDel:Qt}).forEach((([e,n])=>{n(t)}))}};function Kt(t,e){e.forEach((({el:e,max:n,imgContains:i})=>{const s=()=>{e&&(t.scrollable?function(t){if(!t.el)return;if(t.el.classList.contains(Jt))return;t.el.classList.add(Jt),t.el.style.height=`${t.maxHeight}px`}({el:e,maxHeight:n}):function(t){if(!t.el)return;if(!t.maxHeight)return;if(t.el.classList.contains(Yt))return;t.el.classList.add(Yt),t.el.style.height=`${t.maxHeight}px`,t.el.style.overflow="hidden";const e=u(`
        ${Mt("readMore")}`);e.onclick=e=>{e.stopPropagation(),Xt(t.el),t.postBtnClick&&t.postBtnClick(e)},t.el.append(e)}({el:e,maxHeight:n,postBtnClick:t.postExpandBtnClick}))},a=()=>{e&&p(e)>n&&s()};a(),i&&e&&function(t,e){if(!t)return;const n=t.getElementsByTagName("img");if(!n.length)return;let i=n.length;for(let s=0;s{i--,0===i&&e()})),0===i&&e()}(e,(()=>a()))}))}const Yt="atk-height-limit";function Xt(t){t&&t.classList.contains(Yt)&&(t.classList.remove(Yt),Array.from(t.children).forEach((t=>{t.classList.contains("atk-height-limit-btn")&&t.remove()})),t.style.height="",t.style.overflow="")}const Jt="atk-height-limit-scroll";class Zt extends Rt{constructor(t){super(t)}render(){var t;return this.$el=u('
        \n
        \n
        \n
        \n
        \n \n \n \n
        \n
        \n
        \n
        \n \n
        \n
        \n
        \n'),this.$main=this.$el.querySelector(".atk-main"),this.$header=this.$el.querySelector(".atk-header"),this.$body=this.$el.querySelector(".atk-body"),this.$content=this.$body.querySelector(".atk-content"),this.$actions=this.$el.querySelector(".atk-actions"),this.$el.setAttribute("id",`atk-comment-${this.data.id}`),t=this,Object.entries(Gt).forEach((([e,n])=>{n(t)})),this.recoveryChildrenWrap(),this.$el}checkHeightLimit(){const t=this.ctx.conf.heightLimit;if(!t||!t.content||!t.children)return;const e=t.content,n=t.children;Kt({postExpandBtnClick:()=>{const t=this.comment.getChildren();1===t.length&&Xt(t[0].getRender().$content)},scrollable:t.scrollable},[{el:this.$content,max:e,imgContains:!0},{el:this.$replyTo,max:e,imgContains:!0},{el:this.$childrenWrap,max:n,imgContains:!1}])}heightLimitRemoveForChildren(){this.$childrenWrap&&Xt(this.$childrenWrap)}playFadeAnim(){T(this.comment.getRender().$el)}playFadeAnimForBody(){T(this.comment.getRender().$body)}getChildrenWrap(){return this.$childrenWrap}renderChildrenWrap(){return this.$childrenWrap||(this.$childrenWrap=u('
        '),this.$main.append(this.$childrenWrap)),this.$childrenWrap}recoveryChildrenWrap(){this.$childrenWrap&&this.$main.append(this.$childrenWrap)}setUnread(t){t?this.$el.classList.add("atk-unread"):this.$el.classList.remove("atk-unread")}setOpenable(t){t?this.$el.classList.add("atk-openable"):this.$el.classList.remove("atk-openable")}setOpenURL(t){this.setOpenable(!0),this.$el.onclick=e=>{e.preventDefault(),window.open(t),this.cConf.openEvt&&this.cConf.openEvt()}}setOpenAction(t){this.setOpenable(!0),this.$el.onclick=e=>{e.preventDefault(),t()}}}class te{constructor(t){d(this,"comment"),this.comment=t}get ctx(){return this.comment.ctx}get data(){return this.comment.getData()}get cConf(){return this.comment.getConf()}vote(t){const e="up"===t?this.comment.getRender().voteBtnUp:this.comment.getRender().voteBtnDown;this.ctx.getApi().comment.vote(this.data.id,`comment_${t}`).then((t=>{var e,n;this.data.vote_up=t.up,this.data.vote_down=t.down,null==(e=this.comment.getRender().voteBtnUp)||e.updateText(),null==(n=this.comment.getRender().voteBtnDown)||n.updateText()})).catch((t=>{null==e||e.setError(this.ctx.$t("voteFail")),console.log(t)}))}adminEdit(t,e){if(e.isLoading)return;e.setLoading(!0,`${this.ctx.$t("editing")}...`);const n=l({},this.data);"collapsed"===t?n.is_collapsed=!n.is_collapsed:"pending"===t?n.is_pending=!n.is_pending:"pinned"===t&&(n.is_pinned=!n.is_pinned),this.ctx.getApi().comment.commentEdit(n).then((t=>{e.setLoading(!1),this.comment.setData(t),this.ctx.listRefreshUI()})).catch((t=>{console.error(t),e.setError(this.ctx.$t("editFail"))}))}adminDelete(t){t.isLoading||(t.setLoading(!0,`${this.ctx.$t("deleting")}...`),this.ctx.getApi().comment.commentDel(this.data.id,this.data.site_name).then((()=>{t.setLoading(!1),this.cConf.onDelete&&this.cConf.onDelete(this.comment)})).catch((e=>{console.error(e),t.setError(this.ctx.$t("deleteFail"))})))}goToReplyComment(){const t=window.location.hash,e=`#atk-comment-${this.data.rid}`;window.location.hash=e,e===t&&window.dispatchEvent(new Event("hashchange"))}}class ee extends w{constructor(t,e,n){super(t),d(this,"renderInstance"),d(this,"actionInstance"),d(this,"data"),d(this,"cConf"),d(this,"parent"),d(this,"children",[]),d(this,"nestCurt"),d(this,"nestMax"),this.nestMax=t.conf.nestMax||3,this.cConf=n,this.data=l({},e),this.data.date=this.data.date.replace(/-/g,"/"),this.parent=null,this.nestCurt=1,this.actionInstance=new te(this),this.renderInstance=new Zt(this)}render(){const t=this.renderInstance.render();this.$el&&this.$el.replaceWith(t),this.$el=t,this.cConf.afterRender&&this.cConf.afterRender()}getActions(){return this.actionInstance}getRender(){return this.renderInstance}getData(){return this.data}setData(t){this.data=t,this.render(),this.getRender().playFadeAnimForBody()}getParent(){return this.parent}getChildren(){return this.children}getNestCurt(){return this.nestCurt}getIsRoot(){return 0===this.data.rid}getID(){return this.data.id}putChild(t,e="append"){t.parent=this,t.nestCurt=this.nestCurt+1,this.children.push(t);const n=this.getChildrenEl();"append"===e?n.append(t.getEl()):"prepend"===e&&n.prepend(t.getEl()),t.getRender().playFadeAnim(),t.getRender().checkHeightLimit()}getChildrenEl(){let t=this.getRender().getChildrenWrap();return t||(t=this.nestCurt{n.parent&&(t.push(n.parent),e(n.parent))};return e(this),t}getEl(){return this.$el}getGravatarURL(){return function(t,e){const{mirror:n,params:i}=t.conf.gravatar;return`${n.replace(/\/$/,"")}/${e}?${i.replace(/^\?/,"")}`}(this.ctx,this.data.email_encrypted)}getContentMarked(){return wt(this.ctx,this.data.content)}getDateFormatted(){return y(new Date(this.data.date),this.ctx)}getUserUA(){const t=function(t){const e=String(t||Pt.userAgent),n={os:"",osVersion:"",engine:"",browser:"",device:"",language:"",version:""},i={Trident:e.includes("Trident")||e.includes("NET CLR"),Presto:e.includes("Presto"),WebKit:e.includes("AppleWebKit"),Gecko:e.includes("Gecko/")},s={Safari:e.includes("Safari"),Chrome:e.includes("Chrome")||e.includes("CriOS"),IE:e.includes("MSIE")||e.includes("Trident"),Edge:e.includes("Edge")||e.includes("Edg"),Firefox:e.includes("Firefox")||e.includes("FxiOS"),"Firefox Focus":e.includes("Focus"),Chromium:e.includes("Chromium"),Opera:e.includes("Opera")||e.includes("OPR"),Vivaldi:e.includes("Vivaldi"),Yandex:e.includes("YaBrowser"),Kindle:e.includes("Kindle")||e.includes("Silk/"),360:e.includes("360EE")||e.includes("360SE"),UC:e.includes("UC")||e.includes(" UBrowser"),QQBrowser:e.includes("QQBrowser"),QQ:e.includes("QQ/"),Baidu:e.includes("Baidu")||e.includes("BIDUBrowser"),Maxthon:e.includes("Maxthon"),Sogou:e.includes("MetaSr")||e.includes("Sogou"),LBBROWSER:e.includes("LBBROWSER"),"2345Explorer":e.includes("2345Explorer"),TheWorld:e.includes("TheWorld"),MIUI:e.includes("MiuiBrowser"),Quark:e.includes("Quark"),Qiyu:e.includes("Qiyu"),Wechat:e.includes("MicroMessenger"),Taobao:e.includes("AliApp(TB"),Alipay:e.includes("AliApp(AP"),Weibo:e.includes("Weibo"),Douban:e.includes("com.douban.frodo"),Suning:e.includes("SNEBUY-APP"),iQiYi:e.includes("IqiyiApp")},a={Windows:e.includes("Windows"),Linux:e.includes("Linux")||e.includes("X11"),macOS:e.includes("Macintosh"),Android:e.includes("Android")||e.includes("Adr"),Ubuntu:e.includes("Ubuntu"),FreeBSD:e.includes("FreeBSD"),Debian:e.includes("Debian"),"Windows Phone":e.includes("IEMobile")||e.includes("Windows Phone"),BlackBerry:e.includes("BlackBerry")||e.includes("RIM"),MeeGo:e.includes("MeeGo"),Symbian:e.includes("Symbian"),iOS:e.includes("like Mac OS X"),"Chrome OS":e.includes("CrOS"),WebOS:e.includes("hpwOS")},r={Mobile:e.includes("Mobi")||e.includes("iPh")||e.includes("480"),Tablet:e.includes("Tablet")||e.includes("Pad")||e.includes("Nexus 7")};r.Mobile?r.Mobile=!e.includes("iPad"):s.Chrome&&e.includes("Edg")?(s.Chrome=!1,s.Edge=!0):Bt.showModalDialog&&Bt.chrome&&(s.Chrome=!1,s[360]=!0),n.device="PC",n.language=(()=>{const t=(Pt.browserLanguage||Pt.language).split("-");return t[1]&&(t[1]=t[1].toUpperCase()),t.join("_")})();const o={engine:i,browser:s,os:a,device:r};Object.entries(o).forEach((([t,e])=>{Object.entries(e).forEach((([e,i])=>{!0===i&&(n[t]=e)}))}));const l={Windows:()=>{const t=e.replace(/^.*Windows NT ([\d.]+);.*$/,"$1");return{6.4:"10",6.3:"8.1",6.2:"8",6.1:"7","6.0":"Vista",5.2:"XP",5.1:"XP","5.0":"2000","10.0":"10","11.0":"11"}[t]||t},Android:()=>e.replace(/^.*Android ([\d.]+);.*$/,"$1"),iOS:()=>e.replace(/^.*OS ([\d_]+) like.*$/,"$1").replace(/_/g,"."),Debian:()=>e.replace(/^.*Debian\/([\d.]+).*$/,"$1"),"Windows Phone":()=>e.replace(/^.*Windows Phone( OS)? ([\d.]+);.*$/,"$2"),macOS:()=>e.replace(/^.*Mac OS X ([\d_]+).*$/,"$1").replace(/_/g,"."),WebOS:()=>e.replace(/^.*hpwOS\/([\d.]+);.*$/,"$1")};n.osVersion="",l[n.os]&&(n.osVersion=l[n.os](),n.osVersion===e&&(n.osVersion=""));const c={Safari:()=>e.replace(/^.*Version\/([\d.]+).*$/,"$1"),Chrome:()=>e.replace(/^.*Chrome\/([\d.]+).*$/,"$1").replace(/^.*CriOS\/([\d.]+).*$/,"$1"),IE:()=>e.replace(/^.*MSIE ([\d.]+).*$/,"$1").replace(/^.*rv:([\d.]+).*$/,"$1"),Edge:()=>e.replace(/^.*(Edge|Edg|Edg[A-Z]{1})\/([\d.]+).*$/,"$2"),Firefox:()=>e.replace(/^.*Firefox\/([\d.]+).*$/,"$1").replace(/^.*FxiOS\/([\d.]+).*$/,"$1"),"Firefox Focus":()=>e.replace(/^.*Focus\/([\d.]+).*$/,"$1"),Chromium:()=>e.replace(/^.*Chromium\/([\d.]+).*$/,"$1"),Opera:()=>e.replace(/^.*Opera\/([\d.]+).*$/,"$1").replace(/^.*OPR\/([\d.]+).*$/,"$1"),Vivaldi:()=>e.replace(/^.*Vivaldi\/([\d.]+).*$/,"$1"),Yandex:()=>e.replace(/^.*YaBrowser\/([\d.]+).*$/,"$1"),Kindle:()=>e.replace(/^.*Version\/([\d.]+).*$/,"$1"),Maxthon:()=>e.replace(/^.*Maxthon\/([\d.]+).*$/,"$1"),QQBrowser:()=>e.replace(/^.*QQBrowser\/([\d.]+).*$/,"$1"),QQ:()=>e.replace(/^.*QQ\/([\d.]+).*$/,"$1"),Baidu:()=>e.replace(/^.*BIDUBrowser[\s/]([\d.]+).*$/,"$1"),UC:()=>e.replace(/^.*UC?Browser\/([\d.]+).*$/,"$1"),Sogou:()=>e.replace(/^.*SE ([\d.X]+).*$/,"$1").replace(/^.*SogouMobileBrowser\/([\d.]+).*$/,"$1"),"2345Explorer":()=>e.replace(/^.*2345Explorer\/([\d.]+).*$/,"$1"),TheWorld:()=>e.replace(/^.*TheWorld ([\d.]+).*$/,"$1"),MIUI:()=>e.replace(/^.*MiuiBrowser\/([\d.]+).*$/,"$1"),Quark:()=>e.replace(/^.*Quark\/([\d.]+).*$/,"$1"),Qiyu:()=>e.replace(/^.*Qiyu\/([\d.]+).*$/,"$1"),Wechat:()=>e.replace(/^.*MicroMessenger\/([\d.]+).*$/,"$1"),Taobao:()=>e.replace(/^.*AliApp\(TB\/([\d.]+).*$/,"$1"),Alipay:()=>e.replace(/^.*AliApp\(AP\/([\d.]+).*$/,"$1"),Weibo:()=>e.replace(/^.*weibo__([\d.]+).*$/,"$1"),Douban:()=>e.replace(/^.*com.douban.frodo\/([\d.]+).*$/,"$1"),Suning:()=>e.replace(/^.*SNEBUY-APP([\d.]+).*$/,"$1"),iQiYi:()=>e.replace(/^.*IqiyiVersion\/([\d.]+).*$/,"$1")};return n.version="",c[n.browser]&&(n.version=c[n.browser](),n.version===e&&(n.version="")),n.version.indexOf(".")&&(n.version=n.version.substring(0,n.version.indexOf("."))),"iOS"===n.os&&e.includes("iPad")?n.os="iPadOS":"Edge"!==n.browser||e.includes("Edg")?"MIUI"===n.browser?n.os="Android":"Chrome"===n.browser&&Number(n.version)>27||"Opera"===n.browser&&Number(n.version)>12||"Yandex"===n.browser?n.engine="Blink":void 0===n.browser&&(n.browser="Unknow App"):n.engine="EdgeHTML",n}(this.data.ua);return{browser:`${t.browser} ${t.version}`,os:`${t.os} ${t.osVersion}`}}getConf(){return this.cConf}}class ne{constructor(t,e){d(this,"conf"),d(this,"total"),d(this,"$el"),d(this,"$input"),d(this,"inputTimer"),d(this,"$prevBtn"),d(this,"$nextBtn"),d(this,"page",1),this.total=t,this.conf=e,this.$el=u('
        \n
        \n
        Prev
        \n \n
        Next
        \n
        \n
        '),this.$input=this.$el.querySelector(".atk-input"),this.$input.value=`${this.page}`,this.$input.oninput=()=>this.input(),this.$input.onkeydown=t=>this.keydown(t),this.$prevBtn=this.$el.querySelector(".atk-btn-prev"),this.$nextBtn=this.$el.querySelector(".atk-btn-next"),this.$prevBtn.onclick=()=>this.prev(),this.$nextBtn.onclick=()=>this.next(),this.checkDisabled()}get pageSize(){return this.conf.pageSize}get offset(){return this.pageSize*(this.page-1)}get maxPage(){return Math.ceil(this.total/this.pageSize)}update(t,e){this.page=Math.ceil(t/this.pageSize)+1,this.total=e,this.setInput(this.page),this.checkDisabled()}setInput(t){this.$input.value=`${t}`}input(t=!1){window.clearTimeout(this.inputTimer);const e=this.$input.value.trim(),n=()=>{if(""===e)return void this.setInput(this.page);let t=Number(e);Number.isNaN(t)||t<1?this.setInput(this.page):(t>this.maxPage&&(this.setInput(this.maxPage),t=this.maxPage),this.change(t))};t?n():this.inputTimer=window.setTimeout((()=>n()),800)}prev(){const t=this.page-1;t<1||this.change(t)}next(){const t=this.page+1;t>this.maxPage||this.change(t)}change(t){this.page=t,this.conf.onChange(this.offset),this.setInput(t),this.checkDisabled()}checkDisabled(){this.page+1>this.maxPage?this.$nextBtn.classList.add("atk-disabled"):this.$nextBtn.classList.remove("atk-disabled"),this.page-1<1?this.$prevBtn.classList.add("atk-disabled"):this.$prevBtn.classList.remove("atk-disabled")}keydown(t){const e=t.keyCode||t.which;if(38===e){const t=Number(this.$input.value)+1;if(t>this.maxPage)return;this.setInput(t),this.input()}else if(40===e){const t=Number(this.$input.value)-1;if(t<1)return;this.setInput(t),this.input()}else 13===e&&this.input(!0)}setLoading(t){t?x(this.$el):C(this.$el)}}const ie={createInstance(t){const e=new ne(t.total,{pageSize:t.pageSize,onChange:e=>h(this,null,(function*(){if(!0===t.list.conf.editorTravel&&t.list.ctx.editorTravelBack(),yield t.list.fetchComments(e),t.list.repositionAt){(t.list.scrollListenerAt||window).scroll({top:t.list.repositionAt?g(t.list.repositionAt).top:0,left:0})}}))});return[e,e.$el]},setLoading(t){this.instance.setLoading(t)},update(t,e){this.instance.update(t,e)},next(){this.instance.next()}};class se{constructor(t){d(this,"conf"),d(this,"$el"),d(this,"$loading"),d(this,"$text"),d(this,"offset",0),d(this,"total",0),d(this,"origText","Load More"),this.conf=t,this.origText=this.conf.text||this.origText,this.$el=u(``),this.$loading=this.$el.querySelector(".atk-loading-icon"),this.$text=this.$el.querySelector(".atk-text"),this.$el.onclick=()=>{this.click()}}get hasMore(){return this.total>this.offset+this.conf.pageSize}click(){this.hasMore&&this.conf.onClick(this.offset+this.conf.pageSize),this.checkDisabled()}show(){this.$el.style.display=""}hide(){this.$el.style.display="none"}setLoading(t){this.$loading.style.display=t?"":"none",this.$text.style.display=t?"none":""}showErr(t){this.setLoading(!1),this.$text.innerText=t,this.$el.classList.add("atk-err"),window.setTimeout((()=>{this.$text.innerText=this.origText,this.$el.classList.remove("atk-err")}),2e3)}update(t,e){this.offset=t,this.total=e,this.checkDisabled()}checkDisabled(){this.hasMore?this.show():this.hide()}}const ae={pagination:ie,"read-more":{createInstance(t){const e=new se({pageSize:t.pageSize,onClick:e=>h(this,null,(function*(){yield t.list.fetchComments(e)})),text:Mt("loadMore")});if(t.list.conf.pagination.autoLoad){const n=t.list.scrollListenerAt||document;this.autoLoadScrollEvent&&n.removeEventListener("scroll",this.autoLoadScrollEvent),this.autoLoadScrollEvent=()=>{if("read-more"!==t.mode||!(null==e?void 0:e.hasMore)||t.list.getLoading())return;const n=t.list.$el.querySelector(".atk-list-comments-wrap > .atk-comment-wrap:nth-last-child(3)");n&&function(t,e=document.documentElement){const n=e.clientHeight,i=e.scrollTop,s=i+n,a=t.getBoundingClientRect();return a.top+i+a.height<=s}(n,t.list.scrollListenerAt)&&e.click()},n.addEventListener("scroll",this.autoLoadScrollEvent)}return[e,e.$el]},setLoading(t){this.instance.setLoading(t)},update(t,e){this.instance.update(t,e)},showErr(t){this.instance.showErr(t)},next(){this.instance.click()}}};class re{constructor(t){d(this,"conf"),this.conf=t,this.init()}getAdaptor(){return ae[this.conf.mode]}init(){const t=this.getAdaptor(),[e,n]=t.createInstance(this.conf);t.instance=e,t.el=n,this.conf.list.$el.append(t.el)}setLoading(t){this.getAdaptor().setLoading(t)}update(t,e){this.getAdaptor().update(t,e)}getEl(){return this.getAdaptor().el}showErr(t){const e=this.getAdaptor(),n=e.showErr;n&&n.bind(e)(t)}setMode(t){t!==this.conf.mode&&(this.getEl().remove(),this.conf.mode=t,this.init())}next(){this.getAdaptor().next()}}function oe(t,e,n){const i=function(t,e){const n=t.split("."),i=e.split(".");for(let s=0;s<3;s++){const t=Number(n[s]),e=Number(i[s]);if(t>e)return 1;if(e>t)return-1;if(!Number.isNaN(t)&&Number.isNaN(e))return 1;if(Number.isNaN(t)&&!Number.isNaN(e))return-1}return 0}(e,n);if(0!==i){const s=u(`
        请更新 Artalk ${Mt(i<0?"frontend":"backend")}以获得完整体验 (帮助文档)

        当前版本:${Mt("frontend")} ${e} / ${Mt("backend")} ${n}

        `),a=u('忽略');return a.onclick=()=>{L(t.$el.parentElement,null),t.ctx.conf.versionCheck=!1,t.fetchComments(0)},s.append(a),L(t.$el.parentElement,s,'Artalk Warn'),!0}return!1}function le(t){const{$dropdownWrap:e,dropdownList:n}=t;if(e.querySelector(".atk-dropdown"))return;e.classList.add("atk-dropdown-wrap"),e.append(u(''));let i=0;const s=u('
          ');n.forEach(((t,e)=>{const n=t[0],a=t[1],r=u('
        • '),o=r.querySelector("span");o.innerText=n,o.onclick=()=>{((t,e,n,a)=>{a(),i=t,s.querySelectorAll(".active").forEach((t=>{t.classList.remove("active")})),e.classList.add("active"),s.style.display="none",setTimeout((()=>{s.style.display=""}),80)})(e,r,0,a)},s.append(r),e===i&&r.classList.add("active")})),e.append(s)}const ce={el:"",pageKey:"",pageTitle:"",server:"",site:"",placeholder:"",noComment:"",sendBtn:"",darkMode:!1,editorTravel:!0,flatMode:"auto",nestMax:2,nestSort:"DATE_ASC",emoticons:"https://cdn.jsdelivr.net/gh/ArtalkJS/Emoticons/grps/default.json",vote:!0,voteDown:!1,uaBadge:!0,listSort:!0,preview:!0,countEl:"#ArtalkCount",pvEl:"#ArtalkPV",gravatar:{mirror:"https://cravatar.cn/avatar/",params:"d=mp&s=240"},pagination:{pageSize:20,readMore:!0,autoLoad:!0},heightLimit:{content:300,children:400,scrollable:!1},imgUpload:!0,reqTimeout:15e3,versionCheck:!0,useBackendConf:!0,locale:"zh-CN"};function de(t){const e=b(ce,t);if("string"==typeof e.el&&e.el)try{const t=document.querySelector(e.el);if(!t)throw Error(`Target element "${e.el}" was not found.`);e.el=t}catch(n){throw console.error(n),new Error("Please check your Artalk `el` config.")}return e.server=e.server.replace(/\/$/,"").replace(/\/api\/?$/,""),e.pageKey||(e.pageKey=`${window.location.pathname}`),e.pageTitle||(e.pageTitle=`${document.title}`),"auto"===e.locale&&(e.locale=navigator.language),e}function he(t){const e=["el","pageKey","pageTitle","server","site","darkMode"];return Object.keys(t).forEach((n=>{e.includes(n)&&delete t[n]})),t.emoticons&&"string"==typeof t.emoticons&&(t.emoticons=t.emoticons.trim(),t.emoticons.startsWith("[")||t.emoticons.startsWith("{")?t.emoticons=JSON.parse(t.emoticons):"false"===t.emoticons&&(t.emoticons=!1)),t}ce.vote=!1,ce.uaBadge=!1,ce.emoticons=!1;class ue extends w{constructor(t){super(t),d(this,"$commentsWrap"),d(this,"data"),d(this,"isLoading",!1),d(this,"confLoaded",!1),d(this,"noCommentText"),d(this,"_nestSortBy"),d(this,"_flatMode"),d(this,"_pageMode"),d(this,"pgHolder"),d(this,"_pageSize"),d(this,"scrollListenerAt"),d(this,"repositionAt"),d(this,"renderComment"),d(this,"paramsEditor"),d(this,"onAfterLoad"),d(this,"unread",[]),d(this,"unreadHighlight"),this.$el=u('
          \n
          \n
          '),this.$commentsWrap=this.$el.querySelector(".atk-list-comments-wrap"),window.setInterval((()=>{this.$el.querySelectorAll("[data-atk-comment-date]").forEach((t=>{const e=t.getAttribute("data-atk-comment-date");t.innerText=y(new Date(Number(e)),this.ctx)}))}),3e4),this.ctx.on("conf-loaded",(()=>{}))}get nestSortBy(){return this._nestSortBy||this.ctx.conf.nestSort||"DATE_ASC"}set nestSortBy(t){this._nestSortBy=t}get flatMode(){return void 0!==this._flatMode?this._flatMode:!0===this.ctx.conf.flatMode||Number(this.ctx.conf.nestMax)<=1||!("auto"!==this.ctx.conf.flatMode||!window.matchMedia("(max-width: 768px)").matches)}set flatMode(t){this._flatMode=t}get pageMode(){return this._pageMode||(this.conf.pagination.readMore?"read-more":"pagination")}set pageMode(t){var e;this._pageMode=t,null==(e=this.pgHolder)||e.setMode(this._pageMode)}get pageSize(){return this._pageSize||this.conf.pagination.pageSize}set pageSize(t){this._pageSize=t}getData(){return this.data}clearData(){this.data=void 0}getLoading(){return this.isLoading}getCommentsWrapEl(){return this.$commentsWrap}setLoading(t,e=!1){var n;this.isLoading=t,e?function(t,e){t?x(e):C(e)}(t,this.$el):null==(n=this.pgHolder)||n.setLoading(t)}fetchComments(t){return h(this,null,(function*(){if(this.isLoading)return;const e=0===t,n=t=>this.setLoading(t,e);let i;n(!0),this.ctx.trigger("list-load"),("read-more"===this.pageMode&&e||"pagination"===this.pageMode)&&this.ctx.clearAllComments();try{i=yield this.ctx.getApi().comment.get(t,this.pageSize,this.flatMode,this.paramsEditor)}catch(s){throw this.onError(s.msg||String(s),t,s.data),s}finally{n(!1)}L(this.$el,null);try{this.onLoad(i,t)}catch(s){throw this.onError(String(s),t),s}finally{n(!1)}}))}onLoad(t,e){if(this.data=t,!this.confLoaded){const e=he(t.conf.frontend_conf);this.conf.useBackendConf?this.ctx.updateConf(e):this.ctx.updateConf({}),this.confLoaded=!0}this.ctx.conf.versionCheck&&oe(this,Ot,t.api_version.version)||(this.importComments(t.comments),this.refreshPagination(e,this.flatMode?t.total:t.total_roots),this.refreshUI(),this.ctx.updateNotifies(t.unread||[]),this.ctx.trigger("list-loaded"),this.onAfterLoad&&this.onAfterLoad(t))}refreshPagination(t,e){var n;this.pgHolder||(this.pgHolder=new re({list:this,mode:this.pageMode,pageSize:this.pageSize,total:e})),null==(n=this.pgHolder)||n.update(t,e)}onError(t,e,n){var i;this.confLoaded||this.ctx.updateConf({}),t=String(t),console.error(t),0===e||"read-more"!==this.pageMode?L(this.$el,function(t,e,n){const i=u(`${e},${Mt("listLoadFailMsg")}
          `),s=u(`${Mt("listRetry")}`);s.onclick=()=>t.fetchComments(0),i.appendChild(s);const a=u(' | 打开控制台');i.appendChild(a),_t.data.isAdmin||a.classList.add("atk-hide");let r="";if(null==n?void 0:n.err_no_site){const e={create_name:t.ctx.conf.site,create_urls:`${window.location.protocol}//${window.location.host}`};r=`sites|${JSON.stringify(e)}`}return a.onclick=()=>t.ctx.showSidebar({view:r}),i}(this,t,n)):null==(i=this.pgHolder)||i.showErr(this.$t("loadFail"))}refreshUI(){!function(t){const e=t.ctx.getCommentList().length<=0;let n=t.getCommentsWrapEl().querySelector(".atk-list-no-comment");e?n||(n=u('
          '),n.innerHTML=t.noCommentText||t.ctx.conf.noComment||t.ctx.$t("noComment"),t.getCommentsWrapEl().appendChild(n)):null==n||n.remove(),t.ctx.checkAdminShowEl()}(this)}reload(){this.fetchComments(0)}createComment(t,e){e||(e=this.ctx.getCommentDataList());const n=new ee(this.ctx,t,{isFlatMode:this.flatMode,afterRender:()=>{this.renderComment&&this.renderComment(n)},onDelete:t=>{this.ctx.deleteComment(t),this.refreshUI()},replyTo:t.rid?e.find((e=>e.id===t.rid)):void 0});return n.render(),this.ctx.getCommentList().push(n),n}importComments(t){this.flatMode?t.forEach((e=>{this.putCommentFlatMode(e,t,"append")})):this.importCommentsNest(t)}importCommentsNest(t){const e=function(t,e="DATE_DESC",n=2){const i=[];t.filter((t=>0===t.rid)).forEach((e=>{const s={id:e.id,comment:e,children:[],level:1};s.parent=s,i.push(s),function e(i){const s=t.filter((t=>t.rid===i.id));0!==s.length&&(i.level>=n&&(i=i.parent),s.forEach((t=>{const n={id:t.id,comment:t,children:[],parent:i,level:i.level+1};i.children.push(n),e(n)})))}(s)}));const s=(n,i)=>{let s=n.id-i.id;return"DATE_ASC"===e?s=+new Date(n.comment.date)-+new Date(i.comment.date):"DATE_DESC"===e?s=+new Date(i.comment.date)-+new Date(n.comment.date):"SRC_INDEX"===e?s=t.indexOf(n.comment)-t.indexOf(i.comment):"VOTE_UP_DESC"===e&&(s=i.comment.vote_up-n.comment.vote_up),s};return function t(e){e.forEach((e=>{e.children=e.children.sort(s),t(e.children)}))}(i),i}(t,this.nestSortBy,this.conf.nestMax);e.forEach((e=>{const n=this.createComment(e.comment,t);this.$commentsWrap.appendChild(n.getEl()),n.getRender().playFadeAnim();const i=this;!function e(n,s){s.children.forEach((s=>{const a=s.comment,r=i.createComment(a,t);n.putChild(r),e(r,s)}))}(n,e),n.getRender().checkHeightLimit()}))}putCommentFlatMode(t,e,n){t.is_collapsed&&(t.is_allow_reply=!1);const i=this.createComment(t,e);return t.visible&&("append"===n&&this.$commentsWrap.append(i.getEl()),"prepend"===n&&this.$commentsWrap.prepend(i.getEl()),i.getRender().playFadeAnim()),i.getRender().checkHeightLimit(),i}insertComment(t){if(this.flatMode){S(this.putCommentFlatMode(t,this.ctx.getCommentDataList(),"prepend").getEl())}else{const e=this.createComment(t);if(0===t.rid)this.$commentsWrap.prepend(e.getEl());else{const n=this.ctx.findComment(t.rid);n&&(n.putChild(e,"DATE_ASC"===this.nestSortBy?"append":"prepend"),e.getParents().forEach((t=>{t.getRender().heightLimitRemoveForChildren()})))}e.getRender().checkHeightLimit(),S(e.getEl()),e.getRender().playFadeAnim()}this.data&&(this.data.total+=1),this.refreshUI(),this.ctx.trigger("list-loaded"),this.ctx.trigger("list-inserted",t)}updateComment(t){const e=this.ctx.findComment(t.id);e&&e.setData(t)}updateUnread(t){this.unread=t,!0===this.unreadHighlight&&this.ctx.getCommentList().forEach((t=>{const e=this.unread.find((e=>e.comment_id===t.getID()));e?(t.getRender().setUnread(!0),t.getRender().setOpenAction((()=>{window.open(e.read_link),this.unread=this.unread.filter((e=>e.comment_id!==t.getID())),this.ctx.updateNotifies(this.unread)}))):t.getRender().setUnread(!1)}))}}class pe extends ue{constructor(t){const e=u('
          \n
          \n
          \n
          \n
          \n
          \n \n \n \n
          \n
          \n
          \n
          \n
          \n \n
          \n');super(t),d(this,"$closeCommentBtn"),d(this,"$openSidebarBtn"),d(this,"$unreadBadge"),d(this,"$commentCount"),d(this,"$commentCountNum"),d(this,"$dropdownWrap"),d(this,"goToCommentFounded",!1),d(this,"goToCommentDelay",!0),e.querySelector(".atk-list-body").append(this.$el),this.$el=e,this.repositionAt=this.$el,this.initListActionBtn();this.$commentCount=this.$el.querySelector(".atk-comment-count");const n=()=>{this.$commentCount.innerHTML=this.$t("counter",{count:'0'}),this.$commentCountNum=this.$commentCount.querySelector(".atk-comment-count-num")};n(),this.$el.querySelector(".atk-copyright").innerHTML=`Powered By Artalk`,this.ctx.on("conf-loaded",(()=>{n(),this.refreshUI()}))}initListActionBtn(){this.$openSidebarBtn=this.$el.querySelector('[data-action="open-sidebar"]'),this.$closeCommentBtn=this.$el.querySelector('[data-action="admin-close-comment"]'),this.$unreadBadge=this.$el.querySelector(".atk-unread-badge"),this.$openSidebarBtn.addEventListener("click",(()=>{this.ctx.showSidebar()})),this.$closeCommentBtn.addEventListener("click",(()=>{this.data&&(this.data.page.admin_only=!this.data.page.admin_only,this.adminPageEditSave())}))}refreshUI(){var t;super.refreshUI(),this.$commentCountNum.innerText=String(Number(null==(t=this.data)?void 0:t.total)||0),_t.data.nick&&_t.data.email?this.$openSidebarBtn.classList.remove("atk-hide"):this.$openSidebarBtn.classList.add("atk-hide"),this.$openSidebarBtn.querySelector(".atk-text").innerText=_t.data.isAdmin?this.$t("ctrlCenter"):this.$t("msgCenter"),this.data&&this.data.page&&!0===this.data.page.admin_only?(this.ctx.editorClose(),this.$closeCommentBtn.innerHTML=this.$t("openComment")):(this.ctx.editorOpen(),this.$closeCommentBtn.innerHTML=this.$t("closeComment")),this.ctx.conf.listSort?this.initDropdown():function(t){var e,n;const{$dropdownWrap:i}=t;i.classList.remove("atk-dropdown-wrap"),null==(e=i.querySelector(".atk-arrow-down-icon"))||e.remove(),null==(n=i.querySelector(".atk-dropdown"))||n.remove()}({$dropdownWrap:this.$commentCount})}onLoad(t,e){super.onLoad(t,e),this.goToCommentFounded||this.checkGoToCommentByUrlHash(),!0===this.ctx.conf.editorTravel&&this.ctx.editorTravelBack()}checkGoToCommentByUrlHash(){var t;let e=Number(m("atk_comment"));if(!e){const t=window.location.hash.match(/#atk-comment-([0-9]+)/);if(!t||!t[1]||Number.isNaN(Number(t[1])))return;e=Number(t[1])}if(!e)return;const n=this.ctx.findComment(e);if(!n)return void(null==(t=this.pgHolder)||t.next());const i=m("atk_notify_key");i&&this.ctx.getApi().user.markRead(e,i).then((()=>{this.unread=this.unread.filter((t=>t.comment_id!==e)),this.updateUnread(this.unread)})),n.getParents().forEach((t=>{t.getRender().heightLimitRemoveForChildren()}));const s=()=>{S(n.getEl(),!1),n.getEl().classList.remove("atk-flash-once"),window.setTimeout((()=>{n.getEl().classList.add("atk-flash-once")}),150)};this.goToCommentDelay?window.setTimeout((()=>s()),350):s(),this.goToCommentFounded=!0,this.goToCommentDelay=!0}adminPageEditSave(){this.data&&this.data.page&&(this.ctx.editorShowLoading(),this.ctx.getApi().page.pageEdit(this.data.page).then((t=>{this.data&&(this.data.page=l({},t)),this.refreshUI()})).catch((t=>{this.ctx.editorShowNotify(`${this.$t("editFail")}: ${t.msg||String(t)}`,"e")})).finally((()=>{this.ctx.editorHideLoading()})))}showUnreadBadge(t){t>0?(this.$unreadBadge.innerText=`${Number(t||0)}`,this.$unreadBadge.style.display="block"):this.$unreadBadge.style.display="none"}initDropdown(){const t=t=>{this.paramsEditor=t,this.fetchComments(0)};le({$dropdownWrap:this.$commentCount,dropdownList:[[this.$t("sortLatest"),()=>{t((t=>{t.sort_by="date_desc"}))}],[this.$t("sortBest"),()=>{t((t=>{t.sort_by="vote"}))}],[this.$t("sortOldest"),()=>{t((t=>{t.sort_by="date_asc"}))}],[this.$t("sortAuthor"),()=>{t((t=>{t.view_only_admin=!0}))}]]})}updateUnread(t){super.updateUnread(t),this.showUnreadBadge((null==t?void 0:t.length)||0)}}class me{constructor(t,e){d(this,"conf"),d(this,"$root"),d(this,"markedReplacers",[]),d(this,"commentList",[]),d(this,"eventList",[]),this.conf=t,this.$root=e||document.createElement("div"),this.$root.classList.add("artalk"),this.$root.innerHTML=""}inject(t,e){this[t]=e}get(t){return this[t]}getApi(){return this.api}getCommentList(){return this.commentList}getCommentDataList(){return this.commentList.map((t=>t.getData()))}findComment(t){return this.commentList.find((e=>e.getData().id===t))}deleteComment(t){let e;if("number"==typeof t){const n=this.findComment(t);if(!n)throw Error(`Comment ${t} cannot be found`);e=n}else e=t;if(e.getEl().remove(),this.commentList.splice(this.commentList.indexOf(e),1),this.list){const t=this.list.getData();t&&(t.total-=1),this.list.refreshUI()}}clearAllComments(){this.list&&(this.list.getCommentsWrapEl().innerHTML="",this.list.clearData()),this.commentList=[]}insertComment(t){var e;null==(e=this.list)||e.insertComment(t)}updateComment(t){var e;null==(e=this.list)||e.updateComment(t)}replyComment(t,e,n){this.editor.setReply(t,e,n)}cancelReplyComment(){this.editor.cancelReply()}editComment(t,e){this.editor.setEditComment(t,e)}cancelEditComment(){this.editor.cancelEditComment()}updateNotifies(t){var e;null==(e=this.list)||e.updateUnread(t)}listReload(){var t;null==(t=this.list)||t.reload()}reload(){this.listReload()}listRefreshUI(){var t;null==(t=this.list)||t.refreshUI()}listHashGotoCheck(){if(!(this.list&&this.list instanceof pe))return;const t=this.list;t.goToCommentDelay=!1,t.checkGoToCommentByUrlHash()}editorOpen(){this.editor.open()}editorClose(){this.editor.close()}editorShowLoading(){this.editor.showLoading()}editorHideLoading(){this.editor.hideLoading()}editorShowNotify(t,e){this.editor.showNotify(t,e)}editorTravel(t){this.editor.travel(t)}editorTravelBack(){this.editor.travelBack()}showSidebar(t){this.sidebarLayer.show(t)}hideSidebar(){this.sidebarLayer.hide()}checkAdmin(t){this.checkerLauncher.checkAdmin(t)}checkCaptcha(t){this.checkerLauncher.checkCaptcha(t)}checkAdminShowEl(){const t=[];this.$root.querySelectorAll("[atk-only-admin-show]").forEach((e=>t.push(e)));const{$wrap:e}=O();e&&e.querySelectorAll("[atk-only-admin-show]").forEach((e=>t.push(e)));const n=document.querySelector(".atk-sidebar");n&&n.querySelectorAll("[atk-only-admin-show]").forEach((e=>t.push(e))),t.forEach((t=>{this.user.data.isAdmin?t.classList.remove("atk-hide"):t.classList.add("atk-hide")}))}on(t,e,n="internal"){this.eventList.push({name:t,handler:e,scope:n})}off(t,e,n="internal"){this.eventList=this.eventList.filter((i=>e?!(i.name===t&&i.handler===e&&i.scope===n):!(i.name===t&&i.scope===n)))}trigger(t,e,n){this.eventList.filter((e=>e.name===t&&(!n||e.scope===n))).map((t=>t.handler)).forEach((t=>t(e)))}$t(t,e={}){return Mt(t,e)}setDarkMode(t){R(this,t)}updateConf(t){this.conf=b(this.conf,t),this.trigger("conf-loaded")}getMarkedInstance(){return bt()}}class ge{constructor(t,e){return d(this,"ctx"),d(this,"$el"),d(this,"$content"),d(this,"$actions"),this.ctx=t,this.$el=u('
          \n
          \n
          \n
          \n
          \n
          '),this.$actions=this.$el.querySelector(".atk-layer-dialog-actions"),this.$content=this.$el.querySelector(".atk-layer-dialog-content"),this.$content.appendChild(e),this}setYes(t){const e=u(``);return e.onclick=this.onBtnClick(t),this.$actions.appendChild(e),this}setNo(t){const e=u(``);return e.onclick=this.onBtnClick(t),this.$actions.appendChild(e),this}onBtnClick(t){return e=>{const n=t(e.currentTarget,this);void 0!==n&&!0!==n||this.$el.remove()}}}function fe(t){const e=u('
          '),n=u('');n.style.display="none",x(e,{transparentBg:!0}),n.src=`${t.getCtx().conf.server}/api/captcha/get?t=${+new Date}`,n.onload=()=>{n.style.display="",C(e)},e.append(n);const i=u('
          ');e.append(i),t.hideInteractInput();let s=!1;return function e(){return h(this,null,(function*(){var n;if(yield(n=1e3,new Promise((t=>{window.setTimeout((()=>{t(null)}),n)}))),s)return;let i=!1;try{i=(yield t.getCtx().getApi().captcha.captchaStatus()).is_pass}catch(a){i=!1}i?t.triggerSuccess():e()}))}(),i.onclick=()=>{s=!0,t.cancel()},e}const ye={request:(t,e)=>t.getApi().captcha.captchaCheck(e),body:t=>t.get("iframe")?fe(t):function(t){const e=u(`${t.getCtx().$t("captchaCheck")}`);return e.querySelector(".atk-captcha-img").onclick=()=>{const n=e.querySelector(".atk-captcha-img");t.getApi().captcha.captchaGet().then((t=>{n.setAttribute("src",t)})).catch((t=>{console.error("Failed to get captcha image ",t)}))},e}(t),onSuccess(t,e,n,i){t.set("val",n)},onError(t,e,n,i){i.querySelector(".atk-captcha-img").click(),i.querySelector('input[type="text"]').value=""}},$e={inputType:"password",request(t,e){const n={name:_t.data.nick,email:_t.data.email,password:e};return(()=>h(this,null,(function*(){return(yield t.getApi().user.login(n.name,n.email,n.password)).token})))()},body:t=>u(`${t.getCtx().$t("adminCheck")}`),onSuccess(t,e,n,i){_t.update({isAdmin:!0,token:e}),t.getCtx().trigger("user-changed",_t.data),t.getCtx().listReload()},onError(t,e,n,i){}};class ve{constructor(t){d(this,"ctx"),d(this,"launched",[]),this.ctx=t}checkCaptcha(t){this.fire(ye,t,(e=>{e.set("img_data",t.imgData),e.set("iframe",t.iframe)}))}checkAdmin(t){this.fire($e,t)}fire(t,e,n){if(this.launched.includes(t))return;this.launched.push(t);const i=new M(this.ctx,`checker-${(new Date).getTime()}`);i.setMaskClickHide(!1),i.show();const s={};let a=!1;const r={set:(t,e)=>{s[t]=e},get:t=>s[t],getCtx:()=>this.ctx,getApi:()=>this.ctx.getApi(),getLayer:()=>i,hideInteractInput:()=>{a=!0},triggerSuccess:()=>{this.close(t,i),t.onSuccess&&t.onSuccess(r,"","",o),e.onSuccess&&e.onSuccess("",d.$el)},cancel:()=>{this.close(t,i),e.onCancel&&e.onCancel()}};n&&n(r);const o=u();o.appendChild(t.body(r));const l=u(``);let c;o.appendChild(l),setTimeout((()=>l.focus()),80),l.onkeyup=t=>{"Enter"!==t.key&&13!==t.keyCode||(t.preventDefault(),i.getEl().querySelector('button[data-action="confirm"]').click())};const d=new ge(this.ctx,o);d.setYes((n=>{const s=l.value.trim();c||(c=n.innerText);const a=()=>{n.innerText=c||"",n.classList.remove("error")};return n.innerText=`${this.ctx.$t("loading")}...`,t.request(r,s).then((n=>{this.close(t,i),t.onSuccess&&t.onSuccess(r,n,s,o),e.onSuccess&&e.onSuccess(s,d.$el)})).catch((e=>{var i;i=String(e.msg||String(e)),n.innerText=i,n.classList.add("error"),t.onError&&t.onError(r,e,s,o);const c=setTimeout((()=>a()),3e3);l.onfocus=()=>{a(),clearTimeout(c)}})),!1})),d.setNo((()=>(this.close(t,i),e.onCancel&&e.onCancel(),!1))),a&&(l.style.display="none",d.$el.querySelector(".atk-layer-dialog-actions").style.display="none"),i.getEl().append(d.$el),e.onMount&&e.onMount(d.$el)}close(t,e){e.disposeNow(),this.launched=this.launched.filter((e=>e!==t))}}function ke(t,e,n,i){return h(this,null,(function*(){var s,a;if(_t.data.token){const t=new Headers(n.headers);t.set("Authorization",`Bearer ${_t.data.token}`),n.headers=t}const r=yield function(t,e,n,i){var s;const a=new AbortController;null==(s=i.signal)||s.addEventListener("abort",(()=>a.abort()));let r=fetch(e,c(l({},i),{signal:a.signal}));if(n>0){const t=setTimeout((()=>a.abort()),n);r.finally((()=>{clearTimeout(t)}))}return r=r.catch((t=>{throw"AbortError"===(t||{}).name?new Error(Mt("reqAborted")):t})),r}(0,e,i||t.conf.reqTimeout||15e3,n),o=r.status,d=[401,400].includes(o);if(!r.ok&&!d)throw new Error(`${Mt("reqGot")} ${o}`);let h=yield r.json();const u=(i,s)=>{ke(t,e,n).then((t=>{i(t)})).catch((t=>{s(t)}))};if((null==(s=h.data)?void 0:s.need_captcha)?h=yield new Promise(((e,n)=>{t.checkCaptcha({imgData:h.data.img_data,iframe:h.data.iframe,onSuccess:()=>{u(e,n)},onCancel:()=>{n(h)}})})):((null==(a=h.data)?void 0:a.need_login)||d)&&(h=yield new Promise(((e,n)=>{t.checkAdmin({onSuccess:()=>{u(e,n)},onCancel:()=>{n(h)}})}))),!h.success)throw h;return h}))}function be(t){const e=new FormData;return Object.keys(t).forEach((n=>e.append(n,String(t[n])))),e}!function(){function t(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function e(t,e){for(var n=0;n({user:t.data.user,is_login:t.data.is_login,unread:t.data.unread||[],unread_count:t.data.unread_count||0}))),abort:()=>{n.abort()}}}loginStatus(){return h(this,null,(function*(){return(yield this.POST("/login-status",{name:_t.data.nick,email:_t.data.email}))||{is_login:!1,is_admin:!1}}))}logout(){return h(this,null,(function*(){return this.POST("/logout")}))}markRead(t,e,n=!1){const i={comment_id:t,notify_key:e};return n&&(delete i.comment_id,delete i.notify_key,i.read_all=!0,i.name=_t.data.nick,i.email=_t.data.email),this.POST("/mark-read",i)}userList(t,e,n){return h(this,null,(function*(){const i={offset:t||0,limit:e||15};n&&(i.type=n);return yield this.POST("/admin/user-get",i)}))}userAdd(t,e){return h(this,null,(function*(){const n={name:t.name||"",email:t.email||"",password:e||"",link:t.link||"",is_admin:t.is_admin||!1,site_names:t.site_names_raw||"",receive_email:t.receive_email||!0,badge_name:t.badge_name||"",badge_color:t.badge_color||""};return(yield this.POST("/admin/user-add",n)).user}))}userEdit(t,e){return h(this,null,(function*(){const n={id:t.id,name:t.name||"",email:t.email||"",password:e||"",link:t.link||"",is_admin:t.is_admin||!1,site_names:t.site_names_raw||"",receive_email:t.receive_email||!0,badge_name:t.badge_name||"",badge_color:t.badge_color||""};return(yield this.POST("/admin/user-edit",n)).user}))}userDel(t){return this.POST("/admin/user-del",{id:String(t)})}},system:class extends we{conf(){return h(this,null,(function*(){return he((yield this.POST("/conf")).frontend_conf||{})}))}getSettings(){return h(this,null,(function*(){return yield this.POST("/admin/setting-get")}))}saveSettings(t){return h(this,null,(function*(){return yield this.POST("/admin/setting-save",{data:t})}))}version(){return h(this,null,(function*(){const t=yield fetch(`${this.api.baseURL}/version`,{method:"POST"});return yield t.json()}))}},captcha:class extends we{captchaGet(){return h(this,null,(function*(){return(yield this.POST("/captcha/refresh")).img_data||""}))}captchaCheck(t){return h(this,null,(function*(){return(yield this.POST("/captcha/check",{value:t})).img_data||""}))}captchaStatus(){return h(this,null,(function*(){return(yield this.POST("/captcha/status"))||{is_pass:!1}}))}},admin:class extends we{cacheFlushAll(){return this.POST("/admin/cache-flush",{flush_all:!0})}cacheWarmUp(){return this.POST("/admin/cache-warm",{})}},upload:class extends we{imgUpload(t){return h(this,null,(function*(){const e=be({name:_t.data.nick,email:_t.data.email,page_key:this.ctx.conf.pageKey});e.set("file",t);const n={method:"POST",body:e};return(yield this.Fetch("/img-upload",n)).data||{}}))}}};class Ce{constructor(t){d(this,"ctx"),this.ctx=t,Object.entries(xe).forEach((([t,e])=>{this[t]=new e(this,this.ctx)}))}get baseURL(){return`${this.ctx.conf.server}/api`}}function Se(t){const e={editor:t,isMoved:!1,move:t=>function(t,e){if(t.isMoved)return;t.isMoved=!0;const n=t.editor.getUI().$el;n.after(u('
          '));const i=u("
          ");e.after(i),i.replaceWith(n),n.classList.add("atk-fade-in")}(e,t),back:()=>function(t){var e;if(!t.isMoved)return;t.isMoved=!1,null==(e=t.editor.ctx.$root.querySelector(".atk-editor-travel-placeholder"))||e.replaceWith(t.editor.getUI().$el),t.editor.cancelReply()}(e)};return e}class Ee{constructor(t){d(this,"editor"),d(this,"$panel"),d(this,"$btn"),d(this,"onHeaderInput"),d(this,"contentTransformer"),d(this,"onContentUpdated"),this.editor=t}get ctx(){return this.editor.ctx}registerPanel(t="
          "){return this.$panel=u(t),this.$panel}registerBtn(t){return this.$btn=u(`${t}`),this.$btn}registerHeaderInputEvt(t){this.onHeaderInput=t}registerContentTransformer(t){this.contentTransformer=t}registerContentUpdatedEvt(t){this.onContentUpdated=t}getPanel(){return this.$panel}getBtn(){return this.$btn}}d(Ee,"Name");class Te extends Ee{constructor(t){super(t),d(this,"emoticons",[]),d(this,"loadingTask",null),d(this,"$grpWrap"),d(this,"$grpSwitcher"),d(this,"isListLoaded",!1),d(this,"isImgLoaded",!1),this.editor=t,this.registerPanel('
          '),this.registerBtn(this.ctx.$t("emoticon")),this.registerContentTransformer((t=>this.transEmoticonImageText(t))),window.setTimeout((()=>{this.loadEmoticonsData()}),1e3)}onPanelShow(){(()=>{h(this,null,(function*(){yield this.loadEmoticonsData(),this.isImgLoaded||(this.initEmoticonsList(),this.isImgLoaded=!0),setTimeout((()=>{this.changeListHeight()}),30)}))})()}onPanelHide(){this.$panel.parentElement.style.height=""}loadEmoticonsData(){return h(this,null,(function*(){this.isListLoaded||(null===this.loadingTask?(this.loadingTask=(()=>h(this,null,(function*(){x(this.$panel),this.emoticons=yield this.handleData(this.ctx.conf.emoticons),C(this.$panel),this.loadingTask=null,this.isListLoaded=!0})))(),yield this.loadingTask):yield this.loadingTask)}))}handleData(t){return h(this,null,(function*(){if(!Array.isArray(t)&&["object","string"].includes(typeof t)&&(t=[t]),!Array.isArray(t))return L(this.$panel,"表情包数据必须为 Array/Object/String 类型"),C(this.$panel),[];const e=e=>{"object"==typeof e&&(e.name&&t.find((t=>t.name===e.name))||t.push(e))},n=t=>h(this,null,(function*(){yield Promise.all(t.map(((t,i)=>h(this,null,(function*(){if("object"!=typeof t||Array.isArray(t)){if(Array.isArray(t))yield n(t);else if("string"==typeof t){const i=yield this.remoteLoad(t);Array.isArray(i)?yield n(i):"object"==typeof i&&e(i)}}else e(t)})))))}));return yield n(t),t.forEach((t=>{if(this.isOwOFormat(t)){this.convertOwO(t).forEach((t=>{e(t)}))}else Array.isArray(t)&&t.forEach((t=>{e(t)}))})),t=t.filter((t=>"object"==typeof t&&!Array.isArray(t)&&!!t&&!!t.name)),this.solveNullKey(t),this.solveSameKey(t),t}))}remoteLoad(t){return h(this,null,(function*(){if(!t)return[];try{const e=yield fetch(t);return yield e.json()}catch(e){return C(this.$panel),L(this.$panel,`表情加载失败 ${String(e)}`),[]}}))}solveNullKey(t){t.forEach((t=>{t.items.forEach(((e,n)=>{e.key||(e.key=`${t.name} ${n+1}`)}))}))}solveSameKey(t){const e={};t.forEach((t=>{t.items.forEach((t=>{t.key&&""!==String(t.key).trim()&&(e[t.key]?e[t.key]++:e[t.key]=1,e[t.key]>1&&(t.key=`${t.key} ${e[t.key]}`))}))}))}isOwOFormat(t){try{return"object"==typeof t&&!!Object.values(t).length&&Array.isArray(Object.keys(Object.values(t)[0].container))&&Object.keys(Object.values(t)[0].container[0]).includes("icon")}catch(e){return!1}}convertOwO(t){const e=[];return Object.entries(t).forEach((([t,n])=>{const i={name:t,type:n.type,items:[]};n.container.forEach(((e,n)=>{const s=e.icon;if(/<(img|IMG)/.test(s)){const t=/src=["'](.*?)["']/.exec(s);t&&t.length>1&&(e.icon=t[1])}i.items.push({key:e.text||`${t} ${n+1}`,val:e.icon})})),e.push(i)})),e}initEmoticonsList(){this.$grpWrap=u('
          '),this.$panel.append(this.$grpWrap),this.emoticons.forEach(((t,e)=>{const n=u('');this.$grpWrap.append(n),n.setAttribute("data-index",String(e)),n.setAttribute("data-grp-name",t.name),n.setAttribute("data-type",t.type),t.items.forEach((e=>{const i=u('');if(n.append(i),e.key&&!new RegExp(`^(${t.name})?\\s?[0-9]+$`).test(e.key)&&i.setAttribute("title",e.key),"image"===t.type){const t=document.createElement("img");t.src=e.val,t.alt=e.key,i.append(t)}else i.innerText=e.val;i.onclick=()=>{"image"===t.type?this.editor.insertContent(`:[${e.key}]`):this.editor.insertContent(e.val||"")}}))})),this.emoticons.length>1&&(this.$grpSwitcher=u('
          '),this.$panel.append(this.$grpSwitcher),this.emoticons.forEach(((t,e)=>{const n=u("");n.innerText=t.name,n.setAttribute("data-index",String(e)),n.onclick=()=>this.openGrp(e),this.$grpSwitcher.append(n)}))),this.emoticons.length>0&&this.openGrp(0)}openGrp(t){var e,n,i;Array.from(this.$grpWrap.children).forEach((e=>{const n=e;n.getAttribute("data-index")!==String(t)?n.style.display="none":n.style.display=""})),null==(e=this.$grpSwitcher)||e.querySelectorAll("span.active").forEach((t=>t.classList.remove("active"))),null==(i=null==(n=this.$grpSwitcher)?void 0:n.querySelector(`span[data-index="${t}"]`))||i.classList.add("active"),this.changeListHeight()}changeListHeight(){}transEmoticonImageText(t){return this.emoticons&&Array.isArray(this.emoticons)?(this.emoticons.forEach((e=>{"image"===e.type&&Object.entries(e.items).forEach((([e,n])=>{t=t.split(`:[${n.key}]`).join(``)}))})),t):t}}d(Te,"Name","emoticons");class Le extends Ee{constructor(t){super(t),d(this,"$imgUploadInput"),d(this,"allowImgExts",["png","jpg","jpeg","gif","bmp","svg","webp"]),this.$imgUploadInput=document.createElement("input"),this.$imgUploadInput.type="file",this.$imgUploadInput.style.display="none",this.$imgUploadInput.accept=this.allowImgExts.map((t=>`.${t}`)).join(",");const e=this.registerBtn(`${this.ctx.$t("image")}`);e.after(this.$imgUploadInput),e.onclick=()=>{const t=this.$imgUploadInput;t.onchange=()=>{(()=>{h(this,null,(function*(){if(!t.files||0===t.files.length)return;const e=t.files[0];this.uploadImg(e)}))})()},t.click()},this.ctx.conf.imgUpload||this.getBtn().setAttribute("atk-only-admin-show","");const n=t=>{if(t)for(let e=0;e{t.stopPropagation(),t.preventDefault()})),this.editor.getUI().$textarea.addEventListener("drop",(t=>{var e;const i=null==(e=t.dataTransfer)?void 0:e.files;(null==i?void 0:i.length)&&(t.preventDefault(),n(i))})),this.editor.getUI().$textarea.addEventListener("paste",(t=>{var e;const i=null==(e=t.clipboardData)?void 0:e.files;(null==i?void 0:i.length)&&(t.preventDefault(),n(i))}))}uploadImg(t){return h(this,null,(function*(){const e=/[^.]+$/.exec(t.name);if(!e||!this.allowImgExts.includes(e[0]))return;if(!_t.checkHasBasicUserInfo())return void this.editor.showNotify(this.ctx.$t("uploadLoginMsg"),"w");let n="\n";""===this.editor.getUI().$textarea.value.trim()&&(n="");const i=`${n}![](Uploading ${t.name}...)`;let s;this.editor.insertContent(i);try{s=this.ctx.conf.imgUploader?{img_url:yield this.ctx.conf.imgUploader(t)}:yield this.ctx.getApi().upload.imgUpload(t)}catch(a){console.error(a),this.editor.showNotify(`${this.ctx.$t("uploadFail")},${a.msg}`,"e")}if(s&&s.img_url){let t=s.img_url;v(t)||(t=k(this.ctx,t)),this.editor.setContent(this.editor.getUI().$textarea.value.replace(i,`${n}![](${t})`))}else this.editor.setContent(this.editor.getUI().$textarea.value.replace(i,""))}))}}d(Le,"Name","upload");class Ae extends Ee{constructor(t){super(t),d(this,"isBind",!1),this.registerPanel('
          ');let e=this.editor.$t("preview");this.ctx.getMarkedInstance()&&(e+=' '),this.registerBtn(e),this.registerContentUpdatedEvt((t=>{this.updateContent()}))}onPanelShow(){if(this.updateContent(),!this.isBind){const t=()=>{this.updateContent()};this.editor.getUI().$textarea.addEventListener("input",t),this.editor.getUI().$textarea.addEventListener("change",t),this.isBind=!0}}updateContent(){"none"!==this.$panel.style.display&&(this.$panel.innerHTML=this.editor.getContentMarked())}}d(Ae,"Name","preview");class Me extends Ee{constructor(t){super(t),d(this,"queryUserInfo",{timeout:null,abortFunc:null}),this.registerHeaderInputEvt(((t,e)=>{"nick"!==t&&"email"!==t||this.fetchUserInfo()})),this.editor.getUI().$link.addEventListener("change",(()=>{const t=this.editor.getUI().$link.value.trim();t&&!/^(http|https):\/\//.test(t)&&(this.editor.getUI().$link.value=`https://${t}`,_t.update({link:this.editor.getUI().$link.value}))}))}fetchUserInfo(){_t.logout(),this.queryUserInfo.timeout&&window.clearTimeout(this.queryUserInfo.timeout),this.queryUserInfo.abortFunc&&this.queryUserInfo.abortFunc(),this.queryUserInfo.timeout=window.setTimeout((()=>{this.queryUserInfo.timeout=null;const{req:t,abort:e}=this.ctx.getApi().user.userGet(_t.data.nick,_t.data.email);this.queryUserInfo.abortFunc=e,t.then((t=>{var e;t.is_login||_t.logout(),this.ctx.updateNotifies(t.unread),_t.checkHasBasicUserInfo()&&!t.is_login&&(null==(e=t.user)?void 0:e.is_admin)&&this.showLoginDialog(),t.user&&t.user.link&&(this.editor.getUI().$link.value=t.user.link,_t.update({link:t.user.link}))})).catch((()=>{})).finally((()=>{this.queryUserInfo.abortFunc=null}))}),400)}showLoginDialog(){this.ctx.checkAdmin({onSuccess:()=>{}})}}d(Me,"Name","headerInput");const Oe=[Te,Le,Ae,Me];function _e(t){const e={editor:t,plugList:{},openedPlugName:null,openPlugPanel:t=>Be(e,t),closePlugPanel:()=>Pe(e),triggerHeaderInputEvt:(t,n)=>function(t,e,n){Object.entries(t.plugList).forEach((([t,i])=>{i.onHeaderInput&&i.onHeaderInput(e,n)}))}(e,t,n),triggerContentUpdatedEvt:t=>function(t,e){Object.entries(t.plugList).forEach((([t,n])=>{n.onContentUpdated&&n.onContentUpdated(e)}))}(e,t),getTransformedContent:t=>function(t,e){let n=e;return Object.entries(t.plugList).forEach((([t,e])=>{e.contentTransformer&&(n=e.contentTransformer(n))})),n}(e,t)};t.getUI().$plugPanelWrap.innerHTML="",t.getUI().$plugPanelWrap.style.display="none",t.getUI().$plugBtnWrap.innerHTML="";const n=[{k:"upload",v:(i=t.conf).imgUpload},{k:"emoticons",v:i.emoticons},{k:"preview",v:i.preview}].filter((t=>!t.v)).flatMap((t=>t.k));var i;return Oe.filter((t=>!n.includes(t.Name))).forEach((t=>{!function(t,e){const n=e.Name,i=new e(t.editor);t.plugList[n]=i,function(t,e,n){const i=n.getBtn();if(!i)return;t.editor.getUI().$plugBtnWrap.appendChild(i),i.onclick=i.onclick||(()=>{t.editor.getUI().$plugBtnWrap.querySelectorAll(".active").forEach((t=>t.classList.remove("active"))),e!==t.openedPlugName?(Be(t,e),i.classList.add("active")):Pe(t)});const s=n.getPanel();s&&(s.setAttribute("data-plug-name",e),s.style.display="none",t.editor.getUI().$plugPanelWrap.appendChild(s))}(t,n,i)}(e,t)})),e}function Be(t,e){Object.entries(t.plugList).forEach((([t,n])=>{const i=n.getPanel();i&&(t===e?(i.style.display="",n.onPanelShow&&n.onPanelShow()):(i.style.display="none",n.onPanelHide&&n.onPanelHide()))})),t.editor.getUI().$plugPanelWrap.style.display="",t.openedPlugName=e}function Pe(t){if(!t.openedPlugName)return;const e=t.plugList[t.openedPlugName];e&&(e.onPanelHide&&e.onPanelHide(),t.editor.getUI().$plugPanelWrap.style.display="none",t.openedPlugName=null)}function Re(t){const e={editor:t,comment:void 0,setReply:(t,n,i)=>function(t,e,n,i=!0){t.editor.cancelEditComment(),Ie(t);const s=t.editor.getUI();s.$sendReply||(s.$sendReply=u(`
          ${t.editor.$t("reply")} ×
          `),s.$sendReply.querySelector(".atk-text").innerText=`@${e.nick}`,s.$sendReply.addEventListener("click",(()=>{t.editor.cancelReply()})),s.$textareaWrap.append(s.$sendReply));t.comment=e,t.editor.travel(n),i&&S(s.$el);s.$textarea.focus()}(e,t,n,i),cancelReply:()=>Ie(e)};return e}function Ie(t){if(!t.comment)return;const e=t.editor.getUI();e.$sendReply&&(e.$sendReply.remove(),e.$sendReply=void 0),t.comment=void 0,t.editor.travelBack()}function Ue(t){const e={editor:t,comment:void 0,setEdit:(t,n)=>function(t,e,n){De(t),t.editor.cancelReply();const i=t.editor.getUI();if(!i.$editCancelBtn){const e=u(`
          ${t.editor.$t("editCancel")} ×
          `);e.onclick=()=>{De(t)},i.$textareaWrap.append(e),i.$editCancelBtn=e}t.comment=e,i.$header.style.display="none",t.editor.travel(n),i.$nick.value=e.nick||"",i.$email.value=e.email||"",i.$link.value=e.link||"",t.editor.setContent(e.content),i.$textarea.focus(),t.editor.refreshSendBtnText()}(e,t,n),cancelEdit:()=>De(e)};return function(t){t.editor.getSubmitManager().registerCustom({activeCond:()=>!!t.comment,req:()=>h(this,null,(function*(){const e={content:t.editor.getFinalContent(),nick:t.editor.getUI().$nick.value,email:t.editor.getUI().$email.value,link:t.editor.getUI().$link.value};return yield t.editor.ctx.getApi().comment.commentEdit(l(l({},t.comment),e))})),post:e=>{t.editor.ctx.updateComment(e)}})}(e),e}function De(t){if(!t.comment)return;const e=t.editor.getUI();e.$editCancelBtn&&(e.$editCancelBtn.remove(),e.$editCancelBtn=void 0),t.comment=void 0,t.editor.travelBack();const{nick:n,email:i,link:s}=_t.data;e.$nick.value=n,e.$email.value=i,e.$link.value=s,t.editor.setContent(""),t.editor.refreshSendBtnText(),e.$header.style.display=""}function qe(t){const e={editor:t,do:()=>function(t){return h(this,null,(function*(){if(""===t.editor.getFinalContent().trim())return void t.editor.focus();const e=t.customs.find((t=>t.activeCond()));t.editor.ctx.trigger("editor-submit"),t.editor.showLoading();try{let n;(null==e?void 0:e.pre)&&e.pre(),n=(null==e?void 0:e.req)?yield e.req():yield function(t){return h(this,null,(function*(){const e=yield t.editor.ctx.getApi().comment.add(l({},function(t){var e;const{nick:n,email:i,link:s}=_t.data,a=t.editor.ctx.conf,r=null==(e=t.editor.getReplyManager())?void 0:e.comment;return{content:t.editor.getFinalContent(),nick:n,email:i,link:s,rid:r?r.id:0,page_key:r?r.page_key:a.pageKey,page_title:r?void 0:a.pageTitle,site_name:r?r.site_name:a.site}}(t)));return e}))}(t),(null==e?void 0:e.post)?e.post(n):function(t,e){const n=t.editor.getReplyManager(),i=t.editor.ctx.conf;(null==n?void 0:n.comment)&&n.comment.page_key!==i.pageKey&&window.open(`${n.comment.page_url}#atk-comment-${e.id}`);t.editor.ctx.insertComment(e)}(t,n)}catch(n){return console.error(n),void t.editor.showNotify(`${t.editor.$t("commentFail")},${n.msg||String(n)}`,"e")}finally{t.editor.hideLoading()}t.editor.reset(),t.editor.ctx.trigger("editor-submitted")}))}(e),customs:[],registerCustom:t=>{e.customs.push(t)}};return e}const We={localStorage:function(t){const e=window.localStorage.getItem("ArtalkContent")||"";""!==e.trim()&&(t.showNotify(t.$t("restoredMsg"),"i"),t.setContent(e));t.getUI().$textarea.addEventListener("input",(()=>t.saveToLocalStorage()))},header:function(t){const e=t.getHeaderInputEls();Object.entries(e).forEach((([e,n])=>{n.value=_t.data[e]||"",n.addEventListener("input",(()=>function(t,e,n){var i;if(t.isEditMode)return;_t.update({[e]:n.value.trim()}),null==(i=t.getPlugs())||i.triggerHeaderInputEvt(e,n)}(t,e,n))),n.placeholder=`${t.$t(e)}`}))},textarea:function(t){t.getUI().$textarea.placeholder=t.ctx.conf.placeholder||t.$t("placeholder"),t.getUI().$textarea.addEventListener("keydown",(e=>{9===(e.keyCode||e.which)&&(e.preventDefault(),t.insertContent("\t"))})),t.getUI().$textarea.addEventListener("input",(()=>{t.adjustTextareaHeight()}))},submitBtn:function(t){t.refreshSendBtnText(),t.getUI().$submitBtn.addEventListener("click",(()=>t.submit()))},submitManager:function(t){t.setSubmitManager(qe(t))},plugs:function(t){t.setPlugs(_e(t))},mover:function(t){if(!t.conf.editorTravel)return;t.setMover(Se(t))},replyManager:function(t){t.setReplyManager(Re(t))},editModeManager:function(t){t.setEditModeManager(Ue(t))}};const Fe={$header:".atk-header",$nick:'.atk-header [name="nick"]',$email:'.atk-header [name="email"]',$link:'.atk-header [name="link"]',$textareaWrap:".atk-textarea-wrap",$textarea:".atk-textarea",$bottom:".atk-bottom",$submitBtn:".atk-send-btn",$notifyWrap:".atk-notify-wrap",$plugBtnWrap:".atk-plug-btn-wrap",$plugPanelWrap:".atk-plug-panel-wrap"};class He extends w{constructor(t){super(t),d(this,"ui"),d(this,"plugs"),d(this,"mover"),d(this,"reply"),d(this,"editMode"),d(this,"submitManager"),this.ui=function(){const t=u('
          \n
          \n \n \n \n
          \n
          \n \n
          \n \n
          \n
          \n
          \n \n
          \n
          \n
          \n
          \n'),e={$el:t};return Object.entries(Fe).forEach((([n,i])=>{e[n]=t.querySelector(i)})),e}(),this.$el=this.ui.$el,this.ctx.on("conf-loaded",(()=>{var t;t=this,Object.entries(We).forEach((([e,n])=>{n(t)}))}))}getUI(){return this.ui}getPlugs(){return this.plugs}setPlugs(t){this.plugs=t}setMover(t){this.mover=t}setReplyManager(t){this.reply=t}getReplyManager(){return this.reply}get isReplyMode(){var t;return!!(null==(t=this.reply)?void 0:t.comment)}setEditModeManager(t){this.editMode=t}get isEditMode(){var t;return!!(null==(t=this.editMode)?void 0:t.comment)}setSubmitManager(t){this.submitManager=t}getSubmitManager(){return this.submitManager}getHeaderInputEls(){return{nick:this.ui.$nick,email:this.ui.$email,link:this.ui.$link}}saveToLocalStorage(){window.localStorage.setItem("ArtalkContent",this.getContentOriginal().trim())}refreshSendBtnText(){this.isEditMode?this.ui.$submitBtn.innerText=this.$t("save"):this.ui.$submitBtn.innerText=this.ctx.conf.sendBtn||this.$t("send")}getFinalContent(){let t=this.getContentOriginal();return this.plugs&&(t=this.plugs.getTransformedContent(t)),t}getContentOriginal(){return this.ui.$textarea.value||""}getContentMarked(){return wt(this.ctx,this.getFinalContent())}setContent(t){this.ui.$textarea.value=t,this.saveToLocalStorage(),this.plugs&&this.plugs.triggerContentUpdatedEvt(t),window.setTimeout((()=>{this.adjustTextareaHeight()}),80)}insertContent(t){if(document.selection)this.ui.$textarea.focus(),document.selection.createRange().text=t,this.ui.$textarea.focus();else if(this.ui.$textarea.selectionStart||0===this.ui.$textarea.selectionStart){const e=this.ui.$textarea.selectionStart,n=this.ui.$textarea.selectionEnd,i=this.ui.$textarea.scrollTop;this.setContent(this.ui.$textarea.value.substring(0,e)+t+this.ui.$textarea.value.substring(n,this.ui.$textarea.value.length)),this.ui.$textarea.focus(),this.ui.$textarea.selectionStart=e+t.length,this.ui.$textarea.selectionEnd=e+t.length,this.ui.$textarea.scrollTop=i}else this.ui.$textarea.focus(),this.ui.$textarea.value+=t}adjustTextareaHeight(){const t=this.ui.$textarea.offsetHeight-this.ui.$textarea.clientHeight;this.ui.$textarea.style.height="0px",this.ui.$textarea.style.height=`${this.ui.$textarea.scrollHeight+t}px`}focus(){this.ui.$textarea.focus()}reset(){this.setContent(""),this.cancelReply(),this.cancelEditComment()}setReply(t,e,n=!0){var i;null==(i=this.reply)||i.setReply(t,e,n)}cancelReply(){var t;null==(t=this.reply)||t.cancelReply()}setEditComment(t,e){var n;null==(n=this.editMode)||n.setEdit(t,e)}cancelEditComment(){var t;null==(t=this.editMode)||t.cancelEdit()}showNotify(t,e){E(this.ui.$notifyWrap,t,e)}showLoading(){x(this.ui.$el)}hideLoading(){C(this.ui.$el)}submit(){return h(this,null,(function*(){this.submitManager&&(yield this.submitManager.do())}))}close(){this.ui.$textareaWrap.querySelector(".atk-comment-closed")||this.ui.$textareaWrap.prepend(u(`
          ${this.$t("onlyAdminCanReply")}
          `)),_t.data.isAdmin?(this.ui.$textarea.style.display="",this.ui.$bottom.style.display=""):(this.ui.$textarea.style.display="none",this.closePlugPanel(),this.ui.$bottom.style.display="none")}open(){var t;null==(t=this.ui.$textareaWrap.querySelector(".atk-comment-closed"))||t.remove(),this.ui.$textarea.style.display="",this.ui.$bottom.style.display=""}travel(t){var e;null==(e=this.mover)||e.move(t)}travelBack(){var t;null==(t=this.mover)||t.back()}openPlugPanel(t){var e;null==(e=this.plugs)||e.openPlugPanel(t)}closePlugPanel(){var t;null==(t=this.plugs)||t.closePlugPanel()}}class Ne extends w{constructor(t){super(t),d(this,"layer"),d(this,"$header"),d(this,"$closeBtn"),d(this,"$iframeWrap"),d(this,"$iframe"),d(this,"firstShow",!0),this.$el=u('
          \n
          \n
          \n
          \n
          \n
          \n
          \n
          \n'),this.$header=this.$el.querySelector(".atk-sidebar-header"),this.$closeBtn=this.$header.querySelector(".atk-sidebar-close"),this.$iframeWrap=this.$el.querySelector(".atk-sidebar-iframe-wrap"),this.$closeBtn.onclick=()=>{this.hide()},this.ctx.on("user-changed",(()=>{this.firstShow=!0}))}show(){return h(this,arguments,(function*(t={}){if(this.$el.style.transform="",null==this.layer&&(this.layer=new M(this.ctx,"sidebar",this.$el),this.layer.afterHide=()=>{!0===this.ctx.conf.editorTravel&&this.ctx.editorTravelBack()}),this.layer.show(),(()=>{h(this,null,(function*(){var e;const n=yield this.ctx.getApi().user.loginStatus();n.is_admin&&!n.is_login&&(null==(e=this.layer)||e.hide(),this.firstShow=!0,this.ctx.checkAdmin({onSuccess:()=>{setTimeout((()=>{this.show(t)}),500)},onCancel:()=>{}}))}))})(),this.firstShow){this.$iframeWrap.innerHTML="",this.$iframe=u("");const e=k(this.ctx,"/sidebar/"),n={pageKey:this.conf.pageKey,site:this.conf.site||"",user:JSON.stringify(_t.data),time:+new Date};t.view&&(n.view=t.view),this.conf.darkMode&&(n.darkMode="1"),"string"==typeof this.conf.locale&&(n.locale=this.conf.locale);const i=new URLSearchParams(n);this.iframeLoad(`${e}?${i.toString()}`),this.$iframeWrap.append(this.$iframe),this.firstShow=!1}else{const t=this.$iframe.src.includes("darkMode=1");this.conf.darkMode&&!t&&this.iframeLoad(`${this.$iframe.src}&darkMode=1`),!this.conf.darkMode&&t&&this.iframeLoad(this.$iframe.src.replace("&darkMode=1",""))}setTimeout((()=>{this.$el.style.transform="translate(0, 0)"}),100),setTimeout((()=>{this.ctx.updateNotifies([])}),0),this.ctx.trigger("sidebar-show")}))}hide(){var t;this.$el.style.transform="",null==(t=this.layer)||t.hide(),this.ctx.trigger("sidebar-hide")}iframeLoad(t){this.$iframe&&(this.$iframe.src=t,x(this.$iframeWrap),this.$iframe.onload=()=>{C(this.$iframeWrap)})}}const je={i18n(t){At(t.conf.locale),t.on("conf-loaded",(()=>{At(t.conf.locale)}))},markdown(){!function(){try{if(!t.marked.name)return}catch(s){return}const e=new t.marked.Renderer,n=e.link;e.link=(t,i,s)=>{const a=null==t?void 0:t.startsWith(`${window.location.protocol}//${window.location.hostname}`);return n.call(e,t,i,s).replace(/^{const n=e||"plaintext";let i=t;return window.hljs?n&&window.hljs.getLanguage(n)&&(i=window.hljs.highlight(n,t).value):i=vt(t),`
          \n${i.replace(/&/g,"&")}\n
          `};const i=t.marked;t.marked.setOptions({renderer:e,pedantic:!1,gfm:!0,breaks:!0,smartLists:!0,smartypants:!0,xhtml:!1,sanitize:!1,silent:!0}),kt=i}()},user:t=>(_t.setContext(t),_t),api:t=>new Ce(t),checkerLauncher:t=>new ve(t),editor(t){const e=new He(t);return t.$root.appendChild(e.$el),e},list(t){const e=new pe(t);return t.$root.appendChild(e.$el),e.fetchComments(0),e},layer(t){M.BodyOrgOverflow=document.body.style.overflow,M.BodyOrgPaddingRight=document.body.style.paddingRight},sidebarLayer:t=>new Ne(t),eventsDefault(t){window.addEventListener("hashchange",(()=>{t.listHashGotoCheck()})),t.on("user-changed",(()=>{t.checkAdminShowEl(),t.listRefreshUI()}))},darkMode(t){P(t),t.on("conf-loaded",(()=>{P(t)}))}};function ze(t){return h(this,null,(function*(){const e=t.ctx.conf.countEl;e&&document.querySelector(e)&&Ve(t,{api:"page_comment",countEl:e});const n=t.pvAdd?yield t.ctx.getApi().page.pv():void 0,i=t.ctx.conf.pvEl;i&&document.querySelector(i)&&Ve(t,{api:"page_pv",countEl:i,curtPageCount:n})}))}function Ve(t,e){return h(this,null,(function*(){let n={};const i=t.ctx.conf.pageKey;e.curtPageCount&&(n[i]=e.curtPageCount);let s=Array.from(document.querySelectorAll(e.countEl)).map((t=>t.getAttribute("data-page-key")||i)).filter((t=>void 0===n[t]));if(s=[...new Set(s)],s.length>0){const i=yield t.ctx.getApi().page.stat(e.api,s);n=l(l({},n),i)}document.querySelectorAll(e.countEl).forEach((t=>{const e=t.getAttribute("data-page-key")||i;t.innerHTML=`${Number(n[e]||0)}`}))}))}const Qe=class t{constructor(e){d(this,"conf"),d(this,"ctx"),d(this,"$root"),t.instance&&t.destroy(),this.conf=de(e),this.conf.el instanceof HTMLElement&&(this.$root=this.conf.el),this.ctx=new me(this.conf,this.$root),Object.entries(je).forEach((([e,n])=>{if(t.DisabledComponents.includes(e))return;const i=n(this.ctx);i&&this.ctx.inject(e,i)})),t.plugins.forEach((t=>{"function"==typeof t&&t(this.ctx)}))}static init(e){return this.instance&&t.destroy(),this.instance=new t(e),this.instance}use(e){t.plugins.push(e),"function"==typeof e&&e(this.ctx)}update(e){if(!t.instance)throw Error("cannot call `update` function before call `load`");return t.instance.ctx.updateConf(e),t.instance}reload(){this.ctx.listReload()}destroy(){if(!t.instance)throw Error("cannot call `destroy` function before call `load`");t.instance.$root.remove(),delete t.instance}on(t,e){this.ctx.on(t,e,"external")}off(t,e){this.ctx.off(t,e,"external")}trigger(t,e){this.ctx.trigger(t,e,"external")}setDarkMode(t){this.ctx.setDarkMode(t)}static use(t){this.plugins.push(t),this.instance&&"function"==typeof t&&t(this.instance.ctx)}static update(t){var e;return null==(e=this.instance)?void 0:e.update(t)}static reload(){var t;null==(t=this.instance)||t.reload()}static destroy(){var t;null==(t=this.instance)||t.destroy()}static on(t,e){var n;null==(n=this.instance)||n.on(t,e)}static off(t,e){var n;null==(n=this.instance)||n.off(t,e)}static trigger(t,e){var n;null==(n=this.instance)||n.trigger(t,e)}static setDarkMode(t){var e;null==(e=this.instance)||e.setDarkMode(t)}static loadCountWidget(t){const e=new me(de(t));e.inject("api",new Ce(e)),ze({ctx:e,pvAdd:!1})}static LoadCountWidget(t){console.warn("The method `LoadCountWidget` is deprecated, please use `loadCountWidget` instead."),this.loadCountWidget(t)}};return d(Qe,"instance"),d(Qe,"ListLite",ue),d(Qe,"defaults",ce),d(Qe,"plugins",[t=>{t.conf.useBackendConf?t.on("list-loaded",(()=>{ze({ctx:t,pvAdd:!0})})):ze({ctx:t,pvAdd:!0})}]),d(Qe,"DisabledComponents",[]),Qe})); +!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e(require("marked")):"function"==typeof define&&define.amd?define(["marked"],e):(t="undefined"!=typeof globalThis?globalThis:t||self).Artalk=e(t.marked)}(this,(function(t){"use strict";var e=Object.defineProperty,n=Object.defineProperties,i=Object.getOwnPropertyDescriptors,s=Object.getOwnPropertySymbols,a=Object.prototype.hasOwnProperty,r=Object.prototype.propertyIsEnumerable,o=(t,n,i)=>n in t?e(t,n,{enumerable:!0,configurable:!0,writable:!0,value:i}):t[n]=i,l=(t,e)=>{for(var n in e||(e={}))a.call(e,n)&&o(t,n,e[n]);if(s)for(var n of s(e))r.call(e,n)&&o(t,n,e[n]);return t},c=(t,e)=>n(t,i(e)),d=(t,e,n)=>(o(t,"symbol"!=typeof e?e+"":e,n),n),h=(t,e,n)=>new Promise(((i,s)=>{var a=t=>{try{o(n.next(t))}catch(e){s(e)}},r=t=>{try{o(n.throw(t))}catch(e){s(e)}},o=t=>t.done?i(t.value):Promise.resolve(t.value).then(a,r);o((n=n.apply(t,e)).next())}));function u(t=""){const e=document.createElement("div");return e.innerHTML=t.trim(),e.firstElementChild||e}function p(t){return parseFloat(getComputedStyle(t,null).height.replace("px",""))}function m(t){const e=RegExp(`[?&]${t}=([^&]*)`).exec(window.location.search);return e&&decodeURIComponent(e[1].replace(/\+/g," "))}function g(t){const e=t.getBoundingClientRect();return{top:e.top+window.scrollY,left:e.left+window.scrollX}}function f(t,e){let n=t.toString();for(;n.length=13?t.replace(/Windows NT 10.0/,"Windows NT 11.0"):"macOS"===e.platform&&i>=11?t.replace(/(Mac OS X \d+_\d+_\d+|Mac OS X)/,`Mac OS X ${n.platformVersion.replace(/\./g,"_")}`):t}))}function v(t){let e;try{e=new URL(t)}catch(n){return!1}return"http:"===e.protocol||"https:"===e.protocol}function k(t,e){return function(t,e){return`${t.replace(/\/$/,"")}/${e.replace(/^\//,"")}`}(t.conf.server,e)}function b(t,e){const n=t=>t&&"object"==typeof t;return n(t)&&n(e)?(Object.keys(e).forEach((i=>{const s=t[i],a=e[i];Array.isArray(s)&&Array.isArray(a)?t[i]=s.concat(a):n(s)&&n(a)?t[i]=b(l({},s),a):t[i]=a})),t):e}class w{constructor(t){d(this,"$el"),d(this,"ctx"),d(this,"conf"),this.ctx=t,this.conf=t.conf}$t(t,e={}){return this.ctx.$t(t,e)}}function x(t,e){let n=t.querySelector(":scope > .atk-loading");n||(n=u(''),(null==e?void 0:e.transparentBg)&&(n.style.background="transparent"),t.appendChild(n)),n.style.display="";const i=n.querySelector(".atk-loading-spinner");i&&(i.style.display="none",window.setTimeout((()=>{i.style.display=""}),500))}function C(t){const e=t.querySelector(":scope > .atk-loading");e&&(e.style.display="none")}function S(t,e=!0){const n=g(t).top+p(t)/2-document.documentElement.clientHeight/2;e?window.scroll({top:n>0?n:0,left:0}):window.scroll(0,n>0?n:0)}function E(t,e,n){const i=u(`
          `);i.querySelector(".atk-notify-content").innerHTML=function(t){const e=document.createElement("div");return e.innerText=t,e.innerHTML}(e).replace("\n","
          "),t.appendChild(i);const s=()=>{i.classList.add("atk-fade-out"),setTimeout((()=>{i.remove()}),200)};let a;a=window.setTimeout((()=>{s()}),3e3),i.addEventListener("click",(()=>{s(),window.clearTimeout(a)}))}function T(t,e){!function(t,e,n="in"){t.classList.add(`atk-fade-${n}`);const i=()=>{t.classList.remove(`atk-fade-${n}`),t.removeEventListener("animationend",i),e&&e()};t.addEventListener("animationend",i)}(t,e,"in")}function L(t,e,n='Artalk Error'){let i=t.querySelector(".atk-error-layer");if(null===e)return void(null!==i&&i.remove());i||(i=u(`
          ${n}
          `),t.appendChild(i));const s=i.querySelector(".atk-error-text");s.innerHTML="",null!==e&&(e instanceof HTMLElement?s.appendChild(e):s.innerText=e)}const A=class t extends w{constructor(t,e,n){super(t),d(this,"name"),d(this,"$wrap"),d(this,"$mask"),d(this,"maskClickHideEnable",!0),d(this,"afterHide"),this.name=e;const{$wrap:i,$mask:s}=M();this.$wrap=i,this.$mask=s,this.$el=this.$wrap.querySelector(`[data-layer-name="${e}"].atk-layer-item`),null===this.$el&&(n?this.$el=n:(this.$el=u(),this.$el.classList.add("atk-layer-item"))),this.$el.setAttribute("data-layer-name",e),this.$el.style.display="none",this.$wrap.append(this.$el)}getName(){return this.name}getWrapEl(){return this.$wrap}getEl(){return this.$el}show(){this.fireAllActionTimer(),this.$wrap.style.display="block",this.$mask.style.display="block",this.$mask.classList.add("atk-fade-in"),this.$el.style.display="",this.$mask.onclick=()=>{this.maskClickHideEnable&&this.hide()},this.pageBodyScrollBarHide()}hide(){this.afterHide&&this.afterHide(),this.$wrap.classList.add("atk-fade-out"),this.$el.style.display="none",this.pageBodyScrollBarShow(),this.newActionTimer((()=>{this.$wrap.style.display="none",this.checkCleanLayer()}),450),this.newActionTimer((()=>{this.$wrap.style.display="none",this.$wrap.classList.remove("atk-fade-out")}),200)}setMaskClickHide(t){this.maskClickHideEnable=t}pageBodyScrollBarHide(){document.body.style.overflow="hidden";const t=parseInt(window.getComputedStyle(document.body,null).getPropertyValue("padding-right"),10);document.body.style.paddingRight=`${function(){const t=document.createElement("p");t.style.width="100%",t.style.height="200px";const e=document.createElement("div");e.style.position="absolute",e.style.top="0px",e.style.left="0px",e.style.visibility="hidden",e.style.width="200px",e.style.height="150px",e.style.overflow="hidden",e.appendChild(t),document.body.appendChild(e);const n=t.offsetWidth;e.style.overflow="scroll";let i=t.offsetWidth;return n===i&&(i=e.clientWidth),document.body.removeChild(e),n-i}()+t||0}px`}pageBodyScrollBarShow(){document.body.style.overflow=t.BodyOrgOverflow,document.body.style.paddingRight=t.BodyOrgPaddingRight}newActionTimer(e,n){const i=()=>{e(),t.actionTimers=t.actionTimers.filter((t=>t.act!==i))},s=window.setTimeout((()=>i()),n);t.actionTimers.push({act:i,tid:s})}fireAllActionTimer(){t.actionTimers.forEach((t=>{clearTimeout(t.tid),t.act()}))}disposeNow(){this.$el.remove(),this.pageBodyScrollBarShow(),this.checkCleanLayer()}dispose(){this.hide(),this.$el.remove(),this.checkCleanLayer()}checkCleanLayer(){0===this.getWrapEl().querySelectorAll(".atk-layer-item").length&&(this.$wrap.style.display="none")}};d(A,"BodyOrgOverflow"),d(A,"BodyOrgPaddingRight"),d(A,"actionTimers",[]);let O=A;function M(){let t=document.querySelector(".atk-layer-wrap");t||(t=u(''),document.body.appendChild(t));const e=t.querySelector(".atk-layer-mask");return{$wrap:t,$mask:e}}const _=window.matchMedia("(prefers-color-scheme: dark)");let B;function P(t){R(t,t.conf.darkMode,!1)}function R(t,e,n=!0){const i=e=>{!function(t,e){e?t.$root.classList.add(I):t.$root.classList.remove(I);const{$wrap:n}=M();n&&(e?n.classList.add(I):n.classList.remove(I))}(t,e),n&&function(t,e){t.conf.darkMode=e}(t,e)};"auto"===e?(B||(B=t=>i(t.matches),_.addEventListener("change",B)),i(_.matches)):(B&&_.removeEventListener("change",B),i(e))}const I="atk-dark-mode";var U="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function D(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var q={"&":"&","<":"<",">":">",'"':""","'":"'"},W={"&":"&","<":"<",">":">",""":'"',"'":"'"},F=/(&|<|>|"|')/g,H=/[&<>"']/g;function N(t){return q[t]}function j(t){return W[t]}function z(t){return null==t?"":String(t).replace(H,N)}function V(t){return null==t?"":String(t).replace(F,j)}z.options=V.options={};var Q={encode:z,escape:z,decode:V,unescape:V,version:"1.0.0-browser"};var G=function t(e){for(var n,i,s=Array.prototype.slice.call(arguments,1);s.length;)for(i in n=s.shift())n.hasOwnProperty(i)&&("[object Object]"===Object.prototype.toString.call(e[i])?e[i]=t(e[i],n[i]):e[i]=n[i]);return e},K=function(t){return"string"==typeof t?t.toLowerCase():t};function Y(t,e){return t[e]=!0,t}var X=function(t){return t.reduce(Y,{})},J={uris:X(["background","base","cite","href","longdesc","src","usemap"])},Z={voids:X(["area","br","col","hr","img","wbr","input","base","basefont","link","meta"])},tt=Q,et=K,nt=Z,it=/^<\s*([\w:-]+)((?:\s+[\w:-]+(?:\s*=\s*(?:(?:"[^"]*")|(?:'[^']*')|[^>\s]+))?)*)\s*(\/?)\s*>/,st=/^<\s*\/\s*([\w:-]+)[^>]*>/,at=/([\w:-]+)(?:\s*=\s*(?:(?:"((?:[^"])*)")|(?:'((?:[^'])*)')|([^>\s]+)))?/g,rt=/^=0&&(e.comment&&e.comment(t.substring(4,i)),t=t.substring(i+3),n=!1):ot.test(t)?r(st,l):rt.test(t)&&r(it,o);var i;!function(){if(!n)return;var i,s=t.indexOf("<");s>=0?(i=t.substring(0,s),t=t.substring(s)):(i=t,t="");e.chars&&e.chars(i)}()}();var i=t===s;s=t,i&&(t="")}function r(e,i){var s=t.match(e);s&&(t=t.substring(s[0].length),s[0].replace(e,i),n=!1)}function o(t,n,s,a){var r={},o=et(n),l=nt.voids[o]||!!a;s.replace(at,(function(t,e,n,i,s){r[e]=void 0===n&&void 0===i&&void 0===s?void 0:tt.decode(n||i||s||"")})),l||i.push(o),e.start&&e.start(o,r,l)}function l(t,n){var s,a=0,r=et(n);if(r)for(a=i.length-1;a>=0&&i[a]!==r;a--);if(a>=0){for(s=i.length-1;s>=a;s--)e.end&&e.end(i[s]);i.length=a}}l()},mt=function(t,e){var n,i=e||{};return o(),{start:function(t,e,r){var o=ct(t);if(n.ignoring)return void a(o);if(-1===(i.allowedTags||[]).indexOf(o))return void a(o);if(i.filter&&!i.filter({tag:o,attrs:e}))return void a(o);s("<"),s(o),Object.keys(e).forEach((function(t){var n=e[t],a=(i.allowedClasses||{})[o]||[],r=(i.allowedAttributes||{})[o]||[],l=ct(t);("class"===l&&-1===r.indexOf(l)?(n=n.split(" ").filter((function(t){return a&&-1!==a.indexOf(t)})).join(" ").trim()).length:-1!==r.indexOf(l)&&(!0!==dt.uris[l]||function(t){var e=t[0];if("#"===e||"/"===e)return!0;var n=t.indexOf(":");if(-1===n)return!0;var s=t.indexOf("?");if(-1!==s&&n>s)return!0;var a=t.indexOf("#");return-1!==a&&n>a||i.allowedSchemes.some(r);function r(e){return 0===t.indexOf(e+":")}}(n)))&&(s(" "),s(t),"string"==typeof n&&(s('="'),s(lt.encode(n)),s('"')))})),s(r?"/>":">")},end:function(t){var e=ct(t);-1!==(i.allowedTags||[]).indexOf(e)&&!1===n.ignoring?(s("")):r(e)},chars:function(t){!1===n.ignoring&&s(i.transformText?i.transformText(t):t)}};function s(e){t.push(e)}function a(t){ht.voids[t]||(!1===n.ignoring?n={ignoring:t,depth:1}:n.ignoring===t&&n.depth++)}function r(t){n.ignoring===t&&--n.depth<=0&&o()}function o(){n={ignoring:!1,depth:0}}},gt={allowedAttributes:{a:["href","name","target","title","aria-label"],iframe:["allowfullscreen","frameborder","src"],img:["src","alt","title","aria-label"]},allowedClasses:{},allowedSchemes:["http","https","mailto"],allowedTags:["a","abbr","article","b","blockquote","br","caption","code","del","details","div","em","h1","h2","h3","h4","h5","h6","hr","i","img","ins","kbd","li","main","mark","ol","p","pre","section","span","strike","strong","sub","summary","sup","table","tbody","td","th","thead","tr","u","ul"],filter:null};function ft(t,e,n){var i=[],s=!0===n?e:ut({},gt,e),a=mt(i,s);return pt(t,a),i.join("")}ft.defaults=gt;const yt=D(ft);var $t={exports:{}};$t.exports=function(){function t(t,e){return t(e={exports:{}},e.exports),e.exports}var e=t((function(t){var e=t.exports=function(){return new RegExp("(?:"+e.line().source+")|(?:"+e.block().source+")","gm")};e.line=function(){return/(?:^|\s)\/\/(.+?)$/gm},e.block=function(){return/\/\*([\S\s]*?)\*\//gm}})),n=["23AC69","91C132","F19726","E8552D","1AAB8E","E1147F","2980C1","1BA1E6","9FA0A0","F19726","E30B20","E30B20","A3338B"];function i(t){return''+t+""}return function(t,s){void 0===s&&(s={});var a=s.colors;void 0===a&&(a=n);var r=0,o={},l=new RegExp("("+/[\u4E00-\u9FFF\u3400-\u4dbf\uf900-\ufaff\u3040-\u309f\uac00-\ud7af\u0400-\u04FF]+|\w+/.source+"|"+/'+e+"
          ";return r=++r%a.length,l}))}}();const vt=D($t.exports);let kt;function bt(){return kt}function wt(t,e){var n;let i=null==(n=bt())?void 0:n.parse(e);i||(i=e.replace(/```\s*([^]+?.*?[^]+?[^]+?)```/g,((t,e)=>`
          ${vt(e)}
          `)).replace(/!\[(.*?)\]\((.*?)\)/g,((t,e,n)=>`${e}`)).replace(/\[(.*?)\]\((.*?)\)/g,((t,e,n)=>`
          ${e}`)).replace(/\n/g,"
          "));let s=yt(i,{allowedClasses:{},allowedSchemes:["http","https","mailto","data"],allowedTags:["a","abbr","article","b","blockquote","br","caption","code","del","details","div","em","h1","h2","h3","h4","h5","h6","hr","i","img","ins","kbd","li","main","mark","ol","p","pre","section","span","strike","strong","sub","summary","sup","table","tbody","td","th","thead","tr","u","ul"],allowedAttributes:{"*":["title","accesskey"],a:["href","name","target","aria-label","rel"],img:["src","alt","title","atk-emoticon","aria-label"],code:["class"],span:["class","style"]},filter:t=>([["code",/^hljs\W+language-(.*)$/],["span",/^(hljs-.*)$/]].forEach((([e,n])=>{t.tag===e&&t.attrs.class&&!n.test(t.attrs.class)&&delete t.attrs.class})),"span"===t.tag&&t.attrs.style&&!/^color:(\W+)?#[0-9a-f]{3,6};?$/i.test(t.attrs.style)&&delete t.attrs.style,!0)});return t.markedReplacers.forEach((t=>{"function"==typeof t&&(s=t(s))})),s}const xt={placeholder:"Leave a comment",noComment:"No Comment",send:"Send",save:"Save",nick:"Nickname",email:"Email",link:"Website",emoticon:"Emoji",preview:"Preview",image:"Image",uploadFail:"Upload Failed",commentFail:"Failed to comment",restoredMsg:"Content has been restored",onlyAdminCanReply:"Only admin can reply",uploadLoginMsg:"Please fill in your name and email to upload",counter:"{count} Comments",sortLatest:"Latest",sortOldest:"Oldest",sortBest:"Best",sortAuthor:"Author",openComment:"Open Comment",closeComment:"Close Comment",listLoadFailMsg:"Failed to load comments",listRetry:"Click to retry",loadMore:"Load More",admin:"Admin",reply:"Reply",voteUp:"Up",voteDown:"Down",voteFail:"Vote Failed",readMore:"Read More",actionConfirm:"Confirm",collapse:"Collapse",collapsed:"Collapsed",collapsedMsg:"This comment has been collapsed",expand:"Expand",approved:"Approved",pending:"Pending",pendingMsg:"Pending, visible only to commenter.",edit:"Edit",editCancel:"Cancel Edit",delete:"Delete",deleteConfirm:"Confirm",pin:"Pin",unpin:"Unpin",seconds:"seconds ago",minutes:"minutes ago",hours:"hours ago",days:"days ago",now:"just now",adminCheck:"Enter admin password:",captchaCheck:"Enter the CAPTCHA to continue:",confirm:"Confirm",cancel:"Cancel",msgCenter:"Messages",ctrlCenter:"Admin",frontend:"Frontend",backend:"Backend",loading:"Loading",loadFail:"Load Failed",editing:"Editing",editFail:"Edit Failed",deleting:"Deleting",deleteFail:"Delete Failed",reqGot:"Request got",reqAborted:"Request timed out or terminated unexpectedly"},Ct="ArtalkI18n",St={en:xt,"en-US":xt,"zh-CN":{placeholder:"键入内容...",noComment:"「此时无声胜有声」",send:"发送评论",save:"保存评论",nick:"昵称",email:"邮箱",link:"网址",emoticon:"表情",preview:"预览",image:"图片",uploadFail:"上传失败",commentFail:"评论失败",restoredMsg:"内容已自动恢复",onlyAdminCanReply:"仅管理员可评论",uploadLoginMsg:"填入你的名字邮箱才能上传哦",counter:"{count} 条评论",sortLatest:"最新",sortOldest:"最早",sortBest:"最热",sortAuthor:"作者",openComment:"打开评论",closeComment:"关闭评论",listLoadFailMsg:"无法获取评论列表数据",listRetry:"点击重新获取",loadMore:"加载更多",admin:"管理员",reply:"回复",voteUp:"赞同",voteDown:"反对",voteFail:"投票失败",readMore:"阅读更多",actionConfirm:"确认操作",collapse:"折叠",collapsed:"已折叠",collapsedMsg:"该评论已被系统或管理员折叠",expand:"展开",approved:"已审",pending:"待审",pendingMsg:"审核中,仅本人可见。",edit:"编辑",editCancel:"取消编辑",delete:"删除",deleteConfirm:"确认删除",pin:"置顶",unpin:"取消置顶",seconds:"秒前",minutes:"分钟前",hours:"小时前",days:"天前",now:"刚刚",adminCheck:"键入密码来验证管理员身份:",captchaCheck:"键入验证码继续:",confirm:"确认",cancel:"取消",msgCenter:"通知中心",ctrlCenter:"控制中心",frontend:"前端",backend:"后端",loading:"加载中",loadFail:"加载失败",editing:"修改中",editFail:"修改失败",deleting:"删除中",deleteFail:"删除失败",reqGot:"请求响应",reqAborted:"请求超时或意外终止"}};function Et(t){return t=t.replace(/^([a-zA-Z]+)(-[a-zA-Z]+)?$/,((t,e,n)=>e.toLowerCase()+(n||"").toUpperCase())),St[t]?St[t]:window[Ct]&&window[Ct][t]?window[Ct][t]:St.en}let Tt="en",Lt=Et(Tt);function At(t){t!==Tt&&(Tt=t,Lt="string"==typeof t?Et(t):t)}function Ot(t,e={}){let n=(null==Lt?void 0:Lt[t])||t;return n=n.replace(/\{\s*(\w+?)\s*\}/g,((t,n)=>e[n]||"")),n}const Mt="2.6.4";const _t=new class{constructor(){d(this,"ctx"),d(this,"data");const t=JSON.parse(window.localStorage.getItem("ArtalkUser")||"{}");this.data={nick:t.nick||"",email:t.email||"",link:t.link||"",token:t.token||"",isAdmin:t.isAdmin||!1}}setContext(t){this.ctx=t}update(t={}){var e;Object.entries(t).forEach((([t,e])=>{this.data[t]=e})),window.localStorage.setItem("ArtalkUser",JSON.stringify(this.data)),null==(e=this.ctx)||e.trigger("user-changed",this.data)}logout(){this.update({token:"",isAdmin:!1})}checkHasBasicUserInfo(){return!!this.data.nick&&!!this.data.email}},Bt=window||{},Pt=navigator||{};class Rt{constructor(t){d(this,"comment"),d(this,"$el"),d(this,"$main"),d(this,"$header"),d(this,"$headerNick"),d(this,"$headerBadgeWrap"),d(this,"$body"),d(this,"$content"),d(this,"$childrenWrap"),d(this,"$actions"),d(this,"voteBtnUp"),d(this,"voteBtnDown"),d(this,"$replyTo"),d(this,"$replyAt"),this.comment=t}get ctx(){return this.comment.ctx}get data(){return this.comment.getData()}get conf(){return this.comment.conf}get cConf(){return this.comment.getConf()}}function It(t){if(t.$headerNick=t.$el.querySelector(".atk-nick"),t.data.link){const e=u('');e.innerText=t.data.nick,e.href=v(t.data.link)?t.data.link:`https://${t.data.link}`,t.$headerNick.append(e)}else t.$headerNick.innerText=t.data.nick}function Ut(t){t.$headerBadgeWrap=t.$el.querySelector(".atk-badge-wrap"),t.$headerBadgeWrap.innerHTML="";const e=t.data.badge_name,n=t.data.badge_color;if(e){const i=u('');i.innerText=e.replace("管理员",t.ctx.$t("admin")),i.style.backgroundColor=n||"",t.$headerBadgeWrap.append(i)}if(t.data.is_pinned){const e=u(`${t.ctx.$t("pin")}`);t.$headerBadgeWrap.append(e)}}function Dt(t){const e=t.$el.querySelector(".atk-date");e.innerText=t.comment.getDateFormatted(),e.setAttribute("data-atk-comment-date",String(+new Date(t.data.date)))}function qt(t){if(!t.ctx.conf.uaBadge&&!t.data.ip_region)return;let e=t.$header.querySelector("atk-ua-wrap");if(e||(e=u(''),t.$header.append(e)),e.innerHTML="",t.data.ip_region){const n=u('');n.innerText=t.data.ip_region,e.append(n)}if(t.ctx.conf.uaBadge){const{browser:n,os:i}=t.comment.getUserUA();if(String(n).trim()){const t=u('');t.innerText=n,e.append(t)}if(String(i).trim()){const t=u('');t.innerText=i,e.append(t)}}}class Wt{constructor(t,e){d(this,"ctx"),d(this,"conf"),d(this,"$el"),d(this,"isLoading",!1),d(this,"msgRecTimer"),d(this,"msgRecTimerFunc"),d(this,"isConfirming",!1),d(this,"confirmRecTimer"),this.ctx=t,this.$el=u(''),this.conf="object"!=typeof e?{text:e}:e,this.$el.innerText=this.getText(),this.conf.adminOnly&&this.$el.setAttribute("atk-only-admin-show","")}get isMessaging(){return!!this.msgRecTimer}appendTo(t){return t.append(this.$el),this}getText(){return"string"==typeof this.conf.text?this.conf.text:this.conf.text()}setClick(t){this.$el.onclick=e=>{if(e.stopPropagation(),!this.isLoading){if(this.conf.confirm&&!this.isMessaging){const t=()=>{this.isConfirming=!1,this.$el.classList.remove("atk-btn-confirm"),this.$el.innerText=this.getText()};if(!this.isConfirming)return this.isConfirming=!0,this.$el.classList.add("atk-btn-confirm"),this.$el.innerText=this.conf.confirmText||this.ctx.$t("actionConfirm"),void(this.confirmRecTimer=window.setTimeout((()=>t()),5e3));this.confirmRecTimer&&window.clearTimeout(this.confirmRecTimer),t()}if(this.msgRecTimer)return this.fireMsgRecTimer(),void this.clearMsgRecTimer();t()}}}updateText(t){t&&(this.conf.text=t),this.setLoading(!1),this.$el.innerText=this.getText()}setLoading(t,e){this.isLoading!==t&&(this.isLoading=t,t?(this.$el.classList.add("atk-btn-loading"),this.$el.innerText=e||`${this.ctx.$t("loading")}...`):(this.$el.classList.remove("atk-btn-loading"),this.$el.innerText=this.getText()))}setError(t){this.setMsg(t,"atk-btn-error")}setWarn(t){this.setMsg(t,"atk-btn-warn")}setSuccess(t){this.setMsg(t,"atk-btn-success")}setMsg(t,e,n,i){this.setLoading(!1),e&&this.$el.classList.add(e),this.$el.innerText=t,this.setMsgRecTimer((()=>{this.$el.innerText=this.getText(),e&&this.$el.classList.remove(e),i&&i()}),n||2500)}setMsgRecTimer(t,e){this.fireMsgRecTimer(),this.clearMsgRecTimer(),this.msgRecTimerFunc=t,this.msgRecTimer=window.setTimeout((()=>{t(),this.clearMsgRecTimer()}),e)}fireMsgRecTimer(){this.msgRecTimerFunc&&this.msgRecTimerFunc()}clearMsgRecTimer(){this.msgRecTimer&&window.clearTimeout(this.msgRecTimer),this.msgRecTimer=void 0,this.msgRecTimerFunc=void 0}}function Ft(t){t.ctx.conf.vote&&(t.voteBtnUp=new Wt(t.ctx,(()=>`${t.ctx.$t("voteUp")} (${t.data.vote_up||0})`)).appendTo(t.$actions),t.voteBtnUp.setClick((()=>{t.comment.getActions().vote("up")})),t.ctx.conf.voteDown&&(t.voteBtnDown=new Wt(t.ctx,(()=>`${t.ctx.$t("voteDown")} (${t.data.vote_down||0})`)).appendTo(t.$actions),t.voteBtnDown.setClick((()=>{t.comment.getActions().vote("down")}))))}function Ht(t){if(!t.data.is_allow_reply)return;const e=u(`${t.ctx.$t("reply")}`);t.$actions.append(e),e.addEventListener("click",(e=>{e.stopPropagation(),t.cConf.onReplyBtnClick?t.cConf.onReplyBtnClick():t.ctx.replyComment(t.data,t.$el)}))}function Nt(t){const e=new Wt(t.ctx,{text:()=>t.data.is_collapsed?t.ctx.$t("expand"):t.ctx.$t("collapse"),adminOnly:!0});e.appendTo(t.$actions),e.setClick((()=>{t.comment.getActions().adminEdit("collapsed",e)}))}function jt(t){const e=new Wt(t.ctx,{text:()=>t.data.is_pending?t.ctx.$t("pending"):t.ctx.$t("approved"),adminOnly:!0});e.appendTo(t.$actions),e.setClick((()=>{t.comment.getActions().adminEdit("pending",e)}))}function zt(t){const e=new Wt(t.ctx,{text:()=>t.data.is_pinned?t.ctx.$t("unpin"):t.ctx.$t("pin"),adminOnly:!0});e.appendTo(t.$actions),e.setClick((()=>{t.comment.getActions().adminEdit("pinned",e)}))}function Vt(t){const e=new Wt(t.ctx,{text:t.ctx.$t("edit"),adminOnly:!0});e.appendTo(t.$actions),e.setClick((()=>{t.ctx.editComment(t.data,t.$el)}))}function Qt(t){const e=new Wt(t.ctx,{text:t.ctx.$t("delete"),confirm:!0,confirmText:t.ctx.$t("deleteConfirm"),adminOnly:!0});e.appendTo(t.$actions),e.setClick((()=>{t.comment.getActions().adminDelete(e)}))}const Gt={Avatar:function(t){const e=t.$el.querySelector(".atk-avatar"),n=u(""),i=t.conf.avatarURLBuilder;if(n.src=i?i(t.data):t.comment.getGravatarURL(),t.data.link){const i=u('');i.href=v(t.data.link)?t.data.link:`https://${t.data.link}`,i.append(n),e.append(i)}else e.append(n)},Header:function(t){Object.entries({renderNick:It,renderVerifyBadge:Ut,renderDate:Dt,renderUABadge:qt}).forEach((([e,n])=>{n(t)}))},Content:function(t){if(!t.data.is_collapsed)return t.$content.innerHTML=t.comment.getContentMarked(),void t.$content.classList.remove("atk-hide","atk-collapsed");t.$content.classList.add("atk-hide","atk-type-collapsed");const e=u(`\n
          \n ${t.ctx.$t("collapsedMsg")}\n ${t.ctx.$t("expand")}\n
          `);t.$body.insertAdjacentElement("beforeend",e);const n=e.querySelector(".atk-show-btn");n.addEventListener("click",(e=>{e.stopPropagation(),t.$content.classList.contains("atk-hide")?(t.$content.innerHTML=t.comment.getContentMarked(),t.$content.classList.remove("atk-hide"),T(t.$content),n.innerHTML=t.ctx.$t("collapse")):(t.$content.innerHTML="",t.$content.classList.add("atk-hide"),n.innerHTML=t.ctx.$t("expand"))}))},ReplyAt:function(t){t.cConf.isFlatMode||0===t.data.rid||t.cConf.replyTo&&(t.$replyAt=u(''),t.$replyAt.querySelector(".atk-nick").innerText=`${t.cConf.replyTo.nick}`,t.$replyAt.onclick=()=>{t.comment.getActions().goToReplyComment()},t.$headerBadgeWrap.insertAdjacentElement("afterend",t.$replyAt))},ReplyTo:function(t){if(!t.cConf.isFlatMode)return;if(!t.cConf.replyTo)return;t.$replyTo=u(`\n
          \n
          ${t.ctx.$t("reply")} :
          \n
          \n
          `);const e=t.$replyTo.querySelector(".atk-nick");e.innerText=`@${t.cConf.replyTo.nick}`,e.onclick=()=>{t.comment.getActions().goToReplyComment()};let n=wt(t.ctx,t.cConf.replyTo.content);t.cConf.replyTo.is_collapsed&&(n=`[${t.ctx.$t("collapsed")}]`),t.$replyTo.querySelector(".atk-content").innerHTML=n,t.$body.prepend(t.$replyTo)},Pending:function(t){if(!t.data.is_pending)return;const e=u(`
          ${t.ctx.$t("pendingMsg")}
          `);t.$body.prepend(e)},Actions:function(t){Object.entries({renderVote:Ft,renderReply:Ht,renderCollapse:Nt,renderModerator:jt,renderPin:zt,renderEdit:Vt,renderDel:Qt}).forEach((([e,n])=>{n(t)}))}};function Kt(t,e){e.forEach((({el:e,max:n,imgContains:i})=>{const s=()=>{e&&(t.scrollable?function(t){if(!t.el)return;if(t.el.classList.contains(Jt))return;t.el.classList.add(Jt),t.el.style.height=`${t.maxHeight}px`}({el:e,maxHeight:n}):function(t){if(!t.el)return;if(!t.maxHeight)return;if(t.el.classList.contains(Yt))return;t.el.classList.add(Yt),t.el.style.height=`${t.maxHeight}px`,t.el.style.overflow="hidden";const e=u(`
          ${Ot("readMore")}`);e.onclick=e=>{e.stopPropagation(),Xt(t.el),t.postBtnClick&&t.postBtnClick(e)},t.el.append(e)}({el:e,maxHeight:n,postBtnClick:t.postExpandBtnClick}))},a=()=>{e&&p(e)>n&&s()};a(),i&&e&&function(t,e){if(!t)return;const n=t.getElementsByTagName("img");if(!n.length)return;let i=n.length;for(let s=0;s{i--,0===i&&e()})),0===i&&e()}(e,(()=>a()))}))}const Yt="atk-height-limit";function Xt(t){t&&t.classList.contains(Yt)&&(t.classList.remove(Yt),Array.from(t.children).forEach((t=>{t.classList.contains("atk-height-limit-btn")&&t.remove()})),t.style.height="",t.style.overflow="")}const Jt="atk-height-limit-scroll";class Zt extends Rt{constructor(t){super(t)}render(){var t;return this.$el=u('
          \n
          \n
          \n
          \n
          \n \n \n \n
          \n
          \n
          \n
          \n \n
          \n
          \n
          \n'),this.$main=this.$el.querySelector(".atk-main"),this.$header=this.$el.querySelector(".atk-header"),this.$body=this.$el.querySelector(".atk-body"),this.$content=this.$body.querySelector(".atk-content"),this.$actions=this.$el.querySelector(".atk-actions"),this.$el.setAttribute("id",`atk-comment-${this.data.id}`),t=this,Object.entries(Gt).forEach((([e,n])=>{n(t)})),this.recoveryChildrenWrap(),this.$el}checkHeightLimit(){const t=this.ctx.conf.heightLimit;if(!t||!t.content||!t.children)return;const e=t.content,n=t.children;Kt({postExpandBtnClick:()=>{const t=this.comment.getChildren();1===t.length&&Xt(t[0].getRender().$content)},scrollable:t.scrollable},[{el:this.$content,max:e,imgContains:!0},{el:this.$replyTo,max:e,imgContains:!0},{el:this.$childrenWrap,max:n,imgContains:!1}])}heightLimitRemoveForChildren(){this.$childrenWrap&&Xt(this.$childrenWrap)}playFadeAnim(){T(this.comment.getRender().$el)}playFadeAnimForBody(){T(this.comment.getRender().$body)}getChildrenWrap(){return this.$childrenWrap}renderChildrenWrap(){return this.$childrenWrap||(this.$childrenWrap=u('
          '),this.$main.append(this.$childrenWrap)),this.$childrenWrap}recoveryChildrenWrap(){this.$childrenWrap&&this.$main.append(this.$childrenWrap)}setUnread(t){t?this.$el.classList.add("atk-unread"):this.$el.classList.remove("atk-unread")}setOpenable(t){t?this.$el.classList.add("atk-openable"):this.$el.classList.remove("atk-openable")}setOpenURL(t){this.setOpenable(!0),this.$el.onclick=e=>{e.preventDefault(),window.open(t),this.cConf.openEvt&&this.cConf.openEvt()}}setOpenAction(t){this.setOpenable(!0),this.$el.onclick=e=>{e.preventDefault(),t()}}}class te{constructor(t){d(this,"comment"),this.comment=t}get ctx(){return this.comment.ctx}get data(){return this.comment.getData()}get cConf(){return this.comment.getConf()}vote(t){const e="up"===t?this.comment.getRender().voteBtnUp:this.comment.getRender().voteBtnDown;this.ctx.getApi().comment.vote(this.data.id,`comment_${t}`).then((t=>{var e,n;this.data.vote_up=t.up,this.data.vote_down=t.down,null==(e=this.comment.getRender().voteBtnUp)||e.updateText(),null==(n=this.comment.getRender().voteBtnDown)||n.updateText()})).catch((t=>{null==e||e.setError(this.ctx.$t("voteFail")),console.log(t)}))}adminEdit(t,e){if(e.isLoading)return;e.setLoading(!0,`${this.ctx.$t("editing")}...`);const n=l({},this.data);"collapsed"===t?n.is_collapsed=!n.is_collapsed:"pending"===t?n.is_pending=!n.is_pending:"pinned"===t&&(n.is_pinned=!n.is_pinned),this.ctx.getApi().comment.commentEdit(n).then((t=>{e.setLoading(!1),this.comment.setData(t),this.ctx.listRefreshUI()})).catch((t=>{console.error(t),e.setError(this.ctx.$t("editFail"))}))}adminDelete(t){t.isLoading||(t.setLoading(!0,`${this.ctx.$t("deleting")}...`),this.ctx.getApi().comment.commentDel(this.data.id,this.data.site_name).then((()=>{t.setLoading(!1),this.cConf.onDelete&&this.cConf.onDelete(this.comment)})).catch((e=>{console.error(e),t.setError(this.ctx.$t("deleteFail"))})))}goToReplyComment(){const t=window.location.hash,e=`#atk-comment-${this.data.rid}`;window.location.hash=e,e===t&&window.dispatchEvent(new Event("hashchange"))}}class ee extends w{constructor(t,e,n){super(t),d(this,"renderInstance"),d(this,"actionInstance"),d(this,"data"),d(this,"cConf"),d(this,"parent"),d(this,"children",[]),d(this,"nestCurt"),d(this,"nestMax"),this.nestMax=t.conf.nestMax||3,this.cConf=n,this.data=l({},e),this.data.date=this.data.date.replace(/-/g,"/"),this.parent=null,this.nestCurt=1,this.actionInstance=new te(this),this.renderInstance=new Zt(this)}render(){const t=this.renderInstance.render();this.$el&&this.$el.replaceWith(t),this.$el=t,this.cConf.afterRender&&this.cConf.afterRender()}getActions(){return this.actionInstance}getRender(){return this.renderInstance}getData(){return this.data}setData(t){this.data=t,this.render(),this.getRender().playFadeAnimForBody()}getParent(){return this.parent}getChildren(){return this.children}getNestCurt(){return this.nestCurt}getIsRoot(){return 0===this.data.rid}getID(){return this.data.id}putChild(t,e="append"){t.parent=this,t.nestCurt=this.nestCurt+1,this.children.push(t);const n=this.getChildrenEl();"append"===e?n.append(t.getEl()):"prepend"===e&&n.prepend(t.getEl()),t.getRender().playFadeAnim(),t.getRender().checkHeightLimit()}getChildrenEl(){let t=this.getRender().getChildrenWrap();return t||(t=this.nestCurt{n.parent&&(t.push(n.parent),e(n.parent))};return e(this),t}getEl(){return this.$el}getGravatarURL(){return function(t,e){const{mirror:n,params:i}=t.conf.gravatar;return`${n.replace(/\/$/,"")}/${e}?${i.replace(/^\?/,"")}`}(this.ctx,this.data.email_encrypted)}getContentMarked(){return wt(this.ctx,this.data.content)}getDateFormatted(){return y(new Date(this.data.date),this.ctx)}getUserUA(){const t=function(t){const e=String(t||Pt.userAgent),n={os:"",osVersion:"",engine:"",browser:"",device:"",language:"",version:""},i={Trident:e.includes("Trident")||e.includes("NET CLR"),Presto:e.includes("Presto"),WebKit:e.includes("AppleWebKit"),Gecko:e.includes("Gecko/")},s={Safari:e.includes("Safari"),Chrome:e.includes("Chrome")||e.includes("CriOS"),IE:e.includes("MSIE")||e.includes("Trident"),Edge:e.includes("Edge")||e.includes("Edg"),Firefox:e.includes("Firefox")||e.includes("FxiOS"),"Firefox Focus":e.includes("Focus"),Chromium:e.includes("Chromium"),Opera:e.includes("Opera")||e.includes("OPR"),Vivaldi:e.includes("Vivaldi"),Yandex:e.includes("YaBrowser"),Kindle:e.includes("Kindle")||e.includes("Silk/"),360:e.includes("360EE")||e.includes("360SE"),UC:e.includes("UC")||e.includes(" UBrowser"),QQBrowser:e.includes("QQBrowser"),QQ:e.includes("QQ/"),Baidu:e.includes("Baidu")||e.includes("BIDUBrowser"),Maxthon:e.includes("Maxthon"),Sogou:e.includes("MetaSr")||e.includes("Sogou"),LBBROWSER:e.includes("LBBROWSER"),"2345Explorer":e.includes("2345Explorer"),TheWorld:e.includes("TheWorld"),MIUI:e.includes("MiuiBrowser"),Quark:e.includes("Quark"),Qiyu:e.includes("Qiyu"),Wechat:e.includes("MicroMessenger"),Taobao:e.includes("AliApp(TB"),Alipay:e.includes("AliApp(AP"),Weibo:e.includes("Weibo"),Douban:e.includes("com.douban.frodo"),Suning:e.includes("SNEBUY-APP"),iQiYi:e.includes("IqiyiApp")},a={Windows:e.includes("Windows"),Linux:e.includes("Linux")||e.includes("X11"),macOS:e.includes("Macintosh"),Android:e.includes("Android")||e.includes("Adr"),Ubuntu:e.includes("Ubuntu"),FreeBSD:e.includes("FreeBSD"),Debian:e.includes("Debian"),"Windows Phone":e.includes("IEMobile")||e.includes("Windows Phone"),BlackBerry:e.includes("BlackBerry")||e.includes("RIM"),MeeGo:e.includes("MeeGo"),Symbian:e.includes("Symbian"),iOS:e.includes("like Mac OS X"),"Chrome OS":e.includes("CrOS"),WebOS:e.includes("hpwOS")},r={Mobile:e.includes("Mobi")||e.includes("iPh")||e.includes("480"),Tablet:e.includes("Tablet")||e.includes("Pad")||e.includes("Nexus 7")};r.Mobile?r.Mobile=!e.includes("iPad"):s.Chrome&&e.includes("Edg")?(s.Chrome=!1,s.Edge=!0):Bt.showModalDialog&&Bt.chrome&&(s.Chrome=!1,s[360]=!0),n.device="PC",n.language=(()=>{const t=(Pt.browserLanguage||Pt.language).split("-");return t[1]&&(t[1]=t[1].toUpperCase()),t.join("_")})();const o={engine:i,browser:s,os:a,device:r};Object.entries(o).forEach((([t,e])=>{Object.entries(e).forEach((([e,i])=>{!0===i&&(n[t]=e)}))}));const l={Windows:()=>{const t=e.replace(/^.*Windows NT ([\d.]+);.*$/,"$1");return{6.4:"10",6.3:"8.1",6.2:"8",6.1:"7","6.0":"Vista",5.2:"XP",5.1:"XP","5.0":"2000","10.0":"10","11.0":"11"}[t]||t},Android:()=>e.replace(/^.*Android ([\d.]+);.*$/,"$1"),iOS:()=>e.replace(/^.*OS ([\d_]+) like.*$/,"$1").replace(/_/g,"."),Debian:()=>e.replace(/^.*Debian\/([\d.]+).*$/,"$1"),"Windows Phone":()=>e.replace(/^.*Windows Phone( OS)? ([\d.]+);.*$/,"$2"),macOS:()=>e.replace(/^.*Mac OS X ([\d_]+).*$/,"$1").replace(/_/g,"."),WebOS:()=>e.replace(/^.*hpwOS\/([\d.]+);.*$/,"$1")};n.osVersion="",l[n.os]&&(n.osVersion=l[n.os](),n.osVersion===e&&(n.osVersion=""));const c={Safari:()=>e.replace(/^.*Version\/([\d.]+).*$/,"$1"),Chrome:()=>e.replace(/^.*Chrome\/([\d.]+).*$/,"$1").replace(/^.*CriOS\/([\d.]+).*$/,"$1"),IE:()=>e.replace(/^.*MSIE ([\d.]+).*$/,"$1").replace(/^.*rv:([\d.]+).*$/,"$1"),Edge:()=>e.replace(/^.*(Edge|Edg|Edg[A-Z]{1})\/([\d.]+).*$/,"$2"),Firefox:()=>e.replace(/^.*Firefox\/([\d.]+).*$/,"$1").replace(/^.*FxiOS\/([\d.]+).*$/,"$1"),"Firefox Focus":()=>e.replace(/^.*Focus\/([\d.]+).*$/,"$1"),Chromium:()=>e.replace(/^.*Chromium\/([\d.]+).*$/,"$1"),Opera:()=>e.replace(/^.*Opera\/([\d.]+).*$/,"$1").replace(/^.*OPR\/([\d.]+).*$/,"$1"),Vivaldi:()=>e.replace(/^.*Vivaldi\/([\d.]+).*$/,"$1"),Yandex:()=>e.replace(/^.*YaBrowser\/([\d.]+).*$/,"$1"),Kindle:()=>e.replace(/^.*Version\/([\d.]+).*$/,"$1"),Maxthon:()=>e.replace(/^.*Maxthon\/([\d.]+).*$/,"$1"),QQBrowser:()=>e.replace(/^.*QQBrowser\/([\d.]+).*$/,"$1"),QQ:()=>e.replace(/^.*QQ\/([\d.]+).*$/,"$1"),Baidu:()=>e.replace(/^.*BIDUBrowser[\s/]([\d.]+).*$/,"$1"),UC:()=>e.replace(/^.*UC?Browser\/([\d.]+).*$/,"$1"),Sogou:()=>e.replace(/^.*SE ([\d.X]+).*$/,"$1").replace(/^.*SogouMobileBrowser\/([\d.]+).*$/,"$1"),"2345Explorer":()=>e.replace(/^.*2345Explorer\/([\d.]+).*$/,"$1"),TheWorld:()=>e.replace(/^.*TheWorld ([\d.]+).*$/,"$1"),MIUI:()=>e.replace(/^.*MiuiBrowser\/([\d.]+).*$/,"$1"),Quark:()=>e.replace(/^.*Quark\/([\d.]+).*$/,"$1"),Qiyu:()=>e.replace(/^.*Qiyu\/([\d.]+).*$/,"$1"),Wechat:()=>e.replace(/^.*MicroMessenger\/([\d.]+).*$/,"$1"),Taobao:()=>e.replace(/^.*AliApp\(TB\/([\d.]+).*$/,"$1"),Alipay:()=>e.replace(/^.*AliApp\(AP\/([\d.]+).*$/,"$1"),Weibo:()=>e.replace(/^.*weibo__([\d.]+).*$/,"$1"),Douban:()=>e.replace(/^.*com.douban.frodo\/([\d.]+).*$/,"$1"),Suning:()=>e.replace(/^.*SNEBUY-APP([\d.]+).*$/,"$1"),iQiYi:()=>e.replace(/^.*IqiyiVersion\/([\d.]+).*$/,"$1")};return n.version="",c[n.browser]&&(n.version=c[n.browser](),n.version===e&&(n.version="")),n.version.indexOf(".")&&(n.version=n.version.substring(0,n.version.indexOf("."))),"iOS"===n.os&&e.includes("iPad")?n.os="iPadOS":"Edge"!==n.browser||e.includes("Edg")?"MIUI"===n.browser?n.os="Android":"Chrome"===n.browser&&Number(n.version)>27||"Opera"===n.browser&&Number(n.version)>12||"Yandex"===n.browser?n.engine="Blink":void 0===n.browser&&(n.browser="Unknow App"):n.engine="EdgeHTML",n}(this.data.ua);return{browser:`${t.browser} ${t.version}`,os:`${t.os} ${t.osVersion}`}}getConf(){return this.cConf}}class ne{constructor(t,e){d(this,"conf"),d(this,"total"),d(this,"$el"),d(this,"$input"),d(this,"inputTimer"),d(this,"$prevBtn"),d(this,"$nextBtn"),d(this,"page",1),this.total=t,this.conf=e,this.$el=u('
          \n
          \n
          Prev
          \n \n
          Next
          \n
          \n
          '),this.$input=this.$el.querySelector(".atk-input"),this.$input.value=`${this.page}`,this.$input.oninput=()=>this.input(),this.$input.onkeydown=t=>this.keydown(t),this.$prevBtn=this.$el.querySelector(".atk-btn-prev"),this.$nextBtn=this.$el.querySelector(".atk-btn-next"),this.$prevBtn.onclick=()=>this.prev(),this.$nextBtn.onclick=()=>this.next(),this.checkDisabled()}get pageSize(){return this.conf.pageSize}get offset(){return this.pageSize*(this.page-1)}get maxPage(){return Math.ceil(this.total/this.pageSize)}update(t,e){this.page=Math.ceil(t/this.pageSize)+1,this.total=e,this.setInput(this.page),this.checkDisabled()}setInput(t){this.$input.value=`${t}`}input(t=!1){window.clearTimeout(this.inputTimer);const e=this.$input.value.trim(),n=()=>{if(""===e)return void this.setInput(this.page);let t=Number(e);Number.isNaN(t)||t<1?this.setInput(this.page):(t>this.maxPage&&(this.setInput(this.maxPage),t=this.maxPage),this.change(t))};t?n():this.inputTimer=window.setTimeout((()=>n()),800)}prev(){const t=this.page-1;t<1||this.change(t)}next(){const t=this.page+1;t>this.maxPage||this.change(t)}change(t){this.page=t,this.conf.onChange(this.offset),this.setInput(t),this.checkDisabled()}checkDisabled(){this.page+1>this.maxPage?this.$nextBtn.classList.add("atk-disabled"):this.$nextBtn.classList.remove("atk-disabled"),this.page-1<1?this.$prevBtn.classList.add("atk-disabled"):this.$prevBtn.classList.remove("atk-disabled")}keydown(t){const e=t.keyCode||t.which;if(38===e){const t=Number(this.$input.value)+1;if(t>this.maxPage)return;this.setInput(t),this.input()}else if(40===e){const t=Number(this.$input.value)-1;if(t<1)return;this.setInput(t),this.input()}else 13===e&&this.input(!0)}setLoading(t){t?x(this.$el):C(this.$el)}}const ie={createInstance(t){const e=new ne(t.total,{pageSize:t.pageSize,onChange:e=>h(this,null,(function*(){if(!0===t.list.conf.editorTravel&&t.list.ctx.editorTravelBack(),yield t.list.fetchComments(e),t.list.repositionAt){(t.list.scrollListenerAt||window).scroll({top:t.list.repositionAt?g(t.list.repositionAt).top:0,left:0})}}))});return[e,e.$el]},setLoading(t){this.instance.setLoading(t)},update(t,e){this.instance.update(t,e)},next(){this.instance.next()}};class se{constructor(t){d(this,"conf"),d(this,"$el"),d(this,"$loading"),d(this,"$text"),d(this,"offset",0),d(this,"total",0),d(this,"origText","Load More"),this.conf=t,this.origText=this.conf.text||this.origText,this.$el=u(``),this.$loading=this.$el.querySelector(".atk-loading-icon"),this.$text=this.$el.querySelector(".atk-text"),this.$el.onclick=()=>{this.click()}}get hasMore(){return this.total>this.offset+this.conf.pageSize}click(){this.hasMore&&this.conf.onClick(this.offset+this.conf.pageSize),this.checkDisabled()}show(){this.$el.style.display=""}hide(){this.$el.style.display="none"}setLoading(t){this.$loading.style.display=t?"":"none",this.$text.style.display=t?"none":""}showErr(t){this.setLoading(!1),this.$text.innerText=t,this.$el.classList.add("atk-err"),window.setTimeout((()=>{this.$text.innerText=this.origText,this.$el.classList.remove("atk-err")}),2e3)}update(t,e){this.offset=t,this.total=e,this.checkDisabled()}checkDisabled(){this.hasMore?this.show():this.hide()}}const ae={pagination:ie,"read-more":{createInstance(t){const e=new se({pageSize:t.pageSize,onClick:e=>h(this,null,(function*(){yield t.list.fetchComments(e)})),text:Ot("loadMore")});if(t.list.conf.pagination.autoLoad){const n=t.list.scrollListenerAt||document;this.autoLoadScrollEvent&&n.removeEventListener("scroll",this.autoLoadScrollEvent),this.autoLoadScrollEvent=()=>{if("read-more"!==t.mode||!(null==e?void 0:e.hasMore)||t.list.getLoading())return;const n=t.list.$el.querySelector(".atk-list-comments-wrap > .atk-comment-wrap:nth-last-child(3)");n&&function(t,e=document.documentElement){const n=e.clientHeight,i=e.scrollTop,s=i+n,a=t.getBoundingClientRect();return a.top+i+a.height<=s}(n,t.list.scrollListenerAt)&&e.click()},n.addEventListener("scroll",this.autoLoadScrollEvent)}return[e,e.$el]},setLoading(t){this.instance.setLoading(t)},update(t,e){this.instance.update(t,e)},showErr(t){this.instance.showErr(t)},next(){this.instance.click()}}};class re{constructor(t){d(this,"conf"),this.conf=t,this.init()}getAdaptor(){return ae[this.conf.mode]}init(){const t=this.getAdaptor(),[e,n]=t.createInstance(this.conf);t.instance=e,t.el=n,this.conf.list.$el.append(t.el)}setLoading(t){this.getAdaptor().setLoading(t)}update(t,e){this.getAdaptor().update(t,e)}getEl(){return this.getAdaptor().el}showErr(t){const e=this.getAdaptor(),n=e.showErr;n&&n.bind(e)(t)}setMode(t){t!==this.conf.mode&&(this.getEl().remove(),this.conf.mode=t,this.init())}next(){this.getAdaptor().next()}}function oe(t,e,n){const i=function(t,e){const n=t.split("."),i=e.split(".");for(let s=0;s<3;s++){const t=Number(n[s]),e=Number(i[s]);if(t>e)return 1;if(e>t)return-1;if(!Number.isNaN(t)&&Number.isNaN(e))return 1;if(Number.isNaN(t)&&!Number.isNaN(e))return-1}return 0}(e,n);if(0!==i){const s=u(`
          请更新 Artalk ${Ot(i<0?"frontend":"backend")}以获得完整体验 (帮助文档)

          当前版本:${Ot("frontend")} ${e} / ${Ot("backend")} ${n}

          `),a=u('忽略');return a.onclick=()=>{L(t.$el.parentElement,null),t.ctx.conf.versionCheck=!1,t.fetchComments(0)},s.append(a),L(t.$el.parentElement,s,'Artalk Warn'),!0}return!1}function le(t){const{$dropdownWrap:e,dropdownList:n}=t;if(e.querySelector(".atk-dropdown"))return;e.classList.add("atk-dropdown-wrap"),e.append(u(''));let i=0;const s=u('
            ');n.forEach(((t,e)=>{const n=t[0],a=t[1],r=u('
          • '),o=r.querySelector("span");o.innerText=n,o.onclick=()=>{((t,e,n,a)=>{a(),i=t,s.querySelectorAll(".active").forEach((t=>{t.classList.remove("active")})),e.classList.add("active"),s.style.display="none",setTimeout((()=>{s.style.display=""}),80)})(e,r,0,a)},s.append(r),e===i&&r.classList.add("active")})),e.append(s)}const ce={el:"",pageKey:"",pageTitle:"",server:"",site:"",placeholder:"",noComment:"",sendBtn:"",darkMode:!1,editorTravel:!0,flatMode:"auto",nestMax:2,nestSort:"DATE_ASC",emoticons:"https://cdn.jsdelivr.net/gh/ArtalkJS/Emoticons/grps/default.json",vote:!0,voteDown:!1,uaBadge:!0,listSort:!0,preview:!0,countEl:"#ArtalkCount",pvEl:"#ArtalkPV",gravatar:{mirror:"https://cravatar.cn/avatar/",params:"d=mp&s=240"},pagination:{pageSize:20,readMore:!0,autoLoad:!0},heightLimit:{content:300,children:400,scrollable:!1},imgUpload:!0,reqTimeout:15e3,versionCheck:!0,useBackendConf:!0,locale:"zh-CN"};function de(t){const e=b(ce,t);if("string"==typeof e.el&&e.el)try{const t=document.querySelector(e.el);if(!t)throw Error(`Target element "${e.el}" was not found.`);e.el=t}catch(n){throw console.error(n),new Error("Please check your Artalk `el` config.")}return e.server=e.server.replace(/\/$/,"").replace(/\/api\/?$/,""),e.pageKey||(e.pageKey=`${window.location.pathname}`),e.pageTitle||(e.pageTitle=`${document.title}`),"auto"===e.locale&&(e.locale=navigator.language),e}function he(t){const e=["el","pageKey","pageTitle","server","site","darkMode"];return Object.keys(t).forEach((n=>{e.includes(n)&&delete t[n]})),t.emoticons&&"string"==typeof t.emoticons&&(t.emoticons=t.emoticons.trim(),t.emoticons.startsWith("[")||t.emoticons.startsWith("{")?t.emoticons=JSON.parse(t.emoticons):"false"===t.emoticons&&(t.emoticons=!1)),t}ce.vote=!1,ce.uaBadge=!1,ce.emoticons=!1;class ue extends w{constructor(t){super(t),d(this,"$commentsWrap"),d(this,"data"),d(this,"isLoading",!1),d(this,"confLoaded",!1),d(this,"noCommentText"),d(this,"_nestSortBy"),d(this,"_flatMode"),d(this,"_pageMode"),d(this,"pgHolder"),d(this,"_pageSize"),d(this,"scrollListenerAt"),d(this,"repositionAt"),d(this,"renderComment"),d(this,"paramsEditor"),d(this,"onAfterLoad"),d(this,"unread",[]),d(this,"unreadHighlight"),this.$el=u('
            \n
            \n
            '),this.$commentsWrap=this.$el.querySelector(".atk-list-comments-wrap"),window.setInterval((()=>{this.$el.querySelectorAll("[data-atk-comment-date]").forEach((t=>{const e=t.getAttribute("data-atk-comment-date");t.innerText=y(new Date(Number(e)),this.ctx)}))}),3e4),this.ctx.on("conf-loaded",(()=>{}))}get nestSortBy(){return this._nestSortBy||this.ctx.conf.nestSort||"DATE_ASC"}set nestSortBy(t){this._nestSortBy=t}get flatMode(){return void 0!==this._flatMode?this._flatMode:!0===this.ctx.conf.flatMode||Number(this.ctx.conf.nestMax)<=1||!("auto"!==this.ctx.conf.flatMode||!window.matchMedia("(max-width: 768px)").matches)}set flatMode(t){this._flatMode=t}get pageMode(){return this._pageMode||(this.conf.pagination.readMore?"read-more":"pagination")}set pageMode(t){var e;this._pageMode=t,null==(e=this.pgHolder)||e.setMode(this._pageMode)}get pageSize(){return this._pageSize||this.conf.pagination.pageSize}set pageSize(t){this._pageSize=t}getData(){return this.data}clearData(){this.data=void 0}getLoading(){return this.isLoading}getCommentsWrapEl(){return this.$commentsWrap}setLoading(t,e=!1){var n;this.isLoading=t,e?function(t,e){t?x(e):C(e)}(t,this.$el):null==(n=this.pgHolder)||n.setLoading(t)}fetchComments(t){return h(this,null,(function*(){if(this.isLoading)return;const e=0===t,n=t=>this.setLoading(t,e);let i;n(!0),this.ctx.trigger("list-load"),("read-more"===this.pageMode&&e||"pagination"===this.pageMode)&&this.ctx.clearAllComments();try{i=yield this.ctx.getApi().comment.get(t,this.pageSize,this.flatMode,this.paramsEditor)}catch(s){throw this.onError(s.msg||String(s),t,s.data),s}finally{n(!1)}L(this.$el,null);try{this.onLoad(i,t)}catch(s){throw this.onError(String(s),t),s}finally{n(!1)}}))}onLoad(t,e){if(this.data=t,!this.confLoaded){const e=he(t.conf.frontend_conf);this.conf.useBackendConf?this.ctx.updateConf(e):this.ctx.updateConf({}),this.confLoaded=!0}this.ctx.conf.versionCheck&&oe(this,Mt,t.api_version.version)||(this.importComments(t.comments),this.refreshPagination(e,this.flatMode?t.total:t.total_roots),this.refreshUI(),this.ctx.updateNotifies(t.unread||[]),this.ctx.trigger("list-loaded"),this.onAfterLoad&&this.onAfterLoad(t))}refreshPagination(t,e){var n;this.pgHolder||(this.pgHolder=new re({list:this,mode:this.pageMode,pageSize:this.pageSize,total:e})),null==(n=this.pgHolder)||n.update(t,e)}onError(t,e,n){var i;this.confLoaded||this.ctx.updateConf({}),t=String(t),console.error(t),0===e||"read-more"!==this.pageMode?L(this.$el,function(t,e,n){const i=u(`${e},${Ot("listLoadFailMsg")}
            `),s=u(`${Ot("listRetry")}`);s.onclick=()=>t.fetchComments(0),i.appendChild(s);const a=u(' | 打开控制台');i.appendChild(a),_t.data.isAdmin||a.classList.add("atk-hide");let r="";if(null==n?void 0:n.err_no_site){const e={create_name:t.ctx.conf.site,create_urls:`${window.location.protocol}//${window.location.host}`};r=`sites|${JSON.stringify(e)}`}return a.onclick=()=>t.ctx.showSidebar({view:r}),i}(this,t,n)):null==(i=this.pgHolder)||i.showErr(this.$t("loadFail"))}refreshUI(){!function(t){const e=t.ctx.getCommentList().length<=0;let n=t.getCommentsWrapEl().querySelector(".atk-list-no-comment");e?n||(n=u('
            '),n.innerHTML=t.noCommentText||t.ctx.conf.noComment||t.ctx.$t("noComment"),t.getCommentsWrapEl().appendChild(n)):null==n||n.remove(),t.ctx.checkAdminShowEl()}(this)}reload(){this.fetchComments(0)}createComment(t,e){e||(e=this.ctx.getCommentDataList());const n=new ee(this.ctx,t,{isFlatMode:this.flatMode,afterRender:()=>{this.renderComment&&this.renderComment(n)},onDelete:t=>{this.ctx.deleteComment(t),this.refreshUI()},replyTo:t.rid?e.find((e=>e.id===t.rid)):void 0});return n.render(),this.ctx.getCommentList().push(n),n}importComments(t){this.flatMode?t.forEach((e=>{this.putCommentFlatMode(e,t,"append")})):this.importCommentsNest(t)}importCommentsNest(t){const e=function(t,e="DATE_DESC",n=2){const i=[];t.filter((t=>0===t.rid)).forEach((e=>{const s={id:e.id,comment:e,children:[],level:1};s.parent=s,i.push(s),function e(i){const s=t.filter((t=>t.rid===i.id));0!==s.length&&(i.level>=n&&(i=i.parent),s.forEach((t=>{const n={id:t.id,comment:t,children:[],parent:i,level:i.level+1};i.children.push(n),e(n)})))}(s)}));const s=(n,i)=>{let s=n.id-i.id;return"DATE_ASC"===e?s=+new Date(n.comment.date)-+new Date(i.comment.date):"DATE_DESC"===e?s=+new Date(i.comment.date)-+new Date(n.comment.date):"SRC_INDEX"===e?s=t.indexOf(n.comment)-t.indexOf(i.comment):"VOTE_UP_DESC"===e&&(s=i.comment.vote_up-n.comment.vote_up),s};return function t(e){e.forEach((e=>{e.children=e.children.sort(s),t(e.children)}))}(i),i}(t,this.nestSortBy,this.conf.nestMax);e.forEach((e=>{const n=this.createComment(e.comment,t);this.$commentsWrap.appendChild(n.getEl()),n.getRender().playFadeAnim();const i=this;!function e(n,s){s.children.forEach((s=>{const a=s.comment,r=i.createComment(a,t);n.putChild(r),e(r,s)}))}(n,e),n.getRender().checkHeightLimit()}))}putCommentFlatMode(t,e,n){t.is_collapsed&&(t.is_allow_reply=!1);const i=this.createComment(t,e);return t.visible&&("append"===n&&this.$commentsWrap.append(i.getEl()),"prepend"===n&&this.$commentsWrap.prepend(i.getEl()),i.getRender().playFadeAnim()),i.getRender().checkHeightLimit(),i}insertComment(t){if(this.flatMode){S(this.putCommentFlatMode(t,this.ctx.getCommentDataList(),"prepend").getEl())}else{const e=this.createComment(t);if(0===t.rid)this.$commentsWrap.prepend(e.getEl());else{const n=this.ctx.findComment(t.rid);n&&(n.putChild(e,"DATE_ASC"===this.nestSortBy?"append":"prepend"),e.getParents().forEach((t=>{t.getRender().heightLimitRemoveForChildren()})))}e.getRender().checkHeightLimit(),S(e.getEl()),e.getRender().playFadeAnim()}this.data&&(this.data.total+=1),this.refreshUI(),this.ctx.trigger("list-loaded"),this.ctx.trigger("list-inserted",t)}updateComment(t){const e=this.ctx.findComment(t.id);e&&e.setData(t)}updateUnread(t){this.unread=t,!0===this.unreadHighlight&&this.ctx.getCommentList().forEach((t=>{const e=this.unread.find((e=>e.comment_id===t.getID()));e?(t.getRender().setUnread(!0),t.getRender().setOpenAction((()=>{window.open(e.read_link),this.unread=this.unread.filter((e=>e.comment_id!==t.getID())),this.ctx.updateNotifies(this.unread)}))):t.getRender().setUnread(!1)}))}}class pe extends ue{constructor(t){const e=u('
            \n
            \n
            \n
            \n
            \n
            \n \n \n \n
            \n
            \n
            \n
            \n
            \n \n
            \n');super(t),d(this,"$closeCommentBtn"),d(this,"$openSidebarBtn"),d(this,"$unreadBadge"),d(this,"$commentCount"),d(this,"$commentCountNum"),d(this,"$dropdownWrap"),d(this,"goToCommentFounded",!1),d(this,"goToCommentDelay",!0),e.querySelector(".atk-list-body").append(this.$el),this.$el=e,this.repositionAt=this.$el,this.initListActionBtn();this.$commentCount=this.$el.querySelector(".atk-comment-count");const n=()=>{this.$commentCount.innerHTML=this.$t("counter",{count:'0'}),this.$commentCountNum=this.$commentCount.querySelector(".atk-comment-count-num")};n(),this.$el.querySelector(".atk-copyright").innerHTML=`Powered By Artalk`,this.ctx.on("conf-loaded",(()=>{n(),this.refreshUI()}))}initListActionBtn(){this.$openSidebarBtn=this.$el.querySelector('[data-action="open-sidebar"]'),this.$closeCommentBtn=this.$el.querySelector('[data-action="admin-close-comment"]'),this.$unreadBadge=this.$el.querySelector(".atk-unread-badge"),this.$openSidebarBtn.addEventListener("click",(()=>{this.ctx.showSidebar()})),this.$closeCommentBtn.addEventListener("click",(()=>{this.data&&(this.data.page.admin_only=!this.data.page.admin_only,this.adminPageEditSave())}))}refreshUI(){var t;super.refreshUI(),this.$commentCountNum.innerText=String(Number(null==(t=this.data)?void 0:t.total)||0),_t.data.nick&&_t.data.email?this.$openSidebarBtn.classList.remove("atk-hide"):this.$openSidebarBtn.classList.add("atk-hide"),this.$openSidebarBtn.querySelector(".atk-text").innerText=_t.data.isAdmin?this.$t("ctrlCenter"):this.$t("msgCenter"),this.data&&this.data.page&&!0===this.data.page.admin_only?(this.ctx.editorClose(),this.$closeCommentBtn.innerHTML=this.$t("openComment")):(this.ctx.editorOpen(),this.$closeCommentBtn.innerHTML=this.$t("closeComment")),this.ctx.conf.listSort?this.initDropdown():function(t){var e,n;const{$dropdownWrap:i}=t;i.classList.remove("atk-dropdown-wrap"),null==(e=i.querySelector(".atk-arrow-down-icon"))||e.remove(),null==(n=i.querySelector(".atk-dropdown"))||n.remove()}({$dropdownWrap:this.$commentCount})}onLoad(t,e){super.onLoad(t,e),this.goToCommentFounded||this.checkGoToCommentByUrlHash(),!0===this.ctx.conf.editorTravel&&this.ctx.editorTravelBack()}checkGoToCommentByUrlHash(){var t;let e=Number(m("atk_comment"));if(!e){const t=window.location.hash.match(/#atk-comment-([0-9]+)/);if(!t||!t[1]||Number.isNaN(Number(t[1])))return;e=Number(t[1])}if(!e)return;const n=this.ctx.findComment(e);if(!n)return void(null==(t=this.pgHolder)||t.next());const i=m("atk_notify_key");i&&this.ctx.getApi().user.markRead(e,i).then((()=>{this.unread=this.unread.filter((t=>t.comment_id!==e)),this.updateUnread(this.unread)})),n.getParents().forEach((t=>{t.getRender().heightLimitRemoveForChildren()}));const s=()=>{S(n.getEl(),!1),n.getEl().classList.remove("atk-flash-once"),window.setTimeout((()=>{n.getEl().classList.add("atk-flash-once")}),150)};this.goToCommentDelay?window.setTimeout((()=>s()),350):s(),this.goToCommentFounded=!0,this.goToCommentDelay=!0}adminPageEditSave(){this.data&&this.data.page&&(this.ctx.editorShowLoading(),this.ctx.getApi().page.pageEdit(this.data.page).then((t=>{this.data&&(this.data.page=l({},t)),this.refreshUI()})).catch((t=>{this.ctx.editorShowNotify(`${this.$t("editFail")}: ${t.msg||String(t)}`,"e")})).finally((()=>{this.ctx.editorHideLoading()})))}showUnreadBadge(t){t>0?(this.$unreadBadge.innerText=`${Number(t||0)}`,this.$unreadBadge.style.display="block"):this.$unreadBadge.style.display="none"}initDropdown(){const t=t=>{this.paramsEditor=t,this.fetchComments(0)};le({$dropdownWrap:this.$commentCount,dropdownList:[[this.$t("sortLatest"),()=>{t((t=>{t.sort_by="date_desc"}))}],[this.$t("sortBest"),()=>{t((t=>{t.sort_by="vote"}))}],[this.$t("sortOldest"),()=>{t((t=>{t.sort_by="date_asc"}))}],[this.$t("sortAuthor"),()=>{t((t=>{t.view_only_admin=!0}))}]]})}updateUnread(t){super.updateUnread(t),this.showUnreadBadge((null==t?void 0:t.length)||0)}}class me{constructor(t,e){d(this,"conf"),d(this,"$root"),d(this,"markedReplacers",[]),d(this,"commentList",[]),d(this,"eventList",[]),this.conf=t,this.$root=e||document.createElement("div"),this.$root.classList.add("artalk"),this.$root.innerHTML=""}inject(t,e){this[t]=e}get(t){return this[t]}getApi(){return this.api}getCommentList(){return this.commentList}getCommentDataList(){return this.commentList.map((t=>t.getData()))}findComment(t){return this.commentList.find((e=>e.getData().id===t))}deleteComment(t){let e;if("number"==typeof t){const n=this.findComment(t);if(!n)throw Error(`Comment ${t} cannot be found`);e=n}else e=t;if(e.getEl().remove(),this.commentList.splice(this.commentList.indexOf(e),1),this.list){const t=this.list.getData();t&&(t.total-=1),this.list.refreshUI()}}clearAllComments(){this.list&&(this.list.getCommentsWrapEl().innerHTML="",this.list.clearData()),this.commentList=[]}insertComment(t){var e;null==(e=this.list)||e.insertComment(t)}updateComment(t){var e;null==(e=this.list)||e.updateComment(t)}replyComment(t,e,n){this.editor.setReply(t,e,n)}cancelReplyComment(){this.editor.cancelReply()}editComment(t,e){this.editor.setEditComment(t,e)}cancelEditComment(){this.editor.cancelEditComment()}updateNotifies(t){var e;null==(e=this.list)||e.updateUnread(t)}listReload(){var t;null==(t=this.list)||t.reload()}reload(){this.listReload()}listRefreshUI(){var t;null==(t=this.list)||t.refreshUI()}listHashGotoCheck(){if(!(this.list&&this.list instanceof pe))return;const t=this.list;t.goToCommentDelay=!1,t.checkGoToCommentByUrlHash()}editorOpen(){this.editor.open()}editorClose(){this.editor.close()}editorShowLoading(){this.editor.showLoading()}editorHideLoading(){this.editor.hideLoading()}editorShowNotify(t,e){this.editor.showNotify(t,e)}editorTravel(t){this.editor.travel(t)}editorTravelBack(){this.editor.travelBack()}showSidebar(t){this.sidebarLayer.show(t)}hideSidebar(){this.sidebarLayer.hide()}checkAdmin(t){this.checkerLauncher.checkAdmin(t)}checkCaptcha(t){this.checkerLauncher.checkCaptcha(t)}checkAdminShowEl(){const t=[];this.$root.querySelectorAll("[atk-only-admin-show]").forEach((e=>t.push(e)));const{$wrap:e}=M();e&&e.querySelectorAll("[atk-only-admin-show]").forEach((e=>t.push(e)));const n=document.querySelector(".atk-sidebar");n&&n.querySelectorAll("[atk-only-admin-show]").forEach((e=>t.push(e))),t.forEach((t=>{this.user.data.isAdmin?t.classList.remove("atk-hide"):t.classList.add("atk-hide")}))}on(t,e,n="internal"){this.eventList.push({name:t,handler:e,scope:n})}off(t,e,n="internal"){this.eventList=this.eventList.filter((i=>e?!(i.name===t&&i.handler===e&&i.scope===n):!(i.name===t&&i.scope===n)))}trigger(t,e,n){this.eventList.filter((e=>e.name===t&&(!n||e.scope===n))).map((t=>t.handler)).forEach((t=>t(e)))}$t(t,e={}){return Ot(t,e)}setDarkMode(t){R(this,t)}updateConf(t){this.conf=b(this.conf,t),this.trigger("conf-loaded")}getMarkedInstance(){return bt()}}class ge{constructor(t,e){return d(this,"ctx"),d(this,"$el"),d(this,"$content"),d(this,"$actions"),this.ctx=t,this.$el=u('
            \n
            \n
            \n
            \n
            \n
            '),this.$actions=this.$el.querySelector(".atk-layer-dialog-actions"),this.$content=this.$el.querySelector(".atk-layer-dialog-content"),this.$content.appendChild(e),this}setYes(t){const e=u(``);return e.onclick=this.onBtnClick(t),this.$actions.appendChild(e),this}setNo(t){const e=u(``);return e.onclick=this.onBtnClick(t),this.$actions.appendChild(e),this}onBtnClick(t){return e=>{const n=t(e.currentTarget,this);void 0!==n&&!0!==n||this.$el.remove()}}}function fe(t){const e=u('
            '),n=u('');n.style.display="none",x(e,{transparentBg:!0}),n.src=`${t.getCtx().conf.server}/api/captcha/get?t=${+new Date}`,n.onload=()=>{n.style.display="",C(e)},e.append(n);const i=u('
            ');e.append(i),t.hideInteractInput();let s=!1;return function e(){return h(this,null,(function*(){var n;if(yield(n=1e3,new Promise((t=>{window.setTimeout((()=>{t(null)}),n)}))),s)return;let i=!1;try{i=(yield t.getCtx().getApi().captcha.captchaStatus()).is_pass}catch(a){i=!1}i?t.triggerSuccess():e()}))}(),i.onclick=()=>{s=!0,t.cancel()},e}const ye={request:(t,e)=>t.getApi().captcha.captchaCheck(e),body:t=>t.get("iframe")?fe(t):function(t){const e=u(`${t.getCtx().$t("captchaCheck")}`);return e.querySelector(".atk-captcha-img").onclick=()=>{const n=e.querySelector(".atk-captcha-img");t.getApi().captcha.captchaGet().then((t=>{n.setAttribute("src",t)})).catch((t=>{console.error("Failed to get captcha image ",t)}))},e}(t),onSuccess(t,e,n,i){t.set("val",n)},onError(t,e,n,i){i.querySelector(".atk-captcha-img").click(),i.querySelector('input[type="text"]').value=""}},$e={inputType:"password",request(t,e){const n={name:_t.data.nick,email:_t.data.email,password:e};return(()=>h(this,null,(function*(){return(yield t.getApi().user.login(n.name,n.email,n.password)).token})))()},body:t=>u(`${t.getCtx().$t("adminCheck")}`),onSuccess(t,e,n,i){_t.update({isAdmin:!0,token:e}),t.getCtx().trigger("user-changed",_t.data),t.getCtx().listReload()},onError(t,e,n,i){}};class ve{constructor(t){d(this,"ctx"),d(this,"launched",[]),this.ctx=t}checkCaptcha(t){this.fire(ye,t,(e=>{e.set("img_data",t.imgData),e.set("iframe",t.iframe)}))}checkAdmin(t){this.fire($e,t)}fire(t,e,n){if(this.launched.includes(t))return;this.launched.push(t);const i=new O(this.ctx,`checker-${(new Date).getTime()}`);i.setMaskClickHide(!1),i.show();const s={};let a=!1;const r={set:(t,e)=>{s[t]=e},get:t=>s[t],getCtx:()=>this.ctx,getApi:()=>this.ctx.getApi(),getLayer:()=>i,hideInteractInput:()=>{a=!0},triggerSuccess:()=>{this.close(t,i),t.onSuccess&&t.onSuccess(r,"","",o),e.onSuccess&&e.onSuccess("",d.$el)},cancel:()=>{this.close(t,i),e.onCancel&&e.onCancel()}};n&&n(r);const o=u();o.appendChild(t.body(r));const l=u(``);let c;o.appendChild(l),setTimeout((()=>l.focus()),80),l.onkeyup=t=>{"Enter"!==t.key&&13!==t.keyCode||(t.preventDefault(),i.getEl().querySelector('button[data-action="confirm"]').click())};const d=new ge(this.ctx,o);d.setYes((n=>{const s=l.value.trim();c||(c=n.innerText);const a=()=>{n.innerText=c||"",n.classList.remove("error")};return n.innerText=`${this.ctx.$t("loading")}...`,t.request(r,s).then((n=>{this.close(t,i),t.onSuccess&&t.onSuccess(r,n,s,o),e.onSuccess&&e.onSuccess(s,d.$el)})).catch((e=>{var i;i=String(e.msg||String(e)),n.innerText=i,n.classList.add("error"),t.onError&&t.onError(r,e,s,o);const c=setTimeout((()=>a()),3e3);l.onfocus=()=>{a(),clearTimeout(c)}})),!1})),d.setNo((()=>(this.close(t,i),e.onCancel&&e.onCancel(),!1))),a&&(l.style.display="none",d.$el.querySelector(".atk-layer-dialog-actions").style.display="none"),i.getEl().append(d.$el),e.onMount&&e.onMount(d.$el)}close(t,e){e.disposeNow(),this.launched=this.launched.filter((e=>e!==t))}}function ke(t,e,n,i){return h(this,null,(function*(){var s,a;if(_t.data.token){const t=new Headers(n.headers);t.set("Authorization",`Bearer ${_t.data.token}`),n.headers=t}const r=yield function(t,e,n,i){var s;const a=new AbortController;null==(s=i.signal)||s.addEventListener("abort",(()=>a.abort()));let r=fetch(e,c(l({},i),{signal:a.signal}));if(n>0){const t=setTimeout((()=>a.abort()),n);r.finally((()=>{clearTimeout(t)}))}return r=r.catch((t=>{throw"AbortError"===(t||{}).name?new Error(Ot("reqAborted")):t})),r}(0,e,i||t.conf.reqTimeout||15e3,n),o=r.status,d=[401,400].includes(o);if(!r.ok&&!d)throw new Error(`${Ot("reqGot")} ${o}`);let h=yield r.json();const u=(i,s)=>{ke(t,e,n).then((t=>{i(t)})).catch((t=>{s(t)}))};if((null==(s=h.data)?void 0:s.need_captcha)?h=yield new Promise(((e,n)=>{t.checkCaptcha({imgData:h.data.img_data,iframe:h.data.iframe,onSuccess:()=>{u(e,n)},onCancel:()=>{n(h)}})})):((null==(a=h.data)?void 0:a.need_login)||d)&&(h=yield new Promise(((e,n)=>{t.checkAdmin({onSuccess:()=>{u(e,n)},onCancel:()=>{n(h)}})}))),!h.success)throw h;return h}))}function be(t){const e=new FormData;return Object.keys(t).forEach((n=>e.append(n,String(t[n])))),e}!function(){function t(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function e(t,e){for(var n=0;n({user:t.data.user,is_login:t.data.is_login,unread:t.data.unread||[],unread_count:t.data.unread_count||0}))),abort:()=>{n.abort()}}}loginStatus(){return h(this,null,(function*(){return(yield this.POST("/login-status",{name:_t.data.nick,email:_t.data.email}))||{is_login:!1,is_admin:!1}}))}logout(){return h(this,null,(function*(){return this.POST("/logout")}))}markRead(t,e,n=!1){const i={comment_id:t,notify_key:e};return n&&(delete i.comment_id,delete i.notify_key,i.read_all=!0,i.name=_t.data.nick,i.email=_t.data.email),this.POST("/mark-read",i)}userList(t,e,n){return h(this,null,(function*(){const i={offset:t||0,limit:e||15};n&&(i.type=n);return yield this.POST("/admin/user-get",i)}))}userAdd(t,e){return h(this,null,(function*(){const n={name:t.name||"",email:t.email||"",password:e||"",link:t.link||"",is_admin:t.is_admin||!1,site_names:t.site_names_raw||"",receive_email:t.receive_email||!0,badge_name:t.badge_name||"",badge_color:t.badge_color||""};return(yield this.POST("/admin/user-add",n)).user}))}userEdit(t,e){return h(this,null,(function*(){const n={id:t.id,name:t.name||"",email:t.email||"",password:e||"",link:t.link||"",is_admin:t.is_admin||!1,site_names:t.site_names_raw||"",receive_email:t.receive_email||!0,badge_name:t.badge_name||"",badge_color:t.badge_color||""};return(yield this.POST("/admin/user-edit",n)).user}))}userDel(t){return this.POST("/admin/user-del",{id:String(t)})}},system:class extends we{conf(){return h(this,null,(function*(){return he((yield this.POST("/conf")).frontend_conf||{})}))}getSettings(){return h(this,null,(function*(){return yield this.POST("/admin/setting-get")}))}saveSettings(t){return h(this,null,(function*(){return yield this.POST("/admin/setting-save",{data:t})}))}version(){return h(this,null,(function*(){const t=yield fetch(`${this.api.baseURL}/version`,{method:"POST"});return yield t.json()}))}},captcha:class extends we{captchaGet(){return h(this,null,(function*(){return(yield this.POST("/captcha/refresh")).img_data||""}))}captchaCheck(t){return h(this,null,(function*(){return(yield this.POST("/captcha/check",{value:t})).img_data||""}))}captchaStatus(){return h(this,null,(function*(){return(yield this.POST("/captcha/status"))||{is_pass:!1}}))}},admin:class extends we{cacheFlushAll(){return this.POST("/admin/cache-flush",{flush_all:!0})}cacheWarmUp(){return this.POST("/admin/cache-warm",{})}},upload:class extends we{imgUpload(t){return h(this,null,(function*(){const e=be({name:_t.data.nick,email:_t.data.email,page_key:this.ctx.conf.pageKey});e.set("file",t);const n={method:"POST",body:e};return(yield this.Fetch("/img-upload",n)).data||{}}))}}};class Ce{constructor(t){d(this,"ctx"),this.ctx=t,Object.entries(xe).forEach((([t,e])=>{this[t]=new e(this,this.ctx)}))}get baseURL(){return`${this.ctx.conf.server}/api`}}function Se(t){const e={editor:t,isMoved:!1,move:t=>function(t,e){if(t.isMoved)return;t.isMoved=!0;const n=t.editor.getUI().$el;n.after(u('
            '));const i=u("
            ");e.after(i),i.replaceWith(n),n.classList.add("atk-fade-in")}(e,t),back:()=>function(t){var e;if(!t.isMoved)return;t.isMoved=!1,null==(e=t.editor.ctx.$root.querySelector(".atk-editor-travel-placeholder"))||e.replaceWith(t.editor.getUI().$el),t.editor.cancelReply()}(e)};return e}class Ee{constructor(t){d(this,"editor"),d(this,"$panel"),d(this,"$btn"),d(this,"onHeaderInput"),d(this,"contentTransformer"),d(this,"onContentUpdated"),this.editor=t}get ctx(){return this.editor.ctx}registerPanel(t="
            "){return this.$panel=u(t),this.$panel}registerBtn(t){return this.$btn=u(`${t}`),this.$btn}registerHeaderInputEvt(t){this.onHeaderInput=t}registerContentTransformer(t){this.contentTransformer=t}registerContentUpdatedEvt(t){this.onContentUpdated=t}getPanel(){return this.$panel}getBtn(){return this.$btn}}d(Ee,"Name");class Te extends Ee{constructor(t){super(t),d(this,"emoticons",[]),d(this,"loadingTask",null),d(this,"$grpWrap"),d(this,"$grpSwitcher"),d(this,"isListLoaded",!1),d(this,"isImgLoaded",!1),this.editor=t,this.registerPanel('
            '),this.registerBtn(this.ctx.$t("emoticon")),this.registerContentTransformer((t=>this.transEmoticonImageText(t))),window.setTimeout((()=>{this.loadEmoticonsData()}),1e3)}onPanelShow(){(()=>{h(this,null,(function*(){yield this.loadEmoticonsData(),this.isImgLoaded||(this.initEmoticonsList(),this.isImgLoaded=!0),setTimeout((()=>{this.changeListHeight()}),30)}))})()}onPanelHide(){this.$panel.parentElement.style.height=""}loadEmoticonsData(){return h(this,null,(function*(){this.isListLoaded||(null===this.loadingTask?(this.loadingTask=(()=>h(this,null,(function*(){x(this.$panel),this.emoticons=yield this.handleData(this.ctx.conf.emoticons),C(this.$panel),this.loadingTask=null,this.isListLoaded=!0})))(),yield this.loadingTask):yield this.loadingTask)}))}handleData(t){return h(this,null,(function*(){if(!Array.isArray(t)&&["object","string"].includes(typeof t)&&(t=[t]),!Array.isArray(t))return L(this.$panel,"表情包数据必须为 Array/Object/String 类型"),C(this.$panel),[];const e=e=>{"object"==typeof e&&(e.name&&t.find((t=>t.name===e.name))||t.push(e))},n=t=>h(this,null,(function*(){yield Promise.all(t.map(((t,i)=>h(this,null,(function*(){if("object"!=typeof t||Array.isArray(t)){if(Array.isArray(t))yield n(t);else if("string"==typeof t){const i=yield this.remoteLoad(t);Array.isArray(i)?yield n(i):"object"==typeof i&&e(i)}}else e(t)})))))}));return yield n(t),t.forEach((t=>{if(this.isOwOFormat(t)){this.convertOwO(t).forEach((t=>{e(t)}))}else Array.isArray(t)&&t.forEach((t=>{e(t)}))})),t=t.filter((t=>"object"==typeof t&&!Array.isArray(t)&&!!t&&!!t.name)),this.solveNullKey(t),this.solveSameKey(t),t}))}remoteLoad(t){return h(this,null,(function*(){if(!t)return[];try{const e=yield fetch(t);return yield e.json()}catch(e){return C(this.$panel),L(this.$panel,`表情加载失败 ${String(e)}`),[]}}))}solveNullKey(t){t.forEach((t=>{t.items.forEach(((e,n)=>{e.key||(e.key=`${t.name} ${n+1}`)}))}))}solveSameKey(t){const e={};t.forEach((t=>{t.items.forEach((t=>{t.key&&""!==String(t.key).trim()&&(e[t.key]?e[t.key]++:e[t.key]=1,e[t.key]>1&&(t.key=`${t.key} ${e[t.key]}`))}))}))}isOwOFormat(t){try{return"object"==typeof t&&!!Object.values(t).length&&Array.isArray(Object.keys(Object.values(t)[0].container))&&Object.keys(Object.values(t)[0].container[0]).includes("icon")}catch(e){return!1}}convertOwO(t){const e=[];return Object.entries(t).forEach((([t,n])=>{const i={name:t,type:n.type,items:[]};n.container.forEach(((e,n)=>{const s=e.icon;if(/<(img|IMG)/.test(s)){const t=/src=["'](.*?)["']/.exec(s);t&&t.length>1&&(e.icon=t[1])}i.items.push({key:e.text||`${t} ${n+1}`,val:e.icon})})),e.push(i)})),e}initEmoticonsList(){this.$grpWrap=u('
            '),this.$panel.append(this.$grpWrap),this.emoticons.forEach(((t,e)=>{const n=u('');this.$grpWrap.append(n),n.setAttribute("data-index",String(e)),n.setAttribute("data-grp-name",t.name),n.setAttribute("data-type",t.type),t.items.forEach((e=>{const i=u('');if(n.append(i),e.key&&!new RegExp(`^(${t.name})?\\s?[0-9]+$`).test(e.key)&&i.setAttribute("title",e.key),"image"===t.type){const t=document.createElement("img");t.src=e.val,t.alt=e.key,i.append(t)}else i.innerText=e.val;i.onclick=()=>{"image"===t.type?this.editor.insertContent(`:[${e.key}]`):this.editor.insertContent(e.val||"")}}))})),this.emoticons.length>1&&(this.$grpSwitcher=u('
            '),this.$panel.append(this.$grpSwitcher),this.emoticons.forEach(((t,e)=>{const n=u("");n.innerText=t.name,n.setAttribute("data-index",String(e)),n.onclick=()=>this.openGrp(e),this.$grpSwitcher.append(n)}))),this.emoticons.length>0&&this.openGrp(0)}openGrp(t){var e,n,i;Array.from(this.$grpWrap.children).forEach((e=>{const n=e;n.getAttribute("data-index")!==String(t)?n.style.display="none":n.style.display=""})),null==(e=this.$grpSwitcher)||e.querySelectorAll("span.active").forEach((t=>t.classList.remove("active"))),null==(i=null==(n=this.$grpSwitcher)?void 0:n.querySelector(`span[data-index="${t}"]`))||i.classList.add("active"),this.changeListHeight()}changeListHeight(){}transEmoticonImageText(t){return this.emoticons&&Array.isArray(this.emoticons)?(this.emoticons.forEach((e=>{"image"===e.type&&Object.entries(e.items).forEach((([e,n])=>{t=t.split(`:[${n.key}]`).join(``)}))})),t):t}}d(Te,"Name","emoticons");class Le extends Ee{constructor(t){super(t),d(this,"$imgUploadInput"),d(this,"allowImgExts",["png","jpg","jpeg","gif","bmp","svg","webp"]),this.$imgUploadInput=document.createElement("input"),this.$imgUploadInput.type="file",this.$imgUploadInput.style.display="none",this.$imgUploadInput.accept=this.allowImgExts.map((t=>`.${t}`)).join(",");const e=this.registerBtn(`${this.ctx.$t("image")}`);e.after(this.$imgUploadInput),e.onclick=()=>{const t=this.$imgUploadInput;t.onchange=()=>{(()=>{h(this,null,(function*(){if(!t.files||0===t.files.length)return;const e=t.files[0];this.uploadImg(e)}))})()},t.click()},this.ctx.conf.imgUpload||this.getBtn().setAttribute("atk-only-admin-show","");const n=t=>{if(t)for(let e=0;e{t.stopPropagation(),t.preventDefault()})),this.editor.getUI().$textarea.addEventListener("drop",(t=>{var e;const i=null==(e=t.dataTransfer)?void 0:e.files;(null==i?void 0:i.length)&&(t.preventDefault(),n(i))})),this.editor.getUI().$textarea.addEventListener("paste",(t=>{var e;const i=null==(e=t.clipboardData)?void 0:e.files;(null==i?void 0:i.length)&&(t.preventDefault(),n(i))}))}uploadImg(t){return h(this,null,(function*(){const e=/[^.]+$/.exec(t.name);if(!e||!this.allowImgExts.includes(e[0]))return;if(!_t.checkHasBasicUserInfo())return void this.editor.showNotify(this.ctx.$t("uploadLoginMsg"),"w");let n="\n";""===this.editor.getUI().$textarea.value.trim()&&(n="");const i=`${n}![](Uploading ${t.name}...)`;let s;this.editor.insertContent(i);try{s=this.ctx.conf.imgUploader?{img_url:yield this.ctx.conf.imgUploader(t)}:yield this.ctx.getApi().upload.imgUpload(t)}catch(a){console.error(a),this.editor.showNotify(`${this.ctx.$t("uploadFail")},${a.msg}`,"e")}if(s&&s.img_url){let t=s.img_url;v(t)||(t=k(this.ctx,t)),this.editor.setContent(this.editor.getUI().$textarea.value.replace(i,`${n}![](${t})`))}else this.editor.setContent(this.editor.getUI().$textarea.value.replace(i,""))}))}}d(Le,"Name","upload");class Ae extends Ee{constructor(t){super(t),d(this,"isBind",!1),this.registerPanel('
            ');let e=this.editor.$t("preview");this.ctx.getMarkedInstance()&&(e+=' '),this.registerBtn(e),this.registerContentUpdatedEvt((t=>{this.updateContent()}))}onPanelShow(){if(this.updateContent(),!this.isBind){const t=()=>{this.updateContent()};this.editor.getUI().$textarea.addEventListener("input",t),this.editor.getUI().$textarea.addEventListener("change",t),this.isBind=!0}}updateContent(){"none"!==this.$panel.style.display&&(this.$panel.innerHTML=this.editor.getContentMarked())}}d(Ae,"Name","preview");class Oe extends Ee{constructor(t){super(t),d(this,"queryUserInfo",{timeout:null,abortFunc:null}),this.registerHeaderInputEvt(((t,e)=>{"nick"!==t&&"email"!==t||this.fetchUserInfo()})),this.editor.getUI().$link.addEventListener("change",(()=>{const t=this.editor.getUI().$link.value.trim();t&&!/^(http|https):\/\//.test(t)&&(this.editor.getUI().$link.value=`https://${t}`,_t.update({link:this.editor.getUI().$link.value}))}))}fetchUserInfo(){_t.logout(),this.queryUserInfo.timeout&&window.clearTimeout(this.queryUserInfo.timeout),this.queryUserInfo.abortFunc&&this.queryUserInfo.abortFunc(),this.queryUserInfo.timeout=window.setTimeout((()=>{this.queryUserInfo.timeout=null;const{req:t,abort:e}=this.ctx.getApi().user.userGet(_t.data.nick,_t.data.email);this.queryUserInfo.abortFunc=e,t.then((t=>{var e;t.is_login||_t.logout(),this.ctx.updateNotifies(t.unread),_t.checkHasBasicUserInfo()&&!t.is_login&&(null==(e=t.user)?void 0:e.is_admin)&&this.showLoginDialog(),t.user&&t.user.link&&(this.editor.getUI().$link.value=t.user.link,_t.update({link:t.user.link}))})).catch((()=>{})).finally((()=>{this.queryUserInfo.abortFunc=null}))}),400)}showLoginDialog(){this.ctx.checkAdmin({onSuccess:()=>{}})}}d(Oe,"Name","headerInput");const Me=[Te,Le,Ae,Oe];function _e(t){const e={editor:t,plugList:{},openedPlugName:null,openPlugPanel:t=>Be(e,t),closePlugPanel:()=>Pe(e),triggerHeaderInputEvt:(t,n)=>function(t,e,n){Object.entries(t.plugList).forEach((([t,i])=>{i.onHeaderInput&&i.onHeaderInput(e,n)}))}(e,t,n),triggerContentUpdatedEvt:t=>function(t,e){Object.entries(t.plugList).forEach((([t,n])=>{n.onContentUpdated&&n.onContentUpdated(e)}))}(e,t),getTransformedContent:t=>function(t,e){let n=e;return Object.entries(t.plugList).forEach((([t,e])=>{e.contentTransformer&&(n=e.contentTransformer(n))})),n}(e,t)};t.getUI().$plugPanelWrap.innerHTML="",t.getUI().$plugPanelWrap.style.display="none",t.getUI().$plugBtnWrap.innerHTML="";const n=[{k:"upload",v:(i=t.conf).imgUpload},{k:"emoticons",v:i.emoticons},{k:"preview",v:i.preview}].filter((t=>!t.v)).flatMap((t=>t.k));var i;return Me.filter((t=>!n.includes(t.Name))).forEach((t=>{!function(t,e){const n=e.Name,i=new e(t.editor);t.plugList[n]=i,function(t,e,n){const i=n.getBtn();if(!i)return;t.editor.getUI().$plugBtnWrap.appendChild(i),i.onclick=i.onclick||(()=>{t.editor.getUI().$plugBtnWrap.querySelectorAll(".active").forEach((t=>t.classList.remove("active"))),e!==t.openedPlugName?(Be(t,e),i.classList.add("active")):Pe(t)});const s=n.getPanel();s&&(s.setAttribute("data-plug-name",e),s.style.display="none",t.editor.getUI().$plugPanelWrap.appendChild(s))}(t,n,i)}(e,t)})),e}function Be(t,e){Object.entries(t.plugList).forEach((([t,n])=>{const i=n.getPanel();i&&(t===e?(i.style.display="",n.onPanelShow&&n.onPanelShow()):(i.style.display="none",n.onPanelHide&&n.onPanelHide()))})),t.editor.getUI().$plugPanelWrap.style.display="",t.openedPlugName=e}function Pe(t){if(!t.openedPlugName)return;const e=t.plugList[t.openedPlugName];e&&(e.onPanelHide&&e.onPanelHide(),t.editor.getUI().$plugPanelWrap.style.display="none",t.openedPlugName=null)}function Re(t){const e={editor:t,comment:void 0,setReply:(t,n,i)=>function(t,e,n,i=!0){t.editor.cancelEditComment(),Ie(t);const s=t.editor.getUI();s.$sendReply||(s.$sendReply=u(`
            ${t.editor.$t("reply")} ×
            `),s.$sendReply.querySelector(".atk-text").innerText=`@${e.nick}`,s.$sendReply.addEventListener("click",(()=>{t.editor.cancelReply()})),s.$textareaWrap.append(s.$sendReply));t.comment=e,t.editor.travel(n),i&&S(s.$el);s.$textarea.focus()}(e,t,n,i),cancelReply:()=>Ie(e)};return e}function Ie(t){if(!t.comment)return;const e=t.editor.getUI();e.$sendReply&&(e.$sendReply.remove(),e.$sendReply=void 0),t.comment=void 0,t.editor.travelBack()}function Ue(t){const e={editor:t,comment:void 0,setEdit:(t,n)=>function(t,e,n){De(t),t.editor.cancelReply();const i=t.editor.getUI();if(!i.$editCancelBtn){const e=u(`
            ${t.editor.$t("editCancel")} ×
            `);e.onclick=()=>{De(t)},i.$textareaWrap.append(e),i.$editCancelBtn=e}t.comment=e,i.$header.style.display="none",t.editor.travel(n),i.$nick.value=e.nick||"",i.$email.value=e.email||"",i.$link.value=e.link||"",t.editor.setContent(e.content),i.$textarea.focus(),t.editor.refreshSendBtnText()}(e,t,n),cancelEdit:()=>De(e)};return function(t){const e=t.editor.getSubmitManager();if(!e)throw Error("submitManager not initialized");e.registerCustom({activeCond:()=>!!t.comment,req:()=>h(this,null,(function*(){const e={content:t.editor.getFinalContent(),nick:t.editor.getUI().$nick.value,email:t.editor.getUI().$email.value,link:t.editor.getUI().$link.value};return yield t.editor.ctx.getApi().comment.commentEdit(l(l({},t.comment),e))})),post:e=>{t.editor.ctx.updateComment(e)}})}(e),e}function De(t){if(!t.comment)return;const e=t.editor.getUI();e.$editCancelBtn&&(e.$editCancelBtn.remove(),e.$editCancelBtn=void 0),t.comment=void 0,t.editor.travelBack();const{nick:n,email:i,link:s}=_t.data;e.$nick.value=n,e.$email.value=i,e.$link.value=s,t.editor.setContent(""),t.editor.refreshSendBtnText(),e.$header.style.display=""}function qe(t){const e={editor:t,do:()=>function(t){return h(this,null,(function*(){if(""===t.editor.getFinalContent().trim())return void t.editor.focus();const e=t.customs.find((t=>t.activeCond()));t.editor.ctx.trigger("editor-submit"),t.editor.showLoading();try{let n;(null==e?void 0:e.pre)&&e.pre(),n=(null==e?void 0:e.req)?yield e.req():yield function(t){return h(this,null,(function*(){const e=yield t.editor.ctx.getApi().comment.add(l({},function(t){var e;const{nick:n,email:i,link:s}=_t.data,a=t.editor.ctx.conf,r=null==(e=t.editor.getReplyManager())?void 0:e.comment;return{content:t.editor.getFinalContent(),nick:n,email:i,link:s,rid:r?r.id:0,page_key:r?r.page_key:a.pageKey,page_title:r?void 0:a.pageTitle,site_name:r?r.site_name:a.site}}(t)));return e}))}(t),(null==e?void 0:e.post)?e.post(n):function(t,e){const n=t.editor.getReplyManager(),i=t.editor.ctx.conf;(null==n?void 0:n.comment)&&n.comment.page_key!==i.pageKey&&window.open(`${n.comment.page_url}#atk-comment-${e.id}`);t.editor.ctx.insertComment(e)}(t,n)}catch(n){return console.error(n),void t.editor.showNotify(`${t.editor.$t("commentFail")},${n.msg||String(n)}`,"e")}finally{t.editor.hideLoading()}t.editor.reset(),t.editor.ctx.trigger("editor-submitted")}))}(e),customs:[],registerCustom:t=>{e.customs.push(t)}};return e}const We={localStorage:function(t){const e=window.localStorage.getItem("ArtalkContent")||"";""!==e.trim()&&(t.showNotify(t.$t("restoredMsg"),"i"),t.setContent(e));const n=()=>{t.saveToLocalStorage()};return t.getUI().$textarea.addEventListener("input",n),()=>{t.getUI().$textarea.removeEventListener("input",n)}},header:function(t){const e=t.getHeaderInputEls(),n={};return Object.entries(e).forEach((([e,n])=>{n.placeholder=`${t.$t(e)}`,n.value=_t.data[e]||""})),Object.entries(e).forEach((([e,i])=>{i.addEventListener("input",n[e]=((e,n)=>()=>{var i;t.isEditMode||(_t.update({[n]:e.value.trim()}),null==(i=t.getPlugs())||i.triggerHeaderInputEvt(n,e))})(i,e))})),()=>{Object.entries(e).forEach((([t,e])=>{e.removeEventListener("input",n[t])}))}},textarea:function(t){t.getUI().$textarea.placeholder=t.ctx.conf.placeholder||t.$t("placeholder");const e=e=>{9===(e.keyCode||e.which)&&(e.preventDefault(),t.insertContent("\t"))},n=()=>{t.adjustTextareaHeight()};return t.getUI().$textarea.addEventListener("keydown",e),t.getUI().$textarea.addEventListener("input",n),()=>{t.getUI().$textarea.removeEventListener("keydown",e),t.getUI().$textarea.removeEventListener("input",n)}},submitBtn:function(t){t.refreshSendBtnText();const e=()=>{t.submit()};return t.getUI().$submitBtn.addEventListener("click",e),()=>{t.getUI().$submitBtn.removeEventListener("click",e)}},submitManager:function(t){t.setSubmitManager(qe(t)),t.setEditModeManager(Ue(t))},mover:function(t){if(!t.conf.editorTravel)return;t.setMover(Se(t))},reply:function(t){t.setReplyManager(Re(t))},plugs:function(t){t.setPlugs(_e(t))}};const Fe={$header:".atk-header",$nick:'.atk-header [name="nick"]',$email:'.atk-header [name="email"]',$link:'.atk-header [name="link"]',$textareaWrap:".atk-textarea-wrap",$textarea:".atk-textarea",$bottom:".atk-bottom",$submitBtn:".atk-send-btn",$notifyWrap:".atk-notify-wrap",$plugBtnWrap:".atk-plug-btn-wrap",$plugPanelWrap:".atk-plug-panel-wrap"};class He extends w{constructor(t){super(t),d(this,"ui"),d(this,"plugs"),d(this,"mover"),d(this,"reply"),d(this,"editMode"),d(this,"submitManager"),d(this,"unmountFuncs",[]),this.ui=function(){const t=u('
            \n
            \n \n \n \n
            \n
            \n \n
            \n \n
            \n
            \n
            \n \n
            \n
            \n
            \n
            \n'),e={$el:t};return Object.entries(Fe).forEach((([n,i])=>{e[n]=t.querySelector(i)})),e}(),this.$el=this.ui.$el,this.ctx.on("conf-loaded",(()=>{var t;null==(t=this.unmountFuncs)||t.forEach((t=>!!t&&t())),this.unmountFuncs=function(t){const e=[];return Object.entries(We).forEach((([n,i])=>{const s=i(t);s&&e.push(s)})),e}(this)}))}getUI(){return this.ui}getPlugs(){return this.plugs}setPlugs(t){this.plugs=t}setMover(t){this.mover=t}setReplyManager(t){this.reply=t}getReplyManager(){return this.reply}get isReplyMode(){var t;return!!(null==(t=this.reply)?void 0:t.comment)}setEditModeManager(t){this.editMode=t}get isEditMode(){var t;return!!(null==(t=this.editMode)?void 0:t.comment)}setSubmitManager(t){this.submitManager=t}getSubmitManager(){return this.submitManager}getHeaderInputEls(){return{nick:this.ui.$nick,email:this.ui.$email,link:this.ui.$link}}saveToLocalStorage(){window.localStorage.setItem("ArtalkContent",this.getContentOriginal().trim())}refreshSendBtnText(){this.isEditMode?this.ui.$submitBtn.innerText=this.$t("save"):this.ui.$submitBtn.innerText=this.ctx.conf.sendBtn||this.$t("send")}getFinalContent(){let t=this.getContentOriginal();return this.plugs&&(t=this.plugs.getTransformedContent(t)),t}getContentOriginal(){return this.ui.$textarea.value||""}getContentMarked(){return wt(this.ctx,this.getFinalContent())}setContent(t){this.ui.$textarea.value=t,this.saveToLocalStorage(),this.plugs&&this.plugs.triggerContentUpdatedEvt(t),window.setTimeout((()=>{this.adjustTextareaHeight()}),80)}insertContent(t){if(document.selection)this.ui.$textarea.focus(),document.selection.createRange().text=t,this.ui.$textarea.focus();else if(this.ui.$textarea.selectionStart||0===this.ui.$textarea.selectionStart){const e=this.ui.$textarea.selectionStart,n=this.ui.$textarea.selectionEnd,i=this.ui.$textarea.scrollTop;this.setContent(this.ui.$textarea.value.substring(0,e)+t+this.ui.$textarea.value.substring(n,this.ui.$textarea.value.length)),this.ui.$textarea.focus(),this.ui.$textarea.selectionStart=e+t.length,this.ui.$textarea.selectionEnd=e+t.length,this.ui.$textarea.scrollTop=i}else this.ui.$textarea.focus(),this.ui.$textarea.value+=t}adjustTextareaHeight(){const t=this.ui.$textarea.offsetHeight-this.ui.$textarea.clientHeight;this.ui.$textarea.style.height="0px",this.ui.$textarea.style.height=`${this.ui.$textarea.scrollHeight+t}px`}focus(){this.ui.$textarea.focus()}reset(){this.setContent(""),this.cancelReply(),this.cancelEditComment()}setReply(t,e,n=!0){var i;null==(i=this.reply)||i.setReply(t,e,n)}cancelReply(){var t;null==(t=this.reply)||t.cancelReply()}setEditComment(t,e){var n;null==(n=this.editMode)||n.setEdit(t,e)}cancelEditComment(){var t;null==(t=this.editMode)||t.cancelEdit()}showNotify(t,e){E(this.ui.$notifyWrap,t,e)}showLoading(){x(this.ui.$el)}hideLoading(){C(this.ui.$el)}submit(){return h(this,null,(function*(){if(!this.submitManager)throw Error("submitManger not initialized");yield this.submitManager.do()}))}close(){this.ui.$textareaWrap.querySelector(".atk-comment-closed")||this.ui.$textareaWrap.prepend(u(`
            ${this.$t("onlyAdminCanReply")}
            `)),_t.data.isAdmin?(this.ui.$textarea.style.display="",this.ui.$bottom.style.display=""):(this.ui.$textarea.style.display="none",this.closePlugPanel(),this.ui.$bottom.style.display="none")}open(){var t;null==(t=this.ui.$textareaWrap.querySelector(".atk-comment-closed"))||t.remove(),this.ui.$textarea.style.display="",this.ui.$bottom.style.display=""}travel(t){var e;null==(e=this.mover)||e.move(t)}travelBack(){var t;null==(t=this.mover)||t.back()}openPlugPanel(t){var e;null==(e=this.plugs)||e.openPlugPanel(t)}closePlugPanel(){var t;null==(t=this.plugs)||t.closePlugPanel()}}class Ne extends w{constructor(t){super(t),d(this,"layer"),d(this,"$header"),d(this,"$closeBtn"),d(this,"$iframeWrap"),d(this,"$iframe"),d(this,"firstShow",!0),this.$el=u('
            \n
            \n
            \n
            \n
            \n
            \n
            \n
            \n'),this.$header=this.$el.querySelector(".atk-sidebar-header"),this.$closeBtn=this.$header.querySelector(".atk-sidebar-close"),this.$iframeWrap=this.$el.querySelector(".atk-sidebar-iframe-wrap"),this.$closeBtn.onclick=()=>{this.hide()},this.ctx.on("user-changed",(()=>{this.firstShow=!0}))}show(){return h(this,arguments,(function*(t={}){if(this.$el.style.transform="",null==this.layer&&(this.layer=new O(this.ctx,"sidebar",this.$el),this.layer.afterHide=()=>{!0===this.ctx.conf.editorTravel&&this.ctx.editorTravelBack()}),this.layer.show(),(()=>{h(this,null,(function*(){var e;const n=yield this.ctx.getApi().user.loginStatus();n.is_admin&&!n.is_login&&(null==(e=this.layer)||e.hide(),this.firstShow=!0,this.ctx.checkAdmin({onSuccess:()=>{setTimeout((()=>{this.show(t)}),500)},onCancel:()=>{}}))}))})(),this.firstShow){this.$iframeWrap.innerHTML="",this.$iframe=u("");const e=k(this.ctx,"/sidebar/"),n={pageKey:this.conf.pageKey,site:this.conf.site||"",user:JSON.stringify(_t.data),time:+new Date};t.view&&(n.view=t.view),this.conf.darkMode&&(n.darkMode="1"),"string"==typeof this.conf.locale&&(n.locale=this.conf.locale);const i=new URLSearchParams(n);this.iframeLoad(`${e}?${i.toString()}`),this.$iframeWrap.append(this.$iframe),this.firstShow=!1}else{const t=this.$iframe.src.includes("darkMode=1");this.conf.darkMode&&!t&&this.iframeLoad(`${this.$iframe.src}&darkMode=1`),!this.conf.darkMode&&t&&this.iframeLoad(this.$iframe.src.replace("&darkMode=1",""))}setTimeout((()=>{this.$el.style.transform="translate(0, 0)"}),100),setTimeout((()=>{this.ctx.updateNotifies([])}),0),this.ctx.trigger("sidebar-show")}))}hide(){var t;this.$el.style.transform="",null==(t=this.layer)||t.hide(),this.ctx.trigger("sidebar-hide")}iframeLoad(t){this.$iframe&&(this.$iframe.src=t,x(this.$iframeWrap),this.$iframe.onload=()=>{C(this.$iframeWrap)})}}const je={i18n(t){At(t.conf.locale),t.on("conf-loaded",(()=>{At(t.conf.locale)}))},markdown(){!function(){try{if(!t.marked.name)return}catch(s){return}const e=new t.marked.Renderer,n=e.link;e.link=(t,i,s)=>{const a=null==t?void 0:t.startsWith(`${window.location.protocol}//${window.location.hostname}`);return n.call(e,t,i,s).replace(/^{const n=e||"plaintext";let i=t;return window.hljs?n&&window.hljs.getLanguage(n)&&(i=window.hljs.highlight(n,t).value):i=vt(t),`
            \n${i.replace(/&/g,"&")}\n
            `};const i=t.marked;t.marked.setOptions({renderer:e,pedantic:!1,gfm:!0,breaks:!0,smartLists:!0,smartypants:!0,xhtml:!1,sanitize:!1,silent:!0}),kt=i}()},user:t=>(_t.setContext(t),_t),api:t=>new Ce(t),checkerLauncher:t=>new ve(t),editor(t){const e=new He(t);return t.$root.appendChild(e.$el),e},list(t){const e=new pe(t);return t.$root.appendChild(e.$el),e.fetchComments(0),e},layer(t){O.BodyOrgOverflow=document.body.style.overflow,O.BodyOrgPaddingRight=document.body.style.paddingRight},sidebarLayer:t=>new Ne(t),eventsDefault(t){window.addEventListener("hashchange",(()=>{t.listHashGotoCheck()})),t.on("user-changed",(()=>{t.checkAdminShowEl(),t.listRefreshUI()}))},darkMode(t){P(t),t.on("conf-loaded",(()=>{P(t)}))}};function ze(t){return h(this,null,(function*(){const e=t.ctx.conf.countEl;e&&document.querySelector(e)&&Ve(t,{api:"page_comment",countEl:e});const n=t.pvAdd?yield t.ctx.getApi().page.pv():void 0,i=t.ctx.conf.pvEl;i&&document.querySelector(i)&&Ve(t,{api:"page_pv",countEl:i,curtPageCount:n})}))}function Ve(t,e){return h(this,null,(function*(){let n={};const i=t.ctx.conf.pageKey;e.curtPageCount&&(n[i]=e.curtPageCount);let s=Array.from(document.querySelectorAll(e.countEl)).map((t=>t.getAttribute("data-page-key")||i)).filter((t=>void 0===n[t]));if(s=[...new Set(s)],s.length>0){const i=yield t.ctx.getApi().page.stat(e.api,s);n=l(l({},n),i)}document.querySelectorAll(e.countEl).forEach((t=>{const e=t.getAttribute("data-page-key")||i;t.innerHTML=`${Number(n[e]||0)}`}))}))}const Qe=class t{constructor(e){d(this,"conf"),d(this,"ctx"),d(this,"$root"),t.instance&&t.destroy(),this.conf=de(e),this.conf.el instanceof HTMLElement&&(this.$root=this.conf.el),this.ctx=new me(this.conf,this.$root),Object.entries(je).forEach((([e,n])=>{if(t.DisabledComponents.includes(e))return;const i=n(this.ctx);i&&this.ctx.inject(e,i)})),t.plugins.forEach((t=>{"function"==typeof t&&t(this.ctx)}))}static init(e){return this.instance&&t.destroy(),this.instance=new t(e),this.instance}use(e){t.plugins.push(e),"function"==typeof e&&e(this.ctx)}update(e){if(!t.instance)throw Error("cannot call `update` function before call `load`");return t.instance.ctx.updateConf(e),t.instance}reload(){this.ctx.listReload()}destroy(){if(!t.instance)throw Error("cannot call `destroy` function before call `load`");t.instance.$root.remove(),delete t.instance}on(t,e){this.ctx.on(t,e,"external")}off(t,e){this.ctx.off(t,e,"external")}trigger(t,e){this.ctx.trigger(t,e,"external")}setDarkMode(t){this.ctx.setDarkMode(t)}static use(t){this.plugins.push(t),this.instance&&"function"==typeof t&&t(this.instance.ctx)}static update(t){var e;return null==(e=this.instance)?void 0:e.update(t)}static reload(){var t;null==(t=this.instance)||t.reload()}static destroy(){var t;null==(t=this.instance)||t.destroy()}static on(t,e){var n;null==(n=this.instance)||n.on(t,e)}static off(t,e){var n;null==(n=this.instance)||n.off(t,e)}static trigger(t,e){var n;null==(n=this.instance)||n.trigger(t,e)}static setDarkMode(t){var e;null==(e=this.instance)||e.setDarkMode(t)}static loadCountWidget(t){const e=new me(de(t));e.inject("api",new Ce(e)),ze({ctx:e,pvAdd:!1})}static LoadCountWidget(t){console.warn("The method `LoadCountWidget` is deprecated, please use `loadCountWidget` instead."),this.loadCountWidget(t)}};return d(Qe,"instance"),d(Qe,"ListLite",ue),d(Qe,"defaults",ce),d(Qe,"plugins",[t=>{t.conf.useBackendConf?t.on("list-loaded",(()=>{ze({ctx:t,pvAdd:!0})})):ze({ctx:t,pvAdd:!0})}]),d(Qe,"DisabledComponents",[]),Qe})); diff --git a/dependencies.json b/dependencies.json index f7485ab16..2ee5a8e34 100644 --- a/dependencies.json +++ b/dependencies.json @@ -71,7 +71,7 @@ }, { "name": "artalk", - "version": "2.6.3", + "version": "2.6.4", "files": [ { "remote": "dist/Artalk.js",