@shinigamidev/comment-client
Version:
client for waline comment system
10 lines • 61.6 kB
JavaScript
import{fetchCommentCount as zt,getArticleCounter as Tt,updateArticleCounter as Ke,updateComment as be,addComment as Pt,login as Vt,getComment as Bt,deleteComment as Ht,updatePageview as Nt,getPageview as Wt,getRecentComment as Dt,getUserList as Ft}from"@waline/api";export*from"@waline/api";import{h as y,defineComponent as fe,inject as je,ref as k,computed as W,onMounted as we,watch as ae,onUnmounted as Ze,openBlock as u,createElementBlock as g,createElementVNode as d,toDisplayString as L,Fragment as O,renderList as J,normalizeClass as H,createBlock as ee,createCommentVNode as b,onBeforeUnmount as Ot,nextTick as Xe,normalizeStyle as Je,reactive as Ae,withDirectives as _e,vModelText as Gt,vShow as Me,createVNode as q,createTextVNode as ne,resolveComponent as Ye,withCtx as qt,provide as Kt,createApp as Zt,watchEffect as Qe}from"vue";import*as $e from"vue-toastification";import Xt from"vue-toastification";import Jt from"vue-truncate-read-more";import{useStorage as ve,useScriptTag as Yt,useDebounceFn as Qt,useEventListener as et,useNow as $t,useStyleTag as en}from"@vueuse/core";import tt from"autosize";import{marked as tn,Marked as nn}from"marked";import{markedHighlight as on}from"marked-highlight";import{load as ln}from"recaptcha-v3";const an=["nick","mail","link"],nt=n=>n.filter(o=>an.includes(o)),ot=["//unpkg.com/@waline/emojis@1.1.0/weibo"],rn=["//unpkg.com/@waline/emojis/tieba/tieba_agree.png","//unpkg.com/@waline/emojis/tieba/tieba_look_down.png","//unpkg.com/@waline/emojis/tieba/tieba_sunglasses.png","//unpkg.com/@waline/emojis/tieba/tieba_pick_nose.png","//unpkg.com/@waline/emojis/tieba/tieba_awkward.png","//unpkg.com/@waline/emojis/tieba/tieba_sleep.png"],sn=n=>new Promise((o,t)=>{if(n.size>128e3)return t(new Error("File too large! File size limit 128KB"));const e=new FileReader;e.readAsDataURL(n),e.onload=()=>{var r;return o(((r=e.result)==null?void 0:r.toString())??"")},e.onerror=t}),cn=n=>n===!0?'<p class="wl-tex">TeX is not available in preview</p>':'<span class="wl-tex">TeX is not available in preview</span>',dn=n=>{const o=async(t,e={})=>fetch(`https://api.giphy.com/v1/gifs/${t}?${new URLSearchParams({lang:n,limit:"20",rating:"g",api_key:"6CIMLkNMMOhRcXPoMCPkFy4Ybk2XUiMp",...e}).toString()}`).then(r=>r.json()).then(({data:r})=>r.map(m=>({title:m.title,src:m.images.downsized_medium.url})));return{search:t=>o("search",{q:t,offset:"0"}),default:()=>o("trending",{}),more:(t,e=0)=>o("search",{q:t,offset:e.toString()})}},un=/[\u4E00-\u9FFF\u3400-\u4dbf\uf900-\ufaff\u3040-\u309f\uac00-\ud7af\u0400-\u04FF]+|\w+/,mn=/</,vn=/(?:^|\s)\/\/(.+?)$/gm,gn=/\/\*([\S\s]*?)\*\//gm,hn=new RegExp(`(${un.source}|${mn.source})|((?:${vn.source})|(?:${gn.source}))`,"gmi"),lt=["23AC69","91C132","F19726","E8552D","1AAB8E","E1147F","2980C1","1BA1E6","9FA0A0","F19726","E30B20","E30B20","A3338B"],Ue={},fn=n=>{let o=0;return n.replace(hn,(t,e,r)=>{if(r)return`<span style="color: slategray">${r}</span>`;if(e==="<")return"<";let m;Ue[e]?m=Ue[e]:(m=lt[o],Ue[e]=m);const c=`<span style="color: #${m}">${e}</span>`;return o=++o%lt.length,c})},wn=["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","profile","approved","waiting","spam","unsticky","oldest","latest","hottest","reactionTitle"],oe=n=>Object.fromEntries(n.map((o,t)=>[wn[t],o]));var yn=oe(["Benutzername","Der Benutzername darf nicht weniger als 3 Bytes umfassen.","E-Mail","Bitte bestätigen Sie Ihre E-Mail-Adresse.","Webseite","Optional","Kommentieren Sie hier...","Noch keine Kommentare.","Senden","Gefällt mir","Gefällt mir nicht mehr","Antworten","Antwort abbrechen","Kommentare","Aktualisieren","Mehr laden...","Vorschau","Emoji","Ein Bild hochladen","Vor einigen Sekunden","Vor einigen Minuten","Vor einigen Stunden","Vor einigen Tagen","Gerade eben","Hochladen läuft","Anmelden","Abmelden","Admin","Angeheftet","Wörter","Bitte geben Sie Kommentare zwischen $0 und $1 Wörtern ein! Aktuelle Anzahl der Wörter: $2","Anonym","Zwerge","Hobbits","Ents","Magier","Elfen","Maïar","GIF","Nach einem GIF suchen","Profil","Genehmigt","Ausstehend","Spam","Lösen","Älteste","Neueste","Am beliebtesten","Was denken Sie?"]),it=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!
Current word number: $2`,"Anonymous","Dwarves","Hobbits","Ents","Wizards","Elves","Maiar","GIF","Search GIF","Profile","Approved","Waiting","Spam","Unsticky","Oldest","Latest","Hottest","What do you think?"]),at=oe(["Pseudo","Le pseudo ne peut pas faire moins de 3 octets.","E-mail","Veuillez confirmer votre adresse e-mail.","Site Web","Optionnel","Commentez ici...","Aucun commentaire pour l'instant.","Envoyer","J'aime","Annuler le j'aime","Répondre","Annuler la réponse","Commentaires","Actualiser","Charger plus...","Aperçu","Emoji","Télécharger une image","Il y a quelques secondes","Il y a quelques minutes","Il y a quelques heures","Il y a quelques jours","À l'instant","Téléchargement en cours","Connexion","Déconnexion","Admin","Épinglé","Mots",`Veuillez saisir des commentaires entre $0 et $1 mots !
Nombre actuel de mots : $2`,"Anonyme","Nains","Hobbits","Ents","Mages","Elfes","Maïar","GIF","Rechercher un GIF","Profil","Approuvé","En attente","Indésirable","Détacher","Le plus ancien","Dernier","Le plus populaire","Qu'en pensez-vous ?"]),rt=oe(["ニックネーム","3バイト以上のニックネームをご入力ください.","メールアドレス","メールアドレスをご確認ください.","サイト","オプション","ここにコメント","コメントしましょう~","提出する","Like","Cancel like","返信する","キャンセル","コメント","更新","さらに読み込む","プレビュー","絵文字","画像をアップロード","秒前","分前","時間前","日前","たっだ今","アップロード","ログインする","ログアウト","管理者","トップに置く","ワード",`コメントは $0 から $1 ワードの間でなければなりません!
現在の単語番号: $2`,"匿名","うえにん","なかにん","しもおし","特にしもおし","かげ","なぬし","GIF","探す GIF","個人情報","承認済み","待っている","スパム","べたつかない","逆順","正順","人気順","どう思いますか?"]),pn=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úmero de palavras atuais: $2`,"Anônimo","Dwarves","Hobbits","Ents","Wizards","Elves","Maiar","GIF","Pesquisar GIF","informação pessoal","Aprovado","Espera","Spam","Unsticky","Mais velho","Mais recentes","Mais quente","O que você acha?"]),st=oe(["Псевдоним","Никнейм не может быть меньше 3 байт.","Эл. адрес","Пожалуйста, подтвердите адрес вашей электронной почты.","Веб-сайт","Необязательный","Комментарий здесь...","Пока нет комментариев.","Отправить","Like","Cancel like","Отвечать","Отменить ответ","Комментарии","Обновить","Загрузи больше...","Превью","эмодзи","Загрузить изображение","секунд назад","несколько минут назад","несколько часов назад","дней назад","прямо сейчас","Загрузка","Авторизоваться","Выход из системы","Админ","Липкий","Слова",`Пожалуйста, введите комментарии от $0 до $1 слов!
Номер текущего слова: $2`,"Анонимный","Dwarves","Hobbits","Ents","Wizards","Elves","Maiar","GIF","Поиск GIF","Персональные данные","Одобренный","Ожидающий","Спам","Нелипкий","самый старый","последний","самый горячий","Что вы думаете?"]),ct=oe(["Tên","Tên không được nhỏ hơn 3 ký tự.","E-Mail","Vui lòng xác nhập địa chỉ email của bạn.","Website","Tùy chọn","Hãy bình luận có văn hoá!","Chưa có bình luận","Gửi","Thích","Bỏ thích","Trả lời","Hủy bỏ","bình luận","Làm mới","Tải thêm...","Xem trước","Emoji","Tải lên hình ảnh","giây trước","phút trước","giờ trước","ngày trước","Vừa xong","Đang tải lên","Đăng nhập","đăng xuất","Quản trị viên","Dính","từ",`Bình luận phải có độ dài giữa $0 và $1 từ!
Số từ hiện tại: $2`,"Vô danh","Người lùn","Người tí hon","Thần rừng","Pháp sư","Tiên tộc","Maiar","Ảnh GIF","Tìm kiếm ảnh GIF","thông tin cá nhân","Đã được phê duyệt","Đang chờ đợi","Thư rác","Không dính","lâu đời nhất","muộn nhất","nóng nhất","What do you think?"]),dt=oe(["昵称","昵称不能少于3个字符","邮箱","请填写正确的邮件地址","网址","可选","欢迎评论","来发评论吧~","提交","喜欢","取消喜欢","回复","取消回复","评论","刷新","加载更多...","预览","表情","上传图片","秒前","分钟前","小时前","天前","刚刚","正在上传","登录","退出","博主","置顶","字",`评论字数应在 $0 到 $1 字之间!
当前字数:$2`,"匿名","潜水","冒泡","吐槽","活跃","话痨","传说","表情包","搜索表情包","个人资料","通过","待审核","垃圾","取消置顶","按倒序","按正序","按热度","你认为这篇文章怎么样?"]),kn=oe(["暱稱","暱稱不能少於3個字元","郵箱","請填寫正確的郵件地址","網址","可選","歡迎留言","來發留言吧~","送出","喜歡","取消喜歡","回覆","取消回覆","留言","重整","載入更多...","預覽","表情","上傳圖片","秒前","分鐘前","小時前","天前","剛剛","正在上傳","登入","登出","管理者","置頂","字",`留言字數應在 $0 到 $1 字之間!
目前字數:$2`,"匿名","潛水","冒泡","吐槽","活躍","多話","傳說","表情包","搜尋表情包","個人資料","通過","待審核","垃圾","取消置頂","最早","最新","熱門","你認為這篇文章怎麼樣?"]);const ut="en-US",Ce={zh:dt,"zh-cn":dt,"zh-tw":kn,en:it,"en-us":it,fr:at,"fr-fr":at,jp:rt,"jp-jp":rt,"pt-br":pn,ru:st,"ru-ru":st,vi:ct,"vi-vn":ct,de:yn},mt=n=>Ce[n.toLowerCase()]||Ce[ut.toLowerCase()],vt=n=>Object.keys(Ce).includes(n.toLowerCase())?n:ut,gt=n=>{try{n=decodeURI(n)}catch{}return n},ht=(n="")=>n.replace(/\/$/u,""),ft=n=>/^(https?:)?\/\//.test(n),Ie=n=>{const o=ht(n);return ft(o)?o:`https://${o}`},bn=n=>Array.isArray(n)?n:n?[0,n]:!1,ze=(n,o)=>typeof n=="function"?n:n===!1?!1:o,_n=({serverURL:n,path:o=location.pathname,lang:t=typeof navigator>"u"?"en-US":navigator.language,locale:e,emoji:r=ot,meta:m=["nick","mail","link"],requiredMeta:c=[],dark:s=!1,pageSize:i=10,wordLimit:l,imageUploader:a,highlighter:R,texRenderer:T,copyright:p=!0,login:_="enable",search:S,reaction:A,recaptchaV3Key:E="",turnstileKey:j="",commentSorting:G="latest",...N})=>({serverURL:Ie(n),path:gt(o),lang:vt(t),locale:{...mt(vt(t)),...typeof e=="object"?e:{}},wordLimit:bn(l),meta:nt(m),requiredMeta:nt(c),imageUploader:ze(a,sn),highlighter:ze(R,fn),texRenderer:ze(T,cn),dark:s,emoji:typeof r=="boolean"?r?ot:[]:r,pageSize:i,login:_,copyright:p,search:S===!1?!1:typeof S=="object"?S:dn(t),recaptchaV3Key:E,turnstileKey:j,reaction:Array.isArray(A)?A:A===!0?rn:[],commentSorting:G,...N}),ge=n=>typeof n=="string",Te="{--waline-white:#000;--waline-light-grey:#666;--waline-dark-grey:#999;--waline-color:#888;--waline-bg-color:#1e1e1e;--waline-bg-color-light:#272727;--waline-bg-color-hover: #444;--waline-border-color:#333;--waline-disable-bg-color:#444;--waline-disable-color:#272727;--waline-bq-color:#272727;--waline-info-bg-color:#272727;--waline-info-color:#666}",Cn=n=>ge(n)?n==="auto"?`@media(prefers-color-scheme:dark){body${Te}}`:`${n}${Te}`:n===!0?`:root${Te}`:"",Pe=(n,o)=>{let t=n.toString();for(;t.length<o;)t="0"+t;return t},In=n=>{const o=Pe(n.getDate(),2),t=Pe(n.getMonth()+1,2);return`${Pe(n.getFullYear(),2)}-${t}-${o}`},Ln=(n,o,t)=>{if(!n)return"";const e=ge(n)?new Date(n.indexOf(" ")!==-1?n.replace(/-/g,"/"):n):n,r=o.getTime()-e.getTime(),m=Math.floor(r/(24*3600*1e3));if(m===0){const c=r%864e5,s=Math.floor(c/(3600*1e3));if(s===0){const i=c%36e5,l=Math.floor(i/(60*1e3));if(l===0){const a=i%6e4;return`${Math.round(a/1e3)} ${t.seconds}`}return`${l} ${t.minutes}`}return`${s} ${t.hours}`}return m<0?t.now:m<8?`${m} ${t.days}`:In(e)},Sn=/^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$/,En=n=>Sn.test(n),Rn=n=>!!/@[0-9]+\.[0-9]+\.[0-9]+/.test(n),xn=n=>{const o=ve("WALINE_EMOJI",{}),t=Rn(n);if(t){const e=o.value[n];if(e)return Promise.resolve(e)}return fetch(`${n}/info.json`).then(e=>e.json()).then(e=>{const r={folder:n,...e};return t&&(o.value[n]=r),r})},wt=(n,o="",t="",e="")=>`${o?`${o}/`:""}${t}${n}${e?`.${e}`:""}`,jn=n=>Promise.all(n.map(o=>ge(o)?xn(ht(o)):Promise.resolve(o))).then(o=>{const t={tabs:[],map:{}};return o.forEach(e=>{const{name:r,folder:m,icon:c,prefix:s="",type:i,items:l}=e;t.tabs.push({name:r,icon:wt(c,m,s,i),items:l.map(a=>{const R=`${s}${a}`;return t.map[R]=wt(a,m,s,i),R})})}),t}),yt=n=>{n.name!=="AbortError"&&console.error(n.message)},Ve=n=>n instanceof HTMLElement?n:ge(n)?document.querySelector(n):null,An=n=>n.type.includes("image"),pt=n=>{const o=Array.from(n).find(An);return o?o.getAsFile():null},Mn=/\$.*?\$/,Un=/^\$(.*?)\$/,zn=/^(?:\s{0,3})\$\$((?:[^\n]|\n[^\n])+?)\n{0,1}\$\$/,Tn=n=>[{name:"blockMath",level:"block",tokenizer(o){const t=zn.exec(o);if(t!==null)return{type:"html",raw:t[0],text:n(!0,t[1])}}},{name:"inlineMath",level:"inline",start(o){const t=o.search(Mn);return t!==-1?t:o.length},tokenizer(o){const t=Un.exec(o);if(t!==null)return{type:"html",raw:t[0],text:n(!1,t[1])}}}],Pn=()=>[{name:"spoiler",level:"block",start(n){return n.indexOf("[spoiler]")},tokenizer(n){const o=/^\[spoiler\]([\s\S]+?)\[\/spoiler\]/.exec(n);if(o)return{type:"spoiler",raw:o[0],text:o[1].trim()}},renderer(n){return`<details><summary>Spoiler</summary>${tn(n.text)}</details>`}},{name:"inlinespoiler",level:"inline",start(n){return n.indexOf("!!")},tokenizer(n){const o=/^!!([^\s][^]*?[^\s])!!(?!\s)/,t=n.match(o);if(t)return{type:"inlinespoiler",raw:t[0],text:t[1].trim(),tokens:this.lexer.inlineTokens(t[1].trim())}},renderer(n){return`<span class="spoiler">${this.parser.parseInline(n.tokens)}</span>`}}],kt=(n="",o={})=>n.replace(/:(.+?):/g,(t,e)=>o[e]?`<img class="wl-emoji" src="${o[e]}" alt="${e}">`:t),Vn=(n,{emojiMap:o,highlighter:t,texRenderer:e})=>{const r=new nn;if(r.setOptions({breaks:!0}),t&&r.use(on({highlight:t})),e){const m=Tn(e);r.use({extensions:m})}return r.use({extensions:Pn()}),r.parse(kt(n,o))},Be=n=>{const{path:o}=n.dataset;return o!=null&&o.length?o:null},Bn=n=>n.match(/[\w\d\s,.\u00C0-\u024F\u0400-\u04FF]+/giu),Hn=n=>n.match(/[\u4E00-\u9FD5]/gu),Nn=n=>{var o,t;return(((o=Bn(n))==null?void 0:o.reduce((e,r)=>e+(["",",","."].includes(r.trim())?0:r.trim().split(/\s+/u).length),0))??0)+(((t=Hn(n))==null?void 0:t.length)??0)},Wn=async()=>{if(!navigator)return"";const{userAgentData:n}=navigator;let o=navigator.userAgent;if(!n||n.platform!=="Windows")return o;const{platformVersion:t}=await n.getHighEntropyValues(["platformVersion"]);return t&&parseInt(t.split(".")[0])>=13&&(o=o.replace("Windows NT 10.0","Windows NT 11.0")),o},bt=({serverURL:n,path:o=window.location.pathname,selector:t=".waline-comment-count",lang:e=navigator.language})=>{const r=new AbortController,m=document.querySelectorAll(t);return m.length&&zt({serverURL:Ie(n),paths:Array.from(m).map(c=>gt(Be(c)??o)),lang:e,signal:r.signal}).then(c=>{m.forEach((s,i)=>{s.innerText=c[i].toString()})}).catch(yt),r.abort.bind(r)},Dn=({size:n})=>y("svg",{class:"wl-close-icon",viewBox:"0 0 1024 1024",width:n,height:n},[y("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"}),y("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"})]),Fn=()=>y("svg",{viewBox:"0 0 24 24",width:"20",height:"20",fill:"none",stroke:"red","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",class:"lucide lucide-trash2-icon lucide-trash-2"},[y("path",{d:"M3 6h18"}),y("path",{d:"M19 6v14c0 1-1 2-2 2H7c-1 0-2-1-2-2V6"}),y("path",{d:"M8 6V4c0-1 1-2 2-2h4c1 0 2 1 2 2v2"}),y("line",{x1:"10",y1:"11",x2:"10",y2:"17"}),y("line",{x1:"14",y1:"11",x2:"14",y2:"17"})]),On=({size:n})=>y("svg",{viewBox:"0 0 640 512",width:n,height:n,xmlns:"http://www.w3.org/2000/svg"},y("path",{fill:"currentColor",d:"M38.8 5.1C28.4-3.1 13.3-1.2 5.1 9.2S-1.2 34.7 9.2 42.9l592 464c10.4 8.2 25.5 6.3 33.7-4.1s6.3-25.5-4.1-33.7L525.6 386.7c39.6-40.6 66.4-86.1 79.9-118.4c3.3-7.9 3.3-16.7 0-24.6c-14.9-35.7-46.2-87.7-93-131.1C465.5 68.8 400.8 32 320 32c-68.2 0-125 26.3-169.3 60.8L38.8 5.1zm151 118.3C226 97.7 269.5 80 320 80c65.2 0 118.8 29.6 159.9 67.7C518.4 183.5 545 226 558.6 256c-12.6 28-36.6 66.8-70.9 100.9l-53.8-42.2c9.1-17.6 14.2-37.5 14.2-58.7c0-70.7-57.3-128-128-128c-32.2 0-61.7 11.9-84.2 31.5l-46.1-36.1zM394.9 284.2l-81.5-63.9c4.2-8.5 6.6-18.2 6.6-28.3c0-5.5-.7-10.9-2-16c.7 0 1.3 0 2 0c44.2 0 80 35.8 80 80c0 9.9-1.8 19.4-5.1 28.2zm51.3 163.3l-41.9-33C378.8 425.4 350.7 432 320 432c-65.2 0-118.8-29.6-159.9-67.7C121.6 328.5 95 286 81.4 256c8.3-18.4 21.5-41.5 39.4-64.8L83.1 161.5C60.3 191.2 44 220.8 34.5 243.7c-3.3 7.9-3.3 16.7 0 24.6c14.9 35.7 46.2 87.7 93 131.1C174.5 443.2 239.2 480 320 480c47.8 0 89.9-12.9 126.2-32.5zm-88-69.3L302 334c-23.5-5.4-43.1-21.2-53.7-42.3l-56.1-44.2c-.2 2.8-.3 5.6-.3 8.5c0 70.7 57.3 128 128 128c13.3 0 26.1-2 38.2-5.8z"})),Gn=()=>y("svg",{viewBox:"0 0 1024 1024",width:"24",height:"24"},y("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"})),qn=()=>y("svg",{viewBox:"0 0 1024 1024",width:"24",height:"24"},[y("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"}),y("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"})]),Kn=({active:n=!1})=>y("svg",{viewBox:"0 0 24 24",width:"20",height:"20",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",class:"lucide lucide-thumbs-up-icon lucide-thumbs-up"},[y("path",{d:"M15 5.88 14 10h5.83a2 2 0 0 1 1.92 2.56l-2.33 8A2 2 0 0 1 17.5 22H4a2 2 0 0 1-2-2v-8a2 2 0 0 1 2-2h2.76a2 2 0 0 0 1.79-1.11L12 2a3.13 3.13 0 0 1 3 3.88Z",fill:n?"currentColor":""}),y("path",{d:"M7 10v12"})]),Zn=()=>y("svg",{viewBox:"0 0 1024 1024",width:"24",height:"24"},[y("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"}),y("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"})]),Xn=()=>y("svg",{viewBox:"0 0 24 24",width:"20",height:"20",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",class:"lucide lucide-square-pen-icon lucide-square-pen"},[y("path",{d:"M12 3H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7"}),y("path",{d:"M18.375 2.625a1 1 0 0 1 3 3l-9.013 9.014a2 2 0 0 1-.853.505l-2.873.84a.5.5 0 0 1-.62-.62l.84-2.873a2 2 0 0 1 .506-.852z"})]),Jn=()=>y("svg",{class:"verified-icon",viewBox:"0 0 1024 1024",width:"14",height:"14"},y("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"})),Yn=()=>y("svg",{class:"lucide lucide-pin-icon lucide-pin",viewBox:"0 0 24 24",width:"20",height:"20",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"},[y("path",{d:"M12 17v5"}),y("path",{d:"M9 10.76a2 2 0 0 1-1.11 1.79l-1.78.9A2 2 0 0 0 5 15.24V16a1 1 0 0 0 1 1h12a1 1 0 0 0 1-1v-.76a2 2 0 0 0-1.11-1.79l-1.78-.9A2 2 0 0 1 15 10.76V7a1 1 0 0 1 1-1 2 2 0 0 0 0-4H8a2 2 0 0 0 0 4 1 1 0 0 1 1 1z"})]),Le=({size:n=100})=>y("svg",{width:n,height:n,viewBox:"0 0 100 100",preserveAspectRatio:"xMidYMid"},y("circle",{cx:50,cy:50,fill:"none",stroke:"currentColor",strokeWidth:"4",r:"40","stroke-dasharray":"85 30"},y("animateTransform",{attributeName:"transform",type:"rotate",repeatCount:"indefinite",dur:"1s",values:"0 50 50;360 50 50",keyTimes:"0;1"}))),Qn=()=>y("svg",{width:24,height:24,fill:"currentcolor",viewBox:"0 0 24 24"},[y("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"}),y("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"})]),$n=()=>y("svg",{width:20,height:20,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor","stroke-width":2,"stroke-linecap":"round","stroke-linejoin":"round",class:"lucide lucide-chevron-down-icon lucide-chevron-down"},y("path",{d:"m6 9 6 6 6-6"})),eo=()=>y("svg",{width:20,height:20,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor","stroke-width":2,"stroke-linecap":"round","stroke-linejoin":"round",class:"lucide lucide-chevron-down-icon lucide-chevron-down"},y("path",{d:"m18 15-6-6-6 6"})),to=()=>ve("WALINE_USER_META",{nick:"",mail:"",link:""}),no=()=>ve("WALINE_COMMENT_BOX_EDITOR",""),oo="WALINE_LIKE";let _t=null;const Ct=()=>_t??(_t=ve(oo,[])),lo="WALINE_REACTION";let It=null;const io=()=>It??(It=ve(lo,{})),Lt={},ao=n=>{const o=Lt[n]??(Lt[n]=ln(n,{useRecaptchaNet:!0,autoHideBadge:!0}));return{execute:t=>o.then(e=>e.execute(t))}},ro=n=>({execute:async o=>{const{load:t}=Yt("https://challenges.cloudflare.com/turnstile/v0/api.js",void 0,{async:!1});await t();const e=window==null?void 0:window.turnstile;return new Promise(r=>{e==null||e.ready(()=>{e==null||e.render(".wl-captcha-container",{sitekey:n,action:o,size:"compact",callback:r})})})}}),so="WALINE_USER";let St=null;const Se=()=>St??(St=ve(so,{}));var co=fe({__name:"ArticleReaction",setup(n,{expose:o}){o();const t=io(),e=je("config"),r=k(-1),m=k([]),c=k(0),s=W(()=>e.value.locale),i=W(()=>e.value.reaction.length>0),l=W(()=>{const{reaction:_,path:S}=e.value;return _.map((A,E)=>({icon:A,desc:s.value[`reaction${E}`],active:t.value[S]===E}))});let a;const R=async()=>{if(!i.value)return;const{serverURL:_,lang:S,path:A,reaction:E}=e.value,j=new AbortController;a=j.abort.bind(j);const G=await Tt({serverURL:_,lang:S,paths:[A],type:E.map((N,Z)=>`reaction${Z}`),signal:j.signal});m.value=E.map((N,Z)=>G[0][`reaction${Z}`]),c.value=G[0].totalReaction},T=async _=>{if(r.value===-1){const{serverURL:S,lang:A,path:E}=e.value,j=t.value[E];r.value=_,j!==void 0&&(await Ke({serverURL:S,lang:A,path:E,type:`reaction${j}`,action:"desc"}),m.value[j]=Math.max(m.value[j]-1,0)),j!==_&&(await Ke({serverURL:S,lang:A,path:E,type:`reaction${_}`}),m.value[_]=(m.value[_]||0)+1),c.value=m.value.reduce((G,N)=>G+N,0),j===_?delete t.value[E]:t.value[E]=_,r.value=-1}};we(()=>{ae(()=>[e.value.serverURL,e.value.path],()=>{R()},{immediate:!0})}),Ze(()=>a==null?void 0:a());const p={reactionStorage:t,config:e,votingIndex:r,voteNumbers:m,totalReaction:c,locale:s,isReactionEnabled:i,reactionsInfo:l,get abort(){return a},set abort(_){a=_},fetchReaction:R,vote:T,get LoadingIcon(){return Le}};return Object.defineProperty(p,"__isScriptSetup",{enumerable:!1,value:!0}),p}}),ye=(n,o)=>{const t=n.__vccOpts||n;for(const[e,r]of o)t[e]=r;return t};const uo={key:0,class:"wl-reaction"},mo=["textContent"],vo=["textContent"],go={class:"wl-reaction-list"},ho=["onClick"],fo={class:"wl-reaction-img"},wo=["src","alt"],yo=["textContent"],po=["textContent"];function ko(n,o,t,e,r,m){return e.reactionsInfo.length?(u(),g("div",uo,[d("div",{class:"wl-reaction-title",textContent:L(e.locale.reactionTitle)},null,8,mo),d("div",{class:"wl-reaction-respons",textContent:L(`${e.totalReaction} Reactions`)},null,8,vo),d("ul",go,[(u(!0),g(O,null,J(e.reactionsInfo,({active:c,icon:s,desc:i},l)=>(u(),g("li",{key:l,class:H(["wl-reaction-item",{active:c}]),onClick:a=>e.vote(l)},[d("div",fo,[d("img",{src:s,alt:i},null,8,wo),e.votingIndex===l?(u(),ee(e.LoadingIcon,{key:0,class:"wl-reaction-loading"})):(u(),g("div",{key:1,class:"wl-reaction-votes",textContent:L(e.voteNumbers[l]||0)},null,8,yo))]),d("div",{class:"wl-reaction-text",textContent:L(i)},null,8,po)],10,ho))),128))])])):b("v-if",!0)}var bo=ye(co,[["render",ko],["__file","ArticleReaction.vue"]]),_o=fe({__name:"ImageWall",props:{items:{default:()=>[]},columnWidth:{default:300},gap:{default:0}},emits:["insert"],setup(n,{expose:o}){const t=n;o();let e=null;const r=k(null),m=k({}),c=k([]),s=()=>{const p=Math.floor((r.value.getBoundingClientRect().width+t.gap)/(t.columnWidth+t.gap));return p>0?p:1},i=p=>new Array(p).fill(null).map(()=>[]),l=async p=>{var _;if(p>=t.items.length)return;await Xe();const S=Array.from(((_=r.value)==null?void 0:_.children)??[]).reduce((A,E)=>E.getBoundingClientRect().height<A.getBoundingClientRect().height?E:A);c.value[Number(S.dataset.index)].push(p),await l(p+1)},a=async(p=!1)=>{if(c.value.length===s()&&!p)return;c.value=i(s());const _=window.scrollY;await l(0),window.scrollTo({top:_})},R=p=>{m.value[p.target.src]=!0};we(()=>{a(!0),e=new ResizeObserver(()=>{a()}),e.observe(r.value),ae(()=>[t.items],()=>{m.value={},a(!0)}),ae(()=>[t.columnWidth,t.gap],()=>{a()})}),Ot(()=>e.unobserve(r.value));const T={props:t,get resizeObserver(){return e},set resizeObserver(p){e=p},wall:r,state:m,columns:c,getColumnCount:s,createColumns:i,fillColumns:l,redraw:a,imageLoad:R,get LoadingIcon(){return Le}};return Object.defineProperty(T,"__isScriptSetup",{enumerable:!1,value:!0}),T}});const Co=["data-index"],Io=["src","title","onClick"];function Lo(n,o,t,e,r,m){return u(),g("div",{ref:"wall",class:"wl-gallery",style:Je({gap:`${t.gap}px`})},[(u(!0),g(O,null,J(e.columns,(c,s)=>(u(),g("div",{key:s,class:"wl-gallery-column","data-index":s,style:Je({gap:`${t.gap}px`})},[(u(!0),g(O,null,J(c,i=>(u(),g(O,{key:i},[e.state[t.items[i].src]?b("v-if",!0):(u(),ee(e.LoadingIcon,{key:0,size:36,style:{margin:"20px auto"}})),d("img",{class:"wl-gallery-item",src:t.items[i].src,title:t.items[i].title,loading:"lazy",onLoad:e.imageLoad,onClick:l=>n.$emit("insert",``)},null,40,Io)],64))),128))],12,Co))),128))],4)}var So=ye(_o,[["render",Lo],["__file","ImageWall.vue"]]),Eo=fe({__name:"CommentBox",props:{edit:{default:null},rootId:{default:""},replyId:{default:""},replyUser:{default:""}},emits:["log","cancelEdit","cancelReply","submit"],setup(n,{expose:o,emit:t}){o();const e=n,r=t,{useToast:m}=$e,c=m(),s=je("config"),i=no(),l=to(),a=Se(),R=k({}),T=k(null),p=k(null),_=k(null),S=k(null),A=k(null),E=k(null),j=k(null),G=k({tabs:[],map:{}}),N=k(0),Z=k(!1),re=k(!1),le=k(!1),z=k(""),ue=k(0),D=Ae({loading:!0,list:[]}),se=k(0),Y=k(!1),he=k(""),ie=k(!1),me=k(!1),ce=W(()=>s.value.locale),Ee=W(()=>{var v;return!!((v=a.value)!=null&&v.token)}),de=W(()=>s.value.imageUploader!==!1),f=v=>{const h=T.value,w=h.selectionStart,x=h.selectionEnd||0,F=h.scrollTop;i.value=h.value.substring(0,w)+v+h.value.substring(x,h.value.length),h.focus(),h.selectionStart=w+v.length,h.selectionEnd=w+v.length,h.scrollTop=F},C=()=>{const v=T.value,h=v.selectionStart,w=v.selectionEnd,x=v.value,F=x.substring(0,h),X=x.substring(w,x.length),V=x.substring(h,w),$=`${F}[spoiler]${V}[/spoiler]${X}`;i.value=$,v.focus(),v.selectionStart=h+9,v.selectionEnd=w+9},U=v=>{const h=v.key;(v.ctrlKey||v.metaKey)&&h==="Enter"&&Q()},M=v=>{const h=`![${s.value.locale.uploading} ${v.name}]()`;return f(h),ie.value=!0,Promise.resolve().then(()=>s.value.imageUploader(v)).then(w=>{i.value=i.value.replace(h,`\r
`)}).catch(w=>{c.error(w.message),i.value=i.value.replace(h,"")}).then(()=>{ie.value=!1})},P=v=>{var h;if((h=v.dataTransfer)!=null&&h.items){const w=pt(v.dataTransfer.items);w&&de.value&&(M(w),v.preventDefault())}},K=v=>{if(v.clipboardData){const h=pt(v.clipboardData.items);h&&de.value&&M(h)}},I=()=>{const v=p.value;v.files&&de.value&&M(v.files[0]).then(()=>{v.value=""})},Q=async()=>{var v,h,w,x,F,X;const{serverURL:V,lang:$,login:pe,wordLimit:Fe,requiredMeta:Oe,recaptchaV3Key:Ge,turnstileKey:qe}=s.value,Ut=await Wn(),B={comment:he.value,nick:l.value.nick,mail:l.value.mail,link:l.value.link,url:s.value.path,ua:Ut};if(!e.edit)if((v=a.value)!=null&&v.token)B.nick=a.value.display_name,B.mail=a.value.email,B.link=a.value.url;else{if(pe==="force")return;if(Oe.indexOf("nick")>-1&&!B.nick){(h=R.value.nick)==null||h.focus(),c.error(ce.value.nickError);return}if(Oe.indexOf("mail")>-1&&!B.mail||B.mail&&!En(B.mail)){(w=R.value.mail)==null||w.focus(),c.error(ce.value.mailError);return}B.nick||(B.nick=ce.value.anonymous)}if(!B.comment){(x=T.value)==null||x.focus();return}if(!Y.value){c.error(ce.value.wordHint.replace("$0",Fe[0].toString()).replace("$1",Fe[1].toString()).replace("$2",ue.value.toString()));return}B.comment=kt(B.comment,G.value.map),e.replyId&&e.rootId&&(B.pid=e.replyId,B.rid=e.rootId,B.at=e.replyUser),ie.value=!0;try{Ge&&(B.recaptchaV3=await ao(Ge).execute("social")),qe&&(B.turnstile=await ro(qe).execute("social"));const ke={serverURL:V,lang:$,token:(F=a.value)==null?void 0:F.token,comment:B},te=await(e.edit?be({objectId:e.edit.objectId,...ke}):Pt(ke));if(ie.value=!1,typeof te.errno>"u"&&te.success===!1){c.error(te.message),xe();return}if(te.errno==1001){c.error(te.errmsg),xe();return}if(te.errmsg){if(te.errno===401){c.info("Login dulu tong!");return}c.error(te.errmsg);return}r("submit",te.data),i.value="",z.value="",await Xe(),e.replyId&&r("cancelReply"),(X=e.edit)!=null&&X.objectId&&r("cancelEdit")}catch(ke){ie.value=!1,c.error(ke.message)}},He=v=>{const h=(window.innerWidth-450)/2,w=(window.innerHeight-450)/2,x=window.open(`${v}/oauth?type=google&redirect=/ui/profile`,"_blank",`width=450,height=450,left=${h},top=${w},scrollbars=no,resizable=no,status=no,location=no,toolbar=no,menubar=no`);return new Promise(F=>{const X=({data:V})=>{!V||typeof V!="object"||V.type!=="userInfo"||V.data.token&&(x==null||x.close(),window.removeEventListener("message",X),F(V.data))};window.addEventListener("message",X)})},Re=v=>{v.preventDefault();const{lang:h,serverURL:w}=s.value;Vt({serverURL:w,lang:h}).then(x=>{a.value=x,(x.remember?localStorage:sessionStorage).setItem("WALINE_USER",JSON.stringify(x)),r("log")})},xe=()=>{a.value={},localStorage.setItem("WALINE_USER","null"),sessionStorage.setItem("WALINE_USER","null"),r("log")},At=v=>{v.preventDefault();const{lang:h,serverURL:w}=s.value,x=800,F=800,X=(window.innerWidth-x)/2,V=(window.innerHeight-F)/2,$=new URLSearchParams({lng:h,token:a.value.token}),pe=window.open(`${w}/ui/profile?${$.toString()}`,"_blank",`width=${x},height=${F},left=${X},top=${V},scrollbars=no,resizable=no,status=no,location=no,toolbar=no,menubar=no`);pe==null||pe.postMessage({type:"TOKEN",data:a.value.token},"*")},Ne=v=>{var h,w,x,F;!((h=_.value)!=null&&h.contains(v.target))&&!((w=S.value)!=null&&w.contains(v.target))&&(Z.value=!1),!((x=A.value)!=null&&x.contains(v.target))&&!((F=E.value)!=null&&F.contains(v.target))&&(re.value=!1)},We=async v=>{var h;const{scrollTop:w,clientHeight:x,scrollHeight:F}=v.target,X=(x+w)/F,V=s.value.search,$=((h=j.value)==null?void 0:h.value)??"";X<.9||D.loading||me.value||(D.loading=!0,(V.more&&D.list.length?await V.more($,D.list.length):await V.search($)).length?D.list=[...D.list,...V.more&&D.list.length?await V.more($,D.list.length):await V.search($)]:me.value=!0,D.loading=!1,setTimeout(()=>{v.target.scrollTop=w},50))},Mt=Qt(v=>{D.list=[],me.value=!1,We(v)},300);ae([s,ue],([v,h])=>{const{wordLimit:w}=v;w?h<w[0]&&w[0]!==0?(se.value=w[0],Y.value=!1):h>w[1]?(se.value=w[1],Y.value=!1):(se.value=w[1],Y.value=!0):(se.value=0,Y.value=!0)},{immediate:!0}),et("click",Ne),et("message",({data:v})=>{!v||v.type!=="profile"||(a.value={...a.value,...v.data},[localStorage,sessionStorage].filter(h=>h.getItem("WALINE_USER")).forEach(h=>h.setItem("WALINE_USER",JSON.stringify(a))))}),ae(re,async v=>{var h;if(!v)return;const w=s.value.search;j.value&&(j.value.value=""),D.loading=!0,D.list=await(((h=w.default)==null?void 0:h.call(w))??w.search("")),D.loading=!1}),we(()=>{var v;(v=e.edit)!=null&&v.objectId&&(i.value=e.edit.orig),ae(()=>i.value,h=>{const{highlighter:w,texRenderer:x}=s.value;he.value=h,z.value=Vn(h,{emojiMap:G.value.map,highlighter:w,texRenderer:x}),ue.value=Nn(h),h?tt(T.value):tt.destroy(T.value)},{immediate:!0}),ae(()=>s.value.emoji,h=>jn(h).then(w=>{G.value=w}),{immediate:!0})});const De={props:e,emit:r,useToast:m,toast:c,config:s,editor:i,userMeta:l,userInfo:a,inputRefs:R,editorRef:T,imageUploadRef:p,emojiButtonRef:_,emojiPopupRef:S,gifButtonRef:A,gifPopupRef:E,gifSearchInputRef:j,emoji:G,emojiTabIndex:N,showEmoji:Z,showGif:re,showPreview:le,previewText:z,wordNumber:ue,searchResults:D,wordLimit:se,isWordNumberLegal:Y,content:he,isSubmitting:ie,isImageListEnd:me,locale:ce,isLogin:Ee,canUploadImage:de,insert:f,addSpoilerTag:C,onKeyDown:U,uploadImage:M,onDrop:P,onPaste:K,onChange:I,submitComment:Q,customLogin:He,onLogin:Re,onLogout:xe,onProfile:At,popupHandler:Ne,onImageWallScroll:We,onGifSearch:Mt,get CloseIcon(){return Dn},get EmojiIcon(){return Gn},get GifIcon(){return Qn},get ImageIcon(){return qn},get LoadingIcon(){return Le},get PreviewIcon(){return Zn},get SpoilerIcon(){return On},ImageWall:So};return Object.defineProperty(De,"__isScriptSetup",{enumerable:!1,value:!0}),De}});const Ro={key:0,class:"",style:{margin:"0.5em",position:"relative",display:"flex","justify-content":"space-between","align-items":"center"}},xo={style:{display:"flex","justify-content":"space-between","align-items":"center"}},jo={class:"wl-avatar-custom"},Ao=["title"],Mo=["src"],Uo=["textContent"],zo=["title"],To=["title"],Po={class:"wl-comment"},Vo={class:"wl-panel"},Bo=["placeholder"],Ho={class:"wl-preview"},No=d("hr",null,null,-1),Wo=["innerHTML"],Do={class:"wl-footer"},Fo={class:"wl-actions"},Oo=["title"],Go=["title"],qo=["title","aria-label"],Ko=["title"],Zo={class:"wl-info"},Xo=d("div",{class:"wl-captcha-container"},null,-1),Jo={class:"wl-text-number"},Yo={key:0},Qo=["textContent"],$o=["textContent"],el=["disabled"],tl=["placeholder"],nl={key:1,class:"wl-loading"},ol={key:0,class:"wl-tab-wrapper"},ll=["title","onClick"],il=["src","alt"],al={key:0,class:"wl-tabs"},rl=["onClick"],sl=["src","alt","title"],cl=["title"];function dl(n,o,t,e,r,m){var c,s;return u(),g("div",{key:e.userInfo.token},[e.config.login!=="disable"&&e.isLogin&&!((c=t.edit)!=null&&c.objectId)&&!t.replyId?(u(),g("div",Ro,[d("div",xo,[d("div",jo,[d("a",{href:"#",class:"wl-login-nick","aria-label":"Profile",title:e.locale.profile},[d("img",{src:e.userInfo.avatar,alt:"avatar"},null,8,Mo)],8,Ao)]),d("span",{style:{"margin-left":"0.5em","font-weight":"bold","font-size":"0.875em","line-height":"1",color:"var(--waline-dark-grey)"},textContent:L(e.userInfo.display_name)},null,8,Uo)]),d("div",null,[d("a",{href:"#",class:"","aria-label":"Profile",title:e.locale.profile,onClick:e.onProfile,textContent:"Edit Profile"},null,8,zo),d("a",{href:"#",class:"",style:{"margin-left":"0.5em"},"aria-label":"Logout",title:e.locale.logout,onClick:e.onLogout,textContent:"Logout"},null,8,To)])])):b("v-if",!0),d("div",Po,[d("div",Vo,[_e(d("textarea",{id:"wl-edit",ref:"editorRef","onUpdate:modelValue":o[0]||(o[0]=i=>e.editor=i),class:"wl-editor",placeholder:t.replyUser?`@${t.replyUser}`:e.locale.placeholder,onKeydown:e.onKeyDown,onDrop:e.onDrop,onPaste:e.onPaste},null,40,Bo),[[Gt,e.editor]]),_e(d("div",Ho,[No,d("h4",null,L(e.locale.preview)+":",1),d("div",{class:"wl-content",innerHTML:e.previewText},null,8,Wo)],512),[[Me,e.showPreview]]),d("div",Do,[d("div",Fo,[_e(d("button",{ref:"emojiButtonRef",type:"button",class:H(["wl-action",{active:e.showEmoji}]),title:e.locale.emoji,onClick:o[1]||(o[1]=i=>e.showEmoji=!e.showEmoji)},[q(e.EmojiIcon)],10,Oo),[[Me,e.emoji.tabs.length]]),e.config.search?(u(),g("button",{key:0,ref:"gifButtonRef",type:"button",class:H(["wl-action",{active:e.showGif}]),title:e.locale.gif,onClick:o[2]||(o[2]=i=>e.showGif=!e.showGif)},[q(e.GifIcon)],10,Go)):b("v-if",!0),d("input",{id:"wl-image-upload",ref:"imageUploadRef",class:"upload","aria-hidden":"true",type:"file",accept:".png,.jpg,.jpeg,.webp,.bmp,.gif",onChange:e.onChange},null,544),e.canUploadImage?(u(),g("label",{key:1,for:"wl-image-upload",class:"wl-action",title:e.locale.uploadImage,"aria-label":e.locale.uploadImage},[q(e.ImageIcon)],8,qo)):b("v-if",!0),d("button",{type:"button",class:H(["wl-action",{active:e.showPreview}]),title:e.locale.preview,onClick:o[3]||(o[3]=i=>e.showPreview=!e.showPreview)},[q(e.PreviewIcon)],10,Ko),d("button",{type:"button",class:"wl-action",title:"Spoiler",onClick:e.addSpoilerTag},[q(e.SpoilerIcon,{size:24})])]),d("div",Zo,[Xo,d("div",Jo,[ne(L(e.wordNumber)+" ",1),e.config.wordLimit?(u(),g("span",Yo,[ne(" / "),d("span",{class:H({illegal:!e.isWordNumberLegal}),textContent:L(e.wordLimit)},null,10,Qo)])):b("v-if",!0),ne(" "+L(e.locale.word),1)]),e.config.login!=="disable"&&!e.isLogin?(u(),g("button",{key:0,type:"button",class:"wl-btn",onClick:e.onLogin,textContent:L(e.locale.login)},null,8,$o)):b("v-if",!0),e.config.login!=="force"||e.isLogin?(u(),g("button",{key:1,type:"submit",class:"primary wl-btn",title:"Cmd|Ctrl + Enter",disabled:e.isSubmitting,onClick:e.submitComment},[e.isSubmitting?(u(),ee(e.LoadingIcon,{key:0,size:16})):(u(),g(O,{key:1},[ne(L(e.locale.submit),1)],64))],8,el)):b("v-if",!0)]),d("div",{ref:"gifPopupRef",class:H(["wl-gif-popup",{display:e.showGif}])},[d("input",{ref:"gifSearchInputRef",type:"text",placeholder:e.locale.gifSearchPlaceholder,onInput:o[4]||(o[4]=(...i)=>e.onGifSearch&&e.onGifSearch(...i))},null,40,tl),e.searchResults.list.length?(u(),ee(e.ImageWall,{key:0,items:e.searchResults.list,"column-width":200,gap:6,onInsert:o[5]||(o[5]=i=>e.insert(i)),onScroll:e.onImageWallScroll},null,8,["items"])):b("v-if",!0),e.searchResults.loading?(u(),g("div",nl,[q(e.LoadingIcon,{size:30})])):b("v-if",!0)],2),d("div",{ref:"emojiPopupRef",class:H(["wl-emoji-popup",{display:e.showEmoji}])},[(u(!0),g(O,null,J(e.emoji.tabs,(i,l)=>(u(),g(O,{key:i.name},[l===e.emojiTabIndex?(u(),g("div",ol,[(u(!0),g(O,null,J(i.items,a=>(u(),g("button",{key:a,type:"button",title:a,onClick:R=>e.insert(`:${a}:`)},[e.showEmoji?(u(),g("img",{key:0,class:"wl-emoji",src:e.emoji.map[a],alt:a,loading:"lazy",referrerPolicy:"no-referrer"},null,8,il)):b("v-if",!0)],8,ll))),128))])):b("v-if",!0)],64))),128)),e.emoji.tabs.length>1?(u(),g("div",al,[(u(!0),g(O,null,J(e.emoji.tabs,(i,l)=>(u(),g("button",{key:i.name,type:"button",class:H(["wl-tab",{active:e.emojiTabIndex===l}]),onClick:a=>e.emojiTabIndex=l},[d("img",{class:"wl-emoji",src:i.icon,alt:i.name,title:i.name,loading:"lazy",referrerPolicy:"no-referrer"},null,8,sl)],10,rl))),128))])):b("v-if",!0)],2)])]),t.replyId||(s=t.edit)!=null&&s.objectId?(u(),g("button",{key:0,type:"button",class:"wl-close",title:e.locale.cancelReply,onClick:o[6]||(o[6]=i=>t.replyId?e.emit("cancelReply"):e.emit("cancelEdit"))},[q(e.CloseIcon,{size:24})],8,cl)):b("v-if",!0)])])}var Et=ye(Eo,[["render",dl],["__file","CommentBox.vue"]]),ul=fe({__name:"CommentCard",props:{comment:{},edit:{default:null},rootId:{},reply:{default:null}},emits:["log","submit","delete","edit","like","status","sticky","reply","banned"],setup(n,{expose:o,emit:t}){o();const e=n,r=t,m=["approved","waiting","spam"],c=je("config"),s=Ct(),i=$t(),l=Se(),a=W(()=>c.value.locale),R=W(()=>{const{link:z}=e.comment;return z?ft(z)?z:`https://${z}`:""}),T=W(()=>s.value.includes(e.comment.objectId)),p=W(()=>Ln(new Date(e.comment.time),i.value,a.value)),_=W(()=>l.value.type==="administrator"),S=W(()=>e.comment.user_id&&l.value.objectId===e.comment.user_id),A=W(()=>{var z;return e.comment.objectId===((z=e.reply)==null?void 0:z.objectId)}),E=W(()=>{var z;return e.comment.objectId===((z=e.edit)==null?void 0:z.objectId)}),j=k(!1);function G(){}function N(z){r("submit",z)}function Z(z){r("edit",z)}function re(z){r("reply",A.value?null:z),j.value=!0}we(()=>{});const le={props:e,emit:r,commentStatus:m,config:c,likes:s,now:i,userInfo:l,locale:a,link:R,like:T,time:p,isAdmin:_,isOwner:S,isReplyingCurrent:A,isEditingCurrent:E,showReplies:j,init:G,onSubmit:N,onEdit:Z,onReply:re,CommentBox:Et,get DeleteIcon(){return Fn},get EditIcon(){return Xn},get LikeIcon(){return Kn},get ChevronDownIcon(){return $n},get ChevronUpIcon(){return eo},get VerifiedIcon(){return Jn},get StickyIcon(){return Yn}};return Object.defineProperty(le,"__isScriptSetup",{enumerable:!1,value:!0}),le}});const ml=["id"],vl={key:0,style:{"z-index":"1",top:"-10px",position:"absolute",opacity:"70%"}},gl={class:"wl-user","aria-hidden":"true"},hl=["src"],fl={class:"wl-head"},wl=["href"],yl=["textContent"],pl=["textContent"],kl=["textContent"],bl=["textContent"],_l={class:"wl-meta","aria-hidden":"true"},Cl=["data-value","textContent"],Il={key:0,class:"wl-content"},Ll={key:0},Sl=["href"],El=d("span",null,": ",-1),Rl=["innerHTML"],xl={style:{display:"flex","justify-content":"space-between","align-items":"center"}},jl={key:0,class:"wl-comment-actions"},Al=["title"],Ml={style:{display:"flex","flex-direction":"row",gap:"0.25em"}},Ul=["title"],zl=d("span",null,"Reply",-1),Tl=[zl],Pl={key:1,class:"wl-admin-actions",style:{display:"flex","justify-content":"space-between","align-items":"center",gap:"0.5em"}},Vl={class:"dropdown"},Bl=d("summary",{role:"button"},[d("a",{class:"button"},[d("svg",{width:"24",height:"24",viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg"},[d("path",{d:"M7 12C7 13.1046 6.10457 14 5 14C3.89543 14 3 13.1046 3 12C3 10.8954 3.89543 10 5 10C6.10457 10 7 10.8954 7 12Z",fill:"#999"}),d("path",{d:"M14 12C14 13.1046 13.1046 14 12 14C10.8954 14 10 13.1046 10 12C10 10.8954 10.8954 10 12 10C13.1046 10 14 10.8954 14 12Z",fill:"#999"}),d("path",{d:"M21 12C21 13.1046 20.1046 14 19 14C17.8954 14 17 13.1046 17 12C17 10.8954 17.8954 10 19 10C20.1046 10 21 10.8954 21 12Z",fill:"#999"})])])],-1),Hl=["onClick"],Nl={key:2,class:""},Wl=["title"],Dl={key:3,class:"wl-quote"};function Fl(n,o,t,e,r,m){var i;const c=Ye("TruncateReadMore"),s=Ye("CommentCard",!0);return u(),g("div",{id:t.comment.objectId,class:H(["wl-card-item",{sticky:t.comment.sticky}])},[t.comment.sticky?(u(),g("div",vl,[q(e.StickyIcon)])):b("v-if",!0),d("div",gl,[t.comment.avatar?(u(),g("img",{key:0,class:"wl-user-avatar",src:t.comment.avatar,alt:""},null,8,hl)):b("v-if",!0),t.comment.type?(u(),ee(e.VerifiedIcon,{key:1})):b("v-if",!0)]),d("div",{class:H(["wl-card",{sticky:t.comment.sticky}])},[d("div",fl,[e.link?(u(),g("a",{key:0,class:"wl-nick",href:e.link,target:"_blank",rel:"nofollow noopener noreferrer"},L(t.comment.nick),9,wl)):(u(),g("span",{key:1,class:H(["wl-nick",{sticky:t.comment.sticky}])},L(t.comment.nick),3)),t.comment.type==="administrator"?(u(),g("span",{key:2,class:H(["wl-badge","admin"]),textContent:L(e.locale.admin)},null,8,yl)):b("v-if",!0),t.comment.label?(u(),g("span",{key:3,class:"wl-badge",textContent:L(t.comment.label)},null,8,pl)):b("v-if",!0),typeof t.comment.level=="number"?(u(),g("span",{key:4,class:H(`wl-badge level${t.comment.level}`),textContent:L(e.locale[`level${t.comment.level}`]||`Level ${t.comment.level}`)},null,10,kl)):b("v-if",!0),d("span",{class:"wl-time",textContent:L(e.time)},null,8,bl)]),d("div",_l,[(u(),g(O,null,J(["addr","browser","os"],l=>(u(),g(O,null,[t.comment[l]?(u(),g("span",{key:l,class:H(`wl-${l}`),"data-value":t.comment[l],textContent:L(t.comment[l])},null,10,Cl)):b("v-if",!0)],64))),64))]),e.isEditingCurrent?b("v-if",!0):(u(),g("div",Il,[t.comment.reply_user?(u(),g("p",Ll,[d("a",{href:"#"+t.comment.pid},"@"+L(t.comment.reply_user.nick),9,Sl),El])):b("v-if",!0),q(c,{"truncate-value":300,"only-if-more-than-value":375},{html:qt(()=>[d("div",{innerHTML:t.comment.comment},null,8,Rl)]),_:1})])),d("div",xl,[e.isEditingCurrent?b("v-if",!0):(u(),g("div",jl,[e.isAdmin||e.isOwner?(u(),g(O,{key:0},[d("button",{type:"button",class:"wl-edit",onClick:o[0]||(o[0]=l=>e.emit("edit",t.comment))},[q(e.EditIcon)]),d("button",{type:"button",class:"wl-delete",onClick:o[1]||(o[1]=l=>e.emit("delete",t.comment))},[q(e.DeleteIcon)])],64)):b("v-if",!0),d("button",{type:"button",class:"wl-like",title:e.like?e.locale.cancelLike:e.locale.like,onClick:o[2]||(o[2]=l=>e.emit("like",t.comment))},[d("span",Ml,[q(e.LikeIcon,{active:e.like},null,8,["active"]),ne(" "+L("like"in t.comment?t.comment.like:""),1)])],8,Al),d("button",{type:"button",class:H(["wl-reply",{active:e.isReplyingCurrent}]),title:e.isReplyingCurrent?e.locale.cancelReply:e.locale.reply,onClick:o[3]||(o[3]=l=>e.onReply(t.comment))},Tl,10,Ul)])),e.isAdmin&&!e.isEditingCurrent?(u(),g("div",Pl,[e.isAdmin&&!("rid"in t.comment)?(u(),g("button",{key:0,type:"submit",class:"wl-btn wl-sticky",onClick:o[4]||(o[4]=l=>e.emit("sticky",t.comment))},L(t.comment.sticky?e.locale.unsticky:e.locale.sticky),1)):b("v-if",!0),d("details",Vl,[Bl,d("ul",null,[(u(),g(O,null,J(e.commentStatus,l=>d("li",{key:l},[d("span",{class:H({disabled:t.comment.status===l}),onClick:a=>e.emit("status",{status:l,comment:t.comment})},L(e.locale[l]),11,Hl)])),64)),d("li",null,[d("span",{onClick:o[5]||(o[5]=l=>e.emit("banned",t.comment))},"Banned")])])])])):b("v-if",!0)]),e.isReplyingCurrent||e.isEditingCurrent?(u(),g("div",{key:1,class:H({"wl-reply-wrapper":e.isReplyingCurrent,"wl-edit-wrapper":e.isEditingCurrent})},[q(e.CommentBox,{edit:t.edit,"reply-id":(i=t.reply)==null?void 0:i.objectId,"reply-user":t.comment.nick,"root-id":t.rootId,onLog:o[6]||(o[6]=l=>e.emit("log")),onCancelReply:o[7]||(o[7]=l=>e.emit("reply",null)),onCancelEdit:o[8]||(o[8]=l=>e.emit("edit",null)),onSubmit:o[9]||(o[9]=l=>e.onSubmit(l))},null,8,["edit","reply-id","reply-user","root-id"])],2)):b("v-if",!0),"children"in t.comment&&t.comment.children.length>0?(u(),g("div",Nl,[d("button",{type:"button",class:"wl-show-comment",title:e.showReplies?"Hide replies":"Show replies",onClick:o[10]||(o[10]=l=>e.showReplies=!e.showReplies)},[e.showReplies?(u(),ee(e.ChevronUpIcon,{key:1})):(u(),ee(e.ChevronDownIcon,{key:0})),ne(" "+L(t.comment.children.length)+" balasan ",1)],8,Wl)])):b("v-if",!0),"children"in t.comment?_e((u(),g("div",Dl,[(u(!0),g(O,null,J(t.comment.children,l=>(u(