@waline/client 2.4.1 → 2.4.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/component.esm.js +1 -1
- package/dist/component.esm.js.map +1 -1
- package/dist/component.js +1 -1
- package/dist/component.js.map +1 -1
- package/dist/legacy.d.ts +1 -1
- package/dist/legacy.js +1 -1
- package/dist/legacy.js.map +1 -1
- package/dist/pageview.cjs.js +1 -1
- package/dist/pageview.esm.js +1 -1
- package/dist/pageview.js +1 -1
- package/dist/shim.d.ts +1 -1
- package/dist/shim.esm.d.ts +1 -1
- package/dist/shim.esm.js +1 -1
- package/dist/shim.esm.js.map +1 -1
- package/dist/shim.js +1 -1
- package/dist/shim.js.map +1 -1
- package/dist/waline.cjs.d.ts +1 -1
- package/dist/waline.cjs.js +1 -1
- package/dist/waline.cjs.js.map +1 -1
- package/dist/waline.d.ts +1 -1
- package/dist/waline.esm.d.ts +1 -1
- package/dist/waline.esm.js +1 -1
- package/dist/waline.esm.js.map +1 -1
- package/dist/waline.js +1 -1
- package/dist/waline.js.map +1 -1
- package/package.json +1 -2
- package/src/typings/waline.ts +1 -1
package/dist/shim.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"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"<";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:{},F="__vueuse_ssr_handlers__";P[F]=P[F]||{};const _=P[F];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 _[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.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`)}))},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}}});const ze={class:"wl-comment"},Ae={key:0,class:"wl-login-info"},Ue={class:"wl-avatar"},De=["title"],Me=["src"],Oe=["textContent"],Te={class:"wl-panel"},Pe=["for","textContent"],Fe=["id","name","type","onUpdate:modelValue"],_e=["placeholder"],He={class:"wl-preview"},We=e.createElementVNode("hr",null,null,-1),qe=["innerHTML"],Je={class:"wl-footer"},Ke={class:"wl-actions"},Ye={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"],Xe=["title"],Qe=["title"],Ze={class:"wl-info"},et={class:"wl-text-number"},tt={key:0},nt=e.createTextVNode(" / "),ot=["textContent"],lt=["textContent"],rt=["disabled"],at={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"];Re.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",ze,["disable"!==t.config.login&&t.isLogin?(e.openBlock(),e.createElementBlock("div",Ae,[e.createElementVNode("div",Ue,[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,De),e.createElementVNode("img",{src:t.userInfo.avatar,alt:"avatar"},null,8,Me)]),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,Oe)])):e.createCommentVNode("v-if",!0),e.createElementVNode("div",Te,["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,Pe),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,_e),[[e.vModelText,t.editor]]),e.withDirectives(e.createElementVNode("div",He,[We,e.createElementVNode("h4",null,e.toDisplayString(t.locale.preview)+":",1),e.createElementVNode("div",{class:"wl-content",innerHTML:t.previewText},null,8,qe)],512),[[e.vShow,t.showPreview]]),e.createElementVNode("div",Je,[e.createElementVNode("div",Ke,[e.createElementVNode("a",Ye,[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("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,Xe)):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,Qe)]),e.createElementVNode("div",Ze,[e.createElementVNode("div",et,[e.createTextVNode(e.toDisplayString(t.wordNumber)+" ",1),t.config.wordLimit?(e.openBlock(),e.createElementBlock("span",tt,[nt,e.createElementVNode("span",{class:e.normalizeClass({illegal:!t.isWordNumberLegal}),textContent:e.toDisplayString(t.wordLimit)},null,10,ot)])):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,lt)),"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,rt)):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",at,[(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[11]||(n[11]=e=>t.$emit("cancel-reply"))},[e.createVNode(i,{size:24})],8,dt)):e.createCommentVNode("v-if",!0)])},Re.__file="src/components/CommentBox.vue";const pt=["approved","waiting","spam"];var vt=e.defineComponent({props:{comment:{type:Object,required:!0},rootId:{type:String,required:!0},reply:{type:Object}},components:{CommentBox:Re,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:pt}}});const gt=["id"],ht={class:"wl-user","aria-hidden":"true"},ft=["src"],wt={class:"wl-card"},yt={class:"wl-head"},kt=["href"],bt={key:1,class:"wl-nick"},Ct=["textContent"],Et=["textContent"],$t=["textContent"],Bt=["textContent"],Nt=["textContent"],St={class:"wl-comment-actions"},Lt=["title"],It=["textContent"],Vt=["title"],jt={class:"wl-meta","aria-hidden":"true"},xt=["textContent"],Rt=["textContent"],zt=["textContent"],At=["innerHTML"],Ut={key:0,class:"wl-admin-actions"},Dt={class:"wl-comment-status"},Mt=["disabled","onClick","textContent"],Ot={key:1,class:"wl-reply-wrapper"},Tt={key:2,class:"wl-quote"};vt.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",ht,[t.comment.avatar?(e.openBlock(),e.createElementBlock("img",{key:0,src:t.comment.avatar},null,8,ft)):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",yt,[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,kt)):(e.openBlock(),e.createElementBlock("span",bt,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,Ct)):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,Et)):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,$t)):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,Nt),e.createElementVNode("div",St,[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,It)):e.createCommentVNode("v-if",!0)],8,Lt),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,Vt)])]),e.createElementVNode("div",jt,[t.comment.addr?(e.openBlock(),e.createElementBlock("span",{key:0,textContent:e.toDisplayString(t.comment.addr)},null,8,xt)):e.createCommentVNode("v-if",!0),t.comment.browser?(e.openBlock(),e.createElementBlock("span",{key:1,textContent:e.toDisplayString(t.comment.browser)},null,8,Rt)):e.createCommentVNode("v-if",!0),t.comment.os?(e.openBlock(),e.createElementBlock("span",{key:2,textContent:e.toDisplayString(t.comment.os)},null,8,zt)):e.createCommentVNode("v-if",!0)]),e.createElementVNode("div",{class:"wl-content",innerHTML:t.comment.comment},null,8,At),t.isAdmin?(e.openBlock(),e.createElementBlock("div",Ut,[e.createElementVNode("span",Dt,[(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,Mt)))),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",Ot,[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)},vt.__file="src/components/CommentCard.vue";var Pt=e.defineComponent({name:"WalineRoot",components:{CommentBox:Re,CommentCard:vt,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.1"}}});const Ft={"data-waline":""},_t={class:"wl-count"},Ht=["textContent"],Wt={class:"wl-cards"},qt={key:1,class:"wl-operation"},Jt=["textContent"],Kt={key:0,class:"wl-loading"},Yt=["textContent"],Gt={class:"wl-operation"},Xt=["textContent"],Qt={key:3,class:"wl-power"},Zt=e.createTextVNode(" Powered by "),en=e.createElementVNode("a",{href:"https://github.com/walinejs/waline",target:"_blank",rel:"noreferrer"}," Waline ",-1);Pt.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",Ft,[t.reply?e.createCommentVNode("v-if",!0):(e.openBlock(),e.createBlock(i,{key:0,onSubmit:t.onSubmit},null,8,["onSubmit"])),e.createElementVNode("div",_t,[t.count?(e.openBlock(),e.createElementBlock("span",{key:0,class:"wl-num",textContent:e.toDisplayString(t.count)},null,8,Ht)):e.createCommentVNode("v-if",!0),e.createTextVNode(" "+e.toDisplayString(t.i18n.comment),1)]),e.createElementVNode("div",Wt,[(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",qt,[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,Jt)])):(e.openBlock(),e.createElementBlock(e.Fragment,{key:2},["loading"===t.status?(e.openBlock(),e.createElementBlock("div",Kt,[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",Gt,[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,Xt)])],2112)):e.createCommentVNode("v-if",!0):(e.openBlock(),e.createElementBlock("div",{key:1,class:"wl-empty",textContent:e.toDisplayString(t.i18n.sofa)},null,8,Yt))],2112)),e.createCommentVNode(" Copyright Information "),t.config.copyright?(e.openBlock(),e.createElementBlock("div",Qt,[Zt,en,e.createTextVNode(" v"+e.toDisplayString(t.version),1)])):e.createCommentVNode("v-if",!0)])},Pt.__file="src/components/Waline.vue";const tn=(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 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=>tn(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=>tn(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&&nn({serverURL:i.serverURL,path:c.path,selector:"string"==typeof c.pageview?c.pageview:void 0})},u=a?e.createApp((()=>e.h(Pt,{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=nn,exports.version="2.4.1";
|
|
1
|
+
"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"<";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`)}))},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";
|
|
2
2
|
//# sourceMappingURL=shim.js.map
|