@waline/client 3.3.2 → 3.4.0
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.js +1 -1
- package/dist/component.js +1 -1
- package/dist/component.js.map +1 -1
- package/dist/pageview.js +1 -1
- package/dist/slim.js +1 -1
- package/dist/slim.js.map +1 -1
- package/dist/waline.css +1 -1
- package/dist/waline.css.map +1 -1
- package/dist/waline.js +58 -58
- package/dist/waline.js.map +1 -1
- package/dist/waline.umd.js +58 -58
- package/dist/waline.umd.js.map +1 -1
- package/package.json +9 -9
package/dist/pageview.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
const v="3.
|
|
1
|
+
const v="3.4.0",$={"Content-Type":"application/json"},h=e=>`${e.replace(/\/?$/,"/")}api/`,u=(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:o,signal:a})=>fetch(`${h(e)}article?path=${encodeURIComponent(r.join(","))}&type=${encodeURIComponent(o.join(","))}&lang=${t}`,{signal:a}).then(n=>n.json()).then(n=>u(n,"Get counter").data),U=({serverURL:e,lang:t,path:r,type:o,action:a})=>fetch(`${h(e)}article?lang=${t}`,{method:"POST",headers:$,body:JSON.stringify({path:r,type:o,action:a})}).then(n=>n.json()).then(n=>u(n,"Update counter").data),R=({serverURL:e,lang:t,paths:r,signal:o})=>f({serverURL:e,lang:t,paths:r,type:["time"],signal:o}),w=e=>U({...e,type:"time",action:"inc"}),L=(e="")=>e.replace(/\/$/u,""),b=e=>/^(https?:)?\/\//.test(e),d=e=>{const t=L(e);return b(t)?t:`https://${t}`},j=e=>{e.name!=="AbortError"&&console.error(e.message)},m=e=>{const{path:t}=e.dataset;return t!=null&&t.length?t:null},y=(e,t)=>{t.forEach((r,o)=>{const a=e[o].time;typeof a=="number"&&(r.innerText=a.toString())})},S=({serverURL:e,path:t=window.location.pathname,selector:r=".waline-pageview-count",update:o=!0,lang:a=navigator.language})=>{const n=new AbortController,i=Array.from(document.querySelectorAll(r)),p=l=>{const s=m(l);return s!==null&&t!==s},g=l=>R({serverURL:d(e),paths:l.map(s=>m(s)??t),lang:a,signal:n.signal}).then(s=>y(s,l)).catch(j);if(o){const l=i.filter(c=>!p(c)),s=i.filter(p);w({serverURL:d(e),path:t,lang:a}).then(c=>y(c,l)),s.length&&g(s)}else g(i);return n.abort.bind(n)};export{S as pageviewCount,v as version};
|
|
2
2
|
//# sourceMappingURL=pageview.js.map
|
package/dist/slim.js
CHANGED
|
@@ -8,5 +8,5 @@ import{fetchCommentCount as Rt,getArticleCounter as xt,updateArticleCounter as F
|
|
|
8
8
|
Số từ hiện tại: $2`,"Vô danh","Người lùn","Người tí hon","Thần rừng","Pháp sư","Tiên tộc","Maiar","Ảnh GIF","Tìm kiếm ảnh GIF","thông tin cá nhân","Đã được phê duyệt","Đang chờ đợi","Thư rác","Không dính","lâu đời nhất","muộn nhất","nóng nhất","What do you think?"]),lt=Q(["昵称","昵称不能少于3个字符","邮箱","请填写正确的邮件地址","网址","可选","欢迎评论","来发评论吧~","提交","喜欢","取消喜欢","回复","取消回复","评论","刷新","加载更多...","预览","表情","上传图片","秒前","分钟前","小时前","天前","刚刚","正在上传","登录","退出","博主","置顶","字",`评论字数应在 $0 到 $1 字之间!
|
|
9
9
|
当前字数:$2`,"匿名","潜水","冒泡","吐槽","活跃","话痨","传说","表情包","搜索表情包","个人资料","通过","待审核","垃圾","取消置顶","按倒序","按正序","按热度","你认为这篇文章怎么样?"]),vl=Q(["暱稱","暱稱不能少於3個字元","郵箱","請填寫正確的郵件地址","網址","可選","歡迎留言","來發留言吧~","送出","喜歡","取消喜歡","回覆","取消回覆","留言","重整","載入更多...","預覽","表情","上傳圖片","秒前","分鐘前","小時前","天前","剛剛","正在上傳","登入","登出","管理者","置頂","字",`留言字數應在 $0 到 $1 字之間!
|
|
10
10
|
目前字數:$2`,"匿名","潛水","冒泡","吐槽","活躍","多話","傳說","表情包","搜尋表情包","個人資料","通過","待審核","垃圾","取消置頂","最早","最新","熱門","你認為這篇文章怎麼樣?"]);const at="en-US",ye={zh:lt,"zh-cn":lt,"zh-tw":vl,en:Xe,"en-us":Xe,fr:Ye,"fr-fr":Ye,jp:Qe,"jp-jp":Qe,"pt-br":ml,ru:et,"ru-ru":et,vi:tt,"vi-vn":tt,de:ul,es:Je,"es-mx":Je},nt=e=>ye[e.toLowerCase()]||ye[at.toLowerCase()],it=e=>Object.keys(ye).includes(e.toLowerCase())?e:at,ot=e=>{try{e=decodeURI(e)}catch{}return e},rt=(e="")=>e.replace(/\/$/u,""),st=e=>/^(https?:)?\/\//.test(e),ke=e=>{const a=rt(e);return st(a)?a:`https://${a}`},dl=e=>Array.isArray(e)?e:e?[0,e]:!1,Ie=(e,a)=>typeof e=="function"?e:e===!1?!1:a,pl=({serverURL:e,path:a=location.pathname,lang:t=typeof navigator>"u"?"en-US":navigator.language,locale:l,emoji:n=Ke,meta:r=["nick","mail","link"],requiredMeta:f=[],dark:c=!1,pageSize:C=10,wordLimit:u,imageUploader:w,highlighter:U,texRenderer:g,copyright:S=!0,login:j="enable",search:$,reaction:y,recaptchaV3Key:i="",turnstileKey:h="",commentSorting:F="latest",...q})=>({serverURL:ke(e),path:ot(a),lang:it(t),locale:{...nt(it(t)),...typeof l=="object"?l:{}},wordLimit:dl(u),meta:Ge(r),requiredMeta:Ge(f),imageUploader:Ie(w,el),highlighter:Ie(U,sl),texRenderer:Ie(g,tl),dark:c,emoji:typeof n=="boolean"?n?Ke:[]:n,pageSize:C,login:j,copyright:S,search:$===!1?!1:typeof $=="object"?$:ll(t),recaptchaV3Key:i,turnstileKey:h,reaction:Array.isArray(y)?y:y===!0?Qt:[],commentSorting:F,...q}),re=e=>typeof e=="string",Ae="{--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}",gl=e=>re(e)?e==="auto"?`@media(prefers-color-scheme:dark){body${Ae}}`:`${e}${Ae}`:e===!0?`:root${Ae}`:"",Re=(e,a)=>{let t=e.toString();for(;t.length<a;)t="0"+t;return t},hl=e=>{const a=Re(e.getDate(),2),t=Re(e.getMonth()+1,2);return`${Re(e.getFullYear(),2)}-${t}-${a}`},fl=(e,a,t)=>{if(!e)return"";const l=re(e)?new Date(e.includes(" ")?e.replace(/-/g,"/"):e):e,n=a.getTime()-l.getTime(),r=Math.floor(n/(24*3600*1e3));if(r===0){const f=n%864e5,c=Math.floor(f/(3600*1e3));if(c===0){const C=f%36e5,u=Math.floor(C/(60*1e3));if(u===0){const w=C%6e4;return`${Math.round(w/1e3)} ${t.seconds}`}return`${u} ${t.minutes}`}return`${c} ${t.hours}`}return r<0?t.now:r<8?`${r} ${t.days}`:hl(l)},wl=/^[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])?)*$/,yl=e=>wl.test(e),kl=e=>!!/@[0-9]+\.[0-9]+\.[0-9]+/.test(e),bl=e=>{const a=oe("WALINE_EMOJI",{}),t=kl(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 n={folder:e,...l};return t&&(a.value[e]=n),n})},ct=(e,a="",t="",l="")=>`${a?`${a}/`:""}${t}${e}${l?`.${l}`:""}`,Cl=e=>Promise.all(e.map(a=>re(a)?bl(rt(a)):Promise.resolve(a))).then(a=>{const t={tabs:[],map:{}};return a.forEach(l=>{const{name:n,folder:r,icon:f,prefix:c="",type:C,items:u}=l;t.tabs.push({name:n,icon:ct(f,r,c,C),items:u.map(w=>{const U=`${c}${w}`;return t.map[U]=ct(w,r,c,C),U})})}),t}),ut=e=>{e.name!=="AbortError"&&console.error(e.message)},xe=e=>e instanceof HTMLElement?e:re(e)?document.querySelector(e):null,$l=e=>e.type.includes("image"),mt=e=>{const a=Array.from(e).find($l);return a?a.getAsFile():null},Ll=/\$.*?\$/,El=/^\$(.*?)\$/,Il=/^(?:\s{0,3})\$\$((?:[^\n]|\n[^\n])+?)\n{0,1}\$\$/,Al=e=>[{name:"blockMath",level:"block",tokenizer(a){const t=Il.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(Ll);return t!==-1?t:a.length},tokenizer(a){const t=El.exec(a);if(t!==null)return{type:"html",raw:t[0],text:e(!1,t[1])}}}],vt=(e="",a={})=>e.replace(/:(.+?):/g,(t,l)=>a[l]?`<img class="wl-emoji" src="${a[l]}" alt="${l}">`:t),Rl=(e,{emojiMap:a,highlighter:t,texRenderer:l})=>{const n=new Zt;if(n.setOptions({breaks:!0}),t&&n.use(Xt({highlight:t})),l){const r=Al(l);n.use({extensions:r})}return n.parse(vt(e,a))},Me=e=>{const{path:a}=e.dataset;return a!=null&&a.length?a:null},xl=e=>e.match(/[\w\d\s,.\u00C0-\u024F\u0400-\u04FF]+/giu),Ml=e=>e.match(/[\u4E00-\u9FD5]/gu),Sl=e=>{var a,t;return(((a=xl(e))==null?void 0:a.reduce((l,n)=>l+(["",",","."].includes(n.trim())?0:n.trim().split(/\s+/u).length),0))??0)+(((t=Ml(e))==null?void 0:t.length)??0)},jl=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},dt=({serverURL:e,path:a=window.location.pathname,selector:t=".waline-comment-count",lang:l=navigator.language})=>{const n=new AbortController,r=document.querySelectorAll(t);return r.length&&Rt({serverURL:ke(e),paths:Array.from(r).map(f=>ot(Me(f)??a)),lang:l,signal:n.signal}).then(f=>{r.forEach((c,C)=>{c.innerText=f[C].toString()})}).catch(ut),n.abort.bind(n)},pt=({size:e})=>x("svg",{class:"wl-close-icon",viewBox:"0 0 1024 1024",width:e,height:e},[x("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"}),x("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"})]),Ul=()=>x("svg",{viewBox:"0 0 1024 1024",width:"24",height:"24"},x("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"})),zl=()=>x("svg",{viewBox:"0 0 1024 1024",width:"24",height:"24"},x("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"})),_l=()=>x("svg",{viewBox:"0 0 1024 1024",width:"24",height:"24"},[x("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"}),x("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"})]),Vl=({active:e=!1})=>x("svg",{viewBox:"0 0 1024 1024",width:"24",height:"24"},[x("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"})]),Hl=()=>x("svg",{viewBox:"0 0 1024 1024",width:"24",height:"24"},[x("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"}),x("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"})]),Tl=()=>x("svg",{width:"16",height:"16",ariaHidden:"true"},x("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"})),Fl=()=>x("svg",{viewBox:"0 0 1024 1024",width:"24",height:"24"},x("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"})),Nl=()=>x("svg",{viewBox:"0 0 1024 1024",width:"24",height:"24"},x("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"})),Pl=()=>x("svg",{class:"verified-icon",viewBox:"0 0 1024 1024",width:"14",height:"14"},x("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"})),me=({size:e=100})=>x("svg",{width:e,height:e,viewBox:"0 0 100 100",preserveAspectRatio:"xMidYMid"},x("circle",{cx:50,cy:50,fill:"none",stroke:"currentColor",strokeWidth:"4",r:"40","stroke-dasharray":"85 30"},x("animateTransform",{attributeName:"transform",type:"rotate",repeatCount:"indefinite",dur:"1s",values:"0 50 50;360 50 50",keyTimes:"0;1"}))),Wl=()=>x("svg",{width:24,height:24,fill:"currentcolor",viewBox:"0 0 24 24"},[x("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"}),x("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"})]),Bl=()=>oe("WALINE_USER_META",{nick:"",mail:"",link:""}),Dl=()=>oe("WALINE_COMMENT_BOX_EDITOR",""),Ol="WALINE_LIKE";let gt=null;const ht=()=>gt??(gt=oe(Ol,[])),ql="WALINE_REACTION";let ft=null;const Gl=()=>ft??(ft=oe(ql,{})),wt={},Kl=e=>{const a=wt[e]??(wt[e]=Jt(e,{useRecaptchaNet:!0,autoHideBadge:!0}));return{execute:t=>a.then(l=>l.execute(t))}},Zl=e=>({execute:async a=>{const{load:t}=Ot("https://challenges.cloudflare.com/turnstile/v0/api.js",void 0,{async:!1});await t();const l=window==null?void 0:window.turnstile;return new Promise(n=>{l==null||l.ready(()=>{l==null||l.render(".wl-captcha-container",{sitekey:e,action:a,size:"compact",callback:n})})})}}),Xl="WALINE_USER";let yt=null;const be=()=>yt??(yt=oe(Xl,{})),Jl={key:0,class:"wl-reaction"},Yl=["textContent"],Ql={class:"wl-reaction-list"},ea=["onClick"],ta={class:"wl-reaction-img"},la=["src","alt"],aa=["textContent"],na=["textContent"];var ia=ue({__name:"ArticleReaction",setup(e,{expose:a}){a();const t=Gl(),l=$e("config"),n=E(-1),r=E([]),f=P(()=>l.value.locale),c=P(()=>l.value.reaction.length>0),C=P(()=>{const{reaction:g,path:S}=l.value;return g.map((j,$)=>({icon:j,desc:f.value[`reaction${$}`],active:t.value[S]===$}))});let u;const w=async()=>{if(!c.value)return;const{serverURL:g,lang:S,path:j,reaction:$}=l.value,y=new AbortController;u=y.abort.bind(y);const i=await xt({serverURL:g,lang:S,paths:[j],type:$.map((h,F)=>`reaction${F}`),signal:y.signal});r.value=$.map((h,F)=>i[0][`reaction${F}`])},U=async g=>{if(n.value===-1){const{serverURL:S,lang:j,path:$}=l.value,y=t.value[$];n.value=g,y!==void 0&&(await Fe({serverURL:S,lang:j,path:$,type:`reaction${y}`,action:"desc"}),r.value[y]=Math.max(r.value[y]-1,0)),y!==g&&(await Fe({serverURL:S,lang:j,path:$,type:`reaction${g}`}),r.value[g]=(r.value[g]||0)+1),y===g?delete t.value[$]:t.value[$]=g,n.value=-1}};return fe(()=>{ae(()=>[l.value.serverURL,l.value.path],()=>{w()},{immediate:!0})}),Ne(()=>u==null?void 0:u()),(g,S)=>C.value.length?(s(),m("div",Jl,[p("div",{class:"wl-reaction-title",textContent:M(f.value.reactionTitle)},null,8,Yl),p("ul",Ql,[(s(!0),m(W,null,J(C.value,({active:j,icon:$,desc:y},i)=>(s(),m("li",{key:i,class:D(["wl-reaction-item",{active:j}]),onClick:h=>U(i)},[p("div",ta,[p("img",{src:$,alt:y},null,8,la),n.value===i?(s(),ne(L(me),{key:0,class:"wl-reaction-loading"})):(s(),m("div",{key:1,class:"wl-reaction-votes",textContent:M(r.value[i]||0)},null,8,aa))]),p("div",{class:"wl-reaction-text",textContent:M(y)},null,8,na)],10,ea))),128))])])):I("v-if",!0)}});const oa=["data-index"],ra=["src","title","onClick"];var sa=ue({__name:"ImageWall",props:{items:{default:()=>[]},columnWidth:{default:300},gap:{default:0}},emits:["insert"],setup(e,{expose:a}){const t=e;a();let l=null;const n=E(null),r=E({}),f=E([]),c=()=>{const g=Math.floor((n.value.getBoundingClientRect().width+t.gap)/(t.columnWidth+t.gap));return g>0?g:1},C=g=>new Array(g).fill(null).map(()=>[]),u=async g=>{var S;if(g>=t.items.length)return;await We();const j=Array.from(((S=n.value)==null?void 0:S.children)??[]).reduce(($,y)=>y.getBoundingClientRect().height<$.getBoundingClientRect().height?y:$);f.value[Number(j.dataset.index)].push(g),await u(g+1)},w=async(g=!1)=>{if(f.value.length===c()&&!g)return;f.value=C(c());const S=window.scrollY;await u(0),window.scrollTo({top:S})},U=g=>{r.value[g.target.src]=!0};return fe(()=>{w(!0),l=new ResizeObserver(()=>{w()}),l.observe(n.value),ae(()=>[t.items],()=>{r.value={},w(!0)}),ae(()=>[t.columnWidth,t.gap],()=>{w()})}),Tt(()=>l.unobserve(n.value)),(g,S)=>(s(),m("div",{ref_key:"wall",ref:n,class:"wl-gallery",style:Pe({gap:`${g.gap}px`})},[(s(!0),m(W,null,J(f.value,(j,$)=>(s(),m("div",{key:$,class:"wl-gallery-column","data-index":$,style:Pe({gap:`${g.gap}px`})},[(s(!0),m(W,null,J(j,y=>(s(),m(W,{key:y},[r.value[g.items[y].src]?I("v-if",!0):(s(),ne(L(me),{key:0,size:36,style:{margin:"20px auto"}})),p("img",{class:"wl-gallery-item",src:g.items[y].src,title:g.items[y].title,loading:"lazy",onLoad:U,onClick:i=>g.$emit("insert",``)},null,40,ra)],64))),128))],12,oa))),128))],4))}});const ca={key:0,class:"wl-login-info"},ua={class:"wl-avatar"},ma=["title"],va=["title"],da=["src"],pa=["title","textContent"],ga={class:"wl-panel"},ha=["for","textContent"],fa=["id","onUpdate:modelValue","name","type"],wa=["placeholder"],ya={class:"wl-preview"},ka=["innerHTML"],ba={class:"wl-footer"},Ca={class:"wl-actions"},$a={href:"https://guides.github.com/features/mastering-markdown/",title:"Markdown Guide","aria-label":"Markdown is supported",class:"wl-action",target:"_blank",rel:"noopener noreferrer"},La=["title"],Ea=["title"],Ia=["title","aria-label"],Aa=["title"],Ra={class:"wl-info"},xa={class:"wl-text-number"},Ma={key:0},Sa=["textContent"],ja=["textContent"],Ua=["disabled"],za=["placeholder"],_a={key:1,class:"wl-loading"},Va={key:0,class:"wl-tab-wrapper"},Ha=["title","onClick"],Ta=["src","alt"],Fa={key:0,class:"wl-tabs"},Na=["onClick"],Pa=["src","alt","title"],Wa=["title"];var kt=ue({__name:"CommentBox",props:{edit:{default:null},rootId:{default:""},replyId:{default:""},replyUser:{default:""}},emits:["log","cancelEdit","cancelReply","submit"],setup(e,{emit:a}){const t=e,l=a,n=$e("config"),r=Dl(),f=Bl(),c=be(),C=E({}),u=E(null),w=E(null),U=E(null),g=E(null),S=E(null),j=E(null),$=E(null),y=E({tabs:[],map:{}}),i=E(0),h=E(!1),F=E(!1),q=E(!1),A=E(""),_=E(0),H=Le({loading:!0,list:[]}),te=E(0),le=E(!1),ve=E(""),Y=E(!1),se=E(!1),d=P(()=>n.value.locale),R=P(()=>{var v;return!!((v=c.value)!=null&&v.token)}),z=P(()=>n.value.imageUploader!==!1),G=v=>{const o=u.value,k=o.selectionStart,V=o.selectionEnd||0,b=o.scrollTop;r.value=o.value.substring(0,k)+v+o.value.substring(V,o.value.length),o.focus(),o.selectionStart=k+v.length,o.selectionEnd=k+v.length,o.scrollTop=b},K=v=>{if(Y.value)return;const o=v.key;(v.ctrlKey||v.metaKey)&&o==="Enter"&&de()},Z=v=>{const o=`![${n.value.locale.uploading} ${v.name}]()`;return G(o),Y.value=!0,Promise.resolve().then(()=>n.value.imageUploader(v)).then(k=>{r.value=r.value.replace(o,`\r
|
|
11
|
-
`)}).catch(k=>{alert(k.message),r.value=r.value.replace(o,"")}).then(()=>{Y.value=!1})},X=v=>{var o;if((o=v.dataTransfer)!=null&&o.items){const k=mt(v.dataTransfer.items);k&&z.value&&(Z(k),v.preventDefault())}},ce=v=>{if(v.clipboardData){const o=mt(v.clipboardData.items);o&&z.value&&Z(o)}},Se=()=>{const v=w.value;v.files&&z.value&&Z(v.files[0]).then(()=>{v.value=""})},de=async()=>{var v,o,k,V,b,B;const{serverURL:N,lang:ee,login:pe,wordLimit:_e,requiredMeta:Ve,recaptchaV3Key:He,turnstileKey:Te}=n.value,At=await jl(),T={comment:ve.value,nick:f.value.nick,mail:f.value.mail,link:f.value.link,url:n.value.path,ua:At};if(!t.edit)if((v=c.value)!=null&&v.token)T.nick=c.value.display_name,T.mail=c.value.email,T.link=c.value.url;else{if(pe==="force")return;if(Ve.includes("nick")&&!T.nick)return(o=C.value.nick)==null||o.focus(),alert(d.value.nickError);if(Ve.includes("mail")&&!T.mail||T.mail&&!yl(T.mail))return(k=C.value.mail)==null||k.focus(),alert(d.value.mailError);T.nick||(T.nick=d.value.anonymous)}if(!T.comment){(V=u.value)==null||V.focus();return}if(!le.value)return alert(d.value.wordHint.replace("$0",_e[0].toString()).replace("$1",_e[1].toString()).replace("$2",_.value.toString()));T.comment=vt(T.comment,y.value.map),t.replyId&&t.rootId&&(T.pid=t.replyId,T.rid=t.rootId,T.at=t.replyUser),Y.value=!0;try{He&&(T.recaptchaV3=await Kl(He).execute("social")),Te&&(T.turnstile=await Zl(Te).execute("social"));const ge={serverURL:N,lang:ee,token:(b=c.value)==null?void 0:b.token,comment:T},Ce=await(t.edit?he({objectId:t.edit.objectId,...ge}):Mt(ge));if(Y.value=!1,Ce.errmsg)return alert(Ce.errmsg);l("submit",Ce.data),r.value="",A.value="",await We(),t.replyId&&l("cancelReply"),(B=t.edit)!=null&&B.objectId&&l("cancelEdit")}catch(ge){Y.value=!1,alert(ge.message)}},Lt=v=>{v.preventDefault();const{lang:o,serverURL:k}=n.value;St({serverURL:k,lang:o}).then(V=>{c.value=V,(V.remember?localStorage:sessionStorage).setItem("WALINE_USER",JSON.stringify(V)),l("log")})},Et=()=>{c.value={},localStorage.setItem("WALINE_USER","null"),sessionStorage.setItem("WALINE_USER","null"),l("log")},je=v=>{v.preventDefault();const{lang:o,serverURL:k}=n.value,V=800,b=800,B=(window.innerWidth-V)/2,N=(window.innerHeight-b)/2,ee=new URLSearchParams({lng:o,token:c.value.token}),pe=window.open(`${k}/ui/profile?${ee.toString()}`,"_blank",`width=${V},height=${b},left=${B},top=${N},scrollbars=no,resizable=no,status=no,location=no,toolbar=no,menubar=no`);pe==null||pe.postMessage({type:"TOKEN",data:c.value.token},"*")},It=v=>{var o,k,V,b;!((o=U.value)!=null&&o.contains(v.target))&&!((k=g.value)!=null&&k.contains(v.target))&&(h.value=!1),!((V=S.value)!=null&&V.contains(v.target))&&!((b=j.value)!=null&&b.contains(v.target))&&(F.value=!1)},Ue=async v=>{var o;const{scrollTop:k,clientHeight:V,scrollHeight:b}=v.target,B=(V+k)/b,N=n.value.search,ee=((o=$.value)==null?void 0:o.value)??"";B<.9||H.loading||se.value||(H.loading=!0,(N.more&&H.list.length?await N.more(ee,H.list.length):await N.search(ee)).length?H.list=[...H.list,...N.more&&H.list.length?await N.more(ee,H.list.length):await N.search(ee)]:se.value=!0,H.loading=!1,setTimeout(()=>{v.target.scrollTop=k},50))},ze=qt(v=>{H.list=[],se.value=!1,Ue(v)},300);return ae([n,_],([v,o])=>{const{wordLimit:k}=v;k?o<k[0]&&k[0]!==0?(te.value=k[0],le.value=!1):o>k[1]?(te.value=k[1],le.value=!1):(te.value=k[1],le.value=!0):(te.value=0,le.value=!0)},{immediate:!0}),Oe("click",It),Oe("message",({data:v})=>{!v||v.type!=="profile"||(c.value={...c.value,...v.data},[localStorage,sessionStorage].filter(o=>o.getItem("WALINE_USER")).forEach(o=>o.setItem("WALINE_USER",JSON.stringify(c))))}),ae(F,async v=>{var o;if(!v)return;const k=n.value.search;$.value&&($.value.value=""),H.loading=!0,H.list=await(((o=k.default)==null?void 0:o.call(k))??k.search("")),H.loading=!1}),fe(()=>{var v;(v=t.edit)!=null&&v.objectId&&(r.value=t.edit.orig),ae(()=>r.value,o=>{const{highlighter:k,texRenderer:V}=n.value;ve.value=o,A.value=Rl(o,{emojiMap:y.value.map,highlighter:k,texRenderer:V}),_.value=Sl(o),o?qe(u.value):qe.destroy(u.value)},{immediate:!0}),ae(()=>n.value.emoji,o=>Cl(o).then(k=>{y.value=k}),{immediate:!0})}),(v,o)=>{var k,V;return s(),m("div",{key:L(c).token,class:"wl-comment"},[L(n).login!=="disable"&&R.value&&!((k=v.edit)!=null&&k.objectId)?(s(),m("div",ca,[p("div",ua,[p("button",{type:"submit",class:"wl-logout-btn",title:d.value.logout,onClick:Et},[O(L(pt),{size:14})],8,ma),p("a",{href:"#",class:"wl-login-nick","aria-label":"Profile",title:d.value.profile,onClick:je},[p("img",{src:L(c).avatar,alt:"avatar"},null,8,da)],8,va)]),p("a",{href:"#",class:"wl-login-nick","aria-label":"Profile",title:d.value.profile,onClick:je,textContent:M(L(c).display_name)},null,8,pa)])):I("v-if",!0),p("div",ga,[L(n).login!=="force"&&L(n).meta.length&&!R.value?(s(),m("div",{key:0,class:D(["wl-header",`item${L(n).meta.length}`])},[(s(!0),m(W,null,J(L(n).meta,b=>(s(),m("div",{key:b,class:"wl-header-item"},[p("label",{for:`wl-${b}`,textContent:M(d.value[b]+(L(n).requiredMeta.includes(b)||!L(n).requiredMeta.length?"":`(${d.value.optional})`))},null,8,ha),we(p("input",{id:`wl-${b}`,ref_for:!0,ref:B=>{B&&(C.value[b]=B)},"onUpdate:modelValue":B=>L(f)[b]=B,class:D(["wl-input",`wl-${b}`]),name:b,type:b==="mail"?"email":"text"},null,10,fa),[[Ft,L(f)[b]]])]))),128))],2)):I("v-if",!0),we(p("textarea",{id:"wl-edit",ref_key:"editorRef",ref:u,"onUpdate:modelValue":o[0]||(o[0]=b=>Nt(r)?r.value=b:null),class:"wl-editor",placeholder:v.replyUser?`@${v.replyUser}`:d.value.placeholder,onKeydown:K,onDrop:X,onPaste:ce},null,40,wa),[[Pt,L(r)]]),we(p("div",ya,[o[7]||(o[7]=p("hr",null,null,-1)),p("h4",null,M(d.value.preview)+":",1),p("div",{class:"wl-content",innerHTML:A.value},null,8,ka)],512),[[Be,q.value]]),p("div",ba,[p("div",Ca,[p("a",$a,[O(L(Tl))]),we(p("button",{ref_key:"emojiButtonRef",ref:U,type:"button",class:D(["wl-action",{active:h.value}]),title:d.value.emoji,onClick:o[1]||(o[1]=b=>h.value=!h.value)},[O(L(zl))],10,La),[[Be,y.value.tabs.length]]),L(n).search?(s(),m("button",{key:0,ref_key:"gifButtonRef",ref:S,type:"button",class:D(["wl-action",{active:F.value}]),title:d.value.gif,onClick:o[2]||(o[2]=b=>F.value=!F.value)},[O(L(Wl))],10,Ea)):I("v-if",!0),p("input",{id:"wl-image-upload",ref_key:"imageUploadRef",ref:w,class:"upload","aria-hidden":"true",type:"file",accept:".png,.jpg,.jpeg,.webp,.bmp,.gif",onChange:Se},null,544),z.value?(s(),m("label",{key:1,for:"wl-image-upload",class:"wl-action",title:d.value.uploadImage,"aria-label":d.value.uploadImage},[O(L(_l))],8,Ia)):I("v-if",!0),p("button",{type:"button",class:D(["wl-action",{active:q.value}]),title:d.value.preview,onClick:o[3]||(o[3]=b=>q.value=!q.value)},[O(L(Hl))],10,Aa)]),p("div",Ra,[o[9]||(o[9]=p("div",{class:"wl-captcha-container"},null,-1)),p("div",xa,[ie(M(_.value)+" ",1),L(n).wordLimit?(s(),m("span",Ma,[o[8]||(o[8]=ie(" / ")),p("span",{class:D({illegal:!le.value}),textContent:M(te.value)},null,10,Sa)])):I("v-if",!0),ie(" "+M(d.value.word),1)]),L(n).login!=="disable"&&!R.value?(s(),m("button",{key:0,type:"button",class:"wl-btn",onClick:Lt,textContent:M(d.value.login)},null,8,ja)):I("v-if",!0),L(n).login!=="force"||R.value?(s(),m("button",{key:1,type:"submit",class:"primary wl-btn",title:"Cmd|Ctrl + Enter",disabled:Y.value,onClick:de},[Y.value?(s(),ne(L(me),{key:0,size:16})):(s(),m(W,{key:1},[ie(M(d.value.submit),1)],64))],8,Ua)):I("v-if",!0)]),p("div",{ref_key:"gifPopupRef",ref:j,class:D(["wl-gif-popup",{display:F.value}])},[p("input",{ref_key:"gifSearchInputRef",ref:$,type:"text",placeholder:d.value.gifSearchPlaceholder,onInput:o[4]||(o[4]=(...b)=>L(ze)&&L(ze)(...b))},null,40,za),H.list.length?(s(),ne(sa,{key:0,items:H.list,"column-width":200,gap:6,onInsert:o[5]||(o[5]=b=>G(b)),onScroll:Ue},null,8,["items"])):I("v-if",!0),H.loading?(s(),m("div",_a,[O(L(me),{size:30})])):I("v-if",!0)],2),p("div",{ref_key:"emojiPopupRef",ref:g,class:D(["wl-emoji-popup",{display:h.value}])},[(s(!0),m(W,null,J(y.value.tabs,(b,B)=>(s(),m(W,{key:b.name},[B===i.value?(s(),m("div",Va,[(s(!0),m(W,null,J(b.items,N=>(s(),m("button",{key:N,type:"button",title:N,onClick:ee=>G(`:${N}:`)},[h.value?(s(),m("img",{key:0,class:"wl-emoji",src:y.value.map[N],alt:N,loading:"lazy",referrerPolicy:"no-referrer"},null,8,Ta)):I("v-if",!0)],8,Ha))),128))])):I("v-if",!0)],64))),128)),y.value.tabs.length>1?(s(),m("div",Fa,[(s(!0),m(W,null,J(y.value.tabs,(b,B)=>(s(),m("button",{key:b.name,type:"button",class:D(["wl-tab",{active:i.value===B}]),onClick:N=>i.value=B},[p("img",{class:"wl-emoji",src:b.icon,alt:b.name,title:b.name,loading:"lazy",referrerPolicy:"no-referrer"},null,8,Pa)],10,Na))),128))])):I("v-if",!0)],2)])]),v.replyId||(V=v.edit)!=null&&V.objectId?(s(),m("button",{key:1,type:"button",class:"wl-close",title:d.value.cancelReply,onClick:o[6]||(o[6]=b=>v.replyId?l("cancelReply"):l("cancelEdit"))},[O(L(pt),{size:24})],8,Wa)):I("v-if",!0)])}}});const Ba=["id"],Da={class:"wl-user","aria-hidden":"true"},Oa=["src"],qa={class:"wl-card"},Ga={class:"wl-head"},Ka=["href"],Za={key:1,class:"wl-nick"},Xa=["textContent"],Ja=["textContent"],Ya=["textContent"],Qa=["textContent"],en=["textContent"],tn={class:"wl-comment-actions"},ln=["title"],an=["title"],nn={class:"wl-meta","aria-hidden":"true"},on=["data-value","textContent"],rn={key:0,class:"wl-content"},sn={key:0},cn=["href"],un=["innerHTML"],mn={key:1,class:"wl-admin-actions"},vn={class:"wl-comment-status"},dn=["disabled","onClick","textContent"],pn={key:3,class:"wl-quote"};var gn=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 t=e,l=a,n=["approved","waiting","spam"],r=$e("config"),f=ht(),c=Gt(),C=be(),u=P(()=>r.value.locale),w=P(()=>{const{link:i}=t.comment;return i?st(i)?i:`https://${i}`:""}),U=P(()=>f.value.includes(t.comment.objectId)),g=P(()=>fl(new Date(t.comment.time),c.value,u.value)),S=P(()=>C.value.type==="administrator"),j=P(()=>t.comment.user_id&&C.value.objectId===t.comment.user_id),$=P(()=>{var i;return t.comment.objectId===((i=t.reply)==null?void 0:i.objectId)}),y=P(()=>{var i;return t.comment.objectId===((i=t.edit)==null?void 0:i.objectId)});return(i,h)=>{var F;const q=Wt("CommentCard",!0);return s(),m("div",{id:i.comment.objectId,class:"wl-card-item"},[p("div",Da,[i.comment.avatar?(s(),m("img",{key:0,class:"wl-user-avatar",src:i.comment.avatar,alt:""},null,8,Oa)):I("v-if",!0),i.comment.type?(s(),ne(L(Pl),{key:1})):I("v-if",!0)]),p("div",qa,[p("div",Ga,[w.value?(s(),m("a",{key:0,class:"wl-nick",href:w.value,target:"_blank",rel:"nofollow noopener noreferrer"},M(i.comment.nick),9,Ka)):(s(),m("span",Za,M(i.comment.nick),1)),i.comment.type==="administrator"?(s(),m("span",{key:2,class:"wl-badge",textContent:M(u.value.admin)},null,8,Xa)):I("v-if",!0),i.comment.label?(s(),m("span",{key:3,class:"wl-badge",textContent:M(i.comment.label)},null,8,Ja)):I("v-if",!0),i.comment.sticky?(s(),m("span",{key:4,class:"wl-badge",textContent:M(u.value.sticky)},null,8,Ya)):I("v-if",!0),typeof i.comment.level=="number"?(s(),m("span",{key:5,class:D(`wl-badge level${i.comment.level}`),textContent:M(u.value[`level${i.comment.level}`]||`Level ${i.comment.level}`)},null,10,Qa)):I("v-if",!0),p("span",{class:"wl-time",textContent:M(g.value)},null,8,en),p("div",tn,[S.value||j.value?(s(),m(W,{key:0},[p("button",{type:"button",class:"wl-edit",onClick:h[0]||(h[0]=A=>l("edit",i.comment))},[O(L(Nl))]),p("button",{type:"button",class:"wl-delete",onClick:h[1]||(h[1]=A=>l("delete",i.comment))},[O(L(Ul))])],64)):I("v-if",!0),p("button",{type:"button",class:"wl-like",title:U.value?u.value.cancelLike:u.value.like,onClick:h[2]||(h[2]=A=>l("like",i.comment))},[O(L(Vl),{active:U.value},null,8,["active"]),ie(" "+M("like"in i.comment?i.comment.like:""),1)],8,ln),p("button",{type:"button",class:D(["wl-reply",{active:$.value}]),title:$.value?u.value.cancelReply:u.value.reply,onClick:h[3]||(h[3]=A=>l("reply",$.value?null:i.comment))},[O(L(Fl))],10,an)])]),p("div",nn,[(s(),m(W,null,J(["addr","browser","os"],A=>(s(),m(W,null,[i.comment[A]?(s(),m("span",{key:A,class:D(`wl-${A}`),"data-value":i.comment[A],textContent:M(i.comment[A])},null,10,on)):I("v-if",!0)],64))),64))]),y.value?I("v-if",!0):(s(),m("div",rn,[i.comment.reply_user?(s(),m("p",sn,[p("a",{href:"#"+i.comment.pid},"@"+M(i.comment.reply_user.nick),9,cn),h[17]||(h[17]=p("span",null,": ",-1))])):I("v-if",!0),p("div",{innerHTML:i.comment.comment},null,8,un)])),S.value&&!y.value?(s(),m("div",mn,[p("span",vn,[(s(),m(W,null,J(n,A=>p("button",{key:A,type:"submit",class:D(`wl-btn wl-${A}`),disabled:i.comment.status===A,onClick:_=>l("status",{status:A,comment:i.comment}),textContent:M(u.value[A])},null,10,dn)),64))]),S.value&&!("rid"in i.comment)?(s(),m("button",{key:0,type:"submit",class:"wl-btn wl-sticky",onClick:h[4]||(h[4]=A=>l("sticky",i.comment))},M(i.comment.sticky?u.value.unsticky:u.value.sticky),1)):I("v-if",!0)])):I("v-if",!0),$.value||y.value?(s(),m("div",{key:2,class:D({"wl-reply-wrapper":$.value,"wl-edit-wrapper":y.value})},[O(kt,{edit:i.edit,"reply-id":(F=i.reply)==null?void 0:F.objectId,"reply-user":i.comment.nick,"root-id":i.rootId,onLog:h[5]||(h[5]=A=>l("log")),onCancelReply:h[6]||(h[6]=A=>l("reply",null)),onCancelEdit:h[7]||(h[7]=A=>l("edit",null)),onSubmit:h[8]||(h[8]=A=>l("submit",A))},null,8,["edit","reply-id","reply-user","root-id"])],2)):I("v-if",!0),"children"in i.comment?(s(),m("div",pn,[(s(!0),m(W,null,J(i.comment.children,A=>(s(),ne(q,{key:A.objectId,comment:A,reply:i.reply,edit:i.edit,"root-id":i.rootId,onLog:h[9]||(h[9]=_=>l("log")),onDelete:h[10]||(h[10]=_=>l("delete",_)),onEdit:h[11]||(h[11]=_=>l("edit",_)),onLike:h[12]||(h[12]=_=>l("like",_)),onReply:h[13]||(h[13]=_=>l("reply",_)),onStatus:h[14]||(h[14]=_=>l("status",_)),onSticky:h[15]||(h[15]=_=>l("sticky",_)),onSubmit:h[16]||(h[16]=_=>l("submit",_))},null,8,["comment","reply","edit","root-id"]))),128))])):I("v-if",!0)])],8,Ba)}}});const bt="3.3.2",hn={"data-waline":""},fn={class:"wl-meta-head"},wn={class:"wl-count"},yn=["textContent"],kn={class:"wl-sort"},bn=["onClick"],Cn={class:"wl-cards"},$n={key:1,class:"wl-operation"},Ln=["textContent"],En={key:2,class:"wl-loading"},In=["textContent"],An={key:4,class:"wl-operation"},Rn=["textContent"],xn={key:5,class:"wl-power"};var Mn=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,t={latest:"insertedAt_desc",oldest:"insertedAt_asc",hottest:"like_desc"},l=Object.keys(t),n=be(),r=ht(),f=E("loading"),c=E(0),C=E(1),u=E(0),w=P(()=>pl(a)),U=E(w.value.commentSorting),g=E([]),S=E(null),j=E(null),$=P(()=>gl(w.value.dark)),y=P(()=>w.value.locale);Kt($,{id:"waline-darkmode"});let i;const h=d=>{var R;const{serverURL:z,path:G,pageSize:K}=w.value,Z=new AbortController;f.value="loading",i==null||i(),Ut({serverURL:z,lang:w.value.lang,path:G,pageSize:K,sortBy:t[U.value],page:d,signal:Z.signal,token:(R=n.value)==null?void 0:R.token}).then(X=>{f.value="success",c.value=X.count,g.value.push(...X.data),C.value=d,u.value=X.totalPages}).catch(X=>{X.name!=="AbortError"&&(console.error(X.message),f.value="error")}),i=Z.abort.bind(Z)},F=()=>h(C.value+1),q=()=>{c.value=0,g.value=[],h(1)},A=d=>{U.value!==d&&(U.value=d,q())},_=d=>{S.value=d},H=d=>{j.value=d},te=d=>{if(j.value)j.value.comment=d.comment,j.value.orig=d.orig;else if("rid"in d){const R=g.value.find(({objectId:z})=>z===d.rid);if(!R)return;Array.isArray(R.children)||(R.children=[]),R.children.push(d)}else g.value.unshift(d),c.value+=1},le=async({comment:d,status:R})=>{var z;if(d.status===R)return;const{serverURL:G,lang:K}=w.value;await he({serverURL:G,lang:K,token:(z=n.value)==null?void 0:z.token,objectId:d.objectId,comment:{status:R}}),d.status=R},ve=async d=>{var R;if("rid"in d)return;const{serverURL:z,lang:G}=w.value;await he({serverURL:z,lang:G,token:(R=n.value)==null?void 0:R.token,objectId:d.objectId,comment:{sticky:d.sticky?0:1}}),d.sticky=!d.sticky},Y=async({objectId:d})=>{var R;if(!confirm("Are you sure you want to delete this comment?"))return;const{serverURL:z,lang:G}=w.value;await jt({serverURL:z,lang:G,token:(R=n.value)==null?void 0:R.token,objectId:d}),g.value.some((K,Z)=>K.objectId===d?(g.value=g.value.filter((X,ce)=>ce!==Z),!0):K.children.some((X,ce)=>X.objectId===d?(g.value[Z].children=K.children.filter((Se,de)=>de!==ce),!0):!1))},se=async d=>{var R;const{serverURL:z,lang:G}=w.value,{objectId:K}=d,Z=r.value.includes(K);await he({serverURL:z,lang:G,objectId:K,token:(R=n.value)==null?void 0:R.token,comment:{like:!Z}}),Z?r.value=r.value.filter(X=>X!==K):(r.value=[...r.value,K],r.value.length>50&&(r.value=r.value.slice(-50))),d.like=(d.like||0)+(Z?-1:1)};return Bt("config",w),fe(()=>{ae(()=>[a.serverURL,a.path],()=>q(),{immediate:!0})}),Ne(()=>i==null?void 0:i()),(d,R)=>(s(),m("div",hn,[O(ia),!S.value&&!j.value?(s(),ne(kt,{key:0,onLog:q,onSubmit:te})):I("v-if",!0),p("div",fn,[p("div",wn,[c.value?(s(),m("span",{key:0,class:"wl-num",textContent:M(c.value)},null,8,yn)):I("v-if",!0),ie(" "+M(y.value.comment),1)]),p("ul",kn,[(s(!0),m(W,null,J(L(l),z=>(s(),m("li",{key:z,class:D([z===U.value?"active":""]),onClick:G=>A(z)},M(y.value[z]),11,bn))),128))])]),p("div",Cn,[(s(!0),m(W,null,J(g.value,z=>(s(),ne(gn,{key:z.objectId,"root-id":z.objectId,comment:z,reply:S.value,edit:j.value,onLog:q,onReply:_,onEdit:H,onSubmit:te,onStatus:le,onDelete:Y,onSticky:ve,onLike:se},null,8,["root-id","comment","reply","edit"]))),128))]),f.value==="error"?(s(),m("div",$n,[p("button",{type:"button",class:"wl-btn",onClick:q,textContent:M(y.value.refresh)},null,8,Ln)])):f.value==="loading"?(s(),m("div",En,[O(L(me),{size:30})])):g.value.length?C.value<u.value?(s(),m("div",An,[p("button",{type:"button",class:"wl-btn",onClick:F,textContent:M(y.value.more)},null,8,Rn)])):I("v-if",!0):(s(),m("div",{key:3,class:"wl-empty",textContent:M(y.value.sofa)},null,8,In)),w.value.copyright?(s(),m("div",xn,[R[0]||(R[0]=ie(" Powered by ")),R[1]||(R[1]=p("a",{href:"https://github.com/walinejs/waline",target:"_blank",rel:"noopener noreferrer"}," Waline ",-1)),ie(" v"+M(L(bt)),1)])):I("v-if",!0)]))}});const Ct=(e,a)=>{a.forEach((t,l)=>{const n=e[l].time;typeof n=="number"&&(t.innerText=n.toString())})},$t=({serverURL:e,path:a=window.location.pathname,selector:t=".waline-pageview-count",update:l=!0,lang:n=navigator.language})=>{const r=new AbortController,f=Array.from(document.querySelectorAll(t)),c=u=>{const w=Me(u);return w!==null&&a!==w},C=u=>_t({serverURL:ke(e),paths:u.map(w=>Me(w)??a),lang:n,signal:r.signal}).then(w=>Ct(w,u)).catch(ut);if(l){const u=f.filter(U=>!c(U)),w=f.filter(c);zt({serverURL:ke(e),path:a,lang:n}).then(U=>Ct(U,u)),w.length&&C(w)}else C(f);return r.abort.bind(r)},Sn=({el:e="#waline",path:a=window.location.pathname,comment:t=!1,pageview:l=!1,...n})=>{const r=e?xe(e):null;if(e&&!r)throw new Error("Option 'el' do not match any domElement!");if(!n.serverURL)throw new Error("Option 'serverURL' is missing!");const f=Le({...n}),c=Le({comment:t,pageview:l,path:a}),C=()=>{c.comment&&dt({serverURL:f.serverURL,path:c.path,...re(c.comment)?{selector:c.comment}:{}})},u=()=>{c.pageview&&$t({serverURL:f.serverURL,path:c.path,...re(c.pageview)?{selector:c.pageview}:{}})},w=r?Dt(()=>x(Mn,{path:c.path,...f})):null;w&&w.mount(r);const U=De(C),g=De(u);return{el:r,update:({comment:S,pageview:j,path:$=window.location.pathname,...y}={})=>{Object.entries(y).forEach(([i,h])=>{f[i]=h}),c.path=$,S!==void 0&&(c.comment=S),j!==void 0&&(c.pageview=j)},destroy:()=>{w==null||w.unmount(),U(),g()}}},jn=({el:e,serverURL:a,count:t,lang:l=navigator.language})=>{var n;const r=be(),f=xe(e),c=new AbortController;return Vt({serverURL:a,count:t,lang:l,signal:c.signal,token:(n=r.value)==null?void 0:n.token}).then(C=>f&&C.length?(f.innerHTML=`<ul class="wl-recent-list">${C.map(u=>`<li class="wl-recent-item"><a href="${u.url}">${u.nick}</a>:${u.comment}</li>`).join("")}</ul>`,{comments:C,destroy:()=>{c.abort(),f.innerHTML=""}}):{comments:C,destroy:()=>c.abort()})},Un=({el:e,serverURL:a,count:t,locale:l,lang:n=navigator.language,mode:r="list"})=>{const f=xe(e),c=new AbortController;return Ht({serverURL:a,pageSize:t,lang:n,signal:c.signal}).then(C=>!f||!C.length?{users:C,destroy:()=>c.abort()}:(l={...nt(n),...typeof l=="object"?l:{}},f.innerHTML=`<ul class="wl-user-${r}">${C.map((u,w)=>[`<li class="wl-user-item" aria-label="${u.nick}">`,u.link&&`<a href="${u.link}" target="_blank">`,'<div class="wl-user-avatar">',`<img src="${u.avatar}" alt="${u.nick}">`,`<span class="wl-user-badge">${w+1}</span>`,"</div>",'<div class="wl-user-meta">','<div class="wl-user-name">',u.nick,u.level&&`<span class="wl-badge">${l?l[`level${u.level}`]:`Level ${u.level}`}</span>`,u.label&&`<span class="wl-badge">${u.label}</span>`,"</div>",u.link&&u.link,"</div>",u.link&&"</a>","</li>"].filter(U=>U).join("")).join("")}</ul>`,{users:C,destroy:()=>{c.abort(),f.innerHTML=""}}))};export{jn as RecentComments,Un as UserList,dt as commentCount,ye as defaultLocales,Sn as init,$t as pageviewCount,bt as version};
|
|
11
|
+
`)}).catch(k=>{alert(k.message),r.value=r.value.replace(o,"")}).then(()=>{Y.value=!1})},X=v=>{var o;if((o=v.dataTransfer)!=null&&o.items){const k=mt(v.dataTransfer.items);k&&z.value&&(Z(k),v.preventDefault())}},ce=v=>{if(v.clipboardData){const o=mt(v.clipboardData.items);o&&z.value&&Z(o)}},Se=()=>{const v=w.value;v.files&&z.value&&Z(v.files[0]).then(()=>{v.value=""})},de=async()=>{var v,o,k,V,b,B;const{serverURL:N,lang:ee,login:pe,wordLimit:_e,requiredMeta:Ve,recaptchaV3Key:He,turnstileKey:Te}=n.value,At=await jl(),T={comment:ve.value,nick:f.value.nick,mail:f.value.mail,link:f.value.link,url:n.value.path,ua:At};if(!t.edit)if((v=c.value)!=null&&v.token)T.nick=c.value.display_name,T.mail=c.value.email,T.link=c.value.url;else{if(pe==="force")return;if(Ve.includes("nick")&&!T.nick)return(o=C.value.nick)==null||o.focus(),alert(d.value.nickError);if(Ve.includes("mail")&&!T.mail||T.mail&&!yl(T.mail))return(k=C.value.mail)==null||k.focus(),alert(d.value.mailError);T.nick||(T.nick=d.value.anonymous)}if(!T.comment){(V=u.value)==null||V.focus();return}if(!le.value)return alert(d.value.wordHint.replace("$0",_e[0].toString()).replace("$1",_e[1].toString()).replace("$2",_.value.toString()));T.comment=vt(T.comment,y.value.map),t.replyId&&t.rootId&&(T.pid=t.replyId,T.rid=t.rootId,T.at=t.replyUser),Y.value=!0;try{He&&(T.recaptchaV3=await Kl(He).execute("social")),Te&&(T.turnstile=await Zl(Te).execute("social"));const ge={serverURL:N,lang:ee,token:(b=c.value)==null?void 0:b.token,comment:T},Ce=await(t.edit?he({objectId:t.edit.objectId,...ge}):Mt(ge));if(Y.value=!1,Ce.errmsg)return alert(Ce.errmsg);l("submit",Ce.data),r.value="",A.value="",await We(),t.replyId&&l("cancelReply"),(B=t.edit)!=null&&B.objectId&&l("cancelEdit")}catch(ge){Y.value=!1,alert(ge.message)}},Lt=v=>{v.preventDefault();const{lang:o,serverURL:k}=n.value;St({serverURL:k,lang:o}).then(V=>{c.value=V,(V.remember?localStorage:sessionStorage).setItem("WALINE_USER",JSON.stringify(V)),l("log")})},Et=()=>{c.value={},localStorage.setItem("WALINE_USER","null"),sessionStorage.setItem("WALINE_USER","null"),l("log")},je=v=>{v.preventDefault();const{lang:o,serverURL:k}=n.value,V=800,b=800,B=(window.innerWidth-V)/2,N=(window.innerHeight-b)/2,ee=new URLSearchParams({lng:o,token:c.value.token}),pe=window.open(`${k}/ui/profile?${ee.toString()}`,"_blank",`width=${V},height=${b},left=${B},top=${N},scrollbars=no,resizable=no,status=no,location=no,toolbar=no,menubar=no`);pe==null||pe.postMessage({type:"TOKEN",data:c.value.token},"*")},It=v=>{var o,k,V,b;!((o=U.value)!=null&&o.contains(v.target))&&!((k=g.value)!=null&&k.contains(v.target))&&(h.value=!1),!((V=S.value)!=null&&V.contains(v.target))&&!((b=j.value)!=null&&b.contains(v.target))&&(F.value=!1)},Ue=async v=>{var o;const{scrollTop:k,clientHeight:V,scrollHeight:b}=v.target,B=(V+k)/b,N=n.value.search,ee=((o=$.value)==null?void 0:o.value)??"";B<.9||H.loading||se.value||(H.loading=!0,(N.more&&H.list.length?await N.more(ee,H.list.length):await N.search(ee)).length?H.list=[...H.list,...N.more&&H.list.length?await N.more(ee,H.list.length):await N.search(ee)]:se.value=!0,H.loading=!1,setTimeout(()=>{v.target.scrollTop=k},50))},ze=qt(v=>{H.list=[],se.value=!1,Ue(v)},300);return ae([n,_],([v,o])=>{const{wordLimit:k}=v;k?o<k[0]&&k[0]!==0?(te.value=k[0],le.value=!1):o>k[1]?(te.value=k[1],le.value=!1):(te.value=k[1],le.value=!0):(te.value=0,le.value=!0)},{immediate:!0}),Oe("click",It),Oe("message",({data:v})=>{!v||v.type!=="profile"||(c.value={...c.value,...v.data},[localStorage,sessionStorage].filter(o=>o.getItem("WALINE_USER")).forEach(o=>o.setItem("WALINE_USER",JSON.stringify(c))))}),ae(F,async v=>{var o;if(!v)return;const k=n.value.search;$.value&&($.value.value=""),H.loading=!0,H.list=await(((o=k.default)==null?void 0:o.call(k))??k.search("")),H.loading=!1}),fe(()=>{var v;(v=t.edit)!=null&&v.objectId&&(r.value=t.edit.orig),ae(()=>r.value,o=>{const{highlighter:k,texRenderer:V}=n.value;ve.value=o,A.value=Rl(o,{emojiMap:y.value.map,highlighter:k,texRenderer:V}),_.value=Sl(o),o?qe(u.value):qe.destroy(u.value)},{immediate:!0}),ae(()=>n.value.emoji,o=>Cl(o).then(k=>{y.value=k}),{immediate:!0})}),(v,o)=>{var k,V;return s(),m("div",{key:L(c).token,class:"wl-comment"},[L(n).login!=="disable"&&R.value&&!((k=v.edit)!=null&&k.objectId)?(s(),m("div",ca,[p("div",ua,[p("button",{type:"submit",class:"wl-logout-btn",title:d.value.logout,onClick:Et},[O(L(pt),{size:14})],8,ma),p("a",{href:"#",class:"wl-login-nick","aria-label":"Profile",title:d.value.profile,onClick:je},[p("img",{src:L(c).avatar,alt:"avatar"},null,8,da)],8,va)]),p("a",{href:"#",class:"wl-login-nick","aria-label":"Profile",title:d.value.profile,onClick:je,textContent:M(L(c).display_name)},null,8,pa)])):I("v-if",!0),p("div",ga,[L(n).login!=="force"&&L(n).meta.length&&!R.value?(s(),m("div",{key:0,class:D(["wl-header",`item${L(n).meta.length}`])},[(s(!0),m(W,null,J(L(n).meta,b=>(s(),m("div",{key:b,class:"wl-header-item"},[p("label",{for:`wl-${b}`,textContent:M(d.value[b]+(L(n).requiredMeta.includes(b)||!L(n).requiredMeta.length?"":`(${d.value.optional})`))},null,8,ha),we(p("input",{id:`wl-${b}`,ref_for:!0,ref:B=>{B&&(C.value[b]=B)},"onUpdate:modelValue":B=>L(f)[b]=B,class:D(["wl-input",`wl-${b}`]),name:b,type:b==="mail"?"email":"text"},null,10,fa),[[Ft,L(f)[b]]])]))),128))],2)):I("v-if",!0),we(p("textarea",{id:"wl-edit",ref_key:"editorRef",ref:u,"onUpdate:modelValue":o[0]||(o[0]=b=>Nt(r)?r.value=b:null),class:"wl-editor",placeholder:v.replyUser?`@${v.replyUser}`:d.value.placeholder,onKeydown:K,onDrop:X,onPaste:ce},null,40,wa),[[Pt,L(r)]]),we(p("div",ya,[o[7]||(o[7]=p("hr",null,null,-1)),p("h4",null,M(d.value.preview)+":",1),p("div",{class:"wl-content",innerHTML:A.value},null,8,ka)],512),[[Be,q.value]]),p("div",ba,[p("div",Ca,[p("a",$a,[O(L(Tl))]),we(p("button",{ref_key:"emojiButtonRef",ref:U,type:"button",class:D(["wl-action",{active:h.value}]),title:d.value.emoji,onClick:o[1]||(o[1]=b=>h.value=!h.value)},[O(L(zl))],10,La),[[Be,y.value.tabs.length]]),L(n).search?(s(),m("button",{key:0,ref_key:"gifButtonRef",ref:S,type:"button",class:D(["wl-action",{active:F.value}]),title:d.value.gif,onClick:o[2]||(o[2]=b=>F.value=!F.value)},[O(L(Wl))],10,Ea)):I("v-if",!0),p("input",{id:"wl-image-upload",ref_key:"imageUploadRef",ref:w,class:"upload","aria-hidden":"true",type:"file",accept:".png,.jpg,.jpeg,.webp,.bmp,.gif",onChange:Se},null,544),z.value?(s(),m("label",{key:1,for:"wl-image-upload",class:"wl-action",title:d.value.uploadImage,"aria-label":d.value.uploadImage},[O(L(_l))],8,Ia)):I("v-if",!0),p("button",{type:"button",class:D(["wl-action",{active:q.value}]),title:d.value.preview,onClick:o[3]||(o[3]=b=>q.value=!q.value)},[O(L(Hl))],10,Aa)]),p("div",Ra,[o[9]||(o[9]=p("div",{class:"wl-captcha-container"},null,-1)),p("div",xa,[ie(M(_.value)+" ",1),L(n).wordLimit?(s(),m("span",Ma,[o[8]||(o[8]=ie(" / ")),p("span",{class:D({illegal:!le.value}),textContent:M(te.value)},null,10,Sa)])):I("v-if",!0),ie(" "+M(d.value.word),1)]),L(n).login!=="disable"&&!R.value?(s(),m("button",{key:0,type:"button",class:"wl-btn",onClick:Lt,textContent:M(d.value.login)},null,8,ja)):I("v-if",!0),L(n).login!=="force"||R.value?(s(),m("button",{key:1,type:"submit",class:"primary wl-btn",title:"Cmd|Ctrl + Enter",disabled:Y.value,onClick:de},[Y.value?(s(),ne(L(me),{key:0,size:16})):(s(),m(W,{key:1},[ie(M(d.value.submit),1)],64))],8,Ua)):I("v-if",!0)]),p("div",{ref_key:"gifPopupRef",ref:j,class:D(["wl-gif-popup",{display:F.value}])},[p("input",{ref_key:"gifSearchInputRef",ref:$,type:"text",placeholder:d.value.gifSearchPlaceholder,onInput:o[4]||(o[4]=(...b)=>L(ze)&&L(ze)(...b))},null,40,za),H.list.length?(s(),ne(sa,{key:0,items:H.list,"column-width":200,gap:6,onInsert:o[5]||(o[5]=b=>G(b)),onScroll:Ue},null,8,["items"])):I("v-if",!0),H.loading?(s(),m("div",_a,[O(L(me),{size:30})])):I("v-if",!0)],2),p("div",{ref_key:"emojiPopupRef",ref:g,class:D(["wl-emoji-popup",{display:h.value}])},[(s(!0),m(W,null,J(y.value.tabs,(b,B)=>(s(),m(W,{key:b.name},[B===i.value?(s(),m("div",Va,[(s(!0),m(W,null,J(b.items,N=>(s(),m("button",{key:N,type:"button",title:N,onClick:ee=>G(`:${N}:`)},[h.value?(s(),m("img",{key:0,class:"wl-emoji",src:y.value.map[N],alt:N,loading:"lazy",referrerPolicy:"no-referrer"},null,8,Ta)):I("v-if",!0)],8,Ha))),128))])):I("v-if",!0)],64))),128)),y.value.tabs.length>1?(s(),m("div",Fa,[(s(!0),m(W,null,J(y.value.tabs,(b,B)=>(s(),m("button",{key:b.name,type:"button",class:D(["wl-tab",{active:i.value===B}]),onClick:N=>i.value=B},[p("img",{class:"wl-emoji",src:b.icon,alt:b.name,title:b.name,loading:"lazy",referrerPolicy:"no-referrer"},null,8,Pa)],10,Na))),128))])):I("v-if",!0)],2)])]),v.replyId||(V=v.edit)!=null&&V.objectId?(s(),m("button",{key:1,type:"button",class:"wl-close",title:d.value.cancelReply,onClick:o[6]||(o[6]=b=>v.replyId?l("cancelReply"):l("cancelEdit"))},[O(L(pt),{size:24})],8,Wa)):I("v-if",!0)])}}});const Ba=["id"],Da={class:"wl-user","aria-hidden":"true"},Oa=["src"],qa={class:"wl-card"},Ga={class:"wl-head"},Ka=["href"],Za={key:1,class:"wl-nick"},Xa=["textContent"],Ja=["textContent"],Ya=["textContent"],Qa=["textContent"],en=["textContent"],tn={class:"wl-comment-actions"},ln=["title"],an=["title"],nn={class:"wl-meta","aria-hidden":"true"},on=["data-value","textContent"],rn={key:0,class:"wl-content"},sn={key:0},cn=["href"],un=["innerHTML"],mn={key:1,class:"wl-admin-actions"},vn={class:"wl-comment-status"},dn=["disabled","onClick","textContent"],pn={key:3,class:"wl-quote"};var gn=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 t=e,l=a,n=["approved","waiting","spam"],r=$e("config"),f=ht(),c=Gt(),C=be(),u=P(()=>r.value.locale),w=P(()=>{const{link:i}=t.comment;return i?st(i)?i:`https://${i}`:""}),U=P(()=>f.value.includes(t.comment.objectId)),g=P(()=>fl(new Date(t.comment.time),c.value,u.value)),S=P(()=>C.value.type==="administrator"),j=P(()=>t.comment.user_id&&C.value.objectId===t.comment.user_id),$=P(()=>{var i;return t.comment.objectId===((i=t.reply)==null?void 0:i.objectId)}),y=P(()=>{var i;return t.comment.objectId===((i=t.edit)==null?void 0:i.objectId)});return(i,h)=>{var F;const q=Wt("CommentCard",!0);return s(),m("div",{id:i.comment.objectId,class:"wl-card-item"},[p("div",Da,[i.comment.avatar?(s(),m("img",{key:0,class:"wl-user-avatar",src:i.comment.avatar,alt:""},null,8,Oa)):I("v-if",!0),i.comment.type?(s(),ne(L(Pl),{key:1})):I("v-if",!0)]),p("div",qa,[p("div",Ga,[w.value?(s(),m("a",{key:0,class:"wl-nick",href:w.value,target:"_blank",rel:"nofollow noopener noreferrer"},M(i.comment.nick),9,Ka)):(s(),m("span",Za,M(i.comment.nick),1)),i.comment.type==="administrator"?(s(),m("span",{key:2,class:"wl-badge",textContent:M(u.value.admin)},null,8,Xa)):I("v-if",!0),i.comment.label?(s(),m("span",{key:3,class:"wl-badge",textContent:M(i.comment.label)},null,8,Ja)):I("v-if",!0),i.comment.sticky?(s(),m("span",{key:4,class:"wl-badge",textContent:M(u.value.sticky)},null,8,Ya)):I("v-if",!0),typeof i.comment.level=="number"?(s(),m("span",{key:5,class:D(`wl-badge level${i.comment.level}`),textContent:M(u.value[`level${i.comment.level}`]||`Level ${i.comment.level}`)},null,10,Qa)):I("v-if",!0),p("span",{class:"wl-time",textContent:M(g.value)},null,8,en),p("div",tn,[S.value||j.value?(s(),m(W,{key:0},[p("button",{type:"button",class:"wl-edit",onClick:h[0]||(h[0]=A=>l("edit",i.comment))},[O(L(Nl))]),p("button",{type:"button",class:"wl-delete",onClick:h[1]||(h[1]=A=>l("delete",i.comment))},[O(L(Ul))])],64)):I("v-if",!0),p("button",{type:"button",class:"wl-like",title:U.value?u.value.cancelLike:u.value.like,onClick:h[2]||(h[2]=A=>l("like",i.comment))},[O(L(Vl),{active:U.value},null,8,["active"]),ie(" "+M("like"in i.comment?i.comment.like:""),1)],8,ln),p("button",{type:"button",class:D(["wl-reply",{active:$.value}]),title:$.value?u.value.cancelReply:u.value.reply,onClick:h[3]||(h[3]=A=>l("reply",$.value?null:i.comment))},[O(L(Fl))],10,an)])]),p("div",nn,[(s(),m(W,null,J(["addr","browser","os"],A=>(s(),m(W,null,[i.comment[A]?(s(),m("span",{key:A,class:D(`wl-${A}`),"data-value":i.comment[A],textContent:M(i.comment[A])},null,10,on)):I("v-if",!0)],64))),64))]),y.value?I("v-if",!0):(s(),m("div",rn,[i.comment.reply_user?(s(),m("p",sn,[p("a",{href:"#"+i.comment.pid},"@"+M(i.comment.reply_user.nick),9,cn),h[17]||(h[17]=p("span",null,": ",-1))])):I("v-if",!0),p("div",{innerHTML:i.comment.comment},null,8,un)])),S.value&&!y.value?(s(),m("div",mn,[p("span",vn,[(s(),m(W,null,J(n,A=>p("button",{key:A,type:"submit",class:D(`wl-btn wl-${A}`),disabled:i.comment.status===A,onClick:_=>l("status",{status:A,comment:i.comment}),textContent:M(u.value[A])},null,10,dn)),64))]),S.value&&!("rid"in i.comment)?(s(),m("button",{key:0,type:"submit",class:"wl-btn wl-sticky",onClick:h[4]||(h[4]=A=>l("sticky",i.comment))},M(i.comment.sticky?u.value.unsticky:u.value.sticky),1)):I("v-if",!0)])):I("v-if",!0),$.value||y.value?(s(),m("div",{key:2,class:D({"wl-reply-wrapper":$.value,"wl-edit-wrapper":y.value})},[O(kt,{edit:i.edit,"reply-id":(F=i.reply)==null?void 0:F.objectId,"reply-user":i.comment.nick,"root-id":i.rootId,onLog:h[5]||(h[5]=A=>l("log")),onCancelReply:h[6]||(h[6]=A=>l("reply",null)),onCancelEdit:h[7]||(h[7]=A=>l("edit",null)),onSubmit:h[8]||(h[8]=A=>l("submit",A))},null,8,["edit","reply-id","reply-user","root-id"])],2)):I("v-if",!0),"children"in i.comment?(s(),m("div",pn,[(s(!0),m(W,null,J(i.comment.children,A=>(s(),ne(q,{key:A.objectId,comment:A,reply:i.reply,edit:i.edit,"root-id":i.rootId,onLog:h[9]||(h[9]=_=>l("log")),onDelete:h[10]||(h[10]=_=>l("delete",_)),onEdit:h[11]||(h[11]=_=>l("edit",_)),onLike:h[12]||(h[12]=_=>l("like",_)),onReply:h[13]||(h[13]=_=>l("reply",_)),onStatus:h[14]||(h[14]=_=>l("status",_)),onSticky:h[15]||(h[15]=_=>l("sticky",_)),onSubmit:h[16]||(h[16]=_=>l("submit",_))},null,8,["comment","reply","edit","root-id"]))),128))])):I("v-if",!0)])],8,Ba)}}});const bt="3.4.0",hn={"data-waline":""},fn={class:"wl-meta-head"},wn={class:"wl-count"},yn=["textContent"],kn={class:"wl-sort"},bn=["onClick"],Cn={class:"wl-cards"},$n={key:1,class:"wl-operation"},Ln=["textContent"],En={key:2,class:"wl-loading"},In=["textContent"],An={key:4,class:"wl-operation"},Rn=["textContent"],xn={key:5,class:"wl-power"};var Mn=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,t={latest:"insertedAt_desc",oldest:"insertedAt_asc",hottest:"like_desc"},l=Object.keys(t),n=be(),r=ht(),f=E("loading"),c=E(0),C=E(1),u=E(0),w=P(()=>pl(a)),U=E(w.value.commentSorting),g=E([]),S=E(null),j=E(null),$=P(()=>gl(w.value.dark)),y=P(()=>w.value.locale);Kt($,{id:"waline-darkmode"});let i;const h=d=>{var R;const{serverURL:z,path:G,pageSize:K}=w.value,Z=new AbortController;f.value="loading",i==null||i(),Ut({serverURL:z,lang:w.value.lang,path:G,pageSize:K,sortBy:t[U.value],page:d,signal:Z.signal,token:(R=n.value)==null?void 0:R.token}).then(X=>{f.value="success",c.value=X.count,g.value.push(...X.data),C.value=d,u.value=X.totalPages}).catch(X=>{X.name!=="AbortError"&&(console.error(X.message),f.value="error")}),i=Z.abort.bind(Z)},F=()=>h(C.value+1),q=()=>{c.value=0,g.value=[],h(1)},A=d=>{U.value!==d&&(U.value=d,q())},_=d=>{S.value=d},H=d=>{j.value=d},te=d=>{if(j.value)j.value.comment=d.comment,j.value.orig=d.orig;else if("rid"in d){const R=g.value.find(({objectId:z})=>z===d.rid);if(!R)return;Array.isArray(R.children)||(R.children=[]),R.children.push(d)}else g.value.unshift(d),c.value+=1},le=async({comment:d,status:R})=>{var z;if(d.status===R)return;const{serverURL:G,lang:K}=w.value;await he({serverURL:G,lang:K,token:(z=n.value)==null?void 0:z.token,objectId:d.objectId,comment:{status:R}}),d.status=R},ve=async d=>{var R;if("rid"in d)return;const{serverURL:z,lang:G}=w.value;await he({serverURL:z,lang:G,token:(R=n.value)==null?void 0:R.token,objectId:d.objectId,comment:{sticky:d.sticky?0:1}}),d.sticky=!d.sticky},Y=async({objectId:d})=>{var R;if(!confirm("Are you sure you want to delete this comment?"))return;const{serverURL:z,lang:G}=w.value;await jt({serverURL:z,lang:G,token:(R=n.value)==null?void 0:R.token,objectId:d}),g.value.some((K,Z)=>K.objectId===d?(g.value=g.value.filter((X,ce)=>ce!==Z),!0):K.children.some((X,ce)=>X.objectId===d?(g.value[Z].children=K.children.filter((Se,de)=>de!==ce),!0):!1))},se=async d=>{var R;const{serverURL:z,lang:G}=w.value,{objectId:K}=d,Z=r.value.includes(K);await he({serverURL:z,lang:G,objectId:K,token:(R=n.value)==null?void 0:R.token,comment:{like:!Z}}),Z?r.value=r.value.filter(X=>X!==K):(r.value=[...r.value,K],r.value.length>50&&(r.value=r.value.slice(-50))),d.like=(d.like||0)+(Z?-1:1)};return Bt("config",w),fe(()=>{ae(()=>[a.serverURL,a.path],()=>q(),{immediate:!0})}),Ne(()=>i==null?void 0:i()),(d,R)=>(s(),m("div",hn,[O(ia),!S.value&&!j.value?(s(),ne(kt,{key:0,onLog:q,onSubmit:te})):I("v-if",!0),p("div",fn,[p("div",wn,[c.value?(s(),m("span",{key:0,class:"wl-num",textContent:M(c.value)},null,8,yn)):I("v-if",!0),ie(" "+M(y.value.comment),1)]),p("ul",kn,[(s(!0),m(W,null,J(L(l),z=>(s(),m("li",{key:z,class:D([z===U.value?"active":""]),onClick:G=>A(z)},M(y.value[z]),11,bn))),128))])]),p("div",Cn,[(s(!0),m(W,null,J(g.value,z=>(s(),ne(gn,{key:z.objectId,"root-id":z.objectId,comment:z,reply:S.value,edit:j.value,onLog:q,onReply:_,onEdit:H,onSubmit:te,onStatus:le,onDelete:Y,onSticky:ve,onLike:se},null,8,["root-id","comment","reply","edit"]))),128))]),f.value==="error"?(s(),m("div",$n,[p("button",{type:"button",class:"wl-btn",onClick:q,textContent:M(y.value.refresh)},null,8,Ln)])):f.value==="loading"?(s(),m("div",En,[O(L(me),{size:30})])):g.value.length?C.value<u.value?(s(),m("div",An,[p("button",{type:"button",class:"wl-btn",onClick:F,textContent:M(y.value.more)},null,8,Rn)])):I("v-if",!0):(s(),m("div",{key:3,class:"wl-empty",textContent:M(y.value.sofa)},null,8,In)),w.value.copyright?(s(),m("div",xn,[R[0]||(R[0]=ie(" Powered by ")),R[1]||(R[1]=p("a",{href:"https://github.com/walinejs/waline",target:"_blank",rel:"noopener noreferrer"}," Waline ",-1)),ie(" v"+M(L(bt)),1)])):I("v-if",!0)]))}});const Ct=(e,a)=>{a.forEach((t,l)=>{const n=e[l].time;typeof n=="number"&&(t.innerText=n.toString())})},$t=({serverURL:e,path:a=window.location.pathname,selector:t=".waline-pageview-count",update:l=!0,lang:n=navigator.language})=>{const r=new AbortController,f=Array.from(document.querySelectorAll(t)),c=u=>{const w=Me(u);return w!==null&&a!==w},C=u=>_t({serverURL:ke(e),paths:u.map(w=>Me(w)??a),lang:n,signal:r.signal}).then(w=>Ct(w,u)).catch(ut);if(l){const u=f.filter(U=>!c(U)),w=f.filter(c);zt({serverURL:ke(e),path:a,lang:n}).then(U=>Ct(U,u)),w.length&&C(w)}else C(f);return r.abort.bind(r)},Sn=({el:e="#waline",path:a=window.location.pathname,comment:t=!1,pageview:l=!1,...n})=>{const r=e?xe(e):null;if(e&&!r)throw new Error("Option 'el' do not match any domElement!");if(!n.serverURL)throw new Error("Option 'serverURL' is missing!");const f=Le({...n}),c=Le({comment:t,pageview:l,path:a}),C=()=>{c.comment&&dt({serverURL:f.serverURL,path:c.path,...re(c.comment)?{selector:c.comment}:{}})},u=()=>{c.pageview&&$t({serverURL:f.serverURL,path:c.path,...re(c.pageview)?{selector:c.pageview}:{}})},w=r?Dt(()=>x(Mn,{path:c.path,...f})):null;w&&w.mount(r);const U=De(C),g=De(u);return{el:r,update:({comment:S,pageview:j,path:$=window.location.pathname,...y}={})=>{Object.entries(y).forEach(([i,h])=>{f[i]=h}),c.path=$,S!==void 0&&(c.comment=S),j!==void 0&&(c.pageview=j)},destroy:()=>{w==null||w.unmount(),U(),g()}}},jn=({el:e,serverURL:a,count:t,lang:l=navigator.language})=>{var n;const r=be(),f=xe(e),c=new AbortController;return Vt({serverURL:a,count:t,lang:l,signal:c.signal,token:(n=r.value)==null?void 0:n.token}).then(C=>f&&C.length?(f.innerHTML=`<ul class="wl-recent-list">${C.map(u=>`<li class="wl-recent-item"><a href="${u.url}">${u.nick}</a>:${u.comment}</li>`).join("")}</ul>`,{comments:C,destroy:()=>{c.abort(),f.innerHTML=""}}):{comments:C,destroy:()=>c.abort()})},Un=({el:e,serverURL:a,count:t,locale:l,lang:n=navigator.language,mode:r="list"})=>{const f=xe(e),c=new AbortController;return Ht({serverURL:a,pageSize:t,lang:n,signal:c.signal}).then(C=>!f||!C.length?{users:C,destroy:()=>c.abort()}:(l={...nt(n),...typeof l=="object"?l:{}},f.innerHTML=`<ul class="wl-user-${r}">${C.map((u,w)=>[`<li class="wl-user-item" aria-label="${u.nick}">`,u.link&&`<a href="${u.link}" target="_blank">`,'<div class="wl-user-avatar">',`<img src="${u.avatar}" alt="${u.nick}">`,`<span class="wl-user-badge">${w+1}</span>`,"</div>",'<div class="wl-user-meta">','<div class="wl-user-name">',u.nick,u.level&&`<span class="wl-badge">${l?l[`level${u.level}`]:`Level ${u.level}`}</span>`,u.label&&`<span class="wl-badge">${u.label}</span>`,"</div>",u.link&&u.link,"</div>",u.link&&"</a>","</li>"].filter(U=>U).join("")).join("")}</ul>`,{users:C,destroy:()=>{c.abort(),f.innerHTML=""}}))};export{jn as RecentComments,Un as UserList,dt as commentCount,ye as defaultLocales,Sn as init,$t as pageviewCount,bt as version};
|
|
12
12
|
//# sourceMappingURL=slim.js.map
|