@waline/client 3.0.0-alpha.6 → 3.0.0-alpha.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/comment.mjs CHANGED
@@ -1,2 +1,2 @@
1
- const i=e=>`${e.replace(/\/?$/,"/")}api/`,h=(e,t="")=>{if(typeof e=="object"&&e.errno)throw new TypeError(`${t} failed with ${e.errno}: ${e.errmsg}`);return e},p=({serverURL:e,lang:t,paths:r,signal:o})=>fetch(`${i(e)}comment?type=count&url=${encodeURIComponent(r.join(","))}&lang=${t}`,{signal:o}).then(n=>n.json()).then(n=>h(n,"Get comment count").data),g=e=>{try{e=decodeURI(e)}catch{}return e},m=(e="")=>e.replace(/\/$/u,""),u=e=>/^(https?:)?\/\//.test(e),d=e=>{const t=m(e);return u(t)?t:`https://${t}`},$=e=>{e.name!=="AbortError"&&console.error(e.message)},f=e=>e.dataset.path||null,v=({serverURL:e,path:t=window.location.pathname,selector:r=".waline-comment-count",lang:o=navigator.language})=>{const n=new AbortController,a=document.querySelectorAll(r);return a.length&&p({serverURL:d(e),paths:Array.from(a).map(c=>g(f(c)||t)),lang:o,signal:n.signal}).then(c=>{a.forEach((s,l)=>{s.innerText=c[l].toString()})}).catch($),n.abort.bind(n)},w="3.0.0-alpha.6";export{v as commentCount,w as version};
1
+ const i=e=>`${e.replace(/\/?$/,"/")}api/`,h=(e,t="")=>{if(typeof e=="object"&&e.errno)throw new TypeError(`${t} failed with ${e.errno}: ${e.errmsg}`);return e},p=({serverURL:e,lang:t,paths:r,signal:o})=>fetch(`${i(e)}comment?type=count&url=${encodeURIComponent(r.join(","))}&lang=${t}`,{signal:o}).then(n=>n.json()).then(n=>h(n,"Get comment count").data),g=e=>{try{e=decodeURI(e)}catch{}return e},m=(e="")=>e.replace(/\/$/u,""),u=e=>/^(https?:)?\/\//.test(e),d=e=>{const t=m(e);return u(t)?t:`https://${t}`},$=e=>{e.name!=="AbortError"&&console.error(e.message)},f=e=>e.dataset.path||null,v=({serverURL:e,path:t=window.location.pathname,selector:r=".waline-comment-count",lang:o=navigator.language})=>{const n=new AbortController,a=document.querySelectorAll(r);return a.length&&p({serverURL:d(e),paths:Array.from(a).map(c=>g(f(c)||t)),lang:o,signal:n.signal}).then(c=>{a.forEach((s,l)=>{s.innerText=c[l].toString()})}).catch($),n.abort.bind(n)},w="3.0.0-alpha.7";export{v as commentCount,w as version};
2
2
  //# sourceMappingURL=comment.mjs.map
@@ -1,2 +1,2 @@
1
- (function(o,r){typeof exports=="object"&&typeof module<"u"?r(exports):typeof define=="function"&&define.amd?define(["exports"],r):(o=typeof globalThis<"u"?globalThis:o||self,r(o.Waline={}))})(this,function(o){"use strict";const r=e=>`${e.replace(/\/?$/,"/")}api/`,l=(e,n="")=>{if(typeof e=="object"&&e.errno)throw new TypeError(`${n} failed with ${e.errno}: ${e.errmsg}`);return e},p=({serverURL:e,lang:n,paths:a,signal:s})=>fetch(`${r(e)}comment?type=count&url=${encodeURIComponent(a.join(","))}&lang=${n}`,{signal:s}).then(t=>t.json()).then(t=>l(t,"Get comment count").data),h=e=>{try{e=decodeURI(e)}catch{}return e},u=(e="")=>e.replace(/\/$/u,""),d=e=>/^(https?:)?\/\//.test(e),m=e=>{const n=u(e);return d(n)?n:`https://${n}`},f=e=>{e.name!=="AbortError"&&console.error(e.message)},g=e=>e.dataset.path||null,$=({serverURL:e,path:n=window.location.pathname,selector:a=".waline-comment-count",lang:s=navigator.language})=>{const t=new AbortController,c=document.querySelectorAll(a);return c.length&&p({serverURL:m(e),paths:Array.from(c).map(i=>h(g(i)||n)),lang:s,signal:t.signal}).then(i=>{c.forEach((v,w)=>{v.innerText=i[w].toString()})}).catch(f),t.abort.bind(t)},y="3.0.0-alpha.6";o.commentCount=$,o.version=y});
1
+ (function(o,r){typeof exports=="object"&&typeof module<"u"?r(exports):typeof define=="function"&&define.amd?define(["exports"],r):(o=typeof globalThis<"u"?globalThis:o||self,r(o.Waline={}))})(this,function(o){"use strict";const r=e=>`${e.replace(/\/?$/,"/")}api/`,l=(e,n="")=>{if(typeof e=="object"&&e.errno)throw new TypeError(`${n} failed with ${e.errno}: ${e.errmsg}`);return e},p=({serverURL:e,lang:n,paths:a,signal:s})=>fetch(`${r(e)}comment?type=count&url=${encodeURIComponent(a.join(","))}&lang=${n}`,{signal:s}).then(t=>t.json()).then(t=>l(t,"Get comment count").data),h=e=>{try{e=decodeURI(e)}catch{}return e},u=(e="")=>e.replace(/\/$/u,""),d=e=>/^(https?:)?\/\//.test(e),m=e=>{const n=u(e);return d(n)?n:`https://${n}`},f=e=>{e.name!=="AbortError"&&console.error(e.message)},g=e=>e.dataset.path||null,$=({serverURL:e,path:n=window.location.pathname,selector:a=".waline-comment-count",lang:s=navigator.language})=>{const t=new AbortController,c=document.querySelectorAll(a);return c.length&&p({serverURL:m(e),paths:Array.from(c).map(i=>h(g(i)||n)),lang:s,signal:t.signal}).then(i=>{c.forEach((v,w)=>{v.innerText=i[w].toString()})}).catch(f),t.abort.bind(t)},y="3.0.0-alpha.7";o.commentCount=$,o.version=y});
2
2
  //# sourceMappingURL=comment.umd.js.map
package/dist/component.js CHANGED
@@ -5,5 +5,5 @@ import{h as R,defineComponent as ce,inject as be,ref as L,computed as N,onMounte
5
5
  Номер текущего слова: $2`,"Анонимный","Dwarves","Hobbits","Ents","Wizards","Elves","Maiar","GIF","Поиск GIF","Персональные данные","Одобренный","Ожидающий","Спам","Нелипкий","самый старый","последний","самый горячий","Что вы думаете?"]),Ee=re(["昵称","昵称不能少于3个字符","邮箱","请填写正确的邮件地址","网址","可选","欢迎评论","来发评论吧~","提交","喜欢","取消喜欢","回复","取消回复","评论","刷新","加载更多...","预览","表情","上传图片","秒前","分钟前","小时前","天前","刚刚","正在上传","登录","退出","博主","置顶","字",`评论字数应在 $0 到 $1 字之间!
6
6
  当前字数:$2`,"匿名","潜水","冒泡","吐槽","活跃","话痨","传说","表情包","搜索表情包","个人资料","通过","待审核","垃圾","取消置顶","按倒序","按正序","按热度","你认为这篇文章怎么样?"]),it=re(["暱稱","暱稱不能少於3個字元","郵箱","請填寫正確的郵件地址","網址","可選","歡迎留言","來發留言吧~","送出","喜歡","取消喜歡","回覆","取消回覆","留言","重整","載入更多...","預覽","表情","上傳圖片","秒前","分鐘前","小時前","天前","剛剛","正在上傳","登入","登出","管理者","置頂","字",`留言字數應在 $0 到 $1 字之間!
7
7
  目前字數:$2`,"匿名","潛水","冒泡","吐槽","活躍","多話","傳說","表情包","搜尋表情包","個人資料","通過","待審核","垃圾","取消置頂","最早","最新","熱門","你認為這篇文章怎麼樣?"]);const Re={zh:Ee,"zh-cn":Ee,"zh-CN":Ee,"zh-tw":it,"zh-TW":it,en:Ie,"en-US":Ie,"en-us":Ie,jp:ye,ja:ye,"jp-jp":ye,"jp-JP":ye,"pt-br":nt,"pt-BR":nt,ru:xe,"ru-ru":xe,"ru-RU":xe},xl=e=>{const a=Qe(e);return et(a)?a:`https://${a}`},El=e=>Array.isArray(e)?e:e?[0,e]:!1,_e=(e,a)=>typeof e=="function"?e:e===!1?!1:a,Rl=({serverURL:e,path:a=location.pathname,lang:t=typeof navigator>"u"?"en-US":navigator.language,locale:l,emoji:u=lt,meta:o=["nick","mail","link"],requiredMeta:k=[],dark:M=!1,pageSize:b=10,wordLimit:I,imageUploader:C,highlighter:V,texRenderer:m,copyright:S=!0,login:A="enable",search:$,reaction:p,recaptchaV3Key:n="",turnstileKey:d="",commentSorting:W="latest",...P})=>({serverURL:xl(e),path:ml(a),locale:{...Re[t]||Re[pl],...typeof l=="object"?l:{}},wordLimit:El(I),meta:tt(o),requiredMeta:tt(k),imageUploader:_e(C,hl),highlighter:_e(V,Ll),texRenderer:_e(m,fl),lang:Object.keys(Re).includes(t)?t:"en-US",dark:M,emoji:typeof u=="boolean"?u?lt:[]:u,pageSize:b,login:A,copyright:S,search:$===!1?!1:typeof $=="object"?$:yl(t),recaptchaV3Key:n,turnstileKey:d,reaction:Array.isArray(p)?p:p===!0?gl:[],commentSorting:W,...P}),Me="{--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}",_l=e=>typeof e=="string"?e==="auto"?`@media(prefers-color-scheme:dark){body${Me}}`:`${e}${Me}`:e===!0?`:root${Me}`:"",Se=(e,a)=>{let t=e.toString();for(;t.length<a;)t="0"+t;return t},Ml=e=>{const a=Se(e.getDate(),2),t=Se(e.getMonth()+1,2);return`${Se(e.getFullYear(),2)}-${t}-${a}`},Sl=(e,a,t)=>{if(!e)return"";const l=typeof e=="string"?new Date(e.indexOf(" ")!==-1?e.replace(/-/g,"/"):e):e,u=a.getTime()-l.getTime(),o=Math.floor(u/(24*3600*1e3));if(o===0){const k=u%864e5,M=Math.floor(k/(3600*1e3));if(M===0){const b=k%36e5,I=Math.floor(b/(60*1e3));if(I===0){const C=b%6e4;return`${Math.round(C/1e3)} ${t.seconds}`}return`${I} ${t.minutes}`}return`${M} ${t.hours}`}return o<0?t.now:o<8?`${o} ${t.days}`:Ml(l)},jl=/^[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])?)*$/,Al=e=>jl.test(e),zl=e=>!!/@[0-9]+\.[0-9]+\.[0-9]+/.test(e),Ul=e=>{const a=oe("WALINE_EMOJI",{}),t=zl(e);if(t){const l=a.value[e];if(l)return Promise.resolve(l)}return fetch(`${e}/info.json`).then(l=>l.json()).then(l=>{const u={folder:e,...l};return t&&(a.value[e]=u),u})},ot=(e,a="",t="",l="")=>`${a?`${a}/`:""}${t}${e}${l?`.${l}`:""}`,Vl=e=>Promise.all(e.map(a=>typeof a=="string"?Ul(Qe(a)):Promise.resolve(a))).then(a=>{const t={tabs:[],map:{}};return a.forEach(l=>{const{name:u,folder:o,icon:k,prefix:M,type:b,items:I}=l;t.tabs.push({name:u,icon:ot(k,o,M,b),items:I.map(C=>{const V=`${M||""}${C}`;return t.map[V]=ot(C,o,M,b),V})})}),t}),Hl=e=>e.type.includes("image"),rt=e=>{const a=Array.from(e).find(Hl);return a?a.getAsFile():null},Tl=/\$.*?\$/,Wl=/^\$(.*?)\$/,Fl=/^(?:\s{0,3})\$\$((?:[^\n]|\n[^\n])+?)\n{0,1}\$\$/,Nl=e=>[{name:"blockMath",level:"block",tokenizer(a){const t=Fl.exec(a);if(t!==null)return{type:"html",raw:t[0],text:e(!0,t[1])}}},{name:"inlineMath",level:"inline",start(a){const t=a.search(Tl);return t!==-1?t:a.length},tokenizer(a){const t=Wl.exec(a);if(t!==null)return{type:"html",raw:t[0],text:e(!1,t[1])}}}],st=(e="",a={})=>e.replace(/:(.+?):/g,(t,l)=>a[l]?`<img class="wl-emoji" src="${a[l]}" alt="${l}">`:t),Bl=(e,{emojiMap:a,highlighter:t,texRenderer:l})=>{const u=new St;if(u.setOptions({breaks:!0}),t&&u.use(jt({highlight:t})),l){const o=Nl(l);u.use({extensions:o})}return u.parse(st(e,a))},Pl=e=>e.match(/[\w\d\s,.\u00C0-\u024F\u0400-\u04FF]+/giu),Dl=e=>e.match(/[\u4E00-\u9FD5]/gu),Ol=e=>{var a,t;return(((a=Pl(e))==null?void 0:a.reduce((l,u)=>l+(["",",","."].includes(u.trim())?0:u.trim().split(/\s+/u).length),0))||0)+(((t=Dl(e))==null?void 0:t.length)||0)},ql=async()=>{if(!navigator)return"";const{userAgentData:e}=navigator;let a=navigator.userAgent;if(!e||e.platform!=="Windows")return a;const{platformVersion:t}=await e.getHighEntropyValues(["platformVersion"]);return t&&parseInt(t.split(".")[0])>=13&&(a=a.replace("Windows NT 10.0","Windows NT 11.0")),a},Kl={class:"wl-comment"},Zl={key:0,class:"wl-login-info"},Gl={class:"wl-avatar"},Jl=["title"],Xl=["title"],Yl=["src"],Ql=["title","textContent"],ea={class:"wl-panel"},ta=["for","textContent"],la=["id","onUpdate:modelValue","name","type"],aa=["placeholder"],na={class:"wl-preview"},ia=v("hr",null,null,-1),oa=["innerHTML"],ra={class:"wl-footer"},sa={class:"wl-actions"},ca={href:"https://guides.github.com/features/mastering-markdown/",title:"Markdown Guide","aria-label":"Markdown is supported",class:"wl-action",target:"_blank",rel:"noopener noreferrer"},ua=["title"],va=["title"],ma=["title"],da=["title"],pa={class:"wl-info"},ga=v("div",{class:"wl-captcha-container"},null,-1),ha={class:"wl-text-number"},fa={key:0},ya=["textContent"],wa=["textContent"],ka=["disabled"],ba=["placeholder"],Ca={key:1,class:"wl-loading"},$a={key:0,class:"wl-tab-wrapper"},La=["title","onClick"],Ia=["src","alt"],xa={key:0,class:"wl-tabs"},Ea=["onClick"],Ra=["src","alt","title"],_a=["title"];var Ma=ce({__name:"CommentBox",props:{edit:{default:null},rootId:{default:""},replyId:{default:""},replyUser:{default:""}},emits:["log","cancelEdit","cancelReply","submit"],setup(e,{expose:a,emit:t}){const l=e,u=t;a();const o=be("config"),k=Ot(),M=Dt(),b=$e(),I=L({}),C=L(null),V=L(null),m=L(null),S=L(null),A=L(null),$=L(null),p=L(null),n=L({tabs:[],map:{}}),d=L(0),W=L(!1),P=L(!1),E=L(!1),z=L(""),ie=L(0),H=ht({loading:!0,list:[]}),ne=L(0),ee=L(!1),me=L(""),Y=L(!1),y=L(!1),g=N(()=>o.value.locale),j=N(()=>{var c;return!!((c=b.value)!=null&&c.token)}),K=N(()=>o.value.imageUploader!==!1),D=c=>{const r=C.value,h=r.selectionStart,U=r.selectionEnd||0,f=r.scrollTop;k.value=r.value.substring(0,h)+c+r.value.substring(U,r.value.length),r.focus(),r.selectionStart=h+c.length,r.selectionEnd=h+c.length,r.scrollTop=f},J=c=>{const r=c.key;(c.ctrlKey||c.metaKey)&&r==="Enter"&&Ae()},Z=c=>{const r=`![${o.value.locale.uploading} ${c.name}]()`;return D(r),Y.value=!0,Promise.resolve().then(()=>o.value.imageUploader(c)).then(h=>{k.value=k.value.replace(r,`\r
8
- ![${c.name}](${h})`)}).catch(h=>{alert(h.message),k.value=k.value.replace(r,"")}).then(()=>{Y.value=!1})},se=c=>{var r;if((r=c.dataTransfer)!=null&&r.items){const h=rt(c.dataTransfer.items);h&&K.value&&(Z(h),c.preventDefault())}},je=c=>{if(c.clipboardData){const r=rt(c.clipboardData.items);r&&K.value&&Z(r)}},we=()=>{const c=V.value;c.files&&K.value&&Z(c.files[0]).then(()=>{c.value=""})},Ae=async()=>{var c,r,h,U,f,O;const{serverURL:F,lang:Q,login:de,wordLimit:We,requiredMeta:Fe,recaptchaV3Key:Ne,turnstileKey:Be}=o.value,dt=await ql(),T={comment:me.value,nick:M.value.nick,mail:M.value.mail,link:M.value.link,url:o.value.path,ua:dt};if((c=b.value)!=null&&c.token)T.nick=b.value.display_name,T.mail=b.value.email,T.link=b.value.url;else{if(de==="force")return;if(Fe.indexOf("nick")>-1&&!T.nick)return(r=I.value.nick)==null||r.focus(),alert(g.value.nickError);if(Fe.indexOf("mail")>-1&&!T.mail||T.mail&&!Al(T.mail))return(h=I.value.mail)==null||h.focus(),alert(g.value.mailError);T.nick||(T.nick=g.value.anonymous)}if(!T.comment){(U=C.value)==null||U.focus();return}if(!ee.value)return alert(g.value.wordHint.replace("$0",We[0].toString()).replace("$1",We[1].toString()).replace("$2",ie.value.toString()));T.comment=st(T.comment,n.value.map),l.replyId&&l.rootId&&(T.pid=l.replyId,T.rid=l.rootId,T.at=l.replyUser),Y.value=!0;try{Ne&&(T.recaptchaV3=await Gt(Ne).execute("social")),Be&&(T.turnstile=await Jt(Be).execute("social"));const pe={serverURL:F,lang:Q,token:(f=b.value)==null?void 0:f.token,comment:T},ke=await(l.edit?fe({objectId:l.edit.objectId,...pe}):Et(pe));if(Y.value=!1,ke.errmsg)return alert(ke.errmsg);u("submit",ke.data),k.value="",z.value="",l.replyId&&u("cancelReply"),(O=l.edit)!=null&&O.objectId&&u("cancelEdit")}catch(pe){Y.value=!1,alert(pe.message)}},vt=c=>{c.preventDefault();const{lang:r,serverURL:h}=o.value;Rt({serverURL:h,lang:r}).then(U=>{b.value=U,(U.remember?localStorage:sessionStorage).setItem("WALINE_USER",JSON.stringify(U)),u("log")})},mt=()=>{b.value={},localStorage.setItem("WALINE_USER","null"),sessionStorage.setItem("WALINE_USER","null"),u("log")},ze=c=>{c.preventDefault();const{lang:r,serverURL:h}=o.value,U=800,f=800,O=(window.innerWidth-U)/2,F=(window.innerHeight-f)/2,Q=new URLSearchParams({lng:r,token:b.value.token}),de=window.open(`${h}/ui/profile?${Q.toString()}`,"_blank",`width=${U},height=${f},left=${O},top=${F},scrollbars=no,resizable=no,status=no,location=no,toolbar=no,menubar=no`);de==null||de.postMessage({type:"TOKEN",data:b.value.token},"*")},Ue=c=>{var r,h,U,f;!((r=m.value)!=null&&r.contains(c.target))&&!((h=S.value)!=null&&h.contains(c.target))&&(W.value=!1),!((U=A.value)!=null&&U.contains(c.target))&&!((f=$.value)!=null&&f.contains(c.target))&&(P.value=!1)},Ve=async c=>{var r;const{scrollTop:h,clientHeight:U,scrollHeight:f}=c.target,O=(U+h)/f,F=o.value.search,Q=((r=p.value)==null?void 0:r.value)||"";O<.9||H.loading||y.value||(H.loading=!0,(F.more&&H.list.length?await F.more(Q,H.list.length):await F.search(Q)).length?H.list=[...H.list,...F.more&&H.list.length?await F.more(Q,H.list.length):await F.search(Q)]:y.value=!0,H.loading=!1,setTimeout(()=>{c.target.scrollTop=h},50))},He=$t(c=>{H.list=[],y.value=!1,Ve(c)},300);te([o,ie],([c,r])=>{const{wordLimit:h}=c;h?r<h[0]&&h[0]!==0?(ne.value=h[0],ee.value=!1):r>h[1]?(ne.value=h[1],ee.value=!1):(ne.value=h[1],ee.value=!0):(ne.value=0,ee.value=!0)},{immediate:!0});const Te=({data:c})=>{!c||c.type!=="profile"||(b.value={...b.value,...c.data},[localStorage,sessionStorage].filter(r=>r.getItem("WALINE_USER")).forEach(r=>r.setItem("WALINE_USER",JSON.stringify(b))))};return ge(()=>{var c;document.body.addEventListener("click",Ue),window.addEventListener("message",Te),(c=l.edit)!=null&&c.objectId&&(k.value=l.edit.orig),te(P,async r=>{if(!r)return;const h=o.value.search;p.value&&(p.value.value=""),H.loading=!0,H.list=h.default?await h.default():await h.search(""),H.loading=!1}),te(()=>k.value,r=>{const{highlighter:h,texRenderer:U}=o.value;me.value=r,z.value=Bl(r,{emojiMap:n.value.map,highlighter:h,texRenderer:U}),ie.value=Ol(r),r?qe(C.value):qe.destroy(C.value)},{immediate:!0}),te(()=>o.value.emoji,r=>Vl(r).then(h=>{n.value=h}),{immediate:!0})}),Ce(()=>{document.body.removeEventListener("click",Ue),window.removeEventListener("message",Te)}),(c,r)=>{var h,U;return i(),s("div",Kl,[w(o).login!=="disable"&&j.value&&!((h=c.edit)!=null&&h.objectId)?(i(),s("div",Zl,[v("div",Gl,[v("button",{type:"submit",class:"wl-logout-btn",title:g.value.logout,onClick:mt},[G(w(Ke),{size:14})],8,Jl),v("a",{href:"#",class:"wl-login-nick","aria-label":"Profile",title:g.value.profile,onClick:ze},[v("img",{src:w(b).avatar,alt:"avatar"},null,8,Yl)],8,Xl)]),v("a",{href:"#",class:"wl-login-nick","aria-label":"Profile",title:g.value.profile,onClick:ze,textContent:_(w(b).display_name)},null,8,Ql)])):x("v-if",!0),v("div",ea,[w(o).login!=="force"&&w(o).meta.length&&!j.value?(i(),s("div",{key:0,class:q(["wl-header",`item${w(o).meta.length}`])},[(i(!0),s(B,null,X(w(o).meta,f=>(i(),s("div",{key:f,class:"wl-header-item"},[v("label",{for:`wl-${f}`,textContent:_(g.value[f]+(w(o).requiredMeta.includes(f)||!w(o).requiredMeta.length?"":`(${g.value.optional})`))},null,8,ta),he(v("input",{id:`wl-${f}`,ref_for:!0,ref:O=>{O&&(I.value[f]=O)},"onUpdate:modelValue":O=>w(M)[f]=O,class:q(["wl-input",`wl-${f}`]),name:f,type:f==="mail"?"email":"text"},null,10,la),[[ft,w(M)[f]]])]))),128))],2)):x("v-if",!0),he(v("textarea",{id:"wl-edit",ref_key:"editorRef",ref:C,"onUpdate:modelValue":r[0]||(r[0]=f=>yt(k)?k.value=f:null),class:"wl-editor",placeholder:c.replyUser?`@${c.replyUser}`:g.value.placeholder,onKeydown:J,onDrop:se,onPaste:je},null,40,aa),[[wt,w(k)]]),he(v("div",na,[ia,v("h4",null,_(g.value.preview)+":",1),v("div",{class:"wl-content",innerHTML:z.value},null,8,oa)],512),[[De,E.value]]),v("div",ra,[v("div",sa,[v("a",ca,[G(w(Wt))]),he(v("button",{ref_key:"emojiButtonRef",ref:m,type:"button",class:q(["wl-action",{active:W.value}]),title:g.value.emoji,onClick:r[1]||(r[1]=f=>W.value=!W.value)},[G(w(Ut))],10,ua),[[De,n.value.tabs.length]]),w(o).search?(i(),s("button",{key:0,ref_key:"gifButtonRef",ref:A,type:"button",class:q(["wl-action",{active:P.value}]),title:g.value.gif,onClick:r[2]||(r[2]=f=>P.value=!P.value)},[G(w(Pt))],10,va)):x("v-if",!0),v("input",{id:"wl-image-upload",ref_key:"imageUploadRef",ref:V,class:"upload",type:"file",accept:".png,.jpg,.jpeg,.webp,.bmp,.gif",onChange:we},null,544),K.value?(i(),s("label",{key:1,for:"wl-image-upload",class:"wl-action",title:g.value.uploadImage},[G(w(Vt))],8,ma)):x("v-if",!0),v("button",{type:"button",class:q(["wl-action",{active:E.value}]),title:g.value.preview,onClick:r[3]||(r[3]=f=>E.value=!E.value)},[G(w(Tt))],10,da)]),v("div",pa,[ga,v("div",ha,[ae(_(ie.value)+" ",1),w(o).wordLimit?(i(),s("span",fa,[ae("  /  "),v("span",{class:q({illegal:!ee.value}),textContent:_(ne.value)},null,10,ya)])):x("v-if",!0),ae("  "+_(g.value.word),1)]),w(o).login!=="disable"&&!j.value?(i(),s("button",{key:0,type:"button",class:"wl-btn",onClick:vt,textContent:_(g.value.login)},null,8,wa)):x("v-if",!0),w(o).login!=="force"||j.value?(i(),s("button",{key:1,type:"submit",class:"primary wl-btn",title:"Cmd|Ctrl + Enter",disabled:Y.value,onClick:Ae},[Y.value?(i(),le(w(ue),{key:0,size:16})):(i(),s(B,{key:1},[ae(_(g.value.submit),1)],64))],8,ka)):x("v-if",!0)]),v("div",{ref_key:"gifPopupRef",ref:$,class:q(["wl-gif-popup",{display:P.value}])},[v("input",{ref_key:"gifSearchInputRef",ref:p,type:"text",placeholder:g.value.gifSearchPlaceholder,onInput:r[4]||(r[4]=(...f)=>w(He)&&w(He)(...f))},null,40,ba),H.list.length?(i(),le(vl,{key:0,items:H.list,"column-width":200,gap:6,onInsert:r[5]||(r[5]=f=>D(f)),onScroll:Ve},null,8,["items"])):x("v-if",!0),H.loading?(i(),s("div",Ca,[G(w(ue),{size:30})])):x("v-if",!0)],2),v("div",{ref_key:"emojiPopupRef",ref:S,class:q(["wl-emoji-popup",{display:W.value}])},[(i(!0),s(B,null,X(n.value.tabs,(f,O)=>(i(),s(B,{key:f.name},[O===d.value?(i(),s("div",$a,[(i(!0),s(B,null,X(f.items,F=>(i(),s("button",{key:F,type:"button",title:F,onClick:Q=>D(`:${F}:`)},[W.value?(i(),s("img",{key:0,class:"wl-emoji",src:n.value.map[F],alt:F,loading:"lazy",referrerPolicy:"no-referrer"},null,8,Ia)):x("v-if",!0)],8,La))),128))])):x("v-if",!0)],64))),128)),n.value.tabs.length>1?(i(),s("div",xa,[(i(!0),s(B,null,X(n.value.tabs,(f,O)=>(i(),s("button",{key:f.name,type:"button",class:q(["wl-tab",{active:d.value===O}]),onClick:F=>d.value=O},[v("img",{class:"wl-emoji",src:f.icon,alt:f.name,title:f.name,loading:"lazy",referrerPolicy:"no-referrer"},null,8,Ra)],10,Ea))),128))])):x("v-if",!0)],2)])]),c.replyId||(U=c.edit)!=null&&U.objectId?(i(),s("button",{key:1,type:"button",class:"wl-close",title:g.value.cancelReply,onClick:r[6]||(r[6]=f=>c.$emit(c.replyId?"cancelReply":"cancelEdit"))},[G(w(Ke),{size:24})],8,_a)):x("v-if",!0)])}}}),ct=ve(Ma,[["__file","CommentBox.vue"]]);const Sa=["id"],ja={class:"wl-user","aria-hidden":"true"},Aa=["src"],za={class:"wl-card"},Ua={class:"wl-head"},Va=["href"],Ha={key:1,class:"wl-nick"},Ta=["textContent"],Wa=["textContent"],Fa=["textContent"],Na=["textContent"],Ba=["textContent"],Pa={class:"wl-comment-actions"},Da=["title"],Oa=["title"],qa={class:"wl-meta","aria-hidden":"true"},Ka=["data-value","textContent"],Za=["innerHTML"],Ga={key:1,class:"wl-admin-actions"},Ja={class:"wl-comment-status"},Xa=["disabled","onClick","textContent"],Ya={key:3,class:"wl-quote"};var Qa=ce({__name:"CommentCard",props:{comment:{},edit:{default:null},rootId:{},reply:{default:null}},emits:["log","submit","delete","edit","like","status","sticky","reply"],setup(e,{emit:a}){const t=e,l=a,u=["approved","waiting","spam"],o=be("config"),k=Ge(),M=Lt(),b=$e(),I=N(()=>o.value.locale),C=N(()=>{const{link:n}=t.comment;return n?et(n)?n:`https://${n}`:""}),V=N(()=>k.value.includes(t.comment.objectId)),m=N(()=>Sl(t.comment.insertedAt,M.value,I.value)),S=N(()=>b.value.type==="administrator"),A=N(()=>t.comment.user_id&&b.value.objectId===t.comment.user_id),$=N(()=>{var n;return t.comment.objectId===((n=t.reply)==null?void 0:n.objectId)}),p=N(()=>{var n;return t.comment.objectId===((n=t.edit)==null?void 0:n.objectId)});return(n,d)=>{var W;const P=kt("CommentCard",!0);return i(),s("div",{id:n.comment.objectId,class:"wl-card-item"},[v("div",ja,[n.comment.avatar?(i(),s("img",{key:0,class:"wl-user-avatar",src:n.comment.avatar},null,8,Aa)):x("v-if",!0),n.comment.type?(i(),le(w(Bt),{key:1})):x("v-if",!0)]),v("div",za,[v("div",Ua,[C.value?(i(),s("a",{key:0,class:"wl-nick",href:C.value,target:"_blank",rel:"nofollow noopener noreferrer"},_(n.comment.nick),9,Va)):(i(),s("span",Ha,_(n.comment.nick),1)),n.comment.type==="administrator"?(i(),s("span",{key:2,class:"wl-badge",textContent:_(I.value.admin)},null,8,Ta)):x("v-if",!0),n.comment.label?(i(),s("span",{key:3,class:"wl-badge",textContent:_(n.comment.label)},null,8,Wa)):x("v-if",!0),n.comment.sticky?(i(),s("span",{key:4,class:"wl-badge",textContent:_(I.value.sticky)},null,8,Fa)):x("v-if",!0),typeof n.comment.level=="number"?(i(),s("span",{key:5,class:q(`wl-badge level${n.comment.level}`),textContent:_(I.value[`level${n.comment.level}`]||`Level ${n.comment.level}`)},null,10,Na)):x("v-if",!0),v("span",{class:"wl-time",textContent:_(m.value)},null,8,Ba),v("div",Pa,[S.value||A.value?(i(),s(B,{key:0},[v("button",{type:"button",class:"wl-edit",onClick:d[0]||(d[0]=E=>l("edit",n.comment))},[G(w(Nt))]),v("button",{type:"button",class:"wl-delete",onClick:d[1]||(d[1]=E=>l("delete",n.comment))},[G(w(zt))])],64)):x("v-if",!0),v("button",{type:"button",class:"wl-like",title:V.value?I.value.cancelLike:I.value.like,onClick:d[2]||(d[2]=E=>l("like",n.comment))},[G(w(Ht),{active:V.value},null,8,["active"]),ae(" "+_("like"in n.comment?n.comment.like:""),1)],8,Da),v("button",{type:"button",class:q(["wl-reply",{active:$.value}]),title:$.value?I.value.cancelReply:I.value.reply,onClick:d[3]||(d[3]=E=>l("reply",$.value?null:n.comment))},[G(w(Ft))],10,Oa)])]),v("div",qa,[(i(),s(B,null,X(["addr","browser","os"],E=>(i(),s(B,null,[n.comment[E]?(i(),s("span",{key:E,class:q(`wl-${E}`),"data-value":n.comment[E],textContent:_(n.comment[E])},null,10,Ka)):x("v-if",!0)],64))),64))]),p.value?x("v-if",!0):(i(),s("div",{key:0,class:"wl-content",innerHTML:n.comment.comment},null,8,Za)),S.value&&!p.value?(i(),s("div",Ga,[v("span",Ja,[(i(),s(B,null,X(u,E=>v("button",{key:E,type:"submit",class:q(`wl-btn wl-${E}`),disabled:n.comment.status===E,onClick:z=>l("status",{status:E,comment:n.comment}),textContent:_(I.value[E])},null,10,Xa)),64))]),S.value&&!("rid"in n.comment)?(i(),s("button",{key:0,type:"submit",class:"wl-btn wl-sticky",onClick:d[4]||(d[4]=E=>l("sticky",n.comment))},_(n.comment.sticky?I.value.unsticky:I.value.sticky),1)):x("v-if",!0)])):x("v-if",!0),$.value||p.value?(i(),s("div",{key:2,class:q({"wl-reply-wrapper":$.value,"wl-edit-wrapper":p.value})},[G(ct,{edit:n.edit,"reply-id":(W=n.reply)==null?void 0:W.objectId,"reply-user":n.comment.nick,"root-id":n.rootId,onLog:d[5]||(d[5]=E=>l("log")),onCancelReply:d[6]||(d[6]=E=>l("reply",null)),onCancelEdit:d[7]||(d[7]=E=>l("edit",null)),onSubmit:d[8]||(d[8]=E=>l("submit",E))},null,8,["edit","reply-id","reply-user","root-id"])],2)):x("v-if",!0),"children"in n.comment?(i(),s("div",Ya,[(i(!0),s(B,null,X(n.comment.children,E=>(i(),le(P,{key:E.objectId,comment:E,reply:n.reply,edit:n.edit,"root-id":n.rootId,onLog:d[9]||(d[9]=z=>l("log")),onDelete:d[10]||(d[10]=z=>l("delete",z)),onEdit:d[11]||(d[11]=z=>l("edit",z)),onLike:d[12]||(d[12]=z=>l("like",z)),onReply:d[13]||(d[13]=z=>l("reply",z)),onStatus:d[14]||(d[14]=z=>l("status",z)),onSticky:d[15]||(d[15]=z=>l("sticky",z)),onSubmit:d[16]||(d[16]=z=>l("submit",z))},null,8,["comment","reply","edit","root-id"]))),128))])):x("v-if",!0)])],8,Sa)}}}),en=ve(Qa,[["__file","CommentCard.vue"]]);const ut="3.0.0-alpha.6",tn={"data-waline":""},ln={class:"wl-meta-head"},an={class:"wl-count"},nn=["textContent"],on={class:"wl-sort"},rn=["onClick"],sn={class:"wl-cards"},cn={key:1,class:"wl-operation"},un=["textContent"],vn={key:2,class:"wl-loading"},mn=["textContent"],dn={key:4,class:"wl-operation"},pn=["textContent"],gn={key:5,class:"wl-power"},hn=v("a",{href:"https://github.com/walinejs/waline",target:"_blank",rel:"noopener noreferrer"}," Waline ",-1);var fn=ce({__name:"WalineComment",props:["serverURL","path","meta","requiredMeta","dark","commentSorting","lang","locale","pageSize","wordLimit","emoji","login","highlighter","texRenderer","imageUploader","search","copyright","recaptchaV3Key","turnstileKey","reaction"],setup(e){const a=e,t={latest:"insertedAt_desc",oldest:"insertedAt_asc",hottest:"like_desc"},l=Object.keys(t),u=$e(),o=Ge(),k=L("loading"),M=L(0),b=L(1),I=L(0),C=N(()=>Rl(a)),V=L(C.value.commentSorting),m=L([]),S=L(null),A=L(null),$=N(()=>_l(C.value.dark)),p=N(()=>C.value.locale);It($,{id:"waline-darkmode"});let n;const d=y=>{var g;const{serverURL:j,path:K,pageSize:D}=C.value,J=new AbortController;k.value="loading",n==null||n(),Mt({serverURL:j,lang:C.value.lang,path:K,pageSize:D,sortBy:t[V.value],page:y,signal:J.signal,token:(g=u.value)==null?void 0:g.token}).then(Z=>{k.value="success",M.value=Z.count,m.value.push(...Z.data),b.value=y,I.value=Z.totalPages}).catch(Z=>{Z.name!=="AbortError"&&(console.error(Z.message),k.value="error")}),n=J.abort.bind(J)},W=()=>d(b.value+1),P=()=>{M.value=0,m.value=[],d(1)},E=y=>{V.value!==y&&(V.value=y,P())},z=y=>{S.value=y},ie=y=>{A.value=y},H=y=>{if(A.value)A.value.comment=y.comment,A.value.orig=y.orig;else if("rid"in y){const g=m.value.find(({objectId:j})=>j===y.rid);if(!g)return;Array.isArray(g.children)||(g.children=[]),g.children.push(y)}else m.value.unshift(y),M.value+=1},ne=async({comment:y,status:g})=>{var j;if(y.status===g)return;const{serverURL:K,lang:D}=C.value;await fe({serverURL:K,lang:D,token:(j=u.value)==null?void 0:j.token,objectId:y.objectId,comment:{status:g}}),y.status=g},ee=async y=>{var g;if("rid"in y)return;const{serverURL:j,lang:K}=C.value;await fe({serverURL:j,lang:K,token:(g=u.value)==null?void 0:g.token,objectId:y.objectId,comment:{sticky:y.sticky?0:1}}),y.sticky=!y.sticky},me=async({objectId:y})=>{var g;if(!confirm("Are you sure you want to delete this comment?"))return;const{serverURL:j,lang:K}=C.value;await _t({serverURL:j,lang:K,token:(g=u.value)==null?void 0:g.token,objectId:y}),m.value.some((D,J)=>D.objectId===y?(m.value=m.value.filter((Z,se)=>se!==J),!0):D.children.some((Z,se)=>Z.objectId===y?(m.value[J].children=D.children.filter((je,we)=>we!==se),!0):!1))},Y=async y=>{var g;const{serverURL:j,lang:K}=C.value,{objectId:D}=y,J=o.value.includes(D);await fe({serverURL:j,lang:K,objectId:D,token:(g=u.value)==null?void 0:g.token,comment:{like:!J}}),J?o.value=o.value.filter(Z=>Z!==D):(o.value=[...o.value,D],o.value.length>50&&(o.value=o.value.slice(-50))),y.like=(y.like||0)+(J?-1:1)};return bt("config",C),ge(()=>{te(()=>[a.serverURL,a.path],()=>P(),{immediate:!0})}),Ce(()=>n==null?void 0:n()),(y,g)=>(i(),s("div",tn,[G(rl),S.value?x("v-if",!0):(i(),le(ct,{key:0,onLog:P,onSubmit:H})),v("div",ln,[v("div",an,[M.value?(i(),s("span",{key:0,class:"wl-num",textContent:_(M.value)},null,8,nn)):x("v-if",!0),ae(" "+_(p.value.comment),1)]),v("ul",on,[(i(!0),s(B,null,X(w(l),j=>(i(),s("li",{key:j,class:q([j===V.value?"active":""]),onClick:K=>E(j)},_(p.value[j]),11,rn))),128))])]),v("div",sn,[(i(!0),s(B,null,X(m.value,j=>(i(),le(en,{key:j.objectId,"root-id":j.objectId,comment:j,reply:S.value,edit:A.value,onLog:P,onReply:z,onEdit:ie,onSubmit:H,onStatus:ne,onDelete:me,onSticky:ee,onLike:Y},null,8,["root-id","comment","reply","edit"]))),128))]),k.value==="error"?(i(),s("div",cn,[v("button",{type:"button",class:"wl-btn",onClick:P,textContent:_(p.value.refresh)},null,8,un)])):k.value==="loading"?(i(),s("div",vn,[G(w(ue),{size:30})])):m.value.length?b.value<I.value?(i(),s("div",dn,[v("button",{type:"button",class:"wl-btn",onClick:W,textContent:_(p.value.more)},null,8,pn)])):x("v-if",!0):(i(),s("div",{key:3,class:"wl-empty",textContent:_(p.value.sofa)},null,8,mn)),C.value.copyright?(i(),s("div",gn,[ae(" Powered by "),hn,ae(" v"+_(w(ut)),1)])):x("v-if",!0)]))}}),yn=ve(fn,[["__file","WalineComment.vue"]]);export{yn as Waline,ut as version};
8
+ ![${c.name}](${h})`)}).catch(h=>{alert(h.message),k.value=k.value.replace(r,"")}).then(()=>{Y.value=!1})},se=c=>{var r;if((r=c.dataTransfer)!=null&&r.items){const h=rt(c.dataTransfer.items);h&&K.value&&(Z(h),c.preventDefault())}},je=c=>{if(c.clipboardData){const r=rt(c.clipboardData.items);r&&K.value&&Z(r)}},we=()=>{const c=V.value;c.files&&K.value&&Z(c.files[0]).then(()=>{c.value=""})},Ae=async()=>{var c,r,h,U,f,O;const{serverURL:F,lang:Q,login:de,wordLimit:We,requiredMeta:Fe,recaptchaV3Key:Ne,turnstileKey:Be}=o.value,dt=await ql(),T={comment:me.value,nick:M.value.nick,mail:M.value.mail,link:M.value.link,url:o.value.path,ua:dt};if((c=b.value)!=null&&c.token)T.nick=b.value.display_name,T.mail=b.value.email,T.link=b.value.url;else{if(de==="force")return;if(Fe.indexOf("nick")>-1&&!T.nick)return(r=I.value.nick)==null||r.focus(),alert(g.value.nickError);if(Fe.indexOf("mail")>-1&&!T.mail||T.mail&&!Al(T.mail))return(h=I.value.mail)==null||h.focus(),alert(g.value.mailError);T.nick||(T.nick=g.value.anonymous)}if(!T.comment){(U=C.value)==null||U.focus();return}if(!ee.value)return alert(g.value.wordHint.replace("$0",We[0].toString()).replace("$1",We[1].toString()).replace("$2",ie.value.toString()));T.comment=st(T.comment,n.value.map),l.replyId&&l.rootId&&(T.pid=l.replyId,T.rid=l.rootId,T.at=l.replyUser),Y.value=!0;try{Ne&&(T.recaptchaV3=await Gt(Ne).execute("social")),Be&&(T.turnstile=await Jt(Be).execute("social"));const pe={serverURL:F,lang:Q,token:(f=b.value)==null?void 0:f.token,comment:T},ke=await(l.edit?fe({objectId:l.edit.objectId,...pe}):Et(pe));if(Y.value=!1,ke.errmsg)return alert(ke.errmsg);u("submit",ke.data),k.value="",z.value="",l.replyId&&u("cancelReply"),(O=l.edit)!=null&&O.objectId&&u("cancelEdit")}catch(pe){Y.value=!1,alert(pe.message)}},vt=c=>{c.preventDefault();const{lang:r,serverURL:h}=o.value;Rt({serverURL:h,lang:r}).then(U=>{b.value=U,(U.remember?localStorage:sessionStorage).setItem("WALINE_USER",JSON.stringify(U)),u("log")})},mt=()=>{b.value={},localStorage.setItem("WALINE_USER","null"),sessionStorage.setItem("WALINE_USER","null"),u("log")},ze=c=>{c.preventDefault();const{lang:r,serverURL:h}=o.value,U=800,f=800,O=(window.innerWidth-U)/2,F=(window.innerHeight-f)/2,Q=new URLSearchParams({lng:r,token:b.value.token}),de=window.open(`${h}/ui/profile?${Q.toString()}`,"_blank",`width=${U},height=${f},left=${O},top=${F},scrollbars=no,resizable=no,status=no,location=no,toolbar=no,menubar=no`);de==null||de.postMessage({type:"TOKEN",data:b.value.token},"*")},Ue=c=>{var r,h,U,f;!((r=m.value)!=null&&r.contains(c.target))&&!((h=S.value)!=null&&h.contains(c.target))&&(W.value=!1),!((U=A.value)!=null&&U.contains(c.target))&&!((f=$.value)!=null&&f.contains(c.target))&&(P.value=!1)},Ve=async c=>{var r;const{scrollTop:h,clientHeight:U,scrollHeight:f}=c.target,O=(U+h)/f,F=o.value.search,Q=((r=p.value)==null?void 0:r.value)||"";O<.9||H.loading||y.value||(H.loading=!0,(F.more&&H.list.length?await F.more(Q,H.list.length):await F.search(Q)).length?H.list=[...H.list,...F.more&&H.list.length?await F.more(Q,H.list.length):await F.search(Q)]:y.value=!0,H.loading=!1,setTimeout(()=>{c.target.scrollTop=h},50))},He=$t(c=>{H.list=[],y.value=!1,Ve(c)},300);te([o,ie],([c,r])=>{const{wordLimit:h}=c;h?r<h[0]&&h[0]!==0?(ne.value=h[0],ee.value=!1):r>h[1]?(ne.value=h[1],ee.value=!1):(ne.value=h[1],ee.value=!0):(ne.value=0,ee.value=!0)},{immediate:!0});const Te=({data:c})=>{!c||c.type!=="profile"||(b.value={...b.value,...c.data},[localStorage,sessionStorage].filter(r=>r.getItem("WALINE_USER")).forEach(r=>r.setItem("WALINE_USER",JSON.stringify(b))))};return ge(()=>{var c;document.body.addEventListener("click",Ue),window.addEventListener("message",Te),(c=l.edit)!=null&&c.objectId&&(k.value=l.edit.orig),te(P,async r=>{if(!r)return;const h=o.value.search;p.value&&(p.value.value=""),H.loading=!0,H.list=h.default?await h.default():await h.search(""),H.loading=!1}),te(()=>k.value,r=>{const{highlighter:h,texRenderer:U}=o.value;me.value=r,z.value=Bl(r,{emojiMap:n.value.map,highlighter:h,texRenderer:U}),ie.value=Ol(r),r?qe(C.value):qe.destroy(C.value)},{immediate:!0}),te(()=>o.value.emoji,r=>Vl(r).then(h=>{n.value=h}),{immediate:!0})}),Ce(()=>{document.body.removeEventListener("click",Ue),window.removeEventListener("message",Te)}),(c,r)=>{var h,U;return i(),s("div",Kl,[w(o).login!=="disable"&&j.value&&!((h=c.edit)!=null&&h.objectId)?(i(),s("div",Zl,[v("div",Gl,[v("button",{type:"submit",class:"wl-logout-btn",title:g.value.logout,onClick:mt},[G(w(Ke),{size:14})],8,Jl),v("a",{href:"#",class:"wl-login-nick","aria-label":"Profile",title:g.value.profile,onClick:ze},[v("img",{src:w(b).avatar,alt:"avatar"},null,8,Yl)],8,Xl)]),v("a",{href:"#",class:"wl-login-nick","aria-label":"Profile",title:g.value.profile,onClick:ze,textContent:_(w(b).display_name)},null,8,Ql)])):x("v-if",!0),v("div",ea,[w(o).login!=="force"&&w(o).meta.length&&!j.value?(i(),s("div",{key:0,class:q(["wl-header",`item${w(o).meta.length}`])},[(i(!0),s(B,null,X(w(o).meta,f=>(i(),s("div",{key:f,class:"wl-header-item"},[v("label",{for:`wl-${f}`,textContent:_(g.value[f]+(w(o).requiredMeta.includes(f)||!w(o).requiredMeta.length?"":`(${g.value.optional})`))},null,8,ta),he(v("input",{id:`wl-${f}`,ref_for:!0,ref:O=>{O&&(I.value[f]=O)},"onUpdate:modelValue":O=>w(M)[f]=O,class:q(["wl-input",`wl-${f}`]),name:f,type:f==="mail"?"email":"text"},null,10,la),[[ft,w(M)[f]]])]))),128))],2)):x("v-if",!0),he(v("textarea",{id:"wl-edit",ref_key:"editorRef",ref:C,"onUpdate:modelValue":r[0]||(r[0]=f=>yt(k)?k.value=f:null),class:"wl-editor",placeholder:c.replyUser?`@${c.replyUser}`:g.value.placeholder,onKeydown:J,onDrop:se,onPaste:je},null,40,aa),[[wt,w(k)]]),he(v("div",na,[ia,v("h4",null,_(g.value.preview)+":",1),v("div",{class:"wl-content",innerHTML:z.value},null,8,oa)],512),[[De,E.value]]),v("div",ra,[v("div",sa,[v("a",ca,[G(w(Wt))]),he(v("button",{ref_key:"emojiButtonRef",ref:m,type:"button",class:q(["wl-action",{active:W.value}]),title:g.value.emoji,onClick:r[1]||(r[1]=f=>W.value=!W.value)},[G(w(Ut))],10,ua),[[De,n.value.tabs.length]]),w(o).search?(i(),s("button",{key:0,ref_key:"gifButtonRef",ref:A,type:"button",class:q(["wl-action",{active:P.value}]),title:g.value.gif,onClick:r[2]||(r[2]=f=>P.value=!P.value)},[G(w(Pt))],10,va)):x("v-if",!0),v("input",{id:"wl-image-upload",ref_key:"imageUploadRef",ref:V,class:"upload",type:"file",accept:".png,.jpg,.jpeg,.webp,.bmp,.gif",onChange:we},null,544),K.value?(i(),s("label",{key:1,for:"wl-image-upload",class:"wl-action",title:g.value.uploadImage},[G(w(Vt))],8,ma)):x("v-if",!0),v("button",{type:"button",class:q(["wl-action",{active:E.value}]),title:g.value.preview,onClick:r[3]||(r[3]=f=>E.value=!E.value)},[G(w(Tt))],10,da)]),v("div",pa,[ga,v("div",ha,[ae(_(ie.value)+" ",1),w(o).wordLimit?(i(),s("span",fa,[ae("  /  "),v("span",{class:q({illegal:!ee.value}),textContent:_(ne.value)},null,10,ya)])):x("v-if",!0),ae("  "+_(g.value.word),1)]),w(o).login!=="disable"&&!j.value?(i(),s("button",{key:0,type:"button",class:"wl-btn",onClick:vt,textContent:_(g.value.login)},null,8,wa)):x("v-if",!0),w(o).login!=="force"||j.value?(i(),s("button",{key:1,type:"submit",class:"primary wl-btn",title:"Cmd|Ctrl + Enter",disabled:Y.value,onClick:Ae},[Y.value?(i(),le(w(ue),{key:0,size:16})):(i(),s(B,{key:1},[ae(_(g.value.submit),1)],64))],8,ka)):x("v-if",!0)]),v("div",{ref_key:"gifPopupRef",ref:$,class:q(["wl-gif-popup",{display:P.value}])},[v("input",{ref_key:"gifSearchInputRef",ref:p,type:"text",placeholder:g.value.gifSearchPlaceholder,onInput:r[4]||(r[4]=(...f)=>w(He)&&w(He)(...f))},null,40,ba),H.list.length?(i(),le(vl,{key:0,items:H.list,"column-width":200,gap:6,onInsert:r[5]||(r[5]=f=>D(f)),onScroll:Ve},null,8,["items"])):x("v-if",!0),H.loading?(i(),s("div",Ca,[G(w(ue),{size:30})])):x("v-if",!0)],2),v("div",{ref_key:"emojiPopupRef",ref:S,class:q(["wl-emoji-popup",{display:W.value}])},[(i(!0),s(B,null,X(n.value.tabs,(f,O)=>(i(),s(B,{key:f.name},[O===d.value?(i(),s("div",$a,[(i(!0),s(B,null,X(f.items,F=>(i(),s("button",{key:F,type:"button",title:F,onClick:Q=>D(`:${F}:`)},[W.value?(i(),s("img",{key:0,class:"wl-emoji",src:n.value.map[F],alt:F,loading:"lazy",referrerPolicy:"no-referrer"},null,8,Ia)):x("v-if",!0)],8,La))),128))])):x("v-if",!0)],64))),128)),n.value.tabs.length>1?(i(),s("div",xa,[(i(!0),s(B,null,X(n.value.tabs,(f,O)=>(i(),s("button",{key:f.name,type:"button",class:q(["wl-tab",{active:d.value===O}]),onClick:F=>d.value=O},[v("img",{class:"wl-emoji",src:f.icon,alt:f.name,title:f.name,loading:"lazy",referrerPolicy:"no-referrer"},null,8,Ra)],10,Ea))),128))])):x("v-if",!0)],2)])]),c.replyId||(U=c.edit)!=null&&U.objectId?(i(),s("button",{key:1,type:"button",class:"wl-close",title:g.value.cancelReply,onClick:r[6]||(r[6]=f=>c.$emit(c.replyId?"cancelReply":"cancelEdit"))},[G(w(Ke),{size:24})],8,_a)):x("v-if",!0)])}}}),ct=ve(Ma,[["__file","CommentBox.vue"]]);const Sa=["id"],ja={class:"wl-user","aria-hidden":"true"},Aa=["src"],za={class:"wl-card"},Ua={class:"wl-head"},Va=["href"],Ha={key:1,class:"wl-nick"},Ta=["textContent"],Wa=["textContent"],Fa=["textContent"],Na=["textContent"],Ba=["textContent"],Pa={class:"wl-comment-actions"},Da=["title"],Oa=["title"],qa={class:"wl-meta","aria-hidden":"true"},Ka=["data-value","textContent"],Za=["innerHTML"],Ga={key:1,class:"wl-admin-actions"},Ja={class:"wl-comment-status"},Xa=["disabled","onClick","textContent"],Ya={key:3,class:"wl-quote"};var Qa=ce({__name:"CommentCard",props:{comment:{},edit:{default:null},rootId:{},reply:{default:null}},emits:["log","submit","delete","edit","like","status","sticky","reply"],setup(e,{emit:a}){const t=e,l=a,u=["approved","waiting","spam"],o=be("config"),k=Ge(),M=Lt(),b=$e(),I=N(()=>o.value.locale),C=N(()=>{const{link:n}=t.comment;return n?et(n)?n:`https://${n}`:""}),V=N(()=>k.value.includes(t.comment.objectId)),m=N(()=>Sl(t.comment.insertedAt,M.value,I.value)),S=N(()=>b.value.type==="administrator"),A=N(()=>t.comment.user_id&&b.value.objectId===t.comment.user_id),$=N(()=>{var n;return t.comment.objectId===((n=t.reply)==null?void 0:n.objectId)}),p=N(()=>{var n;return t.comment.objectId===((n=t.edit)==null?void 0:n.objectId)});return(n,d)=>{var W;const P=kt("CommentCard",!0);return i(),s("div",{id:n.comment.objectId,class:"wl-card-item"},[v("div",ja,[n.comment.avatar?(i(),s("img",{key:0,class:"wl-user-avatar",src:n.comment.avatar},null,8,Aa)):x("v-if",!0),n.comment.type?(i(),le(w(Bt),{key:1})):x("v-if",!0)]),v("div",za,[v("div",Ua,[C.value?(i(),s("a",{key:0,class:"wl-nick",href:C.value,target:"_blank",rel:"nofollow noopener noreferrer"},_(n.comment.nick),9,Va)):(i(),s("span",Ha,_(n.comment.nick),1)),n.comment.type==="administrator"?(i(),s("span",{key:2,class:"wl-badge",textContent:_(I.value.admin)},null,8,Ta)):x("v-if",!0),n.comment.label?(i(),s("span",{key:3,class:"wl-badge",textContent:_(n.comment.label)},null,8,Wa)):x("v-if",!0),n.comment.sticky?(i(),s("span",{key:4,class:"wl-badge",textContent:_(I.value.sticky)},null,8,Fa)):x("v-if",!0),typeof n.comment.level=="number"?(i(),s("span",{key:5,class:q(`wl-badge level${n.comment.level}`),textContent:_(I.value[`level${n.comment.level}`]||`Level ${n.comment.level}`)},null,10,Na)):x("v-if",!0),v("span",{class:"wl-time",textContent:_(m.value)},null,8,Ba),v("div",Pa,[S.value||A.value?(i(),s(B,{key:0},[v("button",{type:"button",class:"wl-edit",onClick:d[0]||(d[0]=E=>l("edit",n.comment))},[G(w(Nt))]),v("button",{type:"button",class:"wl-delete",onClick:d[1]||(d[1]=E=>l("delete",n.comment))},[G(w(zt))])],64)):x("v-if",!0),v("button",{type:"button",class:"wl-like",title:V.value?I.value.cancelLike:I.value.like,onClick:d[2]||(d[2]=E=>l("like",n.comment))},[G(w(Ht),{active:V.value},null,8,["active"]),ae(" "+_("like"in n.comment?n.comment.like:""),1)],8,Da),v("button",{type:"button",class:q(["wl-reply",{active:$.value}]),title:$.value?I.value.cancelReply:I.value.reply,onClick:d[3]||(d[3]=E=>l("reply",$.value?null:n.comment))},[G(w(Ft))],10,Oa)])]),v("div",qa,[(i(),s(B,null,X(["addr","browser","os"],E=>(i(),s(B,null,[n.comment[E]?(i(),s("span",{key:E,class:q(`wl-${E}`),"data-value":n.comment[E],textContent:_(n.comment[E])},null,10,Ka)):x("v-if",!0)],64))),64))]),p.value?x("v-if",!0):(i(),s("div",{key:0,class:"wl-content",innerHTML:n.comment.comment},null,8,Za)),S.value&&!p.value?(i(),s("div",Ga,[v("span",Ja,[(i(),s(B,null,X(u,E=>v("button",{key:E,type:"submit",class:q(`wl-btn wl-${E}`),disabled:n.comment.status===E,onClick:z=>l("status",{status:E,comment:n.comment}),textContent:_(I.value[E])},null,10,Xa)),64))]),S.value&&!("rid"in n.comment)?(i(),s("button",{key:0,type:"submit",class:"wl-btn wl-sticky",onClick:d[4]||(d[4]=E=>l("sticky",n.comment))},_(n.comment.sticky?I.value.unsticky:I.value.sticky),1)):x("v-if",!0)])):x("v-if",!0),$.value||p.value?(i(),s("div",{key:2,class:q({"wl-reply-wrapper":$.value,"wl-edit-wrapper":p.value})},[G(ct,{edit:n.edit,"reply-id":(W=n.reply)==null?void 0:W.objectId,"reply-user":n.comment.nick,"root-id":n.rootId,onLog:d[5]||(d[5]=E=>l("log")),onCancelReply:d[6]||(d[6]=E=>l("reply",null)),onCancelEdit:d[7]||(d[7]=E=>l("edit",null)),onSubmit:d[8]||(d[8]=E=>l("submit",E))},null,8,["edit","reply-id","reply-user","root-id"])],2)):x("v-if",!0),"children"in n.comment?(i(),s("div",Ya,[(i(!0),s(B,null,X(n.comment.children,E=>(i(),le(P,{key:E.objectId,comment:E,reply:n.reply,edit:n.edit,"root-id":n.rootId,onLog:d[9]||(d[9]=z=>l("log")),onDelete:d[10]||(d[10]=z=>l("delete",z)),onEdit:d[11]||(d[11]=z=>l("edit",z)),onLike:d[12]||(d[12]=z=>l("like",z)),onReply:d[13]||(d[13]=z=>l("reply",z)),onStatus:d[14]||(d[14]=z=>l("status",z)),onSticky:d[15]||(d[15]=z=>l("sticky",z)),onSubmit:d[16]||(d[16]=z=>l("submit",z))},null,8,["comment","reply","edit","root-id"]))),128))])):x("v-if",!0)])],8,Sa)}}}),en=ve(Qa,[["__file","CommentCard.vue"]]);const ut="3.0.0-alpha.7",tn={"data-waline":""},ln={class:"wl-meta-head"},an={class:"wl-count"},nn=["textContent"],on={class:"wl-sort"},rn=["onClick"],sn={class:"wl-cards"},cn={key:1,class:"wl-operation"},un=["textContent"],vn={key:2,class:"wl-loading"},mn=["textContent"],dn={key:4,class:"wl-operation"},pn=["textContent"],gn={key:5,class:"wl-power"},hn=v("a",{href:"https://github.com/walinejs/waline",target:"_blank",rel:"noopener noreferrer"}," Waline ",-1);var fn=ce({__name:"WalineComment",props:["serverURL","path","meta","requiredMeta","dark","commentSorting","lang","locale","pageSize","wordLimit","emoji","login","highlighter","texRenderer","imageUploader","search","copyright","recaptchaV3Key","turnstileKey","reaction"],setup(e){const a=e,t={latest:"insertedAt_desc",oldest:"insertedAt_asc",hottest:"like_desc"},l=Object.keys(t),u=$e(),o=Ge(),k=L("loading"),M=L(0),b=L(1),I=L(0),C=N(()=>Rl(a)),V=L(C.value.commentSorting),m=L([]),S=L(null),A=L(null),$=N(()=>_l(C.value.dark)),p=N(()=>C.value.locale);It($,{id:"waline-darkmode"});let n;const d=y=>{var g;const{serverURL:j,path:K,pageSize:D}=C.value,J=new AbortController;k.value="loading",n==null||n(),Mt({serverURL:j,lang:C.value.lang,path:K,pageSize:D,sortBy:t[V.value],page:y,signal:J.signal,token:(g=u.value)==null?void 0:g.token}).then(Z=>{k.value="success",M.value=Z.count,m.value.push(...Z.data),b.value=y,I.value=Z.totalPages}).catch(Z=>{Z.name!=="AbortError"&&(console.error(Z.message),k.value="error")}),n=J.abort.bind(J)},W=()=>d(b.value+1),P=()=>{M.value=0,m.value=[],d(1)},E=y=>{V.value!==y&&(V.value=y,P())},z=y=>{S.value=y},ie=y=>{A.value=y},H=y=>{if(A.value)A.value.comment=y.comment,A.value.orig=y.orig;else if("rid"in y){const g=m.value.find(({objectId:j})=>j===y.rid);if(!g)return;Array.isArray(g.children)||(g.children=[]),g.children.push(y)}else m.value.unshift(y),M.value+=1},ne=async({comment:y,status:g})=>{var j;if(y.status===g)return;const{serverURL:K,lang:D}=C.value;await fe({serverURL:K,lang:D,token:(j=u.value)==null?void 0:j.token,objectId:y.objectId,comment:{status:g}}),y.status=g},ee=async y=>{var g;if("rid"in y)return;const{serverURL:j,lang:K}=C.value;await fe({serverURL:j,lang:K,token:(g=u.value)==null?void 0:g.token,objectId:y.objectId,comment:{sticky:y.sticky?0:1}}),y.sticky=!y.sticky},me=async({objectId:y})=>{var g;if(!confirm("Are you sure you want to delete this comment?"))return;const{serverURL:j,lang:K}=C.value;await _t({serverURL:j,lang:K,token:(g=u.value)==null?void 0:g.token,objectId:y}),m.value.some((D,J)=>D.objectId===y?(m.value=m.value.filter((Z,se)=>se!==J),!0):D.children.some((Z,se)=>Z.objectId===y?(m.value[J].children=D.children.filter((je,we)=>we!==se),!0):!1))},Y=async y=>{var g;const{serverURL:j,lang:K}=C.value,{objectId:D}=y,J=o.value.includes(D);await fe({serverURL:j,lang:K,objectId:D,token:(g=u.value)==null?void 0:g.token,comment:{like:!J}}),J?o.value=o.value.filter(Z=>Z!==D):(o.value=[...o.value,D],o.value.length>50&&(o.value=o.value.slice(-50))),y.like=(y.like||0)+(J?-1:1)};return bt("config",C),ge(()=>{te(()=>[a.serverURL,a.path],()=>P(),{immediate:!0})}),Ce(()=>n==null?void 0:n()),(y,g)=>(i(),s("div",tn,[G(rl),S.value?x("v-if",!0):(i(),le(ct,{key:0,onLog:P,onSubmit:H})),v("div",ln,[v("div",an,[M.value?(i(),s("span",{key:0,class:"wl-num",textContent:_(M.value)},null,8,nn)):x("v-if",!0),ae(" "+_(p.value.comment),1)]),v("ul",on,[(i(!0),s(B,null,X(w(l),j=>(i(),s("li",{key:j,class:q([j===V.value?"active":""]),onClick:K=>E(j)},_(p.value[j]),11,rn))),128))])]),v("div",sn,[(i(!0),s(B,null,X(m.value,j=>(i(),le(en,{key:j.objectId,"root-id":j.objectId,comment:j,reply:S.value,edit:A.value,onLog:P,onReply:z,onEdit:ie,onSubmit:H,onStatus:ne,onDelete:me,onSticky:ee,onLike:Y},null,8,["root-id","comment","reply","edit"]))),128))]),k.value==="error"?(i(),s("div",cn,[v("button",{type:"button",class:"wl-btn",onClick:P,textContent:_(p.value.refresh)},null,8,un)])):k.value==="loading"?(i(),s("div",vn,[G(w(ue),{size:30})])):m.value.length?b.value<I.value?(i(),s("div",dn,[v("button",{type:"button",class:"wl-btn",onClick:W,textContent:_(p.value.more)},null,8,pn)])):x("v-if",!0):(i(),s("div",{key:3,class:"wl-empty",textContent:_(p.value.sofa)},null,8,mn)),C.value.copyright?(i(),s("div",gn,[ae(" Powered by "),hn,ae(" v"+_(w(ut)),1)])):x("v-if",!0)]))}}),yn=ve(fn,[["__file","WalineComment.vue"]]);export{yn as Waline,ut as version};
9
9
  //# sourceMappingURL=component.js.map
package/dist/pageview.js CHANGED
@@ -1,2 +1,2 @@
1
- const u="3.0.0-alpha.6",v={"Content-Type":"application/json"},g=e=>`${e.replace(/\/?$/,"/")}api/`,$=(e,t="")=>{if(typeof e=="object"&&e.errno)throw new TypeError(`${t} failed with ${e.errno}: ${e.errmsg}`);return e},f=({serverURL:e,lang:t,paths:r,type:a,signal:n})=>fetch(`${g(e)}article?path=${encodeURIComponent(r.join(","))}&type=${encodeURIComponent(a.join(","))}&lang=${t}`,{signal:n}).then(o=>o.json()),R=({serverURL:e,lang:t,path:r,type:a,action:n})=>fetch(`${g(e)}article?lang=${t}`,{method:"POST",headers:v,body:JSON.stringify({path:r,type:a,action:n})}).then(o=>o.json()).then(o=>$(o,"Update counter").data),U=({serverURL:e,lang:t,paths:r,signal:a})=>f({serverURL:e,lang:t,paths:r,type:["time"],signal:a}).then(n=>Array.isArray(n)?n:[n]),w=e=>R({...e,type:"time",action:"inc"}),L=(e="")=>e.replace(/\/$/u,""),A=e=>/^(https?:)?\/\//.test(e),y=e=>{const t=L(e);return A(t)?t:`https://${t}`},b=e=>{e.name!=="AbortError"&&console.error(e.message)},d=e=>e.dataset.path||null,m=(e,t)=>{t.forEach((r,a)=>{r.innerText=e[a].toString()})},j=({serverURL:e,path:t=window.location.pathname,selector:r=".waline-pageview-count",update:a=!0,lang:n=navigator.language})=>{const o=new AbortController,i=Array.from(document.querySelectorAll(r)),c=l=>{const s=d(l);return s!==null&&t!==s},h=l=>U({serverURL:y(e),paths:l.map(s=>d(s)||t),lang:n,signal:o.signal}).then(s=>m(s,l)).catch(b);if(a){const l=i.filter(p=>!c(p)),s=i.filter(c);w({serverURL:y(e),path:t,lang:n}).then(([p])=>m(new Array(l.length).fill(p),l)),s.length&&h(s)}else h(i);return o.abort.bind(o)};export{j as pageviewCount,u as version};
1
+ const u="3.0.0-alpha.7",v={"Content-Type":"application/json"},g=e=>`${e.replace(/\/?$/,"/")}api/`,$=(e,t="")=>{if(typeof e=="object"&&e.errno)throw new TypeError(`${t} failed with ${e.errno}: ${e.errmsg}`);return e},f=({serverURL:e,lang:t,paths:r,type:a,signal:n})=>fetch(`${g(e)}article?path=${encodeURIComponent(r.join(","))}&type=${encodeURIComponent(a.join(","))}&lang=${t}`,{signal:n}).then(o=>o.json()),R=({serverURL:e,lang:t,path:r,type:a,action:n})=>fetch(`${g(e)}article?lang=${t}`,{method:"POST",headers:v,body:JSON.stringify({path:r,type:a,action:n})}).then(o=>o.json()).then(o=>$(o,"Update counter").data),U=({serverURL:e,lang:t,paths:r,signal:a})=>f({serverURL:e,lang:t,paths:r,type:["time"],signal:a}).then(n=>Array.isArray(n)?n:[n]),w=e=>R({...e,type:"time",action:"inc"}),L=(e="")=>e.replace(/\/$/u,""),A=e=>/^(https?:)?\/\//.test(e),y=e=>{const t=L(e);return A(t)?t:`https://${t}`},b=e=>{e.name!=="AbortError"&&console.error(e.message)},d=e=>e.dataset.path||null,m=(e,t)=>{t.forEach((r,a)=>{r.innerText=e[a].toString()})},j=({serverURL:e,path:t=window.location.pathname,selector:r=".waline-pageview-count",update:a=!0,lang:n=navigator.language})=>{const o=new AbortController,i=Array.from(document.querySelectorAll(r)),c=l=>{const s=d(l);return s!==null&&t!==s},h=l=>U({serverURL:y(e),paths:l.map(s=>d(s)||t),lang:n,signal:o.signal}).then(s=>m(s,l)).catch(b);if(a){const l=i.filter(p=>!c(p)),s=i.filter(c);w({serverURL:y(e),path:t,lang:n}).then(([p])=>m(new Array(l.length).fill(p),l)),s.length&&h(s)}else h(i);return o.abort.bind(o)};export{j as pageviewCount,u as version};
2
2
  //# sourceMappingURL=pageview.js.map
@@ -1,2 +1,2 @@
1
- (function(l,p){typeof exports=="object"&&typeof module<"u"?p(exports):typeof define=="function"&&define.amd?define(["exports"],p):(l=typeof globalThis<"u"?globalThis:l||self,p(l.Waline={}))})(this,function(l){"use strict";const p="3.0.0-alpha.6",v={"Content-Type":"application/json"},g=e=>`${e.replace(/\/?$/,"/")}api/`,$=(e,t="")=>{if(typeof e=="object"&&e.errno)throw new TypeError(`${t} failed with ${e.errno}: ${e.errmsg}`);return e},w=({serverURL:e,lang:t,paths:r,type:o,signal:n})=>fetch(`${g(e)}article?path=${encodeURIComponent(r.join(","))}&type=${encodeURIComponent(o.join(","))}&lang=${t}`,{signal:n}).then(a=>a.json()),R=({serverURL:e,lang:t,path:r,type:o,action:n})=>fetch(`${g(e)}article?lang=${t}`,{method:"POST",headers:v,body:JSON.stringify({path:r,type:o,action:n})}).then(a=>a.json()).then(a=>$(a,"Update counter").data),U=({serverURL:e,lang:t,paths:r,signal:o})=>w({serverURL:e,lang:t,paths:r,type:["time"],signal:o}).then(n=>Array.isArray(n)?n:[n]),L=e=>R({...e,type:"time",action:"inc"}),b=(e="")=>e.replace(/\/$/u,""),j=e=>/^(https?:)?\/\//.test(e),d=e=>{const t=b(e);return j(t)?t:`https://${t}`},A=e=>{e.name!=="AbortError"&&console.error(e.message)},f=e=>e.dataset.path||null,u=(e,t)=>{t.forEach((r,o)=>{r.innerText=e[o].toString()})},C=({serverURL:e,path:t=window.location.pathname,selector:r=".waline-pageview-count",update:o=!0,lang:n=navigator.language})=>{const a=new AbortController,c=Array.from(document.querySelectorAll(r)),y=s=>{const i=f(s);return i!==null&&t!==i},m=s=>U({serverURL:d(e),paths:s.map(i=>f(i)||t),lang:n,signal:a.signal}).then(i=>u(i,s)).catch(A);if(o){const s=c.filter(h=>!y(h)),i=c.filter(y);L({serverURL:d(e),path:t,lang:n}).then(([h])=>u(new Array(s.length).fill(h),s)),i.length&&m(i)}else m(c);return a.abort.bind(a)};l.pageviewCount=C,l.version=p});
1
+ (function(l,p){typeof exports=="object"&&typeof module<"u"?p(exports):typeof define=="function"&&define.amd?define(["exports"],p):(l=typeof globalThis<"u"?globalThis:l||self,p(l.Waline={}))})(this,function(l){"use strict";const p="3.0.0-alpha.7",v={"Content-Type":"application/json"},g=e=>`${e.replace(/\/?$/,"/")}api/`,$=(e,t="")=>{if(typeof e=="object"&&e.errno)throw new TypeError(`${t} failed with ${e.errno}: ${e.errmsg}`);return e},w=({serverURL:e,lang:t,paths:r,type:o,signal:n})=>fetch(`${g(e)}article?path=${encodeURIComponent(r.join(","))}&type=${encodeURIComponent(o.join(","))}&lang=${t}`,{signal:n}).then(a=>a.json()),R=({serverURL:e,lang:t,path:r,type:o,action:n})=>fetch(`${g(e)}article?lang=${t}`,{method:"POST",headers:v,body:JSON.stringify({path:r,type:o,action:n})}).then(a=>a.json()).then(a=>$(a,"Update counter").data),U=({serverURL:e,lang:t,paths:r,signal:o})=>w({serverURL:e,lang:t,paths:r,type:["time"],signal:o}).then(n=>Array.isArray(n)?n:[n]),L=e=>R({...e,type:"time",action:"inc"}),b=(e="")=>e.replace(/\/$/u,""),j=e=>/^(https?:)?\/\//.test(e),d=e=>{const t=b(e);return j(t)?t:`https://${t}`},A=e=>{e.name!=="AbortError"&&console.error(e.message)},f=e=>e.dataset.path||null,u=(e,t)=>{t.forEach((r,o)=>{r.innerText=e[o].toString()})},C=({serverURL:e,path:t=window.location.pathname,selector:r=".waline-pageview-count",update:o=!0,lang:n=navigator.language})=>{const a=new AbortController,c=Array.from(document.querySelectorAll(r)),y=s=>{const i=f(s);return i!==null&&t!==i},m=s=>U({serverURL:d(e),paths:s.map(i=>f(i)||t),lang:n,signal:a.signal}).then(i=>u(i,s)).catch(A);if(o){const s=c.filter(h=>!y(h)),i=c.filter(y);L({serverURL:d(e),path:t,lang:n}).then(([h])=>u(new Array(s.length).fill(h),s)),i.length&&m(i)}else m(c);return a.abort.bind(a)};l.pageviewCount=C,l.version=p});
2
2
  //# sourceMappingURL=pageview.umd.js.map
package/dist/shim.js CHANGED
@@ -5,5 +5,5 @@ import{fetchCommentCount as Rt,getArticleCounter as xt,updateArticleCounter as K
5
5
  Номер текущего слова: $2`,"Анонимный","Dwarves","Hobbits","Ents","Wizards","Elves","Maiar","GIF","Поиск GIF","Персональные данные","Одобренный","Ожидающий","Спам","Нелипкий","самый старый","последний","самый горячий","Что вы думаете?"]),Ae=re(["昵称","昵称不能少于3个字符","邮箱","请填写正确的邮件地址","网址","可选","欢迎评论","来发评论吧~","提交","喜欢","取消喜欢","回复","取消回复","评论","刷新","加载更多...","预览","表情","上传图片","秒前","分钟前","小时前","天前","刚刚","正在上传","登录","退出","博主","置顶","字",`评论字数应在 $0 到 $1 字之间!
6
6
  当前字数:$2`,"匿名","潜水","冒泡","吐槽","活跃","话痨","传说","表情包","搜索表情包","个人资料","通过","待审核","垃圾","取消置顶","按倒序","按正序","按热度","你认为这篇文章怎么样?"]),at=re(["暱稱","暱稱不能少於3個字元","郵箱","請填寫正確的郵件地址","網址","可選","歡迎留言","來發留言吧~","送出","喜歡","取消喜歡","回覆","取消回覆","留言","重整","載入更多...","預覽","表情","上傳圖片","秒前","分鐘前","小時前","天前","剛剛","正在上傳","登入","登出","管理者","置頂","字",`留言字數應在 $0 到 $1 字之間!
7
7
  目前字數:$2`,"匿名","潛水","冒泡","吐槽","活躍","多話","傳說","表情包","搜尋表情包","個人資料","通過","待審核","垃圾","取消置頂","最早","最新","熱門","你認為這篇文章怎麼樣?"]);const se={zh:Ae,"zh-cn":Ae,"zh-CN":Ae,"zh-tw":at,"zh-TW":at,en:Ie,"en-US":Ie,"en-us":Ie,jp:ye,ja:ye,"jp-jp":ye,"jp-JP":ye,"pt-br":lt,"pt-BR":lt,ru:Ue,"ru-ru":Ue,"ru-RU":Ue},nt=e=>{try{e=decodeURI(e)}catch{}return e},ot=(e="")=>e.replace(/\/$/u,""),it=e=>/^(https?:)?\/\//.test(e),ke=e=>{const a=ot(e);return it(a)?a:`https://${a}`},sl=e=>Array.isArray(e)?e:e?[0,e]:!1,_e=(e,a)=>typeof e=="function"?e:e===!1?!1:a,cl=({serverURL:e,path:a=location.pathname,lang:l=typeof navigator>"u"?"en-US":navigator.language,locale:t,emoji:i=Qe,meta:n=["nick","mail","link"],requiredMeta:m=[],dark:d=!1,pageSize:g=10,wordLimit:c,imageUploader:f,highlighter:S,texRenderer:p,copyright:A=!0,login:M="enable",search:R,reaction:y,recaptchaV3Key:o="",turnstileKey:w="",commentSorting:F="latest",...B})=>({serverURL:ke(e),path:nt(a),locale:{...se[l]||se[et],...typeof t=="object"?t:{}},wordLimit:sl(c),meta:Ye(n),requiredMeta:Ye(m),imageUploader:_e(f,Yt),highlighter:_e(S,il),texRenderer:_e(p,Qt),lang:Object.keys(se).includes(l)?l:"en-US",dark:d,emoji:typeof i=="boolean"?i?Qe:[]:i,pageSize:g,login:M,copyright:A,search:R===!1?!1:typeof R=="object"?R:el(l),recaptchaV3Key:o,turnstileKey:w,reaction:Array.isArray(y)?y:y===!0?Xt:[],commentSorting:F,...B}),Me="{--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}",ul=e=>typeof e=="string"?e==="auto"?`@media(prefers-color-scheme:dark){body${Me}}`:`${e}${Me}`:e===!0?`:root${Me}`:"",Se=(e,a)=>{let l=e.toString();for(;l.length<a;)l="0"+l;return l},vl=e=>{const a=Se(e.getDate(),2),l=Se(e.getMonth()+1,2);return`${Se(e.getFullYear(),2)}-${l}-${a}`},ml=(e,a,l)=>{if(!e)return"";const t=typeof e=="string"?new Date(e.indexOf(" ")!==-1?e.replace(/-/g,"/"):e):e,i=a.getTime()-t.getTime(),n=Math.floor(i/(24*3600*1e3));if(n===0){const m=i%864e5,d=Math.floor(m/(3600*1e3));if(d===0){const g=m%36e5,c=Math.floor(g/(60*1e3));if(c===0){const f=g%6e4;return`${Math.round(f/1e3)} ${l.seconds}`}return`${c} ${l.minutes}`}return`${d} ${l.hours}`}return n<0?l.now:n<8?`${n} ${l.days}`:vl(t)},dl=/^[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])?)*$/,pl=e=>dl.test(e),gl=e=>!!/@[0-9]+\.[0-9]+\.[0-9]+/.test(e),hl=e=>{const a=ie("WALINE_EMOJI",{}),l=gl(e);if(l){const t=a.value[e];if(t)return Promise.resolve(t)}return fetch(`${e}/info.json`).then(t=>t.json()).then(t=>{const i={folder:e,...t};return l&&(a.value[e]=i),i})},rt=(e,a="",l="",t="")=>`${a?`${a}/`:""}${l}${e}${t?`.${t}`:""}`,fl=e=>Promise.all(e.map(a=>typeof a=="string"?hl(ot(a)):Promise.resolve(a))).then(a=>{const l={tabs:[],map:{}};return a.forEach(t=>{const{name:i,folder:n,icon:m,prefix:d,type:g,items:c}=t;l.tabs.push({name:i,icon:rt(m,n,d,g),items:c.map(f=>{const S=`${d||""}${f}`;return l.map[S]=rt(f,n,d,g),S})})}),l}),st=e=>{e.name!=="AbortError"&&console.error(e.message)},je=e=>e instanceof HTMLElement?e:typeof e=="string"?document.querySelector(e):null,wl=e=>e.type.includes("image"),ct=e=>{const a=Array.from(e).find(wl);return a?a.getAsFile():null},yl=/\$.*?\$/,kl=/^\$(.*?)\$/,bl=/^(?:\s{0,3})\$\$((?:[^\n]|\n[^\n])+?)\n{0,1}\$\$/,Cl=e=>[{name:"blockMath",level:"block",tokenizer(a){const l=bl.exec(a);if(l!==null)return{type:"html",raw:l[0],text:e(!0,l[1])}}},{name:"inlineMath",level:"inline",start(a){const l=a.search(yl);return l!==-1?l:a.length},tokenizer(a){const l=kl.exec(a);if(l!==null)return{type:"html",raw:l[0],text:e(!1,l[1])}}}],ut=(e="",a={})=>e.replace(/:(.+?):/g,(l,t)=>a[t]?`<img class="wl-emoji" src="${a[t]}" alt="${t}">`:l),$l=(e,{emojiMap:a,highlighter:l,texRenderer:t})=>{const i=new Kt;if(i.setOptions({breaks:!0}),l&&i.use(Zt({highlight:l})),t){const n=Cl(t);i.use({extensions:n})}return i.parse(ut(e,a))},ze=e=>e.dataset.path||null,Ll=e=>e.match(/[\w\d\s,.\u00C0-\u024F\u0400-\u04FF]+/giu),Rl=e=>e.match(/[\u4E00-\u9FD5]/gu),xl=e=>{var a,l;return(((a=Ll(e))==null?void 0:a.reduce((t,i)=>t+(["",",","."].includes(i.trim())?0:i.trim().split(/\s+/u).length),0))||0)+(((l=Rl(e))==null?void 0:l.length)||0)},El=async()=>{if(!navigator)return"";const{userAgentData:e}=navigator;let a=navigator.userAgent;if(!e||e.platform!=="Windows")return a;const{platformVersion:l}=await e.getHighEntropyValues(["platformVersion"]);return l&&parseInt(l.split(".")[0])>=13&&(a=a.replace("Windows NT 10.0","Windows NT 11.0")),a},vt=({serverURL:e,path:a=window.location.pathname,selector:l=".waline-comment-count",lang:t=navigator.language})=>{const i=new AbortController,n=document.querySelectorAll(l);return n.length&&Rt({serverURL:ke(e),paths:Array.from(n).map(m=>nt(ze(m)||a)),lang:t,signal:i.signal}).then(m=>{n.forEach((d,g)=>{d.innerText=m[g].toString()})}).catch(st),i.abort.bind(i)},mt=({size:e})=>U("svg",{class:"wl-close-icon",viewBox:"0 0 1024 1024",width:e,height:e},[U("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"}),U("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"})]),Il=()=>U("svg",{viewBox:"0 0 1024 1024",width:"24",height:"24"},U("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"})),Ul=()=>U("svg",{viewBox:"0 0 1024 1024",width:"24",height:"24"},U("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"})),Al=()=>U("svg",{viewBox:"0 0 1024 1024",width:"24",height:"24"},[U("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"}),U("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"})]),_l=({active:e=!1})=>U("svg",{viewBox:"0 0 1024 1024",width:"24",height:"24"},[U("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"})]),Ml=()=>U("svg",{viewBox:"0 0 1024 1024",width:"24",height:"24"},[U("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"}),U("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"})]),Sl=()=>U("svg",{width:"16",height:"16",ariaHidden:"true"},U("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"})),jl=()=>U("svg",{viewBox:"0 0 1024 1024",width:"24",height:"24"},U("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"})),zl=()=>U("svg",{viewBox:"0 0 1024 1024",width:"24",height:"24"},U("path",{d:"M813.039 318.772L480.53 651.278H360.718V531.463L693.227 198.961C697.904 194.284 704.027 192 710.157 192C716.302 192 722.436 194.284 727.114 198.961L813.039 284.88C817.72 289.561 820 295.684 820 301.825C820 307.95 817.72 314.093 813.039 318.772ZM710.172 261.888L420.624 551.431V591.376H460.561L750.109 301.825L710.172 261.888ZM490.517 291.845H240.906V771.09H720.156V521.479C720.156 504.947 733.559 491.529 750.109 491.529C766.653 491.529 780.063 504.947 780.063 521.479V791.059C780.063 813.118 762.18 831 740.125 831H220.937C198.882 831 181 813.118 181 791.059V271.872C181 249.817 198.882 231.935 220.937 231.935H490.517C507.06 231.935 520.47 245.352 520.47 261.888C520.47 278.424 507.06 291.845 490.517 291.845Z",fill:"currentColor"})),Hl=()=>U("svg",{class:"verified-icon",viewBox:"0 0 1024 1024",width:"14",height:"14"},U("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"})),ve=({size:e=100})=>U("svg",{width:e,height:e,viewBox:"0 0 100 100",preserveAspectRatio:"xMidYMid"},U("circle",{cx:50,cy:50,fill:"none",stroke:"currentColor",strokeWidth:"4",r:"40","stroke-dasharray":"85 30"},U("animateTransform",{attributeName:"transform",type:"rotate",repeatCount:"indefinite",dur:"1s",values:"0 50 50;360 50 50",keyTimes:"0;1"}))),Vl=()=>U("svg",{width:24,height:24,fill:"currentcolor",viewBox:"0 0 24 24"},[U("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"}),U("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"})]),Tl=()=>ie("WALINE_USER_META",{nick:"",mail:"",link:""}),Fl=()=>ie("WALINE_COMMENT_BOX_EDITOR",""),Nl="WALINE_LIKE";let dt=null;const pt=()=>dt||(dt=ie(Nl,[])),Wl="WALINE_REACTION";let gt=null;const Pl=()=>gt??(gt=ie(Wl,{})),ht={},Bl=e=>{const a=ht[e]??(ht[e]=Gt(e,{useRecaptchaNet:!0,autoHideBadge:!0}));return{execute:l=>a.then(t=>t.execute(l))}},Dl=e=>({execute:async a=>{const{load:l}=Bt("https://challenges.cloudflare.com/turnstile/v0/api.js",void 0,{async:!1});await l();const t=window==null?void 0:window.turnstile;return new Promise(i=>{t==null||t.ready(()=>{t==null||t.render(".wl-captcha-container",{sitekey:e,action:a,size:"compact",callback:i})})})}}),Ol="WALINE_USER";let ft=null;const be=()=>ft??(ft=ie(Ol,{})),ql={key:0,class:"wl-reaction"},Kl=["textContent"],Zl={class:"wl-reaction-list"},Gl=["onClick"],Jl={class:"wl-reaction-img"},Xl=["src","alt"],Yl=["textContent"],Ql=["textContent"];var ea=ue({__name:"ArticleReaction",setup(e,{expose:a}){a();const l=Pl(),t=Le("config"),i=x(-1),n=x([]),m=W(()=>t.value.locale),d=W(()=>t.value.reaction.length>0),g=W(()=>{const{reaction:p,path:A}=t.value;return p.map((M,R)=>({icon:M,desc:m.value[`reaction${R}`],active:l.value[A]===R}))});let c;const f=async()=>{if(d.value){const{serverURL:p,lang:A,path:M,reaction:R}=t.value,y=new AbortController;c=y.abort.bind(y);const o=await xt({serverURL:p,lang:A,paths:[M],type:R.map((w,F)=>`reaction${F}`),signal:y.signal});if(Array.isArray(o)||typeof o=="number")return;n.value=R.map((w,F)=>o[`reaction${F}`])}},S=async p=>{if(i.value===-1){const{serverURL:A,lang:M,path:R}=t.value,y=l.value[R];i.value=p,y!==void 0&&(await Ke({serverURL:A,lang:M,path:R,type:`reaction${y}`,action:"desc"}),n.value[y]=Math.max(n.value[y]-1,0)),y!==p&&(await Ke({serverURL:A,lang:M,path:R,type:`reaction${p}`}),n.value[p]=(n.value[p]||0)+1),y===p?delete l.value[R]:l.value[R]=p,i.value=-1}};return fe(()=>{te(()=>[t.value.serverURL,t.value.path],()=>{f()},{immediate:!0})}),Re(()=>c==null?void 0:c()),(p,A)=>g.value.length?(r(),u("div",ql,[h("div",{class:"wl-reaction-title",textContent:_(m.value.reactionTitle)},null,8,Kl),h("ul",Zl,[(r(!0),u(P,null,X(g.value,({active:M,icon:R,desc:y},o)=>(r(),u("li",{key:o,class:q(["wl-reaction-item",{active:M}]),onClick:w=>S(o)},[h("div",Jl,[h("img",{src:R,alt:y},null,8,Xl),i.value===o?(r(),le(L(ve),{key:0,class:"wl-reaction-loading"})):(r(),u("div",{key:1,class:"wl-reaction-votes",textContent:_(n.value[o]||0)},null,8,Yl))]),h("div",{class:"wl-reaction-text",textContent:_(y)},null,8,Ql)],10,Gl))),128))])])):E("v-if",!0)}}),me=(e,a)=>{const l=e.__vccOpts||e;for(const[t,i]of a)l[t]=i;return l},ta=me(ea,[["__file","ArticleReaction.vue"]]);const la=["data-index"],aa=["src","title","onClick"];var na=ue({__name:"ImageWall",props:{items:{default:()=>[]},columnWidth:{default:300},gap:{default:0}},emits:["insert"],setup(e,{expose:a}){const l=e;a();let t=null;const i=x(null),n=x({}),m=x([]),d=()=>{const p=Math.floor((i.value.getBoundingClientRect().width+l.gap)/(l.columnWidth+l.gap));return p>0?p:1},g=p=>new Array(p).fill(null).map(()=>[]),c=async p=>{var A;if(p>=l.items.length)return;await Ht();const M=Array.from(((A=i.value)==null?void 0:A.children)||[]).reduce((R,y)=>y.getBoundingClientRect().height<R.getBoundingClientRect().height?y:R);m.value[Number(M.dataset.index)].push(p),await c(p+1)},f=async(p=!1)=>{if(m.value.length===d()&&!p)return;m.value=g(d());const A=window.scrollY;await c(0),window.scrollTo({top:A})},S=p=>{n.value[p.target.src]=!0};return fe(()=>{f(!0),t=new ResizeObserver(()=>{f()}),t.observe(i.value),te(()=>[l.items],()=>{n.value={},f(!0)}),te(()=>[l.columnWidth,l.gap],()=>{f()})}),zt(()=>t.unobserve(i.value)),(p,A)=>(r(),u("div",{ref_key:"wall",ref:i,class:"wl-gallery",style:Ze({gap:`${p.gap}px`})},[(r(!0),u(P,null,X(m.value,(M,R)=>(r(),u("div",{key:R,class:"wl-gallery-column","data-index":R,style:Ze({gap:`${p.gap}px`})},[(r(!0),u(P,null,X(M,y=>(r(),u(P,{key:y},[n.value[p.items[y].src]?E("v-if",!0):(r(),le(L(ve),{key:0,size:36,style:{margin:"20px auto"}})),h("img",{class:"wl-gallery-item",src:p.items[y].src,title:p.items[y].title,loading:"lazy",onLoad:S,onClick:o=>p.$emit("insert",`![](${p.items[y].src})`)},null,40,aa)],64))),128))],12,la))),128))],4))}}),oa=me(na,[["__file","ImageWall.vue"]]);const ia={class:"wl-comment"},ra={key:0,class:"wl-login-info"},sa={class:"wl-avatar"},ca=["title"],ua=["title"],va=["src"],ma=["title","textContent"],da={class:"wl-panel"},pa=["for","textContent"],ga=["id","onUpdate:modelValue","name","type"],ha=["placeholder"],fa={class:"wl-preview"},wa=h("hr",null,null,-1),ya=["innerHTML"],ka={class:"wl-footer"},ba={class:"wl-actions"},Ca={href:"https://guides.github.com/features/mastering-markdown/",title:"Markdown Guide","aria-label":"Markdown is supported",class:"wl-action",target:"_blank",rel:"noopener noreferrer"},$a=["title"],La=["title"],Ra=["title"],xa=["title"],Ea={class:"wl-info"},Ia=h("div",{class:"wl-captcha-container"},null,-1),Ua={class:"wl-text-number"},Aa={key:0},_a=["textContent"],Ma=["textContent"],Sa=["disabled"],ja=["placeholder"],za={key:1,class:"wl-loading"},Ha={key:0,class:"wl-tab-wrapper"},Va=["title","onClick"],Ta=["src","alt"],Fa={key:0,class:"wl-tabs"},Na=["onClick"],Wa=["src","alt","title"],Pa=["title"];var Ba=ue({__name:"CommentBox",props:{edit:{default:null},rootId:{default:""},replyId:{default:""},replyUser:{default:""}},emits:["log","cancelEdit","cancelReply","submit"],setup(e,{expose:a,emit:l}){const t=e,i=l;a();const n=Le("config"),m=Fl(),d=Tl(),g=be(),c=x({}),f=x(null),S=x(null),p=x(null),A=x(null),M=x(null),R=x(null),y=x(null),o=x({tabs:[],map:{}}),w=x(0),F=x(!1),B=x(!1),I=x(!1),z=x(""),oe=x(0),V=xe({loading:!0,list:[]}),ne=x(0),ee=x(!1),de=x(""),Y=x(!1),$=x(!1),k=W(()=>n.value.locale),j=W(()=>{var v;return!!((v=g.value)!=null&&v.token)}),K=W(()=>n.value.imageUploader!==!1),D=v=>{const s=f.value,b=s.selectionStart,H=s.selectionEnd||0,C=s.scrollTop;m.value=s.value.substring(0,b)+v+s.value.substring(H,s.value.length),s.focus(),s.selectionStart=b+v.length,s.selectionEnd=b+v.length,s.scrollTop=C},J=v=>{const s=v.key;(v.ctrlKey||v.metaKey)&&s==="Enter"&&Ve()},Z=v=>{const s=`![${n.value.locale.uploading} ${v.name}]()`;return D(s),Y.value=!0,Promise.resolve().then(()=>n.value.imageUploader(v)).then(b=>{m.value=m.value.replace(s,`\r
8
- ![${v.name}](${b})`)}).catch(b=>{alert(b.message),m.value=m.value.replace(s,"")}).then(()=>{Y.value=!1})},ce=v=>{var s;if((s=v.dataTransfer)!=null&&s.items){const b=ct(v.dataTransfer.items);b&&K.value&&(Z(b),v.preventDefault())}},He=v=>{if(v.clipboardData){const s=ct(v.clipboardData.items);s&&K.value&&Z(s)}},Ce=()=>{const v=S.value;v.files&&K.value&&Z(v.files[0]).then(()=>{v.value=""})},Ve=async()=>{var v,s,b,H,C,O;const{serverURL:N,lang:Q,login:pe,wordLimit:Be,requiredMeta:De,recaptchaV3Key:Oe,turnstileKey:qe}=n.value,Lt=await El(),T={comment:de.value,nick:d.value.nick,mail:d.value.mail,link:d.value.link,url:n.value.path,ua:Lt};if((v=g.value)!=null&&v.token)T.nick=g.value.display_name,T.mail=g.value.email,T.link=g.value.url;else{if(pe==="force")return;if(De.indexOf("nick")>-1&&!T.nick)return(s=c.value.nick)==null||s.focus(),alert(k.value.nickError);if(De.indexOf("mail")>-1&&!T.mail||T.mail&&!pl(T.mail))return(b=c.value.mail)==null||b.focus(),alert(k.value.mailError);T.nick||(T.nick=k.value.anonymous)}if(!T.comment){(H=f.value)==null||H.focus();return}if(!ee.value)return alert(k.value.wordHint.replace("$0",Be[0].toString()).replace("$1",Be[1].toString()).replace("$2",oe.value.toString()));T.comment=ut(T.comment,o.value.map),t.replyId&&t.rootId&&(T.pid=t.replyId,T.rid=t.rootId,T.at=t.replyUser),Y.value=!0;try{Oe&&(T.recaptchaV3=await Bl(Oe).execute("social")),qe&&(T.turnstile=await Dl(qe).execute("social"));const ge={serverURL:N,lang:Q,token:(C=g.value)==null?void 0:C.token,comment:T},$e=await(t.edit?he({objectId:t.edit.objectId,...ge}):Et(ge));if(Y.value=!1,$e.errmsg)return alert($e.errmsg);i("submit",$e.data),m.value="",z.value="",t.replyId&&i("cancelReply"),(O=t.edit)!=null&&O.objectId&&i("cancelEdit")}catch(ge){Y.value=!1,alert(ge.message)}},Ct=v=>{v.preventDefault();const{lang:s,serverURL:b}=n.value;It({serverURL:b,lang:s}).then(H=>{g.value=H,(H.remember?localStorage:sessionStorage).setItem("WALINE_USER",JSON.stringify(H)),i("log")})},$t=()=>{g.value={},localStorage.setItem("WALINE_USER","null"),sessionStorage.setItem("WALINE_USER","null"),i("log")},Te=v=>{v.preventDefault();const{lang:s,serverURL:b}=n.value,H=800,C=800,O=(window.innerWidth-H)/2,N=(window.innerHeight-C)/2,Q=new URLSearchParams({lng:s,token:g.value.token}),pe=window.open(`${b}/ui/profile?${Q.toString()}`,"_blank",`width=${H},height=${C},left=${O},top=${N},scrollbars=no,resizable=no,status=no,location=no,toolbar=no,menubar=no`);pe==null||pe.postMessage({type:"TOKEN",data:g.value.token},"*")},Fe=v=>{var s,b,H,C;!((s=p.value)!=null&&s.contains(v.target))&&!((b=A.value)!=null&&b.contains(v.target))&&(F.value=!1),!((H=M.value)!=null&&H.contains(v.target))&&!((C=R.value)!=null&&C.contains(v.target))&&(B.value=!1)},Ne=async v=>{var s;const{scrollTop:b,clientHeight:H,scrollHeight:C}=v.target,O=(H+b)/C,N=n.value.search,Q=((s=y.value)==null?void 0:s.value)||"";O<.9||V.loading||$.value||(V.loading=!0,(N.more&&V.list.length?await N.more(Q,V.list.length):await N.search(Q)).length?V.list=[...V.list,...N.more&&V.list.length?await N.more(Q,V.list.length):await N.search(Q)]:$.value=!0,V.loading=!1,setTimeout(()=>{v.target.scrollTop=b},50))},We=Dt(v=>{V.list=[],$.value=!1,Ne(v)},300);te([n,oe],([v,s])=>{const{wordLimit:b}=v;b?s<b[0]&&b[0]!==0?(ne.value=b[0],ee.value=!1):s>b[1]?(ne.value=b[1],ee.value=!1):(ne.value=b[1],ee.value=!0):(ne.value=0,ee.value=!0)},{immediate:!0});const Pe=({data:v})=>{!v||v.type!=="profile"||(g.value={...g.value,...v.data},[localStorage,sessionStorage].filter(s=>s.getItem("WALINE_USER")).forEach(s=>s.setItem("WALINE_USER",JSON.stringify(g))))};return fe(()=>{var v;document.body.addEventListener("click",Fe),window.addEventListener("message",Pe),(v=t.edit)!=null&&v.objectId&&(m.value=t.edit.orig),te(B,async s=>{if(!s)return;const b=n.value.search;y.value&&(y.value.value=""),V.loading=!0,V.list=b.default?await b.default():await b.search(""),V.loading=!1}),te(()=>m.value,s=>{const{highlighter:b,texRenderer:H}=n.value;de.value=s,z.value=$l(s,{emojiMap:o.value.map,highlighter:b,texRenderer:H}),oe.value=xl(s),s?Xe(f.value):Xe.destroy(f.value)},{immediate:!0}),te(()=>n.value.emoji,s=>fl(s).then(b=>{o.value=b}),{immediate:!0})}),Re(()=>{document.body.removeEventListener("click",Fe),window.removeEventListener("message",Pe)}),(v,s)=>{var b,H;return r(),u("div",ia,[L(n).login!=="disable"&&j.value&&!((b=v.edit)!=null&&b.objectId)?(r(),u("div",ra,[h("div",sa,[h("button",{type:"submit",class:"wl-logout-btn",title:k.value.logout,onClick:$t},[G(L(mt),{size:14})],8,ca),h("a",{href:"#",class:"wl-login-nick","aria-label":"Profile",title:k.value.profile,onClick:Te},[h("img",{src:L(g).avatar,alt:"avatar"},null,8,va)],8,ua)]),h("a",{href:"#",class:"wl-login-nick","aria-label":"Profile",title:k.value.profile,onClick:Te,textContent:_(L(g).display_name)},null,8,ma)])):E("v-if",!0),h("div",da,[L(n).login!=="force"&&L(n).meta.length&&!j.value?(r(),u("div",{key:0,class:q(["wl-header",`item${L(n).meta.length}`])},[(r(!0),u(P,null,X(L(n).meta,C=>(r(),u("div",{key:C,class:"wl-header-item"},[h("label",{for:`wl-${C}`,textContent:_(k.value[C]+(L(n).requiredMeta.includes(C)||!L(n).requiredMeta.length?"":`(${k.value.optional})`))},null,8,pa),we(h("input",{id:`wl-${C}`,ref_for:!0,ref:O=>{O&&(c.value[C]=O)},"onUpdate:modelValue":O=>L(d)[C]=O,class:q(["wl-input",`wl-${C}`]),name:C,type:C==="mail"?"email":"text"},null,10,ga),[[Vt,L(d)[C]]])]))),128))],2)):E("v-if",!0),we(h("textarea",{id:"wl-edit",ref_key:"editorRef",ref:f,"onUpdate:modelValue":s[0]||(s[0]=C=>Tt(m)?m.value=C:null),class:"wl-editor",placeholder:v.replyUser?`@${v.replyUser}`:k.value.placeholder,onKeydown:J,onDrop:ce,onPaste:He},null,40,ha),[[Ft,L(m)]]),we(h("div",fa,[wa,h("h4",null,_(k.value.preview)+":",1),h("div",{class:"wl-content",innerHTML:z.value},null,8,ya)],512),[[Ge,I.value]]),h("div",ka,[h("div",ba,[h("a",Ca,[G(L(Sl))]),we(h("button",{ref_key:"emojiButtonRef",ref:p,type:"button",class:q(["wl-action",{active:F.value}]),title:k.value.emoji,onClick:s[1]||(s[1]=C=>F.value=!F.value)},[G(L(Ul))],10,$a),[[Ge,o.value.tabs.length]]),L(n).search?(r(),u("button",{key:0,ref_key:"gifButtonRef",ref:M,type:"button",class:q(["wl-action",{active:B.value}]),title:k.value.gif,onClick:s[2]||(s[2]=C=>B.value=!B.value)},[G(L(Vl))],10,La)):E("v-if",!0),h("input",{id:"wl-image-upload",ref_key:"imageUploadRef",ref:S,class:"upload",type:"file",accept:".png,.jpg,.jpeg,.webp,.bmp,.gif",onChange:Ce},null,544),K.value?(r(),u("label",{key:1,for:"wl-image-upload",class:"wl-action",title:k.value.uploadImage},[G(L(Al))],8,Ra)):E("v-if",!0),h("button",{type:"button",class:q(["wl-action",{active:I.value}]),title:k.value.preview,onClick:s[3]||(s[3]=C=>I.value=!I.value)},[G(L(Ml))],10,xa)]),h("div",Ea,[Ia,h("div",Ua,[ae(_(oe.value)+" ",1),L(n).wordLimit?(r(),u("span",Aa,[ae("  /  "),h("span",{class:q({illegal:!ee.value}),textContent:_(ne.value)},null,10,_a)])):E("v-if",!0),ae("  "+_(k.value.word),1)]),L(n).login!=="disable"&&!j.value?(r(),u("button",{key:0,type:"button",class:"wl-btn",onClick:Ct,textContent:_(k.value.login)},null,8,Ma)):E("v-if",!0),L(n).login!=="force"||j.value?(r(),u("button",{key:1,type:"submit",class:"primary wl-btn",title:"Cmd|Ctrl + Enter",disabled:Y.value,onClick:Ve},[Y.value?(r(),le(L(ve),{key:0,size:16})):(r(),u(P,{key:1},[ae(_(k.value.submit),1)],64))],8,Sa)):E("v-if",!0)]),h("div",{ref_key:"gifPopupRef",ref:R,class:q(["wl-gif-popup",{display:B.value}])},[h("input",{ref_key:"gifSearchInputRef",ref:y,type:"text",placeholder:k.value.gifSearchPlaceholder,onInput:s[4]||(s[4]=(...C)=>L(We)&&L(We)(...C))},null,40,ja),V.list.length?(r(),le(oa,{key:0,items:V.list,"column-width":200,gap:6,onInsert:s[5]||(s[5]=C=>D(C)),onScroll:Ne},null,8,["items"])):E("v-if",!0),V.loading?(r(),u("div",za,[G(L(ve),{size:30})])):E("v-if",!0)],2),h("div",{ref_key:"emojiPopupRef",ref:A,class:q(["wl-emoji-popup",{display:F.value}])},[(r(!0),u(P,null,X(o.value.tabs,(C,O)=>(r(),u(P,{key:C.name},[O===w.value?(r(),u("div",Ha,[(r(!0),u(P,null,X(C.items,N=>(r(),u("button",{key:N,type:"button",title:N,onClick:Q=>D(`:${N}:`)},[F.value?(r(),u("img",{key:0,class:"wl-emoji",src:o.value.map[N],alt:N,loading:"lazy",referrerPolicy:"no-referrer"},null,8,Ta)):E("v-if",!0)],8,Va))),128))])):E("v-if",!0)],64))),128)),o.value.tabs.length>1?(r(),u("div",Fa,[(r(!0),u(P,null,X(o.value.tabs,(C,O)=>(r(),u("button",{key:C.name,type:"button",class:q(["wl-tab",{active:w.value===O}]),onClick:N=>w.value=O},[h("img",{class:"wl-emoji",src:C.icon,alt:C.name,title:C.name,loading:"lazy",referrerPolicy:"no-referrer"},null,8,Wa)],10,Na))),128))])):E("v-if",!0)],2)])]),v.replyId||(H=v.edit)!=null&&H.objectId?(r(),u("button",{key:1,type:"button",class:"wl-close",title:k.value.cancelReply,onClick:s[6]||(s[6]=C=>v.$emit(v.replyId?"cancelReply":"cancelEdit"))},[G(L(mt),{size:24})],8,Pa)):E("v-if",!0)])}}}),wt=me(Ba,[["__file","CommentBox.vue"]]);const Da=["id"],Oa={class:"wl-user","aria-hidden":"true"},qa=["src"],Ka={class:"wl-card"},Za={class:"wl-head"},Ga=["href"],Ja={key:1,class:"wl-nick"},Xa=["textContent"],Ya=["textContent"],Qa=["textContent"],en=["textContent"],tn=["textContent"],ln={class:"wl-comment-actions"},an=["title"],nn=["title"],on={class:"wl-meta","aria-hidden":"true"},rn=["data-value","textContent"],sn=["innerHTML"],cn={key:1,class:"wl-admin-actions"},un={class:"wl-comment-status"},vn=["disabled","onClick","textContent"],mn={key:3,class:"wl-quote"};var dn=ue({__name:"CommentCard",props:{comment:{},edit:{default:null},rootId:{},reply:{default:null}},emits:["log","submit","delete","edit","like","status","sticky","reply"],setup(e,{emit:a}){const l=e,t=a,i=["approved","waiting","spam"],n=Le("config"),m=pt(),d=Ot(),g=be(),c=W(()=>n.value.locale),f=W(()=>{const{link:o}=l.comment;return o?it(o)?o:`https://${o}`:""}),S=W(()=>m.value.includes(l.comment.objectId)),p=W(()=>ml(l.comment.insertedAt,d.value,c.value)),A=W(()=>g.value.type==="administrator"),M=W(()=>l.comment.user_id&&g.value.objectId===l.comment.user_id),R=W(()=>{var o;return l.comment.objectId===((o=l.reply)==null?void 0:o.objectId)}),y=W(()=>{var o;return l.comment.objectId===((o=l.edit)==null?void 0:o.objectId)});return(o,w)=>{var F;const B=Nt("CommentCard",!0);return r(),u("div",{id:o.comment.objectId,class:"wl-card-item"},[h("div",Oa,[o.comment.avatar?(r(),u("img",{key:0,class:"wl-user-avatar",src:o.comment.avatar},null,8,qa)):E("v-if",!0),o.comment.type?(r(),le(L(Hl),{key:1})):E("v-if",!0)]),h("div",Ka,[h("div",Za,[f.value?(r(),u("a",{key:0,class:"wl-nick",href:f.value,target:"_blank",rel:"nofollow noopener noreferrer"},_(o.comment.nick),9,Ga)):(r(),u("span",Ja,_(o.comment.nick),1)),o.comment.type==="administrator"?(r(),u("span",{key:2,class:"wl-badge",textContent:_(c.value.admin)},null,8,Xa)):E("v-if",!0),o.comment.label?(r(),u("span",{key:3,class:"wl-badge",textContent:_(o.comment.label)},null,8,Ya)):E("v-if",!0),o.comment.sticky?(r(),u("span",{key:4,class:"wl-badge",textContent:_(c.value.sticky)},null,8,Qa)):E("v-if",!0),typeof o.comment.level=="number"?(r(),u("span",{key:5,class:q(`wl-badge level${o.comment.level}`),textContent:_(c.value[`level${o.comment.level}`]||`Level ${o.comment.level}`)},null,10,en)):E("v-if",!0),h("span",{class:"wl-time",textContent:_(p.value)},null,8,tn),h("div",ln,[A.value||M.value?(r(),u(P,{key:0},[h("button",{type:"button",class:"wl-edit",onClick:w[0]||(w[0]=I=>t("edit",o.comment))},[G(L(zl))]),h("button",{type:"button",class:"wl-delete",onClick:w[1]||(w[1]=I=>t("delete",o.comment))},[G(L(Il))])],64)):E("v-if",!0),h("button",{type:"button",class:"wl-like",title:S.value?c.value.cancelLike:c.value.like,onClick:w[2]||(w[2]=I=>t("like",o.comment))},[G(L(_l),{active:S.value},null,8,["active"]),ae(" "+_("like"in o.comment?o.comment.like:""),1)],8,an),h("button",{type:"button",class:q(["wl-reply",{active:R.value}]),title:R.value?c.value.cancelReply:c.value.reply,onClick:w[3]||(w[3]=I=>t("reply",R.value?null:o.comment))},[G(L(jl))],10,nn)])]),h("div",on,[(r(),u(P,null,X(["addr","browser","os"],I=>(r(),u(P,null,[o.comment[I]?(r(),u("span",{key:I,class:q(`wl-${I}`),"data-value":o.comment[I],textContent:_(o.comment[I])},null,10,rn)):E("v-if",!0)],64))),64))]),y.value?E("v-if",!0):(r(),u("div",{key:0,class:"wl-content",innerHTML:o.comment.comment},null,8,sn)),A.value&&!y.value?(r(),u("div",cn,[h("span",un,[(r(),u(P,null,X(i,I=>h("button",{key:I,type:"submit",class:q(`wl-btn wl-${I}`),disabled:o.comment.status===I,onClick:z=>t("status",{status:I,comment:o.comment}),textContent:_(c.value[I])},null,10,vn)),64))]),A.value&&!("rid"in o.comment)?(r(),u("button",{key:0,type:"submit",class:"wl-btn wl-sticky",onClick:w[4]||(w[4]=I=>t("sticky",o.comment))},_(o.comment.sticky?c.value.unsticky:c.value.sticky),1)):E("v-if",!0)])):E("v-if",!0),R.value||y.value?(r(),u("div",{key:2,class:q({"wl-reply-wrapper":R.value,"wl-edit-wrapper":y.value})},[G(wt,{edit:o.edit,"reply-id":(F=o.reply)==null?void 0:F.objectId,"reply-user":o.comment.nick,"root-id":o.rootId,onLog:w[5]||(w[5]=I=>t("log")),onCancelReply:w[6]||(w[6]=I=>t("reply",null)),onCancelEdit:w[7]||(w[7]=I=>t("edit",null)),onSubmit:w[8]||(w[8]=I=>t("submit",I))},null,8,["edit","reply-id","reply-user","root-id"])],2)):E("v-if",!0),"children"in o.comment?(r(),u("div",mn,[(r(!0),u(P,null,X(o.comment.children,I=>(r(),le(B,{key:I.objectId,comment:I,reply:o.reply,edit:o.edit,"root-id":o.rootId,onLog:w[9]||(w[9]=z=>t("log")),onDelete:w[10]||(w[10]=z=>t("delete",z)),onEdit:w[11]||(w[11]=z=>t("edit",z)),onLike:w[12]||(w[12]=z=>t("like",z)),onReply:w[13]||(w[13]=z=>t("reply",z)),onStatus:w[14]||(w[14]=z=>t("status",z)),onSticky:w[15]||(w[15]=z=>t("sticky",z)),onSubmit:w[16]||(w[16]=z=>t("submit",z))},null,8,["comment","reply","edit","root-id"]))),128))])):E("v-if",!0)])],8,Da)}}}),pn=me(dn,[["__file","CommentCard.vue"]]);const yt="3.0.0-alpha.6",gn={"data-waline":""},hn={class:"wl-meta-head"},fn={class:"wl-count"},wn=["textContent"],yn={class:"wl-sort"},kn=["onClick"],bn={class:"wl-cards"},Cn={key:1,class:"wl-operation"},$n=["textContent"],Ln={key:2,class:"wl-loading"},Rn=["textContent"],xn={key:4,class:"wl-operation"},En=["textContent"],In={key:5,class:"wl-power"},Un=h("a",{href:"https://github.com/walinejs/waline",target:"_blank",rel:"noopener noreferrer"}," Waline ",-1);var An=ue({__name:"WalineComment",props:["serverURL","path","meta","requiredMeta","dark","commentSorting","lang","locale","pageSize","wordLimit","emoji","login","highlighter","texRenderer","imageUploader","search","copyright","recaptchaV3Key","turnstileKey","reaction"],setup(e){const a=e,l={latest:"insertedAt_desc",oldest:"insertedAt_asc",hottest:"like_desc"},t=Object.keys(l),i=be(),n=pt(),m=x("loading"),d=x(0),g=x(1),c=x(0),f=W(()=>cl(a)),S=x(f.value.commentSorting),p=x([]),A=x(null),M=x(null),R=W(()=>ul(f.value.dark)),y=W(()=>f.value.locale);qt(R,{id:"waline-darkmode"});let o;const w=$=>{var k;const{serverURL:j,path:K,pageSize:D}=f.value,J=new AbortController;m.value="loading",o==null||o(),At({serverURL:j,lang:f.value.lang,path:K,pageSize:D,sortBy:l[S.value],page:$,signal:J.signal,token:(k=i.value)==null?void 0:k.token}).then(Z=>{m.value="success",d.value=Z.count,p.value.push(...Z.data),g.value=$,c.value=Z.totalPages}).catch(Z=>{Z.name!=="AbortError"&&(console.error(Z.message),m.value="error")}),o=J.abort.bind(J)},F=()=>w(g.value+1),B=()=>{d.value=0,p.value=[],w(1)},I=$=>{S.value!==$&&(S.value=$,B())},z=$=>{A.value=$},oe=$=>{M.value=$},V=$=>{if(M.value)M.value.comment=$.comment,M.value.orig=$.orig;else if("rid"in $){const k=p.value.find(({objectId:j})=>j===$.rid);if(!k)return;Array.isArray(k.children)||(k.children=[]),k.children.push($)}else p.value.unshift($),d.value+=1},ne=async({comment:$,status:k})=>{var j;if($.status===k)return;const{serverURL:K,lang:D}=f.value;await he({serverURL:K,lang:D,token:(j=i.value)==null?void 0:j.token,objectId:$.objectId,comment:{status:k}}),$.status=k},ee=async $=>{var k;if("rid"in $)return;const{serverURL:j,lang:K}=f.value;await he({serverURL:j,lang:K,token:(k=i.value)==null?void 0:k.token,objectId:$.objectId,comment:{sticky:$.sticky?0:1}}),$.sticky=!$.sticky},de=async({objectId:$})=>{var k;if(!confirm("Are you sure you want to delete this comment?"))return;const{serverURL:j,lang:K}=f.value;await Ut({serverURL:j,lang:K,token:(k=i.value)==null?void 0:k.token,objectId:$}),p.value.some((D,J)=>D.objectId===$?(p.value=p.value.filter((Z,ce)=>ce!==J),!0):D.children.some((Z,ce)=>Z.objectId===$?(p.value[J].children=D.children.filter((He,Ce)=>Ce!==ce),!0):!1))},Y=async $=>{var k;const{serverURL:j,lang:K}=f.value,{objectId:D}=$,J=n.value.includes(D);await he({serverURL:j,lang:K,objectId:D,token:(k=i.value)==null?void 0:k.token,comment:{like:!J}}),J?n.value=n.value.filter(Z=>Z!==D):(n.value=[...n.value,D],n.value.length>50&&(n.value=n.value.slice(-50))),$.like=($.like||0)+(J?-1:1)};return Wt("config",f),fe(()=>{te(()=>[a.serverURL,a.path],()=>B(),{immediate:!0})}),Re(()=>o==null?void 0:o()),($,k)=>(r(),u("div",gn,[G(ta),A.value?E("v-if",!0):(r(),le(wt,{key:0,onLog:B,onSubmit:V})),h("div",hn,[h("div",fn,[d.value?(r(),u("span",{key:0,class:"wl-num",textContent:_(d.value)},null,8,wn)):E("v-if",!0),ae(" "+_(y.value.comment),1)]),h("ul",yn,[(r(!0),u(P,null,X(L(t),j=>(r(),u("li",{key:j,class:q([j===S.value?"active":""]),onClick:K=>I(j)},_(y.value[j]),11,kn))),128))])]),h("div",bn,[(r(!0),u(P,null,X(p.value,j=>(r(),le(pn,{key:j.objectId,"root-id":j.objectId,comment:j,reply:A.value,edit:M.value,onLog:B,onReply:z,onEdit:oe,onSubmit:V,onStatus:ne,onDelete:de,onSticky:ee,onLike:Y},null,8,["root-id","comment","reply","edit"]))),128))]),m.value==="error"?(r(),u("div",Cn,[h("button",{type:"button",class:"wl-btn",onClick:B,textContent:_(y.value.refresh)},null,8,$n)])):m.value==="loading"?(r(),u("div",Ln,[G(L(ve),{size:30})])):p.value.length?g.value<c.value?(r(),u("div",xn,[h("button",{type:"button",class:"wl-btn",onClick:F,textContent:_(y.value.more)},null,8,En)])):E("v-if",!0):(r(),u("div",{key:3,class:"wl-empty",textContent:_(y.value.sofa)},null,8,Rn)),f.value.copyright?(r(),u("div",In,[ae(" Powered by "),Un,ae(" v"+_(L(yt)),1)])):E("v-if",!0)]))}}),_n=me(An,[["__file","WalineComment.vue"]]);const kt=(e,a)=>{a.forEach((l,t)=>{l.innerText=e[t].toString()})},bt=({serverURL:e,path:a=window.location.pathname,selector:l=".waline-pageview-count",update:t=!0,lang:i=navigator.language})=>{const n=new AbortController,m=Array.from(document.querySelectorAll(l)),d=c=>{const f=ze(c);return f!==null&&a!==f},g=c=>Mt({serverURL:ke(e),paths:c.map(f=>ze(f)||a),lang:i,signal:n.signal}).then(f=>kt(f,c)).catch(st);if(t){const c=m.filter(S=>!d(S)),f=m.filter(d);_t({serverURL:ke(e),path:a,lang:i}).then(([S])=>kt(new Array(c.length).fill(S),c)),f.length&&g(f)}else g(m);return n.abort.bind(n)},Mn=({el:e="#waline",path:a=window.location.pathname,comment:l=!1,pageview:t=!1,...i})=>{const n=e?je(e):null;if(e&&!n)throw new Error("Option 'el' do not match any domElement!");if(!i.serverURL)throw new Error("Option 'serverURL' is missing!");const m=xe({...i}),d=xe({comment:l,pageview:t,path:a}),g=()=>{d.comment&&vt({serverURL:m.serverURL,path:d.path,...typeof d.comment=="string"?{selector:d.comment}:{}})},c=()=>{d.pageview&&bt({serverURL:m.serverURL,path:d.path,...typeof d.pageview=="string"?{selector:d.pageview}:{}})},f=n?Pt(()=>U(_n,{path:d.path,...m})):null;f&&f.mount(n);const S=Je(g),p=Je(c);return{el:n,update:({comment:A,pageview:M,path:R=window.location.pathname,...y}={})=>{Object.entries(y).forEach(([o,w])=>{m[o]=w}),d.path=R,A!==void 0&&(d.comment=A),M!==void 0&&(d.pageview=M)},destroy:()=>{f==null||f.unmount(),S(),p()}}},Sn=({el:e,serverURL:a,count:l,lang:t=navigator.language})=>{var i;const n=be(),m=je(e),d=new AbortController;return St({serverURL:a,count:l,lang:t,signal:d.signal,token:(i=n.value)==null?void 0:i.token}).then(g=>m&&g.length?(m.innerHTML=`<ul class="wl-recent-list">${g.map(c=>`<li class="wl-recent-item"><a href="${c.url}">${c.nick}</a>:${c.comment}</li>`).join("")}</ul>`,{comments:g,destroy:()=>{d.abort(),m.innerHTML=""}}):{comments:g,destroy:()=>d.abort()})},jn=({el:e,serverURL:a,count:l,locale:t,lang:i=navigator.language,mode:n="list"})=>{const m=je(e),d=new AbortController;return jt({serverURL:a,pageSize:l,lang:i,signal:d.signal}).then(g=>!m||!g.length?{users:g,destroy:()=>d.abort()}:(t={...se[i]||se[et],...typeof t=="object"?t:{}},m.innerHTML=`<ul class="wl-user-${n}">${g.map((c,f)=>[`<li class="wl-user-item" aria-label="${c.nick}">`,c.link&&`<a href="${c.link}" target="_blank">`,'<div class="wl-user-avatar">',`<img src="${c.avatar}" alt="${c.nick}">`,`<span class="wl-user-badge">${f+1}</span>`,"</div>",'<div class="wl-user-meta">','<div class="wl-user-name">',c.nick,c.level&&`<span class="wl-badge">${t?t[`level${c.level}`]:`Level ${c.level}`}</span>`,c.label&&`<span class="wl-badge">${c.label}</span>`,"</div>",c.link&&c.link,"</div>",c.link&&"</a>","</li>"].filter(S=>S).join("")).join("")}</ul>`,{users:g,destroy:()=>{d.abort(),m.innerHTML=""}}))};export{Sn as RecentComments,jn as UserList,vt as commentCount,se as defaultLocales,Mn as init,bt as pageviewCount,yt as version};
8
+ ![${v.name}](${b})`)}).catch(b=>{alert(b.message),m.value=m.value.replace(s,"")}).then(()=>{Y.value=!1})},ce=v=>{var s;if((s=v.dataTransfer)!=null&&s.items){const b=ct(v.dataTransfer.items);b&&K.value&&(Z(b),v.preventDefault())}},He=v=>{if(v.clipboardData){const s=ct(v.clipboardData.items);s&&K.value&&Z(s)}},Ce=()=>{const v=S.value;v.files&&K.value&&Z(v.files[0]).then(()=>{v.value=""})},Ve=async()=>{var v,s,b,H,C,O;const{serverURL:N,lang:Q,login:pe,wordLimit:Be,requiredMeta:De,recaptchaV3Key:Oe,turnstileKey:qe}=n.value,Lt=await El(),T={comment:de.value,nick:d.value.nick,mail:d.value.mail,link:d.value.link,url:n.value.path,ua:Lt};if((v=g.value)!=null&&v.token)T.nick=g.value.display_name,T.mail=g.value.email,T.link=g.value.url;else{if(pe==="force")return;if(De.indexOf("nick")>-1&&!T.nick)return(s=c.value.nick)==null||s.focus(),alert(k.value.nickError);if(De.indexOf("mail")>-1&&!T.mail||T.mail&&!pl(T.mail))return(b=c.value.mail)==null||b.focus(),alert(k.value.mailError);T.nick||(T.nick=k.value.anonymous)}if(!T.comment){(H=f.value)==null||H.focus();return}if(!ee.value)return alert(k.value.wordHint.replace("$0",Be[0].toString()).replace("$1",Be[1].toString()).replace("$2",oe.value.toString()));T.comment=ut(T.comment,o.value.map),t.replyId&&t.rootId&&(T.pid=t.replyId,T.rid=t.rootId,T.at=t.replyUser),Y.value=!0;try{Oe&&(T.recaptchaV3=await Bl(Oe).execute("social")),qe&&(T.turnstile=await Dl(qe).execute("social"));const ge={serverURL:N,lang:Q,token:(C=g.value)==null?void 0:C.token,comment:T},$e=await(t.edit?he({objectId:t.edit.objectId,...ge}):Et(ge));if(Y.value=!1,$e.errmsg)return alert($e.errmsg);i("submit",$e.data),m.value="",z.value="",t.replyId&&i("cancelReply"),(O=t.edit)!=null&&O.objectId&&i("cancelEdit")}catch(ge){Y.value=!1,alert(ge.message)}},Ct=v=>{v.preventDefault();const{lang:s,serverURL:b}=n.value;It({serverURL:b,lang:s}).then(H=>{g.value=H,(H.remember?localStorage:sessionStorage).setItem("WALINE_USER",JSON.stringify(H)),i("log")})},$t=()=>{g.value={},localStorage.setItem("WALINE_USER","null"),sessionStorage.setItem("WALINE_USER","null"),i("log")},Te=v=>{v.preventDefault();const{lang:s,serverURL:b}=n.value,H=800,C=800,O=(window.innerWidth-H)/2,N=(window.innerHeight-C)/2,Q=new URLSearchParams({lng:s,token:g.value.token}),pe=window.open(`${b}/ui/profile?${Q.toString()}`,"_blank",`width=${H},height=${C},left=${O},top=${N},scrollbars=no,resizable=no,status=no,location=no,toolbar=no,menubar=no`);pe==null||pe.postMessage({type:"TOKEN",data:g.value.token},"*")},Fe=v=>{var s,b,H,C;!((s=p.value)!=null&&s.contains(v.target))&&!((b=A.value)!=null&&b.contains(v.target))&&(F.value=!1),!((H=M.value)!=null&&H.contains(v.target))&&!((C=R.value)!=null&&C.contains(v.target))&&(B.value=!1)},Ne=async v=>{var s;const{scrollTop:b,clientHeight:H,scrollHeight:C}=v.target,O=(H+b)/C,N=n.value.search,Q=((s=y.value)==null?void 0:s.value)||"";O<.9||V.loading||$.value||(V.loading=!0,(N.more&&V.list.length?await N.more(Q,V.list.length):await N.search(Q)).length?V.list=[...V.list,...N.more&&V.list.length?await N.more(Q,V.list.length):await N.search(Q)]:$.value=!0,V.loading=!1,setTimeout(()=>{v.target.scrollTop=b},50))},We=Dt(v=>{V.list=[],$.value=!1,Ne(v)},300);te([n,oe],([v,s])=>{const{wordLimit:b}=v;b?s<b[0]&&b[0]!==0?(ne.value=b[0],ee.value=!1):s>b[1]?(ne.value=b[1],ee.value=!1):(ne.value=b[1],ee.value=!0):(ne.value=0,ee.value=!0)},{immediate:!0});const Pe=({data:v})=>{!v||v.type!=="profile"||(g.value={...g.value,...v.data},[localStorage,sessionStorage].filter(s=>s.getItem("WALINE_USER")).forEach(s=>s.setItem("WALINE_USER",JSON.stringify(g))))};return fe(()=>{var v;document.body.addEventListener("click",Fe),window.addEventListener("message",Pe),(v=t.edit)!=null&&v.objectId&&(m.value=t.edit.orig),te(B,async s=>{if(!s)return;const b=n.value.search;y.value&&(y.value.value=""),V.loading=!0,V.list=b.default?await b.default():await b.search(""),V.loading=!1}),te(()=>m.value,s=>{const{highlighter:b,texRenderer:H}=n.value;de.value=s,z.value=$l(s,{emojiMap:o.value.map,highlighter:b,texRenderer:H}),oe.value=xl(s),s?Xe(f.value):Xe.destroy(f.value)},{immediate:!0}),te(()=>n.value.emoji,s=>fl(s).then(b=>{o.value=b}),{immediate:!0})}),Re(()=>{document.body.removeEventListener("click",Fe),window.removeEventListener("message",Pe)}),(v,s)=>{var b,H;return r(),u("div",ia,[L(n).login!=="disable"&&j.value&&!((b=v.edit)!=null&&b.objectId)?(r(),u("div",ra,[h("div",sa,[h("button",{type:"submit",class:"wl-logout-btn",title:k.value.logout,onClick:$t},[G(L(mt),{size:14})],8,ca),h("a",{href:"#",class:"wl-login-nick","aria-label":"Profile",title:k.value.profile,onClick:Te},[h("img",{src:L(g).avatar,alt:"avatar"},null,8,va)],8,ua)]),h("a",{href:"#",class:"wl-login-nick","aria-label":"Profile",title:k.value.profile,onClick:Te,textContent:_(L(g).display_name)},null,8,ma)])):E("v-if",!0),h("div",da,[L(n).login!=="force"&&L(n).meta.length&&!j.value?(r(),u("div",{key:0,class:q(["wl-header",`item${L(n).meta.length}`])},[(r(!0),u(P,null,X(L(n).meta,C=>(r(),u("div",{key:C,class:"wl-header-item"},[h("label",{for:`wl-${C}`,textContent:_(k.value[C]+(L(n).requiredMeta.includes(C)||!L(n).requiredMeta.length?"":`(${k.value.optional})`))},null,8,pa),we(h("input",{id:`wl-${C}`,ref_for:!0,ref:O=>{O&&(c.value[C]=O)},"onUpdate:modelValue":O=>L(d)[C]=O,class:q(["wl-input",`wl-${C}`]),name:C,type:C==="mail"?"email":"text"},null,10,ga),[[Vt,L(d)[C]]])]))),128))],2)):E("v-if",!0),we(h("textarea",{id:"wl-edit",ref_key:"editorRef",ref:f,"onUpdate:modelValue":s[0]||(s[0]=C=>Tt(m)?m.value=C:null),class:"wl-editor",placeholder:v.replyUser?`@${v.replyUser}`:k.value.placeholder,onKeydown:J,onDrop:ce,onPaste:He},null,40,ha),[[Ft,L(m)]]),we(h("div",fa,[wa,h("h4",null,_(k.value.preview)+":",1),h("div",{class:"wl-content",innerHTML:z.value},null,8,ya)],512),[[Ge,I.value]]),h("div",ka,[h("div",ba,[h("a",Ca,[G(L(Sl))]),we(h("button",{ref_key:"emojiButtonRef",ref:p,type:"button",class:q(["wl-action",{active:F.value}]),title:k.value.emoji,onClick:s[1]||(s[1]=C=>F.value=!F.value)},[G(L(Ul))],10,$a),[[Ge,o.value.tabs.length]]),L(n).search?(r(),u("button",{key:0,ref_key:"gifButtonRef",ref:M,type:"button",class:q(["wl-action",{active:B.value}]),title:k.value.gif,onClick:s[2]||(s[2]=C=>B.value=!B.value)},[G(L(Vl))],10,La)):E("v-if",!0),h("input",{id:"wl-image-upload",ref_key:"imageUploadRef",ref:S,class:"upload",type:"file",accept:".png,.jpg,.jpeg,.webp,.bmp,.gif",onChange:Ce},null,544),K.value?(r(),u("label",{key:1,for:"wl-image-upload",class:"wl-action",title:k.value.uploadImage},[G(L(Al))],8,Ra)):E("v-if",!0),h("button",{type:"button",class:q(["wl-action",{active:I.value}]),title:k.value.preview,onClick:s[3]||(s[3]=C=>I.value=!I.value)},[G(L(Ml))],10,xa)]),h("div",Ea,[Ia,h("div",Ua,[ae(_(oe.value)+" ",1),L(n).wordLimit?(r(),u("span",Aa,[ae("  /  "),h("span",{class:q({illegal:!ee.value}),textContent:_(ne.value)},null,10,_a)])):E("v-if",!0),ae("  "+_(k.value.word),1)]),L(n).login!=="disable"&&!j.value?(r(),u("button",{key:0,type:"button",class:"wl-btn",onClick:Ct,textContent:_(k.value.login)},null,8,Ma)):E("v-if",!0),L(n).login!=="force"||j.value?(r(),u("button",{key:1,type:"submit",class:"primary wl-btn",title:"Cmd|Ctrl + Enter",disabled:Y.value,onClick:Ve},[Y.value?(r(),le(L(ve),{key:0,size:16})):(r(),u(P,{key:1},[ae(_(k.value.submit),1)],64))],8,Sa)):E("v-if",!0)]),h("div",{ref_key:"gifPopupRef",ref:R,class:q(["wl-gif-popup",{display:B.value}])},[h("input",{ref_key:"gifSearchInputRef",ref:y,type:"text",placeholder:k.value.gifSearchPlaceholder,onInput:s[4]||(s[4]=(...C)=>L(We)&&L(We)(...C))},null,40,ja),V.list.length?(r(),le(oa,{key:0,items:V.list,"column-width":200,gap:6,onInsert:s[5]||(s[5]=C=>D(C)),onScroll:Ne},null,8,["items"])):E("v-if",!0),V.loading?(r(),u("div",za,[G(L(ve),{size:30})])):E("v-if",!0)],2),h("div",{ref_key:"emojiPopupRef",ref:A,class:q(["wl-emoji-popup",{display:F.value}])},[(r(!0),u(P,null,X(o.value.tabs,(C,O)=>(r(),u(P,{key:C.name},[O===w.value?(r(),u("div",Ha,[(r(!0),u(P,null,X(C.items,N=>(r(),u("button",{key:N,type:"button",title:N,onClick:Q=>D(`:${N}:`)},[F.value?(r(),u("img",{key:0,class:"wl-emoji",src:o.value.map[N],alt:N,loading:"lazy",referrerPolicy:"no-referrer"},null,8,Ta)):E("v-if",!0)],8,Va))),128))])):E("v-if",!0)],64))),128)),o.value.tabs.length>1?(r(),u("div",Fa,[(r(!0),u(P,null,X(o.value.tabs,(C,O)=>(r(),u("button",{key:C.name,type:"button",class:q(["wl-tab",{active:w.value===O}]),onClick:N=>w.value=O},[h("img",{class:"wl-emoji",src:C.icon,alt:C.name,title:C.name,loading:"lazy",referrerPolicy:"no-referrer"},null,8,Wa)],10,Na))),128))])):E("v-if",!0)],2)])]),v.replyId||(H=v.edit)!=null&&H.objectId?(r(),u("button",{key:1,type:"button",class:"wl-close",title:k.value.cancelReply,onClick:s[6]||(s[6]=C=>v.$emit(v.replyId?"cancelReply":"cancelEdit"))},[G(L(mt),{size:24})],8,Pa)):E("v-if",!0)])}}}),wt=me(Ba,[["__file","CommentBox.vue"]]);const Da=["id"],Oa={class:"wl-user","aria-hidden":"true"},qa=["src"],Ka={class:"wl-card"},Za={class:"wl-head"},Ga=["href"],Ja={key:1,class:"wl-nick"},Xa=["textContent"],Ya=["textContent"],Qa=["textContent"],en=["textContent"],tn=["textContent"],ln={class:"wl-comment-actions"},an=["title"],nn=["title"],on={class:"wl-meta","aria-hidden":"true"},rn=["data-value","textContent"],sn=["innerHTML"],cn={key:1,class:"wl-admin-actions"},un={class:"wl-comment-status"},vn=["disabled","onClick","textContent"],mn={key:3,class:"wl-quote"};var dn=ue({__name:"CommentCard",props:{comment:{},edit:{default:null},rootId:{},reply:{default:null}},emits:["log","submit","delete","edit","like","status","sticky","reply"],setup(e,{emit:a}){const l=e,t=a,i=["approved","waiting","spam"],n=Le("config"),m=pt(),d=Ot(),g=be(),c=W(()=>n.value.locale),f=W(()=>{const{link:o}=l.comment;return o?it(o)?o:`https://${o}`:""}),S=W(()=>m.value.includes(l.comment.objectId)),p=W(()=>ml(l.comment.insertedAt,d.value,c.value)),A=W(()=>g.value.type==="administrator"),M=W(()=>l.comment.user_id&&g.value.objectId===l.comment.user_id),R=W(()=>{var o;return l.comment.objectId===((o=l.reply)==null?void 0:o.objectId)}),y=W(()=>{var o;return l.comment.objectId===((o=l.edit)==null?void 0:o.objectId)});return(o,w)=>{var F;const B=Nt("CommentCard",!0);return r(),u("div",{id:o.comment.objectId,class:"wl-card-item"},[h("div",Oa,[o.comment.avatar?(r(),u("img",{key:0,class:"wl-user-avatar",src:o.comment.avatar},null,8,qa)):E("v-if",!0),o.comment.type?(r(),le(L(Hl),{key:1})):E("v-if",!0)]),h("div",Ka,[h("div",Za,[f.value?(r(),u("a",{key:0,class:"wl-nick",href:f.value,target:"_blank",rel:"nofollow noopener noreferrer"},_(o.comment.nick),9,Ga)):(r(),u("span",Ja,_(o.comment.nick),1)),o.comment.type==="administrator"?(r(),u("span",{key:2,class:"wl-badge",textContent:_(c.value.admin)},null,8,Xa)):E("v-if",!0),o.comment.label?(r(),u("span",{key:3,class:"wl-badge",textContent:_(o.comment.label)},null,8,Ya)):E("v-if",!0),o.comment.sticky?(r(),u("span",{key:4,class:"wl-badge",textContent:_(c.value.sticky)},null,8,Qa)):E("v-if",!0),typeof o.comment.level=="number"?(r(),u("span",{key:5,class:q(`wl-badge level${o.comment.level}`),textContent:_(c.value[`level${o.comment.level}`]||`Level ${o.comment.level}`)},null,10,en)):E("v-if",!0),h("span",{class:"wl-time",textContent:_(p.value)},null,8,tn),h("div",ln,[A.value||M.value?(r(),u(P,{key:0},[h("button",{type:"button",class:"wl-edit",onClick:w[0]||(w[0]=I=>t("edit",o.comment))},[G(L(zl))]),h("button",{type:"button",class:"wl-delete",onClick:w[1]||(w[1]=I=>t("delete",o.comment))},[G(L(Il))])],64)):E("v-if",!0),h("button",{type:"button",class:"wl-like",title:S.value?c.value.cancelLike:c.value.like,onClick:w[2]||(w[2]=I=>t("like",o.comment))},[G(L(_l),{active:S.value},null,8,["active"]),ae(" "+_("like"in o.comment?o.comment.like:""),1)],8,an),h("button",{type:"button",class:q(["wl-reply",{active:R.value}]),title:R.value?c.value.cancelReply:c.value.reply,onClick:w[3]||(w[3]=I=>t("reply",R.value?null:o.comment))},[G(L(jl))],10,nn)])]),h("div",on,[(r(),u(P,null,X(["addr","browser","os"],I=>(r(),u(P,null,[o.comment[I]?(r(),u("span",{key:I,class:q(`wl-${I}`),"data-value":o.comment[I],textContent:_(o.comment[I])},null,10,rn)):E("v-if",!0)],64))),64))]),y.value?E("v-if",!0):(r(),u("div",{key:0,class:"wl-content",innerHTML:o.comment.comment},null,8,sn)),A.value&&!y.value?(r(),u("div",cn,[h("span",un,[(r(),u(P,null,X(i,I=>h("button",{key:I,type:"submit",class:q(`wl-btn wl-${I}`),disabled:o.comment.status===I,onClick:z=>t("status",{status:I,comment:o.comment}),textContent:_(c.value[I])},null,10,vn)),64))]),A.value&&!("rid"in o.comment)?(r(),u("button",{key:0,type:"submit",class:"wl-btn wl-sticky",onClick:w[4]||(w[4]=I=>t("sticky",o.comment))},_(o.comment.sticky?c.value.unsticky:c.value.sticky),1)):E("v-if",!0)])):E("v-if",!0),R.value||y.value?(r(),u("div",{key:2,class:q({"wl-reply-wrapper":R.value,"wl-edit-wrapper":y.value})},[G(wt,{edit:o.edit,"reply-id":(F=o.reply)==null?void 0:F.objectId,"reply-user":o.comment.nick,"root-id":o.rootId,onLog:w[5]||(w[5]=I=>t("log")),onCancelReply:w[6]||(w[6]=I=>t("reply",null)),onCancelEdit:w[7]||(w[7]=I=>t("edit",null)),onSubmit:w[8]||(w[8]=I=>t("submit",I))},null,8,["edit","reply-id","reply-user","root-id"])],2)):E("v-if",!0),"children"in o.comment?(r(),u("div",mn,[(r(!0),u(P,null,X(o.comment.children,I=>(r(),le(B,{key:I.objectId,comment:I,reply:o.reply,edit:o.edit,"root-id":o.rootId,onLog:w[9]||(w[9]=z=>t("log")),onDelete:w[10]||(w[10]=z=>t("delete",z)),onEdit:w[11]||(w[11]=z=>t("edit",z)),onLike:w[12]||(w[12]=z=>t("like",z)),onReply:w[13]||(w[13]=z=>t("reply",z)),onStatus:w[14]||(w[14]=z=>t("status",z)),onSticky:w[15]||(w[15]=z=>t("sticky",z)),onSubmit:w[16]||(w[16]=z=>t("submit",z))},null,8,["comment","reply","edit","root-id"]))),128))])):E("v-if",!0)])],8,Da)}}}),pn=me(dn,[["__file","CommentCard.vue"]]);const yt="3.0.0-alpha.7",gn={"data-waline":""},hn={class:"wl-meta-head"},fn={class:"wl-count"},wn=["textContent"],yn={class:"wl-sort"},kn=["onClick"],bn={class:"wl-cards"},Cn={key:1,class:"wl-operation"},$n=["textContent"],Ln={key:2,class:"wl-loading"},Rn=["textContent"],xn={key:4,class:"wl-operation"},En=["textContent"],In={key:5,class:"wl-power"},Un=h("a",{href:"https://github.com/walinejs/waline",target:"_blank",rel:"noopener noreferrer"}," Waline ",-1);var An=ue({__name:"WalineComment",props:["serverURL","path","meta","requiredMeta","dark","commentSorting","lang","locale","pageSize","wordLimit","emoji","login","highlighter","texRenderer","imageUploader","search","copyright","recaptchaV3Key","turnstileKey","reaction"],setup(e){const a=e,l={latest:"insertedAt_desc",oldest:"insertedAt_asc",hottest:"like_desc"},t=Object.keys(l),i=be(),n=pt(),m=x("loading"),d=x(0),g=x(1),c=x(0),f=W(()=>cl(a)),S=x(f.value.commentSorting),p=x([]),A=x(null),M=x(null),R=W(()=>ul(f.value.dark)),y=W(()=>f.value.locale);qt(R,{id:"waline-darkmode"});let o;const w=$=>{var k;const{serverURL:j,path:K,pageSize:D}=f.value,J=new AbortController;m.value="loading",o==null||o(),At({serverURL:j,lang:f.value.lang,path:K,pageSize:D,sortBy:l[S.value],page:$,signal:J.signal,token:(k=i.value)==null?void 0:k.token}).then(Z=>{m.value="success",d.value=Z.count,p.value.push(...Z.data),g.value=$,c.value=Z.totalPages}).catch(Z=>{Z.name!=="AbortError"&&(console.error(Z.message),m.value="error")}),o=J.abort.bind(J)},F=()=>w(g.value+1),B=()=>{d.value=0,p.value=[],w(1)},I=$=>{S.value!==$&&(S.value=$,B())},z=$=>{A.value=$},oe=$=>{M.value=$},V=$=>{if(M.value)M.value.comment=$.comment,M.value.orig=$.orig;else if("rid"in $){const k=p.value.find(({objectId:j})=>j===$.rid);if(!k)return;Array.isArray(k.children)||(k.children=[]),k.children.push($)}else p.value.unshift($),d.value+=1},ne=async({comment:$,status:k})=>{var j;if($.status===k)return;const{serverURL:K,lang:D}=f.value;await he({serverURL:K,lang:D,token:(j=i.value)==null?void 0:j.token,objectId:$.objectId,comment:{status:k}}),$.status=k},ee=async $=>{var k;if("rid"in $)return;const{serverURL:j,lang:K}=f.value;await he({serverURL:j,lang:K,token:(k=i.value)==null?void 0:k.token,objectId:$.objectId,comment:{sticky:$.sticky?0:1}}),$.sticky=!$.sticky},de=async({objectId:$})=>{var k;if(!confirm("Are you sure you want to delete this comment?"))return;const{serverURL:j,lang:K}=f.value;await Ut({serverURL:j,lang:K,token:(k=i.value)==null?void 0:k.token,objectId:$}),p.value.some((D,J)=>D.objectId===$?(p.value=p.value.filter((Z,ce)=>ce!==J),!0):D.children.some((Z,ce)=>Z.objectId===$?(p.value[J].children=D.children.filter((He,Ce)=>Ce!==ce),!0):!1))},Y=async $=>{var k;const{serverURL:j,lang:K}=f.value,{objectId:D}=$,J=n.value.includes(D);await he({serverURL:j,lang:K,objectId:D,token:(k=i.value)==null?void 0:k.token,comment:{like:!J}}),J?n.value=n.value.filter(Z=>Z!==D):(n.value=[...n.value,D],n.value.length>50&&(n.value=n.value.slice(-50))),$.like=($.like||0)+(J?-1:1)};return Wt("config",f),fe(()=>{te(()=>[a.serverURL,a.path],()=>B(),{immediate:!0})}),Re(()=>o==null?void 0:o()),($,k)=>(r(),u("div",gn,[G(ta),A.value?E("v-if",!0):(r(),le(wt,{key:0,onLog:B,onSubmit:V})),h("div",hn,[h("div",fn,[d.value?(r(),u("span",{key:0,class:"wl-num",textContent:_(d.value)},null,8,wn)):E("v-if",!0),ae(" "+_(y.value.comment),1)]),h("ul",yn,[(r(!0),u(P,null,X(L(t),j=>(r(),u("li",{key:j,class:q([j===S.value?"active":""]),onClick:K=>I(j)},_(y.value[j]),11,kn))),128))])]),h("div",bn,[(r(!0),u(P,null,X(p.value,j=>(r(),le(pn,{key:j.objectId,"root-id":j.objectId,comment:j,reply:A.value,edit:M.value,onLog:B,onReply:z,onEdit:oe,onSubmit:V,onStatus:ne,onDelete:de,onSticky:ee,onLike:Y},null,8,["root-id","comment","reply","edit"]))),128))]),m.value==="error"?(r(),u("div",Cn,[h("button",{type:"button",class:"wl-btn",onClick:B,textContent:_(y.value.refresh)},null,8,$n)])):m.value==="loading"?(r(),u("div",Ln,[G(L(ve),{size:30})])):p.value.length?g.value<c.value?(r(),u("div",xn,[h("button",{type:"button",class:"wl-btn",onClick:F,textContent:_(y.value.more)},null,8,En)])):E("v-if",!0):(r(),u("div",{key:3,class:"wl-empty",textContent:_(y.value.sofa)},null,8,Rn)),f.value.copyright?(r(),u("div",In,[ae(" Powered by "),Un,ae(" v"+_(L(yt)),1)])):E("v-if",!0)]))}}),_n=me(An,[["__file","WalineComment.vue"]]);const kt=(e,a)=>{a.forEach((l,t)=>{l.innerText=e[t].toString()})},bt=({serverURL:e,path:a=window.location.pathname,selector:l=".waline-pageview-count",update:t=!0,lang:i=navigator.language})=>{const n=new AbortController,m=Array.from(document.querySelectorAll(l)),d=c=>{const f=ze(c);return f!==null&&a!==f},g=c=>Mt({serverURL:ke(e),paths:c.map(f=>ze(f)||a),lang:i,signal:n.signal}).then(f=>kt(f,c)).catch(st);if(t){const c=m.filter(S=>!d(S)),f=m.filter(d);_t({serverURL:ke(e),path:a,lang:i}).then(([S])=>kt(new Array(c.length).fill(S),c)),f.length&&g(f)}else g(m);return n.abort.bind(n)},Mn=({el:e="#waline",path:a=window.location.pathname,comment:l=!1,pageview:t=!1,...i})=>{const n=e?je(e):null;if(e&&!n)throw new Error("Option 'el' do not match any domElement!");if(!i.serverURL)throw new Error("Option 'serverURL' is missing!");const m=xe({...i}),d=xe({comment:l,pageview:t,path:a}),g=()=>{d.comment&&vt({serverURL:m.serverURL,path:d.path,...typeof d.comment=="string"?{selector:d.comment}:{}})},c=()=>{d.pageview&&bt({serverURL:m.serverURL,path:d.path,...typeof d.pageview=="string"?{selector:d.pageview}:{}})},f=n?Pt(()=>U(_n,{path:d.path,...m})):null;f&&f.mount(n);const S=Je(g),p=Je(c);return{el:n,update:({comment:A,pageview:M,path:R=window.location.pathname,...y}={})=>{Object.entries(y).forEach(([o,w])=>{m[o]=w}),d.path=R,A!==void 0&&(d.comment=A),M!==void 0&&(d.pageview=M)},destroy:()=>{f==null||f.unmount(),S(),p()}}},Sn=({el:e,serverURL:a,count:l,lang:t=navigator.language})=>{var i;const n=be(),m=je(e),d=new AbortController;return St({serverURL:a,count:l,lang:t,signal:d.signal,token:(i=n.value)==null?void 0:i.token}).then(g=>m&&g.length?(m.innerHTML=`<ul class="wl-recent-list">${g.map(c=>`<li class="wl-recent-item"><a href="${c.url}">${c.nick}</a>:${c.comment}</li>`).join("")}</ul>`,{comments:g,destroy:()=>{d.abort(),m.innerHTML=""}}):{comments:g,destroy:()=>d.abort()})},jn=({el:e,serverURL:a,count:l,locale:t,lang:i=navigator.language,mode:n="list"})=>{const m=je(e),d=new AbortController;return jt({serverURL:a,pageSize:l,lang:i,signal:d.signal}).then(g=>!m||!g.length?{users:g,destroy:()=>d.abort()}:(t={...se[i]||se[et],...typeof t=="object"?t:{}},m.innerHTML=`<ul class="wl-user-${n}">${g.map((c,f)=>[`<li class="wl-user-item" aria-label="${c.nick}">`,c.link&&`<a href="${c.link}" target="_blank">`,'<div class="wl-user-avatar">',`<img src="${c.avatar}" alt="${c.nick}">`,`<span class="wl-user-badge">${f+1}</span>`,"</div>",'<div class="wl-user-meta">','<div class="wl-user-name">',c.nick,c.level&&`<span class="wl-badge">${t?t[`level${c.level}`]:`Level ${c.level}`}</span>`,c.label&&`<span class="wl-badge">${c.label}</span>`,"</div>",c.link&&c.link,"</div>",c.link&&"</a>","</li>"].filter(S=>S).join("")).join("")}</ul>`,{users:g,destroy:()=>{d.abort(),m.innerHTML=""}}))};export{Sn as RecentComments,jn as UserList,vt as commentCount,se as defaultLocales,Mn as init,bt as pageviewCount,yt as version};
9
9
  //# sourceMappingURL=shim.js.map
package/dist/waline.js CHANGED
@@ -50,5 +50,5 @@ ${t}</tr>
50
50
  `+(s.tokens?this.parseInline(s.tokens):s.text);r+=n?this.renderer.paragraph(o):o;continue}default:{const s='Token with "'+l.type+'" type was not found.';if(this.options.silent)return console.error(s),"";throw new Error(s)}}}return r}parseInline(t,n){n=n||this.renderer;let r="";for(let i=0;i<t.length;i++){const l=t[i];if(this.options.extensions&&this.options.extensions.renderers&&this.options.extensions.renderers[l.type]){const s=this.options.extensions.renderers[l.type].call({parser:this},l);if(s!==!1||!["escape","html","link","image","strong","em","codespan","br","del","text"].includes(l.type)){r+=s||"";continue}}switch(l.type){case"escape":{const s=l;r+=n.text(s.text);break}case"html":{const s=l;r+=n.html(s.text);break}case"link":{const s=l;r+=n.link(s.href,s.title,this.parseInline(s.tokens,n));break}case"image":{const s=l;r+=n.image(s.href,s.title,s.text);break}case"strong":{const s=l;r+=n.strong(this.parseInline(s.tokens,n));break}case"em":{const s=l;r+=n.em(this.parseInline(s.tokens,n));break}case"codespan":{const s=l;r+=n.codespan(s.text);break}case"br":{r+=n.br();break}case"del":{const s=l;r+=n.del(this.parseInline(s.tokens,n));break}case"text":{const s=l;r+=n.text(s.text);break}default:{const s='Token with "'+l.type+'" type was not found.';if(this.options.silent)return console.error(s),"";throw new Error(s)}}}return r}}class bn{options;constructor(t){this.options=t||$t}preprocess(t){return t}postprocess(t){return t}processAllTokens(t){return t}}ze(bn,"passThroughHooks",new Set(["preprocess","postprocess","processAllTokens"]));class Bs{constructor(...t){_r(this,En);_r(this,br);ze(this,"defaults",vi());ze(this,"options",this.setOptions);ze(this,"parse",Rn(this,En,Ei).call(this,nt.lex,rt.parse));ze(this,"parseInline",Rn(this,En,Ei).call(this,nt.lexInline,rt.parseInline));ze(this,"Parser",rt);ze(this,"Renderer",vr);ze(this,"TextRenderer",Ci);ze(this,"Lexer",nt);ze(this,"Tokenizer",hr);ze(this,"Hooks",bn);this.use(...t)}walkTokens(t,n){var i,l;let r=[];for(const s of t)switch(r=r.concat(n.call(this,s)),s.type){case"table":{const o=s;for(const a of o.header)r=r.concat(this.walkTokens(a.tokens,n));for(const a of o.rows)for(const c of a)r=r.concat(this.walkTokens(c.tokens,n));break}case"list":{const o=s;r=r.concat(this.walkTokens(o.items,n));break}default:{const o=s;(l=(i=this.defaults.extensions)==null?void 0:i.childTokens)!=null&&l[o.type]?this.defaults.extensions.childTokens[o.type].forEach(a=>{r=r.concat(this.walkTokens(o[a],n))}):o.tokens&&(r=r.concat(this.walkTokens(o.tokens,n)))}}return r}use(...t){const n=this.defaults.extensions||{renderers:{},childTokens:{}};return t.forEach(r=>{const i={...r};if(i.async=this.defaults.async||i.async||!1,r.extensions&&(r.extensions.forEach(l=>{if(!l.name)throw new Error("extension name required");if("renderer"in l){const s=n.renderers[l.name];s?n.renderers[l.name]=function(...o){let a=l.renderer.apply(this,o);return a===!1&&(a=s.apply(this,o)),a}:n.renderers[l.name]=l.renderer}if("tokenizer"in l){if(!l.level||l.level!=="block"&&l.level!=="inline")throw new Error("extension level must be 'block' or 'inline'");const s=n[l.level];s?s.unshift(l.tokenizer):n[l.level]=[l.tokenizer],l.start&&(l.level==="block"?n.startBlock?n.startBlock.push(l.start):n.startBlock=[l.start]:l.level==="inline"&&(n.startInline?n.startInline.push(l.start):n.startInline=[l.start]))}"childTokens"in l&&l.childTokens&&(n.childTokens[l.name]=l.childTokens)}),i.extensions=n),r.renderer){const l=this.defaults.renderer||new vr(this.defaults);for(const s in r.renderer){if(!(s in l))throw new Error(`renderer '${s}' does not exist`);if(s==="options")continue;const o=s,a=r.renderer[o],c=l[o];l[o]=(...f)=>{let p=a.apply(l,f);return p===!1&&(p=c.apply(l,f)),p||""}}i.renderer=l}if(r.tokenizer){const l=this.defaults.tokenizer||new hr(this.defaults);for(const s in r.tokenizer){if(!(s in l))throw new Error(`tokenizer '${s}' does not exist`);if(["options","rules","lexer"].includes(s))continue;const o=s,a=r.tokenizer[o],c=l[o];l[o]=(...f)=>{let p=a.apply(l,f);return p===!1&&(p=c.apply(l,f)),p}}i.tokenizer=l}if(r.hooks){const l=this.defaults.hooks||new bn;for(const s in r.hooks){if(!(s in l))throw new Error(`hook '${s}' does not exist`);if(s==="options")continue;const o=s,a=r.hooks[o],c=l[o];bn.passThroughHooks.has(s)?l[o]=f=>{if(this.defaults.async)return Promise.resolve(a.call(l,f)).then(h=>c.call(l,h));const p=a.call(l,f);return c.call(l,p)}:l[o]=(...f)=>{let p=a.apply(l,f);return p===!1&&(p=c.apply(l,f)),p}}i.hooks=l}if(r.walkTokens){const l=this.defaults.walkTokens,s=r.walkTokens;i.walkTokens=function(o){let a=[];return a.push(s.call(this,o)),l&&(a=a.concat(l.call(this,o))),a}}this.defaults={...this.defaults,...i}}),this}setOptions(t){return this.defaults={...this.defaults,...t},this}lexer(t,n){return nt.lex(t,n??this.defaults)}parser(t,n){return rt.parse(t,n??this.defaults)}}En=new WeakSet,Ei=function(t,n){return(r,i)=>{const l={...i},s={...this.defaults,...l};this.defaults.async===!0&&l.async===!1&&(s.silent||console.warn("marked(): The async option was set to true by an extension. The async: false option sent to parse will be ignored."),s.async=!0);const o=Rn(this,br,uo).call(this,!!s.silent,!!s.async);if(typeof r>"u"||r===null)return o(new Error("marked(): input parameter is undefined or null"));if(typeof r!="string")return o(new Error("marked(): input parameter is of type "+Object.prototype.toString.call(r)+", string expected"));if(s.hooks&&(s.hooks.options=s),s.async)return Promise.resolve(s.hooks?s.hooks.preprocess(r):r).then(a=>t(a,s)).then(a=>s.hooks?s.hooks.processAllTokens(a):a).then(a=>s.walkTokens?Promise.all(this.walkTokens(a,s.walkTokens)).then(()=>a):a).then(a=>n(a,s)).then(a=>s.hooks?s.hooks.postprocess(a):a).catch(o);try{s.hooks&&(r=s.hooks.preprocess(r));let a=t(r,s);s.hooks&&(a=s.hooks.processAllTokens(a)),s.walkTokens&&this.walkTokens(a,s.walkTokens);let c=n(a,s);return s.hooks&&(c=s.hooks.postprocess(c)),c}catch(a){return o(a)}}},br=new WeakSet,uo=function(t,n){return r=>{if(r.message+=`
51
51
  Please report this to https://github.com/markedjs/marked.`,t){const i="<p>An error occurred:</p><pre>"+Le(r.message+"",!0)+"</pre>";return n?Promise.resolve(i):i}if(n)return Promise.reject(r);throw r}};const Et=new Bs;function fe(e,t){return Et.parse(e,t)}fe.options=fe.setOptions=function(e){return Et.setOptions(e),fe.defaults=Et.defaults,Ts(fe.defaults),fe},fe.getDefaults=vi,fe.defaults=$t,fe.use=function(...e){return Et.use(...e),fe.defaults=Et.defaults,Ts(fe.defaults),fe},fe.walkTokens=function(e,t){return Et.walkTokens(e,t)},fe.parseInline=Et.parseInline,fe.Parser=rt,fe.parser=rt.parse,fe.Renderer=vr,fe.TextRenderer=Ci,fe.Lexer=nt,fe.lexer=nt.lex,fe.Tokenizer=hr,fe.Hooks=bn,fe.parse=fe;function ef(e){if(typeof e=="function"&&(e={highlight:e}),!e||typeof e.highlight!="function")throw new Error("Must provide highlight function");return typeof e.langPrefix!="string"&&(e.langPrefix="language-"),{async:!!e.async,walkTokens(t){if(t.type!=="code")return;const n=tf(t);if(e.async)return Promise.resolve(e.highlight(t.text,n)).then(Vs(t));const r=e.highlight(t.text,n);if(r instanceof Promise)throw new Error("markedHighlight is not set to async but the highlight function is async. Set the async option to true on markedHighlight to await the async highlight function.");Vs(t)(r)},renderer:{code(t,n,r){const i=(n||"").match(/\S*/)[0],l=i?` class="${e.langPrefix}${Zs(i)}"`:"";return t=t.replace(/\n$/,""),`<pre><code${l}>${r?t:Zs(t,!0)}
52
52
  </code></pre>`}}}}function tf(e){return(e.lang||"").match(/\S*/)[0]}function Vs(e){return t=>{typeof t=="string"&&t!==e.text&&(e.escaped=!0,e.text=t)}}const Ws=/[&<>"']/,nf=new RegExp(Ws.source,"g"),Ks=/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/,rf=new RegExp(Ks.source,"g"),lf={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"},qs=e=>lf[e];function Zs(e,t){if(t){if(Ws.test(e))return e.replace(nf,qs)}else if(Ks.test(e))return e.replace(rf,qs);return e}const sf=/\$.*?\$/,of=/^\$(.*?)\$/,af=/^(?:\s{0,3})\$\$((?:[^\n]|\n[^\n])+?)\n{0,1}\$\$/,cf=e=>[{name:"blockMath",level:"block",tokenizer(t){const n=af.exec(t);if(n!==null)return{type:"html",raw:n[0],text:e(!0,n[1])}}},{name:"inlineMath",level:"inline",start(t){const n=t.search(sf);return n!==-1?n:t.length},tokenizer(t){const n=of.exec(t);if(n!==null)return{type:"html",raw:n[0],text:e(!1,n[1])}}}],Js=(e="",t={})=>e.replace(/:(.+?):/g,(n,r)=>t[r]?`<img class="wl-emoji" src="${t[r]}" alt="${r}">`:n),uf=(e,{emojiMap:t,highlighter:n,texRenderer:r})=>{const i=new Bs;if(i.setOptions({breaks:!0}),n&&i.use(ef({highlight:n})),r){const l=cf(r);i.use({extensions:l})}return i.parse(Js(e,t))},$i=e=>e.dataset.path||null,ff=e=>e.match(/[\w\d\s,.\u00C0-\u024F\u0400-\u04FF]+/giu),df=e=>e.match(/[\u4E00-\u9FD5]/gu),hf=e=>{var t,n;return(((t=ff(e))==null?void 0:t.reduce((r,i)=>r+(["",",","."].includes(i.trim())?0:i.trim().split(/\s+/u).length),0))||0)+(((n=df(e))==null?void 0:n.length)||0)},pf=async()=>{if(!navigator)return"";const{userAgentData:e}=navigator;let t=navigator.userAgent;if(!e||e.platform!=="Windows")return t;const{platformVersion:n}=await e.getHighEntropyValues(["platformVersion"]);return n&&parseInt(n.split(".")[0])>=13&&(t=t.replace("Windows NT 10.0","Windows NT 11.0")),t},Qs=({serverURL:e,path:t=window.location.pathname,selector:n=".waline-comment-count",lang:r=navigator.language})=>{const i=new AbortController,l=document.querySelectorAll(n);return l.length&&zi({serverURL:In(e),paths:Array.from(l).map(s=>Ki($i(s)||t)),lang:r,signal:i.signal}).then(s=>{l.forEach((o,a)=>{o.innerText=s[a].toString()})}).catch(Es),i.abort.bind(i)},Ys=({size:e})=>ee("svg",{class:"wl-close-icon",viewBox:"0 0 1024 1024",width:e,height:e},[ee("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"}),ee("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"})]),gf=()=>ee("svg",{viewBox:"0 0 1024 1024",width:"24",height:"24"},ee("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"})),mf=()=>ee("svg",{viewBox:"0 0 1024 1024",width:"24",height:"24"},ee("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"})),vf=()=>ee("svg",{viewBox:"0 0 1024 1024",width:"24",height:"24"},[ee("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"}),ee("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"})]),wf=({active:e=!1})=>ee("svg",{viewBox:"0 0 1024 1024",width:"24",height:"24"},[ee("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"})]),yf=()=>ee("svg",{viewBox:"0 0 1024 1024",width:"24",height:"24"},[ee("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"}),ee("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"})]),bf=()=>ee("svg",{width:"16",height:"16",ariaHidden:"true"},ee("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"})),kf=()=>ee("svg",{viewBox:"0 0 1024 1024",width:"24",height:"24"},ee("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"})),xf=()=>ee("svg",{viewBox:"0 0 1024 1024",width:"24",height:"24"},ee("path",{d:"M813.039 318.772L480.53 651.278H360.718V531.463L693.227 198.961C697.904 194.284 704.027 192 710.157 192C716.302 192 722.436 194.284 727.114 198.961L813.039 284.88C817.72 289.561 820 295.684 820 301.825C820 307.95 817.72 314.093 813.039 318.772ZM710.172 261.888L420.624 551.431V591.376H460.561L750.109 301.825L710.172 261.888ZM490.517 291.845H240.906V771.09H720.156V521.479C720.156 504.947 733.559 491.529 750.109 491.529C766.653 491.529 780.063 504.947 780.063 521.479V791.059C780.063 813.118 762.18 831 740.125 831H220.937C198.882 831 181 813.118 181 791.059V271.872C181 249.817 198.882 231.935 220.937 231.935H490.517C507.06 231.935 520.47 245.352 520.47 261.888C520.47 278.424 507.06 291.845 490.517 291.845Z",fill:"currentColor"})),_f=()=>ee("svg",{class:"verified-icon",viewBox:"0 0 1024 1024",width:"14",height:"14"},ee("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"})),kn=({size:e=100})=>ee("svg",{width:e,height:e,viewBox:"0 0 100 100",preserveAspectRatio:"xMidYMid"},ee("circle",{cx:50,cy:50,fill:"none",stroke:"currentColor",strokeWidth:"4",r:"40","stroke-dasharray":"85 30"},ee("animateTransform",{attributeName:"transform",type:"rotate",repeatCount:"indefinite",dur:"1s",values:"0 50 50;360 50 50",keyTimes:"0;1"}))),Cf=()=>ee("svg",{width:24,height:24,fill:"currentcolor",viewBox:"0 0 24 24"},[ee("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"}),ee("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"})]),$f=()=>Dt("WALINE_USER_META",{nick:"",mail:"",link:""}),Ef=()=>Dt("WALINE_COMMENT_BOX_EDITOR",""),Rf="WALINE_LIKE";let Xs=null;const Gs=()=>Xs||(Xs=Dt(Rf,[])),Tf="WALINE_REACTION";let eo=null;const Af=()=>eo??(eo=Dt(Tf,{}));var wr=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{},to={},Bt={},xn={},If=wr&&wr.__awaiter||function(e,t,n,r){function i(l){return l instanceof n?l:new n(function(s){s(l)})}return new(n||(n=Promise))(function(l,s){function o(f){try{c(r.next(f))}catch(p){s(p)}}function a(f){try{c(r.throw(f))}catch(p){s(p)}}function c(f){f.done?l(f.value):i(f.value).then(o,a)}c((r=r.apply(e,t||[])).next())})},Lf=wr&&wr.__generator||function(e,t){var n={label:0,sent:function(){if(l[0]&1)throw l[1];return l[1]},trys:[],ops:[]},r,i,l,s;return s={next:o(0),throw:o(1),return:o(2)},typeof Symbol=="function"&&(s[Symbol.iterator]=function(){return this}),s;function o(c){return function(f){return a([c,f])}}function a(c){if(r)throw new TypeError("Generator is already executing.");for(;n;)try{if(r=1,i&&(l=c[0]&2?i.return:c[0]?i.throw||((l=i.return)&&l.call(i),0):i.next)&&!(l=l.call(i,c[1])).done)return l;switch(i=0,l&&(c=[c[0]&2,l.value]),c[0]){case 0:case 1:l=c;break;case 4:return n.label++,{value:c[1],done:!1};case 5:n.label++,i=c[1],c=[0];continue;case 7:c=n.ops.pop(),n.trys.pop();continue;default:if(l=n.trys,!(l=l.length>0&&l[l.length-1])&&(c[0]===6||c[0]===2)){n=0;continue}if(c[0]===3&&(!l||c[1]>l[0]&&c[1]<l[3])){n.label=c[1];break}if(c[0]===6&&n.label<l[1]){n.label=l[1],l=c;break}if(l&&n.label<l[2]){n.label=l[2],n.ops.push(c);break}l[2]&&n.ops.pop(),n.trys.pop();continue}c=t.call(e,n)}catch(f){c=[6,f],i=0}finally{r=l=0}if(c[0]&5)throw c[1];return{value:c[0]?c[1]:void 0,done:!0}}};Object.defineProperty(xn,"__esModule",{value:!0}),xn.ReCaptchaInstance=void 0;var Sf=function(){function e(t,n,r){this.siteKey=t,this.recaptchaID=n,this.recaptcha=r,this.styleContainer=null}return e.prototype.execute=function(t){return If(this,void 0,void 0,function(){return Lf(this,function(n){return[2,this.recaptcha.enterprise?this.recaptcha.enterprise.execute(this.recaptchaID,{action:t}):this.recaptcha.execute(this.recaptchaID,{action:t})]})})},e.prototype.getSiteKey=function(){return this.siteKey},e.prototype.hideBadge=function(){this.styleContainer===null&&(this.styleContainer=document.createElement("style"),this.styleContainer.innerHTML=".grecaptcha-badge{visibility:hidden !important;}",document.head.appendChild(this.styleContainer))},e.prototype.showBadge=function(){this.styleContainer!==null&&(document.head.removeChild(this.styleContainer),this.styleContainer=null)},e}();xn.ReCaptchaInstance=Sf,Object.defineProperty(Bt,"__esModule",{value:!0}),Bt.getInstance=Bt.load=void 0;var Mf=xn,dt;(function(e){e[e.NOT_LOADED=0]="NOT_LOADED",e[e.LOADING=1]="LOADING",e[e.LOADED=2]="LOADED"})(dt||(dt={}));var no=function(){function e(){}return e.load=function(t,n){if(n===void 0&&(n={}),typeof document>"u")return Promise.reject(new Error("This is a library for the browser!"));if(e.getLoadingState()===dt.LOADED)return e.instance.getSiteKey()===t?Promise.resolve(e.instance):Promise.reject(new Error("reCAPTCHA already loaded with different site key!"));if(e.getLoadingState()===dt.LOADING)return t!==e.instanceSiteKey?Promise.reject(new Error("reCAPTCHA already loaded with different site key!")):new Promise(function(i,l){e.successfulLoadingConsumers.push(function(s){return i(s)}),e.errorLoadingRunnable.push(function(s){return l(s)})});e.instanceSiteKey=t,e.setLoadingState(dt.LOADING);var r=new e;return new Promise(function(i,l){r.loadScript(t,n.useRecaptchaNet||!1,n.useEnterprise||!1,n.renderParameters?n.renderParameters:{},n.customUrl).then(function(){e.setLoadingState(dt.LOADED);var s=r.doExplicitRender(grecaptcha,t,n.explicitRenderParameters?n.explicitRenderParameters:{},n.useEnterprise||!1),o=new Mf.ReCaptchaInstance(t,s,grecaptcha);e.successfulLoadingConsumers.forEach(function(a){return a(o)}),e.successfulLoadingConsumers=[],n.autoHideBadge&&o.hideBadge(),e.instance=o,i(o)}).catch(function(s){e.errorLoadingRunnable.forEach(function(o){return o(s)}),e.errorLoadingRunnable=[],l(s)})})},e.getInstance=function(){return e.instance},e.setLoadingState=function(t){e.loadingState=t},e.getLoadingState=function(){return e.loadingState===null?dt.NOT_LOADED:e.loadingState},e.prototype.loadScript=function(t,n,r,i,l){var s=this;n===void 0&&(n=!1),r===void 0&&(r=!1),i===void 0&&(i={}),l===void 0&&(l="");var o=document.createElement("script");o.setAttribute("recaptcha-v3-script","");var a="https://www.google.com/recaptcha/api.js";n&&(r?a="https://recaptcha.net/recaptcha/enterprise.js":a="https://recaptcha.net/recaptcha/api.js"),r&&(a="https://www.google.com/recaptcha/enterprise.js"),l&&(a=l),i.render&&(i.render=void 0);var c=this.buildQueryString(i);return o.src=a+"?render=explicit"+c,new Promise(function(f,p){o.addEventListener("load",s.waitForScriptToLoad(function(){f(o)},r),!1),o.onerror=function(h){e.setLoadingState(dt.NOT_LOADED),p(h)},document.head.appendChild(o)})},e.prototype.buildQueryString=function(t){var n=Object.keys(t);return n.length<1?"":"&"+Object.keys(t).filter(function(r){return!!t[r]}).map(function(r){return r+"="+t[r]}).join("&")},e.prototype.waitForScriptToLoad=function(t,n){var r=this;return function(){window.grecaptcha===void 0?setTimeout(function(){r.waitForScriptToLoad(t,n)},e.SCRIPT_LOAD_DELAY):n?window.grecaptcha.enterprise.ready(function(){t()}):window.grecaptcha.ready(function(){t()})}},e.prototype.doExplicitRender=function(t,n,r,i){var l={sitekey:n,badge:r.badge,size:r.size,tabindex:r.tabindex};return r.container?i?t.enterprise.render(r.container,l):t.render(r.container,l):i?t.enterprise.render(l):t.render(l)},e.loadingState=null,e.instance=null,e.instanceSiteKey=null,e.successfulLoadingConsumers=[],e.errorLoadingRunnable=[],e.SCRIPT_LOAD_DELAY=25,e}();Bt.load=no.load,Bt.getInstance=no.getInstance,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.ReCaptchaInstance=e.getInstance=e.load=void 0;var t=Bt;Object.defineProperty(e,"load",{enumerable:!0,get:function(){return t.load}}),Object.defineProperty(e,"getInstance",{enumerable:!0,get:function(){return t.getInstance}});var n=xn;Object.defineProperty(e,"ReCaptchaInstance",{enumerable:!0,get:function(){return n.ReCaptchaInstance}})}(to);const ro={},zf=e=>{const t=ro[e]??(ro[e]=to.load(e,{useRecaptchaNet:!0,autoHideBadge:!0}));return{execute:n=>t.then(r=>r.execute(n))}},Of=e=>({execute:async t=>{const{load:n}=hu("https://challenges.cloudflare.com/turnstile/v0/api.js",void 0,{async:!1});await n();const r=window==null?void 0:window.turnstile;return new Promise(i=>{r==null||r.ready(()=>{r==null||r.render(".wl-captcha-container",{sitekey:e,action:t,size:"compact",callback:i})})})}}),jf="WALINE_USER";let io=null;const yr=()=>io??(io=Dt(jf,{})),Pf={key:0,class:"wl-reaction"},Uf=["textContent"],Ff={class:"wl-reaction-list"},Nf=["onClick"],Hf={class:"wl-reaction-img"},Df=["src","alt"],Bf=["textContent"],Vf=["textContent"];var Wf=ln({__name:"ArticleReaction",setup(e,{expose:t}){t();const n=Af(),r=tr("config"),i=W(-1),l=W([]),s=ye(()=>r.value.locale),o=ye(()=>r.value.reaction.length>0),a=ye(()=>{const{reaction:h,path:v}=r.value;return h.map((A,x)=>({icon:A,desc:s.value[`reaction${x}`],active:n.value[v]===x}))});let c;const f=async()=>{if(o.value){const{serverURL:h,lang:v,path:A,reaction:x}=r.value,C=new AbortController;c=C.abort.bind(C);const y=await Cr({serverURL:h,lang:v,paths:[A],type:x.map(($,H)=>`reaction${H}`),signal:C.signal});if(Array.isArray(y)||typeof y=="number")return;l.value=x.map(($,H)=>y[`reaction${H}`])}},p=async h=>{if(i.value===-1){const{serverURL:v,lang:A,path:x}=r.value,C=n.value[x];i.value=h,C!==void 0&&(await Tn({serverURL:v,lang:A,path:x,type:`reaction${C}`,action:"desc"}),l.value[C]=Math.max(l.value[C]-1,0)),C!==h&&(await Tn({serverURL:v,lang:A,path:x,type:`reaction${h}`}),l.value[h]=(l.value[h]||0)+1),C===h?delete n.value[x]:n.value[x]=h,i.value=-1}};return sn(()=>{Oe(()=>[r.value.serverURL,r.value.path],()=>{f()},{immediate:!0})}),Xn(()=>c==null?void 0:c()),(h,v)=>a.value.length?(I(),z("div",Pf,[P("div",{class:"wl-reaction-title",textContent:ne(s.value.reactionTitle)},null,8,Uf),P("ul",Ff,[(I(!0),z(ae,null,je(a.value,({active:A,icon:x,desc:C},y)=>(I(),z("li",{key:y,class:pe(["wl-reaction-item",{active:A}]),onClick:$=>p(y)},[P("div",Hf,[P("img",{src:x,alt:C},null,8,Df),i.value===y?(I(),Xe(K(kn),{key:0,class:"wl-reaction-loading"})):(I(),z("div",{key:1,class:"wl-reaction-votes",textContent:ne(l.value[y]||0)},null,8,Bf))]),P("div",{class:"wl-reaction-text",textContent:ne(C)},null,8,Vf)],10,Nf))),128))])])):Y("v-if",!0)}}),_n=(e,t)=>{const n=e.__vccOpts||e;for(const[r,i]of t)n[r]=i;return n},Kf=_n(Wf,[["__file","ArticleReaction.vue"]]),Cn=new Map;function qf(e){var t=Cn.get(e);t&&t.destroy()}function Zf(e){var t=Cn.get(e);t&&t.update()}var $n=null;typeof window>"u"?(($n=function(e){return e}).destroy=function(e){return e},$n.update=function(e){return e}):(($n=function(e,t){return e&&Array.prototype.forEach.call(e.length?e:[e],function(n){return function(r){if(r&&r.nodeName&&r.nodeName==="TEXTAREA"&&!Cn.has(r)){var i,l=null,s=window.getComputedStyle(r),o=(i=r.value,function(){c({testForHeightReduction:i===""||!r.value.startsWith(i),restoreTextAlign:null}),i=r.value}),a=(function(p){r.removeEventListener("autosize:destroy",a),r.removeEventListener("autosize:update",f),r.removeEventListener("input",o),window.removeEventListener("resize",f),Object.keys(p).forEach(function(h){return r.style[h]=p[h]}),Cn.delete(r)}).bind(r,{height:r.style.height,resize:r.style.resize,textAlign:r.style.textAlign,overflowY:r.style.overflowY,overflowX:r.style.overflowX,wordWrap:r.style.wordWrap});r.addEventListener("autosize:destroy",a),r.addEventListener("autosize:update",f),r.addEventListener("input",o),window.addEventListener("resize",f),r.style.overflowX="hidden",r.style.wordWrap="break-word",Cn.set(r,{destroy:a,update:f}),f()}function c(p){var h,v,A=p.restoreTextAlign,x=A===void 0?null:A,C=p.testForHeightReduction,y=C===void 0||C,$=s.overflowY;if(r.scrollHeight!==0&&(s.resize==="vertical"?r.style.resize="none":s.resize==="both"&&(r.style.resize="horizontal"),y&&(h=function(T){for(var U=[];T&&T.parentNode&&T.parentNode instanceof Element;)T.parentNode.scrollTop&&U.push([T.parentNode,T.parentNode.scrollTop]),T=T.parentNode;return function(){return U.forEach(function(J){var q=J[0],D=J[1];q.style.scrollBehavior="auto",q.scrollTop=D,q.style.scrollBehavior=null})}}(r),r.style.height=""),v=s.boxSizing==="content-box"?r.scrollHeight-(parseFloat(s.paddingTop)+parseFloat(s.paddingBottom)):r.scrollHeight+parseFloat(s.borderTopWidth)+parseFloat(s.borderBottomWidth),s.maxHeight!=="none"&&v>parseFloat(s.maxHeight)?(s.overflowY==="hidden"&&(r.style.overflow="scroll"),v=parseFloat(s.maxHeight)):s.overflowY!=="hidden"&&(r.style.overflow="hidden"),r.style.height=v+"px",x&&(r.style.textAlign=x),h&&h(),l!==v&&(r.dispatchEvent(new Event("autosize:resized",{bubbles:!0})),l=v),$!==s.overflow&&!x)){var H=s.textAlign;s.overflow==="hidden"&&(r.style.textAlign=H==="start"?"end":"start"),c({restoreTextAlign:H,testForHeightReduction:!0})}}function f(){c({testForHeightReduction:!0,restoreTextAlign:null})}}(n)}),e}).destroy=function(e){return e&&Array.prototype.forEach.call(e.length?e:[e],qf),e},$n.update=function(e){return e&&Array.prototype.forEach.call(e.length?e:[e],Zf),e});var Jf=$n,lo=Jf;const Qf=["data-index"],Yf=["src","title","onClick"];var Xf=ln({__name:"ImageWall",props:{items:{default:()=>[]},columnWidth:{default:300},gap:{default:0}},emits:["insert"],setup(e,{expose:t}){const n=e;t();let r=null;const i=W(null),l=W({}),s=W([]),o=()=>{const h=Math.floor((i.value.getBoundingClientRect().width+n.gap)/(n.columnWidth+n.gap));return h>0?h:1},a=h=>new Array(h).fill(null).map(()=>[]),c=async h=>{var v;if(h>=n.items.length)return;await Kn();const A=Array.from(((v=i.value)==null?void 0:v.children)||[]).reduce((x,C)=>C.getBoundingClientRect().height<x.getBoundingClientRect().height?C:x);s.value[Number(A.dataset.index)].push(h),await c(h+1)},f=async(h=!1)=>{if(s.value.length===o()&&!h)return;s.value=a(o());const v=window.scrollY;await c(0),window.scrollTo({top:v})},p=h=>{l.value[h.target.src]=!0};return sn(()=>{f(!0),r=new ResizeObserver(()=>{f()}),r.observe(i.value),Oe(()=>[n.items],()=>{l.value={},f(!0)}),Oe(()=>[n.columnWidth,n.gap],()=>{f()})}),Na(()=>r.unobserve(i.value)),(h,v)=>(I(),z("div",{ref_key:"wall",ref:i,class:"wl-gallery",style:Jt({gap:`${h.gap}px`})},[(I(!0),z(ae,null,je(s.value,(A,x)=>(I(),z("div",{key:x,class:"wl-gallery-column","data-index":x,style:Jt({gap:`${h.gap}px`})},[(I(!0),z(ae,null,je(A,C=>(I(),z(ae,{key:C},[l.value[h.items[C].src]?Y("v-if",!0):(I(),Xe(K(kn),{key:0,size:36,style:{margin:"20px auto"}})),P("img",{class:"wl-gallery-item",src:h.items[C].src,title:h.items[C].title,loading:"lazy",onLoad:p,onClick:y=>h.$emit("insert",`![](${h.items[C].src})`)},null,40,Yf)],64))),128))],12,Qf))),128))],4))}}),Gf=_n(Xf,[["__file","ImageWall.vue"]]);const ed={class:"wl-comment"},td={key:0,class:"wl-login-info"},nd={class:"wl-avatar"},rd=["title"],id=["title"],ld=["src"],sd=["title","textContent"],od={class:"wl-panel"},ad=["for","textContent"],cd=["id","onUpdate:modelValue","name","type"],ud=["placeholder"],fd={class:"wl-preview"},dd=P("hr",null,null,-1),hd=["innerHTML"],pd={class:"wl-footer"},gd={class:"wl-actions"},md={href:"https://guides.github.com/features/mastering-markdown/",title:"Markdown Guide","aria-label":"Markdown is supported",class:"wl-action",target:"_blank",rel:"noopener noreferrer"},vd=["title"],wd=["title"],yd=["title"],bd=["title"],kd={class:"wl-info"},xd=P("div",{class:"wl-captcha-container"},null,-1),_d={class:"wl-text-number"},Cd={key:0},$d=["textContent"],Ed=["textContent"],Rd=["disabled"],Td=["placeholder"],Ad={key:1,class:"wl-loading"},Id={key:0,class:"wl-tab-wrapper"},Ld=["title","onClick"],Sd=["src","alt"],Md={key:0,class:"wl-tabs"},zd=["onClick"],Od=["src","alt","title"],jd=["title"];var Pd=ln({__name:"CommentBox",props:{edit:{default:null},rootId:{default:""},replyId:{default:""},replyUser:{default:""}},emits:["log","cancelEdit","cancelReply","submit"],setup(e,{expose:t,emit:n}){const r=e,i=n;t();const l=tr("config"),s=Ef(),o=$f(),a=yr(),c=W({}),f=W(null),p=W(null),h=W(null),v=W(null),A=W(null),x=W(null),C=W(null),y=W({tabs:[],map:{}}),$=W(0),H=W(!1),T=W(!1),U=W(!1),J=W(""),q=W(0),D=Gt({loading:!0,list:[]}),Z=W(0),oe=W(!1),xe=W(""),Ue=W(!1),B=W(!1),N=ye(()=>l.value.locale),re=ye(()=>{var L;return!!((L=a.value)!=null&&L.token)}),ge=ye(()=>l.value.imageUploader!==!1),he=L=>{const u=f.value,d=u.selectionStart,g=u.selectionEnd||0,m=u.scrollTop;s.value=u.value.substring(0,d)+L+u.value.substring(g,u.value.length),u.focus(),u.selectionStart=d+L.length,u.selectionEnd=d+L.length,u.scrollTop=m},be=L=>{const u=L.key;(L.ctrlKey||L.metaKey)&&u==="Enter"&&Vt()},me=L=>{const u=`![${l.value.locale.uploading} ${L.name}]()`;return he(u),Ue.value=!0,Promise.resolve().then(()=>l.value.imageUploader(L)).then(d=>{s.value=s.value.replace(u,`\r
53
- ![${L.name}](${d})`)}).catch(d=>{alert(d.message),s.value=s.value.replace(u,"")}).then(()=>{Ue.value=!1})},it=L=>{var u;if((u=L.dataTransfer)!=null&&u.items){const d=Rs(L.dataTransfer.items);d&&ge.value&&(me(d),L.preventDefault())}},ht=L=>{if(L.clipboardData){const u=Rs(L.clipboardData.items);u&&ge.value&&me(u)}},Se=()=>{const L=p.value;L.files&&ge.value&&me(L.files[0]).then(()=>{L.value=""})},Vt=async()=>{var L,u,d,g,m,w;const{serverURL:b,lang:E,login:_,wordLimit:R,requiredMeta:k,recaptchaV3Key:O,turnstileKey:S}=l.value,j=await pf(),M={comment:xe.value,nick:o.value.nick,mail:o.value.mail,link:o.value.link,url:l.value.path,ua:j};if((L=a.value)!=null&&L.token)M.nick=a.value.display_name,M.mail=a.value.email,M.link=a.value.url;else{if(_==="force")return;if(k.indexOf("nick")>-1&&!M.nick)return(u=c.value.nick)==null||u.focus(),alert(N.value.nickError);if(k.indexOf("mail")>-1&&!M.mail||M.mail&&!Mo(M.mail))return(d=c.value.mail)==null||d.focus(),alert(N.value.mailError);M.nick||(M.nick=N.value.anonymous)}if(!M.comment){(g=f.value)==null||g.focus();return}if(!oe.value)return alert(N.value.wordHint.replace("$0",R[0].toString()).replace("$1",R[1].toString()).replace("$2",q.value.toString()));M.comment=Js(M.comment,y.value.map),r.replyId&&r.rootId&&(M.pid=r.replyId,M.rid=r.rootId,M.at=r.replyUser),Ue.value=!0;try{O&&(M.recaptchaV3=await zf(O).execute("social")),S&&(M.turnstile=await Of(S).execute("social"));const V={serverURL:b,lang:E,token:(m=a.value)==null?void 0:m.token,comment:M},G=await(r.edit?qt({objectId:r.edit.objectId,...V}):Si(V));if(Ue.value=!1,G.errmsg)return alert(G.errmsg);i("submit",G.data),s.value="",J.value="",r.replyId&&i("cancelReply"),(w=r.edit)!=null&&w.objectId&&i("cancelEdit")}catch(V){Ue.value=!1,alert(V.message)}},kr=L=>{L.preventDefault();const{lang:u,serverURL:d}=l.value;Oi({serverURL:d,lang:u}).then(g=>{a.value=g,(g.remember?localStorage:sessionStorage).setItem("WALINE_USER",JSON.stringify(g)),i("log")})},xr=()=>{a.value={},localStorage.setItem("WALINE_USER","null"),sessionStorage.setItem("WALINE_USER","null"),i("log")},Me=L=>{L.preventDefault();const{lang:u,serverURL:d}=l.value,g=800,m=800,w=(window.innerWidth-g)/2,b=(window.innerHeight-m)/2,E=new URLSearchParams({lng:u,token:a.value.token}),_=window.open(`${d}/ui/profile?${E.toString()}`,"_blank",`width=${g},height=${m},left=${w},top=${b},scrollbars=no,resizable=no,status=no,location=no,toolbar=no,menubar=no`);_==null||_.postMessage({type:"TOKEN",data:a.value.token},"*")},pt=L=>{var u,d,g,m;!((u=h.value)!=null&&u.contains(L.target))&&!((d=v.value)!=null&&d.contains(L.target))&&(H.value=!1),!((g=A.value)!=null&&g.contains(L.target))&&!((m=x.value)!=null&&m.contains(L.target))&&(T.value=!1)},Wt=async L=>{var u;const{scrollTop:d,clientHeight:g,scrollHeight:m}=L.target,w=(g+d)/m,b=l.value.search,E=((u=C.value)==null?void 0:u.value)||"";w<.9||D.loading||B.value||(D.loading=!0,(b.more&&D.list.length?await b.more(E,D.list.length):await b.search(E)).length?D.list=[...D.list,...b.more&&D.list.length?await b.more(E,D.list.length):await b.search(E)]:B.value=!0,D.loading=!1,setTimeout(()=>{L.target.scrollTop=d},50))},Ze=eu(L=>{D.list=[],B.value=!1,Wt(L)},300);Oe([l,q],([L,u])=>{const{wordLimit:d}=L;d?u<d[0]&&d[0]!==0?(Z.value=d[0],oe.value=!1):u>d[1]?(Z.value=d[1],oe.value=!1):(Z.value=d[1],oe.value=!0):(Z.value=0,oe.value=!0)},{immediate:!0});const Rt=({data:L})=>{!L||L.type!=="profile"||(a.value={...a.value,...L.data},[localStorage,sessionStorage].filter(u=>u.getItem("WALINE_USER")).forEach(u=>u.setItem("WALINE_USER",JSON.stringify(a))))};return sn(()=>{var L;document.body.addEventListener("click",pt),window.addEventListener("message",Rt),(L=r.edit)!=null&&L.objectId&&(s.value=r.edit.orig),Oe(T,async u=>{if(!u)return;const d=l.value.search;C.value&&(C.value.value=""),D.loading=!0,D.list=d.default?await d.default():await d.search(""),D.loading=!1}),Oe(()=>s.value,u=>{const{highlighter:d,texRenderer:g}=l.value;xe.value=u,J.value=uf(u,{emojiMap:y.value.map,highlighter:d,texRenderer:g}),q.value=hf(u),u?lo(f.value):lo.destroy(f.value)},{immediate:!0}),Oe(()=>l.value.emoji,u=>wu(u).then(d=>{y.value=d}),{immediate:!0})}),Xn(()=>{document.body.removeEventListener("click",pt),window.removeEventListener("message",Rt)}),(L,u)=>{var d,g;return I(),z("div",ed,[K(l).login!=="disable"&&re.value&&!((d=L.edit)!=null&&d.objectId)?(I(),z("div",td,[P("div",nd,[P("button",{type:"submit",class:"wl-logout-btn",title:N.value.logout,onClick:xr},[le(K(Ys),{size:14})],8,rd),P("a",{href:"#",class:"wl-login-nick","aria-label":"Profile",title:N.value.profile,onClick:Me},[P("img",{src:K(a).avatar,alt:"avatar"},null,8,ld)],8,id)]),P("a",{href:"#",class:"wl-login-nick","aria-label":"Profile",title:N.value.profile,onClick:Me,textContent:ne(K(a).display_name)},null,8,sd)])):Y("v-if",!0),P("div",od,[K(l).login!=="force"&&K(l).meta.length&&!re.value?(I(),z("div",{key:0,class:pe(["wl-header",`item${K(l).meta.length}`])},[(I(!0),z(ae,null,je(K(l).meta,m=>(I(),z("div",{key:m,class:"wl-header-item"},[P("label",{for:`wl-${m}`,textContent:ne(N.value[m]+(K(l).requiredMeta.includes(m)||!K(l).requiredMeta.length?"":`(${N.value.optional})`))},null,8,ad),Qn(P("input",{id:`wl-${m}`,ref_for:!0,ref:w=>{w&&(c.value[m]=w)},"onUpdate:modelValue":w=>K(o)[m]=w,class:pe(["wl-input",`wl-${m}`]),name:m,type:m==="mail"?"email":"text"},null,10,cd),[[Vc,K(o)[m]]])]))),128))],2)):Y("v-if",!0),Qn(P("textarea",{id:"wl-edit",ref_key:"editorRef",ref:f,"onUpdate:modelValue":u[0]||(u[0]=m=>we(s)?s.value=m:null),class:"wl-editor",placeholder:L.replyUser?`@${L.replyUser}`:N.value.placeholder,onKeydown:be,onDrop:it,onPaste:ht},null,40,ud),[[pi,K(s)]]),Qn(P("div",fd,[dd,P("h4",null,ne(N.value.preview)+":",1),P("div",{class:"wl-content",innerHTML:J.value},null,8,hd)],512),[[os,U.value]]),P("div",pd,[P("div",gd,[P("a",md,[le(K(bf))]),Qn(P("button",{ref_key:"emojiButtonRef",ref:h,type:"button",class:pe(["wl-action",{active:H.value}]),title:N.value.emoji,onClick:u[1]||(u[1]=m=>H.value=!H.value)},[le(K(mf))],10,vd),[[os,y.value.tabs.length]]),K(l).search?(I(),z("button",{key:0,ref_key:"gifButtonRef",ref:A,type:"button",class:pe(["wl-action",{active:T.value}]),title:N.value.gif,onClick:u[2]||(u[2]=m=>T.value=!T.value)},[le(K(Cf))],10,wd)):Y("v-if",!0),P("input",{id:"wl-image-upload",ref_key:"imageUploadRef",ref:p,class:"upload",type:"file",accept:".png,.jpg,.jpeg,.webp,.bmp,.gif",onChange:Se},null,544),ge.value?(I(),z("label",{key:1,for:"wl-image-upload",class:"wl-action",title:N.value.uploadImage},[le(K(vf))],8,yd)):Y("v-if",!0),P("button",{type:"button",class:pe(["wl-action",{active:U.value}]),title:N.value.preview,onClick:u[3]||(u[3]=m=>U.value=!U.value)},[le(K(yf))],10,bd)]),P("div",kd,[xd,P("div",_d,[Ge(ne(q.value)+" ",1),K(l).wordLimit?(I(),z("span",Cd,[Ge("  /  "),P("span",{class:pe({illegal:!oe.value}),textContent:ne(Z.value)},null,10,$d)])):Y("v-if",!0),Ge("  "+ne(N.value.word),1)]),K(l).login!=="disable"&&!re.value?(I(),z("button",{key:0,type:"button",class:"wl-btn",onClick:kr,textContent:ne(N.value.login)},null,8,Ed)):Y("v-if",!0),K(l).login!=="force"||re.value?(I(),z("button",{key:1,type:"submit",class:"primary wl-btn",title:"Cmd|Ctrl + Enter",disabled:Ue.value,onClick:Vt},[Ue.value?(I(),Xe(K(kn),{key:0,size:16})):(I(),z(ae,{key:1},[Ge(ne(N.value.submit),1)],64))],8,Rd)):Y("v-if",!0)]),P("div",{ref_key:"gifPopupRef",ref:x,class:pe(["wl-gif-popup",{display:T.value}])},[P("input",{ref_key:"gifSearchInputRef",ref:C,type:"text",placeholder:N.value.gifSearchPlaceholder,onInput:u[4]||(u[4]=(...m)=>K(Ze)&&K(Ze)(...m))},null,40,Td),D.list.length?(I(),Xe(Gf,{key:0,items:D.list,"column-width":200,gap:6,onInsert:u[5]||(u[5]=m=>he(m)),onScroll:Wt},null,8,["items"])):Y("v-if",!0),D.loading?(I(),z("div",Ad,[le(K(kn),{size:30})])):Y("v-if",!0)],2),P("div",{ref_key:"emojiPopupRef",ref:v,class:pe(["wl-emoji-popup",{display:H.value}])},[(I(!0),z(ae,null,je(y.value.tabs,(m,w)=>(I(),z(ae,{key:m.name},[w===$.value?(I(),z("div",Id,[(I(!0),z(ae,null,je(m.items,b=>(I(),z("button",{key:b,type:"button",title:b,onClick:E=>he(`:${b}:`)},[H.value?(I(),z("img",{key:0,class:"wl-emoji",src:y.value.map[b],alt:b,loading:"lazy",referrerPolicy:"no-referrer"},null,8,Sd)):Y("v-if",!0)],8,Ld))),128))])):Y("v-if",!0)],64))),128)),y.value.tabs.length>1?(I(),z("div",Md,[(I(!0),z(ae,null,je(y.value.tabs,(m,w)=>(I(),z("button",{key:m.name,type:"button",class:pe(["wl-tab",{active:$.value===w}]),onClick:b=>$.value=w},[P("img",{class:"wl-emoji",src:m.icon,alt:m.name,title:m.name,loading:"lazy",referrerPolicy:"no-referrer"},null,8,Od)],10,zd))),128))])):Y("v-if",!0)],2)])]),L.replyId||(g=L.edit)!=null&&g.objectId?(I(),z("button",{key:1,type:"button",class:"wl-close",title:N.value.cancelReply,onClick:u[6]||(u[6]=m=>L.$emit(L.replyId?"cancelReply":"cancelEdit"))},[le(K(Ys),{size:24})],8,jd)):Y("v-if",!0)])}}}),so=_n(Pd,[["__file","CommentBox.vue"]]);const Ud=["id"],Fd={class:"wl-user","aria-hidden":"true"},Nd=["src"],Hd={class:"wl-card"},Dd={class:"wl-head"},Bd=["href"],Vd={key:1,class:"wl-nick"},Wd=["textContent"],Kd=["textContent"],qd=["textContent"],Zd=["textContent"],Jd=["textContent"],Qd={class:"wl-comment-actions"},Yd=["title"],Xd=["title"],Gd={class:"wl-meta","aria-hidden":"true"},eh=["data-value","textContent"],th=["innerHTML"],nh={key:1,class:"wl-admin-actions"},rh={class:"wl-comment-status"},ih=["disabled","onClick","textContent"],lh={key:3,class:"wl-quote"};var sh=ln({__name:"CommentCard",props:{comment:{},edit:{default:null},rootId:{},reply:{default:null}},emits:["log","submit","delete","edit","like","status","sticky","reply"],setup(e,{emit:t}){const n=e,r=t,i=["approved","waiting","spam"],l=tr("config"),s=Gs(),o=du(),a=yr(),c=ye(()=>l.value.locale),f=ye(()=>{const{link:y}=n.comment;return y?Zi(y)?y:`https://${y}`:""}),p=ye(()=>s.value.includes(n.comment.objectId)),h=ye(()=>Lo(n.comment.insertedAt,o.value,c.value)),v=ye(()=>a.value.type==="administrator"),A=ye(()=>n.comment.user_id&&a.value.objectId===n.comment.user_id),x=ye(()=>{var y;return n.comment.objectId===((y=n.reply)==null?void 0:y.objectId)}),C=ye(()=>{var y;return n.comment.objectId===((y=n.edit)==null?void 0:y.objectId)});return(y,$)=>{var H;const T=Ma("CommentCard",!0);return I(),z("div",{id:y.comment.objectId,class:"wl-card-item"},[P("div",Fd,[y.comment.avatar?(I(),z("img",{key:0,class:"wl-user-avatar",src:y.comment.avatar},null,8,Nd)):Y("v-if",!0),y.comment.type?(I(),Xe(K(_f),{key:1})):Y("v-if",!0)]),P("div",Hd,[P("div",Dd,[f.value?(I(),z("a",{key:0,class:"wl-nick",href:f.value,target:"_blank",rel:"nofollow noopener noreferrer"},ne(y.comment.nick),9,Bd)):(I(),z("span",Vd,ne(y.comment.nick),1)),y.comment.type==="administrator"?(I(),z("span",{key:2,class:"wl-badge",textContent:ne(c.value.admin)},null,8,Wd)):Y("v-if",!0),y.comment.label?(I(),z("span",{key:3,class:"wl-badge",textContent:ne(y.comment.label)},null,8,Kd)):Y("v-if",!0),y.comment.sticky?(I(),z("span",{key:4,class:"wl-badge",textContent:ne(c.value.sticky)},null,8,qd)):Y("v-if",!0),typeof y.comment.level=="number"?(I(),z("span",{key:5,class:pe(`wl-badge level${y.comment.level}`),textContent:ne(c.value[`level${y.comment.level}`]||`Level ${y.comment.level}`)},null,10,Zd)):Y("v-if",!0),P("span",{class:"wl-time",textContent:ne(h.value)},null,8,Jd),P("div",Qd,[v.value||A.value?(I(),z(ae,{key:0},[P("button",{type:"button",class:"wl-edit",onClick:$[0]||($[0]=U=>r("edit",y.comment))},[le(K(xf))]),P("button",{type:"button",class:"wl-delete",onClick:$[1]||($[1]=U=>r("delete",y.comment))},[le(K(gf))])],64)):Y("v-if",!0),P("button",{type:"button",class:"wl-like",title:p.value?c.value.cancelLike:c.value.like,onClick:$[2]||($[2]=U=>r("like",y.comment))},[le(K(wf),{active:p.value},null,8,["active"]),Ge(" "+ne("like"in y.comment?y.comment.like:""),1)],8,Yd),P("button",{type:"button",class:pe(["wl-reply",{active:x.value}]),title:x.value?c.value.cancelReply:c.value.reply,onClick:$[3]||($[3]=U=>r("reply",x.value?null:y.comment))},[le(K(kf))],10,Xd)])]),P("div",Gd,[(I(),z(ae,null,je(["addr","browser","os"],U=>(I(),z(ae,null,[y.comment[U]?(I(),z("span",{key:U,class:pe(`wl-${U}`),"data-value":y.comment[U],textContent:ne(y.comment[U])},null,10,eh)):Y("v-if",!0)],64))),64))]),C.value?Y("v-if",!0):(I(),z("div",{key:0,class:"wl-content",innerHTML:y.comment.comment},null,8,th)),v.value&&!C.value?(I(),z("div",nh,[P("span",rh,[(I(),z(ae,null,je(i,U=>P("button",{key:U,type:"submit",class:pe(`wl-btn wl-${U}`),disabled:y.comment.status===U,onClick:J=>r("status",{status:U,comment:y.comment}),textContent:ne(c.value[U])},null,10,ih)),64))]),v.value&&!("rid"in y.comment)?(I(),z("button",{key:0,type:"submit",class:"wl-btn wl-sticky",onClick:$[4]||($[4]=U=>r("sticky",y.comment))},ne(y.comment.sticky?c.value.unsticky:c.value.sticky),1)):Y("v-if",!0)])):Y("v-if",!0),x.value||C.value?(I(),z("div",{key:2,class:pe({"wl-reply-wrapper":x.value,"wl-edit-wrapper":C.value})},[le(so,{edit:y.edit,"reply-id":(H=y.reply)==null?void 0:H.objectId,"reply-user":y.comment.nick,"root-id":y.rootId,onLog:$[5]||($[5]=U=>r("log")),onCancelReply:$[6]||($[6]=U=>r("reply",null)),onCancelEdit:$[7]||($[7]=U=>r("edit",null)),onSubmit:$[8]||($[8]=U=>r("submit",U))},null,8,["edit","reply-id","reply-user","root-id"])],2)):Y("v-if",!0),"children"in y.comment?(I(),z("div",lh,[(I(!0),z(ae,null,je(y.comment.children,U=>(I(),Xe(T,{key:U.objectId,comment:U,reply:y.reply,edit:y.edit,"root-id":y.rootId,onLog:$[9]||($[9]=J=>r("log")),onDelete:$[10]||($[10]=J=>r("delete",J)),onEdit:$[11]||($[11]=J=>r("edit",J)),onLike:$[12]||($[12]=J=>r("like",J)),onReply:$[13]||($[13]=J=>r("reply",J)),onStatus:$[14]||($[14]=J=>r("status",J)),onSticky:$[15]||($[15]=J=>r("sticky",J)),onSubmit:$[16]||($[16]=J=>r("submit",J))},null,8,["comment","reply","edit","root-id"]))),128))])):Y("v-if",!0)])],8,Ud)}}}),oh=_n(sh,[["__file","CommentCard.vue"]]);const oo="3.0.0-alpha.6",ah={"data-waline":""},ch={class:"wl-meta-head"},uh={class:"wl-count"},fh=["textContent"],dh={class:"wl-sort"},hh=["onClick"],ph={class:"wl-cards"},gh={key:1,class:"wl-operation"},mh=["textContent"],vh={key:2,class:"wl-loading"},wh=["textContent"],yh={key:4,class:"wl-operation"},bh=["textContent"],kh={key:5,class:"wl-power"},xh=P("a",{href:"https://github.com/walinejs/waline",target:"_blank",rel:"noopener noreferrer"}," Waline ",-1);var _h=ln({__name:"WalineComment",props:["serverURL","path","meta","requiredMeta","dark","commentSorting","lang","locale","pageSize","wordLimit","emoji","login","highlighter","texRenderer","imageUploader","search","copyright","recaptchaV3Key","turnstileKey","reaction"],setup(e){const t=e,n={latest:"insertedAt_desc",oldest:"insertedAt_asc",hottest:"like_desc"},r=Object.keys(n),i=yr(),l=Gs(),s=W("loading"),o=W(0),a=W(1),c=W(0),f=ye(()=>To(t)),p=W(f.value.commentSorting),h=W([]),v=W(null),A=W(null),x=ye(()=>Ao(f.value.dark)),C=ye(()=>f.value.locale);gu(x,{id:"waline-darkmode"});let y;const $=B=>{var N;const{serverURL:re,path:ge,pageSize:he}=f.value,be=new AbortController;s.value="loading",y==null||y(),Li({serverURL:re,lang:f.value.lang,path:ge,pageSize:he,sortBy:n[p.value],page:B,signal:be.signal,token:(N=i.value)==null?void 0:N.token}).then(me=>{s.value="success",o.value=me.count,h.value.push(...me.data),a.value=B,c.value=me.totalPages}).catch(me=>{me.name!=="AbortError"&&(console.error(me.message),s.value="error")}),y=be.abort.bind(be)},H=()=>$(a.value+1),T=()=>{o.value=0,h.value=[],$(1)},U=B=>{p.value!==B&&(p.value=B,T())},J=B=>{v.value=B},q=B=>{A.value=B},D=B=>{if(A.value)A.value.comment=B.comment,A.value.orig=B.orig;else if("rid"in B){const N=h.value.find(({objectId:re})=>re===B.rid);if(!N)return;Array.isArray(N.children)||(N.children=[]),N.children.push(B)}else h.value.unshift(B),o.value+=1},Z=async({comment:B,status:N})=>{var re;if(B.status===N)return;const{serverURL:ge,lang:he}=f.value;await qt({serverURL:ge,lang:he,token:(re=i.value)==null?void 0:re.token,objectId:B.objectId,comment:{status:N}}),B.status=N},oe=async B=>{var N;if("rid"in B)return;const{serverURL:re,lang:ge}=f.value;await qt({serverURL:re,lang:ge,token:(N=i.value)==null?void 0:N.token,objectId:B.objectId,comment:{sticky:B.sticky?0:1}}),B.sticky=!B.sticky},xe=async({objectId:B})=>{var N;if(!confirm("Are you sure you want to delete this comment?"))return;const{serverURL:re,lang:ge}=f.value;await Mi({serverURL:re,lang:ge,token:(N=i.value)==null?void 0:N.token,objectId:B}),h.value.some((he,be)=>he.objectId===B?(h.value=h.value.filter((me,it)=>it!==be),!0):he.children.some((me,it)=>me.objectId===B?(h.value[be].children=he.children.filter((ht,Se)=>Se!==it),!0):!1))},Ue=async B=>{var N;const{serverURL:re,lang:ge}=f.value,{objectId:he}=B,be=l.value.includes(he);await qt({serverURL:re,lang:ge,objectId:he,token:(N=i.value)==null?void 0:N.token,comment:{like:!be}}),be?l.value=l.value.filter(me=>me!==he):(l.value=[...l.value,he],l.value.length>50&&(l.value=l.value.slice(-50))),B.like=(B.like||0)+(be?-1:1)};return Za("config",f),sn(()=>{Oe(()=>[t.serverURL,t.path],()=>T(),{immediate:!0})}),Xn(()=>y==null?void 0:y()),(B,N)=>(I(),z("div",ah,[le(Kf),v.value?Y("v-if",!0):(I(),Xe(so,{key:0,onLog:T,onSubmit:D})),P("div",ch,[P("div",uh,[o.value?(I(),z("span",{key:0,class:"wl-num",textContent:ne(o.value)},null,8,fh)):Y("v-if",!0),Ge(" "+ne(C.value.comment),1)]),P("ul",dh,[(I(!0),z(ae,null,je(K(r),re=>(I(),z("li",{key:re,class:pe([re===p.value?"active":""]),onClick:ge=>U(re)},ne(C.value[re]),11,hh))),128))])]),P("div",ph,[(I(!0),z(ae,null,je(h.value,re=>(I(),Xe(oh,{key:re.objectId,"root-id":re.objectId,comment:re,reply:v.value,edit:A.value,onLog:T,onReply:J,onEdit:q,onSubmit:D,onStatus:Z,onDelete:xe,onSticky:oe,onLike:Ue},null,8,["root-id","comment","reply","edit"]))),128))]),s.value==="error"?(I(),z("div",gh,[P("button",{type:"button",class:"wl-btn",onClick:T,textContent:ne(C.value.refresh)},null,8,mh)])):s.value==="loading"?(I(),z("div",vh,[le(K(kn),{size:30})])):h.value.length?a.value<c.value?(I(),z("div",yh,[P("button",{type:"button",class:"wl-btn",onClick:H,textContent:ne(C.value.more)},null,8,bh)])):Y("v-if",!0):(I(),z("div",{key:3,class:"wl-empty",textContent:ne(C.value.sofa)},null,8,wh)),f.value.copyright?(I(),z("div",kh,[Ge(" Powered by "),xh,Ge(" v"+ne(K(oo)),1)])):Y("v-if",!0)]))}}),Ch=_n(_h,[["__file","WalineComment.vue"]]);const ao=(e,t)=>{t.forEach((n,r)=>{n.innerText=e[r].toString()})},co=({serverURL:e,path:t=window.location.pathname,selector:n=".waline-pageview-count",update:r=!0,lang:i=navigator.language})=>{const l=new AbortController,s=Array.from(document.querySelectorAll(n)),o=c=>{const f=$i(c);return f!==null&&t!==f},a=c=>ji({serverURL:In(e),paths:c.map(f=>$i(f)||t),lang:i,signal:l.signal}).then(f=>ao(f,c)).catch(Es);if(r){const c=s.filter(p=>!o(p)),f=s.filter(o);Pi({serverURL:In(e),path:t,lang:i}).then(([p])=>ao(new Array(c.length).fill(p),c)),f.length&&a(f)}else a(s);return l.abort.bind(l)},$h=({el:e="#waline",path:t=window.location.pathname,comment:n=!1,pageview:r=!1,...i})=>{const l=e?mi(e):null;if(e&&!l)throw new Error("Option 'el' do not match any domElement!");if(!i.serverURL)throw new Error("Option 'serverURL' is missing!");const s=Gt({...i}),o=Gt({comment:n,pageview:r,path:t}),a=()=>{o.comment&&Qs({serverURL:s.serverURL,path:o.path,...typeof o.comment=="string"?{selector:o.comment}:{}})},c=()=>{o.pageview&&co({serverURL:s.serverURL,path:o.path,...typeof o.pageview=="string"?{selector:o.pageview}:{}})},f=l?Zc(()=>ee(Ch,{path:o.path,...s})):null;f&&f.mount(l);const p=jl(a),h=jl(c);return{el:l,update:({comment:v,pageview:A,path:x=window.location.pathname,...C}={})=>{Object.entries(C).forEach(([y,$])=>{s[y]=$}),o.path=x,v!==void 0&&(o.comment=v),A!==void 0&&(o.pageview=A)},destroy:()=>{f==null||f.unmount(),p(),h()}}},Eh=({el:e,serverURL:t,count:n,lang:r=navigator.language})=>{var i;const l=yr(),s=mi(e),o=new AbortController;return Ui({serverURL:t,count:n,lang:r,signal:o.signal,token:(i=l.value)==null?void 0:i.token}).then(a=>s&&a.length?(s.innerHTML=`<ul class="wl-recent-list">${a.map(c=>`<li class="wl-recent-item"><a href="${c.url}">${c.nick}</a>:${c.comment}</li>`).join("")}</ul>`,{comments:a,destroy:()=>{o.abort(),s.innerHTML=""}}):{comments:a,destroy:()=>o.abort()})},Rh=({el:e,serverURL:t,count:n,locale:r,lang:i=navigator.language,mode:l="list"})=>{const s=mi(e),o=new AbortController;return Fi({serverURL:t,pageSize:n,lang:i,signal:o.signal}).then(a=>!s||!a.length?{users:a,destroy:()=>o.abort()}:(r={...Lt[i]||Lt[Di],...typeof r=="object"?r:{}},s.innerHTML=`<ul class="wl-user-${l}">${a.map((c,f)=>[`<li class="wl-user-item" aria-label="${c.nick}">`,c.link&&`<a href="${c.link}" target="_blank">`,'<div class="wl-user-avatar">',`<img src="${c.avatar}" alt="${c.nick}">`,`<span class="wl-user-badge">${f+1}</span>`,"</div>",'<div class="wl-user-meta">','<div class="wl-user-name">',c.nick,c.level&&`<span class="wl-badge">${r?r[`level${c.level}`]:`Level ${c.level}`}</span>`,c.label&&`<span class="wl-badge">${c.label}</span>`,"</div>",c.link&&c.link,"</div>",c.link&&"</a>","</li>"].filter(p=>p).join("")).join("")}</ul>`,{users:a,destroy:()=>{o.abort(),s.innerHTML=""}}))};export{Eh as RecentComments,Rh as UserList,Si as addComment,Qs as commentCount,Lt as defaultLocales,Mi as deleteComment,zi as fetchCommentCount,Cr as getArticleCounter,Li as getComment,ji as getPageview,Ui as getRecentComment,Fi as getUserList,$h as init,Oi as login,co as pageviewCount,Tn as updateArticleCounter,qt as updateComment,Pi as updatePageview,oo as version};
53
+ ![${L.name}](${d})`)}).catch(d=>{alert(d.message),s.value=s.value.replace(u,"")}).then(()=>{Ue.value=!1})},it=L=>{var u;if((u=L.dataTransfer)!=null&&u.items){const d=Rs(L.dataTransfer.items);d&&ge.value&&(me(d),L.preventDefault())}},ht=L=>{if(L.clipboardData){const u=Rs(L.clipboardData.items);u&&ge.value&&me(u)}},Se=()=>{const L=p.value;L.files&&ge.value&&me(L.files[0]).then(()=>{L.value=""})},Vt=async()=>{var L,u,d,g,m,w;const{serverURL:b,lang:E,login:_,wordLimit:R,requiredMeta:k,recaptchaV3Key:O,turnstileKey:S}=l.value,j=await pf(),M={comment:xe.value,nick:o.value.nick,mail:o.value.mail,link:o.value.link,url:l.value.path,ua:j};if((L=a.value)!=null&&L.token)M.nick=a.value.display_name,M.mail=a.value.email,M.link=a.value.url;else{if(_==="force")return;if(k.indexOf("nick")>-1&&!M.nick)return(u=c.value.nick)==null||u.focus(),alert(N.value.nickError);if(k.indexOf("mail")>-1&&!M.mail||M.mail&&!Mo(M.mail))return(d=c.value.mail)==null||d.focus(),alert(N.value.mailError);M.nick||(M.nick=N.value.anonymous)}if(!M.comment){(g=f.value)==null||g.focus();return}if(!oe.value)return alert(N.value.wordHint.replace("$0",R[0].toString()).replace("$1",R[1].toString()).replace("$2",q.value.toString()));M.comment=Js(M.comment,y.value.map),r.replyId&&r.rootId&&(M.pid=r.replyId,M.rid=r.rootId,M.at=r.replyUser),Ue.value=!0;try{O&&(M.recaptchaV3=await zf(O).execute("social")),S&&(M.turnstile=await Of(S).execute("social"));const V={serverURL:b,lang:E,token:(m=a.value)==null?void 0:m.token,comment:M},G=await(r.edit?qt({objectId:r.edit.objectId,...V}):Si(V));if(Ue.value=!1,G.errmsg)return alert(G.errmsg);i("submit",G.data),s.value="",J.value="",r.replyId&&i("cancelReply"),(w=r.edit)!=null&&w.objectId&&i("cancelEdit")}catch(V){Ue.value=!1,alert(V.message)}},kr=L=>{L.preventDefault();const{lang:u,serverURL:d}=l.value;Oi({serverURL:d,lang:u}).then(g=>{a.value=g,(g.remember?localStorage:sessionStorage).setItem("WALINE_USER",JSON.stringify(g)),i("log")})},xr=()=>{a.value={},localStorage.setItem("WALINE_USER","null"),sessionStorage.setItem("WALINE_USER","null"),i("log")},Me=L=>{L.preventDefault();const{lang:u,serverURL:d}=l.value,g=800,m=800,w=(window.innerWidth-g)/2,b=(window.innerHeight-m)/2,E=new URLSearchParams({lng:u,token:a.value.token}),_=window.open(`${d}/ui/profile?${E.toString()}`,"_blank",`width=${g},height=${m},left=${w},top=${b},scrollbars=no,resizable=no,status=no,location=no,toolbar=no,menubar=no`);_==null||_.postMessage({type:"TOKEN",data:a.value.token},"*")},pt=L=>{var u,d,g,m;!((u=h.value)!=null&&u.contains(L.target))&&!((d=v.value)!=null&&d.contains(L.target))&&(H.value=!1),!((g=A.value)!=null&&g.contains(L.target))&&!((m=x.value)!=null&&m.contains(L.target))&&(T.value=!1)},Wt=async L=>{var u;const{scrollTop:d,clientHeight:g,scrollHeight:m}=L.target,w=(g+d)/m,b=l.value.search,E=((u=C.value)==null?void 0:u.value)||"";w<.9||D.loading||B.value||(D.loading=!0,(b.more&&D.list.length?await b.more(E,D.list.length):await b.search(E)).length?D.list=[...D.list,...b.more&&D.list.length?await b.more(E,D.list.length):await b.search(E)]:B.value=!0,D.loading=!1,setTimeout(()=>{L.target.scrollTop=d},50))},Ze=eu(L=>{D.list=[],B.value=!1,Wt(L)},300);Oe([l,q],([L,u])=>{const{wordLimit:d}=L;d?u<d[0]&&d[0]!==0?(Z.value=d[0],oe.value=!1):u>d[1]?(Z.value=d[1],oe.value=!1):(Z.value=d[1],oe.value=!0):(Z.value=0,oe.value=!0)},{immediate:!0});const Rt=({data:L})=>{!L||L.type!=="profile"||(a.value={...a.value,...L.data},[localStorage,sessionStorage].filter(u=>u.getItem("WALINE_USER")).forEach(u=>u.setItem("WALINE_USER",JSON.stringify(a))))};return sn(()=>{var L;document.body.addEventListener("click",pt),window.addEventListener("message",Rt),(L=r.edit)!=null&&L.objectId&&(s.value=r.edit.orig),Oe(T,async u=>{if(!u)return;const d=l.value.search;C.value&&(C.value.value=""),D.loading=!0,D.list=d.default?await d.default():await d.search(""),D.loading=!1}),Oe(()=>s.value,u=>{const{highlighter:d,texRenderer:g}=l.value;xe.value=u,J.value=uf(u,{emojiMap:y.value.map,highlighter:d,texRenderer:g}),q.value=hf(u),u?lo(f.value):lo.destroy(f.value)},{immediate:!0}),Oe(()=>l.value.emoji,u=>wu(u).then(d=>{y.value=d}),{immediate:!0})}),Xn(()=>{document.body.removeEventListener("click",pt),window.removeEventListener("message",Rt)}),(L,u)=>{var d,g;return I(),z("div",ed,[K(l).login!=="disable"&&re.value&&!((d=L.edit)!=null&&d.objectId)?(I(),z("div",td,[P("div",nd,[P("button",{type:"submit",class:"wl-logout-btn",title:N.value.logout,onClick:xr},[le(K(Ys),{size:14})],8,rd),P("a",{href:"#",class:"wl-login-nick","aria-label":"Profile",title:N.value.profile,onClick:Me},[P("img",{src:K(a).avatar,alt:"avatar"},null,8,ld)],8,id)]),P("a",{href:"#",class:"wl-login-nick","aria-label":"Profile",title:N.value.profile,onClick:Me,textContent:ne(K(a).display_name)},null,8,sd)])):Y("v-if",!0),P("div",od,[K(l).login!=="force"&&K(l).meta.length&&!re.value?(I(),z("div",{key:0,class:pe(["wl-header",`item${K(l).meta.length}`])},[(I(!0),z(ae,null,je(K(l).meta,m=>(I(),z("div",{key:m,class:"wl-header-item"},[P("label",{for:`wl-${m}`,textContent:ne(N.value[m]+(K(l).requiredMeta.includes(m)||!K(l).requiredMeta.length?"":`(${N.value.optional})`))},null,8,ad),Qn(P("input",{id:`wl-${m}`,ref_for:!0,ref:w=>{w&&(c.value[m]=w)},"onUpdate:modelValue":w=>K(o)[m]=w,class:pe(["wl-input",`wl-${m}`]),name:m,type:m==="mail"?"email":"text"},null,10,cd),[[Vc,K(o)[m]]])]))),128))],2)):Y("v-if",!0),Qn(P("textarea",{id:"wl-edit",ref_key:"editorRef",ref:f,"onUpdate:modelValue":u[0]||(u[0]=m=>we(s)?s.value=m:null),class:"wl-editor",placeholder:L.replyUser?`@${L.replyUser}`:N.value.placeholder,onKeydown:be,onDrop:it,onPaste:ht},null,40,ud),[[pi,K(s)]]),Qn(P("div",fd,[dd,P("h4",null,ne(N.value.preview)+":",1),P("div",{class:"wl-content",innerHTML:J.value},null,8,hd)],512),[[os,U.value]]),P("div",pd,[P("div",gd,[P("a",md,[le(K(bf))]),Qn(P("button",{ref_key:"emojiButtonRef",ref:h,type:"button",class:pe(["wl-action",{active:H.value}]),title:N.value.emoji,onClick:u[1]||(u[1]=m=>H.value=!H.value)},[le(K(mf))],10,vd),[[os,y.value.tabs.length]]),K(l).search?(I(),z("button",{key:0,ref_key:"gifButtonRef",ref:A,type:"button",class:pe(["wl-action",{active:T.value}]),title:N.value.gif,onClick:u[2]||(u[2]=m=>T.value=!T.value)},[le(K(Cf))],10,wd)):Y("v-if",!0),P("input",{id:"wl-image-upload",ref_key:"imageUploadRef",ref:p,class:"upload",type:"file",accept:".png,.jpg,.jpeg,.webp,.bmp,.gif",onChange:Se},null,544),ge.value?(I(),z("label",{key:1,for:"wl-image-upload",class:"wl-action",title:N.value.uploadImage},[le(K(vf))],8,yd)):Y("v-if",!0),P("button",{type:"button",class:pe(["wl-action",{active:U.value}]),title:N.value.preview,onClick:u[3]||(u[3]=m=>U.value=!U.value)},[le(K(yf))],10,bd)]),P("div",kd,[xd,P("div",_d,[Ge(ne(q.value)+" ",1),K(l).wordLimit?(I(),z("span",Cd,[Ge("  /  "),P("span",{class:pe({illegal:!oe.value}),textContent:ne(Z.value)},null,10,$d)])):Y("v-if",!0),Ge("  "+ne(N.value.word),1)]),K(l).login!=="disable"&&!re.value?(I(),z("button",{key:0,type:"button",class:"wl-btn",onClick:kr,textContent:ne(N.value.login)},null,8,Ed)):Y("v-if",!0),K(l).login!=="force"||re.value?(I(),z("button",{key:1,type:"submit",class:"primary wl-btn",title:"Cmd|Ctrl + Enter",disabled:Ue.value,onClick:Vt},[Ue.value?(I(),Xe(K(kn),{key:0,size:16})):(I(),z(ae,{key:1},[Ge(ne(N.value.submit),1)],64))],8,Rd)):Y("v-if",!0)]),P("div",{ref_key:"gifPopupRef",ref:x,class:pe(["wl-gif-popup",{display:T.value}])},[P("input",{ref_key:"gifSearchInputRef",ref:C,type:"text",placeholder:N.value.gifSearchPlaceholder,onInput:u[4]||(u[4]=(...m)=>K(Ze)&&K(Ze)(...m))},null,40,Td),D.list.length?(I(),Xe(Gf,{key:0,items:D.list,"column-width":200,gap:6,onInsert:u[5]||(u[5]=m=>he(m)),onScroll:Wt},null,8,["items"])):Y("v-if",!0),D.loading?(I(),z("div",Ad,[le(K(kn),{size:30})])):Y("v-if",!0)],2),P("div",{ref_key:"emojiPopupRef",ref:v,class:pe(["wl-emoji-popup",{display:H.value}])},[(I(!0),z(ae,null,je(y.value.tabs,(m,w)=>(I(),z(ae,{key:m.name},[w===$.value?(I(),z("div",Id,[(I(!0),z(ae,null,je(m.items,b=>(I(),z("button",{key:b,type:"button",title:b,onClick:E=>he(`:${b}:`)},[H.value?(I(),z("img",{key:0,class:"wl-emoji",src:y.value.map[b],alt:b,loading:"lazy",referrerPolicy:"no-referrer"},null,8,Sd)):Y("v-if",!0)],8,Ld))),128))])):Y("v-if",!0)],64))),128)),y.value.tabs.length>1?(I(),z("div",Md,[(I(!0),z(ae,null,je(y.value.tabs,(m,w)=>(I(),z("button",{key:m.name,type:"button",class:pe(["wl-tab",{active:$.value===w}]),onClick:b=>$.value=w},[P("img",{class:"wl-emoji",src:m.icon,alt:m.name,title:m.name,loading:"lazy",referrerPolicy:"no-referrer"},null,8,Od)],10,zd))),128))])):Y("v-if",!0)],2)])]),L.replyId||(g=L.edit)!=null&&g.objectId?(I(),z("button",{key:1,type:"button",class:"wl-close",title:N.value.cancelReply,onClick:u[6]||(u[6]=m=>L.$emit(L.replyId?"cancelReply":"cancelEdit"))},[le(K(Ys),{size:24})],8,jd)):Y("v-if",!0)])}}}),so=_n(Pd,[["__file","CommentBox.vue"]]);const Ud=["id"],Fd={class:"wl-user","aria-hidden":"true"},Nd=["src"],Hd={class:"wl-card"},Dd={class:"wl-head"},Bd=["href"],Vd={key:1,class:"wl-nick"},Wd=["textContent"],Kd=["textContent"],qd=["textContent"],Zd=["textContent"],Jd=["textContent"],Qd={class:"wl-comment-actions"},Yd=["title"],Xd=["title"],Gd={class:"wl-meta","aria-hidden":"true"},eh=["data-value","textContent"],th=["innerHTML"],nh={key:1,class:"wl-admin-actions"},rh={class:"wl-comment-status"},ih=["disabled","onClick","textContent"],lh={key:3,class:"wl-quote"};var sh=ln({__name:"CommentCard",props:{comment:{},edit:{default:null},rootId:{},reply:{default:null}},emits:["log","submit","delete","edit","like","status","sticky","reply"],setup(e,{emit:t}){const n=e,r=t,i=["approved","waiting","spam"],l=tr("config"),s=Gs(),o=du(),a=yr(),c=ye(()=>l.value.locale),f=ye(()=>{const{link:y}=n.comment;return y?Zi(y)?y:`https://${y}`:""}),p=ye(()=>s.value.includes(n.comment.objectId)),h=ye(()=>Lo(n.comment.insertedAt,o.value,c.value)),v=ye(()=>a.value.type==="administrator"),A=ye(()=>n.comment.user_id&&a.value.objectId===n.comment.user_id),x=ye(()=>{var y;return n.comment.objectId===((y=n.reply)==null?void 0:y.objectId)}),C=ye(()=>{var y;return n.comment.objectId===((y=n.edit)==null?void 0:y.objectId)});return(y,$)=>{var H;const T=Ma("CommentCard",!0);return I(),z("div",{id:y.comment.objectId,class:"wl-card-item"},[P("div",Fd,[y.comment.avatar?(I(),z("img",{key:0,class:"wl-user-avatar",src:y.comment.avatar},null,8,Nd)):Y("v-if",!0),y.comment.type?(I(),Xe(K(_f),{key:1})):Y("v-if",!0)]),P("div",Hd,[P("div",Dd,[f.value?(I(),z("a",{key:0,class:"wl-nick",href:f.value,target:"_blank",rel:"nofollow noopener noreferrer"},ne(y.comment.nick),9,Bd)):(I(),z("span",Vd,ne(y.comment.nick),1)),y.comment.type==="administrator"?(I(),z("span",{key:2,class:"wl-badge",textContent:ne(c.value.admin)},null,8,Wd)):Y("v-if",!0),y.comment.label?(I(),z("span",{key:3,class:"wl-badge",textContent:ne(y.comment.label)},null,8,Kd)):Y("v-if",!0),y.comment.sticky?(I(),z("span",{key:4,class:"wl-badge",textContent:ne(c.value.sticky)},null,8,qd)):Y("v-if",!0),typeof y.comment.level=="number"?(I(),z("span",{key:5,class:pe(`wl-badge level${y.comment.level}`),textContent:ne(c.value[`level${y.comment.level}`]||`Level ${y.comment.level}`)},null,10,Zd)):Y("v-if",!0),P("span",{class:"wl-time",textContent:ne(h.value)},null,8,Jd),P("div",Qd,[v.value||A.value?(I(),z(ae,{key:0},[P("button",{type:"button",class:"wl-edit",onClick:$[0]||($[0]=U=>r("edit",y.comment))},[le(K(xf))]),P("button",{type:"button",class:"wl-delete",onClick:$[1]||($[1]=U=>r("delete",y.comment))},[le(K(gf))])],64)):Y("v-if",!0),P("button",{type:"button",class:"wl-like",title:p.value?c.value.cancelLike:c.value.like,onClick:$[2]||($[2]=U=>r("like",y.comment))},[le(K(wf),{active:p.value},null,8,["active"]),Ge(" "+ne("like"in y.comment?y.comment.like:""),1)],8,Yd),P("button",{type:"button",class:pe(["wl-reply",{active:x.value}]),title:x.value?c.value.cancelReply:c.value.reply,onClick:$[3]||($[3]=U=>r("reply",x.value?null:y.comment))},[le(K(kf))],10,Xd)])]),P("div",Gd,[(I(),z(ae,null,je(["addr","browser","os"],U=>(I(),z(ae,null,[y.comment[U]?(I(),z("span",{key:U,class:pe(`wl-${U}`),"data-value":y.comment[U],textContent:ne(y.comment[U])},null,10,eh)):Y("v-if",!0)],64))),64))]),C.value?Y("v-if",!0):(I(),z("div",{key:0,class:"wl-content",innerHTML:y.comment.comment},null,8,th)),v.value&&!C.value?(I(),z("div",nh,[P("span",rh,[(I(),z(ae,null,je(i,U=>P("button",{key:U,type:"submit",class:pe(`wl-btn wl-${U}`),disabled:y.comment.status===U,onClick:J=>r("status",{status:U,comment:y.comment}),textContent:ne(c.value[U])},null,10,ih)),64))]),v.value&&!("rid"in y.comment)?(I(),z("button",{key:0,type:"submit",class:"wl-btn wl-sticky",onClick:$[4]||($[4]=U=>r("sticky",y.comment))},ne(y.comment.sticky?c.value.unsticky:c.value.sticky),1)):Y("v-if",!0)])):Y("v-if",!0),x.value||C.value?(I(),z("div",{key:2,class:pe({"wl-reply-wrapper":x.value,"wl-edit-wrapper":C.value})},[le(so,{edit:y.edit,"reply-id":(H=y.reply)==null?void 0:H.objectId,"reply-user":y.comment.nick,"root-id":y.rootId,onLog:$[5]||($[5]=U=>r("log")),onCancelReply:$[6]||($[6]=U=>r("reply",null)),onCancelEdit:$[7]||($[7]=U=>r("edit",null)),onSubmit:$[8]||($[8]=U=>r("submit",U))},null,8,["edit","reply-id","reply-user","root-id"])],2)):Y("v-if",!0),"children"in y.comment?(I(),z("div",lh,[(I(!0),z(ae,null,je(y.comment.children,U=>(I(),Xe(T,{key:U.objectId,comment:U,reply:y.reply,edit:y.edit,"root-id":y.rootId,onLog:$[9]||($[9]=J=>r("log")),onDelete:$[10]||($[10]=J=>r("delete",J)),onEdit:$[11]||($[11]=J=>r("edit",J)),onLike:$[12]||($[12]=J=>r("like",J)),onReply:$[13]||($[13]=J=>r("reply",J)),onStatus:$[14]||($[14]=J=>r("status",J)),onSticky:$[15]||($[15]=J=>r("sticky",J)),onSubmit:$[16]||($[16]=J=>r("submit",J))},null,8,["comment","reply","edit","root-id"]))),128))])):Y("v-if",!0)])],8,Ud)}}}),oh=_n(sh,[["__file","CommentCard.vue"]]);const oo="3.0.0-alpha.7",ah={"data-waline":""},ch={class:"wl-meta-head"},uh={class:"wl-count"},fh=["textContent"],dh={class:"wl-sort"},hh=["onClick"],ph={class:"wl-cards"},gh={key:1,class:"wl-operation"},mh=["textContent"],vh={key:2,class:"wl-loading"},wh=["textContent"],yh={key:4,class:"wl-operation"},bh=["textContent"],kh={key:5,class:"wl-power"},xh=P("a",{href:"https://github.com/walinejs/waline",target:"_blank",rel:"noopener noreferrer"}," Waline ",-1);var _h=ln({__name:"WalineComment",props:["serverURL","path","meta","requiredMeta","dark","commentSorting","lang","locale","pageSize","wordLimit","emoji","login","highlighter","texRenderer","imageUploader","search","copyright","recaptchaV3Key","turnstileKey","reaction"],setup(e){const t=e,n={latest:"insertedAt_desc",oldest:"insertedAt_asc",hottest:"like_desc"},r=Object.keys(n),i=yr(),l=Gs(),s=W("loading"),o=W(0),a=W(1),c=W(0),f=ye(()=>To(t)),p=W(f.value.commentSorting),h=W([]),v=W(null),A=W(null),x=ye(()=>Ao(f.value.dark)),C=ye(()=>f.value.locale);gu(x,{id:"waline-darkmode"});let y;const $=B=>{var N;const{serverURL:re,path:ge,pageSize:he}=f.value,be=new AbortController;s.value="loading",y==null||y(),Li({serverURL:re,lang:f.value.lang,path:ge,pageSize:he,sortBy:n[p.value],page:B,signal:be.signal,token:(N=i.value)==null?void 0:N.token}).then(me=>{s.value="success",o.value=me.count,h.value.push(...me.data),a.value=B,c.value=me.totalPages}).catch(me=>{me.name!=="AbortError"&&(console.error(me.message),s.value="error")}),y=be.abort.bind(be)},H=()=>$(a.value+1),T=()=>{o.value=0,h.value=[],$(1)},U=B=>{p.value!==B&&(p.value=B,T())},J=B=>{v.value=B},q=B=>{A.value=B},D=B=>{if(A.value)A.value.comment=B.comment,A.value.orig=B.orig;else if("rid"in B){const N=h.value.find(({objectId:re})=>re===B.rid);if(!N)return;Array.isArray(N.children)||(N.children=[]),N.children.push(B)}else h.value.unshift(B),o.value+=1},Z=async({comment:B,status:N})=>{var re;if(B.status===N)return;const{serverURL:ge,lang:he}=f.value;await qt({serverURL:ge,lang:he,token:(re=i.value)==null?void 0:re.token,objectId:B.objectId,comment:{status:N}}),B.status=N},oe=async B=>{var N;if("rid"in B)return;const{serverURL:re,lang:ge}=f.value;await qt({serverURL:re,lang:ge,token:(N=i.value)==null?void 0:N.token,objectId:B.objectId,comment:{sticky:B.sticky?0:1}}),B.sticky=!B.sticky},xe=async({objectId:B})=>{var N;if(!confirm("Are you sure you want to delete this comment?"))return;const{serverURL:re,lang:ge}=f.value;await Mi({serverURL:re,lang:ge,token:(N=i.value)==null?void 0:N.token,objectId:B}),h.value.some((he,be)=>he.objectId===B?(h.value=h.value.filter((me,it)=>it!==be),!0):he.children.some((me,it)=>me.objectId===B?(h.value[be].children=he.children.filter((ht,Se)=>Se!==it),!0):!1))},Ue=async B=>{var N;const{serverURL:re,lang:ge}=f.value,{objectId:he}=B,be=l.value.includes(he);await qt({serverURL:re,lang:ge,objectId:he,token:(N=i.value)==null?void 0:N.token,comment:{like:!be}}),be?l.value=l.value.filter(me=>me!==he):(l.value=[...l.value,he],l.value.length>50&&(l.value=l.value.slice(-50))),B.like=(B.like||0)+(be?-1:1)};return Za("config",f),sn(()=>{Oe(()=>[t.serverURL,t.path],()=>T(),{immediate:!0})}),Xn(()=>y==null?void 0:y()),(B,N)=>(I(),z("div",ah,[le(Kf),v.value?Y("v-if",!0):(I(),Xe(so,{key:0,onLog:T,onSubmit:D})),P("div",ch,[P("div",uh,[o.value?(I(),z("span",{key:0,class:"wl-num",textContent:ne(o.value)},null,8,fh)):Y("v-if",!0),Ge(" "+ne(C.value.comment),1)]),P("ul",dh,[(I(!0),z(ae,null,je(K(r),re=>(I(),z("li",{key:re,class:pe([re===p.value?"active":""]),onClick:ge=>U(re)},ne(C.value[re]),11,hh))),128))])]),P("div",ph,[(I(!0),z(ae,null,je(h.value,re=>(I(),Xe(oh,{key:re.objectId,"root-id":re.objectId,comment:re,reply:v.value,edit:A.value,onLog:T,onReply:J,onEdit:q,onSubmit:D,onStatus:Z,onDelete:xe,onSticky:oe,onLike:Ue},null,8,["root-id","comment","reply","edit"]))),128))]),s.value==="error"?(I(),z("div",gh,[P("button",{type:"button",class:"wl-btn",onClick:T,textContent:ne(C.value.refresh)},null,8,mh)])):s.value==="loading"?(I(),z("div",vh,[le(K(kn),{size:30})])):h.value.length?a.value<c.value?(I(),z("div",yh,[P("button",{type:"button",class:"wl-btn",onClick:H,textContent:ne(C.value.more)},null,8,bh)])):Y("v-if",!0):(I(),z("div",{key:3,class:"wl-empty",textContent:ne(C.value.sofa)},null,8,wh)),f.value.copyright?(I(),z("div",kh,[Ge(" Powered by "),xh,Ge(" v"+ne(K(oo)),1)])):Y("v-if",!0)]))}}),Ch=_n(_h,[["__file","WalineComment.vue"]]);const ao=(e,t)=>{t.forEach((n,r)=>{n.innerText=e[r].toString()})},co=({serverURL:e,path:t=window.location.pathname,selector:n=".waline-pageview-count",update:r=!0,lang:i=navigator.language})=>{const l=new AbortController,s=Array.from(document.querySelectorAll(n)),o=c=>{const f=$i(c);return f!==null&&t!==f},a=c=>ji({serverURL:In(e),paths:c.map(f=>$i(f)||t),lang:i,signal:l.signal}).then(f=>ao(f,c)).catch(Es);if(r){const c=s.filter(p=>!o(p)),f=s.filter(o);Pi({serverURL:In(e),path:t,lang:i}).then(([p])=>ao(new Array(c.length).fill(p),c)),f.length&&a(f)}else a(s);return l.abort.bind(l)},$h=({el:e="#waline",path:t=window.location.pathname,comment:n=!1,pageview:r=!1,...i})=>{const l=e?mi(e):null;if(e&&!l)throw new Error("Option 'el' do not match any domElement!");if(!i.serverURL)throw new Error("Option 'serverURL' is missing!");const s=Gt({...i}),o=Gt({comment:n,pageview:r,path:t}),a=()=>{o.comment&&Qs({serverURL:s.serverURL,path:o.path,...typeof o.comment=="string"?{selector:o.comment}:{}})},c=()=>{o.pageview&&co({serverURL:s.serverURL,path:o.path,...typeof o.pageview=="string"?{selector:o.pageview}:{}})},f=l?Zc(()=>ee(Ch,{path:o.path,...s})):null;f&&f.mount(l);const p=jl(a),h=jl(c);return{el:l,update:({comment:v,pageview:A,path:x=window.location.pathname,...C}={})=>{Object.entries(C).forEach(([y,$])=>{s[y]=$}),o.path=x,v!==void 0&&(o.comment=v),A!==void 0&&(o.pageview=A)},destroy:()=>{f==null||f.unmount(),p(),h()}}},Eh=({el:e,serverURL:t,count:n,lang:r=navigator.language})=>{var i;const l=yr(),s=mi(e),o=new AbortController;return Ui({serverURL:t,count:n,lang:r,signal:o.signal,token:(i=l.value)==null?void 0:i.token}).then(a=>s&&a.length?(s.innerHTML=`<ul class="wl-recent-list">${a.map(c=>`<li class="wl-recent-item"><a href="${c.url}">${c.nick}</a>:${c.comment}</li>`).join("")}</ul>`,{comments:a,destroy:()=>{o.abort(),s.innerHTML=""}}):{comments:a,destroy:()=>o.abort()})},Rh=({el:e,serverURL:t,count:n,locale:r,lang:i=navigator.language,mode:l="list"})=>{const s=mi(e),o=new AbortController;return Fi({serverURL:t,pageSize:n,lang:i,signal:o.signal}).then(a=>!s||!a.length?{users:a,destroy:()=>o.abort()}:(r={...Lt[i]||Lt[Di],...typeof r=="object"?r:{}},s.innerHTML=`<ul class="wl-user-${l}">${a.map((c,f)=>[`<li class="wl-user-item" aria-label="${c.nick}">`,c.link&&`<a href="${c.link}" target="_blank">`,'<div class="wl-user-avatar">',`<img src="${c.avatar}" alt="${c.nick}">`,`<span class="wl-user-badge">${f+1}</span>`,"</div>",'<div class="wl-user-meta">','<div class="wl-user-name">',c.nick,c.level&&`<span class="wl-badge">${r?r[`level${c.level}`]:`Level ${c.level}`}</span>`,c.label&&`<span class="wl-badge">${c.label}</span>`,"</div>",c.link&&c.link,"</div>",c.link&&"</a>","</li>"].filter(p=>p).join("")).join("")}</ul>`,{users:a,destroy:()=>{o.abort(),s.innerHTML=""}}))};export{Eh as RecentComments,Rh as UserList,Si as addComment,Qs as commentCount,Lt as defaultLocales,Mi as deleteComment,zi as fetchCommentCount,Cr as getArticleCounter,Li as getComment,ji as getPageview,Ui as getRecentComment,Fi as getUserList,$h as init,Oi as login,co as pageviewCount,Tn as updateArticleCounter,qt as updateComment,Pi as updatePageview,oo as version};
54
54
  //# sourceMappingURL=waline.js.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@waline/client",
3
- "version": "3.0.0-alpha.6",
3
+ "version": "3.0.0-alpha.7",
4
4
  "description": "client for waline comment system",
5
5
  "keywords": [
6
6
  "valine",
@@ -91,6 +91,7 @@
91
91
  "autosize": "^6.0.1",
92
92
  "marked": "^11.1.0",
93
93
  "marked-highlight": "^2.0.9",
94
+ "recaptcha-v3": "^1.10.0",
94
95
  "vue": "^3.3.11"
95
96
  },
96
97
  "devDependencies": {
@@ -100,7 +101,6 @@
100
101
  "@types/autosize": "4.0.3",
101
102
  "@types/marked": "5.0.2",
102
103
  "@vitejs/plugin-vue": "4.5.2",
103
- "recaptcha-v3": "1.10.0",
104
104
  "user-agent-data-types": "0.4.2",
105
105
  "vite": "5.0.8"
106
106
  }