@waline/client
Advanced tools
Comparing version 2.6.0 to 2.6.1
@@ -1,2 +0,2 @@ | ||
import{getCurrentScope as e,onScopeDispose as t,watch as n,unref as l,ref as o,isRef as a,readonly as i,shallowRef as r,h as s,defineComponent as c,onMounted as u,onBeforeUnmount as m,resolveComponent as d,openBlock as v,createElementBlock as p,normalizeStyle as g,Fragment as f,renderList as h,createBlock as w,createCommentVNode as y,createElementVNode as b,nextTick as k,computed as C,inject as I,reactive as $,onUnmounted as x,createVNode as L,toDisplayString as S,normalizeClass as j,withDirectives as E,vModelDynamic as R,vModelText as z,vShow as A,createTextVNode as M,provide as U}from"vue";import O from"autosize";import{marked as P}from"marked";function T(n){return!!e()&&(t(n),!0)}var N;const H="undefined"!=typeof window,V=()=>{};function _(e,t){return function(...n){e((()=>t.apply(this,n)),{fn:t,thisArg:this,args:n})}}H&&(null==(N=null==window?void 0:window.navigator)?void 0:N.userAgent)&&/iP(ad|hone|od)/.test(window.navigator.userAgent);const F=e=>e();function D(e,t=200,n={}){return _(function(e,t={}){let n,o;return a=>{const i=l(e),r=l(t.maxWait);if(n&&clearTimeout(n),i<=0||void 0!==r&&r<=0)return o&&(clearTimeout(o),o=null),a();r&&!o&&(o=setTimeout((()=>{n&&clearTimeout(n),o=null,a()}),r)),n=setTimeout((()=>{o&&clearTimeout(o),o=null,a()}),i)}}(t,n),e)}var B=Object.getOwnPropertySymbols,W=Object.prototype.hasOwnProperty,G=Object.prototype.propertyIsEnumerable;function q(e,t,l={}){const o=l,{eventFilter:a=F}=o,i=((e,t)=>{var n={};for(var l in e)W.call(e,l)&&t.indexOf(l)<0&&(n[l]=e[l]);if(null!=e&&B)for(var l of B(e))t.indexOf(l)<0&&G.call(e,l)&&(n[l]=e[l]);return n})(o,["eventFilter"]);return n(e,_(a,t),i)}var J=Object.defineProperty,K=Object.defineProperties,Y=Object.getOwnPropertyDescriptors,Z=Object.getOwnPropertySymbols,X=Object.prototype.hasOwnProperty,Q=Object.prototype.propertyIsEnumerable,ee=(e,t,n)=>t in e?J(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;function te(e,t,n={}){const l=n,{eventFilter:a}=l,i=((e,t)=>{var n={};for(var l in e)X.call(e,l)&&t.indexOf(l)<0&&(n[l]=e[l]);if(null!=e&&Z)for(var l of Z(e))t.indexOf(l)<0&&Q.call(e,l)&&(n[l]=e[l]);return n})(l,["eventFilter"]),{eventFilter:r,pause:s,resume:c,isActive:u}=function(e=F){const t=o(!0);return{isActive:t,pause:function(){t.value=!1},resume:function(){t.value=!0},eventFilter:(...n)=>{t.value&&e(...n)}}}(a),m=q(e,t,(d=((e,t)=>{for(var n in t||(t={}))X.call(t,n)&&ee(e,n,t[n]);if(Z)for(var n of Z(t))Q.call(t,n)&&ee(e,n,t[n]);return e})({},i),K(d,Y({eventFilter:r}))));var d;return{stop:m,pause:s,resume:c,isActive:u}}const ne=H?window:void 0,le=H?window.document:void 0;function oe(...e){let t,o,a,i;if("string"==typeof e[0]?([o,a,i]=e,t=ne):[t,o,a,i]=e,!t)return V;let r=V;const s=n((()=>function(e){var t;const n=l(e);return null!=(t=null==n?void 0:n.$el)?t:n}(t)),(e=>{r(),e&&(e.addEventListener(o,a,i),r=()=>{e.removeEventListener(o,a,i),r=V})}),{immediate:!0,flush:"post"}),c=()=>{s(),r()};return T(c),c}H&&window.navigator,H&&window.location;const ae="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},ie="__vueuse_ssr_handlers__";ae[ie]=ae[ie]||{};const re=ae[ie];const se={boolean:{read:e=>"true"===e,write:e=>String(e)},object:{read:e=>JSON.parse(e),write:e=>JSON.stringify(e)},number:{read:e=>Number.parseFloat(e),write:e=>String(e)},any:{read:e=>e,write:e=>String(e)},string:{read:e=>e,write:e=>String(e)},map:{read:e=>new Map(JSON.parse(e)),write:e=>JSON.stringify(Array.from(e.entries()))},set:{read:e=>new Set(JSON.parse(e)),write:e=>JSON.stringify(Array.from(e))},date:{read:e=>new Date(e),write:e=>e.toISOString()}};function ce(e,t,n,a={}){var i;const{flush:s="pre",deep:c=!0,listenToStorageChanges:u=!0,writeDefaults:m=!0,shallow:d,window:v=ne,eventFilter:p,onError:g=(e=>{console.error(e)})}=a,f=(d?r:o)(t);if(!n)try{n=function(e,t){return re[e]||t}("getDefaultStorage",(()=>{var e;return null==(e=ne)?void 0:e.localStorage}))()}catch(e){g(e)}if(!n)return f;const h=l(t),w=function(e){return null==e?"any":e instanceof Set?"set":e instanceof Map?"map":e instanceof Date?"date":"boolean"==typeof e?"boolean":"string"==typeof e?"string":"object"==typeof e||Array.isArray(e)?"object":Number.isNaN(e)?"any":"number"}(h),y=null!=(i=a.serializer)?i:se[w],{pause:b,resume:k}=te(f,(()=>function(t){try{null==t?n.removeItem(e):n.setItem(e,y.write(t))}catch(e){g(e)}}(f.value)),{flush:s,deep:c,eventFilter:p});return v&&u&&oe(v,"storage",C),C(),f;function C(t){t&&t.key!==e||(f.value=function(t){if(!t||t.key===e){b();try{const l=t?t.newValue:n.getItem(e);return null==l?(m&&null!==h&&n.setItem(e,y.write(h)),h):"string"!=typeof l?l:y.read(l)}catch(e){g(e)}finally{k()}}}(t))}}var ue,me,de=Object.defineProperty,ve=Object.getOwnPropertySymbols,pe=Object.prototype.hasOwnProperty,ge=Object.prototype.propertyIsEnumerable,fe=(e,t,n)=>t in e?de(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;function he(e={}){const{controls:t=!1,interval:i="requestAnimationFrame"}=e,r=o(new Date),s=()=>r.value=new Date,c="requestAnimationFrame"===i?function(e,t={}){const{immediate:n=!0,window:l=ne}=t,a=o(!1);let i=null;function r(){a.value&&l&&(e(),i=l.requestAnimationFrame(r))}function s(){!a.value&&l&&(a.value=!0,r())}function c(){a.value=!1,null!=i&&l&&(l.cancelAnimationFrame(i),i=null)}return n&&s(),T(c),{isActive:a,pause:c,resume:s}}(s,{immediate:!0}):function(e,t=1e3,i={}){const{immediate:r=!0,immediateCallback:s=!1}=i;let c=null;const u=o(!1);function m(){c&&(clearInterval(c),c=null)}function d(){u.value=!1,m()}function v(){l(t)<=0||(u.value=!0,s&&e(),m(),c=setInterval(e,l(t)))}r&&H&&v(),a(t)&&T(n(t,(()=>{r&&H&&v()})));return T(d),{isActive:u,pause:d,resume:v}}(s,i,{immediate:!0});return t?((e,t)=>{for(var n in t||(t={}))pe.call(t,n)&&fe(e,n,t[n]);if(ve)for(var n of ve(t))ge.call(t,n)&&fe(e,n,t[n]);return e})({now:r},c):r}(me=ue||(ue={})).UP="UP",me.RIGHT="RIGHT",me.DOWN="DOWN",me.LEFT="LEFT",me.NONE="NONE";let we=0;const ye=({size:e})=>s("svg",{width:e,height:e,viewBox:"0 0 100 100",preserveAspectRatio:"xMidYMid"},s("circle",{cx:50,cy:50,fill:"none",stroke:"currentColor",strokeWidth:"4",r:"40","stroke-dasharray":"85 30"},s("animateTransform",{attributeName:"transform",type:"rotate",repeatCount:"indefinite",dur:"1s",values:"0 50 50;360 50 50",keyTimes:"0;1"})));var be=(e,t)=>{const n=e.__vccOpts||e;for(const[e,l]of t)n[e]=l;return n};const ke=c({name:"ImageWall",components:{LoadingIcon:ye},props:{items:{type:Array,default:()=>[]},columnWidth:{type:Number,default:300},gap:{type:Number,default:0}},emit:["insert"],setup(e){let t=null;const l=o(null),a=o({}),i=o([]),r=()=>{const t=Math.floor((l.value.getBoundingClientRect().width+e.gap)/(e.columnWidth+e.gap));return t>0?t:1},s=async t=>{if(t>=e.items.length)return;await k();const n=Array.from(l.value?.children||[]).reduce(((e,t)=>t.getBoundingClientRect().height<e.getBoundingClientRect().height?t:e));i.value[Number(n.dataset.index)].push(t),await s(t+1)},c=async(e=!1)=>{if(i.value.length===r()&&!e)return;var t;i.value=(t=r(),new Array(t).fill(null).map((()=>[])));const n=window.scrollY;await s(0),window.scrollTo({top:n})};return n((()=>[e.items]),(()=>{a.value={},c(!0)})),n((()=>[e.columnWidth,e.gap]),(()=>c())),u((()=>{c(!0),t=new ResizeObserver((()=>c())),t.observe(l.value)})),m((()=>t.unobserve(l.value))),{columns:i,state:a,wall:l}}}),Ce=["data-index"],Ie=["src","title","onLoad","onClick"];var $e=be(ke,[["render",function(e,t,n,l,o,a){const i=d("LoadingIcon");return v(),p("div",{ref:"wall",class:"wl-gallery",style:g({gap:`${e.gap}px`})},[(v(!0),p(f,null,h(e.columns,((t,n)=>(v(),p("div",{key:n,class:"wl-gallery-column","data-index":n,style:g({gap:`${e.gap}px`})},[(v(!0),p(f,null,h(t,(t=>(v(),p(f,{key:t},[e.state[e.items[t].src]?y("v-if",!0):(v(),w(i,{key:0,size:36,style:{margin:"20px auto"}})),b("img",{class:"wl-gallery-item",src:e.items[t].src,title:e.items[t].title,loading:"lazy",onLoad:n=>e.state[e.items[t].src]=!0,onClick:n=>e.$emit("insert",`![](${e.items[t].src})`)},null,40,Ie)],64)))),128))],12,Ce)))),128))],4)}],["__file","ImageWall.vue"]]);const xe=["nick","mail","link"],Le=e=>e.filter((e=>xe.includes(e))),Se=e=>new Promise(((t,n)=>{const l=new FileReader;l.readAsDataURL(e),l.onload=()=>t(l.result?.toString()||""),l.onerror=n})),je=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>',Ee=()=>{const e={next:""},t=({keyword:e,pos:t})=>{const n=new URLSearchParams("media_filter=minimal");return n.set("key","PAY5JLFIH6V6"),n.set("limit","20"),n.set("pos",t||""),n.set("q",e),fetch(`https://g.tenor.com/v1/search?${n.toString()}`,{headers:{"Content-Type":"application/json"}}).then((e=>e.json())).catch((()=>({next:t||"",results:[]})))};return{search:(n="")=>t({keyword:n}).then((t=>(e.next=t.next,t.results.map((e=>({title:e.title,src:e.media[0].tinygif.url})))))),more:n=>t({keyword:n,pos:e.next}).then((t=>(e.next=t.next,t.results.map((e=>({title:e.title,src:e.media[0].tinygif.url}))))))}},Re=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"),ze=["23AC69","91C132","F19726","E8552D","1AAB8E","E1147F","2980C1","1BA1E6","9FA0A0","F19726","E30B20","E30B20","A3338B"],Ae={},Me=e=>{let t=0;return e.replace(Re,((e,n,l)=>{if(l)return`<span style="color: slategray">${l}</span>`;if("<"===n)return"<";let o;Ae[n]?o=Ae[n]:(o=ze[t],Ae[n]=o);const a=`<span style="color: #${o}">${n}</span>`;return t=++t%ze.length,a}))},Ue=["nick","nickError","mail","mailError","link","optional","placeholder","sofa","submit","like","cancelLike","reply","cancelReply","comment","refresh","more","preview","emoji","uploadImage","seconds","minutes","hours","days","now","uploading","login","logout","admin","sticky","word","wordHint","anonymous","level0","level1","level2","level3","level4","level5","gif","gifSearchPlaceholder"],Oe=e=>Object.fromEntries(e.map(((e,t)=>[Ue[t],e])));var Pe=Oe(["NickName","NickName cannot be less than 3 bytes.","E-Mail","Please confirm your email address.","Website","Optional","Comment here...","No comment yet.","Submit","Like","Cancel like","Reply","Cancel reply","Comments","Refresh","Load More...","Preview","Emoji","Upload Image","seconds ago","minutes ago","hours ago","days ago","just now","Uploading","Login","logout","Admin","Sticky","Words","Please input comments between $0 and $1 words!\n Current word number: $2","Anonymous","Dwarves","Hobbits","Ents","Wizards","Elves","Maiar","GIF","Search GIF"]),Te=Oe(["ニックネーム","3バイト以上のニックネームをご入力ください.","メールアドレス","メールアドレスをご確認ください.","サイト","オプション","ここにコメント","コメントしましょう~","提出する","Like","Cancel like","返信する","キャンセル","コメント","更新","さらに読み込む","プレビュー","絵文字","画像をアップロード","秒前","分前","時間前","日前","たっだ今","アップロード","ログインする","ログアウト","管理者","トップに置く","ワード","コメントは $0 から $1 ワードの間でなければなりません!\n 現在の単語番号: $2","匿名","うえにん","なかにん","しもおし","特にしもおし","かげ","なぬし","GIF","探す GIF"]),Ne=Oe(["昵称","昵称不能少于3个字符","邮箱","请填写正确的邮件地址","网址","可选","欢迎评论","来发评论吧~","提交","喜欢","取消喜欢","回复","取消回复","评论","刷新","加载更多...","预览","表情","上传图片","秒前","分钟前","小时前","天前","刚刚","正在上传","登录","退出","博主","置顶","字","评论字数应在 $0 到 $1 字之间!\n当前字数:$2","匿名","潜水","冒泡","吐槽","活跃","话痨","传说","表情包","搜索表情包"]),He=Oe(["暱稱","郵箱","網址","可選","暱稱不能少於3個字元","請填寫正確的郵件地址","歡迎評論","來發評論吧~","提交","喜歡","取消喜歡","回覆","取消回覆","評論","刷新","載入更多...","預覽","表情","上傳圖片","秒前","分鐘前","小時前","天前","剛剛","正在上傳","登錄","退出","博主","置頂","字","評論字數應在 $0 到 $1 字之間!\n當前字數:$2","匿名","潛水","冒泡","吐槽","活躍","話癆","傳說","表情包","搜索表情包"]),Ve=Oe(["Apelido","Apelido não pode ser menor que 3 bytes.","E-Mail","Por favor, confirme seu endereço de e-mail.","Website","Opcional","Comente aqui...","Nenhum comentário, ainda.","Enviar","Like","Cancel like","Responder","Cancelar resposta","Comentários","Refrescar","Carregar Mais...","Visualizar","Emoji","Enviar Imagem","segundos atrás","minutos atrás","horas atrás","dias atrás","agora mesmo","Enviando","Entrar","Sair","Admin","Sticky","Palavras","Favor enviar comentário com $0 a $1 palavras!\n Número de palavras atuais: $2","Anônimo","Dwarves","Hobbits","Ents","Wizards","Elves","Maiar","GIF","Pesquisar GIF"]),_e=Oe(["Псевдоним","Никнейм не может быть меньше 3 байт.","Эл. адрес","Пожалуйста, подтвердите адрес вашей электронной почты.","Веб-сайт","Необязательный","Комментарий здесь...","Пока нет комментариев.","Отправить","Like","Cancel like","Отвечать","Отменить ответ","Комментарии","Обновить","Загрузи больше...","Превью","эмодзи","Загрузить изображение","секунд назад","несколько минут назад","несколько часов назад","дней назад","прямо сейчас","Загрузка","Авторизоваться","Выход из системы","Админ","Липкий","Слова","Пожалуйста, введите комментарии от $0 до $1 слов!\nНомер текущего слова: $2","Анонимный","Dwarves","Hobbits","Ents","Wizards","Elves","Maiar","GIF","Поиск GIF"]);const Fe={zh:Ne,"zh-cn":Ne,"zh-CN":Ne,"zh-tw":He,"zh-TW":He,en:Pe,"en-US":Pe,"en-us":Pe,jp:Te,"jp-jp":Te,"jp-JP":Te,"pt-br":Ve,"pt-BR":Ve,ru:_e,"ru-ru":_e,"ru-RU":_e},De=e=>{try{e=decodeURI(e)}catch(e){}return e},Be=(e="")=>e.replace(/\/$/u,""),We=e=>/^(https?:)?\/\//.test(e),Ge=e=>{const t=Be(e);return We(t)?t:`https://${t}`},qe=e=>Array.isArray(e)?e:!!e&&[0,e],Je=(e,t)=>"function"==typeof e?e:!1!==e&&t,Ke="{--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}",Ye=(e,t)=>{let n=e.toString();for(;n.length<t;)n="0"+n;return n},Ze=(e,t,n)=>{if(!e)return"";const l="string"==typeof e?new Date(-1!==e.indexOf(" ")?e.replace(/-/g,"/"):e):e,o=t.getTime()-l.getTime(),a=Math.floor(o/864e5);if(0===a){const e=o%864e5,t=Math.floor(e/36e5);if(0===t){const t=e%36e5,l=Math.floor(t/6e4);if(0===l){const e=t%6e4;return`${Math.round(e/1e3)} ${n.seconds}`}return`${l} ${n.minutes}`}return`${t} ${n.hours}`}return a<0?n.now:a<8?`${a} ${n.days}`:(e=>{const t=Ye(e.getDate(),2),n=Ye(e.getMonth()+1,2);return`${Ye(e.getFullYear(),2)}-${n}-${t}`})(l)},Xe=e=>{const t=ce("WALINE_EMOJI",{}),n=Boolean(/@[0-9]+\.[0-9]+\.[0-9]+/.test(e));if(n){const n=t.value[e];if(n)return Promise.resolve(n)}return fetch(`${e}/info.json`).then((e=>e.json())).then((l=>{const o={folder:e,...l};return n&&(t.value[e]=o),o}))},Qe=(e,t="",n="",l="")=>`${t?`${t}/`:""}${n}${e}${l?`.${l}`:""}`,et={"Content-Type":"application/json"},tt=({serverURL:e,lang:t,path:n,page:l,pageSize:o,signal:a,token:i})=>{const r={};return i&&(r.Authorization=`Bearer ${i}`),fetch(`${e}/comment?path=${encodeURIComponent(n)}&pageSize=${o}&page=${l}&lang=${t}`,{signal:a,headers:r}).then((e=>e.json())).then((e=>((e,t="")=>{if("object"==typeof e&&e.errno)throw new TypeError(`Fetch ${t} failed with ${e.errno}: ${e.errmsg}`);return e})(e,"comment list")))},nt=({serverURL:e,lang:t,token:n,objectId:l,...o})=>fetch(`${e}/comment/${l}?lang=${t}`,{method:"PUT",headers:{"Content-Type":"application/json",Authorization:`Bearer ${n}`},body:JSON.stringify(o)}).then((e=>e.json())),lt=e=>e.type.includes("image"),ot=e=>{const t=Array.from(e).find(lt);return t?t.getAsFile():null},at=/\$.*?\$/,it=/^\$(.*?)\$/,rt=/^(?:\s{0,3})\$\$((?:[^\n]|\n[^\n])+?)\n{0,1}\$\$/,st=(e="",t={})=>e.replace(/:(.+?):/g,((e,n)=>t[n]?`<img class="wl-emoji" src="${t[n]}" alt="${n}">`:e)),ct=(e,{emojiMap:t,highlighter:n,texRenderer:l})=>{if(P.setOptions({highlight:n||void 0,breaks:!0,smartLists:!0,smartypants:!0}),l){const e=(e=>[{name:"blockMath",level:"block",tokenizer(t){const n=rt.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(at);return-1!==t?t:e.length},tokenizer(t){const n=it.exec(t);if(null!==n)return{type:"html",raw:n[0],text:e(!1,n[1])}}}])(l);P.use({extensions:e})}return P.parse(st(e,t))};let ut=null;const mt=()=>ut||(ut=ce("USER_KEY",{}));let dt=null;const vt=()=>dt||(dt=ce("WALINE_LIKE",[])),pt=c({name:"CommentBox",components:{CloseIcon:({size:e})=>s("svg",{class:"wl-close-icon",viewBox:"0 0 1024 1024",width:e,height:e},[s("path",{d:"M697.173 85.333h-369.92c-144.64 0-241.92 101.547-241.92 252.587v348.587c0 150.613 97.28 252.16 241.92 252.16h369.92c144.64 0 241.494-101.547 241.494-252.16V337.92c0-151.04-96.854-252.587-241.494-252.587z",fill:"currentColor"}),s("path",{d:"m640.683 587.52-75.947-75.861 75.904-75.862a37.29 37.29 0 0 0 0-52.778 37.205 37.205 0 0 0-52.779 0l-75.946 75.818-75.862-75.946a37.419 37.419 0 0 0-52.821 0 37.419 37.419 0 0 0 0 52.821l75.947 75.947-75.776 75.733a37.29 37.29 0 1 0 52.778 52.821l75.776-75.776 75.947 75.947a37.376 37.376 0 0 0 52.779-52.821z",fill:"#888"})]),EmojiIcon:()=>s("svg",{viewBox:"0 0 1024 1024",width:"24",height:"24"},s("path",{d:"M563.2 463.3 677 540c1.7 1.2 3.7 1.8 5.8 1.8.7 0 1.4-.1 2-.2 2.7-.5 5.1-2.1 6.6-4.4l25.3-37.8c1.5-2.3 2.1-5.1 1.6-7.8s-2.1-5.1-4.4-6.6l-73.6-49.1 73.6-49.1c2.3-1.5 3.9-3.9 4.4-6.6.5-2.7 0-5.5-1.6-7.8l-25.3-37.8a10.1 10.1 0 0 0-6.6-4.4c-.7-.1-1.3-.2-2-.2-2.1 0-4.1.6-5.8 1.8l-113.8 76.6c-9.2 6.2-14.7 16.4-14.7 27.5.1 11 5.5 21.3 14.7 27.4zM387 348.8h-45.5c-5.7 0-10.4 4.7-10.4 10.4v153.3c0 5.7 4.7 10.4 10.4 10.4H387c5.7 0 10.4-4.7 10.4-10.4V359.2c0-5.7-4.7-10.4-10.4-10.4zm333.8 241.3-41-20a10.3 10.3 0 0 0-8.1-.5c-2.6.9-4.8 2.9-5.9 5.4-30.1 64.9-93.1 109.1-164.4 115.2-5.7.5-9.9 5.5-9.5 11.2l3.9 45.5c.5 5.3 5 9.5 10.3 9.5h.9c94.8-8 178.5-66.5 218.6-152.7 2.4-5 .3-11.2-4.8-13.6zm186-186.1c-11.9-42-30.5-81.4-55.2-117.1-24.1-34.9-53.5-65.6-87.5-91.2-33.9-25.6-71.5-45.5-111.6-59.2-41.2-14-84.1-21.1-127.8-21.1h-1.2c-75.4 0-148.8 21.4-212.5 61.7-63.7 40.3-114.3 97.6-146.5 165.8-32.2 68.1-44.3 143.6-35.1 218.4 9.3 74.8 39.4 145 87.3 203.3.1.2.3.3.4.5l36.2 38.4c1.1 1.2 2.5 2.1 3.9 2.6 73.3 66.7 168.2 103.5 267.5 103.5 73.3 0 145.2-20.3 207.7-58.7 37.3-22.9 70.3-51.5 98.1-85 27.1-32.7 48.7-69.5 64.2-109.1 15.5-39.7 24.4-81.3 26.6-123.8 2.4-43.6-2.5-87-14.5-129zm-60.5 181.1c-8.3 37-22.8 72-43 104-19.7 31.1-44.3 58.6-73.1 81.7-28.8 23.1-61 41-95.7 53.4-35.6 12.7-72.9 19.1-110.9 19.1-82.6 0-161.7-30.6-222.8-86.2l-34.1-35.8c-23.9-29.3-42.4-62.2-55.1-97.7-12.4-34.7-18.8-71-19.2-107.9-.4-36.9 5.4-73.3 17.1-108.2 12-35.8 30-69.2 53.4-99.1 31.7-40.4 71.1-72 117.2-94.1 44.5-21.3 94-32.6 143.4-32.6 49.3 0 97 10.8 141.8 32 34.3 16.3 65.3 38.1 92 64.8 26.1 26 47.5 56 63.6 89.2 16.2 33.2 26.6 68.5 31 105.1 4.6 37.5 2.7 75.3-5.6 112.3z",fill:"currentColor"})),ImageIcon:()=>s("svg",{viewBox:"0 0 1024 1024",width:"24",height:"24"},[s("path",{d:"M784 112H240c-88 0-160 72-160 160v480c0 88 72 160 160 160h544c88 0 160-72 160-160V272c0-88-72-160-160-160zm96 640c0 52.8-43.2 96-96 96H240c-52.8 0-96-43.2-96-96V272c0-52.8 43.2-96 96-96h544c52.8 0 96 43.2 96 96v480z",fill:"currentColor"}),s("path",{d:"M352 480c52.8 0 96-43.2 96-96s-43.2-96-96-96-96 43.2-96 96 43.2 96 96 96zm0-128c17.6 0 32 14.4 32 32s-14.4 32-32 32-32-14.4-32-32 14.4-32 32-32zm462.4 379.2-3.2-3.2-177.6-177.6c-25.6-25.6-65.6-25.6-91.2 0l-80 80-36.8-36.8c-25.6-25.6-65.6-25.6-91.2 0L200 728c-4.8 6.4-8 14.4-8 24 0 17.6 14.4 32 32 32 9.6 0 16-3.2 22.4-9.6L380.8 640l134.4 134.4c6.4 6.4 14.4 9.6 24 9.6 17.6 0 32-14.4 32-32 0-9.6-4.8-17.6-9.6-24l-52.8-52.8 80-80L769.6 776c6.4 4.8 12.8 8 20.8 8 17.6 0 32-14.4 32-32 0-8-3.2-16-8-20.8z",fill:"currentColor"})]),ImageWall:$e,MarkdownIcon:()=>s("svg",{width:"16",height:"16",ariaHidden:"true"},s("path",{d:"M14.85 3H1.15C.52 3 0 3.52 0 4.15v7.69C0 12.48.52 13 1.15 13h13.69c.64 0 1.15-.52 1.15-1.15v-7.7C16 3.52 15.48 3 14.85 3zM9 11H7V8L5.5 9.92 4 8v3H2V5h2l1.5 2L7 5h2v6zm2.99.5L9.5 8H11V5h2v3h1.5l-2.51 3.5z",fill:"currentColor"})),PreviewIcon:()=>s("svg",{viewBox:"0 0 1024 1024",width:"24",height:"24"},[s("path",{d:"M710.816 654.301c70.323-96.639 61.084-230.578-23.705-314.843-46.098-46.098-107.183-71.109-172.28-71.109-65.008 0-126.092 25.444-172.28 71.109-45.227 46.098-70.756 107.183-70.756 172.106 0 64.923 25.444 126.007 71.194 172.106 46.099 46.098 107.184 71.109 172.28 71.109 51.414 0 100.648-16.212 142.824-47.404l126.53 126.006c7.058 7.06 16.297 10.979 26.406 10.979 10.105 0 19.343-3.919 26.402-10.979 14.467-14.467 14.467-38.172 0-52.723L710.816 654.301zm-315.107-23.265c-65.88-65.88-65.88-172.54 0-238.42 32.069-32.07 74.245-49.149 119.471-49.149 45.227 0 87.407 17.603 119.472 49.149 65.88 65.879 65.88 172.539 0 238.42-63.612 63.178-175.242 63.178-238.943 0zm0 0",fill:"currentColor"}),s("path",{d:"M703.319 121.603H321.03c-109.8 0-199.469 89.146-199.469 199.38v382.034c0 109.796 89.236 199.38 199.469 199.38h207.397c20.653 0 37.384-16.645 37.384-37.299 0-20.649-16.731-37.296-37.384-37.296H321.03c-68.582 0-124.352-55.77-124.352-124.267V321.421c0-68.496 55.77-124.267 124.352-124.267h382.289c68.582 0 124.352 55.771 124.352 124.267V524.72c0 20.654 16.736 37.299 37.385 37.299 20.654 0 37.384-16.645 37.384-37.299V320.549c-.085-109.8-89.321-198.946-199.121-198.946zm0 0",fill:"currentColor"})]),LoadingIcon:ye,GifIcon:()=>s("svg",{width:24,height:24,fill:"currentcolor",viewBox:"0 0 24 24"},[s("path",{style:"transform: translateY(0.5px)",d:"M18.968 10.5H15.968V11.484H17.984V12.984H15.968V15H14.468V9H18.968V10.5V10.5ZM8.984 9C9.26533 9 9.49967 9.09367 9.687 9.281C9.87433 9.46833 9.968 9.70267 9.968 9.984V10.5H6.499V13.5H8.468V12H9.968V14.016C9.968 14.2973 9.87433 14.5317 9.687 14.719C9.49967 14.9063 9.26533 15 8.984 15H5.984C5.70267 15 5.46833 14.9063 5.281 14.719C5.09367 14.5317 5 14.2973 5 14.016V9.985C5 9.70367 5.09367 9.46933 5.281 9.282C5.46833 9.09467 5.70267 9.001 5.984 9.001H8.984V9ZM11.468 9H12.968V15H11.468V9V9Z"}),s("path",{d:"M18.5 3H5.75C3.6875 3 2 4.6875 2 6.75V18C2 20.0625 3.6875 21.75 5.75 21.75H18.5C20.5625 21.75 22.25 20.0625 22.25 18V6.75C22.25 4.6875 20.5625 3 18.5 3ZM20.75 18C20.75 19.2375 19.7375 20.25 18.5 20.25H5.75C4.5125 20.25 3.5 19.2375 3.5 18V6.75C3.5 5.5125 4.5125 4.5 5.75 4.5H18.5C19.7375 4.5 20.75 5.5125 20.75 6.75V18Z"})])},props:{rootId:{type:String,default:""},replyId:{type:String,default:""},replyUser:{type:String,default:""}},emits:["submit","cancel-reply"],setup(e,{emit:t}){const l=I("config"),a=ce("WALINE_COMMENT_BOX_EDITOR",""),i=ce("WALINE_USER_META",{nick:"",mail:"",link:""}),r=mt(),s=o({}),c=o(null),m=o(null),d=o(null),v=o(null),p=o(null),g=o(null),f=o(null),h=o({tabs:[],map:{}}),w=o(0),y=o(!1),b=o(!1),k=o(!1),L=o(""),S=o(0),j=$({loading:!0,list:[]}),E=o(0),R=o(!1),z=o(""),A=o(!1),M=C((()=>l.value.locale)),U=C((()=>Boolean(r.value?.token))),P=C((()=>!1!==l.value.imageUploader)),T=e=>{const t=c.value,n=t.selectionStart,l=t.selectionEnd||0,o=t.scrollTop;a.value=t.value.substring(0,n)+e+t.value.substring(l,t.value.length),t.focus(),t.selectionStart=n+e.length,t.selectionEnd=n+e.length,t.scrollTop=o},N=e=>{const t=`![${l.value.locale.uploading} ${e.name}]()`;return T(t),Promise.resolve().then((()=>l.value.imageUploader(e))).then((n=>{a.value=a.value.replace(t,`\r\n![${e.name}](${n})`)}))},H=()=>{const{serverURL:n,lang:o,login:u,wordLimit:m,requiredMeta:d}=l.value,v={comment:z.value,nick:i.value.nick,mail:i.value.mail,link:i.value.link,ua:navigator.userAgent,url:l.value.path};if(r.value?.token)v.nick=r.value.display_name,v.mail=r.value.email,v.link=r.value.url;else{if("force"===u)return;if(d.indexOf("nick")>-1&&!v.nick)return s.value.nick?.focus(),alert(M.value.nickError);if(d.indexOf("mail")>-1&&!v.mail||v.mail&&!/^\w(?:[\w._-]*\w)?@(?:\w(?:[\w-]*\w)?\.)*\w+$/.exec(v.mail))return s.value.mail?.focus(),alert(M.value.mailError);if(!v.comment)return void c.value?.focus();v.nick||(v.nick=M.value.anonymous)}if(!R.value)return alert(M.value.wordHint.replace("$0",m[0].toString()).replace("$1",m[1].toString()).replace("$2",S.value.toString()));v.comment=st(v.comment,h.value.map),e.replyId&&e.rootId&&(v.pid=e.replyId,v.rid=e.rootId,v.at=e.replyUser),A.value=!0,(({serverURL:e,lang:t,token:n,comment:l})=>{const o={"Content-Type":"application/json"};return n&&(o.Authorization=`Bearer ${n}`),fetch(`${e}/comment?lang=${t}`,{method:"POST",headers:o,body:JSON.stringify(l)}).then((e=>e.json()))})({serverURL:n,lang:o,token:r.value?.token,comment:v}).then((n=>{if(A.value=!1,n.errmsg)return alert(n.errmsg);t("submit",n.data),a.value="",L.value="",e.replyId&&t("cancel-reply")})).catch((e=>{A.value=!1,alert(e.message)}))},V=e=>{d.value.contains(e.target)||v.value.contains(e.target)||(y.value=!1),p.value.contains(e.target)||g.value.contains(e.target)||(b.value=!1)},_=async e=>{const{scrollTop:t,clientHeight:n,scrollHeight:o}=e.target,a=(n+t)/o,i=l.value.search,r=f.value?.value||"";a<.9||j.loading||(j.loading=!0,j.list.push(...i.more?await i.more(r,j.list.length):await i.search(r)),j.loading=!1,setTimeout((()=>{e.target.scrollTop=t}),50))},F=D((e=>{j.list=[],_(e)}),300);return n([l,S],(([e,t])=>{const{wordLimit:n}=e;n?t<n[0]&&0!==n[0]?(E.value=n[0],R.value=!1):t>n[1]?(E.value=n[1],R.value=!1):(E.value=n[1],R.value=!0):(E.value=0,R.value=!0)}),{immediate:!0}),n(b,(async e=>{if(!e)return;const t=l.value.search;f.value&&(f.value.value=""),j.loading=!0,j.list=t.default?await t.default():await t.search(""),j.loading=!1})),u((()=>{document.body.addEventListener("click",V),n((()=>a.value),(e=>{const{highlighter:t,texRenderer:n}=l.value;z.value=e,L.value=ct(e,{emojiMap:h.value.map,highlighter:t,texRenderer:n}),S.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?O(c.value):O.destroy(c.value)}),{immediate:!0}),n((()=>l.value.emoji),(e=>{return(t=Array.isArray(e)?e:[],Promise.all(t.map((e=>"string"==typeof e?Xe(Be(e)):Promise.resolve(e)))).then((e=>{const t={tabs:[],map:{}};return e.forEach((e=>{const{name:n,folder:l,icon:o,prefix:a,type:i,items:r}=e;t.tabs.push({name:n,icon:Qe(o,l,a,i),items:r.map((e=>{const n=`${a||""}${e}`;return t.map[n]=Qe(e,l,a,i),n}))})})),t}))).then((e=>{h.value=e}));var t}),{immediate:!0})})),x((()=>{document.body.removeEventListener("click",V)})),{config:l,locale:M,insert:T,onChange:()=>{const e=m.value;e.files&&P.value&&N(e.files[0]).then((()=>{e.value=""}))},onDrop:e=>{if(e.dataTransfer?.items){const t=ot(e.dataTransfer.items);t&&P.value&&(N(t),e.preventDefault())}},onKeyDown:e=>{const t=e.key;(e.ctrlKey||e.metaKey)&&"Enter"===t&&H()},onPaste:e=>{if(e.clipboardData){const t=ot(e.clipboardData.items);t&&P.value&&N(t)}},onLogin:e=>{e.preventDefault();const{lang:t,serverURL:n}=l.value,o=(window.innerWidth-450)/2,a=(window.innerHeight-450)/2,i=window.open(`${n}/ui/login?lng=${encodeURIComponent(t)}`,"_blank",`width=450,height=450,left=${o},top=${a},scrollbars=no,resizable=no,status=no,location=no,toolbar=no,menubar=no`);i?.postMessage({type:"TOKEN",data:null},"*");const s=({data:e})=>{e&&"userInfo"===e.type&&e.data.token&&(i?.close(),r.value=e.data,(e.data.remember?localStorage:sessionStorage).setItem("WALINE_USER",JSON.stringify(e.data)),window.removeEventListener("message",s))};window.addEventListener("message",s)},onLogout:()=>{r.value={},localStorage.setItem("WALINE_USER","null"),sessionStorage.setItem("WALINE_USER","null")},onProfile:e=>{e.preventDefault();const{lang:t,serverURL:n}=l.value,o=(window.innerWidth-800)/2,a=(window.innerHeight-800)/2;window.open(`${n}/ui/profile?lng=${encodeURIComponent(t)}`,"_blank",`width=800,height=800,left=${o},top=${a},scrollbars=no,resizable=no,status=no,location=no,toolbar=no,menubar=no`)?.postMessage({type:"TOKEN",data:r.value.token},"*");const i=({data:e})=>{e&&"profile"===e.type&&(r.value={...r.value,...e},[localStorage,sessionStorage].filter((e=>e.getItem("WALINE_USER"))).forEach((e=>e.setItem("WALINE_USER",JSON.stringify(r)))),window.removeEventListener("message",i))};window.addEventListener("message",i)},submitComment:H,onImageWallScroll:_,onGifSearch:F,isLogin:U,userInfo:r,isSubmitting:A,wordNumber:S,wordLimit:E,isWordNumberLegal:R,editor:a,userMeta:i,emoji:h,emojiTabIndex:w,showEmoji:y,gifData:j,showGif:b,canUploadImage:P,previewText:L,showPreview:k,inputRefs:s,editorRef:c,emojiButtonRef:d,emojiPopupRef:v,gifButtonRef:p,gifPopupRef:g,imageUploadRef:m,gifSearchInputRef:f}}}),gt={class:"wl-comment"},ft={key:0,class:"wl-login-info"},ht={class:"wl-avatar"},wt=["title"],yt=["src"],bt=["textContent"],kt={class:"wl-panel"},Ct=["for","textContent"],It=["id","name","type","onUpdate:modelValue"],$t=["placeholder"],xt={class:"wl-preview"},Lt=b("hr",null,null,-1),St=["innerHTML"],jt={class:"wl-footer"},Et={class:"wl-actions"},Rt={href:"https://guides.github.com/features/mastering-markdown/",title:"Markdown Guide","aria-label":"Markdown is supported",class:"wl-action",target:"_blank",rel:"noreferrer"},zt=["title"],At=["title"],Mt=["title"],Ut=["title"],Ot={class:"wl-info"},Pt={class:"wl-text-number"},Tt={key:0},Nt=M(" / "),Ht=["textContent"],Vt=["textContent"],_t=["disabled"],Ft=["placeholder"],Dt={key:0,class:"wl-loading"},Bt={key:0,class:"wl-tab-wrapper"},Wt=["title","onClick"],Gt=["src","alt"],qt={key:0,class:"wl-tabs"},Jt=["onClick"],Kt=["src","alt","title"],Yt=["title"];var Zt=be(pt,[["render",function(e,t,n,l,o,a){const i=d("CloseIcon"),r=d("MarkdownIcon"),s=d("EmojiIcon"),c=d("GifIcon"),u=d("ImageIcon"),m=d("PreviewIcon"),g=d("LoadingIcon"),k=d("ImageWall");return v(),p("div",gt,["disable"!==e.config.login&&e.isLogin?(v(),p("div",ft,[b("div",ht,[b("button",{class:"wl-logout-btn",title:e.locale.logout,onClick:t[0]||(t[0]=(...t)=>e.onLogout&&e.onLogout(...t))},[L(i,{size:14})],8,wt),b("img",{src:e.userInfo.avatar,alt:"avatar"},null,8,yt)]),b("a",{href:"#",class:"wl-login-nick","aria-label":"Profile",onClick:t[1]||(t[1]=(...t)=>e.onProfile&&e.onProfile(...t)),textContent:S(e.userInfo.display_name)},null,8,bt)])):y("v-if",!0),b("div",kt,["force"!==e.config.login&&e.config.meta.length&&!e.isLogin?(v(),p("div",{key:0,class:j(["wl-header",`item${e.config.meta.length}`])},[(v(!0),p(f,null,h(e.config.meta,(t=>(v(),p("div",{class:"wl-header-item",key:t},[b("label",{for:t,textContent:S(e.locale[t]+(e.config.requiredMeta.includes(t)||!e.config.requiredMeta.length?"":`(${e.locale.optional})`))},null,8,Ct),E(b("input",{ref_for:!0,ref:n=>{n&&(e.inputRefs[t]=n)},id:`wl-${t}`,class:j(["wl-input",`wl-${t}`]),name:t,type:"mail"===t?"email":"text","onUpdate:modelValue":n=>e.userMeta[t]=n},null,10,It),[[R,e.userMeta[t]]])])))),128))],2)):y("v-if",!0),E(b("textarea",{class:"wl-editor",ref:"editorRef",id:"wl-edit",placeholder:e.replyUser?`@${e.replyUser}`:e.locale.placeholder,"onUpdate:modelValue":t[2]||(t[2]=t=>e.editor=t),onKeydown:t[3]||(t[3]=(...t)=>e.onKeyDown&&e.onKeyDown(...t)),onDrop:t[4]||(t[4]=(...t)=>e.onDrop&&e.onDrop(...t)),onPaste:t[5]||(t[5]=(...t)=>e.onPaste&&e.onPaste(...t))},null,40,$t),[[z,e.editor]]),E(b("div",xt,[Lt,b("h4",null,S(e.locale.preview)+":",1),b("div",{class:"wl-content",innerHTML:e.previewText},null,8,St)],512),[[A,e.showPreview]]),b("div",jt,[b("div",Et,[b("a",Rt,[L(r)]),E(b("button",{ref:"emojiButtonRef",class:j(["wl-action",{actived:e.showEmoji}]),title:e.locale.emoji,onClick:t[6]||(t[6]=t=>e.showEmoji=!e.showEmoji)},[L(s)],10,zt),[[A,e.emoji.tabs.length]]),e.config.search?(v(),p("button",{key:0,ref:"gifButtonRef",class:j(["wl-action",{actived:e.showGif}]),title:e.locale.gif,onClick:t[7]||(t[7]=t=>e.showGif=!e.showGif)},[L(c)],10,At)):y("v-if",!0),b("input",{ref:"imageUploadRef",class:"upload",id:"wl-image-upload",type:"file",accept:".png,.jpg,.jpeg,.webp,.bmp,.gif",onChange:t[8]||(t[8]=(...t)=>e.onChange&&e.onChange(...t))},null,544),e.canUploadImage?(v(),p("label",{key:1,for:"wl-image-upload",class:"wl-action",title:e.locale.uploadImage},[L(u)],8,Mt)):y("v-if",!0),b("button",{class:j(["wl-action",{actived:e.showPreview}]),title:e.locale.preview,onClick:t[9]||(t[9]=t=>e.showPreview=!e.showPreview)},[L(m)],10,Ut)]),b("div",Ot,[b("div",Pt,[M(S(e.wordNumber)+" ",1),e.config.wordLimit?(v(),p("span",Tt,[Nt,b("span",{class:j({illegal:!e.isWordNumberLegal}),textContent:S(e.wordLimit)},null,10,Ht)])):y("v-if",!0),M(" "+S(e.locale.word),1)]),"disable"===e.config.login||e.isLogin?y("v-if",!0):(v(),p("button",{key:0,class:"wl-btn",onClick:t[10]||(t[10]=(...t)=>e.onLogin&&e.onLogin(...t)),textContent:S(e.locale.login)},null,8,Vt)),"force"!==e.config.login||e.isLogin?(v(),p("button",{key:1,class:"wl-btn primary",title:"Cmd|Ctrl + Enter",disabled:e.isSubmitting,onClick:t[11]||(t[11]=(...t)=>e.submitComment&&e.submitComment(...t))},[e.isSubmitting?(v(),w(g,{key:0,size:16})):(v(),p(f,{key:1},[M(S(e.locale.submit),1)],64))],8,_t)):y("v-if",!0)]),b("div",{ref:"gifPopupRef",class:j(["wl-gif-popup",{display:e.showGif}])},[b("input",{type:"text",placeholder:e.locale.gifSearchPlaceholder,ref:"gifSearchInputRef",onInput:t[12]||(t[12]=(...t)=>e.onGifSearch&&e.onGifSearch(...t))},null,40,Ft),L(k,{items:e.gifData.list,"column-width":200,gap:6,onInsert:t[13]||(t[13]=t=>e.insert(t)),onScroll:e.onImageWallScroll},null,8,["items","onScroll"]),e.gifData.loading?(v(),p("div",Dt,[L(g,{size:30})])):y("v-if",!0)],2),b("div",{ref:"emojiPopupRef",class:j(["wl-emoji-popup",{display:e.showEmoji}])},[(v(!0),p(f,null,h(e.emoji.tabs,((t,n)=>(v(),p(f,{key:t.name},[n===e.emojiTabIndex?(v(),p("div",Bt,[(v(!0),p(f,null,h(t.items,(t=>(v(),p("button",{key:t,title:t,onClick:n=>e.insert(`:${t}:`)},[e.showEmoji?(v(),p("img",{key:0,class:"wl-emoji",src:e.emoji.map[t],alt:t,loading:"lazy",referrerPolicy:"no-referrer"},null,8,Gt)):y("v-if",!0)],8,Wt)))),128))])):y("v-if",!0)],64)))),128)),e.emoji.tabs.length>1?(v(),p("div",qt,[(v(!0),p(f,null,h(e.emoji.tabs,((t,n)=>(v(),p("button",{key:t.name,class:j(["wl-tab",{active:e.emojiTabIndex===n}]),onClick:t=>e.emojiTabIndex=n},[b("img",{class:"wl-emoji",src:t.icon,alt:t.name,title:t.name,loading:"lazy",referrerPolicy:"no-referrer"},null,8,Kt)],10,Jt)))),128))])):y("v-if",!0)],2)])]),e.replyId?(v(),p("button",{key:1,class:"wl-close",title:e.locale.cancelReply,onClick:t[14]||(t[14]=t=>e.$emit("cancel-reply"))},[L(i,{size:24})],8,Yt)):y("v-if",!0)])}],["__file","CommentBox.vue"]]);const Xt=["approved","waiting","spam"],Qt=c({props:{comment:{type:Object,required:!0},rootId:{type:String,required:!0},reply:{type:Object}},components:{CommentBox:Zt,DeleteIcon:()=>s("svg",{viewBox:"0 0 1024 1024",width:"24",height:"24"},s("path",{d:"m341.013 394.667 27.755 393.45h271.83l27.733-393.45h64.106l-28.01 397.952a64 64 0 0 1-63.83 59.498H368.768a64 64 0 0 1-63.83-59.52l-28.053-397.93h64.128zm139.307 19.818v298.667h-64V414.485h64zm117.013 0v298.667h-64V414.485h64zM181.333 288h640v64h-640v-64zm453.483-106.667v64h-256v-64h256z",fill:"red"})),LikeIcon:({active:e=!1})=>s("svg",{viewBox:"0 0 1024 1024",width:"24",height:"24"},[s("path",{d:"M850.654 323.804c-11.042-25.625-26.862-48.532-46.885-68.225-20.022-19.61-43.258-34.936-69.213-45.73-26.78-11.124-55.124-16.727-84.375-16.727-40.622 0-80.256 11.123-114.698 32.135A214.79 214.79 0 0 0 512 241.819a214.79 214.79 0 0 0-23.483-16.562c-34.442-21.012-74.076-32.135-114.698-32.135-29.25 0-57.595 5.603-84.375 16.727-25.872 10.711-49.19 26.12-69.213 45.73-20.105 19.693-35.843 42.6-46.885 68.225-11.453 26.615-17.303 54.877-17.303 83.963 0 27.439 5.603 56.03 16.727 85.117 9.31 24.307 22.659 49.52 39.715 74.981 27.027 40.293 64.188 82.316 110.33 124.915 76.465 70.615 152.189 119.394 155.402 121.371l19.528 12.525c8.652 5.52 19.776 5.52 28.427 0l19.529-12.525c3.213-2.06 78.854-50.756 155.401-121.371 46.143-42.6 83.304-84.622 110.33-124.915 17.057-25.46 30.487-50.674 39.716-74.981 11.124-29.087 16.727-57.678 16.727-85.117.082-29.086-5.768-57.348-17.221-83.963z"+(e?"":"M512 761.5S218.665 573.55 218.665 407.767c0-83.963 69.461-152.023 155.154-152.023 60.233 0 112.473 33.618 138.181 82.727 25.708-49.109 77.948-82.727 138.18-82.727 85.694 0 155.155 68.06 155.155 152.023C805.335 573.551 512 761.5 512 761.5z"),fill:e?"red":"currentColor"})]),ReplyIcon:()=>s("svg",{viewBox:"0 0 1024 1024",width:"24",height:"24"},s("path",{d:"M810.667 213.333a64 64 0 0 1 64 64V704a64 64 0 0 1-64 64H478.336l-146.645 96.107a21.333 21.333 0 0 1-33.024-17.856V768h-85.334a64 64 0 0 1-64-64V277.333a64 64 0 0 1 64-64h597.334zm0 64H213.333V704h149.334v63.296L459.243 704h351.424V277.333zm-271.36 213.334v64h-176.64v-64h176.64zm122.026-128v64H362.667v-64h298.666z",fill:"currentColor"})),VerifiedIcon:()=>s("svg",{class:"verified-icon",viewBox:"0 0 1024 1024",width:"14",height:"14"},s("path",{d:"m894.4 461.56-54.4-63.2c-10.4-12-18.8-34.4-18.8-50.4v-68c0-42.4-34.8-77.2-77.2-77.2h-68c-15.6 0-38.4-8.4-50.4-18.8l-63.2-54.4c-27.6-23.6-72.8-23.6-100.8 0l-62.8 54.8c-12 10-34.8 18.4-50.4 18.4h-69.2c-42.4 0-77.2 34.8-77.2 77.2v68.4c0 15.6-8.4 38-18.4 50l-54 63.6c-23.2 27.6-23.2 72.4 0 100l54 63.6c10 12 18.4 34.4 18.4 50v68.4c0 42.4 34.8 77.2 77.2 77.2h69.2c15.6 0 38.4 8.4 50.4 18.8l63.2 54.4c27.6 23.6 72.8 23.6 100.8 0l63.2-54.4c12-10.4 34.4-18.8 50.4-18.8h68c42.4 0 77.2-34.8 77.2-77.2v-68c0-15.6 8.4-38.4 18.8-50.4l54.4-63.2c23.2-27.6 23.2-73.2-.4-100.8zm-216-25.2-193.2 193.2a30 30 0 0 1-42.4 0l-96.8-96.8a30.16 30.16 0 0 1 0-42.4c11.6-11.6 30.8-11.6 42.4 0l75.6 75.6 172-172c11.6-11.6 30.8-11.6 42.4 0 11.6 11.6 11.6 30.8 0 42.4z",fill:"#27ae60"}))},emits:["submit","reply","like","delete","status","sticky"],setup(e){const t=I("config"),n=vt(),l=mt(),o=C((()=>t.value.locale)),a=C((()=>{let{link:t}=e.comment;return t?We(t)?t:`https://${t}`:""})),i=C((()=>n.value.includes(e.comment.objectId))),r=((e,t)=>{const n=he();return C((()=>Ze(e,n.value,t)))})(e.comment.insertedAt,o.value),s=C((()=>"administrator"===l.value.type)),c=C((()=>e.comment.user_id&&l.value.objectId===e.comment.user_id)),u=C((()=>e.comment.objectId===e.reply?.objectId));return{config:t,locale:o,isReplyingCurrent:u,link:a,like:i,time:r,isAdmin:s,isOwner:c,commentStatus:Xt}}}),en=["id"],tn={class:"wl-user","aria-hidden":"true"},nn=["src"],ln={class:"wl-card"},on={class:"wl-head"},an=["href"],rn={key:1,class:"wl-nick"},sn=["textContent"],cn=["textContent"],un=["textContent"],mn=["textContent"],dn=["textContent"],vn={class:"wl-comment-actions"},pn=["title"],gn=["textContent"],fn=["title"],hn={class:"wl-meta","aria-hidden":"true"},wn=["textContent"],yn=["textContent"],bn=["textContent"],kn=["innerHTML"],Cn={key:0,class:"wl-admin-actions"},In={class:"wl-comment-status"},$n=["disabled","onClick","textContent"],xn={key:1,class:"wl-reply-wrapper"},Ln={key:2,class:"wl-quote"};const Sn=c({name:"WalineRoot",components:{CommentBox:Zt,CommentCard:be(Qt,[["render",function(e,t,n,l,o,a){const i=d("VerifiedIcon"),r=d("DeleteIcon"),s=d("LikeIcon"),c=d("ReplyIcon"),u=d("CommentBox"),m=d("CommentCard",!0);return v(),p("div",{class:"wl-item",id:e.comment.objectId},[b("div",tn,[e.comment.avatar?(v(),p("img",{key:0,src:e.comment.avatar},null,8,nn)):y("v-if",!0),e.comment.type?(v(),w(i,{key:1})):y("v-if",!0)]),b("div",ln,[b("div",on,[e.link?(v(),p("a",{key:0,class:"wl-nick",href:e.link,target:"_blank",rel:"nofollow noreferrer"},S(e.comment.nick),9,an)):(v(),p("span",rn,S(e.comment.nick),1)),"administrator"===e.comment.type?(v(),p("span",{key:2,class:"wl-badge",textContent:S(e.locale.admin)},null,8,sn)):y("v-if",!0),e.comment.label?(v(),p("span",{key:3,class:"wl-badge",textContent:S(e.comment.label)},null,8,cn)):y("v-if",!0),e.comment.sticky?(v(),p("span",{key:4,class:"wl-badge",textContent:S(e.locale.sticky)},null,8,un)):y("v-if",!0),void 0!==e.comment.level&&e.comment.level>=0?(v(),p("span",{key:5,class:j(`wl-badge level${e.comment.level}`),textContent:S(e.locale[`level${e.comment.level}`]||`Level ${e.comment.level}`)},null,10,mn)):y("v-if",!0),b("span",{class:"wl-time",textContent:S(e.time)},null,8,dn),b("div",vn,[e.isAdmin||e.isOwner?(v(),p("button",{key:0,class:"wl-delete",onClick:t[0]||(t[0]=t=>e.$emit("delete",e.comment))},[L(r)])):y("v-if",!0),b("button",{class:"wl-like",onClick:t[1]||(t[1]=t=>e.$emit("like",e.comment)),title:e.like?e.locale.cancelLike:e.locale.like},[L(s,{active:e.like},null,8,["active"]),"like"in e.comment?(v(),p("span",{key:0,textContent:S(e.comment.like)},null,8,gn)):y("v-if",!0)],8,pn),b("button",{class:j(["wl-reply",{active:e.isReplyingCurrent}]),title:e.isReplyingCurrent?e.locale.cancelReply:e.locale.reply,onClick:t[2]||(t[2]=t=>e.$emit("reply",e.isReplyingCurrent?null:e.comment))},[L(c)],10,fn)])]),b("div",hn,[e.comment.addr?(v(),p("span",{key:0,textContent:S(e.comment.addr)},null,8,wn)):y("v-if",!0),e.comment.browser?(v(),p("span",{key:1,textContent:S(e.comment.browser)},null,8,yn)):y("v-if",!0),e.comment.os?(v(),p("span",{key:2,textContent:S(e.comment.os)},null,8,bn)):y("v-if",!0)]),b("div",{class:"wl-content",innerHTML:e.comment.comment},null,8,kn),e.isAdmin?(v(),p("div",Cn,[b("span",In,[(v(!0),p(f,null,h(e.commentStatus,(t=>(v(),p("button",{key:t,class:j(`wl-btn wl-${t}`),disabled:e.comment.status===t,onClick:n=>e.$emit("status",{status:t,comment:e.comment}),textContent:S(t)},null,10,$n)))),128))]),e.isAdmin&&!e.comment.rid?(v(),p("button",{key:0,class:"wl-btn wl-sticky",onClick:t[3]||(t[3]=t=>e.$emit("sticky",e.comment))},S(e.comment.sticky?"unsticky":"sticky"),1)):y("v-if",!0)])):y("v-if",!0),e.isReplyingCurrent?(v(),p("div",xn,[L(u,{replyId:e.comment.objectId,replyUser:e.comment.nick,rootId:e.rootId,onSubmit:t[4]||(t[4]=t=>e.$emit("submit",t)),onCancelReply:t[5]||(t[5]=t=>e.$emit("reply",null))},null,8,["replyId","replyUser","rootId"])])):y("v-if",!0),e.comment.children?(v(),p("div",Ln,[(v(!0),p(f,null,h(e.comment.children,(n=>(v(),w(m,{key:n.objectId,comment:n,reply:e.reply,rootId:e.rootId,onReply:t[6]||(t[6]=t=>e.$emit("reply",t)),onSubmit:t[7]||(t[7]=t=>e.$emit("submit",t)),onLike:t[8]||(t[8]=t=>e.$emit("like",t)),onDelete:t[9]||(t[9]=t=>e.$emit("delete",t)),onStatus:t[10]||(t[10]=t=>e.$emit("status",t)),onSticky:t[11]||(t[11]=t=>e.$emit("sticky",t))},null,8,["comment","reply","rootId"])))),128))])):y("v-if",!0)])],8,en)}],["__file","CommentCard.vue"]]),LoadingIcon:ye},props:["serverURL","path","meta","requiredMeta","dark","lang","locale","pageSize","wordLimit","emoji","login","highlighter","texRenderer","imageUploader","copyright"],setup(e){const t=C((()=>(({serverURL:e,path:t=location.pathname,lang:n="zh-CN",locale:l,emoji:o=["//unpkg.com/@waline/emojis@1.0.1/weibo"],meta:a=["nick","mail","link"],requiredMeta:i=[],dark:r=!1,pageSize:s=10,wordLimit:c,imageUploader:u,highlighter:m,texRenderer:d,copyright:v=!0,login:p="enable",search:g=Ee(),...f})=>({serverURL:Ge(e),path:De(t),locale:{...Fe[n]||Fe["zh-CN"],..."object"==typeof l?l:{}},wordLimit:qe(c),meta:Le(a),requiredMeta:Le(i),imageUploader:Je(u,Se),highlighter:Je(m,Me),texRenderer:Je(d,je),lang:n,dark:r,emoji:o,pageSize:s,login:p,copyright:v,search:g,...f}))(e))),l=mt(),a=vt(),r=o("loading"),s=o(0),c=o(1),m=o(0),d=o([]),v=o(null),p=C((()=>{return"string"==typeof(e=t.value.dark)?"auto"===e?`@media(prefers-color-scheme:dark){body${Ke}}`:`${e}${Ke}`:!0===e?`:root${Ke}`:"";var e}));let g;!function(e,t={}){const l=o(!1),{document:a=le,immediate:r=!0,manual:s=!1,id:c="vueuse_styletag_"+ ++we}=t,u=o(e);let m=()=>{};const d=()=>{if(!a)return;const e=a.getElementById(c)||a.createElement("style");e.type="text/css",e.id=c,t.media&&(e.media=t.media),a.head.appendChild(e),l.value||(m=n(u,(t=>{e.innerText=t}),{immediate:!0}),l.value=!0)},v=()=>{a&&l.value&&(m(),a.head.removeChild(a.getElementById(c)),l.value=!1)};r&&!s&&d(),s||T(v),i(l)}(p);const f=e=>{const{serverURL:n,path:o,pageSize:a}=t.value,i=new AbortController;r.value="loading",g?.(),tt({serverURL:n,lang:t.value.lang,path:o,pageSize:a,page:e,signal:i.signal,token:l.value?.token}).then((t=>{r.value="success",s.value=t.count,d.value.push(...t.data),c.value=e,m.value=t.totalPages})).catch((e=>{"AbortError"!==e.name&&(console.error(e.message),r.value="error")})),g=i.abort.bind(i)},h=()=>{s.value=0,d.value=[],f(1)};return U("config",t),n((()=>e.path),h),u((()=>h())),{config:t,darkmodeStyle:p,i18n:C((()=>t.value.locale)),status:r,count:s,page:c,totalPages:m,data:d,reply:v,loadMore:()=>f(c.value+1),refresh:h,onReply:e=>{v.value=e},onSubmit:e=>{if(e.rid){const t=d.value.find((({objectId:t})=>t===e.rid));if(!t)return;Array.isArray(t.children)||(t.children=[]),t.children.push(e)}else d.value.unshift(e)},onStatusChange:async({comment:e,status:n})=>{if(e.status===n)return;const{serverURL:o,lang:a}=t.value;await nt({serverURL:o,lang:a,token:l.value?.token,objectId:e.objectId,status:n}),e.status=n},onDelete:async({objectId:e})=>{if(!confirm("Are you sure you want to delete this comment?"))return;const{serverURL:n,lang:o}=t.value;await(({serverURL:e,lang:t,token:n,objectId:l})=>fetch(`${e}/comment/${l}?lang=${t}`,{method:"DELETE",headers:{Authorization:`Bearer ${n}`}}).then((e=>e.json())))({serverURL:n,lang:o,token:l.value?.token,objectId:e}),d.value.some(((t,n)=>t.objectId===e?(d.value=d.value.filter(((e,t)=>t!==n)),!0):t.children.some(((l,o)=>l.objectId===e&&(d.value[n].children=t.children.filter(((e,t)=>t!==o)),!0)))))},onSticky:async e=>{if(e.rid)return;const{serverURL:n,lang:o}=t.value;await nt({serverURL:n,lang:o,token:l.value?.token,objectId:e.objectId,sticky:e.sticky?0:1}),e.sticky=!e.sticky},onLike:async e=>{const{serverURL:n,lang:l}=t.value,{objectId:o}=e,i=a.value.includes(o);await(({serverURL:e,lang:t,objectId:n,like:l})=>fetch(`${e}/comment/${n}?lang=${t}`,{method:"PUT",headers:et,body:JSON.stringify({like:l})}).then((e=>e.json())))({serverURL:n,lang:l,objectId:o,like:!i}),i?a.value=a.value.filter((e=>e!==o)):(a.value=[...a.value,o],a.value.length>50&&(a.value=a.value.slice(-50))),e.like=(e.like||0)+(i?-1:1)},version:"2.6.0"}}}),jn={"data-waline":""},En={class:"wl-count"},Rn=["textContent"],zn={class:"wl-cards"},An={key:1,class:"wl-operation"},Mn=["textContent"],Un={key:0,class:"wl-loading"},On=["textContent"],Pn={class:"wl-operation"},Tn=["textContent"],Nn={key:3,class:"wl-power"},Hn=M(" Powered by "),Vn=b("a",{href:"https://github.com/walinejs/waline",target:"_blank",rel:"noreferrer"}," Waline ",-1);var _n=be(Sn,[["render",function(e,t,n,l,o,a){const i=d("CommentBox"),r=d("CommentCard"),s=d("LoadingIcon");return v(),p("div",jn,[e.reply?y("v-if",!0):(v(),w(i,{key:0,onSubmit:e.onSubmit},null,8,["onSubmit"])),b("div",En,[e.count?(v(),p("span",{key:0,class:"wl-num",textContent:S(e.count)},null,8,Rn)):y("v-if",!0),M(" "+S(e.i18n.comment),1)]),b("div",zn,[(v(!0),p(f,null,h(e.data,(t=>(v(),w(r,{key:t.objectId,"root-id":t.objectId,comment:t,reply:e.reply,onReply:e.onReply,onSubmit:e.onSubmit,onStatus:e.onStatusChange,onDelete:e.onDelete,onSticky:e.onSticky,onLike:e.onLike},null,8,["root-id","comment","reply","onReply","onSubmit","onStatus","onDelete","onSticky","onLike"])))),128))]),"error"===e.status?(v(),p("div",An,[b("button",{type:"button",class:"wl-btn",onClick:t[0]||(t[0]=(...t)=>e.refresh&&e.refresh(...t)),textContent:S(e.i18n.refresh)},null,8,Mn)])):(v(),p(f,{key:2},["loading"===e.status?(v(),p("div",Un,[L(s,{size:30})])):e.data.length?e.page<e.totalPages?(v(),p(f,{key:2},[y(" Load more button "),b("div",Pn,[b("button",{type:"button",class:"wl-btn",onClick:t[1]||(t[1]=(...t)=>e.loadMore&&e.loadMore(...t)),textContent:S(e.i18n.more)},null,8,Tn)])],2112)):y("v-if",!0):(v(),p("div",{key:1,class:"wl-empty",textContent:S(e.i18n.sofa)},null,8,On))],64)),y(" Copyright Information "),e.config.copyright?(v(),p("div",Nn,[Hn,Vn,M(" v"+S(e.version),1)])):y("v-if",!0)])}],["__file","Waline.vue"]]);const Fn="2.6.0";export{_n as Waline,Fn as version}; | ||
import{getCurrentScope as e,onScopeDispose as t,watch as n,unref as l,ref as o,isRef as a,readonly as i,shallowRef as r,h as s,defineComponent as c,onMounted as u,onBeforeUnmount as m,resolveComponent as d,openBlock as v,createElementBlock as p,normalizeStyle as g,Fragment as f,renderList as h,createBlock as w,createCommentVNode as y,createElementVNode as b,nextTick as k,computed as C,inject as I,reactive as $,onUnmounted as x,createVNode as L,toDisplayString as S,normalizeClass as j,withDirectives as E,vModelDynamic as R,vModelText as z,vShow as A,createTextVNode as M,provide as U}from"vue";import O from"autosize";import{marked as P}from"marked";function T(n){return!!e()&&(t(n),!0)}var N;const H="undefined"!=typeof window,V=()=>{};function _(e,t){return function(...n){e((()=>t.apply(this,n)),{fn:t,thisArg:this,args:n})}}H&&(null==(N=null==window?void 0:window.navigator)?void 0:N.userAgent)&&/iP(ad|hone|od)/.test(window.navigator.userAgent);const F=e=>e();function D(e,t=200,n={}){return _(function(e,t={}){let n,o;return a=>{const i=l(e),r=l(t.maxWait);if(n&&clearTimeout(n),i<=0||void 0!==r&&r<=0)return o&&(clearTimeout(o),o=null),a();r&&!o&&(o=setTimeout((()=>{n&&clearTimeout(n),o=null,a()}),r)),n=setTimeout((()=>{o&&clearTimeout(o),o=null,a()}),i)}}(t,n),e)}var B=Object.getOwnPropertySymbols,W=Object.prototype.hasOwnProperty,G=Object.prototype.propertyIsEnumerable;function q(e,t,l={}){const o=l,{eventFilter:a=F}=o,i=((e,t)=>{var n={};for(var l in e)W.call(e,l)&&t.indexOf(l)<0&&(n[l]=e[l]);if(null!=e&&B)for(var l of B(e))t.indexOf(l)<0&&G.call(e,l)&&(n[l]=e[l]);return n})(o,["eventFilter"]);return n(e,_(a,t),i)}var J=Object.defineProperty,K=Object.defineProperties,Y=Object.getOwnPropertyDescriptors,Z=Object.getOwnPropertySymbols,X=Object.prototype.hasOwnProperty,Q=Object.prototype.propertyIsEnumerable,ee=(e,t,n)=>t in e?J(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;function te(e,t,n={}){const l=n,{eventFilter:a}=l,i=((e,t)=>{var n={};for(var l in e)X.call(e,l)&&t.indexOf(l)<0&&(n[l]=e[l]);if(null!=e&&Z)for(var l of Z(e))t.indexOf(l)<0&&Q.call(e,l)&&(n[l]=e[l]);return n})(l,["eventFilter"]),{eventFilter:r,pause:s,resume:c,isActive:u}=function(e=F){const t=o(!0);return{isActive:t,pause:function(){t.value=!1},resume:function(){t.value=!0},eventFilter:(...n)=>{t.value&&e(...n)}}}(a),m=q(e,t,(d=((e,t)=>{for(var n in t||(t={}))X.call(t,n)&&ee(e,n,t[n]);if(Z)for(var n of Z(t))Q.call(t,n)&&ee(e,n,t[n]);return e})({},i),K(d,Y({eventFilter:r}))));var d;return{stop:m,pause:s,resume:c,isActive:u}}const ne=H?window:void 0,le=H?window.document:void 0;function oe(...e){let t,o,a,i;if("string"==typeof e[0]?([o,a,i]=e,t=ne):[t,o,a,i]=e,!t)return V;let r=V;const s=n((()=>function(e){var t;const n=l(e);return null!=(t=null==n?void 0:n.$el)?t:n}(t)),(e=>{r(),e&&(e.addEventListener(o,a,i),r=()=>{e.removeEventListener(o,a,i),r=V})}),{immediate:!0,flush:"post"}),c=()=>{s(),r()};return T(c),c}H&&window.navigator,H&&window.location;const ae="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},ie="__vueuse_ssr_handlers__";ae[ie]=ae[ie]||{};const re=ae[ie];const se={boolean:{read:e=>"true"===e,write:e=>String(e)},object:{read:e=>JSON.parse(e),write:e=>JSON.stringify(e)},number:{read:e=>Number.parseFloat(e),write:e=>String(e)},any:{read:e=>e,write:e=>String(e)},string:{read:e=>e,write:e=>String(e)},map:{read:e=>new Map(JSON.parse(e)),write:e=>JSON.stringify(Array.from(e.entries()))},set:{read:e=>new Set(JSON.parse(e)),write:e=>JSON.stringify(Array.from(e))},date:{read:e=>new Date(e),write:e=>e.toISOString()}};function ce(e,t,n,a={}){var i;const{flush:s="pre",deep:c=!0,listenToStorageChanges:u=!0,writeDefaults:m=!0,shallow:d,window:v=ne,eventFilter:p,onError:g=(e=>{console.error(e)})}=a,f=(d?r:o)(t);if(!n)try{n=function(e,t){return re[e]||t}("getDefaultStorage",(()=>{var e;return null==(e=ne)?void 0:e.localStorage}))()}catch(e){g(e)}if(!n)return f;const h=l(t),w=function(e){return null==e?"any":e instanceof Set?"set":e instanceof Map?"map":e instanceof Date?"date":"boolean"==typeof e?"boolean":"string"==typeof e?"string":"object"==typeof e||Array.isArray(e)?"object":Number.isNaN(e)?"any":"number"}(h),y=null!=(i=a.serializer)?i:se[w],{pause:b,resume:k}=te(f,(()=>function(t){try{null==t?n.removeItem(e):n.setItem(e,y.write(t))}catch(e){g(e)}}(f.value)),{flush:s,deep:c,eventFilter:p});return v&&u&&oe(v,"storage",C),C(),f;function C(t){t&&t.key!==e||(f.value=function(t){if(!t||t.key===e){b();try{const l=t?t.newValue:n.getItem(e);return null==l?(m&&null!==h&&n.setItem(e,y.write(h)),h):"string"!=typeof l?l:y.read(l)}catch(e){g(e)}finally{k()}}}(t))}}var ue,me,de=Object.defineProperty,ve=Object.getOwnPropertySymbols,pe=Object.prototype.hasOwnProperty,ge=Object.prototype.propertyIsEnumerable,fe=(e,t,n)=>t in e?de(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;function he(e={}){const{controls:t=!1,interval:i="requestAnimationFrame"}=e,r=o(new Date),s=()=>r.value=new Date,c="requestAnimationFrame"===i?function(e,t={}){const{immediate:n=!0,window:l=ne}=t,a=o(!1);let i=null;function r(){a.value&&l&&(e(),i=l.requestAnimationFrame(r))}function s(){!a.value&&l&&(a.value=!0,r())}function c(){a.value=!1,null!=i&&l&&(l.cancelAnimationFrame(i),i=null)}return n&&s(),T(c),{isActive:a,pause:c,resume:s}}(s,{immediate:!0}):function(e,t=1e3,i={}){const{immediate:r=!0,immediateCallback:s=!1}=i;let c=null;const u=o(!1);function m(){c&&(clearInterval(c),c=null)}function d(){u.value=!1,m()}function v(){l(t)<=0||(u.value=!0,s&&e(),m(),c=setInterval(e,l(t)))}r&&H&&v(),a(t)&&T(n(t,(()=>{r&&H&&v()})));return T(d),{isActive:u,pause:d,resume:v}}(s,i,{immediate:!0});return t?((e,t)=>{for(var n in t||(t={}))pe.call(t,n)&&fe(e,n,t[n]);if(ve)for(var n of ve(t))ge.call(t,n)&&fe(e,n,t[n]);return e})({now:r},c):r}(me=ue||(ue={})).UP="UP",me.RIGHT="RIGHT",me.DOWN="DOWN",me.LEFT="LEFT",me.NONE="NONE";let we=0;const ye=({size:e})=>s("svg",{width:e,height:e,viewBox:"0 0 100 100",preserveAspectRatio:"xMidYMid"},s("circle",{cx:50,cy:50,fill:"none",stroke:"currentColor",strokeWidth:"4",r:"40","stroke-dasharray":"85 30"},s("animateTransform",{attributeName:"transform",type:"rotate",repeatCount:"indefinite",dur:"1s",values:"0 50 50;360 50 50",keyTimes:"0;1"})));var be=(e,t)=>{const n=e.__vccOpts||e;for(const[e,l]of t)n[e]=l;return n};const ke=c({name:"ImageWall",components:{LoadingIcon:ye},props:{items:{type:Array,default:()=>[]},columnWidth:{type:Number,default:300},gap:{type:Number,default:0}},emit:["insert"],setup(e){let t=null;const l=o(null),a=o({}),i=o([]),r=()=>{const t=Math.floor((l.value.getBoundingClientRect().width+e.gap)/(e.columnWidth+e.gap));return t>0?t:1},s=async t=>{if(t>=e.items.length)return;await k();const n=Array.from(l.value?.children||[]).reduce(((e,t)=>t.getBoundingClientRect().height<e.getBoundingClientRect().height?t:e));i.value[Number(n.dataset.index)].push(t),await s(t+1)},c=async(e=!1)=>{if(i.value.length===r()&&!e)return;var t;i.value=(t=r(),new Array(t).fill(null).map((()=>[])));const n=window.scrollY;await s(0),window.scrollTo({top:n})};return n((()=>[e.items]),(()=>{a.value={},c(!0)})),n((()=>[e.columnWidth,e.gap]),(()=>c())),u((()=>{c(!0),t=new ResizeObserver((()=>c())),t.observe(l.value)})),m((()=>t.unobserve(l.value))),{columns:i,state:a,wall:l}}}),Ce=["data-index"],Ie=["src","title","onLoad","onClick"];var $e=be(ke,[["render",function(e,t,n,l,o,a){const i=d("LoadingIcon");return v(),p("div",{ref:"wall",class:"wl-gallery",style:g({gap:`${e.gap}px`})},[(v(!0),p(f,null,h(e.columns,((t,n)=>(v(),p("div",{key:n,class:"wl-gallery-column","data-index":n,style:g({gap:`${e.gap}px`})},[(v(!0),p(f,null,h(t,(t=>(v(),p(f,{key:t},[e.state[e.items[t].src]?y("v-if",!0):(v(),w(i,{key:0,size:36,style:{margin:"20px auto"}})),b("img",{class:"wl-gallery-item",src:e.items[t].src,title:e.items[t].title,loading:"lazy",onLoad:n=>e.state[e.items[t].src]=!0,onClick:n=>e.$emit("insert",`![](${e.items[t].src})`)},null,40,Ie)],64)))),128))],12,Ce)))),128))],4)}],["__file","ImageWall.vue"]]);const xe=["nick","mail","link"],Le=e=>e.filter((e=>xe.includes(e))),Se=e=>new Promise(((t,n)=>{const l=new FileReader;l.readAsDataURL(e),l.onload=()=>t(l.result?.toString()||""),l.onerror=n})),je=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>',Ee=()=>{const e={next:""},t=({keyword:e,pos:t})=>{const n=new URLSearchParams("media_filter=minimal");return n.set("key","PAY5JLFIH6V6"),n.set("limit","20"),n.set("pos",t||""),n.set("q",e),fetch(`https://g.tenor.com/v1/search?${n.toString()}`,{headers:{"Content-Type":"application/json"}}).then((e=>e.json())).catch((()=>({next:t||"",results:[]})))};return{search:(n="")=>t({keyword:n}).then((t=>(e.next=t.next,t.results.map((e=>({title:e.title,src:e.media[0].tinygif.url})))))),more:n=>t({keyword:n,pos:e.next}).then((t=>(e.next=t.next,t.results.map((e=>({title:e.title,src:e.media[0].tinygif.url}))))))}},Re=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"),ze=["23AC69","91C132","F19726","E8552D","1AAB8E","E1147F","2980C1","1BA1E6","9FA0A0","F19726","E30B20","E30B20","A3338B"],Ae={},Me=e=>{let t=0;return e.replace(Re,((e,n,l)=>{if(l)return`<span style="color: slategray">${l}</span>`;if("<"===n)return"<";let o;Ae[n]?o=Ae[n]:(o=ze[t],Ae[n]=o);const a=`<span style="color: #${o}">${n}</span>`;return t=++t%ze.length,a}))},Ue=["nick","nickError","mail","mailError","link","optional","placeholder","sofa","submit","like","cancelLike","reply","cancelReply","comment","refresh","more","preview","emoji","uploadImage","seconds","minutes","hours","days","now","uploading","login","logout","admin","sticky","word","wordHint","anonymous","level0","level1","level2","level3","level4","level5","gif","gifSearchPlaceholder"],Oe=e=>Object.fromEntries(e.map(((e,t)=>[Ue[t],e])));var Pe=Oe(["NickName","NickName cannot be less than 3 bytes.","E-Mail","Please confirm your email address.","Website","Optional","Comment here...","No comment yet.","Submit","Like","Cancel like","Reply","Cancel reply","Comments","Refresh","Load More...","Preview","Emoji","Upload Image","seconds ago","minutes ago","hours ago","days ago","just now","Uploading","Login","logout","Admin","Sticky","Words","Please input comments between $0 and $1 words!\n Current word number: $2","Anonymous","Dwarves","Hobbits","Ents","Wizards","Elves","Maiar","GIF","Search GIF"]),Te=Oe(["ニックネーム","3バイト以上のニックネームをご入力ください.","メールアドレス","メールアドレスをご確認ください.","サイト","オプション","ここにコメント","コメントしましょう~","提出する","Like","Cancel like","返信する","キャンセル","コメント","更新","さらに読み込む","プレビュー","絵文字","画像をアップロード","秒前","分前","時間前","日前","たっだ今","アップロード","ログインする","ログアウト","管理者","トップに置く","ワード","コメントは $0 から $1 ワードの間でなければなりません!\n 現在の単語番号: $2","匿名","うえにん","なかにん","しもおし","特にしもおし","かげ","なぬし","GIF","探す GIF"]),Ne=Oe(["昵称","昵称不能少于3个字符","邮箱","请填写正确的邮件地址","网址","可选","欢迎评论","来发评论吧~","提交","喜欢","取消喜欢","回复","取消回复","评论","刷新","加载更多...","预览","表情","上传图片","秒前","分钟前","小时前","天前","刚刚","正在上传","登录","退出","博主","置顶","字","评论字数应在 $0 到 $1 字之间!\n当前字数:$2","匿名","潜水","冒泡","吐槽","活跃","话痨","传说","表情包","搜索表情包"]),He=Oe(["暱稱","郵箱","網址","可選","暱稱不能少於3個字元","請填寫正確的郵件地址","歡迎評論","來發評論吧~","提交","喜歡","取消喜歡","回覆","取消回覆","評論","刷新","載入更多...","預覽","表情","上傳圖片","秒前","分鐘前","小時前","天前","剛剛","正在上傳","登錄","退出","博主","置頂","字","評論字數應在 $0 到 $1 字之間!\n當前字數:$2","匿名","潛水","冒泡","吐槽","活躍","話癆","傳說","表情包","搜索表情包"]),Ve=Oe(["Apelido","Apelido não pode ser menor que 3 bytes.","E-Mail","Por favor, confirme seu endereço de e-mail.","Website","Opcional","Comente aqui...","Nenhum comentário, ainda.","Enviar","Like","Cancel like","Responder","Cancelar resposta","Comentários","Refrescar","Carregar Mais...","Visualizar","Emoji","Enviar Imagem","segundos atrás","minutos atrás","horas atrás","dias atrás","agora mesmo","Enviando","Entrar","Sair","Admin","Sticky","Palavras","Favor enviar comentário com $0 a $1 palavras!\n Número de palavras atuais: $2","Anônimo","Dwarves","Hobbits","Ents","Wizards","Elves","Maiar","GIF","Pesquisar GIF"]),_e=Oe(["Псевдоним","Никнейм не может быть меньше 3 байт.","Эл. адрес","Пожалуйста, подтвердите адрес вашей электронной почты.","Веб-сайт","Необязательный","Комментарий здесь...","Пока нет комментариев.","Отправить","Like","Cancel like","Отвечать","Отменить ответ","Комментарии","Обновить","Загрузи больше...","Превью","эмодзи","Загрузить изображение","секунд назад","несколько минут назад","несколько часов назад","дней назад","прямо сейчас","Загрузка","Авторизоваться","Выход из системы","Админ","Липкий","Слова","Пожалуйста, введите комментарии от $0 до $1 слов!\nНомер текущего слова: $2","Анонимный","Dwarves","Hobbits","Ents","Wizards","Elves","Maiar","GIF","Поиск GIF"]);const Fe={zh:Ne,"zh-cn":Ne,"zh-CN":Ne,"zh-tw":He,"zh-TW":He,en:Pe,"en-US":Pe,"en-us":Pe,jp:Te,"jp-jp":Te,"jp-JP":Te,"pt-br":Ve,"pt-BR":Ve,ru:_e,"ru-ru":_e,"ru-RU":_e},De=e=>{try{e=decodeURI(e)}catch(e){}return e},Be=(e="")=>e.replace(/\/$/u,""),We=e=>/^(https?:)?\/\//.test(e),Ge=e=>{const t=Be(e);return We(t)?t:`https://${t}`},qe=e=>Array.isArray(e)?e:!!e&&[0,e],Je=(e,t)=>"function"==typeof e?e:!1!==e&&t,Ke="{--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}",Ye=(e,t)=>{let n=e.toString();for(;n.length<t;)n="0"+n;return n},Ze=(e,t,n)=>{if(!e)return"";const l="string"==typeof e?new Date(-1!==e.indexOf(" ")?e.replace(/-/g,"/"):e):e,o=t.getTime()-l.getTime(),a=Math.floor(o/864e5);if(0===a){const e=o%864e5,t=Math.floor(e/36e5);if(0===t){const t=e%36e5,l=Math.floor(t/6e4);if(0===l){const e=t%6e4;return`${Math.round(e/1e3)} ${n.seconds}`}return`${l} ${n.minutes}`}return`${t} ${n.hours}`}return a<0?n.now:a<8?`${a} ${n.days}`:(e=>{const t=Ye(e.getDate(),2),n=Ye(e.getMonth()+1,2);return`${Ye(e.getFullYear(),2)}-${n}-${t}`})(l)},Xe=e=>{const t=ce("WALINE_EMOJI",{}),n=Boolean(/@[0-9]+\.[0-9]+\.[0-9]+/.test(e));if(n){const n=t.value[e];if(n)return Promise.resolve(n)}return fetch(`${e}/info.json`).then((e=>e.json())).then((l=>{const o={folder:e,...l};return n&&(t.value[e]=o),o}))},Qe=(e,t="",n="",l="")=>`${t?`${t}/`:""}${n}${e}${l?`.${l}`:""}`,et={"Content-Type":"application/json"},tt=({serverURL:e,lang:t,path:n,page:l,pageSize:o,signal:a,token:i})=>{const r={};return i&&(r.Authorization=`Bearer ${i}`),fetch(`${e}/comment?path=${encodeURIComponent(n)}&pageSize=${o}&page=${l}&lang=${t}`,{signal:a,headers:r}).then((e=>e.json())).then((e=>((e,t="")=>{if("object"==typeof e&&e.errno)throw new TypeError(`Fetch ${t} failed with ${e.errno}: ${e.errmsg}`);return e})(e,"comment list")))},nt=({serverURL:e,lang:t,token:n,objectId:l,...o})=>fetch(`${e}/comment/${l}?lang=${t}`,{method:"PUT",headers:{"Content-Type":"application/json",Authorization:`Bearer ${n}`},body:JSON.stringify(o)}).then((e=>e.json())),lt=e=>e.type.includes("image"),ot=e=>{const t=Array.from(e).find(lt);return t?t.getAsFile():null},at=/\$.*?\$/,it=/^\$(.*?)\$/,rt=/^(?:\s{0,3})\$\$((?:[^\n]|\n[^\n])+?)\n{0,1}\$\$/,st=(e="",t={})=>e.replace(/:(.+?):/g,((e,n)=>t[n]?`<img class="wl-emoji" src="${t[n]}" alt="${n}">`:e)),ct=(e,{emojiMap:t,highlighter:n,texRenderer:l})=>{if(P.setOptions({highlight:n||void 0,breaks:!0,smartLists:!0,smartypants:!0}),l){const e=(e=>[{name:"blockMath",level:"block",tokenizer(t){const n=rt.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(at);return-1!==t?t:e.length},tokenizer(t){const n=it.exec(t);if(null!==n)return{type:"html",raw:n[0],text:e(!1,n[1])}}}])(l);P.use({extensions:e})}return P.parse(st(e,t))};let ut=null;const mt=()=>ut||(ut=ce("USER_KEY",{}));let dt=null;const vt=()=>dt||(dt=ce("WALINE_LIKE",[])),pt=c({name:"CommentBox",components:{CloseIcon:({size:e})=>s("svg",{class:"wl-close-icon",viewBox:"0 0 1024 1024",width:e,height:e},[s("path",{d:"M697.173 85.333h-369.92c-144.64 0-241.92 101.547-241.92 252.587v348.587c0 150.613 97.28 252.16 241.92 252.16h369.92c144.64 0 241.494-101.547 241.494-252.16V337.92c0-151.04-96.854-252.587-241.494-252.587z",fill:"currentColor"}),s("path",{d:"m640.683 587.52-75.947-75.861 75.904-75.862a37.29 37.29 0 0 0 0-52.778 37.205 37.205 0 0 0-52.779 0l-75.946 75.818-75.862-75.946a37.419 37.419 0 0 0-52.821 0 37.419 37.419 0 0 0 0 52.821l75.947 75.947-75.776 75.733a37.29 37.29 0 1 0 52.778 52.821l75.776-75.776 75.947 75.947a37.376 37.376 0 0 0 52.779-52.821z",fill:"#888"})]),EmojiIcon:()=>s("svg",{viewBox:"0 0 1024 1024",width:"24",height:"24"},s("path",{d:"M563.2 463.3 677 540c1.7 1.2 3.7 1.8 5.8 1.8.7 0 1.4-.1 2-.2 2.7-.5 5.1-2.1 6.6-4.4l25.3-37.8c1.5-2.3 2.1-5.1 1.6-7.8s-2.1-5.1-4.4-6.6l-73.6-49.1 73.6-49.1c2.3-1.5 3.9-3.9 4.4-6.6.5-2.7 0-5.5-1.6-7.8l-25.3-37.8a10.1 10.1 0 0 0-6.6-4.4c-.7-.1-1.3-.2-2-.2-2.1 0-4.1.6-5.8 1.8l-113.8 76.6c-9.2 6.2-14.7 16.4-14.7 27.5.1 11 5.5 21.3 14.7 27.4zM387 348.8h-45.5c-5.7 0-10.4 4.7-10.4 10.4v153.3c0 5.7 4.7 10.4 10.4 10.4H387c5.7 0 10.4-4.7 10.4-10.4V359.2c0-5.7-4.7-10.4-10.4-10.4zm333.8 241.3-41-20a10.3 10.3 0 0 0-8.1-.5c-2.6.9-4.8 2.9-5.9 5.4-30.1 64.9-93.1 109.1-164.4 115.2-5.7.5-9.9 5.5-9.5 11.2l3.9 45.5c.5 5.3 5 9.5 10.3 9.5h.9c94.8-8 178.5-66.5 218.6-152.7 2.4-5 .3-11.2-4.8-13.6zm186-186.1c-11.9-42-30.5-81.4-55.2-117.1-24.1-34.9-53.5-65.6-87.5-91.2-33.9-25.6-71.5-45.5-111.6-59.2-41.2-14-84.1-21.1-127.8-21.1h-1.2c-75.4 0-148.8 21.4-212.5 61.7-63.7 40.3-114.3 97.6-146.5 165.8-32.2 68.1-44.3 143.6-35.1 218.4 9.3 74.8 39.4 145 87.3 203.3.1.2.3.3.4.5l36.2 38.4c1.1 1.2 2.5 2.1 3.9 2.6 73.3 66.7 168.2 103.5 267.5 103.5 73.3 0 145.2-20.3 207.7-58.7 37.3-22.9 70.3-51.5 98.1-85 27.1-32.7 48.7-69.5 64.2-109.1 15.5-39.7 24.4-81.3 26.6-123.8 2.4-43.6-2.5-87-14.5-129zm-60.5 181.1c-8.3 37-22.8 72-43 104-19.7 31.1-44.3 58.6-73.1 81.7-28.8 23.1-61 41-95.7 53.4-35.6 12.7-72.9 19.1-110.9 19.1-82.6 0-161.7-30.6-222.8-86.2l-34.1-35.8c-23.9-29.3-42.4-62.2-55.1-97.7-12.4-34.7-18.8-71-19.2-107.9-.4-36.9 5.4-73.3 17.1-108.2 12-35.8 30-69.2 53.4-99.1 31.7-40.4 71.1-72 117.2-94.1 44.5-21.3 94-32.6 143.4-32.6 49.3 0 97 10.8 141.8 32 34.3 16.3 65.3 38.1 92 64.8 26.1 26 47.5 56 63.6 89.2 16.2 33.2 26.6 68.5 31 105.1 4.6 37.5 2.7 75.3-5.6 112.3z",fill:"currentColor"})),ImageIcon:()=>s("svg",{viewBox:"0 0 1024 1024",width:"24",height:"24"},[s("path",{d:"M784 112H240c-88 0-160 72-160 160v480c0 88 72 160 160 160h544c88 0 160-72 160-160V272c0-88-72-160-160-160zm96 640c0 52.8-43.2 96-96 96H240c-52.8 0-96-43.2-96-96V272c0-52.8 43.2-96 96-96h544c52.8 0 96 43.2 96 96v480z",fill:"currentColor"}),s("path",{d:"M352 480c52.8 0 96-43.2 96-96s-43.2-96-96-96-96 43.2-96 96 43.2 96 96 96zm0-128c17.6 0 32 14.4 32 32s-14.4 32-32 32-32-14.4-32-32 14.4-32 32-32zm462.4 379.2-3.2-3.2-177.6-177.6c-25.6-25.6-65.6-25.6-91.2 0l-80 80-36.8-36.8c-25.6-25.6-65.6-25.6-91.2 0L200 728c-4.8 6.4-8 14.4-8 24 0 17.6 14.4 32 32 32 9.6 0 16-3.2 22.4-9.6L380.8 640l134.4 134.4c6.4 6.4 14.4 9.6 24 9.6 17.6 0 32-14.4 32-32 0-9.6-4.8-17.6-9.6-24l-52.8-52.8 80-80L769.6 776c6.4 4.8 12.8 8 20.8 8 17.6 0 32-14.4 32-32 0-8-3.2-16-8-20.8z",fill:"currentColor"})]),ImageWall:$e,MarkdownIcon:()=>s("svg",{width:"16",height:"16",ariaHidden:"true"},s("path",{d:"M14.85 3H1.15C.52 3 0 3.52 0 4.15v7.69C0 12.48.52 13 1.15 13h13.69c.64 0 1.15-.52 1.15-1.15v-7.7C16 3.52 15.48 3 14.85 3zM9 11H7V8L5.5 9.92 4 8v3H2V5h2l1.5 2L7 5h2v6zm2.99.5L9.5 8H11V5h2v3h1.5l-2.51 3.5z",fill:"currentColor"})),PreviewIcon:()=>s("svg",{viewBox:"0 0 1024 1024",width:"24",height:"24"},[s("path",{d:"M710.816 654.301c70.323-96.639 61.084-230.578-23.705-314.843-46.098-46.098-107.183-71.109-172.28-71.109-65.008 0-126.092 25.444-172.28 71.109-45.227 46.098-70.756 107.183-70.756 172.106 0 64.923 25.444 126.007 71.194 172.106 46.099 46.098 107.184 71.109 172.28 71.109 51.414 0 100.648-16.212 142.824-47.404l126.53 126.006c7.058 7.06 16.297 10.979 26.406 10.979 10.105 0 19.343-3.919 26.402-10.979 14.467-14.467 14.467-38.172 0-52.723L710.816 654.301zm-315.107-23.265c-65.88-65.88-65.88-172.54 0-238.42 32.069-32.07 74.245-49.149 119.471-49.149 45.227 0 87.407 17.603 119.472 49.149 65.88 65.879 65.88 172.539 0 238.42-63.612 63.178-175.242 63.178-238.943 0zm0 0",fill:"currentColor"}),s("path",{d:"M703.319 121.603H321.03c-109.8 0-199.469 89.146-199.469 199.38v382.034c0 109.796 89.236 199.38 199.469 199.38h207.397c20.653 0 37.384-16.645 37.384-37.299 0-20.649-16.731-37.296-37.384-37.296H321.03c-68.582 0-124.352-55.77-124.352-124.267V321.421c0-68.496 55.77-124.267 124.352-124.267h382.289c68.582 0 124.352 55.771 124.352 124.267V524.72c0 20.654 16.736 37.299 37.385 37.299 20.654 0 37.384-16.645 37.384-37.299V320.549c-.085-109.8-89.321-198.946-199.121-198.946zm0 0",fill:"currentColor"})]),LoadingIcon:ye,GifIcon:()=>s("svg",{width:24,height:24,fill:"currentcolor",viewBox:"0 0 24 24"},[s("path",{style:"transform: translateY(0.5px)",d:"M18.968 10.5H15.968V11.484H17.984V12.984H15.968V15H14.468V9H18.968V10.5V10.5ZM8.984 9C9.26533 9 9.49967 9.09367 9.687 9.281C9.87433 9.46833 9.968 9.70267 9.968 9.984V10.5H6.499V13.5H8.468V12H9.968V14.016C9.968 14.2973 9.87433 14.5317 9.687 14.719C9.49967 14.9063 9.26533 15 8.984 15H5.984C5.70267 15 5.46833 14.9063 5.281 14.719C5.09367 14.5317 5 14.2973 5 14.016V9.985C5 9.70367 5.09367 9.46933 5.281 9.282C5.46833 9.09467 5.70267 9.001 5.984 9.001H8.984V9ZM11.468 9H12.968V15H11.468V9V9Z"}),s("path",{d:"M18.5 3H5.75C3.6875 3 2 4.6875 2 6.75V18C2 20.0625 3.6875 21.75 5.75 21.75H18.5C20.5625 21.75 22.25 20.0625 22.25 18V6.75C22.25 4.6875 20.5625 3 18.5 3ZM20.75 18C20.75 19.2375 19.7375 20.25 18.5 20.25H5.75C4.5125 20.25 3.5 19.2375 3.5 18V6.75C3.5 5.5125 4.5125 4.5 5.75 4.5H18.5C19.7375 4.5 20.75 5.5125 20.75 6.75V18Z"})])},props:{rootId:{type:String,default:""},replyId:{type:String,default:""},replyUser:{type:String,default:""}},emits:["submit","cancel-reply"],setup(e,{emit:t}){const l=I("config"),a=ce("WALINE_COMMENT_BOX_EDITOR",""),i=ce("WALINE_USER_META",{nick:"",mail:"",link:""}),r=mt(),s=o({}),c=o(null),m=o(null),d=o(null),v=o(null),p=o(null),g=o(null),f=o(null),h=o({tabs:[],map:{}}),w=o(0),y=o(!1),b=o(!1),k=o(!1),L=o(""),S=o(0),j=$({loading:!0,list:[]}),E=o(0),R=o(!1),z=o(""),A=o(!1),M=C((()=>l.value.locale)),U=C((()=>Boolean(r.value?.token))),P=C((()=>!1!==l.value.imageUploader)),T=e=>{const t=c.value,n=t.selectionStart,l=t.selectionEnd||0,o=t.scrollTop;a.value=t.value.substring(0,n)+e+t.value.substring(l,t.value.length),t.focus(),t.selectionStart=n+e.length,t.selectionEnd=n+e.length,t.scrollTop=o},N=e=>{const t=`![${l.value.locale.uploading} ${e.name}]()`;return T(t),Promise.resolve().then((()=>l.value.imageUploader(e))).then((n=>{a.value=a.value.replace(t,`\r\n![${e.name}](${n})`)}))},H=()=>{const{serverURL:n,lang:o,login:u,wordLimit:m,requiredMeta:d}=l.value,v={comment:z.value,nick:i.value.nick,mail:i.value.mail,link:i.value.link,ua:navigator.userAgent,url:l.value.path};if(r.value?.token)v.nick=r.value.display_name,v.mail=r.value.email,v.link=r.value.url;else{if("force"===u)return;if(d.indexOf("nick")>-1&&!v.nick)return s.value.nick?.focus(),alert(M.value.nickError);if(d.indexOf("mail")>-1&&!v.mail||v.mail&&!/^\w(?:[\w._-]*\w)?@(?:\w(?:[\w-]*\w)?\.)*\w+$/.exec(v.mail))return s.value.mail?.focus(),alert(M.value.mailError);if(!v.comment)return void c.value?.focus();v.nick||(v.nick=M.value.anonymous)}if(!R.value)return alert(M.value.wordHint.replace("$0",m[0].toString()).replace("$1",m[1].toString()).replace("$2",S.value.toString()));v.comment=st(v.comment,h.value.map),e.replyId&&e.rootId&&(v.pid=e.replyId,v.rid=e.rootId,v.at=e.replyUser),A.value=!0,(({serverURL:e,lang:t,token:n,comment:l})=>{const o={"Content-Type":"application/json"};return n&&(o.Authorization=`Bearer ${n}`),fetch(`${e}/comment?lang=${t}`,{method:"POST",headers:o,body:JSON.stringify(l)}).then((e=>e.json()))})({serverURL:n,lang:o,token:r.value?.token,comment:v}).then((n=>{if(A.value=!1,n.errmsg)return alert(n.errmsg);t("submit",n.data),a.value="",L.value="",e.replyId&&t("cancel-reply")})).catch((e=>{A.value=!1,alert(e.message)}))},V=e=>{d.value.contains(e.target)||v.value.contains(e.target)||(y.value=!1),p.value.contains(e.target)||g.value.contains(e.target)||(b.value=!1)},_=async e=>{const{scrollTop:t,clientHeight:n,scrollHeight:o}=e.target,a=(n+t)/o,i=l.value.search,r=f.value?.value||"";a<.9||j.loading||(j.loading=!0,j.list.push(...i.more?await i.more(r,j.list.length):await i.search(r)),j.loading=!1,setTimeout((()=>{e.target.scrollTop=t}),50))},F=D((e=>{j.list=[],_(e)}),300);return n([l,S],(([e,t])=>{const{wordLimit:n}=e;n?t<n[0]&&0!==n[0]?(E.value=n[0],R.value=!1):t>n[1]?(E.value=n[1],R.value=!1):(E.value=n[1],R.value=!0):(E.value=0,R.value=!0)}),{immediate:!0}),n(b,(async e=>{if(!e)return;const t=l.value.search;f.value&&(f.value.value=""),j.loading=!0,j.list=t.default?await t.default():await t.search(""),j.loading=!1})),u((()=>{document.body.addEventListener("click",V),n((()=>a.value),(e=>{const{highlighter:t,texRenderer:n}=l.value;z.value=e,L.value=ct(e,{emojiMap:h.value.map,highlighter:t,texRenderer:n}),S.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?O(c.value):O.destroy(c.value)}),{immediate:!0}),n((()=>l.value.emoji),(e=>{return(t=Array.isArray(e)?e:[],Promise.all(t.map((e=>"string"==typeof e?Xe(Be(e)):Promise.resolve(e)))).then((e=>{const t={tabs:[],map:{}};return e.forEach((e=>{const{name:n,folder:l,icon:o,prefix:a,type:i,items:r}=e;t.tabs.push({name:n,icon:Qe(o,l,a,i),items:r.map((e=>{const n=`${a||""}${e}`;return t.map[n]=Qe(e,l,a,i),n}))})})),t}))).then((e=>{h.value=e}));var t}),{immediate:!0})})),x((()=>{document.body.removeEventListener("click",V)})),{config:l,locale:M,insert:T,onChange:()=>{const e=m.value;e.files&&P.value&&N(e.files[0]).then((()=>{e.value=""}))},onDrop:e=>{if(e.dataTransfer?.items){const t=ot(e.dataTransfer.items);t&&P.value&&(N(t),e.preventDefault())}},onKeyDown:e=>{const t=e.key;(e.ctrlKey||e.metaKey)&&"Enter"===t&&H()},onPaste:e=>{if(e.clipboardData){const t=ot(e.clipboardData.items);t&&P.value&&N(t)}},onLogin:e=>{e.preventDefault();const{lang:t,serverURL:n}=l.value,o=(window.innerWidth-450)/2,a=(window.innerHeight-450)/2,i=window.open(`${n}/ui/login?lng=${encodeURIComponent(t)}`,"_blank",`width=450,height=450,left=${o},top=${a},scrollbars=no,resizable=no,status=no,location=no,toolbar=no,menubar=no`);i?.postMessage({type:"TOKEN",data:null},"*");const s=({data:e})=>{e&&"userInfo"===e.type&&e.data.token&&(i?.close(),r.value=e.data,(e.data.remember?localStorage:sessionStorage).setItem("WALINE_USER",JSON.stringify(e.data)),window.removeEventListener("message",s))};window.addEventListener("message",s)},onLogout:()=>{r.value={},localStorage.setItem("WALINE_USER","null"),sessionStorage.setItem("WALINE_USER","null")},onProfile:e=>{e.preventDefault();const{lang:t,serverURL:n}=l.value,o=(window.innerWidth-800)/2,a=(window.innerHeight-800)/2;window.open(`${n}/ui/profile?lng=${encodeURIComponent(t)}`,"_blank",`width=800,height=800,left=${o},top=${a},scrollbars=no,resizable=no,status=no,location=no,toolbar=no,menubar=no`)?.postMessage({type:"TOKEN",data:r.value.token},"*");const i=({data:e})=>{e&&"profile"===e.type&&(r.value={...r.value,...e},[localStorage,sessionStorage].filter((e=>e.getItem("WALINE_USER"))).forEach((e=>e.setItem("WALINE_USER",JSON.stringify(r)))),window.removeEventListener("message",i))};window.addEventListener("message",i)},submitComment:H,onImageWallScroll:_,onGifSearch:F,isLogin:U,userInfo:r,isSubmitting:A,wordNumber:S,wordLimit:E,isWordNumberLegal:R,editor:a,userMeta:i,emoji:h,emojiTabIndex:w,showEmoji:y,gifData:j,showGif:b,canUploadImage:P,previewText:L,showPreview:k,inputRefs:s,editorRef:c,emojiButtonRef:d,emojiPopupRef:v,gifButtonRef:p,gifPopupRef:g,imageUploadRef:m,gifSearchInputRef:f}}}),gt={class:"wl-comment"},ft={key:0,class:"wl-login-info"},ht={class:"wl-avatar"},wt=["title"],yt=["src"],bt=["textContent"],kt={class:"wl-panel"},Ct=["for","textContent"],It=["id","name","type","onUpdate:modelValue"],$t=["placeholder"],xt={class:"wl-preview"},Lt=b("hr",null,null,-1),St=["innerHTML"],jt={class:"wl-footer"},Et={class:"wl-actions"},Rt={href:"https://guides.github.com/features/mastering-markdown/",title:"Markdown Guide","aria-label":"Markdown is supported",class:"wl-action",target:"_blank",rel:"noreferrer"},zt=["title"],At=["title"],Mt=["title"],Ut=["title"],Ot={class:"wl-info"},Pt={class:"wl-text-number"},Tt={key:0},Nt=M(" / "),Ht=["textContent"],Vt=["textContent"],_t=["disabled"],Ft=["placeholder"],Dt={key:0,class:"wl-loading"},Bt={key:0,class:"wl-tab-wrapper"},Wt=["title","onClick"],Gt=["src","alt"],qt={key:0,class:"wl-tabs"},Jt=["onClick"],Kt=["src","alt","title"],Yt=["title"];var Zt=be(pt,[["render",function(e,t,n,l,o,a){const i=d("CloseIcon"),r=d("MarkdownIcon"),s=d("EmojiIcon"),c=d("GifIcon"),u=d("ImageIcon"),m=d("PreviewIcon"),g=d("LoadingIcon"),k=d("ImageWall");return v(),p("div",gt,["disable"!==e.config.login&&e.isLogin?(v(),p("div",ft,[b("div",ht,[b("button",{class:"wl-logout-btn",title:e.locale.logout,onClick:t[0]||(t[0]=(...t)=>e.onLogout&&e.onLogout(...t))},[L(i,{size:14})],8,wt),b("img",{src:e.userInfo.avatar,alt:"avatar"},null,8,yt)]),b("a",{href:"#",class:"wl-login-nick","aria-label":"Profile",onClick:t[1]||(t[1]=(...t)=>e.onProfile&&e.onProfile(...t)),textContent:S(e.userInfo.display_name)},null,8,bt)])):y("v-if",!0),b("div",kt,["force"!==e.config.login&&e.config.meta.length&&!e.isLogin?(v(),p("div",{key:0,class:j(["wl-header",`item${e.config.meta.length}`])},[(v(!0),p(f,null,h(e.config.meta,(t=>(v(),p("div",{class:"wl-header-item",key:t},[b("label",{for:t,textContent:S(e.locale[t]+(e.config.requiredMeta.includes(t)||!e.config.requiredMeta.length?"":`(${e.locale.optional})`))},null,8,Ct),E(b("input",{ref_for:!0,ref:n=>{n&&(e.inputRefs[t]=n)},id:`wl-${t}`,class:j(["wl-input",`wl-${t}`]),name:t,type:"mail"===t?"email":"text","onUpdate:modelValue":n=>e.userMeta[t]=n},null,10,It),[[R,e.userMeta[t]]])])))),128))],2)):y("v-if",!0),E(b("textarea",{class:"wl-editor",ref:"editorRef",id:"wl-edit",placeholder:e.replyUser?`@${e.replyUser}`:e.locale.placeholder,"onUpdate:modelValue":t[2]||(t[2]=t=>e.editor=t),onKeydown:t[3]||(t[3]=(...t)=>e.onKeyDown&&e.onKeyDown(...t)),onDrop:t[4]||(t[4]=(...t)=>e.onDrop&&e.onDrop(...t)),onPaste:t[5]||(t[5]=(...t)=>e.onPaste&&e.onPaste(...t))},null,40,$t),[[z,e.editor]]),E(b("div",xt,[Lt,b("h4",null,S(e.locale.preview)+":",1),b("div",{class:"wl-content",innerHTML:e.previewText},null,8,St)],512),[[A,e.showPreview]]),b("div",jt,[b("div",Et,[b("a",Rt,[L(r)]),E(b("button",{ref:"emojiButtonRef",class:j(["wl-action",{actived:e.showEmoji}]),title:e.locale.emoji,onClick:t[6]||(t[6]=t=>e.showEmoji=!e.showEmoji)},[L(s)],10,zt),[[A,e.emoji.tabs.length]]),e.config.search?(v(),p("button",{key:0,ref:"gifButtonRef",class:j(["wl-action",{actived:e.showGif}]),title:e.locale.gif,onClick:t[7]||(t[7]=t=>e.showGif=!e.showGif)},[L(c)],10,At)):y("v-if",!0),b("input",{ref:"imageUploadRef",class:"upload",id:"wl-image-upload",type:"file",accept:".png,.jpg,.jpeg,.webp,.bmp,.gif",onChange:t[8]||(t[8]=(...t)=>e.onChange&&e.onChange(...t))},null,544),e.canUploadImage?(v(),p("label",{key:1,for:"wl-image-upload",class:"wl-action",title:e.locale.uploadImage},[L(u)],8,Mt)):y("v-if",!0),b("button",{class:j(["wl-action",{actived:e.showPreview}]),title:e.locale.preview,onClick:t[9]||(t[9]=t=>e.showPreview=!e.showPreview)},[L(m)],10,Ut)]),b("div",Ot,[b("div",Pt,[M(S(e.wordNumber)+" ",1),e.config.wordLimit?(v(),p("span",Tt,[Nt,b("span",{class:j({illegal:!e.isWordNumberLegal}),textContent:S(e.wordLimit)},null,10,Ht)])):y("v-if",!0),M(" "+S(e.locale.word),1)]),"disable"===e.config.login||e.isLogin?y("v-if",!0):(v(),p("button",{key:0,class:"wl-btn",onClick:t[10]||(t[10]=(...t)=>e.onLogin&&e.onLogin(...t)),textContent:S(e.locale.login)},null,8,Vt)),"force"!==e.config.login||e.isLogin?(v(),p("button",{key:1,class:"wl-btn primary",title:"Cmd|Ctrl + Enter",disabled:e.isSubmitting,onClick:t[11]||(t[11]=(...t)=>e.submitComment&&e.submitComment(...t))},[e.isSubmitting?(v(),w(g,{key:0,size:16})):(v(),p(f,{key:1},[M(S(e.locale.submit),1)],64))],8,_t)):y("v-if",!0)]),b("div",{ref:"gifPopupRef",class:j(["wl-gif-popup",{display:e.showGif}])},[b("input",{type:"text",placeholder:e.locale.gifSearchPlaceholder,ref:"gifSearchInputRef",onInput:t[12]||(t[12]=(...t)=>e.onGifSearch&&e.onGifSearch(...t))},null,40,Ft),L(k,{items:e.gifData.list,"column-width":200,gap:6,onInsert:t[13]||(t[13]=t=>e.insert(t)),onScroll:e.onImageWallScroll},null,8,["items","onScroll"]),e.gifData.loading?(v(),p("div",Dt,[L(g,{size:30})])):y("v-if",!0)],2),b("div",{ref:"emojiPopupRef",class:j(["wl-emoji-popup",{display:e.showEmoji}])},[(v(!0),p(f,null,h(e.emoji.tabs,((t,n)=>(v(),p(f,{key:t.name},[n===e.emojiTabIndex?(v(),p("div",Bt,[(v(!0),p(f,null,h(t.items,(t=>(v(),p("button",{key:t,title:t,onClick:n=>e.insert(`:${t}:`)},[e.showEmoji?(v(),p("img",{key:0,class:"wl-emoji",src:e.emoji.map[t],alt:t,loading:"lazy",referrerPolicy:"no-referrer"},null,8,Gt)):y("v-if",!0)],8,Wt)))),128))])):y("v-if",!0)],64)))),128)),e.emoji.tabs.length>1?(v(),p("div",qt,[(v(!0),p(f,null,h(e.emoji.tabs,((t,n)=>(v(),p("button",{key:t.name,class:j(["wl-tab",{active:e.emojiTabIndex===n}]),onClick:t=>e.emojiTabIndex=n},[b("img",{class:"wl-emoji",src:t.icon,alt:t.name,title:t.name,loading:"lazy",referrerPolicy:"no-referrer"},null,8,Kt)],10,Jt)))),128))])):y("v-if",!0)],2)])]),e.replyId?(v(),p("button",{key:1,class:"wl-close",title:e.locale.cancelReply,onClick:t[14]||(t[14]=t=>e.$emit("cancel-reply"))},[L(i,{size:24})],8,Yt)):y("v-if",!0)])}],["__file","CommentBox.vue"]]);const Xt=["approved","waiting","spam"],Qt=c({props:{comment:{type:Object,required:!0},rootId:{type:String,required:!0},reply:{type:Object}},components:{CommentBox:Zt,DeleteIcon:()=>s("svg",{viewBox:"0 0 1024 1024",width:"24",height:"24"},s("path",{d:"m341.013 394.667 27.755 393.45h271.83l27.733-393.45h64.106l-28.01 397.952a64 64 0 0 1-63.83 59.498H368.768a64 64 0 0 1-63.83-59.52l-28.053-397.93h64.128zm139.307 19.818v298.667h-64V414.485h64zm117.013 0v298.667h-64V414.485h64zM181.333 288h640v64h-640v-64zm453.483-106.667v64h-256v-64h256z",fill:"red"})),LikeIcon:({active:e=!1})=>s("svg",{viewBox:"0 0 1024 1024",width:"24",height:"24"},[s("path",{d:"M850.654 323.804c-11.042-25.625-26.862-48.532-46.885-68.225-20.022-19.61-43.258-34.936-69.213-45.73-26.78-11.124-55.124-16.727-84.375-16.727-40.622 0-80.256 11.123-114.698 32.135A214.79 214.79 0 0 0 512 241.819a214.79 214.79 0 0 0-23.483-16.562c-34.442-21.012-74.076-32.135-114.698-32.135-29.25 0-57.595 5.603-84.375 16.727-25.872 10.711-49.19 26.12-69.213 45.73-20.105 19.693-35.843 42.6-46.885 68.225-11.453 26.615-17.303 54.877-17.303 83.963 0 27.439 5.603 56.03 16.727 85.117 9.31 24.307 22.659 49.52 39.715 74.981 27.027 40.293 64.188 82.316 110.33 124.915 76.465 70.615 152.189 119.394 155.402 121.371l19.528 12.525c8.652 5.52 19.776 5.52 28.427 0l19.529-12.525c3.213-2.06 78.854-50.756 155.401-121.371 46.143-42.6 83.304-84.622 110.33-124.915 17.057-25.46 30.487-50.674 39.716-74.981 11.124-29.087 16.727-57.678 16.727-85.117.082-29.086-5.768-57.348-17.221-83.963z"+(e?"":"M512 761.5S218.665 573.55 218.665 407.767c0-83.963 69.461-152.023 155.154-152.023 60.233 0 112.473 33.618 138.181 82.727 25.708-49.109 77.948-82.727 138.18-82.727 85.694 0 155.155 68.06 155.155 152.023C805.335 573.551 512 761.5 512 761.5z"),fill:e?"red":"currentColor"})]),ReplyIcon:()=>s("svg",{viewBox:"0 0 1024 1024",width:"24",height:"24"},s("path",{d:"M810.667 213.333a64 64 0 0 1 64 64V704a64 64 0 0 1-64 64H478.336l-146.645 96.107a21.333 21.333 0 0 1-33.024-17.856V768h-85.334a64 64 0 0 1-64-64V277.333a64 64 0 0 1 64-64h597.334zm0 64H213.333V704h149.334v63.296L459.243 704h351.424V277.333zm-271.36 213.334v64h-176.64v-64h176.64zm122.026-128v64H362.667v-64h298.666z",fill:"currentColor"})),VerifiedIcon:()=>s("svg",{class:"verified-icon",viewBox:"0 0 1024 1024",width:"14",height:"14"},s("path",{d:"m894.4 461.56-54.4-63.2c-10.4-12-18.8-34.4-18.8-50.4v-68c0-42.4-34.8-77.2-77.2-77.2h-68c-15.6 0-38.4-8.4-50.4-18.8l-63.2-54.4c-27.6-23.6-72.8-23.6-100.8 0l-62.8 54.8c-12 10-34.8 18.4-50.4 18.4h-69.2c-42.4 0-77.2 34.8-77.2 77.2v68.4c0 15.6-8.4 38-18.4 50l-54 63.6c-23.2 27.6-23.2 72.4 0 100l54 63.6c10 12 18.4 34.4 18.4 50v68.4c0 42.4 34.8 77.2 77.2 77.2h69.2c15.6 0 38.4 8.4 50.4 18.8l63.2 54.4c27.6 23.6 72.8 23.6 100.8 0l63.2-54.4c12-10.4 34.4-18.8 50.4-18.8h68c42.4 0 77.2-34.8 77.2-77.2v-68c0-15.6 8.4-38.4 18.8-50.4l54.4-63.2c23.2-27.6 23.2-73.2-.4-100.8zm-216-25.2-193.2 193.2a30 30 0 0 1-42.4 0l-96.8-96.8a30.16 30.16 0 0 1 0-42.4c11.6-11.6 30.8-11.6 42.4 0l75.6 75.6 172-172c11.6-11.6 30.8-11.6 42.4 0 11.6 11.6 11.6 30.8 0 42.4z",fill:"#27ae60"}))},emits:["submit","reply","like","delete","status","sticky"],setup(e){const t=I("config"),n=vt(),l=mt(),o=C((()=>t.value.locale)),a=C((()=>{let{link:t}=e.comment;return t?We(t)?t:`https://${t}`:""})),i=C((()=>n.value.includes(e.comment.objectId))),r=((e,t)=>{const n=he();return C((()=>Ze(e,n.value,t)))})(e.comment.insertedAt,o.value),s=C((()=>"administrator"===l.value.type)),c=C((()=>e.comment.user_id&&l.value.objectId===e.comment.user_id)),u=C((()=>e.comment.objectId===e.reply?.objectId));return{config:t,locale:o,isReplyingCurrent:u,link:a,like:i,time:r,isAdmin:s,isOwner:c,commentStatus:Xt}}}),en=["id"],tn={class:"wl-user","aria-hidden":"true"},nn=["src"],ln={class:"wl-card"},on={class:"wl-head"},an=["href"],rn={key:1,class:"wl-nick"},sn=["textContent"],cn=["textContent"],un=["textContent"],mn=["textContent"],dn=["textContent"],vn={class:"wl-comment-actions"},pn=["title"],gn=["textContent"],fn=["title"],hn={class:"wl-meta","aria-hidden":"true"},wn=["textContent"],yn=["textContent"],bn=["textContent"],kn=["innerHTML"],Cn={key:0,class:"wl-admin-actions"},In={class:"wl-comment-status"},$n=["disabled","onClick","textContent"],xn={key:1,class:"wl-reply-wrapper"},Ln={key:2,class:"wl-quote"};const Sn=c({name:"WalineRoot",components:{CommentBox:Zt,CommentCard:be(Qt,[["render",function(e,t,n,l,o,a){const i=d("VerifiedIcon"),r=d("DeleteIcon"),s=d("LikeIcon"),c=d("ReplyIcon"),u=d("CommentBox"),m=d("CommentCard",!0);return v(),p("div",{class:"wl-item",id:e.comment.objectId},[b("div",tn,[e.comment.avatar?(v(),p("img",{key:0,src:e.comment.avatar},null,8,nn)):y("v-if",!0),e.comment.type?(v(),w(i,{key:1})):y("v-if",!0)]),b("div",ln,[b("div",on,[e.link?(v(),p("a",{key:0,class:"wl-nick",href:e.link,target:"_blank",rel:"nofollow noreferrer"},S(e.comment.nick),9,an)):(v(),p("span",rn,S(e.comment.nick),1)),"administrator"===e.comment.type?(v(),p("span",{key:2,class:"wl-badge",textContent:S(e.locale.admin)},null,8,sn)):y("v-if",!0),e.comment.label?(v(),p("span",{key:3,class:"wl-badge",textContent:S(e.comment.label)},null,8,cn)):y("v-if",!0),e.comment.sticky?(v(),p("span",{key:4,class:"wl-badge",textContent:S(e.locale.sticky)},null,8,un)):y("v-if",!0),void 0!==e.comment.level&&e.comment.level>=0?(v(),p("span",{key:5,class:j(`wl-badge level${e.comment.level}`),textContent:S(e.locale[`level${e.comment.level}`]||`Level ${e.comment.level}`)},null,10,mn)):y("v-if",!0),b("span",{class:"wl-time",textContent:S(e.time)},null,8,dn),b("div",vn,[e.isAdmin||e.isOwner?(v(),p("button",{key:0,class:"wl-delete",onClick:t[0]||(t[0]=t=>e.$emit("delete",e.comment))},[L(r)])):y("v-if",!0),b("button",{class:"wl-like",onClick:t[1]||(t[1]=t=>e.$emit("like",e.comment)),title:e.like?e.locale.cancelLike:e.locale.like},[L(s,{active:e.like},null,8,["active"]),"like"in e.comment?(v(),p("span",{key:0,textContent:S(e.comment.like)},null,8,gn)):y("v-if",!0)],8,pn),b("button",{class:j(["wl-reply",{active:e.isReplyingCurrent}]),title:e.isReplyingCurrent?e.locale.cancelReply:e.locale.reply,onClick:t[2]||(t[2]=t=>e.$emit("reply",e.isReplyingCurrent?null:e.comment))},[L(c)],10,fn)])]),b("div",hn,[e.comment.addr?(v(),p("span",{key:0,textContent:S(e.comment.addr)},null,8,wn)):y("v-if",!0),e.comment.browser?(v(),p("span",{key:1,textContent:S(e.comment.browser)},null,8,yn)):y("v-if",!0),e.comment.os?(v(),p("span",{key:2,textContent:S(e.comment.os)},null,8,bn)):y("v-if",!0)]),b("div",{class:"wl-content",innerHTML:e.comment.comment},null,8,kn),e.isAdmin?(v(),p("div",Cn,[b("span",In,[(v(!0),p(f,null,h(e.commentStatus,(t=>(v(),p("button",{key:t,class:j(`wl-btn wl-${t}`),disabled:e.comment.status===t,onClick:n=>e.$emit("status",{status:t,comment:e.comment}),textContent:S(t)},null,10,$n)))),128))]),e.isAdmin&&!e.comment.rid?(v(),p("button",{key:0,class:"wl-btn wl-sticky",onClick:t[3]||(t[3]=t=>e.$emit("sticky",e.comment))},S(e.comment.sticky?"unsticky":"sticky"),1)):y("v-if",!0)])):y("v-if",!0),e.isReplyingCurrent?(v(),p("div",xn,[L(u,{replyId:e.comment.objectId,replyUser:e.comment.nick,rootId:e.rootId,onSubmit:t[4]||(t[4]=t=>e.$emit("submit",t)),onCancelReply:t[5]||(t[5]=t=>e.$emit("reply",null))},null,8,["replyId","replyUser","rootId"])])):y("v-if",!0),e.comment.children?(v(),p("div",Ln,[(v(!0),p(f,null,h(e.comment.children,(n=>(v(),w(m,{key:n.objectId,comment:n,reply:e.reply,rootId:e.rootId,onReply:t[6]||(t[6]=t=>e.$emit("reply",t)),onSubmit:t[7]||(t[7]=t=>e.$emit("submit",t)),onLike:t[8]||(t[8]=t=>e.$emit("like",t)),onDelete:t[9]||(t[9]=t=>e.$emit("delete",t)),onStatus:t[10]||(t[10]=t=>e.$emit("status",t)),onSticky:t[11]||(t[11]=t=>e.$emit("sticky",t))},null,8,["comment","reply","rootId"])))),128))])):y("v-if",!0)])],8,en)}],["__file","CommentCard.vue"]]),LoadingIcon:ye},props:["serverURL","path","meta","requiredMeta","dark","lang","locale","pageSize","wordLimit","emoji","login","highlighter","texRenderer","imageUploader","copyright"],setup(e){const t=C((()=>(({serverURL:e,path:t=location.pathname,lang:n="zh-CN",locale:l,emoji:o=["//unpkg.com/@waline/emojis@1.0.1/weibo"],meta:a=["nick","mail","link"],requiredMeta:i=[],dark:r=!1,pageSize:s=10,wordLimit:c,imageUploader:u,highlighter:m,texRenderer:d,copyright:v=!0,login:p="enable",search:g=Ee(),...f})=>({serverURL:Ge(e),path:De(t),locale:{...Fe[n]||Fe["zh-CN"],..."object"==typeof l?l:{}},wordLimit:qe(c),meta:Le(a),requiredMeta:Le(i),imageUploader:Je(u,Se),highlighter:Je(m,Me),texRenderer:Je(d,je),lang:n,dark:r,emoji:o,pageSize:s,login:p,copyright:v,search:g,...f}))(e))),l=mt(),a=vt(),r=o("loading"),s=o(0),c=o(1),m=o(0),d=o([]),v=o(null),p=C((()=>{return"string"==typeof(e=t.value.dark)?"auto"===e?`@media(prefers-color-scheme:dark){body${Ke}}`:`${e}${Ke}`:!0===e?`:root${Ke}`:"";var e}));let g;!function(e,t={}){const l=o(!1),{document:a=le,immediate:r=!0,manual:s=!1,id:c="vueuse_styletag_"+ ++we}=t,u=o(e);let m=()=>{};const d=()=>{if(!a)return;const e=a.getElementById(c)||a.createElement("style");e.type="text/css",e.id=c,t.media&&(e.media=t.media),a.head.appendChild(e),l.value||(m=n(u,(t=>{e.innerText=t}),{immediate:!0}),l.value=!0)},v=()=>{a&&l.value&&(m(),a.head.removeChild(a.getElementById(c)),l.value=!1)};r&&!s&&d(),s||T(v),i(l)}(p);const f=e=>{const{serverURL:n,path:o,pageSize:a}=t.value,i=new AbortController;r.value="loading",g?.(),tt({serverURL:n,lang:t.value.lang,path:o,pageSize:a,page:e,signal:i.signal,token:l.value?.token}).then((t=>{r.value="success",s.value=t.count,d.value.push(...t.data),c.value=e,m.value=t.totalPages})).catch((e=>{"AbortError"!==e.name&&(console.error(e.message),r.value="error")})),g=i.abort.bind(i)},h=()=>{s.value=0,d.value=[],f(1)};return U("config",t),n((()=>e.path),h),u((()=>h())),{config:t,darkmodeStyle:p,i18n:C((()=>t.value.locale)),status:r,count:s,page:c,totalPages:m,data:d,reply:v,loadMore:()=>f(c.value+1),refresh:h,onReply:e=>{v.value=e},onSubmit:e=>{if(e.rid){const t=d.value.find((({objectId:t})=>t===e.rid));if(!t)return;Array.isArray(t.children)||(t.children=[]),t.children.push(e)}else d.value.unshift(e)},onStatusChange:async({comment:e,status:n})=>{if(e.status===n)return;const{serverURL:o,lang:a}=t.value;await nt({serverURL:o,lang:a,token:l.value?.token,objectId:e.objectId,status:n}),e.status=n},onDelete:async({objectId:e})=>{if(!confirm("Are you sure you want to delete this comment?"))return;const{serverURL:n,lang:o}=t.value;await(({serverURL:e,lang:t,token:n,objectId:l})=>fetch(`${e}/comment/${l}?lang=${t}`,{method:"DELETE",headers:{Authorization:`Bearer ${n}`}}).then((e=>e.json())))({serverURL:n,lang:o,token:l.value?.token,objectId:e}),d.value.some(((t,n)=>t.objectId===e?(d.value=d.value.filter(((e,t)=>t!==n)),!0):t.children.some(((l,o)=>l.objectId===e&&(d.value[n].children=t.children.filter(((e,t)=>t!==o)),!0)))))},onSticky:async e=>{if(e.rid)return;const{serverURL:n,lang:o}=t.value;await nt({serverURL:n,lang:o,token:l.value?.token,objectId:e.objectId,sticky:e.sticky?0:1}),e.sticky=!e.sticky},onLike:async e=>{const{serverURL:n,lang:l}=t.value,{objectId:o}=e,i=a.value.includes(o);await(({serverURL:e,lang:t,objectId:n,like:l})=>fetch(`${e}/comment/${n}?lang=${t}`,{method:"PUT",headers:et,body:JSON.stringify({like:l})}).then((e=>e.json())))({serverURL:n,lang:l,objectId:o,like:!i}),i?a.value=a.value.filter((e=>e!==o)):(a.value=[...a.value,o],a.value.length>50&&(a.value=a.value.slice(-50))),e.like=(e.like||0)+(i?-1:1)},version:"2.6.1"}}}),jn={"data-waline":""},En={class:"wl-count"},Rn=["textContent"],zn={class:"wl-cards"},An={key:1,class:"wl-operation"},Mn=["textContent"],Un={key:0,class:"wl-loading"},On=["textContent"],Pn={class:"wl-operation"},Tn=["textContent"],Nn={key:3,class:"wl-power"},Hn=M(" Powered by "),Vn=b("a",{href:"https://github.com/walinejs/waline",target:"_blank",rel:"noreferrer"}," Waline ",-1);var _n=be(Sn,[["render",function(e,t,n,l,o,a){const i=d("CommentBox"),r=d("CommentCard"),s=d("LoadingIcon");return v(),p("div",jn,[e.reply?y("v-if",!0):(v(),w(i,{key:0,onSubmit:e.onSubmit},null,8,["onSubmit"])),b("div",En,[e.count?(v(),p("span",{key:0,class:"wl-num",textContent:S(e.count)},null,8,Rn)):y("v-if",!0),M(" "+S(e.i18n.comment),1)]),b("div",zn,[(v(!0),p(f,null,h(e.data,(t=>(v(),w(r,{key:t.objectId,"root-id":t.objectId,comment:t,reply:e.reply,onReply:e.onReply,onSubmit:e.onSubmit,onStatus:e.onStatusChange,onDelete:e.onDelete,onSticky:e.onSticky,onLike:e.onLike},null,8,["root-id","comment","reply","onReply","onSubmit","onStatus","onDelete","onSticky","onLike"])))),128))]),"error"===e.status?(v(),p("div",An,[b("button",{type:"button",class:"wl-btn",onClick:t[0]||(t[0]=(...t)=>e.refresh&&e.refresh(...t)),textContent:S(e.i18n.refresh)},null,8,Mn)])):(v(),p(f,{key:2},["loading"===e.status?(v(),p("div",Un,[L(s,{size:30})])):e.data.length?e.page<e.totalPages?(v(),p(f,{key:2},[y(" Load more button "),b("div",Pn,[b("button",{type:"button",class:"wl-btn",onClick:t[1]||(t[1]=(...t)=>e.loadMore&&e.loadMore(...t)),textContent:S(e.i18n.more)},null,8,Tn)])],2112)):y("v-if",!0):(v(),p("div",{key:1,class:"wl-empty",textContent:S(e.i18n.sofa)},null,8,On))],64)),y(" Copyright Information "),e.config.copyright?(v(),p("div",Nn,[Hn,Vn,M(" v"+S(e.version),1)])):y("v-if",!0)])}],["__file","Waline.vue"]]);const Fn="2.6.1";export{_n as Waline,Fn as version}; | ||
//# sourceMappingURL=component.esm.js.map |
@@ -1,2 +0,2 @@ | ||
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("vue"),t=require("autosize"),n=require("marked");function o(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var l,a=o(t);function r(t){return!!e.getCurrentScope()&&(e.onScopeDispose(t),!0)}const i="undefined"!=typeof window,c=()=>{};function s(e,t){return function(...n){e((()=>t.apply(this,n)),{fn:t,thisArg:this,args:n})}}i&&(null==(l=null==window?void 0:window.navigator)?void 0:l.userAgent)&&/iP(ad|hone|od)/.test(window.navigator.userAgent);const m=e=>e();function u(t,n=200,o={}){return s(function(t,n={}){let o,l;return a=>{const r=e.unref(t),i=e.unref(n.maxWait);if(o&&clearTimeout(o),r<=0||void 0!==i&&i<=0)return l&&(clearTimeout(l),l=null),a();i&&!l&&(l=setTimeout((()=>{o&&clearTimeout(o),l=null,a()}),i)),o=setTimeout((()=>{l&&clearTimeout(l),l=null,a()}),r)}}(n,o),t)}var d=Object.getOwnPropertySymbols,p=Object.prototype.hasOwnProperty,v=Object.prototype.propertyIsEnumerable;function g(t,n,o={}){const l=o,{eventFilter:a=m}=l,r=((e,t)=>{var n={};for(var o in e)p.call(e,o)&&t.indexOf(o)<0&&(n[o]=e[o]);if(null!=e&&d)for(var o of d(e))t.indexOf(o)<0&&v.call(e,o)&&(n[o]=e[o]);return n})(l,["eventFilter"]);return e.watch(t,s(a,n),r)}var f=Object.defineProperty,h=Object.defineProperties,k=Object.getOwnPropertyDescriptors,y=Object.getOwnPropertySymbols,w=Object.prototype.hasOwnProperty,b=Object.prototype.propertyIsEnumerable,C=(e,t,n)=>t in e?f(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;function E(t,n,o={}){const l=o,{eventFilter:a}=l,r=((e,t)=>{var n={};for(var o in e)w.call(e,o)&&t.indexOf(o)<0&&(n[o]=e[o]);if(null!=e&&y)for(var o of y(e))t.indexOf(o)<0&&b.call(e,o)&&(n[o]=e[o]);return n})(l,["eventFilter"]),{eventFilter:i,pause:c,resume:s,isActive:u}=function(t=m){const n=e.ref(!0);return{isActive:n,pause:function(){n.value=!1},resume:function(){n.value=!0},eventFilter:(...e)=>{n.value&&t(...e)}}}(a),d=g(t,n,(p=((e,t)=>{for(var n in t||(t={}))w.call(t,n)&&C(e,n,t[n]);if(y)for(var n of y(t))b.call(t,n)&&C(e,n,t[n]);return e})({},r),h(p,k({eventFilter:i}))));var p;return{stop:d,pause:c,resume:s,isActive:u}}const B=i?window:void 0,N=i?window.document:void 0;function V(...t){let n,o,l,a;if("string"==typeof t[0]?([o,l,a]=t,n=B):[n,o,l,a]=t,!n)return c;let i=c;const s=e.watch((()=>function(t){var n;const o=e.unref(t);return null!=(n=null==o?void 0:o.$el)?n:o}(n)),(e=>{i(),e&&(e.addEventListener(o,l,a),i=()=>{e.removeEventListener(o,l,a),i=c})}),{immediate:!0,flush:"post"}),m=()=>{s(),i()};return r(m),m}i&&window.navigator,i&&window.location;const I="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},S="__vueuse_ssr_handlers__";I[S]=I[S]||{};const $=I[S];const x={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 L(t,n,o,l={}){var a;const{flush:r="pre",deep:i=!0,listenToStorageChanges:c=!0,writeDefaults:s=!0,shallow:m,window:u=B,eventFilter:d,onError:p=(e=>{console.error(e)})}=l,v=(m?e.shallowRef:e.ref)(n);if(!o)try{o=function(e,t){return $[e]||t}("getDefaultStorage",(()=>{var e;return null==(e=B)?void 0:e.localStorage}))()}catch(e){p(e)}if(!o)return v;const g=e.unref(n),f=function(e){return null==e?"any":e instanceof Set?"set":e instanceof Map?"map":e instanceof Date?"date":"boolean"==typeof e?"boolean":"string"==typeof e?"string":"object"==typeof e||Array.isArray(e)?"object":Number.isNaN(e)?"any":"number"}(g),h=null!=(a=l.serializer)?a:x[f],{pause:k,resume:y}=E(v,(()=>function(e){try{null==e?o.removeItem(t):o.setItem(t,h.write(e))}catch(e){p(e)}}(v.value)),{flush:r,deep:i,eventFilter:d});return u&&c&&V(u,"storage",w),w(),v;function w(e){e&&e.key!==t||(v.value=function(e){if(!e||e.key===t){k();try{const n=e?e.newValue:o.getItem(t);return null==n?(s&&null!==g&&o.setItem(t,h.write(g)),g):"string"!=typeof n?n:h.read(n)}catch(e){p(e)}finally{y()}}}(e))}}var j,R,z=Object.defineProperty,D=Object.getOwnPropertySymbols,M=Object.prototype.hasOwnProperty,A=Object.prototype.propertyIsEnumerable,U=(e,t,n)=>t in e?z(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;function T(t={}){const{controls:n=!1,interval:o="requestAnimationFrame"}=t,l=e.ref(new Date),a=()=>l.value=new Date,c="requestAnimationFrame"===o?function(t,n={}){const{immediate:o=!0,window:l=B}=n,a=e.ref(!1);let i=null;function c(){a.value&&l&&(t(),i=l.requestAnimationFrame(c))}function s(){!a.value&&l&&(a.value=!0,c())}function m(){a.value=!1,null!=i&&l&&(l.cancelAnimationFrame(i),i=null)}return o&&s(),r(m),{isActive:a,pause:m,resume:s}}(a,{immediate:!0}):function(t,n=1e3,o={}){const{immediate:l=!0,immediateCallback:a=!1}=o;let c=null;const s=e.ref(!1);function m(){c&&(clearInterval(c),c=null)}function u(){s.value=!1,m()}function d(){e.unref(n)<=0||(s.value=!0,a&&t(),m(),c=setInterval(t,e.unref(n)))}l&&i&&d(),e.isRef(n)&&r(e.watch(n,(()=>{l&&i&&d()})));return r(u),{isActive:s,pause:u,resume:d}}(a,o,{immediate:!0});return n?((e,t)=>{for(var n in t||(t={}))M.call(t,n)&&U(e,n,t[n]);if(D)for(var n of D(t))A.call(t,n)&&U(e,n,t[n]);return e})({now:l},c):l}(R=j||(j={})).UP="UP",R.RIGHT="RIGHT",R.DOWN="DOWN",R.LEFT="LEFT",R.NONE="NONE";let O=0;const P=({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 F=(e,t)=>{const n=e.__vccOpts||e;for(const[e,o]of t)n[e]=o;return n};const H=e.defineComponent({name:"ImageWall",components:{LoadingIcon:P},props:{items:{type:Array,default:()=>[]},columnWidth:{type:Number,default:300},gap:{type:Number,default:0}},emit:["insert"],setup(t){let n=null;const o=e.ref(null),l=e.ref({}),a=e.ref([]),r=()=>{const e=Math.floor((o.value.getBoundingClientRect().width+t.gap)/(t.columnWidth+t.gap));return e>0?e:1},i=async n=>{if(n>=t.items.length)return;await e.nextTick();const l=Array.from(o.value?.children||[]).reduce(((e,t)=>t.getBoundingClientRect().height<e.getBoundingClientRect().height?t:e));a.value[Number(l.dataset.index)].push(n),await i(n+1)},c=async(e=!1)=>{if(a.value.length===r()&&!e)return;var t;a.value=(t=r(),new Array(t).fill(null).map((()=>[])));const n=window.scrollY;await i(0),window.scrollTo({top:n})};return e.watch((()=>[t.items]),(()=>{l.value={},c(!0)})),e.watch((()=>[t.columnWidth,t.gap]),(()=>c())),e.onMounted((()=>{c(!0),n=new ResizeObserver((()=>c())),n.observe(o.value)})),e.onBeforeUnmount((()=>n.unobserve(o.value))),{columns:a,state:l,wall:o}}}),_=["data-index"],W=["src","title","onLoad","onClick"];var G=F(H,[["render",function(t,n,o,l,a,r){const i=e.resolveComponent("LoadingIcon");return e.openBlock(),e.createElementBlock("div",{ref:"wall",class:"wl-gallery",style:e.normalizeStyle({gap:`${t.gap}px`})},[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(t.columns,((n,o)=>(e.openBlock(),e.createElementBlock("div",{key:o,class:"wl-gallery-column","data-index":o,style:e.normalizeStyle({gap:`${t.gap}px`})},[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(n,(n=>(e.openBlock(),e.createElementBlock(e.Fragment,{key:n},[t.state[t.items[n].src]?e.createCommentVNode("v-if",!0):(e.openBlock(),e.createBlock(i,{key:0,size:36,style:{margin:"20px auto"}})),e.createElementVNode("img",{class:"wl-gallery-item",src:t.items[n].src,title:t.items[n].title,loading:"lazy",onLoad:e=>t.state[t.items[n].src]=!0,onClick:e=>t.$emit("insert",`![](${t.items[n].src})`)},null,40,W)],64)))),128))],12,_)))),128))],4)}],["__file","ImageWall.vue"]]);const q=["nick","mail","link"],J=e=>e.filter((e=>q.includes(e))),K=e=>new Promise(((t,n)=>{const o=new FileReader;o.readAsDataURL(e),o.onload=()=>t(o.result?.toString()||""),o.onerror=n})),Y=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>',Z=()=>{const e={next:""},t=({keyword:e,pos:t})=>{const n=new URLSearchParams("media_filter=minimal");return n.set("key","PAY5JLFIH6V6"),n.set("limit","20"),n.set("pos",t||""),n.set("q",e),fetch(`https://g.tenor.com/v1/search?${n.toString()}`,{headers:{"Content-Type":"application/json"}}).then((e=>e.json())).catch((()=>({next:t||"",results:[]})))};return{search:(n="")=>t({keyword:n}).then((t=>(e.next=t.next,t.results.map((e=>({title:e.title,src:e.media[0].tinygif.url})))))),more:n=>t({keyword:n,pos:e.next}).then((t=>(e.next=t.next,t.results.map((e=>({title:e.title,src:e.media[0].tinygif.url}))))))}},X=new RegExp(`(${/[\u4E00-\u9FFF\u3400-\u4dbf\uf900-\ufaff\u3040-\u309f\uac00-\ud7af\u0400-\u04FF]+|\w+/.source}|${/</.source})|((?:${/(?:^|\s)\/\/(.+?)$/gm.source})|(?:${/\/\*([\S\s]*?)\*\//gm.source}))`,"gmi"),Q=["23AC69","91C132","F19726","E8552D","1AAB8E","E1147F","2980C1","1BA1E6","9FA0A0","F19726","E30B20","E30B20","A3338B"],ee={},te=e=>{let t=0;return e.replace(X,((e,n,o)=>{if(o)return`<span style="color: slategray">${o}</span>`;if("<"===n)return"<";let l;ee[n]?l=ee[n]:(l=Q[t],ee[n]=l);const a=`<span style="color: #${l}">${n}</span>`;return t=++t%Q.length,a}))},ne=["nick","nickError","mail","mailError","link","optional","placeholder","sofa","submit","like","cancelLike","reply","cancelReply","comment","refresh","more","preview","emoji","uploadImage","seconds","minutes","hours","days","now","uploading","login","logout","admin","sticky","word","wordHint","anonymous","level0","level1","level2","level3","level4","level5","gif","gifSearchPlaceholder"],oe=e=>Object.fromEntries(e.map(((e,t)=>[ne[t],e])));var le=oe(["NickName","NickName cannot be less than 3 bytes.","E-Mail","Please confirm your email address.","Website","Optional","Comment here...","No comment yet.","Submit","Like","Cancel like","Reply","Cancel reply","Comments","Refresh","Load More...","Preview","Emoji","Upload Image","seconds ago","minutes ago","hours ago","days ago","just now","Uploading","Login","logout","Admin","Sticky","Words","Please input comments between $0 and $1 words!\n Current word number: $2","Anonymous","Dwarves","Hobbits","Ents","Wizards","Elves","Maiar","GIF","Search GIF"]),ae=oe(["ニックネーム","3バイト以上のニックネームをご入力ください.","メールアドレス","メールアドレスをご確認ください.","サイト","オプション","ここにコメント","コメントしましょう~","提出する","Like","Cancel like","返信する","キャンセル","コメント","更新","さらに読み込む","プレビュー","絵文字","画像をアップロード","秒前","分前","時間前","日前","たっだ今","アップロード","ログインする","ログアウト","管理者","トップに置く","ワード","コメントは $0 から $1 ワードの間でなければなりません!\n 現在の単語番号: $2","匿名","うえにん","なかにん","しもおし","特にしもおし","かげ","なぬし","GIF","探す GIF"]),re=oe(["昵称","昵称不能少于3个字符","邮箱","请填写正确的邮件地址","网址","可选","欢迎评论","来发评论吧~","提交","喜欢","取消喜欢","回复","取消回复","评论","刷新","加载更多...","预览","表情","上传图片","秒前","分钟前","小时前","天前","刚刚","正在上传","登录","退出","博主","置顶","字","评论字数应在 $0 到 $1 字之间!\n当前字数:$2","匿名","潜水","冒泡","吐槽","活跃","话痨","传说","表情包","搜索表情包"]),ie=oe(["暱稱","郵箱","網址","可選","暱稱不能少於3個字元","請填寫正確的郵件地址","歡迎評論","來發評論吧~","提交","喜歡","取消喜歡","回覆","取消回覆","評論","刷新","載入更多...","預覽","表情","上傳圖片","秒前","分鐘前","小時前","天前","剛剛","正在上傳","登錄","退出","博主","置頂","字","評論字數應在 $0 到 $1 字之間!\n當前字數:$2","匿名","潛水","冒泡","吐槽","活躍","話癆","傳說","表情包","搜索表情包"]),ce=oe(["Apelido","Apelido não pode ser menor que 3 bytes.","E-Mail","Por favor, confirme seu endereço de e-mail.","Website","Opcional","Comente aqui...","Nenhum comentário, ainda.","Enviar","Like","Cancel like","Responder","Cancelar resposta","Comentários","Refrescar","Carregar Mais...","Visualizar","Emoji","Enviar Imagem","segundos atrás","minutos atrás","horas atrás","dias atrás","agora mesmo","Enviando","Entrar","Sair","Admin","Sticky","Palavras","Favor enviar comentário com $0 a $1 palavras!\n Número de palavras atuais: $2","Anônimo","Dwarves","Hobbits","Ents","Wizards","Elves","Maiar","GIF","Pesquisar GIF"]),se=oe(["Псевдоним","Никнейм не может быть меньше 3 байт.","Эл. адрес","Пожалуйста, подтвердите адрес вашей электронной почты.","Веб-сайт","Необязательный","Комментарий здесь...","Пока нет комментариев.","Отправить","Like","Cancel like","Отвечать","Отменить ответ","Комментарии","Обновить","Загрузи больше...","Превью","эмодзи","Загрузить изображение","секунд назад","несколько минут назад","несколько часов назад","дней назад","прямо сейчас","Загрузка","Авторизоваться","Выход из системы","Админ","Липкий","Слова","Пожалуйста, введите комментарии от $0 до $1 слов!\nНомер текущего слова: $2","Анонимный","Dwarves","Hobbits","Ents","Wizards","Elves","Maiar","GIF","Поиск GIF"]);const me={zh:re,"zh-cn":re,"zh-CN":re,"zh-tw":ie,"zh-TW":ie,en:le,"en-US":le,"en-us":le,jp:ae,"jp-jp":ae,"jp-JP":ae,"pt-br":ce,"pt-BR":ce,ru:se,"ru-ru":se,"ru-RU":se},ue=e=>{try{e=decodeURI(e)}catch(e){}return e},de=(e="")=>e.replace(/\/$/u,""),pe=e=>/^(https?:)?\/\//.test(e),ve=e=>{const t=de(e);return pe(t)?t:`https://${t}`},ge=e=>Array.isArray(e)?e:!!e&&[0,e],fe=(e,t)=>"function"==typeof e?e:!1!==e&&t,he="{--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}",ke=(e,t)=>{let n=e.toString();for(;n.length<t;)n="0"+n;return n},ye=(e,t,n)=>{if(!e)return"";const o="string"==typeof e?new Date(-1!==e.indexOf(" ")?e.replace(/-/g,"/"):e):e,l=t.getTime()-o.getTime(),a=Math.floor(l/864e5);if(0===a){const e=l%864e5,t=Math.floor(e/36e5);if(0===t){const t=e%36e5,o=Math.floor(t/6e4);if(0===o){const e=t%6e4;return`${Math.round(e/1e3)} ${n.seconds}`}return`${o} ${n.minutes}`}return`${t} ${n.hours}`}return a<0?n.now:a<8?`${a} ${n.days}`:(e=>{const t=ke(e.getDate(),2),n=ke(e.getMonth()+1,2);return`${ke(e.getFullYear(),2)}-${n}-${t}`})(o)},we=e=>{const t=L("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}))},be=(e,t="",n="",o="")=>`${t?`${t}/`:""}${n}${e}${o?`.${o}`:""}`,Ce={"Content-Type":"application/json"},Ee=({serverURL:e,lang:t,path:n,page:o,pageSize:l,signal:a,token:r})=>{const i={};return r&&(i.Authorization=`Bearer ${r}`),fetch(`${e}/comment?path=${encodeURIComponent(n)}&pageSize=${l}&page=${o}&lang=${t}`,{signal:a,headers:i}).then((e=>e.json())).then((e=>((e,t="")=>{if("object"==typeof e&&e.errno)throw new TypeError(`Fetch ${t} failed with ${e.errno}: ${e.errmsg}`);return e})(e,"comment list")))},Be=({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())),Ne=e=>e.type.includes("image"),Ve=e=>{const t=Array.from(e).find(Ne);return t?t.getAsFile():null},Ie=/\$.*?\$/,Se=/^\$(.*?)\$/,$e=/^(?:\s{0,3})\$\$((?:[^\n]|\n[^\n])+?)\n{0,1}\$\$/,xe=(e="",t={})=>e.replace(/:(.+?):/g,((e,n)=>t[n]?`<img class="wl-emoji" src="${t[n]}" alt="${n}">`:e)),Le=(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=$e.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(Ie);return-1!==t?t:e.length},tokenizer(t){const n=Se.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(xe(e,t))};let je=null;const Re=()=>je||(je=L("USER_KEY",{}));let ze=null;const De=()=>ze||(ze=L("WALINE_LIKE",[])),Me=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"})]),ImageWall:G,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:P,GifIcon:()=>e.h("svg",{width:24,height:24,fill:"currentcolor",viewBox:"0 0 24 24"},[e.h("path",{style:"transform: translateY(0.5px)",d:"M18.968 10.5H15.968V11.484H17.984V12.984H15.968V15H14.468V9H18.968V10.5V10.5ZM8.984 9C9.26533 9 9.49967 9.09367 9.687 9.281C9.87433 9.46833 9.968 9.70267 9.968 9.984V10.5H6.499V13.5H8.468V12H9.968V14.016C9.968 14.2973 9.87433 14.5317 9.687 14.719C9.49967 14.9063 9.26533 15 8.984 15H5.984C5.70267 15 5.46833 14.9063 5.281 14.719C5.09367 14.5317 5 14.2973 5 14.016V9.985C5 9.70367 5.09367 9.46933 5.281 9.282C5.46833 9.09467 5.70267 9.001 5.984 9.001H8.984V9ZM11.468 9H12.968V15H11.468V9V9Z"}),e.h("path",{d:"M18.5 3H5.75C3.6875 3 2 4.6875 2 6.75V18C2 20.0625 3.6875 21.75 5.75 21.75H18.5C20.5625 21.75 22.25 20.0625 22.25 18V6.75C22.25 4.6875 20.5625 3 18.5 3ZM20.75 18C20.75 19.2375 19.7375 20.25 18.5 20.25H5.75C4.5125 20.25 3.5 19.2375 3.5 18V6.75C3.5 5.5125 4.5125 4.5 5.75 4.5H18.5C19.7375 4.5 20.75 5.5125 20.75 6.75V18Z"})])},props:{rootId:{type:String,default:""},replyId:{type:String,default:""},replyUser:{type:String,default:""}},emits:["submit","cancel-reply"],setup(t,{emit:n}){const o=e.inject("config"),l=L("WALINE_COMMENT_BOX_EDITOR",""),r=L("WALINE_USER_META",{nick:"",mail:"",link:""}),i=Re(),c=e.ref({}),s=e.ref(null),m=e.ref(null),d=e.ref(null),p=e.ref(null),v=e.ref(null),g=e.ref(null),f=e.ref(null),h=e.ref({tabs:[],map:{}}),k=e.ref(0),y=e.ref(!1),w=e.ref(!1),b=e.ref(!1),C=e.ref(""),E=e.ref(0),B=e.reactive({loading:!0,list:[]}),N=e.ref(0),V=e.ref(!1),I=e.ref(""),S=e.ref(!1),$=e.computed((()=>o.value.locale)),x=e.computed((()=>Boolean(i.value?.token))),j=e.computed((()=>!1!==o.value.imageUploader)),R=e=>{const t=s.value,n=t.selectionStart,o=t.selectionEnd||0,a=t.scrollTop;l.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=a},z=e=>{const t=`![${o.value.locale.uploading} ${e.name}]()`;return R(t),Promise.resolve().then((()=>o.value.imageUploader(e))).then((n=>{l.value=l.value.replace(t,`\r\n![${e.name}](${n})`)}))},D=()=>{const{serverURL:e,lang:a,login:m,wordLimit:u,requiredMeta:d}=o.value,p={comment:I.value,nick:r.value.nick,mail:r.value.mail,link:r.value.link,ua:navigator.userAgent,url:o.value.path};if(i.value?.token)p.nick=i.value.display_name,p.mail=i.value.email,p.link=i.value.url;else{if("force"===m)return;if(d.indexOf("nick")>-1&&!p.nick)return c.value.nick?.focus(),alert($.value.nickError);if(d.indexOf("mail")>-1&&!p.mail||p.mail&&!/^\w(?:[\w._-]*\w)?@(?:\w(?:[\w-]*\w)?\.)*\w+$/.exec(p.mail))return c.value.mail?.focus(),alert($.value.mailError);if(!p.comment)return void s.value?.focus();p.nick||(p.nick=$.value.anonymous)}if(!V.value)return alert($.value.wordHint.replace("$0",u[0].toString()).replace("$1",u[1].toString()).replace("$2",E.value.toString()));p.comment=xe(p.comment,h.value.map),t.replyId&&t.rootId&&(p.pid=t.replyId,p.rid=t.rootId,p.at=t.replyUser),S.value=!0,(({serverURL:e,lang:t,token:n,comment:o})=>{const l={"Content-Type":"application/json"};return n&&(l.Authorization=`Bearer ${n}`),fetch(`${e}/comment?lang=${t}`,{method:"POST",headers:l,body:JSON.stringify(o)}).then((e=>e.json()))})({serverURL:e,lang:a,token:i.value?.token,comment:p}).then((e=>{if(S.value=!1,e.errmsg)return alert(e.errmsg);n("submit",e.data),l.value="",C.value="",t.replyId&&n("cancel-reply")})).catch((e=>{S.value=!1,alert(e.message)}))},M=e=>{d.value.contains(e.target)||p.value.contains(e.target)||(y.value=!1),v.value.contains(e.target)||g.value.contains(e.target)||(w.value=!1)},A=async e=>{const{scrollTop:t,clientHeight:n,scrollHeight:l}=e.target,a=(n+t)/l,r=o.value.search,i=f.value?.value||"";a<.9||B.loading||(B.loading=!0,B.list.push(...r.more?await r.more(i,B.list.length):await r.search(i)),B.loading=!1,setTimeout((()=>{e.target.scrollTop=t}),50))},U=u((e=>{B.list=[],A(e)}),300);return e.watch([o,E],(([e,t])=>{const{wordLimit:n}=e;n?t<n[0]&&0!==n[0]?(N.value=n[0],V.value=!1):t>n[1]?(N.value=n[1],V.value=!1):(N.value=n[1],V.value=!0):(N.value=0,V.value=!0)}),{immediate:!0}),e.watch(w,(async e=>{if(!e)return;const t=o.value.search;f.value&&(f.value.value=""),B.loading=!0,B.list=t.default?await t.default():await t.search(""),B.loading=!1})),e.onMounted((()=>{document.body.addEventListener("click",M),e.watch((()=>l.value),(e=>{const{highlighter:t,texRenderer:n}=o.value;I.value=e,C.value=Le(e,{emojiMap:h.value.map,highlighter:t,texRenderer:n}),E.value=(e=>(e=>e.match(/[\w\d\s\u00C0-\u024F]+/giu)||[])(e).reduce(((e,t)=>e+(""===t.trim()?0:t.trim().split(/\s+/u).length)),0)+(e=>e.match(/[\u4E00-\u9FA5]/gu)||[])(e).length)(e),e?a.default(s.value):a.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?we(de(e)):Promise.resolve(e)))).then((e=>{const t={tabs:[],map:{}};return e.forEach((e=>{const{name:n,folder:o,icon:l,prefix:a,type:r,items:i}=e;t.tabs.push({name:n,icon:be(l,o,a,r),items:i.map((e=>{const n=`${a||""}${e}`;return t.map[n]=be(e,o,a,r),n}))})})),t}))).then((e=>{h.value=e}));var t}),{immediate:!0})})),e.onUnmounted((()=>{document.body.removeEventListener("click",M)})),{config:o,locale:$,insert:R,onChange:()=>{const e=m.value;e.files&&j.value&&z(e.files[0]).then((()=>{e.value=""}))},onDrop:e=>{if(e.dataTransfer?.items){const t=Ve(e.dataTransfer.items);t&&j.value&&(z(t),e.preventDefault())}},onKeyDown:e=>{const t=e.key;(e.ctrlKey||e.metaKey)&&"Enter"===t&&D()},onPaste:e=>{if(e.clipboardData){const t=Ve(e.clipboardData.items);t&&j.value&&z(t)}},onLogin:e=>{e.preventDefault();const{lang:t,serverURL:n}=o.value,l=(window.innerWidth-450)/2,a=(window.innerHeight-450)/2,r=window.open(`${n}/ui/login?lng=${encodeURIComponent(t)}`,"_blank",`width=450,height=450,left=${l},top=${a},scrollbars=no,resizable=no,status=no,location=no,toolbar=no,menubar=no`);r?.postMessage({type:"TOKEN",data:null},"*");const c=({data:e})=>{e&&"userInfo"===e.type&&e.data.token&&(r?.close(),i.value=e.data,(e.data.remember?localStorage:sessionStorage).setItem("WALINE_USER",JSON.stringify(e.data)),window.removeEventListener("message",c))};window.addEventListener("message",c)},onLogout:()=>{i.value={},localStorage.setItem("WALINE_USER","null"),sessionStorage.setItem("WALINE_USER","null")},onProfile:e=>{e.preventDefault();const{lang:t,serverURL:n}=o.value,l=(window.innerWidth-800)/2,a=(window.innerHeight-800)/2;window.open(`${n}/ui/profile?lng=${encodeURIComponent(t)}`,"_blank",`width=800,height=800,left=${l},top=${a},scrollbars=no,resizable=no,status=no,location=no,toolbar=no,menubar=no`)?.postMessage({type:"TOKEN",data:i.value.token},"*");const r=({data:e})=>{e&&"profile"===e.type&&(i.value={...i.value,...e},[localStorage,sessionStorage].filter((e=>e.getItem("WALINE_USER"))).forEach((e=>e.setItem("WALINE_USER",JSON.stringify(i)))),window.removeEventListener("message",r))};window.addEventListener("message",r)},submitComment:D,onImageWallScroll:A,onGifSearch:U,isLogin:x,userInfo:i,isSubmitting:S,wordNumber:E,wordLimit:N,isWordNumberLegal:V,editor:l,userMeta:r,emoji:h,emojiTabIndex:k,showEmoji:y,gifData:B,showGif:w,canUploadImage:j,previewText:C,showPreview:b,inputRefs:c,editorRef:s,emojiButtonRef:d,emojiPopupRef:p,gifButtonRef:v,gifPopupRef:g,imageUploadRef:m,gifSearchInputRef:f}}}),Ae={class:"wl-comment"},Ue={key:0,class:"wl-login-info"},Te={class:"wl-avatar"},Oe=["title"],Pe=["src"],Fe=["textContent"],He={class:"wl-panel"},_e=["for","textContent"],We=["id","name","type","onUpdate:modelValue"],Ge=["placeholder"],qe={class:"wl-preview"},Je=e.createElementVNode("hr",null,null,-1),Ke=["innerHTML"],Ye={class:"wl-footer"},Ze={class:"wl-actions"},Xe={href:"https://guides.github.com/features/mastering-markdown/",title:"Markdown Guide","aria-label":"Markdown is supported",class:"wl-action",target:"_blank",rel:"noreferrer"},Qe=["title"],et=["title"],tt=["title"],nt=["title"],ot={class:"wl-info"},lt={class:"wl-text-number"},at={key:0},rt=e.createTextVNode(" / "),it=["textContent"],ct=["textContent"],st=["disabled"],mt=["placeholder"],ut={key:0,class:"wl-loading"},dt={key:0,class:"wl-tab-wrapper"},pt=["title","onClick"],vt=["src","alt"],gt={key:0,class:"wl-tabs"},ft=["onClick"],ht=["src","alt","title"],kt=["title"];var yt=F(Me,[["render",function(t,n,o,l,a,r){const i=e.resolveComponent("CloseIcon"),c=e.resolveComponent("MarkdownIcon"),s=e.resolveComponent("EmojiIcon"),m=e.resolveComponent("GifIcon"),u=e.resolveComponent("ImageIcon"),d=e.resolveComponent("PreviewIcon"),p=e.resolveComponent("LoadingIcon"),v=e.resolveComponent("ImageWall");return e.openBlock(),e.createElementBlock("div",Ae,["disable"!==t.config.login&&t.isLogin?(e.openBlock(),e.createElementBlock("div",Ue,[e.createElementVNode("div",Te,[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,Oe),e.createElementVNode("img",{src:t.userInfo.avatar,alt:"avatar"},null,8,Pe)]),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,Fe)])):e.createCommentVNode("v-if",!0),e.createElementVNode("div",He,["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,We),[[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,Ge),[[e.vModelText,t.editor]]),e.withDirectives(e.createElementVNode("div",qe,[Je,e.createElementVNode("h4",null,e.toDisplayString(t.locale.preview)+":",1),e.createElementVNode("div",{class:"wl-content",innerHTML:t.previewText},null,8,Ke)],512),[[e.vShow,t.showPreview]]),e.createElementVNode("div",Ye,[e.createElementVNode("div",Ze,[e.createElementVNode("a",Xe,[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,Qe),[[e.vShow,t.emoji.tabs.length]]),t.config.search?(e.openBlock(),e.createElementBlock("button",{key:0,ref:"gifButtonRef",class:e.normalizeClass(["wl-action",{actived:t.showGif}]),title:t.locale.gif,onClick:n[7]||(n[7]=e=>t.showGif=!t.showGif)},[e.createVNode(m)],10,et)):e.createCommentVNode("v-if",!0),e.createElementVNode("input",{ref:"imageUploadRef",class:"upload",id:"wl-image-upload",type:"file",accept:".png,.jpg,.jpeg,.webp,.bmp,.gif",onChange:n[8]||(n[8]=(...e)=>t.onChange&&t.onChange(...e))},null,544),t.canUploadImage?(e.openBlock(),e.createElementBlock("label",{key:1,for:"wl-image-upload",class:"wl-action",title:t.locale.uploadImage},[e.createVNode(u)],8,tt)):e.createCommentVNode("v-if",!0),e.createElementVNode("button",{class:e.normalizeClass(["wl-action",{actived:t.showPreview}]),title:t.locale.preview,onClick:n[9]||(n[9]=e=>t.showPreview=!t.showPreview)},[e.createVNode(d)],10,nt)]),e.createElementVNode("div",ot,[e.createElementVNode("div",lt,[e.createTextVNode(e.toDisplayString(t.wordNumber)+" ",1),t.config.wordLimit?(e.openBlock(),e.createElementBlock("span",at,[rt,e.createElementVNode("span",{class:e.normalizeClass({illegal:!t.isWordNumberLegal}),textContent:e.toDisplayString(t.wordLimit)},null,10,it)])):e.createCommentVNode("v-if",!0),e.createTextVNode(" "+e.toDisplayString(t.locale.word),1)]),"disable"===t.config.login||t.isLogin?e.createCommentVNode("v-if",!0):(e.openBlock(),e.createElementBlock("button",{key:0,class:"wl-btn",onClick:n[10]||(n[10]=(...e)=>t.onLogin&&t.onLogin(...e)),textContent:e.toDisplayString(t.locale.login)},null,8,ct)),"force"!==t.config.login||t.isLogin?(e.openBlock(),e.createElementBlock("button",{key:1,class:"wl-btn primary",title:"Cmd|Ctrl + Enter",disabled:t.isSubmitting,onClick:n[11]||(n[11]=(...e)=>t.submitComment&&t.submitComment(...e))},[t.isSubmitting?(e.openBlock(),e.createBlock(p,{key:0,size:16})):(e.openBlock(),e.createElementBlock(e.Fragment,{key:1},[e.createTextVNode(e.toDisplayString(t.locale.submit),1)],64))],8,st)):e.createCommentVNode("v-if",!0)]),e.createElementVNode("div",{ref:"gifPopupRef",class:e.normalizeClass(["wl-gif-popup",{display:t.showGif}])},[e.createElementVNode("input",{type:"text",placeholder:t.locale.gifSearchPlaceholder,ref:"gifSearchInputRef",onInput:n[12]||(n[12]=(...e)=>t.onGifSearch&&t.onGifSearch(...e))},null,40,mt),e.createVNode(v,{items:t.gifData.list,"column-width":200,gap:6,onInsert:n[13]||(n[13]=e=>t.insert(e)),onScroll:t.onImageWallScroll},null,8,["items","onScroll"]),t.gifData.loading?(e.openBlock(),e.createElementBlock("div",ut,[e.createVNode(p,{size:30})])):e.createCommentVNode("v-if",!0)],2),e.createElementVNode("div",{ref:"emojiPopupRef",class:e.normalizeClass(["wl-emoji-popup",{display:t.showEmoji}])},[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(t.emoji.tabs,((n,o)=>(e.openBlock(),e.createElementBlock(e.Fragment,{key:n.name},[o===t.emojiTabIndex?(e.openBlock(),e.createElementBlock("div",dt,[(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,vt)):e.createCommentVNode("v-if",!0)],8,pt)))),128))])):e.createCommentVNode("v-if",!0)],64)))),128)),t.emoji.tabs.length>1?(e.openBlock(),e.createElementBlock("div",gt,[(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,ht)],10,ft)))),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[14]||(n[14]=e=>t.$emit("cancel-reply"))},[e.createVNode(i,{size:24})],8,kt)):e.createCommentVNode("v-if",!0)])}],["__file","CommentBox.vue"]]);const wt=["approved","waiting","spam"],bt=e.defineComponent({props:{comment:{type:Object,required:!0},rootId:{type:String,required:!0},reply:{type:Object}},components:{CommentBox:yt,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=De(),l=Re(),a=e.computed((()=>n.value.locale)),r=e.computed((()=>{let{link:e}=t.comment;return e?pe(e)?e:`https://${e}`:""})),i=e.computed((()=>o.value.includes(t.comment.objectId))),c=((t,n)=>{const o=T();return e.computed((()=>ye(t,o.value,n)))})(t.comment.insertedAt,a.value),s=e.computed((()=>"administrator"===l.value.type)),m=e.computed((()=>t.comment.user_id&&l.value.objectId===t.comment.user_id)),u=e.computed((()=>t.comment.objectId===t.reply?.objectId));return{config:n,locale:a,isReplyingCurrent:u,link:r,like:i,time:c,isAdmin:s,isOwner:m,commentStatus:wt}}}),Ct=["id"],Et={class:"wl-user","aria-hidden":"true"},Bt=["src"],Nt={class:"wl-card"},Vt={class:"wl-head"},It=["href"],St={key:1,class:"wl-nick"},$t=["textContent"],xt=["textContent"],Lt=["textContent"],jt=["textContent"],Rt=["textContent"],zt={class:"wl-comment-actions"},Dt=["title"],Mt=["textContent"],At=["title"],Ut={class:"wl-meta","aria-hidden":"true"},Tt=["textContent"],Ot=["textContent"],Pt=["textContent"],Ft=["innerHTML"],Ht={key:0,class:"wl-admin-actions"},_t={class:"wl-comment-status"},Wt=["disabled","onClick","textContent"],Gt={key:1,class:"wl-reply-wrapper"},qt={key:2,class:"wl-quote"};var Jt=F(bt,[["render",function(t,n,o,l,a,r){const i=e.resolveComponent("VerifiedIcon"),c=e.resolveComponent("DeleteIcon"),s=e.resolveComponent("LikeIcon"),m=e.resolveComponent("ReplyIcon"),u=e.resolveComponent("CommentBox"),d=e.resolveComponent("CommentCard",!0);return e.openBlock(),e.createElementBlock("div",{class:"wl-item",id:t.comment.objectId},[e.createElementVNode("div",Et,[t.comment.avatar?(e.openBlock(),e.createElementBlock("img",{key:0,src:t.comment.avatar},null,8,Bt)):e.createCommentVNode("v-if",!0),t.comment.type?(e.openBlock(),e.createBlock(i,{key:1})):e.createCommentVNode("v-if",!0)]),e.createElementVNode("div",Nt,[e.createElementVNode("div",Vt,[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,It)):(e.openBlock(),e.createElementBlock("span",St,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,xt)):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,Lt)):e.createCommentVNode("v-if",!0),void 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,jt)):e.createCommentVNode("v-if",!0),e.createElementVNode("span",{class:"wl-time",textContent:e.toDisplayString(t.time)},null,8,Rt),e.createElementVNode("div",zt,[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,Mt)):e.createCommentVNode("v-if",!0)],8,Dt),e.createElementVNode("button",{class:e.normalizeClass(["wl-reply",{active:t.isReplyingCurrent}]),title:t.isReplyingCurrent?t.locale.cancelReply:t.locale.reply,onClick:n[2]||(n[2]=e=>t.$emit("reply",t.isReplyingCurrent?null:t.comment))},[e.createVNode(m)],10,At)])]),e.createElementVNode("div",Ut,[t.comment.addr?(e.openBlock(),e.createElementBlock("span",{key:0,textContent:e.toDisplayString(t.comment.addr)},null,8,Tt)):e.createCommentVNode("v-if",!0),t.comment.browser?(e.openBlock(),e.createElementBlock("span",{key:1,textContent:e.toDisplayString(t.comment.browser)},null,8,Ot)):e.createCommentVNode("v-if",!0),t.comment.os?(e.openBlock(),e.createElementBlock("span",{key:2,textContent:e.toDisplayString(t.comment.os)},null,8,Pt)):e.createCommentVNode("v-if",!0)]),e.createElementVNode("div",{class:"wl-content",innerHTML:t.comment.comment},null,8,Ft),t.isAdmin?(e.openBlock(),e.createElementBlock("div",Ht,[e.createElementVNode("span",_t,[(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,Wt)))),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",Gt,[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",qt,[(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,Ct)}],["__file","CommentCard.vue"]]);const Kt=e.defineComponent({name:"WalineRoot",components:{CommentBox:yt,CommentCard:Jt,LoadingIcon:P},props:["serverURL","path","meta","requiredMeta","dark","lang","locale","pageSize","wordLimit","emoji","login","highlighter","texRenderer","imageUploader","copyright"],setup(t){const n=e.computed((()=>(({serverURL:e,path:t=location.pathname,lang:n="zh-CN",locale:o,emoji:l=["//unpkg.com/@waline/emojis@1.0.1/weibo"],meta:a=["nick","mail","link"],requiredMeta:r=[],dark:i=!1,pageSize:c=10,wordLimit:s,imageUploader:m,highlighter:u,texRenderer:d,copyright:p=!0,login:v="enable",search:g=Z(),...f})=>({serverURL:ve(e),path:ue(t),locale:{...me[n]||me["zh-CN"],..."object"==typeof o?o:{}},wordLimit:ge(s),meta:J(a),requiredMeta:J(r),imageUploader:fe(m,K),highlighter:fe(u,te),texRenderer:fe(d,Y),lang:n,dark:i,emoji:l,pageSize:c,login:v,copyright:p,search:g,...f}))(t))),o=Re(),l=De(),a=e.ref("loading"),i=e.ref(0),c=e.ref(1),s=e.ref(0),m=e.ref([]),u=e.ref(null),d=e.computed((()=>{return"string"==typeof(e=n.value.dark)?"auto"===e?`@media(prefers-color-scheme:dark){body${he}}`:`${e}${he}`:!0===e?`:root${he}`:"";var e}));let p;!function(t,n={}){const o=e.ref(!1),{document:l=N,immediate:a=!0,manual:i=!1,id:c="vueuse_styletag_"+ ++O}=n,s=e.ref(t);let m=()=>{};const u=()=>{if(!l)return;const t=l.getElementById(c)||l.createElement("style");t.type="text/css",t.id=c,n.media&&(t.media=n.media),l.head.appendChild(t),o.value||(m=e.watch(s,(e=>{t.innerText=e}),{immediate:!0}),o.value=!0)},d=()=>{l&&o.value&&(m(),l.head.removeChild(l.getElementById(c)),o.value=!1)};a&&!i&&u(),i||r(d),e.readonly(o)}(d);const v=e=>{const{serverURL:t,path:l,pageSize:r}=n.value,u=new AbortController;a.value="loading",p?.(),Ee({serverURL:t,lang:n.value.lang,path:l,pageSize:r,page:e,signal:u.signal,token:o.value?.token}).then((t=>{a.value="success",i.value=t.count,m.value.push(...t.data),c.value=e,s.value=t.totalPages})).catch((e=>{"AbortError"!==e.name&&(console.error(e.message),a.value="error")})),p=u.abort.bind(u)},g=()=>{i.value=0,m.value=[],v(1)};return e.provide("config",n),e.watch((()=>t.path),g),e.onMounted((()=>g())),{config:n,darkmodeStyle:d,i18n:e.computed((()=>n.value.locale)),status:a,count:i,page:c,totalPages:s,data:m,reply:u,loadMore:()=>v(c.value+1),refresh:g,onReply:e=>{u.value=e},onSubmit:e=>{if(e.rid){const t=m.value.find((({objectId:t})=>t===e.rid));if(!t)return;Array.isArray(t.children)||(t.children=[]),t.children.push(e)}else m.value.unshift(e)},onStatusChange:async({comment:e,status:t})=>{if(e.status===t)return;const{serverURL:l,lang:a}=n.value;await Be({serverURL:l,lang:a,token:o.value?.token,objectId:e.objectId,status:t}),e.status=t},onDelete:async({objectId:e})=>{if(!confirm("Are you sure you want to delete this comment?"))return;const{serverURL:t,lang:l}=n.value;await(({serverURL:e,lang:t,token:n,objectId:o})=>fetch(`${e}/comment/${o}?lang=${t}`,{method:"DELETE",headers:{Authorization:`Bearer ${n}`}}).then((e=>e.json())))({serverURL:t,lang:l,token:o.value?.token,objectId:e}),m.value.some(((t,n)=>t.objectId===e?(m.value=m.value.filter(((e,t)=>t!==n)),!0):t.children.some(((o,l)=>o.objectId===e&&(m.value[n].children=t.children.filter(((e,t)=>t!==l)),!0)))))},onSticky:async e=>{if(e.rid)return;const{serverURL:t,lang:l}=n.value;await Be({serverURL:t,lang:l,token:o.value?.token,objectId:e.objectId,sticky:e.sticky?0:1}),e.sticky=!e.sticky},onLike:async e=>{const{serverURL:t,lang:o}=n.value,{objectId:a}=e,r=l.value.includes(a);await(({serverURL:e,lang:t,objectId:n,like:o})=>fetch(`${e}/comment/${n}?lang=${t}`,{method:"PUT",headers:Ce,body:JSON.stringify({like:o})}).then((e=>e.json())))({serverURL:t,lang:o,objectId:a,like:!r}),r?l.value=l.value.filter((e=>e!==a)):(l.value=[...l.value,a],l.value.length>50&&(l.value=l.value.slice(-50))),e.like=(e.like||0)+(r?-1:1)},version:"2.6.0"}}}),Yt={"data-waline":""},Zt={class:"wl-count"},Xt=["textContent"],Qt={class:"wl-cards"},en={key:1,class:"wl-operation"},tn=["textContent"],nn={key:0,class:"wl-loading"},on=["textContent"],ln={class:"wl-operation"},an=["textContent"],rn={key:3,class:"wl-power"},cn=e.createTextVNode(" Powered by "),sn=e.createElementVNode("a",{href:"https://github.com/walinejs/waline",target:"_blank",rel:"noreferrer"}," Waline ",-1);var mn=F(Kt,[["render",function(t,n,o,l,a,r){const i=e.resolveComponent("CommentBox"),c=e.resolveComponent("CommentCard"),s=e.resolveComponent("LoadingIcon");return e.openBlock(),e.createElementBlock("div",Yt,[t.reply?e.createCommentVNode("v-if",!0):(e.openBlock(),e.createBlock(i,{key:0,onSubmit:t.onSubmit},null,8,["onSubmit"])),e.createElementVNode("div",Zt,[t.count?(e.openBlock(),e.createElementBlock("span",{key:0,class:"wl-num",textContent:e.toDisplayString(t.count)},null,8,Xt)):e.createCommentVNode("v-if",!0),e.createTextVNode(" "+e.toDisplayString(t.i18n.comment),1)]),e.createElementVNode("div",Qt,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(t.data,(n=>(e.openBlock(),e.createBlock(c,{key:n.objectId,"root-id":n.objectId,comment:n,reply:t.reply,onReply:t.onReply,onSubmit:t.onSubmit,onStatus:t.onStatusChange,onDelete:t.onDelete,onSticky:t.onSticky,onLike:t.onLike},null,8,["root-id","comment","reply","onReply","onSubmit","onStatus","onDelete","onSticky","onLike"])))),128))]),"error"===t.status?(e.openBlock(),e.createElementBlock("div",en,[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,tn)])):(e.openBlock(),e.createElementBlock(e.Fragment,{key:2},["loading"===t.status?(e.openBlock(),e.createElementBlock("div",nn,[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",ln,[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,an)])],2112)):e.createCommentVNode("v-if",!0):(e.openBlock(),e.createElementBlock("div",{key:1,class:"wl-empty",textContent:e.toDisplayString(t.i18n.sofa)},null,8,on))],64)),e.createCommentVNode(" Copyright Information "),t.config.copyright?(e.openBlock(),e.createElementBlock("div",rn,[cn,sn,e.createTextVNode(" v"+e.toDisplayString(t.version),1)])):e.createCommentVNode("v-if",!0)])}],["__file","Waline.vue"]]);exports.Waline=mn,exports.version="2.6.0"; | ||
"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,a=o(t);function r(t){return!!e.getCurrentScope()&&(e.onScopeDispose(t),!0)}const i="undefined"!=typeof window,c=()=>{};function s(e,t){return function(...n){e((()=>t.apply(this,n)),{fn:t,thisArg:this,args:n})}}i&&(null==(l=null==window?void 0:window.navigator)?void 0:l.userAgent)&&/iP(ad|hone|od)/.test(window.navigator.userAgent);const m=e=>e();function u(t,n=200,o={}){return s(function(t,n={}){let o,l;return a=>{const r=e.unref(t),i=e.unref(n.maxWait);if(o&&clearTimeout(o),r<=0||void 0!==i&&i<=0)return l&&(clearTimeout(l),l=null),a();i&&!l&&(l=setTimeout((()=>{o&&clearTimeout(o),l=null,a()}),i)),o=setTimeout((()=>{l&&clearTimeout(l),l=null,a()}),r)}}(n,o),t)}var d=Object.getOwnPropertySymbols,p=Object.prototype.hasOwnProperty,v=Object.prototype.propertyIsEnumerable;function g(t,n,o={}){const l=o,{eventFilter:a=m}=l,r=((e,t)=>{var n={};for(var o in e)p.call(e,o)&&t.indexOf(o)<0&&(n[o]=e[o]);if(null!=e&&d)for(var o of d(e))t.indexOf(o)<0&&v.call(e,o)&&(n[o]=e[o]);return n})(l,["eventFilter"]);return e.watch(t,s(a,n),r)}var f=Object.defineProperty,h=Object.defineProperties,k=Object.getOwnPropertyDescriptors,y=Object.getOwnPropertySymbols,w=Object.prototype.hasOwnProperty,b=Object.prototype.propertyIsEnumerable,C=(e,t,n)=>t in e?f(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;function E(t,n,o={}){const l=o,{eventFilter:a}=l,r=((e,t)=>{var n={};for(var o in e)w.call(e,o)&&t.indexOf(o)<0&&(n[o]=e[o]);if(null!=e&&y)for(var o of y(e))t.indexOf(o)<0&&b.call(e,o)&&(n[o]=e[o]);return n})(l,["eventFilter"]),{eventFilter:i,pause:c,resume:s,isActive:u}=function(t=m){const n=e.ref(!0);return{isActive:n,pause:function(){n.value=!1},resume:function(){n.value=!0},eventFilter:(...e)=>{n.value&&t(...e)}}}(a),d=g(t,n,(p=((e,t)=>{for(var n in t||(t={}))w.call(t,n)&&C(e,n,t[n]);if(y)for(var n of y(t))b.call(t,n)&&C(e,n,t[n]);return e})({},r),h(p,k({eventFilter:i}))));var p;return{stop:d,pause:c,resume:s,isActive:u}}const B=i?window:void 0,N=i?window.document:void 0;function V(...t){let n,o,l,a;if("string"==typeof t[0]?([o,l,a]=t,n=B):[n,o,l,a]=t,!n)return c;let i=c;const s=e.watch((()=>function(t){var n;const o=e.unref(t);return null!=(n=null==o?void 0:o.$el)?n:o}(n)),(e=>{i(),e&&(e.addEventListener(o,l,a),i=()=>{e.removeEventListener(o,l,a),i=c})}),{immediate:!0,flush:"post"}),m=()=>{s(),i()};return r(m),m}i&&window.navigator,i&&window.location;const I="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},S="__vueuse_ssr_handlers__";I[S]=I[S]||{};const $=I[S];const x={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 L(t,n,o,l={}){var a;const{flush:r="pre",deep:i=!0,listenToStorageChanges:c=!0,writeDefaults:s=!0,shallow:m,window:u=B,eventFilter:d,onError:p=(e=>{console.error(e)})}=l,v=(m?e.shallowRef:e.ref)(n);if(!o)try{o=function(e,t){return $[e]||t}("getDefaultStorage",(()=>{var e;return null==(e=B)?void 0:e.localStorage}))()}catch(e){p(e)}if(!o)return v;const g=e.unref(n),f=function(e){return null==e?"any":e instanceof Set?"set":e instanceof Map?"map":e instanceof Date?"date":"boolean"==typeof e?"boolean":"string"==typeof e?"string":"object"==typeof e||Array.isArray(e)?"object":Number.isNaN(e)?"any":"number"}(g),h=null!=(a=l.serializer)?a:x[f],{pause:k,resume:y}=E(v,(()=>function(e){try{null==e?o.removeItem(t):o.setItem(t,h.write(e))}catch(e){p(e)}}(v.value)),{flush:r,deep:i,eventFilter:d});return u&&c&&V(u,"storage",w),w(),v;function w(e){e&&e.key!==t||(v.value=function(e){if(!e||e.key===t){k();try{const n=e?e.newValue:o.getItem(t);return null==n?(s&&null!==g&&o.setItem(t,h.write(g)),g):"string"!=typeof n?n:h.read(n)}catch(e){p(e)}finally{y()}}}(e))}}var j,R,z=Object.defineProperty,D=Object.getOwnPropertySymbols,M=Object.prototype.hasOwnProperty,A=Object.prototype.propertyIsEnumerable,U=(e,t,n)=>t in e?z(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;function T(t={}){const{controls:n=!1,interval:o="requestAnimationFrame"}=t,l=e.ref(new Date),a=()=>l.value=new Date,c="requestAnimationFrame"===o?function(t,n={}){const{immediate:o=!0,window:l=B}=n,a=e.ref(!1);let i=null;function c(){a.value&&l&&(t(),i=l.requestAnimationFrame(c))}function s(){!a.value&&l&&(a.value=!0,c())}function m(){a.value=!1,null!=i&&l&&(l.cancelAnimationFrame(i),i=null)}return o&&s(),r(m),{isActive:a,pause:m,resume:s}}(a,{immediate:!0}):function(t,n=1e3,o={}){const{immediate:l=!0,immediateCallback:a=!1}=o;let c=null;const s=e.ref(!1);function m(){c&&(clearInterval(c),c=null)}function u(){s.value=!1,m()}function d(){e.unref(n)<=0||(s.value=!0,a&&t(),m(),c=setInterval(t,e.unref(n)))}l&&i&&d(),e.isRef(n)&&r(e.watch(n,(()=>{l&&i&&d()})));return r(u),{isActive:s,pause:u,resume:d}}(a,o,{immediate:!0});return n?((e,t)=>{for(var n in t||(t={}))M.call(t,n)&&U(e,n,t[n]);if(D)for(var n of D(t))A.call(t,n)&&U(e,n,t[n]);return e})({now:l},c):l}(R=j||(j={})).UP="UP",R.RIGHT="RIGHT",R.DOWN="DOWN",R.LEFT="LEFT",R.NONE="NONE";let O=0;const P=({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 F=(e,t)=>{const n=e.__vccOpts||e;for(const[e,o]of t)n[e]=o;return n};const H=e.defineComponent({name:"ImageWall",components:{LoadingIcon:P},props:{items:{type:Array,default:()=>[]},columnWidth:{type:Number,default:300},gap:{type:Number,default:0}},emit:["insert"],setup(t){let n=null;const o=e.ref(null),l=e.ref({}),a=e.ref([]),r=()=>{const e=Math.floor((o.value.getBoundingClientRect().width+t.gap)/(t.columnWidth+t.gap));return e>0?e:1},i=async n=>{if(n>=t.items.length)return;await e.nextTick();const l=Array.from(o.value?.children||[]).reduce(((e,t)=>t.getBoundingClientRect().height<e.getBoundingClientRect().height?t:e));a.value[Number(l.dataset.index)].push(n),await i(n+1)},c=async(e=!1)=>{if(a.value.length===r()&&!e)return;var t;a.value=(t=r(),new Array(t).fill(null).map((()=>[])));const n=window.scrollY;await i(0),window.scrollTo({top:n})};return e.watch((()=>[t.items]),(()=>{l.value={},c(!0)})),e.watch((()=>[t.columnWidth,t.gap]),(()=>c())),e.onMounted((()=>{c(!0),n=new ResizeObserver((()=>c())),n.observe(o.value)})),e.onBeforeUnmount((()=>n.unobserve(o.value))),{columns:a,state:l,wall:o}}}),_=["data-index"],W=["src","title","onLoad","onClick"];var G=F(H,[["render",function(t,n,o,l,a,r){const i=e.resolveComponent("LoadingIcon");return e.openBlock(),e.createElementBlock("div",{ref:"wall",class:"wl-gallery",style:e.normalizeStyle({gap:`${t.gap}px`})},[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(t.columns,((n,o)=>(e.openBlock(),e.createElementBlock("div",{key:o,class:"wl-gallery-column","data-index":o,style:e.normalizeStyle({gap:`${t.gap}px`})},[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(n,(n=>(e.openBlock(),e.createElementBlock(e.Fragment,{key:n},[t.state[t.items[n].src]?e.createCommentVNode("v-if",!0):(e.openBlock(),e.createBlock(i,{key:0,size:36,style:{margin:"20px auto"}})),e.createElementVNode("img",{class:"wl-gallery-item",src:t.items[n].src,title:t.items[n].title,loading:"lazy",onLoad:e=>t.state[t.items[n].src]=!0,onClick:e=>t.$emit("insert",`![](${t.items[n].src})`)},null,40,W)],64)))),128))],12,_)))),128))],4)}],["__file","ImageWall.vue"]]);const q=["nick","mail","link"],J=e=>e.filter((e=>q.includes(e))),K=e=>new Promise(((t,n)=>{const o=new FileReader;o.readAsDataURL(e),o.onload=()=>t(o.result?.toString()||""),o.onerror=n})),Y=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>',Z=()=>{const e={next:""},t=({keyword:e,pos:t})=>{const n=new URLSearchParams("media_filter=minimal");return n.set("key","PAY5JLFIH6V6"),n.set("limit","20"),n.set("pos",t||""),n.set("q",e),fetch(`https://g.tenor.com/v1/search?${n.toString()}`,{headers:{"Content-Type":"application/json"}}).then((e=>e.json())).catch((()=>({next:t||"",results:[]})))};return{search:(n="")=>t({keyword:n}).then((t=>(e.next=t.next,t.results.map((e=>({title:e.title,src:e.media[0].tinygif.url})))))),more:n=>t({keyword:n,pos:e.next}).then((t=>(e.next=t.next,t.results.map((e=>({title:e.title,src:e.media[0].tinygif.url}))))))}},X=new RegExp(`(${/[\u4E00-\u9FFF\u3400-\u4dbf\uf900-\ufaff\u3040-\u309f\uac00-\ud7af\u0400-\u04FF]+|\w+/.source}|${/</.source})|((?:${/(?:^|\s)\/\/(.+?)$/gm.source})|(?:${/\/\*([\S\s]*?)\*\//gm.source}))`,"gmi"),Q=["23AC69","91C132","F19726","E8552D","1AAB8E","E1147F","2980C1","1BA1E6","9FA0A0","F19726","E30B20","E30B20","A3338B"],ee={},te=e=>{let t=0;return e.replace(X,((e,n,o)=>{if(o)return`<span style="color: slategray">${o}</span>`;if("<"===n)return"<";let l;ee[n]?l=ee[n]:(l=Q[t],ee[n]=l);const a=`<span style="color: #${l}">${n}</span>`;return t=++t%Q.length,a}))},ne=["nick","nickError","mail","mailError","link","optional","placeholder","sofa","submit","like","cancelLike","reply","cancelReply","comment","refresh","more","preview","emoji","uploadImage","seconds","minutes","hours","days","now","uploading","login","logout","admin","sticky","word","wordHint","anonymous","level0","level1","level2","level3","level4","level5","gif","gifSearchPlaceholder"],oe=e=>Object.fromEntries(e.map(((e,t)=>[ne[t],e])));var le=oe(["NickName","NickName cannot be less than 3 bytes.","E-Mail","Please confirm your email address.","Website","Optional","Comment here...","No comment yet.","Submit","Like","Cancel like","Reply","Cancel reply","Comments","Refresh","Load More...","Preview","Emoji","Upload Image","seconds ago","minutes ago","hours ago","days ago","just now","Uploading","Login","logout","Admin","Sticky","Words","Please input comments between $0 and $1 words!\n Current word number: $2","Anonymous","Dwarves","Hobbits","Ents","Wizards","Elves","Maiar","GIF","Search GIF"]),ae=oe(["ニックネーム","3バイト以上のニックネームをご入力ください.","メールアドレス","メールアドレスをご確認ください.","サイト","オプション","ここにコメント","コメントしましょう~","提出する","Like","Cancel like","返信する","キャンセル","コメント","更新","さらに読み込む","プレビュー","絵文字","画像をアップロード","秒前","分前","時間前","日前","たっだ今","アップロード","ログインする","ログアウト","管理者","トップに置く","ワード","コメントは $0 から $1 ワードの間でなければなりません!\n 現在の単語番号: $2","匿名","うえにん","なかにん","しもおし","特にしもおし","かげ","なぬし","GIF","探す GIF"]),re=oe(["昵称","昵称不能少于3个字符","邮箱","请填写正确的邮件地址","网址","可选","欢迎评论","来发评论吧~","提交","喜欢","取消喜欢","回复","取消回复","评论","刷新","加载更多...","预览","表情","上传图片","秒前","分钟前","小时前","天前","刚刚","正在上传","登录","退出","博主","置顶","字","评论字数应在 $0 到 $1 字之间!\n当前字数:$2","匿名","潜水","冒泡","吐槽","活跃","话痨","传说","表情包","搜索表情包"]),ie=oe(["暱稱","郵箱","網址","可選","暱稱不能少於3個字元","請填寫正確的郵件地址","歡迎評論","來發評論吧~","提交","喜歡","取消喜歡","回覆","取消回覆","評論","刷新","載入更多...","預覽","表情","上傳圖片","秒前","分鐘前","小時前","天前","剛剛","正在上傳","登錄","退出","博主","置頂","字","評論字數應在 $0 到 $1 字之間!\n當前字數:$2","匿名","潛水","冒泡","吐槽","活躍","話癆","傳說","表情包","搜索表情包"]),ce=oe(["Apelido","Apelido não pode ser menor que 3 bytes.","E-Mail","Por favor, confirme seu endereço de e-mail.","Website","Opcional","Comente aqui...","Nenhum comentário, ainda.","Enviar","Like","Cancel like","Responder","Cancelar resposta","Comentários","Refrescar","Carregar Mais...","Visualizar","Emoji","Enviar Imagem","segundos atrás","minutos atrás","horas atrás","dias atrás","agora mesmo","Enviando","Entrar","Sair","Admin","Sticky","Palavras","Favor enviar comentário com $0 a $1 palavras!\n Número de palavras atuais: $2","Anônimo","Dwarves","Hobbits","Ents","Wizards","Elves","Maiar","GIF","Pesquisar GIF"]),se=oe(["Псевдоним","Никнейм не может быть меньше 3 байт.","Эл. адрес","Пожалуйста, подтвердите адрес вашей электронной почты.","Веб-сайт","Необязательный","Комментарий здесь...","Пока нет комментариев.","Отправить","Like","Cancel like","Отвечать","Отменить ответ","Комментарии","Обновить","Загрузи больше...","Превью","эмодзи","Загрузить изображение","секунд назад","несколько минут назад","несколько часов назад","дней назад","прямо сейчас","Загрузка","Авторизоваться","Выход из системы","Админ","Липкий","Слова","Пожалуйста, введите комментарии от $0 до $1 слов!\nНомер текущего слова: $2","Анонимный","Dwarves","Hobbits","Ents","Wizards","Elves","Maiar","GIF","Поиск GIF"]);const me={zh:re,"zh-cn":re,"zh-CN":re,"zh-tw":ie,"zh-TW":ie,en:le,"en-US":le,"en-us":le,jp:ae,"jp-jp":ae,"jp-JP":ae,"pt-br":ce,"pt-BR":ce,ru:se,"ru-ru":se,"ru-RU":se},ue=e=>{try{e=decodeURI(e)}catch(e){}return e},de=(e="")=>e.replace(/\/$/u,""),pe=e=>/^(https?:)?\/\//.test(e),ve=e=>{const t=de(e);return pe(t)?t:`https://${t}`},ge=e=>Array.isArray(e)?e:!!e&&[0,e],fe=(e,t)=>"function"==typeof e?e:!1!==e&&t,he="{--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}",ke=(e,t)=>{let n=e.toString();for(;n.length<t;)n="0"+n;return n},ye=(e,t,n)=>{if(!e)return"";const o="string"==typeof e?new Date(-1!==e.indexOf(" ")?e.replace(/-/g,"/"):e):e,l=t.getTime()-o.getTime(),a=Math.floor(l/864e5);if(0===a){const e=l%864e5,t=Math.floor(e/36e5);if(0===t){const t=e%36e5,o=Math.floor(t/6e4);if(0===o){const e=t%6e4;return`${Math.round(e/1e3)} ${n.seconds}`}return`${o} ${n.minutes}`}return`${t} ${n.hours}`}return a<0?n.now:a<8?`${a} ${n.days}`:(e=>{const t=ke(e.getDate(),2),n=ke(e.getMonth()+1,2);return`${ke(e.getFullYear(),2)}-${n}-${t}`})(o)},we=e=>{const t=L("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}))},be=(e,t="",n="",o="")=>`${t?`${t}/`:""}${n}${e}${o?`.${o}`:""}`,Ce={"Content-Type":"application/json"},Ee=({serverURL:e,lang:t,path:n,page:o,pageSize:l,signal:a,token:r})=>{const i={};return r&&(i.Authorization=`Bearer ${r}`),fetch(`${e}/comment?path=${encodeURIComponent(n)}&pageSize=${l}&page=${o}&lang=${t}`,{signal:a,headers:i}).then((e=>e.json())).then((e=>((e,t="")=>{if("object"==typeof e&&e.errno)throw new TypeError(`Fetch ${t} failed with ${e.errno}: ${e.errmsg}`);return e})(e,"comment list")))},Be=({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())),Ne=e=>e.type.includes("image"),Ve=e=>{const t=Array.from(e).find(Ne);return t?t.getAsFile():null},Ie=/\$.*?\$/,Se=/^\$(.*?)\$/,$e=/^(?:\s{0,3})\$\$((?:[^\n]|\n[^\n])+?)\n{0,1}\$\$/,xe=(e="",t={})=>e.replace(/:(.+?):/g,((e,n)=>t[n]?`<img class="wl-emoji" src="${t[n]}" alt="${n}">`:e)),Le=(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=$e.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(Ie);return-1!==t?t:e.length},tokenizer(t){const n=Se.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(xe(e,t))};let je=null;const Re=()=>je||(je=L("USER_KEY",{}));let ze=null;const De=()=>ze||(ze=L("WALINE_LIKE",[])),Me=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"})]),ImageWall:G,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:P,GifIcon:()=>e.h("svg",{width:24,height:24,fill:"currentcolor",viewBox:"0 0 24 24"},[e.h("path",{style:"transform: translateY(0.5px)",d:"M18.968 10.5H15.968V11.484H17.984V12.984H15.968V15H14.468V9H18.968V10.5V10.5ZM8.984 9C9.26533 9 9.49967 9.09367 9.687 9.281C9.87433 9.46833 9.968 9.70267 9.968 9.984V10.5H6.499V13.5H8.468V12H9.968V14.016C9.968 14.2973 9.87433 14.5317 9.687 14.719C9.49967 14.9063 9.26533 15 8.984 15H5.984C5.70267 15 5.46833 14.9063 5.281 14.719C5.09367 14.5317 5 14.2973 5 14.016V9.985C5 9.70367 5.09367 9.46933 5.281 9.282C5.46833 9.09467 5.70267 9.001 5.984 9.001H8.984V9ZM11.468 9H12.968V15H11.468V9V9Z"}),e.h("path",{d:"M18.5 3H5.75C3.6875 3 2 4.6875 2 6.75V18C2 20.0625 3.6875 21.75 5.75 21.75H18.5C20.5625 21.75 22.25 20.0625 22.25 18V6.75C22.25 4.6875 20.5625 3 18.5 3ZM20.75 18C20.75 19.2375 19.7375 20.25 18.5 20.25H5.75C4.5125 20.25 3.5 19.2375 3.5 18V6.75C3.5 5.5125 4.5125 4.5 5.75 4.5H18.5C19.7375 4.5 20.75 5.5125 20.75 6.75V18Z"})])},props:{rootId:{type:String,default:""},replyId:{type:String,default:""},replyUser:{type:String,default:""}},emits:["submit","cancel-reply"],setup(t,{emit:n}){const o=e.inject("config"),l=L("WALINE_COMMENT_BOX_EDITOR",""),r=L("WALINE_USER_META",{nick:"",mail:"",link:""}),i=Re(),c=e.ref({}),s=e.ref(null),m=e.ref(null),d=e.ref(null),p=e.ref(null),v=e.ref(null),g=e.ref(null),f=e.ref(null),h=e.ref({tabs:[],map:{}}),k=e.ref(0),y=e.ref(!1),w=e.ref(!1),b=e.ref(!1),C=e.ref(""),E=e.ref(0),B=e.reactive({loading:!0,list:[]}),N=e.ref(0),V=e.ref(!1),I=e.ref(""),S=e.ref(!1),$=e.computed((()=>o.value.locale)),x=e.computed((()=>Boolean(i.value?.token))),j=e.computed((()=>!1!==o.value.imageUploader)),R=e=>{const t=s.value,n=t.selectionStart,o=t.selectionEnd||0,a=t.scrollTop;l.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=a},z=e=>{const t=`![${o.value.locale.uploading} ${e.name}]()`;return R(t),Promise.resolve().then((()=>o.value.imageUploader(e))).then((n=>{l.value=l.value.replace(t,`\r\n![${e.name}](${n})`)}))},D=()=>{const{serverURL:e,lang:a,login:m,wordLimit:u,requiredMeta:d}=o.value,p={comment:I.value,nick:r.value.nick,mail:r.value.mail,link:r.value.link,ua:navigator.userAgent,url:o.value.path};if(i.value?.token)p.nick=i.value.display_name,p.mail=i.value.email,p.link=i.value.url;else{if("force"===m)return;if(d.indexOf("nick")>-1&&!p.nick)return c.value.nick?.focus(),alert($.value.nickError);if(d.indexOf("mail")>-1&&!p.mail||p.mail&&!/^\w(?:[\w._-]*\w)?@(?:\w(?:[\w-]*\w)?\.)*\w+$/.exec(p.mail))return c.value.mail?.focus(),alert($.value.mailError);if(!p.comment)return void s.value?.focus();p.nick||(p.nick=$.value.anonymous)}if(!V.value)return alert($.value.wordHint.replace("$0",u[0].toString()).replace("$1",u[1].toString()).replace("$2",E.value.toString()));p.comment=xe(p.comment,h.value.map),t.replyId&&t.rootId&&(p.pid=t.replyId,p.rid=t.rootId,p.at=t.replyUser),S.value=!0,(({serverURL:e,lang:t,token:n,comment:o})=>{const l={"Content-Type":"application/json"};return n&&(l.Authorization=`Bearer ${n}`),fetch(`${e}/comment?lang=${t}`,{method:"POST",headers:l,body:JSON.stringify(o)}).then((e=>e.json()))})({serverURL:e,lang:a,token:i.value?.token,comment:p}).then((e=>{if(S.value=!1,e.errmsg)return alert(e.errmsg);n("submit",e.data),l.value="",C.value="",t.replyId&&n("cancel-reply")})).catch((e=>{S.value=!1,alert(e.message)}))},M=e=>{d.value.contains(e.target)||p.value.contains(e.target)||(y.value=!1),v.value.contains(e.target)||g.value.contains(e.target)||(w.value=!1)},A=async e=>{const{scrollTop:t,clientHeight:n,scrollHeight:l}=e.target,a=(n+t)/l,r=o.value.search,i=f.value?.value||"";a<.9||B.loading||(B.loading=!0,B.list.push(...r.more?await r.more(i,B.list.length):await r.search(i)),B.loading=!1,setTimeout((()=>{e.target.scrollTop=t}),50))},U=u((e=>{B.list=[],A(e)}),300);return e.watch([o,E],(([e,t])=>{const{wordLimit:n}=e;n?t<n[0]&&0!==n[0]?(N.value=n[0],V.value=!1):t>n[1]?(N.value=n[1],V.value=!1):(N.value=n[1],V.value=!0):(N.value=0,V.value=!0)}),{immediate:!0}),e.watch(w,(async e=>{if(!e)return;const t=o.value.search;f.value&&(f.value.value=""),B.loading=!0,B.list=t.default?await t.default():await t.search(""),B.loading=!1})),e.onMounted((()=>{document.body.addEventListener("click",M),e.watch((()=>l.value),(e=>{const{highlighter:t,texRenderer:n}=o.value;I.value=e,C.value=Le(e,{emojiMap:h.value.map,highlighter:t,texRenderer:n}),E.value=(e=>(e=>e.match(/[\w\d\s\u00C0-\u024F]+/giu)||[])(e).reduce(((e,t)=>e+(""===t.trim()?0:t.trim().split(/\s+/u).length)),0)+(e=>e.match(/[\u4E00-\u9FA5]/gu)||[])(e).length)(e),e?a.default(s.value):a.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?we(de(e)):Promise.resolve(e)))).then((e=>{const t={tabs:[],map:{}};return e.forEach((e=>{const{name:n,folder:o,icon:l,prefix:a,type:r,items:i}=e;t.tabs.push({name:n,icon:be(l,o,a,r),items:i.map((e=>{const n=`${a||""}${e}`;return t.map[n]=be(e,o,a,r),n}))})})),t}))).then((e=>{h.value=e}));var t}),{immediate:!0})})),e.onUnmounted((()=>{document.body.removeEventListener("click",M)})),{config:o,locale:$,insert:R,onChange:()=>{const e=m.value;e.files&&j.value&&z(e.files[0]).then((()=>{e.value=""}))},onDrop:e=>{if(e.dataTransfer?.items){const t=Ve(e.dataTransfer.items);t&&j.value&&(z(t),e.preventDefault())}},onKeyDown:e=>{const t=e.key;(e.ctrlKey||e.metaKey)&&"Enter"===t&&D()},onPaste:e=>{if(e.clipboardData){const t=Ve(e.clipboardData.items);t&&j.value&&z(t)}},onLogin:e=>{e.preventDefault();const{lang:t,serverURL:n}=o.value,l=(window.innerWidth-450)/2,a=(window.innerHeight-450)/2,r=window.open(`${n}/ui/login?lng=${encodeURIComponent(t)}`,"_blank",`width=450,height=450,left=${l},top=${a},scrollbars=no,resizable=no,status=no,location=no,toolbar=no,menubar=no`);r?.postMessage({type:"TOKEN",data:null},"*");const c=({data:e})=>{e&&"userInfo"===e.type&&e.data.token&&(r?.close(),i.value=e.data,(e.data.remember?localStorage:sessionStorage).setItem("WALINE_USER",JSON.stringify(e.data)),window.removeEventListener("message",c))};window.addEventListener("message",c)},onLogout:()=>{i.value={},localStorage.setItem("WALINE_USER","null"),sessionStorage.setItem("WALINE_USER","null")},onProfile:e=>{e.preventDefault();const{lang:t,serverURL:n}=o.value,l=(window.innerWidth-800)/2,a=(window.innerHeight-800)/2;window.open(`${n}/ui/profile?lng=${encodeURIComponent(t)}`,"_blank",`width=800,height=800,left=${l},top=${a},scrollbars=no,resizable=no,status=no,location=no,toolbar=no,menubar=no`)?.postMessage({type:"TOKEN",data:i.value.token},"*");const r=({data:e})=>{e&&"profile"===e.type&&(i.value={...i.value,...e},[localStorage,sessionStorage].filter((e=>e.getItem("WALINE_USER"))).forEach((e=>e.setItem("WALINE_USER",JSON.stringify(i)))),window.removeEventListener("message",r))};window.addEventListener("message",r)},submitComment:D,onImageWallScroll:A,onGifSearch:U,isLogin:x,userInfo:i,isSubmitting:S,wordNumber:E,wordLimit:N,isWordNumberLegal:V,editor:l,userMeta:r,emoji:h,emojiTabIndex:k,showEmoji:y,gifData:B,showGif:w,canUploadImage:j,previewText:C,showPreview:b,inputRefs:c,editorRef:s,emojiButtonRef:d,emojiPopupRef:p,gifButtonRef:v,gifPopupRef:g,imageUploadRef:m,gifSearchInputRef:f}}}),Ae={class:"wl-comment"},Ue={key:0,class:"wl-login-info"},Te={class:"wl-avatar"},Oe=["title"],Pe=["src"],Fe=["textContent"],He={class:"wl-panel"},_e=["for","textContent"],We=["id","name","type","onUpdate:modelValue"],Ge=["placeholder"],qe={class:"wl-preview"},Je=e.createElementVNode("hr",null,null,-1),Ke=["innerHTML"],Ye={class:"wl-footer"},Ze={class:"wl-actions"},Xe={href:"https://guides.github.com/features/mastering-markdown/",title:"Markdown Guide","aria-label":"Markdown is supported",class:"wl-action",target:"_blank",rel:"noreferrer"},Qe=["title"],et=["title"],tt=["title"],nt=["title"],ot={class:"wl-info"},lt={class:"wl-text-number"},at={key:0},rt=e.createTextVNode(" / "),it=["textContent"],ct=["textContent"],st=["disabled"],mt=["placeholder"],ut={key:0,class:"wl-loading"},dt={key:0,class:"wl-tab-wrapper"},pt=["title","onClick"],vt=["src","alt"],gt={key:0,class:"wl-tabs"},ft=["onClick"],ht=["src","alt","title"],kt=["title"];var yt=F(Me,[["render",function(t,n,o,l,a,r){const i=e.resolveComponent("CloseIcon"),c=e.resolveComponent("MarkdownIcon"),s=e.resolveComponent("EmojiIcon"),m=e.resolveComponent("GifIcon"),u=e.resolveComponent("ImageIcon"),d=e.resolveComponent("PreviewIcon"),p=e.resolveComponent("LoadingIcon"),v=e.resolveComponent("ImageWall");return e.openBlock(),e.createElementBlock("div",Ae,["disable"!==t.config.login&&t.isLogin?(e.openBlock(),e.createElementBlock("div",Ue,[e.createElementVNode("div",Te,[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,Oe),e.createElementVNode("img",{src:t.userInfo.avatar,alt:"avatar"},null,8,Pe)]),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,Fe)])):e.createCommentVNode("v-if",!0),e.createElementVNode("div",He,["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,We),[[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,Ge),[[e.vModelText,t.editor]]),e.withDirectives(e.createElementVNode("div",qe,[Je,e.createElementVNode("h4",null,e.toDisplayString(t.locale.preview)+":",1),e.createElementVNode("div",{class:"wl-content",innerHTML:t.previewText},null,8,Ke)],512),[[e.vShow,t.showPreview]]),e.createElementVNode("div",Ye,[e.createElementVNode("div",Ze,[e.createElementVNode("a",Xe,[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,Qe),[[e.vShow,t.emoji.tabs.length]]),t.config.search?(e.openBlock(),e.createElementBlock("button",{key:0,ref:"gifButtonRef",class:e.normalizeClass(["wl-action",{actived:t.showGif}]),title:t.locale.gif,onClick:n[7]||(n[7]=e=>t.showGif=!t.showGif)},[e.createVNode(m)],10,et)):e.createCommentVNode("v-if",!0),e.createElementVNode("input",{ref:"imageUploadRef",class:"upload",id:"wl-image-upload",type:"file",accept:".png,.jpg,.jpeg,.webp,.bmp,.gif",onChange:n[8]||(n[8]=(...e)=>t.onChange&&t.onChange(...e))},null,544),t.canUploadImage?(e.openBlock(),e.createElementBlock("label",{key:1,for:"wl-image-upload",class:"wl-action",title:t.locale.uploadImage},[e.createVNode(u)],8,tt)):e.createCommentVNode("v-if",!0),e.createElementVNode("button",{class:e.normalizeClass(["wl-action",{actived:t.showPreview}]),title:t.locale.preview,onClick:n[9]||(n[9]=e=>t.showPreview=!t.showPreview)},[e.createVNode(d)],10,nt)]),e.createElementVNode("div",ot,[e.createElementVNode("div",lt,[e.createTextVNode(e.toDisplayString(t.wordNumber)+" ",1),t.config.wordLimit?(e.openBlock(),e.createElementBlock("span",at,[rt,e.createElementVNode("span",{class:e.normalizeClass({illegal:!t.isWordNumberLegal}),textContent:e.toDisplayString(t.wordLimit)},null,10,it)])):e.createCommentVNode("v-if",!0),e.createTextVNode(" "+e.toDisplayString(t.locale.word),1)]),"disable"===t.config.login||t.isLogin?e.createCommentVNode("v-if",!0):(e.openBlock(),e.createElementBlock("button",{key:0,class:"wl-btn",onClick:n[10]||(n[10]=(...e)=>t.onLogin&&t.onLogin(...e)),textContent:e.toDisplayString(t.locale.login)},null,8,ct)),"force"!==t.config.login||t.isLogin?(e.openBlock(),e.createElementBlock("button",{key:1,class:"wl-btn primary",title:"Cmd|Ctrl + Enter",disabled:t.isSubmitting,onClick:n[11]||(n[11]=(...e)=>t.submitComment&&t.submitComment(...e))},[t.isSubmitting?(e.openBlock(),e.createBlock(p,{key:0,size:16})):(e.openBlock(),e.createElementBlock(e.Fragment,{key:1},[e.createTextVNode(e.toDisplayString(t.locale.submit),1)],64))],8,st)):e.createCommentVNode("v-if",!0)]),e.createElementVNode("div",{ref:"gifPopupRef",class:e.normalizeClass(["wl-gif-popup",{display:t.showGif}])},[e.createElementVNode("input",{type:"text",placeholder:t.locale.gifSearchPlaceholder,ref:"gifSearchInputRef",onInput:n[12]||(n[12]=(...e)=>t.onGifSearch&&t.onGifSearch(...e))},null,40,mt),e.createVNode(v,{items:t.gifData.list,"column-width":200,gap:6,onInsert:n[13]||(n[13]=e=>t.insert(e)),onScroll:t.onImageWallScroll},null,8,["items","onScroll"]),t.gifData.loading?(e.openBlock(),e.createElementBlock("div",ut,[e.createVNode(p,{size:30})])):e.createCommentVNode("v-if",!0)],2),e.createElementVNode("div",{ref:"emojiPopupRef",class:e.normalizeClass(["wl-emoji-popup",{display:t.showEmoji}])},[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(t.emoji.tabs,((n,o)=>(e.openBlock(),e.createElementBlock(e.Fragment,{key:n.name},[o===t.emojiTabIndex?(e.openBlock(),e.createElementBlock("div",dt,[(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,vt)):e.createCommentVNode("v-if",!0)],8,pt)))),128))])):e.createCommentVNode("v-if",!0)],64)))),128)),t.emoji.tabs.length>1?(e.openBlock(),e.createElementBlock("div",gt,[(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,ht)],10,ft)))),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[14]||(n[14]=e=>t.$emit("cancel-reply"))},[e.createVNode(i,{size:24})],8,kt)):e.createCommentVNode("v-if",!0)])}],["__file","CommentBox.vue"]]);const wt=["approved","waiting","spam"],bt=e.defineComponent({props:{comment:{type:Object,required:!0},rootId:{type:String,required:!0},reply:{type:Object}},components:{CommentBox:yt,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=De(),l=Re(),a=e.computed((()=>n.value.locale)),r=e.computed((()=>{let{link:e}=t.comment;return e?pe(e)?e:`https://${e}`:""})),i=e.computed((()=>o.value.includes(t.comment.objectId))),c=((t,n)=>{const o=T();return e.computed((()=>ye(t,o.value,n)))})(t.comment.insertedAt,a.value),s=e.computed((()=>"administrator"===l.value.type)),m=e.computed((()=>t.comment.user_id&&l.value.objectId===t.comment.user_id)),u=e.computed((()=>t.comment.objectId===t.reply?.objectId));return{config:n,locale:a,isReplyingCurrent:u,link:r,like:i,time:c,isAdmin:s,isOwner:m,commentStatus:wt}}}),Ct=["id"],Et={class:"wl-user","aria-hidden":"true"},Bt=["src"],Nt={class:"wl-card"},Vt={class:"wl-head"},It=["href"],St={key:1,class:"wl-nick"},$t=["textContent"],xt=["textContent"],Lt=["textContent"],jt=["textContent"],Rt=["textContent"],zt={class:"wl-comment-actions"},Dt=["title"],Mt=["textContent"],At=["title"],Ut={class:"wl-meta","aria-hidden":"true"},Tt=["textContent"],Ot=["textContent"],Pt=["textContent"],Ft=["innerHTML"],Ht={key:0,class:"wl-admin-actions"},_t={class:"wl-comment-status"},Wt=["disabled","onClick","textContent"],Gt={key:1,class:"wl-reply-wrapper"},qt={key:2,class:"wl-quote"};var Jt=F(bt,[["render",function(t,n,o,l,a,r){const i=e.resolveComponent("VerifiedIcon"),c=e.resolveComponent("DeleteIcon"),s=e.resolveComponent("LikeIcon"),m=e.resolveComponent("ReplyIcon"),u=e.resolveComponent("CommentBox"),d=e.resolveComponent("CommentCard",!0);return e.openBlock(),e.createElementBlock("div",{class:"wl-item",id:t.comment.objectId},[e.createElementVNode("div",Et,[t.comment.avatar?(e.openBlock(),e.createElementBlock("img",{key:0,src:t.comment.avatar},null,8,Bt)):e.createCommentVNode("v-if",!0),t.comment.type?(e.openBlock(),e.createBlock(i,{key:1})):e.createCommentVNode("v-if",!0)]),e.createElementVNode("div",Nt,[e.createElementVNode("div",Vt,[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,It)):(e.openBlock(),e.createElementBlock("span",St,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,xt)):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,Lt)):e.createCommentVNode("v-if",!0),void 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,jt)):e.createCommentVNode("v-if",!0),e.createElementVNode("span",{class:"wl-time",textContent:e.toDisplayString(t.time)},null,8,Rt),e.createElementVNode("div",zt,[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,Mt)):e.createCommentVNode("v-if",!0)],8,Dt),e.createElementVNode("button",{class:e.normalizeClass(["wl-reply",{active:t.isReplyingCurrent}]),title:t.isReplyingCurrent?t.locale.cancelReply:t.locale.reply,onClick:n[2]||(n[2]=e=>t.$emit("reply",t.isReplyingCurrent?null:t.comment))},[e.createVNode(m)],10,At)])]),e.createElementVNode("div",Ut,[t.comment.addr?(e.openBlock(),e.createElementBlock("span",{key:0,textContent:e.toDisplayString(t.comment.addr)},null,8,Tt)):e.createCommentVNode("v-if",!0),t.comment.browser?(e.openBlock(),e.createElementBlock("span",{key:1,textContent:e.toDisplayString(t.comment.browser)},null,8,Ot)):e.createCommentVNode("v-if",!0),t.comment.os?(e.openBlock(),e.createElementBlock("span",{key:2,textContent:e.toDisplayString(t.comment.os)},null,8,Pt)):e.createCommentVNode("v-if",!0)]),e.createElementVNode("div",{class:"wl-content",innerHTML:t.comment.comment},null,8,Ft),t.isAdmin?(e.openBlock(),e.createElementBlock("div",Ht,[e.createElementVNode("span",_t,[(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,Wt)))),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",Gt,[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",qt,[(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,Ct)}],["__file","CommentCard.vue"]]);const Kt=e.defineComponent({name:"WalineRoot",components:{CommentBox:yt,CommentCard:Jt,LoadingIcon:P},props:["serverURL","path","meta","requiredMeta","dark","lang","locale","pageSize","wordLimit","emoji","login","highlighter","texRenderer","imageUploader","copyright"],setup(t){const n=e.computed((()=>(({serverURL:e,path:t=location.pathname,lang:n="zh-CN",locale:o,emoji:l=["//unpkg.com/@waline/emojis@1.0.1/weibo"],meta:a=["nick","mail","link"],requiredMeta:r=[],dark:i=!1,pageSize:c=10,wordLimit:s,imageUploader:m,highlighter:u,texRenderer:d,copyright:p=!0,login:v="enable",search:g=Z(),...f})=>({serverURL:ve(e),path:ue(t),locale:{...me[n]||me["zh-CN"],..."object"==typeof o?o:{}},wordLimit:ge(s),meta:J(a),requiredMeta:J(r),imageUploader:fe(m,K),highlighter:fe(u,te),texRenderer:fe(d,Y),lang:n,dark:i,emoji:l,pageSize:c,login:v,copyright:p,search:g,...f}))(t))),o=Re(),l=De(),a=e.ref("loading"),i=e.ref(0),c=e.ref(1),s=e.ref(0),m=e.ref([]),u=e.ref(null),d=e.computed((()=>{return"string"==typeof(e=n.value.dark)?"auto"===e?`@media(prefers-color-scheme:dark){body${he}}`:`${e}${he}`:!0===e?`:root${he}`:"";var e}));let p;!function(t,n={}){const o=e.ref(!1),{document:l=N,immediate:a=!0,manual:i=!1,id:c="vueuse_styletag_"+ ++O}=n,s=e.ref(t);let m=()=>{};const u=()=>{if(!l)return;const t=l.getElementById(c)||l.createElement("style");t.type="text/css",t.id=c,n.media&&(t.media=n.media),l.head.appendChild(t),o.value||(m=e.watch(s,(e=>{t.innerText=e}),{immediate:!0}),o.value=!0)},d=()=>{l&&o.value&&(m(),l.head.removeChild(l.getElementById(c)),o.value=!1)};a&&!i&&u(),i||r(d),e.readonly(o)}(d);const v=e=>{const{serverURL:t,path:l,pageSize:r}=n.value,u=new AbortController;a.value="loading",p?.(),Ee({serverURL:t,lang:n.value.lang,path:l,pageSize:r,page:e,signal:u.signal,token:o.value?.token}).then((t=>{a.value="success",i.value=t.count,m.value.push(...t.data),c.value=e,s.value=t.totalPages})).catch((e=>{"AbortError"!==e.name&&(console.error(e.message),a.value="error")})),p=u.abort.bind(u)},g=()=>{i.value=0,m.value=[],v(1)};return e.provide("config",n),e.watch((()=>t.path),g),e.onMounted((()=>g())),{config:n,darkmodeStyle:d,i18n:e.computed((()=>n.value.locale)),status:a,count:i,page:c,totalPages:s,data:m,reply:u,loadMore:()=>v(c.value+1),refresh:g,onReply:e=>{u.value=e},onSubmit:e=>{if(e.rid){const t=m.value.find((({objectId:t})=>t===e.rid));if(!t)return;Array.isArray(t.children)||(t.children=[]),t.children.push(e)}else m.value.unshift(e)},onStatusChange:async({comment:e,status:t})=>{if(e.status===t)return;const{serverURL:l,lang:a}=n.value;await Be({serverURL:l,lang:a,token:o.value?.token,objectId:e.objectId,status:t}),e.status=t},onDelete:async({objectId:e})=>{if(!confirm("Are you sure you want to delete this comment?"))return;const{serverURL:t,lang:l}=n.value;await(({serverURL:e,lang:t,token:n,objectId:o})=>fetch(`${e}/comment/${o}?lang=${t}`,{method:"DELETE",headers:{Authorization:`Bearer ${n}`}}).then((e=>e.json())))({serverURL:t,lang:l,token:o.value?.token,objectId:e}),m.value.some(((t,n)=>t.objectId===e?(m.value=m.value.filter(((e,t)=>t!==n)),!0):t.children.some(((o,l)=>o.objectId===e&&(m.value[n].children=t.children.filter(((e,t)=>t!==l)),!0)))))},onSticky:async e=>{if(e.rid)return;const{serverURL:t,lang:l}=n.value;await Be({serverURL:t,lang:l,token:o.value?.token,objectId:e.objectId,sticky:e.sticky?0:1}),e.sticky=!e.sticky},onLike:async e=>{const{serverURL:t,lang:o}=n.value,{objectId:a}=e,r=l.value.includes(a);await(({serverURL:e,lang:t,objectId:n,like:o})=>fetch(`${e}/comment/${n}?lang=${t}`,{method:"PUT",headers:Ce,body:JSON.stringify({like:o})}).then((e=>e.json())))({serverURL:t,lang:o,objectId:a,like:!r}),r?l.value=l.value.filter((e=>e!==a)):(l.value=[...l.value,a],l.value.length>50&&(l.value=l.value.slice(-50))),e.like=(e.like||0)+(r?-1:1)},version:"2.6.1"}}}),Yt={"data-waline":""},Zt={class:"wl-count"},Xt=["textContent"],Qt={class:"wl-cards"},en={key:1,class:"wl-operation"},tn=["textContent"],nn={key:0,class:"wl-loading"},on=["textContent"],ln={class:"wl-operation"},an=["textContent"],rn={key:3,class:"wl-power"},cn=e.createTextVNode(" Powered by "),sn=e.createElementVNode("a",{href:"https://github.com/walinejs/waline",target:"_blank",rel:"noreferrer"}," Waline ",-1);var mn=F(Kt,[["render",function(t,n,o,l,a,r){const i=e.resolveComponent("CommentBox"),c=e.resolveComponent("CommentCard"),s=e.resolveComponent("LoadingIcon");return e.openBlock(),e.createElementBlock("div",Yt,[t.reply?e.createCommentVNode("v-if",!0):(e.openBlock(),e.createBlock(i,{key:0,onSubmit:t.onSubmit},null,8,["onSubmit"])),e.createElementVNode("div",Zt,[t.count?(e.openBlock(),e.createElementBlock("span",{key:0,class:"wl-num",textContent:e.toDisplayString(t.count)},null,8,Xt)):e.createCommentVNode("v-if",!0),e.createTextVNode(" "+e.toDisplayString(t.i18n.comment),1)]),e.createElementVNode("div",Qt,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(t.data,(n=>(e.openBlock(),e.createBlock(c,{key:n.objectId,"root-id":n.objectId,comment:n,reply:t.reply,onReply:t.onReply,onSubmit:t.onSubmit,onStatus:t.onStatusChange,onDelete:t.onDelete,onSticky:t.onSticky,onLike:t.onLike},null,8,["root-id","comment","reply","onReply","onSubmit","onStatus","onDelete","onSticky","onLike"])))),128))]),"error"===t.status?(e.openBlock(),e.createElementBlock("div",en,[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,tn)])):(e.openBlock(),e.createElementBlock(e.Fragment,{key:2},["loading"===t.status?(e.openBlock(),e.createElementBlock("div",nn,[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",ln,[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,an)])],2112)):e.createCommentVNode("v-if",!0):(e.openBlock(),e.createElementBlock("div",{key:1,class:"wl-empty",textContent:e.toDisplayString(t.i18n.sofa)},null,8,on))],64)),e.createCommentVNode(" Copyright Information "),t.config.copyright?(e.openBlock(),e.createElementBlock("div",rn,[cn,sn,e.createTextVNode(" v"+e.toDisplayString(t.version),1)])):e.createCommentVNode("v-if",!0)])}],["__file","Waline.vue"]]);exports.Waline=mn,exports.version="2.6.1"; | ||
//# sourceMappingURL=component.js.map |
@@ -1,2 +0,2 @@ | ||
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});const e=e=>{const t=((e="")=>e.replace(/\/$/u,""))(e);return/^(https?:)?\/\//.test(t)?t:`https://${t}`},t=e=>{"AbortError"!==e.name&&console.error(e.message)},r={"Content-Type":"application/json"},n=(e,t="")=>{if("object"==typeof e&&e.errno)throw new TypeError(`Fetch ${t} failed with ${e.errno}: ${e.errmsg}`);return e},o=({serverURL:e,lang:t,paths:r,signal:o})=>fetch(`${e}/article?path=${encodeURIComponent(r.join(","))}&lang=${t}`,{signal:o}).then((e=>e.json())).then((e=>n(e,"visit count"))).then((e=>Array.isArray(e)?e:[e])),a=({serverURL:e,lang:t,path:o})=>fetch(`${e}/article?lang=${t}`,{method:"POST",headers:r,body:JSON.stringify({path:o})}).then((e=>e.json())).then((e=>n(e,"visit count"))),s=e=>e.dataset.path||e.getAttribute("id"),i=(e,t)=>{t.forEach(((t,r)=>{t.innerText=e[r].toString()}))};exports.pageviewCount=({serverURL:r,path:n=window.location.pathname,selector:l=".waline-pageview-count",update:h=!0,lang:c="zh-CN"})=>{const p=new AbortController,g=Array.from(document.querySelectorAll(l)),u=e=>{const t=s(e);return null!==t&&n!==t},d=a=>o({serverURL:e(r),paths:a.map((e=>s(e)||n)),lang:c,signal:p.signal}).then((e=>i(e,a))).catch(t);if(h){const e=g.filter((e=>!u(e))),t=g.filter(u);a({serverURL:r,path:n,lang:c}).then((t=>i(new Array(e.length).fill(t),e))),t.length&&d(t)}else d(g);return p.abort.bind(p)},exports.version="2.6.0"; | ||
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});const e=e=>{const t=((e="")=>e.replace(/\/$/u,""))(e);return/^(https?:)?\/\//.test(t)?t:`https://${t}`},t=e=>{"AbortError"!==e.name&&console.error(e.message)},r={"Content-Type":"application/json"},n=(e,t="")=>{if("object"==typeof e&&e.errno)throw new TypeError(`Fetch ${t} failed with ${e.errno}: ${e.errmsg}`);return e},o=({serverURL:e,lang:t,paths:r,signal:o})=>fetch(`${e}/article?path=${encodeURIComponent(r.join(","))}&lang=${t}`,{signal:o}).then((e=>e.json())).then((e=>n(e,"visit count"))).then((e=>Array.isArray(e)?e:[e])),a=({serverURL:e,lang:t,path:o})=>fetch(`${e}/article?lang=${t}`,{method:"POST",headers:r,body:JSON.stringify({path:o})}).then((e=>e.json())).then((e=>n(e,"visit count"))),s=e=>e.dataset.path||e.getAttribute("id"),i=(e,t)=>{t.forEach(((t,r)=>{t.innerText=e[r].toString()}))};exports.pageviewCount=({serverURL:r,path:n=window.location.pathname,selector:l=".waline-pageview-count",update:h=!0,lang:c="zh-CN"})=>{const p=new AbortController,g=Array.from(document.querySelectorAll(l)),u=e=>{const t=s(e);return null!==t&&n!==t},d=a=>o({serverURL:e(r),paths:a.map((e=>s(e)||n)),lang:c,signal:p.signal}).then((e=>i(e,a))).catch(t);if(h){const t=g.filter((e=>!u(e))),o=g.filter(u);a({serverURL:e(r),path:n,lang:c}).then((e=>i(new Array(t.length).fill(e),t))),o.length&&d(o)}else d(g);return p.abort.bind(p)},exports.version="2.6.1"; | ||
//# sourceMappingURL=pageview.cjs.js.map |
@@ -1,2 +0,2 @@ | ||
const e="2.6.0",t=e=>{const t=((e="")=>e.replace(/\/$/u,""))(e);return/^(https?:)?\/\//.test(t)?t:`https://${t}`},r=e=>{"AbortError"!==e.name&&console.error(e.message)},n={"Content-Type":"application/json"},a=(e,t="")=>{if("object"==typeof e&&e.errno)throw new TypeError(`Fetch ${t} failed with ${e.errno}: ${e.errmsg}`);return e},o=({serverURL:e,lang:t,paths:r,signal:n})=>fetch(`${e}/article?path=${encodeURIComponent(r.join(","))}&lang=${t}`,{signal:n}).then((e=>e.json())).then((e=>a(e,"visit count"))).then((e=>Array.isArray(e)?e:[e])),l=({serverURL:e,lang:t,path:r})=>fetch(`${e}/article?lang=${t}`,{method:"POST",headers:n,body:JSON.stringify({path:r})}).then((e=>e.json())).then((e=>a(e,"visit count"))),s=e=>e.dataset.path||e.getAttribute("id"),i=(e,t)=>{t.forEach(((t,r)=>{t.innerText=e[r].toString()}))},h=({serverURL:e,path:n=window.location.pathname,selector:a=".waline-pageview-count",update:h=!0,lang:c="zh-CN"})=>{const p=new AbortController,g=Array.from(document.querySelectorAll(a)),u=e=>{const t=s(e);return null!==t&&n!==t},f=a=>o({serverURL:t(e),paths:a.map((e=>s(e)||n)),lang:c,signal:p.signal}).then((e=>i(e,a))).catch(r);if(h){const t=g.filter((e=>!u(e))),r=g.filter(u);l({serverURL:e,path:n,lang:c}).then((e=>i(new Array(t.length).fill(e),t))),r.length&&f(r)}else f(g);return p.abort.bind(p)};export{h as pageviewCount,e as version}; | ||
const e="2.6.1",t=e=>{const t=((e="")=>e.replace(/\/$/u,""))(e);return/^(https?:)?\/\//.test(t)?t:`https://${t}`},r=e=>{"AbortError"!==e.name&&console.error(e.message)},n={"Content-Type":"application/json"},a=(e,t="")=>{if("object"==typeof e&&e.errno)throw new TypeError(`Fetch ${t} failed with ${e.errno}: ${e.errmsg}`);return e},o=({serverURL:e,lang:t,paths:r,signal:n})=>fetch(`${e}/article?path=${encodeURIComponent(r.join(","))}&lang=${t}`,{signal:n}).then((e=>e.json())).then((e=>a(e,"visit count"))).then((e=>Array.isArray(e)?e:[e])),l=({serverURL:e,lang:t,path:r})=>fetch(`${e}/article?lang=${t}`,{method:"POST",headers:n,body:JSON.stringify({path:r})}).then((e=>e.json())).then((e=>a(e,"visit count"))),s=e=>e.dataset.path||e.getAttribute("id"),i=(e,t)=>{t.forEach(((t,r)=>{t.innerText=e[r].toString()}))},h=({serverURL:e,path:n=window.location.pathname,selector:a=".waline-pageview-count",update:h=!0,lang:c="zh-CN"})=>{const p=new AbortController,g=Array.from(document.querySelectorAll(a)),u=e=>{const t=s(e);return null!==t&&n!==t},f=a=>o({serverURL:t(e),paths:a.map((e=>s(e)||n)),lang:c,signal:p.signal}).then((e=>i(e,a))).catch(r);if(h){const r=g.filter((e=>!u(e))),a=g.filter(u);l({serverURL:t(e),path:n,lang:c}).then((e=>i(new Array(r.length).fill(e),r))),a.length&&f(a)}else f(g);return p.abort.bind(p)};export{h as pageviewCount,e as version}; | ||
//# sourceMappingURL=pageview.esm.js.map |
@@ -1,2 +0,2 @@ | ||
!function(e,t){if("function"==typeof define&&define.amd)define("Waline",["exports"],t);else if("undefined"!=typeof exports)t(exports);else{var n={exports:{}};t(n.exports),e.Waline=n.exports}}("undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:this,(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.version=e.pageviewCount=void 0;e.version="2.6.0";const t=e=>{const t=function(){return(arguments.length>0&&void 0!==arguments[0]?arguments[0]:"").replace(/\/$/u,"")}(e);return/^(https?:)?\/\//.test(t)?t:"https://".concat(t)},n=e=>{"AbortError"!==e.name&&console.error(e.message)},r={"Content-Type":"application/json"},o=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"";if("object"==typeof e&&e.errno)throw new TypeError("Fetch ".concat(t," failed with ").concat(e.errno,": ").concat(e.errmsg));return e},a=e=>{let{serverURL:t,lang:n,paths:r,signal:a}=e;return fetch("".concat(t,"/article?path=").concat(encodeURIComponent(r.join(",")),"&lang=").concat(n),{signal:a}).then((e=>e.json())).then((e=>o(e,"visit count"))).then((e=>Array.isArray(e)?e:[e]))},i=e=>{let{serverURL:t,lang:n,path:a}=e;return fetch("".concat(t,"/article?lang=").concat(n),{method:"POST",headers:r,body:JSON.stringify({path:a})}).then((e=>e.json())).then((e=>o(e,"visit count")))},l=e=>e.dataset.path||e.getAttribute("id"),s=(e,t)=>{t.forEach(((t,n)=>{t.innerText=e[n].toString()}))};e.pageviewCount=e=>{let{serverURL:r,path:o=window.location.pathname,selector:c=".waline-pageview-count",update:h=!0,lang:p="zh-CN"}=e;const f=new AbortController,u=Array.from(document.querySelectorAll(c)),d=e=>{const t=l(e);return null!==t&&o!==t},g=e=>a({serverURL:t(r),paths:e.map((e=>l(e)||o)),lang:p,signal:f.signal}).then((t=>s(t,e))).catch(n);if(h){const e=u.filter((e=>!d(e))),t=u.filter(d);i({serverURL:r,path:o,lang:p}).then((t=>s(new Array(e.length).fill(t),e))),t.length&&g(t)}else g(u);return f.abort.bind(f)}})); | ||
!function(e,t){if("function"==typeof define&&define.amd)define("Waline",["exports"],t);else if("undefined"!=typeof exports)t(exports);else{var n={exports:{}};t(n.exports),e.Waline=n.exports}}("undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:this,(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.version=e.pageviewCount=void 0;e.version="2.6.1";const t=e=>{const t=function(){return(arguments.length>0&&void 0!==arguments[0]?arguments[0]:"").replace(/\/$/u,"")}(e);return/^(https?:)?\/\//.test(t)?t:"https://".concat(t)},n=e=>{"AbortError"!==e.name&&console.error(e.message)},r={"Content-Type":"application/json"},o=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"";if("object"==typeof e&&e.errno)throw new TypeError("Fetch ".concat(t," failed with ").concat(e.errno,": ").concat(e.errmsg));return e},a=e=>{let{serverURL:t,lang:n,paths:r,signal:a}=e;return fetch("".concat(t,"/article?path=").concat(encodeURIComponent(r.join(",")),"&lang=").concat(n),{signal:a}).then((e=>e.json())).then((e=>o(e,"visit count"))).then((e=>Array.isArray(e)?e:[e]))},i=e=>{let{serverURL:t,lang:n,path:a}=e;return fetch("".concat(t,"/article?lang=").concat(n),{method:"POST",headers:r,body:JSON.stringify({path:a})}).then((e=>e.json())).then((e=>o(e,"visit count")))},l=e=>e.dataset.path||e.getAttribute("id"),s=(e,t)=>{t.forEach(((t,n)=>{t.innerText=e[n].toString()}))};e.pageviewCount=e=>{let{serverURL:r,path:o=window.location.pathname,selector:c=".waline-pageview-count",update:h=!0,lang:p="zh-CN"}=e;const f=new AbortController,u=Array.from(document.querySelectorAll(c)),d=e=>{const t=l(e);return null!==t&&o!==t},g=e=>a({serverURL:t(r),paths:e.map((e=>l(e)||o)),lang:p,signal:f.signal}).then((t=>s(t,e))).catch(n);if(h){const e=u.filter((e=>!d(e))),n=u.filter(d);i({serverURL:t(r),path:o,lang:p}).then((t=>s(new Array(e.length).fill(t),e))),n.length&&g(n)}else g(u);return f.abort.bind(f)}})); | ||
//# sourceMappingURL=pageview.js.map |
@@ -1,2 +0,2 @@ | ||
import{getCurrentScope as e,onScopeDispose as t,watch as n,ref as l,unref as o,isRef as a,readonly as r,shallowRef as i,computed as s,h as c,defineComponent as u,onMounted as m,onBeforeUnmount as d,resolveComponent as p,openBlock as v,createElementBlock as g,normalizeStyle as h,Fragment as f,renderList as w,createBlock as y,createCommentVNode as b,createElementVNode as k,nextTick as C,inject as $,reactive as I,onUnmounted as L,createVNode as S,toDisplayString as j,normalizeClass as x,withDirectives as R,vModelDynamic as E,vModelText as A,vShow as U,createTextVNode as z,provide as M,createApp as O,watchEffect as T}from"vue";import P from"autosize";import{marked as N}from"marked";const H=["nick","mail","link"],V=e=>e.filter((e=>H.includes(e))),_=e=>new Promise(((t,n)=>{const l=new FileReader;l.readAsDataURL(e),l.onload=()=>t(l.result?.toString()||""),l.onerror=n})),F=e=>!0===e?'<p class="wl-tex">Tex is not available in preview</p>':'<span class="wl-tex">Tex is not available in preview</span>',B=()=>{const e={next:""},t=({keyword:e,pos:t})=>{const n=new URLSearchParams("media_filter=minimal");return n.set("key","PAY5JLFIH6V6"),n.set("limit","20"),n.set("pos",t||""),n.set("q",e),fetch(`https://g.tenor.com/v1/search?${n.toString()}`,{headers:{"Content-Type":"application/json"}}).then((e=>e.json())).catch((()=>({next:t||"",results:[]})))};return{search:(n="")=>t({keyword:n}).then((t=>(e.next=t.next,t.results.map((e=>({title:e.title,src:e.media[0].tinygif.url})))))),more:n=>t({keyword:n,pos:e.next}).then((t=>(e.next=t.next,t.results.map((e=>({title:e.title,src:e.media[0].tinygif.url}))))))}},D=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"),W=["23AC69","91C132","F19726","E8552D","1AAB8E","E1147F","2980C1","1BA1E6","9FA0A0","F19726","E30B20","E30B20","A3338B"],G={},q=e=>{let t=0;return e.replace(D,((e,n,l)=>{if(l)return`<span style="color: slategray">${l}</span>`;if("<"===n)return"<";let o;G[n]?o=G[n]:(o=W[t],G[n]=o);const a=`<span style="color: #${o}">${n}</span>`;return t=++t%W.length,a}))},J=["nick","nickError","mail","mailError","link","optional","placeholder","sofa","submit","like","cancelLike","reply","cancelReply","comment","refresh","more","preview","emoji","uploadImage","seconds","minutes","hours","days","now","uploading","login","logout","admin","sticky","word","wordHint","anonymous","level0","level1","level2","level3","level4","level5","gif","gifSearchPlaceholder"],K=e=>Object.fromEntries(e.map(((e,t)=>[J[t],e])));var Y=K(["NickName","NickName cannot be less than 3 bytes.","E-Mail","Please confirm your email address.","Website","Optional","Comment here...","No comment yet.","Submit","Like","Cancel like","Reply","Cancel reply","Comments","Refresh","Load More...","Preview","Emoji","Upload Image","seconds ago","minutes ago","hours ago","days ago","just now","Uploading","Login","logout","Admin","Sticky","Words","Please input comments between $0 and $1 words!\n Current word number: $2","Anonymous","Dwarves","Hobbits","Ents","Wizards","Elves","Maiar","GIF","Search GIF"]),Z=K(["ニックネーム","3バイト以上のニックネームをご入力ください.","メールアドレス","メールアドレスをご確認ください.","サイト","オプション","ここにコメント","コメントしましょう~","提出する","Like","Cancel like","返信する","キャンセル","コメント","更新","さらに読み込む","プレビュー","絵文字","画像をアップロード","秒前","分前","時間前","日前","たっだ今","アップロード","ログインする","ログアウト","管理者","トップに置く","ワード","コメントは $0 から $1 ワードの間でなければなりません!\n 現在の単語番号: $2","匿名","うえにん","なかにん","しもおし","特にしもおし","かげ","なぬし","GIF","探す GIF"]),X=K(["昵称","昵称不能少于3个字符","邮箱","请填写正确的邮件地址","网址","可选","欢迎评论","来发评论吧~","提交","喜欢","取消喜欢","回复","取消回复","评论","刷新","加载更多...","预览","表情","上传图片","秒前","分钟前","小时前","天前","刚刚","正在上传","登录","退出","博主","置顶","字","评论字数应在 $0 到 $1 字之间!\n当前字数:$2","匿名","潜水","冒泡","吐槽","活跃","话痨","传说","表情包","搜索表情包"]),Q=K(["暱稱","郵箱","網址","可選","暱稱不能少於3個字元","請填寫正確的郵件地址","歡迎評論","來發評論吧~","提交","喜歡","取消喜歡","回覆","取消回覆","評論","刷新","載入更多...","預覽","表情","上傳圖片","秒前","分鐘前","小時前","天前","剛剛","正在上傳","登錄","退出","博主","置頂","字","評論字數應在 $0 到 $1 字之間!\n當前字數:$2","匿名","潛水","冒泡","吐槽","活躍","話癆","傳說","表情包","搜索表情包"]),ee=K(["Apelido","Apelido não pode ser menor que 3 bytes.","E-Mail","Por favor, confirme seu endereço de e-mail.","Website","Opcional","Comente aqui...","Nenhum comentário, ainda.","Enviar","Like","Cancel like","Responder","Cancelar resposta","Comentários","Refrescar","Carregar Mais...","Visualizar","Emoji","Enviar Imagem","segundos atrás","minutos atrás","horas atrás","dias atrás","agora mesmo","Enviando","Entrar","Sair","Admin","Sticky","Palavras","Favor enviar comentário com $0 a $1 palavras!\n Número de palavras atuais: $2","Anônimo","Dwarves","Hobbits","Ents","Wizards","Elves","Maiar","GIF","Pesquisar GIF"]),te=K(["Псевдоним","Никнейм не может быть меньше 3 байт.","Эл. адрес","Пожалуйста, подтвердите адрес вашей электронной почты.","Веб-сайт","Необязательный","Комментарий здесь...","Пока нет комментариев.","Отправить","Like","Cancel like","Отвечать","Отменить ответ","Комментарии","Обновить","Загрузи больше...","Превью","эмодзи","Загрузить изображение","секунд назад","несколько минут назад","несколько часов назад","дней назад","прямо сейчас","Загрузка","Авторизоваться","Выход из системы","Админ","Липкий","Слова","Пожалуйста, введите комментарии от $0 до $1 слов!\nНомер текущего слова: $2","Анонимный","Dwarves","Hobbits","Ents","Wizards","Elves","Maiar","GIF","Поиск GIF"]);const ne={zh:X,"zh-cn":X,"zh-CN":X,"zh-tw":Q,"zh-TW":Q,en:Y,"en-US":Y,"en-us":Y,jp:Z,"jp-jp":Z,"jp-JP":Z,"pt-br":ee,"pt-BR":ee,ru:te,"ru-ru":te,"ru-RU":te};function le(n){return!!e()&&(t(n),!0)}var oe;const ae="undefined"!=typeof window,re=()=>{};function ie(e,t){return function(...n){e((()=>t.apply(this,n)),{fn:t,thisArg:this,args:n})}}ae&&(null==(oe=null==window?void 0:window.navigator)?void 0:oe.userAgent)&&/iP(ad|hone|od)/.test(window.navigator.userAgent);const se=e=>e();function ce(e,t=200,n={}){return ie(function(e,t={}){let n,l;return a=>{const r=o(e),i=o(t.maxWait);if(n&&clearTimeout(n),r<=0||void 0!==i&&i<=0)return l&&(clearTimeout(l),l=null),a();i&&!l&&(l=setTimeout((()=>{n&&clearTimeout(n),l=null,a()}),i)),n=setTimeout((()=>{l&&clearTimeout(l),l=null,a()}),r)}}(t,n),e)}var ue=Object.getOwnPropertySymbols,me=Object.prototype.hasOwnProperty,de=Object.prototype.propertyIsEnumerable;function pe(e,t,l={}){const o=l,{eventFilter:a=se}=o,r=((e,t)=>{var n={};for(var l in e)me.call(e,l)&&t.indexOf(l)<0&&(n[l]=e[l]);if(null!=e&&ue)for(var l of ue(e))t.indexOf(l)<0&&de.call(e,l)&&(n[l]=e[l]);return n})(o,["eventFilter"]);return n(e,ie(a,t),r)}var ve=Object.defineProperty,ge=Object.defineProperties,he=Object.getOwnPropertyDescriptors,fe=Object.getOwnPropertySymbols,we=Object.prototype.hasOwnProperty,ye=Object.prototype.propertyIsEnumerable,be=(e,t,n)=>t in e?ve(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;function ke(e,t,n={}){const o=n,{eventFilter:a}=o,r=((e,t)=>{var n={};for(var l in e)we.call(e,l)&&t.indexOf(l)<0&&(n[l]=e[l]);if(null!=e&&fe)for(var l of fe(e))t.indexOf(l)<0&&ye.call(e,l)&&(n[l]=e[l]);return n})(o,["eventFilter"]),{eventFilter:i,pause:s,resume:c,isActive:u}=function(e=se){const t=l(!0);return{isActive:t,pause:function(){t.value=!1},resume:function(){t.value=!0},eventFilter:(...n)=>{t.value&&e(...n)}}}(a),m=pe(e,t,(d=((e,t)=>{for(var n in t||(t={}))we.call(t,n)&&be(e,n,t[n]);if(fe)for(var n of fe(t))ye.call(t,n)&&be(e,n,t[n]);return e})({},r),ge(d,he({eventFilter:i}))));var d;return{stop:m,pause:s,resume:c,isActive:u}}const Ce=ae?window:void 0,$e=ae?window.document:void 0;function Ie(...e){let t,l,a,r;if("string"==typeof e[0]?([l,a,r]=e,t=Ce):[t,l,a,r]=e,!t)return re;let i=re;const s=n((()=>function(e){var t;const n=o(e);return null!=(t=null==n?void 0:n.$el)?t:n}(t)),(e=>{i(),e&&(e.addEventListener(l,a,r),i=()=>{e.removeEventListener(l,a,r),i=re})}),{immediate:!0,flush:"post"}),c=()=>{s(),i()};return le(c),c}ae&&window.navigator,ae&&window.location;const Le="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},Se="__vueuse_ssr_handlers__";Le[Se]=Le[Se]||{};const je=Le[Se];const xe={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 Re(e,t,n,a={}){var r;const{flush:s="pre",deep:c=!0,listenToStorageChanges:u=!0,writeDefaults:m=!0,shallow:d,window:p=Ce,eventFilter:v,onError:g=(e=>{console.error(e)})}=a,h=(d?i:l)(t);if(!n)try{n=function(e,t){return je[e]||t}("getDefaultStorage",(()=>{var e;return null==(e=Ce)?void 0:e.localStorage}))()}catch(e){g(e)}if(!n)return h;const f=o(t),w=function(e){return null==e?"any":e instanceof Set?"set":e instanceof Map?"map":e instanceof Date?"date":"boolean"==typeof e?"boolean":"string"==typeof e?"string":"object"==typeof e||Array.isArray(e)?"object":Number.isNaN(e)?"any":"number"}(f),y=null!=(r=a.serializer)?r:xe[w],{pause:b,resume:k}=ke(h,(()=>function(t){try{null==t?n.removeItem(e):n.setItem(e,y.write(t))}catch(e){g(e)}}(h.value)),{flush:s,deep:c,eventFilter:v});return p&&u&&Ie(p,"storage",C),C(),h;function C(t){t&&t.key!==e||(h.value=function(t){if(!t||t.key===e){b();try{const l=t?t.newValue:n.getItem(e);return null==l?(m&&null!==f&&n.setItem(e,y.write(f)),f):"string"!=typeof l?l:y.read(l)}catch(e){g(e)}finally{k()}}}(t))}}var Ee,Ae,Ue=Object.defineProperty,ze=Object.getOwnPropertySymbols,Me=Object.prototype.hasOwnProperty,Oe=Object.prototype.propertyIsEnumerable,Te=(e,t,n)=>t in e?Ue(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;function Pe(e={}){const{controls:t=!1,interval:r="requestAnimationFrame"}=e,i=l(new Date),s=()=>i.value=new Date,c="requestAnimationFrame"===r?function(e,t={}){const{immediate:n=!0,window:o=Ce}=t,a=l(!1);let r=null;function i(){a.value&&o&&(e(),r=o.requestAnimationFrame(i))}function s(){!a.value&&o&&(a.value=!0,i())}function c(){a.value=!1,null!=r&&o&&(o.cancelAnimationFrame(r),r=null)}return n&&s(),le(c),{isActive:a,pause:c,resume:s}}(s,{immediate:!0}):function(e,t=1e3,r={}){const{immediate:i=!0,immediateCallback:s=!1}=r;let c=null;const u=l(!1);function m(){c&&(clearInterval(c),c=null)}function d(){u.value=!1,m()}function p(){o(t)<=0||(u.value=!0,s&&e(),m(),c=setInterval(e,o(t)))}i&&ae&&p(),a(t)&&le(n(t,(()=>{i&&ae&&p()})));return le(d),{isActive:u,pause:d,resume:p}}(s,r,{immediate:!0});return t?((e,t)=>{for(var n in t||(t={}))Me.call(t,n)&&Te(e,n,t[n]);if(ze)for(var n of ze(t))Oe.call(t,n)&&Te(e,n,t[n]);return e})({now:i},c):i}(Ae=Ee||(Ee={})).UP="UP",Ae.RIGHT="RIGHT",Ae.DOWN="DOWN",Ae.LEFT="LEFT",Ae.NONE="NONE";let Ne=0;const He=e=>{try{e=decodeURI(e)}catch(e){}return e},Ve=(e="")=>e.replace(/\/$/u,""),_e=e=>/^(https?:)?\/\//.test(e),Fe=e=>{const t=Ve(e);return _e(t)?t:`https://${t}`},Be=e=>Array.isArray(e)?e:!!e&&[0,e],De=(e,t)=>"function"==typeof e?e:!1!==e&&t,We="{--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}",Ge=(e,t)=>{let n=e.toString();for(;n.length<t;)n="0"+n;return n},qe=(e,t,n)=>{if(!e)return"";const l="string"==typeof e?new Date(-1!==e.indexOf(" ")?e.replace(/-/g,"/"):e):e,o=t.getTime()-l.getTime(),a=Math.floor(o/864e5);if(0===a){const e=o%864e5,t=Math.floor(e/36e5);if(0===t){const t=e%36e5,l=Math.floor(t/6e4);if(0===l){const e=t%6e4;return`${Math.round(e/1e3)} ${n.seconds}`}return`${l} ${n.minutes}`}return`${t} ${n.hours}`}return a<0?n.now:a<8?`${a} ${n.days}`:(e=>{const t=Ge(e.getDate(),2),n=Ge(e.getMonth()+1,2);return`${Ge(e.getFullYear(),2)}-${n}-${t}`})(l)},Je=e=>{const t=Re("WALINE_EMOJI",{}),n=Boolean(/@[0-9]+\.[0-9]+\.[0-9]+/.test(e));if(n){const n=t.value[e];if(n)return Promise.resolve(n)}return fetch(`${e}/info.json`).then((e=>e.json())).then((l=>{const o={folder:e,...l};return n&&(t.value[e]=o),o}))},Ke=(e,t="",n="",l="")=>`${t?`${t}/`:""}${n}${e}${l?`.${l}`:""}`,Ye=e=>{"AbortError"!==e.name&&console.error(e.message)},Ze={"Content-Type":"application/json"},Xe=(e,t="")=>{if("object"==typeof e&&e.errno)throw new TypeError(`Fetch ${t} failed with ${e.errno}: ${e.errmsg}`);return e},Qe=({serverURL:e,lang:t,token:n,objectId:l,...o})=>fetch(`${e}/comment/${l}?lang=${t}`,{method:"PUT",headers:{"Content-Type":"application/json",Authorization:`Bearer ${n}`},body:JSON.stringify(o)}).then((e=>e.json())),et=({serverURL:e,lang:t,paths:n,signal:l})=>fetch(`${e}/article?path=${encodeURIComponent(n.join(","))}&lang=${t}`,{signal:l}).then((e=>e.json())).then((e=>Xe(e,"visit count"))).then((e=>Array.isArray(e)?e:[e])),tt=({serverURL:e,lang:t,path:n})=>fetch(`${e}/article?lang=${t}`,{method:"POST",headers:Ze,body:JSON.stringify({path:n})}).then((e=>e.json())).then((e=>Xe(e,"visit count"))),nt=e=>e instanceof HTMLElement?e:"string"==typeof e?document.querySelector(e):null,lt=e=>e.type.includes("image"),ot=e=>{const t=Array.from(e).find(lt);return t?t.getAsFile():null},at=/\$.*?\$/,rt=/^\$(.*?)\$/,it=/^(?:\s{0,3})\$\$((?:[^\n]|\n[^\n])+?)\n{0,1}\$\$/,st=(e="",t={})=>e.replace(/:(.+?):/g,((e,n)=>t[n]?`<img class="wl-emoji" src="${t[n]}" alt="${n}">`:e)),ct=(e,{emojiMap:t,highlighter:n,texRenderer:l})=>{if(N.setOptions({highlight:n||void 0,breaks:!0,smartLists:!0,smartypants:!0}),l){const e=(e=>[{name:"blockMath",level:"block",tokenizer(t){const n=it.exec(t);if(null!==n)return{type:"html",raw:n[0],text:e(!0,n[1])}}},{name:"inlineMath",level:"inline",start(e){const t=e.search(at);return-1!==t?t:e.length},tokenizer(t){const n=rt.exec(t);if(null!==n)return{type:"html",raw:n[0],text:e(!1,n[1])}}}])(l);N.use({extensions:e})}return N.parse(st(e,t))},ut=e=>e.dataset.path||e.getAttribute("id");let mt=null;const dt=()=>mt||(mt=Re("USER_KEY",{}));let pt=null;const vt=()=>pt||(pt=Re("WALINE_LIKE",[])),gt=({serverURL:e,path:t=window.location.pathname,selector:n=".waline-comment-count",lang:l="zh-CN"})=>{const o=new AbortController,a=document.querySelectorAll(n),r=dt();return a.length&&(({serverURL:e,lang:t,paths:n,signal:l,token:o})=>{const a={};return o&&(a.Authorization=`Bearer ${o}`),fetch(`${e}/comment?type=count&url=${encodeURIComponent(n.join(","))}&lang=${t}`,{signal:l,headers:a}).then((e=>e.json())).then((e=>Xe(e,"comment count"))).then((e=>Array.isArray(e)?e:[e]))})({serverURL:Fe(e),paths:Array.from(a).map((e=>He(e.dataset.path||e.getAttribute("id")||t))),lang:l,signal:o.signal,token:r.value?.token}).then((e=>{a.forEach(((t,n)=>{t.innerText=e[n].toString()}))})).catch(Ye),o.abort.bind(o)},ht=({size:e})=>c("svg",{width:e,height:e,viewBox:"0 0 100 100",preserveAspectRatio:"xMidYMid"},c("circle",{cx:50,cy:50,fill:"none",stroke:"currentColor",strokeWidth:"4",r:"40","stroke-dasharray":"85 30"},c("animateTransform",{attributeName:"transform",type:"rotate",repeatCount:"indefinite",dur:"1s",values:"0 50 50;360 50 50",keyTimes:"0;1"})));var ft=(e,t)=>{const n=e.__vccOpts||e;for(const[e,l]of t)n[e]=l;return n};const wt=u({name:"ImageWall",components:{LoadingIcon:ht},props:{items:{type:Array,default:()=>[]},columnWidth:{type:Number,default:300},gap:{type:Number,default:0}},emit:["insert"],setup(e){let t=null;const o=l(null),a=l({}),r=l([]),i=()=>{const t=Math.floor((o.value.getBoundingClientRect().width+e.gap)/(e.columnWidth+e.gap));return t>0?t:1},s=async t=>{if(t>=e.items.length)return;await C();const n=Array.from(o.value?.children||[]).reduce(((e,t)=>t.getBoundingClientRect().height<e.getBoundingClientRect().height?t:e));r.value[Number(n.dataset.index)].push(t),await s(t+1)},c=async(e=!1)=>{if(r.value.length===i()&&!e)return;var t;r.value=(t=i(),new Array(t).fill(null).map((()=>[])));const n=window.scrollY;await s(0),window.scrollTo({top:n})};return n((()=>[e.items]),(()=>{a.value={},c(!0)})),n((()=>[e.columnWidth,e.gap]),(()=>c())),m((()=>{c(!0),t=new ResizeObserver((()=>c())),t.observe(o.value)})),d((()=>t.unobserve(o.value))),{columns:r,state:a,wall:o}}}),yt=["data-index"],bt=["src","title","onLoad","onClick"];const kt=u({name:"CommentBox",components:{CloseIcon:({size:e})=>c("svg",{class:"wl-close-icon",viewBox:"0 0 1024 1024",width:e,height:e},[c("path",{d:"M697.173 85.333h-369.92c-144.64 0-241.92 101.547-241.92 252.587v348.587c0 150.613 97.28 252.16 241.92 252.16h369.92c144.64 0 241.494-101.547 241.494-252.16V337.92c0-151.04-96.854-252.587-241.494-252.587z",fill:"currentColor"}),c("path",{d:"m640.683 587.52-75.947-75.861 75.904-75.862a37.29 37.29 0 0 0 0-52.778 37.205 37.205 0 0 0-52.779 0l-75.946 75.818-75.862-75.946a37.419 37.419 0 0 0-52.821 0 37.419 37.419 0 0 0 0 52.821l75.947 75.947-75.776 75.733a37.29 37.29 0 1 0 52.778 52.821l75.776-75.776 75.947 75.947a37.376 37.376 0 0 0 52.779-52.821z",fill:"#888"})]),EmojiIcon:()=>c("svg",{viewBox:"0 0 1024 1024",width:"24",height:"24"},c("path",{d:"M563.2 463.3 677 540c1.7 1.2 3.7 1.8 5.8 1.8.7 0 1.4-.1 2-.2 2.7-.5 5.1-2.1 6.6-4.4l25.3-37.8c1.5-2.3 2.1-5.1 1.6-7.8s-2.1-5.1-4.4-6.6l-73.6-49.1 73.6-49.1c2.3-1.5 3.9-3.9 4.4-6.6.5-2.7 0-5.5-1.6-7.8l-25.3-37.8a10.1 10.1 0 0 0-6.6-4.4c-.7-.1-1.3-.2-2-.2-2.1 0-4.1.6-5.8 1.8l-113.8 76.6c-9.2 6.2-14.7 16.4-14.7 27.5.1 11 5.5 21.3 14.7 27.4zM387 348.8h-45.5c-5.7 0-10.4 4.7-10.4 10.4v153.3c0 5.7 4.7 10.4 10.4 10.4H387c5.7 0 10.4-4.7 10.4-10.4V359.2c0-5.7-4.7-10.4-10.4-10.4zm333.8 241.3-41-20a10.3 10.3 0 0 0-8.1-.5c-2.6.9-4.8 2.9-5.9 5.4-30.1 64.9-93.1 109.1-164.4 115.2-5.7.5-9.9 5.5-9.5 11.2l3.9 45.5c.5 5.3 5 9.5 10.3 9.5h.9c94.8-8 178.5-66.5 218.6-152.7 2.4-5 .3-11.2-4.8-13.6zm186-186.1c-11.9-42-30.5-81.4-55.2-117.1-24.1-34.9-53.5-65.6-87.5-91.2-33.9-25.6-71.5-45.5-111.6-59.2-41.2-14-84.1-21.1-127.8-21.1h-1.2c-75.4 0-148.8 21.4-212.5 61.7-63.7 40.3-114.3 97.6-146.5 165.8-32.2 68.1-44.3 143.6-35.1 218.4 9.3 74.8 39.4 145 87.3 203.3.1.2.3.3.4.5l36.2 38.4c1.1 1.2 2.5 2.1 3.9 2.6 73.3 66.7 168.2 103.5 267.5 103.5 73.3 0 145.2-20.3 207.7-58.7 37.3-22.9 70.3-51.5 98.1-85 27.1-32.7 48.7-69.5 64.2-109.1 15.5-39.7 24.4-81.3 26.6-123.8 2.4-43.6-2.5-87-14.5-129zm-60.5 181.1c-8.3 37-22.8 72-43 104-19.7 31.1-44.3 58.6-73.1 81.7-28.8 23.1-61 41-95.7 53.4-35.6 12.7-72.9 19.1-110.9 19.1-82.6 0-161.7-30.6-222.8-86.2l-34.1-35.8c-23.9-29.3-42.4-62.2-55.1-97.7-12.4-34.7-18.8-71-19.2-107.9-.4-36.9 5.4-73.3 17.1-108.2 12-35.8 30-69.2 53.4-99.1 31.7-40.4 71.1-72 117.2-94.1 44.5-21.3 94-32.6 143.4-32.6 49.3 0 97 10.8 141.8 32 34.3 16.3 65.3 38.1 92 64.8 26.1 26 47.5 56 63.6 89.2 16.2 33.2 26.6 68.5 31 105.1 4.6 37.5 2.7 75.3-5.6 112.3z",fill:"currentColor"})),ImageIcon:()=>c("svg",{viewBox:"0 0 1024 1024",width:"24",height:"24"},[c("path",{d:"M784 112H240c-88 0-160 72-160 160v480c0 88 72 160 160 160h544c88 0 160-72 160-160V272c0-88-72-160-160-160zm96 640c0 52.8-43.2 96-96 96H240c-52.8 0-96-43.2-96-96V272c0-52.8 43.2-96 96-96h544c52.8 0 96 43.2 96 96v480z",fill:"currentColor"}),c("path",{d:"M352 480c52.8 0 96-43.2 96-96s-43.2-96-96-96-96 43.2-96 96 43.2 96 96 96zm0-128c17.6 0 32 14.4 32 32s-14.4 32-32 32-32-14.4-32-32 14.4-32 32-32zm462.4 379.2-3.2-3.2-177.6-177.6c-25.6-25.6-65.6-25.6-91.2 0l-80 80-36.8-36.8c-25.6-25.6-65.6-25.6-91.2 0L200 728c-4.8 6.4-8 14.4-8 24 0 17.6 14.4 32 32 32 9.6 0 16-3.2 22.4-9.6L380.8 640l134.4 134.4c6.4 6.4 14.4 9.6 24 9.6 17.6 0 32-14.4 32-32 0-9.6-4.8-17.6-9.6-24l-52.8-52.8 80-80L769.6 776c6.4 4.8 12.8 8 20.8 8 17.6 0 32-14.4 32-32 0-8-3.2-16-8-20.8z",fill:"currentColor"})]),ImageWall:ft(wt,[["render",function(e,t,n,l,o,a){const r=p("LoadingIcon");return v(),g("div",{ref:"wall",class:"wl-gallery",style:h({gap:`${e.gap}px`})},[(v(!0),g(f,null,w(e.columns,((t,n)=>(v(),g("div",{key:n,class:"wl-gallery-column","data-index":n,style:h({gap:`${e.gap}px`})},[(v(!0),g(f,null,w(t,(t=>(v(),g(f,{key:t},[e.state[e.items[t].src]?b("v-if",!0):(v(),y(r,{key:0,size:36,style:{margin:"20px auto"}})),k("img",{class:"wl-gallery-item",src:e.items[t].src,title:e.items[t].title,loading:"lazy",onLoad:n=>e.state[e.items[t].src]=!0,onClick:n=>e.$emit("insert",`![](${e.items[t].src})`)},null,40,bt)],64)))),128))],12,yt)))),128))],4)}],["__file","ImageWall.vue"]]),MarkdownIcon:()=>c("svg",{width:"16",height:"16",ariaHidden:"true"},c("path",{d:"M14.85 3H1.15C.52 3 0 3.52 0 4.15v7.69C0 12.48.52 13 1.15 13h13.69c.64 0 1.15-.52 1.15-1.15v-7.7C16 3.52 15.48 3 14.85 3zM9 11H7V8L5.5 9.92 4 8v3H2V5h2l1.5 2L7 5h2v6zm2.99.5L9.5 8H11V5h2v3h1.5l-2.51 3.5z",fill:"currentColor"})),PreviewIcon:()=>c("svg",{viewBox:"0 0 1024 1024",width:"24",height:"24"},[c("path",{d:"M710.816 654.301c70.323-96.639 61.084-230.578-23.705-314.843-46.098-46.098-107.183-71.109-172.28-71.109-65.008 0-126.092 25.444-172.28 71.109-45.227 46.098-70.756 107.183-70.756 172.106 0 64.923 25.444 126.007 71.194 172.106 46.099 46.098 107.184 71.109 172.28 71.109 51.414 0 100.648-16.212 142.824-47.404l126.53 126.006c7.058 7.06 16.297 10.979 26.406 10.979 10.105 0 19.343-3.919 26.402-10.979 14.467-14.467 14.467-38.172 0-52.723L710.816 654.301zm-315.107-23.265c-65.88-65.88-65.88-172.54 0-238.42 32.069-32.07 74.245-49.149 119.471-49.149 45.227 0 87.407 17.603 119.472 49.149 65.88 65.879 65.88 172.539 0 238.42-63.612 63.178-175.242 63.178-238.943 0zm0 0",fill:"currentColor"}),c("path",{d:"M703.319 121.603H321.03c-109.8 0-199.469 89.146-199.469 199.38v382.034c0 109.796 89.236 199.38 199.469 199.38h207.397c20.653 0 37.384-16.645 37.384-37.299 0-20.649-16.731-37.296-37.384-37.296H321.03c-68.582 0-124.352-55.77-124.352-124.267V321.421c0-68.496 55.77-124.267 124.352-124.267h382.289c68.582 0 124.352 55.771 124.352 124.267V524.72c0 20.654 16.736 37.299 37.385 37.299 20.654 0 37.384-16.645 37.384-37.299V320.549c-.085-109.8-89.321-198.946-199.121-198.946zm0 0",fill:"currentColor"})]),LoadingIcon:ht,GifIcon:()=>c("svg",{width:24,height:24,fill:"currentcolor",viewBox:"0 0 24 24"},[c("path",{style:"transform: translateY(0.5px)",d:"M18.968 10.5H15.968V11.484H17.984V12.984H15.968V15H14.468V9H18.968V10.5V10.5ZM8.984 9C9.26533 9 9.49967 9.09367 9.687 9.281C9.87433 9.46833 9.968 9.70267 9.968 9.984V10.5H6.499V13.5H8.468V12H9.968V14.016C9.968 14.2973 9.87433 14.5317 9.687 14.719C9.49967 14.9063 9.26533 15 8.984 15H5.984C5.70267 15 5.46833 14.9063 5.281 14.719C5.09367 14.5317 5 14.2973 5 14.016V9.985C5 9.70367 5.09367 9.46933 5.281 9.282C5.46833 9.09467 5.70267 9.001 5.984 9.001H8.984V9ZM11.468 9H12.968V15H11.468V9V9Z"}),c("path",{d:"M18.5 3H5.75C3.6875 3 2 4.6875 2 6.75V18C2 20.0625 3.6875 21.75 5.75 21.75H18.5C20.5625 21.75 22.25 20.0625 22.25 18V6.75C22.25 4.6875 20.5625 3 18.5 3ZM20.75 18C20.75 19.2375 19.7375 20.25 18.5 20.25H5.75C4.5125 20.25 3.5 19.2375 3.5 18V6.75C3.5 5.5125 4.5125 4.5 5.75 4.5H18.5C19.7375 4.5 20.75 5.5125 20.75 6.75V18Z"})])},props:{rootId:{type:String,default:""},replyId:{type:String,default:""},replyUser:{type:String,default:""}},emits:["submit","cancel-reply"],setup(e,{emit:t}){const o=$("config"),a=Re("WALINE_COMMENT_BOX_EDITOR",""),r=Re("WALINE_USER_META",{nick:"",mail:"",link:""}),i=dt(),c=l({}),u=l(null),d=l(null),p=l(null),v=l(null),g=l(null),h=l(null),f=l(null),w=l({tabs:[],map:{}}),y=l(0),b=l(!1),k=l(!1),C=l(!1),S=l(""),j=l(0),x=I({loading:!0,list:[]}),R=l(0),E=l(!1),A=l(""),U=l(!1),z=s((()=>o.value.locale)),M=s((()=>Boolean(i.value?.token))),O=s((()=>!1!==o.value.imageUploader)),T=e=>{const t=u.value,n=t.selectionStart,l=t.selectionEnd||0,o=t.scrollTop;a.value=t.value.substring(0,n)+e+t.value.substring(l,t.value.length),t.focus(),t.selectionStart=n+e.length,t.selectionEnd=n+e.length,t.scrollTop=o},N=e=>{const t=`![${o.value.locale.uploading} ${e.name}]()`;return T(t),Promise.resolve().then((()=>o.value.imageUploader(e))).then((n=>{a.value=a.value.replace(t,`\r\n![${e.name}](${n})`)}))},H=()=>{const{serverURL:n,lang:l,login:s,wordLimit:m,requiredMeta:d}=o.value,p={comment:A.value,nick:r.value.nick,mail:r.value.mail,link:r.value.link,ua:navigator.userAgent,url:o.value.path};if(i.value?.token)p.nick=i.value.display_name,p.mail=i.value.email,p.link=i.value.url;else{if("force"===s)return;if(d.indexOf("nick")>-1&&!p.nick)return c.value.nick?.focus(),alert(z.value.nickError);if(d.indexOf("mail")>-1&&!p.mail||p.mail&&!/^\w(?:[\w._-]*\w)?@(?:\w(?:[\w-]*\w)?\.)*\w+$/.exec(p.mail))return c.value.mail?.focus(),alert(z.value.mailError);if(!p.comment)return void u.value?.focus();p.nick||(p.nick=z.value.anonymous)}if(!E.value)return alert(z.value.wordHint.replace("$0",m[0].toString()).replace("$1",m[1].toString()).replace("$2",j.value.toString()));p.comment=st(p.comment,w.value.map),e.replyId&&e.rootId&&(p.pid=e.replyId,p.rid=e.rootId,p.at=e.replyUser),U.value=!0,(({serverURL:e,lang:t,token:n,comment:l})=>{const o={"Content-Type":"application/json"};return n&&(o.Authorization=`Bearer ${n}`),fetch(`${e}/comment?lang=${t}`,{method:"POST",headers:o,body:JSON.stringify(l)}).then((e=>e.json()))})({serverURL:n,lang:l,token:i.value?.token,comment:p}).then((n=>{if(U.value=!1,n.errmsg)return alert(n.errmsg);t("submit",n.data),a.value="",S.value="",e.replyId&&t("cancel-reply")})).catch((e=>{U.value=!1,alert(e.message)}))},V=e=>{p.value.contains(e.target)||v.value.contains(e.target)||(b.value=!1),g.value.contains(e.target)||h.value.contains(e.target)||(k.value=!1)},_=async e=>{const{scrollTop:t,clientHeight:n,scrollHeight:l}=e.target,a=(n+t)/l,r=o.value.search,i=f.value?.value||"";a<.9||x.loading||(x.loading=!0,x.list.push(...r.more?await r.more(i,x.list.length):await r.search(i)),x.loading=!1,setTimeout((()=>{e.target.scrollTop=t}),50))},F=ce((e=>{x.list=[],_(e)}),300);return n([o,j],(([e,t])=>{const{wordLimit:n}=e;n?t<n[0]&&0!==n[0]?(R.value=n[0],E.value=!1):t>n[1]?(R.value=n[1],E.value=!1):(R.value=n[1],E.value=!0):(R.value=0,E.value=!0)}),{immediate:!0}),n(k,(async e=>{if(!e)return;const t=o.value.search;f.value&&(f.value.value=""),x.loading=!0,x.list=t.default?await t.default():await t.search(""),x.loading=!1})),m((()=>{document.body.addEventListener("click",V),n((()=>a.value),(e=>{const{highlighter:t,texRenderer:n}=o.value;A.value=e,S.value=ct(e,{emojiMap:w.value.map,highlighter:t,texRenderer:n}),j.value=(e=>(e=>e.match(/[\w\d\s\u00C0-\u024F]+/giu)||[])(e).reduce(((e,t)=>e+(""===t.trim()?0:t.trim().split(/\s+/u).length)),0)+(e=>e.match(/[\u4E00-\u9FA5]/gu)||[])(e).length)(e),e?P(u.value):P.destroy(u.value)}),{immediate:!0}),n((()=>o.value.emoji),(e=>{return(t=Array.isArray(e)?e:[],Promise.all(t.map((e=>"string"==typeof e?Je(Ve(e)):Promise.resolve(e)))).then((e=>{const t={tabs:[],map:{}};return e.forEach((e=>{const{name:n,folder:l,icon:o,prefix:a,type:r,items:i}=e;t.tabs.push({name:n,icon:Ke(o,l,a,r),items:i.map((e=>{const n=`${a||""}${e}`;return t.map[n]=Ke(e,l,a,r),n}))})})),t}))).then((e=>{w.value=e}));var t}),{immediate:!0})})),L((()=>{document.body.removeEventListener("click",V)})),{config:o,locale:z,insert:T,onChange:()=>{const e=d.value;e.files&&O.value&&N(e.files[0]).then((()=>{e.value=""}))},onDrop:e=>{if(e.dataTransfer?.items){const t=ot(e.dataTransfer.items);t&&O.value&&(N(t),e.preventDefault())}},onKeyDown:e=>{const t=e.key;(e.ctrlKey||e.metaKey)&&"Enter"===t&&H()},onPaste:e=>{if(e.clipboardData){const t=ot(e.clipboardData.items);t&&O.value&&N(t)}},onLogin:e=>{e.preventDefault();const{lang:t,serverURL:n}=o.value,l=(window.innerWidth-450)/2,a=(window.innerHeight-450)/2,r=window.open(`${n}/ui/login?lng=${encodeURIComponent(t)}`,"_blank",`width=450,height=450,left=${l},top=${a},scrollbars=no,resizable=no,status=no,location=no,toolbar=no,menubar=no`);r?.postMessage({type:"TOKEN",data:null},"*");const s=({data:e})=>{e&&"userInfo"===e.type&&e.data.token&&(r?.close(),i.value=e.data,(e.data.remember?localStorage:sessionStorage).setItem("WALINE_USER",JSON.stringify(e.data)),window.removeEventListener("message",s))};window.addEventListener("message",s)},onLogout:()=>{i.value={},localStorage.setItem("WALINE_USER","null"),sessionStorage.setItem("WALINE_USER","null")},onProfile:e=>{e.preventDefault();const{lang:t,serverURL:n}=o.value,l=(window.innerWidth-800)/2,a=(window.innerHeight-800)/2;window.open(`${n}/ui/profile?lng=${encodeURIComponent(t)}`,"_blank",`width=800,height=800,left=${l},top=${a},scrollbars=no,resizable=no,status=no,location=no,toolbar=no,menubar=no`)?.postMessage({type:"TOKEN",data:i.value.token},"*");const r=({data:e})=>{e&&"profile"===e.type&&(i.value={...i.value,...e},[localStorage,sessionStorage].filter((e=>e.getItem("WALINE_USER"))).forEach((e=>e.setItem("WALINE_USER",JSON.stringify(i)))),window.removeEventListener("message",r))};window.addEventListener("message",r)},submitComment:H,onImageWallScroll:_,onGifSearch:F,isLogin:M,userInfo:i,isSubmitting:U,wordNumber:j,wordLimit:R,isWordNumberLegal:E,editor:a,userMeta:r,emoji:w,emojiTabIndex:y,showEmoji:b,gifData:x,showGif:k,canUploadImage:O,previewText:S,showPreview:C,inputRefs:c,editorRef:u,emojiButtonRef:p,emojiPopupRef:v,gifButtonRef:g,gifPopupRef:h,imageUploadRef:d,gifSearchInputRef:f}}}),Ct={class:"wl-comment"},$t={key:0,class:"wl-login-info"},It={class:"wl-avatar"},Lt=["title"],St=["src"],jt=["textContent"],xt={class:"wl-panel"},Rt=["for","textContent"],Et=["id","name","type","onUpdate:modelValue"],At=["placeholder"],Ut={class:"wl-preview"},zt=k("hr",null,null,-1),Mt=["innerHTML"],Ot={class:"wl-footer"},Tt={class:"wl-actions"},Pt={href:"https://guides.github.com/features/mastering-markdown/",title:"Markdown Guide","aria-label":"Markdown is supported",class:"wl-action",target:"_blank",rel:"noreferrer"},Nt=["title"],Ht=["title"],Vt=["title"],_t=["title"],Ft={class:"wl-info"},Bt={class:"wl-text-number"},Dt={key:0},Wt=z(" / "),Gt=["textContent"],qt=["textContent"],Jt=["disabled"],Kt=["placeholder"],Yt={key:0,class:"wl-loading"},Zt={key:0,class:"wl-tab-wrapper"},Xt=["title","onClick"],Qt=["src","alt"],en={key:0,class:"wl-tabs"},tn=["onClick"],nn=["src","alt","title"],ln=["title"];var on=ft(kt,[["render",function(e,t,n,l,o,a){const r=p("CloseIcon"),i=p("MarkdownIcon"),s=p("EmojiIcon"),c=p("GifIcon"),u=p("ImageIcon"),m=p("PreviewIcon"),d=p("LoadingIcon"),h=p("ImageWall");return v(),g("div",Ct,["disable"!==e.config.login&&e.isLogin?(v(),g("div",$t,[k("div",It,[k("button",{class:"wl-logout-btn",title:e.locale.logout,onClick:t[0]||(t[0]=(...t)=>e.onLogout&&e.onLogout(...t))},[S(r,{size:14})],8,Lt),k("img",{src:e.userInfo.avatar,alt:"avatar"},null,8,St)]),k("a",{href:"#",class:"wl-login-nick","aria-label":"Profile",onClick:t[1]||(t[1]=(...t)=>e.onProfile&&e.onProfile(...t)),textContent:j(e.userInfo.display_name)},null,8,jt)])):b("v-if",!0),k("div",xt,["force"!==e.config.login&&e.config.meta.length&&!e.isLogin?(v(),g("div",{key:0,class:x(["wl-header",`item${e.config.meta.length}`])},[(v(!0),g(f,null,w(e.config.meta,(t=>(v(),g("div",{class:"wl-header-item",key:t},[k("label",{for:t,textContent:j(e.locale[t]+(e.config.requiredMeta.includes(t)||!e.config.requiredMeta.length?"":`(${e.locale.optional})`))},null,8,Rt),R(k("input",{ref_for:!0,ref:n=>{n&&(e.inputRefs[t]=n)},id:`wl-${t}`,class:x(["wl-input",`wl-${t}`]),name:t,type:"mail"===t?"email":"text","onUpdate:modelValue":n=>e.userMeta[t]=n},null,10,Et),[[E,e.userMeta[t]]])])))),128))],2)):b("v-if",!0),R(k("textarea",{class:"wl-editor",ref:"editorRef",id:"wl-edit",placeholder:e.replyUser?`@${e.replyUser}`:e.locale.placeholder,"onUpdate:modelValue":t[2]||(t[2]=t=>e.editor=t),onKeydown:t[3]||(t[3]=(...t)=>e.onKeyDown&&e.onKeyDown(...t)),onDrop:t[4]||(t[4]=(...t)=>e.onDrop&&e.onDrop(...t)),onPaste:t[5]||(t[5]=(...t)=>e.onPaste&&e.onPaste(...t))},null,40,At),[[A,e.editor]]),R(k("div",Ut,[zt,k("h4",null,j(e.locale.preview)+":",1),k("div",{class:"wl-content",innerHTML:e.previewText},null,8,Mt)],512),[[U,e.showPreview]]),k("div",Ot,[k("div",Tt,[k("a",Pt,[S(i)]),R(k("button",{ref:"emojiButtonRef",class:x(["wl-action",{actived:e.showEmoji}]),title:e.locale.emoji,onClick:t[6]||(t[6]=t=>e.showEmoji=!e.showEmoji)},[S(s)],10,Nt),[[U,e.emoji.tabs.length]]),e.config.search?(v(),g("button",{key:0,ref:"gifButtonRef",class:x(["wl-action",{actived:e.showGif}]),title:e.locale.gif,onClick:t[7]||(t[7]=t=>e.showGif=!e.showGif)},[S(c)],10,Ht)):b("v-if",!0),k("input",{ref:"imageUploadRef",class:"upload",id:"wl-image-upload",type:"file",accept:".png,.jpg,.jpeg,.webp,.bmp,.gif",onChange:t[8]||(t[8]=(...t)=>e.onChange&&e.onChange(...t))},null,544),e.canUploadImage?(v(),g("label",{key:1,for:"wl-image-upload",class:"wl-action",title:e.locale.uploadImage},[S(u)],8,Vt)):b("v-if",!0),k("button",{class:x(["wl-action",{actived:e.showPreview}]),title:e.locale.preview,onClick:t[9]||(t[9]=t=>e.showPreview=!e.showPreview)},[S(m)],10,_t)]),k("div",Ft,[k("div",Bt,[z(j(e.wordNumber)+" ",1),e.config.wordLimit?(v(),g("span",Dt,[Wt,k("span",{class:x({illegal:!e.isWordNumberLegal}),textContent:j(e.wordLimit)},null,10,Gt)])):b("v-if",!0),z(" "+j(e.locale.word),1)]),"disable"===e.config.login||e.isLogin?b("v-if",!0):(v(),g("button",{key:0,class:"wl-btn",onClick:t[10]||(t[10]=(...t)=>e.onLogin&&e.onLogin(...t)),textContent:j(e.locale.login)},null,8,qt)),"force"!==e.config.login||e.isLogin?(v(),g("button",{key:1,class:"wl-btn primary",title:"Cmd|Ctrl + Enter",disabled:e.isSubmitting,onClick:t[11]||(t[11]=(...t)=>e.submitComment&&e.submitComment(...t))},[e.isSubmitting?(v(),y(d,{key:0,size:16})):(v(),g(f,{key:1},[z(j(e.locale.submit),1)],64))],8,Jt)):b("v-if",!0)]),k("div",{ref:"gifPopupRef",class:x(["wl-gif-popup",{display:e.showGif}])},[k("input",{type:"text",placeholder:e.locale.gifSearchPlaceholder,ref:"gifSearchInputRef",onInput:t[12]||(t[12]=(...t)=>e.onGifSearch&&e.onGifSearch(...t))},null,40,Kt),S(h,{items:e.gifData.list,"column-width":200,gap:6,onInsert:t[13]||(t[13]=t=>e.insert(t)),onScroll:e.onImageWallScroll},null,8,["items","onScroll"]),e.gifData.loading?(v(),g("div",Yt,[S(d,{size:30})])):b("v-if",!0)],2),k("div",{ref:"emojiPopupRef",class:x(["wl-emoji-popup",{display:e.showEmoji}])},[(v(!0),g(f,null,w(e.emoji.tabs,((t,n)=>(v(),g(f,{key:t.name},[n===e.emojiTabIndex?(v(),g("div",Zt,[(v(!0),g(f,null,w(t.items,(t=>(v(),g("button",{key:t,title:t,onClick:n=>e.insert(`:${t}:`)},[e.showEmoji?(v(),g("img",{key:0,class:"wl-emoji",src:e.emoji.map[t],alt:t,loading:"lazy",referrerPolicy:"no-referrer"},null,8,Qt)):b("v-if",!0)],8,Xt)))),128))])):b("v-if",!0)],64)))),128)),e.emoji.tabs.length>1?(v(),g("div",en,[(v(!0),g(f,null,w(e.emoji.tabs,((t,n)=>(v(),g("button",{key:t.name,class:x(["wl-tab",{active:e.emojiTabIndex===n}]),onClick:t=>e.emojiTabIndex=n},[k("img",{class:"wl-emoji",src:t.icon,alt:t.name,title:t.name,loading:"lazy",referrerPolicy:"no-referrer"},null,8,nn)],10,tn)))),128))])):b("v-if",!0)],2)])]),e.replyId?(v(),g("button",{key:1,class:"wl-close",title:e.locale.cancelReply,onClick:t[14]||(t[14]=t=>e.$emit("cancel-reply"))},[S(r,{size:24})],8,ln)):b("v-if",!0)])}],["__file","CommentBox.vue"]]);const an=["approved","waiting","spam"],rn=u({props:{comment:{type:Object,required:!0},rootId:{type:String,required:!0},reply:{type:Object}},components:{CommentBox:on,DeleteIcon:()=>c("svg",{viewBox:"0 0 1024 1024",width:"24",height:"24"},c("path",{d:"m341.013 394.667 27.755 393.45h271.83l27.733-393.45h64.106l-28.01 397.952a64 64 0 0 1-63.83 59.498H368.768a64 64 0 0 1-63.83-59.52l-28.053-397.93h64.128zm139.307 19.818v298.667h-64V414.485h64zm117.013 0v298.667h-64V414.485h64zM181.333 288h640v64h-640v-64zm453.483-106.667v64h-256v-64h256z",fill:"red"})),LikeIcon:({active:e=!1})=>c("svg",{viewBox:"0 0 1024 1024",width:"24",height:"24"},[c("path",{d:"M850.654 323.804c-11.042-25.625-26.862-48.532-46.885-68.225-20.022-19.61-43.258-34.936-69.213-45.73-26.78-11.124-55.124-16.727-84.375-16.727-40.622 0-80.256 11.123-114.698 32.135A214.79 214.79 0 0 0 512 241.819a214.79 214.79 0 0 0-23.483-16.562c-34.442-21.012-74.076-32.135-114.698-32.135-29.25 0-57.595 5.603-84.375 16.727-25.872 10.711-49.19 26.12-69.213 45.73-20.105 19.693-35.843 42.6-46.885 68.225-11.453 26.615-17.303 54.877-17.303 83.963 0 27.439 5.603 56.03 16.727 85.117 9.31 24.307 22.659 49.52 39.715 74.981 27.027 40.293 64.188 82.316 110.33 124.915 76.465 70.615 152.189 119.394 155.402 121.371l19.528 12.525c8.652 5.52 19.776 5.52 28.427 0l19.529-12.525c3.213-2.06 78.854-50.756 155.401-121.371 46.143-42.6 83.304-84.622 110.33-124.915 17.057-25.46 30.487-50.674 39.716-74.981 11.124-29.087 16.727-57.678 16.727-85.117.082-29.086-5.768-57.348-17.221-83.963z"+(e?"":"M512 761.5S218.665 573.55 218.665 407.767c0-83.963 69.461-152.023 155.154-152.023 60.233 0 112.473 33.618 138.181 82.727 25.708-49.109 77.948-82.727 138.18-82.727 85.694 0 155.155 68.06 155.155 152.023C805.335 573.551 512 761.5 512 761.5z"),fill:e?"red":"currentColor"})]),ReplyIcon:()=>c("svg",{viewBox:"0 0 1024 1024",width:"24",height:"24"},c("path",{d:"M810.667 213.333a64 64 0 0 1 64 64V704a64 64 0 0 1-64 64H478.336l-146.645 96.107a21.333 21.333 0 0 1-33.024-17.856V768h-85.334a64 64 0 0 1-64-64V277.333a64 64 0 0 1 64-64h597.334zm0 64H213.333V704h149.334v63.296L459.243 704h351.424V277.333zm-271.36 213.334v64h-176.64v-64h176.64zm122.026-128v64H362.667v-64h298.666z",fill:"currentColor"})),VerifiedIcon:()=>c("svg",{class:"verified-icon",viewBox:"0 0 1024 1024",width:"14",height:"14"},c("path",{d:"m894.4 461.56-54.4-63.2c-10.4-12-18.8-34.4-18.8-50.4v-68c0-42.4-34.8-77.2-77.2-77.2h-68c-15.6 0-38.4-8.4-50.4-18.8l-63.2-54.4c-27.6-23.6-72.8-23.6-100.8 0l-62.8 54.8c-12 10-34.8 18.4-50.4 18.4h-69.2c-42.4 0-77.2 34.8-77.2 77.2v68.4c0 15.6-8.4 38-18.4 50l-54 63.6c-23.2 27.6-23.2 72.4 0 100l54 63.6c10 12 18.4 34.4 18.4 50v68.4c0 42.4 34.8 77.2 77.2 77.2h69.2c15.6 0 38.4 8.4 50.4 18.8l63.2 54.4c27.6 23.6 72.8 23.6 100.8 0l63.2-54.4c12-10.4 34.4-18.8 50.4-18.8h68c42.4 0 77.2-34.8 77.2-77.2v-68c0-15.6 8.4-38.4 18.8-50.4l54.4-63.2c23.2-27.6 23.2-73.2-.4-100.8zm-216-25.2-193.2 193.2a30 30 0 0 1-42.4 0l-96.8-96.8a30.16 30.16 0 0 1 0-42.4c11.6-11.6 30.8-11.6 42.4 0l75.6 75.6 172-172c11.6-11.6 30.8-11.6 42.4 0 11.6 11.6 11.6 30.8 0 42.4z",fill:"#27ae60"}))},emits:["submit","reply","like","delete","status","sticky"],setup(e){const t=$("config"),n=vt(),l=dt(),o=s((()=>t.value.locale)),a=s((()=>{let{link:t}=e.comment;return t?_e(t)?t:`https://${t}`:""})),r=s((()=>n.value.includes(e.comment.objectId))),i=((e,t)=>{const n=Pe();return s((()=>qe(e,n.value,t)))})(e.comment.insertedAt,o.value),c=s((()=>"administrator"===l.value.type)),u=s((()=>e.comment.user_id&&l.value.objectId===e.comment.user_id)),m=s((()=>e.comment.objectId===e.reply?.objectId));return{config:t,locale:o,isReplyingCurrent:m,link:a,like:r,time:i,isAdmin:c,isOwner:u,commentStatus:an}}}),sn=["id"],cn={class:"wl-user","aria-hidden":"true"},un=["src"],mn={class:"wl-card"},dn={class:"wl-head"},pn=["href"],vn={key:1,class:"wl-nick"},gn=["textContent"],hn=["textContent"],fn=["textContent"],wn=["textContent"],yn=["textContent"],bn={class:"wl-comment-actions"},kn=["title"],Cn=["textContent"],$n=["title"],In={class:"wl-meta","aria-hidden":"true"},Ln=["textContent"],Sn=["textContent"],jn=["textContent"],xn=["innerHTML"],Rn={key:0,class:"wl-admin-actions"},En={class:"wl-comment-status"},An=["disabled","onClick","textContent"],Un={key:1,class:"wl-reply-wrapper"},zn={key:2,class:"wl-quote"};const Mn=u({name:"WalineRoot",components:{CommentBox:on,CommentCard:ft(rn,[["render",function(e,t,n,l,o,a){const r=p("VerifiedIcon"),i=p("DeleteIcon"),s=p("LikeIcon"),c=p("ReplyIcon"),u=p("CommentBox"),m=p("CommentCard",!0);return v(),g("div",{class:"wl-item",id:e.comment.objectId},[k("div",cn,[e.comment.avatar?(v(),g("img",{key:0,src:e.comment.avatar},null,8,un)):b("v-if",!0),e.comment.type?(v(),y(r,{key:1})):b("v-if",!0)]),k("div",mn,[k("div",dn,[e.link?(v(),g("a",{key:0,class:"wl-nick",href:e.link,target:"_blank",rel:"nofollow noreferrer"},j(e.comment.nick),9,pn)):(v(),g("span",vn,j(e.comment.nick),1)),"administrator"===e.comment.type?(v(),g("span",{key:2,class:"wl-badge",textContent:j(e.locale.admin)},null,8,gn)):b("v-if",!0),e.comment.label?(v(),g("span",{key:3,class:"wl-badge",textContent:j(e.comment.label)},null,8,hn)):b("v-if",!0),e.comment.sticky?(v(),g("span",{key:4,class:"wl-badge",textContent:j(e.locale.sticky)},null,8,fn)):b("v-if",!0),void 0!==e.comment.level&&e.comment.level>=0?(v(),g("span",{key:5,class:x(`wl-badge level${e.comment.level}`),textContent:j(e.locale[`level${e.comment.level}`]||`Level ${e.comment.level}`)},null,10,wn)):b("v-if",!0),k("span",{class:"wl-time",textContent:j(e.time)},null,8,yn),k("div",bn,[e.isAdmin||e.isOwner?(v(),g("button",{key:0,class:"wl-delete",onClick:t[0]||(t[0]=t=>e.$emit("delete",e.comment))},[S(i)])):b("v-if",!0),k("button",{class:"wl-like",onClick:t[1]||(t[1]=t=>e.$emit("like",e.comment)),title:e.like?e.locale.cancelLike:e.locale.like},[S(s,{active:e.like},null,8,["active"]),"like"in e.comment?(v(),g("span",{key:0,textContent:j(e.comment.like)},null,8,Cn)):b("v-if",!0)],8,kn),k("button",{class:x(["wl-reply",{active:e.isReplyingCurrent}]),title:e.isReplyingCurrent?e.locale.cancelReply:e.locale.reply,onClick:t[2]||(t[2]=t=>e.$emit("reply",e.isReplyingCurrent?null:e.comment))},[S(c)],10,$n)])]),k("div",In,[e.comment.addr?(v(),g("span",{key:0,textContent:j(e.comment.addr)},null,8,Ln)):b("v-if",!0),e.comment.browser?(v(),g("span",{key:1,textContent:j(e.comment.browser)},null,8,Sn)):b("v-if",!0),e.comment.os?(v(),g("span",{key:2,textContent:j(e.comment.os)},null,8,jn)):b("v-if",!0)]),k("div",{class:"wl-content",innerHTML:e.comment.comment},null,8,xn),e.isAdmin?(v(),g("div",Rn,[k("span",En,[(v(!0),g(f,null,w(e.commentStatus,(t=>(v(),g("button",{key:t,class:x(`wl-btn wl-${t}`),disabled:e.comment.status===t,onClick:n=>e.$emit("status",{status:t,comment:e.comment}),textContent:j(t)},null,10,An)))),128))]),e.isAdmin&&!e.comment.rid?(v(),g("button",{key:0,class:"wl-btn wl-sticky",onClick:t[3]||(t[3]=t=>e.$emit("sticky",e.comment))},j(e.comment.sticky?"unsticky":"sticky"),1)):b("v-if",!0)])):b("v-if",!0),e.isReplyingCurrent?(v(),g("div",Un,[S(u,{replyId:e.comment.objectId,replyUser:e.comment.nick,rootId:e.rootId,onSubmit:t[4]||(t[4]=t=>e.$emit("submit",t)),onCancelReply:t[5]||(t[5]=t=>e.$emit("reply",null))},null,8,["replyId","replyUser","rootId"])])):b("v-if",!0),e.comment.children?(v(),g("div",zn,[(v(!0),g(f,null,w(e.comment.children,(n=>(v(),y(m,{key:n.objectId,comment:n,reply:e.reply,rootId:e.rootId,onReply:t[6]||(t[6]=t=>e.$emit("reply",t)),onSubmit:t[7]||(t[7]=t=>e.$emit("submit",t)),onLike:t[8]||(t[8]=t=>e.$emit("like",t)),onDelete:t[9]||(t[9]=t=>e.$emit("delete",t)),onStatus:t[10]||(t[10]=t=>e.$emit("status",t)),onSticky:t[11]||(t[11]=t=>e.$emit("sticky",t))},null,8,["comment","reply","rootId"])))),128))])):b("v-if",!0)])],8,sn)}],["__file","CommentCard.vue"]]),LoadingIcon:ht},props:["serverURL","path","meta","requiredMeta","dark","lang","locale","pageSize","wordLimit","emoji","login","highlighter","texRenderer","imageUploader","copyright"],setup(e){const t=s((()=>(({serverURL:e,path:t=location.pathname,lang:n="zh-CN",locale:l,emoji:o=["//unpkg.com/@waline/emojis@1.0.1/weibo"],meta:a=["nick","mail","link"],requiredMeta:r=[],dark:i=!1,pageSize:s=10,wordLimit:c,imageUploader:u,highlighter:m,texRenderer:d,copyright:p=!0,login:v="enable",search:g=B(),...h})=>({serverURL:Fe(e),path:He(t),locale:{...ne[n]||ne["zh-CN"],..."object"==typeof l?l:{}},wordLimit:Be(c),meta:V(a),requiredMeta:V(r),imageUploader:De(u,_),highlighter:De(m,q),texRenderer:De(d,F),lang:n,dark:i,emoji:o,pageSize:s,login:v,copyright:p,search:g,...h}))(e))),o=dt(),a=vt(),i=l("loading"),c=l(0),u=l(1),d=l(0),p=l([]),v=l(null),g=s((()=>{return"string"==typeof(e=t.value.dark)?"auto"===e?`@media(prefers-color-scheme:dark){body${We}}`:`${e}${We}`:!0===e?`:root${We}`:"";var e}));let h;!function(e,t={}){const o=l(!1),{document:a=$e,immediate:i=!0,manual:s=!1,id:c="vueuse_styletag_"+ ++Ne}=t,u=l(e);let m=()=>{};const d=()=>{if(!a)return;const e=a.getElementById(c)||a.createElement("style");e.type="text/css",e.id=c,t.media&&(e.media=t.media),a.head.appendChild(e),o.value||(m=n(u,(t=>{e.innerText=t}),{immediate:!0}),o.value=!0)},p=()=>{a&&o.value&&(m(),a.head.removeChild(a.getElementById(c)),o.value=!1)};i&&!s&&d(),s||le(p),r(o)}(g);const f=e=>{const{serverURL:n,path:l,pageSize:a}=t.value,r=new AbortController;i.value="loading",h?.(),(({serverURL:e,lang:t,path:n,page:l,pageSize:o,signal:a,token:r})=>{const i={};return r&&(i.Authorization=`Bearer ${r}`),fetch(`${e}/comment?path=${encodeURIComponent(n)}&pageSize=${o}&page=${l}&lang=${t}`,{signal:a,headers:i}).then((e=>e.json())).then((e=>Xe(e,"comment list")))})({serverURL:n,lang:t.value.lang,path:l,pageSize:a,page:e,signal:r.signal,token:o.value?.token}).then((t=>{i.value="success",c.value=t.count,p.value.push(...t.data),u.value=e,d.value=t.totalPages})).catch((e=>{"AbortError"!==e.name&&(console.error(e.message),i.value="error")})),h=r.abort.bind(r)},w=()=>{c.value=0,p.value=[],f(1)};return M("config",t),n((()=>e.path),w),m((()=>w())),{config:t,darkmodeStyle:g,i18n:s((()=>t.value.locale)),status:i,count:c,page:u,totalPages:d,data:p,reply:v,loadMore:()=>f(u.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:n})=>{if(e.status===n)return;const{serverURL:l,lang:a}=t.value;await Qe({serverURL:l,lang:a,token:o.value?.token,objectId:e.objectId,status:n}),e.status=n},onDelete:async({objectId:e})=>{if(!confirm("Are you sure you want to delete this comment?"))return;const{serverURL:n,lang:l}=t.value;await(({serverURL:e,lang:t,token:n,objectId:l})=>fetch(`${e}/comment/${l}?lang=${t}`,{method:"DELETE",headers:{Authorization:`Bearer ${n}`}}).then((e=>e.json())))({serverURL:n,lang:l,token:o.value?.token,objectId:e}),p.value.some(((t,n)=>t.objectId===e?(p.value=p.value.filter(((e,t)=>t!==n)),!0):t.children.some(((l,o)=>l.objectId===e&&(p.value[n].children=t.children.filter(((e,t)=>t!==o)),!0)))))},onSticky:async e=>{if(e.rid)return;const{serverURL:n,lang:l}=t.value;await Qe({serverURL:n,lang:l,token:o.value?.token,objectId:e.objectId,sticky:e.sticky?0:1}),e.sticky=!e.sticky},onLike:async e=>{const{serverURL:n,lang:l}=t.value,{objectId:o}=e,r=a.value.includes(o);await(({serverURL:e,lang:t,objectId:n,like:l})=>fetch(`${e}/comment/${n}?lang=${t}`,{method:"PUT",headers:Ze,body:JSON.stringify({like:l})}).then((e=>e.json())))({serverURL:n,lang:l,objectId:o,like:!r}),r?a.value=a.value.filter((e=>e!==o)):(a.value=[...a.value,o],a.value.length>50&&(a.value=a.value.slice(-50))),e.like=(e.like||0)+(r?-1:1)},version:"2.6.0"}}}),On={"data-waline":""},Tn={class:"wl-count"},Pn=["textContent"],Nn={class:"wl-cards"},Hn={key:1,class:"wl-operation"},Vn=["textContent"],_n={key:0,class:"wl-loading"},Fn=["textContent"],Bn={class:"wl-operation"},Dn=["textContent"],Wn={key:3,class:"wl-power"},Gn=z(" Powered by "),qn=k("a",{href:"https://github.com/walinejs/waline",target:"_blank",rel:"noreferrer"}," Waline ",-1);var Jn=ft(Mn,[["render",function(e,t,n,l,o,a){const r=p("CommentBox"),i=p("CommentCard"),s=p("LoadingIcon");return v(),g("div",On,[e.reply?b("v-if",!0):(v(),y(r,{key:0,onSubmit:e.onSubmit},null,8,["onSubmit"])),k("div",Tn,[e.count?(v(),g("span",{key:0,class:"wl-num",textContent:j(e.count)},null,8,Pn)):b("v-if",!0),z(" "+j(e.i18n.comment),1)]),k("div",Nn,[(v(!0),g(f,null,w(e.data,(t=>(v(),y(i,{key:t.objectId,"root-id":t.objectId,comment:t,reply:e.reply,onReply:e.onReply,onSubmit:e.onSubmit,onStatus:e.onStatusChange,onDelete:e.onDelete,onSticky:e.onSticky,onLike:e.onLike},null,8,["root-id","comment","reply","onReply","onSubmit","onStatus","onDelete","onSticky","onLike"])))),128))]),"error"===e.status?(v(),g("div",Hn,[k("button",{type:"button",class:"wl-btn",onClick:t[0]||(t[0]=(...t)=>e.refresh&&e.refresh(...t)),textContent:j(e.i18n.refresh)},null,8,Vn)])):(v(),g(f,{key:2},["loading"===e.status?(v(),g("div",_n,[S(s,{size:30})])):e.data.length?e.page<e.totalPages?(v(),g(f,{key:2},[b(" Load more button "),k("div",Bn,[k("button",{type:"button",class:"wl-btn",onClick:t[1]||(t[1]=(...t)=>e.loadMore&&e.loadMore(...t)),textContent:j(e.i18n.more)},null,8,Dn)])],2112)):b("v-if",!0):(v(),g("div",{key:1,class:"wl-empty",textContent:j(e.i18n.sofa)},null,8,Fn))],64)),b(" Copyright Information "),e.config.copyright?(v(),g("div",Wn,[Gn,qn,z(" v"+j(e.version),1)])):b("v-if",!0)])}],["__file","Waline.vue"]]);const Kn=(e,t)=>{t.forEach(((t,n)=>{t.innerText=e[n].toString()}))},Yn=({serverURL:e,path:t=window.location.pathname,selector:n=".waline-pageview-count",update:l=!0,lang:o="zh-CN"})=>{const a=new AbortController,r=Array.from(document.querySelectorAll(n)),i=e=>{const n=ut(e);return null!==n&&t!==n},s=n=>et({serverURL:Fe(e),paths:n.map((e=>ut(e)||t)),lang:o,signal:a.signal}).then((e=>Kn(e,n))).catch(Ye);if(l){const n=r.filter((e=>!i(e))),l=r.filter(i);tt({serverURL:e,path:t,lang:o}).then((e=>Kn(new Array(n.length).fill(e),n))),l.length&&s(l)}else s(r);return a.abort.bind(a)},Zn=({el:e="#waline",path:t=window.location.pathname,comment:n=!1,pageview:l=!1,...o})=>{const a=e?nt(e):null;if(e&&!a)throw new Error("Option 'el' do not match any domElement!");if(!o.serverURL)throw new Error("Option 'serverURL' is missing!");const r=I({...o}),i=I({comment:n,pageview:l,path:t}),s=a?O((()=>c(Jn,{path:i.path,...r}))):null;s&&s.mount(a);const u=T((()=>{i.comment&>({serverURL:r.serverURL,path:i.path,selector:"string"==typeof i.comment?i.comment:void 0})})),m=T((()=>{i.pageview&&Yn({serverURL:r.serverURL,path:i.path,selector:"string"==typeof i.pageview?i.pageview:void 0})}));return{el:a,update:({comment:e,pageview:t,path:n=window.location.pathname,...l}={})=>{Object.entries(l).forEach((([e,t])=>{r[e]=t})),i.path=n,void 0!==e&&(i.comment=e),void 0!==t&&(i.pageview=t)},destroy:()=>{s?.unmount(),u(),m()}}},Xn="2.6.0",Qn=({el:e,serverURL:t,count:n,lang:l="zh-CN"})=>{const o=dt(),a=nt(e),r=new AbortController;return(({serverURL:e,lang:t,count:n,signal:l,token:o})=>{const a={};return o&&(a.Authorization=`Bearer ${o}`),fetch(`${e}/comment?type=recent&count=${n}&lang=${t}`,{signal:l,headers:a}).then((e=>e.json())).then((e=>Xe(e,"recent comment")))})({serverURL:t,count:n,lang:l,signal:r.signal,token:o.value?.token}).then((e=>a&&e.length?(a.innerHTML=`<ul class="wl-recent-list">${e.map((e=>`<li class="wl-recent-item"><a href="${e.url}">${e.nick}</a>:${e.comment}</li>`)).join("")}</ul>`,{comments:e,destroy:()=>{r.abort(),a.innerHTML=""}}):{comments:e,destroy:()=>r.abort()}))};export{Qn as RecentComments,gt as commentCount,ne as defaultLocales,Zn as init,Yn as pageviewCount,Xn as version}; | ||
import{getCurrentScope as e,onScopeDispose as t,watch as n,ref as l,unref as o,isRef as a,readonly as r,shallowRef as i,computed as s,h as c,defineComponent as u,onMounted as m,onBeforeUnmount as d,resolveComponent as p,openBlock as v,createElementBlock as g,normalizeStyle as h,Fragment as f,renderList as w,createBlock as y,createCommentVNode as b,createElementVNode as k,nextTick as C,inject as $,reactive as I,onUnmounted as L,createVNode as S,toDisplayString as j,normalizeClass as x,withDirectives as R,vModelDynamic as E,vModelText as A,vShow as U,createTextVNode as z,provide as M,createApp as O,watchEffect as T}from"vue";import P from"autosize";import{marked as N}from"marked";const H=["nick","mail","link"],V=e=>e.filter((e=>H.includes(e))),_=e=>new Promise(((t,n)=>{const l=new FileReader;l.readAsDataURL(e),l.onload=()=>t(l.result?.toString()||""),l.onerror=n})),F=e=>!0===e?'<p class="wl-tex">Tex is not available in preview</p>':'<span class="wl-tex">Tex is not available in preview</span>',B=()=>{const e={next:""},t=({keyword:e,pos:t})=>{const n=new URLSearchParams("media_filter=minimal");return n.set("key","PAY5JLFIH6V6"),n.set("limit","20"),n.set("pos",t||""),n.set("q",e),fetch(`https://g.tenor.com/v1/search?${n.toString()}`,{headers:{"Content-Type":"application/json"}}).then((e=>e.json())).catch((()=>({next:t||"",results:[]})))};return{search:(n="")=>t({keyword:n}).then((t=>(e.next=t.next,t.results.map((e=>({title:e.title,src:e.media[0].tinygif.url})))))),more:n=>t({keyword:n,pos:e.next}).then((t=>(e.next=t.next,t.results.map((e=>({title:e.title,src:e.media[0].tinygif.url}))))))}},D=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"),W=["23AC69","91C132","F19726","E8552D","1AAB8E","E1147F","2980C1","1BA1E6","9FA0A0","F19726","E30B20","E30B20","A3338B"],G={},q=e=>{let t=0;return e.replace(D,((e,n,l)=>{if(l)return`<span style="color: slategray">${l}</span>`;if("<"===n)return"<";let o;G[n]?o=G[n]:(o=W[t],G[n]=o);const a=`<span style="color: #${o}">${n}</span>`;return t=++t%W.length,a}))},J=["nick","nickError","mail","mailError","link","optional","placeholder","sofa","submit","like","cancelLike","reply","cancelReply","comment","refresh","more","preview","emoji","uploadImage","seconds","minutes","hours","days","now","uploading","login","logout","admin","sticky","word","wordHint","anonymous","level0","level1","level2","level3","level4","level5","gif","gifSearchPlaceholder"],K=e=>Object.fromEntries(e.map(((e,t)=>[J[t],e])));var Y=K(["NickName","NickName cannot be less than 3 bytes.","E-Mail","Please confirm your email address.","Website","Optional","Comment here...","No comment yet.","Submit","Like","Cancel like","Reply","Cancel reply","Comments","Refresh","Load More...","Preview","Emoji","Upload Image","seconds ago","minutes ago","hours ago","days ago","just now","Uploading","Login","logout","Admin","Sticky","Words","Please input comments between $0 and $1 words!\n Current word number: $2","Anonymous","Dwarves","Hobbits","Ents","Wizards","Elves","Maiar","GIF","Search GIF"]),Z=K(["ニックネーム","3バイト以上のニックネームをご入力ください.","メールアドレス","メールアドレスをご確認ください.","サイト","オプション","ここにコメント","コメントしましょう~","提出する","Like","Cancel like","返信する","キャンセル","コメント","更新","さらに読み込む","プレビュー","絵文字","画像をアップロード","秒前","分前","時間前","日前","たっだ今","アップロード","ログインする","ログアウト","管理者","トップに置く","ワード","コメントは $0 から $1 ワードの間でなければなりません!\n 現在の単語番号: $2","匿名","うえにん","なかにん","しもおし","特にしもおし","かげ","なぬし","GIF","探す GIF"]),X=K(["昵称","昵称不能少于3个字符","邮箱","请填写正确的邮件地址","网址","可选","欢迎评论","来发评论吧~","提交","喜欢","取消喜欢","回复","取消回复","评论","刷新","加载更多...","预览","表情","上传图片","秒前","分钟前","小时前","天前","刚刚","正在上传","登录","退出","博主","置顶","字","评论字数应在 $0 到 $1 字之间!\n当前字数:$2","匿名","潜水","冒泡","吐槽","活跃","话痨","传说","表情包","搜索表情包"]),Q=K(["暱稱","郵箱","網址","可選","暱稱不能少於3個字元","請填寫正確的郵件地址","歡迎評論","來發評論吧~","提交","喜歡","取消喜歡","回覆","取消回覆","評論","刷新","載入更多...","預覽","表情","上傳圖片","秒前","分鐘前","小時前","天前","剛剛","正在上傳","登錄","退出","博主","置頂","字","評論字數應在 $0 到 $1 字之間!\n當前字數:$2","匿名","潛水","冒泡","吐槽","活躍","話癆","傳說","表情包","搜索表情包"]),ee=K(["Apelido","Apelido não pode ser menor que 3 bytes.","E-Mail","Por favor, confirme seu endereço de e-mail.","Website","Opcional","Comente aqui...","Nenhum comentário, ainda.","Enviar","Like","Cancel like","Responder","Cancelar resposta","Comentários","Refrescar","Carregar Mais...","Visualizar","Emoji","Enviar Imagem","segundos atrás","minutos atrás","horas atrás","dias atrás","agora mesmo","Enviando","Entrar","Sair","Admin","Sticky","Palavras","Favor enviar comentário com $0 a $1 palavras!\n Número de palavras atuais: $2","Anônimo","Dwarves","Hobbits","Ents","Wizards","Elves","Maiar","GIF","Pesquisar GIF"]),te=K(["Псевдоним","Никнейм не может быть меньше 3 байт.","Эл. адрес","Пожалуйста, подтвердите адрес вашей электронной почты.","Веб-сайт","Необязательный","Комментарий здесь...","Пока нет комментариев.","Отправить","Like","Cancel like","Отвечать","Отменить ответ","Комментарии","Обновить","Загрузи больше...","Превью","эмодзи","Загрузить изображение","секунд назад","несколько минут назад","несколько часов назад","дней назад","прямо сейчас","Загрузка","Авторизоваться","Выход из системы","Админ","Липкий","Слова","Пожалуйста, введите комментарии от $0 до $1 слов!\nНомер текущего слова: $2","Анонимный","Dwarves","Hobbits","Ents","Wizards","Elves","Maiar","GIF","Поиск GIF"]);const ne={zh:X,"zh-cn":X,"zh-CN":X,"zh-tw":Q,"zh-TW":Q,en:Y,"en-US":Y,"en-us":Y,jp:Z,"jp-jp":Z,"jp-JP":Z,"pt-br":ee,"pt-BR":ee,ru:te,"ru-ru":te,"ru-RU":te};function le(n){return!!e()&&(t(n),!0)}var oe;const ae="undefined"!=typeof window,re=()=>{};function ie(e,t){return function(...n){e((()=>t.apply(this,n)),{fn:t,thisArg:this,args:n})}}ae&&(null==(oe=null==window?void 0:window.navigator)?void 0:oe.userAgent)&&/iP(ad|hone|od)/.test(window.navigator.userAgent);const se=e=>e();function ce(e,t=200,n={}){return ie(function(e,t={}){let n,l;return a=>{const r=o(e),i=o(t.maxWait);if(n&&clearTimeout(n),r<=0||void 0!==i&&i<=0)return l&&(clearTimeout(l),l=null),a();i&&!l&&(l=setTimeout((()=>{n&&clearTimeout(n),l=null,a()}),i)),n=setTimeout((()=>{l&&clearTimeout(l),l=null,a()}),r)}}(t,n),e)}var ue=Object.getOwnPropertySymbols,me=Object.prototype.hasOwnProperty,de=Object.prototype.propertyIsEnumerable;function pe(e,t,l={}){const o=l,{eventFilter:a=se}=o,r=((e,t)=>{var n={};for(var l in e)me.call(e,l)&&t.indexOf(l)<0&&(n[l]=e[l]);if(null!=e&&ue)for(var l of ue(e))t.indexOf(l)<0&&de.call(e,l)&&(n[l]=e[l]);return n})(o,["eventFilter"]);return n(e,ie(a,t),r)}var ve=Object.defineProperty,ge=Object.defineProperties,he=Object.getOwnPropertyDescriptors,fe=Object.getOwnPropertySymbols,we=Object.prototype.hasOwnProperty,ye=Object.prototype.propertyIsEnumerable,be=(e,t,n)=>t in e?ve(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;function ke(e,t,n={}){const o=n,{eventFilter:a}=o,r=((e,t)=>{var n={};for(var l in e)we.call(e,l)&&t.indexOf(l)<0&&(n[l]=e[l]);if(null!=e&&fe)for(var l of fe(e))t.indexOf(l)<0&&ye.call(e,l)&&(n[l]=e[l]);return n})(o,["eventFilter"]),{eventFilter:i,pause:s,resume:c,isActive:u}=function(e=se){const t=l(!0);return{isActive:t,pause:function(){t.value=!1},resume:function(){t.value=!0},eventFilter:(...n)=>{t.value&&e(...n)}}}(a),m=pe(e,t,(d=((e,t)=>{for(var n in t||(t={}))we.call(t,n)&&be(e,n,t[n]);if(fe)for(var n of fe(t))ye.call(t,n)&&be(e,n,t[n]);return e})({},r),ge(d,he({eventFilter:i}))));var d;return{stop:m,pause:s,resume:c,isActive:u}}const Ce=ae?window:void 0,$e=ae?window.document:void 0;function Ie(...e){let t,l,a,r;if("string"==typeof e[0]?([l,a,r]=e,t=Ce):[t,l,a,r]=e,!t)return re;let i=re;const s=n((()=>function(e){var t;const n=o(e);return null!=(t=null==n?void 0:n.$el)?t:n}(t)),(e=>{i(),e&&(e.addEventListener(l,a,r),i=()=>{e.removeEventListener(l,a,r),i=re})}),{immediate:!0,flush:"post"}),c=()=>{s(),i()};return le(c),c}ae&&window.navigator,ae&&window.location;const Le="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},Se="__vueuse_ssr_handlers__";Le[Se]=Le[Se]||{};const je=Le[Se];const xe={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 Re(e,t,n,a={}){var r;const{flush:s="pre",deep:c=!0,listenToStorageChanges:u=!0,writeDefaults:m=!0,shallow:d,window:p=Ce,eventFilter:v,onError:g=(e=>{console.error(e)})}=a,h=(d?i:l)(t);if(!n)try{n=function(e,t){return je[e]||t}("getDefaultStorage",(()=>{var e;return null==(e=Ce)?void 0:e.localStorage}))()}catch(e){g(e)}if(!n)return h;const f=o(t),w=function(e){return null==e?"any":e instanceof Set?"set":e instanceof Map?"map":e instanceof Date?"date":"boolean"==typeof e?"boolean":"string"==typeof e?"string":"object"==typeof e||Array.isArray(e)?"object":Number.isNaN(e)?"any":"number"}(f),y=null!=(r=a.serializer)?r:xe[w],{pause:b,resume:k}=ke(h,(()=>function(t){try{null==t?n.removeItem(e):n.setItem(e,y.write(t))}catch(e){g(e)}}(h.value)),{flush:s,deep:c,eventFilter:v});return p&&u&&Ie(p,"storage",C),C(),h;function C(t){t&&t.key!==e||(h.value=function(t){if(!t||t.key===e){b();try{const l=t?t.newValue:n.getItem(e);return null==l?(m&&null!==f&&n.setItem(e,y.write(f)),f):"string"!=typeof l?l:y.read(l)}catch(e){g(e)}finally{k()}}}(t))}}var Ee,Ae,Ue=Object.defineProperty,ze=Object.getOwnPropertySymbols,Me=Object.prototype.hasOwnProperty,Oe=Object.prototype.propertyIsEnumerable,Te=(e,t,n)=>t in e?Ue(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;function Pe(e={}){const{controls:t=!1,interval:r="requestAnimationFrame"}=e,i=l(new Date),s=()=>i.value=new Date,c="requestAnimationFrame"===r?function(e,t={}){const{immediate:n=!0,window:o=Ce}=t,a=l(!1);let r=null;function i(){a.value&&o&&(e(),r=o.requestAnimationFrame(i))}function s(){!a.value&&o&&(a.value=!0,i())}function c(){a.value=!1,null!=r&&o&&(o.cancelAnimationFrame(r),r=null)}return n&&s(),le(c),{isActive:a,pause:c,resume:s}}(s,{immediate:!0}):function(e,t=1e3,r={}){const{immediate:i=!0,immediateCallback:s=!1}=r;let c=null;const u=l(!1);function m(){c&&(clearInterval(c),c=null)}function d(){u.value=!1,m()}function p(){o(t)<=0||(u.value=!0,s&&e(),m(),c=setInterval(e,o(t)))}i&&ae&&p(),a(t)&&le(n(t,(()=>{i&&ae&&p()})));return le(d),{isActive:u,pause:d,resume:p}}(s,r,{immediate:!0});return t?((e,t)=>{for(var n in t||(t={}))Me.call(t,n)&&Te(e,n,t[n]);if(ze)for(var n of ze(t))Oe.call(t,n)&&Te(e,n,t[n]);return e})({now:i},c):i}(Ae=Ee||(Ee={})).UP="UP",Ae.RIGHT="RIGHT",Ae.DOWN="DOWN",Ae.LEFT="LEFT",Ae.NONE="NONE";let Ne=0;const He=e=>{try{e=decodeURI(e)}catch(e){}return e},Ve=(e="")=>e.replace(/\/$/u,""),_e=e=>/^(https?:)?\/\//.test(e),Fe=e=>{const t=Ve(e);return _e(t)?t:`https://${t}`},Be=e=>Array.isArray(e)?e:!!e&&[0,e],De=(e,t)=>"function"==typeof e?e:!1!==e&&t,We="{--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}",Ge=(e,t)=>{let n=e.toString();for(;n.length<t;)n="0"+n;return n},qe=(e,t,n)=>{if(!e)return"";const l="string"==typeof e?new Date(-1!==e.indexOf(" ")?e.replace(/-/g,"/"):e):e,o=t.getTime()-l.getTime(),a=Math.floor(o/864e5);if(0===a){const e=o%864e5,t=Math.floor(e/36e5);if(0===t){const t=e%36e5,l=Math.floor(t/6e4);if(0===l){const e=t%6e4;return`${Math.round(e/1e3)} ${n.seconds}`}return`${l} ${n.minutes}`}return`${t} ${n.hours}`}return a<0?n.now:a<8?`${a} ${n.days}`:(e=>{const t=Ge(e.getDate(),2),n=Ge(e.getMonth()+1,2);return`${Ge(e.getFullYear(),2)}-${n}-${t}`})(l)},Je=e=>{const t=Re("WALINE_EMOJI",{}),n=Boolean(/@[0-9]+\.[0-9]+\.[0-9]+/.test(e));if(n){const n=t.value[e];if(n)return Promise.resolve(n)}return fetch(`${e}/info.json`).then((e=>e.json())).then((l=>{const o={folder:e,...l};return n&&(t.value[e]=o),o}))},Ke=(e,t="",n="",l="")=>`${t?`${t}/`:""}${n}${e}${l?`.${l}`:""}`,Ye=e=>{"AbortError"!==e.name&&console.error(e.message)},Ze={"Content-Type":"application/json"},Xe=(e,t="")=>{if("object"==typeof e&&e.errno)throw new TypeError(`Fetch ${t} failed with ${e.errno}: ${e.errmsg}`);return e},Qe=({serverURL:e,lang:t,token:n,objectId:l,...o})=>fetch(`${e}/comment/${l}?lang=${t}`,{method:"PUT",headers:{"Content-Type":"application/json",Authorization:`Bearer ${n}`},body:JSON.stringify(o)}).then((e=>e.json())),et=({serverURL:e,lang:t,paths:n,signal:l})=>fetch(`${e}/article?path=${encodeURIComponent(n.join(","))}&lang=${t}`,{signal:l}).then((e=>e.json())).then((e=>Xe(e,"visit count"))).then((e=>Array.isArray(e)?e:[e])),tt=({serverURL:e,lang:t,path:n})=>fetch(`${e}/article?lang=${t}`,{method:"POST",headers:Ze,body:JSON.stringify({path:n})}).then((e=>e.json())).then((e=>Xe(e,"visit count"))),nt=e=>e instanceof HTMLElement?e:"string"==typeof e?document.querySelector(e):null,lt=e=>e.type.includes("image"),ot=e=>{const t=Array.from(e).find(lt);return t?t.getAsFile():null},at=/\$.*?\$/,rt=/^\$(.*?)\$/,it=/^(?:\s{0,3})\$\$((?:[^\n]|\n[^\n])+?)\n{0,1}\$\$/,st=(e="",t={})=>e.replace(/:(.+?):/g,((e,n)=>t[n]?`<img class="wl-emoji" src="${t[n]}" alt="${n}">`:e)),ct=(e,{emojiMap:t,highlighter:n,texRenderer:l})=>{if(N.setOptions({highlight:n||void 0,breaks:!0,smartLists:!0,smartypants:!0}),l){const e=(e=>[{name:"blockMath",level:"block",tokenizer(t){const n=it.exec(t);if(null!==n)return{type:"html",raw:n[0],text:e(!0,n[1])}}},{name:"inlineMath",level:"inline",start(e){const t=e.search(at);return-1!==t?t:e.length},tokenizer(t){const n=rt.exec(t);if(null!==n)return{type:"html",raw:n[0],text:e(!1,n[1])}}}])(l);N.use({extensions:e})}return N.parse(st(e,t))},ut=e=>e.dataset.path||e.getAttribute("id");let mt=null;const dt=()=>mt||(mt=Re("USER_KEY",{}));let pt=null;const vt=()=>pt||(pt=Re("WALINE_LIKE",[])),gt=({serverURL:e,path:t=window.location.pathname,selector:n=".waline-comment-count",lang:l="zh-CN"})=>{const o=new AbortController,a=document.querySelectorAll(n),r=dt();return a.length&&(({serverURL:e,lang:t,paths:n,signal:l,token:o})=>{const a={};return o&&(a.Authorization=`Bearer ${o}`),fetch(`${e}/comment?type=count&url=${encodeURIComponent(n.join(","))}&lang=${t}`,{signal:l,headers:a}).then((e=>e.json())).then((e=>Xe(e,"comment count"))).then((e=>Array.isArray(e)?e:[e]))})({serverURL:Fe(e),paths:Array.from(a).map((e=>He(e.dataset.path||e.getAttribute("id")||t))),lang:l,signal:o.signal,token:r.value?.token}).then((e=>{a.forEach(((t,n)=>{t.innerText=e[n].toString()}))})).catch(Ye),o.abort.bind(o)},ht=({size:e})=>c("svg",{width:e,height:e,viewBox:"0 0 100 100",preserveAspectRatio:"xMidYMid"},c("circle",{cx:50,cy:50,fill:"none",stroke:"currentColor",strokeWidth:"4",r:"40","stroke-dasharray":"85 30"},c("animateTransform",{attributeName:"transform",type:"rotate",repeatCount:"indefinite",dur:"1s",values:"0 50 50;360 50 50",keyTimes:"0;1"})));var ft=(e,t)=>{const n=e.__vccOpts||e;for(const[e,l]of t)n[e]=l;return n};const wt=u({name:"ImageWall",components:{LoadingIcon:ht},props:{items:{type:Array,default:()=>[]},columnWidth:{type:Number,default:300},gap:{type:Number,default:0}},emit:["insert"],setup(e){let t=null;const o=l(null),a=l({}),r=l([]),i=()=>{const t=Math.floor((o.value.getBoundingClientRect().width+e.gap)/(e.columnWidth+e.gap));return t>0?t:1},s=async t=>{if(t>=e.items.length)return;await C();const n=Array.from(o.value?.children||[]).reduce(((e,t)=>t.getBoundingClientRect().height<e.getBoundingClientRect().height?t:e));r.value[Number(n.dataset.index)].push(t),await s(t+1)},c=async(e=!1)=>{if(r.value.length===i()&&!e)return;var t;r.value=(t=i(),new Array(t).fill(null).map((()=>[])));const n=window.scrollY;await s(0),window.scrollTo({top:n})};return n((()=>[e.items]),(()=>{a.value={},c(!0)})),n((()=>[e.columnWidth,e.gap]),(()=>c())),m((()=>{c(!0),t=new ResizeObserver((()=>c())),t.observe(o.value)})),d((()=>t.unobserve(o.value))),{columns:r,state:a,wall:o}}}),yt=["data-index"],bt=["src","title","onLoad","onClick"];const kt=u({name:"CommentBox",components:{CloseIcon:({size:e})=>c("svg",{class:"wl-close-icon",viewBox:"0 0 1024 1024",width:e,height:e},[c("path",{d:"M697.173 85.333h-369.92c-144.64 0-241.92 101.547-241.92 252.587v348.587c0 150.613 97.28 252.16 241.92 252.16h369.92c144.64 0 241.494-101.547 241.494-252.16V337.92c0-151.04-96.854-252.587-241.494-252.587z",fill:"currentColor"}),c("path",{d:"m640.683 587.52-75.947-75.861 75.904-75.862a37.29 37.29 0 0 0 0-52.778 37.205 37.205 0 0 0-52.779 0l-75.946 75.818-75.862-75.946a37.419 37.419 0 0 0-52.821 0 37.419 37.419 0 0 0 0 52.821l75.947 75.947-75.776 75.733a37.29 37.29 0 1 0 52.778 52.821l75.776-75.776 75.947 75.947a37.376 37.376 0 0 0 52.779-52.821z",fill:"#888"})]),EmojiIcon:()=>c("svg",{viewBox:"0 0 1024 1024",width:"24",height:"24"},c("path",{d:"M563.2 463.3 677 540c1.7 1.2 3.7 1.8 5.8 1.8.7 0 1.4-.1 2-.2 2.7-.5 5.1-2.1 6.6-4.4l25.3-37.8c1.5-2.3 2.1-5.1 1.6-7.8s-2.1-5.1-4.4-6.6l-73.6-49.1 73.6-49.1c2.3-1.5 3.9-3.9 4.4-6.6.5-2.7 0-5.5-1.6-7.8l-25.3-37.8a10.1 10.1 0 0 0-6.6-4.4c-.7-.1-1.3-.2-2-.2-2.1 0-4.1.6-5.8 1.8l-113.8 76.6c-9.2 6.2-14.7 16.4-14.7 27.5.1 11 5.5 21.3 14.7 27.4zM387 348.8h-45.5c-5.7 0-10.4 4.7-10.4 10.4v153.3c0 5.7 4.7 10.4 10.4 10.4H387c5.7 0 10.4-4.7 10.4-10.4V359.2c0-5.7-4.7-10.4-10.4-10.4zm333.8 241.3-41-20a10.3 10.3 0 0 0-8.1-.5c-2.6.9-4.8 2.9-5.9 5.4-30.1 64.9-93.1 109.1-164.4 115.2-5.7.5-9.9 5.5-9.5 11.2l3.9 45.5c.5 5.3 5 9.5 10.3 9.5h.9c94.8-8 178.5-66.5 218.6-152.7 2.4-5 .3-11.2-4.8-13.6zm186-186.1c-11.9-42-30.5-81.4-55.2-117.1-24.1-34.9-53.5-65.6-87.5-91.2-33.9-25.6-71.5-45.5-111.6-59.2-41.2-14-84.1-21.1-127.8-21.1h-1.2c-75.4 0-148.8 21.4-212.5 61.7-63.7 40.3-114.3 97.6-146.5 165.8-32.2 68.1-44.3 143.6-35.1 218.4 9.3 74.8 39.4 145 87.3 203.3.1.2.3.3.4.5l36.2 38.4c1.1 1.2 2.5 2.1 3.9 2.6 73.3 66.7 168.2 103.5 267.5 103.5 73.3 0 145.2-20.3 207.7-58.7 37.3-22.9 70.3-51.5 98.1-85 27.1-32.7 48.7-69.5 64.2-109.1 15.5-39.7 24.4-81.3 26.6-123.8 2.4-43.6-2.5-87-14.5-129zm-60.5 181.1c-8.3 37-22.8 72-43 104-19.7 31.1-44.3 58.6-73.1 81.7-28.8 23.1-61 41-95.7 53.4-35.6 12.7-72.9 19.1-110.9 19.1-82.6 0-161.7-30.6-222.8-86.2l-34.1-35.8c-23.9-29.3-42.4-62.2-55.1-97.7-12.4-34.7-18.8-71-19.2-107.9-.4-36.9 5.4-73.3 17.1-108.2 12-35.8 30-69.2 53.4-99.1 31.7-40.4 71.1-72 117.2-94.1 44.5-21.3 94-32.6 143.4-32.6 49.3 0 97 10.8 141.8 32 34.3 16.3 65.3 38.1 92 64.8 26.1 26 47.5 56 63.6 89.2 16.2 33.2 26.6 68.5 31 105.1 4.6 37.5 2.7 75.3-5.6 112.3z",fill:"currentColor"})),ImageIcon:()=>c("svg",{viewBox:"0 0 1024 1024",width:"24",height:"24"},[c("path",{d:"M784 112H240c-88 0-160 72-160 160v480c0 88 72 160 160 160h544c88 0 160-72 160-160V272c0-88-72-160-160-160zm96 640c0 52.8-43.2 96-96 96H240c-52.8 0-96-43.2-96-96V272c0-52.8 43.2-96 96-96h544c52.8 0 96 43.2 96 96v480z",fill:"currentColor"}),c("path",{d:"M352 480c52.8 0 96-43.2 96-96s-43.2-96-96-96-96 43.2-96 96 43.2 96 96 96zm0-128c17.6 0 32 14.4 32 32s-14.4 32-32 32-32-14.4-32-32 14.4-32 32-32zm462.4 379.2-3.2-3.2-177.6-177.6c-25.6-25.6-65.6-25.6-91.2 0l-80 80-36.8-36.8c-25.6-25.6-65.6-25.6-91.2 0L200 728c-4.8 6.4-8 14.4-8 24 0 17.6 14.4 32 32 32 9.6 0 16-3.2 22.4-9.6L380.8 640l134.4 134.4c6.4 6.4 14.4 9.6 24 9.6 17.6 0 32-14.4 32-32 0-9.6-4.8-17.6-9.6-24l-52.8-52.8 80-80L769.6 776c6.4 4.8 12.8 8 20.8 8 17.6 0 32-14.4 32-32 0-8-3.2-16-8-20.8z",fill:"currentColor"})]),ImageWall:ft(wt,[["render",function(e,t,n,l,o,a){const r=p("LoadingIcon");return v(),g("div",{ref:"wall",class:"wl-gallery",style:h({gap:`${e.gap}px`})},[(v(!0),g(f,null,w(e.columns,((t,n)=>(v(),g("div",{key:n,class:"wl-gallery-column","data-index":n,style:h({gap:`${e.gap}px`})},[(v(!0),g(f,null,w(t,(t=>(v(),g(f,{key:t},[e.state[e.items[t].src]?b("v-if",!0):(v(),y(r,{key:0,size:36,style:{margin:"20px auto"}})),k("img",{class:"wl-gallery-item",src:e.items[t].src,title:e.items[t].title,loading:"lazy",onLoad:n=>e.state[e.items[t].src]=!0,onClick:n=>e.$emit("insert",`![](${e.items[t].src})`)},null,40,bt)],64)))),128))],12,yt)))),128))],4)}],["__file","ImageWall.vue"]]),MarkdownIcon:()=>c("svg",{width:"16",height:"16",ariaHidden:"true"},c("path",{d:"M14.85 3H1.15C.52 3 0 3.52 0 4.15v7.69C0 12.48.52 13 1.15 13h13.69c.64 0 1.15-.52 1.15-1.15v-7.7C16 3.52 15.48 3 14.85 3zM9 11H7V8L5.5 9.92 4 8v3H2V5h2l1.5 2L7 5h2v6zm2.99.5L9.5 8H11V5h2v3h1.5l-2.51 3.5z",fill:"currentColor"})),PreviewIcon:()=>c("svg",{viewBox:"0 0 1024 1024",width:"24",height:"24"},[c("path",{d:"M710.816 654.301c70.323-96.639 61.084-230.578-23.705-314.843-46.098-46.098-107.183-71.109-172.28-71.109-65.008 0-126.092 25.444-172.28 71.109-45.227 46.098-70.756 107.183-70.756 172.106 0 64.923 25.444 126.007 71.194 172.106 46.099 46.098 107.184 71.109 172.28 71.109 51.414 0 100.648-16.212 142.824-47.404l126.53 126.006c7.058 7.06 16.297 10.979 26.406 10.979 10.105 0 19.343-3.919 26.402-10.979 14.467-14.467 14.467-38.172 0-52.723L710.816 654.301zm-315.107-23.265c-65.88-65.88-65.88-172.54 0-238.42 32.069-32.07 74.245-49.149 119.471-49.149 45.227 0 87.407 17.603 119.472 49.149 65.88 65.879 65.88 172.539 0 238.42-63.612 63.178-175.242 63.178-238.943 0zm0 0",fill:"currentColor"}),c("path",{d:"M703.319 121.603H321.03c-109.8 0-199.469 89.146-199.469 199.38v382.034c0 109.796 89.236 199.38 199.469 199.38h207.397c20.653 0 37.384-16.645 37.384-37.299 0-20.649-16.731-37.296-37.384-37.296H321.03c-68.582 0-124.352-55.77-124.352-124.267V321.421c0-68.496 55.77-124.267 124.352-124.267h382.289c68.582 0 124.352 55.771 124.352 124.267V524.72c0 20.654 16.736 37.299 37.385 37.299 20.654 0 37.384-16.645 37.384-37.299V320.549c-.085-109.8-89.321-198.946-199.121-198.946zm0 0",fill:"currentColor"})]),LoadingIcon:ht,GifIcon:()=>c("svg",{width:24,height:24,fill:"currentcolor",viewBox:"0 0 24 24"},[c("path",{style:"transform: translateY(0.5px)",d:"M18.968 10.5H15.968V11.484H17.984V12.984H15.968V15H14.468V9H18.968V10.5V10.5ZM8.984 9C9.26533 9 9.49967 9.09367 9.687 9.281C9.87433 9.46833 9.968 9.70267 9.968 9.984V10.5H6.499V13.5H8.468V12H9.968V14.016C9.968 14.2973 9.87433 14.5317 9.687 14.719C9.49967 14.9063 9.26533 15 8.984 15H5.984C5.70267 15 5.46833 14.9063 5.281 14.719C5.09367 14.5317 5 14.2973 5 14.016V9.985C5 9.70367 5.09367 9.46933 5.281 9.282C5.46833 9.09467 5.70267 9.001 5.984 9.001H8.984V9ZM11.468 9H12.968V15H11.468V9V9Z"}),c("path",{d:"M18.5 3H5.75C3.6875 3 2 4.6875 2 6.75V18C2 20.0625 3.6875 21.75 5.75 21.75H18.5C20.5625 21.75 22.25 20.0625 22.25 18V6.75C22.25 4.6875 20.5625 3 18.5 3ZM20.75 18C20.75 19.2375 19.7375 20.25 18.5 20.25H5.75C4.5125 20.25 3.5 19.2375 3.5 18V6.75C3.5 5.5125 4.5125 4.5 5.75 4.5H18.5C19.7375 4.5 20.75 5.5125 20.75 6.75V18Z"})])},props:{rootId:{type:String,default:""},replyId:{type:String,default:""},replyUser:{type:String,default:""}},emits:["submit","cancel-reply"],setup(e,{emit:t}){const o=$("config"),a=Re("WALINE_COMMENT_BOX_EDITOR",""),r=Re("WALINE_USER_META",{nick:"",mail:"",link:""}),i=dt(),c=l({}),u=l(null),d=l(null),p=l(null),v=l(null),g=l(null),h=l(null),f=l(null),w=l({tabs:[],map:{}}),y=l(0),b=l(!1),k=l(!1),C=l(!1),S=l(""),j=l(0),x=I({loading:!0,list:[]}),R=l(0),E=l(!1),A=l(""),U=l(!1),z=s((()=>o.value.locale)),M=s((()=>Boolean(i.value?.token))),O=s((()=>!1!==o.value.imageUploader)),T=e=>{const t=u.value,n=t.selectionStart,l=t.selectionEnd||0,o=t.scrollTop;a.value=t.value.substring(0,n)+e+t.value.substring(l,t.value.length),t.focus(),t.selectionStart=n+e.length,t.selectionEnd=n+e.length,t.scrollTop=o},N=e=>{const t=`![${o.value.locale.uploading} ${e.name}]()`;return T(t),Promise.resolve().then((()=>o.value.imageUploader(e))).then((n=>{a.value=a.value.replace(t,`\r\n![${e.name}](${n})`)}))},H=()=>{const{serverURL:n,lang:l,login:s,wordLimit:m,requiredMeta:d}=o.value,p={comment:A.value,nick:r.value.nick,mail:r.value.mail,link:r.value.link,ua:navigator.userAgent,url:o.value.path};if(i.value?.token)p.nick=i.value.display_name,p.mail=i.value.email,p.link=i.value.url;else{if("force"===s)return;if(d.indexOf("nick")>-1&&!p.nick)return c.value.nick?.focus(),alert(z.value.nickError);if(d.indexOf("mail")>-1&&!p.mail||p.mail&&!/^\w(?:[\w._-]*\w)?@(?:\w(?:[\w-]*\w)?\.)*\w+$/.exec(p.mail))return c.value.mail?.focus(),alert(z.value.mailError);if(!p.comment)return void u.value?.focus();p.nick||(p.nick=z.value.anonymous)}if(!E.value)return alert(z.value.wordHint.replace("$0",m[0].toString()).replace("$1",m[1].toString()).replace("$2",j.value.toString()));p.comment=st(p.comment,w.value.map),e.replyId&&e.rootId&&(p.pid=e.replyId,p.rid=e.rootId,p.at=e.replyUser),U.value=!0,(({serverURL:e,lang:t,token:n,comment:l})=>{const o={"Content-Type":"application/json"};return n&&(o.Authorization=`Bearer ${n}`),fetch(`${e}/comment?lang=${t}`,{method:"POST",headers:o,body:JSON.stringify(l)}).then((e=>e.json()))})({serverURL:n,lang:l,token:i.value?.token,comment:p}).then((n=>{if(U.value=!1,n.errmsg)return alert(n.errmsg);t("submit",n.data),a.value="",S.value="",e.replyId&&t("cancel-reply")})).catch((e=>{U.value=!1,alert(e.message)}))},V=e=>{p.value.contains(e.target)||v.value.contains(e.target)||(b.value=!1),g.value.contains(e.target)||h.value.contains(e.target)||(k.value=!1)},_=async e=>{const{scrollTop:t,clientHeight:n,scrollHeight:l}=e.target,a=(n+t)/l,r=o.value.search,i=f.value?.value||"";a<.9||x.loading||(x.loading=!0,x.list.push(...r.more?await r.more(i,x.list.length):await r.search(i)),x.loading=!1,setTimeout((()=>{e.target.scrollTop=t}),50))},F=ce((e=>{x.list=[],_(e)}),300);return n([o,j],(([e,t])=>{const{wordLimit:n}=e;n?t<n[0]&&0!==n[0]?(R.value=n[0],E.value=!1):t>n[1]?(R.value=n[1],E.value=!1):(R.value=n[1],E.value=!0):(R.value=0,E.value=!0)}),{immediate:!0}),n(k,(async e=>{if(!e)return;const t=o.value.search;f.value&&(f.value.value=""),x.loading=!0,x.list=t.default?await t.default():await t.search(""),x.loading=!1})),m((()=>{document.body.addEventListener("click",V),n((()=>a.value),(e=>{const{highlighter:t,texRenderer:n}=o.value;A.value=e,S.value=ct(e,{emojiMap:w.value.map,highlighter:t,texRenderer:n}),j.value=(e=>(e=>e.match(/[\w\d\s\u00C0-\u024F]+/giu)||[])(e).reduce(((e,t)=>e+(""===t.trim()?0:t.trim().split(/\s+/u).length)),0)+(e=>e.match(/[\u4E00-\u9FA5]/gu)||[])(e).length)(e),e?P(u.value):P.destroy(u.value)}),{immediate:!0}),n((()=>o.value.emoji),(e=>{return(t=Array.isArray(e)?e:[],Promise.all(t.map((e=>"string"==typeof e?Je(Ve(e)):Promise.resolve(e)))).then((e=>{const t={tabs:[],map:{}};return e.forEach((e=>{const{name:n,folder:l,icon:o,prefix:a,type:r,items:i}=e;t.tabs.push({name:n,icon:Ke(o,l,a,r),items:i.map((e=>{const n=`${a||""}${e}`;return t.map[n]=Ke(e,l,a,r),n}))})})),t}))).then((e=>{w.value=e}));var t}),{immediate:!0})})),L((()=>{document.body.removeEventListener("click",V)})),{config:o,locale:z,insert:T,onChange:()=>{const e=d.value;e.files&&O.value&&N(e.files[0]).then((()=>{e.value=""}))},onDrop:e=>{if(e.dataTransfer?.items){const t=ot(e.dataTransfer.items);t&&O.value&&(N(t),e.preventDefault())}},onKeyDown:e=>{const t=e.key;(e.ctrlKey||e.metaKey)&&"Enter"===t&&H()},onPaste:e=>{if(e.clipboardData){const t=ot(e.clipboardData.items);t&&O.value&&N(t)}},onLogin:e=>{e.preventDefault();const{lang:t,serverURL:n}=o.value,l=(window.innerWidth-450)/2,a=(window.innerHeight-450)/2,r=window.open(`${n}/ui/login?lng=${encodeURIComponent(t)}`,"_blank",`width=450,height=450,left=${l},top=${a},scrollbars=no,resizable=no,status=no,location=no,toolbar=no,menubar=no`);r?.postMessage({type:"TOKEN",data:null},"*");const s=({data:e})=>{e&&"userInfo"===e.type&&e.data.token&&(r?.close(),i.value=e.data,(e.data.remember?localStorage:sessionStorage).setItem("WALINE_USER",JSON.stringify(e.data)),window.removeEventListener("message",s))};window.addEventListener("message",s)},onLogout:()=>{i.value={},localStorage.setItem("WALINE_USER","null"),sessionStorage.setItem("WALINE_USER","null")},onProfile:e=>{e.preventDefault();const{lang:t,serverURL:n}=o.value,l=(window.innerWidth-800)/2,a=(window.innerHeight-800)/2;window.open(`${n}/ui/profile?lng=${encodeURIComponent(t)}`,"_blank",`width=800,height=800,left=${l},top=${a},scrollbars=no,resizable=no,status=no,location=no,toolbar=no,menubar=no`)?.postMessage({type:"TOKEN",data:i.value.token},"*");const r=({data:e})=>{e&&"profile"===e.type&&(i.value={...i.value,...e},[localStorage,sessionStorage].filter((e=>e.getItem("WALINE_USER"))).forEach((e=>e.setItem("WALINE_USER",JSON.stringify(i)))),window.removeEventListener("message",r))};window.addEventListener("message",r)},submitComment:H,onImageWallScroll:_,onGifSearch:F,isLogin:M,userInfo:i,isSubmitting:U,wordNumber:j,wordLimit:R,isWordNumberLegal:E,editor:a,userMeta:r,emoji:w,emojiTabIndex:y,showEmoji:b,gifData:x,showGif:k,canUploadImage:O,previewText:S,showPreview:C,inputRefs:c,editorRef:u,emojiButtonRef:p,emojiPopupRef:v,gifButtonRef:g,gifPopupRef:h,imageUploadRef:d,gifSearchInputRef:f}}}),Ct={class:"wl-comment"},$t={key:0,class:"wl-login-info"},It={class:"wl-avatar"},Lt=["title"],St=["src"],jt=["textContent"],xt={class:"wl-panel"},Rt=["for","textContent"],Et=["id","name","type","onUpdate:modelValue"],At=["placeholder"],Ut={class:"wl-preview"},zt=k("hr",null,null,-1),Mt=["innerHTML"],Ot={class:"wl-footer"},Tt={class:"wl-actions"},Pt={href:"https://guides.github.com/features/mastering-markdown/",title:"Markdown Guide","aria-label":"Markdown is supported",class:"wl-action",target:"_blank",rel:"noreferrer"},Nt=["title"],Ht=["title"],Vt=["title"],_t=["title"],Ft={class:"wl-info"},Bt={class:"wl-text-number"},Dt={key:0},Wt=z(" / "),Gt=["textContent"],qt=["textContent"],Jt=["disabled"],Kt=["placeholder"],Yt={key:0,class:"wl-loading"},Zt={key:0,class:"wl-tab-wrapper"},Xt=["title","onClick"],Qt=["src","alt"],en={key:0,class:"wl-tabs"},tn=["onClick"],nn=["src","alt","title"],ln=["title"];var on=ft(kt,[["render",function(e,t,n,l,o,a){const r=p("CloseIcon"),i=p("MarkdownIcon"),s=p("EmojiIcon"),c=p("GifIcon"),u=p("ImageIcon"),m=p("PreviewIcon"),d=p("LoadingIcon"),h=p("ImageWall");return v(),g("div",Ct,["disable"!==e.config.login&&e.isLogin?(v(),g("div",$t,[k("div",It,[k("button",{class:"wl-logout-btn",title:e.locale.logout,onClick:t[0]||(t[0]=(...t)=>e.onLogout&&e.onLogout(...t))},[S(r,{size:14})],8,Lt),k("img",{src:e.userInfo.avatar,alt:"avatar"},null,8,St)]),k("a",{href:"#",class:"wl-login-nick","aria-label":"Profile",onClick:t[1]||(t[1]=(...t)=>e.onProfile&&e.onProfile(...t)),textContent:j(e.userInfo.display_name)},null,8,jt)])):b("v-if",!0),k("div",xt,["force"!==e.config.login&&e.config.meta.length&&!e.isLogin?(v(),g("div",{key:0,class:x(["wl-header",`item${e.config.meta.length}`])},[(v(!0),g(f,null,w(e.config.meta,(t=>(v(),g("div",{class:"wl-header-item",key:t},[k("label",{for:t,textContent:j(e.locale[t]+(e.config.requiredMeta.includes(t)||!e.config.requiredMeta.length?"":`(${e.locale.optional})`))},null,8,Rt),R(k("input",{ref_for:!0,ref:n=>{n&&(e.inputRefs[t]=n)},id:`wl-${t}`,class:x(["wl-input",`wl-${t}`]),name:t,type:"mail"===t?"email":"text","onUpdate:modelValue":n=>e.userMeta[t]=n},null,10,Et),[[E,e.userMeta[t]]])])))),128))],2)):b("v-if",!0),R(k("textarea",{class:"wl-editor",ref:"editorRef",id:"wl-edit",placeholder:e.replyUser?`@${e.replyUser}`:e.locale.placeholder,"onUpdate:modelValue":t[2]||(t[2]=t=>e.editor=t),onKeydown:t[3]||(t[3]=(...t)=>e.onKeyDown&&e.onKeyDown(...t)),onDrop:t[4]||(t[4]=(...t)=>e.onDrop&&e.onDrop(...t)),onPaste:t[5]||(t[5]=(...t)=>e.onPaste&&e.onPaste(...t))},null,40,At),[[A,e.editor]]),R(k("div",Ut,[zt,k("h4",null,j(e.locale.preview)+":",1),k("div",{class:"wl-content",innerHTML:e.previewText},null,8,Mt)],512),[[U,e.showPreview]]),k("div",Ot,[k("div",Tt,[k("a",Pt,[S(i)]),R(k("button",{ref:"emojiButtonRef",class:x(["wl-action",{actived:e.showEmoji}]),title:e.locale.emoji,onClick:t[6]||(t[6]=t=>e.showEmoji=!e.showEmoji)},[S(s)],10,Nt),[[U,e.emoji.tabs.length]]),e.config.search?(v(),g("button",{key:0,ref:"gifButtonRef",class:x(["wl-action",{actived:e.showGif}]),title:e.locale.gif,onClick:t[7]||(t[7]=t=>e.showGif=!e.showGif)},[S(c)],10,Ht)):b("v-if",!0),k("input",{ref:"imageUploadRef",class:"upload",id:"wl-image-upload",type:"file",accept:".png,.jpg,.jpeg,.webp,.bmp,.gif",onChange:t[8]||(t[8]=(...t)=>e.onChange&&e.onChange(...t))},null,544),e.canUploadImage?(v(),g("label",{key:1,for:"wl-image-upload",class:"wl-action",title:e.locale.uploadImage},[S(u)],8,Vt)):b("v-if",!0),k("button",{class:x(["wl-action",{actived:e.showPreview}]),title:e.locale.preview,onClick:t[9]||(t[9]=t=>e.showPreview=!e.showPreview)},[S(m)],10,_t)]),k("div",Ft,[k("div",Bt,[z(j(e.wordNumber)+" ",1),e.config.wordLimit?(v(),g("span",Dt,[Wt,k("span",{class:x({illegal:!e.isWordNumberLegal}),textContent:j(e.wordLimit)},null,10,Gt)])):b("v-if",!0),z(" "+j(e.locale.word),1)]),"disable"===e.config.login||e.isLogin?b("v-if",!0):(v(),g("button",{key:0,class:"wl-btn",onClick:t[10]||(t[10]=(...t)=>e.onLogin&&e.onLogin(...t)),textContent:j(e.locale.login)},null,8,qt)),"force"!==e.config.login||e.isLogin?(v(),g("button",{key:1,class:"wl-btn primary",title:"Cmd|Ctrl + Enter",disabled:e.isSubmitting,onClick:t[11]||(t[11]=(...t)=>e.submitComment&&e.submitComment(...t))},[e.isSubmitting?(v(),y(d,{key:0,size:16})):(v(),g(f,{key:1},[z(j(e.locale.submit),1)],64))],8,Jt)):b("v-if",!0)]),k("div",{ref:"gifPopupRef",class:x(["wl-gif-popup",{display:e.showGif}])},[k("input",{type:"text",placeholder:e.locale.gifSearchPlaceholder,ref:"gifSearchInputRef",onInput:t[12]||(t[12]=(...t)=>e.onGifSearch&&e.onGifSearch(...t))},null,40,Kt),S(h,{items:e.gifData.list,"column-width":200,gap:6,onInsert:t[13]||(t[13]=t=>e.insert(t)),onScroll:e.onImageWallScroll},null,8,["items","onScroll"]),e.gifData.loading?(v(),g("div",Yt,[S(d,{size:30})])):b("v-if",!0)],2),k("div",{ref:"emojiPopupRef",class:x(["wl-emoji-popup",{display:e.showEmoji}])},[(v(!0),g(f,null,w(e.emoji.tabs,((t,n)=>(v(),g(f,{key:t.name},[n===e.emojiTabIndex?(v(),g("div",Zt,[(v(!0),g(f,null,w(t.items,(t=>(v(),g("button",{key:t,title:t,onClick:n=>e.insert(`:${t}:`)},[e.showEmoji?(v(),g("img",{key:0,class:"wl-emoji",src:e.emoji.map[t],alt:t,loading:"lazy",referrerPolicy:"no-referrer"},null,8,Qt)):b("v-if",!0)],8,Xt)))),128))])):b("v-if",!0)],64)))),128)),e.emoji.tabs.length>1?(v(),g("div",en,[(v(!0),g(f,null,w(e.emoji.tabs,((t,n)=>(v(),g("button",{key:t.name,class:x(["wl-tab",{active:e.emojiTabIndex===n}]),onClick:t=>e.emojiTabIndex=n},[k("img",{class:"wl-emoji",src:t.icon,alt:t.name,title:t.name,loading:"lazy",referrerPolicy:"no-referrer"},null,8,nn)],10,tn)))),128))])):b("v-if",!0)],2)])]),e.replyId?(v(),g("button",{key:1,class:"wl-close",title:e.locale.cancelReply,onClick:t[14]||(t[14]=t=>e.$emit("cancel-reply"))},[S(r,{size:24})],8,ln)):b("v-if",!0)])}],["__file","CommentBox.vue"]]);const an=["approved","waiting","spam"],rn=u({props:{comment:{type:Object,required:!0},rootId:{type:String,required:!0},reply:{type:Object}},components:{CommentBox:on,DeleteIcon:()=>c("svg",{viewBox:"0 0 1024 1024",width:"24",height:"24"},c("path",{d:"m341.013 394.667 27.755 393.45h271.83l27.733-393.45h64.106l-28.01 397.952a64 64 0 0 1-63.83 59.498H368.768a64 64 0 0 1-63.83-59.52l-28.053-397.93h64.128zm139.307 19.818v298.667h-64V414.485h64zm117.013 0v298.667h-64V414.485h64zM181.333 288h640v64h-640v-64zm453.483-106.667v64h-256v-64h256z",fill:"red"})),LikeIcon:({active:e=!1})=>c("svg",{viewBox:"0 0 1024 1024",width:"24",height:"24"},[c("path",{d:"M850.654 323.804c-11.042-25.625-26.862-48.532-46.885-68.225-20.022-19.61-43.258-34.936-69.213-45.73-26.78-11.124-55.124-16.727-84.375-16.727-40.622 0-80.256 11.123-114.698 32.135A214.79 214.79 0 0 0 512 241.819a214.79 214.79 0 0 0-23.483-16.562c-34.442-21.012-74.076-32.135-114.698-32.135-29.25 0-57.595 5.603-84.375 16.727-25.872 10.711-49.19 26.12-69.213 45.73-20.105 19.693-35.843 42.6-46.885 68.225-11.453 26.615-17.303 54.877-17.303 83.963 0 27.439 5.603 56.03 16.727 85.117 9.31 24.307 22.659 49.52 39.715 74.981 27.027 40.293 64.188 82.316 110.33 124.915 76.465 70.615 152.189 119.394 155.402 121.371l19.528 12.525c8.652 5.52 19.776 5.52 28.427 0l19.529-12.525c3.213-2.06 78.854-50.756 155.401-121.371 46.143-42.6 83.304-84.622 110.33-124.915 17.057-25.46 30.487-50.674 39.716-74.981 11.124-29.087 16.727-57.678 16.727-85.117.082-29.086-5.768-57.348-17.221-83.963z"+(e?"":"M512 761.5S218.665 573.55 218.665 407.767c0-83.963 69.461-152.023 155.154-152.023 60.233 0 112.473 33.618 138.181 82.727 25.708-49.109 77.948-82.727 138.18-82.727 85.694 0 155.155 68.06 155.155 152.023C805.335 573.551 512 761.5 512 761.5z"),fill:e?"red":"currentColor"})]),ReplyIcon:()=>c("svg",{viewBox:"0 0 1024 1024",width:"24",height:"24"},c("path",{d:"M810.667 213.333a64 64 0 0 1 64 64V704a64 64 0 0 1-64 64H478.336l-146.645 96.107a21.333 21.333 0 0 1-33.024-17.856V768h-85.334a64 64 0 0 1-64-64V277.333a64 64 0 0 1 64-64h597.334zm0 64H213.333V704h149.334v63.296L459.243 704h351.424V277.333zm-271.36 213.334v64h-176.64v-64h176.64zm122.026-128v64H362.667v-64h298.666z",fill:"currentColor"})),VerifiedIcon:()=>c("svg",{class:"verified-icon",viewBox:"0 0 1024 1024",width:"14",height:"14"},c("path",{d:"m894.4 461.56-54.4-63.2c-10.4-12-18.8-34.4-18.8-50.4v-68c0-42.4-34.8-77.2-77.2-77.2h-68c-15.6 0-38.4-8.4-50.4-18.8l-63.2-54.4c-27.6-23.6-72.8-23.6-100.8 0l-62.8 54.8c-12 10-34.8 18.4-50.4 18.4h-69.2c-42.4 0-77.2 34.8-77.2 77.2v68.4c0 15.6-8.4 38-18.4 50l-54 63.6c-23.2 27.6-23.2 72.4 0 100l54 63.6c10 12 18.4 34.4 18.4 50v68.4c0 42.4 34.8 77.2 77.2 77.2h69.2c15.6 0 38.4 8.4 50.4 18.8l63.2 54.4c27.6 23.6 72.8 23.6 100.8 0l63.2-54.4c12-10.4 34.4-18.8 50.4-18.8h68c42.4 0 77.2-34.8 77.2-77.2v-68c0-15.6 8.4-38.4 18.8-50.4l54.4-63.2c23.2-27.6 23.2-73.2-.4-100.8zm-216-25.2-193.2 193.2a30 30 0 0 1-42.4 0l-96.8-96.8a30.16 30.16 0 0 1 0-42.4c11.6-11.6 30.8-11.6 42.4 0l75.6 75.6 172-172c11.6-11.6 30.8-11.6 42.4 0 11.6 11.6 11.6 30.8 0 42.4z",fill:"#27ae60"}))},emits:["submit","reply","like","delete","status","sticky"],setup(e){const t=$("config"),n=vt(),l=dt(),o=s((()=>t.value.locale)),a=s((()=>{let{link:t}=e.comment;return t?_e(t)?t:`https://${t}`:""})),r=s((()=>n.value.includes(e.comment.objectId))),i=((e,t)=>{const n=Pe();return s((()=>qe(e,n.value,t)))})(e.comment.insertedAt,o.value),c=s((()=>"administrator"===l.value.type)),u=s((()=>e.comment.user_id&&l.value.objectId===e.comment.user_id)),m=s((()=>e.comment.objectId===e.reply?.objectId));return{config:t,locale:o,isReplyingCurrent:m,link:a,like:r,time:i,isAdmin:c,isOwner:u,commentStatus:an}}}),sn=["id"],cn={class:"wl-user","aria-hidden":"true"},un=["src"],mn={class:"wl-card"},dn={class:"wl-head"},pn=["href"],vn={key:1,class:"wl-nick"},gn=["textContent"],hn=["textContent"],fn=["textContent"],wn=["textContent"],yn=["textContent"],bn={class:"wl-comment-actions"},kn=["title"],Cn=["textContent"],$n=["title"],In={class:"wl-meta","aria-hidden":"true"},Ln=["textContent"],Sn=["textContent"],jn=["textContent"],xn=["innerHTML"],Rn={key:0,class:"wl-admin-actions"},En={class:"wl-comment-status"},An=["disabled","onClick","textContent"],Un={key:1,class:"wl-reply-wrapper"},zn={key:2,class:"wl-quote"};const Mn=u({name:"WalineRoot",components:{CommentBox:on,CommentCard:ft(rn,[["render",function(e,t,n,l,o,a){const r=p("VerifiedIcon"),i=p("DeleteIcon"),s=p("LikeIcon"),c=p("ReplyIcon"),u=p("CommentBox"),m=p("CommentCard",!0);return v(),g("div",{class:"wl-item",id:e.comment.objectId},[k("div",cn,[e.comment.avatar?(v(),g("img",{key:0,src:e.comment.avatar},null,8,un)):b("v-if",!0),e.comment.type?(v(),y(r,{key:1})):b("v-if",!0)]),k("div",mn,[k("div",dn,[e.link?(v(),g("a",{key:0,class:"wl-nick",href:e.link,target:"_blank",rel:"nofollow noreferrer"},j(e.comment.nick),9,pn)):(v(),g("span",vn,j(e.comment.nick),1)),"administrator"===e.comment.type?(v(),g("span",{key:2,class:"wl-badge",textContent:j(e.locale.admin)},null,8,gn)):b("v-if",!0),e.comment.label?(v(),g("span",{key:3,class:"wl-badge",textContent:j(e.comment.label)},null,8,hn)):b("v-if",!0),e.comment.sticky?(v(),g("span",{key:4,class:"wl-badge",textContent:j(e.locale.sticky)},null,8,fn)):b("v-if",!0),void 0!==e.comment.level&&e.comment.level>=0?(v(),g("span",{key:5,class:x(`wl-badge level${e.comment.level}`),textContent:j(e.locale[`level${e.comment.level}`]||`Level ${e.comment.level}`)},null,10,wn)):b("v-if",!0),k("span",{class:"wl-time",textContent:j(e.time)},null,8,yn),k("div",bn,[e.isAdmin||e.isOwner?(v(),g("button",{key:0,class:"wl-delete",onClick:t[0]||(t[0]=t=>e.$emit("delete",e.comment))},[S(i)])):b("v-if",!0),k("button",{class:"wl-like",onClick:t[1]||(t[1]=t=>e.$emit("like",e.comment)),title:e.like?e.locale.cancelLike:e.locale.like},[S(s,{active:e.like},null,8,["active"]),"like"in e.comment?(v(),g("span",{key:0,textContent:j(e.comment.like)},null,8,Cn)):b("v-if",!0)],8,kn),k("button",{class:x(["wl-reply",{active:e.isReplyingCurrent}]),title:e.isReplyingCurrent?e.locale.cancelReply:e.locale.reply,onClick:t[2]||(t[2]=t=>e.$emit("reply",e.isReplyingCurrent?null:e.comment))},[S(c)],10,$n)])]),k("div",In,[e.comment.addr?(v(),g("span",{key:0,textContent:j(e.comment.addr)},null,8,Ln)):b("v-if",!0),e.comment.browser?(v(),g("span",{key:1,textContent:j(e.comment.browser)},null,8,Sn)):b("v-if",!0),e.comment.os?(v(),g("span",{key:2,textContent:j(e.comment.os)},null,8,jn)):b("v-if",!0)]),k("div",{class:"wl-content",innerHTML:e.comment.comment},null,8,xn),e.isAdmin?(v(),g("div",Rn,[k("span",En,[(v(!0),g(f,null,w(e.commentStatus,(t=>(v(),g("button",{key:t,class:x(`wl-btn wl-${t}`),disabled:e.comment.status===t,onClick:n=>e.$emit("status",{status:t,comment:e.comment}),textContent:j(t)},null,10,An)))),128))]),e.isAdmin&&!e.comment.rid?(v(),g("button",{key:0,class:"wl-btn wl-sticky",onClick:t[3]||(t[3]=t=>e.$emit("sticky",e.comment))},j(e.comment.sticky?"unsticky":"sticky"),1)):b("v-if",!0)])):b("v-if",!0),e.isReplyingCurrent?(v(),g("div",Un,[S(u,{replyId:e.comment.objectId,replyUser:e.comment.nick,rootId:e.rootId,onSubmit:t[4]||(t[4]=t=>e.$emit("submit",t)),onCancelReply:t[5]||(t[5]=t=>e.$emit("reply",null))},null,8,["replyId","replyUser","rootId"])])):b("v-if",!0),e.comment.children?(v(),g("div",zn,[(v(!0),g(f,null,w(e.comment.children,(n=>(v(),y(m,{key:n.objectId,comment:n,reply:e.reply,rootId:e.rootId,onReply:t[6]||(t[6]=t=>e.$emit("reply",t)),onSubmit:t[7]||(t[7]=t=>e.$emit("submit",t)),onLike:t[8]||(t[8]=t=>e.$emit("like",t)),onDelete:t[9]||(t[9]=t=>e.$emit("delete",t)),onStatus:t[10]||(t[10]=t=>e.$emit("status",t)),onSticky:t[11]||(t[11]=t=>e.$emit("sticky",t))},null,8,["comment","reply","rootId"])))),128))])):b("v-if",!0)])],8,sn)}],["__file","CommentCard.vue"]]),LoadingIcon:ht},props:["serverURL","path","meta","requiredMeta","dark","lang","locale","pageSize","wordLimit","emoji","login","highlighter","texRenderer","imageUploader","copyright"],setup(e){const t=s((()=>(({serverURL:e,path:t=location.pathname,lang:n="zh-CN",locale:l,emoji:o=["//unpkg.com/@waline/emojis@1.0.1/weibo"],meta:a=["nick","mail","link"],requiredMeta:r=[],dark:i=!1,pageSize:s=10,wordLimit:c,imageUploader:u,highlighter:m,texRenderer:d,copyright:p=!0,login:v="enable",search:g=B(),...h})=>({serverURL:Fe(e),path:He(t),locale:{...ne[n]||ne["zh-CN"],..."object"==typeof l?l:{}},wordLimit:Be(c),meta:V(a),requiredMeta:V(r),imageUploader:De(u,_),highlighter:De(m,q),texRenderer:De(d,F),lang:n,dark:i,emoji:o,pageSize:s,login:v,copyright:p,search:g,...h}))(e))),o=dt(),a=vt(),i=l("loading"),c=l(0),u=l(1),d=l(0),p=l([]),v=l(null),g=s((()=>{return"string"==typeof(e=t.value.dark)?"auto"===e?`@media(prefers-color-scheme:dark){body${We}}`:`${e}${We}`:!0===e?`:root${We}`:"";var e}));let h;!function(e,t={}){const o=l(!1),{document:a=$e,immediate:i=!0,manual:s=!1,id:c="vueuse_styletag_"+ ++Ne}=t,u=l(e);let m=()=>{};const d=()=>{if(!a)return;const e=a.getElementById(c)||a.createElement("style");e.type="text/css",e.id=c,t.media&&(e.media=t.media),a.head.appendChild(e),o.value||(m=n(u,(t=>{e.innerText=t}),{immediate:!0}),o.value=!0)},p=()=>{a&&o.value&&(m(),a.head.removeChild(a.getElementById(c)),o.value=!1)};i&&!s&&d(),s||le(p),r(o)}(g);const f=e=>{const{serverURL:n,path:l,pageSize:a}=t.value,r=new AbortController;i.value="loading",h?.(),(({serverURL:e,lang:t,path:n,page:l,pageSize:o,signal:a,token:r})=>{const i={};return r&&(i.Authorization=`Bearer ${r}`),fetch(`${e}/comment?path=${encodeURIComponent(n)}&pageSize=${o}&page=${l}&lang=${t}`,{signal:a,headers:i}).then((e=>e.json())).then((e=>Xe(e,"comment list")))})({serverURL:n,lang:t.value.lang,path:l,pageSize:a,page:e,signal:r.signal,token:o.value?.token}).then((t=>{i.value="success",c.value=t.count,p.value.push(...t.data),u.value=e,d.value=t.totalPages})).catch((e=>{"AbortError"!==e.name&&(console.error(e.message),i.value="error")})),h=r.abort.bind(r)},w=()=>{c.value=0,p.value=[],f(1)};return M("config",t),n((()=>e.path),w),m((()=>w())),{config:t,darkmodeStyle:g,i18n:s((()=>t.value.locale)),status:i,count:c,page:u,totalPages:d,data:p,reply:v,loadMore:()=>f(u.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:n})=>{if(e.status===n)return;const{serverURL:l,lang:a}=t.value;await Qe({serverURL:l,lang:a,token:o.value?.token,objectId:e.objectId,status:n}),e.status=n},onDelete:async({objectId:e})=>{if(!confirm("Are you sure you want to delete this comment?"))return;const{serverURL:n,lang:l}=t.value;await(({serverURL:e,lang:t,token:n,objectId:l})=>fetch(`${e}/comment/${l}?lang=${t}`,{method:"DELETE",headers:{Authorization:`Bearer ${n}`}}).then((e=>e.json())))({serverURL:n,lang:l,token:o.value?.token,objectId:e}),p.value.some(((t,n)=>t.objectId===e?(p.value=p.value.filter(((e,t)=>t!==n)),!0):t.children.some(((l,o)=>l.objectId===e&&(p.value[n].children=t.children.filter(((e,t)=>t!==o)),!0)))))},onSticky:async e=>{if(e.rid)return;const{serverURL:n,lang:l}=t.value;await Qe({serverURL:n,lang:l,token:o.value?.token,objectId:e.objectId,sticky:e.sticky?0:1}),e.sticky=!e.sticky},onLike:async e=>{const{serverURL:n,lang:l}=t.value,{objectId:o}=e,r=a.value.includes(o);await(({serverURL:e,lang:t,objectId:n,like:l})=>fetch(`${e}/comment/${n}?lang=${t}`,{method:"PUT",headers:Ze,body:JSON.stringify({like:l})}).then((e=>e.json())))({serverURL:n,lang:l,objectId:o,like:!r}),r?a.value=a.value.filter((e=>e!==o)):(a.value=[...a.value,o],a.value.length>50&&(a.value=a.value.slice(-50))),e.like=(e.like||0)+(r?-1:1)},version:"2.6.1"}}}),On={"data-waline":""},Tn={class:"wl-count"},Pn=["textContent"],Nn={class:"wl-cards"},Hn={key:1,class:"wl-operation"},Vn=["textContent"],_n={key:0,class:"wl-loading"},Fn=["textContent"],Bn={class:"wl-operation"},Dn=["textContent"],Wn={key:3,class:"wl-power"},Gn=z(" Powered by "),qn=k("a",{href:"https://github.com/walinejs/waline",target:"_blank",rel:"noreferrer"}," Waline ",-1);var Jn=ft(Mn,[["render",function(e,t,n,l,o,a){const r=p("CommentBox"),i=p("CommentCard"),s=p("LoadingIcon");return v(),g("div",On,[e.reply?b("v-if",!0):(v(),y(r,{key:0,onSubmit:e.onSubmit},null,8,["onSubmit"])),k("div",Tn,[e.count?(v(),g("span",{key:0,class:"wl-num",textContent:j(e.count)},null,8,Pn)):b("v-if",!0),z(" "+j(e.i18n.comment),1)]),k("div",Nn,[(v(!0),g(f,null,w(e.data,(t=>(v(),y(i,{key:t.objectId,"root-id":t.objectId,comment:t,reply:e.reply,onReply:e.onReply,onSubmit:e.onSubmit,onStatus:e.onStatusChange,onDelete:e.onDelete,onSticky:e.onSticky,onLike:e.onLike},null,8,["root-id","comment","reply","onReply","onSubmit","onStatus","onDelete","onSticky","onLike"])))),128))]),"error"===e.status?(v(),g("div",Hn,[k("button",{type:"button",class:"wl-btn",onClick:t[0]||(t[0]=(...t)=>e.refresh&&e.refresh(...t)),textContent:j(e.i18n.refresh)},null,8,Vn)])):(v(),g(f,{key:2},["loading"===e.status?(v(),g("div",_n,[S(s,{size:30})])):e.data.length?e.page<e.totalPages?(v(),g(f,{key:2},[b(" Load more button "),k("div",Bn,[k("button",{type:"button",class:"wl-btn",onClick:t[1]||(t[1]=(...t)=>e.loadMore&&e.loadMore(...t)),textContent:j(e.i18n.more)},null,8,Dn)])],2112)):b("v-if",!0):(v(),g("div",{key:1,class:"wl-empty",textContent:j(e.i18n.sofa)},null,8,Fn))],64)),b(" Copyright Information "),e.config.copyright?(v(),g("div",Wn,[Gn,qn,z(" v"+j(e.version),1)])):b("v-if",!0)])}],["__file","Waline.vue"]]);const Kn=(e,t)=>{t.forEach(((t,n)=>{t.innerText=e[n].toString()}))},Yn=({serverURL:e,path:t=window.location.pathname,selector:n=".waline-pageview-count",update:l=!0,lang:o="zh-CN"})=>{const a=new AbortController,r=Array.from(document.querySelectorAll(n)),i=e=>{const n=ut(e);return null!==n&&t!==n},s=n=>et({serverURL:Fe(e),paths:n.map((e=>ut(e)||t)),lang:o,signal:a.signal}).then((e=>Kn(e,n))).catch(Ye);if(l){const n=r.filter((e=>!i(e))),l=r.filter(i);tt({serverURL:Fe(e),path:t,lang:o}).then((e=>Kn(new Array(n.length).fill(e),n))),l.length&&s(l)}else s(r);return a.abort.bind(a)},Zn=({el:e="#waline",path:t=window.location.pathname,comment:n=!1,pageview:l=!1,...o})=>{const a=e?nt(e):null;if(e&&!a)throw new Error("Option 'el' do not match any domElement!");if(!o.serverURL)throw new Error("Option 'serverURL' is missing!");const r=I({...o}),i=I({comment:n,pageview:l,path:t}),s=a?O((()=>c(Jn,{path:i.path,...r}))):null;s&&s.mount(a);const u=T((()=>{i.comment&>({serverURL:r.serverURL,path:i.path,selector:"string"==typeof i.comment?i.comment:void 0})})),m=T((()=>{i.pageview&&Yn({serverURL:r.serverURL,path:i.path,selector:"string"==typeof i.pageview?i.pageview:void 0})}));return{el:a,update:({comment:e,pageview:t,path:n=window.location.pathname,...l}={})=>{Object.entries(l).forEach((([e,t])=>{r[e]=t})),i.path=n,void 0!==e&&(i.comment=e),void 0!==t&&(i.pageview=t)},destroy:()=>{s?.unmount(),u(),m()}}},Xn="2.6.1",Qn=({el:e,serverURL:t,count:n,lang:l="zh-CN"})=>{const o=dt(),a=nt(e),r=new AbortController;return(({serverURL:e,lang:t,count:n,signal:l,token:o})=>{const a={};return o&&(a.Authorization=`Bearer ${o}`),fetch(`${e}/comment?type=recent&count=${n}&lang=${t}`,{signal:l,headers:a}).then((e=>e.json())).then((e=>Xe(e,"recent comment")))})({serverURL:t,count:n,lang:l,signal:r.signal,token:o.value?.token}).then((e=>a&&e.length?(a.innerHTML=`<ul class="wl-recent-list">${e.map((e=>`<li class="wl-recent-item"><a href="${e.url}">${e.nick}</a>:${e.comment}</li>`)).join("")}</ul>`,{comments:e,destroy:()=>{r.abort(),a.innerHTML=""}}):{comments:e,destroy:()=>r.abort()}))};export{Qn as RecentComments,gt as commentCount,ne as defaultLocales,Zn as init,Yn as pageviewCount,Xn as version}; | ||
//# sourceMappingURL=shim.esm.js.map |
@@ -1,2 +0,2 @@ | ||
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("vue"),t=require("autosize"),n=require("marked");function o(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var l=o(t);const r=["nick","mail","link"],a=e=>e.filter((e=>r.includes(e))),i=e=>new Promise(((t,n)=>{const o=new FileReader;o.readAsDataURL(e),o.onload=()=>t(o.result?.toString()||""),o.onerror=n})),c=e=>!0===e?'<p class="wl-tex">Tex is not available in preview</p>':'<span class="wl-tex">Tex is not available in preview</span>',s=()=>{const e={next:""},t=({keyword:e,pos:t})=>{const n=new URLSearchParams("media_filter=minimal");return n.set("key","PAY5JLFIH6V6"),n.set("limit","20"),n.set("pos",t||""),n.set("q",e),fetch(`https://g.tenor.com/v1/search?${n.toString()}`,{headers:{"Content-Type":"application/json"}}).then((e=>e.json())).catch((()=>({next:t||"",results:[]})))};return{search:(n="")=>t({keyword:n}).then((t=>(e.next=t.next,t.results.map((e=>({title:e.title,src:e.media[0].tinygif.url})))))),more:n=>t({keyword:n,pos:e.next}).then((t=>(e.next=t.next,t.results.map((e=>({title:e.title,src:e.media[0].tinygif.url}))))))}},m=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"),u=["23AC69","91C132","F19726","E8552D","1AAB8E","E1147F","2980C1","1BA1E6","9FA0A0","F19726","E30B20","E30B20","A3338B"],d={},p=e=>{let t=0;return e.replace(m,((e,n,o)=>{if(o)return`<span style="color: slategray">${o}</span>`;if("<"===n)return"<";let l;d[n]?l=d[n]:(l=u[t],d[n]=l);const r=`<span style="color: #${l}">${n}</span>`;return t=++t%u.length,r}))},v=["nick","nickError","mail","mailError","link","optional","placeholder","sofa","submit","like","cancelLike","reply","cancelReply","comment","refresh","more","preview","emoji","uploadImage","seconds","minutes","hours","days","now","uploading","login","logout","admin","sticky","word","wordHint","anonymous","level0","level1","level2","level3","level4","level5","gif","gifSearchPlaceholder"],g=e=>Object.fromEntries(e.map(((e,t)=>[v[t],e])));var h=g(["NickName","NickName cannot be less than 3 bytes.","E-Mail","Please confirm your email address.","Website","Optional","Comment here...","No comment yet.","Submit","Like","Cancel like","Reply","Cancel reply","Comments","Refresh","Load More...","Preview","Emoji","Upload Image","seconds ago","minutes ago","hours ago","days ago","just now","Uploading","Login","logout","Admin","Sticky","Words","Please input comments between $0 and $1 words!\n Current word number: $2","Anonymous","Dwarves","Hobbits","Ents","Wizards","Elves","Maiar","GIF","Search GIF"]),f=g(["ニックネーム","3バイト以上のニックネームをご入力ください.","メールアドレス","メールアドレスをご確認ください.","サイト","オプション","ここにコメント","コメントしましょう~","提出する","Like","Cancel like","返信する","キャンセル","コメント","更新","さらに読み込む","プレビュー","絵文字","画像をアップロード","秒前","分前","時間前","日前","たっだ今","アップロード","ログインする","ログアウト","管理者","トップに置く","ワード","コメントは $0 から $1 ワードの間でなければなりません!\n 現在の単語番号: $2","匿名","うえにん","なかにん","しもおし","特にしもおし","かげ","なぬし","GIF","探す GIF"]),w=g(["昵称","昵称不能少于3个字符","邮箱","请填写正确的邮件地址","网址","可选","欢迎评论","来发评论吧~","提交","喜欢","取消喜欢","回复","取消回复","评论","刷新","加载更多...","预览","表情","上传图片","秒前","分钟前","小时前","天前","刚刚","正在上传","登录","退出","博主","置顶","字","评论字数应在 $0 到 $1 字之间!\n当前字数:$2","匿名","潜水","冒泡","吐槽","活跃","话痨","传说","表情包","搜索表情包"]),y=g(["暱稱","郵箱","網址","可選","暱稱不能少於3個字元","請填寫正確的郵件地址","歡迎評論","來發評論吧~","提交","喜歡","取消喜歡","回覆","取消回覆","評論","刷新","載入更多...","預覽","表情","上傳圖片","秒前","分鐘前","小時前","天前","剛剛","正在上傳","登錄","退出","博主","置頂","字","評論字數應在 $0 到 $1 字之間!\n當前字數:$2","匿名","潛水","冒泡","吐槽","活躍","話癆","傳說","表情包","搜索表情包"]),k=g(["Apelido","Apelido não pode ser menor que 3 bytes.","E-Mail","Por favor, confirme seu endereço de e-mail.","Website","Opcional","Comente aqui...","Nenhum comentário, ainda.","Enviar","Like","Cancel like","Responder","Cancelar resposta","Comentários","Refrescar","Carregar Mais...","Visualizar","Emoji","Enviar Imagem","segundos atrás","minutos atrás","horas atrás","dias atrás","agora mesmo","Enviando","Entrar","Sair","Admin","Sticky","Palavras","Favor enviar comentário com $0 a $1 palavras!\n Número de palavras atuais: $2","Anônimo","Dwarves","Hobbits","Ents","Wizards","Elves","Maiar","GIF","Pesquisar GIF"]),b=g(["Псевдоним","Никнейм не может быть меньше 3 байт.","Эл. адрес","Пожалуйста, подтвердите адрес вашей электронной почты.","Веб-сайт","Необязательный","Комментарий здесь...","Пока нет комментариев.","Отправить","Like","Cancel like","Отвечать","Отменить ответ","Комментарии","Обновить","Загрузи больше...","Превью","эмодзи","Загрузить изображение","секунд назад","несколько минут назад","несколько часов назад","дней назад","прямо сейчас","Загрузка","Авторизоваться","Выход из системы","Админ","Липкий","Слова","Пожалуйста, введите комментарии от $0 до $1 слов!\nНомер текущего слова: $2","Анонимный","Dwarves","Hobbits","Ents","Wizards","Elves","Maiar","GIF","Поиск GIF"]);const C={zh:w,"zh-cn":w,"zh-CN":w,"zh-tw":y,"zh-TW":y,en:h,"en-US":h,"en-us":h,jp:f,"jp-jp":f,"jp-JP":f,"pt-br":k,"pt-BR":k,ru:b,"ru-ru":b,"ru-RU":b};function E(t){return!!e.getCurrentScope()&&(e.onScopeDispose(t),!0)}var B;const N="undefined"!=typeof window,$=()=>{};function S(e,t){return function(...n){e((()=>t.apply(this,n)),{fn:t,thisArg:this,args:n})}}N&&(null==(B=null==window?void 0:window.navigator)?void 0:B.userAgent)&&/iP(ad|hone|od)/.test(window.navigator.userAgent);const V=e=>e();function I(t,n=200,o={}){return S(function(t,n={}){let o,l;return r=>{const a=e.unref(t),i=e.unref(n.maxWait);if(o&&clearTimeout(o),a<=0||void 0!==i&&i<=0)return l&&(clearTimeout(l),l=null),r();i&&!l&&(l=setTimeout((()=>{o&&clearTimeout(o),l=null,r()}),i)),o=setTimeout((()=>{l&&clearTimeout(l),l=null,r()}),a)}}(n,o),t)}var L=Object.getOwnPropertySymbols,x=Object.prototype.hasOwnProperty,j=Object.prototype.propertyIsEnumerable;function R(t,n,o={}){const l=o,{eventFilter:r=V}=l,a=((e,t)=>{var n={};for(var o in e)x.call(e,o)&&t.indexOf(o)<0&&(n[o]=e[o]);if(null!=e&&L)for(var o of L(e))t.indexOf(o)<0&&j.call(e,o)&&(n[o]=e[o]);return n})(l,["eventFilter"]);return e.watch(t,S(r,n),a)}var z=Object.defineProperty,A=Object.defineProperties,U=Object.getOwnPropertyDescriptors,M=Object.getOwnPropertySymbols,D=Object.prototype.hasOwnProperty,T=Object.prototype.propertyIsEnumerable,O=(e,t,n)=>t in e?z(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;function P(t,n,o={}){const l=o,{eventFilter:r}=l,a=((e,t)=>{var n={};for(var o in e)D.call(e,o)&&t.indexOf(o)<0&&(n[o]=e[o]);if(null!=e&&M)for(var o of M(e))t.indexOf(o)<0&&T.call(e,o)&&(n[o]=e[o]);return n})(l,["eventFilter"]),{eventFilter:i,pause:c,resume:s,isActive:m}=function(t=V){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=R(t,n,(d=((e,t)=>{for(var n in t||(t={}))D.call(t,n)&&O(e,n,t[n]);if(M)for(var n of M(t))T.call(t,n)&&O(e,n,t[n]);return e})({},a),A(d,U({eventFilter:i}))));var d;return{stop:u,pause:c,resume:s,isActive:m}}const F=N?window:void 0,H=N?window.document:void 0;function _(...t){let n,o,l,r;if("string"==typeof t[0]?([o,l,r]=t,n=F):[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 E(c),c}N&&window.navigator,N&&window.location;const W="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},q="__vueuse_ssr_handlers__";W[q]=W[q]||{};const G=W[q];const J={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 K(t,n,o,l={}){var r;const{flush:a="pre",deep:i=!0,listenToStorageChanges:c=!0,writeDefaults:s=!0,shallow:m,window:u=F,eventFilter:d,onError:p=(e=>{console.error(e)})}=l,v=(m?e.shallowRef:e.ref)(n);if(!o)try{o=function(e,t){return G[e]||t}("getDefaultStorage",(()=>{var e;return null==(e=F)?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:J[h],{pause:w,resume:y}=P(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&&_(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 Y,Z,X=Object.defineProperty,Q=Object.getOwnPropertySymbols,ee=Object.prototype.hasOwnProperty,te=Object.prototype.propertyIsEnumerable,ne=(e,t,n)=>t in e?X(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;function oe(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=F}=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(),E(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(){e.unref(n)<=0||(i.value=!0,r&&t(),c(),a=setInterval(t,e.unref(n)))}l&&N&&m(),e.isRef(n)&&E(e.watch(n,(()=>{l&&N&&m()})));return E(s),{isActive:i,pause:s,resume:m}}(r,o,{immediate:!0});return n?((e,t)=>{for(var n in t||(t={}))ee.call(t,n)&&ne(e,n,t[n]);if(Q)for(var n of Q(t))te.call(t,n)&&ne(e,n,t[n]);return e})({now:l},a):l}(Z=Y||(Y={})).UP="UP",Z.RIGHT="RIGHT",Z.DOWN="DOWN",Z.LEFT="LEFT",Z.NONE="NONE";let le=0;const re=e=>{try{e=decodeURI(e)}catch(e){}return e},ae=(e="")=>e.replace(/\/$/u,""),ie=e=>/^(https?:)?\/\//.test(e),ce=e=>{const t=ae(e);return ie(t)?t:`https://${t}`},se=e=>Array.isArray(e)?e:!!e&&[0,e],me=(e,t)=>"function"==typeof e?e:!1!==e&&t,ue="{--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}",de=(e,t)=>{let n=e.toString();for(;n.length<t;)n="0"+n;return n},pe=(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=de(e.getDate(),2),n=de(e.getMonth()+1,2);return`${de(e.getFullYear(),2)}-${n}-${t}`})(o)},ve=e=>{const t=K("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}))},ge=(e,t="",n="",o="")=>`${t?`${t}/`:""}${n}${e}${o?`.${o}`:""}`,he=e=>{"AbortError"!==e.name&&console.error(e.message)},fe={"Content-Type":"application/json"},we=(e,t="")=>{if("object"==typeof e&&e.errno)throw new TypeError(`Fetch ${t} failed with ${e.errno}: ${e.errmsg}`);return e},ye=({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())),ke=({serverURL:e,lang:t,paths:n,signal:o})=>fetch(`${e}/article?path=${encodeURIComponent(n.join(","))}&lang=${t}`,{signal:o}).then((e=>e.json())).then((e=>we(e,"visit count"))).then((e=>Array.isArray(e)?e:[e])),be=({serverURL:e,lang:t,path:n})=>fetch(`${e}/article?lang=${t}`,{method:"POST",headers:fe,body:JSON.stringify({path:n})}).then((e=>e.json())).then((e=>we(e,"visit count"))),Ce=e=>e instanceof HTMLElement?e:"string"==typeof e?document.querySelector(e):null,Ee=e=>e.type.includes("image"),Be=e=>{const t=Array.from(e).find(Ee);return t?t.getAsFile():null},Ne=/\$.*?\$/,$e=/^\$(.*?)\$/,Se=/^(?:\s{0,3})\$\$((?:[^\n]|\n[^\n])+?)\n{0,1}\$\$/,Ve=(e="",t={})=>e.replace(/:(.+?):/g,((e,n)=>t[n]?`<img class="wl-emoji" src="${t[n]}" alt="${n}">`:e)),Ie=(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=Se.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(Ne);return-1!==t?t:e.length},tokenizer(t){const n=$e.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(Ve(e,t))},Le=e=>e.dataset.path||e.getAttribute("id");let xe=null;const je=()=>xe||(xe=K("USER_KEY",{}));let Re=null;const ze=()=>Re||(Re=K("WALINE_LIKE",[])),Ae=({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=je();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=>we(e,"comment count"))).then((e=>Array.isArray(e)?e:[e]))})({serverURL:ce(e),paths:Array.from(r).map((e=>re(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(he),l.abort.bind(l)},Ue=({size:t})=>e.h("svg",{width:t,height:t,viewBox:"0 0 100 100",preserveAspectRatio:"xMidYMid"},e.h("circle",{cx:50,cy:50,fill:"none",stroke:"currentColor",strokeWidth:"4",r:"40","stroke-dasharray":"85 30"},e.h("animateTransform",{attributeName:"transform",type:"rotate",repeatCount:"indefinite",dur:"1s",values:"0 50 50;360 50 50",keyTimes:"0;1"})));var Me=(e,t)=>{const n=e.__vccOpts||e;for(const[e,o]of t)n[e]=o;return n};const De=e.defineComponent({name:"ImageWall",components:{LoadingIcon:Ue},props:{items:{type:Array,default:()=>[]},columnWidth:{type:Number,default:300},gap:{type:Number,default:0}},emit:["insert"],setup(t){let n=null;const o=e.ref(null),l=e.ref({}),r=e.ref([]),a=()=>{const e=Math.floor((o.value.getBoundingClientRect().width+t.gap)/(t.columnWidth+t.gap));return e>0?e:1},i=async n=>{if(n>=t.items.length)return;await e.nextTick();const l=Array.from(o.value?.children||[]).reduce(((e,t)=>t.getBoundingClientRect().height<e.getBoundingClientRect().height?t:e));r.value[Number(l.dataset.index)].push(n),await i(n+1)},c=async(e=!1)=>{if(r.value.length===a()&&!e)return;var t;r.value=(t=a(),new Array(t).fill(null).map((()=>[])));const n=window.scrollY;await i(0),window.scrollTo({top:n})};return e.watch((()=>[t.items]),(()=>{l.value={},c(!0)})),e.watch((()=>[t.columnWidth,t.gap]),(()=>c())),e.onMounted((()=>{c(!0),n=new ResizeObserver((()=>c())),n.observe(o.value)})),e.onBeforeUnmount((()=>n.unobserve(o.value))),{columns:r,state:l,wall:o}}}),Te=["data-index"],Oe=["src","title","onLoad","onClick"];var Pe=Me(De,[["render",function(t,n,o,l,r,a){const i=e.resolveComponent("LoadingIcon");return e.openBlock(),e.createElementBlock("div",{ref:"wall",class:"wl-gallery",style:e.normalizeStyle({gap:`${t.gap}px`})},[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(t.columns,((n,o)=>(e.openBlock(),e.createElementBlock("div",{key:o,class:"wl-gallery-column","data-index":o,style:e.normalizeStyle({gap:`${t.gap}px`})},[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(n,(n=>(e.openBlock(),e.createElementBlock(e.Fragment,{key:n},[t.state[t.items[n].src]?e.createCommentVNode("v-if",!0):(e.openBlock(),e.createBlock(i,{key:0,size:36,style:{margin:"20px auto"}})),e.createElementVNode("img",{class:"wl-gallery-item",src:t.items[n].src,title:t.items[n].title,loading:"lazy",onLoad:e=>t.state[t.items[n].src]=!0,onClick:e=>t.$emit("insert",`![](${t.items[n].src})`)},null,40,Oe)],64)))),128))],12,Te)))),128))],4)}],["__file","ImageWall.vue"]]);const Fe=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"})]),ImageWall:Pe,MarkdownIcon:()=>e.h("svg",{width:"16",height:"16",ariaHidden:"true"},e.h("path",{d:"M14.85 3H1.15C.52 3 0 3.52 0 4.15v7.69C0 12.48.52 13 1.15 13h13.69c.64 0 1.15-.52 1.15-1.15v-7.7C16 3.52 15.48 3 14.85 3zM9 11H7V8L5.5 9.92 4 8v3H2V5h2l1.5 2L7 5h2v6zm2.99.5L9.5 8H11V5h2v3h1.5l-2.51 3.5z",fill:"currentColor"})),PreviewIcon:()=>e.h("svg",{viewBox:"0 0 1024 1024",width:"24",height:"24"},[e.h("path",{d:"M710.816 654.301c70.323-96.639 61.084-230.578-23.705-314.843-46.098-46.098-107.183-71.109-172.28-71.109-65.008 0-126.092 25.444-172.28 71.109-45.227 46.098-70.756 107.183-70.756 172.106 0 64.923 25.444 126.007 71.194 172.106 46.099 46.098 107.184 71.109 172.28 71.109 51.414 0 100.648-16.212 142.824-47.404l126.53 126.006c7.058 7.06 16.297 10.979 26.406 10.979 10.105 0 19.343-3.919 26.402-10.979 14.467-14.467 14.467-38.172 0-52.723L710.816 654.301zm-315.107-23.265c-65.88-65.88-65.88-172.54 0-238.42 32.069-32.07 74.245-49.149 119.471-49.149 45.227 0 87.407 17.603 119.472 49.149 65.88 65.879 65.88 172.539 0 238.42-63.612 63.178-175.242 63.178-238.943 0zm0 0",fill:"currentColor"}),e.h("path",{d:"M703.319 121.603H321.03c-109.8 0-199.469 89.146-199.469 199.38v382.034c0 109.796 89.236 199.38 199.469 199.38h207.397c20.653 0 37.384-16.645 37.384-37.299 0-20.649-16.731-37.296-37.384-37.296H321.03c-68.582 0-124.352-55.77-124.352-124.267V321.421c0-68.496 55.77-124.267 124.352-124.267h382.289c68.582 0 124.352 55.771 124.352 124.267V524.72c0 20.654 16.736 37.299 37.385 37.299 20.654 0 37.384-16.645 37.384-37.299V320.549c-.085-109.8-89.321-198.946-199.121-198.946zm0 0",fill:"currentColor"})]),LoadingIcon:Ue,GifIcon:()=>e.h("svg",{width:24,height:24,fill:"currentcolor",viewBox:"0 0 24 24"},[e.h("path",{style:"transform: translateY(0.5px)",d:"M18.968 10.5H15.968V11.484H17.984V12.984H15.968V15H14.468V9H18.968V10.5V10.5ZM8.984 9C9.26533 9 9.49967 9.09367 9.687 9.281C9.87433 9.46833 9.968 9.70267 9.968 9.984V10.5H6.499V13.5H8.468V12H9.968V14.016C9.968 14.2973 9.87433 14.5317 9.687 14.719C9.49967 14.9063 9.26533 15 8.984 15H5.984C5.70267 15 5.46833 14.9063 5.281 14.719C5.09367 14.5317 5 14.2973 5 14.016V9.985C5 9.70367 5.09367 9.46933 5.281 9.282C5.46833 9.09467 5.70267 9.001 5.984 9.001H8.984V9ZM11.468 9H12.968V15H11.468V9V9Z"}),e.h("path",{d:"M18.5 3H5.75C3.6875 3 2 4.6875 2 6.75V18C2 20.0625 3.6875 21.75 5.75 21.75H18.5C20.5625 21.75 22.25 20.0625 22.25 18V6.75C22.25 4.6875 20.5625 3 18.5 3ZM20.75 18C20.75 19.2375 19.7375 20.25 18.5 20.25H5.75C4.5125 20.25 3.5 19.2375 3.5 18V6.75C3.5 5.5125 4.5125 4.5 5.75 4.5H18.5C19.7375 4.5 20.75 5.5125 20.75 6.75V18Z"})])},props:{rootId:{type:String,default:""},replyId:{type:String,default:""},replyUser:{type:String,default:""}},emits:["submit","cancel-reply"],setup(t,{emit:n}){const o=e.inject("config"),r=K("WALINE_COMMENT_BOX_EDITOR",""),a=K("WALINE_USER_META",{nick:"",mail:"",link:""}),i=je(),c=e.ref({}),s=e.ref(null),m=e.ref(null),u=e.ref(null),d=e.ref(null),p=e.ref(null),v=e.ref(null),g=e.ref(null),h=e.ref({tabs:[],map:{}}),f=e.ref(0),w=e.ref(!1),y=e.ref(!1),k=e.ref(!1),b=e.ref(""),C=e.ref(0),E=e.reactive({loading:!0,list:[]}),B=e.ref(0),N=e.ref(!1),$=e.ref(""),S=e.ref(!1),V=e.computed((()=>o.value.locale)),L=e.computed((()=>Boolean(i.value?.token))),x=e.computed((()=>!1!==o.value.imageUploader)),j=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},R=e=>{const t=`![${o.value.locale.uploading} ${e.name}]()`;return j(t),Promise.resolve().then((()=>o.value.imageUploader(e))).then((n=>{r.value=r.value.replace(t,`\r\n![${e.name}](${n})`)}))},z=()=>{const{serverURL:e,lang:l,login:m,wordLimit:u,requiredMeta:d}=o.value,p={comment:$.value,nick:a.value.nick,mail:a.value.mail,link:a.value.link,ua:navigator.userAgent,url:o.value.path};if(i.value?.token)p.nick=i.value.display_name,p.mail=i.value.email,p.link=i.value.url;else{if("force"===m)return;if(d.indexOf("nick")>-1&&!p.nick)return c.value.nick?.focus(),alert(V.value.nickError);if(d.indexOf("mail")>-1&&!p.mail||p.mail&&!/^\w(?:[\w._-]*\w)?@(?:\w(?:[\w-]*\w)?\.)*\w+$/.exec(p.mail))return c.value.mail?.focus(),alert(V.value.mailError);if(!p.comment)return void s.value?.focus();p.nick||(p.nick=V.value.anonymous)}if(!N.value)return alert(V.value.wordHint.replace("$0",u[0].toString()).replace("$1",u[1].toString()).replace("$2",C.value.toString()));p.comment=Ve(p.comment,h.value.map),t.replyId&&t.rootId&&(p.pid=t.replyId,p.rid=t.rootId,p.at=t.replyUser),S.value=!0,(({serverURL:e,lang:t,token:n,comment:o})=>{const l={"Content-Type":"application/json"};return n&&(l.Authorization=`Bearer ${n}`),fetch(`${e}/comment?lang=${t}`,{method:"POST",headers:l,body:JSON.stringify(o)}).then((e=>e.json()))})({serverURL:e,lang:l,token:i.value?.token,comment:p}).then((e=>{if(S.value=!1,e.errmsg)return alert(e.errmsg);n("submit",e.data),r.value="",b.value="",t.replyId&&n("cancel-reply")})).catch((e=>{S.value=!1,alert(e.message)}))},A=e=>{u.value.contains(e.target)||d.value.contains(e.target)||(w.value=!1),p.value.contains(e.target)||v.value.contains(e.target)||(y.value=!1)},U=async e=>{const{scrollTop:t,clientHeight:n,scrollHeight:l}=e.target,r=(n+t)/l,a=o.value.search,i=g.value?.value||"";r<.9||E.loading||(E.loading=!0,E.list.push(...a.more?await a.more(i,E.list.length):await a.search(i)),E.loading=!1,setTimeout((()=>{e.target.scrollTop=t}),50))},M=I((e=>{E.list=[],U(e)}),300);return e.watch([o,C],(([e,t])=>{const{wordLimit:n}=e;n?t<n[0]&&0!==n[0]?(B.value=n[0],N.value=!1):t>n[1]?(B.value=n[1],N.value=!1):(B.value=n[1],N.value=!0):(B.value=0,N.value=!0)}),{immediate:!0}),e.watch(y,(async e=>{if(!e)return;const t=o.value.search;g.value&&(g.value.value=""),E.loading=!0,E.list=t.default?await t.default():await t.search(""),E.loading=!1})),e.onMounted((()=>{document.body.addEventListener("click",A),e.watch((()=>r.value),(e=>{const{highlighter:t,texRenderer:n}=o.value;$.value=e,b.value=Ie(e,{emojiMap:h.value.map,highlighter:t,texRenderer:n}),C.value=(e=>(e=>e.match(/[\w\d\s\u00C0-\u024F]+/giu)||[])(e).reduce(((e,t)=>e+(""===t.trim()?0:t.trim().split(/\s+/u).length)),0)+(e=>e.match(/[\u4E00-\u9FA5]/gu)||[])(e).length)(e),e?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?ve(ae(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:ge(l,o,r,a),items:i.map((e=>{const n=`${r||""}${e}`;return t.map[n]=ge(e,o,r,a),n}))})})),t}))).then((e=>{h.value=e}));var t}),{immediate:!0})})),e.onUnmounted((()=>{document.body.removeEventListener("click",A)})),{config:o,locale:V,insert:j,onChange:()=>{const e=m.value;e.files&&x.value&&R(e.files[0]).then((()=>{e.value=""}))},onDrop:e=>{if(e.dataTransfer?.items){const t=Be(e.dataTransfer.items);t&&x.value&&(R(t),e.preventDefault())}},onKeyDown:e=>{const t=e.key;(e.ctrlKey||e.metaKey)&&"Enter"===t&&z()},onPaste:e=>{if(e.clipboardData){const t=Be(e.clipboardData.items);t&&x.value&&R(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:z,onImageWallScroll:U,onGifSearch:M,isLogin:L,userInfo:i,isSubmitting:S,wordNumber:C,wordLimit:B,isWordNumberLegal:N,editor:r,userMeta:a,emoji:h,emojiTabIndex:f,showEmoji:w,gifData:E,showGif:y,canUploadImage:x,previewText:b,showPreview:k,inputRefs:c,editorRef:s,emojiButtonRef:u,emojiPopupRef:d,gifButtonRef:p,gifPopupRef:v,imageUploadRef:m,gifSearchInputRef:g}}}),He={class:"wl-comment"},_e={key:0,class:"wl-login-info"},We={class:"wl-avatar"},qe=["title"],Ge=["src"],Je=["textContent"],Ke={class:"wl-panel"},Ye=["for","textContent"],Ze=["id","name","type","onUpdate:modelValue"],Xe=["placeholder"],Qe={class:"wl-preview"},et=e.createElementVNode("hr",null,null,-1),tt=["innerHTML"],nt={class:"wl-footer"},ot={class:"wl-actions"},lt={href:"https://guides.github.com/features/mastering-markdown/",title:"Markdown Guide","aria-label":"Markdown is supported",class:"wl-action",target:"_blank",rel:"noreferrer"},rt=["title"],at=["title"],it=["title"],ct=["title"],st={class:"wl-info"},mt={class:"wl-text-number"},ut={key:0},dt=e.createTextVNode(" / "),pt=["textContent"],vt=["textContent"],gt=["disabled"],ht=["placeholder"],ft={key:0,class:"wl-loading"},wt={key:0,class:"wl-tab-wrapper"},yt=["title","onClick"],kt=["src","alt"],bt={key:0,class:"wl-tabs"},Ct=["onClick"],Et=["src","alt","title"],Bt=["title"];var Nt=Me(Fe,[["render",function(t,n,o,l,r,a){const i=e.resolveComponent("CloseIcon"),c=e.resolveComponent("MarkdownIcon"),s=e.resolveComponent("EmojiIcon"),m=e.resolveComponent("GifIcon"),u=e.resolveComponent("ImageIcon"),d=e.resolveComponent("PreviewIcon"),p=e.resolveComponent("LoadingIcon"),v=e.resolveComponent("ImageWall");return e.openBlock(),e.createElementBlock("div",He,["disable"!==t.config.login&&t.isLogin?(e.openBlock(),e.createElementBlock("div",_e,[e.createElementVNode("div",We,[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,qe),e.createElementVNode("img",{src:t.userInfo.avatar,alt:"avatar"},null,8,Ge)]),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,Je)])):e.createCommentVNode("v-if",!0),e.createElementVNode("div",Ke,["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,Ye),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,Ze),[[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,Xe),[[e.vModelText,t.editor]]),e.withDirectives(e.createElementVNode("div",Qe,[et,e.createElementVNode("h4",null,e.toDisplayString(t.locale.preview)+":",1),e.createElementVNode("div",{class:"wl-content",innerHTML:t.previewText},null,8,tt)],512),[[e.vShow,t.showPreview]]),e.createElementVNode("div",nt,[e.createElementVNode("div",ot,[e.createElementVNode("a",lt,[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,rt),[[e.vShow,t.emoji.tabs.length]]),t.config.search?(e.openBlock(),e.createElementBlock("button",{key:0,ref:"gifButtonRef",class:e.normalizeClass(["wl-action",{actived:t.showGif}]),title:t.locale.gif,onClick:n[7]||(n[7]=e=>t.showGif=!t.showGif)},[e.createVNode(m)],10,at)):e.createCommentVNode("v-if",!0),e.createElementVNode("input",{ref:"imageUploadRef",class:"upload",id:"wl-image-upload",type:"file",accept:".png,.jpg,.jpeg,.webp,.bmp,.gif",onChange:n[8]||(n[8]=(...e)=>t.onChange&&t.onChange(...e))},null,544),t.canUploadImage?(e.openBlock(),e.createElementBlock("label",{key:1,for:"wl-image-upload",class:"wl-action",title:t.locale.uploadImage},[e.createVNode(u)],8,it)):e.createCommentVNode("v-if",!0),e.createElementVNode("button",{class:e.normalizeClass(["wl-action",{actived:t.showPreview}]),title:t.locale.preview,onClick:n[9]||(n[9]=e=>t.showPreview=!t.showPreview)},[e.createVNode(d)],10,ct)]),e.createElementVNode("div",st,[e.createElementVNode("div",mt,[e.createTextVNode(e.toDisplayString(t.wordNumber)+" ",1),t.config.wordLimit?(e.openBlock(),e.createElementBlock("span",ut,[dt,e.createElementVNode("span",{class:e.normalizeClass({illegal:!t.isWordNumberLegal}),textContent:e.toDisplayString(t.wordLimit)},null,10,pt)])):e.createCommentVNode("v-if",!0),e.createTextVNode(" "+e.toDisplayString(t.locale.word),1)]),"disable"===t.config.login||t.isLogin?e.createCommentVNode("v-if",!0):(e.openBlock(),e.createElementBlock("button",{key:0,class:"wl-btn",onClick:n[10]||(n[10]=(...e)=>t.onLogin&&t.onLogin(...e)),textContent:e.toDisplayString(t.locale.login)},null,8,vt)),"force"!==t.config.login||t.isLogin?(e.openBlock(),e.createElementBlock("button",{key:1,class:"wl-btn primary",title:"Cmd|Ctrl + Enter",disabled:t.isSubmitting,onClick:n[11]||(n[11]=(...e)=>t.submitComment&&t.submitComment(...e))},[t.isSubmitting?(e.openBlock(),e.createBlock(p,{key:0,size:16})):(e.openBlock(),e.createElementBlock(e.Fragment,{key:1},[e.createTextVNode(e.toDisplayString(t.locale.submit),1)],64))],8,gt)):e.createCommentVNode("v-if",!0)]),e.createElementVNode("div",{ref:"gifPopupRef",class:e.normalizeClass(["wl-gif-popup",{display:t.showGif}])},[e.createElementVNode("input",{type:"text",placeholder:t.locale.gifSearchPlaceholder,ref:"gifSearchInputRef",onInput:n[12]||(n[12]=(...e)=>t.onGifSearch&&t.onGifSearch(...e))},null,40,ht),e.createVNode(v,{items:t.gifData.list,"column-width":200,gap:6,onInsert:n[13]||(n[13]=e=>t.insert(e)),onScroll:t.onImageWallScroll},null,8,["items","onScroll"]),t.gifData.loading?(e.openBlock(),e.createElementBlock("div",ft,[e.createVNode(p,{size:30})])):e.createCommentVNode("v-if",!0)],2),e.createElementVNode("div",{ref:"emojiPopupRef",class:e.normalizeClass(["wl-emoji-popup",{display:t.showEmoji}])},[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(t.emoji.tabs,((n,o)=>(e.openBlock(),e.createElementBlock(e.Fragment,{key:n.name},[o===t.emojiTabIndex?(e.openBlock(),e.createElementBlock("div",wt,[(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,kt)):e.createCommentVNode("v-if",!0)],8,yt)))),128))])):e.createCommentVNode("v-if",!0)],64)))),128)),t.emoji.tabs.length>1?(e.openBlock(),e.createElementBlock("div",bt,[(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,Et)],10,Ct)))),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[14]||(n[14]=e=>t.$emit("cancel-reply"))},[e.createVNode(i,{size:24})],8,Bt)):e.createCommentVNode("v-if",!0)])}],["__file","CommentBox.vue"]]);const $t=["approved","waiting","spam"],St=e.defineComponent({props:{comment:{type:Object,required:!0},rootId:{type:String,required:!0},reply:{type:Object}},components:{CommentBox:Nt,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=ze(),l=je(),r=e.computed((()=>n.value.locale)),a=e.computed((()=>{let{link:e}=t.comment;return e?ie(e)?e:`https://${e}`:""})),i=e.computed((()=>o.value.includes(t.comment.objectId))),c=((t,n)=>{const o=oe();return e.computed((()=>pe(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:$t}}}),Vt=["id"],It={class:"wl-user","aria-hidden":"true"},Lt=["src"],xt={class:"wl-card"},jt={class:"wl-head"},Rt=["href"],zt={key:1,class:"wl-nick"},At=["textContent"],Ut=["textContent"],Mt=["textContent"],Dt=["textContent"],Tt=["textContent"],Ot={class:"wl-comment-actions"},Pt=["title"],Ft=["textContent"],Ht=["title"],_t={class:"wl-meta","aria-hidden":"true"},Wt=["textContent"],qt=["textContent"],Gt=["textContent"],Jt=["innerHTML"],Kt={key:0,class:"wl-admin-actions"},Yt={class:"wl-comment-status"},Zt=["disabled","onClick","textContent"],Xt={key:1,class:"wl-reply-wrapper"},Qt={key:2,class:"wl-quote"};var en=Me(St,[["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",It,[t.comment.avatar?(e.openBlock(),e.createElementBlock("img",{key:0,src:t.comment.avatar},null,8,Lt)):e.createCommentVNode("v-if",!0),t.comment.type?(e.openBlock(),e.createBlock(i,{key:1})):e.createCommentVNode("v-if",!0)]),e.createElementVNode("div",xt,[e.createElementVNode("div",jt,[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,Rt)):(e.openBlock(),e.createElementBlock("span",zt,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,At)):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,Ut)):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,Mt)):e.createCommentVNode("v-if",!0),void 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,Dt)):e.createCommentVNode("v-if",!0),e.createElementVNode("span",{class:"wl-time",textContent:e.toDisplayString(t.time)},null,8,Tt),e.createElementVNode("div",Ot,[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,Ft)):e.createCommentVNode("v-if",!0)],8,Pt),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,Ht)])]),e.createElementVNode("div",_t,[t.comment.addr?(e.openBlock(),e.createElementBlock("span",{key:0,textContent:e.toDisplayString(t.comment.addr)},null,8,Wt)):e.createCommentVNode("v-if",!0),t.comment.browser?(e.openBlock(),e.createElementBlock("span",{key:1,textContent:e.toDisplayString(t.comment.browser)},null,8,qt)):e.createCommentVNode("v-if",!0),t.comment.os?(e.openBlock(),e.createElementBlock("span",{key:2,textContent:e.toDisplayString(t.comment.os)},null,8,Gt)):e.createCommentVNode("v-if",!0)]),e.createElementVNode("div",{class:"wl-content",innerHTML:t.comment.comment},null,8,Jt),t.isAdmin?(e.openBlock(),e.createElementBlock("div",Kt,[e.createElementVNode("span",Yt,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(t.commentStatus,(n=>(e.openBlock(),e.createElementBlock("button",{key:n,class:e.normalizeClass(`wl-btn wl-${n}`),disabled:t.comment.status===n,onClick:e=>t.$emit("status",{status:n,comment:t.comment}),textContent:e.toDisplayString(n)},null,10,Zt)))),128))]),t.isAdmin&&!t.comment.rid?(e.openBlock(),e.createElementBlock("button",{key:0,class:"wl-btn wl-sticky",onClick:n[3]||(n[3]=e=>t.$emit("sticky",t.comment))},e.toDisplayString(t.comment.sticky?"unsticky":"sticky"),1)):e.createCommentVNode("v-if",!0)])):e.createCommentVNode("v-if",!0),t.isReplyingCurrent?(e.openBlock(),e.createElementBlock("div",Xt,[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",Qt,[(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,Vt)}],["__file","CommentCard.vue"]]);const tn=e.defineComponent({name:"WalineRoot",components:{CommentBox:Nt,CommentCard:en,LoadingIcon:Ue},props:["serverURL","path","meta","requiredMeta","dark","lang","locale","pageSize","wordLimit","emoji","login","highlighter","texRenderer","imageUploader","copyright"],setup(t){const n=e.computed((()=>(({serverURL:e,path:t=location.pathname,lang:n="zh-CN",locale:o,emoji:l=["//unpkg.com/@waline/emojis@1.0.1/weibo"],meta:r=["nick","mail","link"],requiredMeta:m=[],dark:u=!1,pageSize:d=10,wordLimit:v,imageUploader:g,highlighter:h,texRenderer:f,copyright:w=!0,login:y="enable",search:k=s(),...b})=>({serverURL:ce(e),path:re(t),locale:{...C[n]||C["zh-CN"],..."object"==typeof o?o:{}},wordLimit:se(v),meta:a(r),requiredMeta:a(m),imageUploader:me(g,i),highlighter:me(h,p),texRenderer:me(f,c),lang:n,dark:u,emoji:l,pageSize:d,login:y,copyright:w,search:k,...b}))(t))),o=je(),l=ze(),r=e.ref("loading"),m=e.ref(0),u=e.ref(1),d=e.ref(0),v=e.ref([]),g=e.ref(null),h=e.computed((()=>{return"string"==typeof(e=n.value.dark)?"auto"===e?`@media(prefers-color-scheme:dark){body${ue}}`:`${e}${ue}`:!0===e?`:root${ue}`:"";var e}));let f;!function(t,n={}){const o=e.ref(!1),{document:l=H,immediate:r=!0,manual:a=!1,id:i="vueuse_styletag_"+ ++le}=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||E(u),e.readonly(o)}(h);const w=e=>{const{serverURL:t,path:l,pageSize:a}=n.value,i=new AbortController;r.value="loading",f?.(),(({serverURL:e,lang:t,path:n,page:o,pageSize:l,signal:r,token:a})=>{const i={};return a&&(i.Authorization=`Bearer ${a}`),fetch(`${e}/comment?path=${encodeURIComponent(n)}&pageSize=${l}&page=${o}&lang=${t}`,{signal:r,headers:i}).then((e=>e.json())).then((e=>we(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",m.value=t.count,v.value.push(...t.data),u.value=e,d.value=t.totalPages})).catch((e=>{"AbortError"!==e.name&&(console.error(e.message),r.value="error")})),f=i.abort.bind(i)},y=()=>{m.value=0,v.value=[],w(1)};return e.provide("config",n),e.watch((()=>t.path),y),e.onMounted((()=>y())),{config:n,darkmodeStyle:h,i18n:e.computed((()=>n.value.locale)),status:r,count:m,page:u,totalPages:d,data:v,reply:g,loadMore:()=>w(u.value+1),refresh:y,onReply:e=>{g.value=e},onSubmit:e=>{if(e.rid){const t=v.value.find((({objectId:t})=>t===e.rid));if(!t)return;Array.isArray(t.children)||(t.children=[]),t.children.push(e)}else v.value.unshift(e)},onStatusChange:async({comment:e,status:t})=>{if(e.status===t)return;const{serverURL:l,lang:r}=n.value;await ye({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}),v.value.some(((t,n)=>t.objectId===e?(v.value=v.value.filter(((e,t)=>t!==n)),!0):t.children.some(((o,l)=>o.objectId===e&&(v.value[n].children=t.children.filter(((e,t)=>t!==l)),!0)))))},onSticky:async e=>{if(e.rid)return;const{serverURL:t,lang:l}=n.value;await ye({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:fe,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.6.0"}}}),nn={"data-waline":""},on={class:"wl-count"},ln=["textContent"],rn={class:"wl-cards"},an={key:1,class:"wl-operation"},cn=["textContent"],sn={key:0,class:"wl-loading"},mn=["textContent"],un={class:"wl-operation"},dn=["textContent"],pn={key:3,class:"wl-power"},vn=e.createTextVNode(" Powered by "),gn=e.createElementVNode("a",{href:"https://github.com/walinejs/waline",target:"_blank",rel:"noreferrer"}," Waline ",-1);var hn=Me(tn,[["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",nn,[t.reply?e.createCommentVNode("v-if",!0):(e.openBlock(),e.createBlock(i,{key:0,onSubmit:t.onSubmit},null,8,["onSubmit"])),e.createElementVNode("div",on,[t.count?(e.openBlock(),e.createElementBlock("span",{key:0,class:"wl-num",textContent:e.toDisplayString(t.count)},null,8,ln)):e.createCommentVNode("v-if",!0),e.createTextVNode(" "+e.toDisplayString(t.i18n.comment),1)]),e.createElementVNode("div",rn,[(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",an,[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,cn)])):(e.openBlock(),e.createElementBlock(e.Fragment,{key:2},["loading"===t.status?(e.openBlock(),e.createElementBlock("div",sn,[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",un,[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,dn)])],2112)):e.createCommentVNode("v-if",!0):(e.openBlock(),e.createElementBlock("div",{key:1,class:"wl-empty",textContent:e.toDisplayString(t.i18n.sofa)},null,8,mn))],64)),e.createCommentVNode(" Copyright Information "),t.config.copyright?(e.openBlock(),e.createElementBlock("div",pn,[vn,gn,e.createTextVNode(" v"+e.toDisplayString(t.version),1)])):e.createCommentVNode("v-if",!0)])}],["__file","Waline.vue"]]);const fn=(e,t)=>{t.forEach(((t,n)=>{t.innerText=e[n].toString()}))},wn=({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=Le(e);return null!==n&&t!==n},c=n=>ke({serverURL:ce(e),paths:n.map((e=>Le(e)||t)),lang:l,signal:r.signal}).then((e=>fn(e,n))).catch(he);if(o){const n=a.filter((e=>!i(e))),o=a.filter(i);be({serverURL:e,path:t,lang:l}).then((e=>fn(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=je(),r=Ce(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=>we(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=Ae,exports.defaultLocales=C,exports.init=({el:t="#waline",path:n=window.location.pathname,comment:o=!1,pageview:l=!1,...r})=>{const a=t?Ce(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=a?e.createApp((()=>e.h(hn,{path:c.path,...i}))):null;s&&s.mount(a);const m=e.watchEffect((()=>{c.comment&&Ae({serverURL:i.serverURL,path:c.path,selector:"string"==typeof c.comment?c.comment:void 0})})),u=e.watchEffect((()=>{c.pageview&&wn({serverURL:i.serverURL,path:c.path,selector:"string"==typeof c.pageview?c.pageview:void 0})}));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:()=>{s?.unmount(),m(),u()}}},exports.pageviewCount=wn,exports.version="2.6.0"; | ||
"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=()=>{const e={next:""},t=({keyword:e,pos:t})=>{const n=new URLSearchParams("media_filter=minimal");return n.set("key","PAY5JLFIH6V6"),n.set("limit","20"),n.set("pos",t||""),n.set("q",e),fetch(`https://g.tenor.com/v1/search?${n.toString()}`,{headers:{"Content-Type":"application/json"}}).then((e=>e.json())).catch((()=>({next:t||"",results:[]})))};return{search:(n="")=>t({keyword:n}).then((t=>(e.next=t.next,t.results.map((e=>({title:e.title,src:e.media[0].tinygif.url})))))),more:n=>t({keyword:n,pos:e.next}).then((t=>(e.next=t.next,t.results.map((e=>({title:e.title,src:e.media[0].tinygif.url}))))))}},m=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"),u=["23AC69","91C132","F19726","E8552D","1AAB8E","E1147F","2980C1","1BA1E6","9FA0A0","F19726","E30B20","E30B20","A3338B"],d={},p=e=>{let t=0;return e.replace(m,((e,n,o)=>{if(o)return`<span style="color: slategray">${o}</span>`;if("<"===n)return"<";let l;d[n]?l=d[n]:(l=u[t],d[n]=l);const r=`<span style="color: #${l}">${n}</span>`;return t=++t%u.length,r}))},v=["nick","nickError","mail","mailError","link","optional","placeholder","sofa","submit","like","cancelLike","reply","cancelReply","comment","refresh","more","preview","emoji","uploadImage","seconds","minutes","hours","days","now","uploading","login","logout","admin","sticky","word","wordHint","anonymous","level0","level1","level2","level3","level4","level5","gif","gifSearchPlaceholder"],g=e=>Object.fromEntries(e.map(((e,t)=>[v[t],e])));var h=g(["NickName","NickName cannot be less than 3 bytes.","E-Mail","Please confirm your email address.","Website","Optional","Comment here...","No comment yet.","Submit","Like","Cancel like","Reply","Cancel reply","Comments","Refresh","Load More...","Preview","Emoji","Upload Image","seconds ago","minutes ago","hours ago","days ago","just now","Uploading","Login","logout","Admin","Sticky","Words","Please input comments between $0 and $1 words!\n Current word number: $2","Anonymous","Dwarves","Hobbits","Ents","Wizards","Elves","Maiar","GIF","Search GIF"]),f=g(["ニックネーム","3バイト以上のニックネームをご入力ください.","メールアドレス","メールアドレスをご確認ください.","サイト","オプション","ここにコメント","コメントしましょう~","提出する","Like","Cancel like","返信する","キャンセル","コメント","更新","さらに読み込む","プレビュー","絵文字","画像をアップロード","秒前","分前","時間前","日前","たっだ今","アップロード","ログインする","ログアウト","管理者","トップに置く","ワード","コメントは $0 から $1 ワードの間でなければなりません!\n 現在の単語番号: $2","匿名","うえにん","なかにん","しもおし","特にしもおし","かげ","なぬし","GIF","探す GIF"]),w=g(["昵称","昵称不能少于3个字符","邮箱","请填写正确的邮件地址","网址","可选","欢迎评论","来发评论吧~","提交","喜欢","取消喜欢","回复","取消回复","评论","刷新","加载更多...","预览","表情","上传图片","秒前","分钟前","小时前","天前","刚刚","正在上传","登录","退出","博主","置顶","字","评论字数应在 $0 到 $1 字之间!\n当前字数:$2","匿名","潜水","冒泡","吐槽","活跃","话痨","传说","表情包","搜索表情包"]),y=g(["暱稱","郵箱","網址","可選","暱稱不能少於3個字元","請填寫正確的郵件地址","歡迎評論","來發評論吧~","提交","喜歡","取消喜歡","回覆","取消回覆","評論","刷新","載入更多...","預覽","表情","上傳圖片","秒前","分鐘前","小時前","天前","剛剛","正在上傳","登錄","退出","博主","置頂","字","評論字數應在 $0 到 $1 字之間!\n當前字數:$2","匿名","潛水","冒泡","吐槽","活躍","話癆","傳說","表情包","搜索表情包"]),k=g(["Apelido","Apelido não pode ser menor que 3 bytes.","E-Mail","Por favor, confirme seu endereço de e-mail.","Website","Opcional","Comente aqui...","Nenhum comentário, ainda.","Enviar","Like","Cancel like","Responder","Cancelar resposta","Comentários","Refrescar","Carregar Mais...","Visualizar","Emoji","Enviar Imagem","segundos atrás","minutos atrás","horas atrás","dias atrás","agora mesmo","Enviando","Entrar","Sair","Admin","Sticky","Palavras","Favor enviar comentário com $0 a $1 palavras!\n Número de palavras atuais: $2","Anônimo","Dwarves","Hobbits","Ents","Wizards","Elves","Maiar","GIF","Pesquisar GIF"]),b=g(["Псевдоним","Никнейм не может быть меньше 3 байт.","Эл. адрес","Пожалуйста, подтвердите адрес вашей электронной почты.","Веб-сайт","Необязательный","Комментарий здесь...","Пока нет комментариев.","Отправить","Like","Cancel like","Отвечать","Отменить ответ","Комментарии","Обновить","Загрузи больше...","Превью","эмодзи","Загрузить изображение","секунд назад","несколько минут назад","несколько часов назад","дней назад","прямо сейчас","Загрузка","Авторизоваться","Выход из системы","Админ","Липкий","Слова","Пожалуйста, введите комментарии от $0 до $1 слов!\nНомер текущего слова: $2","Анонимный","Dwarves","Hobbits","Ents","Wizards","Elves","Maiar","GIF","Поиск GIF"]);const C={zh:w,"zh-cn":w,"zh-CN":w,"zh-tw":y,"zh-TW":y,en:h,"en-US":h,"en-us":h,jp:f,"jp-jp":f,"jp-JP":f,"pt-br":k,"pt-BR":k,ru:b,"ru-ru":b,"ru-RU":b};function E(t){return!!e.getCurrentScope()&&(e.onScopeDispose(t),!0)}var B;const N="undefined"!=typeof window,$=()=>{};function S(e,t){return function(...n){e((()=>t.apply(this,n)),{fn:t,thisArg:this,args:n})}}N&&(null==(B=null==window?void 0:window.navigator)?void 0:B.userAgent)&&/iP(ad|hone|od)/.test(window.navigator.userAgent);const V=e=>e();function I(t,n=200,o={}){return S(function(t,n={}){let o,l;return r=>{const a=e.unref(t),i=e.unref(n.maxWait);if(o&&clearTimeout(o),a<=0||void 0!==i&&i<=0)return l&&(clearTimeout(l),l=null),r();i&&!l&&(l=setTimeout((()=>{o&&clearTimeout(o),l=null,r()}),i)),o=setTimeout((()=>{l&&clearTimeout(l),l=null,r()}),a)}}(n,o),t)}var L=Object.getOwnPropertySymbols,x=Object.prototype.hasOwnProperty,j=Object.prototype.propertyIsEnumerable;function R(t,n,o={}){const l=o,{eventFilter:r=V}=l,a=((e,t)=>{var n={};for(var o in e)x.call(e,o)&&t.indexOf(o)<0&&(n[o]=e[o]);if(null!=e&&L)for(var o of L(e))t.indexOf(o)<0&&j.call(e,o)&&(n[o]=e[o]);return n})(l,["eventFilter"]);return e.watch(t,S(r,n),a)}var z=Object.defineProperty,A=Object.defineProperties,U=Object.getOwnPropertyDescriptors,M=Object.getOwnPropertySymbols,D=Object.prototype.hasOwnProperty,T=Object.prototype.propertyIsEnumerable,O=(e,t,n)=>t in e?z(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;function P(t,n,o={}){const l=o,{eventFilter:r}=l,a=((e,t)=>{var n={};for(var o in e)D.call(e,o)&&t.indexOf(o)<0&&(n[o]=e[o]);if(null!=e&&M)for(var o of M(e))t.indexOf(o)<0&&T.call(e,o)&&(n[o]=e[o]);return n})(l,["eventFilter"]),{eventFilter:i,pause:c,resume:s,isActive:m}=function(t=V){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=R(t,n,(d=((e,t)=>{for(var n in t||(t={}))D.call(t,n)&&O(e,n,t[n]);if(M)for(var n of M(t))T.call(t,n)&&O(e,n,t[n]);return e})({},a),A(d,U({eventFilter:i}))));var d;return{stop:u,pause:c,resume:s,isActive:m}}const F=N?window:void 0,H=N?window.document:void 0;function _(...t){let n,o,l,r;if("string"==typeof t[0]?([o,l,r]=t,n=F):[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 E(c),c}N&&window.navigator,N&&window.location;const W="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},q="__vueuse_ssr_handlers__";W[q]=W[q]||{};const G=W[q];const J={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 K(t,n,o,l={}){var r;const{flush:a="pre",deep:i=!0,listenToStorageChanges:c=!0,writeDefaults:s=!0,shallow:m,window:u=F,eventFilter:d,onError:p=(e=>{console.error(e)})}=l,v=(m?e.shallowRef:e.ref)(n);if(!o)try{o=function(e,t){return G[e]||t}("getDefaultStorage",(()=>{var e;return null==(e=F)?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:J[h],{pause:w,resume:y}=P(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&&_(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 Y,Z,X=Object.defineProperty,Q=Object.getOwnPropertySymbols,ee=Object.prototype.hasOwnProperty,te=Object.prototype.propertyIsEnumerable,ne=(e,t,n)=>t in e?X(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;function oe(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=F}=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(),E(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(){e.unref(n)<=0||(i.value=!0,r&&t(),c(),a=setInterval(t,e.unref(n)))}l&&N&&m(),e.isRef(n)&&E(e.watch(n,(()=>{l&&N&&m()})));return E(s),{isActive:i,pause:s,resume:m}}(r,o,{immediate:!0});return n?((e,t)=>{for(var n in t||(t={}))ee.call(t,n)&&ne(e,n,t[n]);if(Q)for(var n of Q(t))te.call(t,n)&&ne(e,n,t[n]);return e})({now:l},a):l}(Z=Y||(Y={})).UP="UP",Z.RIGHT="RIGHT",Z.DOWN="DOWN",Z.LEFT="LEFT",Z.NONE="NONE";let le=0;const re=e=>{try{e=decodeURI(e)}catch(e){}return e},ae=(e="")=>e.replace(/\/$/u,""),ie=e=>/^(https?:)?\/\//.test(e),ce=e=>{const t=ae(e);return ie(t)?t:`https://${t}`},se=e=>Array.isArray(e)?e:!!e&&[0,e],me=(e,t)=>"function"==typeof e?e:!1!==e&&t,ue="{--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}",de=(e,t)=>{let n=e.toString();for(;n.length<t;)n="0"+n;return n},pe=(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=de(e.getDate(),2),n=de(e.getMonth()+1,2);return`${de(e.getFullYear(),2)}-${n}-${t}`})(o)},ve=e=>{const t=K("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}))},ge=(e,t="",n="",o="")=>`${t?`${t}/`:""}${n}${e}${o?`.${o}`:""}`,he=e=>{"AbortError"!==e.name&&console.error(e.message)},fe={"Content-Type":"application/json"},we=(e,t="")=>{if("object"==typeof e&&e.errno)throw new TypeError(`Fetch ${t} failed with ${e.errno}: ${e.errmsg}`);return e},ye=({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())),ke=({serverURL:e,lang:t,paths:n,signal:o})=>fetch(`${e}/article?path=${encodeURIComponent(n.join(","))}&lang=${t}`,{signal:o}).then((e=>e.json())).then((e=>we(e,"visit count"))).then((e=>Array.isArray(e)?e:[e])),be=({serverURL:e,lang:t,path:n})=>fetch(`${e}/article?lang=${t}`,{method:"POST",headers:fe,body:JSON.stringify({path:n})}).then((e=>e.json())).then((e=>we(e,"visit count"))),Ce=e=>e instanceof HTMLElement?e:"string"==typeof e?document.querySelector(e):null,Ee=e=>e.type.includes("image"),Be=e=>{const t=Array.from(e).find(Ee);return t?t.getAsFile():null},Ne=/\$.*?\$/,$e=/^\$(.*?)\$/,Se=/^(?:\s{0,3})\$\$((?:[^\n]|\n[^\n])+?)\n{0,1}\$\$/,Ve=(e="",t={})=>e.replace(/:(.+?):/g,((e,n)=>t[n]?`<img class="wl-emoji" src="${t[n]}" alt="${n}">`:e)),Ie=(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=Se.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(Ne);return-1!==t?t:e.length},tokenizer(t){const n=$e.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(Ve(e,t))},Le=e=>e.dataset.path||e.getAttribute("id");let xe=null;const je=()=>xe||(xe=K("USER_KEY",{}));let Re=null;const ze=()=>Re||(Re=K("WALINE_LIKE",[])),Ae=({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=je();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=>we(e,"comment count"))).then((e=>Array.isArray(e)?e:[e]))})({serverURL:ce(e),paths:Array.from(r).map((e=>re(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(he),l.abort.bind(l)},Ue=({size:t})=>e.h("svg",{width:t,height:t,viewBox:"0 0 100 100",preserveAspectRatio:"xMidYMid"},e.h("circle",{cx:50,cy:50,fill:"none",stroke:"currentColor",strokeWidth:"4",r:"40","stroke-dasharray":"85 30"},e.h("animateTransform",{attributeName:"transform",type:"rotate",repeatCount:"indefinite",dur:"1s",values:"0 50 50;360 50 50",keyTimes:"0;1"})));var Me=(e,t)=>{const n=e.__vccOpts||e;for(const[e,o]of t)n[e]=o;return n};const De=e.defineComponent({name:"ImageWall",components:{LoadingIcon:Ue},props:{items:{type:Array,default:()=>[]},columnWidth:{type:Number,default:300},gap:{type:Number,default:0}},emit:["insert"],setup(t){let n=null;const o=e.ref(null),l=e.ref({}),r=e.ref([]),a=()=>{const e=Math.floor((o.value.getBoundingClientRect().width+t.gap)/(t.columnWidth+t.gap));return e>0?e:1},i=async n=>{if(n>=t.items.length)return;await e.nextTick();const l=Array.from(o.value?.children||[]).reduce(((e,t)=>t.getBoundingClientRect().height<e.getBoundingClientRect().height?t:e));r.value[Number(l.dataset.index)].push(n),await i(n+1)},c=async(e=!1)=>{if(r.value.length===a()&&!e)return;var t;r.value=(t=a(),new Array(t).fill(null).map((()=>[])));const n=window.scrollY;await i(0),window.scrollTo({top:n})};return e.watch((()=>[t.items]),(()=>{l.value={},c(!0)})),e.watch((()=>[t.columnWidth,t.gap]),(()=>c())),e.onMounted((()=>{c(!0),n=new ResizeObserver((()=>c())),n.observe(o.value)})),e.onBeforeUnmount((()=>n.unobserve(o.value))),{columns:r,state:l,wall:o}}}),Te=["data-index"],Oe=["src","title","onLoad","onClick"];var Pe=Me(De,[["render",function(t,n,o,l,r,a){const i=e.resolveComponent("LoadingIcon");return e.openBlock(),e.createElementBlock("div",{ref:"wall",class:"wl-gallery",style:e.normalizeStyle({gap:`${t.gap}px`})},[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(t.columns,((n,o)=>(e.openBlock(),e.createElementBlock("div",{key:o,class:"wl-gallery-column","data-index":o,style:e.normalizeStyle({gap:`${t.gap}px`})},[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(n,(n=>(e.openBlock(),e.createElementBlock(e.Fragment,{key:n},[t.state[t.items[n].src]?e.createCommentVNode("v-if",!0):(e.openBlock(),e.createBlock(i,{key:0,size:36,style:{margin:"20px auto"}})),e.createElementVNode("img",{class:"wl-gallery-item",src:t.items[n].src,title:t.items[n].title,loading:"lazy",onLoad:e=>t.state[t.items[n].src]=!0,onClick:e=>t.$emit("insert",`![](${t.items[n].src})`)},null,40,Oe)],64)))),128))],12,Te)))),128))],4)}],["__file","ImageWall.vue"]]);const Fe=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"})]),ImageWall:Pe,MarkdownIcon:()=>e.h("svg",{width:"16",height:"16",ariaHidden:"true"},e.h("path",{d:"M14.85 3H1.15C.52 3 0 3.52 0 4.15v7.69C0 12.48.52 13 1.15 13h13.69c.64 0 1.15-.52 1.15-1.15v-7.7C16 3.52 15.48 3 14.85 3zM9 11H7V8L5.5 9.92 4 8v3H2V5h2l1.5 2L7 5h2v6zm2.99.5L9.5 8H11V5h2v3h1.5l-2.51 3.5z",fill:"currentColor"})),PreviewIcon:()=>e.h("svg",{viewBox:"0 0 1024 1024",width:"24",height:"24"},[e.h("path",{d:"M710.816 654.301c70.323-96.639 61.084-230.578-23.705-314.843-46.098-46.098-107.183-71.109-172.28-71.109-65.008 0-126.092 25.444-172.28 71.109-45.227 46.098-70.756 107.183-70.756 172.106 0 64.923 25.444 126.007 71.194 172.106 46.099 46.098 107.184 71.109 172.28 71.109 51.414 0 100.648-16.212 142.824-47.404l126.53 126.006c7.058 7.06 16.297 10.979 26.406 10.979 10.105 0 19.343-3.919 26.402-10.979 14.467-14.467 14.467-38.172 0-52.723L710.816 654.301zm-315.107-23.265c-65.88-65.88-65.88-172.54 0-238.42 32.069-32.07 74.245-49.149 119.471-49.149 45.227 0 87.407 17.603 119.472 49.149 65.88 65.879 65.88 172.539 0 238.42-63.612 63.178-175.242 63.178-238.943 0zm0 0",fill:"currentColor"}),e.h("path",{d:"M703.319 121.603H321.03c-109.8 0-199.469 89.146-199.469 199.38v382.034c0 109.796 89.236 199.38 199.469 199.38h207.397c20.653 0 37.384-16.645 37.384-37.299 0-20.649-16.731-37.296-37.384-37.296H321.03c-68.582 0-124.352-55.77-124.352-124.267V321.421c0-68.496 55.77-124.267 124.352-124.267h382.289c68.582 0 124.352 55.771 124.352 124.267V524.72c0 20.654 16.736 37.299 37.385 37.299 20.654 0 37.384-16.645 37.384-37.299V320.549c-.085-109.8-89.321-198.946-199.121-198.946zm0 0",fill:"currentColor"})]),LoadingIcon:Ue,GifIcon:()=>e.h("svg",{width:24,height:24,fill:"currentcolor",viewBox:"0 0 24 24"},[e.h("path",{style:"transform: translateY(0.5px)",d:"M18.968 10.5H15.968V11.484H17.984V12.984H15.968V15H14.468V9H18.968V10.5V10.5ZM8.984 9C9.26533 9 9.49967 9.09367 9.687 9.281C9.87433 9.46833 9.968 9.70267 9.968 9.984V10.5H6.499V13.5H8.468V12H9.968V14.016C9.968 14.2973 9.87433 14.5317 9.687 14.719C9.49967 14.9063 9.26533 15 8.984 15H5.984C5.70267 15 5.46833 14.9063 5.281 14.719C5.09367 14.5317 5 14.2973 5 14.016V9.985C5 9.70367 5.09367 9.46933 5.281 9.282C5.46833 9.09467 5.70267 9.001 5.984 9.001H8.984V9ZM11.468 9H12.968V15H11.468V9V9Z"}),e.h("path",{d:"M18.5 3H5.75C3.6875 3 2 4.6875 2 6.75V18C2 20.0625 3.6875 21.75 5.75 21.75H18.5C20.5625 21.75 22.25 20.0625 22.25 18V6.75C22.25 4.6875 20.5625 3 18.5 3ZM20.75 18C20.75 19.2375 19.7375 20.25 18.5 20.25H5.75C4.5125 20.25 3.5 19.2375 3.5 18V6.75C3.5 5.5125 4.5125 4.5 5.75 4.5H18.5C19.7375 4.5 20.75 5.5125 20.75 6.75V18Z"})])},props:{rootId:{type:String,default:""},replyId:{type:String,default:""},replyUser:{type:String,default:""}},emits:["submit","cancel-reply"],setup(t,{emit:n}){const o=e.inject("config"),r=K("WALINE_COMMENT_BOX_EDITOR",""),a=K("WALINE_USER_META",{nick:"",mail:"",link:""}),i=je(),c=e.ref({}),s=e.ref(null),m=e.ref(null),u=e.ref(null),d=e.ref(null),p=e.ref(null),v=e.ref(null),g=e.ref(null),h=e.ref({tabs:[],map:{}}),f=e.ref(0),w=e.ref(!1),y=e.ref(!1),k=e.ref(!1),b=e.ref(""),C=e.ref(0),E=e.reactive({loading:!0,list:[]}),B=e.ref(0),N=e.ref(!1),$=e.ref(""),S=e.ref(!1),V=e.computed((()=>o.value.locale)),L=e.computed((()=>Boolean(i.value?.token))),x=e.computed((()=>!1!==o.value.imageUploader)),j=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},R=e=>{const t=`![${o.value.locale.uploading} ${e.name}]()`;return j(t),Promise.resolve().then((()=>o.value.imageUploader(e))).then((n=>{r.value=r.value.replace(t,`\r\n![${e.name}](${n})`)}))},z=()=>{const{serverURL:e,lang:l,login:m,wordLimit:u,requiredMeta:d}=o.value,p={comment:$.value,nick:a.value.nick,mail:a.value.mail,link:a.value.link,ua:navigator.userAgent,url:o.value.path};if(i.value?.token)p.nick=i.value.display_name,p.mail=i.value.email,p.link=i.value.url;else{if("force"===m)return;if(d.indexOf("nick")>-1&&!p.nick)return c.value.nick?.focus(),alert(V.value.nickError);if(d.indexOf("mail")>-1&&!p.mail||p.mail&&!/^\w(?:[\w._-]*\w)?@(?:\w(?:[\w-]*\w)?\.)*\w+$/.exec(p.mail))return c.value.mail?.focus(),alert(V.value.mailError);if(!p.comment)return void s.value?.focus();p.nick||(p.nick=V.value.anonymous)}if(!N.value)return alert(V.value.wordHint.replace("$0",u[0].toString()).replace("$1",u[1].toString()).replace("$2",C.value.toString()));p.comment=Ve(p.comment,h.value.map),t.replyId&&t.rootId&&(p.pid=t.replyId,p.rid=t.rootId,p.at=t.replyUser),S.value=!0,(({serverURL:e,lang:t,token:n,comment:o})=>{const l={"Content-Type":"application/json"};return n&&(l.Authorization=`Bearer ${n}`),fetch(`${e}/comment?lang=${t}`,{method:"POST",headers:l,body:JSON.stringify(o)}).then((e=>e.json()))})({serverURL:e,lang:l,token:i.value?.token,comment:p}).then((e=>{if(S.value=!1,e.errmsg)return alert(e.errmsg);n("submit",e.data),r.value="",b.value="",t.replyId&&n("cancel-reply")})).catch((e=>{S.value=!1,alert(e.message)}))},A=e=>{u.value.contains(e.target)||d.value.contains(e.target)||(w.value=!1),p.value.contains(e.target)||v.value.contains(e.target)||(y.value=!1)},U=async e=>{const{scrollTop:t,clientHeight:n,scrollHeight:l}=e.target,r=(n+t)/l,a=o.value.search,i=g.value?.value||"";r<.9||E.loading||(E.loading=!0,E.list.push(...a.more?await a.more(i,E.list.length):await a.search(i)),E.loading=!1,setTimeout((()=>{e.target.scrollTop=t}),50))},M=I((e=>{E.list=[],U(e)}),300);return e.watch([o,C],(([e,t])=>{const{wordLimit:n}=e;n?t<n[0]&&0!==n[0]?(B.value=n[0],N.value=!1):t>n[1]?(B.value=n[1],N.value=!1):(B.value=n[1],N.value=!0):(B.value=0,N.value=!0)}),{immediate:!0}),e.watch(y,(async e=>{if(!e)return;const t=o.value.search;g.value&&(g.value.value=""),E.loading=!0,E.list=t.default?await t.default():await t.search(""),E.loading=!1})),e.onMounted((()=>{document.body.addEventListener("click",A),e.watch((()=>r.value),(e=>{const{highlighter:t,texRenderer:n}=o.value;$.value=e,b.value=Ie(e,{emojiMap:h.value.map,highlighter:t,texRenderer:n}),C.value=(e=>(e=>e.match(/[\w\d\s\u00C0-\u024F]+/giu)||[])(e).reduce(((e,t)=>e+(""===t.trim()?0:t.trim().split(/\s+/u).length)),0)+(e=>e.match(/[\u4E00-\u9FA5]/gu)||[])(e).length)(e),e?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?ve(ae(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:ge(l,o,r,a),items:i.map((e=>{const n=`${r||""}${e}`;return t.map[n]=ge(e,o,r,a),n}))})})),t}))).then((e=>{h.value=e}));var t}),{immediate:!0})})),e.onUnmounted((()=>{document.body.removeEventListener("click",A)})),{config:o,locale:V,insert:j,onChange:()=>{const e=m.value;e.files&&x.value&&R(e.files[0]).then((()=>{e.value=""}))},onDrop:e=>{if(e.dataTransfer?.items){const t=Be(e.dataTransfer.items);t&&x.value&&(R(t),e.preventDefault())}},onKeyDown:e=>{const t=e.key;(e.ctrlKey||e.metaKey)&&"Enter"===t&&z()},onPaste:e=>{if(e.clipboardData){const t=Be(e.clipboardData.items);t&&x.value&&R(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:z,onImageWallScroll:U,onGifSearch:M,isLogin:L,userInfo:i,isSubmitting:S,wordNumber:C,wordLimit:B,isWordNumberLegal:N,editor:r,userMeta:a,emoji:h,emojiTabIndex:f,showEmoji:w,gifData:E,showGif:y,canUploadImage:x,previewText:b,showPreview:k,inputRefs:c,editorRef:s,emojiButtonRef:u,emojiPopupRef:d,gifButtonRef:p,gifPopupRef:v,imageUploadRef:m,gifSearchInputRef:g}}}),He={class:"wl-comment"},_e={key:0,class:"wl-login-info"},We={class:"wl-avatar"},qe=["title"],Ge=["src"],Je=["textContent"],Ke={class:"wl-panel"},Ye=["for","textContent"],Ze=["id","name","type","onUpdate:modelValue"],Xe=["placeholder"],Qe={class:"wl-preview"},et=e.createElementVNode("hr",null,null,-1),tt=["innerHTML"],nt={class:"wl-footer"},ot={class:"wl-actions"},lt={href:"https://guides.github.com/features/mastering-markdown/",title:"Markdown Guide","aria-label":"Markdown is supported",class:"wl-action",target:"_blank",rel:"noreferrer"},rt=["title"],at=["title"],it=["title"],ct=["title"],st={class:"wl-info"},mt={class:"wl-text-number"},ut={key:0},dt=e.createTextVNode(" / "),pt=["textContent"],vt=["textContent"],gt=["disabled"],ht=["placeholder"],ft={key:0,class:"wl-loading"},wt={key:0,class:"wl-tab-wrapper"},yt=["title","onClick"],kt=["src","alt"],bt={key:0,class:"wl-tabs"},Ct=["onClick"],Et=["src","alt","title"],Bt=["title"];var Nt=Me(Fe,[["render",function(t,n,o,l,r,a){const i=e.resolveComponent("CloseIcon"),c=e.resolveComponent("MarkdownIcon"),s=e.resolveComponent("EmojiIcon"),m=e.resolveComponent("GifIcon"),u=e.resolveComponent("ImageIcon"),d=e.resolveComponent("PreviewIcon"),p=e.resolveComponent("LoadingIcon"),v=e.resolveComponent("ImageWall");return e.openBlock(),e.createElementBlock("div",He,["disable"!==t.config.login&&t.isLogin?(e.openBlock(),e.createElementBlock("div",_e,[e.createElementVNode("div",We,[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,qe),e.createElementVNode("img",{src:t.userInfo.avatar,alt:"avatar"},null,8,Ge)]),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,Je)])):e.createCommentVNode("v-if",!0),e.createElementVNode("div",Ke,["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,Ye),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,Ze),[[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,Xe),[[e.vModelText,t.editor]]),e.withDirectives(e.createElementVNode("div",Qe,[et,e.createElementVNode("h4",null,e.toDisplayString(t.locale.preview)+":",1),e.createElementVNode("div",{class:"wl-content",innerHTML:t.previewText},null,8,tt)],512),[[e.vShow,t.showPreview]]),e.createElementVNode("div",nt,[e.createElementVNode("div",ot,[e.createElementVNode("a",lt,[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,rt),[[e.vShow,t.emoji.tabs.length]]),t.config.search?(e.openBlock(),e.createElementBlock("button",{key:0,ref:"gifButtonRef",class:e.normalizeClass(["wl-action",{actived:t.showGif}]),title:t.locale.gif,onClick:n[7]||(n[7]=e=>t.showGif=!t.showGif)},[e.createVNode(m)],10,at)):e.createCommentVNode("v-if",!0),e.createElementVNode("input",{ref:"imageUploadRef",class:"upload",id:"wl-image-upload",type:"file",accept:".png,.jpg,.jpeg,.webp,.bmp,.gif",onChange:n[8]||(n[8]=(...e)=>t.onChange&&t.onChange(...e))},null,544),t.canUploadImage?(e.openBlock(),e.createElementBlock("label",{key:1,for:"wl-image-upload",class:"wl-action",title:t.locale.uploadImage},[e.createVNode(u)],8,it)):e.createCommentVNode("v-if",!0),e.createElementVNode("button",{class:e.normalizeClass(["wl-action",{actived:t.showPreview}]),title:t.locale.preview,onClick:n[9]||(n[9]=e=>t.showPreview=!t.showPreview)},[e.createVNode(d)],10,ct)]),e.createElementVNode("div",st,[e.createElementVNode("div",mt,[e.createTextVNode(e.toDisplayString(t.wordNumber)+" ",1),t.config.wordLimit?(e.openBlock(),e.createElementBlock("span",ut,[dt,e.createElementVNode("span",{class:e.normalizeClass({illegal:!t.isWordNumberLegal}),textContent:e.toDisplayString(t.wordLimit)},null,10,pt)])):e.createCommentVNode("v-if",!0),e.createTextVNode(" "+e.toDisplayString(t.locale.word),1)]),"disable"===t.config.login||t.isLogin?e.createCommentVNode("v-if",!0):(e.openBlock(),e.createElementBlock("button",{key:0,class:"wl-btn",onClick:n[10]||(n[10]=(...e)=>t.onLogin&&t.onLogin(...e)),textContent:e.toDisplayString(t.locale.login)},null,8,vt)),"force"!==t.config.login||t.isLogin?(e.openBlock(),e.createElementBlock("button",{key:1,class:"wl-btn primary",title:"Cmd|Ctrl + Enter",disabled:t.isSubmitting,onClick:n[11]||(n[11]=(...e)=>t.submitComment&&t.submitComment(...e))},[t.isSubmitting?(e.openBlock(),e.createBlock(p,{key:0,size:16})):(e.openBlock(),e.createElementBlock(e.Fragment,{key:1},[e.createTextVNode(e.toDisplayString(t.locale.submit),1)],64))],8,gt)):e.createCommentVNode("v-if",!0)]),e.createElementVNode("div",{ref:"gifPopupRef",class:e.normalizeClass(["wl-gif-popup",{display:t.showGif}])},[e.createElementVNode("input",{type:"text",placeholder:t.locale.gifSearchPlaceholder,ref:"gifSearchInputRef",onInput:n[12]||(n[12]=(...e)=>t.onGifSearch&&t.onGifSearch(...e))},null,40,ht),e.createVNode(v,{items:t.gifData.list,"column-width":200,gap:6,onInsert:n[13]||(n[13]=e=>t.insert(e)),onScroll:t.onImageWallScroll},null,8,["items","onScroll"]),t.gifData.loading?(e.openBlock(),e.createElementBlock("div",ft,[e.createVNode(p,{size:30})])):e.createCommentVNode("v-if",!0)],2),e.createElementVNode("div",{ref:"emojiPopupRef",class:e.normalizeClass(["wl-emoji-popup",{display:t.showEmoji}])},[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(t.emoji.tabs,((n,o)=>(e.openBlock(),e.createElementBlock(e.Fragment,{key:n.name},[o===t.emojiTabIndex?(e.openBlock(),e.createElementBlock("div",wt,[(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,kt)):e.createCommentVNode("v-if",!0)],8,yt)))),128))])):e.createCommentVNode("v-if",!0)],64)))),128)),t.emoji.tabs.length>1?(e.openBlock(),e.createElementBlock("div",bt,[(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,Et)],10,Ct)))),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[14]||(n[14]=e=>t.$emit("cancel-reply"))},[e.createVNode(i,{size:24})],8,Bt)):e.createCommentVNode("v-if",!0)])}],["__file","CommentBox.vue"]]);const $t=["approved","waiting","spam"],St=e.defineComponent({props:{comment:{type:Object,required:!0},rootId:{type:String,required:!0},reply:{type:Object}},components:{CommentBox:Nt,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=ze(),l=je(),r=e.computed((()=>n.value.locale)),a=e.computed((()=>{let{link:e}=t.comment;return e?ie(e)?e:`https://${e}`:""})),i=e.computed((()=>o.value.includes(t.comment.objectId))),c=((t,n)=>{const o=oe();return e.computed((()=>pe(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:$t}}}),Vt=["id"],It={class:"wl-user","aria-hidden":"true"},Lt=["src"],xt={class:"wl-card"},jt={class:"wl-head"},Rt=["href"],zt={key:1,class:"wl-nick"},At=["textContent"],Ut=["textContent"],Mt=["textContent"],Dt=["textContent"],Tt=["textContent"],Ot={class:"wl-comment-actions"},Pt=["title"],Ft=["textContent"],Ht=["title"],_t={class:"wl-meta","aria-hidden":"true"},Wt=["textContent"],qt=["textContent"],Gt=["textContent"],Jt=["innerHTML"],Kt={key:0,class:"wl-admin-actions"},Yt={class:"wl-comment-status"},Zt=["disabled","onClick","textContent"],Xt={key:1,class:"wl-reply-wrapper"},Qt={key:2,class:"wl-quote"};var en=Me(St,[["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",It,[t.comment.avatar?(e.openBlock(),e.createElementBlock("img",{key:0,src:t.comment.avatar},null,8,Lt)):e.createCommentVNode("v-if",!0),t.comment.type?(e.openBlock(),e.createBlock(i,{key:1})):e.createCommentVNode("v-if",!0)]),e.createElementVNode("div",xt,[e.createElementVNode("div",jt,[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,Rt)):(e.openBlock(),e.createElementBlock("span",zt,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,At)):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,Ut)):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,Mt)):e.createCommentVNode("v-if",!0),void 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,Dt)):e.createCommentVNode("v-if",!0),e.createElementVNode("span",{class:"wl-time",textContent:e.toDisplayString(t.time)},null,8,Tt),e.createElementVNode("div",Ot,[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,Ft)):e.createCommentVNode("v-if",!0)],8,Pt),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,Ht)])]),e.createElementVNode("div",_t,[t.comment.addr?(e.openBlock(),e.createElementBlock("span",{key:0,textContent:e.toDisplayString(t.comment.addr)},null,8,Wt)):e.createCommentVNode("v-if",!0),t.comment.browser?(e.openBlock(),e.createElementBlock("span",{key:1,textContent:e.toDisplayString(t.comment.browser)},null,8,qt)):e.createCommentVNode("v-if",!0),t.comment.os?(e.openBlock(),e.createElementBlock("span",{key:2,textContent:e.toDisplayString(t.comment.os)},null,8,Gt)):e.createCommentVNode("v-if",!0)]),e.createElementVNode("div",{class:"wl-content",innerHTML:t.comment.comment},null,8,Jt),t.isAdmin?(e.openBlock(),e.createElementBlock("div",Kt,[e.createElementVNode("span",Yt,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(t.commentStatus,(n=>(e.openBlock(),e.createElementBlock("button",{key:n,class:e.normalizeClass(`wl-btn wl-${n}`),disabled:t.comment.status===n,onClick:e=>t.$emit("status",{status:n,comment:t.comment}),textContent:e.toDisplayString(n)},null,10,Zt)))),128))]),t.isAdmin&&!t.comment.rid?(e.openBlock(),e.createElementBlock("button",{key:0,class:"wl-btn wl-sticky",onClick:n[3]||(n[3]=e=>t.$emit("sticky",t.comment))},e.toDisplayString(t.comment.sticky?"unsticky":"sticky"),1)):e.createCommentVNode("v-if",!0)])):e.createCommentVNode("v-if",!0),t.isReplyingCurrent?(e.openBlock(),e.createElementBlock("div",Xt,[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",Qt,[(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,Vt)}],["__file","CommentCard.vue"]]);const tn=e.defineComponent({name:"WalineRoot",components:{CommentBox:Nt,CommentCard:en,LoadingIcon:Ue},props:["serverURL","path","meta","requiredMeta","dark","lang","locale","pageSize","wordLimit","emoji","login","highlighter","texRenderer","imageUploader","copyright"],setup(t){const n=e.computed((()=>(({serverURL:e,path:t=location.pathname,lang:n="zh-CN",locale:o,emoji:l=["//unpkg.com/@waline/emojis@1.0.1/weibo"],meta:r=["nick","mail","link"],requiredMeta:m=[],dark:u=!1,pageSize:d=10,wordLimit:v,imageUploader:g,highlighter:h,texRenderer:f,copyright:w=!0,login:y="enable",search:k=s(),...b})=>({serverURL:ce(e),path:re(t),locale:{...C[n]||C["zh-CN"],..."object"==typeof o?o:{}},wordLimit:se(v),meta:a(r),requiredMeta:a(m),imageUploader:me(g,i),highlighter:me(h,p),texRenderer:me(f,c),lang:n,dark:u,emoji:l,pageSize:d,login:y,copyright:w,search:k,...b}))(t))),o=je(),l=ze(),r=e.ref("loading"),m=e.ref(0),u=e.ref(1),d=e.ref(0),v=e.ref([]),g=e.ref(null),h=e.computed((()=>{return"string"==typeof(e=n.value.dark)?"auto"===e?`@media(prefers-color-scheme:dark){body${ue}}`:`${e}${ue}`:!0===e?`:root${ue}`:"";var e}));let f;!function(t,n={}){const o=e.ref(!1),{document:l=H,immediate:r=!0,manual:a=!1,id:i="vueuse_styletag_"+ ++le}=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||E(u),e.readonly(o)}(h);const w=e=>{const{serverURL:t,path:l,pageSize:a}=n.value,i=new AbortController;r.value="loading",f?.(),(({serverURL:e,lang:t,path:n,page:o,pageSize:l,signal:r,token:a})=>{const i={};return a&&(i.Authorization=`Bearer ${a}`),fetch(`${e}/comment?path=${encodeURIComponent(n)}&pageSize=${l}&page=${o}&lang=${t}`,{signal:r,headers:i}).then((e=>e.json())).then((e=>we(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",m.value=t.count,v.value.push(...t.data),u.value=e,d.value=t.totalPages})).catch((e=>{"AbortError"!==e.name&&(console.error(e.message),r.value="error")})),f=i.abort.bind(i)},y=()=>{m.value=0,v.value=[],w(1)};return e.provide("config",n),e.watch((()=>t.path),y),e.onMounted((()=>y())),{config:n,darkmodeStyle:h,i18n:e.computed((()=>n.value.locale)),status:r,count:m,page:u,totalPages:d,data:v,reply:g,loadMore:()=>w(u.value+1),refresh:y,onReply:e=>{g.value=e},onSubmit:e=>{if(e.rid){const t=v.value.find((({objectId:t})=>t===e.rid));if(!t)return;Array.isArray(t.children)||(t.children=[]),t.children.push(e)}else v.value.unshift(e)},onStatusChange:async({comment:e,status:t})=>{if(e.status===t)return;const{serverURL:l,lang:r}=n.value;await ye({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}),v.value.some(((t,n)=>t.objectId===e?(v.value=v.value.filter(((e,t)=>t!==n)),!0):t.children.some(((o,l)=>o.objectId===e&&(v.value[n].children=t.children.filter(((e,t)=>t!==l)),!0)))))},onSticky:async e=>{if(e.rid)return;const{serverURL:t,lang:l}=n.value;await ye({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:fe,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.6.1"}}}),nn={"data-waline":""},on={class:"wl-count"},ln=["textContent"],rn={class:"wl-cards"},an={key:1,class:"wl-operation"},cn=["textContent"],sn={key:0,class:"wl-loading"},mn=["textContent"],un={class:"wl-operation"},dn=["textContent"],pn={key:3,class:"wl-power"},vn=e.createTextVNode(" Powered by "),gn=e.createElementVNode("a",{href:"https://github.com/walinejs/waline",target:"_blank",rel:"noreferrer"}," Waline ",-1);var hn=Me(tn,[["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",nn,[t.reply?e.createCommentVNode("v-if",!0):(e.openBlock(),e.createBlock(i,{key:0,onSubmit:t.onSubmit},null,8,["onSubmit"])),e.createElementVNode("div",on,[t.count?(e.openBlock(),e.createElementBlock("span",{key:0,class:"wl-num",textContent:e.toDisplayString(t.count)},null,8,ln)):e.createCommentVNode("v-if",!0),e.createTextVNode(" "+e.toDisplayString(t.i18n.comment),1)]),e.createElementVNode("div",rn,[(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",an,[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,cn)])):(e.openBlock(),e.createElementBlock(e.Fragment,{key:2},["loading"===t.status?(e.openBlock(),e.createElementBlock("div",sn,[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",un,[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,dn)])],2112)):e.createCommentVNode("v-if",!0):(e.openBlock(),e.createElementBlock("div",{key:1,class:"wl-empty",textContent:e.toDisplayString(t.i18n.sofa)},null,8,mn))],64)),e.createCommentVNode(" Copyright Information "),t.config.copyright?(e.openBlock(),e.createElementBlock("div",pn,[vn,gn,e.createTextVNode(" v"+e.toDisplayString(t.version),1)])):e.createCommentVNode("v-if",!0)])}],["__file","Waline.vue"]]);const fn=(e,t)=>{t.forEach(((t,n)=>{t.innerText=e[n].toString()}))},wn=({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=Le(e);return null!==n&&t!==n},c=n=>ke({serverURL:ce(e),paths:n.map((e=>Le(e)||t)),lang:l,signal:r.signal}).then((e=>fn(e,n))).catch(he);if(o){const n=a.filter((e=>!i(e))),o=a.filter(i);be({serverURL:ce(e),path:t,lang:l}).then((e=>fn(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=je(),r=Ce(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=>we(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=Ae,exports.defaultLocales=C,exports.init=({el:t="#waline",path:n=window.location.pathname,comment:o=!1,pageview:l=!1,...r})=>{const a=t?Ce(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=a?e.createApp((()=>e.h(hn,{path:c.path,...i}))):null;s&&s.mount(a);const m=e.watchEffect((()=>{c.comment&&Ae({serverURL:i.serverURL,path:c.path,selector:"string"==typeof c.comment?c.comment:void 0})})),u=e.watchEffect((()=>{c.pageview&&wn({serverURL:i.serverURL,path:c.path,selector:"string"==typeof c.pageview?c.pageview:void 0})}));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:()=>{s?.unmount(),m(),u()}}},exports.pageviewCount=wn,exports.version="2.6.1"; | ||
//# sourceMappingURL=shim.js.map |
{ | ||
"name": "@waline/client", | ||
"version": "2.6.0", | ||
"version": "2.6.1", | ||
"description": "client for waline comment system", | ||
@@ -76,7 +76,7 @@ "keywords": [ | ||
"autosize": "^5.0.1", | ||
"marked": "^4.0.16", | ||
"marked": "^4.0.17", | ||
"vue": "^3.2.37" | ||
}, | ||
"devDependencies": { | ||
"@babel/core": "7.18.2", | ||
"@babel/core": "7.18.5", | ||
"@babel/preset-env": "7.18.2", | ||
@@ -89,3 +89,3 @@ "@rollup/plugin-babel": "5.3.1", | ||
"@types/marked": "4.0.3", | ||
"@types/node": "17.0.41", | ||
"@types/node": "17.0.43", | ||
"@vitejs/plugin-vue": "2.3.3", | ||
@@ -98,3 +98,3 @@ "rimraf": "3.0.2", | ||
"typescript": "4.7.3", | ||
"vite": "2.9.10" | ||
"vite": "2.9.12" | ||
}, | ||
@@ -101,0 +101,0 @@ "engines": { |
@@ -100,3 +100,7 @@ import { | ||
void updatePageviews({ serverURL, path, lang }).then((count) => | ||
void updatePageviews({ | ||
serverURL: getServerURL(serverURL), | ||
path, | ||
lang, | ||
}).then((count) => | ||
renderVisitorCount( | ||
@@ -103,0 +107,0 @@ new Array<number>(normalElements.length).fill(count), |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
1643203
9078
Updatedmarked@^4.0.17