Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@waline/client

Package Overview
Dependencies
Maintainers
2
Versions
173
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@waline/client - npm Package Compare versions

Comparing version 2.4.2 to 2.5.0

src/styles/gif.scss

2

dist/component.esm.js

@@ -1,2 +0,2 @@

import{getCurrentScope as e,onScopeDispose as t,watch as n,ref as o,unref as l,isRef as a,readonly as i,shallowRef as r,h as s,computed as c,defineComponent as u,inject as m,onMounted as d,onUnmounted as v,resolveComponent as p,openBlock as g,createElementBlock as f,createElementVNode as h,createVNode as w,toDisplayString as y,createCommentVNode as b,normalizeClass as k,Fragment as C,renderList as $,withDirectives as I,vModelDynamic as j,vModelText as L,vShow as x,createTextVNode as S,createBlock as E,provide as R}from"vue";import z from"autosize";import{marked as A}from"marked";function U(n){return!!e()&&(t(n),!0)}const M="undefined"!=typeof window,O=()=>{};const P=e=>e();var N=Object.getOwnPropertySymbols,_=Object.prototype.hasOwnProperty,T=Object.prototype.propertyIsEnumerable;function D(e,t,o={}){const l=o,{eventFilter:a=P}=l,i=((e,t)=>{var n={};for(var o in e)_.call(e,o)&&t.indexOf(o)<0&&(n[o]=e[o]);if(null!=e&&N)for(var o of N(e))t.indexOf(o)<0&&T.call(e,o)&&(n[o]=e[o]);return n})(l,["eventFilter"]);return n(e,(r=a,s=t,function(...e){r((()=>s.apply(this,e)),{fn:s,thisArg:this,args:e})}),i);var r,s}var B=Object.defineProperty,F=Object.defineProperties,V=Object.getOwnPropertyDescriptors,H=Object.getOwnPropertySymbols,W=Object.prototype.hasOwnProperty,q=Object.prototype.propertyIsEnumerable,J=(e,t,n)=>t in e?B(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;function K(e,t,n={}){const l=n,{eventFilter:a}=l,i=((e,t)=>{var n={};for(var o in e)W.call(e,o)&&t.indexOf(o)<0&&(n[o]=e[o]);if(null!=e&&H)for(var o of H(e))t.indexOf(o)<0&&q.call(e,o)&&(n[o]=e[o]);return n})(l,["eventFilter"]),{eventFilter:r,pause:s,resume:c,isActive:u}=function(e=P){const t=o(!0);return{isActive:t,pause:function(){t.value=!1},resume:function(){t.value=!0},eventFilter:(...n)=>{t.value&&e(...n)}}}(a),m=D(e,t,(d=((e,t)=>{for(var n in t||(t={}))W.call(t,n)&&J(e,n,t[n]);if(H)for(var n of H(t))q.call(t,n)&&J(e,n,t[n]);return e})({},i),F(d,V({eventFilter:r}))));var d;return{stop:m,pause:s,resume:c,isActive:u}}const Y=M?window:void 0,G=M?window.document:void 0;function X(...e){let t,o,a,i;if("string"==typeof e[0]?([o,a,i]=e,t=Y):[t,o,a,i]=e,!t)return O;let r=O;const s=n((()=>function(e){var t;const n=l(e);return null!=(t=null==n?void 0:n.$el)?t:n}(t)),(e=>{r(),e&&(e.addEventListener(o,a,i),r=()=>{e.removeEventListener(o,a,i),r=O})}),{immediate:!0,flush:"post"}),c=()=>{s(),r()};return U(c),c}M&&window.navigator,M&&window.location;const Q="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},Z="__vueuse_ssr_handlers__";Q[Z]=Q[Z]||{};const ee=Q[Z];const te={boolean:{read:e=>"true"===e,write:e=>String(e)},object:{read:e=>JSON.parse(e),write:e=>JSON.stringify(e)},number:{read:e=>Number.parseFloat(e),write:e=>String(e)},any:{read:e=>e,write:e=>String(e)},string:{read:e=>e,write:e=>String(e)},map:{read:e=>new Map(JSON.parse(e)),write:e=>JSON.stringify(Array.from(e.entries()))},set:{read:e=>new Set(JSON.parse(e)),write:e=>JSON.stringify(Array.from(e))},date:{read:e=>new Date(e),write:e=>e.toISOString()}};function ne(e,t,n,a={}){var i;const{flush:s="pre",deep:c=!0,listenToStorageChanges:u=!0,writeDefaults:m=!0,shallow:d,window:v=Y,eventFilter:p,onError:g=(e=>{console.error(e)})}=a,f=(d?r:o)(t);if(!n)try{n=function(e,t){return ee[e]||t}("getDefaultStorage",(()=>{var e;return null==(e=Y)?void 0:e.localStorage}))()}catch(e){g(e)}if(!n)return f;const h=l(t),w=function(e){return null==e?"any":e instanceof Set?"set":e instanceof Map?"map":e instanceof Date?"date":"boolean"==typeof e?"boolean":"string"==typeof e?"string":"object"==typeof e||Array.isArray(e)?"object":Number.isNaN(e)?"any":"number"}(h),y=null!=(i=a.serializer)?i:te[w],{pause:b,resume:k}=K(f,(()=>function(t){try{null==t?n.removeItem(e):n.setItem(e,y.write(t))}catch(e){g(e)}}(f.value)),{flush:s,deep:c,eventFilter:p});return v&&u&&X(v,"storage",C),C(),f;function C(t){t&&t.key!==e||(f.value=function(t){if(!t||t.key===e){b();try{const o=t?t.newValue:n.getItem(e);return null==o?(m&&null!==h&&n.setItem(e,y.write(h)),h):"string"!=typeof o?o:y.read(o)}catch(e){g(e)}finally{k()}}}(t))}}var oe,le,ae=Object.defineProperty,ie=Object.getOwnPropertySymbols,re=Object.prototype.hasOwnProperty,se=Object.prototype.propertyIsEnumerable,ce=(e,t,n)=>t in e?ae(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;function ue(e={}){const{controls:t=!1,interval:i="requestAnimationFrame"}=e,r=o(new Date),s=()=>r.value=new Date,c="requestAnimationFrame"===i?function(e,t={}){const{immediate:n=!0,window:l=Y}=t,a=o(!1);let i=null;function r(){a.value&&l&&(e(),i=l.requestAnimationFrame(r))}function s(){!a.value&&l&&(a.value=!0,r())}function c(){a.value=!1,null!=i&&l&&(l.cancelAnimationFrame(i),i=null)}return n&&s(),U(c),{isActive:a,pause:c,resume:s}}(s,{immediate:!0}):function(e,t=1e3,i={}){const{immediate:r=!0,immediateCallback:s=!1}=i;let c=null;const u=o(!1);function m(){c&&(clearInterval(c),c=null)}function d(){u.value=!1,m()}function v(){t<=0||(u.value=!0,s&&e(),m(),c=setInterval(e,l(t)))}r&&M&&v(),a(t)&&U(n(t,(()=>{r&&M&&v()})));return U(d),{isActive:u,pause:d,resume:v}}(s,i,{immediate:!0});return t?((e,t)=>{for(var n in t||(t={}))re.call(t,n)&&ce(e,n,t[n]);if(ie)for(var n of ie(t))se.call(t,n)&&ce(e,n,t[n]);return e})({now:r},c):r}M&&(null==window?void 0:window.navigator)&&(null==(oe=null==window?void 0:window.navigator)?void 0:oe.platform)&&/iP(ad|hone|od)/.test(null==(le=null==window?void 0:window.navigator)?void 0:le.platform);let me=0;const de=({size:e})=>s("svg",{width:e,height:e,viewBox:"0 0 100 100",preserveAspectRatio:"xMidYMid"},s("circle",{cx:50,cy:50,fill:"none",stroke:"currentColor",strokeWidth:"4",r:"40","stroke-dasharray":"85 30"},s("animateTransform",{attributeName:"transform",type:"rotate",repeatCount:"indefinite",dur:"1s",values:"0 50 50;360 50 50",keyTimes:"0;1"}))),ve=["nick","mail","link"],pe=e=>e.filter((e=>ve.includes(e))),ge=e=>new Promise(((t,n)=>{const o=new FileReader;o.readAsDataURL(e),o.onload=()=>t(o.result?.toString()||""),o.onerror=n})),fe=e=>!0===e?'<p class="wl-tex">Tex is not available in preview</p>':'<span class="wl-tex">Tex is not available in preview</span>',he=new RegExp(`(${/[\u4E00-\u9FFF\u3400-\u4dbf\uf900-\ufaff\u3040-\u309f\uac00-\ud7af\u0400-\u04FF]+|\w+/.source}|${/</.source})|((?:${/(?:^|\s)\/\/(.+?)$/gm.source})|(?:${/\/\*([\S\s]*?)\*\//gm.source}))`,"gmi"),we=["23AC69","91C132","F19726","E8552D","1AAB8E","E1147F","2980C1","1BA1E6","9FA0A0","F19726","E30B20","E30B20","A3338B"],ye={},be=e=>{let t=0;return e.replace(he,((e,n,o)=>{if(o)return`<span style="color: slategray">${o}</span>`;if("<"===n)return"&lt;";let l;ye[n]?l=ye[n]:(l=we[t],ye[n]=l);const a=`<span style="color: #${l}">${n}</span>`;return t=++t%we.length,a}))},ke=["nick","nickError","mail","mailError","link","optional","placeholder","sofa","submit","like","cancelLike","reply","cancelReply","comment","refresh","more","preview","emoji","uploadImage","seconds","minutes","hours","days","now","uploading","login","logout","admin","sticky","word","wordHint","anonymous","level0","level1","level2","level3","level4","level5"],Ce=e=>Object.fromEntries(e.map(((e,t)=>[ke[t],e])));var $e=Ce(["NickName","NickName cannot be less than 3 bytes.","E-Mail","Please confirm your email address.","Website","Optional","Comment here...","No comment yet.","Submit","Like","Cancel like","Reply","Cancel reply","Comments","Refresh","Load More...","Preview","Emoji","Upload Image","seconds ago","minutes ago","hours ago","days ago","just now","Uploading","Login","logout","Admin","Sticky","Words","Please input comments between $0 and $1 words!\n Current word number: $2","Anonymous","Dwarves","Hobbits","Ents","Wizards","Elves","Maiar"]),Ie=Ce(["ニックネーム","3バイト以上のニックネームをご入力ください.","メールアドレス","メールアドレスをご確認ください.","サイト","オプション","ここにコメント","コメントしましょう~","提出する","Like","Cancel like","返信する","キャンセル","コメント","更新","さらに読み込む","プレビュー","絵文字","画像をアップロード","秒前","分前","時間前","日前","たっだ今","アップロード","ログインする","ログアウト","管理者","トップに置く","ワード","コメントは $0 から $1 ワードの間でなければなりません!\n 現在の単語番号: $2","匿名"]),je=Ce(["昵称","昵称不能少于3个字符","邮箱","请填写正确的邮件地址","网址","可选","欢迎评论","来发评论吧~","提交","喜欢","取消喜欢","回复","取消回复","评论","刷新","加载更多...","预览","表情","上传图片","秒前","分钟前","小时前","天前","刚刚","正在上传","登录","退出","博主","置顶","字","评论字数应在 $0 到 $1 字之间!\n当前字数:$2","匿名","潜水","冒泡","吐槽","活跃","话痨","传说"]),Le=Ce(["暱稱","郵箱","網址","可選","暱稱不能少於3個字元","請填寫正確的郵件地址","歡迎評論","來發評論吧~","提交","喜歡","取消喜歡","回覆","取消回覆","評論","刷新","載入更多...","預覽","表情","上傳圖片","秒前","分鐘前","小時前","天前","剛剛","正在上傳","登錄","退出","博主","置頂","字","評論字數應在 $0 到 $1 字之間!\n當前字數:$2","匿名","潛水","冒泡","吐槽","活躍","話癆","傳說"]),xe=Ce(["Apelido","Apelido não pode ser menor que 3 bytes.","E-Mail","Por favor, confirme seu endereço de e-mail.","Website","Opcional","Comente aqui...","Nenhum comentário, ainda.","Enviar","Like","Cancel like","Responder","Cancelar resposta","Comentários","Refrescar","Carregar Mais...","Visualizar","Emoji","Enviar Imagem","segundos atrás","minutos atrás","horas atrás","dias atrás","agora mesmo","Enviando","Entrar","Sair","Admin","Sticky","Palavras","Favor enviar comentário com $0 a $1 palavras!\n Número de palavras atuais: $2","Anônimo"]),Se=Ce(["Псевдоним","Никнейм не может быть меньше 3 байт.","Эл. адрес","Пожалуйста, подтвердите адрес вашей электронной почты.","Веб-сайт","Необязательный","Комментарий здесь...","Пока нет комментариев.","Отправить","Like","Cancel like","Отвечать","Отменить ответ","Комментарии","Обновить","Загрузи больше...","Превью","эмодзи","Загрузить изображение","секунд назад","несколько минут назад","несколько часов назад","дней назад","прямо сейчас","Загрузка","Авторизоваться","Выход из системы","Админ","Липкий","Слова","Пожалуйста, введите комментарии от $0 до $1 слов!\nНомер текущего слова: $2","Анонимный"]);const Ee={zh:je,"zh-cn":je,"zh-CN":je,"zh-tw":Le,"zh-TW":Le,en:$e,"en-US":$e,"en-us":$e,jp:Ie,"jp-jp":Ie,"jp-JP":Ie,"pt-br":xe,"pt-BR":xe,ru:Se,"ru-ru":Se,"ru-RU":Se},Re=e=>{try{e=decodeURI(e)}catch(e){}return e},ze=(e="")=>e.replace(/\/$/u,""),Ae=e=>/^(https?:)?\/\//.test(e),Ue=e=>{const t=ze(e);return Ae(t)?t:`https://${t}`},Me=e=>Array.isArray(e)?e:!!e&&[0,e],Oe=(e,t)=>"function"==typeof e?e:!1!==e&&t,Pe="{--waline-white:#000;--waline-light-grey:#666;--waline-dark-grey:#999;--waline-color:#888;--waline-bgcolor:#1e1e1e;--waline-bgcolor-light:#272727;--waline-bgcolor-hover: #444;--waline-border-color:#333;--waline-disable-bgcolor:#444;--waline-disable-color:#272727;--waline-bq-color:#272727;--waline-info-bgcolor:#272727;--waline-info-color:#666}",Ne=(e,t)=>{let n=e.toString();for(;n.length<t;)n="0"+n;return n},_e=(e,t,n)=>{if(!e)return"";const o="string"==typeof e?new Date(-1!==e.indexOf(" ")?e.replace(/-/g,"/"):e):e,l=t.getTime()-o.getTime(),a=Math.floor(l/864e5);if(0===a){const e=l%864e5,t=Math.floor(e/36e5);if(0===t){const t=e%36e5,o=Math.floor(t/6e4);if(0===o){const e=t%6e4;return`${Math.round(e/1e3)} ${n.seconds}`}return`${o} ${n.minutes}`}return`${t} ${n.hours}`}return a<0?n.now:a<8?`${a} ${n.days}`:(e=>{const t=Ne(e.getDate(),2),n=Ne(e.getMonth()+1,2);return`${Ne(e.getFullYear(),2)}-${n}-${t}`})(o)},Te=e=>{const t=ne("WALINE_EMOJI",{}),n=Boolean(/@[0-9]+\.[0-9]+\.[0-9]+/.test(e));if(n){const n=t.value[e];if(n)return Promise.resolve(n)}return fetch(`${e}/info.json`).then((e=>e.json())).then((o=>{const l={folder:e,...o};return n&&(t.value[e]=l),l}))},De=(e,t="",n="",o="")=>`${t?`${t}/`:""}${n}${e}${o?`.${o}`:""}`,Be={"Content-Type":"application/json"},Fe=({serverURL:e,lang:t,path:n,page:o,pageSize:l,signal:a,token:i})=>{const r={};return i&&(r.Authorization=`Bearer ${i}`),fetch(`${e}/comment?path=${encodeURIComponent(n)}&pageSize=${l}&page=${o}&lang=${t}`,{signal:a,headers:r}).then((e=>e.json())).then((e=>((e,t="")=>{if("object"==typeof e&&e.errno)throw new TypeError(`Fetch ${t} failed with ${e.errno}: ${e.errmsg}`);return e})(e,"comment list")))},Ve=({serverURL:e,lang:t,token:n,objectId:o,...l})=>fetch(`${e}/comment/${o}?lang=${t}`,{method:"PUT",headers:{"Content-Type":"application/json",Authorization:`Bearer ${n}`},body:JSON.stringify(l)}).then((e=>e.json())),He=e=>e.type.includes("image"),We=e=>{const t=Array.from(e).find(He);return t?t.getAsFile():null},qe=/\$.*?\$/,Je=/^\$(.*?)\$/,Ke=/^(?:\s{0,3})\$\$((?:[^\n]|\n[^\n])+?)\n{0,1}\$\$/,Ye=(e="",t={})=>e.replace(/:(.+?):/g,((e,n)=>t[n]?`<img class="wl-emoji" src="${t[n]}" alt="${n}">`:e)),Ge=(e,{emojiMap:t,highlighter:n,texRenderer:o})=>{if(A.setOptions({highlight:n||void 0,breaks:!0,smartLists:!0,smartypants:!0}),o){const e=(e=>[{name:"blockMath",level:"block",tokenizer(t){const n=Ke.exec(t);if(null!==n)return{type:"html",raw:n[0],text:e(!0,n[1])}}},{name:"inlineMath",level:"inline",start(e){const t=e.search(qe);return-1!==t?t:e.length},tokenizer(t){const n=Je.exec(t);if(null!==n)return{type:"html",raw:n[0],text:e(!1,n[1])}}}])(o);A.use({extensions:e})}return A.parse(Ye(e,t))};let Xe=null;const Qe=()=>Xe||(Xe=ne("USER_KEY",{}));let Ze=null;const et=()=>Ze||(Ze=ne("WALIKE_LIKE",[]));var tt=(e,t)=>{const n=e.__vccOpts||e;for(const[e,o]of t)n[e]=o;return n};const nt=u({name:"CommentBox",components:{CloseIcon:({size:e})=>s("svg",{class:"wl-close-icon",viewBox:"0 0 1024 1024",width:e,height:e},[s("path",{d:"M697.173 85.333h-369.92c-144.64 0-241.92 101.547-241.92 252.587v348.587c0 150.613 97.28 252.16 241.92 252.16h369.92c144.64 0 241.494-101.547 241.494-252.16V337.92c0-151.04-96.854-252.587-241.494-252.587z",fill:"currentColor"}),s("path",{d:"m640.683 587.52-75.947-75.861 75.904-75.862a37.29 37.29 0 0 0 0-52.778 37.205 37.205 0 0 0-52.779 0l-75.946 75.818-75.862-75.946a37.419 37.419 0 0 0-52.821 0 37.419 37.419 0 0 0 0 52.821l75.947 75.947-75.776 75.733a37.29 37.29 0 1 0 52.778 52.821l75.776-75.776 75.947 75.947a37.376 37.376 0 0 0 52.779-52.821z",fill:"#888"})]),EmojiIcon:()=>s("svg",{viewBox:"0 0 1024 1024",width:"24",height:"24"},s("path",{d:"M563.2 463.3 677 540c1.7 1.2 3.7 1.8 5.8 1.8.7 0 1.4-.1 2-.2 2.7-.5 5.1-2.1 6.6-4.4l25.3-37.8c1.5-2.3 2.1-5.1 1.6-7.8s-2.1-5.1-4.4-6.6l-73.6-49.1 73.6-49.1c2.3-1.5 3.9-3.9 4.4-6.6.5-2.7 0-5.5-1.6-7.8l-25.3-37.8a10.1 10.1 0 0 0-6.6-4.4c-.7-.1-1.3-.2-2-.2-2.1 0-4.1.6-5.8 1.8l-113.8 76.6c-9.2 6.2-14.7 16.4-14.7 27.5.1 11 5.5 21.3 14.7 27.4zM387 348.8h-45.5c-5.7 0-10.4 4.7-10.4 10.4v153.3c0 5.7 4.7 10.4 10.4 10.4H387c5.7 0 10.4-4.7 10.4-10.4V359.2c0-5.7-4.7-10.4-10.4-10.4zm333.8 241.3-41-20a10.3 10.3 0 0 0-8.1-.5c-2.6.9-4.8 2.9-5.9 5.4-30.1 64.9-93.1 109.1-164.4 115.2-5.7.5-9.9 5.5-9.5 11.2l3.9 45.5c.5 5.3 5 9.5 10.3 9.5h.9c94.8-8 178.5-66.5 218.6-152.7 2.4-5 .3-11.2-4.8-13.6zm186-186.1c-11.9-42-30.5-81.4-55.2-117.1-24.1-34.9-53.5-65.6-87.5-91.2-33.9-25.6-71.5-45.5-111.6-59.2-41.2-14-84.1-21.1-127.8-21.1h-1.2c-75.4 0-148.8 21.4-212.5 61.7-63.7 40.3-114.3 97.6-146.5 165.8-32.2 68.1-44.3 143.6-35.1 218.4 9.3 74.8 39.4 145 87.3 203.3.1.2.3.3.4.5l36.2 38.4c1.1 1.2 2.5 2.1 3.9 2.6 73.3 66.7 168.2 103.5 267.5 103.5 73.3 0 145.2-20.3 207.7-58.7 37.3-22.9 70.3-51.5 98.1-85 27.1-32.7 48.7-69.5 64.2-109.1 15.5-39.7 24.4-81.3 26.6-123.8 2.4-43.6-2.5-87-14.5-129zm-60.5 181.1c-8.3 37-22.8 72-43 104-19.7 31.1-44.3 58.6-73.1 81.7-28.8 23.1-61 41-95.7 53.4-35.6 12.7-72.9 19.1-110.9 19.1-82.6 0-161.7-30.6-222.8-86.2l-34.1-35.8c-23.9-29.3-42.4-62.2-55.1-97.7-12.4-34.7-18.8-71-19.2-107.9-.4-36.9 5.4-73.3 17.1-108.2 12-35.8 30-69.2 53.4-99.1 31.7-40.4 71.1-72 117.2-94.1 44.5-21.3 94-32.6 143.4-32.6 49.3 0 97 10.8 141.8 32 34.3 16.3 65.3 38.1 92 64.8 26.1 26 47.5 56 63.6 89.2 16.2 33.2 26.6 68.5 31 105.1 4.6 37.5 2.7 75.3-5.6 112.3z",fill:"currentColor"})),ImageIcon:()=>s("svg",{viewBox:"0 0 1024 1024",width:"24",height:"24"},[s("path",{d:"M784 112H240c-88 0-160 72-160 160v480c0 88 72 160 160 160h544c88 0 160-72 160-160V272c0-88-72-160-160-160zm96 640c0 52.8-43.2 96-96 96H240c-52.8 0-96-43.2-96-96V272c0-52.8 43.2-96 96-96h544c52.8 0 96 43.2 96 96v480z",fill:"currentColor"}),s("path",{d:"M352 480c52.8 0 96-43.2 96-96s-43.2-96-96-96-96 43.2-96 96 43.2 96 96 96zm0-128c17.6 0 32 14.4 32 32s-14.4 32-32 32-32-14.4-32-32 14.4-32 32-32zm462.4 379.2-3.2-3.2-177.6-177.6c-25.6-25.6-65.6-25.6-91.2 0l-80 80-36.8-36.8c-25.6-25.6-65.6-25.6-91.2 0L200 728c-4.8 6.4-8 14.4-8 24 0 17.6 14.4 32 32 32 9.6 0 16-3.2 22.4-9.6L380.8 640l134.4 134.4c6.4 6.4 14.4 9.6 24 9.6 17.6 0 32-14.4 32-32 0-9.6-4.8-17.6-9.6-24l-52.8-52.8 80-80L769.6 776c6.4 4.8 12.8 8 20.8 8 17.6 0 32-14.4 32-32 0-8-3.2-16-8-20.8z",fill:"currentColor"})]),MarkdownIcon:()=>s("svg",{width:"16",height:"16",ariaHidden:"true"},s("path",{d:"M14.85 3H1.15C.52 3 0 3.52 0 4.15v7.69C0 12.48.52 13 1.15 13h13.69c.64 0 1.15-.52 1.15-1.15v-7.7C16 3.52 15.48 3 14.85 3zM9 11H7V8L5.5 9.92 4 8v3H2V5h2l1.5 2L7 5h2v6zm2.99.5L9.5 8H11V5h2v3h1.5l-2.51 3.5z",fill:"currentColor"})),PreviewIcon:()=>s("svg",{viewBox:"0 0 1024 1024",width:"24",height:"24"},[s("path",{d:"M710.816 654.301c70.323-96.639 61.084-230.578-23.705-314.843-46.098-46.098-107.183-71.109-172.28-71.109-65.008 0-126.092 25.444-172.28 71.109-45.227 46.098-70.756 107.183-70.756 172.106 0 64.923 25.444 126.007 71.194 172.106 46.099 46.098 107.184 71.109 172.28 71.109 51.414 0 100.648-16.212 142.824-47.404l126.53 126.006c7.058 7.06 16.297 10.979 26.406 10.979 10.105 0 19.343-3.919 26.402-10.979 14.467-14.467 14.467-38.172 0-52.723L710.816 654.301zm-315.107-23.265c-65.88-65.88-65.88-172.54 0-238.42 32.069-32.07 74.245-49.149 119.471-49.149 45.227 0 87.407 17.603 119.472 49.149 65.88 65.879 65.88 172.539 0 238.42-63.612 63.178-175.242 63.178-238.943 0zm0 0",fill:"currentColor"}),s("path",{d:"M703.319 121.603H321.03c-109.8 0-199.469 89.146-199.469 199.38v382.034c0 109.796 89.236 199.38 199.469 199.38h207.397c20.653 0 37.384-16.645 37.384-37.299 0-20.649-16.731-37.296-37.384-37.296H321.03c-68.582 0-124.352-55.77-124.352-124.267V321.421c0-68.496 55.77-124.267 124.352-124.267h382.289c68.582 0 124.352 55.771 124.352 124.267V524.72c0 20.654 16.736 37.299 37.385 37.299 20.654 0 37.384-16.645 37.384-37.299V320.549c-.085-109.8-89.321-198.946-199.121-198.946zm0 0",fill:"currentColor"})]),LoadingIcon:de},props:{rootId:{type:String,default:""},replyId:{type:String,default:""},replyUser:{type:String,default:""}},emits:["submit","cancel-reply"],setup(e,{emit:t}){const l=m("config"),a=ne("WALINE_COMMENT_BOX_EDITOR",""),i=ne("WALINE_USER_META",{nick:"",mail:"",link:""}),r=Qe(),s=o({}),u=o(null),p=o(null),g=o(null),f=o(null),h=o({tabs:[],map:{}}),w=o(0),y=o(!1),b=o(!1),k=o(""),C=o(0),$=o(0),I=o(!1),j=o(""),L=o(!1),x=c((()=>l.value.locale)),S=c((()=>Boolean(r.value?.token))),E=c((()=>!1!==l.value.imageUploader)),R=e=>{const t=u.value,n=t.selectionStart,o=t.selectionEnd||0,l=t.scrollTop;a.value=t.value.substring(0,n)+e+t.value.substring(o,t.value.length),t.focus(),t.selectionStart=n+e.length,t.selectionEnd=n+e.length,t.scrollTop=l},A=e=>{const t=`![${l.value.locale.uploading} ${e.name}]()`;return R(t),Promise.resolve().then((()=>l.value.imageUploader(e))).then((n=>{a.value=a.value.replace(t,`\r\n![${e.name}](${n})`)}))},U=()=>{const{serverURL:n,lang:o,login:c,wordLimit:m,requiredMeta:d}=l.value,v={comment:j.value,nick:i.value.nick,mail:i.value.mail,link:i.value.link,ua:navigator.userAgent,url:l.value.path};if(r.value?.token)v.nick=r.value.display_name,v.mail=r.value.email,v.link=r.value.url;else{if("force"===c)return;if(d.indexOf("nick")>-1&&!v.nick)return s.value.nick?.focus(),alert(x.value.nickError);if(d.indexOf("mail")>-1&&!v.mail||v.mail&&!/^\w(?:[\w._-]*\w)?@(?:\w(?:[\w-]*\w)?\.)*\w+$/.exec(v.mail))return s.value.mail?.focus(),alert(x.value.mailError);if(!v.comment)return void u.value?.focus();v.nick||(v.nick=x.value.anonymous)}if(!I.value)return alert(x.value.wordHint.replace("$0",m[0].toString()).replace("$1",m[1].toString()).replace("$2",C.value.toString()));v.comment=Ye(v.comment,h.value.map),e.replyId&&e.rootId&&(v.pid=e.replyId,v.rid=e.rootId,v.at=e.replyUser),L.value=!0,(({serverURL:e,lang:t,token:n,comment:o})=>{const l={"Content-Type":"application/json"};return n&&(l.Authorization=`Bearer ${n}`),fetch(`${e}/comment?lang=${t}`,{method:"POST",headers:l,body:JSON.stringify(o)}).then((e=>e.json()))})({serverURL:n,lang:o,token:r.value?.token,comment:v}).then((n=>{if(L.value=!1,n.errmsg)return alert(n.errmsg);t("submit",n.data),a.value="",k.value="",e.replyId&&t("cancel-reply")})).catch((e=>{L.value=!1,alert(e.message)}))},M=e=>{g.value.contains(e.target)||f.value.contains(e.target)||(y.value=!1)};return n([l,C],(([e,t])=>{const{wordLimit:n}=e;n?t<n[0]&&0!==n[0]?($.value=n[0],I.value=!1):t>n[1]?($.value=n[1],I.value=!1):($.value=n[1],I.value=!0):($.value=0,I.value=!0)}),{immediate:!0}),d((()=>{document.body.addEventListener("click",M),n((()=>a.value),(e=>{const{highlighter:t,texRenderer:n}=l.value;j.value=e,k.value=Ge(e,{emojiMap:h.value.map,highlighter:t,texRenderer:n}),C.value=(e=>(e=>e.match(/[\w\d\s\u00C0-\u024F]+/giu)||[])(e).reduce(((e,t)=>e+(""===t.trim()?0:t.trim().split(/\s+/u).length)),0)+(e=>e.match(/[\u4E00-\u9FA5]/gu)||[])(e).length)(e),e?z(u.value):z.destroy(u.value)}),{immediate:!0}),n((()=>l.value.emoji),(e=>{return(t=Array.isArray(e)?e:[],Promise.all(t.map((e=>"string"==typeof e?Te(ze(e)):Promise.resolve(e)))).then((e=>{const t={tabs:[],map:{}};return e.forEach((e=>{const{name:n,folder:o,icon:l,prefix:a,type:i,items:r}=e;t.tabs.push({name:n,icon:De(l,o,a,i),items:r.map((e=>{const n=`${a||""}${e}`;return t.map[n]=De(e,o,a,i),n}))})})),t}))).then((e=>{h.value=e}));var t}),{immediate:!0})})),v((()=>{document.body.removeEventListener("click",M)})),{config:l,locale:x,insert:R,onChange:()=>{const e=p.value;e.files&&E.value&&A(e.files[0]).then((()=>{e.value=""}))},onDrop:e=>{if(e.dataTransfer?.items){const t=We(e.dataTransfer.items);t&&E.value&&(A(t),e.preventDefault())}},onKeyDown:e=>{const t=e.key;(e.ctrlKey||e.metaKey)&&"Enter"===t&&U()},onPaste:e=>{if(e.clipboardData){const t=We(e.clipboardData.items);t&&E.value&&A(t)}},onLogin:e=>{e.preventDefault();const{lang:t,serverURL:n}=l.value,o=(window.innerWidth-450)/2,a=(window.innerHeight-450)/2,i=window.open(`${n}/ui/login?lng=${encodeURIComponent(t)}`,"_blank",`width=450,height=450,left=${o},top=${a},scrollbars=no,resizable=no,status=no,location=no,toolbar=no,menubar=no`);i?.postMessage({type:"TOKEN",data:null},"*");const s=({data:e})=>{e&&"userInfo"===e.type&&e.data.token&&(i?.close(),r.value=e.data,(e.data.remember?localStorage:sessionStorage).setItem("WALINE_USER",JSON.stringify(e.data)),window.removeEventListener("message",s))};window.addEventListener("message",s)},onLogout:()=>{r.value={},localStorage.setItem("WALINE_USER","null"),sessionStorage.setItem("WALINE_USER","null")},onProfile:e=>{e.preventDefault();const{lang:t,serverURL:n}=l.value,o=(window.innerWidth-800)/2,a=(window.innerHeight-800)/2;window.open(`${n}/ui/profile?lng=${encodeURIComponent(t)}`,"_blank",`width=800,height=800,left=${o},top=${a},scrollbars=no,resizable=no,status=no,location=no,toolbar=no,menubar=no`)?.postMessage({type:"TOKEN",data:r.value.token},"*");const i=({data:e})=>{e&&"profile"===e.type&&(r.value={...r.value,...e},[localStorage,sessionStorage].filter((e=>e.getItem("WALINE_USER"))).forEach((e=>e.setItem("WALINE_USER",JSON.stringify(r)))),window.removeEventListener("message",i))};window.addEventListener("message",i)},submitComment:U,isLogin:S,userInfo:r,isSubmitting:L,wordNumber:C,wordLimit:$,isWordNumberLegal:I,editor:a,userMeta:i,emoji:h,emojiTabIndex:w,showEmoji:y,canUploadImage:E,previewText:k,showPreview:b,inputRefs:s,editorRef:u,emojiButtonRef:g,emojiPopupRef:f,imageUploadRef:p}}}),ot={class:"wl-comment"},lt={key:0,class:"wl-login-info"},at={class:"wl-avatar"},it=["title"],rt=["src"],st=["textContent"],ct={class:"wl-panel"},ut=["for","textContent"],mt=["id","name","type","onUpdate:modelValue"],dt=["placeholder"],vt={class:"wl-preview"},pt=h("hr",null,null,-1),gt=["innerHTML"],ft={class:"wl-footer"},ht={class:"wl-actions"},wt={href:"https://guides.github.com/features/mastering-markdown/",title:"Markdown Guide","aria-label":"Markdown is supported",class:"wl-action",target:"_blank",rel:"noreferrer"},yt=["title"],bt=["title"],kt=["title"],Ct={class:"wl-info"},$t={class:"wl-text-number"},It={key:0},jt=S("  /  "),Lt=["textContent"],xt=["textContent"],St=["disabled"],Et={key:0,class:"wl-tab-wrapper"},Rt=["title","onClick"],zt=["src","alt"],At={key:0,class:"wl-tabs"},Ut=["onClick"],Mt=["src","alt","title"],Ot=["title"];var Pt=tt(nt,[["render",function(e,t,n,o,l,a){const i=p("CloseIcon"),r=p("MarkdownIcon"),s=p("EmojiIcon"),c=p("ImageIcon"),u=p("PreviewIcon"),m=p("LoadingIcon");return g(),f("div",ot,["disable"!==e.config.login&&e.isLogin?(g(),f("div",lt,[h("div",at,[h("button",{class:"wl-logout-btn",title:e.locale.logout,onClick:t[0]||(t[0]=(...t)=>e.onLogout&&e.onLogout(...t))},[w(i,{size:14})],8,it),h("img",{src:e.userInfo.avatar,alt:"avatar"},null,8,rt)]),h("a",{href:"#",class:"wl-login-nick","aria-label":"Profile",onClick:t[1]||(t[1]=(...t)=>e.onProfile&&e.onProfile(...t)),textContent:y(e.userInfo.display_name)},null,8,st)])):b("v-if",!0),h("div",ct,["force"!==e.config.login&&e.config.meta.length&&!e.isLogin?(g(),f("div",{key:0,class:k(["wl-header",`item${e.config.meta.length}`])},[(g(!0),f(C,null,$(e.config.meta,(t=>(g(),f("div",{class:"wl-header-item",key:t},[h("label",{for:t,textContent:y(e.locale[t]+(e.config.requiredMeta.includes(t)||!e.config.requiredMeta.length?"":`(${e.locale.optional})`))},null,8,ut),I(h("input",{ref_for:!0,ref:n=>{n&&(e.inputRefs[t]=n)},id:`wl-${t}`,class:k(["wl-input",`wl-${t}`]),name:t,type:"mail"===t?"email":"text","onUpdate:modelValue":n=>e.userMeta[t]=n},null,10,mt),[[j,e.userMeta[t]]])])))),128))],2)):b("v-if",!0),I(h("textarea",{class:"wl-editor",ref:"editorRef",id:"wl-edit",placeholder:e.replyUser?`@${e.replyUser}`:e.locale.placeholder,"onUpdate:modelValue":t[2]||(t[2]=t=>e.editor=t),onKeydown:t[3]||(t[3]=(...t)=>e.onKeyDown&&e.onKeyDown(...t)),onDrop:t[4]||(t[4]=(...t)=>e.onDrop&&e.onDrop(...t)),onPaste:t[5]||(t[5]=(...t)=>e.onPaste&&e.onPaste(...t))},null,40,dt),[[L,e.editor]]),I(h("div",vt,[pt,h("h4",null,y(e.locale.preview)+":",1),h("div",{class:"wl-content",innerHTML:e.previewText},null,8,gt)],512),[[x,e.showPreview]]),h("div",ft,[h("div",ht,[h("a",wt,[w(r)]),I(h("button",{ref:"emojiButtonRef",class:k(["wl-action",{actived:e.showEmoji}]),title:e.locale.emoji,onClick:t[6]||(t[6]=t=>e.showEmoji=!e.showEmoji)},[w(s)],10,yt),[[x,e.emoji.tabs.length]]),h("input",{ref:"imageUploadRef",class:"upload",id:"wl-image-upload",type:"file",accept:".png,.jpg,.jpeg,.webp,.bmp,.gif",onChange:t[7]||(t[7]=(...t)=>e.onChange&&e.onChange(...t))},null,544),e.canUploadImage?(g(),f("label",{key:0,for:"wl-image-upload",class:"wl-action",title:e.locale.uploadImage},[w(c)],8,bt)):b("v-if",!0),h("button",{class:k(["wl-action",{actived:e.showPreview}]),title:e.locale.preview,onClick:t[8]||(t[8]=t=>e.showPreview=!e.showPreview)},[w(u)],10,kt)]),h("div",Ct,[h("div",$t,[S(y(e.wordNumber)+" ",1),e.config.wordLimit?(g(),f("span",It,[jt,h("span",{class:k({illegal:!e.isWordNumberLegal}),textContent:y(e.wordLimit)},null,10,Lt)])):b("v-if",!0),S("  "+y(e.locale.word),1)]),"disable"===e.config.login||e.isLogin?b("v-if",!0):(g(),f("button",{key:0,class:"wl-btn",onClick:t[9]||(t[9]=(...t)=>e.onLogin&&e.onLogin(...t)),textContent:y(e.locale.login)},null,8,xt)),"force"!==e.config.login||e.isLogin?(g(),f("button",{key:1,class:"wl-btn primary",title:"Cmd|Ctrl + Enter",disabled:e.isSubmitting,onClick:t[10]||(t[10]=(...t)=>e.submitComment&&e.submitComment(...t))},[e.isSubmitting?(g(),E(m,{key:0,size:16})):(g(),f(C,{key:1},[S(y(e.locale.submit),1)],2112))],8,St)):b("v-if",!0)]),h("div",{ref:"emojiPopupRef",class:k(["wl-emoji-popup",{display:e.showEmoji}])},[(g(!0),f(C,null,$(e.emoji.tabs,((t,n)=>(g(),f(C,{key:t.name},[n===e.emojiTabIndex?(g(),f("div",Et,[(g(!0),f(C,null,$(t.items,(t=>(g(),f("button",{key:t,title:t,onClick:n=>e.insert(`:${t}:`)},[e.showEmoji?(g(),f("img",{key:0,class:"wl-emoji",src:e.emoji.map[t],alt:t,loading:"lazy",referrerPolicy:"no-referrer"},null,8,zt)):b("v-if",!0)],8,Rt)))),128))])):b("v-if",!0)],64)))),128)),e.emoji.tabs.length>1?(g(),f("div",At,[(g(!0),f(C,null,$(e.emoji.tabs,((t,n)=>(g(),f("button",{key:t.name,class:k(["wl-tab",{active:e.emojiTabIndex===n}]),onClick:t=>e.emojiTabIndex=n},[h("img",{class:"wl-emoji",src:t.icon,alt:t.name,title:t.name,loading:"lazy",referrerPolicy:"no-referrer"},null,8,Mt)],10,Ut)))),128))])):b("v-if",!0)],2)])]),e.replyId?(g(),f("button",{key:1,class:"wl-close",title:e.locale.cancelReply,onClick:t[11]||(t[11]=t=>e.$emit("cancel-reply"))},[w(i,{size:24})],8,Ot)):b("v-if",!0)])}],["__file","CommentBox.vue"]]);const Nt=["approved","waiting","spam"],_t=u({props:{comment:{type:Object,required:!0},rootId:{type:String,required:!0},reply:{type:Object}},components:{CommentBox:Pt,DeleteIcon:()=>s("svg",{viewBox:"0 0 1024 1024",width:"24",height:"24"},s("path",{d:"m341.013 394.667 27.755 393.45h271.83l27.733-393.45h64.106l-28.01 397.952a64 64 0 0 1-63.83 59.498H368.768a64 64 0 0 1-63.83-59.52l-28.053-397.93h64.128zm139.307 19.818v298.667h-64V414.485h64zm117.013 0v298.667h-64V414.485h64zM181.333 288h640v64h-640v-64zm453.483-106.667v64h-256v-64h256z",fill:"red"})),LikeIcon:({active:e=!1})=>s("svg",{viewBox:"0 0 1024 1024",width:"24",height:"24"},[s("path",{d:"M850.654 323.804c-11.042-25.625-26.862-48.532-46.885-68.225-20.022-19.61-43.258-34.936-69.213-45.73-26.78-11.124-55.124-16.727-84.375-16.727-40.622 0-80.256 11.123-114.698 32.135A214.79 214.79 0 0 0 512 241.819a214.79 214.79 0 0 0-23.483-16.562c-34.442-21.012-74.076-32.135-114.698-32.135-29.25 0-57.595 5.603-84.375 16.727-25.872 10.711-49.19 26.12-69.213 45.73-20.105 19.693-35.843 42.6-46.885 68.225-11.453 26.615-17.303 54.877-17.303 83.963 0 27.439 5.603 56.03 16.727 85.117 9.31 24.307 22.659 49.52 39.715 74.981 27.027 40.293 64.188 82.316 110.33 124.915 76.465 70.615 152.189 119.394 155.402 121.371l19.528 12.525c8.652 5.52 19.776 5.52 28.427 0l19.529-12.525c3.213-2.06 78.854-50.756 155.401-121.371 46.143-42.6 83.304-84.622 110.33-124.915 17.057-25.46 30.487-50.674 39.716-74.981 11.124-29.087 16.727-57.678 16.727-85.117.082-29.086-5.768-57.348-17.221-83.963z"+(e?"":"M512 761.5S218.665 573.55 218.665 407.767c0-83.963 69.461-152.023 155.154-152.023 60.233 0 112.473 33.618 138.181 82.727 25.708-49.109 77.948-82.727 138.18-82.727 85.694 0 155.155 68.06 155.155 152.023C805.335 573.551 512 761.5 512 761.5z"),fill:e?"red":"currentColor"})]),ReplyIcon:()=>s("svg",{viewBox:"0 0 1024 1024",width:"24",height:"24"},s("path",{d:"M810.667 213.333a64 64 0 0 1 64 64V704a64 64 0 0 1-64 64H478.336l-146.645 96.107a21.333 21.333 0 0 1-33.024-17.856V768h-85.334a64 64 0 0 1-64-64V277.333a64 64 0 0 1 64-64h597.334zm0 64H213.333V704h149.334v63.296L459.243 704h351.424V277.333zm-271.36 213.334v64h-176.64v-64h176.64zm122.026-128v64H362.667v-64h298.666z",fill:"currentColor"})),VerifiedIcon:()=>s("svg",{class:"verified-icon",viewBox:"0 0 1024 1024",width:"14",height:"14"},s("path",{d:"m894.4 461.56-54.4-63.2c-10.4-12-18.8-34.4-18.8-50.4v-68c0-42.4-34.8-77.2-77.2-77.2h-68c-15.6 0-38.4-8.4-50.4-18.8l-63.2-54.4c-27.6-23.6-72.8-23.6-100.8 0l-62.8 54.8c-12 10-34.8 18.4-50.4 18.4h-69.2c-42.4 0-77.2 34.8-77.2 77.2v68.4c0 15.6-8.4 38-18.4 50l-54 63.6c-23.2 27.6-23.2 72.4 0 100l54 63.6c10 12 18.4 34.4 18.4 50v68.4c0 42.4 34.8 77.2 77.2 77.2h69.2c15.6 0 38.4 8.4 50.4 18.8l63.2 54.4c27.6 23.6 72.8 23.6 100.8 0l63.2-54.4c12-10.4 34.4-18.8 50.4-18.8h68c42.4 0 77.2-34.8 77.2-77.2v-68c0-15.6 8.4-38.4 18.8-50.4l54.4-63.2c23.2-27.6 23.2-73.2-.4-100.8zm-216-25.2-193.2 193.2a30 30 0 0 1-42.4 0l-96.8-96.8a30.16 30.16 0 0 1 0-42.4c11.6-11.6 30.8-11.6 42.4 0l75.6 75.6 172-172c11.6-11.6 30.8-11.6 42.4 0 11.6 11.6 11.6 30.8 0 42.4z",fill:"#27ae60"}))},emits:["submit","reply","like","delete","status","sticky"],setup(e){const t=m("config"),n=et(),o=Qe(),l=c((()=>t.value.locale)),a=c((()=>{let{link:t}=e.comment;return t?Ae(t)?t:`https://${t}`:""})),i=c((()=>n.value.includes(e.comment.objectId))),r=((e,t)=>{const n=ue();return c((()=>_e(e,n.value,t)))})(e.comment.insertedAt,l.value),s=c((()=>"administrator"===o.value.type)),u=c((()=>e.comment.user_id&&o.value.objectId===e.comment.user_id)),d=c((()=>e.comment.objectId===e.reply?.objectId));return{config:t,locale:l,isReplyingCurrent:d,link:a,like:i,time:r,isAdmin:s,isOwner:u,commentStatus:Nt}}}),Tt=["id"],Dt={class:"wl-user","aria-hidden":"true"},Bt=["src"],Ft={class:"wl-card"},Vt={class:"wl-head"},Ht=["href"],Wt={key:1,class:"wl-nick"},qt=["textContent"],Jt=["textContent"],Kt=["textContent"],Yt=["textContent"],Gt=["textContent"],Xt={class:"wl-comment-actions"},Qt=["title"],Zt=["textContent"],en=["title"],tn={class:"wl-meta","aria-hidden":"true"},nn=["textContent"],on=["textContent"],ln=["textContent"],an=["innerHTML"],rn={key:0,class:"wl-admin-actions"},sn={class:"wl-comment-status"},cn=["disabled","onClick","textContent"],un={key:1,class:"wl-reply-wrapper"},mn={key:2,class:"wl-quote"};const dn=u({name:"WalineRoot",components:{CommentBox:Pt,CommentCard:tt(_t,[["render",function(e,t,n,o,l,a){const i=p("VerifiedIcon"),r=p("DeleteIcon"),s=p("LikeIcon"),c=p("ReplyIcon"),u=p("CommentBox"),m=p("CommentCard",!0);return g(),f("div",{class:"wl-item",id:e.comment.objectId},[h("div",Dt,[e.comment.avatar?(g(),f("img",{key:0,src:e.comment.avatar},null,8,Bt)):b("v-if",!0),e.comment.type?(g(),E(i,{key:1})):b("v-if",!0)]),h("div",Ft,[h("div",Vt,[e.link?(g(),f("a",{key:0,class:"wl-nick",href:e.link,target:"_blank",rel:"nofollow noreferrer"},y(e.comment.nick),9,Ht)):(g(),f("span",Wt,y(e.comment.nick),1)),"administrator"===e.comment.type?(g(),f("span",{key:2,class:"wl-badge",textContent:y(e.locale.admin)},null,8,qt)):b("v-if",!0),e.comment.label?(g(),f("span",{key:3,class:"wl-badge",textContent:y(e.comment.label)},null,8,Jt)):b("v-if",!0),e.comment.sticky?(g(),f("span",{key:4,class:"wl-badge",textContent:y(e.locale.sticky)},null,8,Kt)):b("v-if",!0),e.comment.level&&e.comment.level>=0?(g(),f("span",{key:5,class:k(`wl-badge level${e.comment.level}`),textContent:y(e.locale[`level${e.comment.level}`]||`Level ${e.comment.level}`)},null,10,Yt)):b("v-if",!0),h("span",{class:"wl-time",textContent:y(e.time)},null,8,Gt),h("div",Xt,[e.isAdmin||e.isOwner?(g(),f("button",{key:0,class:"wl-delete",onClick:t[0]||(t[0]=t=>e.$emit("delete",e.comment))},[w(r)])):b("v-if",!0),h("button",{class:"wl-like",onClick:t[1]||(t[1]=t=>e.$emit("like",e.comment)),title:e.like?e.locale.cancelLike:e.locale.like},[w(s,{active:e.like},null,8,["active"]),"like"in e.comment?(g(),f("span",{key:0,textContent:y(e.comment.like)},null,8,Zt)):b("v-if",!0)],8,Qt),h("button",{class:k(["wl-reply",{active:e.isReplyingCurrent}]),title:e.isReplyingCurrent?e.locale.cancelReply:e.locale.reply,onClick:t[2]||(t[2]=t=>e.$emit("reply",e.isReplyingCurrent?null:e.comment))},[w(c)],10,en)])]),h("div",tn,[e.comment.addr?(g(),f("span",{key:0,textContent:y(e.comment.addr)},null,8,nn)):b("v-if",!0),e.comment.browser?(g(),f("span",{key:1,textContent:y(e.comment.browser)},null,8,on)):b("v-if",!0),e.comment.os?(g(),f("span",{key:2,textContent:y(e.comment.os)},null,8,ln)):b("v-if",!0)]),h("div",{class:"wl-content",innerHTML:e.comment.comment},null,8,an),e.isAdmin?(g(),f("div",rn,[h("span",sn,[(g(!0),f(C,null,$(e.commentStatus,(t=>(g(),f("button",{key:t,class:k(`wl-btn wl-${t}`),disabled:e.comment.status===t,onClick:n=>e.$emit("status",{status:t,comment:e.comment}),textContent:y(t)},null,10,cn)))),128))]),e.isAdmin&&!e.comment.rid?(g(),f("button",{key:0,class:"wl-btn wl-sticky",onClick:t[3]||(t[3]=t=>e.$emit("sticky",e.comment))},y(e.comment.sticky?"unsticky":"sticky"),1)):b("v-if",!0)])):b("v-if",!0),e.isReplyingCurrent?(g(),f("div",un,[w(u,{replyId:e.comment.objectId,replyUser:e.comment.nick,rootId:e.rootId,onSubmit:t[4]||(t[4]=t=>e.$emit("submit",t)),onCancelReply:t[5]||(t[5]=t=>e.$emit("reply",null))},null,8,["replyId","replyUser","rootId"])])):b("v-if",!0),e.comment.children?(g(),f("div",mn,[(g(!0),f(C,null,$(e.comment.children,(n=>(g(),E(m,{key:n.objectId,comment:n,reply:e.reply,rootId:e.rootId,onReply:t[6]||(t[6]=t=>e.$emit("reply",t)),onSubmit:t[7]||(t[7]=t=>e.$emit("submit",t)),onLike:t[8]||(t[8]=t=>e.$emit("like",t)),onDelete:t[9]||(t[9]=t=>e.$emit("delete",t)),onStatus:t[10]||(t[10]=t=>e.$emit("status",t)),onSticky:t[11]||(t[11]=t=>e.$emit("sticky",t))},null,8,["comment","reply","rootId"])))),128))])):b("v-if",!0)])],8,Tt)}],["__file","CommentCard.vue"]]),LoadingIcon:de},props:["serverURL","path","meta","requiredMeta","dark","lang","locale","pageSize","wordLimit","emoji","login","highlighter","texRenderer","imageUploader","copyright"],setup(e){const t=c((()=>(({serverURL:e,path:t=location.pathname,lang:n="zh-CN",locale:o,emoji:l=["//unpkg.com/@waline/emojis@1.0.1/weibo"],meta:a=["nick","mail","link"],requiredMeta:i=[],dark:r=!1,pageSize:s=10,wordLimit:c,imageUploader:u,highlighter:m,texRenderer:d,copyright:v=!0,login:p="enable",...g})=>({serverURL:Ue(e),path:Re(t),locale:{...Ee[n]||Ee["zh-CN"],..."object"==typeof o?o:{}},wordLimit:Me(c),meta:pe(a),requiredMeta:pe(i),imageUploader:Oe(u,ge),highlighter:Oe(m,be),texRenderer:Oe(d,fe),lang:n,dark:r,emoji:l,pageSize:s,login:p,copyright:v,...g}))(e))),l=Qe(),a=et(),r=o("loading"),s=o(0),u=o(1),m=o(0),v=o([]),p=o(null),g=c((()=>{return"string"==typeof(e=t.value.dark)?"auto"===e?`@media(prefers-color-scheme:dark){body${Pe}}`:`${e}${Pe}`:!0===e?`:root${Pe}`:"";var e}));let f;!function(e,t={}){const l=o(!1),{document:a=G,immediate:r=!0,manual:s=!1,id:c="vueuse_styletag_"+ ++me}=t,u=o(e);let m=()=>{};const d=()=>{if(!a)return;const e=a.getElementById(c)||a.createElement("style");e.type="text/css",e.id=c,t.media&&(e.media=t.media),a.head.appendChild(e),l.value||(m=n(u,(t=>{e.innerText=t}),{immediate:!0}),l.value=!0)},v=()=>{a&&l.value&&(m(),a.head.removeChild(a.getElementById(c)),l.value=!1)};r&&!s&&d(),s||U(v),i(l)}(g);const h=e=>{const{serverURL:n,path:o,pageSize:a}=t.value,i=new AbortController;r.value="loading",f?.(),Fe({serverURL:n,lang:t.value.lang,path:o,pageSize:a,page:e,signal:i.signal,token:l.value?.token}).then((t=>{r.value="success",s.value=t.count,v.value.push(...t.data),u.value=e,m.value=t.totalPages})).catch((e=>{"AbortError"!==e.name&&(console.error(e.message),r.value="error")})),f=i.abort.bind(i)},w=()=>{s.value=0,v.value=[],h(1)};return R("config",t),n((()=>e.path),w),d((()=>w())),{config:t,darkmodeStyle:g,i18n:c((()=>t.value.locale)),status:r,count:s,page:u,totalPages:m,data:v,reply:p,loadMore:()=>h(u.value+1),refresh:w,onReply:e=>{p.value=e},onSubmit:e=>{if(e.rid){const t=v.value.find((({objectId:t})=>t===e.rid));if(!t)return;Array.isArray(t.children)||(t.children=[]),t.children.push(e)}else v.value.unshift(e)},onStatusChange:async({comment:e,status:n})=>{if(e.status===n)return;const{serverURL:o,lang:a}=t.value;await Ve({serverURL:o,lang:a,token:l.value?.token,objectId:e.objectId,status:n}),e.status=n},onDelete:async({objectId:e})=>{if(!confirm("Are you sure you want to delete this comment?"))return;const{serverURL:n,lang:o}=t.value;await(({serverURL:e,lang:t,token:n,objectId:o})=>fetch(`${e}/comment/${o}?lang=${t}`,{method:"DELETE",headers:{Authorization:`Bearer ${n}`}}).then((e=>e.json())))({serverURL:n,lang:o,token:l.value?.token,objectId:e}),v.value.some(((t,n)=>t.objectId===e?(v.value=v.value.filter(((e,t)=>t!==n)),!0):t.children.some(((o,l)=>o.objectId===e&&(v.value[n].children=t.children.filter(((e,t)=>t!==l)),!0)))))},onSticky:async e=>{if(e.rid)return;const{serverURL:n,lang:o}=t.value;await Ve({serverURL:n,lang:o,token:l.value?.token,objectId:e.objectId,sticky:e.sticky?0:1}),e.sticky=!e.sticky},onLike:async e=>{const{serverURL:n,lang:o}=t.value,{objectId:l}=e,i=a.value.includes(l);await(({serverURL:e,lang:t,objectId:n,like:o})=>fetch(`${e}/comment/${n}?lang=${t}`,{method:"PUT",headers:Be,body:JSON.stringify({like:o})}).then((e=>e.json())))({serverURL:n,lang:o,objectId:l,like:!i}),i?a.value=a.value.filter((e=>e!==l)):(a.value=[...a.value,l],a.value.length>50&&(a.value=a.value.slice(-50))),e.like=(e.like||0)+(i?-1:1)},version:"2.4.2"}}}),vn={"data-waline":""},pn={class:"wl-count"},gn=["textContent"],fn={class:"wl-cards"},hn={key:1,class:"wl-operation"},wn=["textContent"],yn={key:0,class:"wl-loading"},bn=["textContent"],kn={class:"wl-operation"},Cn=["textContent"],$n={key:3,class:"wl-power"},In=S(" Powered by "),jn=h("a",{href:"https://github.com/walinejs/waline",target:"_blank",rel:"noreferrer"}," Waline ",-1);var Ln=tt(dn,[["render",function(e,t,n,o,l,a){const i=p("CommentBox"),r=p("CommentCard"),s=p("LoadingIcon");return g(),f("div",vn,[e.reply?b("v-if",!0):(g(),E(i,{key:0,onSubmit:e.onSubmit},null,8,["onSubmit"])),h("div",pn,[e.count?(g(),f("span",{key:0,class:"wl-num",textContent:y(e.count)},null,8,gn)):b("v-if",!0),S(" "+y(e.i18n.comment),1)]),h("div",fn,[(g(!0),f(C,null,$(e.data,(t=>(g(),E(r,{key:t.objectId,"root-id":t.objectId,comment:t,reply:e.reply,onReply:e.onReply,onSubmit:e.onSubmit,onStatus:e.onStatusChange,onDelete:e.onDelete,onSticky:e.onSticky,onLike:e.onLike},null,8,["root-id","comment","reply","onReply","onSubmit","onStatus","onDelete","onSticky","onLike"])))),128))]),"error"===e.status?(g(),f("div",hn,[h("button",{type:"button",class:"wl-btn",onClick:t[0]||(t[0]=(...t)=>e.refresh&&e.refresh(...t)),textContent:y(e.i18n.refresh)},null,8,wn)])):(g(),f(C,{key:2},["loading"===e.status?(g(),f("div",yn,[w(s,{size:30})])):e.data.length?e.page<e.totalPages?(g(),f(C,{key:2},[b(" Load more button "),h("div",kn,[h("button",{type:"button",class:"wl-btn",onClick:t[1]||(t[1]=(...t)=>e.loadMore&&e.loadMore(...t)),textContent:y(e.i18n.more)},null,8,Cn)])],2112)):b("v-if",!0):(g(),f("div",{key:1,class:"wl-empty",textContent:y(e.i18n.sofa)},null,8,bn))],2112)),b(" Copyright Information "),e.config.copyright?(g(),f("div",$n,[In,jn,S(" v"+y(e.version),1)])):b("v-if",!0)])}],["__file","Waline.vue"]]);const xn="2.4.2";export{Ln as Waline,xn as version};
import{getCurrentScope as e,onScopeDispose as t,watch as n,ref as l,unref as o,isRef as i,readonly as a,shallowRef as r,h as s,computed as c,defineComponent as u,inject as m,onMounted as d,onUnmounted as v,resolveComponent as p,openBlock as f,createElementBlock as g,createElementVNode as h,createVNode as w,toDisplayString as y,createCommentVNode as b,normalizeClass as k,Fragment as C,renderList as $,withDirectives as I,vModelDynamic as S,vModelText as j,vShow as L,createTextVNode as x,createBlock as E,withCtx as R,normalizeStyle as z,provide as M}from"vue";import A from"autosize";import{marked as U}from"marked";function O(n){return!!e()&&(t(n),!0)}const P="undefined"!=typeof window,H=()=>{};const T=e=>e();var V=Object.getOwnPropertySymbols,_=Object.prototype.hasOwnProperty,N=Object.prototype.propertyIsEnumerable;function F(e,t,l={}){const o=l,{eventFilter:i=T}=o,a=((e,t)=>{var n={};for(var l in e)_.call(e,l)&&t.indexOf(l)<0&&(n[l]=e[l]);if(null!=e&&V)for(var l of V(e))t.indexOf(l)<0&&N.call(e,l)&&(n[l]=e[l]);return n})(o,["eventFilter"]);return n(e,(r=i,s=t,function(...e){r((()=>s.apply(this,e)),{fn:s,thisArg:this,args:e})}),a);var r,s}var D=Object.defineProperty,B=Object.defineProperties,W=Object.getOwnPropertyDescriptors,G=Object.getOwnPropertySymbols,q=Object.prototype.hasOwnProperty,J=Object.prototype.propertyIsEnumerable,K=(e,t,n)=>t in e?D(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;function Y(e,t,n={}){const o=n,{eventFilter:i}=o,a=((e,t)=>{var n={};for(var l in e)q.call(e,l)&&t.indexOf(l)<0&&(n[l]=e[l]);if(null!=e&&G)for(var l of G(e))t.indexOf(l)<0&&J.call(e,l)&&(n[l]=e[l]);return n})(o,["eventFilter"]),{eventFilter:r,pause:s,resume:c,isActive:u}=function(e=T){const t=l(!0);return{isActive:t,pause:function(){t.value=!1},resume:function(){t.value=!0},eventFilter:(...n)=>{t.value&&e(...n)}}}(i),m=F(e,t,(d=((e,t)=>{for(var n in t||(t={}))q.call(t,n)&&K(e,n,t[n]);if(G)for(var n of G(t))J.call(t,n)&&K(e,n,t[n]);return e})({},a),B(d,W({eventFilter:r}))));var d;return{stop:m,pause:s,resume:c,isActive:u}}const Z=P?window:void 0,X=P?window.document:void 0;function Q(...e){let t,l,i,a;if("string"==typeof e[0]?([l,i,a]=e,t=Z):[t,l,i,a]=e,!t)return H;let r=H;const s=n((()=>function(e){var t;const n=o(e);return null!=(t=null==n?void 0:n.$el)?t:n}(t)),(e=>{r(),e&&(e.addEventListener(l,i,a),r=()=>{e.removeEventListener(l,i,a),r=H})}),{immediate:!0,flush:"post"}),c=()=>{s(),r()};return O(c),c}P&&window.navigator,P&&window.location;const ee="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},te="__vueuse_ssr_handlers__";ee[te]=ee[te]||{};const ne=ee[te];const le={boolean:{read:e=>"true"===e,write:e=>String(e)},object:{read:e=>JSON.parse(e),write:e=>JSON.stringify(e)},number:{read:e=>Number.parseFloat(e),write:e=>String(e)},any:{read:e=>e,write:e=>String(e)},string:{read:e=>e,write:e=>String(e)},map:{read:e=>new Map(JSON.parse(e)),write:e=>JSON.stringify(Array.from(e.entries()))},set:{read:e=>new Set(JSON.parse(e)),write:e=>JSON.stringify(Array.from(e))},date:{read:e=>new Date(e),write:e=>e.toISOString()}};function oe(e,t,n,i={}){var a;const{flush:s="pre",deep:c=!0,listenToStorageChanges:u=!0,writeDefaults:m=!0,shallow:d,window:v=Z,eventFilter:p,onError:f=(e=>{console.error(e)})}=i,g=(d?r:l)(t);if(!n)try{n=function(e,t){return ne[e]||t}("getDefaultStorage",(()=>{var e;return null==(e=Z)?void 0:e.localStorage}))()}catch(e){f(e)}if(!n)return g;const h=o(t),w=function(e){return null==e?"any":e instanceof Set?"set":e instanceof Map?"map":e instanceof Date?"date":"boolean"==typeof e?"boolean":"string"==typeof e?"string":"object"==typeof e||Array.isArray(e)?"object":Number.isNaN(e)?"any":"number"}(h),y=null!=(a=i.serializer)?a:le[w],{pause:b,resume:k}=Y(g,(()=>function(t){try{null==t?n.removeItem(e):n.setItem(e,y.write(t))}catch(e){f(e)}}(g.value)),{flush:s,deep:c,eventFilter:p});return v&&u&&Q(v,"storage",C),C(),g;function C(t){t&&t.key!==e||(g.value=function(t){if(!t||t.key===e){b();try{const l=t?t.newValue:n.getItem(e);return null==l?(m&&null!==h&&n.setItem(e,y.write(h)),h):"string"!=typeof l?l:y.read(l)}catch(e){f(e)}finally{k()}}}(t))}}var ie,ae,re=Object.defineProperty,se=Object.getOwnPropertySymbols,ce=Object.prototype.hasOwnProperty,ue=Object.prototype.propertyIsEnumerable,me=(e,t,n)=>t in e?re(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;function de(e={}){const{controls:t=!1,interval:a="requestAnimationFrame"}=e,r=l(new Date),s=()=>r.value=new Date,c="requestAnimationFrame"===a?function(e,t={}){const{immediate:n=!0,window:o=Z}=t,i=l(!1);let a=null;function r(){i.value&&o&&(e(),a=o.requestAnimationFrame(r))}function s(){!i.value&&o&&(i.value=!0,r())}function c(){i.value=!1,null!=a&&o&&(o.cancelAnimationFrame(a),a=null)}return n&&s(),O(c),{isActive:i,pause:c,resume:s}}(s,{immediate:!0}):function(e,t=1e3,a={}){const{immediate:r=!0,immediateCallback:s=!1}=a;let c=null;const u=l(!1);function m(){c&&(clearInterval(c),c=null)}function d(){u.value=!1,m()}function v(){t<=0||(u.value=!0,s&&e(),m(),c=setInterval(e,o(t)))}r&&P&&v(),i(t)&&O(n(t,(()=>{r&&P&&v()})));return O(d),{isActive:u,pause:d,resume:v}}(s,a,{immediate:!0});return t?((e,t)=>{for(var n in t||(t={}))ce.call(t,n)&&me(e,n,t[n]);if(se)for(var n of se(t))ue.call(t,n)&&me(e,n,t[n]);return e})({now:r},c):r}P&&(null==window?void 0:window.navigator)&&(null==(ie=null==window?void 0:window.navigator)?void 0:ie.platform)&&/iP(ad|hone|od)/.test(null==(ae=null==window?void 0:window.navigator)?void 0:ae.platform);let ve=0;const pe=({size:e})=>s("svg",{width:e,height:e,viewBox:"0 0 100 100",preserveAspectRatio:"xMidYMid"},s("circle",{cx:50,cy:50,fill:"none",stroke:"currentColor",strokeWidth:"4",r:"40","stroke-dasharray":"85 30"},s("animateTransform",{attributeName:"transform",type:"rotate",repeatCount:"indefinite",dur:"1s",values:"0 50 50;360 50 50",keyTimes:"0;1"}))),fe=["nick","mail","link"],ge=e=>e.filter((e=>fe.includes(e))),he=e=>new Promise(((t,n)=>{const l=new FileReader;l.readAsDataURL(e),l.onload=()=>t(l.result?.toString()||""),l.onerror=n})),we=e=>!0===e?'<p class="wl-tex">Tex is not available in preview</p>':'<span class="wl-tex">Tex is not available in preview</span>',ye=new RegExp(`(${/[\u4E00-\u9FFF\u3400-\u4dbf\uf900-\ufaff\u3040-\u309f\uac00-\ud7af\u0400-\u04FF]+|\w+/.source}|${/</.source})|((?:${/(?:^|\s)\/\/(.+?)$/gm.source})|(?:${/\/\*([\S\s]*?)\*\//gm.source}))`,"gmi"),be=["23AC69","91C132","F19726","E8552D","1AAB8E","E1147F","2980C1","1BA1E6","9FA0A0","F19726","E30B20","E30B20","A3338B"],ke={},Ce=e=>{let t=0;return e.replace(ye,((e,n,l)=>{if(l)return`<span style="color: slategray">${l}</span>`;if("<"===n)return"&lt;";let o;ke[n]?o=ke[n]:(o=be[t],ke[n]=o);const i=`<span style="color: #${o}">${n}</span>`;return t=++t%be.length,i}))},$e=["nick","nickError","mail","mailError","link","optional","placeholder","sofa","submit","like","cancelLike","reply","cancelReply","comment","refresh","more","preview","emoji","uploadImage","seconds","minutes","hours","days","now","uploading","login","logout","admin","sticky","word","wordHint","anonymous","level0","level1","level2","level3","level4","level5","gif","gifSearchPlaceholder"],Ie=e=>Object.fromEntries(e.map(((e,t)=>[$e[t],e])));var Se=Ie(["NickName","NickName cannot be less than 3 bytes.","E-Mail","Please confirm your email address.","Website","Optional","Comment here...","No comment yet.","Submit","Like","Cancel like","Reply","Cancel reply","Comments","Refresh","Load More...","Preview","Emoji","Upload Image","seconds ago","minutes ago","hours ago","days ago","just now","Uploading","Login","logout","Admin","Sticky","Words","Please input comments between $0 and $1 words!\n Current word number: $2","Anonymous","Dwarves","Hobbits","Ents","Wizards","Elves","Maiar","GIF","Search GIF"]),je=Ie(["ニックネーム","3バイト以上のニックネームをご入力ください.","メールアドレス","メールアドレスをご確認ください.","サイト","オプション","ここにコメント","コメントしましょう~","提出する","Like","Cancel like","返信する","キャンセル","コメント","更新","さらに読み込む","プレビュー","絵文字","画像をアップロード","秒前","分前","時間前","日前","たっだ今","アップロード","ログインする","ログアウト","管理者","トップに置く","ワード","コメントは $0 から $1 ワードの間でなければなりません!\n 現在の単語番号: $2","匿名","うえにん","なかにん","しもおし","特にしもおし","かげ","なぬし","GIF","探す GIF"]),Le=Ie(["昵称","昵称不能少于3个字符","邮箱","请填写正确的邮件地址","网址","可选","欢迎评论","来发评论吧~","提交","喜欢","取消喜欢","回复","取消回复","评论","刷新","加载更多...","预览","表情","上传图片","秒前","分钟前","小时前","天前","刚刚","正在上传","登录","退出","博主","置顶","字","评论字数应在 $0 到 $1 字之间!\n当前字数:$2","匿名","潜水","冒泡","吐槽","活跃","话痨","传说","表情包","搜索表情包"]),xe=Ie(["暱稱","郵箱","網址","可選","暱稱不能少於3個字元","請填寫正確的郵件地址","歡迎評論","來發評論吧~","提交","喜歡","取消喜歡","回覆","取消回覆","評論","刷新","載入更多...","預覽","表情","上傳圖片","秒前","分鐘前","小時前","天前","剛剛","正在上傳","登錄","退出","博主","置頂","字","評論字數應在 $0 到 $1 字之間!\n當前字數:$2","匿名","潛水","冒泡","吐槽","活躍","話癆","傳說","表情包","搜索表情包"]),Ee=Ie(["Apelido","Apelido não pode ser menor que 3 bytes.","E-Mail","Por favor, confirme seu endereço de e-mail.","Website","Opcional","Comente aqui...","Nenhum comentário, ainda.","Enviar","Like","Cancel like","Responder","Cancelar resposta","Comentários","Refrescar","Carregar Mais...","Visualizar","Emoji","Enviar Imagem","segundos atrás","minutos atrás","horas atrás","dias atrás","agora mesmo","Enviando","Entrar","Sair","Admin","Sticky","Palavras","Favor enviar comentário com $0 a $1 palavras!\n Número de palavras atuais: $2","Anônimo","Dwarves","Hobbits","Ents","Wizards","Elves","Maiar","GIF","Pesquisar GIF"]),Re=Ie(["Псевдоним","Никнейм не может быть меньше 3 байт.","Эл. адрес","Пожалуйста, подтвердите адрес вашей электронной почты.","Веб-сайт","Необязательный","Комментарий здесь...","Пока нет комментариев.","Отправить","Like","Cancel like","Отвечать","Отменить ответ","Комментарии","Обновить","Загрузи больше...","Превью","эмодзи","Загрузить изображение","секунд назад","несколько минут назад","несколько часов назад","дней назад","прямо сейчас","Загрузка","Авторизоваться","Выход из системы","Админ","Липкий","Слова","Пожалуйста, введите комментарии от $0 до $1 слов!\nНомер текущего слова: $2","Анонимный","Dwarves","Hobbits","Ents","Wizards","Elves","Maiar","GIF","Поиск GIF"]);const ze={zh:Le,"zh-cn":Le,"zh-CN":Le,"zh-tw":xe,"zh-TW":xe,en:Se,"en-US":Se,"en-us":Se,jp:je,"jp-jp":je,"jp-JP":je,"pt-br":Ee,"pt-BR":Ee,ru:Re,"ru-ru":Re,"ru-RU":Re},Me=e=>{try{e=decodeURI(e)}catch(e){}return e},Ae=(e="")=>e.replace(/\/$/u,""),Ue=e=>/^(https?:)?\/\//.test(e),Oe=e=>{const t=Ae(e);return Ue(t)?t:`https://${t}`},Pe=e=>Array.isArray(e)?e:!!e&&[0,e],He=(e,t)=>"function"==typeof e?e:!1!==e&&t,Te="{--waline-white:#000;--waline-light-grey:#666;--waline-dark-grey:#999;--waline-color:#888;--waline-bgcolor:#1e1e1e;--waline-bgcolor-light:#272727;--waline-bgcolor-hover: #444;--waline-border-color:#333;--waline-disable-bgcolor:#444;--waline-disable-color:#272727;--waline-bq-color:#272727;--waline-info-bgcolor:#272727;--waline-info-color:#666}",Ve=(e,t)=>{let n=e.toString();for(;n.length<t;)n="0"+n;return n},_e=(e,t,n)=>{if(!e)return"";const l="string"==typeof e?new Date(-1!==e.indexOf(" ")?e.replace(/-/g,"/"):e):e,o=t.getTime()-l.getTime(),i=Math.floor(o/864e5);if(0===i){const e=o%864e5,t=Math.floor(e/36e5);if(0===t){const t=e%36e5,l=Math.floor(t/6e4);if(0===l){const e=t%6e4;return`${Math.round(e/1e3)} ${n.seconds}`}return`${l} ${n.minutes}`}return`${t} ${n.hours}`}return i<0?n.now:i<8?`${i} ${n.days}`:(e=>{const t=Ve(e.getDate(),2),n=Ve(e.getMonth()+1,2);return`${Ve(e.getFullYear(),2)}-${n}-${t}`})(l)},Ne=e=>{const t=oe("WALINE_EMOJI",{}),n=Boolean(/@[0-9]+\.[0-9]+\.[0-9]+/.test(e));if(n){const n=t.value[e];if(n)return Promise.resolve(n)}return fetch(`${e}/info.json`).then((e=>e.json())).then((l=>{const o={folder:e,...l};return n&&(t.value[e]=o),o}))},Fe=(e,t="",n="",l="")=>`${t?`${t}/`:""}${n}${e}${l?`.${l}`:""}`,De={"Content-Type":"application/json"},Be=({serverURL:e,lang:t,path:n,page:l,pageSize:o,signal:i,token:a})=>{const r={};return a&&(r.Authorization=`Bearer ${a}`),fetch(`${e}/comment?path=${encodeURIComponent(n)}&pageSize=${o}&page=${l}&lang=${t}`,{signal:i,headers:r}).then((e=>e.json())).then((e=>((e,t="")=>{if("object"==typeof e&&e.errno)throw new TypeError(`Fetch ${t} failed with ${e.errno}: ${e.errmsg}`);return e})(e,"comment list")))},We=({serverURL:e,lang:t,token:n,objectId:l,...o})=>fetch(`${e}/comment/${l}?lang=${t}`,{method:"PUT",headers:{"Content-Type":"application/json",Authorization:`Bearer ${n}`},body:JSON.stringify(o)}).then((e=>e.json())),Ge=e=>e.type.includes("image"),qe=e=>{const t=Array.from(e).find(Ge);return t?t.getAsFile():null},Je=/\$.*?\$/,Ke=/^\$(.*?)\$/,Ye=/^(?:\s{0,3})\$\$((?:[^\n]|\n[^\n])+?)\n{0,1}\$\$/,Ze=(e="",t={})=>e.replace(/:(.+?):/g,((e,n)=>t[n]?`<img class="wl-emoji" src="${t[n]}" alt="${n}">`:e)),Xe=(e,{emojiMap:t,highlighter:n,texRenderer:l})=>{if(U.setOptions({highlight:n||void 0,breaks:!0,smartLists:!0,smartypants:!0}),l){const e=(e=>[{name:"blockMath",level:"block",tokenizer(t){const n=Ye.exec(t);if(null!==n)return{type:"html",raw:n[0],text:e(!0,n[1])}}},{name:"inlineMath",level:"inline",start(e){const t=e.search(Je);return-1!==t?t:e.length},tokenizer(t){const n=Ke.exec(t);if(null!==n)return{type:"html",raw:n[0],text:e(!1,n[1])}}}])(l);U.use({extensions:e})}return U.parse(Ze(e,t))},Qe=({key:e,keyword:t,pos:n,limit:l})=>{const o=new URLSearchParams("media_filter=minimal");return o.set("key",e||"PAY5JLFIH6V6"),o.set("limit",(l||20).toString()),o.set("pos",n||""),o.set("q",t),fetch(`https://g.tenor.com/v1/search?${o.toString()}`,{headers:{"Content-Type":"application/json"}}).then((e=>e.json()))};let et=null;const tt=()=>et||(et=oe("USER_KEY",{}));let nt=null;const lt=()=>nt||(nt=oe("WALIKE_LIKE",[]));var ot=(e,t)=>{const n=e.__vccOpts||e;for(const[e,l]of t)n[e]=l;return n};const it=u({name:"CommentBox",components:{CloseIcon:({size:e})=>s("svg",{class:"wl-close-icon",viewBox:"0 0 1024 1024",width:e,height:e},[s("path",{d:"M697.173 85.333h-369.92c-144.64 0-241.92 101.547-241.92 252.587v348.587c0 150.613 97.28 252.16 241.92 252.16h369.92c144.64 0 241.494-101.547 241.494-252.16V337.92c0-151.04-96.854-252.587-241.494-252.587z",fill:"currentColor"}),s("path",{d:"m640.683 587.52-75.947-75.861 75.904-75.862a37.29 37.29 0 0 0 0-52.778 37.205 37.205 0 0 0-52.779 0l-75.946 75.818-75.862-75.946a37.419 37.419 0 0 0-52.821 0 37.419 37.419 0 0 0 0 52.821l75.947 75.947-75.776 75.733a37.29 37.29 0 1 0 52.778 52.821l75.776-75.776 75.947 75.947a37.376 37.376 0 0 0 52.779-52.821z",fill:"#888"})]),EmojiIcon:()=>s("svg",{viewBox:"0 0 1024 1024",width:"24",height:"24"},s("path",{d:"M563.2 463.3 677 540c1.7 1.2 3.7 1.8 5.8 1.8.7 0 1.4-.1 2-.2 2.7-.5 5.1-2.1 6.6-4.4l25.3-37.8c1.5-2.3 2.1-5.1 1.6-7.8s-2.1-5.1-4.4-6.6l-73.6-49.1 73.6-49.1c2.3-1.5 3.9-3.9 4.4-6.6.5-2.7 0-5.5-1.6-7.8l-25.3-37.8a10.1 10.1 0 0 0-6.6-4.4c-.7-.1-1.3-.2-2-.2-2.1 0-4.1.6-5.8 1.8l-113.8 76.6c-9.2 6.2-14.7 16.4-14.7 27.5.1 11 5.5 21.3 14.7 27.4zM387 348.8h-45.5c-5.7 0-10.4 4.7-10.4 10.4v153.3c0 5.7 4.7 10.4 10.4 10.4H387c5.7 0 10.4-4.7 10.4-10.4V359.2c0-5.7-4.7-10.4-10.4-10.4zm333.8 241.3-41-20a10.3 10.3 0 0 0-8.1-.5c-2.6.9-4.8 2.9-5.9 5.4-30.1 64.9-93.1 109.1-164.4 115.2-5.7.5-9.9 5.5-9.5 11.2l3.9 45.5c.5 5.3 5 9.5 10.3 9.5h.9c94.8-8 178.5-66.5 218.6-152.7 2.4-5 .3-11.2-4.8-13.6zm186-186.1c-11.9-42-30.5-81.4-55.2-117.1-24.1-34.9-53.5-65.6-87.5-91.2-33.9-25.6-71.5-45.5-111.6-59.2-41.2-14-84.1-21.1-127.8-21.1h-1.2c-75.4 0-148.8 21.4-212.5 61.7-63.7 40.3-114.3 97.6-146.5 165.8-32.2 68.1-44.3 143.6-35.1 218.4 9.3 74.8 39.4 145 87.3 203.3.1.2.3.3.4.5l36.2 38.4c1.1 1.2 2.5 2.1 3.9 2.6 73.3 66.7 168.2 103.5 267.5 103.5 73.3 0 145.2-20.3 207.7-58.7 37.3-22.9 70.3-51.5 98.1-85 27.1-32.7 48.7-69.5 64.2-109.1 15.5-39.7 24.4-81.3 26.6-123.8 2.4-43.6-2.5-87-14.5-129zm-60.5 181.1c-8.3 37-22.8 72-43 104-19.7 31.1-44.3 58.6-73.1 81.7-28.8 23.1-61 41-95.7 53.4-35.6 12.7-72.9 19.1-110.9 19.1-82.6 0-161.7-30.6-222.8-86.2l-34.1-35.8c-23.9-29.3-42.4-62.2-55.1-97.7-12.4-34.7-18.8-71-19.2-107.9-.4-36.9 5.4-73.3 17.1-108.2 12-35.8 30-69.2 53.4-99.1 31.7-40.4 71.1-72 117.2-94.1 44.5-21.3 94-32.6 143.4-32.6 49.3 0 97 10.8 141.8 32 34.3 16.3 65.3 38.1 92 64.8 26.1 26 47.5 56 63.6 89.2 16.2 33.2 26.6 68.5 31 105.1 4.6 37.5 2.7 75.3-5.6 112.3z",fill:"currentColor"})),ImageIcon:()=>s("svg",{viewBox:"0 0 1024 1024",width:"24",height:"24"},[s("path",{d:"M784 112H240c-88 0-160 72-160 160v480c0 88 72 160 160 160h544c88 0 160-72 160-160V272c0-88-72-160-160-160zm96 640c0 52.8-43.2 96-96 96H240c-52.8 0-96-43.2-96-96V272c0-52.8 43.2-96 96-96h544c52.8 0 96 43.2 96 96v480z",fill:"currentColor"}),s("path",{d:"M352 480c52.8 0 96-43.2 96-96s-43.2-96-96-96-96 43.2-96 96 43.2 96 96 96zm0-128c17.6 0 32 14.4 32 32s-14.4 32-32 32-32-14.4-32-32 14.4-32 32-32zm462.4 379.2-3.2-3.2-177.6-177.6c-25.6-25.6-65.6-25.6-91.2 0l-80 80-36.8-36.8c-25.6-25.6-65.6-25.6-91.2 0L200 728c-4.8 6.4-8 14.4-8 24 0 17.6 14.4 32 32 32 9.6 0 16-3.2 22.4-9.6L380.8 640l134.4 134.4c6.4 6.4 14.4 9.6 24 9.6 17.6 0 32-14.4 32-32 0-9.6-4.8-17.6-9.6-24l-52.8-52.8 80-80L769.6 776c6.4 4.8 12.8 8 20.8 8 17.6 0 32-14.4 32-32 0-8-3.2-16-8-20.8z",fill:"currentColor"})]),MarkdownIcon:()=>s("svg",{width:"16",height:"16",ariaHidden:"true"},s("path",{d:"M14.85 3H1.15C.52 3 0 3.52 0 4.15v7.69C0 12.48.52 13 1.15 13h13.69c.64 0 1.15-.52 1.15-1.15v-7.7C16 3.52 15.48 3 14.85 3zM9 11H7V8L5.5 9.92 4 8v3H2V5h2l1.5 2L7 5h2v6zm2.99.5L9.5 8H11V5h2v3h1.5l-2.51 3.5z",fill:"currentColor"})),PreviewIcon:()=>s("svg",{viewBox:"0 0 1024 1024",width:"24",height:"24"},[s("path",{d:"M710.816 654.301c70.323-96.639 61.084-230.578-23.705-314.843-46.098-46.098-107.183-71.109-172.28-71.109-65.008 0-126.092 25.444-172.28 71.109-45.227 46.098-70.756 107.183-70.756 172.106 0 64.923 25.444 126.007 71.194 172.106 46.099 46.098 107.184 71.109 172.28 71.109 51.414 0 100.648-16.212 142.824-47.404l126.53 126.006c7.058 7.06 16.297 10.979 26.406 10.979 10.105 0 19.343-3.919 26.402-10.979 14.467-14.467 14.467-38.172 0-52.723L710.816 654.301zm-315.107-23.265c-65.88-65.88-65.88-172.54 0-238.42 32.069-32.07 74.245-49.149 119.471-49.149 45.227 0 87.407 17.603 119.472 49.149 65.88 65.879 65.88 172.539 0 238.42-63.612 63.178-175.242 63.178-238.943 0zm0 0",fill:"currentColor"}),s("path",{d:"M703.319 121.603H321.03c-109.8 0-199.469 89.146-199.469 199.38v382.034c0 109.796 89.236 199.38 199.469 199.38h207.397c20.653 0 37.384-16.645 37.384-37.299 0-20.649-16.731-37.296-37.384-37.296H321.03c-68.582 0-124.352-55.77-124.352-124.267V321.421c0-68.496 55.77-124.267 124.352-124.267h382.289c68.582 0 124.352 55.771 124.352 124.267V524.72c0 20.654 16.736 37.299 37.385 37.299 20.654 0 37.384-16.645 37.384-37.299V320.549c-.085-109.8-89.321-198.946-199.121-198.946zm0 0",fill:"currentColor"})]),LoadingIcon:pe,GifIcon:()=>s("svg",{width:24,height:24,fill:"currentcolor",viewBox:"0 0 24 24"},[s("path",{style:"transform: translateY(0.5px)",d:"M18.968 10.5H15.968V11.484H17.984V12.984H15.968V15H14.468V9H18.968V10.5V10.5ZM8.984 9C9.26533 9 9.49967 9.09367 9.687 9.281C9.87433 9.46833 9.968 9.70267 9.968 9.984V10.5H6.499V13.5H8.468V12H9.968V14.016C9.968 14.2973 9.87433 14.5317 9.687 14.719C9.49967 14.9063 9.26533 15 8.984 15H5.984C5.70267 15 5.46833 14.9063 5.281 14.719C5.09367 14.5317 5 14.2973 5 14.016V9.985C5 9.70367 5.09367 9.46933 5.281 9.282C5.46833 9.09467 5.70267 9.001 5.984 9.001H8.984V9ZM11.468 9H12.968V15H11.468V9V9Z"}),s("path",{d:"M18.5 3H5.75C3.6875 3 2 4.6875 2 6.75V18C2 20.0625 3.6875 21.75 5.75 21.75H18.5C20.5625 21.75 22.25 20.0625 22.25 18V6.75C22.25 4.6875 20.5625 3 18.5 3ZM20.75 18C20.75 19.2375 19.7375 20.25 18.5 20.25H5.75C4.5125 20.25 3.5 19.2375 3.5 18V6.75C3.5 5.5125 4.5125 4.5 5.75 4.5H18.5C19.7375 4.5 20.75 5.5125 20.75 6.75V18Z"})])},props:{rootId:{type:String,default:""},replyId:{type:String,default:""},replyUser:{type:String,default:""}},emits:["submit","cancel-reply"],setup(e,{emit:t}){const o=m("config"),i=oe("WALINE_COMMENT_BOX_EDITOR",""),a=oe("WALINE_USER_META",{nick:"",mail:"",link:""}),r=tt(),s=l({}),u=l(null),p=l(null),f=l(null),g=l(null),h=l(null),w=l(null),y=l(null),b=l({tabs:[],map:{}}),k=l(0),C=l(!1),$=l(!1),I=l(!1),S=l(""),j=l(0),L=l({cursor:"",loading:!0,list:[]}),x=l(0),E=l(!1),R=l(""),z=l(!1),M=c((()=>o.value.locale)),U=c((()=>Boolean(r.value?.token))),O=c((()=>!1!==o.value.imageUploader)),P=e=>{const t=u.value,n=t.selectionStart,l=t.selectionEnd||0,o=t.scrollTop;i.value=t.value.substring(0,n)+e+t.value.substring(l,t.value.length),t.focus(),t.selectionStart=n+e.length,t.selectionEnd=n+e.length,t.scrollTop=o},H=e=>{const t=`![${o.value.locale.uploading} ${e.name}]()`;return P(t),Promise.resolve().then((()=>o.value.imageUploader(e))).then((n=>{i.value=i.value.replace(t,`\r\n![${e.name}](${n})`)}))},T=()=>{const{serverURL:n,lang:l,login:c,wordLimit:m,requiredMeta:d}=o.value,v={comment:R.value,nick:a.value.nick,mail:a.value.mail,link:a.value.link,ua:navigator.userAgent,url:o.value.path};if(r.value?.token)v.nick=r.value.display_name,v.mail=r.value.email,v.link=r.value.url;else{if("force"===c)return;if(d.indexOf("nick")>-1&&!v.nick)return s.value.nick?.focus(),alert(M.value.nickError);if(d.indexOf("mail")>-1&&!v.mail||v.mail&&!/^\w(?:[\w._-]*\w)?@(?:\w(?:[\w-]*\w)?\.)*\w+$/.exec(v.mail))return s.value.mail?.focus(),alert(M.value.mailError);if(!v.comment)return void u.value?.focus();v.nick||(v.nick=M.value.anonymous)}if(!E.value)return alert(M.value.wordHint.replace("$0",m[0].toString()).replace("$1",m[1].toString()).replace("$2",j.value.toString()));v.comment=Ze(v.comment,b.value.map),e.replyId&&e.rootId&&(v.pid=e.replyId,v.rid=e.rootId,v.at=e.replyUser),z.value=!0,(({serverURL:e,lang:t,token:n,comment:l})=>{const o={"Content-Type":"application/json"};return n&&(o.Authorization=`Bearer ${n}`),fetch(`${e}/comment?lang=${t}`,{method:"POST",headers:o,body:JSON.stringify(l)}).then((e=>e.json()))})({serverURL:n,lang:l,token:r.value?.token,comment:v}).then((n=>{if(z.value=!1,n.errmsg)return alert(n.errmsg);t("submit",n.data),i.value="",S.value="",e.replyId&&t("cancel-reply")})).catch((e=>{z.value=!1,alert(e.message)}))},V=e=>{f.value.contains(e.target)||g.value.contains(e.target)||(C.value=!1),h.value.contains(e.target)||w.value.contains(e.target)||($.value=!1)},_=function(e,t=300){let n;return(...l)=>{n&&clearTimeout(n),n=window.setTimeout((()=>{e(...l),n=null}),t)}}((async e=>{L.value.cursor="",L.value.list=[],N(e)})),N=async e=>{const{scrollTop:t,clientHeight:n,scrollHeight:l}=e.target;if((n+t)/l<.9||L.value.loading)return;L.value.loading=!0;const o=await Qe({keyword:y.value?.value||"",pos:L.value.cursor}).finally((()=>{L.value.loading=!1}));L.value.cursor=o.next,L.value.list=L.value.list.concat(o.results),setTimeout((()=>{e.target.scrollTop=t}),50)};return n([o,j],(([e,t])=>{const{wordLimit:n}=e;n?t<n[0]&&0!==n[0]?(x.value=n[0],E.value=!1):t>n[1]?(x.value=n[1],E.value=!1):(x.value=n[1],E.value=!0):(x.value=0,E.value=!0)}),{immediate:!0}),n([$],(async([e])=>{if(!e)return;L.value.loading=!0;const t=await Qe({keyword:""}).finally((()=>{L.value.loading=!1}));L.value.cursor=t.next,L.value.list=L.value.list.concat(t.results)})),d((()=>{document.body.addEventListener("click",V),n((()=>i.value),(e=>{const{highlighter:t,texRenderer:n}=o.value;R.value=e,S.value=Xe(e,{emojiMap:b.value.map,highlighter:t,texRenderer:n}),j.value=(e=>(e=>e.match(/[\w\d\s\u00C0-\u024F]+/giu)||[])(e).reduce(((e,t)=>e+(""===t.trim()?0:t.trim().split(/\s+/u).length)),0)+(e=>e.match(/[\u4E00-\u9FA5]/gu)||[])(e).length)(e),e?A(u.value):A.destroy(u.value)}),{immediate:!0}),n((()=>o.value.emoji),(e=>{return(t=Array.isArray(e)?e:[],Promise.all(t.map((e=>"string"==typeof e?Ne(Ae(e)):Promise.resolve(e)))).then((e=>{const t={tabs:[],map:{}};return e.forEach((e=>{const{name:n,folder:l,icon:o,prefix:i,type:a,items:r}=e;t.tabs.push({name:n,icon:Fe(o,l,i,a),items:r.map((e=>{const n=`${i||""}${e}`;return t.map[n]=Fe(e,l,i,a),n}))})})),t}))).then((e=>{b.value=e}));var t}),{immediate:!0})})),v((()=>{document.body.removeEventListener("click",V)})),{config:o,locale:M,insert:P,onChange:()=>{const e=p.value;e.files&&O.value&&H(e.files[0]).then((()=>{e.value=""}))},onDrop:e=>{if(e.dataTransfer?.items){const t=qe(e.dataTransfer.items);t&&O.value&&(H(t),e.preventDefault())}},onKeyDown:e=>{const t=e.key;(e.ctrlKey||e.metaKey)&&"Enter"===t&&T()},onPaste:e=>{if(e.clipboardData){const t=qe(e.clipboardData.items);t&&O.value&&H(t)}},onLogin:e=>{e.preventDefault();const{lang:t,serverURL:n}=o.value,l=(window.innerWidth-450)/2,i=(window.innerHeight-450)/2,a=window.open(`${n}/ui/login?lng=${encodeURIComponent(t)}`,"_blank",`width=450,height=450,left=${l},top=${i},scrollbars=no,resizable=no,status=no,location=no,toolbar=no,menubar=no`);a?.postMessage({type:"TOKEN",data:null},"*");const s=({data:e})=>{e&&"userInfo"===e.type&&e.data.token&&(a?.close(),r.value=e.data,(e.data.remember?localStorage:sessionStorage).setItem("WALINE_USER",JSON.stringify(e.data)),window.removeEventListener("message",s))};window.addEventListener("message",s)},onLogout:()=>{r.value={},localStorage.setItem("WALINE_USER","null"),sessionStorage.setItem("WALINE_USER","null")},onProfile:e=>{e.preventDefault();const{lang:t,serverURL:n}=o.value,l=(window.innerWidth-800)/2,i=(window.innerHeight-800)/2;window.open(`${n}/ui/profile?lng=${encodeURIComponent(t)}`,"_blank",`width=800,height=800,left=${l},top=${i},scrollbars=no,resizable=no,status=no,location=no,toolbar=no,menubar=no`)?.postMessage({type:"TOKEN",data:r.value.token},"*");const a=({data:e})=>{e&&"profile"===e.type&&(r.value={...r.value,...e},[localStorage,sessionStorage].filter((e=>e.getItem("WALINE_USER"))).forEach((e=>e.setItem("WALINE_USER",JSON.stringify(r)))),window.removeEventListener("message",a))};window.addEventListener("message",a)},submitComment:T,onGifMasonryScroll:N,onGifSearch:_,isLogin:U,userInfo:r,isSubmitting:z,wordNumber:j,wordLimit:x,isWordNumberLegal:E,editor:i,userMeta:a,emoji:b,emojiTabIndex:k,showEmoji:C,showGif:$,canUploadImage:O,previewText:S,showPreview:I,inputRefs:s,editorRef:u,emojiButtonRef:f,emojiPopupRef:g,gifButtonRef:h,gifPopupRef:w,imageUploadRef:p,gifSearchInputRef:y,gifData:L}}}),at={class:"wl-comment"},rt={key:0,class:"wl-login-info"},st={class:"wl-avatar"},ct=["title"],ut=["src"],mt=["textContent"],dt={class:"wl-panel"},vt=["for","textContent"],pt=["id","name","type","onUpdate:modelValue"],ft=["placeholder"],gt={class:"wl-preview"},ht=h("hr",null,null,-1),wt=["innerHTML"],yt={class:"wl-footer"},bt={class:"wl-actions"},kt={href:"https://guides.github.com/features/mastering-markdown/",title:"Markdown Guide","aria-label":"Markdown is supported",class:"wl-action",target:"_blank",rel:"noreferrer"},Ct=["title"],$t=["title"],It=["title"],St=["title"],jt={class:"wl-info"},Lt={class:"wl-text-number"},xt={key:0},Et=x("  /  "),Rt=["textContent"],zt=["textContent"],Mt=["disabled"],At=["placeholder"],Ut=["onClick","src","title"],Ot={key:0,class:"wl-loading"},Pt={key:0,class:"wl-tab-wrapper"},Ht=["title","onClick"],Tt=["src","alt"],Vt={key:0,class:"wl-tabs"},_t=["onClick"],Nt=["src","alt","title"],Ft=["title"];var Dt=ot(it,[["render",function(e,t,n,l,o,i){const a=p("CloseIcon"),r=p("MarkdownIcon"),s=p("EmojiIcon"),c=p("GifIcon"),u=p("ImageIcon"),m=p("PreviewIcon"),d=p("LoadingIcon"),v=p("masonry-wall");return f(),g("div",at,["disable"!==e.config.login&&e.isLogin?(f(),g("div",rt,[h("div",st,[h("button",{class:"wl-logout-btn",title:e.locale.logout,onClick:t[0]||(t[0]=(...t)=>e.onLogout&&e.onLogout(...t))},[w(a,{size:14})],8,ct),h("img",{src:e.userInfo.avatar,alt:"avatar"},null,8,ut)]),h("a",{href:"#",class:"wl-login-nick","aria-label":"Profile",onClick:t[1]||(t[1]=(...t)=>e.onProfile&&e.onProfile(...t)),textContent:y(e.userInfo.display_name)},null,8,mt)])):b("v-if",!0),h("div",dt,["force"!==e.config.login&&e.config.meta.length&&!e.isLogin?(f(),g("div",{key:0,class:k(["wl-header",`item${e.config.meta.length}`])},[(f(!0),g(C,null,$(e.config.meta,(t=>(f(),g("div",{class:"wl-header-item",key:t},[h("label",{for:t,textContent:y(e.locale[t]+(e.config.requiredMeta.includes(t)||!e.config.requiredMeta.length?"":`(${e.locale.optional})`))},null,8,vt),I(h("input",{ref_for:!0,ref:n=>{n&&(e.inputRefs[t]=n)},id:`wl-${t}`,class:k(["wl-input",`wl-${t}`]),name:t,type:"mail"===t?"email":"text","onUpdate:modelValue":n=>e.userMeta[t]=n},null,10,pt),[[S,e.userMeta[t]]])])))),128))],2)):b("v-if",!0),I(h("textarea",{class:"wl-editor",ref:"editorRef",id:"wl-edit",placeholder:e.replyUser?`@${e.replyUser}`:e.locale.placeholder,"onUpdate:modelValue":t[2]||(t[2]=t=>e.editor=t),onKeydown:t[3]||(t[3]=(...t)=>e.onKeyDown&&e.onKeyDown(...t)),onDrop:t[4]||(t[4]=(...t)=>e.onDrop&&e.onDrop(...t)),onPaste:t[5]||(t[5]=(...t)=>e.onPaste&&e.onPaste(...t))},null,40,ft),[[j,e.editor]]),I(h("div",gt,[ht,h("h4",null,y(e.locale.preview)+":",1),h("div",{class:"wl-content",innerHTML:e.previewText},null,8,wt)],512),[[L,e.showPreview]]),h("div",yt,[h("div",bt,[h("a",kt,[w(r)]),I(h("button",{ref:"emojiButtonRef",class:k(["wl-action",{actived:e.showEmoji}]),title:e.locale.emoji,onClick:t[6]||(t[6]=t=>e.showEmoji=!e.showEmoji)},[w(s)],10,Ct),[[L,e.emoji.tabs.length]]),h("button",{ref:"gifButtonRef",class:k(["wl-action",{actived:e.showGif}]),title:e.locale.gif,onClick:t[7]||(t[7]=t=>e.showGif=!e.showGif)},[w(c)],10,$t),h("input",{ref:"imageUploadRef",class:"upload",id:"wl-image-upload",type:"file",accept:".png,.jpg,.jpeg,.webp,.bmp,.gif",onChange:t[8]||(t[8]=(...t)=>e.onChange&&e.onChange(...t))},null,544),e.canUploadImage?(f(),g("label",{key:0,for:"wl-image-upload",class:"wl-action",title:e.locale.uploadImage},[w(u)],8,It)):b("v-if",!0),h("button",{class:k(["wl-action",{actived:e.showPreview}]),title:e.locale.preview,onClick:t[9]||(t[9]=t=>e.showPreview=!e.showPreview)},[w(m)],10,St)]),h("div",jt,[h("div",Lt,[x(y(e.wordNumber)+" ",1),e.config.wordLimit?(f(),g("span",xt,[Et,h("span",{class:k({illegal:!e.isWordNumberLegal}),textContent:y(e.wordLimit)},null,10,Rt)])):b("v-if",!0),x("  "+y(e.locale.word),1)]),"disable"===e.config.login||e.isLogin?b("v-if",!0):(f(),g("button",{key:0,class:"wl-btn",onClick:t[10]||(t[10]=(...t)=>e.onLogin&&e.onLogin(...t)),textContent:y(e.locale.login)},null,8,zt)),"force"!==e.config.login||e.isLogin?(f(),g("button",{key:1,class:"wl-btn primary",title:"Cmd|Ctrl + Enter",disabled:e.isSubmitting,onClick:t[11]||(t[11]=(...t)=>e.submitComment&&e.submitComment(...t))},[e.isSubmitting?(f(),E(d,{key:0,size:16})):(f(),g(C,{key:1},[x(y(e.locale.submit),1)],2112))],8,Mt)):b("v-if",!0)]),h("div",{ref:"gifPopupRef",class:k(["wl-gif-popup",{display:e.showGif}])},[h("input",{type:"text",placeholder:e.locale.gifSearchPlaceholder,ref:"gifSearchInputRef",onInput:t[12]||(t[12]=(...t)=>e.onGifSearch&&e.onGifSearch(...t))},null,40,At),w(v,{class:"wl-gif-waterfall",items:e.gifData.list,"ssr-columns":2,"column-width":200,gap:6,onScroll:e.onGifMasonryScroll},{default:R((({item:t})=>[h("img",{onClick:n=>e.insert(`![](${t.media[0].tinygif.url})`),src:t.media[0].tinygif.url,title:t.title,loading:"lazy",style:z({width:"200px",height:200*t.media[0].tinygif.dims[1]/t.media[0].tinygif.dims[0]+"px"})},null,12,Ut)])),_:1},8,["items","onScroll"]),e.gifData.loading?(f(),g("div",Ot,[w(d,{size:30})])):b("v-if",!0)],2),h("div",{ref:"emojiPopupRef",class:k(["wl-emoji-popup",{display:e.showEmoji}])},[(f(!0),g(C,null,$(e.emoji.tabs,((t,n)=>(f(),g(C,{key:t.name},[n===e.emojiTabIndex?(f(),g("div",Pt,[(f(!0),g(C,null,$(t.items,(t=>(f(),g("button",{key:t,title:t,onClick:n=>e.insert(`:${t}:`)},[e.showEmoji?(f(),g("img",{key:0,class:"wl-emoji",src:e.emoji.map[t],alt:t,loading:"lazy",referrerPolicy:"no-referrer"},null,8,Tt)):b("v-if",!0)],8,Ht)))),128))])):b("v-if",!0)],64)))),128)),e.emoji.tabs.length>1?(f(),g("div",Vt,[(f(!0),g(C,null,$(e.emoji.tabs,((t,n)=>(f(),g("button",{key:t.name,class:k(["wl-tab",{active:e.emojiTabIndex===n}]),onClick:t=>e.emojiTabIndex=n},[h("img",{class:"wl-emoji",src:t.icon,alt:t.name,title:t.name,loading:"lazy",referrerPolicy:"no-referrer"},null,8,Nt)],10,_t)))),128))])):b("v-if",!0)],2)])]),e.replyId?(f(),g("button",{key:1,class:"wl-close",title:e.locale.cancelReply,onClick:t[13]||(t[13]=t=>e.$emit("cancel-reply"))},[w(a,{size:24})],8,Ft)):b("v-if",!0)])}],["__file","CommentBox.vue"]]);const Bt=["approved","waiting","spam"],Wt=u({props:{comment:{type:Object,required:!0},rootId:{type:String,required:!0},reply:{type:Object}},components:{CommentBox:Dt,DeleteIcon:()=>s("svg",{viewBox:"0 0 1024 1024",width:"24",height:"24"},s("path",{d:"m341.013 394.667 27.755 393.45h271.83l27.733-393.45h64.106l-28.01 397.952a64 64 0 0 1-63.83 59.498H368.768a64 64 0 0 1-63.83-59.52l-28.053-397.93h64.128zm139.307 19.818v298.667h-64V414.485h64zm117.013 0v298.667h-64V414.485h64zM181.333 288h640v64h-640v-64zm453.483-106.667v64h-256v-64h256z",fill:"red"})),LikeIcon:({active:e=!1})=>s("svg",{viewBox:"0 0 1024 1024",width:"24",height:"24"},[s("path",{d:"M850.654 323.804c-11.042-25.625-26.862-48.532-46.885-68.225-20.022-19.61-43.258-34.936-69.213-45.73-26.78-11.124-55.124-16.727-84.375-16.727-40.622 0-80.256 11.123-114.698 32.135A214.79 214.79 0 0 0 512 241.819a214.79 214.79 0 0 0-23.483-16.562c-34.442-21.012-74.076-32.135-114.698-32.135-29.25 0-57.595 5.603-84.375 16.727-25.872 10.711-49.19 26.12-69.213 45.73-20.105 19.693-35.843 42.6-46.885 68.225-11.453 26.615-17.303 54.877-17.303 83.963 0 27.439 5.603 56.03 16.727 85.117 9.31 24.307 22.659 49.52 39.715 74.981 27.027 40.293 64.188 82.316 110.33 124.915 76.465 70.615 152.189 119.394 155.402 121.371l19.528 12.525c8.652 5.52 19.776 5.52 28.427 0l19.529-12.525c3.213-2.06 78.854-50.756 155.401-121.371 46.143-42.6 83.304-84.622 110.33-124.915 17.057-25.46 30.487-50.674 39.716-74.981 11.124-29.087 16.727-57.678 16.727-85.117.082-29.086-5.768-57.348-17.221-83.963z"+(e?"":"M512 761.5S218.665 573.55 218.665 407.767c0-83.963 69.461-152.023 155.154-152.023 60.233 0 112.473 33.618 138.181 82.727 25.708-49.109 77.948-82.727 138.18-82.727 85.694 0 155.155 68.06 155.155 152.023C805.335 573.551 512 761.5 512 761.5z"),fill:e?"red":"currentColor"})]),ReplyIcon:()=>s("svg",{viewBox:"0 0 1024 1024",width:"24",height:"24"},s("path",{d:"M810.667 213.333a64 64 0 0 1 64 64V704a64 64 0 0 1-64 64H478.336l-146.645 96.107a21.333 21.333 0 0 1-33.024-17.856V768h-85.334a64 64 0 0 1-64-64V277.333a64 64 0 0 1 64-64h597.334zm0 64H213.333V704h149.334v63.296L459.243 704h351.424V277.333zm-271.36 213.334v64h-176.64v-64h176.64zm122.026-128v64H362.667v-64h298.666z",fill:"currentColor"})),VerifiedIcon:()=>s("svg",{class:"verified-icon",viewBox:"0 0 1024 1024",width:"14",height:"14"},s("path",{d:"m894.4 461.56-54.4-63.2c-10.4-12-18.8-34.4-18.8-50.4v-68c0-42.4-34.8-77.2-77.2-77.2h-68c-15.6 0-38.4-8.4-50.4-18.8l-63.2-54.4c-27.6-23.6-72.8-23.6-100.8 0l-62.8 54.8c-12 10-34.8 18.4-50.4 18.4h-69.2c-42.4 0-77.2 34.8-77.2 77.2v68.4c0 15.6-8.4 38-18.4 50l-54 63.6c-23.2 27.6-23.2 72.4 0 100l54 63.6c10 12 18.4 34.4 18.4 50v68.4c0 42.4 34.8 77.2 77.2 77.2h69.2c15.6 0 38.4 8.4 50.4 18.8l63.2 54.4c27.6 23.6 72.8 23.6 100.8 0l63.2-54.4c12-10.4 34.4-18.8 50.4-18.8h68c42.4 0 77.2-34.8 77.2-77.2v-68c0-15.6 8.4-38.4 18.8-50.4l54.4-63.2c23.2-27.6 23.2-73.2-.4-100.8zm-216-25.2-193.2 193.2a30 30 0 0 1-42.4 0l-96.8-96.8a30.16 30.16 0 0 1 0-42.4c11.6-11.6 30.8-11.6 42.4 0l75.6 75.6 172-172c11.6-11.6 30.8-11.6 42.4 0 11.6 11.6 11.6 30.8 0 42.4z",fill:"#27ae60"}))},emits:["submit","reply","like","delete","status","sticky"],setup(e){const t=m("config"),n=lt(),l=tt(),o=c((()=>t.value.locale)),i=c((()=>{let{link:t}=e.comment;return t?Ue(t)?t:`https://${t}`:""})),a=c((()=>n.value.includes(e.comment.objectId))),r=((e,t)=>{const n=de();return c((()=>_e(e,n.value,t)))})(e.comment.insertedAt,o.value),s=c((()=>"administrator"===l.value.type)),u=c((()=>e.comment.user_id&&l.value.objectId===e.comment.user_id)),d=c((()=>e.comment.objectId===e.reply?.objectId));return{config:t,locale:o,isReplyingCurrent:d,link:i,like:a,time:r,isAdmin:s,isOwner:u,commentStatus:Bt}}}),Gt=["id"],qt={class:"wl-user","aria-hidden":"true"},Jt=["src"],Kt={class:"wl-card"},Yt={class:"wl-head"},Zt=["href"],Xt={key:1,class:"wl-nick"},Qt=["textContent"],en=["textContent"],tn=["textContent"],nn=["textContent"],ln=["textContent"],on={class:"wl-comment-actions"},an=["title"],rn=["textContent"],sn=["title"],cn={class:"wl-meta","aria-hidden":"true"},un=["textContent"],mn=["textContent"],dn=["textContent"],vn=["innerHTML"],pn={key:0,class:"wl-admin-actions"},fn={class:"wl-comment-status"},gn=["disabled","onClick","textContent"],hn={key:1,class:"wl-reply-wrapper"},wn={key:2,class:"wl-quote"};const yn=u({name:"WalineRoot",components:{CommentBox:Dt,CommentCard:ot(Wt,[["render",function(e,t,n,l,o,i){const a=p("VerifiedIcon"),r=p("DeleteIcon"),s=p("LikeIcon"),c=p("ReplyIcon"),u=p("CommentBox"),m=p("CommentCard",!0);return f(),g("div",{class:"wl-item",id:e.comment.objectId},[h("div",qt,[e.comment.avatar?(f(),g("img",{key:0,src:e.comment.avatar},null,8,Jt)):b("v-if",!0),e.comment.type?(f(),E(a,{key:1})):b("v-if",!0)]),h("div",Kt,[h("div",Yt,[e.link?(f(),g("a",{key:0,class:"wl-nick",href:e.link,target:"_blank",rel:"nofollow noreferrer"},y(e.comment.nick),9,Zt)):(f(),g("span",Xt,y(e.comment.nick),1)),"administrator"===e.comment.type?(f(),g("span",{key:2,class:"wl-badge",textContent:y(e.locale.admin)},null,8,Qt)):b("v-if",!0),e.comment.label?(f(),g("span",{key:3,class:"wl-badge",textContent:y(e.comment.label)},null,8,en)):b("v-if",!0),e.comment.sticky?(f(),g("span",{key:4,class:"wl-badge",textContent:y(e.locale.sticky)},null,8,tn)):b("v-if",!0),e.comment.level&&e.comment.level>=0?(f(),g("span",{key:5,class:k(`wl-badge level${e.comment.level}`),textContent:y(e.locale[`level${e.comment.level}`]||`Level ${e.comment.level}`)},null,10,nn)):b("v-if",!0),h("span",{class:"wl-time",textContent:y(e.time)},null,8,ln),h("div",on,[e.isAdmin||e.isOwner?(f(),g("button",{key:0,class:"wl-delete",onClick:t[0]||(t[0]=t=>e.$emit("delete",e.comment))},[w(r)])):b("v-if",!0),h("button",{class:"wl-like",onClick:t[1]||(t[1]=t=>e.$emit("like",e.comment)),title:e.like?e.locale.cancelLike:e.locale.like},[w(s,{active:e.like},null,8,["active"]),"like"in e.comment?(f(),g("span",{key:0,textContent:y(e.comment.like)},null,8,rn)):b("v-if",!0)],8,an),h("button",{class:k(["wl-reply",{active:e.isReplyingCurrent}]),title:e.isReplyingCurrent?e.locale.cancelReply:e.locale.reply,onClick:t[2]||(t[2]=t=>e.$emit("reply",e.isReplyingCurrent?null:e.comment))},[w(c)],10,sn)])]),h("div",cn,[e.comment.addr?(f(),g("span",{key:0,textContent:y(e.comment.addr)},null,8,un)):b("v-if",!0),e.comment.browser?(f(),g("span",{key:1,textContent:y(e.comment.browser)},null,8,mn)):b("v-if",!0),e.comment.os?(f(),g("span",{key:2,textContent:y(e.comment.os)},null,8,dn)):b("v-if",!0)]),h("div",{class:"wl-content",innerHTML:e.comment.comment},null,8,vn),e.isAdmin?(f(),g("div",pn,[h("span",fn,[(f(!0),g(C,null,$(e.commentStatus,(t=>(f(),g("button",{key:t,class:k(`wl-btn wl-${t}`),disabled:e.comment.status===t,onClick:n=>e.$emit("status",{status:t,comment:e.comment}),textContent:y(t)},null,10,gn)))),128))]),e.isAdmin&&!e.comment.rid?(f(),g("button",{key:0,class:"wl-btn wl-sticky",onClick:t[3]||(t[3]=t=>e.$emit("sticky",e.comment))},y(e.comment.sticky?"unsticky":"sticky"),1)):b("v-if",!0)])):b("v-if",!0),e.isReplyingCurrent?(f(),g("div",hn,[w(u,{replyId:e.comment.objectId,replyUser:e.comment.nick,rootId:e.rootId,onSubmit:t[4]||(t[4]=t=>e.$emit("submit",t)),onCancelReply:t[5]||(t[5]=t=>e.$emit("reply",null))},null,8,["replyId","replyUser","rootId"])])):b("v-if",!0),e.comment.children?(f(),g("div",wn,[(f(!0),g(C,null,$(e.comment.children,(n=>(f(),E(m,{key:n.objectId,comment:n,reply:e.reply,rootId:e.rootId,onReply:t[6]||(t[6]=t=>e.$emit("reply",t)),onSubmit:t[7]||(t[7]=t=>e.$emit("submit",t)),onLike:t[8]||(t[8]=t=>e.$emit("like",t)),onDelete:t[9]||(t[9]=t=>e.$emit("delete",t)),onStatus:t[10]||(t[10]=t=>e.$emit("status",t)),onSticky:t[11]||(t[11]=t=>e.$emit("sticky",t))},null,8,["comment","reply","rootId"])))),128))])):b("v-if",!0)])],8,Gt)}],["__file","CommentCard.vue"]]),LoadingIcon:pe},props:["serverURL","path","meta","requiredMeta","dark","lang","locale","pageSize","wordLimit","emoji","login","highlighter","texRenderer","imageUploader","copyright"],setup(e){const t=c((()=>(({serverURL:e,path:t=location.pathname,lang:n="zh-CN",locale:l,emoji:o=["//unpkg.com/@waline/emojis@1.0.1/weibo"],meta:i=["nick","mail","link"],requiredMeta:a=[],dark:r=!1,pageSize:s=10,wordLimit:c,imageUploader:u,highlighter:m,texRenderer:d,copyright:v=!0,login:p="enable",...f})=>({serverURL:Oe(e),path:Me(t),locale:{...ze[n]||ze["zh-CN"],..."object"==typeof l?l:{}},wordLimit:Pe(c),meta:ge(i),requiredMeta:ge(a),imageUploader:He(u,he),highlighter:He(m,Ce),texRenderer:He(d,we),lang:n,dark:r,emoji:o,pageSize:s,login:p,copyright:v,...f}))(e))),o=tt(),i=lt(),r=l("loading"),s=l(0),u=l(1),m=l(0),v=l([]),p=l(null),f=c((()=>{return"string"==typeof(e=t.value.dark)?"auto"===e?`@media(prefers-color-scheme:dark){body${Te}}`:`${e}${Te}`:!0===e?`:root${Te}`:"";var e}));let g;!function(e,t={}){const o=l(!1),{document:i=X,immediate:r=!0,manual:s=!1,id:c="vueuse_styletag_"+ ++ve}=t,u=l(e);let m=()=>{};const d=()=>{if(!i)return;const e=i.getElementById(c)||i.createElement("style");e.type="text/css",e.id=c,t.media&&(e.media=t.media),i.head.appendChild(e),o.value||(m=n(u,(t=>{e.innerText=t}),{immediate:!0}),o.value=!0)},v=()=>{i&&o.value&&(m(),i.head.removeChild(i.getElementById(c)),o.value=!1)};r&&!s&&d(),s||O(v),a(o)}(f);const h=e=>{const{serverURL:n,path:l,pageSize:i}=t.value,a=new AbortController;r.value="loading",g?.(),Be({serverURL:n,lang:t.value.lang,path:l,pageSize:i,page:e,signal:a.signal,token:o.value?.token}).then((t=>{r.value="success",s.value=t.count,v.value.push(...t.data),u.value=e,m.value=t.totalPages})).catch((e=>{"AbortError"!==e.name&&(console.error(e.message),r.value="error")})),g=a.abort.bind(a)},w=()=>{s.value=0,v.value=[],h(1)};return M("config",t),n((()=>e.path),w),d((()=>w())),{config:t,darkmodeStyle:f,i18n:c((()=>t.value.locale)),status:r,count:s,page:u,totalPages:m,data:v,reply:p,loadMore:()=>h(u.value+1),refresh:w,onReply:e=>{p.value=e},onSubmit:e=>{if(e.rid){const t=v.value.find((({objectId:t})=>t===e.rid));if(!t)return;Array.isArray(t.children)||(t.children=[]),t.children.push(e)}else v.value.unshift(e)},onStatusChange:async({comment:e,status:n})=>{if(e.status===n)return;const{serverURL:l,lang:i}=t.value;await We({serverURL:l,lang:i,token:o.value?.token,objectId:e.objectId,status:n}),e.status=n},onDelete:async({objectId:e})=>{if(!confirm("Are you sure you want to delete this comment?"))return;const{serverURL:n,lang:l}=t.value;await(({serverURL:e,lang:t,token:n,objectId:l})=>fetch(`${e}/comment/${l}?lang=${t}`,{method:"DELETE",headers:{Authorization:`Bearer ${n}`}}).then((e=>e.json())))({serverURL:n,lang:l,token:o.value?.token,objectId:e}),v.value.some(((t,n)=>t.objectId===e?(v.value=v.value.filter(((e,t)=>t!==n)),!0):t.children.some(((l,o)=>l.objectId===e&&(v.value[n].children=t.children.filter(((e,t)=>t!==o)),!0)))))},onSticky:async e=>{if(e.rid)return;const{serverURL:n,lang:l}=t.value;await We({serverURL:n,lang:l,token:o.value?.token,objectId:e.objectId,sticky:e.sticky?0:1}),e.sticky=!e.sticky},onLike:async e=>{const{serverURL:n,lang:l}=t.value,{objectId:o}=e,a=i.value.includes(o);await(({serverURL:e,lang:t,objectId:n,like:l})=>fetch(`${e}/comment/${n}?lang=${t}`,{method:"PUT",headers:De,body:JSON.stringify({like:l})}).then((e=>e.json())))({serverURL:n,lang:l,objectId:o,like:!a}),a?i.value=i.value.filter((e=>e!==o)):(i.value=[...i.value,o],i.value.length>50&&(i.value=i.value.slice(-50))),e.like=(e.like||0)+(a?-1:1)},version:"2.5.0"}}}),bn={"data-waline":""},kn={class:"wl-count"},Cn=["textContent"],$n={class:"wl-cards"},In={key:1,class:"wl-operation"},Sn=["textContent"],jn={key:0,class:"wl-loading"},Ln=["textContent"],xn={class:"wl-operation"},En=["textContent"],Rn={key:3,class:"wl-power"},zn=x(" Powered by "),Mn=h("a",{href:"https://github.com/walinejs/waline",target:"_blank",rel:"noreferrer"}," Waline ",-1);var An=ot(yn,[["render",function(e,t,n,l,o,i){const a=p("CommentBox"),r=p("CommentCard"),s=p("LoadingIcon");return f(),g("div",bn,[e.reply?b("v-if",!0):(f(),E(a,{key:0,onSubmit:e.onSubmit},null,8,["onSubmit"])),h("div",kn,[e.count?(f(),g("span",{key:0,class:"wl-num",textContent:y(e.count)},null,8,Cn)):b("v-if",!0),x(" "+y(e.i18n.comment),1)]),h("div",$n,[(f(!0),g(C,null,$(e.data,(t=>(f(),E(r,{key:t.objectId,"root-id":t.objectId,comment:t,reply:e.reply,onReply:e.onReply,onSubmit:e.onSubmit,onStatus:e.onStatusChange,onDelete:e.onDelete,onSticky:e.onSticky,onLike:e.onLike},null,8,["root-id","comment","reply","onReply","onSubmit","onStatus","onDelete","onSticky","onLike"])))),128))]),"error"===e.status?(f(),g("div",In,[h("button",{type:"button",class:"wl-btn",onClick:t[0]||(t[0]=(...t)=>e.refresh&&e.refresh(...t)),textContent:y(e.i18n.refresh)},null,8,Sn)])):(f(),g(C,{key:2},["loading"===e.status?(f(),g("div",jn,[w(s,{size:30})])):e.data.length?e.page<e.totalPages?(f(),g(C,{key:2},[b(" Load more button "),h("div",xn,[h("button",{type:"button",class:"wl-btn",onClick:t[1]||(t[1]=(...t)=>e.loadMore&&e.loadMore(...t)),textContent:y(e.i18n.more)},null,8,En)])],2112)):b("v-if",!0):(f(),g("div",{key:1,class:"wl-empty",textContent:y(e.i18n.sofa)},null,8,Ln))],2112)),b(" Copyright Information "),e.config.copyright?(f(),g("div",Rn,[zn,Mn,x(" v"+y(e.version),1)])):b("v-if",!0)])}],["__file","Waline.vue"]]);const Un="2.5.0";export{An as Waline,Un as version};
//# sourceMappingURL=component.esm.js.map

@@ -1,2 +0,2 @@

"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("vue"),t=require("autosize"),n=require("marked");function o(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var l=o(t);function r(t){return!!e.getCurrentScope()&&(e.onScopeDispose(t),!0)}const a="undefined"!=typeof window,i=()=>{};const c=e=>e();var s=Object.getOwnPropertySymbols,m=Object.prototype.hasOwnProperty,u=Object.prototype.propertyIsEnumerable;function d(t,n,o={}){const l=o,{eventFilter:r=c}=l,a=((e,t)=>{var n={};for(var o in e)m.call(e,o)&&t.indexOf(o)<0&&(n[o]=e[o]);if(null!=e&&s)for(var o of s(e))t.indexOf(o)<0&&u.call(e,o)&&(n[o]=e[o]);return n})(l,["eventFilter"]);return e.watch(t,(i=r,d=n,function(...e){i((()=>d.apply(this,e)),{fn:d,thisArg:this,args:e})}),a);var i,d}var p=Object.defineProperty,v=Object.defineProperties,g=Object.getOwnPropertyDescriptors,f=Object.getOwnPropertySymbols,h=Object.prototype.hasOwnProperty,k=Object.prototype.propertyIsEnumerable,y=(e,t,n)=>t in e?p(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;function w(t,n,o={}){const l=o,{eventFilter:r}=l,a=((e,t)=>{var n={};for(var o in e)h.call(e,o)&&t.indexOf(o)<0&&(n[o]=e[o]);if(null!=e&&f)for(var o of f(e))t.indexOf(o)<0&&k.call(e,o)&&(n[o]=e[o]);return n})(l,["eventFilter"]),{eventFilter:i,pause:s,resume:m,isActive:u}=function(t=c){const n=e.ref(!0);return{isActive:n,pause:function(){n.value=!1},resume:function(){n.value=!0},eventFilter:(...e)=>{n.value&&t(...e)}}}(r),p=d(t,n,(w=((e,t)=>{for(var n in t||(t={}))h.call(t,n)&&y(e,n,t[n]);if(f)for(var n of f(t))k.call(t,n)&&y(e,n,t[n]);return e})({},a),v(w,g({eventFilter:i}))));var w;return{stop:p,pause:s,resume:m,isActive:u}}const b=a?window:void 0,C=a?window.document:void 0;function E(...t){let n,o,l,a;if("string"==typeof t[0]?([o,l,a]=t,n=b):[n,o,l,a]=t,!n)return i;let c=i;const s=e.watch((()=>function(t){var n;const o=e.unref(t);return null!=(n=null==o?void 0:o.$el)?n:o}(n)),(e=>{c(),e&&(e.addEventListener(o,l,a),c=()=>{e.removeEventListener(o,l,a),c=i})}),{immediate:!0,flush:"post"}),m=()=>{s(),c()};return r(m),m}a&&window.navigator,a&&window.location;const B="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},N="__vueuse_ssr_handlers__";B[N]=B[N]||{};const $=B[N];const S={boolean:{read:e=>"true"===e,write:e=>String(e)},object:{read:e=>JSON.parse(e),write:e=>JSON.stringify(e)},number:{read:e=>Number.parseFloat(e),write:e=>String(e)},any:{read:e=>e,write:e=>String(e)},string:{read:e=>e,write:e=>String(e)},map:{read:e=>new Map(JSON.parse(e)),write:e=>JSON.stringify(Array.from(e.entries()))},set:{read:e=>new Set(JSON.parse(e)),write:e=>JSON.stringify(Array.from(e))},date:{read:e=>new Date(e),write:e=>e.toISOString()}};function I(t,n,o,l={}){var r;const{flush:a="pre",deep:i=!0,listenToStorageChanges:c=!0,writeDefaults:s=!0,shallow:m,window:u=b,eventFilter:d,onError:p=(e=>{console.error(e)})}=l,v=(m?e.shallowRef:e.ref)(n);if(!o)try{o=function(e,t){return $[e]||t}("getDefaultStorage",(()=>{var e;return null==(e=b)?void 0:e.localStorage}))()}catch(e){p(e)}if(!o)return v;const g=e.unref(n),f=function(e){return null==e?"any":e instanceof Set?"set":e instanceof Map?"map":e instanceof Date?"date":"boolean"==typeof e?"boolean":"string"==typeof e?"string":"object"==typeof e||Array.isArray(e)?"object":Number.isNaN(e)?"any":"number"}(g),h=null!=(r=l.serializer)?r:S[f],{pause:k,resume:y}=w(v,(()=>function(e){try{null==e?o.removeItem(t):o.setItem(t,h.write(e))}catch(e){p(e)}}(v.value)),{flush:a,deep:i,eventFilter:d});return u&&c&&E(u,"storage",C),C(),v;function C(e){e&&e.key!==t||(v.value=function(e){if(!e||e.key===t){k();try{const n=e?e.newValue:o.getItem(t);return null==n?(s&&null!==g&&o.setItem(t,h.write(g)),g):"string"!=typeof n?n:h.read(n)}catch(e){p(e)}finally{y()}}}(e))}}var V,L,j=Object.defineProperty,x=Object.getOwnPropertySymbols,R=Object.prototype.hasOwnProperty,z=Object.prototype.propertyIsEnumerable,D=(e,t,n)=>t in e?j(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;function A(t={}){const{controls:n=!1,interval:o="requestAnimationFrame"}=t,l=e.ref(new Date),i=()=>l.value=new Date,c="requestAnimationFrame"===o?function(t,n={}){const{immediate:o=!0,window:l=b}=n,a=e.ref(!1);let i=null;function c(){a.value&&l&&(t(),i=l.requestAnimationFrame(c))}function s(){!a.value&&l&&(a.value=!0,c())}function m(){a.value=!1,null!=i&&l&&(l.cancelAnimationFrame(i),i=null)}return o&&s(),r(m),{isActive:a,pause:m,resume:s}}(i,{immediate:!0}):function(t,n=1e3,o={}){const{immediate:l=!0,immediateCallback:i=!1}=o;let c=null;const s=e.ref(!1);function m(){c&&(clearInterval(c),c=null)}function u(){s.value=!1,m()}function d(){n<=0||(s.value=!0,i&&t(),m(),c=setInterval(t,e.unref(n)))}l&&a&&d(),e.isRef(n)&&r(e.watch(n,(()=>{l&&a&&d()})));return r(u),{isActive:s,pause:u,resume:d}}(i,o,{immediate:!0});return n?((e,t)=>{for(var n in t||(t={}))R.call(t,n)&&D(e,n,t[n]);if(x)for(var n of x(t))z.call(t,n)&&D(e,n,t[n]);return e})({now:l},c):l}a&&(null==window?void 0:window.navigator)&&(null==(V=null==window?void 0:window.navigator)?void 0:V.platform)&&/iP(ad|hone|od)/.test(null==(L=null==window?void 0:window.navigator)?void 0:L.platform);let M=0;const U=({size:t})=>e.h("svg",{width:t,height:t,viewBox:"0 0 100 100",preserveAspectRatio:"xMidYMid"},e.h("circle",{cx:50,cy:50,fill:"none",stroke:"currentColor",strokeWidth:"4",r:"40","stroke-dasharray":"85 30"},e.h("animateTransform",{attributeName:"transform",type:"rotate",repeatCount:"indefinite",dur:"1s",values:"0 50 50;360 50 50",keyTimes:"0;1"}))),O=["nick","mail","link"],P=e=>e.filter((e=>O.includes(e))),T=e=>new Promise(((t,n)=>{const o=new FileReader;o.readAsDataURL(e),o.onload=()=>t(o.result?.toString()||""),o.onerror=n})),_=e=>!0===e?'<p class="wl-tex">Tex is not available in preview</p>':'<span class="wl-tex">Tex is not available in preview</span>',F=new RegExp(`(${/[\u4E00-\u9FFF\u3400-\u4dbf\uf900-\ufaff\u3040-\u309f\uac00-\ud7af\u0400-\u04FF]+|\w+/.source}|${/</.source})|((?:${/(?:^|\s)\/\/(.+?)$/gm.source})|(?:${/\/\*([\S\s]*?)\*\//gm.source}))`,"gmi"),H=["23AC69","91C132","F19726","E8552D","1AAB8E","E1147F","2980C1","1BA1E6","9FA0A0","F19726","E30B20","E30B20","A3338B"],W={},q=e=>{let t=0;return e.replace(F,((e,n,o)=>{if(o)return`<span style="color: slategray">${o}</span>`;if("<"===n)return"&lt;";let l;W[n]?l=W[n]:(l=H[t],W[n]=l);const r=`<span style="color: #${l}">${n}</span>`;return t=++t%H.length,r}))},J=["nick","nickError","mail","mailError","link","optional","placeholder","sofa","submit","like","cancelLike","reply","cancelReply","comment","refresh","more","preview","emoji","uploadImage","seconds","minutes","hours","days","now","uploading","login","logout","admin","sticky","word","wordHint","anonymous","level0","level1","level2","level3","level4","level5"],K=e=>Object.fromEntries(e.map(((e,t)=>[J[t],e])));var Y=K(["NickName","NickName cannot be less than 3 bytes.","E-Mail","Please confirm your email address.","Website","Optional","Comment here...","No comment yet.","Submit","Like","Cancel like","Reply","Cancel reply","Comments","Refresh","Load More...","Preview","Emoji","Upload Image","seconds ago","minutes ago","hours ago","days ago","just now","Uploading","Login","logout","Admin","Sticky","Words","Please input comments between $0 and $1 words!\n Current word number: $2","Anonymous","Dwarves","Hobbits","Ents","Wizards","Elves","Maiar"]),G=K(["ニックネーム","3バイト以上のニックネームをご入力ください.","メールアドレス","メールアドレスをご確認ください.","サイト","オプション","ここにコメント","コメントしましょう~","提出する","Like","Cancel like","返信する","キャンセル","コメント","更新","さらに読み込む","プレビュー","絵文字","画像をアップロード","秒前","分前","時間前","日前","たっだ今","アップロード","ログインする","ログアウト","管理者","トップに置く","ワード","コメントは $0 から $1 ワードの間でなければなりません!\n 現在の単語番号: $2","匿名"]),X=K(["昵称","昵称不能少于3个字符","邮箱","请填写正确的邮件地址","网址","可选","欢迎评论","来发评论吧~","提交","喜欢","取消喜欢","回复","取消回复","评论","刷新","加载更多...","预览","表情","上传图片","秒前","分钟前","小时前","天前","刚刚","正在上传","登录","退出","博主","置顶","字","评论字数应在 $0 到 $1 字之间!\n当前字数:$2","匿名","潜水","冒泡","吐槽","活跃","话痨","传说"]),Q=K(["暱稱","郵箱","網址","可選","暱稱不能少於3個字元","請填寫正確的郵件地址","歡迎評論","來發評論吧~","提交","喜歡","取消喜歡","回覆","取消回覆","評論","刷新","載入更多...","預覽","表情","上傳圖片","秒前","分鐘前","小時前","天前","剛剛","正在上傳","登錄","退出","博主","置頂","字","評論字數應在 $0 到 $1 字之間!\n當前字數:$2","匿名","潛水","冒泡","吐槽","活躍","話癆","傳說"]),Z=K(["Apelido","Apelido não pode ser menor que 3 bytes.","E-Mail","Por favor, confirme seu endereço de e-mail.","Website","Opcional","Comente aqui...","Nenhum comentário, ainda.","Enviar","Like","Cancel like","Responder","Cancelar resposta","Comentários","Refrescar","Carregar Mais...","Visualizar","Emoji","Enviar Imagem","segundos atrás","minutos atrás","horas atrás","dias atrás","agora mesmo","Enviando","Entrar","Sair","Admin","Sticky","Palavras","Favor enviar comentário com $0 a $1 palavras!\n Número de palavras atuais: $2","Anônimo"]),ee=K(["Псевдоним","Никнейм не может быть меньше 3 байт.","Эл. адрес","Пожалуйста, подтвердите адрес вашей электронной почты.","Веб-сайт","Необязательный","Комментарий здесь...","Пока нет комментариев.","Отправить","Like","Cancel like","Отвечать","Отменить ответ","Комментарии","Обновить","Загрузи больше...","Превью","эмодзи","Загрузить изображение","секунд назад","несколько минут назад","несколько часов назад","дней назад","прямо сейчас","Загрузка","Авторизоваться","Выход из системы","Админ","Липкий","Слова","Пожалуйста, введите комментарии от $0 до $1 слов!\nНомер текущего слова: $2","Анонимный"]);const te={zh:X,"zh-cn":X,"zh-CN":X,"zh-tw":Q,"zh-TW":Q,en:Y,"en-US":Y,"en-us":Y,jp:G,"jp-jp":G,"jp-JP":G,"pt-br":Z,"pt-BR":Z,ru:ee,"ru-ru":ee,"ru-RU":ee},ne=e=>{try{e=decodeURI(e)}catch(e){}return e},oe=(e="")=>e.replace(/\/$/u,""),le=e=>/^(https?:)?\/\//.test(e),re=e=>{const t=oe(e);return le(t)?t:`https://${t}`},ae=e=>Array.isArray(e)?e:!!e&&[0,e],ie=(e,t)=>"function"==typeof e?e:!1!==e&&t,ce="{--waline-white:#000;--waline-light-grey:#666;--waline-dark-grey:#999;--waline-color:#888;--waline-bgcolor:#1e1e1e;--waline-bgcolor-light:#272727;--waline-bgcolor-hover: #444;--waline-border-color:#333;--waline-disable-bgcolor:#444;--waline-disable-color:#272727;--waline-bq-color:#272727;--waline-info-bgcolor:#272727;--waline-info-color:#666}",se=(e,t)=>{let n=e.toString();for(;n.length<t;)n="0"+n;return n},me=(e,t,n)=>{if(!e)return"";const o="string"==typeof e?new Date(-1!==e.indexOf(" ")?e.replace(/-/g,"/"):e):e,l=t.getTime()-o.getTime(),r=Math.floor(l/864e5);if(0===r){const e=l%864e5,t=Math.floor(e/36e5);if(0===t){const t=e%36e5,o=Math.floor(t/6e4);if(0===o){const e=t%6e4;return`${Math.round(e/1e3)} ${n.seconds}`}return`${o} ${n.minutes}`}return`${t} ${n.hours}`}return r<0?n.now:r<8?`${r} ${n.days}`:(e=>{const t=se(e.getDate(),2),n=se(e.getMonth()+1,2);return`${se(e.getFullYear(),2)}-${n}-${t}`})(o)},ue=e=>{const t=I("WALINE_EMOJI",{}),n=Boolean(/@[0-9]+\.[0-9]+\.[0-9]+/.test(e));if(n){const n=t.value[e];if(n)return Promise.resolve(n)}return fetch(`${e}/info.json`).then((e=>e.json())).then((o=>{const l={folder:e,...o};return n&&(t.value[e]=l),l}))},de=(e,t="",n="",o="")=>`${t?`${t}/`:""}${n}${e}${o?`.${o}`:""}`,pe={"Content-Type":"application/json"},ve=({serverURL:e,lang:t,path:n,page:o,pageSize:l,signal:r,token:a})=>{const i={};return a&&(i.Authorization=`Bearer ${a}`),fetch(`${e}/comment?path=${encodeURIComponent(n)}&pageSize=${l}&page=${o}&lang=${t}`,{signal:r,headers:i}).then((e=>e.json())).then((e=>((e,t="")=>{if("object"==typeof e&&e.errno)throw new TypeError(`Fetch ${t} failed with ${e.errno}: ${e.errmsg}`);return e})(e,"comment list")))},ge=({serverURL:e,lang:t,token:n,objectId:o,...l})=>fetch(`${e}/comment/${o}?lang=${t}`,{method:"PUT",headers:{"Content-Type":"application/json",Authorization:`Bearer ${n}`},body:JSON.stringify(l)}).then((e=>e.json())),fe=e=>e.type.includes("image"),he=e=>{const t=Array.from(e).find(fe);return t?t.getAsFile():null},ke=/\$.*?\$/,ye=/^\$(.*?)\$/,we=/^(?:\s{0,3})\$\$((?:[^\n]|\n[^\n])+?)\n{0,1}\$\$/,be=(e="",t={})=>e.replace(/:(.+?):/g,((e,n)=>t[n]?`<img class="wl-emoji" src="${t[n]}" alt="${n}">`:e)),Ce=(e,{emojiMap:t,highlighter:o,texRenderer:l})=>{if(n.marked.setOptions({highlight:o||void 0,breaks:!0,smartLists:!0,smartypants:!0}),l){const e=(e=>[{name:"blockMath",level:"block",tokenizer(t){const n=we.exec(t);if(null!==n)return{type:"html",raw:n[0],text:e(!0,n[1])}}},{name:"inlineMath",level:"inline",start(e){const t=e.search(ke);return-1!==t?t:e.length},tokenizer(t){const n=ye.exec(t);if(null!==n)return{type:"html",raw:n[0],text:e(!1,n[1])}}}])(l);n.marked.use({extensions:e})}return n.marked.parse(be(e,t))};let Ee=null;const Be=()=>Ee||(Ee=I("USER_KEY",{}));let Ne=null;const $e=()=>Ne||(Ne=I("WALIKE_LIKE",[]));var Se=(e,t)=>{const n=e.__vccOpts||e;for(const[e,o]of t)n[e]=o;return n};const Ie=e.defineComponent({name:"CommentBox",components:{CloseIcon:({size:t})=>e.h("svg",{class:"wl-close-icon",viewBox:"0 0 1024 1024",width:t,height:t},[e.h("path",{d:"M697.173 85.333h-369.92c-144.64 0-241.92 101.547-241.92 252.587v348.587c0 150.613 97.28 252.16 241.92 252.16h369.92c144.64 0 241.494-101.547 241.494-252.16V337.92c0-151.04-96.854-252.587-241.494-252.587z",fill:"currentColor"}),e.h("path",{d:"m640.683 587.52-75.947-75.861 75.904-75.862a37.29 37.29 0 0 0 0-52.778 37.205 37.205 0 0 0-52.779 0l-75.946 75.818-75.862-75.946a37.419 37.419 0 0 0-52.821 0 37.419 37.419 0 0 0 0 52.821l75.947 75.947-75.776 75.733a37.29 37.29 0 1 0 52.778 52.821l75.776-75.776 75.947 75.947a37.376 37.376 0 0 0 52.779-52.821z",fill:"#888"})]),EmojiIcon:()=>e.h("svg",{viewBox:"0 0 1024 1024",width:"24",height:"24"},e.h("path",{d:"M563.2 463.3 677 540c1.7 1.2 3.7 1.8 5.8 1.8.7 0 1.4-.1 2-.2 2.7-.5 5.1-2.1 6.6-4.4l25.3-37.8c1.5-2.3 2.1-5.1 1.6-7.8s-2.1-5.1-4.4-6.6l-73.6-49.1 73.6-49.1c2.3-1.5 3.9-3.9 4.4-6.6.5-2.7 0-5.5-1.6-7.8l-25.3-37.8a10.1 10.1 0 0 0-6.6-4.4c-.7-.1-1.3-.2-2-.2-2.1 0-4.1.6-5.8 1.8l-113.8 76.6c-9.2 6.2-14.7 16.4-14.7 27.5.1 11 5.5 21.3 14.7 27.4zM387 348.8h-45.5c-5.7 0-10.4 4.7-10.4 10.4v153.3c0 5.7 4.7 10.4 10.4 10.4H387c5.7 0 10.4-4.7 10.4-10.4V359.2c0-5.7-4.7-10.4-10.4-10.4zm333.8 241.3-41-20a10.3 10.3 0 0 0-8.1-.5c-2.6.9-4.8 2.9-5.9 5.4-30.1 64.9-93.1 109.1-164.4 115.2-5.7.5-9.9 5.5-9.5 11.2l3.9 45.5c.5 5.3 5 9.5 10.3 9.5h.9c94.8-8 178.5-66.5 218.6-152.7 2.4-5 .3-11.2-4.8-13.6zm186-186.1c-11.9-42-30.5-81.4-55.2-117.1-24.1-34.9-53.5-65.6-87.5-91.2-33.9-25.6-71.5-45.5-111.6-59.2-41.2-14-84.1-21.1-127.8-21.1h-1.2c-75.4 0-148.8 21.4-212.5 61.7-63.7 40.3-114.3 97.6-146.5 165.8-32.2 68.1-44.3 143.6-35.1 218.4 9.3 74.8 39.4 145 87.3 203.3.1.2.3.3.4.5l36.2 38.4c1.1 1.2 2.5 2.1 3.9 2.6 73.3 66.7 168.2 103.5 267.5 103.5 73.3 0 145.2-20.3 207.7-58.7 37.3-22.9 70.3-51.5 98.1-85 27.1-32.7 48.7-69.5 64.2-109.1 15.5-39.7 24.4-81.3 26.6-123.8 2.4-43.6-2.5-87-14.5-129zm-60.5 181.1c-8.3 37-22.8 72-43 104-19.7 31.1-44.3 58.6-73.1 81.7-28.8 23.1-61 41-95.7 53.4-35.6 12.7-72.9 19.1-110.9 19.1-82.6 0-161.7-30.6-222.8-86.2l-34.1-35.8c-23.9-29.3-42.4-62.2-55.1-97.7-12.4-34.7-18.8-71-19.2-107.9-.4-36.9 5.4-73.3 17.1-108.2 12-35.8 30-69.2 53.4-99.1 31.7-40.4 71.1-72 117.2-94.1 44.5-21.3 94-32.6 143.4-32.6 49.3 0 97 10.8 141.8 32 34.3 16.3 65.3 38.1 92 64.8 26.1 26 47.5 56 63.6 89.2 16.2 33.2 26.6 68.5 31 105.1 4.6 37.5 2.7 75.3-5.6 112.3z",fill:"currentColor"})),ImageIcon:()=>e.h("svg",{viewBox:"0 0 1024 1024",width:"24",height:"24"},[e.h("path",{d:"M784 112H240c-88 0-160 72-160 160v480c0 88 72 160 160 160h544c88 0 160-72 160-160V272c0-88-72-160-160-160zm96 640c0 52.8-43.2 96-96 96H240c-52.8 0-96-43.2-96-96V272c0-52.8 43.2-96 96-96h544c52.8 0 96 43.2 96 96v480z",fill:"currentColor"}),e.h("path",{d:"M352 480c52.8 0 96-43.2 96-96s-43.2-96-96-96-96 43.2-96 96 43.2 96 96 96zm0-128c17.6 0 32 14.4 32 32s-14.4 32-32 32-32-14.4-32-32 14.4-32 32-32zm462.4 379.2-3.2-3.2-177.6-177.6c-25.6-25.6-65.6-25.6-91.2 0l-80 80-36.8-36.8c-25.6-25.6-65.6-25.6-91.2 0L200 728c-4.8 6.4-8 14.4-8 24 0 17.6 14.4 32 32 32 9.6 0 16-3.2 22.4-9.6L380.8 640l134.4 134.4c6.4 6.4 14.4 9.6 24 9.6 17.6 0 32-14.4 32-32 0-9.6-4.8-17.6-9.6-24l-52.8-52.8 80-80L769.6 776c6.4 4.8 12.8 8 20.8 8 17.6 0 32-14.4 32-32 0-8-3.2-16-8-20.8z",fill:"currentColor"})]),MarkdownIcon:()=>e.h("svg",{width:"16",height:"16",ariaHidden:"true"},e.h("path",{d:"M14.85 3H1.15C.52 3 0 3.52 0 4.15v7.69C0 12.48.52 13 1.15 13h13.69c.64 0 1.15-.52 1.15-1.15v-7.7C16 3.52 15.48 3 14.85 3zM9 11H7V8L5.5 9.92 4 8v3H2V5h2l1.5 2L7 5h2v6zm2.99.5L9.5 8H11V5h2v3h1.5l-2.51 3.5z",fill:"currentColor"})),PreviewIcon:()=>e.h("svg",{viewBox:"0 0 1024 1024",width:"24",height:"24"},[e.h("path",{d:"M710.816 654.301c70.323-96.639 61.084-230.578-23.705-314.843-46.098-46.098-107.183-71.109-172.28-71.109-65.008 0-126.092 25.444-172.28 71.109-45.227 46.098-70.756 107.183-70.756 172.106 0 64.923 25.444 126.007 71.194 172.106 46.099 46.098 107.184 71.109 172.28 71.109 51.414 0 100.648-16.212 142.824-47.404l126.53 126.006c7.058 7.06 16.297 10.979 26.406 10.979 10.105 0 19.343-3.919 26.402-10.979 14.467-14.467 14.467-38.172 0-52.723L710.816 654.301zm-315.107-23.265c-65.88-65.88-65.88-172.54 0-238.42 32.069-32.07 74.245-49.149 119.471-49.149 45.227 0 87.407 17.603 119.472 49.149 65.88 65.879 65.88 172.539 0 238.42-63.612 63.178-175.242 63.178-238.943 0zm0 0",fill:"currentColor"}),e.h("path",{d:"M703.319 121.603H321.03c-109.8 0-199.469 89.146-199.469 199.38v382.034c0 109.796 89.236 199.38 199.469 199.38h207.397c20.653 0 37.384-16.645 37.384-37.299 0-20.649-16.731-37.296-37.384-37.296H321.03c-68.582 0-124.352-55.77-124.352-124.267V321.421c0-68.496 55.77-124.267 124.352-124.267h382.289c68.582 0 124.352 55.771 124.352 124.267V524.72c0 20.654 16.736 37.299 37.385 37.299 20.654 0 37.384-16.645 37.384-37.299V320.549c-.085-109.8-89.321-198.946-199.121-198.946zm0 0",fill:"currentColor"})]),LoadingIcon:U},props:{rootId:{type:String,default:""},replyId:{type:String,default:""},replyUser:{type:String,default:""}},emits:["submit","cancel-reply"],setup(t,{emit:n}){const o=e.inject("config"),r=I("WALINE_COMMENT_BOX_EDITOR",""),a=I("WALINE_USER_META",{nick:"",mail:"",link:""}),i=Be(),c=e.ref({}),s=e.ref(null),m=e.ref(null),u=e.ref(null),d=e.ref(null),p=e.ref({tabs:[],map:{}}),v=e.ref(0),g=e.ref(!1),f=e.ref(!1),h=e.ref(""),k=e.ref(0),y=e.ref(0),w=e.ref(!1),b=e.ref(""),C=e.ref(!1),E=e.computed((()=>o.value.locale)),B=e.computed((()=>Boolean(i.value?.token))),N=e.computed((()=>!1!==o.value.imageUploader)),$=e=>{const t=s.value,n=t.selectionStart,o=t.selectionEnd||0,l=t.scrollTop;r.value=t.value.substring(0,n)+e+t.value.substring(o,t.value.length),t.focus(),t.selectionStart=n+e.length,t.selectionEnd=n+e.length,t.scrollTop=l},S=e=>{const t=`![${o.value.locale.uploading} ${e.name}]()`;return $(t),Promise.resolve().then((()=>o.value.imageUploader(e))).then((n=>{r.value=r.value.replace(t,`\r\n![${e.name}](${n})`)}))},V=()=>{const{serverURL:e,lang:l,login:m,wordLimit:u,requiredMeta:d}=o.value,v={comment:b.value,nick:a.value.nick,mail:a.value.mail,link:a.value.link,ua:navigator.userAgent,url:o.value.path};if(i.value?.token)v.nick=i.value.display_name,v.mail=i.value.email,v.link=i.value.url;else{if("force"===m)return;if(d.indexOf("nick")>-1&&!v.nick)return c.value.nick?.focus(),alert(E.value.nickError);if(d.indexOf("mail")>-1&&!v.mail||v.mail&&!/^\w(?:[\w._-]*\w)?@(?:\w(?:[\w-]*\w)?\.)*\w+$/.exec(v.mail))return c.value.mail?.focus(),alert(E.value.mailError);if(!v.comment)return void s.value?.focus();v.nick||(v.nick=E.value.anonymous)}if(!w.value)return alert(E.value.wordHint.replace("$0",u[0].toString()).replace("$1",u[1].toString()).replace("$2",k.value.toString()));v.comment=be(v.comment,p.value.map),t.replyId&&t.rootId&&(v.pid=t.replyId,v.rid=t.rootId,v.at=t.replyUser),C.value=!0,(({serverURL:e,lang:t,token:n,comment:o})=>{const l={"Content-Type":"application/json"};return n&&(l.Authorization=`Bearer ${n}`),fetch(`${e}/comment?lang=${t}`,{method:"POST",headers:l,body:JSON.stringify(o)}).then((e=>e.json()))})({serverURL:e,lang:l,token:i.value?.token,comment:v}).then((e=>{if(C.value=!1,e.errmsg)return alert(e.errmsg);n("submit",e.data),r.value="",h.value="",t.replyId&&n("cancel-reply")})).catch((e=>{C.value=!1,alert(e.message)}))},L=e=>{u.value.contains(e.target)||d.value.contains(e.target)||(g.value=!1)};return e.watch([o,k],(([e,t])=>{const{wordLimit:n}=e;n?t<n[0]&&0!==n[0]?(y.value=n[0],w.value=!1):t>n[1]?(y.value=n[1],w.value=!1):(y.value=n[1],w.value=!0):(y.value=0,w.value=!0)}),{immediate:!0}),e.onMounted((()=>{document.body.addEventListener("click",L),e.watch((()=>r.value),(e=>{const{highlighter:t,texRenderer:n}=o.value;b.value=e,h.value=Ce(e,{emojiMap:p.value.map,highlighter:t,texRenderer:n}),k.value=(e=>(e=>e.match(/[\w\d\s\u00C0-\u024F]+/giu)||[])(e).reduce(((e,t)=>e+(""===t.trim()?0:t.trim().split(/\s+/u).length)),0)+(e=>e.match(/[\u4E00-\u9FA5]/gu)||[])(e).length)(e),e?l.default(s.value):l.default.destroy(s.value)}),{immediate:!0}),e.watch((()=>o.value.emoji),(e=>{return(t=Array.isArray(e)?e:[],Promise.all(t.map((e=>"string"==typeof e?ue(oe(e)):Promise.resolve(e)))).then((e=>{const t={tabs:[],map:{}};return e.forEach((e=>{const{name:n,folder:o,icon:l,prefix:r,type:a,items:i}=e;t.tabs.push({name:n,icon:de(l,o,r,a),items:i.map((e=>{const n=`${r||""}${e}`;return t.map[n]=de(e,o,r,a),n}))})})),t}))).then((e=>{p.value=e}));var t}),{immediate:!0})})),e.onUnmounted((()=>{document.body.removeEventListener("click",L)})),{config:o,locale:E,insert:$,onChange:()=>{const e=m.value;e.files&&N.value&&S(e.files[0]).then((()=>{e.value=""}))},onDrop:e=>{if(e.dataTransfer?.items){const t=he(e.dataTransfer.items);t&&N.value&&(S(t),e.preventDefault())}},onKeyDown:e=>{const t=e.key;(e.ctrlKey||e.metaKey)&&"Enter"===t&&V()},onPaste:e=>{if(e.clipboardData){const t=he(e.clipboardData.items);t&&N.value&&S(t)}},onLogin:e=>{e.preventDefault();const{lang:t,serverURL:n}=o.value,l=(window.innerWidth-450)/2,r=(window.innerHeight-450)/2,a=window.open(`${n}/ui/login?lng=${encodeURIComponent(t)}`,"_blank",`width=450,height=450,left=${l},top=${r},scrollbars=no,resizable=no,status=no,location=no,toolbar=no,menubar=no`);a?.postMessage({type:"TOKEN",data:null},"*");const c=({data:e})=>{e&&"userInfo"===e.type&&e.data.token&&(a?.close(),i.value=e.data,(e.data.remember?localStorage:sessionStorage).setItem("WALINE_USER",JSON.stringify(e.data)),window.removeEventListener("message",c))};window.addEventListener("message",c)},onLogout:()=>{i.value={},localStorage.setItem("WALINE_USER","null"),sessionStorage.setItem("WALINE_USER","null")},onProfile:e=>{e.preventDefault();const{lang:t,serverURL:n}=o.value,l=(window.innerWidth-800)/2,r=(window.innerHeight-800)/2;window.open(`${n}/ui/profile?lng=${encodeURIComponent(t)}`,"_blank",`width=800,height=800,left=${l},top=${r},scrollbars=no,resizable=no,status=no,location=no,toolbar=no,menubar=no`)?.postMessage({type:"TOKEN",data:i.value.token},"*");const a=({data:e})=>{e&&"profile"===e.type&&(i.value={...i.value,...e},[localStorage,sessionStorage].filter((e=>e.getItem("WALINE_USER"))).forEach((e=>e.setItem("WALINE_USER",JSON.stringify(i)))),window.removeEventListener("message",a))};window.addEventListener("message",a)},submitComment:V,isLogin:B,userInfo:i,isSubmitting:C,wordNumber:k,wordLimit:y,isWordNumberLegal:w,editor:r,userMeta:a,emoji:p,emojiTabIndex:v,showEmoji:g,canUploadImage:N,previewText:h,showPreview:f,inputRefs:c,editorRef:s,emojiButtonRef:u,emojiPopupRef:d,imageUploadRef:m}}}),Ve={class:"wl-comment"},Le={key:0,class:"wl-login-info"},je={class:"wl-avatar"},xe=["title"],Re=["src"],ze=["textContent"],De={class:"wl-panel"},Ae=["for","textContent"],Me=["id","name","type","onUpdate:modelValue"],Ue=["placeholder"],Oe={class:"wl-preview"},Pe=e.createElementVNode("hr",null,null,-1),Te=["innerHTML"],_e={class:"wl-footer"},Fe={class:"wl-actions"},He={href:"https://guides.github.com/features/mastering-markdown/",title:"Markdown Guide","aria-label":"Markdown is supported",class:"wl-action",target:"_blank",rel:"noreferrer"},We=["title"],qe=["title"],Je=["title"],Ke={class:"wl-info"},Ye={class:"wl-text-number"},Ge={key:0},Xe=e.createTextVNode("  /  "),Qe=["textContent"],Ze=["textContent"],et=["disabled"],tt={key:0,class:"wl-tab-wrapper"},nt=["title","onClick"],ot=["src","alt"],lt={key:0,class:"wl-tabs"},rt=["onClick"],at=["src","alt","title"],it=["title"];var ct=Se(Ie,[["render",function(t,n,o,l,r,a){const i=e.resolveComponent("CloseIcon"),c=e.resolveComponent("MarkdownIcon"),s=e.resolveComponent("EmojiIcon"),m=e.resolveComponent("ImageIcon"),u=e.resolveComponent("PreviewIcon"),d=e.resolveComponent("LoadingIcon");return e.openBlock(),e.createElementBlock("div",Ve,["disable"!==t.config.login&&t.isLogin?(e.openBlock(),e.createElementBlock("div",Le,[e.createElementVNode("div",je,[e.createElementVNode("button",{class:"wl-logout-btn",title:t.locale.logout,onClick:n[0]||(n[0]=(...e)=>t.onLogout&&t.onLogout(...e))},[e.createVNode(i,{size:14})],8,xe),e.createElementVNode("img",{src:t.userInfo.avatar,alt:"avatar"},null,8,Re)]),e.createElementVNode("a",{href:"#",class:"wl-login-nick","aria-label":"Profile",onClick:n[1]||(n[1]=(...e)=>t.onProfile&&t.onProfile(...e)),textContent:e.toDisplayString(t.userInfo.display_name)},null,8,ze)])):e.createCommentVNode("v-if",!0),e.createElementVNode("div",De,["force"!==t.config.login&&t.config.meta.length&&!t.isLogin?(e.openBlock(),e.createElementBlock("div",{key:0,class:e.normalizeClass(["wl-header",`item${t.config.meta.length}`])},[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(t.config.meta,(n=>(e.openBlock(),e.createElementBlock("div",{class:"wl-header-item",key:n},[e.createElementVNode("label",{for:n,textContent:e.toDisplayString(t.locale[n]+(t.config.requiredMeta.includes(n)||!t.config.requiredMeta.length?"":`(${t.locale.optional})`))},null,8,Ae),e.withDirectives(e.createElementVNode("input",{ref_for:!0,ref:e=>{e&&(t.inputRefs[n]=e)},id:`wl-${n}`,class:e.normalizeClass(["wl-input",`wl-${n}`]),name:n,type:"mail"===n?"email":"text","onUpdate:modelValue":e=>t.userMeta[n]=e},null,10,Me),[[e.vModelDynamic,t.userMeta[n]]])])))),128))],2)):e.createCommentVNode("v-if",!0),e.withDirectives(e.createElementVNode("textarea",{class:"wl-editor",ref:"editorRef",id:"wl-edit",placeholder:t.replyUser?`@${t.replyUser}`:t.locale.placeholder,"onUpdate:modelValue":n[2]||(n[2]=e=>t.editor=e),onKeydown:n[3]||(n[3]=(...e)=>t.onKeyDown&&t.onKeyDown(...e)),onDrop:n[4]||(n[4]=(...e)=>t.onDrop&&t.onDrop(...e)),onPaste:n[5]||(n[5]=(...e)=>t.onPaste&&t.onPaste(...e))},null,40,Ue),[[e.vModelText,t.editor]]),e.withDirectives(e.createElementVNode("div",Oe,[Pe,e.createElementVNode("h4",null,e.toDisplayString(t.locale.preview)+":",1),e.createElementVNode("div",{class:"wl-content",innerHTML:t.previewText},null,8,Te)],512),[[e.vShow,t.showPreview]]),e.createElementVNode("div",_e,[e.createElementVNode("div",Fe,[e.createElementVNode("a",He,[e.createVNode(c)]),e.withDirectives(e.createElementVNode("button",{ref:"emojiButtonRef",class:e.normalizeClass(["wl-action",{actived:t.showEmoji}]),title:t.locale.emoji,onClick:n[6]||(n[6]=e=>t.showEmoji=!t.showEmoji)},[e.createVNode(s)],10,We),[[e.vShow,t.emoji.tabs.length]]),e.createElementVNode("input",{ref:"imageUploadRef",class:"upload",id:"wl-image-upload",type:"file",accept:".png,.jpg,.jpeg,.webp,.bmp,.gif",onChange:n[7]||(n[7]=(...e)=>t.onChange&&t.onChange(...e))},null,544),t.canUploadImage?(e.openBlock(),e.createElementBlock("label",{key:0,for:"wl-image-upload",class:"wl-action",title:t.locale.uploadImage},[e.createVNode(m)],8,qe)):e.createCommentVNode("v-if",!0),e.createElementVNode("button",{class:e.normalizeClass(["wl-action",{actived:t.showPreview}]),title:t.locale.preview,onClick:n[8]||(n[8]=e=>t.showPreview=!t.showPreview)},[e.createVNode(u)],10,Je)]),e.createElementVNode("div",Ke,[e.createElementVNode("div",Ye,[e.createTextVNode(e.toDisplayString(t.wordNumber)+" ",1),t.config.wordLimit?(e.openBlock(),e.createElementBlock("span",Ge,[Xe,e.createElementVNode("span",{class:e.normalizeClass({illegal:!t.isWordNumberLegal}),textContent:e.toDisplayString(t.wordLimit)},null,10,Qe)])):e.createCommentVNode("v-if",!0),e.createTextVNode("  "+e.toDisplayString(t.locale.word),1)]),"disable"===t.config.login||t.isLogin?e.createCommentVNode("v-if",!0):(e.openBlock(),e.createElementBlock("button",{key:0,class:"wl-btn",onClick:n[9]||(n[9]=(...e)=>t.onLogin&&t.onLogin(...e)),textContent:e.toDisplayString(t.locale.login)},null,8,Ze)),"force"!==t.config.login||t.isLogin?(e.openBlock(),e.createElementBlock("button",{key:1,class:"wl-btn primary",title:"Cmd|Ctrl + Enter",disabled:t.isSubmitting,onClick:n[10]||(n[10]=(...e)=>t.submitComment&&t.submitComment(...e))},[t.isSubmitting?(e.openBlock(),e.createBlock(d,{key:0,size:16})):(e.openBlock(),e.createElementBlock(e.Fragment,{key:1},[e.createTextVNode(e.toDisplayString(t.locale.submit),1)],2112))],8,et)):e.createCommentVNode("v-if",!0)]),e.createElementVNode("div",{ref:"emojiPopupRef",class:e.normalizeClass(["wl-emoji-popup",{display:t.showEmoji}])},[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(t.emoji.tabs,((n,o)=>(e.openBlock(),e.createElementBlock(e.Fragment,{key:n.name},[o===t.emojiTabIndex?(e.openBlock(),e.createElementBlock("div",tt,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(n.items,(n=>(e.openBlock(),e.createElementBlock("button",{key:n,title:n,onClick:e=>t.insert(`:${n}:`)},[t.showEmoji?(e.openBlock(),e.createElementBlock("img",{key:0,class:"wl-emoji",src:t.emoji.map[n],alt:n,loading:"lazy",referrerPolicy:"no-referrer"},null,8,ot)):e.createCommentVNode("v-if",!0)],8,nt)))),128))])):e.createCommentVNode("v-if",!0)],64)))),128)),t.emoji.tabs.length>1?(e.openBlock(),e.createElementBlock("div",lt,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(t.emoji.tabs,((n,o)=>(e.openBlock(),e.createElementBlock("button",{key:n.name,class:e.normalizeClass(["wl-tab",{active:t.emojiTabIndex===o}]),onClick:e=>t.emojiTabIndex=o},[e.createElementVNode("img",{class:"wl-emoji",src:n.icon,alt:n.name,title:n.name,loading:"lazy",referrerPolicy:"no-referrer"},null,8,at)],10,rt)))),128))])):e.createCommentVNode("v-if",!0)],2)])]),t.replyId?(e.openBlock(),e.createElementBlock("button",{key:1,class:"wl-close",title:t.locale.cancelReply,onClick:n[11]||(n[11]=e=>t.$emit("cancel-reply"))},[e.createVNode(i,{size:24})],8,it)):e.createCommentVNode("v-if",!0)])}],["__file","CommentBox.vue"]]);const st=["approved","waiting","spam"],mt=e.defineComponent({props:{comment:{type:Object,required:!0},rootId:{type:String,required:!0},reply:{type:Object}},components:{CommentBox:ct,DeleteIcon:()=>e.h("svg",{viewBox:"0 0 1024 1024",width:"24",height:"24"},e.h("path",{d:"m341.013 394.667 27.755 393.45h271.83l27.733-393.45h64.106l-28.01 397.952a64 64 0 0 1-63.83 59.498H368.768a64 64 0 0 1-63.83-59.52l-28.053-397.93h64.128zm139.307 19.818v298.667h-64V414.485h64zm117.013 0v298.667h-64V414.485h64zM181.333 288h640v64h-640v-64zm453.483-106.667v64h-256v-64h256z",fill:"red"})),LikeIcon:({active:t=!1})=>e.h("svg",{viewBox:"0 0 1024 1024",width:"24",height:"24"},[e.h("path",{d:"M850.654 323.804c-11.042-25.625-26.862-48.532-46.885-68.225-20.022-19.61-43.258-34.936-69.213-45.73-26.78-11.124-55.124-16.727-84.375-16.727-40.622 0-80.256 11.123-114.698 32.135A214.79 214.79 0 0 0 512 241.819a214.79 214.79 0 0 0-23.483-16.562c-34.442-21.012-74.076-32.135-114.698-32.135-29.25 0-57.595 5.603-84.375 16.727-25.872 10.711-49.19 26.12-69.213 45.73-20.105 19.693-35.843 42.6-46.885 68.225-11.453 26.615-17.303 54.877-17.303 83.963 0 27.439 5.603 56.03 16.727 85.117 9.31 24.307 22.659 49.52 39.715 74.981 27.027 40.293 64.188 82.316 110.33 124.915 76.465 70.615 152.189 119.394 155.402 121.371l19.528 12.525c8.652 5.52 19.776 5.52 28.427 0l19.529-12.525c3.213-2.06 78.854-50.756 155.401-121.371 46.143-42.6 83.304-84.622 110.33-124.915 17.057-25.46 30.487-50.674 39.716-74.981 11.124-29.087 16.727-57.678 16.727-85.117.082-29.086-5.768-57.348-17.221-83.963z"+(t?"":"M512 761.5S218.665 573.55 218.665 407.767c0-83.963 69.461-152.023 155.154-152.023 60.233 0 112.473 33.618 138.181 82.727 25.708-49.109 77.948-82.727 138.18-82.727 85.694 0 155.155 68.06 155.155 152.023C805.335 573.551 512 761.5 512 761.5z"),fill:t?"red":"currentColor"})]),ReplyIcon:()=>e.h("svg",{viewBox:"0 0 1024 1024",width:"24",height:"24"},e.h("path",{d:"M810.667 213.333a64 64 0 0 1 64 64V704a64 64 0 0 1-64 64H478.336l-146.645 96.107a21.333 21.333 0 0 1-33.024-17.856V768h-85.334a64 64 0 0 1-64-64V277.333a64 64 0 0 1 64-64h597.334zm0 64H213.333V704h149.334v63.296L459.243 704h351.424V277.333zm-271.36 213.334v64h-176.64v-64h176.64zm122.026-128v64H362.667v-64h298.666z",fill:"currentColor"})),VerifiedIcon:()=>e.h("svg",{class:"verified-icon",viewBox:"0 0 1024 1024",width:"14",height:"14"},e.h("path",{d:"m894.4 461.56-54.4-63.2c-10.4-12-18.8-34.4-18.8-50.4v-68c0-42.4-34.8-77.2-77.2-77.2h-68c-15.6 0-38.4-8.4-50.4-18.8l-63.2-54.4c-27.6-23.6-72.8-23.6-100.8 0l-62.8 54.8c-12 10-34.8 18.4-50.4 18.4h-69.2c-42.4 0-77.2 34.8-77.2 77.2v68.4c0 15.6-8.4 38-18.4 50l-54 63.6c-23.2 27.6-23.2 72.4 0 100l54 63.6c10 12 18.4 34.4 18.4 50v68.4c0 42.4 34.8 77.2 77.2 77.2h69.2c15.6 0 38.4 8.4 50.4 18.8l63.2 54.4c27.6 23.6 72.8 23.6 100.8 0l63.2-54.4c12-10.4 34.4-18.8 50.4-18.8h68c42.4 0 77.2-34.8 77.2-77.2v-68c0-15.6 8.4-38.4 18.8-50.4l54.4-63.2c23.2-27.6 23.2-73.2-.4-100.8zm-216-25.2-193.2 193.2a30 30 0 0 1-42.4 0l-96.8-96.8a30.16 30.16 0 0 1 0-42.4c11.6-11.6 30.8-11.6 42.4 0l75.6 75.6 172-172c11.6-11.6 30.8-11.6 42.4 0 11.6 11.6 11.6 30.8 0 42.4z",fill:"#27ae60"}))},emits:["submit","reply","like","delete","status","sticky"],setup(t){const n=e.inject("config"),o=$e(),l=Be(),r=e.computed((()=>n.value.locale)),a=e.computed((()=>{let{link:e}=t.comment;return e?le(e)?e:`https://${e}`:""})),i=e.computed((()=>o.value.includes(t.comment.objectId))),c=((t,n)=>{const o=A();return e.computed((()=>me(t,o.value,n)))})(t.comment.insertedAt,r.value),s=e.computed((()=>"administrator"===l.value.type)),m=e.computed((()=>t.comment.user_id&&l.value.objectId===t.comment.user_id)),u=e.computed((()=>t.comment.objectId===t.reply?.objectId));return{config:n,locale:r,isReplyingCurrent:u,link:a,like:i,time:c,isAdmin:s,isOwner:m,commentStatus:st}}}),ut=["id"],dt={class:"wl-user","aria-hidden":"true"},pt=["src"],vt={class:"wl-card"},gt={class:"wl-head"},ft=["href"],ht={key:1,class:"wl-nick"},kt=["textContent"],yt=["textContent"],wt=["textContent"],bt=["textContent"],Ct=["textContent"],Et={class:"wl-comment-actions"},Bt=["title"],Nt=["textContent"],$t=["title"],St={class:"wl-meta","aria-hidden":"true"},It=["textContent"],Vt=["textContent"],Lt=["textContent"],jt=["innerHTML"],xt={key:0,class:"wl-admin-actions"},Rt={class:"wl-comment-status"},zt=["disabled","onClick","textContent"],Dt={key:1,class:"wl-reply-wrapper"},At={key:2,class:"wl-quote"};var Mt=Se(mt,[["render",function(t,n,o,l,r,a){const i=e.resolveComponent("VerifiedIcon"),c=e.resolveComponent("DeleteIcon"),s=e.resolveComponent("LikeIcon"),m=e.resolveComponent("ReplyIcon"),u=e.resolveComponent("CommentBox"),d=e.resolveComponent("CommentCard",!0);return e.openBlock(),e.createElementBlock("div",{class:"wl-item",id:t.comment.objectId},[e.createElementVNode("div",dt,[t.comment.avatar?(e.openBlock(),e.createElementBlock("img",{key:0,src:t.comment.avatar},null,8,pt)):e.createCommentVNode("v-if",!0),t.comment.type?(e.openBlock(),e.createBlock(i,{key:1})):e.createCommentVNode("v-if",!0)]),e.createElementVNode("div",vt,[e.createElementVNode("div",gt,[t.link?(e.openBlock(),e.createElementBlock("a",{key:0,class:"wl-nick",href:t.link,target:"_blank",rel:"nofollow noreferrer"},e.toDisplayString(t.comment.nick),9,ft)):(e.openBlock(),e.createElementBlock("span",ht,e.toDisplayString(t.comment.nick),1)),"administrator"===t.comment.type?(e.openBlock(),e.createElementBlock("span",{key:2,class:"wl-badge",textContent:e.toDisplayString(t.locale.admin)},null,8,kt)):e.createCommentVNode("v-if",!0),t.comment.label?(e.openBlock(),e.createElementBlock("span",{key:3,class:"wl-badge",textContent:e.toDisplayString(t.comment.label)},null,8,yt)):e.createCommentVNode("v-if",!0),t.comment.sticky?(e.openBlock(),e.createElementBlock("span",{key:4,class:"wl-badge",textContent:e.toDisplayString(t.locale.sticky)},null,8,wt)):e.createCommentVNode("v-if",!0),t.comment.level&&t.comment.level>=0?(e.openBlock(),e.createElementBlock("span",{key:5,class:e.normalizeClass(`wl-badge level${t.comment.level}`),textContent:e.toDisplayString(t.locale[`level${t.comment.level}`]||`Level ${t.comment.level}`)},null,10,bt)):e.createCommentVNode("v-if",!0),e.createElementVNode("span",{class:"wl-time",textContent:e.toDisplayString(t.time)},null,8,Ct),e.createElementVNode("div",Et,[t.isAdmin||t.isOwner?(e.openBlock(),e.createElementBlock("button",{key:0,class:"wl-delete",onClick:n[0]||(n[0]=e=>t.$emit("delete",t.comment))},[e.createVNode(c)])):e.createCommentVNode("v-if",!0),e.createElementVNode("button",{class:"wl-like",onClick:n[1]||(n[1]=e=>t.$emit("like",t.comment)),title:t.like?t.locale.cancelLike:t.locale.like},[e.createVNode(s,{active:t.like},null,8,["active"]),"like"in t.comment?(e.openBlock(),e.createElementBlock("span",{key:0,textContent:e.toDisplayString(t.comment.like)},null,8,Nt)):e.createCommentVNode("v-if",!0)],8,Bt),e.createElementVNode("button",{class:e.normalizeClass(["wl-reply",{active:t.isReplyingCurrent}]),title:t.isReplyingCurrent?t.locale.cancelReply:t.locale.reply,onClick:n[2]||(n[2]=e=>t.$emit("reply",t.isReplyingCurrent?null:t.comment))},[e.createVNode(m)],10,$t)])]),e.createElementVNode("div",St,[t.comment.addr?(e.openBlock(),e.createElementBlock("span",{key:0,textContent:e.toDisplayString(t.comment.addr)},null,8,It)):e.createCommentVNode("v-if",!0),t.comment.browser?(e.openBlock(),e.createElementBlock("span",{key:1,textContent:e.toDisplayString(t.comment.browser)},null,8,Vt)):e.createCommentVNode("v-if",!0),t.comment.os?(e.openBlock(),e.createElementBlock("span",{key:2,textContent:e.toDisplayString(t.comment.os)},null,8,Lt)):e.createCommentVNode("v-if",!0)]),e.createElementVNode("div",{class:"wl-content",innerHTML:t.comment.comment},null,8,jt),t.isAdmin?(e.openBlock(),e.createElementBlock("div",xt,[e.createElementVNode("span",Rt,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(t.commentStatus,(n=>(e.openBlock(),e.createElementBlock("button",{key:n,class:e.normalizeClass(`wl-btn wl-${n}`),disabled:t.comment.status===n,onClick:e=>t.$emit("status",{status:n,comment:t.comment}),textContent:e.toDisplayString(n)},null,10,zt)))),128))]),t.isAdmin&&!t.comment.rid?(e.openBlock(),e.createElementBlock("button",{key:0,class:"wl-btn wl-sticky",onClick:n[3]||(n[3]=e=>t.$emit("sticky",t.comment))},e.toDisplayString(t.comment.sticky?"unsticky":"sticky"),1)):e.createCommentVNode("v-if",!0)])):e.createCommentVNode("v-if",!0),t.isReplyingCurrent?(e.openBlock(),e.createElementBlock("div",Dt,[e.createVNode(u,{replyId:t.comment.objectId,replyUser:t.comment.nick,rootId:t.rootId,onSubmit:n[4]||(n[4]=e=>t.$emit("submit",e)),onCancelReply:n[5]||(n[5]=e=>t.$emit("reply",null))},null,8,["replyId","replyUser","rootId"])])):e.createCommentVNode("v-if",!0),t.comment.children?(e.openBlock(),e.createElementBlock("div",At,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(t.comment.children,(o=>(e.openBlock(),e.createBlock(d,{key:o.objectId,comment:o,reply:t.reply,rootId:t.rootId,onReply:n[6]||(n[6]=e=>t.$emit("reply",e)),onSubmit:n[7]||(n[7]=e=>t.$emit("submit",e)),onLike:n[8]||(n[8]=e=>t.$emit("like",e)),onDelete:n[9]||(n[9]=e=>t.$emit("delete",e)),onStatus:n[10]||(n[10]=e=>t.$emit("status",e)),onSticky:n[11]||(n[11]=e=>t.$emit("sticky",e))},null,8,["comment","reply","rootId"])))),128))])):e.createCommentVNode("v-if",!0)])],8,ut)}],["__file","CommentCard.vue"]]);const Ut=e.defineComponent({name:"WalineRoot",components:{CommentBox:ct,CommentCard:Mt,LoadingIcon:U},props:["serverURL","path","meta","requiredMeta","dark","lang","locale","pageSize","wordLimit","emoji","login","highlighter","texRenderer","imageUploader","copyright"],setup(t){const n=e.computed((()=>(({serverURL:e,path:t=location.pathname,lang:n="zh-CN",locale:o,emoji:l=["//unpkg.com/@waline/emojis@1.0.1/weibo"],meta:r=["nick","mail","link"],requiredMeta:a=[],dark:i=!1,pageSize:c=10,wordLimit:s,imageUploader:m,highlighter:u,texRenderer:d,copyright:p=!0,login:v="enable",...g})=>({serverURL:re(e),path:ne(t),locale:{...te[n]||te["zh-CN"],..."object"==typeof o?o:{}},wordLimit:ae(s),meta:P(r),requiredMeta:P(a),imageUploader:ie(m,T),highlighter:ie(u,q),texRenderer:ie(d,_),lang:n,dark:i,emoji:l,pageSize:c,login:v,copyright:p,...g}))(t))),o=Be(),l=$e(),a=e.ref("loading"),i=e.ref(0),c=e.ref(1),s=e.ref(0),m=e.ref([]),u=e.ref(null),d=e.computed((()=>{return"string"==typeof(e=n.value.dark)?"auto"===e?`@media(prefers-color-scheme:dark){body${ce}}`:`${e}${ce}`:!0===e?`:root${ce}`:"";var e}));let p;!function(t,n={}){const o=e.ref(!1),{document:l=C,immediate:a=!0,manual:i=!1,id:c="vueuse_styletag_"+ ++M}=n,s=e.ref(t);let m=()=>{};const u=()=>{if(!l)return;const t=l.getElementById(c)||l.createElement("style");t.type="text/css",t.id=c,n.media&&(t.media=n.media),l.head.appendChild(t),o.value||(m=e.watch(s,(e=>{t.innerText=e}),{immediate:!0}),o.value=!0)},d=()=>{l&&o.value&&(m(),l.head.removeChild(l.getElementById(c)),o.value=!1)};a&&!i&&u(),i||r(d),e.readonly(o)}(d);const v=e=>{const{serverURL:t,path:l,pageSize:r}=n.value,u=new AbortController;a.value="loading",p?.(),ve({serverURL:t,lang:n.value.lang,path:l,pageSize:r,page:e,signal:u.signal,token:o.value?.token}).then((t=>{a.value="success",i.value=t.count,m.value.push(...t.data),c.value=e,s.value=t.totalPages})).catch((e=>{"AbortError"!==e.name&&(console.error(e.message),a.value="error")})),p=u.abort.bind(u)},g=()=>{i.value=0,m.value=[],v(1)};return e.provide("config",n),e.watch((()=>t.path),g),e.onMounted((()=>g())),{config:n,darkmodeStyle:d,i18n:e.computed((()=>n.value.locale)),status:a,count:i,page:c,totalPages:s,data:m,reply:u,loadMore:()=>v(c.value+1),refresh:g,onReply:e=>{u.value=e},onSubmit:e=>{if(e.rid){const t=m.value.find((({objectId:t})=>t===e.rid));if(!t)return;Array.isArray(t.children)||(t.children=[]),t.children.push(e)}else m.value.unshift(e)},onStatusChange:async({comment:e,status:t})=>{if(e.status===t)return;const{serverURL:l,lang:r}=n.value;await ge({serverURL:l,lang:r,token:o.value?.token,objectId:e.objectId,status:t}),e.status=t},onDelete:async({objectId:e})=>{if(!confirm("Are you sure you want to delete this comment?"))return;const{serverURL:t,lang:l}=n.value;await(({serverURL:e,lang:t,token:n,objectId:o})=>fetch(`${e}/comment/${o}?lang=${t}`,{method:"DELETE",headers:{Authorization:`Bearer ${n}`}}).then((e=>e.json())))({serverURL:t,lang:l,token:o.value?.token,objectId:e}),m.value.some(((t,n)=>t.objectId===e?(m.value=m.value.filter(((e,t)=>t!==n)),!0):t.children.some(((o,l)=>o.objectId===e&&(m.value[n].children=t.children.filter(((e,t)=>t!==l)),!0)))))},onSticky:async e=>{if(e.rid)return;const{serverURL:t,lang:l}=n.value;await ge({serverURL:t,lang:l,token:o.value?.token,objectId:e.objectId,sticky:e.sticky?0:1}),e.sticky=!e.sticky},onLike:async e=>{const{serverURL:t,lang:o}=n.value,{objectId:r}=e,a=l.value.includes(r);await(({serverURL:e,lang:t,objectId:n,like:o})=>fetch(`${e}/comment/${n}?lang=${t}`,{method:"PUT",headers:pe,body:JSON.stringify({like:o})}).then((e=>e.json())))({serverURL:t,lang:o,objectId:r,like:!a}),a?l.value=l.value.filter((e=>e!==r)):(l.value=[...l.value,r],l.value.length>50&&(l.value=l.value.slice(-50))),e.like=(e.like||0)+(a?-1:1)},version:"2.4.2"}}}),Ot={"data-waline":""},Pt={class:"wl-count"},Tt=["textContent"],_t={class:"wl-cards"},Ft={key:1,class:"wl-operation"},Ht=["textContent"],Wt={key:0,class:"wl-loading"},qt=["textContent"],Jt={class:"wl-operation"},Kt=["textContent"],Yt={key:3,class:"wl-power"},Gt=e.createTextVNode(" Powered by "),Xt=e.createElementVNode("a",{href:"https://github.com/walinejs/waline",target:"_blank",rel:"noreferrer"}," Waline ",-1);var Qt=Se(Ut,[["render",function(t,n,o,l,r,a){const i=e.resolveComponent("CommentBox"),c=e.resolveComponent("CommentCard"),s=e.resolveComponent("LoadingIcon");return e.openBlock(),e.createElementBlock("div",Ot,[t.reply?e.createCommentVNode("v-if",!0):(e.openBlock(),e.createBlock(i,{key:0,onSubmit:t.onSubmit},null,8,["onSubmit"])),e.createElementVNode("div",Pt,[t.count?(e.openBlock(),e.createElementBlock("span",{key:0,class:"wl-num",textContent:e.toDisplayString(t.count)},null,8,Tt)):e.createCommentVNode("v-if",!0),e.createTextVNode(" "+e.toDisplayString(t.i18n.comment),1)]),e.createElementVNode("div",_t,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(t.data,(n=>(e.openBlock(),e.createBlock(c,{key:n.objectId,"root-id":n.objectId,comment:n,reply:t.reply,onReply:t.onReply,onSubmit:t.onSubmit,onStatus:t.onStatusChange,onDelete:t.onDelete,onSticky:t.onSticky,onLike:t.onLike},null,8,["root-id","comment","reply","onReply","onSubmit","onStatus","onDelete","onSticky","onLike"])))),128))]),"error"===t.status?(e.openBlock(),e.createElementBlock("div",Ft,[e.createElementVNode("button",{type:"button",class:"wl-btn",onClick:n[0]||(n[0]=(...e)=>t.refresh&&t.refresh(...e)),textContent:e.toDisplayString(t.i18n.refresh)},null,8,Ht)])):(e.openBlock(),e.createElementBlock(e.Fragment,{key:2},["loading"===t.status?(e.openBlock(),e.createElementBlock("div",Wt,[e.createVNode(s,{size:30})])):t.data.length?t.page<t.totalPages?(e.openBlock(),e.createElementBlock(e.Fragment,{key:2},[e.createCommentVNode(" Load more button "),e.createElementVNode("div",Jt,[e.createElementVNode("button",{type:"button",class:"wl-btn",onClick:n[1]||(n[1]=(...e)=>t.loadMore&&t.loadMore(...e)),textContent:e.toDisplayString(t.i18n.more)},null,8,Kt)])],2112)):e.createCommentVNode("v-if",!0):(e.openBlock(),e.createElementBlock("div",{key:1,class:"wl-empty",textContent:e.toDisplayString(t.i18n.sofa)},null,8,qt))],2112)),e.createCommentVNode(" Copyright Information "),t.config.copyright?(e.openBlock(),e.createElementBlock("div",Yt,[Gt,Xt,e.createTextVNode(" v"+e.toDisplayString(t.version),1)])):e.createCommentVNode("v-if",!0)])}],["__file","Waline.vue"]]);exports.Waline=Qt,exports.version="2.4.2";
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("vue"),t=require("autosize"),n=require("marked");function o(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var l=o(t);function a(t){return!!e.getCurrentScope()&&(e.onScopeDispose(t),!0)}const r="undefined"!=typeof window,i=()=>{};const c=e=>e();var s=Object.getOwnPropertySymbols,m=Object.prototype.hasOwnProperty,u=Object.prototype.propertyIsEnumerable;function d(t,n,o={}){const l=o,{eventFilter:a=c}=l,r=((e,t)=>{var n={};for(var o in e)m.call(e,o)&&t.indexOf(o)<0&&(n[o]=e[o]);if(null!=e&&s)for(var o of s(e))t.indexOf(o)<0&&u.call(e,o)&&(n[o]=e[o]);return n})(l,["eventFilter"]);return e.watch(t,(i=a,d=n,function(...e){i((()=>d.apply(this,e)),{fn:d,thisArg:this,args:e})}),r);var i,d}var p=Object.defineProperty,v=Object.defineProperties,f=Object.getOwnPropertyDescriptors,g=Object.getOwnPropertySymbols,h=Object.prototype.hasOwnProperty,y=Object.prototype.propertyIsEnumerable,w=(e,t,n)=>t in e?p(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;function k(t,n,o={}){const l=o,{eventFilter:a}=l,r=((e,t)=>{var n={};for(var o in e)h.call(e,o)&&t.indexOf(o)<0&&(n[o]=e[o]);if(null!=e&&g)for(var o of g(e))t.indexOf(o)<0&&y.call(e,o)&&(n[o]=e[o]);return n})(l,["eventFilter"]),{eventFilter:i,pause:s,resume:m,isActive:u}=function(t=c){const n=e.ref(!0);return{isActive:n,pause:function(){n.value=!1},resume:function(){n.value=!0},eventFilter:(...e)=>{n.value&&t(...e)}}}(a),p=d(t,n,(k=((e,t)=>{for(var n in t||(t={}))h.call(t,n)&&w(e,n,t[n]);if(g)for(var n of g(t))y.call(t,n)&&w(e,n,t[n]);return e})({},r),v(k,f({eventFilter:i}))));var k;return{stop:p,pause:s,resume:m,isActive:u}}const b=r?window:void 0,C=r?window.document:void 0;function E(...t){let n,o,l,r;if("string"==typeof t[0]?([o,l,r]=t,n=b):[n,o,l,r]=t,!n)return i;let c=i;const s=e.watch((()=>function(t){var n;const o=e.unref(t);return null!=(n=null==o?void 0:o.$el)?n:o}(n)),(e=>{c(),e&&(e.addEventListener(o,l,r),c=()=>{e.removeEventListener(o,l,r),c=i})}),{immediate:!0,flush:"post"}),m=()=>{s(),c()};return a(m),m}r&&window.navigator,r&&window.location;const B="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},V="__vueuse_ssr_handlers__";B[V]=B[V]||{};const N=B[V];const S={boolean:{read:e=>"true"===e,write:e=>String(e)},object:{read:e=>JSON.parse(e),write:e=>JSON.stringify(e)},number:{read:e=>Number.parseFloat(e),write:e=>String(e)},any:{read:e=>e,write:e=>String(e)},string:{read:e=>e,write:e=>String(e)},map:{read:e=>new Map(JSON.parse(e)),write:e=>JSON.stringify(Array.from(e.entries()))},set:{read:e=>new Set(JSON.parse(e)),write:e=>JSON.stringify(Array.from(e))},date:{read:e=>new Date(e),write:e=>e.toISOString()}};function $(t,n,o,l={}){var a;const{flush:r="pre",deep:i=!0,listenToStorageChanges:c=!0,writeDefaults:s=!0,shallow:m,window:u=b,eventFilter:d,onError:p=(e=>{console.error(e)})}=l,v=(m?e.shallowRef:e.ref)(n);if(!o)try{o=function(e,t){return N[e]||t}("getDefaultStorage",(()=>{var e;return null==(e=b)?void 0:e.localStorage}))()}catch(e){p(e)}if(!o)return v;const f=e.unref(n),g=function(e){return null==e?"any":e instanceof Set?"set":e instanceof Map?"map":e instanceof Date?"date":"boolean"==typeof e?"boolean":"string"==typeof e?"string":"object"==typeof e||Array.isArray(e)?"object":Number.isNaN(e)?"any":"number"}(f),h=null!=(a=l.serializer)?a:S[g],{pause:y,resume:w}=k(v,(()=>function(e){try{null==e?o.removeItem(t):o.setItem(t,h.write(e))}catch(e){p(e)}}(v.value)),{flush:r,deep:i,eventFilter:d});return u&&c&&E(u,"storage",C),C(),v;function C(e){e&&e.key!==t||(v.value=function(e){if(!e||e.key===t){y();try{const n=e?e.newValue:o.getItem(t);return null==n?(s&&null!==f&&o.setItem(t,h.write(f)),f):"string"!=typeof n?n:h.read(n)}catch(e){p(e)}finally{w()}}}(e))}}var I,x,L=Object.defineProperty,j=Object.getOwnPropertySymbols,R=Object.prototype.hasOwnProperty,z=Object.prototype.propertyIsEnumerable,D=(e,t,n)=>t in e?L(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;function M(t={}){const{controls:n=!1,interval:o="requestAnimationFrame"}=t,l=e.ref(new Date),i=()=>l.value=new Date,c="requestAnimationFrame"===o?function(t,n={}){const{immediate:o=!0,window:l=b}=n,r=e.ref(!1);let i=null;function c(){r.value&&l&&(t(),i=l.requestAnimationFrame(c))}function s(){!r.value&&l&&(r.value=!0,c())}function m(){r.value=!1,null!=i&&l&&(l.cancelAnimationFrame(i),i=null)}return o&&s(),a(m),{isActive:r,pause:m,resume:s}}(i,{immediate:!0}):function(t,n=1e3,o={}){const{immediate:l=!0,immediateCallback:i=!1}=o;let c=null;const s=e.ref(!1);function m(){c&&(clearInterval(c),c=null)}function u(){s.value=!1,m()}function d(){n<=0||(s.value=!0,i&&t(),m(),c=setInterval(t,e.unref(n)))}l&&r&&d(),e.isRef(n)&&a(e.watch(n,(()=>{l&&r&&d()})));return a(u),{isActive:s,pause:u,resume:d}}(i,o,{immediate:!0});return n?((e,t)=>{for(var n in t||(t={}))R.call(t,n)&&D(e,n,t[n]);if(j)for(var n of j(t))z.call(t,n)&&D(e,n,t[n]);return e})({now:l},c):l}r&&(null==window?void 0:window.navigator)&&(null==(I=null==window?void 0:window.navigator)?void 0:I.platform)&&/iP(ad|hone|od)/.test(null==(x=null==window?void 0:window.navigator)?void 0:x.platform);let A=0;const U=({size:t})=>e.h("svg",{width:t,height:t,viewBox:"0 0 100 100",preserveAspectRatio:"xMidYMid"},e.h("circle",{cx:50,cy:50,fill:"none",stroke:"currentColor",strokeWidth:"4",r:"40","stroke-dasharray":"85 30"},e.h("animateTransform",{attributeName:"transform",type:"rotate",repeatCount:"indefinite",dur:"1s",values:"0 50 50;360 50 50",keyTimes:"0;1"}))),O=["nick","mail","link"],P=e=>e.filter((e=>O.includes(e))),T=e=>new Promise(((t,n)=>{const o=new FileReader;o.readAsDataURL(e),o.onload=()=>t(o.result?.toString()||""),o.onerror=n})),F=e=>!0===e?'<p class="wl-tex">Tex is not available in preview</p>':'<span class="wl-tex">Tex is not available in preview</span>',H=new RegExp(`(${/[\u4E00-\u9FFF\u3400-\u4dbf\uf900-\ufaff\u3040-\u309f\uac00-\ud7af\u0400-\u04FF]+|\w+/.source}|${/</.source})|((?:${/(?:^|\s)\/\/(.+?)$/gm.source})|(?:${/\/\*([\S\s]*?)\*\//gm.source}))`,"gmi"),_=["23AC69","91C132","F19726","E8552D","1AAB8E","E1147F","2980C1","1BA1E6","9FA0A0","F19726","E30B20","E30B20","A3338B"],W={},G=e=>{let t=0;return e.replace(H,((e,n,o)=>{if(o)return`<span style="color: slategray">${o}</span>`;if("<"===n)return"&lt;";let l;W[n]?l=W[n]:(l=_[t],W[n]=l);const a=`<span style="color: #${l}">${n}</span>`;return t=++t%_.length,a}))},q=["nick","nickError","mail","mailError","link","optional","placeholder","sofa","submit","like","cancelLike","reply","cancelReply","comment","refresh","more","preview","emoji","uploadImage","seconds","minutes","hours","days","now","uploading","login","logout","admin","sticky","word","wordHint","anonymous","level0","level1","level2","level3","level4","level5","gif","gifSearchPlaceholder"],J=e=>Object.fromEntries(e.map(((e,t)=>[q[t],e])));var K=J(["NickName","NickName cannot be less than 3 bytes.","E-Mail","Please confirm your email address.","Website","Optional","Comment here...","No comment yet.","Submit","Like","Cancel like","Reply","Cancel reply","Comments","Refresh","Load More...","Preview","Emoji","Upload Image","seconds ago","minutes ago","hours ago","days ago","just now","Uploading","Login","logout","Admin","Sticky","Words","Please input comments between $0 and $1 words!\n Current word number: $2","Anonymous","Dwarves","Hobbits","Ents","Wizards","Elves","Maiar","GIF","Search GIF"]),Y=J(["ニックネーム","3バイト以上のニックネームをご入力ください.","メールアドレス","メールアドレスをご確認ください.","サイト","オプション","ここにコメント","コメントしましょう~","提出する","Like","Cancel like","返信する","キャンセル","コメント","更新","さらに読み込む","プレビュー","絵文字","画像をアップロード","秒前","分前","時間前","日前","たっだ今","アップロード","ログインする","ログアウト","管理者","トップに置く","ワード","コメントは $0 から $1 ワードの間でなければなりません!\n 現在の単語番号: $2","匿名","うえにん","なかにん","しもおし","特にしもおし","かげ","なぬし","GIF","探す GIF"]),Z=J(["昵称","昵称不能少于3个字符","邮箱","请填写正确的邮件地址","网址","可选","欢迎评论","来发评论吧~","提交","喜欢","取消喜欢","回复","取消回复","评论","刷新","加载更多...","预览","表情","上传图片","秒前","分钟前","小时前","天前","刚刚","正在上传","登录","退出","博主","置顶","字","评论字数应在 $0 到 $1 字之间!\n当前字数:$2","匿名","潜水","冒泡","吐槽","活跃","话痨","传说","表情包","搜索表情包"]),X=J(["暱稱","郵箱","網址","可選","暱稱不能少於3個字元","請填寫正確的郵件地址","歡迎評論","來發評論吧~","提交","喜歡","取消喜歡","回覆","取消回覆","評論","刷新","載入更多...","預覽","表情","上傳圖片","秒前","分鐘前","小時前","天前","剛剛","正在上傳","登錄","退出","博主","置頂","字","評論字數應在 $0 到 $1 字之間!\n當前字數:$2","匿名","潛水","冒泡","吐槽","活躍","話癆","傳說","表情包","搜索表情包"]),Q=J(["Apelido","Apelido não pode ser menor que 3 bytes.","E-Mail","Por favor, confirme seu endereço de e-mail.","Website","Opcional","Comente aqui...","Nenhum comentário, ainda.","Enviar","Like","Cancel like","Responder","Cancelar resposta","Comentários","Refrescar","Carregar Mais...","Visualizar","Emoji","Enviar Imagem","segundos atrás","minutos atrás","horas atrás","dias atrás","agora mesmo","Enviando","Entrar","Sair","Admin","Sticky","Palavras","Favor enviar comentário com $0 a $1 palavras!\n Número de palavras atuais: $2","Anônimo","Dwarves","Hobbits","Ents","Wizards","Elves","Maiar","GIF","Pesquisar GIF"]),ee=J(["Псевдоним","Никнейм не может быть меньше 3 байт.","Эл. адрес","Пожалуйста, подтвердите адрес вашей электронной почты.","Веб-сайт","Необязательный","Комментарий здесь...","Пока нет комментариев.","Отправить","Like","Cancel like","Отвечать","Отменить ответ","Комментарии","Обновить","Загрузи больше...","Превью","эмодзи","Загрузить изображение","секунд назад","несколько минут назад","несколько часов назад","дней назад","прямо сейчас","Загрузка","Авторизоваться","Выход из системы","Админ","Липкий","Слова","Пожалуйста, введите комментарии от $0 до $1 слов!\nНомер текущего слова: $2","Анонимный","Dwarves","Hobbits","Ents","Wizards","Elves","Maiar","GIF","Поиск GIF"]);const te={zh:Z,"zh-cn":Z,"zh-CN":Z,"zh-tw":X,"zh-TW":X,en:K,"en-US":K,"en-us":K,jp:Y,"jp-jp":Y,"jp-JP":Y,"pt-br":Q,"pt-BR":Q,ru:ee,"ru-ru":ee,"ru-RU":ee},ne=e=>{try{e=decodeURI(e)}catch(e){}return e},oe=(e="")=>e.replace(/\/$/u,""),le=e=>/^(https?:)?\/\//.test(e),ae=e=>{const t=oe(e);return le(t)?t:`https://${t}`},re=e=>Array.isArray(e)?e:!!e&&[0,e],ie=(e,t)=>"function"==typeof e?e:!1!==e&&t,ce="{--waline-white:#000;--waline-light-grey:#666;--waline-dark-grey:#999;--waline-color:#888;--waline-bgcolor:#1e1e1e;--waline-bgcolor-light:#272727;--waline-bgcolor-hover: #444;--waline-border-color:#333;--waline-disable-bgcolor:#444;--waline-disable-color:#272727;--waline-bq-color:#272727;--waline-info-bgcolor:#272727;--waline-info-color:#666}",se=(e,t)=>{let n=e.toString();for(;n.length<t;)n="0"+n;return n},me=(e,t,n)=>{if(!e)return"";const o="string"==typeof e?new Date(-1!==e.indexOf(" ")?e.replace(/-/g,"/"):e):e,l=t.getTime()-o.getTime(),a=Math.floor(l/864e5);if(0===a){const e=l%864e5,t=Math.floor(e/36e5);if(0===t){const t=e%36e5,o=Math.floor(t/6e4);if(0===o){const e=t%6e4;return`${Math.round(e/1e3)} ${n.seconds}`}return`${o} ${n.minutes}`}return`${t} ${n.hours}`}return a<0?n.now:a<8?`${a} ${n.days}`:(e=>{const t=se(e.getDate(),2),n=se(e.getMonth()+1,2);return`${se(e.getFullYear(),2)}-${n}-${t}`})(o)},ue=e=>{const t=$("WALINE_EMOJI",{}),n=Boolean(/@[0-9]+\.[0-9]+\.[0-9]+/.test(e));if(n){const n=t.value[e];if(n)return Promise.resolve(n)}return fetch(`${e}/info.json`).then((e=>e.json())).then((o=>{const l={folder:e,...o};return n&&(t.value[e]=l),l}))},de=(e,t="",n="",o="")=>`${t?`${t}/`:""}${n}${e}${o?`.${o}`:""}`,pe={"Content-Type":"application/json"},ve=({serverURL:e,lang:t,path:n,page:o,pageSize:l,signal:a,token:r})=>{const i={};return r&&(i.Authorization=`Bearer ${r}`),fetch(`${e}/comment?path=${encodeURIComponent(n)}&pageSize=${l}&page=${o}&lang=${t}`,{signal:a,headers:i}).then((e=>e.json())).then((e=>((e,t="")=>{if("object"==typeof e&&e.errno)throw new TypeError(`Fetch ${t} failed with ${e.errno}: ${e.errmsg}`);return e})(e,"comment list")))},fe=({serverURL:e,lang:t,token:n,objectId:o,...l})=>fetch(`${e}/comment/${o}?lang=${t}`,{method:"PUT",headers:{"Content-Type":"application/json",Authorization:`Bearer ${n}`},body:JSON.stringify(l)}).then((e=>e.json())),ge=e=>e.type.includes("image"),he=e=>{const t=Array.from(e).find(ge);return t?t.getAsFile():null},ye=/\$.*?\$/,we=/^\$(.*?)\$/,ke=/^(?:\s{0,3})\$\$((?:[^\n]|\n[^\n])+?)\n{0,1}\$\$/,be=(e="",t={})=>e.replace(/:(.+?):/g,((e,n)=>t[n]?`<img class="wl-emoji" src="${t[n]}" alt="${n}">`:e)),Ce=(e,{emojiMap:t,highlighter:o,texRenderer:l})=>{if(n.marked.setOptions({highlight:o||void 0,breaks:!0,smartLists:!0,smartypants:!0}),l){const e=(e=>[{name:"blockMath",level:"block",tokenizer(t){const n=ke.exec(t);if(null!==n)return{type:"html",raw:n[0],text:e(!0,n[1])}}},{name:"inlineMath",level:"inline",start(e){const t=e.search(ye);return-1!==t?t:e.length},tokenizer(t){const n=we.exec(t);if(null!==n)return{type:"html",raw:n[0],text:e(!1,n[1])}}}])(l);n.marked.use({extensions:e})}return n.marked.parse(be(e,t))},Ee=({key:e,keyword:t,pos:n,limit:o})=>{const l=new URLSearchParams("media_filter=minimal");return l.set("key",e||"PAY5JLFIH6V6"),l.set("limit",(o||20).toString()),l.set("pos",n||""),l.set("q",t),fetch(`https://g.tenor.com/v1/search?${l.toString()}`,{headers:{"Content-Type":"application/json"}}).then((e=>e.json()))};let Be=null;const Ve=()=>Be||(Be=$("USER_KEY",{}));let Ne=null;const Se=()=>Ne||(Ne=$("WALIKE_LIKE",[]));var $e=(e,t)=>{const n=e.__vccOpts||e;for(const[e,o]of t)n[e]=o;return n};const Ie=e.defineComponent({name:"CommentBox",components:{CloseIcon:({size:t})=>e.h("svg",{class:"wl-close-icon",viewBox:"0 0 1024 1024",width:t,height:t},[e.h("path",{d:"M697.173 85.333h-369.92c-144.64 0-241.92 101.547-241.92 252.587v348.587c0 150.613 97.28 252.16 241.92 252.16h369.92c144.64 0 241.494-101.547 241.494-252.16V337.92c0-151.04-96.854-252.587-241.494-252.587z",fill:"currentColor"}),e.h("path",{d:"m640.683 587.52-75.947-75.861 75.904-75.862a37.29 37.29 0 0 0 0-52.778 37.205 37.205 0 0 0-52.779 0l-75.946 75.818-75.862-75.946a37.419 37.419 0 0 0-52.821 0 37.419 37.419 0 0 0 0 52.821l75.947 75.947-75.776 75.733a37.29 37.29 0 1 0 52.778 52.821l75.776-75.776 75.947 75.947a37.376 37.376 0 0 0 52.779-52.821z",fill:"#888"})]),EmojiIcon:()=>e.h("svg",{viewBox:"0 0 1024 1024",width:"24",height:"24"},e.h("path",{d:"M563.2 463.3 677 540c1.7 1.2 3.7 1.8 5.8 1.8.7 0 1.4-.1 2-.2 2.7-.5 5.1-2.1 6.6-4.4l25.3-37.8c1.5-2.3 2.1-5.1 1.6-7.8s-2.1-5.1-4.4-6.6l-73.6-49.1 73.6-49.1c2.3-1.5 3.9-3.9 4.4-6.6.5-2.7 0-5.5-1.6-7.8l-25.3-37.8a10.1 10.1 0 0 0-6.6-4.4c-.7-.1-1.3-.2-2-.2-2.1 0-4.1.6-5.8 1.8l-113.8 76.6c-9.2 6.2-14.7 16.4-14.7 27.5.1 11 5.5 21.3 14.7 27.4zM387 348.8h-45.5c-5.7 0-10.4 4.7-10.4 10.4v153.3c0 5.7 4.7 10.4 10.4 10.4H387c5.7 0 10.4-4.7 10.4-10.4V359.2c0-5.7-4.7-10.4-10.4-10.4zm333.8 241.3-41-20a10.3 10.3 0 0 0-8.1-.5c-2.6.9-4.8 2.9-5.9 5.4-30.1 64.9-93.1 109.1-164.4 115.2-5.7.5-9.9 5.5-9.5 11.2l3.9 45.5c.5 5.3 5 9.5 10.3 9.5h.9c94.8-8 178.5-66.5 218.6-152.7 2.4-5 .3-11.2-4.8-13.6zm186-186.1c-11.9-42-30.5-81.4-55.2-117.1-24.1-34.9-53.5-65.6-87.5-91.2-33.9-25.6-71.5-45.5-111.6-59.2-41.2-14-84.1-21.1-127.8-21.1h-1.2c-75.4 0-148.8 21.4-212.5 61.7-63.7 40.3-114.3 97.6-146.5 165.8-32.2 68.1-44.3 143.6-35.1 218.4 9.3 74.8 39.4 145 87.3 203.3.1.2.3.3.4.5l36.2 38.4c1.1 1.2 2.5 2.1 3.9 2.6 73.3 66.7 168.2 103.5 267.5 103.5 73.3 0 145.2-20.3 207.7-58.7 37.3-22.9 70.3-51.5 98.1-85 27.1-32.7 48.7-69.5 64.2-109.1 15.5-39.7 24.4-81.3 26.6-123.8 2.4-43.6-2.5-87-14.5-129zm-60.5 181.1c-8.3 37-22.8 72-43 104-19.7 31.1-44.3 58.6-73.1 81.7-28.8 23.1-61 41-95.7 53.4-35.6 12.7-72.9 19.1-110.9 19.1-82.6 0-161.7-30.6-222.8-86.2l-34.1-35.8c-23.9-29.3-42.4-62.2-55.1-97.7-12.4-34.7-18.8-71-19.2-107.9-.4-36.9 5.4-73.3 17.1-108.2 12-35.8 30-69.2 53.4-99.1 31.7-40.4 71.1-72 117.2-94.1 44.5-21.3 94-32.6 143.4-32.6 49.3 0 97 10.8 141.8 32 34.3 16.3 65.3 38.1 92 64.8 26.1 26 47.5 56 63.6 89.2 16.2 33.2 26.6 68.5 31 105.1 4.6 37.5 2.7 75.3-5.6 112.3z",fill:"currentColor"})),ImageIcon:()=>e.h("svg",{viewBox:"0 0 1024 1024",width:"24",height:"24"},[e.h("path",{d:"M784 112H240c-88 0-160 72-160 160v480c0 88 72 160 160 160h544c88 0 160-72 160-160V272c0-88-72-160-160-160zm96 640c0 52.8-43.2 96-96 96H240c-52.8 0-96-43.2-96-96V272c0-52.8 43.2-96 96-96h544c52.8 0 96 43.2 96 96v480z",fill:"currentColor"}),e.h("path",{d:"M352 480c52.8 0 96-43.2 96-96s-43.2-96-96-96-96 43.2-96 96 43.2 96 96 96zm0-128c17.6 0 32 14.4 32 32s-14.4 32-32 32-32-14.4-32-32 14.4-32 32-32zm462.4 379.2-3.2-3.2-177.6-177.6c-25.6-25.6-65.6-25.6-91.2 0l-80 80-36.8-36.8c-25.6-25.6-65.6-25.6-91.2 0L200 728c-4.8 6.4-8 14.4-8 24 0 17.6 14.4 32 32 32 9.6 0 16-3.2 22.4-9.6L380.8 640l134.4 134.4c6.4 6.4 14.4 9.6 24 9.6 17.6 0 32-14.4 32-32 0-9.6-4.8-17.6-9.6-24l-52.8-52.8 80-80L769.6 776c6.4 4.8 12.8 8 20.8 8 17.6 0 32-14.4 32-32 0-8-3.2-16-8-20.8z",fill:"currentColor"})]),MarkdownIcon:()=>e.h("svg",{width:"16",height:"16",ariaHidden:"true"},e.h("path",{d:"M14.85 3H1.15C.52 3 0 3.52 0 4.15v7.69C0 12.48.52 13 1.15 13h13.69c.64 0 1.15-.52 1.15-1.15v-7.7C16 3.52 15.48 3 14.85 3zM9 11H7V8L5.5 9.92 4 8v3H2V5h2l1.5 2L7 5h2v6zm2.99.5L9.5 8H11V5h2v3h1.5l-2.51 3.5z",fill:"currentColor"})),PreviewIcon:()=>e.h("svg",{viewBox:"0 0 1024 1024",width:"24",height:"24"},[e.h("path",{d:"M710.816 654.301c70.323-96.639 61.084-230.578-23.705-314.843-46.098-46.098-107.183-71.109-172.28-71.109-65.008 0-126.092 25.444-172.28 71.109-45.227 46.098-70.756 107.183-70.756 172.106 0 64.923 25.444 126.007 71.194 172.106 46.099 46.098 107.184 71.109 172.28 71.109 51.414 0 100.648-16.212 142.824-47.404l126.53 126.006c7.058 7.06 16.297 10.979 26.406 10.979 10.105 0 19.343-3.919 26.402-10.979 14.467-14.467 14.467-38.172 0-52.723L710.816 654.301zm-315.107-23.265c-65.88-65.88-65.88-172.54 0-238.42 32.069-32.07 74.245-49.149 119.471-49.149 45.227 0 87.407 17.603 119.472 49.149 65.88 65.879 65.88 172.539 0 238.42-63.612 63.178-175.242 63.178-238.943 0zm0 0",fill:"currentColor"}),e.h("path",{d:"M703.319 121.603H321.03c-109.8 0-199.469 89.146-199.469 199.38v382.034c0 109.796 89.236 199.38 199.469 199.38h207.397c20.653 0 37.384-16.645 37.384-37.299 0-20.649-16.731-37.296-37.384-37.296H321.03c-68.582 0-124.352-55.77-124.352-124.267V321.421c0-68.496 55.77-124.267 124.352-124.267h382.289c68.582 0 124.352 55.771 124.352 124.267V524.72c0 20.654 16.736 37.299 37.385 37.299 20.654 0 37.384-16.645 37.384-37.299V320.549c-.085-109.8-89.321-198.946-199.121-198.946zm0 0",fill:"currentColor"})]),LoadingIcon:U,GifIcon:()=>e.h("svg",{width:24,height:24,fill:"currentcolor",viewBox:"0 0 24 24"},[e.h("path",{style:"transform: translateY(0.5px)",d:"M18.968 10.5H15.968V11.484H17.984V12.984H15.968V15H14.468V9H18.968V10.5V10.5ZM8.984 9C9.26533 9 9.49967 9.09367 9.687 9.281C9.87433 9.46833 9.968 9.70267 9.968 9.984V10.5H6.499V13.5H8.468V12H9.968V14.016C9.968 14.2973 9.87433 14.5317 9.687 14.719C9.49967 14.9063 9.26533 15 8.984 15H5.984C5.70267 15 5.46833 14.9063 5.281 14.719C5.09367 14.5317 5 14.2973 5 14.016V9.985C5 9.70367 5.09367 9.46933 5.281 9.282C5.46833 9.09467 5.70267 9.001 5.984 9.001H8.984V9ZM11.468 9H12.968V15H11.468V9V9Z"}),e.h("path",{d:"M18.5 3H5.75C3.6875 3 2 4.6875 2 6.75V18C2 20.0625 3.6875 21.75 5.75 21.75H18.5C20.5625 21.75 22.25 20.0625 22.25 18V6.75C22.25 4.6875 20.5625 3 18.5 3ZM20.75 18C20.75 19.2375 19.7375 20.25 18.5 20.25H5.75C4.5125 20.25 3.5 19.2375 3.5 18V6.75C3.5 5.5125 4.5125 4.5 5.75 4.5H18.5C19.7375 4.5 20.75 5.5125 20.75 6.75V18Z"})])},props:{rootId:{type:String,default:""},replyId:{type:String,default:""},replyUser:{type:String,default:""}},emits:["submit","cancel-reply"],setup(t,{emit:n}){const o=e.inject("config"),a=$("WALINE_COMMENT_BOX_EDITOR",""),r=$("WALINE_USER_META",{nick:"",mail:"",link:""}),i=Ve(),c=e.ref({}),s=e.ref(null),m=e.ref(null),u=e.ref(null),d=e.ref(null),p=e.ref(null),v=e.ref(null),f=e.ref(null),g=e.ref({tabs:[],map:{}}),h=e.ref(0),y=e.ref(!1),w=e.ref(!1),k=e.ref(!1),b=e.ref(""),C=e.ref(0),E=e.ref({cursor:"",loading:!0,list:[]}),B=e.ref(0),V=e.ref(!1),N=e.ref(""),S=e.ref(!1),I=e.computed((()=>o.value.locale)),x=e.computed((()=>Boolean(i.value?.token))),L=e.computed((()=>!1!==o.value.imageUploader)),j=e=>{const t=s.value,n=t.selectionStart,o=t.selectionEnd||0,l=t.scrollTop;a.value=t.value.substring(0,n)+e+t.value.substring(o,t.value.length),t.focus(),t.selectionStart=n+e.length,t.selectionEnd=n+e.length,t.scrollTop=l},R=e=>{const t=`![${o.value.locale.uploading} ${e.name}]()`;return j(t),Promise.resolve().then((()=>o.value.imageUploader(e))).then((n=>{a.value=a.value.replace(t,`\r\n![${e.name}](${n})`)}))},z=()=>{const{serverURL:e,lang:l,login:m,wordLimit:u,requiredMeta:d}=o.value,p={comment:N.value,nick:r.value.nick,mail:r.value.mail,link:r.value.link,ua:navigator.userAgent,url:o.value.path};if(i.value?.token)p.nick=i.value.display_name,p.mail=i.value.email,p.link=i.value.url;else{if("force"===m)return;if(d.indexOf("nick")>-1&&!p.nick)return c.value.nick?.focus(),alert(I.value.nickError);if(d.indexOf("mail")>-1&&!p.mail||p.mail&&!/^\w(?:[\w._-]*\w)?@(?:\w(?:[\w-]*\w)?\.)*\w+$/.exec(p.mail))return c.value.mail?.focus(),alert(I.value.mailError);if(!p.comment)return void s.value?.focus();p.nick||(p.nick=I.value.anonymous)}if(!V.value)return alert(I.value.wordHint.replace("$0",u[0].toString()).replace("$1",u[1].toString()).replace("$2",C.value.toString()));p.comment=be(p.comment,g.value.map),t.replyId&&t.rootId&&(p.pid=t.replyId,p.rid=t.rootId,p.at=t.replyUser),S.value=!0,(({serverURL:e,lang:t,token:n,comment:o})=>{const l={"Content-Type":"application/json"};return n&&(l.Authorization=`Bearer ${n}`),fetch(`${e}/comment?lang=${t}`,{method:"POST",headers:l,body:JSON.stringify(o)}).then((e=>e.json()))})({serverURL:e,lang:l,token:i.value?.token,comment:p}).then((e=>{if(S.value=!1,e.errmsg)return alert(e.errmsg);n("submit",e.data),a.value="",b.value="",t.replyId&&n("cancel-reply")})).catch((e=>{S.value=!1,alert(e.message)}))},D=e=>{u.value.contains(e.target)||d.value.contains(e.target)||(y.value=!1),p.value.contains(e.target)||v.value.contains(e.target)||(w.value=!1)},M=function(e,t=300){let n;return(...o)=>{n&&clearTimeout(n),n=window.setTimeout((()=>{e(...o),n=null}),t)}}((async e=>{E.value.cursor="",E.value.list=[],A(e)})),A=async e=>{const{scrollTop:t,clientHeight:n,scrollHeight:o}=e.target;if((n+t)/o<.9||E.value.loading)return;E.value.loading=!0;const l=await Ee({keyword:f.value?.value||"",pos:E.value.cursor}).finally((()=>{E.value.loading=!1}));E.value.cursor=l.next,E.value.list=E.value.list.concat(l.results),setTimeout((()=>{e.target.scrollTop=t}),50)};return e.watch([o,C],(([e,t])=>{const{wordLimit:n}=e;n?t<n[0]&&0!==n[0]?(B.value=n[0],V.value=!1):t>n[1]?(B.value=n[1],V.value=!1):(B.value=n[1],V.value=!0):(B.value=0,V.value=!0)}),{immediate:!0}),e.watch([w],(async([e])=>{if(!e)return;E.value.loading=!0;const t=await Ee({keyword:""}).finally((()=>{E.value.loading=!1}));E.value.cursor=t.next,E.value.list=E.value.list.concat(t.results)})),e.onMounted((()=>{document.body.addEventListener("click",D),e.watch((()=>a.value),(e=>{const{highlighter:t,texRenderer:n}=o.value;N.value=e,b.value=Ce(e,{emojiMap:g.value.map,highlighter:t,texRenderer:n}),C.value=(e=>(e=>e.match(/[\w\d\s\u00C0-\u024F]+/giu)||[])(e).reduce(((e,t)=>e+(""===t.trim()?0:t.trim().split(/\s+/u).length)),0)+(e=>e.match(/[\u4E00-\u9FA5]/gu)||[])(e).length)(e),e?l.default(s.value):l.default.destroy(s.value)}),{immediate:!0}),e.watch((()=>o.value.emoji),(e=>{return(t=Array.isArray(e)?e:[],Promise.all(t.map((e=>"string"==typeof e?ue(oe(e)):Promise.resolve(e)))).then((e=>{const t={tabs:[],map:{}};return e.forEach((e=>{const{name:n,folder:o,icon:l,prefix:a,type:r,items:i}=e;t.tabs.push({name:n,icon:de(l,o,a,r),items:i.map((e=>{const n=`${a||""}${e}`;return t.map[n]=de(e,o,a,r),n}))})})),t}))).then((e=>{g.value=e}));var t}),{immediate:!0})})),e.onUnmounted((()=>{document.body.removeEventListener("click",D)})),{config:o,locale:I,insert:j,onChange:()=>{const e=m.value;e.files&&L.value&&R(e.files[0]).then((()=>{e.value=""}))},onDrop:e=>{if(e.dataTransfer?.items){const t=he(e.dataTransfer.items);t&&L.value&&(R(t),e.preventDefault())}},onKeyDown:e=>{const t=e.key;(e.ctrlKey||e.metaKey)&&"Enter"===t&&z()},onPaste:e=>{if(e.clipboardData){const t=he(e.clipboardData.items);t&&L.value&&R(t)}},onLogin:e=>{e.preventDefault();const{lang:t,serverURL:n}=o.value,l=(window.innerWidth-450)/2,a=(window.innerHeight-450)/2,r=window.open(`${n}/ui/login?lng=${encodeURIComponent(t)}`,"_blank",`width=450,height=450,left=${l},top=${a},scrollbars=no,resizable=no,status=no,location=no,toolbar=no,menubar=no`);r?.postMessage({type:"TOKEN",data:null},"*");const c=({data:e})=>{e&&"userInfo"===e.type&&e.data.token&&(r?.close(),i.value=e.data,(e.data.remember?localStorage:sessionStorage).setItem("WALINE_USER",JSON.stringify(e.data)),window.removeEventListener("message",c))};window.addEventListener("message",c)},onLogout:()=>{i.value={},localStorage.setItem("WALINE_USER","null"),sessionStorage.setItem("WALINE_USER","null")},onProfile:e=>{e.preventDefault();const{lang:t,serverURL:n}=o.value,l=(window.innerWidth-800)/2,a=(window.innerHeight-800)/2;window.open(`${n}/ui/profile?lng=${encodeURIComponent(t)}`,"_blank",`width=800,height=800,left=${l},top=${a},scrollbars=no,resizable=no,status=no,location=no,toolbar=no,menubar=no`)?.postMessage({type:"TOKEN",data:i.value.token},"*");const r=({data:e})=>{e&&"profile"===e.type&&(i.value={...i.value,...e},[localStorage,sessionStorage].filter((e=>e.getItem("WALINE_USER"))).forEach((e=>e.setItem("WALINE_USER",JSON.stringify(i)))),window.removeEventListener("message",r))};window.addEventListener("message",r)},submitComment:z,onGifMasonryScroll:A,onGifSearch:M,isLogin:x,userInfo:i,isSubmitting:S,wordNumber:C,wordLimit:B,isWordNumberLegal:V,editor:a,userMeta:r,emoji:g,emojiTabIndex:h,showEmoji:y,showGif:w,canUploadImage:L,previewText:b,showPreview:k,inputRefs:c,editorRef:s,emojiButtonRef:u,emojiPopupRef:d,gifButtonRef:p,gifPopupRef:v,imageUploadRef:m,gifSearchInputRef:f,gifData:E}}}),xe={class:"wl-comment"},Le={key:0,class:"wl-login-info"},je={class:"wl-avatar"},Re=["title"],ze=["src"],De=["textContent"],Me={class:"wl-panel"},Ae=["for","textContent"],Ue=["id","name","type","onUpdate:modelValue"],Oe=["placeholder"],Pe={class:"wl-preview"},Te=e.createElementVNode("hr",null,null,-1),Fe=["innerHTML"],He={class:"wl-footer"},_e={class:"wl-actions"},We={href:"https://guides.github.com/features/mastering-markdown/",title:"Markdown Guide","aria-label":"Markdown is supported",class:"wl-action",target:"_blank",rel:"noreferrer"},Ge=["title"],qe=["title"],Je=["title"],Ke=["title"],Ye={class:"wl-info"},Ze={class:"wl-text-number"},Xe={key:0},Qe=e.createTextVNode("  /  "),et=["textContent"],tt=["textContent"],nt=["disabled"],ot=["placeholder"],lt=["onClick","src","title"],at={key:0,class:"wl-loading"},rt={key:0,class:"wl-tab-wrapper"},it=["title","onClick"],ct=["src","alt"],st={key:0,class:"wl-tabs"},mt=["onClick"],ut=["src","alt","title"],dt=["title"];var pt=$e(Ie,[["render",function(t,n,o,l,a,r){const i=e.resolveComponent("CloseIcon"),c=e.resolveComponent("MarkdownIcon"),s=e.resolveComponent("EmojiIcon"),m=e.resolveComponent("GifIcon"),u=e.resolveComponent("ImageIcon"),d=e.resolveComponent("PreviewIcon"),p=e.resolveComponent("LoadingIcon"),v=e.resolveComponent("masonry-wall");return e.openBlock(),e.createElementBlock("div",xe,["disable"!==t.config.login&&t.isLogin?(e.openBlock(),e.createElementBlock("div",Le,[e.createElementVNode("div",je,[e.createElementVNode("button",{class:"wl-logout-btn",title:t.locale.logout,onClick:n[0]||(n[0]=(...e)=>t.onLogout&&t.onLogout(...e))},[e.createVNode(i,{size:14})],8,Re),e.createElementVNode("img",{src:t.userInfo.avatar,alt:"avatar"},null,8,ze)]),e.createElementVNode("a",{href:"#",class:"wl-login-nick","aria-label":"Profile",onClick:n[1]||(n[1]=(...e)=>t.onProfile&&t.onProfile(...e)),textContent:e.toDisplayString(t.userInfo.display_name)},null,8,De)])):e.createCommentVNode("v-if",!0),e.createElementVNode("div",Me,["force"!==t.config.login&&t.config.meta.length&&!t.isLogin?(e.openBlock(),e.createElementBlock("div",{key:0,class:e.normalizeClass(["wl-header",`item${t.config.meta.length}`])},[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(t.config.meta,(n=>(e.openBlock(),e.createElementBlock("div",{class:"wl-header-item",key:n},[e.createElementVNode("label",{for:n,textContent:e.toDisplayString(t.locale[n]+(t.config.requiredMeta.includes(n)||!t.config.requiredMeta.length?"":`(${t.locale.optional})`))},null,8,Ae),e.withDirectives(e.createElementVNode("input",{ref_for:!0,ref:e=>{e&&(t.inputRefs[n]=e)},id:`wl-${n}`,class:e.normalizeClass(["wl-input",`wl-${n}`]),name:n,type:"mail"===n?"email":"text","onUpdate:modelValue":e=>t.userMeta[n]=e},null,10,Ue),[[e.vModelDynamic,t.userMeta[n]]])])))),128))],2)):e.createCommentVNode("v-if",!0),e.withDirectives(e.createElementVNode("textarea",{class:"wl-editor",ref:"editorRef",id:"wl-edit",placeholder:t.replyUser?`@${t.replyUser}`:t.locale.placeholder,"onUpdate:modelValue":n[2]||(n[2]=e=>t.editor=e),onKeydown:n[3]||(n[3]=(...e)=>t.onKeyDown&&t.onKeyDown(...e)),onDrop:n[4]||(n[4]=(...e)=>t.onDrop&&t.onDrop(...e)),onPaste:n[5]||(n[5]=(...e)=>t.onPaste&&t.onPaste(...e))},null,40,Oe),[[e.vModelText,t.editor]]),e.withDirectives(e.createElementVNode("div",Pe,[Te,e.createElementVNode("h4",null,e.toDisplayString(t.locale.preview)+":",1),e.createElementVNode("div",{class:"wl-content",innerHTML:t.previewText},null,8,Fe)],512),[[e.vShow,t.showPreview]]),e.createElementVNode("div",He,[e.createElementVNode("div",_e,[e.createElementVNode("a",We,[e.createVNode(c)]),e.withDirectives(e.createElementVNode("button",{ref:"emojiButtonRef",class:e.normalizeClass(["wl-action",{actived:t.showEmoji}]),title:t.locale.emoji,onClick:n[6]||(n[6]=e=>t.showEmoji=!t.showEmoji)},[e.createVNode(s)],10,Ge),[[e.vShow,t.emoji.tabs.length]]),e.createElementVNode("button",{ref:"gifButtonRef",class:e.normalizeClass(["wl-action",{actived:t.showGif}]),title:t.locale.gif,onClick:n[7]||(n[7]=e=>t.showGif=!t.showGif)},[e.createVNode(m)],10,qe),e.createElementVNode("input",{ref:"imageUploadRef",class:"upload",id:"wl-image-upload",type:"file",accept:".png,.jpg,.jpeg,.webp,.bmp,.gif",onChange:n[8]||(n[8]=(...e)=>t.onChange&&t.onChange(...e))},null,544),t.canUploadImage?(e.openBlock(),e.createElementBlock("label",{key:0,for:"wl-image-upload",class:"wl-action",title:t.locale.uploadImage},[e.createVNode(u)],8,Je)):e.createCommentVNode("v-if",!0),e.createElementVNode("button",{class:e.normalizeClass(["wl-action",{actived:t.showPreview}]),title:t.locale.preview,onClick:n[9]||(n[9]=e=>t.showPreview=!t.showPreview)},[e.createVNode(d)],10,Ke)]),e.createElementVNode("div",Ye,[e.createElementVNode("div",Ze,[e.createTextVNode(e.toDisplayString(t.wordNumber)+" ",1),t.config.wordLimit?(e.openBlock(),e.createElementBlock("span",Xe,[Qe,e.createElementVNode("span",{class:e.normalizeClass({illegal:!t.isWordNumberLegal}),textContent:e.toDisplayString(t.wordLimit)},null,10,et)])):e.createCommentVNode("v-if",!0),e.createTextVNode("  "+e.toDisplayString(t.locale.word),1)]),"disable"===t.config.login||t.isLogin?e.createCommentVNode("v-if",!0):(e.openBlock(),e.createElementBlock("button",{key:0,class:"wl-btn",onClick:n[10]||(n[10]=(...e)=>t.onLogin&&t.onLogin(...e)),textContent:e.toDisplayString(t.locale.login)},null,8,tt)),"force"!==t.config.login||t.isLogin?(e.openBlock(),e.createElementBlock("button",{key:1,class:"wl-btn primary",title:"Cmd|Ctrl + Enter",disabled:t.isSubmitting,onClick:n[11]||(n[11]=(...e)=>t.submitComment&&t.submitComment(...e))},[t.isSubmitting?(e.openBlock(),e.createBlock(p,{key:0,size:16})):(e.openBlock(),e.createElementBlock(e.Fragment,{key:1},[e.createTextVNode(e.toDisplayString(t.locale.submit),1)],2112))],8,nt)):e.createCommentVNode("v-if",!0)]),e.createElementVNode("div",{ref:"gifPopupRef",class:e.normalizeClass(["wl-gif-popup",{display:t.showGif}])},[e.createElementVNode("input",{type:"text",placeholder:t.locale.gifSearchPlaceholder,ref:"gifSearchInputRef",onInput:n[12]||(n[12]=(...e)=>t.onGifSearch&&t.onGifSearch(...e))},null,40,ot),e.createVNode(v,{class:"wl-gif-waterfall",items:t.gifData.list,"ssr-columns":2,"column-width":200,gap:6,onScroll:t.onGifMasonryScroll},{default:e.withCtx((({item:n})=>[e.createElementVNode("img",{onClick:e=>t.insert(`![](${n.media[0].tinygif.url})`),src:n.media[0].tinygif.url,title:n.title,loading:"lazy",style:e.normalizeStyle({width:"200px",height:200*n.media[0].tinygif.dims[1]/n.media[0].tinygif.dims[0]+"px"})},null,12,lt)])),_:1},8,["items","onScroll"]),t.gifData.loading?(e.openBlock(),e.createElementBlock("div",at,[e.createVNode(p,{size:30})])):e.createCommentVNode("v-if",!0)],2),e.createElementVNode("div",{ref:"emojiPopupRef",class:e.normalizeClass(["wl-emoji-popup",{display:t.showEmoji}])},[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(t.emoji.tabs,((n,o)=>(e.openBlock(),e.createElementBlock(e.Fragment,{key:n.name},[o===t.emojiTabIndex?(e.openBlock(),e.createElementBlock("div",rt,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(n.items,(n=>(e.openBlock(),e.createElementBlock("button",{key:n,title:n,onClick:e=>t.insert(`:${n}:`)},[t.showEmoji?(e.openBlock(),e.createElementBlock("img",{key:0,class:"wl-emoji",src:t.emoji.map[n],alt:n,loading:"lazy",referrerPolicy:"no-referrer"},null,8,ct)):e.createCommentVNode("v-if",!0)],8,it)))),128))])):e.createCommentVNode("v-if",!0)],64)))),128)),t.emoji.tabs.length>1?(e.openBlock(),e.createElementBlock("div",st,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(t.emoji.tabs,((n,o)=>(e.openBlock(),e.createElementBlock("button",{key:n.name,class:e.normalizeClass(["wl-tab",{active:t.emojiTabIndex===o}]),onClick:e=>t.emojiTabIndex=o},[e.createElementVNode("img",{class:"wl-emoji",src:n.icon,alt:n.name,title:n.name,loading:"lazy",referrerPolicy:"no-referrer"},null,8,ut)],10,mt)))),128))])):e.createCommentVNode("v-if",!0)],2)])]),t.replyId?(e.openBlock(),e.createElementBlock("button",{key:1,class:"wl-close",title:t.locale.cancelReply,onClick:n[13]||(n[13]=e=>t.$emit("cancel-reply"))},[e.createVNode(i,{size:24})],8,dt)):e.createCommentVNode("v-if",!0)])}],["__file","CommentBox.vue"]]);const vt=["approved","waiting","spam"],ft=e.defineComponent({props:{comment:{type:Object,required:!0},rootId:{type:String,required:!0},reply:{type:Object}},components:{CommentBox:pt,DeleteIcon:()=>e.h("svg",{viewBox:"0 0 1024 1024",width:"24",height:"24"},e.h("path",{d:"m341.013 394.667 27.755 393.45h271.83l27.733-393.45h64.106l-28.01 397.952a64 64 0 0 1-63.83 59.498H368.768a64 64 0 0 1-63.83-59.52l-28.053-397.93h64.128zm139.307 19.818v298.667h-64V414.485h64zm117.013 0v298.667h-64V414.485h64zM181.333 288h640v64h-640v-64zm453.483-106.667v64h-256v-64h256z",fill:"red"})),LikeIcon:({active:t=!1})=>e.h("svg",{viewBox:"0 0 1024 1024",width:"24",height:"24"},[e.h("path",{d:"M850.654 323.804c-11.042-25.625-26.862-48.532-46.885-68.225-20.022-19.61-43.258-34.936-69.213-45.73-26.78-11.124-55.124-16.727-84.375-16.727-40.622 0-80.256 11.123-114.698 32.135A214.79 214.79 0 0 0 512 241.819a214.79 214.79 0 0 0-23.483-16.562c-34.442-21.012-74.076-32.135-114.698-32.135-29.25 0-57.595 5.603-84.375 16.727-25.872 10.711-49.19 26.12-69.213 45.73-20.105 19.693-35.843 42.6-46.885 68.225-11.453 26.615-17.303 54.877-17.303 83.963 0 27.439 5.603 56.03 16.727 85.117 9.31 24.307 22.659 49.52 39.715 74.981 27.027 40.293 64.188 82.316 110.33 124.915 76.465 70.615 152.189 119.394 155.402 121.371l19.528 12.525c8.652 5.52 19.776 5.52 28.427 0l19.529-12.525c3.213-2.06 78.854-50.756 155.401-121.371 46.143-42.6 83.304-84.622 110.33-124.915 17.057-25.46 30.487-50.674 39.716-74.981 11.124-29.087 16.727-57.678 16.727-85.117.082-29.086-5.768-57.348-17.221-83.963z"+(t?"":"M512 761.5S218.665 573.55 218.665 407.767c0-83.963 69.461-152.023 155.154-152.023 60.233 0 112.473 33.618 138.181 82.727 25.708-49.109 77.948-82.727 138.18-82.727 85.694 0 155.155 68.06 155.155 152.023C805.335 573.551 512 761.5 512 761.5z"),fill:t?"red":"currentColor"})]),ReplyIcon:()=>e.h("svg",{viewBox:"0 0 1024 1024",width:"24",height:"24"},e.h("path",{d:"M810.667 213.333a64 64 0 0 1 64 64V704a64 64 0 0 1-64 64H478.336l-146.645 96.107a21.333 21.333 0 0 1-33.024-17.856V768h-85.334a64 64 0 0 1-64-64V277.333a64 64 0 0 1 64-64h597.334zm0 64H213.333V704h149.334v63.296L459.243 704h351.424V277.333zm-271.36 213.334v64h-176.64v-64h176.64zm122.026-128v64H362.667v-64h298.666z",fill:"currentColor"})),VerifiedIcon:()=>e.h("svg",{class:"verified-icon",viewBox:"0 0 1024 1024",width:"14",height:"14"},e.h("path",{d:"m894.4 461.56-54.4-63.2c-10.4-12-18.8-34.4-18.8-50.4v-68c0-42.4-34.8-77.2-77.2-77.2h-68c-15.6 0-38.4-8.4-50.4-18.8l-63.2-54.4c-27.6-23.6-72.8-23.6-100.8 0l-62.8 54.8c-12 10-34.8 18.4-50.4 18.4h-69.2c-42.4 0-77.2 34.8-77.2 77.2v68.4c0 15.6-8.4 38-18.4 50l-54 63.6c-23.2 27.6-23.2 72.4 0 100l54 63.6c10 12 18.4 34.4 18.4 50v68.4c0 42.4 34.8 77.2 77.2 77.2h69.2c15.6 0 38.4 8.4 50.4 18.8l63.2 54.4c27.6 23.6 72.8 23.6 100.8 0l63.2-54.4c12-10.4 34.4-18.8 50.4-18.8h68c42.4 0 77.2-34.8 77.2-77.2v-68c0-15.6 8.4-38.4 18.8-50.4l54.4-63.2c23.2-27.6 23.2-73.2-.4-100.8zm-216-25.2-193.2 193.2a30 30 0 0 1-42.4 0l-96.8-96.8a30.16 30.16 0 0 1 0-42.4c11.6-11.6 30.8-11.6 42.4 0l75.6 75.6 172-172c11.6-11.6 30.8-11.6 42.4 0 11.6 11.6 11.6 30.8 0 42.4z",fill:"#27ae60"}))},emits:["submit","reply","like","delete","status","sticky"],setup(t){const n=e.inject("config"),o=Se(),l=Ve(),a=e.computed((()=>n.value.locale)),r=e.computed((()=>{let{link:e}=t.comment;return e?le(e)?e:`https://${e}`:""})),i=e.computed((()=>o.value.includes(t.comment.objectId))),c=((t,n)=>{const o=M();return e.computed((()=>me(t,o.value,n)))})(t.comment.insertedAt,a.value),s=e.computed((()=>"administrator"===l.value.type)),m=e.computed((()=>t.comment.user_id&&l.value.objectId===t.comment.user_id)),u=e.computed((()=>t.comment.objectId===t.reply?.objectId));return{config:n,locale:a,isReplyingCurrent:u,link:r,like:i,time:c,isAdmin:s,isOwner:m,commentStatus:vt}}}),gt=["id"],ht={class:"wl-user","aria-hidden":"true"},yt=["src"],wt={class:"wl-card"},kt={class:"wl-head"},bt=["href"],Ct={key:1,class:"wl-nick"},Et=["textContent"],Bt=["textContent"],Vt=["textContent"],Nt=["textContent"],St=["textContent"],$t={class:"wl-comment-actions"},It=["title"],xt=["textContent"],Lt=["title"],jt={class:"wl-meta","aria-hidden":"true"},Rt=["textContent"],zt=["textContent"],Dt=["textContent"],Mt=["innerHTML"],At={key:0,class:"wl-admin-actions"},Ut={class:"wl-comment-status"},Ot=["disabled","onClick","textContent"],Pt={key:1,class:"wl-reply-wrapper"},Tt={key:2,class:"wl-quote"};var Ft=$e(ft,[["render",function(t,n,o,l,a,r){const i=e.resolveComponent("VerifiedIcon"),c=e.resolveComponent("DeleteIcon"),s=e.resolveComponent("LikeIcon"),m=e.resolveComponent("ReplyIcon"),u=e.resolveComponent("CommentBox"),d=e.resolveComponent("CommentCard",!0);return e.openBlock(),e.createElementBlock("div",{class:"wl-item",id:t.comment.objectId},[e.createElementVNode("div",ht,[t.comment.avatar?(e.openBlock(),e.createElementBlock("img",{key:0,src:t.comment.avatar},null,8,yt)):e.createCommentVNode("v-if",!0),t.comment.type?(e.openBlock(),e.createBlock(i,{key:1})):e.createCommentVNode("v-if",!0)]),e.createElementVNode("div",wt,[e.createElementVNode("div",kt,[t.link?(e.openBlock(),e.createElementBlock("a",{key:0,class:"wl-nick",href:t.link,target:"_blank",rel:"nofollow noreferrer"},e.toDisplayString(t.comment.nick),9,bt)):(e.openBlock(),e.createElementBlock("span",Ct,e.toDisplayString(t.comment.nick),1)),"administrator"===t.comment.type?(e.openBlock(),e.createElementBlock("span",{key:2,class:"wl-badge",textContent:e.toDisplayString(t.locale.admin)},null,8,Et)):e.createCommentVNode("v-if",!0),t.comment.label?(e.openBlock(),e.createElementBlock("span",{key:3,class:"wl-badge",textContent:e.toDisplayString(t.comment.label)},null,8,Bt)):e.createCommentVNode("v-if",!0),t.comment.sticky?(e.openBlock(),e.createElementBlock("span",{key:4,class:"wl-badge",textContent:e.toDisplayString(t.locale.sticky)},null,8,Vt)):e.createCommentVNode("v-if",!0),t.comment.level&&t.comment.level>=0?(e.openBlock(),e.createElementBlock("span",{key:5,class:e.normalizeClass(`wl-badge level${t.comment.level}`),textContent:e.toDisplayString(t.locale[`level${t.comment.level}`]||`Level ${t.comment.level}`)},null,10,Nt)):e.createCommentVNode("v-if",!0),e.createElementVNode("span",{class:"wl-time",textContent:e.toDisplayString(t.time)},null,8,St),e.createElementVNode("div",$t,[t.isAdmin||t.isOwner?(e.openBlock(),e.createElementBlock("button",{key:0,class:"wl-delete",onClick:n[0]||(n[0]=e=>t.$emit("delete",t.comment))},[e.createVNode(c)])):e.createCommentVNode("v-if",!0),e.createElementVNode("button",{class:"wl-like",onClick:n[1]||(n[1]=e=>t.$emit("like",t.comment)),title:t.like?t.locale.cancelLike:t.locale.like},[e.createVNode(s,{active:t.like},null,8,["active"]),"like"in t.comment?(e.openBlock(),e.createElementBlock("span",{key:0,textContent:e.toDisplayString(t.comment.like)},null,8,xt)):e.createCommentVNode("v-if",!0)],8,It),e.createElementVNode("button",{class:e.normalizeClass(["wl-reply",{active:t.isReplyingCurrent}]),title:t.isReplyingCurrent?t.locale.cancelReply:t.locale.reply,onClick:n[2]||(n[2]=e=>t.$emit("reply",t.isReplyingCurrent?null:t.comment))},[e.createVNode(m)],10,Lt)])]),e.createElementVNode("div",jt,[t.comment.addr?(e.openBlock(),e.createElementBlock("span",{key:0,textContent:e.toDisplayString(t.comment.addr)},null,8,Rt)):e.createCommentVNode("v-if",!0),t.comment.browser?(e.openBlock(),e.createElementBlock("span",{key:1,textContent:e.toDisplayString(t.comment.browser)},null,8,zt)):e.createCommentVNode("v-if",!0),t.comment.os?(e.openBlock(),e.createElementBlock("span",{key:2,textContent:e.toDisplayString(t.comment.os)},null,8,Dt)):e.createCommentVNode("v-if",!0)]),e.createElementVNode("div",{class:"wl-content",innerHTML:t.comment.comment},null,8,Mt),t.isAdmin?(e.openBlock(),e.createElementBlock("div",At,[e.createElementVNode("span",Ut,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(t.commentStatus,(n=>(e.openBlock(),e.createElementBlock("button",{key:n,class:e.normalizeClass(`wl-btn wl-${n}`),disabled:t.comment.status===n,onClick:e=>t.$emit("status",{status:n,comment:t.comment}),textContent:e.toDisplayString(n)},null,10,Ot)))),128))]),t.isAdmin&&!t.comment.rid?(e.openBlock(),e.createElementBlock("button",{key:0,class:"wl-btn wl-sticky",onClick:n[3]||(n[3]=e=>t.$emit("sticky",t.comment))},e.toDisplayString(t.comment.sticky?"unsticky":"sticky"),1)):e.createCommentVNode("v-if",!0)])):e.createCommentVNode("v-if",!0),t.isReplyingCurrent?(e.openBlock(),e.createElementBlock("div",Pt,[e.createVNode(u,{replyId:t.comment.objectId,replyUser:t.comment.nick,rootId:t.rootId,onSubmit:n[4]||(n[4]=e=>t.$emit("submit",e)),onCancelReply:n[5]||(n[5]=e=>t.$emit("reply",null))},null,8,["replyId","replyUser","rootId"])])):e.createCommentVNode("v-if",!0),t.comment.children?(e.openBlock(),e.createElementBlock("div",Tt,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(t.comment.children,(o=>(e.openBlock(),e.createBlock(d,{key:o.objectId,comment:o,reply:t.reply,rootId:t.rootId,onReply:n[6]||(n[6]=e=>t.$emit("reply",e)),onSubmit:n[7]||(n[7]=e=>t.$emit("submit",e)),onLike:n[8]||(n[8]=e=>t.$emit("like",e)),onDelete:n[9]||(n[9]=e=>t.$emit("delete",e)),onStatus:n[10]||(n[10]=e=>t.$emit("status",e)),onSticky:n[11]||(n[11]=e=>t.$emit("sticky",e))},null,8,["comment","reply","rootId"])))),128))])):e.createCommentVNode("v-if",!0)])],8,gt)}],["__file","CommentCard.vue"]]);const Ht=e.defineComponent({name:"WalineRoot",components:{CommentBox:pt,CommentCard:Ft,LoadingIcon:U},props:["serverURL","path","meta","requiredMeta","dark","lang","locale","pageSize","wordLimit","emoji","login","highlighter","texRenderer","imageUploader","copyright"],setup(t){const n=e.computed((()=>(({serverURL:e,path:t=location.pathname,lang:n="zh-CN",locale:o,emoji:l=["//unpkg.com/@waline/emojis@1.0.1/weibo"],meta:a=["nick","mail","link"],requiredMeta:r=[],dark:i=!1,pageSize:c=10,wordLimit:s,imageUploader:m,highlighter:u,texRenderer:d,copyright:p=!0,login:v="enable",...f})=>({serverURL:ae(e),path:ne(t),locale:{...te[n]||te["zh-CN"],..."object"==typeof o?o:{}},wordLimit:re(s),meta:P(a),requiredMeta:P(r),imageUploader:ie(m,T),highlighter:ie(u,G),texRenderer:ie(d,F),lang:n,dark:i,emoji:l,pageSize:c,login:v,copyright:p,...f}))(t))),o=Ve(),l=Se(),r=e.ref("loading"),i=e.ref(0),c=e.ref(1),s=e.ref(0),m=e.ref([]),u=e.ref(null),d=e.computed((()=>{return"string"==typeof(e=n.value.dark)?"auto"===e?`@media(prefers-color-scheme:dark){body${ce}}`:`${e}${ce}`:!0===e?`:root${ce}`:"";var e}));let p;!function(t,n={}){const o=e.ref(!1),{document:l=C,immediate:r=!0,manual:i=!1,id:c="vueuse_styletag_"+ ++A}=n,s=e.ref(t);let m=()=>{};const u=()=>{if(!l)return;const t=l.getElementById(c)||l.createElement("style");t.type="text/css",t.id=c,n.media&&(t.media=n.media),l.head.appendChild(t),o.value||(m=e.watch(s,(e=>{t.innerText=e}),{immediate:!0}),o.value=!0)},d=()=>{l&&o.value&&(m(),l.head.removeChild(l.getElementById(c)),o.value=!1)};r&&!i&&u(),i||a(d),e.readonly(o)}(d);const v=e=>{const{serverURL:t,path:l,pageSize:a}=n.value,u=new AbortController;r.value="loading",p?.(),ve({serverURL:t,lang:n.value.lang,path:l,pageSize:a,page:e,signal:u.signal,token:o.value?.token}).then((t=>{r.value="success",i.value=t.count,m.value.push(...t.data),c.value=e,s.value=t.totalPages})).catch((e=>{"AbortError"!==e.name&&(console.error(e.message),r.value="error")})),p=u.abort.bind(u)},f=()=>{i.value=0,m.value=[],v(1)};return e.provide("config",n),e.watch((()=>t.path),f),e.onMounted((()=>f())),{config:n,darkmodeStyle:d,i18n:e.computed((()=>n.value.locale)),status:r,count:i,page:c,totalPages:s,data:m,reply:u,loadMore:()=>v(c.value+1),refresh:f,onReply:e=>{u.value=e},onSubmit:e=>{if(e.rid){const t=m.value.find((({objectId:t})=>t===e.rid));if(!t)return;Array.isArray(t.children)||(t.children=[]),t.children.push(e)}else m.value.unshift(e)},onStatusChange:async({comment:e,status:t})=>{if(e.status===t)return;const{serverURL:l,lang:a}=n.value;await fe({serverURL:l,lang:a,token:o.value?.token,objectId:e.objectId,status:t}),e.status=t},onDelete:async({objectId:e})=>{if(!confirm("Are you sure you want to delete this comment?"))return;const{serverURL:t,lang:l}=n.value;await(({serverURL:e,lang:t,token:n,objectId:o})=>fetch(`${e}/comment/${o}?lang=${t}`,{method:"DELETE",headers:{Authorization:`Bearer ${n}`}}).then((e=>e.json())))({serverURL:t,lang:l,token:o.value?.token,objectId:e}),m.value.some(((t,n)=>t.objectId===e?(m.value=m.value.filter(((e,t)=>t!==n)),!0):t.children.some(((o,l)=>o.objectId===e&&(m.value[n].children=t.children.filter(((e,t)=>t!==l)),!0)))))},onSticky:async e=>{if(e.rid)return;const{serverURL:t,lang:l}=n.value;await fe({serverURL:t,lang:l,token:o.value?.token,objectId:e.objectId,sticky:e.sticky?0:1}),e.sticky=!e.sticky},onLike:async e=>{const{serverURL:t,lang:o}=n.value,{objectId:a}=e,r=l.value.includes(a);await(({serverURL:e,lang:t,objectId:n,like:o})=>fetch(`${e}/comment/${n}?lang=${t}`,{method:"PUT",headers:pe,body:JSON.stringify({like:o})}).then((e=>e.json())))({serverURL:t,lang:o,objectId:a,like:!r}),r?l.value=l.value.filter((e=>e!==a)):(l.value=[...l.value,a],l.value.length>50&&(l.value=l.value.slice(-50))),e.like=(e.like||0)+(r?-1:1)},version:"2.5.0"}}}),_t={"data-waline":""},Wt={class:"wl-count"},Gt=["textContent"],qt={class:"wl-cards"},Jt={key:1,class:"wl-operation"},Kt=["textContent"],Yt={key:0,class:"wl-loading"},Zt=["textContent"],Xt={class:"wl-operation"},Qt=["textContent"],en={key:3,class:"wl-power"},tn=e.createTextVNode(" Powered by "),nn=e.createElementVNode("a",{href:"https://github.com/walinejs/waline",target:"_blank",rel:"noreferrer"}," Waline ",-1);var on=$e(Ht,[["render",function(t,n,o,l,a,r){const i=e.resolveComponent("CommentBox"),c=e.resolveComponent("CommentCard"),s=e.resolveComponent("LoadingIcon");return e.openBlock(),e.createElementBlock("div",_t,[t.reply?e.createCommentVNode("v-if",!0):(e.openBlock(),e.createBlock(i,{key:0,onSubmit:t.onSubmit},null,8,["onSubmit"])),e.createElementVNode("div",Wt,[t.count?(e.openBlock(),e.createElementBlock("span",{key:0,class:"wl-num",textContent:e.toDisplayString(t.count)},null,8,Gt)):e.createCommentVNode("v-if",!0),e.createTextVNode(" "+e.toDisplayString(t.i18n.comment),1)]),e.createElementVNode("div",qt,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(t.data,(n=>(e.openBlock(),e.createBlock(c,{key:n.objectId,"root-id":n.objectId,comment:n,reply:t.reply,onReply:t.onReply,onSubmit:t.onSubmit,onStatus:t.onStatusChange,onDelete:t.onDelete,onSticky:t.onSticky,onLike:t.onLike},null,8,["root-id","comment","reply","onReply","onSubmit","onStatus","onDelete","onSticky","onLike"])))),128))]),"error"===t.status?(e.openBlock(),e.createElementBlock("div",Jt,[e.createElementVNode("button",{type:"button",class:"wl-btn",onClick:n[0]||(n[0]=(...e)=>t.refresh&&t.refresh(...e)),textContent:e.toDisplayString(t.i18n.refresh)},null,8,Kt)])):(e.openBlock(),e.createElementBlock(e.Fragment,{key:2},["loading"===t.status?(e.openBlock(),e.createElementBlock("div",Yt,[e.createVNode(s,{size:30})])):t.data.length?t.page<t.totalPages?(e.openBlock(),e.createElementBlock(e.Fragment,{key:2},[e.createCommentVNode(" Load more button "),e.createElementVNode("div",Xt,[e.createElementVNode("button",{type:"button",class:"wl-btn",onClick:n[1]||(n[1]=(...e)=>t.loadMore&&t.loadMore(...e)),textContent:e.toDisplayString(t.i18n.more)},null,8,Qt)])],2112)):e.createCommentVNode("v-if",!0):(e.openBlock(),e.createElementBlock("div",{key:1,class:"wl-empty",textContent:e.toDisplayString(t.i18n.sofa)},null,8,Zt))],2112)),e.createCommentVNode(" Copyright Information "),t.config.copyright?(e.openBlock(),e.createElementBlock("div",en,[tn,nn,e.createTextVNode(" v"+e.toDisplayString(t.version),1)])):e.createCommentVNode("v-if",!0)])}],["__file","Waline.vue"]]);exports.Waline=on,exports.version="2.5.0";
//# sourceMappingURL=component.js.map

@@ -80,2 +80,4 @@ interface WalineEmojiInfo {

anonymous: string;
gif: string;
gifSearchPlaceholder: string;
}

@@ -82,0 +84,0 @@

@@ -1,2 +0,2 @@

"use strict";Object.defineProperty(exports,"__esModule",{value:!0});const e=e=>{"AbortError"!==e.name&&console.error(e.message)},t={"Content-Type":"application/json"},r=(e,t="")=>{if("object"==typeof e&&e.errno)throw new TypeError(`Fetch ${t} failed with ${e.errno}: ${e.errmsg}`);return e},n=({serverURL:e,lang:t,paths:n,signal:o})=>fetch(`${e}/article?path=${encodeURIComponent(n.join(","))}&lang=${t}`,{signal:o}).then((e=>e.json())).then((e=>r(e,"visit count"))).then((e=>Array.isArray(e)?e:[e])),o=({serverURL:e,lang:n,path:o})=>fetch(`${e}/article?lang=${n}`,{method:"POST",headers:t,body:JSON.stringify({path:o})}).then((e=>e.json())).then((e=>r(e,"visit count"))),a=e=>e.dataset.path||e.getAttribute("id"),s=(e,t)=>{t.forEach(((t,r)=>{t.innerText=e[r].toString()}))};exports.pageviewCount=({serverURL:t,path:r=window.location.pathname,selector:i=".waline-pageview-count",update:l=!0,lang:h="zh-CN"})=>{const c=new AbortController,p=Array.from(document.querySelectorAll(i)),g=e=>{const t=a(e);return null!==t&&r!==t},u=o=>n({serverURL:t,paths:o.map((e=>a(e)||r)),lang:h,signal:c.signal}).then((e=>s(e,o))).catch(e);if(l){const e=p.filter((e=>!g(e))),n=p.filter(g);o({serverURL:t,path:r,lang:h}).then((t=>s(new Array(e.length).fill(t),e))),n.length&&u(n)}else u(p);return c.abort.bind(c)},exports.version="2.4.2";
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});const e=e=>{"AbortError"!==e.name&&console.error(e.message)},t={"Content-Type":"application/json"},r=(e,t="")=>{if("object"==typeof e&&e.errno)throw new TypeError(`Fetch ${t} failed with ${e.errno}: ${e.errmsg}`);return e},n=({serverURL:e,lang:t,paths:n,signal:o})=>fetch(`${e}/article?path=${encodeURIComponent(n.join(","))}&lang=${t}`,{signal:o}).then((e=>e.json())).then((e=>r(e,"visit count"))).then((e=>Array.isArray(e)?e:[e])),o=({serverURL:e,lang:n,path:o})=>fetch(`${e}/article?lang=${n}`,{method:"POST",headers:t,body:JSON.stringify({path:o})}).then((e=>e.json())).then((e=>r(e,"visit count"))),a=e=>e.dataset.path||e.getAttribute("id"),s=(e,t)=>{t.forEach(((t,r)=>{t.innerText=e[r].toString()}))};exports.pageviewCount=({serverURL:t,path:r=window.location.pathname,selector:i=".waline-pageview-count",update:l=!0,lang:h="zh-CN"})=>{const c=new AbortController,p=Array.from(document.querySelectorAll(i)),g=e=>{const t=a(e);return null!==t&&r!==t},u=o=>n({serverURL:t,paths:o.map((e=>a(e)||r)),lang:h,signal:c.signal}).then((e=>s(e,o))).catch(e);if(l){const e=p.filter((e=>!g(e))),n=p.filter(g);o({serverURL:t,path:r,lang:h}).then((t=>s(new Array(e.length).fill(t),e))),n.length&&u(n)}else u(p);return c.abort.bind(c)},exports.version="2.5.0";
//# sourceMappingURL=pageview.cjs.js.map

@@ -1,2 +0,2 @@

const e="2.4.2",t=e=>{"AbortError"!==e.name&&console.error(e.message)},r={"Content-Type":"application/json"},n=(e,t="")=>{if("object"==typeof e&&e.errno)throw new TypeError(`Fetch ${t} failed with ${e.errno}: ${e.errmsg}`);return e},a=({serverURL:e,lang:t,paths:r,signal:a})=>fetch(`${e}/article?path=${encodeURIComponent(r.join(","))}&lang=${t}`,{signal:a}).then((e=>e.json())).then((e=>n(e,"visit count"))).then((e=>Array.isArray(e)?e:[e])),o=({serverURL:e,lang:t,path:a})=>fetch(`${e}/article?lang=${t}`,{method:"POST",headers:r,body:JSON.stringify({path:a})}).then((e=>e.json())).then((e=>n(e,"visit count"))),l=e=>e.dataset.path||e.getAttribute("id"),i=(e,t)=>{t.forEach(((t,r)=>{t.innerText=e[r].toString()}))},s=({serverURL:e,path:r=window.location.pathname,selector:n=".waline-pageview-count",update:s=!0,lang:h="zh-CN"})=>{const c=new AbortController,g=Array.from(document.querySelectorAll(n)),p=e=>{const t=l(e);return null!==t&&r!==t},f=n=>a({serverURL:e,paths:n.map((e=>l(e)||r)),lang:h,signal:c.signal}).then((e=>i(e,n))).catch(t);if(s){const t=g.filter((e=>!p(e))),n=g.filter(p);o({serverURL:e,path:r,lang:h}).then((e=>i(new Array(t.length).fill(e),t))),n.length&&f(n)}else f(g);return c.abort.bind(c)};export{s as pageviewCount,e as version};
const e="2.5.0",t=e=>{"AbortError"!==e.name&&console.error(e.message)},r={"Content-Type":"application/json"},n=(e,t="")=>{if("object"==typeof e&&e.errno)throw new TypeError(`Fetch ${t} failed with ${e.errno}: ${e.errmsg}`);return e},a=({serverURL:e,lang:t,paths:r,signal:a})=>fetch(`${e}/article?path=${encodeURIComponent(r.join(","))}&lang=${t}`,{signal:a}).then((e=>e.json())).then((e=>n(e,"visit count"))).then((e=>Array.isArray(e)?e:[e])),o=({serverURL:e,lang:t,path:a})=>fetch(`${e}/article?lang=${t}`,{method:"POST",headers:r,body:JSON.stringify({path:a})}).then((e=>e.json())).then((e=>n(e,"visit count"))),l=e=>e.dataset.path||e.getAttribute("id"),i=(e,t)=>{t.forEach(((t,r)=>{t.innerText=e[r].toString()}))},s=({serverURL:e,path:r=window.location.pathname,selector:n=".waline-pageview-count",update:s=!0,lang:h="zh-CN"})=>{const c=new AbortController,g=Array.from(document.querySelectorAll(n)),p=e=>{const t=l(e);return null!==t&&r!==t},f=n=>a({serverURL:e,paths:n.map((e=>l(e)||r)),lang:h,signal:c.signal}).then((e=>i(e,n))).catch(t);if(s){const t=g.filter((e=>!p(e))),n=g.filter(p);o({serverURL:e,path:r,lang:h}).then((e=>i(new Array(t.length).fill(e),t))),n.length&&f(n)}else f(g);return c.abort.bind(c)};export{s as pageviewCount,e as version};
//# sourceMappingURL=pageview.esm.js.map

@@ -1,2 +0,2 @@

!function(e,t){if("function"==typeof define&&define.amd)define("Waline",["exports"],t);else if("undefined"!=typeof exports)t(exports);else{var n={exports:{}};t(n.exports),e.Waline=n.exports}}("undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:this,(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.version=e.pageviewCount=void 0;e.version="2.4.2";const t=e=>{"AbortError"!==e.name&&console.error(e.message)},n={"Content-Type":"application/json"},o=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"";if("object"==typeof e&&e.errno)throw new TypeError("Fetch ".concat(t," failed with ").concat(e.errno,": ").concat(e.errmsg));return e},r=e=>{let{serverURL:t,lang:n,paths:r,signal:a}=e;return fetch("".concat(t,"/article?path=").concat(encodeURIComponent(r.join(",")),"&lang=").concat(n),{signal:a}).then((e=>e.json())).then((e=>o(e,"visit count"))).then((e=>Array.isArray(e)?e:[e]))},a=e=>{let{serverURL:t,lang:r,path:a}=e;return fetch("".concat(t,"/article?lang=").concat(r),{method:"POST",headers:n,body:JSON.stringify({path:a})}).then((e=>e.json())).then((e=>o(e,"visit count")))},i=e=>e.dataset.path||e.getAttribute("id"),l=(e,t)=>{t.forEach(((t,n)=>{t.innerText=e[n].toString()}))};e.pageviewCount=e=>{let{serverURL:n,path:o=window.location.pathname,selector:s=".waline-pageview-count",update:c=!0,lang:h="zh-CN"}=e;const f=new AbortController,p=Array.from(document.querySelectorAll(s)),d=e=>{const t=i(e);return null!==t&&o!==t},g=e=>r({serverURL:n,paths:e.map((e=>i(e)||o)),lang:h,signal:f.signal}).then((t=>l(t,e))).catch(t);if(c){const e=p.filter((e=>!d(e))),t=p.filter(d);a({serverURL:n,path:o,lang:h}).then((t=>l(new Array(e.length).fill(t),e))),t.length&&g(t)}else g(p);return f.abort.bind(f)}}));
!function(e,t){if("function"==typeof define&&define.amd)define("Waline",["exports"],t);else if("undefined"!=typeof exports)t(exports);else{var n={exports:{}};t(n.exports),e.Waline=n.exports}}("undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:this,(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.version=e.pageviewCount=void 0;e.version="2.5.0";const t=e=>{"AbortError"!==e.name&&console.error(e.message)},n={"Content-Type":"application/json"},o=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"";if("object"==typeof e&&e.errno)throw new TypeError("Fetch ".concat(t," failed with ").concat(e.errno,": ").concat(e.errmsg));return e},r=e=>{let{serverURL:t,lang:n,paths:r,signal:a}=e;return fetch("".concat(t,"/article?path=").concat(encodeURIComponent(r.join(",")),"&lang=").concat(n),{signal:a}).then((e=>e.json())).then((e=>o(e,"visit count"))).then((e=>Array.isArray(e)?e:[e]))},a=e=>{let{serverURL:t,lang:r,path:a}=e;return fetch("".concat(t,"/article?lang=").concat(r),{method:"POST",headers:n,body:JSON.stringify({path:a})}).then((e=>e.json())).then((e=>o(e,"visit count")))},i=e=>e.dataset.path||e.getAttribute("id"),l=(e,t)=>{t.forEach(((t,n)=>{t.innerText=e[n].toString()}))};e.pageviewCount=e=>{let{serverURL:n,path:o=window.location.pathname,selector:s=".waline-pageview-count",update:c=!0,lang:h="zh-CN"}=e;const f=new AbortController,p=Array.from(document.querySelectorAll(s)),d=e=>{const t=i(e);return null!==t&&o!==t},g=e=>r({serverURL:n,paths:e.map((e=>i(e)||o)),lang:h,signal:f.signal}).then((t=>l(t,e))).catch(t);if(c){const e=p.filter((e=>!d(e))),t=p.filter(d);a({serverURL:n,path:o,lang:h}).then((t=>l(new Array(e.length).fill(t),e))),t.length&&g(t)}else g(p);return f.abort.bind(f)}}));
//# sourceMappingURL=pageview.js.map

@@ -148,2 +148,4 @@ interface WalineEmojiInfo {

anonymous: string;
gif: string;
gifSearchPlaceholder: string;
}

@@ -150,0 +152,0 @@

@@ -148,2 +148,4 @@ interface WalineEmojiInfo {

anonymous: string;
gif: string;
gifSearchPlaceholder: string;
}

@@ -150,0 +152,0 @@

@@ -1,2 +0,2 @@

import{getCurrentScope as e,onScopeDispose as t,watch as n,ref as o,unref as l,isRef as a,readonly as r,shallowRef as i,computed as s,h as c,defineComponent as u,inject as m,onMounted as d,onUnmounted as v,resolveComponent as p,openBlock as g,createElementBlock as h,createElementVNode as f,createVNode as w,toDisplayString as y,createCommentVNode as b,normalizeClass as k,Fragment as $,renderList as C,withDirectives as L,vModelDynamic as I,vModelText as j,vShow as R,createTextVNode as S,createBlock as x,provide as E,reactive as A,createApp as U,watchEffect as z}from"vue";import M from"autosize";import{marked as O}from"marked";const P=["nick","mail","link"],N=e=>e.filter((e=>P.includes(e))),T=e=>new Promise(((t,n)=>{const o=new FileReader;o.readAsDataURL(e),o.onload=()=>t(o.result?.toString()||""),o.onerror=n})),_=e=>!0===e?'<p class="wl-tex">Tex is not available in preview</p>':'<span class="wl-tex">Tex is not available in preview</span>',B=new RegExp(`(${/[\u4E00-\u9FFF\u3400-\u4dbf\uf900-\ufaff\u3040-\u309f\uac00-\ud7af\u0400-\u04FF]+|\w+/.source}|${/</.source})|((?:${/(?:^|\s)\/\/(.+?)$/gm.source})|(?:${/\/\*([\S\s]*?)\*\//gm.source}))`,"gmi"),D=["23AC69","91C132","F19726","E8552D","1AAB8E","E1147F","2980C1","1BA1E6","9FA0A0","F19726","E30B20","E30B20","A3338B"],F={},H=e=>{let t=0;return e.replace(B,((e,n,o)=>{if(o)return`<span style="color: slategray">${o}</span>`;if("<"===n)return"&lt;";let l;F[n]?l=F[n]:(l=D[t],F[n]=l);const a=`<span style="color: #${l}">${n}</span>`;return t=++t%D.length,a}))},V=["nick","nickError","mail","mailError","link","optional","placeholder","sofa","submit","like","cancelLike","reply","cancelReply","comment","refresh","more","preview","emoji","uploadImage","seconds","minutes","hours","days","now","uploading","login","logout","admin","sticky","word","wordHint","anonymous","level0","level1","level2","level3","level4","level5"],W=e=>Object.fromEntries(e.map(((e,t)=>[V[t],e])));var q=W(["NickName","NickName cannot be less than 3 bytes.","E-Mail","Please confirm your email address.","Website","Optional","Comment here...","No comment yet.","Submit","Like","Cancel like","Reply","Cancel reply","Comments","Refresh","Load More...","Preview","Emoji","Upload Image","seconds ago","minutes ago","hours ago","days ago","just now","Uploading","Login","logout","Admin","Sticky","Words","Please input comments between $0 and $1 words!\n Current word number: $2","Anonymous","Dwarves","Hobbits","Ents","Wizards","Elves","Maiar"]),J=W(["ニックネーム","3バイト以上のニックネームをご入力ください.","メールアドレス","メールアドレスをご確認ください.","サイト","オプション","ここにコメント","コメントしましょう~","提出する","Like","Cancel like","返信する","キャンセル","コメント","更新","さらに読み込む","プレビュー","絵文字","画像をアップロード","秒前","分前","時間前","日前","たっだ今","アップロード","ログインする","ログアウト","管理者","トップに置く","ワード","コメントは $0 から $1 ワードの間でなければなりません!\n 現在の単語番号: $2","匿名"]),K=W(["昵称","昵称不能少于3个字符","邮箱","请填写正确的邮件地址","网址","可选","欢迎评论","来发评论吧~","提交","喜欢","取消喜欢","回复","取消回复","评论","刷新","加载更多...","预览","表情","上传图片","秒前","分钟前","小时前","天前","刚刚","正在上传","登录","退出","博主","置顶","字","评论字数应在 $0 到 $1 字之间!\n当前字数:$2","匿名","潜水","冒泡","吐槽","活跃","话痨","传说"]),Y=W(["暱稱","郵箱","網址","可選","暱稱不能少於3個字元","請填寫正確的郵件地址","歡迎評論","來發評論吧~","提交","喜歡","取消喜歡","回覆","取消回覆","評論","刷新","載入更多...","預覽","表情","上傳圖片","秒前","分鐘前","小時前","天前","剛剛","正在上傳","登錄","退出","博主","置頂","字","評論字數應在 $0 到 $1 字之間!\n當前字數:$2","匿名","潛水","冒泡","吐槽","活躍","話癆","傳說"]),G=W(["Apelido","Apelido não pode ser menor que 3 bytes.","E-Mail","Por favor, confirme seu endereço de e-mail.","Website","Opcional","Comente aqui...","Nenhum comentário, ainda.","Enviar","Like","Cancel like","Responder","Cancelar resposta","Comentários","Refrescar","Carregar Mais...","Visualizar","Emoji","Enviar Imagem","segundos atrás","minutos atrás","horas atrás","dias atrás","agora mesmo","Enviando","Entrar","Sair","Admin","Sticky","Palavras","Favor enviar comentário com $0 a $1 palavras!\n Número de palavras atuais: $2","Anônimo"]),X=W(["Псевдоним","Никнейм не может быть меньше 3 байт.","Эл. адрес","Пожалуйста, подтвердите адрес вашей электронной почты.","Веб-сайт","Необязательный","Комментарий здесь...","Пока нет комментариев.","Отправить","Like","Cancel like","Отвечать","Отменить ответ","Комментарии","Обновить","Загрузи больше...","Превью","эмодзи","Загрузить изображение","секунд назад","несколько минут назад","несколько часов назад","дней назад","прямо сейчас","Загрузка","Авторизоваться","Выход из системы","Админ","Липкий","Слова","Пожалуйста, введите комментарии от $0 до $1 слов!\nНомер текущего слова: $2","Анонимный"]);const Q={zh:K,"zh-cn":K,"zh-CN":K,"zh-tw":Y,"zh-TW":Y,en:q,"en-US":q,"en-us":q,jp:J,"jp-jp":J,"jp-JP":J,"pt-br":G,"pt-BR":G,ru:X,"ru-ru":X,"ru-RU":X};function Z(n){return!!e()&&(t(n),!0)}const ee="undefined"!=typeof window,te=()=>{};const ne=e=>e();var oe=Object.getOwnPropertySymbols,le=Object.prototype.hasOwnProperty,ae=Object.prototype.propertyIsEnumerable;function re(e,t,o={}){const l=o,{eventFilter:a=ne}=l,r=((e,t)=>{var n={};for(var o in e)le.call(e,o)&&t.indexOf(o)<0&&(n[o]=e[o]);if(null!=e&&oe)for(var o of oe(e))t.indexOf(o)<0&&ae.call(e,o)&&(n[o]=e[o]);return n})(l,["eventFilter"]);return n(e,(i=a,s=t,function(...e){i((()=>s.apply(this,e)),{fn:s,thisArg:this,args:e})}),r);var i,s}var ie=Object.defineProperty,se=Object.defineProperties,ce=Object.getOwnPropertyDescriptors,ue=Object.getOwnPropertySymbols,me=Object.prototype.hasOwnProperty,de=Object.prototype.propertyIsEnumerable,ve=(e,t,n)=>t in e?ie(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;function pe(e,t,n={}){const l=n,{eventFilter:a}=l,r=((e,t)=>{var n={};for(var o in e)me.call(e,o)&&t.indexOf(o)<0&&(n[o]=e[o]);if(null!=e&&ue)for(var o of ue(e))t.indexOf(o)<0&&de.call(e,o)&&(n[o]=e[o]);return n})(l,["eventFilter"]),{eventFilter:i,pause:s,resume:c,isActive:u}=function(e=ne){const t=o(!0);return{isActive:t,pause:function(){t.value=!1},resume:function(){t.value=!0},eventFilter:(...n)=>{t.value&&e(...n)}}}(a),m=re(e,t,(d=((e,t)=>{for(var n in t||(t={}))me.call(t,n)&&ve(e,n,t[n]);if(ue)for(var n of ue(t))de.call(t,n)&&ve(e,n,t[n]);return e})({},r),se(d,ce({eventFilter:i}))));var d;return{stop:m,pause:s,resume:c,isActive:u}}const ge=ee?window:void 0,he=ee?window.document:void 0;function fe(...e){let t,o,a,r;if("string"==typeof e[0]?([o,a,r]=e,t=ge):[t,o,a,r]=e,!t)return te;let i=te;const s=n((()=>function(e){var t;const n=l(e);return null!=(t=null==n?void 0:n.$el)?t:n}(t)),(e=>{i(),e&&(e.addEventListener(o,a,r),i=()=>{e.removeEventListener(o,a,r),i=te})}),{immediate:!0,flush:"post"}),c=()=>{s(),i()};return Z(c),c}ee&&window.navigator,ee&&window.location;const we="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},ye="__vueuse_ssr_handlers__";we[ye]=we[ye]||{};const be=we[ye];const ke={boolean:{read:e=>"true"===e,write:e=>String(e)},object:{read:e=>JSON.parse(e),write:e=>JSON.stringify(e)},number:{read:e=>Number.parseFloat(e),write:e=>String(e)},any:{read:e=>e,write:e=>String(e)},string:{read:e=>e,write:e=>String(e)},map:{read:e=>new Map(JSON.parse(e)),write:e=>JSON.stringify(Array.from(e.entries()))},set:{read:e=>new Set(JSON.parse(e)),write:e=>JSON.stringify(Array.from(e))},date:{read:e=>new Date(e),write:e=>e.toISOString()}};function $e(e,t,n,a={}){var r;const{flush:s="pre",deep:c=!0,listenToStorageChanges:u=!0,writeDefaults:m=!0,shallow:d,window:v=ge,eventFilter:p,onError:g=(e=>{console.error(e)})}=a,h=(d?i:o)(t);if(!n)try{n=function(e,t){return be[e]||t}("getDefaultStorage",(()=>{var e;return null==(e=ge)?void 0:e.localStorage}))()}catch(e){g(e)}if(!n)return h;const f=l(t),w=function(e){return null==e?"any":e instanceof Set?"set":e instanceof Map?"map":e instanceof Date?"date":"boolean"==typeof e?"boolean":"string"==typeof e?"string":"object"==typeof e||Array.isArray(e)?"object":Number.isNaN(e)?"any":"number"}(f),y=null!=(r=a.serializer)?r:ke[w],{pause:b,resume:k}=pe(h,(()=>function(t){try{null==t?n.removeItem(e):n.setItem(e,y.write(t))}catch(e){g(e)}}(h.value)),{flush:s,deep:c,eventFilter:p});return v&&u&&fe(v,"storage",$),$(),h;function $(t){t&&t.key!==e||(h.value=function(t){if(!t||t.key===e){b();try{const o=t?t.newValue:n.getItem(e);return null==o?(m&&null!==f&&n.setItem(e,y.write(f)),f):"string"!=typeof o?o:y.read(o)}catch(e){g(e)}finally{k()}}}(t))}}var Ce,Le,Ie=Object.defineProperty,je=Object.getOwnPropertySymbols,Re=Object.prototype.hasOwnProperty,Se=Object.prototype.propertyIsEnumerable,xe=(e,t,n)=>t in e?Ie(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;function Ee(e={}){const{controls:t=!1,interval:r="requestAnimationFrame"}=e,i=o(new Date),s=()=>i.value=new Date,c="requestAnimationFrame"===r?function(e,t={}){const{immediate:n=!0,window:l=ge}=t,a=o(!1);let r=null;function i(){a.value&&l&&(e(),r=l.requestAnimationFrame(i))}function s(){!a.value&&l&&(a.value=!0,i())}function c(){a.value=!1,null!=r&&l&&(l.cancelAnimationFrame(r),r=null)}return n&&s(),Z(c),{isActive:a,pause:c,resume:s}}(s,{immediate:!0}):function(e,t=1e3,r={}){const{immediate:i=!0,immediateCallback:s=!1}=r;let c=null;const u=o(!1);function m(){c&&(clearInterval(c),c=null)}function d(){u.value=!1,m()}function v(){t<=0||(u.value=!0,s&&e(),m(),c=setInterval(e,l(t)))}i&&ee&&v(),a(t)&&Z(n(t,(()=>{i&&ee&&v()})));return Z(d),{isActive:u,pause:d,resume:v}}(s,r,{immediate:!0});return t?((e,t)=>{for(var n in t||(t={}))Re.call(t,n)&&xe(e,n,t[n]);if(je)for(var n of je(t))Se.call(t,n)&&xe(e,n,t[n]);return e})({now:i},c):i}ee&&(null==window?void 0:window.navigator)&&(null==(Ce=null==window?void 0:window.navigator)?void 0:Ce.platform)&&/iP(ad|hone|od)/.test(null==(Le=null==window?void 0:window.navigator)?void 0:Le.platform);let Ae=0;const Ue=e=>{try{e=decodeURI(e)}catch(e){}return e},ze=(e="")=>e.replace(/\/$/u,""),Me=e=>/^(https?:)?\/\//.test(e),Oe=e=>{const t=ze(e);return Me(t)?t:`https://${t}`},Pe=e=>Array.isArray(e)?e:!!e&&[0,e],Ne=(e,t)=>"function"==typeof e?e:!1!==e&&t,Te="{--waline-white:#000;--waline-light-grey:#666;--waline-dark-grey:#999;--waline-color:#888;--waline-bgcolor:#1e1e1e;--waline-bgcolor-light:#272727;--waline-bgcolor-hover: #444;--waline-border-color:#333;--waline-disable-bgcolor:#444;--waline-disable-color:#272727;--waline-bq-color:#272727;--waline-info-bgcolor:#272727;--waline-info-color:#666}",_e=(e,t)=>{let n=e.toString();for(;n.length<t;)n="0"+n;return n},Be=(e,t,n)=>{if(!e)return"";const o="string"==typeof e?new Date(-1!==e.indexOf(" ")?e.replace(/-/g,"/"):e):e,l=t.getTime()-o.getTime(),a=Math.floor(l/864e5);if(0===a){const e=l%864e5,t=Math.floor(e/36e5);if(0===t){const t=e%36e5,o=Math.floor(t/6e4);if(0===o){const e=t%6e4;return`${Math.round(e/1e3)} ${n.seconds}`}return`${o} ${n.minutes}`}return`${t} ${n.hours}`}return a<0?n.now:a<8?`${a} ${n.days}`:(e=>{const t=_e(e.getDate(),2),n=_e(e.getMonth()+1,2);return`${_e(e.getFullYear(),2)}-${n}-${t}`})(o)},De=e=>{const t=$e("WALINE_EMOJI",{}),n=Boolean(/@[0-9]+\.[0-9]+\.[0-9]+/.test(e));if(n){const n=t.value[e];if(n)return Promise.resolve(n)}return fetch(`${e}/info.json`).then((e=>e.json())).then((o=>{const l={folder:e,...o};return n&&(t.value[e]=l),l}))},Fe=(e,t="",n="",o="")=>`${t?`${t}/`:""}${n}${e}${o?`.${o}`:""}`,He=e=>{"AbortError"!==e.name&&console.error(e.message)},Ve={"Content-Type":"application/json"},We=(e,t="")=>{if("object"==typeof e&&e.errno)throw new TypeError(`Fetch ${t} failed with ${e.errno}: ${e.errmsg}`);return e},qe=({serverURL:e,lang:t,token:n,objectId:o,...l})=>fetch(`${e}/comment/${o}?lang=${t}`,{method:"PUT",headers:{"Content-Type":"application/json",Authorization:`Bearer ${n}`},body:JSON.stringify(l)}).then((e=>e.json())),Je=({serverURL:e,lang:t,paths:n,signal:o})=>fetch(`${e}/article?path=${encodeURIComponent(n.join(","))}&lang=${t}`,{signal:o}).then((e=>e.json())).then((e=>We(e,"visit count"))).then((e=>Array.isArray(e)?e:[e])),Ke=({serverURL:e,lang:t,path:n})=>fetch(`${e}/article?lang=${t}`,{method:"POST",headers:Ve,body:JSON.stringify({path:n})}).then((e=>e.json())).then((e=>We(e,"visit count"))),Ye=e=>e instanceof HTMLElement?e:"string"==typeof e?document.querySelector(e):null,Ge=e=>e.type.includes("image"),Xe=e=>{const t=Array.from(e).find(Ge);return t?t.getAsFile():null},Qe=/\$.*?\$/,Ze=/^\$(.*?)\$/,et=/^(?:\s{0,3})\$\$((?:[^\n]|\n[^\n])+?)\n{0,1}\$\$/,tt=(e="",t={})=>e.replace(/:(.+?):/g,((e,n)=>t[n]?`<img class="wl-emoji" src="${t[n]}" alt="${n}">`:e)),nt=(e,{emojiMap:t,highlighter:n,texRenderer:o})=>{if(O.setOptions({highlight:n||void 0,breaks:!0,smartLists:!0,smartypants:!0}),o){const e=(e=>[{name:"blockMath",level:"block",tokenizer(t){const n=et.exec(t);if(null!==n)return{type:"html",raw:n[0],text:e(!0,n[1])}}},{name:"inlineMath",level:"inline",start(e){const t=e.search(Qe);return-1!==t?t:e.length},tokenizer(t){const n=Ze.exec(t);if(null!==n)return{type:"html",raw:n[0],text:e(!1,n[1])}}}])(o);O.use({extensions:e})}return O.parse(tt(e,t))},ot=e=>e.dataset.path||e.getAttribute("id");let lt=null;const at=()=>lt||(lt=$e("USER_KEY",{}));let rt=null;const it=()=>rt||(rt=$e("WALIKE_LIKE",[])),st=({serverURL:e,path:t=window.location.pathname,selector:n=".waline-comment-count",lang:o="zh-CN"})=>{const l=new AbortController,a=document.querySelectorAll(n),r=at();return a.length&&(({serverURL:e,lang:t,paths:n,signal:o,token:l})=>{const a={};return l&&(a.Authorization=`Bearer ${l}`),fetch(`${e}/comment?type=count&url=${encodeURIComponent(n.join(","))}&lang=${t}`,{signal:o,headers:a}).then((e=>e.json())).then((e=>We(e,"comment count"))).then((e=>Array.isArray(e)?e:[e]))})({serverURL:e,paths:Array.from(a).map((e=>Ue(e.dataset.path||e.getAttribute("id")||t))),lang:o,signal:l.signal,token:r.value?.token}).then((e=>{a.forEach(((t,n)=>{t.innerText=e[n].toString()}))})).catch(He),l.abort.bind(l)},ct=({size:e})=>c("svg",{width:e,height:e,viewBox:"0 0 100 100",preserveAspectRatio:"xMidYMid"},c("circle",{cx:50,cy:50,fill:"none",stroke:"currentColor",strokeWidth:"4",r:"40","stroke-dasharray":"85 30"},c("animateTransform",{attributeName:"transform",type:"rotate",repeatCount:"indefinite",dur:"1s",values:"0 50 50;360 50 50",keyTimes:"0;1"})));var ut=(e,t)=>{const n=e.__vccOpts||e;for(const[e,o]of t)n[e]=o;return n};const mt=u({name:"CommentBox",components:{CloseIcon:({size:e})=>c("svg",{class:"wl-close-icon",viewBox:"0 0 1024 1024",width:e,height:e},[c("path",{d:"M697.173 85.333h-369.92c-144.64 0-241.92 101.547-241.92 252.587v348.587c0 150.613 97.28 252.16 241.92 252.16h369.92c144.64 0 241.494-101.547 241.494-252.16V337.92c0-151.04-96.854-252.587-241.494-252.587z",fill:"currentColor"}),c("path",{d:"m640.683 587.52-75.947-75.861 75.904-75.862a37.29 37.29 0 0 0 0-52.778 37.205 37.205 0 0 0-52.779 0l-75.946 75.818-75.862-75.946a37.419 37.419 0 0 0-52.821 0 37.419 37.419 0 0 0 0 52.821l75.947 75.947-75.776 75.733a37.29 37.29 0 1 0 52.778 52.821l75.776-75.776 75.947 75.947a37.376 37.376 0 0 0 52.779-52.821z",fill:"#888"})]),EmojiIcon:()=>c("svg",{viewBox:"0 0 1024 1024",width:"24",height:"24"},c("path",{d:"M563.2 463.3 677 540c1.7 1.2 3.7 1.8 5.8 1.8.7 0 1.4-.1 2-.2 2.7-.5 5.1-2.1 6.6-4.4l25.3-37.8c1.5-2.3 2.1-5.1 1.6-7.8s-2.1-5.1-4.4-6.6l-73.6-49.1 73.6-49.1c2.3-1.5 3.9-3.9 4.4-6.6.5-2.7 0-5.5-1.6-7.8l-25.3-37.8a10.1 10.1 0 0 0-6.6-4.4c-.7-.1-1.3-.2-2-.2-2.1 0-4.1.6-5.8 1.8l-113.8 76.6c-9.2 6.2-14.7 16.4-14.7 27.5.1 11 5.5 21.3 14.7 27.4zM387 348.8h-45.5c-5.7 0-10.4 4.7-10.4 10.4v153.3c0 5.7 4.7 10.4 10.4 10.4H387c5.7 0 10.4-4.7 10.4-10.4V359.2c0-5.7-4.7-10.4-10.4-10.4zm333.8 241.3-41-20a10.3 10.3 0 0 0-8.1-.5c-2.6.9-4.8 2.9-5.9 5.4-30.1 64.9-93.1 109.1-164.4 115.2-5.7.5-9.9 5.5-9.5 11.2l3.9 45.5c.5 5.3 5 9.5 10.3 9.5h.9c94.8-8 178.5-66.5 218.6-152.7 2.4-5 .3-11.2-4.8-13.6zm186-186.1c-11.9-42-30.5-81.4-55.2-117.1-24.1-34.9-53.5-65.6-87.5-91.2-33.9-25.6-71.5-45.5-111.6-59.2-41.2-14-84.1-21.1-127.8-21.1h-1.2c-75.4 0-148.8 21.4-212.5 61.7-63.7 40.3-114.3 97.6-146.5 165.8-32.2 68.1-44.3 143.6-35.1 218.4 9.3 74.8 39.4 145 87.3 203.3.1.2.3.3.4.5l36.2 38.4c1.1 1.2 2.5 2.1 3.9 2.6 73.3 66.7 168.2 103.5 267.5 103.5 73.3 0 145.2-20.3 207.7-58.7 37.3-22.9 70.3-51.5 98.1-85 27.1-32.7 48.7-69.5 64.2-109.1 15.5-39.7 24.4-81.3 26.6-123.8 2.4-43.6-2.5-87-14.5-129zm-60.5 181.1c-8.3 37-22.8 72-43 104-19.7 31.1-44.3 58.6-73.1 81.7-28.8 23.1-61 41-95.7 53.4-35.6 12.7-72.9 19.1-110.9 19.1-82.6 0-161.7-30.6-222.8-86.2l-34.1-35.8c-23.9-29.3-42.4-62.2-55.1-97.7-12.4-34.7-18.8-71-19.2-107.9-.4-36.9 5.4-73.3 17.1-108.2 12-35.8 30-69.2 53.4-99.1 31.7-40.4 71.1-72 117.2-94.1 44.5-21.3 94-32.6 143.4-32.6 49.3 0 97 10.8 141.8 32 34.3 16.3 65.3 38.1 92 64.8 26.1 26 47.5 56 63.6 89.2 16.2 33.2 26.6 68.5 31 105.1 4.6 37.5 2.7 75.3-5.6 112.3z",fill:"currentColor"})),ImageIcon:()=>c("svg",{viewBox:"0 0 1024 1024",width:"24",height:"24"},[c("path",{d:"M784 112H240c-88 0-160 72-160 160v480c0 88 72 160 160 160h544c88 0 160-72 160-160V272c0-88-72-160-160-160zm96 640c0 52.8-43.2 96-96 96H240c-52.8 0-96-43.2-96-96V272c0-52.8 43.2-96 96-96h544c52.8 0 96 43.2 96 96v480z",fill:"currentColor"}),c("path",{d:"M352 480c52.8 0 96-43.2 96-96s-43.2-96-96-96-96 43.2-96 96 43.2 96 96 96zm0-128c17.6 0 32 14.4 32 32s-14.4 32-32 32-32-14.4-32-32 14.4-32 32-32zm462.4 379.2-3.2-3.2-177.6-177.6c-25.6-25.6-65.6-25.6-91.2 0l-80 80-36.8-36.8c-25.6-25.6-65.6-25.6-91.2 0L200 728c-4.8 6.4-8 14.4-8 24 0 17.6 14.4 32 32 32 9.6 0 16-3.2 22.4-9.6L380.8 640l134.4 134.4c6.4 6.4 14.4 9.6 24 9.6 17.6 0 32-14.4 32-32 0-9.6-4.8-17.6-9.6-24l-52.8-52.8 80-80L769.6 776c6.4 4.8 12.8 8 20.8 8 17.6 0 32-14.4 32-32 0-8-3.2-16-8-20.8z",fill:"currentColor"})]),MarkdownIcon:()=>c("svg",{width:"16",height:"16",ariaHidden:"true"},c("path",{d:"M14.85 3H1.15C.52 3 0 3.52 0 4.15v7.69C0 12.48.52 13 1.15 13h13.69c.64 0 1.15-.52 1.15-1.15v-7.7C16 3.52 15.48 3 14.85 3zM9 11H7V8L5.5 9.92 4 8v3H2V5h2l1.5 2L7 5h2v6zm2.99.5L9.5 8H11V5h2v3h1.5l-2.51 3.5z",fill:"currentColor"})),PreviewIcon:()=>c("svg",{viewBox:"0 0 1024 1024",width:"24",height:"24"},[c("path",{d:"M710.816 654.301c70.323-96.639 61.084-230.578-23.705-314.843-46.098-46.098-107.183-71.109-172.28-71.109-65.008 0-126.092 25.444-172.28 71.109-45.227 46.098-70.756 107.183-70.756 172.106 0 64.923 25.444 126.007 71.194 172.106 46.099 46.098 107.184 71.109 172.28 71.109 51.414 0 100.648-16.212 142.824-47.404l126.53 126.006c7.058 7.06 16.297 10.979 26.406 10.979 10.105 0 19.343-3.919 26.402-10.979 14.467-14.467 14.467-38.172 0-52.723L710.816 654.301zm-315.107-23.265c-65.88-65.88-65.88-172.54 0-238.42 32.069-32.07 74.245-49.149 119.471-49.149 45.227 0 87.407 17.603 119.472 49.149 65.88 65.879 65.88 172.539 0 238.42-63.612 63.178-175.242 63.178-238.943 0zm0 0",fill:"currentColor"}),c("path",{d:"M703.319 121.603H321.03c-109.8 0-199.469 89.146-199.469 199.38v382.034c0 109.796 89.236 199.38 199.469 199.38h207.397c20.653 0 37.384-16.645 37.384-37.299 0-20.649-16.731-37.296-37.384-37.296H321.03c-68.582 0-124.352-55.77-124.352-124.267V321.421c0-68.496 55.77-124.267 124.352-124.267h382.289c68.582 0 124.352 55.771 124.352 124.267V524.72c0 20.654 16.736 37.299 37.385 37.299 20.654 0 37.384-16.645 37.384-37.299V320.549c-.085-109.8-89.321-198.946-199.121-198.946zm0 0",fill:"currentColor"})]),LoadingIcon:ct},props:{rootId:{type:String,default:""},replyId:{type:String,default:""},replyUser:{type:String,default:""}},emits:["submit","cancel-reply"],setup(e,{emit:t}){const l=m("config"),a=$e("WALINE_COMMENT_BOX_EDITOR",""),r=$e("WALINE_USER_META",{nick:"",mail:"",link:""}),i=at(),c=o({}),u=o(null),p=o(null),g=o(null),h=o(null),f=o({tabs:[],map:{}}),w=o(0),y=o(!1),b=o(!1),k=o(""),$=o(0),C=o(0),L=o(!1),I=o(""),j=o(!1),R=s((()=>l.value.locale)),S=s((()=>Boolean(i.value?.token))),x=s((()=>!1!==l.value.imageUploader)),E=e=>{const t=u.value,n=t.selectionStart,o=t.selectionEnd||0,l=t.scrollTop;a.value=t.value.substring(0,n)+e+t.value.substring(o,t.value.length),t.focus(),t.selectionStart=n+e.length,t.selectionEnd=n+e.length,t.scrollTop=l},A=e=>{const t=`![${l.value.locale.uploading} ${e.name}]()`;return E(t),Promise.resolve().then((()=>l.value.imageUploader(e))).then((n=>{a.value=a.value.replace(t,`\r\n![${e.name}](${n})`)}))},U=()=>{const{serverURL:n,lang:o,login:s,wordLimit:m,requiredMeta:d}=l.value,v={comment:I.value,nick:r.value.nick,mail:r.value.mail,link:r.value.link,ua:navigator.userAgent,url:l.value.path};if(i.value?.token)v.nick=i.value.display_name,v.mail=i.value.email,v.link=i.value.url;else{if("force"===s)return;if(d.indexOf("nick")>-1&&!v.nick)return c.value.nick?.focus(),alert(R.value.nickError);if(d.indexOf("mail")>-1&&!v.mail||v.mail&&!/^\w(?:[\w._-]*\w)?@(?:\w(?:[\w-]*\w)?\.)*\w+$/.exec(v.mail))return c.value.mail?.focus(),alert(R.value.mailError);if(!v.comment)return void u.value?.focus();v.nick||(v.nick=R.value.anonymous)}if(!L.value)return alert(R.value.wordHint.replace("$0",m[0].toString()).replace("$1",m[1].toString()).replace("$2",$.value.toString()));v.comment=tt(v.comment,f.value.map),e.replyId&&e.rootId&&(v.pid=e.replyId,v.rid=e.rootId,v.at=e.replyUser),j.value=!0,(({serverURL:e,lang:t,token:n,comment:o})=>{const l={"Content-Type":"application/json"};return n&&(l.Authorization=`Bearer ${n}`),fetch(`${e}/comment?lang=${t}`,{method:"POST",headers:l,body:JSON.stringify(o)}).then((e=>e.json()))})({serverURL:n,lang:o,token:i.value?.token,comment:v}).then((n=>{if(j.value=!1,n.errmsg)return alert(n.errmsg);t("submit",n.data),a.value="",k.value="",e.replyId&&t("cancel-reply")})).catch((e=>{j.value=!1,alert(e.message)}))},z=e=>{g.value.contains(e.target)||h.value.contains(e.target)||(y.value=!1)};return n([l,$],(([e,t])=>{const{wordLimit:n}=e;n?t<n[0]&&0!==n[0]?(C.value=n[0],L.value=!1):t>n[1]?(C.value=n[1],L.value=!1):(C.value=n[1],L.value=!0):(C.value=0,L.value=!0)}),{immediate:!0}),d((()=>{document.body.addEventListener("click",z),n((()=>a.value),(e=>{const{highlighter:t,texRenderer:n}=l.value;I.value=e,k.value=nt(e,{emojiMap:f.value.map,highlighter:t,texRenderer:n}),$.value=(e=>(e=>e.match(/[\w\d\s\u00C0-\u024F]+/giu)||[])(e).reduce(((e,t)=>e+(""===t.trim()?0:t.trim().split(/\s+/u).length)),0)+(e=>e.match(/[\u4E00-\u9FA5]/gu)||[])(e).length)(e),e?M(u.value):M.destroy(u.value)}),{immediate:!0}),n((()=>l.value.emoji),(e=>{return(t=Array.isArray(e)?e:[],Promise.all(t.map((e=>"string"==typeof e?De(ze(e)):Promise.resolve(e)))).then((e=>{const t={tabs:[],map:{}};return e.forEach((e=>{const{name:n,folder:o,icon:l,prefix:a,type:r,items:i}=e;t.tabs.push({name:n,icon:Fe(l,o,a,r),items:i.map((e=>{const n=`${a||""}${e}`;return t.map[n]=Fe(e,o,a,r),n}))})})),t}))).then((e=>{f.value=e}));var t}),{immediate:!0})})),v((()=>{document.body.removeEventListener("click",z)})),{config:l,locale:R,insert:E,onChange:()=>{const e=p.value;e.files&&x.value&&A(e.files[0]).then((()=>{e.value=""}))},onDrop:e=>{if(e.dataTransfer?.items){const t=Xe(e.dataTransfer.items);t&&x.value&&(A(t),e.preventDefault())}},onKeyDown:e=>{const t=e.key;(e.ctrlKey||e.metaKey)&&"Enter"===t&&U()},onPaste:e=>{if(e.clipboardData){const t=Xe(e.clipboardData.items);t&&x.value&&A(t)}},onLogin:e=>{e.preventDefault();const{lang:t,serverURL:n}=l.value,o=(window.innerWidth-450)/2,a=(window.innerHeight-450)/2,r=window.open(`${n}/ui/login?lng=${encodeURIComponent(t)}`,"_blank",`width=450,height=450,left=${o},top=${a},scrollbars=no,resizable=no,status=no,location=no,toolbar=no,menubar=no`);r?.postMessage({type:"TOKEN",data:null},"*");const s=({data:e})=>{e&&"userInfo"===e.type&&e.data.token&&(r?.close(),i.value=e.data,(e.data.remember?localStorage:sessionStorage).setItem("WALINE_USER",JSON.stringify(e.data)),window.removeEventListener("message",s))};window.addEventListener("message",s)},onLogout:()=>{i.value={},localStorage.setItem("WALINE_USER","null"),sessionStorage.setItem("WALINE_USER","null")},onProfile:e=>{e.preventDefault();const{lang:t,serverURL:n}=l.value,o=(window.innerWidth-800)/2,a=(window.innerHeight-800)/2;window.open(`${n}/ui/profile?lng=${encodeURIComponent(t)}`,"_blank",`width=800,height=800,left=${o},top=${a},scrollbars=no,resizable=no,status=no,location=no,toolbar=no,menubar=no`)?.postMessage({type:"TOKEN",data:i.value.token},"*");const r=({data:e})=>{e&&"profile"===e.type&&(i.value={...i.value,...e},[localStorage,sessionStorage].filter((e=>e.getItem("WALINE_USER"))).forEach((e=>e.setItem("WALINE_USER",JSON.stringify(i)))),window.removeEventListener("message",r))};window.addEventListener("message",r)},submitComment:U,isLogin:S,userInfo:i,isSubmitting:j,wordNumber:$,wordLimit:C,isWordNumberLegal:L,editor:a,userMeta:r,emoji:f,emojiTabIndex:w,showEmoji:y,canUploadImage:x,previewText:k,showPreview:b,inputRefs:c,editorRef:u,emojiButtonRef:g,emojiPopupRef:h,imageUploadRef:p}}}),dt={class:"wl-comment"},vt={key:0,class:"wl-login-info"},pt={class:"wl-avatar"},gt=["title"],ht=["src"],ft=["textContent"],wt={class:"wl-panel"},yt=["for","textContent"],bt=["id","name","type","onUpdate:modelValue"],kt=["placeholder"],$t={class:"wl-preview"},Ct=f("hr",null,null,-1),Lt=["innerHTML"],It={class:"wl-footer"},jt={class:"wl-actions"},Rt={href:"https://guides.github.com/features/mastering-markdown/",title:"Markdown Guide","aria-label":"Markdown is supported",class:"wl-action",target:"_blank",rel:"noreferrer"},St=["title"],xt=["title"],Et=["title"],At={class:"wl-info"},Ut={class:"wl-text-number"},zt={key:0},Mt=S("  /  "),Ot=["textContent"],Pt=["textContent"],Nt=["disabled"],Tt={key:0,class:"wl-tab-wrapper"},_t=["title","onClick"],Bt=["src","alt"],Dt={key:0,class:"wl-tabs"},Ft=["onClick"],Ht=["src","alt","title"],Vt=["title"];var Wt=ut(mt,[["render",function(e,t,n,o,l,a){const r=p("CloseIcon"),i=p("MarkdownIcon"),s=p("EmojiIcon"),c=p("ImageIcon"),u=p("PreviewIcon"),m=p("LoadingIcon");return g(),h("div",dt,["disable"!==e.config.login&&e.isLogin?(g(),h("div",vt,[f("div",pt,[f("button",{class:"wl-logout-btn",title:e.locale.logout,onClick:t[0]||(t[0]=(...t)=>e.onLogout&&e.onLogout(...t))},[w(r,{size:14})],8,gt),f("img",{src:e.userInfo.avatar,alt:"avatar"},null,8,ht)]),f("a",{href:"#",class:"wl-login-nick","aria-label":"Profile",onClick:t[1]||(t[1]=(...t)=>e.onProfile&&e.onProfile(...t)),textContent:y(e.userInfo.display_name)},null,8,ft)])):b("v-if",!0),f("div",wt,["force"!==e.config.login&&e.config.meta.length&&!e.isLogin?(g(),h("div",{key:0,class:k(["wl-header",`item${e.config.meta.length}`])},[(g(!0),h($,null,C(e.config.meta,(t=>(g(),h("div",{class:"wl-header-item",key:t},[f("label",{for:t,textContent:y(e.locale[t]+(e.config.requiredMeta.includes(t)||!e.config.requiredMeta.length?"":`(${e.locale.optional})`))},null,8,yt),L(f("input",{ref_for:!0,ref:n=>{n&&(e.inputRefs[t]=n)},id:`wl-${t}`,class:k(["wl-input",`wl-${t}`]),name:t,type:"mail"===t?"email":"text","onUpdate:modelValue":n=>e.userMeta[t]=n},null,10,bt),[[I,e.userMeta[t]]])])))),128))],2)):b("v-if",!0),L(f("textarea",{class:"wl-editor",ref:"editorRef",id:"wl-edit",placeholder:e.replyUser?`@${e.replyUser}`:e.locale.placeholder,"onUpdate:modelValue":t[2]||(t[2]=t=>e.editor=t),onKeydown:t[3]||(t[3]=(...t)=>e.onKeyDown&&e.onKeyDown(...t)),onDrop:t[4]||(t[4]=(...t)=>e.onDrop&&e.onDrop(...t)),onPaste:t[5]||(t[5]=(...t)=>e.onPaste&&e.onPaste(...t))},null,40,kt),[[j,e.editor]]),L(f("div",$t,[Ct,f("h4",null,y(e.locale.preview)+":",1),f("div",{class:"wl-content",innerHTML:e.previewText},null,8,Lt)],512),[[R,e.showPreview]]),f("div",It,[f("div",jt,[f("a",Rt,[w(i)]),L(f("button",{ref:"emojiButtonRef",class:k(["wl-action",{actived:e.showEmoji}]),title:e.locale.emoji,onClick:t[6]||(t[6]=t=>e.showEmoji=!e.showEmoji)},[w(s)],10,St),[[R,e.emoji.tabs.length]]),f("input",{ref:"imageUploadRef",class:"upload",id:"wl-image-upload",type:"file",accept:".png,.jpg,.jpeg,.webp,.bmp,.gif",onChange:t[7]||(t[7]=(...t)=>e.onChange&&e.onChange(...t))},null,544),e.canUploadImage?(g(),h("label",{key:0,for:"wl-image-upload",class:"wl-action",title:e.locale.uploadImage},[w(c)],8,xt)):b("v-if",!0),f("button",{class:k(["wl-action",{actived:e.showPreview}]),title:e.locale.preview,onClick:t[8]||(t[8]=t=>e.showPreview=!e.showPreview)},[w(u)],10,Et)]),f("div",At,[f("div",Ut,[S(y(e.wordNumber)+" ",1),e.config.wordLimit?(g(),h("span",zt,[Mt,f("span",{class:k({illegal:!e.isWordNumberLegal}),textContent:y(e.wordLimit)},null,10,Ot)])):b("v-if",!0),S("  "+y(e.locale.word),1)]),"disable"===e.config.login||e.isLogin?b("v-if",!0):(g(),h("button",{key:0,class:"wl-btn",onClick:t[9]||(t[9]=(...t)=>e.onLogin&&e.onLogin(...t)),textContent:y(e.locale.login)},null,8,Pt)),"force"!==e.config.login||e.isLogin?(g(),h("button",{key:1,class:"wl-btn primary",title:"Cmd|Ctrl + Enter",disabled:e.isSubmitting,onClick:t[10]||(t[10]=(...t)=>e.submitComment&&e.submitComment(...t))},[e.isSubmitting?(g(),x(m,{key:0,size:16})):(g(),h($,{key:1},[S(y(e.locale.submit),1)],2112))],8,Nt)):b("v-if",!0)]),f("div",{ref:"emojiPopupRef",class:k(["wl-emoji-popup",{display:e.showEmoji}])},[(g(!0),h($,null,C(e.emoji.tabs,((t,n)=>(g(),h($,{key:t.name},[n===e.emojiTabIndex?(g(),h("div",Tt,[(g(!0),h($,null,C(t.items,(t=>(g(),h("button",{key:t,title:t,onClick:n=>e.insert(`:${t}:`)},[e.showEmoji?(g(),h("img",{key:0,class:"wl-emoji",src:e.emoji.map[t],alt:t,loading:"lazy",referrerPolicy:"no-referrer"},null,8,Bt)):b("v-if",!0)],8,_t)))),128))])):b("v-if",!0)],64)))),128)),e.emoji.tabs.length>1?(g(),h("div",Dt,[(g(!0),h($,null,C(e.emoji.tabs,((t,n)=>(g(),h("button",{key:t.name,class:k(["wl-tab",{active:e.emojiTabIndex===n}]),onClick:t=>e.emojiTabIndex=n},[f("img",{class:"wl-emoji",src:t.icon,alt:t.name,title:t.name,loading:"lazy",referrerPolicy:"no-referrer"},null,8,Ht)],10,Ft)))),128))])):b("v-if",!0)],2)])]),e.replyId?(g(),h("button",{key:1,class:"wl-close",title:e.locale.cancelReply,onClick:t[11]||(t[11]=t=>e.$emit("cancel-reply"))},[w(r,{size:24})],8,Vt)):b("v-if",!0)])}],["__file","CommentBox.vue"]]);const qt=["approved","waiting","spam"],Jt=u({props:{comment:{type:Object,required:!0},rootId:{type:String,required:!0},reply:{type:Object}},components:{CommentBox:Wt,DeleteIcon:()=>c("svg",{viewBox:"0 0 1024 1024",width:"24",height:"24"},c("path",{d:"m341.013 394.667 27.755 393.45h271.83l27.733-393.45h64.106l-28.01 397.952a64 64 0 0 1-63.83 59.498H368.768a64 64 0 0 1-63.83-59.52l-28.053-397.93h64.128zm139.307 19.818v298.667h-64V414.485h64zm117.013 0v298.667h-64V414.485h64zM181.333 288h640v64h-640v-64zm453.483-106.667v64h-256v-64h256z",fill:"red"})),LikeIcon:({active:e=!1})=>c("svg",{viewBox:"0 0 1024 1024",width:"24",height:"24"},[c("path",{d:"M850.654 323.804c-11.042-25.625-26.862-48.532-46.885-68.225-20.022-19.61-43.258-34.936-69.213-45.73-26.78-11.124-55.124-16.727-84.375-16.727-40.622 0-80.256 11.123-114.698 32.135A214.79 214.79 0 0 0 512 241.819a214.79 214.79 0 0 0-23.483-16.562c-34.442-21.012-74.076-32.135-114.698-32.135-29.25 0-57.595 5.603-84.375 16.727-25.872 10.711-49.19 26.12-69.213 45.73-20.105 19.693-35.843 42.6-46.885 68.225-11.453 26.615-17.303 54.877-17.303 83.963 0 27.439 5.603 56.03 16.727 85.117 9.31 24.307 22.659 49.52 39.715 74.981 27.027 40.293 64.188 82.316 110.33 124.915 76.465 70.615 152.189 119.394 155.402 121.371l19.528 12.525c8.652 5.52 19.776 5.52 28.427 0l19.529-12.525c3.213-2.06 78.854-50.756 155.401-121.371 46.143-42.6 83.304-84.622 110.33-124.915 17.057-25.46 30.487-50.674 39.716-74.981 11.124-29.087 16.727-57.678 16.727-85.117.082-29.086-5.768-57.348-17.221-83.963z"+(e?"":"M512 761.5S218.665 573.55 218.665 407.767c0-83.963 69.461-152.023 155.154-152.023 60.233 0 112.473 33.618 138.181 82.727 25.708-49.109 77.948-82.727 138.18-82.727 85.694 0 155.155 68.06 155.155 152.023C805.335 573.551 512 761.5 512 761.5z"),fill:e?"red":"currentColor"})]),ReplyIcon:()=>c("svg",{viewBox:"0 0 1024 1024",width:"24",height:"24"},c("path",{d:"M810.667 213.333a64 64 0 0 1 64 64V704a64 64 0 0 1-64 64H478.336l-146.645 96.107a21.333 21.333 0 0 1-33.024-17.856V768h-85.334a64 64 0 0 1-64-64V277.333a64 64 0 0 1 64-64h597.334zm0 64H213.333V704h149.334v63.296L459.243 704h351.424V277.333zm-271.36 213.334v64h-176.64v-64h176.64zm122.026-128v64H362.667v-64h298.666z",fill:"currentColor"})),VerifiedIcon:()=>c("svg",{class:"verified-icon",viewBox:"0 0 1024 1024",width:"14",height:"14"},c("path",{d:"m894.4 461.56-54.4-63.2c-10.4-12-18.8-34.4-18.8-50.4v-68c0-42.4-34.8-77.2-77.2-77.2h-68c-15.6 0-38.4-8.4-50.4-18.8l-63.2-54.4c-27.6-23.6-72.8-23.6-100.8 0l-62.8 54.8c-12 10-34.8 18.4-50.4 18.4h-69.2c-42.4 0-77.2 34.8-77.2 77.2v68.4c0 15.6-8.4 38-18.4 50l-54 63.6c-23.2 27.6-23.2 72.4 0 100l54 63.6c10 12 18.4 34.4 18.4 50v68.4c0 42.4 34.8 77.2 77.2 77.2h69.2c15.6 0 38.4 8.4 50.4 18.8l63.2 54.4c27.6 23.6 72.8 23.6 100.8 0l63.2-54.4c12-10.4 34.4-18.8 50.4-18.8h68c42.4 0 77.2-34.8 77.2-77.2v-68c0-15.6 8.4-38.4 18.8-50.4l54.4-63.2c23.2-27.6 23.2-73.2-.4-100.8zm-216-25.2-193.2 193.2a30 30 0 0 1-42.4 0l-96.8-96.8a30.16 30.16 0 0 1 0-42.4c11.6-11.6 30.8-11.6 42.4 0l75.6 75.6 172-172c11.6-11.6 30.8-11.6 42.4 0 11.6 11.6 11.6 30.8 0 42.4z",fill:"#27ae60"}))},emits:["submit","reply","like","delete","status","sticky"],setup(e){const t=m("config"),n=it(),o=at(),l=s((()=>t.value.locale)),a=s((()=>{let{link:t}=e.comment;return t?Me(t)?t:`https://${t}`:""})),r=s((()=>n.value.includes(e.comment.objectId))),i=((e,t)=>{const n=Ee();return s((()=>Be(e,n.value,t)))})(e.comment.insertedAt,l.value),c=s((()=>"administrator"===o.value.type)),u=s((()=>e.comment.user_id&&o.value.objectId===e.comment.user_id)),d=s((()=>e.comment.objectId===e.reply?.objectId));return{config:t,locale:l,isReplyingCurrent:d,link:a,like:r,time:i,isAdmin:c,isOwner:u,commentStatus:qt}}}),Kt=["id"],Yt={class:"wl-user","aria-hidden":"true"},Gt=["src"],Xt={class:"wl-card"},Qt={class:"wl-head"},Zt=["href"],en={key:1,class:"wl-nick"},tn=["textContent"],nn=["textContent"],on=["textContent"],ln=["textContent"],an=["textContent"],rn={class:"wl-comment-actions"},sn=["title"],cn=["textContent"],un=["title"],mn={class:"wl-meta","aria-hidden":"true"},dn=["textContent"],vn=["textContent"],pn=["textContent"],gn=["innerHTML"],hn={key:0,class:"wl-admin-actions"},fn={class:"wl-comment-status"},wn=["disabled","onClick","textContent"],yn={key:1,class:"wl-reply-wrapper"},bn={key:2,class:"wl-quote"};const kn=u({name:"WalineRoot",components:{CommentBox:Wt,CommentCard:ut(Jt,[["render",function(e,t,n,o,l,a){const r=p("VerifiedIcon"),i=p("DeleteIcon"),s=p("LikeIcon"),c=p("ReplyIcon"),u=p("CommentBox"),m=p("CommentCard",!0);return g(),h("div",{class:"wl-item",id:e.comment.objectId},[f("div",Yt,[e.comment.avatar?(g(),h("img",{key:0,src:e.comment.avatar},null,8,Gt)):b("v-if",!0),e.comment.type?(g(),x(r,{key:1})):b("v-if",!0)]),f("div",Xt,[f("div",Qt,[e.link?(g(),h("a",{key:0,class:"wl-nick",href:e.link,target:"_blank",rel:"nofollow noreferrer"},y(e.comment.nick),9,Zt)):(g(),h("span",en,y(e.comment.nick),1)),"administrator"===e.comment.type?(g(),h("span",{key:2,class:"wl-badge",textContent:y(e.locale.admin)},null,8,tn)):b("v-if",!0),e.comment.label?(g(),h("span",{key:3,class:"wl-badge",textContent:y(e.comment.label)},null,8,nn)):b("v-if",!0),e.comment.sticky?(g(),h("span",{key:4,class:"wl-badge",textContent:y(e.locale.sticky)},null,8,on)):b("v-if",!0),e.comment.level&&e.comment.level>=0?(g(),h("span",{key:5,class:k(`wl-badge level${e.comment.level}`),textContent:y(e.locale[`level${e.comment.level}`]||`Level ${e.comment.level}`)},null,10,ln)):b("v-if",!0),f("span",{class:"wl-time",textContent:y(e.time)},null,8,an),f("div",rn,[e.isAdmin||e.isOwner?(g(),h("button",{key:0,class:"wl-delete",onClick:t[0]||(t[0]=t=>e.$emit("delete",e.comment))},[w(i)])):b("v-if",!0),f("button",{class:"wl-like",onClick:t[1]||(t[1]=t=>e.$emit("like",e.comment)),title:e.like?e.locale.cancelLike:e.locale.like},[w(s,{active:e.like},null,8,["active"]),"like"in e.comment?(g(),h("span",{key:0,textContent:y(e.comment.like)},null,8,cn)):b("v-if",!0)],8,sn),f("button",{class:k(["wl-reply",{active:e.isReplyingCurrent}]),title:e.isReplyingCurrent?e.locale.cancelReply:e.locale.reply,onClick:t[2]||(t[2]=t=>e.$emit("reply",e.isReplyingCurrent?null:e.comment))},[w(c)],10,un)])]),f("div",mn,[e.comment.addr?(g(),h("span",{key:0,textContent:y(e.comment.addr)},null,8,dn)):b("v-if",!0),e.comment.browser?(g(),h("span",{key:1,textContent:y(e.comment.browser)},null,8,vn)):b("v-if",!0),e.comment.os?(g(),h("span",{key:2,textContent:y(e.comment.os)},null,8,pn)):b("v-if",!0)]),f("div",{class:"wl-content",innerHTML:e.comment.comment},null,8,gn),e.isAdmin?(g(),h("div",hn,[f("span",fn,[(g(!0),h($,null,C(e.commentStatus,(t=>(g(),h("button",{key:t,class:k(`wl-btn wl-${t}`),disabled:e.comment.status===t,onClick:n=>e.$emit("status",{status:t,comment:e.comment}),textContent:y(t)},null,10,wn)))),128))]),e.isAdmin&&!e.comment.rid?(g(),h("button",{key:0,class:"wl-btn wl-sticky",onClick:t[3]||(t[3]=t=>e.$emit("sticky",e.comment))},y(e.comment.sticky?"unsticky":"sticky"),1)):b("v-if",!0)])):b("v-if",!0),e.isReplyingCurrent?(g(),h("div",yn,[w(u,{replyId:e.comment.objectId,replyUser:e.comment.nick,rootId:e.rootId,onSubmit:t[4]||(t[4]=t=>e.$emit("submit",t)),onCancelReply:t[5]||(t[5]=t=>e.$emit("reply",null))},null,8,["replyId","replyUser","rootId"])])):b("v-if",!0),e.comment.children?(g(),h("div",bn,[(g(!0),h($,null,C(e.comment.children,(n=>(g(),x(m,{key:n.objectId,comment:n,reply:e.reply,rootId:e.rootId,onReply:t[6]||(t[6]=t=>e.$emit("reply",t)),onSubmit:t[7]||(t[7]=t=>e.$emit("submit",t)),onLike:t[8]||(t[8]=t=>e.$emit("like",t)),onDelete:t[9]||(t[9]=t=>e.$emit("delete",t)),onStatus:t[10]||(t[10]=t=>e.$emit("status",t)),onSticky:t[11]||(t[11]=t=>e.$emit("sticky",t))},null,8,["comment","reply","rootId"])))),128))])):b("v-if",!0)])],8,Kt)}],["__file","CommentCard.vue"]]),LoadingIcon:ct},props:["serverURL","path","meta","requiredMeta","dark","lang","locale","pageSize","wordLimit","emoji","login","highlighter","texRenderer","imageUploader","copyright"],setup(e){const t=s((()=>(({serverURL:e,path:t=location.pathname,lang:n="zh-CN",locale:o,emoji:l=["//unpkg.com/@waline/emojis@1.0.1/weibo"],meta:a=["nick","mail","link"],requiredMeta:r=[],dark:i=!1,pageSize:s=10,wordLimit:c,imageUploader:u,highlighter:m,texRenderer:d,copyright:v=!0,login:p="enable",...g})=>({serverURL:Oe(e),path:Ue(t),locale:{...Q[n]||Q["zh-CN"],..."object"==typeof o?o:{}},wordLimit:Pe(c),meta:N(a),requiredMeta:N(r),imageUploader:Ne(u,T),highlighter:Ne(m,H),texRenderer:Ne(d,_),lang:n,dark:i,emoji:l,pageSize:s,login:p,copyright:v,...g}))(e))),l=at(),a=it(),i=o("loading"),c=o(0),u=o(1),m=o(0),v=o([]),p=o(null),g=s((()=>{return"string"==typeof(e=t.value.dark)?"auto"===e?`@media(prefers-color-scheme:dark){body${Te}}`:`${e}${Te}`:!0===e?`:root${Te}`:"";var e}));let h;!function(e,t={}){const l=o(!1),{document:a=he,immediate:i=!0,manual:s=!1,id:c="vueuse_styletag_"+ ++Ae}=t,u=o(e);let m=()=>{};const d=()=>{if(!a)return;const e=a.getElementById(c)||a.createElement("style");e.type="text/css",e.id=c,t.media&&(e.media=t.media),a.head.appendChild(e),l.value||(m=n(u,(t=>{e.innerText=t}),{immediate:!0}),l.value=!0)},v=()=>{a&&l.value&&(m(),a.head.removeChild(a.getElementById(c)),l.value=!1)};i&&!s&&d(),s||Z(v),r(l)}(g);const f=e=>{const{serverURL:n,path:o,pageSize:a}=t.value,r=new AbortController;i.value="loading",h?.(),(({serverURL:e,lang:t,path:n,page:o,pageSize:l,signal:a,token:r})=>{const i={};return r&&(i.Authorization=`Bearer ${r}`),fetch(`${e}/comment?path=${encodeURIComponent(n)}&pageSize=${l}&page=${o}&lang=${t}`,{signal:a,headers:i}).then((e=>e.json())).then((e=>We(e,"comment list")))})({serverURL:n,lang:t.value.lang,path:o,pageSize:a,page:e,signal:r.signal,token:l.value?.token}).then((t=>{i.value="success",c.value=t.count,v.value.push(...t.data),u.value=e,m.value=t.totalPages})).catch((e=>{"AbortError"!==e.name&&(console.error(e.message),i.value="error")})),h=r.abort.bind(r)},w=()=>{c.value=0,v.value=[],f(1)};return E("config",t),n((()=>e.path),w),d((()=>w())),{config:t,darkmodeStyle:g,i18n:s((()=>t.value.locale)),status:i,count:c,page:u,totalPages:m,data:v,reply:p,loadMore:()=>f(u.value+1),refresh:w,onReply:e=>{p.value=e},onSubmit:e=>{if(e.rid){const t=v.value.find((({objectId:t})=>t===e.rid));if(!t)return;Array.isArray(t.children)||(t.children=[]),t.children.push(e)}else v.value.unshift(e)},onStatusChange:async({comment:e,status:n})=>{if(e.status===n)return;const{serverURL:o,lang:a}=t.value;await qe({serverURL:o,lang:a,token:l.value?.token,objectId:e.objectId,status:n}),e.status=n},onDelete:async({objectId:e})=>{if(!confirm("Are you sure you want to delete this comment?"))return;const{serverURL:n,lang:o}=t.value;await(({serverURL:e,lang:t,token:n,objectId:o})=>fetch(`${e}/comment/${o}?lang=${t}`,{method:"DELETE",headers:{Authorization:`Bearer ${n}`}}).then((e=>e.json())))({serverURL:n,lang:o,token:l.value?.token,objectId:e}),v.value.some(((t,n)=>t.objectId===e?(v.value=v.value.filter(((e,t)=>t!==n)),!0):t.children.some(((o,l)=>o.objectId===e&&(v.value[n].children=t.children.filter(((e,t)=>t!==l)),!0)))))},onSticky:async e=>{if(e.rid)return;const{serverURL:n,lang:o}=t.value;await qe({serverURL:n,lang:o,token:l.value?.token,objectId:e.objectId,sticky:e.sticky?0:1}),e.sticky=!e.sticky},onLike:async e=>{const{serverURL:n,lang:o}=t.value,{objectId:l}=e,r=a.value.includes(l);await(({serverURL:e,lang:t,objectId:n,like:o})=>fetch(`${e}/comment/${n}?lang=${t}`,{method:"PUT",headers:Ve,body:JSON.stringify({like:o})}).then((e=>e.json())))({serverURL:n,lang:o,objectId:l,like:!r}),r?a.value=a.value.filter((e=>e!==l)):(a.value=[...a.value,l],a.value.length>50&&(a.value=a.value.slice(-50))),e.like=(e.like||0)+(r?-1:1)},version:"2.4.2"}}}),$n={"data-waline":""},Cn={class:"wl-count"},Ln=["textContent"],In={class:"wl-cards"},jn={key:1,class:"wl-operation"},Rn=["textContent"],Sn={key:0,class:"wl-loading"},xn=["textContent"],En={class:"wl-operation"},An=["textContent"],Un={key:3,class:"wl-power"},zn=S(" Powered by "),Mn=f("a",{href:"https://github.com/walinejs/waline",target:"_blank",rel:"noreferrer"}," Waline ",-1);var On=ut(kn,[["render",function(e,t,n,o,l,a){const r=p("CommentBox"),i=p("CommentCard"),s=p("LoadingIcon");return g(),h("div",$n,[e.reply?b("v-if",!0):(g(),x(r,{key:0,onSubmit:e.onSubmit},null,8,["onSubmit"])),f("div",Cn,[e.count?(g(),h("span",{key:0,class:"wl-num",textContent:y(e.count)},null,8,Ln)):b("v-if",!0),S(" "+y(e.i18n.comment),1)]),f("div",In,[(g(!0),h($,null,C(e.data,(t=>(g(),x(i,{key:t.objectId,"root-id":t.objectId,comment:t,reply:e.reply,onReply:e.onReply,onSubmit:e.onSubmit,onStatus:e.onStatusChange,onDelete:e.onDelete,onSticky:e.onSticky,onLike:e.onLike},null,8,["root-id","comment","reply","onReply","onSubmit","onStatus","onDelete","onSticky","onLike"])))),128))]),"error"===e.status?(g(),h("div",jn,[f("button",{type:"button",class:"wl-btn",onClick:t[0]||(t[0]=(...t)=>e.refresh&&e.refresh(...t)),textContent:y(e.i18n.refresh)},null,8,Rn)])):(g(),h($,{key:2},["loading"===e.status?(g(),h("div",Sn,[w(s,{size:30})])):e.data.length?e.page<e.totalPages?(g(),h($,{key:2},[b(" Load more button "),f("div",En,[f("button",{type:"button",class:"wl-btn",onClick:t[1]||(t[1]=(...t)=>e.loadMore&&e.loadMore(...t)),textContent:y(e.i18n.more)},null,8,An)])],2112)):b("v-if",!0):(g(),h("div",{key:1,class:"wl-empty",textContent:y(e.i18n.sofa)},null,8,xn))],2112)),b(" Copyright Information "),e.config.copyright?(g(),h("div",Un,[zn,Mn,S(" v"+y(e.version),1)])):b("v-if",!0)])}],["__file","Waline.vue"]]);const Pn=(e,t)=>{t.forEach(((t,n)=>{t.innerText=e[n].toString()}))},Nn=({serverURL:e,path:t=window.location.pathname,selector:n=".waline-pageview-count",update:o=!0,lang:l="zh-CN"})=>{const a=new AbortController,r=Array.from(document.querySelectorAll(n)),i=e=>{const n=ot(e);return null!==n&&t!==n},s=n=>Je({serverURL:e,paths:n.map((e=>ot(e)||t)),lang:l,signal:a.signal}).then((e=>Pn(e,n))).catch(He);if(o){const n=r.filter((e=>!i(e))),o=r.filter(i);Ke({serverURL:e,path:t,lang:l}).then((e=>Pn(new Array(n.length).fill(e),n))),o.length&&s(o)}else s(r);return a.abort.bind(a)},Tn=({el:e="#waline",path:t=window.location.pathname,comment:n=!1,pageview:o=!1,...l})=>{const a=e?Ye(e):null;if(e&&!a)throw new Error("Option 'el' do not match any domElement!");if(!l.serverURL)throw new Error("Option 'serverURL' is missing!");const r=A({...l}),i=A({comment:n,pageview:o,path:t}),s=()=>{i.comment&&st({serverURL:r.serverURL,path:i.path,selector:"string"==typeof i.comment?i.comment:void 0})},u=()=>{i.pageview&&Nn({serverURL:r.serverURL,path:i.path,selector:"string"==typeof i.pageview?i.pageview:void 0})},m=a?U((()=>c(On,{path:i.path,...r}))):null;m&&m.mount(a),s(),u();const d=z(s),v=z(u);return{el:a,update:({comment:e,pageview:t,path:n=window.location.pathname,...o}={})=>{Object.entries(o).forEach((([e,t])=>{r[e]=t})),i.path=n,void 0!==e&&(i.comment=e),void 0!==t&&(i.pageview=t)},destroy:()=>{m?.unmount(),d(),v()}}},_n="2.4.2",Bn=({el:e,serverURL:t,count:n,lang:o="zh-CN"})=>{const l=at(),a=Ye(e),r=new AbortController;return(({serverURL:e,lang:t,count:n,signal:o,token:l})=>{const a={};return l&&(a.Authorization=`Bearer ${l}`),fetch(`${e}/comment?type=recent&count=${n}&lang=${t}`,{signal:o,headers:a}).then((e=>e.json())).then((e=>We(e,"recent comment")))})({serverURL:t,count:n,lang:o,signal:r.signal,token:l.value?.token}).then((e=>a&&e.length?(a.innerHTML=`<ul class="wl-recent-list">${e.map((e=>`<li class="wl-recent-item"><a href="${e.url}">${e.nick}</a>:${e.comment}</li>`)).join("")}</ul>`,{comments:e,destroy:()=>{r.abort(),a.innerHTML=""}}):{comments:e,destroy:()=>r.abort()}))};export{Bn as RecentComments,st as commentCount,Q as defaultLocales,Tn as init,Nn as pageviewCount,_n as version};
import{getCurrentScope as e,onScopeDispose as t,watch as n,ref as o,unref as l,isRef as a,readonly as i,shallowRef as r,computed as s,defineComponent as c,toRefs as u,onMounted as m,onBeforeUnmount as d,openBlock as v,createElementBlock as p,normalizeStyle as g,Fragment as f,renderList as h,renderSlot as w,createTextVNode as y,toDisplayString as b,nextTick as k,h as C,inject as $,onUnmounted as I,resolveComponent as L,createElementVNode as x,createVNode as S,createCommentVNode as j,normalizeClass as R,withDirectives as E,vModelDynamic as A,vModelText as U,vShow as z,createBlock as M,withCtx as O,provide as P,reactive as T,createApp as H,watchEffect as N}from"vue";import V from"autosize";import{marked as _}from"marked";const B=["nick","mail","link"],F=e=>e.filter((e=>B.includes(e))),D=e=>new Promise(((t,n)=>{const o=new FileReader;o.readAsDataURL(e),o.onload=()=>t(o.result?.toString()||""),o.onerror=n})),W=e=>!0===e?'<p class="wl-tex">Tex is not available in preview</p>':'<span class="wl-tex">Tex is not available in preview</span>',G=new RegExp(`(${/[\u4E00-\u9FFF\u3400-\u4dbf\uf900-\ufaff\u3040-\u309f\uac00-\ud7af\u0400-\u04FF]+|\w+/.source}|${/</.source})|((?:${/(?:^|\s)\/\/(.+?)$/gm.source})|(?:${/\/\*([\S\s]*?)\*\//gm.source}))`,"gmi"),q=["23AC69","91C132","F19726","E8552D","1AAB8E","E1147F","2980C1","1BA1E6","9FA0A0","F19726","E30B20","E30B20","A3338B"],J={},K=e=>{let t=0;return e.replace(G,((e,n,o)=>{if(o)return`<span style="color: slategray">${o}</span>`;if("<"===n)return"&lt;";let l;J[n]?l=J[n]:(l=q[t],J[n]=l);const a=`<span style="color: #${l}">${n}</span>`;return t=++t%q.length,a}))},Y=["nick","nickError","mail","mailError","link","optional","placeholder","sofa","submit","like","cancelLike","reply","cancelReply","comment","refresh","more","preview","emoji","uploadImage","seconds","minutes","hours","days","now","uploading","login","logout","admin","sticky","word","wordHint","anonymous","level0","level1","level2","level3","level4","level5","gif","gifSearchPlaceholder"],Z=e=>Object.fromEntries(e.map(((e,t)=>[Y[t],e])));var X=Z(["NickName","NickName cannot be less than 3 bytes.","E-Mail","Please confirm your email address.","Website","Optional","Comment here...","No comment yet.","Submit","Like","Cancel like","Reply","Cancel reply","Comments","Refresh","Load More...","Preview","Emoji","Upload Image","seconds ago","minutes ago","hours ago","days ago","just now","Uploading","Login","logout","Admin","Sticky","Words","Please input comments between $0 and $1 words!\n Current word number: $2","Anonymous","Dwarves","Hobbits","Ents","Wizards","Elves","Maiar","GIF","Search GIF"]),Q=Z(["ニックネーム","3バイト以上のニックネームをご入力ください.","メールアドレス","メールアドレスをご確認ください.","サイト","オプション","ここにコメント","コメントしましょう~","提出する","Like","Cancel like","返信する","キャンセル","コメント","更新","さらに読み込む","プレビュー","絵文字","画像をアップロード","秒前","分前","時間前","日前","たっだ今","アップロード","ログインする","ログアウト","管理者","トップに置く","ワード","コメントは $0 から $1 ワードの間でなければなりません!\n 現在の単語番号: $2","匿名","うえにん","なかにん","しもおし","特にしもおし","かげ","なぬし","GIF","探す GIF"]),ee=Z(["昵称","昵称不能少于3个字符","邮箱","请填写正确的邮件地址","网址","可选","欢迎评论","来发评论吧~","提交","喜欢","取消喜欢","回复","取消回复","评论","刷新","加载更多...","预览","表情","上传图片","秒前","分钟前","小时前","天前","刚刚","正在上传","登录","退出","博主","置顶","字","评论字数应在 $0 到 $1 字之间!\n当前字数:$2","匿名","潜水","冒泡","吐槽","活跃","话痨","传说","表情包","搜索表情包"]),te=Z(["暱稱","郵箱","網址","可選","暱稱不能少於3個字元","請填寫正確的郵件地址","歡迎評論","來發評論吧~","提交","喜歡","取消喜歡","回覆","取消回覆","評論","刷新","載入更多...","預覽","表情","上傳圖片","秒前","分鐘前","小時前","天前","剛剛","正在上傳","登錄","退出","博主","置頂","字","評論字數應在 $0 到 $1 字之間!\n當前字數:$2","匿名","潛水","冒泡","吐槽","活躍","話癆","傳說","表情包","搜索表情包"]),ne=Z(["Apelido","Apelido não pode ser menor que 3 bytes.","E-Mail","Por favor, confirme seu endereço de e-mail.","Website","Opcional","Comente aqui...","Nenhum comentário, ainda.","Enviar","Like","Cancel like","Responder","Cancelar resposta","Comentários","Refrescar","Carregar Mais...","Visualizar","Emoji","Enviar Imagem","segundos atrás","minutos atrás","horas atrás","dias atrás","agora mesmo","Enviando","Entrar","Sair","Admin","Sticky","Palavras","Favor enviar comentário com $0 a $1 palavras!\n Número de palavras atuais: $2","Anônimo","Dwarves","Hobbits","Ents","Wizards","Elves","Maiar","GIF","Pesquisar GIF"]),oe=Z(["Псевдоним","Никнейм не может быть меньше 3 байт.","Эл. адрес","Пожалуйста, подтвердите адрес вашей электронной почты.","Веб-сайт","Необязательный","Комментарий здесь...","Пока нет комментариев.","Отправить","Like","Cancel like","Отвечать","Отменить ответ","Комментарии","Обновить","Загрузи больше...","Превью","эмодзи","Загрузить изображение","секунд назад","несколько минут назад","несколько часов назад","дней назад","прямо сейчас","Загрузка","Авторизоваться","Выход из системы","Админ","Липкий","Слова","Пожалуйста, введите комментарии от $0 до $1 слов!\nНомер текущего слова: $2","Анонимный","Dwarves","Hobbits","Ents","Wizards","Elves","Maiar","GIF","Поиск GIF"]);const le={zh:ee,"zh-cn":ee,"zh-CN":ee,"zh-tw":te,"zh-TW":te,en:X,"en-US":X,"en-us":X,jp:Q,"jp-jp":Q,"jp-JP":Q,"pt-br":ne,"pt-BR":ne,ru:oe,"ru-ru":oe,"ru-RU":oe};function ae(n){return!!e()&&(t(n),!0)}const ie="undefined"!=typeof window,re=()=>{};const se=e=>e();var ce=Object.getOwnPropertySymbols,ue=Object.prototype.hasOwnProperty,me=Object.prototype.propertyIsEnumerable;function de(e,t,o={}){const l=o,{eventFilter:a=se}=l,i=((e,t)=>{var n={};for(var o in e)ue.call(e,o)&&t.indexOf(o)<0&&(n[o]=e[o]);if(null!=e&&ce)for(var o of ce(e))t.indexOf(o)<0&&me.call(e,o)&&(n[o]=e[o]);return n})(l,["eventFilter"]);return n(e,(r=a,s=t,function(...e){r((()=>s.apply(this,e)),{fn:s,thisArg:this,args:e})}),i);var r,s}var ve=Object.defineProperty,pe=Object.defineProperties,ge=Object.getOwnPropertyDescriptors,fe=Object.getOwnPropertySymbols,he=Object.prototype.hasOwnProperty,we=Object.prototype.propertyIsEnumerable,ye=(e,t,n)=>t in e?ve(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;function be(e,t,n={}){const l=n,{eventFilter:a}=l,i=((e,t)=>{var n={};for(var o in e)he.call(e,o)&&t.indexOf(o)<0&&(n[o]=e[o]);if(null!=e&&fe)for(var o of fe(e))t.indexOf(o)<0&&we.call(e,o)&&(n[o]=e[o]);return n})(l,["eventFilter"]),{eventFilter:r,pause:s,resume:c,isActive:u}=function(e=se){const t=o(!0);return{isActive:t,pause:function(){t.value=!1},resume:function(){t.value=!0},eventFilter:(...n)=>{t.value&&e(...n)}}}(a),m=de(e,t,(d=((e,t)=>{for(var n in t||(t={}))he.call(t,n)&&ye(e,n,t[n]);if(fe)for(var n of fe(t))we.call(t,n)&&ye(e,n,t[n]);return e})({},i),pe(d,ge({eventFilter:r}))));var d;return{stop:m,pause:s,resume:c,isActive:u}}const ke=ie?window:void 0,Ce=ie?window.document:void 0;function $e(...e){let t,o,a,i;if("string"==typeof e[0]?([o,a,i]=e,t=ke):[t,o,a,i]=e,!t)return re;let r=re;const s=n((()=>function(e){var t;const n=l(e);return null!=(t=null==n?void 0:n.$el)?t:n}(t)),(e=>{r(),e&&(e.addEventListener(o,a,i),r=()=>{e.removeEventListener(o,a,i),r=re})}),{immediate:!0,flush:"post"}),c=()=>{s(),r()};return ae(c),c}ie&&window.navigator,ie&&window.location;const Ie="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},Le="__vueuse_ssr_handlers__";Ie[Le]=Ie[Le]||{};const xe=Ie[Le];const Se={boolean:{read:e=>"true"===e,write:e=>String(e)},object:{read:e=>JSON.parse(e),write:e=>JSON.stringify(e)},number:{read:e=>Number.parseFloat(e),write:e=>String(e)},any:{read:e=>e,write:e=>String(e)},string:{read:e=>e,write:e=>String(e)},map:{read:e=>new Map(JSON.parse(e)),write:e=>JSON.stringify(Array.from(e.entries()))},set:{read:e=>new Set(JSON.parse(e)),write:e=>JSON.stringify(Array.from(e))},date:{read:e=>new Date(e),write:e=>e.toISOString()}};function je(e,t,n,a={}){var i;const{flush:s="pre",deep:c=!0,listenToStorageChanges:u=!0,writeDefaults:m=!0,shallow:d,window:v=ke,eventFilter:p,onError:g=(e=>{console.error(e)})}=a,f=(d?r:o)(t);if(!n)try{n=function(e,t){return xe[e]||t}("getDefaultStorage",(()=>{var e;return null==(e=ke)?void 0:e.localStorage}))()}catch(e){g(e)}if(!n)return f;const h=l(t),w=function(e){return null==e?"any":e instanceof Set?"set":e instanceof Map?"map":e instanceof Date?"date":"boolean"==typeof e?"boolean":"string"==typeof e?"string":"object"==typeof e||Array.isArray(e)?"object":Number.isNaN(e)?"any":"number"}(h),y=null!=(i=a.serializer)?i:Se[w],{pause:b,resume:k}=be(f,(()=>function(t){try{null==t?n.removeItem(e):n.setItem(e,y.write(t))}catch(e){g(e)}}(f.value)),{flush:s,deep:c,eventFilter:p});return v&&u&&$e(v,"storage",C),C(),f;function C(t){t&&t.key!==e||(f.value=function(t){if(!t||t.key===e){b();try{const o=t?t.newValue:n.getItem(e);return null==o?(m&&null!==h&&n.setItem(e,y.write(h)),h):"string"!=typeof o?o:y.read(o)}catch(e){g(e)}finally{k()}}}(t))}}var Re,Ee,Ae=Object.defineProperty,Ue=Object.getOwnPropertySymbols,ze=Object.prototype.hasOwnProperty,Me=Object.prototype.propertyIsEnumerable,Oe=(e,t,n)=>t in e?Ae(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;function Pe(e={}){const{controls:t=!1,interval:i="requestAnimationFrame"}=e,r=o(new Date),s=()=>r.value=new Date,c="requestAnimationFrame"===i?function(e,t={}){const{immediate:n=!0,window:l=ke}=t,a=o(!1);let i=null;function r(){a.value&&l&&(e(),i=l.requestAnimationFrame(r))}function s(){!a.value&&l&&(a.value=!0,r())}function c(){a.value=!1,null!=i&&l&&(l.cancelAnimationFrame(i),i=null)}return n&&s(),ae(c),{isActive:a,pause:c,resume:s}}(s,{immediate:!0}):function(e,t=1e3,i={}){const{immediate:r=!0,immediateCallback:s=!1}=i;let c=null;const u=o(!1);function m(){c&&(clearInterval(c),c=null)}function d(){u.value=!1,m()}function v(){t<=0||(u.value=!0,s&&e(),m(),c=setInterval(e,l(t)))}r&&ie&&v(),a(t)&&ae(n(t,(()=>{r&&ie&&v()})));return ae(d),{isActive:u,pause:d,resume:v}}(s,i,{immediate:!0});return t?((e,t)=>{for(var n in t||(t={}))ze.call(t,n)&&Oe(e,n,t[n]);if(Ue)for(var n of Ue(t))Me.call(t,n)&&Oe(e,n,t[n]);return e})({now:r},c):r}ie&&(null==window?void 0:window.navigator)&&(null==(Re=null==window?void 0:window.navigator)?void 0:Re.platform)&&/iP(ad|hone|od)/.test(null==(Ee=null==window?void 0:window.navigator)?void 0:Ee.platform);let Te=0;const He=e=>{try{e=decodeURI(e)}catch(e){}return e},Ne=(e="")=>e.replace(/\/$/u,""),Ve=e=>/^(https?:)?\/\//.test(e),_e=e=>{const t=Ne(e);return Ve(t)?t:`https://${t}`},Be=e=>Array.isArray(e)?e:!!e&&[0,e],Fe=(e,t)=>"function"==typeof e?e:!1!==e&&t,De="{--waline-white:#000;--waline-light-grey:#666;--waline-dark-grey:#999;--waline-color:#888;--waline-bgcolor:#1e1e1e;--waline-bgcolor-light:#272727;--waline-bgcolor-hover: #444;--waline-border-color:#333;--waline-disable-bgcolor:#444;--waline-disable-color:#272727;--waline-bq-color:#272727;--waline-info-bgcolor:#272727;--waline-info-color:#666}",We=(e,t)=>{let n=e.toString();for(;n.length<t;)n="0"+n;return n},Ge=(e,t,n)=>{if(!e)return"";const o="string"==typeof e?new Date(-1!==e.indexOf(" ")?e.replace(/-/g,"/"):e):e,l=t.getTime()-o.getTime(),a=Math.floor(l/864e5);if(0===a){const e=l%864e5,t=Math.floor(e/36e5);if(0===t){const t=e%36e5,o=Math.floor(t/6e4);if(0===o){const e=t%6e4;return`${Math.round(e/1e3)} ${n.seconds}`}return`${o} ${n.minutes}`}return`${t} ${n.hours}`}return a<0?n.now:a<8?`${a} ${n.days}`:(e=>{const t=We(e.getDate(),2),n=We(e.getMonth()+1,2);return`${We(e.getFullYear(),2)}-${n}-${t}`})(o)},qe=e=>{const t=je("WALINE_EMOJI",{}),n=Boolean(/@[0-9]+\.[0-9]+\.[0-9]+/.test(e));if(n){const n=t.value[e];if(n)return Promise.resolve(n)}return fetch(`${e}/info.json`).then((e=>e.json())).then((o=>{const l={folder:e,...o};return n&&(t.value[e]=l),l}))},Je=(e,t="",n="",o="")=>`${t?`${t}/`:""}${n}${e}${o?`.${o}`:""}`,Ke=e=>{"AbortError"!==e.name&&console.error(e.message)},Ye={"Content-Type":"application/json"},Ze=(e,t="")=>{if("object"==typeof e&&e.errno)throw new TypeError(`Fetch ${t} failed with ${e.errno}: ${e.errmsg}`);return e},Xe=({serverURL:e,lang:t,token:n,objectId:o,...l})=>fetch(`${e}/comment/${o}?lang=${t}`,{method:"PUT",headers:{"Content-Type":"application/json",Authorization:`Bearer ${n}`},body:JSON.stringify(l)}).then((e=>e.json())),Qe=({serverURL:e,lang:t,paths:n,signal:o})=>fetch(`${e}/article?path=${encodeURIComponent(n.join(","))}&lang=${t}`,{signal:o}).then((e=>e.json())).then((e=>Ze(e,"visit count"))).then((e=>Array.isArray(e)?e:[e])),et=({serverURL:e,lang:t,path:n})=>fetch(`${e}/article?lang=${t}`,{method:"POST",headers:Ye,body:JSON.stringify({path:n})}).then((e=>e.json())).then((e=>Ze(e,"visit count"))),tt=e=>e instanceof HTMLElement?e:"string"==typeof e?document.querySelector(e):null,nt=e=>e.type.includes("image"),ot=e=>{const t=Array.from(e).find(nt);return t?t.getAsFile():null},lt=/\$.*?\$/,at=/^\$(.*?)\$/,it=/^(?:\s{0,3})\$\$((?:[^\n]|\n[^\n])+?)\n{0,1}\$\$/,rt=(e="",t={})=>e.replace(/:(.+?):/g,((e,n)=>t[n]?`<img class="wl-emoji" src="${t[n]}" alt="${n}">`:e)),st=(e,{emojiMap:t,highlighter:n,texRenderer:o})=>{if(_.setOptions({highlight:n||void 0,breaks:!0,smartLists:!0,smartypants:!0}),o){const e=(e=>[{name:"blockMath",level:"block",tokenizer(t){const n=it.exec(t);if(null!==n)return{type:"html",raw:n[0],text:e(!0,n[1])}}},{name:"inlineMath",level:"inline",start(e){const t=e.search(lt);return-1!==t?t:e.length},tokenizer(t){const n=at.exec(t);if(null!==n)return{type:"html",raw:n[0],text:e(!1,n[1])}}}])(o);_.use({extensions:e})}return _.parse(rt(e,t))},ct=e=>e.dataset.path||e.getAttribute("id"),ut=({key:e,keyword:t,pos:n,limit:o})=>{const l=new URLSearchParams("media_filter=minimal");return l.set("key",e||"PAY5JLFIH6V6"),l.set("limit",(o||20).toString()),l.set("pos",n||""),l.set("q",t),fetch(`https://g.tenor.com/v1/search?${l.toString()}`,{headers:{"Content-Type":"application/json"}}).then((e=>e.json()))};let mt=null;const dt=()=>mt||(mt=je("USER_KEY",{}));let vt=null;const pt=()=>vt||(vt=je("WALIKE_LIKE",[])),gt=({serverURL:e,path:t=window.location.pathname,selector:n=".waline-comment-count",lang:o="zh-CN"})=>{const l=new AbortController,a=document.querySelectorAll(n),i=dt();return a.length&&(({serverURL:e,lang:t,paths:n,signal:o,token:l})=>{const a={};return l&&(a.Authorization=`Bearer ${l}`),fetch(`${e}/comment?type=count&url=${encodeURIComponent(n.join(","))}&lang=${t}`,{signal:o,headers:a}).then((e=>e.json())).then((e=>Ze(e,"comment count"))).then((e=>Array.isArray(e)?e:[e]))})({serverURL:e,paths:Array.from(a).map((e=>He(e.dataset.path||e.getAttribute("id")||t))),lang:o,signal:l.signal,token:i.value?.token}).then((e=>{a.forEach(((t,n)=>{t.innerText=e[n].toString()}))})).catch(Ke),l.abort.bind(l)},ft=["data-index"],ht=c({props:{columnWidth:{default:400},items:null,gap:{default:0},rtl:{type:Boolean,default:!1},ssrColumns:{default:0}},emits:["redraw","redraw-skip"],setup(e,{emit:t}){const a=e,{columnWidth:i,items:r,gap:s,rtl:c,ssrColumns:C}=u(a),$=o([]),I=o();function L(){const e=Math.floor((I.value.getBoundingClientRect().width+s.value)/(i.value+s.value));return e>0?e:1}function x(e){return[...new Array(e)].map((()=>[]))}if(C.value>0){const e=x(C.value);r.value.forEach(((t,n)=>e[n%C.value].push(n))),$.value=e}async function S(e){if(e>=r.value.length)return;await k();const t=[...I.value.children];c.value&&t.reverse();const n=t.reduce(((e,t)=>t.getBoundingClientRect().height<e.getBoundingClientRect().height?t:e));$.value[+n.dataset.index].push(e),await S(e+1)}async function j(e=!1){if($.value.length===L()&&!e)return void t("redraw-skip");$.value=x(L());const n=window.scrollY;await S(0),window.scrollTo({top:n}),t("redraw")}const R=new ResizeObserver((()=>j()));return m((()=>{j(),R.observe(I.value)})),d((()=>R.unobserve(I.value))),n([r,c],(()=>j(!0))),n([i,s],(()=>j())),(e,t)=>(v(),p("div",{ref_key:"wall",ref:I,class:"masonry-wall",style:g({display:"flex",gap:`${l(s)}px`})},[(v(!0),p(f,null,h($.value,((t,n)=>(v(),p("div",{key:n,class:"masonry-column","data-index":n,style:g({display:"flex","flex-basis":0,"flex-direction":"column","flex-grow":1,height:["-webkit-max-content","-moz-max-content","max-content"],gap:`${l(s)}px`})},[(v(!0),p(f,null,h(t,(t=>(v(),p("div",{key:t,class:"masonry-item"},[w(e.$slots,"default",{item:l(r)[t],index:t},(()=>[y(b(l(r)[t]),1)]))])))),128))],12,ft)))),128))],4))}}),wt=(()=>{const e=ht;return e.install=t=>{t.component("MasonryWall",e)},e})(),yt=({size:e})=>C("svg",{width:e,height:e,viewBox:"0 0 100 100",preserveAspectRatio:"xMidYMid"},C("circle",{cx:50,cy:50,fill:"none",stroke:"currentColor",strokeWidth:"4",r:"40","stroke-dasharray":"85 30"},C("animateTransform",{attributeName:"transform",type:"rotate",repeatCount:"indefinite",dur:"1s",values:"0 50 50;360 50 50",keyTimes:"0;1"})));var bt=(e,t)=>{const n=e.__vccOpts||e;for(const[e,o]of t)n[e]=o;return n};const kt=c({name:"CommentBox",components:{CloseIcon:({size:e})=>C("svg",{class:"wl-close-icon",viewBox:"0 0 1024 1024",width:e,height:e},[C("path",{d:"M697.173 85.333h-369.92c-144.64 0-241.92 101.547-241.92 252.587v348.587c0 150.613 97.28 252.16 241.92 252.16h369.92c144.64 0 241.494-101.547 241.494-252.16V337.92c0-151.04-96.854-252.587-241.494-252.587z",fill:"currentColor"}),C("path",{d:"m640.683 587.52-75.947-75.861 75.904-75.862a37.29 37.29 0 0 0 0-52.778 37.205 37.205 0 0 0-52.779 0l-75.946 75.818-75.862-75.946a37.419 37.419 0 0 0-52.821 0 37.419 37.419 0 0 0 0 52.821l75.947 75.947-75.776 75.733a37.29 37.29 0 1 0 52.778 52.821l75.776-75.776 75.947 75.947a37.376 37.376 0 0 0 52.779-52.821z",fill:"#888"})]),EmojiIcon:()=>C("svg",{viewBox:"0 0 1024 1024",width:"24",height:"24"},C("path",{d:"M563.2 463.3 677 540c1.7 1.2 3.7 1.8 5.8 1.8.7 0 1.4-.1 2-.2 2.7-.5 5.1-2.1 6.6-4.4l25.3-37.8c1.5-2.3 2.1-5.1 1.6-7.8s-2.1-5.1-4.4-6.6l-73.6-49.1 73.6-49.1c2.3-1.5 3.9-3.9 4.4-6.6.5-2.7 0-5.5-1.6-7.8l-25.3-37.8a10.1 10.1 0 0 0-6.6-4.4c-.7-.1-1.3-.2-2-.2-2.1 0-4.1.6-5.8 1.8l-113.8 76.6c-9.2 6.2-14.7 16.4-14.7 27.5.1 11 5.5 21.3 14.7 27.4zM387 348.8h-45.5c-5.7 0-10.4 4.7-10.4 10.4v153.3c0 5.7 4.7 10.4 10.4 10.4H387c5.7 0 10.4-4.7 10.4-10.4V359.2c0-5.7-4.7-10.4-10.4-10.4zm333.8 241.3-41-20a10.3 10.3 0 0 0-8.1-.5c-2.6.9-4.8 2.9-5.9 5.4-30.1 64.9-93.1 109.1-164.4 115.2-5.7.5-9.9 5.5-9.5 11.2l3.9 45.5c.5 5.3 5 9.5 10.3 9.5h.9c94.8-8 178.5-66.5 218.6-152.7 2.4-5 .3-11.2-4.8-13.6zm186-186.1c-11.9-42-30.5-81.4-55.2-117.1-24.1-34.9-53.5-65.6-87.5-91.2-33.9-25.6-71.5-45.5-111.6-59.2-41.2-14-84.1-21.1-127.8-21.1h-1.2c-75.4 0-148.8 21.4-212.5 61.7-63.7 40.3-114.3 97.6-146.5 165.8-32.2 68.1-44.3 143.6-35.1 218.4 9.3 74.8 39.4 145 87.3 203.3.1.2.3.3.4.5l36.2 38.4c1.1 1.2 2.5 2.1 3.9 2.6 73.3 66.7 168.2 103.5 267.5 103.5 73.3 0 145.2-20.3 207.7-58.7 37.3-22.9 70.3-51.5 98.1-85 27.1-32.7 48.7-69.5 64.2-109.1 15.5-39.7 24.4-81.3 26.6-123.8 2.4-43.6-2.5-87-14.5-129zm-60.5 181.1c-8.3 37-22.8 72-43 104-19.7 31.1-44.3 58.6-73.1 81.7-28.8 23.1-61 41-95.7 53.4-35.6 12.7-72.9 19.1-110.9 19.1-82.6 0-161.7-30.6-222.8-86.2l-34.1-35.8c-23.9-29.3-42.4-62.2-55.1-97.7-12.4-34.7-18.8-71-19.2-107.9-.4-36.9 5.4-73.3 17.1-108.2 12-35.8 30-69.2 53.4-99.1 31.7-40.4 71.1-72 117.2-94.1 44.5-21.3 94-32.6 143.4-32.6 49.3 0 97 10.8 141.8 32 34.3 16.3 65.3 38.1 92 64.8 26.1 26 47.5 56 63.6 89.2 16.2 33.2 26.6 68.5 31 105.1 4.6 37.5 2.7 75.3-5.6 112.3z",fill:"currentColor"})),ImageIcon:()=>C("svg",{viewBox:"0 0 1024 1024",width:"24",height:"24"},[C("path",{d:"M784 112H240c-88 0-160 72-160 160v480c0 88 72 160 160 160h544c88 0 160-72 160-160V272c0-88-72-160-160-160zm96 640c0 52.8-43.2 96-96 96H240c-52.8 0-96-43.2-96-96V272c0-52.8 43.2-96 96-96h544c52.8 0 96 43.2 96 96v480z",fill:"currentColor"}),C("path",{d:"M352 480c52.8 0 96-43.2 96-96s-43.2-96-96-96-96 43.2-96 96 43.2 96 96 96zm0-128c17.6 0 32 14.4 32 32s-14.4 32-32 32-32-14.4-32-32 14.4-32 32-32zm462.4 379.2-3.2-3.2-177.6-177.6c-25.6-25.6-65.6-25.6-91.2 0l-80 80-36.8-36.8c-25.6-25.6-65.6-25.6-91.2 0L200 728c-4.8 6.4-8 14.4-8 24 0 17.6 14.4 32 32 32 9.6 0 16-3.2 22.4-9.6L380.8 640l134.4 134.4c6.4 6.4 14.4 9.6 24 9.6 17.6 0 32-14.4 32-32 0-9.6-4.8-17.6-9.6-24l-52.8-52.8 80-80L769.6 776c6.4 4.8 12.8 8 20.8 8 17.6 0 32-14.4 32-32 0-8-3.2-16-8-20.8z",fill:"currentColor"})]),MarkdownIcon:()=>C("svg",{width:"16",height:"16",ariaHidden:"true"},C("path",{d:"M14.85 3H1.15C.52 3 0 3.52 0 4.15v7.69C0 12.48.52 13 1.15 13h13.69c.64 0 1.15-.52 1.15-1.15v-7.7C16 3.52 15.48 3 14.85 3zM9 11H7V8L5.5 9.92 4 8v3H2V5h2l1.5 2L7 5h2v6zm2.99.5L9.5 8H11V5h2v3h1.5l-2.51 3.5z",fill:"currentColor"})),PreviewIcon:()=>C("svg",{viewBox:"0 0 1024 1024",width:"24",height:"24"},[C("path",{d:"M710.816 654.301c70.323-96.639 61.084-230.578-23.705-314.843-46.098-46.098-107.183-71.109-172.28-71.109-65.008 0-126.092 25.444-172.28 71.109-45.227 46.098-70.756 107.183-70.756 172.106 0 64.923 25.444 126.007 71.194 172.106 46.099 46.098 107.184 71.109 172.28 71.109 51.414 0 100.648-16.212 142.824-47.404l126.53 126.006c7.058 7.06 16.297 10.979 26.406 10.979 10.105 0 19.343-3.919 26.402-10.979 14.467-14.467 14.467-38.172 0-52.723L710.816 654.301zm-315.107-23.265c-65.88-65.88-65.88-172.54 0-238.42 32.069-32.07 74.245-49.149 119.471-49.149 45.227 0 87.407 17.603 119.472 49.149 65.88 65.879 65.88 172.539 0 238.42-63.612 63.178-175.242 63.178-238.943 0zm0 0",fill:"currentColor"}),C("path",{d:"M703.319 121.603H321.03c-109.8 0-199.469 89.146-199.469 199.38v382.034c0 109.796 89.236 199.38 199.469 199.38h207.397c20.653 0 37.384-16.645 37.384-37.299 0-20.649-16.731-37.296-37.384-37.296H321.03c-68.582 0-124.352-55.77-124.352-124.267V321.421c0-68.496 55.77-124.267 124.352-124.267h382.289c68.582 0 124.352 55.771 124.352 124.267V524.72c0 20.654 16.736 37.299 37.385 37.299 20.654 0 37.384-16.645 37.384-37.299V320.549c-.085-109.8-89.321-198.946-199.121-198.946zm0 0",fill:"currentColor"})]),LoadingIcon:yt,GifIcon:()=>C("svg",{width:24,height:24,fill:"currentcolor",viewBox:"0 0 24 24"},[C("path",{style:"transform: translateY(0.5px)",d:"M18.968 10.5H15.968V11.484H17.984V12.984H15.968V15H14.468V9H18.968V10.5V10.5ZM8.984 9C9.26533 9 9.49967 9.09367 9.687 9.281C9.87433 9.46833 9.968 9.70267 9.968 9.984V10.5H6.499V13.5H8.468V12H9.968V14.016C9.968 14.2973 9.87433 14.5317 9.687 14.719C9.49967 14.9063 9.26533 15 8.984 15H5.984C5.70267 15 5.46833 14.9063 5.281 14.719C5.09367 14.5317 5 14.2973 5 14.016V9.985C5 9.70367 5.09367 9.46933 5.281 9.282C5.46833 9.09467 5.70267 9.001 5.984 9.001H8.984V9ZM11.468 9H12.968V15H11.468V9V9Z"}),C("path",{d:"M18.5 3H5.75C3.6875 3 2 4.6875 2 6.75V18C2 20.0625 3.6875 21.75 5.75 21.75H18.5C20.5625 21.75 22.25 20.0625 22.25 18V6.75C22.25 4.6875 20.5625 3 18.5 3ZM20.75 18C20.75 19.2375 19.7375 20.25 18.5 20.25H5.75C4.5125 20.25 3.5 19.2375 3.5 18V6.75C3.5 5.5125 4.5125 4.5 5.75 4.5H18.5C19.7375 4.5 20.75 5.5125 20.75 6.75V18Z"})])},props:{rootId:{type:String,default:""},replyId:{type:String,default:""},replyUser:{type:String,default:""}},emits:["submit","cancel-reply"],setup(e,{emit:t}){const l=$("config"),a=je("WALINE_COMMENT_BOX_EDITOR",""),i=je("WALINE_USER_META",{nick:"",mail:"",link:""}),r=dt(),c=o({}),u=o(null),d=o(null),v=o(null),p=o(null),g=o(null),f=o(null),h=o(null),w=o({tabs:[],map:{}}),y=o(0),b=o(!1),k=o(!1),C=o(!1),L=o(""),x=o(0),S=o({cursor:"",loading:!0,list:[]}),j=o(0),R=o(!1),E=o(""),A=o(!1),U=s((()=>l.value.locale)),z=s((()=>Boolean(r.value?.token))),M=s((()=>!1!==l.value.imageUploader)),O=e=>{const t=u.value,n=t.selectionStart,o=t.selectionEnd||0,l=t.scrollTop;a.value=t.value.substring(0,n)+e+t.value.substring(o,t.value.length),t.focus(),t.selectionStart=n+e.length,t.selectionEnd=n+e.length,t.scrollTop=l},P=e=>{const t=`![${l.value.locale.uploading} ${e.name}]()`;return O(t),Promise.resolve().then((()=>l.value.imageUploader(e))).then((n=>{a.value=a.value.replace(t,`\r\n![${e.name}](${n})`)}))},T=()=>{const{serverURL:n,lang:o,login:s,wordLimit:m,requiredMeta:d}=l.value,v={comment:E.value,nick:i.value.nick,mail:i.value.mail,link:i.value.link,ua:navigator.userAgent,url:l.value.path};if(r.value?.token)v.nick=r.value.display_name,v.mail=r.value.email,v.link=r.value.url;else{if("force"===s)return;if(d.indexOf("nick")>-1&&!v.nick)return c.value.nick?.focus(),alert(U.value.nickError);if(d.indexOf("mail")>-1&&!v.mail||v.mail&&!/^\w(?:[\w._-]*\w)?@(?:\w(?:[\w-]*\w)?\.)*\w+$/.exec(v.mail))return c.value.mail?.focus(),alert(U.value.mailError);if(!v.comment)return void u.value?.focus();v.nick||(v.nick=U.value.anonymous)}if(!R.value)return alert(U.value.wordHint.replace("$0",m[0].toString()).replace("$1",m[1].toString()).replace("$2",x.value.toString()));v.comment=rt(v.comment,w.value.map),e.replyId&&e.rootId&&(v.pid=e.replyId,v.rid=e.rootId,v.at=e.replyUser),A.value=!0,(({serverURL:e,lang:t,token:n,comment:o})=>{const l={"Content-Type":"application/json"};return n&&(l.Authorization=`Bearer ${n}`),fetch(`${e}/comment?lang=${t}`,{method:"POST",headers:l,body:JSON.stringify(o)}).then((e=>e.json()))})({serverURL:n,lang:o,token:r.value?.token,comment:v}).then((n=>{if(A.value=!1,n.errmsg)return alert(n.errmsg);t("submit",n.data),a.value="",L.value="",e.replyId&&t("cancel-reply")})).catch((e=>{A.value=!1,alert(e.message)}))},H=e=>{v.value.contains(e.target)||p.value.contains(e.target)||(b.value=!1),g.value.contains(e.target)||f.value.contains(e.target)||(k.value=!1)},N=function(e,t=300){let n;return(...o)=>{n&&clearTimeout(n),n=window.setTimeout((()=>{e(...o),n=null}),t)}}((async e=>{S.value.cursor="",S.value.list=[],_(e)})),_=async e=>{const{scrollTop:t,clientHeight:n,scrollHeight:o}=e.target;if((n+t)/o<.9||S.value.loading)return;S.value.loading=!0;const l=await ut({keyword:h.value?.value||"",pos:S.value.cursor}).finally((()=>{S.value.loading=!1}));S.value.cursor=l.next,S.value.list=S.value.list.concat(l.results),setTimeout((()=>{e.target.scrollTop=t}),50)};return n([l,x],(([e,t])=>{const{wordLimit:n}=e;n?t<n[0]&&0!==n[0]?(j.value=n[0],R.value=!1):t>n[1]?(j.value=n[1],R.value=!1):(j.value=n[1],R.value=!0):(j.value=0,R.value=!0)}),{immediate:!0}),n([k],(async([e])=>{if(!e)return;S.value.loading=!0;const t=await ut({keyword:""}).finally((()=>{S.value.loading=!1}));S.value.cursor=t.next,S.value.list=S.value.list.concat(t.results)})),m((()=>{document.body.addEventListener("click",H),n((()=>a.value),(e=>{const{highlighter:t,texRenderer:n}=l.value;E.value=e,L.value=st(e,{emojiMap:w.value.map,highlighter:t,texRenderer:n}),x.value=(e=>(e=>e.match(/[\w\d\s\u00C0-\u024F]+/giu)||[])(e).reduce(((e,t)=>e+(""===t.trim()?0:t.trim().split(/\s+/u).length)),0)+(e=>e.match(/[\u4E00-\u9FA5]/gu)||[])(e).length)(e),e?V(u.value):V.destroy(u.value)}),{immediate:!0}),n((()=>l.value.emoji),(e=>{return(t=Array.isArray(e)?e:[],Promise.all(t.map((e=>"string"==typeof e?qe(Ne(e)):Promise.resolve(e)))).then((e=>{const t={tabs:[],map:{}};return e.forEach((e=>{const{name:n,folder:o,icon:l,prefix:a,type:i,items:r}=e;t.tabs.push({name:n,icon:Je(l,o,a,i),items:r.map((e=>{const n=`${a||""}${e}`;return t.map[n]=Je(e,o,a,i),n}))})})),t}))).then((e=>{w.value=e}));var t}),{immediate:!0})})),I((()=>{document.body.removeEventListener("click",H)})),{config:l,locale:U,insert:O,onChange:()=>{const e=d.value;e.files&&M.value&&P(e.files[0]).then((()=>{e.value=""}))},onDrop:e=>{if(e.dataTransfer?.items){const t=ot(e.dataTransfer.items);t&&M.value&&(P(t),e.preventDefault())}},onKeyDown:e=>{const t=e.key;(e.ctrlKey||e.metaKey)&&"Enter"===t&&T()},onPaste:e=>{if(e.clipboardData){const t=ot(e.clipboardData.items);t&&M.value&&P(t)}},onLogin:e=>{e.preventDefault();const{lang:t,serverURL:n}=l.value,o=(window.innerWidth-450)/2,a=(window.innerHeight-450)/2,i=window.open(`${n}/ui/login?lng=${encodeURIComponent(t)}`,"_blank",`width=450,height=450,left=${o},top=${a},scrollbars=no,resizable=no,status=no,location=no,toolbar=no,menubar=no`);i?.postMessage({type:"TOKEN",data:null},"*");const s=({data:e})=>{e&&"userInfo"===e.type&&e.data.token&&(i?.close(),r.value=e.data,(e.data.remember?localStorage:sessionStorage).setItem("WALINE_USER",JSON.stringify(e.data)),window.removeEventListener("message",s))};window.addEventListener("message",s)},onLogout:()=>{r.value={},localStorage.setItem("WALINE_USER","null"),sessionStorage.setItem("WALINE_USER","null")},onProfile:e=>{e.preventDefault();const{lang:t,serverURL:n}=l.value,o=(window.innerWidth-800)/2,a=(window.innerHeight-800)/2;window.open(`${n}/ui/profile?lng=${encodeURIComponent(t)}`,"_blank",`width=800,height=800,left=${o},top=${a},scrollbars=no,resizable=no,status=no,location=no,toolbar=no,menubar=no`)?.postMessage({type:"TOKEN",data:r.value.token},"*");const i=({data:e})=>{e&&"profile"===e.type&&(r.value={...r.value,...e},[localStorage,sessionStorage].filter((e=>e.getItem("WALINE_USER"))).forEach((e=>e.setItem("WALINE_USER",JSON.stringify(r)))),window.removeEventListener("message",i))};window.addEventListener("message",i)},submitComment:T,onGifMasonryScroll:_,onGifSearch:N,isLogin:z,userInfo:r,isSubmitting:A,wordNumber:x,wordLimit:j,isWordNumberLegal:R,editor:a,userMeta:i,emoji:w,emojiTabIndex:y,showEmoji:b,showGif:k,canUploadImage:M,previewText:L,showPreview:C,inputRefs:c,editorRef:u,emojiButtonRef:v,emojiPopupRef:p,gifButtonRef:g,gifPopupRef:f,imageUploadRef:d,gifSearchInputRef:h,gifData:S}}}),Ct={class:"wl-comment"},$t={key:0,class:"wl-login-info"},It={class:"wl-avatar"},Lt=["title"],xt=["src"],St=["textContent"],jt={class:"wl-panel"},Rt=["for","textContent"],Et=["id","name","type","onUpdate:modelValue"],At=["placeholder"],Ut={class:"wl-preview"},zt=x("hr",null,null,-1),Mt=["innerHTML"],Ot={class:"wl-footer"},Pt={class:"wl-actions"},Tt={href:"https://guides.github.com/features/mastering-markdown/",title:"Markdown Guide","aria-label":"Markdown is supported",class:"wl-action",target:"_blank",rel:"noreferrer"},Ht=["title"],Nt=["title"],Vt=["title"],_t=["title"],Bt={class:"wl-info"},Ft={class:"wl-text-number"},Dt={key:0},Wt=y("  /  "),Gt=["textContent"],qt=["textContent"],Jt=["disabled"],Kt=["placeholder"],Yt=["onClick","src","title"],Zt={key:0,class:"wl-loading"},Xt={key:0,class:"wl-tab-wrapper"},Qt=["title","onClick"],en=["src","alt"],tn={key:0,class:"wl-tabs"},nn=["onClick"],on=["src","alt","title"],ln=["title"];var an=bt(kt,[["render",function(e,t,n,o,l,a){const i=L("CloseIcon"),r=L("MarkdownIcon"),s=L("EmojiIcon"),c=L("GifIcon"),u=L("ImageIcon"),m=L("PreviewIcon"),d=L("LoadingIcon"),w=L("masonry-wall");return v(),p("div",Ct,["disable"!==e.config.login&&e.isLogin?(v(),p("div",$t,[x("div",It,[x("button",{class:"wl-logout-btn",title:e.locale.logout,onClick:t[0]||(t[0]=(...t)=>e.onLogout&&e.onLogout(...t))},[S(i,{size:14})],8,Lt),x("img",{src:e.userInfo.avatar,alt:"avatar"},null,8,xt)]),x("a",{href:"#",class:"wl-login-nick","aria-label":"Profile",onClick:t[1]||(t[1]=(...t)=>e.onProfile&&e.onProfile(...t)),textContent:b(e.userInfo.display_name)},null,8,St)])):j("v-if",!0),x("div",jt,["force"!==e.config.login&&e.config.meta.length&&!e.isLogin?(v(),p("div",{key:0,class:R(["wl-header",`item${e.config.meta.length}`])},[(v(!0),p(f,null,h(e.config.meta,(t=>(v(),p("div",{class:"wl-header-item",key:t},[x("label",{for:t,textContent:b(e.locale[t]+(e.config.requiredMeta.includes(t)||!e.config.requiredMeta.length?"":`(${e.locale.optional})`))},null,8,Rt),E(x("input",{ref_for:!0,ref:n=>{n&&(e.inputRefs[t]=n)},id:`wl-${t}`,class:R(["wl-input",`wl-${t}`]),name:t,type:"mail"===t?"email":"text","onUpdate:modelValue":n=>e.userMeta[t]=n},null,10,Et),[[A,e.userMeta[t]]])])))),128))],2)):j("v-if",!0),E(x("textarea",{class:"wl-editor",ref:"editorRef",id:"wl-edit",placeholder:e.replyUser?`@${e.replyUser}`:e.locale.placeholder,"onUpdate:modelValue":t[2]||(t[2]=t=>e.editor=t),onKeydown:t[3]||(t[3]=(...t)=>e.onKeyDown&&e.onKeyDown(...t)),onDrop:t[4]||(t[4]=(...t)=>e.onDrop&&e.onDrop(...t)),onPaste:t[5]||(t[5]=(...t)=>e.onPaste&&e.onPaste(...t))},null,40,At),[[U,e.editor]]),E(x("div",Ut,[zt,x("h4",null,b(e.locale.preview)+":",1),x("div",{class:"wl-content",innerHTML:e.previewText},null,8,Mt)],512),[[z,e.showPreview]]),x("div",Ot,[x("div",Pt,[x("a",Tt,[S(r)]),E(x("button",{ref:"emojiButtonRef",class:R(["wl-action",{actived:e.showEmoji}]),title:e.locale.emoji,onClick:t[6]||(t[6]=t=>e.showEmoji=!e.showEmoji)},[S(s)],10,Ht),[[z,e.emoji.tabs.length]]),x("button",{ref:"gifButtonRef",class:R(["wl-action",{actived:e.showGif}]),title:e.locale.gif,onClick:t[7]||(t[7]=t=>e.showGif=!e.showGif)},[S(c)],10,Nt),x("input",{ref:"imageUploadRef",class:"upload",id:"wl-image-upload",type:"file",accept:".png,.jpg,.jpeg,.webp,.bmp,.gif",onChange:t[8]||(t[8]=(...t)=>e.onChange&&e.onChange(...t))},null,544),e.canUploadImage?(v(),p("label",{key:0,for:"wl-image-upload",class:"wl-action",title:e.locale.uploadImage},[S(u)],8,Vt)):j("v-if",!0),x("button",{class:R(["wl-action",{actived:e.showPreview}]),title:e.locale.preview,onClick:t[9]||(t[9]=t=>e.showPreview=!e.showPreview)},[S(m)],10,_t)]),x("div",Bt,[x("div",Ft,[y(b(e.wordNumber)+" ",1),e.config.wordLimit?(v(),p("span",Dt,[Wt,x("span",{class:R({illegal:!e.isWordNumberLegal}),textContent:b(e.wordLimit)},null,10,Gt)])):j("v-if",!0),y("  "+b(e.locale.word),1)]),"disable"===e.config.login||e.isLogin?j("v-if",!0):(v(),p("button",{key:0,class:"wl-btn",onClick:t[10]||(t[10]=(...t)=>e.onLogin&&e.onLogin(...t)),textContent:b(e.locale.login)},null,8,qt)),"force"!==e.config.login||e.isLogin?(v(),p("button",{key:1,class:"wl-btn primary",title:"Cmd|Ctrl + Enter",disabled:e.isSubmitting,onClick:t[11]||(t[11]=(...t)=>e.submitComment&&e.submitComment(...t))},[e.isSubmitting?(v(),M(d,{key:0,size:16})):(v(),p(f,{key:1},[y(b(e.locale.submit),1)],2112))],8,Jt)):j("v-if",!0)]),x("div",{ref:"gifPopupRef",class:R(["wl-gif-popup",{display:e.showGif}])},[x("input",{type:"text",placeholder:e.locale.gifSearchPlaceholder,ref:"gifSearchInputRef",onInput:t[12]||(t[12]=(...t)=>e.onGifSearch&&e.onGifSearch(...t))},null,40,Kt),S(w,{class:"wl-gif-waterfall",items:e.gifData.list,"ssr-columns":2,"column-width":200,gap:6,onScroll:e.onGifMasonryScroll},{default:O((({item:t})=>[x("img",{onClick:n=>e.insert(`![](${t.media[0].tinygif.url})`),src:t.media[0].tinygif.url,title:t.title,loading:"lazy",style:g({width:"200px",height:200*t.media[0].tinygif.dims[1]/t.media[0].tinygif.dims[0]+"px"})},null,12,Yt)])),_:1},8,["items","onScroll"]),e.gifData.loading?(v(),p("div",Zt,[S(d,{size:30})])):j("v-if",!0)],2),x("div",{ref:"emojiPopupRef",class:R(["wl-emoji-popup",{display:e.showEmoji}])},[(v(!0),p(f,null,h(e.emoji.tabs,((t,n)=>(v(),p(f,{key:t.name},[n===e.emojiTabIndex?(v(),p("div",Xt,[(v(!0),p(f,null,h(t.items,(t=>(v(),p("button",{key:t,title:t,onClick:n=>e.insert(`:${t}:`)},[e.showEmoji?(v(),p("img",{key:0,class:"wl-emoji",src:e.emoji.map[t],alt:t,loading:"lazy",referrerPolicy:"no-referrer"},null,8,en)):j("v-if",!0)],8,Qt)))),128))])):j("v-if",!0)],64)))),128)),e.emoji.tabs.length>1?(v(),p("div",tn,[(v(!0),p(f,null,h(e.emoji.tabs,((t,n)=>(v(),p("button",{key:t.name,class:R(["wl-tab",{active:e.emojiTabIndex===n}]),onClick:t=>e.emojiTabIndex=n},[x("img",{class:"wl-emoji",src:t.icon,alt:t.name,title:t.name,loading:"lazy",referrerPolicy:"no-referrer"},null,8,on)],10,nn)))),128))])):j("v-if",!0)],2)])]),e.replyId?(v(),p("button",{key:1,class:"wl-close",title:e.locale.cancelReply,onClick:t[13]||(t[13]=t=>e.$emit("cancel-reply"))},[S(i,{size:24})],8,ln)):j("v-if",!0)])}],["__file","CommentBox.vue"]]);const rn=["approved","waiting","spam"],sn=c({props:{comment:{type:Object,required:!0},rootId:{type:String,required:!0},reply:{type:Object}},components:{CommentBox:an,DeleteIcon:()=>C("svg",{viewBox:"0 0 1024 1024",width:"24",height:"24"},C("path",{d:"m341.013 394.667 27.755 393.45h271.83l27.733-393.45h64.106l-28.01 397.952a64 64 0 0 1-63.83 59.498H368.768a64 64 0 0 1-63.83-59.52l-28.053-397.93h64.128zm139.307 19.818v298.667h-64V414.485h64zm117.013 0v298.667h-64V414.485h64zM181.333 288h640v64h-640v-64zm453.483-106.667v64h-256v-64h256z",fill:"red"})),LikeIcon:({active:e=!1})=>C("svg",{viewBox:"0 0 1024 1024",width:"24",height:"24"},[C("path",{d:"M850.654 323.804c-11.042-25.625-26.862-48.532-46.885-68.225-20.022-19.61-43.258-34.936-69.213-45.73-26.78-11.124-55.124-16.727-84.375-16.727-40.622 0-80.256 11.123-114.698 32.135A214.79 214.79 0 0 0 512 241.819a214.79 214.79 0 0 0-23.483-16.562c-34.442-21.012-74.076-32.135-114.698-32.135-29.25 0-57.595 5.603-84.375 16.727-25.872 10.711-49.19 26.12-69.213 45.73-20.105 19.693-35.843 42.6-46.885 68.225-11.453 26.615-17.303 54.877-17.303 83.963 0 27.439 5.603 56.03 16.727 85.117 9.31 24.307 22.659 49.52 39.715 74.981 27.027 40.293 64.188 82.316 110.33 124.915 76.465 70.615 152.189 119.394 155.402 121.371l19.528 12.525c8.652 5.52 19.776 5.52 28.427 0l19.529-12.525c3.213-2.06 78.854-50.756 155.401-121.371 46.143-42.6 83.304-84.622 110.33-124.915 17.057-25.46 30.487-50.674 39.716-74.981 11.124-29.087 16.727-57.678 16.727-85.117.082-29.086-5.768-57.348-17.221-83.963z"+(e?"":"M512 761.5S218.665 573.55 218.665 407.767c0-83.963 69.461-152.023 155.154-152.023 60.233 0 112.473 33.618 138.181 82.727 25.708-49.109 77.948-82.727 138.18-82.727 85.694 0 155.155 68.06 155.155 152.023C805.335 573.551 512 761.5 512 761.5z"),fill:e?"red":"currentColor"})]),ReplyIcon:()=>C("svg",{viewBox:"0 0 1024 1024",width:"24",height:"24"},C("path",{d:"M810.667 213.333a64 64 0 0 1 64 64V704a64 64 0 0 1-64 64H478.336l-146.645 96.107a21.333 21.333 0 0 1-33.024-17.856V768h-85.334a64 64 0 0 1-64-64V277.333a64 64 0 0 1 64-64h597.334zm0 64H213.333V704h149.334v63.296L459.243 704h351.424V277.333zm-271.36 213.334v64h-176.64v-64h176.64zm122.026-128v64H362.667v-64h298.666z",fill:"currentColor"})),VerifiedIcon:()=>C("svg",{class:"verified-icon",viewBox:"0 0 1024 1024",width:"14",height:"14"},C("path",{d:"m894.4 461.56-54.4-63.2c-10.4-12-18.8-34.4-18.8-50.4v-68c0-42.4-34.8-77.2-77.2-77.2h-68c-15.6 0-38.4-8.4-50.4-18.8l-63.2-54.4c-27.6-23.6-72.8-23.6-100.8 0l-62.8 54.8c-12 10-34.8 18.4-50.4 18.4h-69.2c-42.4 0-77.2 34.8-77.2 77.2v68.4c0 15.6-8.4 38-18.4 50l-54 63.6c-23.2 27.6-23.2 72.4 0 100l54 63.6c10 12 18.4 34.4 18.4 50v68.4c0 42.4 34.8 77.2 77.2 77.2h69.2c15.6 0 38.4 8.4 50.4 18.8l63.2 54.4c27.6 23.6 72.8 23.6 100.8 0l63.2-54.4c12-10.4 34.4-18.8 50.4-18.8h68c42.4 0 77.2-34.8 77.2-77.2v-68c0-15.6 8.4-38.4 18.8-50.4l54.4-63.2c23.2-27.6 23.2-73.2-.4-100.8zm-216-25.2-193.2 193.2a30 30 0 0 1-42.4 0l-96.8-96.8a30.16 30.16 0 0 1 0-42.4c11.6-11.6 30.8-11.6 42.4 0l75.6 75.6 172-172c11.6-11.6 30.8-11.6 42.4 0 11.6 11.6 11.6 30.8 0 42.4z",fill:"#27ae60"}))},emits:["submit","reply","like","delete","status","sticky"],setup(e){const t=$("config"),n=pt(),o=dt(),l=s((()=>t.value.locale)),a=s((()=>{let{link:t}=e.comment;return t?Ve(t)?t:`https://${t}`:""})),i=s((()=>n.value.includes(e.comment.objectId))),r=((e,t)=>{const n=Pe();return s((()=>Ge(e,n.value,t)))})(e.comment.insertedAt,l.value),c=s((()=>"administrator"===o.value.type)),u=s((()=>e.comment.user_id&&o.value.objectId===e.comment.user_id)),m=s((()=>e.comment.objectId===e.reply?.objectId));return{config:t,locale:l,isReplyingCurrent:m,link:a,like:i,time:r,isAdmin:c,isOwner:u,commentStatus:rn}}}),cn=["id"],un={class:"wl-user","aria-hidden":"true"},mn=["src"],dn={class:"wl-card"},vn={class:"wl-head"},pn=["href"],gn={key:1,class:"wl-nick"},fn=["textContent"],hn=["textContent"],wn=["textContent"],yn=["textContent"],bn=["textContent"],kn={class:"wl-comment-actions"},Cn=["title"],$n=["textContent"],In=["title"],Ln={class:"wl-meta","aria-hidden":"true"},xn=["textContent"],Sn=["textContent"],jn=["textContent"],Rn=["innerHTML"],En={key:0,class:"wl-admin-actions"},An={class:"wl-comment-status"},Un=["disabled","onClick","textContent"],zn={key:1,class:"wl-reply-wrapper"},Mn={key:2,class:"wl-quote"};const On=c({name:"WalineRoot",components:{CommentBox:an,CommentCard:bt(sn,[["render",function(e,t,n,o,l,a){const i=L("VerifiedIcon"),r=L("DeleteIcon"),s=L("LikeIcon"),c=L("ReplyIcon"),u=L("CommentBox"),m=L("CommentCard",!0);return v(),p("div",{class:"wl-item",id:e.comment.objectId},[x("div",un,[e.comment.avatar?(v(),p("img",{key:0,src:e.comment.avatar},null,8,mn)):j("v-if",!0),e.comment.type?(v(),M(i,{key:1})):j("v-if",!0)]),x("div",dn,[x("div",vn,[e.link?(v(),p("a",{key:0,class:"wl-nick",href:e.link,target:"_blank",rel:"nofollow noreferrer"},b(e.comment.nick),9,pn)):(v(),p("span",gn,b(e.comment.nick),1)),"administrator"===e.comment.type?(v(),p("span",{key:2,class:"wl-badge",textContent:b(e.locale.admin)},null,8,fn)):j("v-if",!0),e.comment.label?(v(),p("span",{key:3,class:"wl-badge",textContent:b(e.comment.label)},null,8,hn)):j("v-if",!0),e.comment.sticky?(v(),p("span",{key:4,class:"wl-badge",textContent:b(e.locale.sticky)},null,8,wn)):j("v-if",!0),e.comment.level&&e.comment.level>=0?(v(),p("span",{key:5,class:R(`wl-badge level${e.comment.level}`),textContent:b(e.locale[`level${e.comment.level}`]||`Level ${e.comment.level}`)},null,10,yn)):j("v-if",!0),x("span",{class:"wl-time",textContent:b(e.time)},null,8,bn),x("div",kn,[e.isAdmin||e.isOwner?(v(),p("button",{key:0,class:"wl-delete",onClick:t[0]||(t[0]=t=>e.$emit("delete",e.comment))},[S(r)])):j("v-if",!0),x("button",{class:"wl-like",onClick:t[1]||(t[1]=t=>e.$emit("like",e.comment)),title:e.like?e.locale.cancelLike:e.locale.like},[S(s,{active:e.like},null,8,["active"]),"like"in e.comment?(v(),p("span",{key:0,textContent:b(e.comment.like)},null,8,$n)):j("v-if",!0)],8,Cn),x("button",{class:R(["wl-reply",{active:e.isReplyingCurrent}]),title:e.isReplyingCurrent?e.locale.cancelReply:e.locale.reply,onClick:t[2]||(t[2]=t=>e.$emit("reply",e.isReplyingCurrent?null:e.comment))},[S(c)],10,In)])]),x("div",Ln,[e.comment.addr?(v(),p("span",{key:0,textContent:b(e.comment.addr)},null,8,xn)):j("v-if",!0),e.comment.browser?(v(),p("span",{key:1,textContent:b(e.comment.browser)},null,8,Sn)):j("v-if",!0),e.comment.os?(v(),p("span",{key:2,textContent:b(e.comment.os)},null,8,jn)):j("v-if",!0)]),x("div",{class:"wl-content",innerHTML:e.comment.comment},null,8,Rn),e.isAdmin?(v(),p("div",En,[x("span",An,[(v(!0),p(f,null,h(e.commentStatus,(t=>(v(),p("button",{key:t,class:R(`wl-btn wl-${t}`),disabled:e.comment.status===t,onClick:n=>e.$emit("status",{status:t,comment:e.comment}),textContent:b(t)},null,10,Un)))),128))]),e.isAdmin&&!e.comment.rid?(v(),p("button",{key:0,class:"wl-btn wl-sticky",onClick:t[3]||(t[3]=t=>e.$emit("sticky",e.comment))},b(e.comment.sticky?"unsticky":"sticky"),1)):j("v-if",!0)])):j("v-if",!0),e.isReplyingCurrent?(v(),p("div",zn,[S(u,{replyId:e.comment.objectId,replyUser:e.comment.nick,rootId:e.rootId,onSubmit:t[4]||(t[4]=t=>e.$emit("submit",t)),onCancelReply:t[5]||(t[5]=t=>e.$emit("reply",null))},null,8,["replyId","replyUser","rootId"])])):j("v-if",!0),e.comment.children?(v(),p("div",Mn,[(v(!0),p(f,null,h(e.comment.children,(n=>(v(),M(m,{key:n.objectId,comment:n,reply:e.reply,rootId:e.rootId,onReply:t[6]||(t[6]=t=>e.$emit("reply",t)),onSubmit:t[7]||(t[7]=t=>e.$emit("submit",t)),onLike:t[8]||(t[8]=t=>e.$emit("like",t)),onDelete:t[9]||(t[9]=t=>e.$emit("delete",t)),onStatus:t[10]||(t[10]=t=>e.$emit("status",t)),onSticky:t[11]||(t[11]=t=>e.$emit("sticky",t))},null,8,["comment","reply","rootId"])))),128))])):j("v-if",!0)])],8,cn)}],["__file","CommentCard.vue"]]),LoadingIcon:yt},props:["serverURL","path","meta","requiredMeta","dark","lang","locale","pageSize","wordLimit","emoji","login","highlighter","texRenderer","imageUploader","copyright"],setup(e){const t=s((()=>(({serverURL:e,path:t=location.pathname,lang:n="zh-CN",locale:o,emoji:l=["//unpkg.com/@waline/emojis@1.0.1/weibo"],meta:a=["nick","mail","link"],requiredMeta:i=[],dark:r=!1,pageSize:s=10,wordLimit:c,imageUploader:u,highlighter:m,texRenderer:d,copyright:v=!0,login:p="enable",...g})=>({serverURL:_e(e),path:He(t),locale:{...le[n]||le["zh-CN"],..."object"==typeof o?o:{}},wordLimit:Be(c),meta:F(a),requiredMeta:F(i),imageUploader:Fe(u,D),highlighter:Fe(m,K),texRenderer:Fe(d,W),lang:n,dark:r,emoji:l,pageSize:s,login:p,copyright:v,...g}))(e))),l=dt(),a=pt(),r=o("loading"),c=o(0),u=o(1),d=o(0),v=o([]),p=o(null),g=s((()=>{return"string"==typeof(e=t.value.dark)?"auto"===e?`@media(prefers-color-scheme:dark){body${De}}`:`${e}${De}`:!0===e?`:root${De}`:"";var e}));let f;!function(e,t={}){const l=o(!1),{document:a=Ce,immediate:r=!0,manual:s=!1,id:c="vueuse_styletag_"+ ++Te}=t,u=o(e);let m=()=>{};const d=()=>{if(!a)return;const e=a.getElementById(c)||a.createElement("style");e.type="text/css",e.id=c,t.media&&(e.media=t.media),a.head.appendChild(e),l.value||(m=n(u,(t=>{e.innerText=t}),{immediate:!0}),l.value=!0)},v=()=>{a&&l.value&&(m(),a.head.removeChild(a.getElementById(c)),l.value=!1)};r&&!s&&d(),s||ae(v),i(l)}(g);const h=e=>{const{serverURL:n,path:o,pageSize:a}=t.value,i=new AbortController;r.value="loading",f?.(),(({serverURL:e,lang:t,path:n,page:o,pageSize:l,signal:a,token:i})=>{const r={};return i&&(r.Authorization=`Bearer ${i}`),fetch(`${e}/comment?path=${encodeURIComponent(n)}&pageSize=${l}&page=${o}&lang=${t}`,{signal:a,headers:r}).then((e=>e.json())).then((e=>Ze(e,"comment list")))})({serverURL:n,lang:t.value.lang,path:o,pageSize:a,page:e,signal:i.signal,token:l.value?.token}).then((t=>{r.value="success",c.value=t.count,v.value.push(...t.data),u.value=e,d.value=t.totalPages})).catch((e=>{"AbortError"!==e.name&&(console.error(e.message),r.value="error")})),f=i.abort.bind(i)},w=()=>{c.value=0,v.value=[],h(1)};return P("config",t),n((()=>e.path),w),m((()=>w())),{config:t,darkmodeStyle:g,i18n:s((()=>t.value.locale)),status:r,count:c,page:u,totalPages:d,data:v,reply:p,loadMore:()=>h(u.value+1),refresh:w,onReply:e=>{p.value=e},onSubmit:e=>{if(e.rid){const t=v.value.find((({objectId:t})=>t===e.rid));if(!t)return;Array.isArray(t.children)||(t.children=[]),t.children.push(e)}else v.value.unshift(e)},onStatusChange:async({comment:e,status:n})=>{if(e.status===n)return;const{serverURL:o,lang:a}=t.value;await Xe({serverURL:o,lang:a,token:l.value?.token,objectId:e.objectId,status:n}),e.status=n},onDelete:async({objectId:e})=>{if(!confirm("Are you sure you want to delete this comment?"))return;const{serverURL:n,lang:o}=t.value;await(({serverURL:e,lang:t,token:n,objectId:o})=>fetch(`${e}/comment/${o}?lang=${t}`,{method:"DELETE",headers:{Authorization:`Bearer ${n}`}}).then((e=>e.json())))({serverURL:n,lang:o,token:l.value?.token,objectId:e}),v.value.some(((t,n)=>t.objectId===e?(v.value=v.value.filter(((e,t)=>t!==n)),!0):t.children.some(((o,l)=>o.objectId===e&&(v.value[n].children=t.children.filter(((e,t)=>t!==l)),!0)))))},onSticky:async e=>{if(e.rid)return;const{serverURL:n,lang:o}=t.value;await Xe({serverURL:n,lang:o,token:l.value?.token,objectId:e.objectId,sticky:e.sticky?0:1}),e.sticky=!e.sticky},onLike:async e=>{const{serverURL:n,lang:o}=t.value,{objectId:l}=e,i=a.value.includes(l);await(({serverURL:e,lang:t,objectId:n,like:o})=>fetch(`${e}/comment/${n}?lang=${t}`,{method:"PUT",headers:Ye,body:JSON.stringify({like:o})}).then((e=>e.json())))({serverURL:n,lang:o,objectId:l,like:!i}),i?a.value=a.value.filter((e=>e!==l)):(a.value=[...a.value,l],a.value.length>50&&(a.value=a.value.slice(-50))),e.like=(e.like||0)+(i?-1:1)},version:"2.5.0"}}}),Pn={"data-waline":""},Tn={class:"wl-count"},Hn=["textContent"],Nn={class:"wl-cards"},Vn={key:1,class:"wl-operation"},_n=["textContent"],Bn={key:0,class:"wl-loading"},Fn=["textContent"],Dn={class:"wl-operation"},Wn=["textContent"],Gn={key:3,class:"wl-power"},qn=y(" Powered by "),Jn=x("a",{href:"https://github.com/walinejs/waline",target:"_blank",rel:"noreferrer"}," Waline ",-1);var Kn=bt(On,[["render",function(e,t,n,o,l,a){const i=L("CommentBox"),r=L("CommentCard"),s=L("LoadingIcon");return v(),p("div",Pn,[e.reply?j("v-if",!0):(v(),M(i,{key:0,onSubmit:e.onSubmit},null,8,["onSubmit"])),x("div",Tn,[e.count?(v(),p("span",{key:0,class:"wl-num",textContent:b(e.count)},null,8,Hn)):j("v-if",!0),y(" "+b(e.i18n.comment),1)]),x("div",Nn,[(v(!0),p(f,null,h(e.data,(t=>(v(),M(r,{key:t.objectId,"root-id":t.objectId,comment:t,reply:e.reply,onReply:e.onReply,onSubmit:e.onSubmit,onStatus:e.onStatusChange,onDelete:e.onDelete,onSticky:e.onSticky,onLike:e.onLike},null,8,["root-id","comment","reply","onReply","onSubmit","onStatus","onDelete","onSticky","onLike"])))),128))]),"error"===e.status?(v(),p("div",Vn,[x("button",{type:"button",class:"wl-btn",onClick:t[0]||(t[0]=(...t)=>e.refresh&&e.refresh(...t)),textContent:b(e.i18n.refresh)},null,8,_n)])):(v(),p(f,{key:2},["loading"===e.status?(v(),p("div",Bn,[S(s,{size:30})])):e.data.length?e.page<e.totalPages?(v(),p(f,{key:2},[j(" Load more button "),x("div",Dn,[x("button",{type:"button",class:"wl-btn",onClick:t[1]||(t[1]=(...t)=>e.loadMore&&e.loadMore(...t)),textContent:b(e.i18n.more)},null,8,Wn)])],2112)):j("v-if",!0):(v(),p("div",{key:1,class:"wl-empty",textContent:b(e.i18n.sofa)},null,8,Fn))],2112)),j(" Copyright Information "),e.config.copyright?(v(),p("div",Gn,[qn,Jn,y(" v"+b(e.version),1)])):j("v-if",!0)])}],["__file","Waline.vue"]]);const Yn=(e,t)=>{t.forEach(((t,n)=>{t.innerText=e[n].toString()}))},Zn=({serverURL:e,path:t=window.location.pathname,selector:n=".waline-pageview-count",update:o=!0,lang:l="zh-CN"})=>{const a=new AbortController,i=Array.from(document.querySelectorAll(n)),r=e=>{const n=ct(e);return null!==n&&t!==n},s=n=>Qe({serverURL:e,paths:n.map((e=>ct(e)||t)),lang:l,signal:a.signal}).then((e=>Yn(e,n))).catch(Ke);if(o){const n=i.filter((e=>!r(e))),o=i.filter(r);et({serverURL:e,path:t,lang:l}).then((e=>Yn(new Array(n.length).fill(e),n))),o.length&&s(o)}else s(i);return a.abort.bind(a)},Xn=({el:e="#waline",path:t=window.location.pathname,comment:n=!1,pageview:o=!1,...l})=>{const a=e?tt(e):null;if(e&&!a)throw new Error("Option 'el' do not match any domElement!");if(!l.serverURL)throw new Error("Option 'serverURL' is missing!");const i=T({...l}),r=T({comment:n,pageview:o,path:t}),s=()=>{r.comment&&gt({serverURL:i.serverURL,path:r.path,selector:"string"==typeof r.comment?r.comment:void 0})},c=()=>{r.pageview&&Zn({serverURL:i.serverURL,path:r.path,selector:"string"==typeof r.pageview?r.pageview:void 0})},u=a?H((()=>C(Kn,{path:r.path,...i}))):null;u&&(u.use(wt),u.mount(a)),s(),c();const m=N(s),d=N(c);return{el:a,update:({comment:e,pageview:t,path:n=window.location.pathname,...o}={})=>{Object.entries(o).forEach((([e,t])=>{i[e]=t})),r.path=n,void 0!==e&&(r.comment=e),void 0!==t&&(r.pageview=t)},destroy:()=>{u?.unmount(),m(),d()}}},Qn="2.5.0",eo=({el:e,serverURL:t,count:n,lang:o="zh-CN"})=>{const l=dt(),a=tt(e),i=new AbortController;return(({serverURL:e,lang:t,count:n,signal:o,token:l})=>{const a={};return l&&(a.Authorization=`Bearer ${l}`),fetch(`${e}/comment?type=recent&count=${n}&lang=${t}`,{signal:o,headers:a}).then((e=>e.json())).then((e=>Ze(e,"recent comment")))})({serverURL:t,count:n,lang:o,signal:i.signal,token:l.value?.token}).then((e=>a&&e.length?(a.innerHTML=`<ul class="wl-recent-list">${e.map((e=>`<li class="wl-recent-item"><a href="${e.url}">${e.nick}</a>:${e.comment}</li>`)).join("")}</ul>`,{comments:e,destroy:()=>{i.abort(),a.innerHTML=""}}):{comments:e,destroy:()=>i.abort()}))};export{eo as RecentComments,gt as commentCount,le as defaultLocales,Xn as init,Zn as pageviewCount,Qn as version};
//# sourceMappingURL=shim.esm.js.map

@@ -1,2 +0,2 @@

"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("vue"),t=require("autosize"),n=require("marked");function o(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var l=o(t);const r=["nick","mail","link"],a=e=>e.filter((e=>r.includes(e))),i=e=>new Promise(((t,n)=>{const o=new FileReader;o.readAsDataURL(e),o.onload=()=>t(o.result?.toString()||""),o.onerror=n})),c=e=>!0===e?'<p class="wl-tex">Tex is not available in preview</p>':'<span class="wl-tex">Tex is not available in preview</span>',s=new RegExp(`(${/[\u4E00-\u9FFF\u3400-\u4dbf\uf900-\ufaff\u3040-\u309f\uac00-\ud7af\u0400-\u04FF]+|\w+/.source}|${/</.source})|((?:${/(?:^|\s)\/\/(.+?)$/gm.source})|(?:${/\/\*([\S\s]*?)\*\//gm.source}))`,"gmi"),m=["23AC69","91C132","F19726","E8552D","1AAB8E","E1147F","2980C1","1BA1E6","9FA0A0","F19726","E30B20","E30B20","A3338B"],u={},d=e=>{let t=0;return e.replace(s,((e,n,o)=>{if(o)return`<span style="color: slategray">${o}</span>`;if("<"===n)return"&lt;";let l;u[n]?l=u[n]:(l=m[t],u[n]=l);const r=`<span style="color: #${l}">${n}</span>`;return t=++t%m.length,r}))},p=["nick","nickError","mail","mailError","link","optional","placeholder","sofa","submit","like","cancelLike","reply","cancelReply","comment","refresh","more","preview","emoji","uploadImage","seconds","minutes","hours","days","now","uploading","login","logout","admin","sticky","word","wordHint","anonymous","level0","level1","level2","level3","level4","level5"],v=e=>Object.fromEntries(e.map(((e,t)=>[p[t],e])));var g=v(["NickName","NickName cannot be less than 3 bytes.","E-Mail","Please confirm your email address.","Website","Optional","Comment here...","No comment yet.","Submit","Like","Cancel like","Reply","Cancel reply","Comments","Refresh","Load More...","Preview","Emoji","Upload Image","seconds ago","minutes ago","hours ago","days ago","just now","Uploading","Login","logout","Admin","Sticky","Words","Please input comments between $0 and $1 words!\n Current word number: $2","Anonymous","Dwarves","Hobbits","Ents","Wizards","Elves","Maiar"]),h=v(["ニックネーム","3バイト以上のニックネームをご入力ください.","メールアドレス","メールアドレスをご確認ください.","サイト","オプション","ここにコメント","コメントしましょう~","提出する","Like","Cancel like","返信する","キャンセル","コメント","更新","さらに読み込む","プレビュー","絵文字","画像をアップロード","秒前","分前","時間前","日前","たっだ今","アップロード","ログインする","ログアウト","管理者","トップに置く","ワード","コメントは $0 から $1 ワードの間でなければなりません!\n 現在の単語番号: $2","匿名"]),f=v(["昵称","昵称不能少于3个字符","邮箱","请填写正确的邮件地址","网址","可选","欢迎评论","来发评论吧~","提交","喜欢","取消喜欢","回复","取消回复","评论","刷新","加载更多...","预览","表情","上传图片","秒前","分钟前","小时前","天前","刚刚","正在上传","登录","退出","博主","置顶","字","评论字数应在 $0 到 $1 字之间!\n当前字数:$2","匿名","潜水","冒泡","吐槽","活跃","话痨","传说"]),w=v(["暱稱","郵箱","網址","可選","暱稱不能少於3個字元","請填寫正確的郵件地址","歡迎評論","來發評論吧~","提交","喜歡","取消喜歡","回覆","取消回覆","評論","刷新","載入更多...","預覽","表情","上傳圖片","秒前","分鐘前","小時前","天前","剛剛","正在上傳","登錄","退出","博主","置頂","字","評論字數應在 $0 到 $1 字之間!\n當前字數:$2","匿名","潛水","冒泡","吐槽","活躍","話癆","傳說"]),y=v(["Apelido","Apelido não pode ser menor que 3 bytes.","E-Mail","Por favor, confirme seu endereço de e-mail.","Website","Opcional","Comente aqui...","Nenhum comentário, ainda.","Enviar","Like","Cancel like","Responder","Cancelar resposta","Comentários","Refrescar","Carregar Mais...","Visualizar","Emoji","Enviar Imagem","segundos atrás","minutos atrás","horas atrás","dias atrás","agora mesmo","Enviando","Entrar","Sair","Admin","Sticky","Palavras","Favor enviar comentário com $0 a $1 palavras!\n Número de palavras atuais: $2","Anônimo"]),k=v(["Псевдоним","Никнейм не может быть меньше 3 байт.","Эл. адрес","Пожалуйста, подтвердите адрес вашей электронной почты.","Веб-сайт","Необязательный","Комментарий здесь...","Пока нет комментариев.","Отправить","Like","Cancel like","Отвечать","Отменить ответ","Комментарии","Обновить","Загрузи больше...","Превью","эмодзи","Загрузить изображение","секунд назад","несколько минут назад","несколько часов назад","дней назад","прямо сейчас","Загрузка","Авторизоваться","Выход из системы","Админ","Липкий","Слова","Пожалуйста, введите комментарии от $0 до $1 слов!\nНомер текущего слова: $2","Анонимный"]);const b={zh:f,"zh-cn":f,"zh-CN":f,"zh-tw":w,"zh-TW":w,en:g,"en-US":g,"en-us":g,jp:h,"jp-jp":h,"jp-JP":h,"pt-br":y,"pt-BR":y,ru:k,"ru-ru":k,"ru-RU":k};function C(t){return!!e.getCurrentScope()&&(e.onScopeDispose(t),!0)}const E="undefined"!=typeof window,$=()=>{};const B=e=>e();var N=Object.getOwnPropertySymbols,S=Object.prototype.hasOwnProperty,L=Object.prototype.propertyIsEnumerable;function I(t,n,o={}){const l=o,{eventFilter:r=B}=l,a=((e,t)=>{var n={};for(var o in e)S.call(e,o)&&t.indexOf(o)<0&&(n[o]=e[o]);if(null!=e&&N)for(var o of N(e))t.indexOf(o)<0&&L.call(e,o)&&(n[o]=e[o]);return n})(l,["eventFilter"]);return e.watch(t,(i=r,c=n,function(...e){i((()=>c.apply(this,e)),{fn:c,thisArg:this,args:e})}),a);var i,c}var V=Object.defineProperty,j=Object.defineProperties,x=Object.getOwnPropertyDescriptors,R=Object.getOwnPropertySymbols,z=Object.prototype.hasOwnProperty,A=Object.prototype.propertyIsEnumerable,U=(e,t,n)=>t in e?V(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;function D(t,n,o={}){const l=o,{eventFilter:r}=l,a=((e,t)=>{var n={};for(var o in e)z.call(e,o)&&t.indexOf(o)<0&&(n[o]=e[o]);if(null!=e&&R)for(var o of R(e))t.indexOf(o)<0&&A.call(e,o)&&(n[o]=e[o]);return n})(l,["eventFilter"]),{eventFilter:i,pause:c,resume:s,isActive:m}=function(t=B){const n=e.ref(!0);return{isActive:n,pause:function(){n.value=!1},resume:function(){n.value=!0},eventFilter:(...e)=>{n.value&&t(...e)}}}(r),u=I(t,n,(d=((e,t)=>{for(var n in t||(t={}))z.call(t,n)&&U(e,n,t[n]);if(R)for(var n of R(t))A.call(t,n)&&U(e,n,t[n]);return e})({},a),j(d,x({eventFilter:i}))));var d;return{stop:u,pause:c,resume:s,isActive:m}}const M=E?window:void 0,O=E?window.document:void 0;function T(...t){let n,o,l,r;if("string"==typeof t[0]?([o,l,r]=t,n=M):[n,o,l,r]=t,!n)return $;let a=$;const i=e.watch((()=>function(t){var n;const o=e.unref(t);return null!=(n=null==o?void 0:o.$el)?n:o}(n)),(e=>{a(),e&&(e.addEventListener(o,l,r),a=()=>{e.removeEventListener(o,l,r),a=$})}),{immediate:!0,flush:"post"}),c=()=>{i(),a()};return C(c),c}E&&window.navigator,E&&window.location;const P="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},_="__vueuse_ssr_handlers__";P[_]=P[_]||{};const F=P[_];const H={boolean:{read:e=>"true"===e,write:e=>String(e)},object:{read:e=>JSON.parse(e),write:e=>JSON.stringify(e)},number:{read:e=>Number.parseFloat(e),write:e=>String(e)},any:{read:e=>e,write:e=>String(e)},string:{read:e=>e,write:e=>String(e)},map:{read:e=>new Map(JSON.parse(e)),write:e=>JSON.stringify(Array.from(e.entries()))},set:{read:e=>new Set(JSON.parse(e)),write:e=>JSON.stringify(Array.from(e))},date:{read:e=>new Date(e),write:e=>e.toISOString()}};function W(t,n,o,l={}){var r;const{flush:a="pre",deep:i=!0,listenToStorageChanges:c=!0,writeDefaults:s=!0,shallow:m,window:u=M,eventFilter:d,onError:p=(e=>{console.error(e)})}=l,v=(m?e.shallowRef:e.ref)(n);if(!o)try{o=function(e,t){return F[e]||t}("getDefaultStorage",(()=>{var e;return null==(e=M)?void 0:e.localStorage}))()}catch(e){p(e)}if(!o)return v;const g=e.unref(n),h=function(e){return null==e?"any":e instanceof Set?"set":e instanceof Map?"map":e instanceof Date?"date":"boolean"==typeof e?"boolean":"string"==typeof e?"string":"object"==typeof e||Array.isArray(e)?"object":Number.isNaN(e)?"any":"number"}(g),f=null!=(r=l.serializer)?r:H[h],{pause:w,resume:y}=D(v,(()=>function(e){try{null==e?o.removeItem(t):o.setItem(t,f.write(e))}catch(e){p(e)}}(v.value)),{flush:a,deep:i,eventFilter:d});return u&&c&&T(u,"storage",k),k(),v;function k(e){e&&e.key!==t||(v.value=function(e){if(!e||e.key===t){w();try{const n=e?e.newValue:o.getItem(t);return null==n?(s&&null!==g&&o.setItem(t,f.write(g)),g):"string"!=typeof n?n:f.read(n)}catch(e){p(e)}finally{y()}}}(e))}}var q,J,K=Object.defineProperty,Y=Object.getOwnPropertySymbols,G=Object.prototype.hasOwnProperty,X=Object.prototype.propertyIsEnumerable,Q=(e,t,n)=>t in e?K(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;function Z(t={}){const{controls:n=!1,interval:o="requestAnimationFrame"}=t,l=e.ref(new Date),r=()=>l.value=new Date,a="requestAnimationFrame"===o?function(t,n={}){const{immediate:o=!0,window:l=M}=n,r=e.ref(!1);let a=null;function i(){r.value&&l&&(t(),a=l.requestAnimationFrame(i))}function c(){!r.value&&l&&(r.value=!0,i())}function s(){r.value=!1,null!=a&&l&&(l.cancelAnimationFrame(a),a=null)}return o&&c(),C(s),{isActive:r,pause:s,resume:c}}(r,{immediate:!0}):function(t,n=1e3,o={}){const{immediate:l=!0,immediateCallback:r=!1}=o;let a=null;const i=e.ref(!1);function c(){a&&(clearInterval(a),a=null)}function s(){i.value=!1,c()}function m(){n<=0||(i.value=!0,r&&t(),c(),a=setInterval(t,e.unref(n)))}l&&E&&m(),e.isRef(n)&&C(e.watch(n,(()=>{l&&E&&m()})));return C(s),{isActive:i,pause:s,resume:m}}(r,o,{immediate:!0});return n?((e,t)=>{for(var n in t||(t={}))G.call(t,n)&&Q(e,n,t[n]);if(Y)for(var n of Y(t))X.call(t,n)&&Q(e,n,t[n]);return e})({now:l},a):l}E&&(null==window?void 0:window.navigator)&&(null==(q=null==window?void 0:window.navigator)?void 0:q.platform)&&/iP(ad|hone|od)/.test(null==(J=null==window?void 0:window.navigator)?void 0:J.platform);let ee=0;const te=e=>{try{e=decodeURI(e)}catch(e){}return e},ne=(e="")=>e.replace(/\/$/u,""),oe=e=>/^(https?:)?\/\//.test(e),le=e=>{const t=ne(e);return oe(t)?t:`https://${t}`},re=e=>Array.isArray(e)?e:!!e&&[0,e],ae=(e,t)=>"function"==typeof e?e:!1!==e&&t,ie="{--waline-white:#000;--waline-light-grey:#666;--waline-dark-grey:#999;--waline-color:#888;--waline-bgcolor:#1e1e1e;--waline-bgcolor-light:#272727;--waline-bgcolor-hover: #444;--waline-border-color:#333;--waline-disable-bgcolor:#444;--waline-disable-color:#272727;--waline-bq-color:#272727;--waline-info-bgcolor:#272727;--waline-info-color:#666}",ce=(e,t)=>{let n=e.toString();for(;n.length<t;)n="0"+n;return n},se=(e,t,n)=>{if(!e)return"";const o="string"==typeof e?new Date(-1!==e.indexOf(" ")?e.replace(/-/g,"/"):e):e,l=t.getTime()-o.getTime(),r=Math.floor(l/864e5);if(0===r){const e=l%864e5,t=Math.floor(e/36e5);if(0===t){const t=e%36e5,o=Math.floor(t/6e4);if(0===o){const e=t%6e4;return`${Math.round(e/1e3)} ${n.seconds}`}return`${o} ${n.minutes}`}return`${t} ${n.hours}`}return r<0?n.now:r<8?`${r} ${n.days}`:(e=>{const t=ce(e.getDate(),2),n=ce(e.getMonth()+1,2);return`${ce(e.getFullYear(),2)}-${n}-${t}`})(o)},me=e=>{const t=W("WALINE_EMOJI",{}),n=Boolean(/@[0-9]+\.[0-9]+\.[0-9]+/.test(e));if(n){const n=t.value[e];if(n)return Promise.resolve(n)}return fetch(`${e}/info.json`).then((e=>e.json())).then((o=>{const l={folder:e,...o};return n&&(t.value[e]=l),l}))},ue=(e,t="",n="",o="")=>`${t?`${t}/`:""}${n}${e}${o?`.${o}`:""}`,de=e=>{"AbortError"!==e.name&&console.error(e.message)},pe={"Content-Type":"application/json"},ve=(e,t="")=>{if("object"==typeof e&&e.errno)throw new TypeError(`Fetch ${t} failed with ${e.errno}: ${e.errmsg}`);return e},ge=({serverURL:e,lang:t,token:n,objectId:o,...l})=>fetch(`${e}/comment/${o}?lang=${t}`,{method:"PUT",headers:{"Content-Type":"application/json",Authorization:`Bearer ${n}`},body:JSON.stringify(l)}).then((e=>e.json())),he=({serverURL:e,lang:t,paths:n,signal:o})=>fetch(`${e}/article?path=${encodeURIComponent(n.join(","))}&lang=${t}`,{signal:o}).then((e=>e.json())).then((e=>ve(e,"visit count"))).then((e=>Array.isArray(e)?e:[e])),fe=({serverURL:e,lang:t,path:n})=>fetch(`${e}/article?lang=${t}`,{method:"POST",headers:pe,body:JSON.stringify({path:n})}).then((e=>e.json())).then((e=>ve(e,"visit count"))),we=e=>e instanceof HTMLElement?e:"string"==typeof e?document.querySelector(e):null,ye=e=>e.type.includes("image"),ke=e=>{const t=Array.from(e).find(ye);return t?t.getAsFile():null},be=/\$.*?\$/,Ce=/^\$(.*?)\$/,Ee=/^(?:\s{0,3})\$\$((?:[^\n]|\n[^\n])+?)\n{0,1}\$\$/,$e=(e="",t={})=>e.replace(/:(.+?):/g,((e,n)=>t[n]?`<img class="wl-emoji" src="${t[n]}" alt="${n}">`:e)),Be=(e,{emojiMap:t,highlighter:o,texRenderer:l})=>{if(n.marked.setOptions({highlight:o||void 0,breaks:!0,smartLists:!0,smartypants:!0}),l){const e=(e=>[{name:"blockMath",level:"block",tokenizer(t){const n=Ee.exec(t);if(null!==n)return{type:"html",raw:n[0],text:e(!0,n[1])}}},{name:"inlineMath",level:"inline",start(e){const t=e.search(be);return-1!==t?t:e.length},tokenizer(t){const n=Ce.exec(t);if(null!==n)return{type:"html",raw:n[0],text:e(!1,n[1])}}}])(l);n.marked.use({extensions:e})}return n.marked.parse($e(e,t))},Ne=e=>e.dataset.path||e.getAttribute("id");let Se=null;const Le=()=>Se||(Se=W("USER_KEY",{}));let Ie=null;const Ve=()=>Ie||(Ie=W("WALIKE_LIKE",[])),je=({serverURL:e,path:t=window.location.pathname,selector:n=".waline-comment-count",lang:o="zh-CN"})=>{const l=new AbortController,r=document.querySelectorAll(n),a=Le();return r.length&&(({serverURL:e,lang:t,paths:n,signal:o,token:l})=>{const r={};return l&&(r.Authorization=`Bearer ${l}`),fetch(`${e}/comment?type=count&url=${encodeURIComponent(n.join(","))}&lang=${t}`,{signal:o,headers:r}).then((e=>e.json())).then((e=>ve(e,"comment count"))).then((e=>Array.isArray(e)?e:[e]))})({serverURL:e,paths:Array.from(r).map((e=>te(e.dataset.path||e.getAttribute("id")||t))),lang:o,signal:l.signal,token:a.value?.token}).then((e=>{r.forEach(((t,n)=>{t.innerText=e[n].toString()}))})).catch(de),l.abort.bind(l)},xe=({size:t})=>e.h("svg",{width:t,height:t,viewBox:"0 0 100 100",preserveAspectRatio:"xMidYMid"},e.h("circle",{cx:50,cy:50,fill:"none",stroke:"currentColor",strokeWidth:"4",r:"40","stroke-dasharray":"85 30"},e.h("animateTransform",{attributeName:"transform",type:"rotate",repeatCount:"indefinite",dur:"1s",values:"0 50 50;360 50 50",keyTimes:"0;1"})));var Re=(e,t)=>{const n=e.__vccOpts||e;for(const[e,o]of t)n[e]=o;return n};const ze=e.defineComponent({name:"CommentBox",components:{CloseIcon:({size:t})=>e.h("svg",{class:"wl-close-icon",viewBox:"0 0 1024 1024",width:t,height:t},[e.h("path",{d:"M697.173 85.333h-369.92c-144.64 0-241.92 101.547-241.92 252.587v348.587c0 150.613 97.28 252.16 241.92 252.16h369.92c144.64 0 241.494-101.547 241.494-252.16V337.92c0-151.04-96.854-252.587-241.494-252.587z",fill:"currentColor"}),e.h("path",{d:"m640.683 587.52-75.947-75.861 75.904-75.862a37.29 37.29 0 0 0 0-52.778 37.205 37.205 0 0 0-52.779 0l-75.946 75.818-75.862-75.946a37.419 37.419 0 0 0-52.821 0 37.419 37.419 0 0 0 0 52.821l75.947 75.947-75.776 75.733a37.29 37.29 0 1 0 52.778 52.821l75.776-75.776 75.947 75.947a37.376 37.376 0 0 0 52.779-52.821z",fill:"#888"})]),EmojiIcon:()=>e.h("svg",{viewBox:"0 0 1024 1024",width:"24",height:"24"},e.h("path",{d:"M563.2 463.3 677 540c1.7 1.2 3.7 1.8 5.8 1.8.7 0 1.4-.1 2-.2 2.7-.5 5.1-2.1 6.6-4.4l25.3-37.8c1.5-2.3 2.1-5.1 1.6-7.8s-2.1-5.1-4.4-6.6l-73.6-49.1 73.6-49.1c2.3-1.5 3.9-3.9 4.4-6.6.5-2.7 0-5.5-1.6-7.8l-25.3-37.8a10.1 10.1 0 0 0-6.6-4.4c-.7-.1-1.3-.2-2-.2-2.1 0-4.1.6-5.8 1.8l-113.8 76.6c-9.2 6.2-14.7 16.4-14.7 27.5.1 11 5.5 21.3 14.7 27.4zM387 348.8h-45.5c-5.7 0-10.4 4.7-10.4 10.4v153.3c0 5.7 4.7 10.4 10.4 10.4H387c5.7 0 10.4-4.7 10.4-10.4V359.2c0-5.7-4.7-10.4-10.4-10.4zm333.8 241.3-41-20a10.3 10.3 0 0 0-8.1-.5c-2.6.9-4.8 2.9-5.9 5.4-30.1 64.9-93.1 109.1-164.4 115.2-5.7.5-9.9 5.5-9.5 11.2l3.9 45.5c.5 5.3 5 9.5 10.3 9.5h.9c94.8-8 178.5-66.5 218.6-152.7 2.4-5 .3-11.2-4.8-13.6zm186-186.1c-11.9-42-30.5-81.4-55.2-117.1-24.1-34.9-53.5-65.6-87.5-91.2-33.9-25.6-71.5-45.5-111.6-59.2-41.2-14-84.1-21.1-127.8-21.1h-1.2c-75.4 0-148.8 21.4-212.5 61.7-63.7 40.3-114.3 97.6-146.5 165.8-32.2 68.1-44.3 143.6-35.1 218.4 9.3 74.8 39.4 145 87.3 203.3.1.2.3.3.4.5l36.2 38.4c1.1 1.2 2.5 2.1 3.9 2.6 73.3 66.7 168.2 103.5 267.5 103.5 73.3 0 145.2-20.3 207.7-58.7 37.3-22.9 70.3-51.5 98.1-85 27.1-32.7 48.7-69.5 64.2-109.1 15.5-39.7 24.4-81.3 26.6-123.8 2.4-43.6-2.5-87-14.5-129zm-60.5 181.1c-8.3 37-22.8 72-43 104-19.7 31.1-44.3 58.6-73.1 81.7-28.8 23.1-61 41-95.7 53.4-35.6 12.7-72.9 19.1-110.9 19.1-82.6 0-161.7-30.6-222.8-86.2l-34.1-35.8c-23.9-29.3-42.4-62.2-55.1-97.7-12.4-34.7-18.8-71-19.2-107.9-.4-36.9 5.4-73.3 17.1-108.2 12-35.8 30-69.2 53.4-99.1 31.7-40.4 71.1-72 117.2-94.1 44.5-21.3 94-32.6 143.4-32.6 49.3 0 97 10.8 141.8 32 34.3 16.3 65.3 38.1 92 64.8 26.1 26 47.5 56 63.6 89.2 16.2 33.2 26.6 68.5 31 105.1 4.6 37.5 2.7 75.3-5.6 112.3z",fill:"currentColor"})),ImageIcon:()=>e.h("svg",{viewBox:"0 0 1024 1024",width:"24",height:"24"},[e.h("path",{d:"M784 112H240c-88 0-160 72-160 160v480c0 88 72 160 160 160h544c88 0 160-72 160-160V272c0-88-72-160-160-160zm96 640c0 52.8-43.2 96-96 96H240c-52.8 0-96-43.2-96-96V272c0-52.8 43.2-96 96-96h544c52.8 0 96 43.2 96 96v480z",fill:"currentColor"}),e.h("path",{d:"M352 480c52.8 0 96-43.2 96-96s-43.2-96-96-96-96 43.2-96 96 43.2 96 96 96zm0-128c17.6 0 32 14.4 32 32s-14.4 32-32 32-32-14.4-32-32 14.4-32 32-32zm462.4 379.2-3.2-3.2-177.6-177.6c-25.6-25.6-65.6-25.6-91.2 0l-80 80-36.8-36.8c-25.6-25.6-65.6-25.6-91.2 0L200 728c-4.8 6.4-8 14.4-8 24 0 17.6 14.4 32 32 32 9.6 0 16-3.2 22.4-9.6L380.8 640l134.4 134.4c6.4 6.4 14.4 9.6 24 9.6 17.6 0 32-14.4 32-32 0-9.6-4.8-17.6-9.6-24l-52.8-52.8 80-80L769.6 776c6.4 4.8 12.8 8 20.8 8 17.6 0 32-14.4 32-32 0-8-3.2-16-8-20.8z",fill:"currentColor"})]),MarkdownIcon:()=>e.h("svg",{width:"16",height:"16",ariaHidden:"true"},e.h("path",{d:"M14.85 3H1.15C.52 3 0 3.52 0 4.15v7.69C0 12.48.52 13 1.15 13h13.69c.64 0 1.15-.52 1.15-1.15v-7.7C16 3.52 15.48 3 14.85 3zM9 11H7V8L5.5 9.92 4 8v3H2V5h2l1.5 2L7 5h2v6zm2.99.5L9.5 8H11V5h2v3h1.5l-2.51 3.5z",fill:"currentColor"})),PreviewIcon:()=>e.h("svg",{viewBox:"0 0 1024 1024",width:"24",height:"24"},[e.h("path",{d:"M710.816 654.301c70.323-96.639 61.084-230.578-23.705-314.843-46.098-46.098-107.183-71.109-172.28-71.109-65.008 0-126.092 25.444-172.28 71.109-45.227 46.098-70.756 107.183-70.756 172.106 0 64.923 25.444 126.007 71.194 172.106 46.099 46.098 107.184 71.109 172.28 71.109 51.414 0 100.648-16.212 142.824-47.404l126.53 126.006c7.058 7.06 16.297 10.979 26.406 10.979 10.105 0 19.343-3.919 26.402-10.979 14.467-14.467 14.467-38.172 0-52.723L710.816 654.301zm-315.107-23.265c-65.88-65.88-65.88-172.54 0-238.42 32.069-32.07 74.245-49.149 119.471-49.149 45.227 0 87.407 17.603 119.472 49.149 65.88 65.879 65.88 172.539 0 238.42-63.612 63.178-175.242 63.178-238.943 0zm0 0",fill:"currentColor"}),e.h("path",{d:"M703.319 121.603H321.03c-109.8 0-199.469 89.146-199.469 199.38v382.034c0 109.796 89.236 199.38 199.469 199.38h207.397c20.653 0 37.384-16.645 37.384-37.299 0-20.649-16.731-37.296-37.384-37.296H321.03c-68.582 0-124.352-55.77-124.352-124.267V321.421c0-68.496 55.77-124.267 124.352-124.267h382.289c68.582 0 124.352 55.771 124.352 124.267V524.72c0 20.654 16.736 37.299 37.385 37.299 20.654 0 37.384-16.645 37.384-37.299V320.549c-.085-109.8-89.321-198.946-199.121-198.946zm0 0",fill:"currentColor"})]),LoadingIcon:xe},props:{rootId:{type:String,default:""},replyId:{type:String,default:""},replyUser:{type:String,default:""}},emits:["submit","cancel-reply"],setup(t,{emit:n}){const o=e.inject("config"),r=W("WALINE_COMMENT_BOX_EDITOR",""),a=W("WALINE_USER_META",{nick:"",mail:"",link:""}),i=Le(),c=e.ref({}),s=e.ref(null),m=e.ref(null),u=e.ref(null),d=e.ref(null),p=e.ref({tabs:[],map:{}}),v=e.ref(0),g=e.ref(!1),h=e.ref(!1),f=e.ref(""),w=e.ref(0),y=e.ref(0),k=e.ref(!1),b=e.ref(""),C=e.ref(!1),E=e.computed((()=>o.value.locale)),$=e.computed((()=>Boolean(i.value?.token))),B=e.computed((()=>!1!==o.value.imageUploader)),N=e=>{const t=s.value,n=t.selectionStart,o=t.selectionEnd||0,l=t.scrollTop;r.value=t.value.substring(0,n)+e+t.value.substring(o,t.value.length),t.focus(),t.selectionStart=n+e.length,t.selectionEnd=n+e.length,t.scrollTop=l},S=e=>{const t=`![${o.value.locale.uploading} ${e.name}]()`;return N(t),Promise.resolve().then((()=>o.value.imageUploader(e))).then((n=>{r.value=r.value.replace(t,`\r\n![${e.name}](${n})`)}))},L=()=>{const{serverURL:e,lang:l,login:m,wordLimit:u,requiredMeta:d}=o.value,v={comment:b.value,nick:a.value.nick,mail:a.value.mail,link:a.value.link,ua:navigator.userAgent,url:o.value.path};if(i.value?.token)v.nick=i.value.display_name,v.mail=i.value.email,v.link=i.value.url;else{if("force"===m)return;if(d.indexOf("nick")>-1&&!v.nick)return c.value.nick?.focus(),alert(E.value.nickError);if(d.indexOf("mail")>-1&&!v.mail||v.mail&&!/^\w(?:[\w._-]*\w)?@(?:\w(?:[\w-]*\w)?\.)*\w+$/.exec(v.mail))return c.value.mail?.focus(),alert(E.value.mailError);if(!v.comment)return void s.value?.focus();v.nick||(v.nick=E.value.anonymous)}if(!k.value)return alert(E.value.wordHint.replace("$0",u[0].toString()).replace("$1",u[1].toString()).replace("$2",w.value.toString()));v.comment=$e(v.comment,p.value.map),t.replyId&&t.rootId&&(v.pid=t.replyId,v.rid=t.rootId,v.at=t.replyUser),C.value=!0,(({serverURL:e,lang:t,token:n,comment:o})=>{const l={"Content-Type":"application/json"};return n&&(l.Authorization=`Bearer ${n}`),fetch(`${e}/comment?lang=${t}`,{method:"POST",headers:l,body:JSON.stringify(o)}).then((e=>e.json()))})({serverURL:e,lang:l,token:i.value?.token,comment:v}).then((e=>{if(C.value=!1,e.errmsg)return alert(e.errmsg);n("submit",e.data),r.value="",f.value="",t.replyId&&n("cancel-reply")})).catch((e=>{C.value=!1,alert(e.message)}))},I=e=>{u.value.contains(e.target)||d.value.contains(e.target)||(g.value=!1)};return e.watch([o,w],(([e,t])=>{const{wordLimit:n}=e;n?t<n[0]&&0!==n[0]?(y.value=n[0],k.value=!1):t>n[1]?(y.value=n[1],k.value=!1):(y.value=n[1],k.value=!0):(y.value=0,k.value=!0)}),{immediate:!0}),e.onMounted((()=>{document.body.addEventListener("click",I),e.watch((()=>r.value),(e=>{const{highlighter:t,texRenderer:n}=o.value;b.value=e,f.value=Be(e,{emojiMap:p.value.map,highlighter:t,texRenderer:n}),w.value=(e=>(e=>e.match(/[\w\d\s\u00C0-\u024F]+/giu)||[])(e).reduce(((e,t)=>e+(""===t.trim()?0:t.trim().split(/\s+/u).length)),0)+(e=>e.match(/[\u4E00-\u9FA5]/gu)||[])(e).length)(e),e?l.default(s.value):l.default.destroy(s.value)}),{immediate:!0}),e.watch((()=>o.value.emoji),(e=>{return(t=Array.isArray(e)?e:[],Promise.all(t.map((e=>"string"==typeof e?me(ne(e)):Promise.resolve(e)))).then((e=>{const t={tabs:[],map:{}};return e.forEach((e=>{const{name:n,folder:o,icon:l,prefix:r,type:a,items:i}=e;t.tabs.push({name:n,icon:ue(l,o,r,a),items:i.map((e=>{const n=`${r||""}${e}`;return t.map[n]=ue(e,o,r,a),n}))})})),t}))).then((e=>{p.value=e}));var t}),{immediate:!0})})),e.onUnmounted((()=>{document.body.removeEventListener("click",I)})),{config:o,locale:E,insert:N,onChange:()=>{const e=m.value;e.files&&B.value&&S(e.files[0]).then((()=>{e.value=""}))},onDrop:e=>{if(e.dataTransfer?.items){const t=ke(e.dataTransfer.items);t&&B.value&&(S(t),e.preventDefault())}},onKeyDown:e=>{const t=e.key;(e.ctrlKey||e.metaKey)&&"Enter"===t&&L()},onPaste:e=>{if(e.clipboardData){const t=ke(e.clipboardData.items);t&&B.value&&S(t)}},onLogin:e=>{e.preventDefault();const{lang:t,serverURL:n}=o.value,l=(window.innerWidth-450)/2,r=(window.innerHeight-450)/2,a=window.open(`${n}/ui/login?lng=${encodeURIComponent(t)}`,"_blank",`width=450,height=450,left=${l},top=${r},scrollbars=no,resizable=no,status=no,location=no,toolbar=no,menubar=no`);a?.postMessage({type:"TOKEN",data:null},"*");const c=({data:e})=>{e&&"userInfo"===e.type&&e.data.token&&(a?.close(),i.value=e.data,(e.data.remember?localStorage:sessionStorage).setItem("WALINE_USER",JSON.stringify(e.data)),window.removeEventListener("message",c))};window.addEventListener("message",c)},onLogout:()=>{i.value={},localStorage.setItem("WALINE_USER","null"),sessionStorage.setItem("WALINE_USER","null")},onProfile:e=>{e.preventDefault();const{lang:t,serverURL:n}=o.value,l=(window.innerWidth-800)/2,r=(window.innerHeight-800)/2;window.open(`${n}/ui/profile?lng=${encodeURIComponent(t)}`,"_blank",`width=800,height=800,left=${l},top=${r},scrollbars=no,resizable=no,status=no,location=no,toolbar=no,menubar=no`)?.postMessage({type:"TOKEN",data:i.value.token},"*");const a=({data:e})=>{e&&"profile"===e.type&&(i.value={...i.value,...e},[localStorage,sessionStorage].filter((e=>e.getItem("WALINE_USER"))).forEach((e=>e.setItem("WALINE_USER",JSON.stringify(i)))),window.removeEventListener("message",a))};window.addEventListener("message",a)},submitComment:L,isLogin:$,userInfo:i,isSubmitting:C,wordNumber:w,wordLimit:y,isWordNumberLegal:k,editor:r,userMeta:a,emoji:p,emojiTabIndex:v,showEmoji:g,canUploadImage:B,previewText:f,showPreview:h,inputRefs:c,editorRef:s,emojiButtonRef:u,emojiPopupRef:d,imageUploadRef:m}}}),Ae={class:"wl-comment"},Ue={key:0,class:"wl-login-info"},De={class:"wl-avatar"},Me=["title"],Oe=["src"],Te=["textContent"],Pe={class:"wl-panel"},_e=["for","textContent"],Fe=["id","name","type","onUpdate:modelValue"],He=["placeholder"],We={class:"wl-preview"},qe=e.createElementVNode("hr",null,null,-1),Je=["innerHTML"],Ke={class:"wl-footer"},Ye={class:"wl-actions"},Ge={href:"https://guides.github.com/features/mastering-markdown/",title:"Markdown Guide","aria-label":"Markdown is supported",class:"wl-action",target:"_blank",rel:"noreferrer"},Xe=["title"],Qe=["title"],Ze=["title"],et={class:"wl-info"},tt={class:"wl-text-number"},nt={key:0},ot=e.createTextVNode("  /  "),lt=["textContent"],rt=["textContent"],at=["disabled"],it={key:0,class:"wl-tab-wrapper"},ct=["title","onClick"],st=["src","alt"],mt={key:0,class:"wl-tabs"},ut=["onClick"],dt=["src","alt","title"],pt=["title"];var vt=Re(ze,[["render",function(t,n,o,l,r,a){const i=e.resolveComponent("CloseIcon"),c=e.resolveComponent("MarkdownIcon"),s=e.resolveComponent("EmojiIcon"),m=e.resolveComponent("ImageIcon"),u=e.resolveComponent("PreviewIcon"),d=e.resolveComponent("LoadingIcon");return e.openBlock(),e.createElementBlock("div",Ae,["disable"!==t.config.login&&t.isLogin?(e.openBlock(),e.createElementBlock("div",Ue,[e.createElementVNode("div",De,[e.createElementVNode("button",{class:"wl-logout-btn",title:t.locale.logout,onClick:n[0]||(n[0]=(...e)=>t.onLogout&&t.onLogout(...e))},[e.createVNode(i,{size:14})],8,Me),e.createElementVNode("img",{src:t.userInfo.avatar,alt:"avatar"},null,8,Oe)]),e.createElementVNode("a",{href:"#",class:"wl-login-nick","aria-label":"Profile",onClick:n[1]||(n[1]=(...e)=>t.onProfile&&t.onProfile(...e)),textContent:e.toDisplayString(t.userInfo.display_name)},null,8,Te)])):e.createCommentVNode("v-if",!0),e.createElementVNode("div",Pe,["force"!==t.config.login&&t.config.meta.length&&!t.isLogin?(e.openBlock(),e.createElementBlock("div",{key:0,class:e.normalizeClass(["wl-header",`item${t.config.meta.length}`])},[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(t.config.meta,(n=>(e.openBlock(),e.createElementBlock("div",{class:"wl-header-item",key:n},[e.createElementVNode("label",{for:n,textContent:e.toDisplayString(t.locale[n]+(t.config.requiredMeta.includes(n)||!t.config.requiredMeta.length?"":`(${t.locale.optional})`))},null,8,_e),e.withDirectives(e.createElementVNode("input",{ref_for:!0,ref:e=>{e&&(t.inputRefs[n]=e)},id:`wl-${n}`,class:e.normalizeClass(["wl-input",`wl-${n}`]),name:n,type:"mail"===n?"email":"text","onUpdate:modelValue":e=>t.userMeta[n]=e},null,10,Fe),[[e.vModelDynamic,t.userMeta[n]]])])))),128))],2)):e.createCommentVNode("v-if",!0),e.withDirectives(e.createElementVNode("textarea",{class:"wl-editor",ref:"editorRef",id:"wl-edit",placeholder:t.replyUser?`@${t.replyUser}`:t.locale.placeholder,"onUpdate:modelValue":n[2]||(n[2]=e=>t.editor=e),onKeydown:n[3]||(n[3]=(...e)=>t.onKeyDown&&t.onKeyDown(...e)),onDrop:n[4]||(n[4]=(...e)=>t.onDrop&&t.onDrop(...e)),onPaste:n[5]||(n[5]=(...e)=>t.onPaste&&t.onPaste(...e))},null,40,He),[[e.vModelText,t.editor]]),e.withDirectives(e.createElementVNode("div",We,[qe,e.createElementVNode("h4",null,e.toDisplayString(t.locale.preview)+":",1),e.createElementVNode("div",{class:"wl-content",innerHTML:t.previewText},null,8,Je)],512),[[e.vShow,t.showPreview]]),e.createElementVNode("div",Ke,[e.createElementVNode("div",Ye,[e.createElementVNode("a",Ge,[e.createVNode(c)]),e.withDirectives(e.createElementVNode("button",{ref:"emojiButtonRef",class:e.normalizeClass(["wl-action",{actived:t.showEmoji}]),title:t.locale.emoji,onClick:n[6]||(n[6]=e=>t.showEmoji=!t.showEmoji)},[e.createVNode(s)],10,Xe),[[e.vShow,t.emoji.tabs.length]]),e.createElementVNode("input",{ref:"imageUploadRef",class:"upload",id:"wl-image-upload",type:"file",accept:".png,.jpg,.jpeg,.webp,.bmp,.gif",onChange:n[7]||(n[7]=(...e)=>t.onChange&&t.onChange(...e))},null,544),t.canUploadImage?(e.openBlock(),e.createElementBlock("label",{key:0,for:"wl-image-upload",class:"wl-action",title:t.locale.uploadImage},[e.createVNode(m)],8,Qe)):e.createCommentVNode("v-if",!0),e.createElementVNode("button",{class:e.normalizeClass(["wl-action",{actived:t.showPreview}]),title:t.locale.preview,onClick:n[8]||(n[8]=e=>t.showPreview=!t.showPreview)},[e.createVNode(u)],10,Ze)]),e.createElementVNode("div",et,[e.createElementVNode("div",tt,[e.createTextVNode(e.toDisplayString(t.wordNumber)+" ",1),t.config.wordLimit?(e.openBlock(),e.createElementBlock("span",nt,[ot,e.createElementVNode("span",{class:e.normalizeClass({illegal:!t.isWordNumberLegal}),textContent:e.toDisplayString(t.wordLimit)},null,10,lt)])):e.createCommentVNode("v-if",!0),e.createTextVNode("  "+e.toDisplayString(t.locale.word),1)]),"disable"===t.config.login||t.isLogin?e.createCommentVNode("v-if",!0):(e.openBlock(),e.createElementBlock("button",{key:0,class:"wl-btn",onClick:n[9]||(n[9]=(...e)=>t.onLogin&&t.onLogin(...e)),textContent:e.toDisplayString(t.locale.login)},null,8,rt)),"force"!==t.config.login||t.isLogin?(e.openBlock(),e.createElementBlock("button",{key:1,class:"wl-btn primary",title:"Cmd|Ctrl + Enter",disabled:t.isSubmitting,onClick:n[10]||(n[10]=(...e)=>t.submitComment&&t.submitComment(...e))},[t.isSubmitting?(e.openBlock(),e.createBlock(d,{key:0,size:16})):(e.openBlock(),e.createElementBlock(e.Fragment,{key:1},[e.createTextVNode(e.toDisplayString(t.locale.submit),1)],2112))],8,at)):e.createCommentVNode("v-if",!0)]),e.createElementVNode("div",{ref:"emojiPopupRef",class:e.normalizeClass(["wl-emoji-popup",{display:t.showEmoji}])},[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(t.emoji.tabs,((n,o)=>(e.openBlock(),e.createElementBlock(e.Fragment,{key:n.name},[o===t.emojiTabIndex?(e.openBlock(),e.createElementBlock("div",it,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(n.items,(n=>(e.openBlock(),e.createElementBlock("button",{key:n,title:n,onClick:e=>t.insert(`:${n}:`)},[t.showEmoji?(e.openBlock(),e.createElementBlock("img",{key:0,class:"wl-emoji",src:t.emoji.map[n],alt:n,loading:"lazy",referrerPolicy:"no-referrer"},null,8,st)):e.createCommentVNode("v-if",!0)],8,ct)))),128))])):e.createCommentVNode("v-if",!0)],64)))),128)),t.emoji.tabs.length>1?(e.openBlock(),e.createElementBlock("div",mt,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(t.emoji.tabs,((n,o)=>(e.openBlock(),e.createElementBlock("button",{key:n.name,class:e.normalizeClass(["wl-tab",{active:t.emojiTabIndex===o}]),onClick:e=>t.emojiTabIndex=o},[e.createElementVNode("img",{class:"wl-emoji",src:n.icon,alt:n.name,title:n.name,loading:"lazy",referrerPolicy:"no-referrer"},null,8,dt)],10,ut)))),128))])):e.createCommentVNode("v-if",!0)],2)])]),t.replyId?(e.openBlock(),e.createElementBlock("button",{key:1,class:"wl-close",title:t.locale.cancelReply,onClick:n[11]||(n[11]=e=>t.$emit("cancel-reply"))},[e.createVNode(i,{size:24})],8,pt)):e.createCommentVNode("v-if",!0)])}],["__file","CommentBox.vue"]]);const gt=["approved","waiting","spam"],ht=e.defineComponent({props:{comment:{type:Object,required:!0},rootId:{type:String,required:!0},reply:{type:Object}},components:{CommentBox:vt,DeleteIcon:()=>e.h("svg",{viewBox:"0 0 1024 1024",width:"24",height:"24"},e.h("path",{d:"m341.013 394.667 27.755 393.45h271.83l27.733-393.45h64.106l-28.01 397.952a64 64 0 0 1-63.83 59.498H368.768a64 64 0 0 1-63.83-59.52l-28.053-397.93h64.128zm139.307 19.818v298.667h-64V414.485h64zm117.013 0v298.667h-64V414.485h64zM181.333 288h640v64h-640v-64zm453.483-106.667v64h-256v-64h256z",fill:"red"})),LikeIcon:({active:t=!1})=>e.h("svg",{viewBox:"0 0 1024 1024",width:"24",height:"24"},[e.h("path",{d:"M850.654 323.804c-11.042-25.625-26.862-48.532-46.885-68.225-20.022-19.61-43.258-34.936-69.213-45.73-26.78-11.124-55.124-16.727-84.375-16.727-40.622 0-80.256 11.123-114.698 32.135A214.79 214.79 0 0 0 512 241.819a214.79 214.79 0 0 0-23.483-16.562c-34.442-21.012-74.076-32.135-114.698-32.135-29.25 0-57.595 5.603-84.375 16.727-25.872 10.711-49.19 26.12-69.213 45.73-20.105 19.693-35.843 42.6-46.885 68.225-11.453 26.615-17.303 54.877-17.303 83.963 0 27.439 5.603 56.03 16.727 85.117 9.31 24.307 22.659 49.52 39.715 74.981 27.027 40.293 64.188 82.316 110.33 124.915 76.465 70.615 152.189 119.394 155.402 121.371l19.528 12.525c8.652 5.52 19.776 5.52 28.427 0l19.529-12.525c3.213-2.06 78.854-50.756 155.401-121.371 46.143-42.6 83.304-84.622 110.33-124.915 17.057-25.46 30.487-50.674 39.716-74.981 11.124-29.087 16.727-57.678 16.727-85.117.082-29.086-5.768-57.348-17.221-83.963z"+(t?"":"M512 761.5S218.665 573.55 218.665 407.767c0-83.963 69.461-152.023 155.154-152.023 60.233 0 112.473 33.618 138.181 82.727 25.708-49.109 77.948-82.727 138.18-82.727 85.694 0 155.155 68.06 155.155 152.023C805.335 573.551 512 761.5 512 761.5z"),fill:t?"red":"currentColor"})]),ReplyIcon:()=>e.h("svg",{viewBox:"0 0 1024 1024",width:"24",height:"24"},e.h("path",{d:"M810.667 213.333a64 64 0 0 1 64 64V704a64 64 0 0 1-64 64H478.336l-146.645 96.107a21.333 21.333 0 0 1-33.024-17.856V768h-85.334a64 64 0 0 1-64-64V277.333a64 64 0 0 1 64-64h597.334zm0 64H213.333V704h149.334v63.296L459.243 704h351.424V277.333zm-271.36 213.334v64h-176.64v-64h176.64zm122.026-128v64H362.667v-64h298.666z",fill:"currentColor"})),VerifiedIcon:()=>e.h("svg",{class:"verified-icon",viewBox:"0 0 1024 1024",width:"14",height:"14"},e.h("path",{d:"m894.4 461.56-54.4-63.2c-10.4-12-18.8-34.4-18.8-50.4v-68c0-42.4-34.8-77.2-77.2-77.2h-68c-15.6 0-38.4-8.4-50.4-18.8l-63.2-54.4c-27.6-23.6-72.8-23.6-100.8 0l-62.8 54.8c-12 10-34.8 18.4-50.4 18.4h-69.2c-42.4 0-77.2 34.8-77.2 77.2v68.4c0 15.6-8.4 38-18.4 50l-54 63.6c-23.2 27.6-23.2 72.4 0 100l54 63.6c10 12 18.4 34.4 18.4 50v68.4c0 42.4 34.8 77.2 77.2 77.2h69.2c15.6 0 38.4 8.4 50.4 18.8l63.2 54.4c27.6 23.6 72.8 23.6 100.8 0l63.2-54.4c12-10.4 34.4-18.8 50.4-18.8h68c42.4 0 77.2-34.8 77.2-77.2v-68c0-15.6 8.4-38.4 18.8-50.4l54.4-63.2c23.2-27.6 23.2-73.2-.4-100.8zm-216-25.2-193.2 193.2a30 30 0 0 1-42.4 0l-96.8-96.8a30.16 30.16 0 0 1 0-42.4c11.6-11.6 30.8-11.6 42.4 0l75.6 75.6 172-172c11.6-11.6 30.8-11.6 42.4 0 11.6 11.6 11.6 30.8 0 42.4z",fill:"#27ae60"}))},emits:["submit","reply","like","delete","status","sticky"],setup(t){const n=e.inject("config"),o=Ve(),l=Le(),r=e.computed((()=>n.value.locale)),a=e.computed((()=>{let{link:e}=t.comment;return e?oe(e)?e:`https://${e}`:""})),i=e.computed((()=>o.value.includes(t.comment.objectId))),c=((t,n)=>{const o=Z();return e.computed((()=>se(t,o.value,n)))})(t.comment.insertedAt,r.value),s=e.computed((()=>"administrator"===l.value.type)),m=e.computed((()=>t.comment.user_id&&l.value.objectId===t.comment.user_id)),u=e.computed((()=>t.comment.objectId===t.reply?.objectId));return{config:n,locale:r,isReplyingCurrent:u,link:a,like:i,time:c,isAdmin:s,isOwner:m,commentStatus:gt}}}),ft=["id"],wt={class:"wl-user","aria-hidden":"true"},yt=["src"],kt={class:"wl-card"},bt={class:"wl-head"},Ct=["href"],Et={key:1,class:"wl-nick"},$t=["textContent"],Bt=["textContent"],Nt=["textContent"],St=["textContent"],Lt=["textContent"],It={class:"wl-comment-actions"},Vt=["title"],jt=["textContent"],xt=["title"],Rt={class:"wl-meta","aria-hidden":"true"},zt=["textContent"],At=["textContent"],Ut=["textContent"],Dt=["innerHTML"],Mt={key:0,class:"wl-admin-actions"},Ot={class:"wl-comment-status"},Tt=["disabled","onClick","textContent"],Pt={key:1,class:"wl-reply-wrapper"},_t={key:2,class:"wl-quote"};var Ft=Re(ht,[["render",function(t,n,o,l,r,a){const i=e.resolveComponent("VerifiedIcon"),c=e.resolveComponent("DeleteIcon"),s=e.resolveComponent("LikeIcon"),m=e.resolveComponent("ReplyIcon"),u=e.resolveComponent("CommentBox"),d=e.resolveComponent("CommentCard",!0);return e.openBlock(),e.createElementBlock("div",{class:"wl-item",id:t.comment.objectId},[e.createElementVNode("div",wt,[t.comment.avatar?(e.openBlock(),e.createElementBlock("img",{key:0,src:t.comment.avatar},null,8,yt)):e.createCommentVNode("v-if",!0),t.comment.type?(e.openBlock(),e.createBlock(i,{key:1})):e.createCommentVNode("v-if",!0)]),e.createElementVNode("div",kt,[e.createElementVNode("div",bt,[t.link?(e.openBlock(),e.createElementBlock("a",{key:0,class:"wl-nick",href:t.link,target:"_blank",rel:"nofollow noreferrer"},e.toDisplayString(t.comment.nick),9,Ct)):(e.openBlock(),e.createElementBlock("span",Et,e.toDisplayString(t.comment.nick),1)),"administrator"===t.comment.type?(e.openBlock(),e.createElementBlock("span",{key:2,class:"wl-badge",textContent:e.toDisplayString(t.locale.admin)},null,8,$t)):e.createCommentVNode("v-if",!0),t.comment.label?(e.openBlock(),e.createElementBlock("span",{key:3,class:"wl-badge",textContent:e.toDisplayString(t.comment.label)},null,8,Bt)):e.createCommentVNode("v-if",!0),t.comment.sticky?(e.openBlock(),e.createElementBlock("span",{key:4,class:"wl-badge",textContent:e.toDisplayString(t.locale.sticky)},null,8,Nt)):e.createCommentVNode("v-if",!0),t.comment.level&&t.comment.level>=0?(e.openBlock(),e.createElementBlock("span",{key:5,class:e.normalizeClass(`wl-badge level${t.comment.level}`),textContent:e.toDisplayString(t.locale[`level${t.comment.level}`]||`Level ${t.comment.level}`)},null,10,St)):e.createCommentVNode("v-if",!0),e.createElementVNode("span",{class:"wl-time",textContent:e.toDisplayString(t.time)},null,8,Lt),e.createElementVNode("div",It,[t.isAdmin||t.isOwner?(e.openBlock(),e.createElementBlock("button",{key:0,class:"wl-delete",onClick:n[0]||(n[0]=e=>t.$emit("delete",t.comment))},[e.createVNode(c)])):e.createCommentVNode("v-if",!0),e.createElementVNode("button",{class:"wl-like",onClick:n[1]||(n[1]=e=>t.$emit("like",t.comment)),title:t.like?t.locale.cancelLike:t.locale.like},[e.createVNode(s,{active:t.like},null,8,["active"]),"like"in t.comment?(e.openBlock(),e.createElementBlock("span",{key:0,textContent:e.toDisplayString(t.comment.like)},null,8,jt)):e.createCommentVNode("v-if",!0)],8,Vt),e.createElementVNode("button",{class:e.normalizeClass(["wl-reply",{active:t.isReplyingCurrent}]),title:t.isReplyingCurrent?t.locale.cancelReply:t.locale.reply,onClick:n[2]||(n[2]=e=>t.$emit("reply",t.isReplyingCurrent?null:t.comment))},[e.createVNode(m)],10,xt)])]),e.createElementVNode("div",Rt,[t.comment.addr?(e.openBlock(),e.createElementBlock("span",{key:0,textContent:e.toDisplayString(t.comment.addr)},null,8,zt)):e.createCommentVNode("v-if",!0),t.comment.browser?(e.openBlock(),e.createElementBlock("span",{key:1,textContent:e.toDisplayString(t.comment.browser)},null,8,At)):e.createCommentVNode("v-if",!0),t.comment.os?(e.openBlock(),e.createElementBlock("span",{key:2,textContent:e.toDisplayString(t.comment.os)},null,8,Ut)):e.createCommentVNode("v-if",!0)]),e.createElementVNode("div",{class:"wl-content",innerHTML:t.comment.comment},null,8,Dt),t.isAdmin?(e.openBlock(),e.createElementBlock("div",Mt,[e.createElementVNode("span",Ot,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(t.commentStatus,(n=>(e.openBlock(),e.createElementBlock("button",{key:n,class:e.normalizeClass(`wl-btn wl-${n}`),disabled:t.comment.status===n,onClick:e=>t.$emit("status",{status:n,comment:t.comment}),textContent:e.toDisplayString(n)},null,10,Tt)))),128))]),t.isAdmin&&!t.comment.rid?(e.openBlock(),e.createElementBlock("button",{key:0,class:"wl-btn wl-sticky",onClick:n[3]||(n[3]=e=>t.$emit("sticky",t.comment))},e.toDisplayString(t.comment.sticky?"unsticky":"sticky"),1)):e.createCommentVNode("v-if",!0)])):e.createCommentVNode("v-if",!0),t.isReplyingCurrent?(e.openBlock(),e.createElementBlock("div",Pt,[e.createVNode(u,{replyId:t.comment.objectId,replyUser:t.comment.nick,rootId:t.rootId,onSubmit:n[4]||(n[4]=e=>t.$emit("submit",e)),onCancelReply:n[5]||(n[5]=e=>t.$emit("reply",null))},null,8,["replyId","replyUser","rootId"])])):e.createCommentVNode("v-if",!0),t.comment.children?(e.openBlock(),e.createElementBlock("div",_t,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(t.comment.children,(o=>(e.openBlock(),e.createBlock(d,{key:o.objectId,comment:o,reply:t.reply,rootId:t.rootId,onReply:n[6]||(n[6]=e=>t.$emit("reply",e)),onSubmit:n[7]||(n[7]=e=>t.$emit("submit",e)),onLike:n[8]||(n[8]=e=>t.$emit("like",e)),onDelete:n[9]||(n[9]=e=>t.$emit("delete",e)),onStatus:n[10]||(n[10]=e=>t.$emit("status",e)),onSticky:n[11]||(n[11]=e=>t.$emit("sticky",e))},null,8,["comment","reply","rootId"])))),128))])):e.createCommentVNode("v-if",!0)])],8,ft)}],["__file","CommentCard.vue"]]);const Ht=e.defineComponent({name:"WalineRoot",components:{CommentBox:vt,CommentCard:Ft,LoadingIcon:xe},props:["serverURL","path","meta","requiredMeta","dark","lang","locale","pageSize","wordLimit","emoji","login","highlighter","texRenderer","imageUploader","copyright"],setup(t){const n=e.computed((()=>(({serverURL:e,path:t=location.pathname,lang:n="zh-CN",locale:o,emoji:l=["//unpkg.com/@waline/emojis@1.0.1/weibo"],meta:r=["nick","mail","link"],requiredMeta:s=[],dark:m=!1,pageSize:u=10,wordLimit:p,imageUploader:v,highlighter:g,texRenderer:h,copyright:f=!0,login:w="enable",...y})=>({serverURL:le(e),path:te(t),locale:{...b[n]||b["zh-CN"],..."object"==typeof o?o:{}},wordLimit:re(p),meta:a(r),requiredMeta:a(s),imageUploader:ae(v,i),highlighter:ae(g,d),texRenderer:ae(h,c),lang:n,dark:m,emoji:l,pageSize:u,login:w,copyright:f,...y}))(t))),o=Le(),l=Ve(),r=e.ref("loading"),s=e.ref(0),m=e.ref(1),u=e.ref(0),p=e.ref([]),v=e.ref(null),g=e.computed((()=>{return"string"==typeof(e=n.value.dark)?"auto"===e?`@media(prefers-color-scheme:dark){body${ie}}`:`${e}${ie}`:!0===e?`:root${ie}`:"";var e}));let h;!function(t,n={}){const o=e.ref(!1),{document:l=O,immediate:r=!0,manual:a=!1,id:i="vueuse_styletag_"+ ++ee}=n,c=e.ref(t);let s=()=>{};const m=()=>{if(!l)return;const t=l.getElementById(i)||l.createElement("style");t.type="text/css",t.id=i,n.media&&(t.media=n.media),l.head.appendChild(t),o.value||(s=e.watch(c,(e=>{t.innerText=e}),{immediate:!0}),o.value=!0)},u=()=>{l&&o.value&&(s(),l.head.removeChild(l.getElementById(i)),o.value=!1)};r&&!a&&m(),a||C(u),e.readonly(o)}(g);const f=e=>{const{serverURL:t,path:l,pageSize:a}=n.value,i=new AbortController;r.value="loading",h?.(),(({serverURL:e,lang:t,path:n,page:o,pageSize:l,signal:r,token:a})=>{const i={};return a&&(i.Authorization=`Bearer ${a}`),fetch(`${e}/comment?path=${encodeURIComponent(n)}&pageSize=${l}&page=${o}&lang=${t}`,{signal:r,headers:i}).then((e=>e.json())).then((e=>ve(e,"comment list")))})({serverURL:t,lang:n.value.lang,path:l,pageSize:a,page:e,signal:i.signal,token:o.value?.token}).then((t=>{r.value="success",s.value=t.count,p.value.push(...t.data),m.value=e,u.value=t.totalPages})).catch((e=>{"AbortError"!==e.name&&(console.error(e.message),r.value="error")})),h=i.abort.bind(i)},w=()=>{s.value=0,p.value=[],f(1)};return e.provide("config",n),e.watch((()=>t.path),w),e.onMounted((()=>w())),{config:n,darkmodeStyle:g,i18n:e.computed((()=>n.value.locale)),status:r,count:s,page:m,totalPages:u,data:p,reply:v,loadMore:()=>f(m.value+1),refresh:w,onReply:e=>{v.value=e},onSubmit:e=>{if(e.rid){const t=p.value.find((({objectId:t})=>t===e.rid));if(!t)return;Array.isArray(t.children)||(t.children=[]),t.children.push(e)}else p.value.unshift(e)},onStatusChange:async({comment:e,status:t})=>{if(e.status===t)return;const{serverURL:l,lang:r}=n.value;await ge({serverURL:l,lang:r,token:o.value?.token,objectId:e.objectId,status:t}),e.status=t},onDelete:async({objectId:e})=>{if(!confirm("Are you sure you want to delete this comment?"))return;const{serverURL:t,lang:l}=n.value;await(({serverURL:e,lang:t,token:n,objectId:o})=>fetch(`${e}/comment/${o}?lang=${t}`,{method:"DELETE",headers:{Authorization:`Bearer ${n}`}}).then((e=>e.json())))({serverURL:t,lang:l,token:o.value?.token,objectId:e}),p.value.some(((t,n)=>t.objectId===e?(p.value=p.value.filter(((e,t)=>t!==n)),!0):t.children.some(((o,l)=>o.objectId===e&&(p.value[n].children=t.children.filter(((e,t)=>t!==l)),!0)))))},onSticky:async e=>{if(e.rid)return;const{serverURL:t,lang:l}=n.value;await ge({serverURL:t,lang:l,token:o.value?.token,objectId:e.objectId,sticky:e.sticky?0:1}),e.sticky=!e.sticky},onLike:async e=>{const{serverURL:t,lang:o}=n.value,{objectId:r}=e,a=l.value.includes(r);await(({serverURL:e,lang:t,objectId:n,like:o})=>fetch(`${e}/comment/${n}?lang=${t}`,{method:"PUT",headers:pe,body:JSON.stringify({like:o})}).then((e=>e.json())))({serverURL:t,lang:o,objectId:r,like:!a}),a?l.value=l.value.filter((e=>e!==r)):(l.value=[...l.value,r],l.value.length>50&&(l.value=l.value.slice(-50))),e.like=(e.like||0)+(a?-1:1)},version:"2.4.2"}}}),Wt={"data-waline":""},qt={class:"wl-count"},Jt=["textContent"],Kt={class:"wl-cards"},Yt={key:1,class:"wl-operation"},Gt=["textContent"],Xt={key:0,class:"wl-loading"},Qt=["textContent"],Zt={class:"wl-operation"},en=["textContent"],tn={key:3,class:"wl-power"},nn=e.createTextVNode(" Powered by "),on=e.createElementVNode("a",{href:"https://github.com/walinejs/waline",target:"_blank",rel:"noreferrer"}," Waline ",-1);var ln=Re(Ht,[["render",function(t,n,o,l,r,a){const i=e.resolveComponent("CommentBox"),c=e.resolveComponent("CommentCard"),s=e.resolveComponent("LoadingIcon");return e.openBlock(),e.createElementBlock("div",Wt,[t.reply?e.createCommentVNode("v-if",!0):(e.openBlock(),e.createBlock(i,{key:0,onSubmit:t.onSubmit},null,8,["onSubmit"])),e.createElementVNode("div",qt,[t.count?(e.openBlock(),e.createElementBlock("span",{key:0,class:"wl-num",textContent:e.toDisplayString(t.count)},null,8,Jt)):e.createCommentVNode("v-if",!0),e.createTextVNode(" "+e.toDisplayString(t.i18n.comment),1)]),e.createElementVNode("div",Kt,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(t.data,(n=>(e.openBlock(),e.createBlock(c,{key:n.objectId,"root-id":n.objectId,comment:n,reply:t.reply,onReply:t.onReply,onSubmit:t.onSubmit,onStatus:t.onStatusChange,onDelete:t.onDelete,onSticky:t.onSticky,onLike:t.onLike},null,8,["root-id","comment","reply","onReply","onSubmit","onStatus","onDelete","onSticky","onLike"])))),128))]),"error"===t.status?(e.openBlock(),e.createElementBlock("div",Yt,[e.createElementVNode("button",{type:"button",class:"wl-btn",onClick:n[0]||(n[0]=(...e)=>t.refresh&&t.refresh(...e)),textContent:e.toDisplayString(t.i18n.refresh)},null,8,Gt)])):(e.openBlock(),e.createElementBlock(e.Fragment,{key:2},["loading"===t.status?(e.openBlock(),e.createElementBlock("div",Xt,[e.createVNode(s,{size:30})])):t.data.length?t.page<t.totalPages?(e.openBlock(),e.createElementBlock(e.Fragment,{key:2},[e.createCommentVNode(" Load more button "),e.createElementVNode("div",Zt,[e.createElementVNode("button",{type:"button",class:"wl-btn",onClick:n[1]||(n[1]=(...e)=>t.loadMore&&t.loadMore(...e)),textContent:e.toDisplayString(t.i18n.more)},null,8,en)])],2112)):e.createCommentVNode("v-if",!0):(e.openBlock(),e.createElementBlock("div",{key:1,class:"wl-empty",textContent:e.toDisplayString(t.i18n.sofa)},null,8,Qt))],2112)),e.createCommentVNode(" Copyright Information "),t.config.copyright?(e.openBlock(),e.createElementBlock("div",tn,[nn,on,e.createTextVNode(" v"+e.toDisplayString(t.version),1)])):e.createCommentVNode("v-if",!0)])}],["__file","Waline.vue"]]);const rn=(e,t)=>{t.forEach(((t,n)=>{t.innerText=e[n].toString()}))},an=({serverURL:e,path:t=window.location.pathname,selector:n=".waline-pageview-count",update:o=!0,lang:l="zh-CN"})=>{const r=new AbortController,a=Array.from(document.querySelectorAll(n)),i=e=>{const n=Ne(e);return null!==n&&t!==n},c=n=>he({serverURL:e,paths:n.map((e=>Ne(e)||t)),lang:l,signal:r.signal}).then((e=>rn(e,n))).catch(de);if(o){const n=a.filter((e=>!i(e))),o=a.filter(i);fe({serverURL:e,path:t,lang:l}).then((e=>rn(new Array(n.length).fill(e),n))),o.length&&c(o)}else c(a);return r.abort.bind(r)};exports.RecentComments=({el:e,serverURL:t,count:n,lang:o="zh-CN"})=>{const l=Le(),r=we(e),a=new AbortController;return(({serverURL:e,lang:t,count:n,signal:o,token:l})=>{const r={};return l&&(r.Authorization=`Bearer ${l}`),fetch(`${e}/comment?type=recent&count=${n}&lang=${t}`,{signal:o,headers:r}).then((e=>e.json())).then((e=>ve(e,"recent comment")))})({serverURL:t,count:n,lang:o,signal:a.signal,token:l.value?.token}).then((e=>r&&e.length?(r.innerHTML=`<ul class="wl-recent-list">${e.map((e=>`<li class="wl-recent-item"><a href="${e.url}">${e.nick}</a>:${e.comment}</li>`)).join("")}</ul>`,{comments:e,destroy:()=>{a.abort(),r.innerHTML=""}}):{comments:e,destroy:()=>a.abort()}))},exports.commentCount=je,exports.defaultLocales=b,exports.init=({el:t="#waline",path:n=window.location.pathname,comment:o=!1,pageview:l=!1,...r})=>{const a=t?we(t):null;if(t&&!a)throw new Error("Option 'el' do not match any domElement!");if(!r.serverURL)throw new Error("Option 'serverURL' is missing!");const i=e.reactive({...r}),c=e.reactive({comment:o,pageview:l,path:n}),s=()=>{c.comment&&je({serverURL:i.serverURL,path:c.path,selector:"string"==typeof c.comment?c.comment:void 0})},m=()=>{c.pageview&&an({serverURL:i.serverURL,path:c.path,selector:"string"==typeof c.pageview?c.pageview:void 0})},u=a?e.createApp((()=>e.h(ln,{path:c.path,...i}))):null;u&&u.mount(a),s(),m();const d=e.watchEffect(s),p=e.watchEffect(m);return{el:a,update:({comment:e,pageview:t,path:n=window.location.pathname,...o}={})=>{Object.entries(o).forEach((([e,t])=>{i[e]=t})),c.path=n,void 0!==e&&(c.comment=e),void 0!==t&&(c.pageview=t)},destroy:()=>{u?.unmount(),d(),p()}}},exports.pageviewCount=an,exports.version="2.4.2";
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("vue"),t=require("autosize"),n=require("marked");function o(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var l=o(t);const r=["nick","mail","link"],a=e=>e.filter((e=>r.includes(e))),i=e=>new Promise(((t,n)=>{const o=new FileReader;o.readAsDataURL(e),o.onload=()=>t(o.result?.toString()||""),o.onerror=n})),c=e=>!0===e?'<p class="wl-tex">Tex is not available in preview</p>':'<span class="wl-tex">Tex is not available in preview</span>',s=new RegExp(`(${/[\u4E00-\u9FFF\u3400-\u4dbf\uf900-\ufaff\u3040-\u309f\uac00-\ud7af\u0400-\u04FF]+|\w+/.source}|${/</.source})|((?:${/(?:^|\s)\/\/(.+?)$/gm.source})|(?:${/\/\*([\S\s]*?)\*\//gm.source}))`,"gmi"),m=["23AC69","91C132","F19726","E8552D","1AAB8E","E1147F","2980C1","1BA1E6","9FA0A0","F19726","E30B20","E30B20","A3338B"],u={},d=e=>{let t=0;return e.replace(s,((e,n,o)=>{if(o)return`<span style="color: slategray">${o}</span>`;if("<"===n)return"&lt;";let l;u[n]?l=u[n]:(l=m[t],u[n]=l);const r=`<span style="color: #${l}">${n}</span>`;return t=++t%m.length,r}))},p=["nick","nickError","mail","mailError","link","optional","placeholder","sofa","submit","like","cancelLike","reply","cancelReply","comment","refresh","more","preview","emoji","uploadImage","seconds","minutes","hours","days","now","uploading","login","logout","admin","sticky","word","wordHint","anonymous","level0","level1","level2","level3","level4","level5","gif","gifSearchPlaceholder"],v=e=>Object.fromEntries(e.map(((e,t)=>[p[t],e])));var g=v(["NickName","NickName cannot be less than 3 bytes.","E-Mail","Please confirm your email address.","Website","Optional","Comment here...","No comment yet.","Submit","Like","Cancel like","Reply","Cancel reply","Comments","Refresh","Load More...","Preview","Emoji","Upload Image","seconds ago","minutes ago","hours ago","days ago","just now","Uploading","Login","logout","Admin","Sticky","Words","Please input comments between $0 and $1 words!\n Current word number: $2","Anonymous","Dwarves","Hobbits","Ents","Wizards","Elves","Maiar","GIF","Search GIF"]),f=v(["ニックネーム","3バイト以上のニックネームをご入力ください.","メールアドレス","メールアドレスをご確認ください.","サイト","オプション","ここにコメント","コメントしましょう~","提出する","Like","Cancel like","返信する","キャンセル","コメント","更新","さらに読み込む","プレビュー","絵文字","画像をアップロード","秒前","分前","時間前","日前","たっだ今","アップロード","ログインする","ログアウト","管理者","トップに置く","ワード","コメントは $0 から $1 ワードの間でなければなりません!\n 現在の単語番号: $2","匿名","うえにん","なかにん","しもおし","特にしもおし","かげ","なぬし","GIF","探す GIF"]),h=v(["昵称","昵称不能少于3个字符","邮箱","请填写正确的邮件地址","网址","可选","欢迎评论","来发评论吧~","提交","喜欢","取消喜欢","回复","取消回复","评论","刷新","加载更多...","预览","表情","上传图片","秒前","分钟前","小时前","天前","刚刚","正在上传","登录","退出","博主","置顶","字","评论字数应在 $0 到 $1 字之间!\n当前字数:$2","匿名","潜水","冒泡","吐槽","活跃","话痨","传说","表情包","搜索表情包"]),w=v(["暱稱","郵箱","網址","可選","暱稱不能少於3個字元","請填寫正確的郵件地址","歡迎評論","來發評論吧~","提交","喜歡","取消喜歡","回覆","取消回覆","評論","刷新","載入更多...","預覽","表情","上傳圖片","秒前","分鐘前","小時前","天前","剛剛","正在上傳","登錄","退出","博主","置頂","字","評論字數應在 $0 到 $1 字之間!\n當前字數:$2","匿名","潛水","冒泡","吐槽","活躍","話癆","傳說","表情包","搜索表情包"]),y=v(["Apelido","Apelido não pode ser menor que 3 bytes.","E-Mail","Por favor, confirme seu endereço de e-mail.","Website","Opcional","Comente aqui...","Nenhum comentário, ainda.","Enviar","Like","Cancel like","Responder","Cancelar resposta","Comentários","Refrescar","Carregar Mais...","Visualizar","Emoji","Enviar Imagem","segundos atrás","minutos atrás","horas atrás","dias atrás","agora mesmo","Enviando","Entrar","Sair","Admin","Sticky","Palavras","Favor enviar comentário com $0 a $1 palavras!\n Número de palavras atuais: $2","Anônimo","Dwarves","Hobbits","Ents","Wizards","Elves","Maiar","GIF","Pesquisar GIF"]),k=v(["Псевдоним","Никнейм не может быть меньше 3 байт.","Эл. адрес","Пожалуйста, подтвердите адрес вашей электронной почты.","Веб-сайт","Необязательный","Комментарий здесь...","Пока нет комментариев.","Отправить","Like","Cancel like","Отвечать","Отменить ответ","Комментарии","Обновить","Загрузи больше...","Превью","эмодзи","Загрузить изображение","секунд назад","несколько минут назад","несколько часов назад","дней назад","прямо сейчас","Загрузка","Авторизоваться","Выход из системы","Админ","Липкий","Слова","Пожалуйста, введите комментарии от $0 до $1 слов!\nНомер текущего слова: $2","Анонимный","Dwarves","Hobbits","Ents","Wizards","Elves","Maiar","GIF","Поиск GIF"]);const b={zh:h,"zh-cn":h,"zh-CN":h,"zh-tw":w,"zh-TW":w,en:g,"en-US":g,"en-us":g,jp:f,"jp-jp":f,"jp-JP":f,"pt-br":y,"pt-BR":y,ru:k,"ru-ru":k,"ru-RU":k};function C(t){return!!e.getCurrentScope()&&(e.onScopeDispose(t),!0)}const E="undefined"!=typeof window,B=()=>{};const $=e=>e();var S=Object.getOwnPropertySymbols,N=Object.prototype.hasOwnProperty,V=Object.prototype.propertyIsEnumerable;function x(t,n,o={}){const l=o,{eventFilter:r=$}=l,a=((e,t)=>{var n={};for(var o in e)N.call(e,o)&&t.indexOf(o)<0&&(n[o]=e[o]);if(null!=e&&S)for(var o of S(e))t.indexOf(o)<0&&V.call(e,o)&&(n[o]=e[o]);return n})(l,["eventFilter"]);return e.watch(t,(i=r,c=n,function(...e){i((()=>c.apply(this,e)),{fn:c,thisArg:this,args:e})}),a);var i,c}var L=Object.defineProperty,I=Object.defineProperties,j=Object.getOwnPropertyDescriptors,R=Object.getOwnPropertySymbols,z=Object.prototype.hasOwnProperty,A=Object.prototype.propertyIsEnumerable,U=(e,t,n)=>t in e?L(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;function M(t,n,o={}){const l=o,{eventFilter:r}=l,a=((e,t)=>{var n={};for(var o in e)z.call(e,o)&&t.indexOf(o)<0&&(n[o]=e[o]);if(null!=e&&R)for(var o of R(e))t.indexOf(o)<0&&A.call(e,o)&&(n[o]=e[o]);return n})(l,["eventFilter"]),{eventFilter:i,pause:c,resume:s,isActive:m}=function(t=$){const n=e.ref(!0);return{isActive:n,pause:function(){n.value=!1},resume:function(){n.value=!0},eventFilter:(...e)=>{n.value&&t(...e)}}}(r),u=x(t,n,(d=((e,t)=>{for(var n in t||(t={}))z.call(t,n)&&U(e,n,t[n]);if(R)for(var n of R(t))A.call(t,n)&&U(e,n,t[n]);return e})({},a),I(d,j({eventFilter:i}))));var d;return{stop:u,pause:c,resume:s,isActive:m}}const D=E?window:void 0,O=E?window.document:void 0;function T(...t){let n,o,l,r;if("string"==typeof t[0]?([o,l,r]=t,n=D):[n,o,l,r]=t,!n)return B;let a=B;const i=e.watch((()=>function(t){var n;const o=e.unref(t);return null!=(n=null==o?void 0:o.$el)?n:o}(n)),(e=>{a(),e&&(e.addEventListener(o,l,r),a=()=>{e.removeEventListener(o,l,r),a=B})}),{immediate:!0,flush:"post"}),c=()=>{i(),a()};return C(c),c}E&&window.navigator,E&&window.location;const P="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},F="__vueuse_ssr_handlers__";P[F]=P[F]||{};const H=P[F];const _={boolean:{read:e=>"true"===e,write:e=>String(e)},object:{read:e=>JSON.parse(e),write:e=>JSON.stringify(e)},number:{read:e=>Number.parseFloat(e),write:e=>String(e)},any:{read:e=>e,write:e=>String(e)},string:{read:e=>e,write:e=>String(e)},map:{read:e=>new Map(JSON.parse(e)),write:e=>JSON.stringify(Array.from(e.entries()))},set:{read:e=>new Set(JSON.parse(e)),write:e=>JSON.stringify(Array.from(e))},date:{read:e=>new Date(e),write:e=>e.toISOString()}};function W(t,n,o,l={}){var r;const{flush:a="pre",deep:i=!0,listenToStorageChanges:c=!0,writeDefaults:s=!0,shallow:m,window:u=D,eventFilter:d,onError:p=(e=>{console.error(e)})}=l,v=(m?e.shallowRef:e.ref)(n);if(!o)try{o=function(e,t){return H[e]||t}("getDefaultStorage",(()=>{var e;return null==(e=D)?void 0:e.localStorage}))()}catch(e){p(e)}if(!o)return v;const g=e.unref(n),f=function(e){return null==e?"any":e instanceof Set?"set":e instanceof Map?"map":e instanceof Date?"date":"boolean"==typeof e?"boolean":"string"==typeof e?"string":"object"==typeof e||Array.isArray(e)?"object":Number.isNaN(e)?"any":"number"}(g),h=null!=(r=l.serializer)?r:_[f],{pause:w,resume:y}=M(v,(()=>function(e){try{null==e?o.removeItem(t):o.setItem(t,h.write(e))}catch(e){p(e)}}(v.value)),{flush:a,deep:i,eventFilter:d});return u&&c&&T(u,"storage",k),k(),v;function k(e){e&&e.key!==t||(v.value=function(e){if(!e||e.key===t){w();try{const n=e?e.newValue:o.getItem(t);return null==n?(s&&null!==g&&o.setItem(t,h.write(g)),g):"string"!=typeof n?n:h.read(n)}catch(e){p(e)}finally{y()}}}(e))}}var q,G,J=Object.defineProperty,K=Object.getOwnPropertySymbols,Y=Object.prototype.hasOwnProperty,Z=Object.prototype.propertyIsEnumerable,X=(e,t,n)=>t in e?J(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;function Q(t={}){const{controls:n=!1,interval:o="requestAnimationFrame"}=t,l=e.ref(new Date),r=()=>l.value=new Date,a="requestAnimationFrame"===o?function(t,n={}){const{immediate:o=!0,window:l=D}=n,r=e.ref(!1);let a=null;function i(){r.value&&l&&(t(),a=l.requestAnimationFrame(i))}function c(){!r.value&&l&&(r.value=!0,i())}function s(){r.value=!1,null!=a&&l&&(l.cancelAnimationFrame(a),a=null)}return o&&c(),C(s),{isActive:r,pause:s,resume:c}}(r,{immediate:!0}):function(t,n=1e3,o={}){const{immediate:l=!0,immediateCallback:r=!1}=o;let a=null;const i=e.ref(!1);function c(){a&&(clearInterval(a),a=null)}function s(){i.value=!1,c()}function m(){n<=0||(i.value=!0,r&&t(),c(),a=setInterval(t,e.unref(n)))}l&&E&&m(),e.isRef(n)&&C(e.watch(n,(()=>{l&&E&&m()})));return C(s),{isActive:i,pause:s,resume:m}}(r,o,{immediate:!0});return n?((e,t)=>{for(var n in t||(t={}))Y.call(t,n)&&X(e,n,t[n]);if(K)for(var n of K(t))Z.call(t,n)&&X(e,n,t[n]);return e})({now:l},a):l}E&&(null==window?void 0:window.navigator)&&(null==(q=null==window?void 0:window.navigator)?void 0:q.platform)&&/iP(ad|hone|od)/.test(null==(G=null==window?void 0:window.navigator)?void 0:G.platform);let ee=0;const te=e=>{try{e=decodeURI(e)}catch(e){}return e},ne=(e="")=>e.replace(/\/$/u,""),oe=e=>/^(https?:)?\/\//.test(e),le=e=>{const t=ne(e);return oe(t)?t:`https://${t}`},re=e=>Array.isArray(e)?e:!!e&&[0,e],ae=(e,t)=>"function"==typeof e?e:!1!==e&&t,ie="{--waline-white:#000;--waline-light-grey:#666;--waline-dark-grey:#999;--waline-color:#888;--waline-bgcolor:#1e1e1e;--waline-bgcolor-light:#272727;--waline-bgcolor-hover: #444;--waline-border-color:#333;--waline-disable-bgcolor:#444;--waline-disable-color:#272727;--waline-bq-color:#272727;--waline-info-bgcolor:#272727;--waline-info-color:#666}",ce=(e,t)=>{let n=e.toString();for(;n.length<t;)n="0"+n;return n},se=(e,t,n)=>{if(!e)return"";const o="string"==typeof e?new Date(-1!==e.indexOf(" ")?e.replace(/-/g,"/"):e):e,l=t.getTime()-o.getTime(),r=Math.floor(l/864e5);if(0===r){const e=l%864e5,t=Math.floor(e/36e5);if(0===t){const t=e%36e5,o=Math.floor(t/6e4);if(0===o){const e=t%6e4;return`${Math.round(e/1e3)} ${n.seconds}`}return`${o} ${n.minutes}`}return`${t} ${n.hours}`}return r<0?n.now:r<8?`${r} ${n.days}`:(e=>{const t=ce(e.getDate(),2),n=ce(e.getMonth()+1,2);return`${ce(e.getFullYear(),2)}-${n}-${t}`})(o)},me=e=>{const t=W("WALINE_EMOJI",{}),n=Boolean(/@[0-9]+\.[0-9]+\.[0-9]+/.test(e));if(n){const n=t.value[e];if(n)return Promise.resolve(n)}return fetch(`${e}/info.json`).then((e=>e.json())).then((o=>{const l={folder:e,...o};return n&&(t.value[e]=l),l}))},ue=(e,t="",n="",o="")=>`${t?`${t}/`:""}${n}${e}${o?`.${o}`:""}`,de=e=>{"AbortError"!==e.name&&console.error(e.message)},pe={"Content-Type":"application/json"},ve=(e,t="")=>{if("object"==typeof e&&e.errno)throw new TypeError(`Fetch ${t} failed with ${e.errno}: ${e.errmsg}`);return e},ge=({serverURL:e,lang:t,token:n,objectId:o,...l})=>fetch(`${e}/comment/${o}?lang=${t}`,{method:"PUT",headers:{"Content-Type":"application/json",Authorization:`Bearer ${n}`},body:JSON.stringify(l)}).then((e=>e.json())),fe=({serverURL:e,lang:t,paths:n,signal:o})=>fetch(`${e}/article?path=${encodeURIComponent(n.join(","))}&lang=${t}`,{signal:o}).then((e=>e.json())).then((e=>ve(e,"visit count"))).then((e=>Array.isArray(e)?e:[e])),he=({serverURL:e,lang:t,path:n})=>fetch(`${e}/article?lang=${t}`,{method:"POST",headers:pe,body:JSON.stringify({path:n})}).then((e=>e.json())).then((e=>ve(e,"visit count"))),we=e=>e instanceof HTMLElement?e:"string"==typeof e?document.querySelector(e):null,ye=e=>e.type.includes("image"),ke=e=>{const t=Array.from(e).find(ye);return t?t.getAsFile():null},be=/\$.*?\$/,Ce=/^\$(.*?)\$/,Ee=/^(?:\s{0,3})\$\$((?:[^\n]|\n[^\n])+?)\n{0,1}\$\$/,Be=(e="",t={})=>e.replace(/:(.+?):/g,((e,n)=>t[n]?`<img class="wl-emoji" src="${t[n]}" alt="${n}">`:e)),$e=(e,{emojiMap:t,highlighter:o,texRenderer:l})=>{if(n.marked.setOptions({highlight:o||void 0,breaks:!0,smartLists:!0,smartypants:!0}),l){const e=(e=>[{name:"blockMath",level:"block",tokenizer(t){const n=Ee.exec(t);if(null!==n)return{type:"html",raw:n[0],text:e(!0,n[1])}}},{name:"inlineMath",level:"inline",start(e){const t=e.search(be);return-1!==t?t:e.length},tokenizer(t){const n=Ce.exec(t);if(null!==n)return{type:"html",raw:n[0],text:e(!1,n[1])}}}])(l);n.marked.use({extensions:e})}return n.marked.parse(Be(e,t))},Se=e=>e.dataset.path||e.getAttribute("id"),Ne=({key:e,keyword:t,pos:n,limit:o})=>{const l=new URLSearchParams("media_filter=minimal");return l.set("key",e||"PAY5JLFIH6V6"),l.set("limit",(o||20).toString()),l.set("pos",n||""),l.set("q",t),fetch(`https://g.tenor.com/v1/search?${l.toString()}`,{headers:{"Content-Type":"application/json"}}).then((e=>e.json()))};let Ve=null;const xe=()=>Ve||(Ve=W("USER_KEY",{}));let Le=null;const Ie=()=>Le||(Le=W("WALIKE_LIKE",[])),je=({serverURL:e,path:t=window.location.pathname,selector:n=".waline-comment-count",lang:o="zh-CN"})=>{const l=new AbortController,r=document.querySelectorAll(n),a=xe();return r.length&&(({serverURL:e,lang:t,paths:n,signal:o,token:l})=>{const r={};return l&&(r.Authorization=`Bearer ${l}`),fetch(`${e}/comment?type=count&url=${encodeURIComponent(n.join(","))}&lang=${t}`,{signal:o,headers:r}).then((e=>e.json())).then((e=>ve(e,"comment count"))).then((e=>Array.isArray(e)?e:[e]))})({serverURL:e,paths:Array.from(r).map((e=>te(e.dataset.path||e.getAttribute("id")||t))),lang:o,signal:l.signal,token:a.value?.token}).then((e=>{r.forEach(((t,n)=>{t.innerText=e[n].toString()}))})).catch(de),l.abort.bind(l)},Re=["data-index"],ze=e.defineComponent({props:{columnWidth:{default:400},items:null,gap:{default:0},rtl:{type:Boolean,default:!1},ssrColumns:{default:0}},emits:["redraw","redraw-skip"],setup(t,{emit:n}){const o=t,{columnWidth:l,items:r,gap:a,rtl:i,ssrColumns:c}=e.toRefs(o),s=e.ref([]),m=e.ref();function u(){const e=Math.floor((m.value.getBoundingClientRect().width+a.value)/(l.value+a.value));return e>0?e:1}function d(e){return[...new Array(e)].map((()=>[]))}if(c.value>0){const e=d(c.value);r.value.forEach(((t,n)=>e[n%c.value].push(n))),s.value=e}async function p(t){if(t>=r.value.length)return;await e.nextTick();const n=[...m.value.children];i.value&&n.reverse();const o=n.reduce(((e,t)=>t.getBoundingClientRect().height<e.getBoundingClientRect().height?t:e));s.value[+o.dataset.index].push(t),await p(t+1)}async function v(e=!1){if(s.value.length===u()&&!e)return void n("redraw-skip");s.value=d(u());const t=window.scrollY;await p(0),window.scrollTo({top:t}),n("redraw")}const g=new ResizeObserver((()=>v()));return e.onMounted((()=>{v(),g.observe(m.value)})),e.onBeforeUnmount((()=>g.unobserve(m.value))),e.watch([r,i],(()=>v(!0))),e.watch([l,a],(()=>v())),(t,n)=>(e.openBlock(),e.createElementBlock("div",{ref_key:"wall",ref:m,class:"masonry-wall",style:e.normalizeStyle({display:"flex",gap:`${e.unref(a)}px`})},[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(s.value,((n,o)=>(e.openBlock(),e.createElementBlock("div",{key:o,class:"masonry-column","data-index":o,style:e.normalizeStyle({display:"flex","flex-basis":0,"flex-direction":"column","flex-grow":1,height:["-webkit-max-content","-moz-max-content","max-content"],gap:`${e.unref(a)}px`})},[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(n,(n=>(e.openBlock(),e.createElementBlock("div",{key:n,class:"masonry-item"},[e.renderSlot(t.$slots,"default",{item:e.unref(r)[n],index:n},(()=>[e.createTextVNode(e.toDisplayString(e.unref(r)[n]),1)]))])))),128))],12,Re)))),128))],4))}}),Ae=(()=>{const e=ze;return e.install=t=>{t.component("MasonryWall",e)},e})(),Ue=({size:t})=>e.h("svg",{width:t,height:t,viewBox:"0 0 100 100",preserveAspectRatio:"xMidYMid"},e.h("circle",{cx:50,cy:50,fill:"none",stroke:"currentColor",strokeWidth:"4",r:"40","stroke-dasharray":"85 30"},e.h("animateTransform",{attributeName:"transform",type:"rotate",repeatCount:"indefinite",dur:"1s",values:"0 50 50;360 50 50",keyTimes:"0;1"})));var Me=(e,t)=>{const n=e.__vccOpts||e;for(const[e,o]of t)n[e]=o;return n};const De=e.defineComponent({name:"CommentBox",components:{CloseIcon:({size:t})=>e.h("svg",{class:"wl-close-icon",viewBox:"0 0 1024 1024",width:t,height:t},[e.h("path",{d:"M697.173 85.333h-369.92c-144.64 0-241.92 101.547-241.92 252.587v348.587c0 150.613 97.28 252.16 241.92 252.16h369.92c144.64 0 241.494-101.547 241.494-252.16V337.92c0-151.04-96.854-252.587-241.494-252.587z",fill:"currentColor"}),e.h("path",{d:"m640.683 587.52-75.947-75.861 75.904-75.862a37.29 37.29 0 0 0 0-52.778 37.205 37.205 0 0 0-52.779 0l-75.946 75.818-75.862-75.946a37.419 37.419 0 0 0-52.821 0 37.419 37.419 0 0 0 0 52.821l75.947 75.947-75.776 75.733a37.29 37.29 0 1 0 52.778 52.821l75.776-75.776 75.947 75.947a37.376 37.376 0 0 0 52.779-52.821z",fill:"#888"})]),EmojiIcon:()=>e.h("svg",{viewBox:"0 0 1024 1024",width:"24",height:"24"},e.h("path",{d:"M563.2 463.3 677 540c1.7 1.2 3.7 1.8 5.8 1.8.7 0 1.4-.1 2-.2 2.7-.5 5.1-2.1 6.6-4.4l25.3-37.8c1.5-2.3 2.1-5.1 1.6-7.8s-2.1-5.1-4.4-6.6l-73.6-49.1 73.6-49.1c2.3-1.5 3.9-3.9 4.4-6.6.5-2.7 0-5.5-1.6-7.8l-25.3-37.8a10.1 10.1 0 0 0-6.6-4.4c-.7-.1-1.3-.2-2-.2-2.1 0-4.1.6-5.8 1.8l-113.8 76.6c-9.2 6.2-14.7 16.4-14.7 27.5.1 11 5.5 21.3 14.7 27.4zM387 348.8h-45.5c-5.7 0-10.4 4.7-10.4 10.4v153.3c0 5.7 4.7 10.4 10.4 10.4H387c5.7 0 10.4-4.7 10.4-10.4V359.2c0-5.7-4.7-10.4-10.4-10.4zm333.8 241.3-41-20a10.3 10.3 0 0 0-8.1-.5c-2.6.9-4.8 2.9-5.9 5.4-30.1 64.9-93.1 109.1-164.4 115.2-5.7.5-9.9 5.5-9.5 11.2l3.9 45.5c.5 5.3 5 9.5 10.3 9.5h.9c94.8-8 178.5-66.5 218.6-152.7 2.4-5 .3-11.2-4.8-13.6zm186-186.1c-11.9-42-30.5-81.4-55.2-117.1-24.1-34.9-53.5-65.6-87.5-91.2-33.9-25.6-71.5-45.5-111.6-59.2-41.2-14-84.1-21.1-127.8-21.1h-1.2c-75.4 0-148.8 21.4-212.5 61.7-63.7 40.3-114.3 97.6-146.5 165.8-32.2 68.1-44.3 143.6-35.1 218.4 9.3 74.8 39.4 145 87.3 203.3.1.2.3.3.4.5l36.2 38.4c1.1 1.2 2.5 2.1 3.9 2.6 73.3 66.7 168.2 103.5 267.5 103.5 73.3 0 145.2-20.3 207.7-58.7 37.3-22.9 70.3-51.5 98.1-85 27.1-32.7 48.7-69.5 64.2-109.1 15.5-39.7 24.4-81.3 26.6-123.8 2.4-43.6-2.5-87-14.5-129zm-60.5 181.1c-8.3 37-22.8 72-43 104-19.7 31.1-44.3 58.6-73.1 81.7-28.8 23.1-61 41-95.7 53.4-35.6 12.7-72.9 19.1-110.9 19.1-82.6 0-161.7-30.6-222.8-86.2l-34.1-35.8c-23.9-29.3-42.4-62.2-55.1-97.7-12.4-34.7-18.8-71-19.2-107.9-.4-36.9 5.4-73.3 17.1-108.2 12-35.8 30-69.2 53.4-99.1 31.7-40.4 71.1-72 117.2-94.1 44.5-21.3 94-32.6 143.4-32.6 49.3 0 97 10.8 141.8 32 34.3 16.3 65.3 38.1 92 64.8 26.1 26 47.5 56 63.6 89.2 16.2 33.2 26.6 68.5 31 105.1 4.6 37.5 2.7 75.3-5.6 112.3z",fill:"currentColor"})),ImageIcon:()=>e.h("svg",{viewBox:"0 0 1024 1024",width:"24",height:"24"},[e.h("path",{d:"M784 112H240c-88 0-160 72-160 160v480c0 88 72 160 160 160h544c88 0 160-72 160-160V272c0-88-72-160-160-160zm96 640c0 52.8-43.2 96-96 96H240c-52.8 0-96-43.2-96-96V272c0-52.8 43.2-96 96-96h544c52.8 0 96 43.2 96 96v480z",fill:"currentColor"}),e.h("path",{d:"M352 480c52.8 0 96-43.2 96-96s-43.2-96-96-96-96 43.2-96 96 43.2 96 96 96zm0-128c17.6 0 32 14.4 32 32s-14.4 32-32 32-32-14.4-32-32 14.4-32 32-32zm462.4 379.2-3.2-3.2-177.6-177.6c-25.6-25.6-65.6-25.6-91.2 0l-80 80-36.8-36.8c-25.6-25.6-65.6-25.6-91.2 0L200 728c-4.8 6.4-8 14.4-8 24 0 17.6 14.4 32 32 32 9.6 0 16-3.2 22.4-9.6L380.8 640l134.4 134.4c6.4 6.4 14.4 9.6 24 9.6 17.6 0 32-14.4 32-32 0-9.6-4.8-17.6-9.6-24l-52.8-52.8 80-80L769.6 776c6.4 4.8 12.8 8 20.8 8 17.6 0 32-14.4 32-32 0-8-3.2-16-8-20.8z",fill:"currentColor"})]),MarkdownIcon:()=>e.h("svg",{width:"16",height:"16",ariaHidden:"true"},e.h("path",{d:"M14.85 3H1.15C.52 3 0 3.52 0 4.15v7.69C0 12.48.52 13 1.15 13h13.69c.64 0 1.15-.52 1.15-1.15v-7.7C16 3.52 15.48 3 14.85 3zM9 11H7V8L5.5 9.92 4 8v3H2V5h2l1.5 2L7 5h2v6zm2.99.5L9.5 8H11V5h2v3h1.5l-2.51 3.5z",fill:"currentColor"})),PreviewIcon:()=>e.h("svg",{viewBox:"0 0 1024 1024",width:"24",height:"24"},[e.h("path",{d:"M710.816 654.301c70.323-96.639 61.084-230.578-23.705-314.843-46.098-46.098-107.183-71.109-172.28-71.109-65.008 0-126.092 25.444-172.28 71.109-45.227 46.098-70.756 107.183-70.756 172.106 0 64.923 25.444 126.007 71.194 172.106 46.099 46.098 107.184 71.109 172.28 71.109 51.414 0 100.648-16.212 142.824-47.404l126.53 126.006c7.058 7.06 16.297 10.979 26.406 10.979 10.105 0 19.343-3.919 26.402-10.979 14.467-14.467 14.467-38.172 0-52.723L710.816 654.301zm-315.107-23.265c-65.88-65.88-65.88-172.54 0-238.42 32.069-32.07 74.245-49.149 119.471-49.149 45.227 0 87.407 17.603 119.472 49.149 65.88 65.879 65.88 172.539 0 238.42-63.612 63.178-175.242 63.178-238.943 0zm0 0",fill:"currentColor"}),e.h("path",{d:"M703.319 121.603H321.03c-109.8 0-199.469 89.146-199.469 199.38v382.034c0 109.796 89.236 199.38 199.469 199.38h207.397c20.653 0 37.384-16.645 37.384-37.299 0-20.649-16.731-37.296-37.384-37.296H321.03c-68.582 0-124.352-55.77-124.352-124.267V321.421c0-68.496 55.77-124.267 124.352-124.267h382.289c68.582 0 124.352 55.771 124.352 124.267V524.72c0 20.654 16.736 37.299 37.385 37.299 20.654 0 37.384-16.645 37.384-37.299V320.549c-.085-109.8-89.321-198.946-199.121-198.946zm0 0",fill:"currentColor"})]),LoadingIcon:Ue,GifIcon:()=>e.h("svg",{width:24,height:24,fill:"currentcolor",viewBox:"0 0 24 24"},[e.h("path",{style:"transform: translateY(0.5px)",d:"M18.968 10.5H15.968V11.484H17.984V12.984H15.968V15H14.468V9H18.968V10.5V10.5ZM8.984 9C9.26533 9 9.49967 9.09367 9.687 9.281C9.87433 9.46833 9.968 9.70267 9.968 9.984V10.5H6.499V13.5H8.468V12H9.968V14.016C9.968 14.2973 9.87433 14.5317 9.687 14.719C9.49967 14.9063 9.26533 15 8.984 15H5.984C5.70267 15 5.46833 14.9063 5.281 14.719C5.09367 14.5317 5 14.2973 5 14.016V9.985C5 9.70367 5.09367 9.46933 5.281 9.282C5.46833 9.09467 5.70267 9.001 5.984 9.001H8.984V9ZM11.468 9H12.968V15H11.468V9V9Z"}),e.h("path",{d:"M18.5 3H5.75C3.6875 3 2 4.6875 2 6.75V18C2 20.0625 3.6875 21.75 5.75 21.75H18.5C20.5625 21.75 22.25 20.0625 22.25 18V6.75C22.25 4.6875 20.5625 3 18.5 3ZM20.75 18C20.75 19.2375 19.7375 20.25 18.5 20.25H5.75C4.5125 20.25 3.5 19.2375 3.5 18V6.75C3.5 5.5125 4.5125 4.5 5.75 4.5H18.5C19.7375 4.5 20.75 5.5125 20.75 6.75V18Z"})])},props:{rootId:{type:String,default:""},replyId:{type:String,default:""},replyUser:{type:String,default:""}},emits:["submit","cancel-reply"],setup(t,{emit:n}){const o=e.inject("config"),r=W("WALINE_COMMENT_BOX_EDITOR",""),a=W("WALINE_USER_META",{nick:"",mail:"",link:""}),i=xe(),c=e.ref({}),s=e.ref(null),m=e.ref(null),u=e.ref(null),d=e.ref(null),p=e.ref(null),v=e.ref(null),g=e.ref(null),f=e.ref({tabs:[],map:{}}),h=e.ref(0),w=e.ref(!1),y=e.ref(!1),k=e.ref(!1),b=e.ref(""),C=e.ref(0),E=e.ref({cursor:"",loading:!0,list:[]}),B=e.ref(0),$=e.ref(!1),S=e.ref(""),N=e.ref(!1),V=e.computed((()=>o.value.locale)),x=e.computed((()=>Boolean(i.value?.token))),L=e.computed((()=>!1!==o.value.imageUploader)),I=e=>{const t=s.value,n=t.selectionStart,o=t.selectionEnd||0,l=t.scrollTop;r.value=t.value.substring(0,n)+e+t.value.substring(o,t.value.length),t.focus(),t.selectionStart=n+e.length,t.selectionEnd=n+e.length,t.scrollTop=l},j=e=>{const t=`![${o.value.locale.uploading} ${e.name}]()`;return I(t),Promise.resolve().then((()=>o.value.imageUploader(e))).then((n=>{r.value=r.value.replace(t,`\r\n![${e.name}](${n})`)}))},R=()=>{const{serverURL:e,lang:l,login:m,wordLimit:u,requiredMeta:d}=o.value,p={comment:S.value,nick:a.value.nick,mail:a.value.mail,link:a.value.link,ua:navigator.userAgent,url:o.value.path};if(i.value?.token)p.nick=i.value.display_name,p.mail=i.value.email,p.link=i.value.url;else{if("force"===m)return;if(d.indexOf("nick")>-1&&!p.nick)return c.value.nick?.focus(),alert(V.value.nickError);if(d.indexOf("mail")>-1&&!p.mail||p.mail&&!/^\w(?:[\w._-]*\w)?@(?:\w(?:[\w-]*\w)?\.)*\w+$/.exec(p.mail))return c.value.mail?.focus(),alert(V.value.mailError);if(!p.comment)return void s.value?.focus();p.nick||(p.nick=V.value.anonymous)}if(!$.value)return alert(V.value.wordHint.replace("$0",u[0].toString()).replace("$1",u[1].toString()).replace("$2",C.value.toString()));p.comment=Be(p.comment,f.value.map),t.replyId&&t.rootId&&(p.pid=t.replyId,p.rid=t.rootId,p.at=t.replyUser),N.value=!0,(({serverURL:e,lang:t,token:n,comment:o})=>{const l={"Content-Type":"application/json"};return n&&(l.Authorization=`Bearer ${n}`),fetch(`${e}/comment?lang=${t}`,{method:"POST",headers:l,body:JSON.stringify(o)}).then((e=>e.json()))})({serverURL:e,lang:l,token:i.value?.token,comment:p}).then((e=>{if(N.value=!1,e.errmsg)return alert(e.errmsg);n("submit",e.data),r.value="",b.value="",t.replyId&&n("cancel-reply")})).catch((e=>{N.value=!1,alert(e.message)}))},z=e=>{u.value.contains(e.target)||d.value.contains(e.target)||(w.value=!1),p.value.contains(e.target)||v.value.contains(e.target)||(y.value=!1)},A=function(e,t=300){let n;return(...o)=>{n&&clearTimeout(n),n=window.setTimeout((()=>{e(...o),n=null}),t)}}((async e=>{E.value.cursor="",E.value.list=[],U(e)})),U=async e=>{const{scrollTop:t,clientHeight:n,scrollHeight:o}=e.target;if((n+t)/o<.9||E.value.loading)return;E.value.loading=!0;const l=await Ne({keyword:g.value?.value||"",pos:E.value.cursor}).finally((()=>{E.value.loading=!1}));E.value.cursor=l.next,E.value.list=E.value.list.concat(l.results),setTimeout((()=>{e.target.scrollTop=t}),50)};return e.watch([o,C],(([e,t])=>{const{wordLimit:n}=e;n?t<n[0]&&0!==n[0]?(B.value=n[0],$.value=!1):t>n[1]?(B.value=n[1],$.value=!1):(B.value=n[1],$.value=!0):(B.value=0,$.value=!0)}),{immediate:!0}),e.watch([y],(async([e])=>{if(!e)return;E.value.loading=!0;const t=await Ne({keyword:""}).finally((()=>{E.value.loading=!1}));E.value.cursor=t.next,E.value.list=E.value.list.concat(t.results)})),e.onMounted((()=>{document.body.addEventListener("click",z),e.watch((()=>r.value),(e=>{const{highlighter:t,texRenderer:n}=o.value;S.value=e,b.value=$e(e,{emojiMap:f.value.map,highlighter:t,texRenderer:n}),C.value=(e=>(e=>e.match(/[\w\d\s\u00C0-\u024F]+/giu)||[])(e).reduce(((e,t)=>e+(""===t.trim()?0:t.trim().split(/\s+/u).length)),0)+(e=>e.match(/[\u4E00-\u9FA5]/gu)||[])(e).length)(e),e?l.default(s.value):l.default.destroy(s.value)}),{immediate:!0}),e.watch((()=>o.value.emoji),(e=>{return(t=Array.isArray(e)?e:[],Promise.all(t.map((e=>"string"==typeof e?me(ne(e)):Promise.resolve(e)))).then((e=>{const t={tabs:[],map:{}};return e.forEach((e=>{const{name:n,folder:o,icon:l,prefix:r,type:a,items:i}=e;t.tabs.push({name:n,icon:ue(l,o,r,a),items:i.map((e=>{const n=`${r||""}${e}`;return t.map[n]=ue(e,o,r,a),n}))})})),t}))).then((e=>{f.value=e}));var t}),{immediate:!0})})),e.onUnmounted((()=>{document.body.removeEventListener("click",z)})),{config:o,locale:V,insert:I,onChange:()=>{const e=m.value;e.files&&L.value&&j(e.files[0]).then((()=>{e.value=""}))},onDrop:e=>{if(e.dataTransfer?.items){const t=ke(e.dataTransfer.items);t&&L.value&&(j(t),e.preventDefault())}},onKeyDown:e=>{const t=e.key;(e.ctrlKey||e.metaKey)&&"Enter"===t&&R()},onPaste:e=>{if(e.clipboardData){const t=ke(e.clipboardData.items);t&&L.value&&j(t)}},onLogin:e=>{e.preventDefault();const{lang:t,serverURL:n}=o.value,l=(window.innerWidth-450)/2,r=(window.innerHeight-450)/2,a=window.open(`${n}/ui/login?lng=${encodeURIComponent(t)}`,"_blank",`width=450,height=450,left=${l},top=${r},scrollbars=no,resizable=no,status=no,location=no,toolbar=no,menubar=no`);a?.postMessage({type:"TOKEN",data:null},"*");const c=({data:e})=>{e&&"userInfo"===e.type&&e.data.token&&(a?.close(),i.value=e.data,(e.data.remember?localStorage:sessionStorage).setItem("WALINE_USER",JSON.stringify(e.data)),window.removeEventListener("message",c))};window.addEventListener("message",c)},onLogout:()=>{i.value={},localStorage.setItem("WALINE_USER","null"),sessionStorage.setItem("WALINE_USER","null")},onProfile:e=>{e.preventDefault();const{lang:t,serverURL:n}=o.value,l=(window.innerWidth-800)/2,r=(window.innerHeight-800)/2;window.open(`${n}/ui/profile?lng=${encodeURIComponent(t)}`,"_blank",`width=800,height=800,left=${l},top=${r},scrollbars=no,resizable=no,status=no,location=no,toolbar=no,menubar=no`)?.postMessage({type:"TOKEN",data:i.value.token},"*");const a=({data:e})=>{e&&"profile"===e.type&&(i.value={...i.value,...e},[localStorage,sessionStorage].filter((e=>e.getItem("WALINE_USER"))).forEach((e=>e.setItem("WALINE_USER",JSON.stringify(i)))),window.removeEventListener("message",a))};window.addEventListener("message",a)},submitComment:R,onGifMasonryScroll:U,onGifSearch:A,isLogin:x,userInfo:i,isSubmitting:N,wordNumber:C,wordLimit:B,isWordNumberLegal:$,editor:r,userMeta:a,emoji:f,emojiTabIndex:h,showEmoji:w,showGif:y,canUploadImage:L,previewText:b,showPreview:k,inputRefs:c,editorRef:s,emojiButtonRef:u,emojiPopupRef:d,gifButtonRef:p,gifPopupRef:v,imageUploadRef:m,gifSearchInputRef:g,gifData:E}}}),Oe={class:"wl-comment"},Te={key:0,class:"wl-login-info"},Pe={class:"wl-avatar"},Fe=["title"],He=["src"],_e=["textContent"],We={class:"wl-panel"},qe=["for","textContent"],Ge=["id","name","type","onUpdate:modelValue"],Je=["placeholder"],Ke={class:"wl-preview"},Ye=e.createElementVNode("hr",null,null,-1),Ze=["innerHTML"],Xe={class:"wl-footer"},Qe={class:"wl-actions"},et={href:"https://guides.github.com/features/mastering-markdown/",title:"Markdown Guide","aria-label":"Markdown is supported",class:"wl-action",target:"_blank",rel:"noreferrer"},tt=["title"],nt=["title"],ot=["title"],lt=["title"],rt={class:"wl-info"},at={class:"wl-text-number"},it={key:0},ct=e.createTextVNode("  /  "),st=["textContent"],mt=["textContent"],ut=["disabled"],dt=["placeholder"],pt=["onClick","src","title"],vt={key:0,class:"wl-loading"},gt={key:0,class:"wl-tab-wrapper"},ft=["title","onClick"],ht=["src","alt"],wt={key:0,class:"wl-tabs"},yt=["onClick"],kt=["src","alt","title"],bt=["title"];var Ct=Me(De,[["render",function(t,n,o,l,r,a){const i=e.resolveComponent("CloseIcon"),c=e.resolveComponent("MarkdownIcon"),s=e.resolveComponent("EmojiIcon"),m=e.resolveComponent("GifIcon"),u=e.resolveComponent("ImageIcon"),d=e.resolveComponent("PreviewIcon"),p=e.resolveComponent("LoadingIcon"),v=e.resolveComponent("masonry-wall");return e.openBlock(),e.createElementBlock("div",Oe,["disable"!==t.config.login&&t.isLogin?(e.openBlock(),e.createElementBlock("div",Te,[e.createElementVNode("div",Pe,[e.createElementVNode("button",{class:"wl-logout-btn",title:t.locale.logout,onClick:n[0]||(n[0]=(...e)=>t.onLogout&&t.onLogout(...e))},[e.createVNode(i,{size:14})],8,Fe),e.createElementVNode("img",{src:t.userInfo.avatar,alt:"avatar"},null,8,He)]),e.createElementVNode("a",{href:"#",class:"wl-login-nick","aria-label":"Profile",onClick:n[1]||(n[1]=(...e)=>t.onProfile&&t.onProfile(...e)),textContent:e.toDisplayString(t.userInfo.display_name)},null,8,_e)])):e.createCommentVNode("v-if",!0),e.createElementVNode("div",We,["force"!==t.config.login&&t.config.meta.length&&!t.isLogin?(e.openBlock(),e.createElementBlock("div",{key:0,class:e.normalizeClass(["wl-header",`item${t.config.meta.length}`])},[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(t.config.meta,(n=>(e.openBlock(),e.createElementBlock("div",{class:"wl-header-item",key:n},[e.createElementVNode("label",{for:n,textContent:e.toDisplayString(t.locale[n]+(t.config.requiredMeta.includes(n)||!t.config.requiredMeta.length?"":`(${t.locale.optional})`))},null,8,qe),e.withDirectives(e.createElementVNode("input",{ref_for:!0,ref:e=>{e&&(t.inputRefs[n]=e)},id:`wl-${n}`,class:e.normalizeClass(["wl-input",`wl-${n}`]),name:n,type:"mail"===n?"email":"text","onUpdate:modelValue":e=>t.userMeta[n]=e},null,10,Ge),[[e.vModelDynamic,t.userMeta[n]]])])))),128))],2)):e.createCommentVNode("v-if",!0),e.withDirectives(e.createElementVNode("textarea",{class:"wl-editor",ref:"editorRef",id:"wl-edit",placeholder:t.replyUser?`@${t.replyUser}`:t.locale.placeholder,"onUpdate:modelValue":n[2]||(n[2]=e=>t.editor=e),onKeydown:n[3]||(n[3]=(...e)=>t.onKeyDown&&t.onKeyDown(...e)),onDrop:n[4]||(n[4]=(...e)=>t.onDrop&&t.onDrop(...e)),onPaste:n[5]||(n[5]=(...e)=>t.onPaste&&t.onPaste(...e))},null,40,Je),[[e.vModelText,t.editor]]),e.withDirectives(e.createElementVNode("div",Ke,[Ye,e.createElementVNode("h4",null,e.toDisplayString(t.locale.preview)+":",1),e.createElementVNode("div",{class:"wl-content",innerHTML:t.previewText},null,8,Ze)],512),[[e.vShow,t.showPreview]]),e.createElementVNode("div",Xe,[e.createElementVNode("div",Qe,[e.createElementVNode("a",et,[e.createVNode(c)]),e.withDirectives(e.createElementVNode("button",{ref:"emojiButtonRef",class:e.normalizeClass(["wl-action",{actived:t.showEmoji}]),title:t.locale.emoji,onClick:n[6]||(n[6]=e=>t.showEmoji=!t.showEmoji)},[e.createVNode(s)],10,tt),[[e.vShow,t.emoji.tabs.length]]),e.createElementVNode("button",{ref:"gifButtonRef",class:e.normalizeClass(["wl-action",{actived:t.showGif}]),title:t.locale.gif,onClick:n[7]||(n[7]=e=>t.showGif=!t.showGif)},[e.createVNode(m)],10,nt),e.createElementVNode("input",{ref:"imageUploadRef",class:"upload",id:"wl-image-upload",type:"file",accept:".png,.jpg,.jpeg,.webp,.bmp,.gif",onChange:n[8]||(n[8]=(...e)=>t.onChange&&t.onChange(...e))},null,544),t.canUploadImage?(e.openBlock(),e.createElementBlock("label",{key:0,for:"wl-image-upload",class:"wl-action",title:t.locale.uploadImage},[e.createVNode(u)],8,ot)):e.createCommentVNode("v-if",!0),e.createElementVNode("button",{class:e.normalizeClass(["wl-action",{actived:t.showPreview}]),title:t.locale.preview,onClick:n[9]||(n[9]=e=>t.showPreview=!t.showPreview)},[e.createVNode(d)],10,lt)]),e.createElementVNode("div",rt,[e.createElementVNode("div",at,[e.createTextVNode(e.toDisplayString(t.wordNumber)+" ",1),t.config.wordLimit?(e.openBlock(),e.createElementBlock("span",it,[ct,e.createElementVNode("span",{class:e.normalizeClass({illegal:!t.isWordNumberLegal}),textContent:e.toDisplayString(t.wordLimit)},null,10,st)])):e.createCommentVNode("v-if",!0),e.createTextVNode("  "+e.toDisplayString(t.locale.word),1)]),"disable"===t.config.login||t.isLogin?e.createCommentVNode("v-if",!0):(e.openBlock(),e.createElementBlock("button",{key:0,class:"wl-btn",onClick:n[10]||(n[10]=(...e)=>t.onLogin&&t.onLogin(...e)),textContent:e.toDisplayString(t.locale.login)},null,8,mt)),"force"!==t.config.login||t.isLogin?(e.openBlock(),e.createElementBlock("button",{key:1,class:"wl-btn primary",title:"Cmd|Ctrl + Enter",disabled:t.isSubmitting,onClick:n[11]||(n[11]=(...e)=>t.submitComment&&t.submitComment(...e))},[t.isSubmitting?(e.openBlock(),e.createBlock(p,{key:0,size:16})):(e.openBlock(),e.createElementBlock(e.Fragment,{key:1},[e.createTextVNode(e.toDisplayString(t.locale.submit),1)],2112))],8,ut)):e.createCommentVNode("v-if",!0)]),e.createElementVNode("div",{ref:"gifPopupRef",class:e.normalizeClass(["wl-gif-popup",{display:t.showGif}])},[e.createElementVNode("input",{type:"text",placeholder:t.locale.gifSearchPlaceholder,ref:"gifSearchInputRef",onInput:n[12]||(n[12]=(...e)=>t.onGifSearch&&t.onGifSearch(...e))},null,40,dt),e.createVNode(v,{class:"wl-gif-waterfall",items:t.gifData.list,"ssr-columns":2,"column-width":200,gap:6,onScroll:t.onGifMasonryScroll},{default:e.withCtx((({item:n})=>[e.createElementVNode("img",{onClick:e=>t.insert(`![](${n.media[0].tinygif.url})`),src:n.media[0].tinygif.url,title:n.title,loading:"lazy",style:e.normalizeStyle({width:"200px",height:200*n.media[0].tinygif.dims[1]/n.media[0].tinygif.dims[0]+"px"})},null,12,pt)])),_:1},8,["items","onScroll"]),t.gifData.loading?(e.openBlock(),e.createElementBlock("div",vt,[e.createVNode(p,{size:30})])):e.createCommentVNode("v-if",!0)],2),e.createElementVNode("div",{ref:"emojiPopupRef",class:e.normalizeClass(["wl-emoji-popup",{display:t.showEmoji}])},[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(t.emoji.tabs,((n,o)=>(e.openBlock(),e.createElementBlock(e.Fragment,{key:n.name},[o===t.emojiTabIndex?(e.openBlock(),e.createElementBlock("div",gt,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(n.items,(n=>(e.openBlock(),e.createElementBlock("button",{key:n,title:n,onClick:e=>t.insert(`:${n}:`)},[t.showEmoji?(e.openBlock(),e.createElementBlock("img",{key:0,class:"wl-emoji",src:t.emoji.map[n],alt:n,loading:"lazy",referrerPolicy:"no-referrer"},null,8,ht)):e.createCommentVNode("v-if",!0)],8,ft)))),128))])):e.createCommentVNode("v-if",!0)],64)))),128)),t.emoji.tabs.length>1?(e.openBlock(),e.createElementBlock("div",wt,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(t.emoji.tabs,((n,o)=>(e.openBlock(),e.createElementBlock("button",{key:n.name,class:e.normalizeClass(["wl-tab",{active:t.emojiTabIndex===o}]),onClick:e=>t.emojiTabIndex=o},[e.createElementVNode("img",{class:"wl-emoji",src:n.icon,alt:n.name,title:n.name,loading:"lazy",referrerPolicy:"no-referrer"},null,8,kt)],10,yt)))),128))])):e.createCommentVNode("v-if",!0)],2)])]),t.replyId?(e.openBlock(),e.createElementBlock("button",{key:1,class:"wl-close",title:t.locale.cancelReply,onClick:n[13]||(n[13]=e=>t.$emit("cancel-reply"))},[e.createVNode(i,{size:24})],8,bt)):e.createCommentVNode("v-if",!0)])}],["__file","CommentBox.vue"]]);const Et=["approved","waiting","spam"],Bt=e.defineComponent({props:{comment:{type:Object,required:!0},rootId:{type:String,required:!0},reply:{type:Object}},components:{CommentBox:Ct,DeleteIcon:()=>e.h("svg",{viewBox:"0 0 1024 1024",width:"24",height:"24"},e.h("path",{d:"m341.013 394.667 27.755 393.45h271.83l27.733-393.45h64.106l-28.01 397.952a64 64 0 0 1-63.83 59.498H368.768a64 64 0 0 1-63.83-59.52l-28.053-397.93h64.128zm139.307 19.818v298.667h-64V414.485h64zm117.013 0v298.667h-64V414.485h64zM181.333 288h640v64h-640v-64zm453.483-106.667v64h-256v-64h256z",fill:"red"})),LikeIcon:({active:t=!1})=>e.h("svg",{viewBox:"0 0 1024 1024",width:"24",height:"24"},[e.h("path",{d:"M850.654 323.804c-11.042-25.625-26.862-48.532-46.885-68.225-20.022-19.61-43.258-34.936-69.213-45.73-26.78-11.124-55.124-16.727-84.375-16.727-40.622 0-80.256 11.123-114.698 32.135A214.79 214.79 0 0 0 512 241.819a214.79 214.79 0 0 0-23.483-16.562c-34.442-21.012-74.076-32.135-114.698-32.135-29.25 0-57.595 5.603-84.375 16.727-25.872 10.711-49.19 26.12-69.213 45.73-20.105 19.693-35.843 42.6-46.885 68.225-11.453 26.615-17.303 54.877-17.303 83.963 0 27.439 5.603 56.03 16.727 85.117 9.31 24.307 22.659 49.52 39.715 74.981 27.027 40.293 64.188 82.316 110.33 124.915 76.465 70.615 152.189 119.394 155.402 121.371l19.528 12.525c8.652 5.52 19.776 5.52 28.427 0l19.529-12.525c3.213-2.06 78.854-50.756 155.401-121.371 46.143-42.6 83.304-84.622 110.33-124.915 17.057-25.46 30.487-50.674 39.716-74.981 11.124-29.087 16.727-57.678 16.727-85.117.082-29.086-5.768-57.348-17.221-83.963z"+(t?"":"M512 761.5S218.665 573.55 218.665 407.767c0-83.963 69.461-152.023 155.154-152.023 60.233 0 112.473 33.618 138.181 82.727 25.708-49.109 77.948-82.727 138.18-82.727 85.694 0 155.155 68.06 155.155 152.023C805.335 573.551 512 761.5 512 761.5z"),fill:t?"red":"currentColor"})]),ReplyIcon:()=>e.h("svg",{viewBox:"0 0 1024 1024",width:"24",height:"24"},e.h("path",{d:"M810.667 213.333a64 64 0 0 1 64 64V704a64 64 0 0 1-64 64H478.336l-146.645 96.107a21.333 21.333 0 0 1-33.024-17.856V768h-85.334a64 64 0 0 1-64-64V277.333a64 64 0 0 1 64-64h597.334zm0 64H213.333V704h149.334v63.296L459.243 704h351.424V277.333zm-271.36 213.334v64h-176.64v-64h176.64zm122.026-128v64H362.667v-64h298.666z",fill:"currentColor"})),VerifiedIcon:()=>e.h("svg",{class:"verified-icon",viewBox:"0 0 1024 1024",width:"14",height:"14"},e.h("path",{d:"m894.4 461.56-54.4-63.2c-10.4-12-18.8-34.4-18.8-50.4v-68c0-42.4-34.8-77.2-77.2-77.2h-68c-15.6 0-38.4-8.4-50.4-18.8l-63.2-54.4c-27.6-23.6-72.8-23.6-100.8 0l-62.8 54.8c-12 10-34.8 18.4-50.4 18.4h-69.2c-42.4 0-77.2 34.8-77.2 77.2v68.4c0 15.6-8.4 38-18.4 50l-54 63.6c-23.2 27.6-23.2 72.4 0 100l54 63.6c10 12 18.4 34.4 18.4 50v68.4c0 42.4 34.8 77.2 77.2 77.2h69.2c15.6 0 38.4 8.4 50.4 18.8l63.2 54.4c27.6 23.6 72.8 23.6 100.8 0l63.2-54.4c12-10.4 34.4-18.8 50.4-18.8h68c42.4 0 77.2-34.8 77.2-77.2v-68c0-15.6 8.4-38.4 18.8-50.4l54.4-63.2c23.2-27.6 23.2-73.2-.4-100.8zm-216-25.2-193.2 193.2a30 30 0 0 1-42.4 0l-96.8-96.8a30.16 30.16 0 0 1 0-42.4c11.6-11.6 30.8-11.6 42.4 0l75.6 75.6 172-172c11.6-11.6 30.8-11.6 42.4 0 11.6 11.6 11.6 30.8 0 42.4z",fill:"#27ae60"}))},emits:["submit","reply","like","delete","status","sticky"],setup(t){const n=e.inject("config"),o=Ie(),l=xe(),r=e.computed((()=>n.value.locale)),a=e.computed((()=>{let{link:e}=t.comment;return e?oe(e)?e:`https://${e}`:""})),i=e.computed((()=>o.value.includes(t.comment.objectId))),c=((t,n)=>{const o=Q();return e.computed((()=>se(t,o.value,n)))})(t.comment.insertedAt,r.value),s=e.computed((()=>"administrator"===l.value.type)),m=e.computed((()=>t.comment.user_id&&l.value.objectId===t.comment.user_id)),u=e.computed((()=>t.comment.objectId===t.reply?.objectId));return{config:n,locale:r,isReplyingCurrent:u,link:a,like:i,time:c,isAdmin:s,isOwner:m,commentStatus:Et}}}),$t=["id"],St={class:"wl-user","aria-hidden":"true"},Nt=["src"],Vt={class:"wl-card"},xt={class:"wl-head"},Lt=["href"],It={key:1,class:"wl-nick"},jt=["textContent"],Rt=["textContent"],zt=["textContent"],At=["textContent"],Ut=["textContent"],Mt={class:"wl-comment-actions"},Dt=["title"],Ot=["textContent"],Tt=["title"],Pt={class:"wl-meta","aria-hidden":"true"},Ft=["textContent"],Ht=["textContent"],_t=["textContent"],Wt=["innerHTML"],qt={key:0,class:"wl-admin-actions"},Gt={class:"wl-comment-status"},Jt=["disabled","onClick","textContent"],Kt={key:1,class:"wl-reply-wrapper"},Yt={key:2,class:"wl-quote"};var Zt=Me(Bt,[["render",function(t,n,o,l,r,a){const i=e.resolveComponent("VerifiedIcon"),c=e.resolveComponent("DeleteIcon"),s=e.resolveComponent("LikeIcon"),m=e.resolveComponent("ReplyIcon"),u=e.resolveComponent("CommentBox"),d=e.resolveComponent("CommentCard",!0);return e.openBlock(),e.createElementBlock("div",{class:"wl-item",id:t.comment.objectId},[e.createElementVNode("div",St,[t.comment.avatar?(e.openBlock(),e.createElementBlock("img",{key:0,src:t.comment.avatar},null,8,Nt)):e.createCommentVNode("v-if",!0),t.comment.type?(e.openBlock(),e.createBlock(i,{key:1})):e.createCommentVNode("v-if",!0)]),e.createElementVNode("div",Vt,[e.createElementVNode("div",xt,[t.link?(e.openBlock(),e.createElementBlock("a",{key:0,class:"wl-nick",href:t.link,target:"_blank",rel:"nofollow noreferrer"},e.toDisplayString(t.comment.nick),9,Lt)):(e.openBlock(),e.createElementBlock("span",It,e.toDisplayString(t.comment.nick),1)),"administrator"===t.comment.type?(e.openBlock(),e.createElementBlock("span",{key:2,class:"wl-badge",textContent:e.toDisplayString(t.locale.admin)},null,8,jt)):e.createCommentVNode("v-if",!0),t.comment.label?(e.openBlock(),e.createElementBlock("span",{key:3,class:"wl-badge",textContent:e.toDisplayString(t.comment.label)},null,8,Rt)):e.createCommentVNode("v-if",!0),t.comment.sticky?(e.openBlock(),e.createElementBlock("span",{key:4,class:"wl-badge",textContent:e.toDisplayString(t.locale.sticky)},null,8,zt)):e.createCommentVNode("v-if",!0),t.comment.level&&t.comment.level>=0?(e.openBlock(),e.createElementBlock("span",{key:5,class:e.normalizeClass(`wl-badge level${t.comment.level}`),textContent:e.toDisplayString(t.locale[`level${t.comment.level}`]||`Level ${t.comment.level}`)},null,10,At)):e.createCommentVNode("v-if",!0),e.createElementVNode("span",{class:"wl-time",textContent:e.toDisplayString(t.time)},null,8,Ut),e.createElementVNode("div",Mt,[t.isAdmin||t.isOwner?(e.openBlock(),e.createElementBlock("button",{key:0,class:"wl-delete",onClick:n[0]||(n[0]=e=>t.$emit("delete",t.comment))},[e.createVNode(c)])):e.createCommentVNode("v-if",!0),e.createElementVNode("button",{class:"wl-like",onClick:n[1]||(n[1]=e=>t.$emit("like",t.comment)),title:t.like?t.locale.cancelLike:t.locale.like},[e.createVNode(s,{active:t.like},null,8,["active"]),"like"in t.comment?(e.openBlock(),e.createElementBlock("span",{key:0,textContent:e.toDisplayString(t.comment.like)},null,8,Ot)):e.createCommentVNode("v-if",!0)],8,Dt),e.createElementVNode("button",{class:e.normalizeClass(["wl-reply",{active:t.isReplyingCurrent}]),title:t.isReplyingCurrent?t.locale.cancelReply:t.locale.reply,onClick:n[2]||(n[2]=e=>t.$emit("reply",t.isReplyingCurrent?null:t.comment))},[e.createVNode(m)],10,Tt)])]),e.createElementVNode("div",Pt,[t.comment.addr?(e.openBlock(),e.createElementBlock("span",{key:0,textContent:e.toDisplayString(t.comment.addr)},null,8,Ft)):e.createCommentVNode("v-if",!0),t.comment.browser?(e.openBlock(),e.createElementBlock("span",{key:1,textContent:e.toDisplayString(t.comment.browser)},null,8,Ht)):e.createCommentVNode("v-if",!0),t.comment.os?(e.openBlock(),e.createElementBlock("span",{key:2,textContent:e.toDisplayString(t.comment.os)},null,8,_t)):e.createCommentVNode("v-if",!0)]),e.createElementVNode("div",{class:"wl-content",innerHTML:t.comment.comment},null,8,Wt),t.isAdmin?(e.openBlock(),e.createElementBlock("div",qt,[e.createElementVNode("span",Gt,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(t.commentStatus,(n=>(e.openBlock(),e.createElementBlock("button",{key:n,class:e.normalizeClass(`wl-btn wl-${n}`),disabled:t.comment.status===n,onClick:e=>t.$emit("status",{status:n,comment:t.comment}),textContent:e.toDisplayString(n)},null,10,Jt)))),128))]),t.isAdmin&&!t.comment.rid?(e.openBlock(),e.createElementBlock("button",{key:0,class:"wl-btn wl-sticky",onClick:n[3]||(n[3]=e=>t.$emit("sticky",t.comment))},e.toDisplayString(t.comment.sticky?"unsticky":"sticky"),1)):e.createCommentVNode("v-if",!0)])):e.createCommentVNode("v-if",!0),t.isReplyingCurrent?(e.openBlock(),e.createElementBlock("div",Kt,[e.createVNode(u,{replyId:t.comment.objectId,replyUser:t.comment.nick,rootId:t.rootId,onSubmit:n[4]||(n[4]=e=>t.$emit("submit",e)),onCancelReply:n[5]||(n[5]=e=>t.$emit("reply",null))},null,8,["replyId","replyUser","rootId"])])):e.createCommentVNode("v-if",!0),t.comment.children?(e.openBlock(),e.createElementBlock("div",Yt,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(t.comment.children,(o=>(e.openBlock(),e.createBlock(d,{key:o.objectId,comment:o,reply:t.reply,rootId:t.rootId,onReply:n[6]||(n[6]=e=>t.$emit("reply",e)),onSubmit:n[7]||(n[7]=e=>t.$emit("submit",e)),onLike:n[8]||(n[8]=e=>t.$emit("like",e)),onDelete:n[9]||(n[9]=e=>t.$emit("delete",e)),onStatus:n[10]||(n[10]=e=>t.$emit("status",e)),onSticky:n[11]||(n[11]=e=>t.$emit("sticky",e))},null,8,["comment","reply","rootId"])))),128))])):e.createCommentVNode("v-if",!0)])],8,$t)}],["__file","CommentCard.vue"]]);const Xt=e.defineComponent({name:"WalineRoot",components:{CommentBox:Ct,CommentCard:Zt,LoadingIcon:Ue},props:["serverURL","path","meta","requiredMeta","dark","lang","locale","pageSize","wordLimit","emoji","login","highlighter","texRenderer","imageUploader","copyright"],setup(t){const n=e.computed((()=>(({serverURL:e,path:t=location.pathname,lang:n="zh-CN",locale:o,emoji:l=["//unpkg.com/@waline/emojis@1.0.1/weibo"],meta:r=["nick","mail","link"],requiredMeta:s=[],dark:m=!1,pageSize:u=10,wordLimit:p,imageUploader:v,highlighter:g,texRenderer:f,copyright:h=!0,login:w="enable",...y})=>({serverURL:le(e),path:te(t),locale:{...b[n]||b["zh-CN"],..."object"==typeof o?o:{}},wordLimit:re(p),meta:a(r),requiredMeta:a(s),imageUploader:ae(v,i),highlighter:ae(g,d),texRenderer:ae(f,c),lang:n,dark:m,emoji:l,pageSize:u,login:w,copyright:h,...y}))(t))),o=xe(),l=Ie(),r=e.ref("loading"),s=e.ref(0),m=e.ref(1),u=e.ref(0),p=e.ref([]),v=e.ref(null),g=e.computed((()=>{return"string"==typeof(e=n.value.dark)?"auto"===e?`@media(prefers-color-scheme:dark){body${ie}}`:`${e}${ie}`:!0===e?`:root${ie}`:"";var e}));let f;!function(t,n={}){const o=e.ref(!1),{document:l=O,immediate:r=!0,manual:a=!1,id:i="vueuse_styletag_"+ ++ee}=n,c=e.ref(t);let s=()=>{};const m=()=>{if(!l)return;const t=l.getElementById(i)||l.createElement("style");t.type="text/css",t.id=i,n.media&&(t.media=n.media),l.head.appendChild(t),o.value||(s=e.watch(c,(e=>{t.innerText=e}),{immediate:!0}),o.value=!0)},u=()=>{l&&o.value&&(s(),l.head.removeChild(l.getElementById(i)),o.value=!1)};r&&!a&&m(),a||C(u),e.readonly(o)}(g);const h=e=>{const{serverURL:t,path:l,pageSize:a}=n.value,i=new AbortController;r.value="loading",f?.(),(({serverURL:e,lang:t,path:n,page:o,pageSize:l,signal:r,token:a})=>{const i={};return a&&(i.Authorization=`Bearer ${a}`),fetch(`${e}/comment?path=${encodeURIComponent(n)}&pageSize=${l}&page=${o}&lang=${t}`,{signal:r,headers:i}).then((e=>e.json())).then((e=>ve(e,"comment list")))})({serverURL:t,lang:n.value.lang,path:l,pageSize:a,page:e,signal:i.signal,token:o.value?.token}).then((t=>{r.value="success",s.value=t.count,p.value.push(...t.data),m.value=e,u.value=t.totalPages})).catch((e=>{"AbortError"!==e.name&&(console.error(e.message),r.value="error")})),f=i.abort.bind(i)},w=()=>{s.value=0,p.value=[],h(1)};return e.provide("config",n),e.watch((()=>t.path),w),e.onMounted((()=>w())),{config:n,darkmodeStyle:g,i18n:e.computed((()=>n.value.locale)),status:r,count:s,page:m,totalPages:u,data:p,reply:v,loadMore:()=>h(m.value+1),refresh:w,onReply:e=>{v.value=e},onSubmit:e=>{if(e.rid){const t=p.value.find((({objectId:t})=>t===e.rid));if(!t)return;Array.isArray(t.children)||(t.children=[]),t.children.push(e)}else p.value.unshift(e)},onStatusChange:async({comment:e,status:t})=>{if(e.status===t)return;const{serverURL:l,lang:r}=n.value;await ge({serverURL:l,lang:r,token:o.value?.token,objectId:e.objectId,status:t}),e.status=t},onDelete:async({objectId:e})=>{if(!confirm("Are you sure you want to delete this comment?"))return;const{serverURL:t,lang:l}=n.value;await(({serverURL:e,lang:t,token:n,objectId:o})=>fetch(`${e}/comment/${o}?lang=${t}`,{method:"DELETE",headers:{Authorization:`Bearer ${n}`}}).then((e=>e.json())))({serverURL:t,lang:l,token:o.value?.token,objectId:e}),p.value.some(((t,n)=>t.objectId===e?(p.value=p.value.filter(((e,t)=>t!==n)),!0):t.children.some(((o,l)=>o.objectId===e&&(p.value[n].children=t.children.filter(((e,t)=>t!==l)),!0)))))},onSticky:async e=>{if(e.rid)return;const{serverURL:t,lang:l}=n.value;await ge({serverURL:t,lang:l,token:o.value?.token,objectId:e.objectId,sticky:e.sticky?0:1}),e.sticky=!e.sticky},onLike:async e=>{const{serverURL:t,lang:o}=n.value,{objectId:r}=e,a=l.value.includes(r);await(({serverURL:e,lang:t,objectId:n,like:o})=>fetch(`${e}/comment/${n}?lang=${t}`,{method:"PUT",headers:pe,body:JSON.stringify({like:o})}).then((e=>e.json())))({serverURL:t,lang:o,objectId:r,like:!a}),a?l.value=l.value.filter((e=>e!==r)):(l.value=[...l.value,r],l.value.length>50&&(l.value=l.value.slice(-50))),e.like=(e.like||0)+(a?-1:1)},version:"2.5.0"}}}),Qt={"data-waline":""},en={class:"wl-count"},tn=["textContent"],nn={class:"wl-cards"},on={key:1,class:"wl-operation"},ln=["textContent"],rn={key:0,class:"wl-loading"},an=["textContent"],cn={class:"wl-operation"},sn=["textContent"],mn={key:3,class:"wl-power"},un=e.createTextVNode(" Powered by "),dn=e.createElementVNode("a",{href:"https://github.com/walinejs/waline",target:"_blank",rel:"noreferrer"}," Waline ",-1);var pn=Me(Xt,[["render",function(t,n,o,l,r,a){const i=e.resolveComponent("CommentBox"),c=e.resolveComponent("CommentCard"),s=e.resolveComponent("LoadingIcon");return e.openBlock(),e.createElementBlock("div",Qt,[t.reply?e.createCommentVNode("v-if",!0):(e.openBlock(),e.createBlock(i,{key:0,onSubmit:t.onSubmit},null,8,["onSubmit"])),e.createElementVNode("div",en,[t.count?(e.openBlock(),e.createElementBlock("span",{key:0,class:"wl-num",textContent:e.toDisplayString(t.count)},null,8,tn)):e.createCommentVNode("v-if",!0),e.createTextVNode(" "+e.toDisplayString(t.i18n.comment),1)]),e.createElementVNode("div",nn,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(t.data,(n=>(e.openBlock(),e.createBlock(c,{key:n.objectId,"root-id":n.objectId,comment:n,reply:t.reply,onReply:t.onReply,onSubmit:t.onSubmit,onStatus:t.onStatusChange,onDelete:t.onDelete,onSticky:t.onSticky,onLike:t.onLike},null,8,["root-id","comment","reply","onReply","onSubmit","onStatus","onDelete","onSticky","onLike"])))),128))]),"error"===t.status?(e.openBlock(),e.createElementBlock("div",on,[e.createElementVNode("button",{type:"button",class:"wl-btn",onClick:n[0]||(n[0]=(...e)=>t.refresh&&t.refresh(...e)),textContent:e.toDisplayString(t.i18n.refresh)},null,8,ln)])):(e.openBlock(),e.createElementBlock(e.Fragment,{key:2},["loading"===t.status?(e.openBlock(),e.createElementBlock("div",rn,[e.createVNode(s,{size:30})])):t.data.length?t.page<t.totalPages?(e.openBlock(),e.createElementBlock(e.Fragment,{key:2},[e.createCommentVNode(" Load more button "),e.createElementVNode("div",cn,[e.createElementVNode("button",{type:"button",class:"wl-btn",onClick:n[1]||(n[1]=(...e)=>t.loadMore&&t.loadMore(...e)),textContent:e.toDisplayString(t.i18n.more)},null,8,sn)])],2112)):e.createCommentVNode("v-if",!0):(e.openBlock(),e.createElementBlock("div",{key:1,class:"wl-empty",textContent:e.toDisplayString(t.i18n.sofa)},null,8,an))],2112)),e.createCommentVNode(" Copyright Information "),t.config.copyright?(e.openBlock(),e.createElementBlock("div",mn,[un,dn,e.createTextVNode(" v"+e.toDisplayString(t.version),1)])):e.createCommentVNode("v-if",!0)])}],["__file","Waline.vue"]]);const vn=(e,t)=>{t.forEach(((t,n)=>{t.innerText=e[n].toString()}))},gn=({serverURL:e,path:t=window.location.pathname,selector:n=".waline-pageview-count",update:o=!0,lang:l="zh-CN"})=>{const r=new AbortController,a=Array.from(document.querySelectorAll(n)),i=e=>{const n=Se(e);return null!==n&&t!==n},c=n=>fe({serverURL:e,paths:n.map((e=>Se(e)||t)),lang:l,signal:r.signal}).then((e=>vn(e,n))).catch(de);if(o){const n=a.filter((e=>!i(e))),o=a.filter(i);he({serverURL:e,path:t,lang:l}).then((e=>vn(new Array(n.length).fill(e),n))),o.length&&c(o)}else c(a);return r.abort.bind(r)};exports.RecentComments=({el:e,serverURL:t,count:n,lang:o="zh-CN"})=>{const l=xe(),r=we(e),a=new AbortController;return(({serverURL:e,lang:t,count:n,signal:o,token:l})=>{const r={};return l&&(r.Authorization=`Bearer ${l}`),fetch(`${e}/comment?type=recent&count=${n}&lang=${t}`,{signal:o,headers:r}).then((e=>e.json())).then((e=>ve(e,"recent comment")))})({serverURL:t,count:n,lang:o,signal:a.signal,token:l.value?.token}).then((e=>r&&e.length?(r.innerHTML=`<ul class="wl-recent-list">${e.map((e=>`<li class="wl-recent-item"><a href="${e.url}">${e.nick}</a>:${e.comment}</li>`)).join("")}</ul>`,{comments:e,destroy:()=>{a.abort(),r.innerHTML=""}}):{comments:e,destroy:()=>a.abort()}))},exports.commentCount=je,exports.defaultLocales=b,exports.init=({el:t="#waline",path:n=window.location.pathname,comment:o=!1,pageview:l=!1,...r})=>{const a=t?we(t):null;if(t&&!a)throw new Error("Option 'el' do not match any domElement!");if(!r.serverURL)throw new Error("Option 'serverURL' is missing!");const i=e.reactive({...r}),c=e.reactive({comment:o,pageview:l,path:n}),s=()=>{c.comment&&je({serverURL:i.serverURL,path:c.path,selector:"string"==typeof c.comment?c.comment:void 0})},m=()=>{c.pageview&&gn({serverURL:i.serverURL,path:c.path,selector:"string"==typeof c.pageview?c.pageview:void 0})},u=a?e.createApp((()=>e.h(pn,{path:c.path,...i}))):null;u&&(u.use(Ae),u.mount(a)),s(),m();const d=e.watchEffect(s),p=e.watchEffect(m);return{el:a,update:({comment:e,pageview:t,path:n=window.location.pathname,...o}={})=>{Object.entries(o).forEach((([e,t])=>{i[e]=t})),c.path=n,void 0!==e&&(c.comment=e),void 0!==t&&(c.pageview=t)},destroy:()=>{u?.unmount(),d(),p()}}},exports.pageviewCount=gn,exports.version="2.5.0";
//# sourceMappingURL=shim.js.map

@@ -148,2 +148,4 @@ interface WalineEmojiInfo {

anonymous: string;
gif: string;
gifSearchPlaceholder: string;
}

@@ -150,0 +152,0 @@

@@ -148,2 +148,4 @@ interface WalineEmojiInfo {

anonymous: string;
gif: string;
gifSearchPlaceholder: string;
}

@@ -150,0 +152,0 @@

@@ -148,2 +148,4 @@ interface WalineEmojiInfo {

anonymous: string;
gif: string;
gifSearchPlaceholder: string;
}

@@ -150,0 +152,0 @@

{
"name": "@waline/client",
"version": "2.4.2",
"version": "2.5.0",
"description": "client for waline comment system",

@@ -59,2 +59,11 @@ "keywords": [

],
"scripts": {
"build": "pnpm rollup && pnpm style",
"clean": "rimraf ./dist",
"dev": "vite -c config/vite.config.js",
"lint": "eslint --ext .ts,.vue .",
"prepublish": "pnpm clean && pnpm build",
"rollup": "rollup -c ./config/rollup.config.js",
"style": "sass ./src/styles/index.scss ./dist/waline.css --style=compressed"
},
"browserslist": {

@@ -89,7 +98,8 @@ "production": [

"@types/marked": "^4.0.3",
"@types/node": "^17.0.31",
"@vitejs/plugin-vue": "^2.3.2",
"@types/node": "^17.0.33",
"@vitejs/plugin-vue": "^2.3.3",
"@vue/compiler-sfc": "^3.2.33",
"@yeger/vue-masonry-wall": "^3.0.31",
"rimraf": "^3.0.2",
"rollup": "^2.72.1",
"rollup": "^2.73.0",
"rollup-plugin-dts": "^4.2.1",

@@ -99,16 +109,7 @@ "rollup-plugin-terser": "^7.0.2",

"typescript": "^4.6.4",
"vite": "^2.9.8"
"vite": "^2.9.9"
},
"engines": {
"node": ">=14"
},
"scripts": {
"build": "pnpm rollup && pnpm style",
"clean": "rimraf ./dist",
"dev": "vite -c config/vite.config.js",
"lint": "eslint --ext .ts,.vue .",
"prepublish": "pnpm clean && pnpm build",
"rollup": "rollup -c ./config/rollup.config.js",
"style": "sass ./src/styles/index.scss ./dist/waline.css --style=compressed"
}
}
}

@@ -151,1 +151,21 @@ import { h } from 'vue';

);
export const GifIcon: FunctionalComponent = () =>
h(
'svg',
{
width: 24,
height: 24,
fill: 'currentcolor',
viewBox: '0 0 24 24',
},
[
h('path', {
style: 'transform: translateY(0.5px)',
d: 'M18.968 10.5H15.968V11.484H17.984V12.984H15.968V15H14.468V9H18.968V10.5V10.5ZM8.984 9C9.26533 9 9.49967 9.09367 9.687 9.281C9.87433 9.46833 9.968 9.70267 9.968 9.984V10.5H6.499V13.5H8.468V12H9.968V14.016C9.968 14.2973 9.87433 14.5317 9.687 14.719C9.49967 14.9063 9.26533 15 8.984 15H5.984C5.70267 15 5.46833 14.9063 5.281 14.719C5.09367 14.5317 5 14.2973 5 14.016V9.985C5 9.70367 5.09367 9.46933 5.281 9.282C5.46833 9.09467 5.70267 9.001 5.984 9.001H8.984V9ZM11.468 9H12.968V15H11.468V9V9Z',
}),
h('path', {
d: 'M18.5 3H5.75C3.6875 3 2 4.6875 2 6.75V18C2 20.0625 3.6875 21.75 5.75 21.75H18.5C20.5625 21.75 22.25 20.0625 22.25 18V6.75C22.25 4.6875 20.5625 3 18.5 3ZM20.75 18C20.75 19.2375 19.7375 20.25 18.5 20.25H5.75C4.5125 20.25 3.5 19.2375 3.5 18V6.75C3.5 5.5125 4.5125 4.5 5.75 4.5H18.5C19.7375 4.5 20.75 5.5125 20.75 6.75V18Z',
}),
]
);

@@ -42,2 +42,4 @@ import { generateLocale } from './generate';

'Maiar',
'GIF',
'Search GIF',
]);

@@ -42,2 +42,4 @@ import type { WalineLocale } from '../../typings';

'level5',
'gif',
'gifSearchPlaceholder',
];

@@ -44,0 +46,0 @@

@@ -36,2 +36,10 @@ import { generateLocale } from './generate';

'匿名',
'うえにん',
'なかにん',
'しもおし',
'特にしもおし',
'かげ',
'なぬし',
'GIF',
'探す GIF',
]);

@@ -36,2 +36,10 @@ import { generateLocale } from './generate';

'Anônimo',
'Dwarves',
'Hobbits',
'Ents',
'Wizards',
'Elves',
'Maiar',
'GIF',
'Pesquisar GIF',
]);

@@ -36,2 +36,10 @@ import { generateLocale } from './generate';

'Анонимный',
'Dwarves',
'Hobbits',
'Ents',
'Wizards',
'Elves',
'Maiar',
'GIF',
'Поиск GIF',
]);

@@ -36,2 +36,10 @@ import { generateLocale } from './generate';

'Vô danh',
'Dwarves',
'Hobbits',
'Ents',
'Wizards',
'Elves',
'Maiar',
'GIF',
'Tìm kiếm GIF',
]);

@@ -42,2 +42,4 @@ import { generateLocale } from './generate';

'传说',
'表情包',
'搜索表情包',
]);

@@ -42,2 +42,4 @@ import { generateLocale } from './generate';

'傳說',
'表情包',
'搜索表情包',
]);
import { createApp, h, reactive, watchEffect } from 'vue';
import MasonryWall from '@yeger/vue-masonry-wall';

@@ -83,4 +84,8 @@ import Waline from './components/Waline.vue';

// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
if (app) app.mount(root!);
if (app) {
// eslint-disable-next-line @typescript-eslint/no-unsafe-argument
app.use(MasonryWall);
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
app.mount(root!);
}

@@ -87,0 +92,0 @@ updateCommentCount();

@@ -39,2 +39,4 @@ export interface WalineDateLocale {

anonymous: string;
gif: string;
gifSearchPlaceholder: string;
}

@@ -13,1 +13,3 @@ export * from './config';

export * from './wordCount';
export * from './fetchGif';
export * from './throttle';

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc