@waline/client 3.12.0 → 3.12.1
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 +3 -3
- 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 +11 -11
- package/dist/waline.js.map +1 -1
- package/dist/waline.umd.js +1 -1
- package/dist/waline.umd.js.map +1 -1
- package/package.json +1 -1
package/dist/pageview.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
const y="3.12.
|
|
1
|
+
const y="3.12.1",$={"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),R=({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),U=({serverURL:e,lang:t,paths:r,signal:o})=>f({serverURL:e,lang:t,paths:r,type:["time"],signal:o}),w=e=>R({...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},v=(e,t)=>{t.forEach((r,o)=>{const a=e[o].time;typeof a=="number"&&(r.textContent=a.toString())})},C=({serverURL:e,path:t=window.location.pathname,selector:r=".waline-pageview-count",update:o=!0,lang:a=navigator.language})=>{const n=new AbortController,i=[...document.querySelectorAll(r)],p=l=>{const s=m(l);return s!=null&&t!==s},g=l=>U({serverURL:d(e),paths:l.map(s=>m(s)??t),lang:a,signal:n.signal}).then(s=>{v(s,l)}).catch(j);if(o){const l=i.filter(c=>!p(c)),s=i.filter(c=>p(c));w({serverURL:d(e),path:t,lang:a}).then(c=>{v(c,l)}),s.length>0&&g(s)}else g(i);return n.abort.bind(n)};export{C as pageviewCount,y as version};
|
|
2
2
|
//# sourceMappingURL=pageview.js.map
|
package/dist/slim.js
CHANGED
|
@@ -10,5 +10,5 @@ import{fetchCommentCount as Tt,getArticleCounter as Be,updateArticleCounter as f
|
|
|
10
10
|
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?","Bình luận của bạn đang được xem xét và hiện chỉ hiển thị với bạn. Nó sẽ được công khai sau khi được phê duyệt.","Đăng ký nhận xét của bài viết này","Đăng ký nhận xét của trang web này","Đăng ký nhận xét của bạn"]),it=Y(["昵称","昵称不能少于3个字符","邮箱","请填写正确的邮件地址","网址","可选","欢迎评论","来发评论吧~","提交","喜欢","取消喜欢","回复","取消回复","评论","刷新","加载更多...","预览","表情","上传图片","秒前","分钟前","小时前","天前","刚刚","正在上传","登录","退出","博主","置顶","字",`评论字数应在 $0 到 $1 字之间!
|
|
11
11
|
当前字数:$2`,"匿名","潜水","冒泡","吐槽","活跃","话痨","传说","表情包","搜索表情包","个人资料","通过","待审核","垃圾","取消置顶","按倒序","按正序","按热度","你认为这篇文章怎么样?","评论正在审核中,当前仅自己可见,审核通过后公开可见。","订阅本文评论","订阅本站评论","订阅你的评论回复"]),ba=Y(["暱稱","暱稱不能少於3個字元","郵箱","請填寫正確的郵件地址","網址","可選","歡迎留言","來發留言吧~","送出","喜歡","取消喜歡","回覆","取消回覆","留言","重整","載入更多...","預覽","表情","上傳圖片","秒前","分鐘前","小時前","天前","剛剛","正在上傳","登入","登出","管理者","置頂","字",`留言字數應在 $0 到 $1 字之間!
|
|
12
12
|
目前字數:$2`,"匿名","潛水","冒泡","吐槽","活躍","多話","傳說","表情包","搜尋表情包","個人資料","通過","待審核","垃圾","取消置頂","最早","最新","熱門","你認為這篇文章怎麼樣?","您的評論正在審核中,目前僅您可見。審核通過後將公開顯示。","訂閱此文章的評論","訂閱本站的評論","訂閱您的評論回覆"]);const st="en-US",ke={zh:it,"zh-cn":it,"zh-tw":ba,en:Qe,"en-us":Qe,fr:tt,"fr-fr":tt,it:at,"it-it":at,jp:nt,"jp-jp":nt,ko:lt,"ko-kr":lt,"pt-br":ya,ru:rt,"ru-ru":rt,vi:ot,"vi-vn":ot,de:wa,es:et,"es-mx":et},ct=e=>ke[e.toLowerCase()]??ke[st.toLowerCase()],ut=e=>Object.keys(ke).includes(e.toLowerCase())?e:st,mt={latest:"insertedAt_desc",oldest:"insertedAt_asc",hottest:"like_desc"},ka=Object.keys(mt),Ce=Symbol("waline-config"),vt=e=>{try{return decodeURI(e)}catch{return e}},dt=(e="")=>e.replace(/\/$/u,""),pt=e=>/^(https?:)?\/\//.test(e),$e=e=>{const a=dt(e);return pt(a)?a:`https://${a}`},Ca=e=>Array.isArray(e)?e:typeof e=="number"?[0,e]:!1,de=(e,a)=>e==null||e===!0?a:e===!1?null:e,$a=({serverURL:e,path:a=location.pathname,lang:t=typeof navigator>"u"?"en-US":navigator.language,locale:l,meta:n=["nick","mail","link"],requiredMeta:o=[],dark:d=!1,pageSize:r=10,wordLimit:u,noCopyright:L=!1,login:c="enable",recaptchaV3Key:h="",turnstileKey:R="",commentSorting:_="latest",emoji:f=Ye,imageUploader:A,highlighter:S,texRenderer:v,search:z,reaction:H,...E})=>({serverURL:$e(e),path:vt(a),lang:ut(t),locale:{...ct(ut(t)),...typeof l=="object"?l:{}},wordLimit:Ca(u),meta:Xe(n),requiredMeta:Xe(o),dark:d,pageSize:r,commentSorting:_,login:c,noCopyright:L,recaptchaV3Key:h,turnstileKey:R,...E,reaction:H===!0?ia:H||null,imageUploader:de(A,sa),highlighter:de(S,ha),texRenderer:de(v,ca),emoji:de(f,Ye),search:de(z,ua(t))}),ue=e=>typeof e=="string",Ue="{--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}",La=e=>ue(e)?e==="auto"?`@media(prefers-color-scheme:dark){body${Ue}}`:`${e}${Ue}`:e===!0?`:root${Ue}`:"",_e=(e,a)=>{let t=e.toString();for(;t.length<a;)t=`0${t}`;return t},Sa=e=>{const a=_e(e.getDate(),2),t=_e(e.getMonth()+1,2);return`${_e(e.getFullYear(),2)}-${t}-${a}`},Ia=(e,a,t)=>{if(!e)return"";const l=ue(e)?new Date(e.includes(" ")?e.replaceAll("-","/"):e):e,n=a.getTime()-l.getTime(),o=Math.floor(n/(24*3600*1e3));if(o===0){const d=n%864e5,r=Math.floor(d/(3600*1e3));if(r===0){const u=d%36e5,L=Math.floor(u/(60*1e3));if(L===0){const c=u%6e4;return`${Math.round(c/1e3)} ${t.seconds}`}return`${L} ${t.minutes}`}return`${r} ${t.hours}`}return o<0?t.now:o<8?`${o} ${t.days}`:Sa(l)},Ea=/^[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])?)*$/,Aa=e=>Ea.test(e),Ma="WALINE_EMOJI",gt=se(Ma,{}),Ra=e=>/@[0-9]+\.[0-9]+\.[0-9]+/.test(e),xa=e=>{const a=Ra(e);if(a){const t=gt.value[e];if(t)return Promise.resolve(t)}return fetch(`${e}/info.json`).then(t=>t.json()).then(t=>{const l={folder:e,...t};return a&&(gt.value[e]=l),l})},ht=(e,a="",t="",l="")=>`${a?`${a}/`:""}${t}${e}${l?`.${l}`:""}`,za=e=>Promise.all(e?e.map(a=>ue(a)?xa(dt(a)):Promise.resolve(a)):[]).then(a=>{const t={tabs:[],map:{}};return a.forEach(l=>{const{name:n,folder:o,icon:d,prefix:r="",type:u,items:L}=l;t.tabs.push({name:n,icon:ht(d,o,r,u),items:L.map(c=>{const h=`${r}${c}`;return t.map[h]=ht(c,o,r,u),h})})}),t}),ft=e=>{e.name!=="AbortError"&&console.error(e.message)},Le=e=>e instanceof HTMLElement?e:ue(e)?document.querySelector(e):null,wt=e=>{const a=[...e].find(t=>t.type.includes("image"));return a?a.getAsFile():null},Ua=/\$.*?\$/,_a=/^\$(.*?)\$/,ja=/^(?:\s{0,3})\$\$((?:[^\n]|\n[^\n])+?)\n{0,1}\$\$/,Va=e=>[{name:"blockMath",level:"block",tokenizer(a){const t=ja.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(Ua);return t===-1?a.length:t},tokenizer(a){const t=_a.exec(a);if(t!=null)return{type:"html",raw:t[0],text:e(!1,t[1])}}}],yt=(e="",a={})=>e.replaceAll(/:(.+?):/g,(t,l)=>a[l]?`<img class="wl-emoji" src="${a[l]}" alt="${l}">`:t),Ha=(e,{emojiMap:a,highlighter:t,texRenderer:l})=>{const n=new na;if(n.setOptions({breaks:!0}),t&&n.use(la({highlight:t})),l){const o=Va(l);n.use({extensions:o})}return n.parse(yt(e,a))},je=e=>{const{path:a}=e.dataset;return a!=null&&a.length?a:null},Fa=e=>e.match(/[\w\d\s,.\u00C0-\u024F\u0400-\u04FF]+/giu),Ta=e=>e.match(/[\u4E00-\u9FD5]/gu),Na=e=>{var a,t;return(((a=Fa(e))==null?void 0:a.reduce((l,n)=>l+(["",",","."].includes(n.trim())?0:n.trim().split(/\s+/u).length),0))??0)+(((t=Ta(e))==null?void 0:t.length)??0)},Ba=async()=>{const{userAgentData:e}=navigator;let a=navigator.userAgent;if((e==null?void 0:e.platform)!=="Windows")return a;const{platformVersion:t}=await e.getHighEntropyValues(["platformVersion"]);return t&&Number.parseInt(t.split(".")[0],10)>=13&&(a=a.replace("Windows NT 10.0","Windows NT 11.0")),a},bt=({serverURL:e,path:a=window.location.pathname,selector:t=".waline-comment-count",lang:l=navigator.language})=>{const n=new AbortController,o=document.querySelectorAll(t);return o.length>0&&Tt({serverURL:$e(e),paths:Array.from(o,d=>vt(je(d)??a)),lang:l,signal:n.signal}).then(d=>{o.forEach((r,u)=>{r.textContent=d[u].toString()})}).catch(ft),n.abort.bind(n)},kt=({size:e})=>k("svg",{class:"wl-close-icon",viewBox:"0 0 1024 1024",width:e,height:e},[k("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"}),k("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"})]),Pa=()=>k("svg",{viewBox:"0 0 1024 1024",width:"24",height:"24"},k("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"})),Wa=()=>k("svg",{viewBox:"0 0 1024 1024",width:"24",height:"24"},k("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"})),Da=()=>k("svg",{viewBox:"0 0 1024 1024",width:"24",height:"24"},[k("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"}),k("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"})]),qa=({active:e=!1})=>k("svg",{viewBox:"0 0 1024 1024",width:"24",height:"24"},[k("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"})]),Ga=()=>k("svg",{viewBox:"0 0 1024 1024",width:"24",height:"24"},[k("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"}),k("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"})]),Oa=()=>k("svg",{width:"16",height:"16",ariaHidden:"true"},k("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"})),Ka=()=>k("svg",{viewBox:"0 0 1024 1024",width:"24",height:"24"},k("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"})),Za=()=>k("svg",{viewBox:"0 0 1024 1024",width:"24",height:"24"},k("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"})),Xa=()=>k("svg",{class:"verified-icon",viewBox:"0 0 1024 1024",width:"14",height:"14"},k("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"})),Ya=()=>k("svg",{class:"administrator-icon",viewBox:"0 0 1024 1024",width:"14",height:"14"},[k("path",{d:"M461.6 129.56C489.6 105.96 534.8 105.96 562.4 129.56L625.6 183.96C637.6 194.36 660.4 202.76 676 202.76H744C786.4 202.76 821.2 237.56 821.2 279.96V347.96C821.2 363.96 829.6 386.36 840 398.36L894.4 461.56C918 489.16 918 534.76 894.8 562.36L840.4 625.56C830 637.56 821.6 660.36 821.6 675.96V743.96C821.6 786.36 786.8 821.16 744.4 821.16H676.4C660.4 821.16 638 829.56 626 839.96L562.8 894.36C534.8 917.96 489.6 917.96 462 894.36L398.8 839.96C386.8 829.56 364 821.16 348.4 821.16H279.2C236.8 821.16 202 786.36 202 743.96V675.56C201.999 659.96 193.6 637.56 183.6 625.56L129.6 561.96C106.4 534.36 106.4 489.56 129.6 461.96L183.6 398.36C193.6 386.359 202 363.959 202 348.36V279.96C202 237.56 236.8 202.76 279.2 202.76H348.4C364 202.76 386.8 194.36 398.8 184.36L461.6 129.56ZM549.567 331.896C530.047 303.082 486.645 306.12 471.433 337.412L442.175 396.526C435.587 409.848 422.856 419.097 408.146 421.226L342.706 430.726C340.776 431 338.884 431.397 336.993 431.946C303.482 441.361 292.756 483.493 317.671 507.812L364.975 553.96C375.623 564.321 380.507 579.299 377.991 593.954L366.917 659.102C366.595 661.03 366.355 662.967 366.279 664.923C364.906 699.688 401.683 722.937 432.514 706.738L491.05 675.966C504.217 669.068 519.954 669.069 533.121 675.966L591.675 706.738C593.406 707.645 595.174 708.432 597.028 709.104C629.666 721.205 663.139 693.382 657.273 659.102L646.069 593.954C643.42 579.176 648.24 564.083 659.001 553.6L706.315 507.461C707.687 506.118 708.994 504.66 710.215 503.127C731.779 475.809 715.737 435.41 681.281 430.365L615.839 420.874C601.13 418.745 588.4 409.486 581.821 396.174L552.562 337.052C551.644 335.284 550.674 333.551 549.567 331.896Z",fill:"#f59831"})]),pe=({size:e=100})=>k("svg",{width:e,height:e,viewBox:"0 0 100 100",preserveAspectRatio:"xMidYMid"},k("circle",{cx:50,cy:50,fill:"none",stroke:"currentColor",strokeWidth:"4",r:"40","stroke-dasharray":"85 30"},k("animateTransform",{attributeName:"transform",type:"rotate",repeatCount:"indefinite",dur:"1s",values:"0 50 50;360 50 50",keyTimes:"0;1"}))),Ja=()=>k("svg",{width:24,height:24,fill:"currentcolor",viewBox:"0 0 24 24"},[k("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"}),k("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"})]),Ct=()=>k("svg",{width:"16",height:"16",viewBox:"0 0 24 24"},k("g",{transform:"translate(0 -1028.4)"},k("g",{},[k("path",{d:"m4 1031.4c-1.1046 0-2 0.9-2 2v16c0 1.1 0.8954 2 2 2h16c1.105 0 2-0.9 2-2v-16c0-1.1-0.895-2-2-2h-16z",fill:"#d35400"}),k("path",{d:"m4 2c-1.1046 0-2 0.8954-2 2v16c0 1.105 0.8954 2 2 2h16c1.105 0 2-0.895 2-2v-16c0-1.1046-0.895-2-2-2h-16z",transform:"translate(0 1028.4)",fill:"#e67e22"}),k("path",{d:"m5 1034.4v2.3c6.443 0 11.667 5.2 11.667 11.7h2.333c0-7.8-6.268-14-14-14zm0 4.6v2.4c3.866 0 7 3.1 7 7h2.333c0-5.2-4.178-9.4-9.333-9.4zm2.0417 5.3c-1.1276 0-2.0417 0.9-2.0417 2s0.9141 2.1 2.0417 2.1c1.1275 0 2.0416-1 2.0416-2.1s-0.9141-2-2.0416-2z",fill:"#d35400"}),k("path",{d:"m5 1033.4v2.3c6.443 0 11.667 5.2 11.667 11.7h2.333c0-7.8-6.268-14-14-14zm0 4.6v2.4c3.866 0 7 3.1 7 7h2.333c0-5.2-4.178-9.4-9.333-9.4zm2.0417 5.3c-1.1276 0-2.0417 0.9-2.0417 2s0.9141 2.1 2.0417 2.1c1.1275 0 2.0416-1 2.0416-2.1s-0.9141-2-2.0416-2z",fill:"#ecf0f1"})]))),Qa=()=>k("svg",{fill:"currentColor",width:"24",height:"24",viewBox:"-3 0 19 19",class:"cf-icon-svg"},k("path",{d:"M.926 12.818a1.403 1.403 0 1 1 0 1.984 1.402 1.402 0 0 1 0-1.984zm10.531 2.357a1.03 1.03 0 0 1-1.029-1.03 8.775 8.775 0 0 0-.694-3.438A8.826 8.826 0 0 0 1.591 5.31a1.03 1.03 0 1 1 0-2.059 10.817 10.817 0 0 1 4.24.857 10.893 10.893 0 0 1 3.463 2.334 10.867 10.867 0 0 1 3.19 7.703 1.027 1.027 0 0 1-1.027 1.029zm-4.538 0a1.03 1.03 0 0 1-1.029-1.03 4.297 4.297 0 0 0-4.299-4.298 1.03 1.03 0 0 1 0-2.059 6.362 6.362 0 0 1 5.857 3.883 6.298 6.298 0 0 1 .5 2.475 1.03 1.03 0 0 1-1.029 1.029z"})),en=()=>se("WALINE_USER_META",{nick:"",mail:"",link:""}),tn=()=>se("WALINE_COMMENT_BOX_EDITOR",""),an="WALINE_LIKE",nn=se(an,[]),$t=()=>nn,ln="WALINE_REACTION",rn=se(ln,{}),Lt=()=>rn,St={},on=e=>{const a=St[e]??(St[e]=ra(e,{useRecaptchaNet:!0,autoHideBadge:!0}));return{execute:t=>a.then(l=>l.execute(t))}},sn=e=>({execute:async a=>{const{load:t}=Qt("https://challenges.cloudflare.com/turnstile/v0/api.js",void 0,{async:!1});await t();const{turnstile:l}=window;return new Promise(n=>{l==null||l.ready(()=>{l.render(".wl-captcha-container",{sitekey:e,action:a,size:"compact",callback:n})})})}}),cn="WALINE_USER",un=se(cn,{}),Se=()=>un,mn={key:0,class:"wl-reaction"},vn=["textContent"],dn={class:"wl-reaction-list"},pn=["onClick"],gn={class:"wl-reaction-img"},hn=["src","alt"],fn=["textContent"],wn=["textContent"];var yn=ne({__name:"ArticleReaction",setup(e){const a=Lt(),t=Me(Ce),l=x(-1),n=x([]),o=N(()=>t.value.locale),d=N(()=>{const{reaction:h}=t.value;return h!=null&&h.length?h:null}),r=N(()=>{var h;const{path:R}=t.value;return((h=d.value)==null?void 0:h.map((_,f)=>({icon:_,desc:o.value[`reaction${f}`],active:a.value[R]===f})))??null});let u;const L=async()=>{const{serverURL:h,lang:R,path:_}=t.value;if(!d.value)return;const f=new AbortController;u=f.abort.bind(f);const[A]=await Be({serverURL:h,lang:R,paths:[_],type:d.value.map((S,v)=>`reaction${v}`),signal:f.signal});n.value=d.value.map((S,v)=>A[`reaction${v}`])},c=async h=>{if(l.value!==-1)return;const{serverURL:R,lang:_,path:f}=t.value,A=a.value[f];l.value=h,A!=null&&(await fe({serverURL:R,lang:_,path:f,type:`reaction${A}`,action:"desc"}),n.value[A]=Math.max(n.value[A]-1,0)),A!==h&&(await fe({serverURL:R,lang:_,path:f,type:`reaction${h}`}),n.value[h]=(n.value[h]||0)+1),A===h?delete a.value[f]:a.value[f]=h,l.value=-1};return ve(()=>{ce(()=>[t.value.serverURL,t.value.path],()=>L())}),Pe(()=>{u==null||u()}),(h,R)=>r.value?(i(),p("div",mn,[m("div",{class:"wl-reaction-title",textContent:M(o.value.reactionTitle)},null,8,vn),m("ul",dn,[(i(!0),p(G,null,K(r.value,({active:_,icon:f,desc:A},S)=>(i(),p("li",{key:S,class:O(["wl-reaction-item",{active:_}]),onClick:v=>c(S)},[m("div",gn,[m("img",{src:f,alt:A},null,8,hn),l.value===S?(i(),Q(b(pe),{key:0,class:"wl-reaction-loading"})):(i(),p("div",{key:1,class:"wl-reaction-votes",textContent:M(n.value[S]||0)},null,8,fn))]),m("div",{class:"wl-reaction-text",textContent:M(A)},null,8,wn)],10,pn))),128))])])):I("v-if",!0)}});const bn=["data-index"],kn=["src","title","onClick"];var Cn=ne({__name:"ImageWall",props:{items:{default:()=>[]},columnWidth:{default:300},gap:{default:0}},emits:["insert"],setup(e){let a=null;const t=ee("wall"),l=x({}),n=x([]),o=()=>{const c=Math.floor((t.value.getBoundingClientRect().width+e.gap)/(e.columnWidth+e.gap));return c>0?c:1},d=c=>Array.from({length:c},()=>[]),r=async c=>{var h;if(c>=e.items.length)return;await We();const R=[...((h=t.value)==null?void 0:h.children)??[]].reduce((_,f)=>f.getBoundingClientRect().height<_.getBoundingClientRect().height?f:_);n.value[Number(R.dataset.index)].push(c),await r(c+1)},u=async(c=!1)=>{if(n.value.length===o()&&!c)return;n.value=d(o());const{scrollY:h}=window;await r(0),window.scrollTo({top:h})},L=c=>{l.value[c.target.src]=!0};return ve(()=>{u(!0),a=new ResizeObserver(()=>{u()}),a.observe(t.value),Re(()=>[e.items],()=>{l.value={},u(!0)}),Re(()=>[e.columnWidth,e.gap],()=>{u()})}),Kt(()=>{a.unobserve(t.value)}),(c,h)=>(i(),p("div",{ref_key:"wall",ref:t,class:"wl-gallery",style:ye({gap:`${e.gap}px`})},[(i(!0),p(G,null,K(n.value,(R,_)=>(i(),p("div",{key:_,class:"wl-gallery-column","data-index":_,style:ye({gap:`${e.gap}px`})},[(i(!0),p(G,null,K(R,f=>(i(),p(G,{key:f},[l.value[e.items[f].src]?I("v-if",!0):(i(),Q(b(pe),{key:0,size:36,style:{margin:"20px auto"}})),m("img",{class:"wl-gallery-item",src:e.items[f].src,title:e.items[f].title,loading:"lazy",onLoad:L,onClick:A=>c.$emit("insert",``)},null,40,kn)],64))),128))],12,bn))),128))],4))}});const $n={key:0,class:"wl-login-info"},Ln={class:"wl-avatar"},Sn=["title"],In=["title"],En=["src"],An=["title","textContent"],Mn={class:"wl-panel"},Rn=["for","textContent"],xn=["id","onUpdate:modelValue","name","type"],zn=["placeholder"],Un={class:"wl-preview"},_n=["innerHTML"],jn={class:"wl-footer"},Vn={class:"wl-actions"},Hn={href:"https://guides.github.com/features/mastering-markdown/",title:"Markdown Guide","aria-label":"Markdown is supported",class:"wl-action",target:"_blank",rel:"noopener noreferrer"},Fn=["title"],Tn=["title"],Nn=["title","aria-label"],Bn=["title"],Pn={class:"wl-info"},Wn={class:"wl-text-number"},Dn={key:0},qn=["textContent"],Gn=["textContent"],On=["disabled"],Kn=["placeholder"],Zn={key:1,class:"wl-loading"},Xn=["title","onClick","onMouseenter"],Yn=["src","alt"],Jn=["src"],Qn={key:0,class:"wl-tabs"},el=["onClick"],tl=["src","alt","title"],al=["title"];var It=ne({__name:"CommentBox",props:{edit:{},rootId:{},replyId:{},replyUser:{}},emits:["log","cancelEdit","cancelReply","submit"],setup(e,{emit:a}){const t=e,l=a,n=Me(Ce),o=tn(),d=en(),r=Se(),u=x({}),L=ee("textarea"),c=ee("image-uploader"),h=ee("emoji-button"),R=ee("emoji-popup"),_=ee("gif-button"),f=ee("gif-popup"),A=ee("gif-search"),S=x({tabs:[],map:{}}),v=x(0),z=x(!1),H=x(""),E=x({});let U;const le=(g,s)=>{clearTimeout(U),H.value=s;const y=g.currentTarget,V=R.value;if(y&&V){const w=y.getBoundingClientRect(),D=V.getBoundingClientRect();E.value={left:`${w.left-D.left+w.width/2}px`,top:`${w.top-D.top}px`,transform:"translate(-50%, -100%)"}}},re=()=>{U=setTimeout(()=>{H.value=""},50)},J=x(!1),oe=x(!1),me=x(""),C=x(0),$=xe({loading:!0,list:[]}),j=x(0),B=x(!1),Z=x(""),P=x(!1),ae=x(!1),F=N(()=>n.value.locale),ie=N(()=>!!r.value.token),ge=N(()=>n.value.imageUploader!=null),Ie=g=>{const s=L.value,y=s.selectionStart,V=s.selectionEnd||0,{scrollTop:w}=s;o.value=s.value.slice(0,y)+g+s.value.slice(V),s.focus(),s.selectionStart=y+g.length,s.selectionEnd=y+g.length,s.scrollTop=w},zt=({key:g,ctrlKey:s,metaKey:y})=>{P.value||(s||y)&&g==="Enter"&&He()},Ee=async g=>{const s=`![${n.value.locale.uploading} ${g.name}]()`;Ie(s),P.value=!0;try{const y=await n.value.imageUploader(g);o.value=o.value.replace(s,`\r
|
|
13
|
-
`)}catch(y){alert(y.message),o.value=o.value.replace(s,"")}finally{P.value=!1}},Ut=g=>{var s;if((s=g.dataTransfer)!=null&&s.items){const y=wt(g.dataTransfer.items);y&&ge.value&&(Ee(y),g.preventDefault())}},_t=g=>{if(g.clipboardData){const s=wt(g.clipboardData.items);s&&ge.value&&Ee(s)}},jt=()=>{const g=c.value;g.files&&ge.value&&Ee(g.files[0]).then(()=>{g.value=""})},He=async()=>{var g;const{serverURL:s,lang:y,login:V,wordLimit:w,requiredMeta:D,recaptchaV3Key:q,turnstileKey:X}=n.value,T={comment:Z.value,nick:d.value.nick,mail:d.value.mail,link:d.value.link,url:n.value.path,ua:await Ba()};if(!t.edit)if(r.value.token)T.nick=r.value.display_name,T.mail=r.value.email,T.link=r.value.url;else{if(V==="force")return;if(D.includes("nick")&&!T.nick){u.value.nick.focus(),alert(F.value.nickError);return}if(D.includes("mail")&&!T.mail||T.mail&&!Aa(T.mail)){u.value.mail.focus(),alert(F.value.mailError);return}T.nick||(T.nick=F.value.anonymous)}if(!T.comment){L.value.focus();return}if(!B.value){alert(F.value.wordHint.replace("$0",w[0].toString()).replace("$1",w[1].toString()).replace("$2",C.value.toString()));return}T.comment=yt(T.comment,S.value.map),t.replyId&&t.rootId&&(T.pid=t.replyId,T.rid=t.rootId,T.at=t.replyUser),P.value=!0;try{q&&(T.recaptchaV3=await on(q).execute("social")),X&&(T.turnstile=await sn(X).execute("social"));const he={serverURL:s,lang:y,token:r.value.token,comment:T},Ae=await(t.edit?we({objectId:t.edit.objectId,...he}):Nt(he));if(P.value=!1,Ae.errmsg){alert(Ae.errmsg);return}l("submit",Ae.data),o.value="",me.value="",await We(),t.replyId&&l("cancelReply"),(g=t.edit)!=null&&g.objectId&&l("cancelEdit")}catch(he){P.value=!1,alert(he.message)}},Vt=g=>{g.preventDefault();const{lang:s,serverURL:y}=n.value;Bt({serverURL:y,lang:s}).then(V=>{r.value=V,(V.remember?localStorage:sessionStorage).setItem("WALINE_USER",JSON.stringify(V)),l("log")})},Ht=()=>{r.value={},localStorage.setItem("WALINE_USER","null"),sessionStorage.setItem("WALINE_USER","null"),l("log")},Fe=g=>{g.preventDefault();const{lang:s,serverURL:y}=n.value,V=800,w=800,D=(window.innerWidth-V)/2,q=(window.innerHeight-w)/2,X=new URLSearchParams({lng:s,token:r.value.token}),T=window.open(`${y}/ui/profile?${X.toString()}`,"_blank",`width=${V},height=${w},left=${D},top=${q},scrollbars=no,resizable=no,status=no,location=no,toolbar=no,menubar=no`);T==null||T.postMessage({type:"TOKEN",data:r.value.token},"*")},Ft=g=>{var s,y,V,w;!((s=h.value)!=null&&s.contains(g.target))&&!((y=R.value)!=null&&y.contains(g.target))&&(z.value=!1),!((V=_.value)!=null&&V.contains(g.target))&&!((w=f.value)!=null&&w.contains(g.target))&&(J.value=!1)},Te=async g=>{var s;const{scrollTop:y,clientHeight:V,scrollHeight:w}=g.target,D=(V+y)/w,q=n.value.search,X=((s=A.value)==null?void 0:s.value)??"";D<.9||$.loading||ae.value||($.loading=!0,(q.more&&$.list.length>0?await q.more(X,$.list.length):await q.search(X)).length>0?$.list=[...$.list,...q.more&&$.list.length>0?await q.more(X,$.list.length):await q.search(X)]:ae.value=!0,$.loading=!1,setTimeout(()=>{g.target.scrollTop=y},50))},Ne=ea(g=>{$.list=[],ae.value=!1,Te(g)},300);return Ke("click",Ft),Ke("message",({data:g})=>{(g==null?void 0:g.type)==="profile"&&(r.value={...r.value,...g.data},[localStorage,sessionStorage].filter(s=>s.getItem("WALINE_USER")).forEach(s=>{s.setItem("WALINE_USER",JSON.stringify(r))}))}),ce([n,C],([g,s])=>{const{wordLimit:y}=g;y?s<y[0]&&y[0]!==0?([j.value]=y,B.value=!1):s>y[1]?([,j.value]=y,B.value=!1):([,j.value]=y,B.value=!0):(j.value=0,B.value=!0)}),Re(J,async g=>{var s;if(!g)return;const y=n.value.search;A.value&&(A.value.value=""),$.loading=!0,$.list=await(((s=y.default)==null?void 0:s.call(y))??y.search("")),$.loading=!1}),ve(()=>{var g;(g=t.edit)!=null&&g.objectId&&(o.value=t.edit.orig),ce(()=>o.value,s=>{const{highlighter:y,texRenderer:V}=n.value;Z.value=s,me.value=Ha(s,{emojiMap:S.value.map,highlighter:y,texRenderer:V}),C.value=Na(s),s?Ze(L.value):Ze.destroy(L.value)}),ce(()=>n.value.emoji,async s=>{S.value=await za(s)})}),(g,s)=>{var y,V;return i(),p("div",{key:b(r).token,class:"wl-comment"},[b(n).login!=="disable"&&ie.value&&!((y=e.edit)!=null&&y.objectId)?(i(),p("div",$n,[m("div",Ln,[m("button",{type:"submit",class:"wl-logout-btn",title:F.value.logout,onClick:Ht},[W(b(kt),{size:14})],8,Sn),m("a",{href:"#",class:"wl-login-nick","aria-label":"Profile",title:F.value.profile,onClick:Fe},[m("img",{src:b(r).avatar,alt:"avatar"},null,8,En)],8,In)]),m("a",{href:"#",class:"wl-login-nick","aria-label":"Profile",title:F.value.profile,onClick:Fe,textContent:M(b(r).display_name)},null,8,An)])):I("v-if",!0),m("div",Mn,[b(n).login!=="force"&&b(n).meta.length&&!ie.value?(i(),p("div",{key:0,class:O(["wl-header",`item${b(n).meta.length}`])},[(i(!0),p(G,null,K(b(n).meta,w=>(i(),p("div",{key:w,class:"wl-header-item"},[m("label",{for:`wl-${w}`,textContent:M(F.value[w]+(b(n).requiredMeta.includes(w)||!b(n).requiredMeta.length?"":`(${F.value.optional})`))},null,8,Rn),be(m("input",{id:`wl-${w}`,ref_for:!0,ref:D=>{D&&(u.value[w]=D)},"onUpdate:modelValue":D=>b(d)[w]=D,class:O(["wl-input",`wl-${w}`]),name:w,type:w==="mail"?"email":"text"},null,10,xn),[[Zt,b(d)[w]]])]))),128))],2)):I("v-if",!0),be(m("textarea",{id:"wl-edit",ref:"textarea","onUpdate:modelValue":s[0]||(s[0]=w=>Xt(o)?o.value=w:null),class:"wl-editor",placeholder:e.replyUser?`@${e.replyUser}`:F.value.placeholder,onKeydown:zt,onDrop:Ut,onPaste:_t},null,40,zn),[[Yt,b(o)]]),be(m("div",Un,[s[7]||(s[7]=m("hr",null,null,-1)),m("h4",null,M(F.value.preview)+":",1),m("div",{class:"wl-content",innerHTML:me.value},null,8,_n)],512),[[De,oe.value]]),m("div",jn,[m("div",Vn,[m("a",Hn,[W(b(Oa))]),be(m("button",{ref:"emoji-button",type:"button",class:O(["wl-action",{active:z.value}]),title:F.value.emoji,onClick:s[1]||(s[1]=w=>z.value=!z.value)},[W(b(Wa))],10,Fn),[[De,S.value.tabs.length]]),b(n).search?(i(),p("button",{key:0,ref:"gif-button",type:"button",class:O(["wl-action",{active:J.value}]),title:F.value.gif,onClick:s[2]||(s[2]=w=>J.value=!J.value)},[W(b(Ja))],10,Tn)):I("v-if",!0),m("input",{id:"wl-image-upload",ref:"image-uploader",class:"upload","aria-hidden":"true",type:"file",accept:".png,.jpg,.jpeg,.webp,.bmp,.gif",onChange:jt},null,544),ge.value?(i(),p("label",{key:1,for:"wl-image-upload",class:"wl-action",title:F.value.uploadImage,"aria-label":F.value.uploadImage},[W(b(Da))],8,Nn)):I("v-if",!0),m("button",{type:"button",class:O(["wl-action",{active:oe.value}]),title:F.value.preview,onClick:s[3]||(s[3]=w=>oe.value=!oe.value)},[W(b(Ga))],10,Bn)]),m("div",Pn,[s[9]||(s[9]=m("div",{class:"wl-captcha-container"},null,-1)),m("div",Wn,[te(M(C.value)+" ",1),b(n).wordLimit?(i(),p("span",Dn,[s[8]||(s[8]=te(" / ",-1)),m("span",{class:O({illegal:!B.value}),textContent:M(j.value)},null,10,qn)])):I("v-if",!0),te(" "+M(F.value.word),1)]),b(n).login!=="disable"&&!ie.value?(i(),p("button",{key:0,type:"button",class:"wl-btn",onClick:Vt,textContent:M(F.value.login)},null,8,Gn)):I("v-if",!0),b(n).login!=="force"||ie.value?(i(),p("button",{key:1,type:"submit",class:"primary wl-btn",title:"Cmd|Ctrl + Enter",disabled:P.value,onClick:He},[P.value?(i(),Q(b(pe),{key:0,size:16})):(i(),p(G,{key:1},[te(M(F.value.submit),1)],64))],8,On)):I("v-if",!0)]),m("div",{ref:"gif-popup",class:O(["wl-gif-popup",{display:J.value}])},[m("input",{ref:"gif-search",type:"text",placeholder:F.value.gifSearchPlaceholder,onInput:s[4]||(s[4]=(...w)=>b(Ne)&&b(Ne)(...w))},null,40,Kn),$.list.length?(i(),Q(Cn,{key:0,items:$.list,"column-width":200,gap:6,onInsert:s[5]||(s[5]=w=>Ie(w)),onScroll:Te},null,8,["items"])):I("v-if",!0),$.loading?(i(),p("div",Zn,[W(b(pe),{size:30})])):I("v-if",!0)],2),m("div",{ref:"emoji-popup",class:O(["wl-emoji-popup",{display:z.value}])},[(i(!0),p(G,null,K(S.value.tabs,(w,D)=>(i(),p(G,{key:w.name},[D===v.value?(i(),p("div",{key:0,class:"wl-tab-wrapper",onScroll:re},[(i(!0),p(G,null,K(w.items,q=>(i(),p("button",{key:q,type:"button",title:q,onClick:X=>Ie(`:${q}:`),onMouseenter:X=>le(X,q),onMouseleave:re},[z.value?(i(),p("img",{key:0,class:"wl-emoji",src:S.value.map[q],alt:q,loading:"lazy",referrerPolicy:"no-referrer"},null,8,Yn)):I("v-if",!0)],40,Xn))),128))],32)):I("v-if",!0)],64))),128)),m("div",null,[H.value?(i(),p("img",{key:0,class:"wl-emoji-preview",src:S.value.map[H.value],alt:"preview",loading:"lazy",referrerPolicy:"no-referrer",style:ye(E.value)},null,12,Jn)):I("v-if",!0)]),S.value.tabs.length>1?(i(),p("div",Qn,[(i(!0),p(G,null,K(S.value.tabs,(w,D)=>(i(),p("button",{key:w.name,type:"button",class:O(["wl-tab",{active:v.value===D}]),onClick:q=>v.value=D},[m("img",{class:"wl-emoji",src:w.icon,alt:w.name,title:w.name,loading:"lazy",referrerPolicy:"no-referrer"},null,8,tl)],10,el))),128))])):I("v-if",!0)],2)])]),e.replyId||(V=e.edit)!=null&&V.objectId?(i(),p("button",{key:1,type:"button",class:"wl-close",title:F.value.cancelReply,onClick:s[6]||(s[6]=w=>e.replyId?l("cancelReply"):l("cancelEdit"))},[W(b(kt),{size:24})],8,al)):I("v-if",!0)])}}});const nl=["id"],ll={class:"wl-user","aria-hidden":"true"},rl=["src"],ol={class:"wl-card"},il={class:"wl-head"},sl=["href"],cl={key:1,class:"wl-nick"},ul=["textContent"],ml=["textContent"],vl=["textContent"],dl=["textContent"],pl={class:"wl-comment-actions"},gl=["title","href"],hl=["title"],fl=["title"],wl={class:"wl-meta","aria-hidden":"true"},yl=["data-value","textContent"],bl={key:0,class:"wl-warning","aria-hidden":"true"},kl={key:1,class:"wl-content"},Cl={key:0},$l=["href"],Ll=["innerHTML"],Sl={key:2,class:"wl-admin-actions"},Il={class:"wl-comment-status"},El=["disabled","onClick","textContent"],Al={key:4,class:"wl-quote"};var Ml=ne({__name:"CommentCard",props:{comment:{},edit:{},rootId:{},reply:{}},emits:["log","submit","delete","like","sticky","edit","reply","status"],setup(e,{emit:a}){const t=a,l=["approved","waiting","spam"],n=Me(Ce),o=$t(),d=ta(),r=Se(),u=N(()=>n.value.locale),L=N(()=>{const{link:S}=e.comment;return S?pt(S)?S:`https://${S}`:""}),c=N(()=>o.value.includes(e.comment.objectId)),h=N(()=>Ia(new Date(e.comment.time),d.value,u.value)),R=N(()=>r.value.type==="administrator"),_=N(()=>e.comment.user_id&&r.value.objectId===e.comment.user_id),f=N(()=>{var S;return e.comment.objectId===((S=e.reply)==null?void 0:S.objectId)}),A=N(()=>{var S;return e.comment.objectId===((S=e.edit)==null?void 0:S.objectId)});return(S,v)=>{var z;const H=qe("CommentCard",!0);return i(),p("div",{id:e.comment.objectId.toString(),class:"wl-card-item"},[m("div",ll,[e.comment.avatar?(i(),p("img",{key:0,class:"wl-user-avatar",src:e.comment.avatar,alt:""},null,8,rl)):I("v-if",!0),e.comment.type==="guest"?(i(),Q(b(Xa),{key:1})):I("v-if",!0),e.comment.type==="administrator"?(i(),Q(b(Ya),{key:2})):I("v-if",!0)]),m("div",ol,[m("div",il,[L.value?(i(),p("a",{key:0,class:"wl-nick",href:L.value,target:"_blank",rel:"nofollow noopener noreferrer"},M(e.comment.nick),9,sl)):(i(),p("span",cl,M(e.comment.nick),1)),e.comment.label?(i(),p("span",{key:2,class:"wl-badge",textContent:M(e.comment.label)},null,8,ul)):I("v-if",!0),e.comment.sticky?(i(),p("span",{key:3,class:"wl-badge",textContent:M(u.value.sticky)},null,8,ml)):I("v-if",!0),typeof e.comment.level=="number"?(i(),p("span",{key:4,class:O(`wl-badge level${e.comment.level}`),textContent:M(u.value[`level${e.comment.level}`]||`Level ${e.comment.level}`)},null,10,vl)):I("v-if",!0),m("span",{class:"wl-time",textContent:M(h.value)},null,8,dl),m("div",pl,[R.value||_.value?(i(),p(G,{key:0},[m("button",{type:"button",class:"wl-edit",onClick:v[0]||(v[0]=E=>t("edit",e.comment))},[W(b(Za))]),m("button",{type:"button",class:"wl-delete",onClick:v[1]||(v[1]=E=>t("delete",e.comment))},[W(b(Pa))])],64)):I("v-if",!0),_.value?(i(),p("a",{key:1,role:"button",class:"wl-rss",title:u.value.subscribeToReplies,href:`${b(n).serverURL}/api/comment/rss?user_id=${e.comment.user_id}`,target:"_blank",rel:"noopener noreferrer"},[W(b(Qa))],8,gl)):I("v-if",!0),m("button",{type:"button",class:"wl-like",title:c.value?u.value.cancelLike:u.value.like,onClick:v[2]||(v[2]=E=>t("like",e.comment))},[W(b(qa),{active:c.value},null,8,["active"]),te(" "+M("like"in e.comment?e.comment.like:""),1)],8,hl),m("button",{type:"button",class:O(["wl-reply",{active:f.value}]),title:f.value?u.value.cancelReply:u.value.reply,onClick:v[3]||(v[3]=E=>t("reply",f.value?null:e.comment))},[W(b(Ka))],10,fl)])]),m("div",wl,[(i(),p(G,null,K(["addr","browser","os"],E=>(i(),p(G,null,[e.comment[E]?(i(),p("span",{key:E,class:O(`wl-${E}`),"data-value":e.comment[E],textContent:M(e.comment[E])},null,10,yl)):I("v-if",!0)],64))),64))]),e.comment.status==="waiting"&&!R.value?(i(),p("div",bl,M(u.value.commentUnderReview),1)):I("v-if",!0),A.value?I("v-if",!0):(i(),p("div",kl,["reply_user"in e.comment&&e.comment.reply_user?(i(),p("p",Cl,[m("a",{href:"#"+e.comment.pid},"@"+M(e.comment.reply_user.nick),9,$l),v[17]||(v[17]=m("span",null,": ",-1))])):I("v-if",!0),m("div",{innerHTML:e.comment.comment},null,8,Ll)])),R.value&&!A.value?(i(),p("div",Sl,[m("span",Il,[(i(),p(G,null,K(l,E=>m("button",{key:E,type:"submit",class:O(`wl-btn wl-${E}`),disabled:e.comment.status===E,onClick:U=>t("status",{status:E,comment:e.comment}),textContent:M(u.value[E])},null,10,El)),64))]),R.value&&!("rid"in e.comment)?(i(),p("button",{key:0,type:"submit",class:"wl-btn wl-sticky",onClick:v[4]||(v[4]=E=>t("sticky",e.comment))},M(e.comment.sticky?u.value.unsticky:u.value.sticky),1)):I("v-if",!0)])):I("v-if",!0),f.value||A.value?(i(),p("div",{key:3,class:O({"wl-reply-wrapper":f.value,"wl-edit-wrapper":A.value})},[W(It,{edit:e.edit,"reply-id":(z=e.reply)==null?void 0:z.objectId,"reply-user":e.comment.nick,"root-id":e.rootId,onLog:v[5]||(v[5]=E=>t("log")),onCancelReply:v[6]||(v[6]=E=>t("reply",null)),onCancelEdit:v[7]||(v[7]=E=>t("edit",null)),onSubmit:v[8]||(v[8]=E=>t("submit",E))},null,8,["edit","reply-id","reply-user","root-id"])],2)):I("v-if",!0),"children"in e.comment?(i(),p("div",Al,[(i(!0),p(G,null,K(e.comment.children,E=>(i(),Q(H,{key:E.objectId,comment:E,reply:e.reply,edit:e.edit,"root-id":e.rootId,onLog:v[9]||(v[9]=U=>t("log")),onDelete:v[10]||(v[10]=U=>t("delete",U)),onEdit:v[11]||(v[11]=U=>t("edit",U)),onLike:v[12]||(v[12]=U=>t("like",U)),onReply:v[13]||(v[13]=U=>t("reply",U)),onStatus:v[14]||(v[14]=U=>t("status",U)),onSticky:v[15]||(v[15]=U=>t("sticky",U)),onSubmit:v[16]||(v[16]=U=>t("submit",U))},null,8,["comment","reply","edit","root-id"]))),128))])):I("v-if",!0)])],8,nl)}}});const Et="3.12.0",Rl={"data-waline":""},xl={class:"wl-meta-head"},zl={class:"wl-count"},Ul=["textContent"],_l={class:"wl-sort"},jl=["onClick"],Vl={class:"wl-cards"},Hl={key:1,class:"wl-operation"},Fl=["textContent"],Tl={key:2,class:"wl-loading"},Nl=["textContent"],Bl={key:4,class:"wl-operation"},Pl=["textContent"],Wl={key:5,class:"wl-meta-foot"},Dl={class:"wl-rss"},ql=["href"],Gl=["textContent"],Ol=["href"],Kl=["textContent"],Zl={key:0,class:"wl-power"};var Xl=ne({__name:"WalineComment",props:{serverURL:{},path:{},meta:{},requiredMeta:{},wordLimit:{},pageSize:{},lang:{},locale:{},commentSorting:{},dark:{type:[String,Boolean]},login:{},noCopyright:{type:Boolean},recaptchaV3Key:{},turnstileKey:{},reaction:{type:[Array,Boolean]},emoji:{},search:{},highlighter:{type:Function},imageUploader:{type:Function},texRenderer:{type:Function}},setup(e){const a=e,t=Se(),l=$t(),n=x("loading"),o=x(0),d=x(1),r=x(0),u=N(()=>$a(a)),L=x(u.value.commentSorting),c=x([]),h=x(null),R=x(null),_=N(()=>La(u.value.dark)),f=N(()=>u.value.locale);aa(_,{id:"waline-darkmode"});let A=null;const S=C=>{const{serverURL:$,path:j,pageSize:B}=u.value,Z=new AbortController;n.value="loading",A==null||A(),Wt({serverURL:$,lang:u.value.lang,path:j,pageSize:B,sortBy:mt[L.value],page:C,signal:Z.signal,token:t.value.token}).then(P=>{n.value="success",o.value=P.count,c.value.push(...P.data),d.value=C,r.value=P.totalPages}).catch(P=>{P.name!=="AbortError"&&(console.error(P.message),n.value="error")}),A=Z.abort.bind(Z)},v=()=>{S(d.value+1)},z=()=>{o.value=0,c.value=[],S(1)},H=C=>{L.value!==C&&(L.value=C,z())},E=C=>{h.value=C},U=C=>{R.value=C},le=C=>{if(R.value)R.value.comment=C.comment,R.value.orig=C.orig;else if("rid"in C){const $=c.value.find(({objectId:j})=>j===C.rid);if(!$)return;Array.isArray($.children)||($.children=[]),$.children.push(C)}else c.value.unshift(C),o.value+=1},re=async({comment:C,status:$})=>{if(C.status===$)return;const{serverURL:j,lang:B}=u.value;await we({serverURL:j,lang:B,token:t.value.token,objectId:C.objectId,comment:{status:$}}),C.status=$},J=async C=>{if("rid"in C)return;const{serverURL:$,lang:j}=u.value;await we({serverURL:$,lang:j,token:t.value.token,objectId:C.objectId,comment:{sticky:C.sticky?0:1}}),C.sticky=!C.sticky},oe=async({objectId:C})=>{if(!confirm("Are you sure you want to delete this comment?"))return;const{serverURL:$,lang:j}=u.value;await Pt({serverURL:$,lang:j,token:t.value.token,objectId:C}),c.value.some((B,Z)=>B.objectId===C?(c.value=c.value.filter((P,ae)=>ae!==Z),!0):B.children.some((P,ae)=>P.objectId===C?(c.value[Z].children=B.children.filter((F,ie)=>ie!==ae),!0):!1))},me=async C=>{const{serverURL:$,lang:j}=u.value,{objectId:B}=C,Z=l.value.includes(B);await we({serverURL:$,lang:j,objectId:B,token:t.value.token,comment:{like:!Z}}),Z?l.value=l.value.filter(P=>P!==B):(l.value=[...l.value,B],l.value.length>50&&(l.value=l.value.slice(-50))),C.like=Math.max(0,(C.like||0)+(Z?-1:1))};return Jt(Ce,u),ve(()=>{ce(()=>[a.serverURL,a.path],()=>{z()})}),Pe(()=>{A==null||A()}),(C,$)=>(i(),p("div",Rl,[W(yn),!h.value&&!R.value?(i(),Q(It,{key:0,onLog:z,onSubmit:le})):I("v-if",!0),m("div",xl,[m("div",zl,[o.value?(i(),p("span",{key:0,class:"wl-num",textContent:M(o.value)},null,8,Ul)):I("v-if",!0),te(" "+M(f.value.comment),1)]),m("ul",_l,[(i(!0),p(G,null,K(b(ka),j=>(i(),p("li",{key:j,class:O([j===L.value?"active":""]),onClick:B=>H(j)},M(f.value[j]),11,jl))),128))])]),m("div",Vl,[(i(!0),p(G,null,K(c.value,j=>(i(),Q(Ml,{key:j.objectId,"root-id":j.objectId,comment:j,reply:h.value,edit:R.value,onLog:z,onReply:E,onEdit:U,onSubmit:le,onStatus:re,onDelete:oe,onSticky:J,onLike:me},null,8,["root-id","comment","reply","edit"]))),128))]),n.value==="error"?(i(),p("div",Hl,[m("button",{type:"button",class:"wl-btn",onClick:z,textContent:M(f.value.refresh)},null,8,Fl)])):n.value==="loading"?(i(),p("div",Tl,[W(b(pe),{size:30})])):c.value.length?d.value<r.value?(i(),p("div",Bl,[m("button",{type:"button",class:"wl-btn",onClick:v,textContent:M(f.value.more)},null,8,Pl)])):I("v-if",!0):(i(),p("div",{key:3,class:"wl-empty",textContent:M(f.value.sofa)},null,8,Nl)),c.value.length||n.value!=="loading"?(i(),p("div",Wl,[m("div",Dl,[m("a",{href:`${u.value.serverURL}/api/comment/rss?path=${encodeURIComponent(u.value.path)}`,target:"_blank",rel:"noopener noreferrer"},[W(b(Ct)),m("span",{textContent:M(f.value.subPostComment)},null,8,Gl)],8,ql),m("a",{href:`${u.value.serverURL}/api/comment/rss`,target:"_blank",rel:"noopener noreferrer"},[W(b(Ct)),m("span",{textContent:M(f.value.subSiteComment)},null,8,Kl)],8,Ol)]),u.value.noCopyright?I("v-if",!0):(i(),p("div",Zl,[$[0]||($[0]=te(" Powered by ",-1)),$[1]||($[1]=m("a",{href:"https://github.com/walinejs/waline",target:"_blank",rel:"noopener noreferrer"}," Waline ",-1)),te(" v"+M(b(Et)),1)]))])):I("v-if",!0)]))}});const At=(e,a)=>{a.forEach((t,l)=>{const n=e[l].time;typeof n=="number"&&(t.textContent=n.toString())})},Mt=({serverURL:e,path:a=window.location.pathname,selector:t=".waline-pageview-count",update:l=!0,lang:n=navigator.language})=>{const o=new AbortController,d=[...document.querySelectorAll(t)],r=L=>{const c=je(L);return c!=null&&a!==c},u=L=>qt({serverURL:$e(e),paths:L.map(c=>je(c)??a),lang:n,signal:o.signal}).then(c=>{At(c,L)}).catch(ft);if(l){const L=d.filter(h=>!r(h)),c=d.filter(h=>r(h));Dt({serverURL:$e(e),path:a,lang:n}).then(h=>{At(h,L)}),c.length>0&&u(c)}else u(d);return o.abort.bind(o)},Yl=({el:e="#waline",path:a=window.location.pathname,comment:t=!1,pageview:l=!1,...n})=>{const o=e?Le(e):null;if(e&&!o)throw new Error("Option 'el' do not match any domElement!");if(!n.serverURL)throw new Error("Option 'serverURL' is missing!");const d=xe({...n}),r=xe({comment:t,pageview:l,path:a}),u=()=>{r.comment&&bt({serverURL:d.serverURL,path:r.path,...ue(r.comment)?{selector:r.comment}:{}})},L=()=>{r.pageview&&Mt({serverURL:d.serverURL,path:r.path,...ue(r.pageview)?{selector:r.pageview}:{}})};let c=null;o&&(c=Ge(()=>k(Xl,{path:r.path,...d})),c.mount(o));const h=Oe(u),R=Oe(L);return{el:o,update:({comment:_,pageview:f,path:A=window.location.pathname,...S}={})=>{Object.entries(S).forEach(([v,z])=>{d[v]=z}),r.path=A,_!=null&&(r.comment=_),f!=null&&(r.pageview=f)},destroy:()=>{c==null||c.unmount(),h(),R()}}},Jl=({el:e,serverURL:a,count:t,lang:l=navigator.language})=>{const n=Se(),o=Le(e),d=new AbortController;return Gt({serverURL:a,count:t,lang:l,signal:d.signal,token:n.value.token}).then(r=>o&&r.length>0?(o.innerHTML=`<ul class="wl-recent-list">${r.map(u=>`<li class="wl-recent-item"><a href="${u.url}">${u.nick}</a>:${u.comment}</li>`).join("")}</ul>`,{comments:r,destroy:()=>{d.abort(),o.innerHTML=""}}):{comments:r,destroy:()=>{d.abort()}})},Ql=({el:e,serverURL:a,count:t,locale:l,lang:n=navigator.language,mode:o="list"})=>{const d=Le(e),r=new AbortController;return Ot({serverURL:a,pageSize:t,lang:n,signal:r.signal}).then(u=>{if(!d||u.length===0)return{users:u,destroy:()=>{r.abort()}};const L={...ct(n),...typeof l=="object"?l:{}};return d.innerHTML=`<ul class="wl-user-${o}">${u.map((c,h)=>[`<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">${h+1}</span>`,"</div>",'<div class="wl-user-meta">','<div class="wl-user-name">',c.nick,typeof c.level=="number"?`<span class="wl-badge">${L[`level${c.level}`]??`Level ${c.level}`}</span>`:"",c.label?`<span class="wl-badge">${c.label}</span>`:"","</div>",c.link,"</div>",c.link?"</a>":"","</li>"].filter(Boolean).join("")).join("")}</ul>`,{users:u,destroy:()=>{r.abort(),d.innerHTML=""}}})},er=async({serverURL:e,lang:a,path:t})=>{const l=[1,2,3,4,5],n=new AbortController,o=n.abort.bind(n),[d]=await Be({serverURL:e,lang:a,paths:[t],type:Array.from({length:5},(r,u)=>`reaction${u}`),signal:n.signal});return{value:l.map((r,u)=>d[`reaction${u}`]),abort:o}},Ve=e=>{if(Number.isNaN(e))return 0;const a=Math.round(e);return Math.min(5,Math.max(0,a))},Rt=(e=[])=>Array.from({length:5},(a,t)=>{const l=e[t]??0;return typeof l=="number"&&l>0?l:0});var tr=ne({name:"WalineStarDisplay",props:{score:{type:Number,default:0}},setup(e){const a=N(()=>Ve(e.score));return{displayScore:a,displayClass:t=>a.value>=t?"wl-star-solid":"wl-star-outline"}}}),xt=(e,a)=>{const t=e.__vccOpts||e;for(const[l,n]of a)t[l]=n;return t};const ar={class:"wl-star-icon",viewBox:"0 0 24 24"};function nr(e,a,t,l,n,o){return i(),p(G,null,K([1,2,3,4,5],d=>m("span",{key:d,class:"wl-star-item"},[(i(),p("svg",ar,[m("path",{class:O(e.displayClass(d)),d:"M12 2l3.09 6.26L22 9.27l-5 4.87L18.18 22 12 18.56 5.82 22 7 14.14l-5-4.87 6.91-1.01L12 2z"},null,2)]))])),64)}var lr=xt(tr,[["render",nr]]),rr=ne({name:"WalineStarWidget",components:{StarDisplay:lr},props:{path:{type:String,default:""},serverURL:{type:String,default:""},lang:{type:String,default:""}},emits:["rate"],setup(e,{emit:a}){const t=x(null),l=Lt(),n=x(Ve((l.value[e.path]??0)+1)),o=x(null),d=x(Rt([])),r=x(!1);ve(()=>{ce(()=>[e.serverURL,e.path],async()=>{try{const v=await er({serverURL:e.serverURL,path:e.path,lang:e.lang});d.value=Rt(v.value)}catch(v){console.error("Failed to fetch reaction data:",v)}})});const u=N(()=>o.value??n.value),L=N(()=>d.value.reduce((v,z)=>v+z,0)),c=N(()=>d.value.map(v=>L.value?v/L.value:0)),h=v=>{if(!t.value)return 0;const{firstElementChild:z,lastElementChild:H}=t.value;if(!z||!H)return 0;const{left:E}=z.getBoundingClientRect(),{right:U}=H.getBoundingClientRect(),le=U-E,re=(v.clientX-E)/le,J=Math.min(1,Math.max(0,re))*5;return Ve(J)},R=v=>{o.value=h(v)},_=()=>{o.value=null},f=async v=>{const z=o.value??h(v);if(z===n.value||r.value)return;r.value=!0;const H=n.value,E={serverURL:e.serverURL,lang:e.lang,path:e.path};try{H&&(await fe({...E,type:`reaction${H-1}`,action:"desc"}),d.value[H-1]=Math.max(0,(d.value[H-1]??0)-1)),n.value=z;const U=z-1;l.value[e.path]=U,await fe({serverURL:e.serverURL,lang:e.lang,path:e.path,type:`reaction${U}`,action:"inc"}),d.value[U]=(d.value[U]??0)+1,a("rate",z)}catch(U){n.value=H,H?l.value[e.path]=H-1:delete l.value[e.path],console.error("[Waline] Failed to update reaction counter",U)}finally{r.value=!1}};function A(v){return d.value[v-1]??0}function S(v){return`${((c.value[v-1]??0)*100).toFixed(1)}%`}return{ratingArea:t,displayScore:u,onMouseMove:R,onMouseLeave:_,onClick:f,countFor:A,percentText:S}}});const or={class:"wl-star"},ir={class:"wl-star-score"},sr={class:"wl-star-rate"},cr={class:"wl-star-progress"},ur=["data-count"],mr={class:"wl-star-percent"};function vr(e,a,t,l,n,o){const d=qe("StarDisplay");return i(),p("div",or,[m("div",{ref:"ratingArea",class:"wl-star-rate",onMousemove:a[0]||(a[0]=(...r)=>e.onMouseMove&&e.onMouseMove(...r)),onMouseleave:a[1]||(a[1]=(...r)=>e.onMouseLeave&&e.onMouseLeave(...r)),onClick:a[2]||(a[2]=(...r)=>e.onClick&&e.onClick(...r))},[W(d,{score:e.displayScore},null,8,["score"])],544),m("div",ir,[(i(),p(G,null,K([5,4,3,2,1],r=>m("div",{key:r,class:"wl-star-row"},[m("div",sr,[W(d,{score:r},null,8,["score"])]),m("div",cr,[m("div",{class:"wl-star-progress-bar",style:ye({width:e.percentText(r)}),"data-count":e.countFor(r).toString()},null,12,ur)]),m("span",mr,M(e.percentText(r)),1)])),64))])])}var dr=xt(rr,[["render",vr]]);const pr=({el:e,path:a,lang:t=navigator.language,serverURL:l,onRate:n})=>{const o=Le(e);if(!o)return{destroy:()=>{}};const d=Ge(dr,{path:a,lang:t,serverURL:l,onRate:n});return d.mount(o),{destroy:()=>{d.unmount(),o.innerHTML=""}}};export{Jl as RecentComments,pr as Star,Ql as UserList,bt as commentCount,ke as defaultLocales,Yl as init,Mt as pageviewCount,Et as version};
|
|
13
|
+
`)}catch(y){alert(y.message),o.value=o.value.replace(s,"")}finally{P.value=!1}},Ut=g=>{var s;if((s=g.dataTransfer)!=null&&s.items){const y=wt(g.dataTransfer.items);y&&ge.value&&(Ee(y),g.preventDefault())}},_t=g=>{if(g.clipboardData){const s=wt(g.clipboardData.items);s&&ge.value&&Ee(s)}},jt=()=>{const g=c.value;g.files&&ge.value&&Ee(g.files[0]).then(()=>{g.value=""})},He=async()=>{var g;const{serverURL:s,lang:y,login:V,wordLimit:w,requiredMeta:D,recaptchaV3Key:q,turnstileKey:X}=n.value,T={comment:Z.value,nick:d.value.nick,mail:d.value.mail,link:d.value.link,url:n.value.path,ua:await Ba()};if(!t.edit)if(r.value.token)T.nick=r.value.display_name,T.mail=r.value.email,T.link=r.value.url;else{if(V==="force")return;if(D.includes("nick")&&!T.nick){u.value.nick.focus(),alert(F.value.nickError);return}if(D.includes("mail")&&!T.mail||T.mail&&!Aa(T.mail)){u.value.mail.focus(),alert(F.value.mailError);return}T.nick||(T.nick=F.value.anonymous)}if(!T.comment){L.value.focus();return}if(!B.value){alert(F.value.wordHint.replace("$0",w[0].toString()).replace("$1",w[1].toString()).replace("$2",C.value.toString()));return}T.comment=yt(T.comment,S.value.map),t.replyId&&t.rootId&&(T.pid=t.replyId,T.rid=t.rootId,T.at=t.replyUser),P.value=!0;try{q&&(T.recaptchaV3=await on(q).execute("social")),X&&(T.turnstile=await sn(X).execute("social"));const he={serverURL:s,lang:y,token:r.value.token,comment:T},Ae=await(t.edit?we({objectId:t.edit.objectId,...he}):Nt(he));if(P.value=!1,Ae.errmsg){alert(Ae.errmsg);return}l("submit",Ae.data),o.value="",me.value="",await We(),t.replyId&&l("cancelReply"),(g=t.edit)!=null&&g.objectId&&l("cancelEdit")}catch(he){P.value=!1,alert(he.message)}},Vt=g=>{g.preventDefault();const{lang:s,serverURL:y}=n.value;Bt({serverURL:y,lang:s}).then(V=>{r.value=V,(V.remember?localStorage:sessionStorage).setItem("WALINE_USER",JSON.stringify(V)),l("log")})},Ht=()=>{r.value={},localStorage.setItem("WALINE_USER","null"),sessionStorage.setItem("WALINE_USER","null"),l("log")},Fe=g=>{g.preventDefault();const{lang:s,serverURL:y}=n.value,V=800,w=800,D=(window.innerWidth-V)/2,q=(window.innerHeight-w)/2,X=new URLSearchParams({lng:s,token:r.value.token}),T=window.open(`${y}/ui/profile?${X.toString()}`,"_blank",`width=${V},height=${w},left=${D},top=${q},scrollbars=no,resizable=no,status=no,location=no,toolbar=no,menubar=no`);T==null||T.postMessage({type:"TOKEN",data:r.value.token},"*")},Ft=g=>{var s,y,V,w;!((s=h.value)!=null&&s.contains(g.target))&&!((y=R.value)!=null&&y.contains(g.target))&&(z.value=!1),!((V=_.value)!=null&&V.contains(g.target))&&!((w=f.value)!=null&&w.contains(g.target))&&(J.value=!1)},Te=async g=>{var s;const{scrollTop:y,clientHeight:V,scrollHeight:w}=g.target,D=(V+y)/w,q=n.value.search,X=((s=A.value)==null?void 0:s.value)??"";D<.9||$.loading||ae.value||($.loading=!0,(q.more&&$.list.length>0?await q.more(X,$.list.length):await q.search(X)).length>0?$.list=[...$.list,...q.more&&$.list.length>0?await q.more(X,$.list.length):await q.search(X)]:ae.value=!0,$.loading=!1,setTimeout(()=>{g.target.scrollTop=y},50))},Ne=ea(g=>{$.list=[],ae.value=!1,Te(g)},300);return Ke("click",Ft),Ke("message",({data:g})=>{(g==null?void 0:g.type)==="profile"&&(r.value={...r.value,...g.data},[localStorage,sessionStorage].filter(s=>s.getItem("WALINE_USER")).forEach(s=>{s.setItem("WALINE_USER",JSON.stringify(r))}))}),ce([n,C],([g,s])=>{const{wordLimit:y}=g;y?s<y[0]&&y[0]!==0?([j.value]=y,B.value=!1):s>y[1]?([,j.value]=y,B.value=!1):([,j.value]=y,B.value=!0):(j.value=0,B.value=!0)}),Re(J,async g=>{var s;if(!g)return;const y=n.value.search;A.value&&(A.value.value=""),$.loading=!0,$.list=await(((s=y.default)==null?void 0:s.call(y))??y.search("")),$.loading=!1}),ve(()=>{var g;(g=t.edit)!=null&&g.objectId&&(o.value=t.edit.orig),ce(()=>o.value,s=>{const{highlighter:y,texRenderer:V}=n.value;Z.value=s,me.value=Ha(s,{emojiMap:S.value.map,highlighter:y,texRenderer:V}),C.value=Na(s),s?Ze(L.value):Ze.destroy(L.value)}),ce(()=>n.value.emoji,async s=>{S.value=await za(s)})}),(g,s)=>{var y,V;return i(),p("div",{key:b(r).token,class:"wl-comment"},[b(n).login!=="disable"&&ie.value&&!((y=e.edit)!=null&&y.objectId)?(i(),p("div",$n,[m("div",Ln,[m("button",{type:"submit",class:"wl-logout-btn",title:F.value.logout,onClick:Ht},[W(b(kt),{size:14})],8,Sn),m("a",{href:"#",class:"wl-login-nick","aria-label":"Profile",title:F.value.profile,onClick:Fe},[m("img",{src:b(r).avatar,alt:"avatar"},null,8,En)],8,In)]),m("a",{href:"#",class:"wl-login-nick","aria-label":"Profile",title:F.value.profile,onClick:Fe,textContent:M(b(r).display_name)},null,8,An)])):I("v-if",!0),m("div",Mn,[b(n).login!=="force"&&b(n).meta.length&&!ie.value?(i(),p("div",{key:0,class:O(["wl-header",`item${b(n).meta.length}`])},[(i(!0),p(G,null,K(b(n).meta,w=>(i(),p("div",{key:w,class:"wl-header-item"},[m("label",{for:`wl-${w}`,textContent:M(F.value[w]+(b(n).requiredMeta.includes(w)||!b(n).requiredMeta.length?"":`(${F.value.optional})`))},null,8,Rn),be(m("input",{id:`wl-${w}`,ref_for:!0,ref:D=>{D&&(u.value[w]=D)},"onUpdate:modelValue":D=>b(d)[w]=D,class:O(["wl-input",`wl-${w}`]),name:w,type:w==="mail"?"email":"text"},null,10,xn),[[Zt,b(d)[w]]])]))),128))],2)):I("v-if",!0),be(m("textarea",{id:"wl-edit",ref:"textarea","onUpdate:modelValue":s[0]||(s[0]=w=>Xt(o)?o.value=w:null),class:"wl-editor",placeholder:e.replyUser?`@${e.replyUser}`:F.value.placeholder,onKeydown:zt,onDrop:Ut,onPaste:_t},null,40,zn),[[Yt,b(o)]]),be(m("div",Un,[s[7]||(s[7]=m("hr",null,null,-1)),m("h4",null,M(F.value.preview)+":",1),m("div",{class:"wl-content",innerHTML:me.value},null,8,_n)],512),[[De,oe.value]]),m("div",jn,[m("div",Vn,[m("a",Hn,[W(b(Oa))]),be(m("button",{ref:"emoji-button",type:"button",class:O(["wl-action",{active:z.value}]),title:F.value.emoji,onClick:s[1]||(s[1]=w=>z.value=!z.value)},[W(b(Wa))],10,Fn),[[De,S.value.tabs.length]]),b(n).search?(i(),p("button",{key:0,ref:"gif-button",type:"button",class:O(["wl-action",{active:J.value}]),title:F.value.gif,onClick:s[2]||(s[2]=w=>J.value=!J.value)},[W(b(Ja))],10,Tn)):I("v-if",!0),m("input",{id:"wl-image-upload",ref:"image-uploader",class:"upload","aria-hidden":"true",type:"file",accept:".png,.jpg,.jpeg,.webp,.bmp,.gif",onChange:jt},null,544),ge.value?(i(),p("label",{key:1,for:"wl-image-upload",class:"wl-action",title:F.value.uploadImage,"aria-label":F.value.uploadImage},[W(b(Da))],8,Nn)):I("v-if",!0),m("button",{type:"button",class:O(["wl-action",{active:oe.value}]),title:F.value.preview,onClick:s[3]||(s[3]=w=>oe.value=!oe.value)},[W(b(Ga))],10,Bn)]),m("div",Pn,[s[9]||(s[9]=m("div",{class:"wl-captcha-container"},null,-1)),m("div",Wn,[te(M(C.value)+" ",1),b(n).wordLimit?(i(),p("span",Dn,[s[8]||(s[8]=te(" / ",-1)),m("span",{class:O({illegal:!B.value}),textContent:M(j.value)},null,10,qn)])):I("v-if",!0),te(" "+M(F.value.word),1)]),b(n).login!=="disable"&&!ie.value?(i(),p("button",{key:0,type:"button",class:"wl-btn",onClick:Vt,textContent:M(F.value.login)},null,8,Gn)):I("v-if",!0),b(n).login!=="force"||ie.value?(i(),p("button",{key:1,type:"submit",class:"primary wl-btn",title:"Cmd|Ctrl + Enter",disabled:P.value,onClick:He},[P.value?(i(),Q(b(pe),{key:0,size:16})):(i(),p(G,{key:1},[te(M(F.value.submit),1)],64))],8,On)):I("v-if",!0)]),m("div",{ref:"gif-popup",class:O(["wl-gif-popup",{display:J.value}])},[m("input",{ref:"gif-search",type:"text",placeholder:F.value.gifSearchPlaceholder,onInput:s[4]||(s[4]=(...w)=>b(Ne)&&b(Ne)(...w))},null,40,Kn),$.list.length?(i(),Q(Cn,{key:0,items:$.list,"column-width":200,gap:6,onInsert:s[5]||(s[5]=w=>Ie(w)),onScroll:Te},null,8,["items"])):I("v-if",!0),$.loading?(i(),p("div",Zn,[W(b(pe),{size:30})])):I("v-if",!0)],2),m("div",{ref:"emoji-popup",class:O(["wl-emoji-popup",{display:z.value}])},[(i(!0),p(G,null,K(S.value.tabs,(w,D)=>(i(),p(G,{key:w.name},[D===v.value?(i(),p("div",{key:0,class:"wl-tab-wrapper",onScroll:re},[(i(!0),p(G,null,K(w.items,q=>(i(),p("button",{key:q,type:"button",title:q,onClick:X=>Ie(`:${q}:`),onMouseenter:X=>le(X,q),onMouseleave:re},[z.value?(i(),p("img",{key:0,class:"wl-emoji",src:S.value.map[q],alt:q,loading:"lazy",referrerPolicy:"no-referrer"},null,8,Yn)):I("v-if",!0)],40,Xn))),128))],32)):I("v-if",!0)],64))),128)),m("div",null,[H.value?(i(),p("img",{key:0,class:"wl-emoji-preview",src:S.value.map[H.value],alt:"preview",loading:"lazy",referrerPolicy:"no-referrer",style:ye(E.value)},null,12,Jn)):I("v-if",!0)]),S.value.tabs.length>1?(i(),p("div",Qn,[(i(!0),p(G,null,K(S.value.tabs,(w,D)=>(i(),p("button",{key:w.name,type:"button",class:O(["wl-tab",{active:v.value===D}]),onClick:q=>v.value=D},[m("img",{class:"wl-emoji",src:w.icon,alt:w.name,title:w.name,loading:"lazy",referrerPolicy:"no-referrer"},null,8,tl)],10,el))),128))])):I("v-if",!0)],2)])]),e.replyId||(V=e.edit)!=null&&V.objectId?(i(),p("button",{key:1,type:"button",class:"wl-close",title:F.value.cancelReply,onClick:s[6]||(s[6]=w=>e.replyId?l("cancelReply"):l("cancelEdit"))},[W(b(kt),{size:24})],8,al)):I("v-if",!0)])}}});const nl=["id"],ll={class:"wl-user","aria-hidden":"true"},rl=["src"],ol={class:"wl-card"},il={class:"wl-head"},sl=["href"],cl={key:1,class:"wl-nick"},ul=["textContent"],ml=["textContent"],vl=["textContent"],dl=["textContent"],pl={class:"wl-comment-actions"},gl=["title","href"],hl=["title"],fl=["title"],wl={class:"wl-meta","aria-hidden":"true"},yl=["data-value","textContent"],bl={key:0,class:"wl-warning","aria-hidden":"true"},kl={key:1,class:"wl-content"},Cl={key:0,class:"wl-reply-to"},$l=["href"],Ll=["innerHTML"],Sl={key:2,class:"wl-admin-actions"},Il={class:"wl-comment-status"},El=["disabled","onClick","textContent"],Al={key:4,class:"wl-quote"};var Ml=ne({__name:"CommentCard",props:{comment:{},edit:{},rootId:{},reply:{}},emits:["log","submit","delete","like","sticky","edit","reply","status"],setup(e,{emit:a}){const t=a,l=["approved","waiting","spam"],n=Me(Ce),o=$t(),d=ta(),r=Se(),u=N(()=>n.value.locale),L=N(()=>{const{link:S}=e.comment;return S?pt(S)?S:`https://${S}`:""}),c=N(()=>o.value.includes(e.comment.objectId)),h=N(()=>Ia(new Date(e.comment.time),d.value,u.value)),R=N(()=>r.value.type==="administrator"),_=N(()=>e.comment.user_id&&r.value.objectId===e.comment.user_id),f=N(()=>{var S;return e.comment.objectId===((S=e.reply)==null?void 0:S.objectId)}),A=N(()=>{var S;return e.comment.objectId===((S=e.edit)==null?void 0:S.objectId)});return(S,v)=>{var z;const H=qe("CommentCard",!0);return i(),p("div",{id:e.comment.objectId.toString(),class:"wl-card-item"},[m("div",ll,[e.comment.avatar?(i(),p("img",{key:0,class:"wl-user-avatar",src:e.comment.avatar,alt:""},null,8,rl)):I("v-if",!0),e.comment.type==="guest"?(i(),Q(b(Xa),{key:1})):I("v-if",!0),e.comment.type==="administrator"?(i(),Q(b(Ya),{key:2})):I("v-if",!0)]),m("div",ol,[m("div",il,[L.value?(i(),p("a",{key:0,class:"wl-nick",href:L.value,target:"_blank",rel:"nofollow noopener noreferrer"},M(e.comment.nick),9,sl)):(i(),p("span",cl,M(e.comment.nick),1)),e.comment.label?(i(),p("span",{key:2,class:"wl-badge",textContent:M(e.comment.label)},null,8,ul)):I("v-if",!0),e.comment.sticky?(i(),p("span",{key:3,class:"wl-badge",textContent:M(u.value.sticky)},null,8,ml)):I("v-if",!0),typeof e.comment.level=="number"?(i(),p("span",{key:4,class:O(`wl-badge level${e.comment.level}`),textContent:M(u.value[`level${e.comment.level}`]||`Level ${e.comment.level}`)},null,10,vl)):I("v-if",!0),m("span",{class:"wl-time",textContent:M(h.value)},null,8,dl),m("div",pl,[R.value||_.value?(i(),p(G,{key:0},[m("button",{type:"button",class:"wl-edit",onClick:v[0]||(v[0]=E=>t("edit",e.comment))},[W(b(Za))]),m("button",{type:"button",class:"wl-delete",onClick:v[1]||(v[1]=E=>t("delete",e.comment))},[W(b(Pa))])],64)):I("v-if",!0),_.value?(i(),p("a",{key:1,role:"button",class:"wl-rss",title:u.value.subscribeToReplies,href:`${b(n).serverURL}/api/comment/rss?user_id=${e.comment.user_id}`,target:"_blank",rel:"noopener noreferrer"},[W(b(Qa))],8,gl)):I("v-if",!0),m("button",{type:"button",class:"wl-like",title:c.value?u.value.cancelLike:u.value.like,onClick:v[2]||(v[2]=E=>t("like",e.comment))},[W(b(qa),{active:c.value},null,8,["active"]),te(" "+M("like"in e.comment?e.comment.like:""),1)],8,hl),m("button",{type:"button",class:O(["wl-reply",{active:f.value}]),title:f.value?u.value.cancelReply:u.value.reply,onClick:v[3]||(v[3]=E=>t("reply",f.value?null:e.comment))},[W(b(Ka))],10,fl)])]),m("div",wl,[(i(),p(G,null,K(["addr","browser","os"],E=>(i(),p(G,null,[e.comment[E]?(i(),p("span",{key:E,class:O(`wl-${E}`),"data-value":e.comment[E],textContent:M(e.comment[E])},null,10,yl)):I("v-if",!0)],64))),64))]),e.comment.status==="waiting"&&!R.value?(i(),p("div",bl,M(u.value.commentUnderReview),1)):I("v-if",!0),A.value?I("v-if",!0):(i(),p("div",kl,["reply_user"in e.comment&&e.comment.reply_user?(i(),p("div",Cl,[m("a",{href:"#"+e.comment.pid},"@"+M(e.comment.reply_user.nick),9,$l),v[17]||(v[17]=m("span",null,": ",-1))])):I("v-if",!0),m("div",{innerHTML:e.comment.comment},null,8,Ll)])),R.value&&!A.value?(i(),p("div",Sl,[m("span",Il,[(i(),p(G,null,K(l,E=>m("button",{key:E,type:"submit",class:O(`wl-btn wl-${E}`),disabled:e.comment.status===E,onClick:U=>t("status",{status:E,comment:e.comment}),textContent:M(u.value[E])},null,10,El)),64))]),R.value&&!("rid"in e.comment)?(i(),p("button",{key:0,type:"submit",class:"wl-btn wl-sticky",onClick:v[4]||(v[4]=E=>t("sticky",e.comment))},M(e.comment.sticky?u.value.unsticky:u.value.sticky),1)):I("v-if",!0)])):I("v-if",!0),f.value||A.value?(i(),p("div",{key:3,class:O({"wl-reply-wrapper":f.value,"wl-edit-wrapper":A.value})},[W(It,{edit:e.edit,"reply-id":(z=e.reply)==null?void 0:z.objectId,"reply-user":e.comment.nick,"root-id":e.rootId,onLog:v[5]||(v[5]=E=>t("log")),onCancelReply:v[6]||(v[6]=E=>t("reply",null)),onCancelEdit:v[7]||(v[7]=E=>t("edit",null)),onSubmit:v[8]||(v[8]=E=>t("submit",E))},null,8,["edit","reply-id","reply-user","root-id"])],2)):I("v-if",!0),"children"in e.comment?(i(),p("div",Al,[(i(!0),p(G,null,K(e.comment.children,E=>(i(),Q(H,{key:E.objectId,comment:E,reply:e.reply,edit:e.edit,"root-id":e.rootId,onLog:v[9]||(v[9]=U=>t("log")),onDelete:v[10]||(v[10]=U=>t("delete",U)),onEdit:v[11]||(v[11]=U=>t("edit",U)),onLike:v[12]||(v[12]=U=>t("like",U)),onReply:v[13]||(v[13]=U=>t("reply",U)),onStatus:v[14]||(v[14]=U=>t("status",U)),onSticky:v[15]||(v[15]=U=>t("sticky",U)),onSubmit:v[16]||(v[16]=U=>t("submit",U))},null,8,["comment","reply","edit","root-id"]))),128))])):I("v-if",!0)])],8,nl)}}});const Et="3.12.1",Rl={"data-waline":""},xl={class:"wl-meta-head"},zl={class:"wl-count"},Ul=["textContent"],_l={class:"wl-sort"},jl=["onClick"],Vl={class:"wl-cards"},Hl={key:1,class:"wl-operation"},Fl=["textContent"],Tl={key:2,class:"wl-loading"},Nl=["textContent"],Bl={key:4,class:"wl-operation"},Pl=["textContent"],Wl={key:5,class:"wl-meta-foot"},Dl={class:"wl-rss"},ql=["href","alt"],Gl=["textContent"],Ol=["href","alt"],Kl=["textContent"],Zl={key:0,class:"wl-power"};var Xl=ne({__name:"WalineComment",props:{serverURL:{},path:{},meta:{},requiredMeta:{},wordLimit:{},pageSize:{},lang:{},locale:{},commentSorting:{},dark:{type:[String,Boolean]},login:{},noCopyright:{type:Boolean},recaptchaV3Key:{},turnstileKey:{},reaction:{type:[Array,Boolean]},emoji:{},search:{},highlighter:{type:Function},imageUploader:{type:Function},texRenderer:{type:Function}},setup(e){const a=e,t=Se(),l=$t(),n=x("loading"),o=x(0),d=x(1),r=x(0),u=N(()=>$a(a)),L=x(u.value.commentSorting),c=x([]),h=x(null),R=x(null),_=N(()=>La(u.value.dark)),f=N(()=>u.value.locale);aa(_,{id:"waline-darkmode"});let A=null;const S=C=>{const{serverURL:$,path:j,pageSize:B}=u.value,Z=new AbortController;n.value="loading",A==null||A(),Wt({serverURL:$,lang:u.value.lang,path:j,pageSize:B,sortBy:mt[L.value],page:C,signal:Z.signal,token:t.value.token}).then(P=>{n.value="success",o.value=P.count,c.value.push(...P.data),d.value=C,r.value=P.totalPages}).catch(P=>{P.name!=="AbortError"&&(console.error(P.message),n.value="error")}),A=Z.abort.bind(Z)},v=()=>{S(d.value+1)},z=()=>{o.value=0,c.value=[],S(1)},H=C=>{L.value!==C&&(L.value=C,z())},E=C=>{h.value=C},U=C=>{R.value=C},le=C=>{if(R.value)R.value.comment=C.comment,R.value.orig=C.orig;else if("rid"in C){const $=c.value.find(({objectId:j})=>j===C.rid);if(!$)return;Array.isArray($.children)||($.children=[]),$.children.push(C)}else c.value.unshift(C),o.value+=1},re=async({comment:C,status:$})=>{if(C.status===$)return;const{serverURL:j,lang:B}=u.value;await we({serverURL:j,lang:B,token:t.value.token,objectId:C.objectId,comment:{status:$}}),C.status=$},J=async C=>{if("rid"in C)return;const{serverURL:$,lang:j}=u.value;await we({serverURL:$,lang:j,token:t.value.token,objectId:C.objectId,comment:{sticky:C.sticky?0:1}}),C.sticky=!C.sticky},oe=async({objectId:C})=>{if(!confirm("Are you sure you want to delete this comment?"))return;const{serverURL:$,lang:j}=u.value;await Pt({serverURL:$,lang:j,token:t.value.token,objectId:C}),c.value.some((B,Z)=>B.objectId===C?(c.value=c.value.filter((P,ae)=>ae!==Z),!0):B.children.some((P,ae)=>P.objectId===C?(c.value[Z].children=B.children.filter((F,ie)=>ie!==ae),!0):!1))},me=async C=>{const{serverURL:$,lang:j}=u.value,{objectId:B}=C,Z=l.value.includes(B);await we({serverURL:$,lang:j,objectId:B,token:t.value.token,comment:{like:!Z}}),Z?l.value=l.value.filter(P=>P!==B):(l.value=[...l.value,B],l.value.length>50&&(l.value=l.value.slice(-50))),C.like=Math.max(0,(C.like||0)+(Z?-1:1))};return Jt(Ce,u),ve(()=>{ce(()=>[a.serverURL,a.path],()=>{z()})}),Pe(()=>{A==null||A()}),(C,$)=>(i(),p("div",Rl,[W(yn),!h.value&&!R.value?(i(),Q(It,{key:0,onLog:z,onSubmit:le})):I("v-if",!0),m("div",xl,[m("div",zl,[o.value?(i(),p("span",{key:0,class:"wl-num",textContent:M(o.value)},null,8,Ul)):I("v-if",!0),te(" "+M(f.value.comment),1)]),m("ul",_l,[(i(!0),p(G,null,K(b(ka),j=>(i(),p("li",{key:j,class:O([j===L.value?"active":""]),onClick:B=>H(j)},M(f.value[j]),11,jl))),128))])]),m("div",Vl,[(i(!0),p(G,null,K(c.value,j=>(i(),Q(Ml,{key:j.objectId,"root-id":j.objectId,comment:j,reply:h.value,edit:R.value,onLog:z,onReply:E,onEdit:U,onSubmit:le,onStatus:re,onDelete:oe,onSticky:J,onLike:me},null,8,["root-id","comment","reply","edit"]))),128))]),n.value==="error"?(i(),p("div",Hl,[m("button",{type:"button",class:"wl-btn",onClick:z,textContent:M(f.value.refresh)},null,8,Fl)])):n.value==="loading"?(i(),p("div",Tl,[W(b(pe),{size:30})])):c.value.length?d.value<r.value?(i(),p("div",Bl,[m("button",{type:"button",class:"wl-btn",onClick:v,textContent:M(f.value.more)},null,8,Pl)])):I("v-if",!0):(i(),p("div",{key:3,class:"wl-empty",textContent:M(f.value.sofa)},null,8,Nl)),c.value.length||n.value!=="loading"?(i(),p("div",Wl,[m("div",Dl,[m("a",{href:`${u.value.serverURL}/api/comment/rss?path=${encodeURIComponent(u.value.path)}`,target:"_blank",rel:"noopener noreferrer",alt:f.value.subPostComment},[W(b(Ct)),m("span",{textContent:M(f.value.subPostComment)},null,8,Gl)],8,ql),m("a",{href:`${u.value.serverURL}/api/comment/rss`,target:"_blank",rel:"noopener noreferrer",alt:f.value.subSiteComment},[W(b(Ct)),m("span",{textContent:M(f.value.subSiteComment)},null,8,Kl)],8,Ol)]),u.value.noCopyright?I("v-if",!0):(i(),p("div",Zl,[$[0]||($[0]=te(" Powered by ",-1)),$[1]||($[1]=m("a",{href:"https://github.com/walinejs/waline",target:"_blank",rel:"noopener noreferrer"}," Waline ",-1)),te(" v"+M(b(Et)),1)]))])):I("v-if",!0)]))}});const At=(e,a)=>{a.forEach((t,l)=>{const n=e[l].time;typeof n=="number"&&(t.textContent=n.toString())})},Mt=({serverURL:e,path:a=window.location.pathname,selector:t=".waline-pageview-count",update:l=!0,lang:n=navigator.language})=>{const o=new AbortController,d=[...document.querySelectorAll(t)],r=L=>{const c=je(L);return c!=null&&a!==c},u=L=>qt({serverURL:$e(e),paths:L.map(c=>je(c)??a),lang:n,signal:o.signal}).then(c=>{At(c,L)}).catch(ft);if(l){const L=d.filter(h=>!r(h)),c=d.filter(h=>r(h));Dt({serverURL:$e(e),path:a,lang:n}).then(h=>{At(h,L)}),c.length>0&&u(c)}else u(d);return o.abort.bind(o)},Yl=({el:e="#waline",path:a=window.location.pathname,comment:t=!1,pageview:l=!1,...n})=>{const o=e?Le(e):null;if(e&&!o)throw new Error("Option 'el' do not match any domElement!");if(!n.serverURL)throw new Error("Option 'serverURL' is missing!");const d=xe({...n}),r=xe({comment:t,pageview:l,path:a}),u=()=>{r.comment&&bt({serverURL:d.serverURL,path:r.path,...ue(r.comment)?{selector:r.comment}:{}})},L=()=>{r.pageview&&Mt({serverURL:d.serverURL,path:r.path,...ue(r.pageview)?{selector:r.pageview}:{}})};let c=null;o&&(c=Ge(()=>k(Xl,{path:r.path,...d})),c.mount(o));const h=Oe(u),R=Oe(L);return{el:o,update:({comment:_,pageview:f,path:A=window.location.pathname,...S}={})=>{Object.entries(S).forEach(([v,z])=>{d[v]=z}),r.path=A,_!=null&&(r.comment=_),f!=null&&(r.pageview=f)},destroy:()=>{c==null||c.unmount(),h(),R()}}},Jl=({el:e,serverURL:a,count:t,lang:l=navigator.language})=>{const n=Se(),o=Le(e),d=new AbortController;return Gt({serverURL:a,count:t,lang:l,signal:d.signal,token:n.value.token}).then(r=>o&&r.length>0?(o.innerHTML=`<ul class="wl-recent-list">${r.map(u=>`<li class="wl-recent-item"><a href="${u.url}">${u.nick}</a>:${u.comment}</li>`).join("")}</ul>`,{comments:r,destroy:()=>{d.abort(),o.innerHTML=""}}):{comments:r,destroy:()=>{d.abort()}})},Ql=({el:e,serverURL:a,count:t,locale:l,lang:n=navigator.language,mode:o="list"})=>{const d=Le(e),r=new AbortController;return Ot({serverURL:a,pageSize:t,lang:n,signal:r.signal}).then(u=>{if(!d||u.length===0)return{users:u,destroy:()=>{r.abort()}};const L={...ct(n),...typeof l=="object"?l:{}};return d.innerHTML=`<ul class="wl-user-${o}">${u.map((c,h)=>[`<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">${h+1}</span>`,"</div>",'<div class="wl-user-meta">','<div class="wl-user-name">',c.nick,typeof c.level=="number"?`<span class="wl-badge">${L[`level${c.level}`]??`Level ${c.level}`}</span>`:"",c.label?`<span class="wl-badge">${c.label}</span>`:"","</div>",c.link,"</div>",c.link?"</a>":"","</li>"].filter(Boolean).join("")).join("")}</ul>`,{users:u,destroy:()=>{r.abort(),d.innerHTML=""}}})},er=async({serverURL:e,lang:a,path:t})=>{const l=[1,2,3,4,5],n=new AbortController,o=n.abort.bind(n),[d]=await Be({serverURL:e,lang:a,paths:[t],type:Array.from({length:5},(r,u)=>`reaction${u}`),signal:n.signal});return{value:l.map((r,u)=>d[`reaction${u}`]),abort:o}},Ve=e=>{if(Number.isNaN(e))return 0;const a=Math.round(e);return Math.min(5,Math.max(0,a))},Rt=(e=[])=>Array.from({length:5},(a,t)=>{const l=e[t]??0;return typeof l=="number"&&l>0?l:0});var tr=ne({name:"WalineStarDisplay",props:{score:{type:Number,default:0}},setup(e){const a=N(()=>Ve(e.score));return{displayScore:a,displayClass:t=>a.value>=t?"wl-star-solid":"wl-star-outline"}}}),xt=(e,a)=>{const t=e.__vccOpts||e;for(const[l,n]of a)t[l]=n;return t};const ar={class:"wl-star-icon",viewBox:"0 0 24 24"};function nr(e,a,t,l,n,o){return i(),p(G,null,K([1,2,3,4,5],d=>m("span",{key:d,class:"wl-star-item"},[(i(),p("svg",ar,[m("path",{class:O(e.displayClass(d)),d:"M12 2l3.09 6.26L22 9.27l-5 4.87L18.18 22 12 18.56 5.82 22 7 14.14l-5-4.87 6.91-1.01L12 2z"},null,2)]))])),64)}var lr=xt(tr,[["render",nr]]),rr=ne({name:"WalineStarWidget",components:{StarDisplay:lr},props:{path:{type:String,default:""},serverURL:{type:String,default:""},lang:{type:String,default:""}},emits:["rate"],setup(e,{emit:a}){const t=x(null),l=Lt(),n=x(Ve((l.value[e.path]??0)+1)),o=x(null),d=x(Rt([])),r=x(!1);ve(()=>{ce(()=>[e.serverURL,e.path],async()=>{try{const v=await er({serverURL:e.serverURL,path:e.path,lang:e.lang});d.value=Rt(v.value)}catch(v){console.error("Failed to fetch reaction data:",v)}})});const u=N(()=>o.value??n.value),L=N(()=>d.value.reduce((v,z)=>v+z,0)),c=N(()=>d.value.map(v=>L.value?v/L.value:0)),h=v=>{if(!t.value)return 0;const{firstElementChild:z,lastElementChild:H}=t.value;if(!z||!H)return 0;const{left:E}=z.getBoundingClientRect(),{right:U}=H.getBoundingClientRect(),le=U-E,re=(v.clientX-E)/le,J=Math.min(1,Math.max(0,re))*5;return Ve(J)},R=v=>{o.value=h(v)},_=()=>{o.value=null},f=async v=>{const z=o.value??h(v);if(z===n.value||r.value)return;r.value=!0;const H=n.value,E={serverURL:e.serverURL,lang:e.lang,path:e.path};try{H&&(await fe({...E,type:`reaction${H-1}`,action:"desc"}),d.value[H-1]=Math.max(0,(d.value[H-1]??0)-1)),n.value=z;const U=z-1;l.value[e.path]=U,await fe({serverURL:e.serverURL,lang:e.lang,path:e.path,type:`reaction${U}`,action:"inc"}),d.value[U]=(d.value[U]??0)+1,a("rate",z)}catch(U){n.value=H,H?l.value[e.path]=H-1:delete l.value[e.path],console.error("[Waline] Failed to update reaction counter",U)}finally{r.value=!1}};function A(v){return d.value[v-1]??0}function S(v){return`${((c.value[v-1]??0)*100).toFixed(1)}%`}return{ratingArea:t,displayScore:u,onMouseMove:R,onMouseLeave:_,onClick:f,countFor:A,percentText:S}}});const or={class:"wl-star"},ir={class:"wl-star-score"},sr={class:"wl-star-rate"},cr={class:"wl-star-progress"},ur=["data-count"],mr={class:"wl-star-percent"};function vr(e,a,t,l,n,o){const d=qe("StarDisplay");return i(),p("div",or,[m("div",{ref:"ratingArea",class:"wl-star-rate",onMousemove:a[0]||(a[0]=(...r)=>e.onMouseMove&&e.onMouseMove(...r)),onMouseleave:a[1]||(a[1]=(...r)=>e.onMouseLeave&&e.onMouseLeave(...r)),onClick:a[2]||(a[2]=(...r)=>e.onClick&&e.onClick(...r))},[W(d,{score:e.displayScore},null,8,["score"])],544),m("div",ir,[(i(),p(G,null,K([5,4,3,2,1],r=>m("div",{key:r,class:"wl-star-row"},[m("div",sr,[W(d,{score:r},null,8,["score"])]),m("div",cr,[m("div",{class:"wl-star-progress-bar",style:ye({width:e.percentText(r)}),"data-count":e.countFor(r).toString()},null,12,ur)]),m("span",mr,M(e.percentText(r)),1)])),64))])])}var dr=xt(rr,[["render",vr]]);const pr=({el:e,path:a,lang:t=navigator.language,serverURL:l,onRate:n})=>{const o=Le(e);if(!o)return{destroy:()=>{}};const d=Ge(dr,{path:a,lang:t,serverURL:l,onRate:n});return d.mount(o),{destroy:()=>{d.unmount(),o.innerHTML=""}}};export{Jl as RecentComments,pr as Star,Ql as UserList,bt as commentCount,ke as defaultLocales,Yl as init,Mt as pageviewCount,Et as version};
|
|
14
14
|
//# sourceMappingURL=slim.js.map
|