@waline/client 3.5.3 → 3.5.5
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/{components.d.ts → component.d.ts} +3 -2
- package/dist/component.js +1 -1
- package/dist/pageview.js +1 -1
- package/dist/slim.js +1 -1
- package/dist/waline.js +1 -1
- package/dist/waline.umd.js +1 -1
- package/package.json +1 -1
package/dist/comment.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
const i=e=>`${e.replace(/\/?$/,"/")}api/`,h=(e,t="")=>{if(typeof e=="object"&&e.errno)throw new TypeError(`${t} failed with ${e.errno}: ${e.errmsg}`);return e},g=({serverURL:e,lang:t,paths:r,signal:o})=>fetch(`${i(e)}comment?type=count&url=${encodeURIComponent(r.join(","))}&lang=${t}`,{signal:o}).then(n=>n.json()).then(n=>h(n,"Get comment count").data),p=e=>{try{e=decodeURI(e)}catch{}return e},m=(e="")=>e.replace(/\/$/u,""),u=e=>/^(https?:)?\/\//.test(e),d=e=>{const t=m(e);return u(t)?t:`https://${t}`},$=e=>{e.name!=="AbortError"&&console.error(e.message)},f=e=>{const{path:t}=e.dataset;return t!=null&&t.length?t:null},v=({serverURL:e,path:t=window.location.pathname,selector:r=".waline-comment-count",lang:o=navigator.language})=>{const n=new AbortController,a=document.querySelectorAll(r);return a.length&&g({serverURL:d(e),paths:Array.from(a).map(c=>p(f(c)??t)),lang:o,signal:n.signal}).then(c=>{a.forEach((s,l)=>{s.innerText=c[l].toString()})}).catch($),n.abort.bind(n)},w="3.5.
|
|
1
|
+
const i=e=>`${e.replace(/\/?$/,"/")}api/`,h=(e,t="")=>{if(typeof e=="object"&&e.errno)throw new TypeError(`${t} failed with ${e.errno}: ${e.errmsg}`);return e},g=({serverURL:e,lang:t,paths:r,signal:o})=>fetch(`${i(e)}comment?type=count&url=${encodeURIComponent(r.join(","))}&lang=${t}`,{signal:o}).then(n=>n.json()).then(n=>h(n,"Get comment count").data),p=e=>{try{e=decodeURI(e)}catch{}return e},m=(e="")=>e.replace(/\/$/u,""),u=e=>/^(https?:)?\/\//.test(e),d=e=>{const t=m(e);return u(t)?t:`https://${t}`},$=e=>{e.name!=="AbortError"&&console.error(e.message)},f=e=>{const{path:t}=e.dataset;return t!=null&&t.length?t:null},v=({serverURL:e,path:t=window.location.pathname,selector:r=".waline-comment-count",lang:o=navigator.language})=>{const n=new AbortController,a=document.querySelectorAll(r);return a.length&&g({serverURL:d(e),paths:Array.from(a).map(c=>p(f(c)??t)),lang:o,signal:n.signal}).then(c=>{a.forEach((s,l)=>{s.innerText=c[l].toString()})}).catch($),n.abort.bind(n)},w="3.5.5";export{v as commentCount,w as version};
|
|
2
2
|
//# sourceMappingURL=comment.js.map
|
|
@@ -439,7 +439,7 @@ interface WalineProps {
|
|
|
439
439
|
/* eslint-disable @typescript-eslint/no-empty-object-type */
|
|
440
440
|
|
|
441
441
|
|
|
442
|
-
declare const
|
|
442
|
+
declare const Waline: DefineComponent<
|
|
443
443
|
WalineProps,
|
|
444
444
|
{},
|
|
445
445
|
{},
|
|
@@ -461,5 +461,6 @@ declare const _default: DefineComponent<
|
|
|
461
461
|
{},
|
|
462
462
|
HTMLDivElement
|
|
463
463
|
>;
|
|
464
|
+
declare const version: string;
|
|
464
465
|
|
|
465
|
-
export {
|
|
466
|
+
export { Waline, version };
|
package/dist/component.js
CHANGED
|
@@ -8,5 +8,5 @@ import{h as x,defineComponent as oe,inject as we,ref as R,computed as W,createEl
|
|
|
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?"]),Xe=J(["昵称","昵称不能少于3个字符","邮箱","请填写正确的邮件地址","网址","可选","欢迎评论","来发评论吧~","提交","喜欢","取消喜欢","回复","取消回复","评论","刷新","加载更多...","预览","表情","上传图片","秒前","分钟前","小时前","天前","刚刚","正在上传","登录","退出","博主","置顶","字",`评论字数应在 $0 到 $1 字之间!
|
|
9
9
|
当前字数:$2`,"匿名","潜水","冒泡","吐槽","活跃","话痨","传说","表情包","搜索表情包","个人资料","通过","待审核","垃圾","取消置顶","按倒序","按正序","按热度","你认为这篇文章怎么样?"]),pl=J(["暱稱","暱稱不能少於3個字元","郵箱","請填寫正確的郵件地址","網址","可選","歡迎留言","來發留言吧~","送出","喜歡","取消喜歡","回覆","取消回覆","留言","重整","載入更多...","預覽","表情","上傳圖片","秒前","分鐘前","小時前","天前","剛剛","正在上傳","登入","登出","管理者","置頂","字",`留言字數應在 $0 到 $1 字之間!
|
|
10
10
|
目前字數:$2`,"匿名","潛水","冒泡","吐槽","活躍","多話","傳說","表情包","搜尋表情包","個人資料","通過","待審核","垃圾","取消置頂","最早","最新","熱門","你認為這篇文章怎麼樣?"]);const Ye="en-US",$e={zh:Xe,"zh-cn":Xe,"zh-tw":pl,en:Pe,"en-us":Pe,fr:Ge,"fr-fr":Ge,jp:Oe,"jp-jp":Oe,"pt-br":dl,ru:Ke,"ru-ru":Ke,vi:Ze,"vi-vn":Ze,de:vl,es:qe,"es-mx":qe},gl=e=>$e[e.toLowerCase()]||$e[Ye.toLowerCase()],Je=e=>Object.keys($e).includes(e.toLowerCase())?e:Ye,Qe={latest:"insertedAt_desc",oldest:"insertedAt_asc",hottest:"like_desc"},hl=Object.keys(Qe),he=Symbol("waline-config"),fl={key:0,class:"wl-reaction"},yl=["textContent"],wl={class:"wl-reaction-list"},kl=["onClick"],bl={class:"wl-reaction-img"},Cl=["src","alt"],$l=["textContent"],Il=["textContent"];var El=oe({__name:"ArticleReaction",setup(e){const a=Zt(),t=we(he),l=R(-1),r=R([]),d=W(()=>t.value.locale),M=W(()=>{const{reaction:m}=t.value;return m!=null&&m.length?m:null}),k=W(()=>{var m;const{path:S}=t.value;return((m=M.value)==null?void 0:m.map((U,I)=>({icon:U,desc:d.value[`reaction${I}`],active:a.value[S]===I})))??null});let C;const b=async()=>{const{serverURL:m,lang:S,path:U}=t.value;if(!M.value)return;const I=new AbortController;C=I.abort.bind(I);const[y]=await Et({serverURL:m,lang:S,paths:[U],type:M.value.map((j,o)=>`reaction${o}`),signal:I.signal});r.value=M.value.map((j,o)=>y[`reaction${o}`])},A=async m=>{if(l.value!==-1)return;const{serverURL:S,lang:U,path:I}=t.value,y=a.value[I];l.value=m,y!==void 0&&(await _e({serverURL:S,lang:U,path:I,type:`reaction${y}`,action:"desc"}),r.value[y]=Math.max(r.value[y]-1,0)),y!==m&&(await _e({serverURL:S,lang:U,path:I,type:`reaction${m}`}),r.value[m]=(r.value[m]||0)+1),y===m?delete a.value[I]:a.value[I]=m,l.value=-1};return de(()=>{se(()=>[t.value.serverURL,t.value.path],()=>b())}),je(()=>{C==null||C()}),(m,S)=>k.value?(i(),s("div",fl,[u("div",{class:"wl-reaction-title",textContent:L(d.value.reactionTitle)},null,8,yl),u("ul",wl,[(i(!0),s(B,null,Z(k.value,({active:U,icon:I,desc:y},j)=>(i(),s("li",{key:j,class:P(["wl-reaction-item",{active:U}]),onClick:o=>A(j)},[u("div",bl,[u("img",{src:I,alt:y},null,8,Cl),l.value===j?(i(),ee(w(ce),{key:0,class:"wl-reaction-loading"})):(i(),s("div",{key:1,class:"wl-reaction-votes",textContent:L(r.value[j]||0)},null,8,$l))]),u("div",{class:"wl-reaction-text",textContent:L(y)},null,8,Il)],10,kl))),128))])])):$("v-if",!0)}});const Ll=["data-index"],xl=["src","title","onClick"];var Ml=oe({__name:"ImageWall",props:{items:{default:()=>[]},columnWidth:{default:300},gap:{default:0}},emits:["insert"],setup(e){const a=e;let t=null;const l=te("wall"),r=R({}),d=R([]),M=()=>{const m=Math.floor((l.value.getBoundingClientRect().width+a.gap)/(a.columnWidth+a.gap));return m>0?m:1},k=m=>new Array(m).fill(null).map(()=>[]),C=async m=>{var S;if(m>=a.items.length)return;await Re();const U=Array.from(((S=l.value)==null?void 0:S.children)??[]).reduce((I,y)=>y.getBoundingClientRect().height<I.getBoundingClientRect().height?y:I);d.value[Number(U.dataset.index)].push(m),await C(m+1)},b=async(m=!1)=>{if(d.value.length===M()&&!m)return;d.value=k(M());const S=window.scrollY;await C(0),window.scrollTo({top:S})},A=m=>{r.value[m.target.src]=!0};return de(()=>{b(!0),t=new ResizeObserver(()=>{b()}),t.observe(l.value),ke(()=>[a.items],()=>{r.value={},b(!0)}),ke(()=>[a.columnWidth,a.gap],()=>{b()})}),dt(()=>{t.unobserve(l.value)}),(m,S)=>(i(),s("div",{ref_key:"wall",ref:l,class:"wl-gallery",style:ze({gap:`${m.gap}px`})},[(i(!0),s(B,null,Z(d.value,(U,I)=>(i(),s("div",{key:I,class:"wl-gallery-column","data-index":I,style:ze({gap:`${m.gap}px`})},[(i(!0),s(B,null,Z(U,y=>(i(),s(B,{key:y},[r.value[m.items[y].src]?$("v-if",!0):(i(),ee(w(ce),{key:0,size:36,style:{margin:"20px auto"}})),u("img",{class:"wl-gallery-item",src:m.items[y].src,title:m.items[y].title,loading:"lazy",onLoad:A,onClick:j=>m.$emit("insert",``)},null,40,xl)],64))),128))],12,Ll))),128))],4))}});const Al=e=>{try{e=decodeURI(e)}catch{}return e},et=(e="")=>e.replace(/\/$/u,""),tt=e=>/^(https?:)?\/\//.test(e),Sl=e=>{const a=et(e);return tt(a)?a:`https://${a}`},jl=e=>Array.isArray(e)?e:e?[0,e]:!1,ie=(e,a)=>e==null||e===!0?a:e===!1?null:e,zl=({serverURL:e,path:a=location.pathname,lang:t=typeof navigator>"u"?"en-US":navigator.language,locale:l,meta:r=["nick","mail","link"],requiredMeta:d=[],dark:M=!1,pageSize:k=10,wordLimit:C,noCopyright:b=!1,login:A="enable",recaptchaV3Key:m="",turnstileKey:S="",commentSorting:U="latest",emoji:I=Be,imageUploader:y,highlighter:j,texRenderer:o,search:v,reaction:K,...X})=>({serverURL:Sl(e),path:Al(a),lang:Je(t),locale:{...gl(Je(t)),...typeof l=="object"?l:{}},wordLimit:jl(C),meta:We(r),requiredMeta:We(d),dark:M,pageSize:k,commentSorting:U,login:A,noCopyright:b,recaptchaV3Key:m,turnstileKey:S,...X,reaction:ie(K,tl),imageUploader:ie(y,ll),highlighter:ie(j,ul),texRenderer:ie(o,al),emoji:ie(I,Be),search:ie(v,nl(t))}),Ie=e=>typeof e=="string",Ee="{--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}",Rl=e=>Ie(e)?e==="auto"?`@media(prefers-color-scheme:dark){body${Ee}}`:`${e}${Ee}`:e===!0?`:root${Ee}`:"",Le=(e,a)=>{let t=e.toString();for(;t.length<a;)t="0"+t;return t},Vl=e=>{const a=Le(e.getDate(),2),t=Le(e.getMonth()+1,2);return`${Le(e.getFullYear(),2)}-${t}-${a}`},Ul=(e,a,t)=>{if(!e)return"";const l=Ie(e)?new Date(e.includes(" ")?e.replace(/-/g,"/"):e):e,r=a.getTime()-l.getTime(),d=Math.floor(r/(24*3600*1e3));if(d===0){const M=r%864e5,k=Math.floor(M/(3600*1e3));if(k===0){const C=M%36e5,b=Math.floor(C/(60*1e3));if(b===0){const A=C%6e4;return`${Math.round(A/1e3)} ${t.seconds}`}return`${b} ${t.minutes}`}return`${k} ${t.hours}`}return d<0?t.now:d<8?`${d} ${t.days}`:Vl(l)},_l=/^[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])?)*$/,Hl=e=>_l.test(e),Tl="WALINE_EMOJI",lt=ne(Tl,{}),Fl=e=>!!/@[0-9]+\.[0-9]+\.[0-9]+/.test(e),Nl=e=>{const a=Fl(e);if(a){const t=lt.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&&(lt.value[e]=l),l})},at=(e,a="",t="",l="")=>`${a?`${a}/`:""}${t}${e}${l?`.${l}`:""}`,Wl=e=>Promise.all(e?e.map(a=>Ie(a)?Nl(et(a)):Promise.resolve(a)):[]).then(a=>{const t={tabs:[],map:{}};return a.forEach(l=>{const{name:r,folder:d,icon:M,prefix:k="",type:C,items:b}=l;t.tabs.push({name:r,icon:at(M,d,k,C),items:b.map(A=>{const m=`${k}${A}`;return t.map[m]=at(A,d,k,C),m})})}),t}),Bl=e=>e.type.includes("image"),nt=e=>{const a=Array.from(e).find(Bl);return a?a.getAsFile():null},Dl=/\$.*?\$/,Pl=/^\$(.*?)\$/,ql=/^(?:\s{0,3})\$\$((?:[^\n]|\n[^\n])+?)\n{0,1}\$\$/,Gl=e=>[{name:"blockMath",level:"block",tokenizer(a){const t=ql.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(Dl);return t!==-1?t:a.length},tokenizer(a){const t=Pl.exec(a);if(t!==null)return{type:"html",raw:t[0],text:e(!1,t[1])}}}],it=(e="",a={})=>e.replace(/:(.+?):/g,(t,l)=>a[l]?`<img class="wl-emoji" src="${a[l]}" alt="${l}">`:t),Ol=(e,{emojiMap:a,highlighter:t,texRenderer:l})=>{const r=new St;if(r.setOptions({breaks:!0}),t&&r.use(jt({highlight:t})),l){const d=Gl(l);r.use({extensions:d})}return r.parse(it(e,a))},Kl=e=>e.match(/[\w\d\s,.\u00C0-\u024F\u0400-\u04FF]+/giu),Zl=e=>e.match(/[\u4E00-\u9FD5]/gu),Xl=e=>{var a,t;return(((a=Kl(e))==null?void 0:a.reduce((l,r)=>l+(["",",","."].includes(r.trim())?0:r.trim().split(/\s+/u).length),0))??0)+(((t=Zl(e))==null?void 0:t.length)??0)},Yl=async()=>{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},Jl={key:0,class:"wl-login-info"},Ql={class:"wl-avatar"},ea=["title"],ta=["title"],la=["src"],aa=["title","textContent"],na={class:"wl-panel"},ia=["for","textContent"],ra=["id","onUpdate:modelValue","name","type"],oa=["placeholder"],sa={class:"wl-preview"},ca=["innerHTML"],ua={class:"wl-footer"},ma={class:"wl-actions"},va={href:"https://guides.github.com/features/mastering-markdown/",title:"Markdown Guide","aria-label":"Markdown is supported",class:"wl-action",target:"_blank",rel:"noopener noreferrer"},da=["title"],pa=["title"],ga=["title","aria-label"],ha=["title"],fa={class:"wl-info"},ya={class:"wl-text-number"},wa={key:0},ka=["textContent"],ba=["textContent"],Ca=["disabled"],$a=["placeholder"],Ia={key:1,class:"wl-loading"},Ea={key:0,class:"wl-tab-wrapper"},La=["title","onClick"],xa=["src","alt"],Ma={key:0,class:"wl-tabs"},Aa=["onClick"],Sa=["src","alt","title"],ja=["title"];var rt=oe({__name:"CommentBox",props:{edit:{},rootId:{},replyId:{},replyUser:{}},emits:["log","cancelEdit","cancelReply","submit"],setup(e,{emit:a}){const t=e,l=a,r=we(he),d=Pt(),M=Dt(),k=be(),C=R({}),b=te("textarea"),A=te("image-uploader"),m=te("emoji-button"),S=te("emoji-popup"),U=te("gif-button"),I=te("gif-popup"),y=te("gif-search"),j=R({tabs:[],map:{}}),o=R(0),v=R(!1),K=R(!1),X=R(!1),E=R(""),V=R(0),T=pt({loading:!0,list:[]}),ae=R(0),Q=R(!1),ue=R(""),p=R(!1),z=R(!1),g=W(()=>r.value.locale),F=W(()=>!!k.value.token),q=W(()=>bt(r.value.imageUploader)),G=c=>{const n=b.value,f=n.selectionStart,H=n.selectionEnd||0,h=n.scrollTop;d.value=n.value.substring(0,f)+c+n.value.substring(H,n.value.length),n.focus(),n.selectionStart=f+c.length,n.selectionEnd=f+c.length,n.scrollTop=h},re=({key:c,ctrlKey:n,metaKey:f})=>{p.value||(n||f)&&c==="Enter"&&xe()},me=async c=>{const n=`![${r.value.locale.uploading} ${c.name}]()`;G(n),p.value=!0;try{const f=await r.value.imageUploader(c);d.value=d.value.replace(n,`\r
|
|
11
|
-
`)}catch(f){alert(f.message),d.value=d.value.replace(n,"")}finally{p.value=!1}},fe=c=>{var n;if((n=c.dataTransfer)!=null&&n.items){const f=nt(c.dataTransfer.items);f&&q.value&&(me(f),c.preventDefault())}},st=c=>{if(c.clipboardData){const n=nt(c.clipboardData.items);n&&q.value&&me(n)}},ct=()=>{const c=A.value;c.files&&q.value&&me(c.files[0]).then(()=>{c.value=""})},xe=async()=>{var c;const{serverURL:n,lang:f,login:H,wordLimit:h,requiredMeta:D,recaptchaV3Key:N,turnstileKey:Y}=r.value,_={comment:ue.value,nick:M.value.nick,mail:M.value.mail,link:M.value.link,url:r.value.path,ua:await Yl()};if(!t.edit)if(k.value.token)_.nick=k.value.display_name,_.mail=k.value.email,_.link=k.value.url;else{if(H==="force")return;if(D.includes("nick")&&!_.nick){C.value.nick.focus(),alert(g.value.nickError);return}if(D.includes("mail")&&!_.mail||_.mail&&!Hl(_.mail)){C.value.mail.focus(),alert(g.value.mailError);return}_.nick||(_.nick=g.value.anonymous)}if(!_.comment){b.value.focus();return}if(!Q.value){alert(g.value.wordHint.replace("$0",h[0].toString()).replace("$1",h[1].toString()).replace("$2",V.value.toString()));return}_.comment=it(_.comment,j.value.map),t.replyId&&t.rootId&&(_.pid=t.replyId,_.rid=t.rootId,_.at=t.replyUser),p.value=!0;try{N&&(_.recaptchaV3=await Xt(N).execute("social")),Y&&(_.turnstile=await Yt(Y).execute("social"));const ve={serverURL:n,lang:f,token:k.value.token,comment:_},ye=await(t.edit?ge({objectId:t.edit.objectId,...ve}):Lt(ve));if(p.value=!1,ye.errmsg){alert(ye.errmsg);return}l("submit",ye.data),d.value="",E.value="",await Re(),t.replyId&&l("cancelReply"),(c=t.edit)!=null&&c.objectId&&l("cancelEdit")}catch(ve){p.value=!1,alert(ve.message)}},ut=c=>{c.preventDefault();const{lang:n,serverURL:f}=r.value;xt({serverURL:f,lang:n}).then(H=>{k.value=H,(H.remember?localStorage:sessionStorage).setItem("WALINE_USER",JSON.stringify(H)),l("log")})},mt=()=>{k.value={},localStorage.setItem("WALINE_USER","null"),sessionStorage.setItem("WALINE_USER","null"),l("log")},Me=c=>{c.preventDefault();const{lang:n,serverURL:f}=r.value,H=800,h=800,D=(window.innerWidth-H)/2,N=(window.innerHeight-h)/2,Y=new URLSearchParams({lng:n,token:k.value.token}),_=window.open(`${f}/ui/profile?${Y.toString()}`,"_blank",`width=${H},height=${h},left=${D},top=${N},scrollbars=no,resizable=no,status=no,location=no,toolbar=no,menubar=no`);_==null||_.postMessage({type:"TOKEN",data:k.value.token},"*")},vt=c=>{var n,f,H,h;!((n=m.value)!=null&&n.contains(c.target))&&!((f=S.value)!=null&&f.contains(c.target))&&(v.value=!1),!((H=U.value)!=null&&H.contains(c.target))&&!((h=I.value)!=null&&h.contains(c.target))&&(K.value=!1)},Ae=async c=>{var n;const{scrollTop:f,clientHeight:H,scrollHeight:h}=c.target,D=(H+f)/h,N=r.value.search,Y=((n=y.value)==null?void 0:n.value)??"";D<.9||T.loading||z.value||(T.loading=!0,(N.more&&T.list.length?await N.more(Y,T.list.length):await N.search(Y)).length?T.list=[...T.list,...N.more&&T.list.length?await N.more(Y,T.list.length):await N.search(Y)]:z.value=!0,T.loading=!1,setTimeout(()=>{c.target.scrollTop=f},50))},Se=Ct(c=>{T.list=[],z.value=!1,Ae(c)},300);return Ue("click",vt),Ue("message",({data:c})=>{!c||c.type!=="profile"||(k.value={...k.value,...c.data},[localStorage,sessionStorage].filter(n=>n.getItem("WALINE_USER")).forEach(n=>{n.setItem("WALINE_USER",JSON.stringify(k))}))}),se([r,V],([c,n])=>{const{wordLimit:f}=c;f?n<f[0]&&f[0]!==0?(ae.value=f[0],Q.value=!1):n>f[1]?(ae.value=f[1],Q.value=!1):(ae.value=f[1],Q.value=!0):(ae.value=0,Q.value=!0)}),ke(K,async c=>{var n;if(!c)return;const f=r.value.search;y.value&&(y.value.value=""),T.loading=!0,T.list=await(((n=f.default)==null?void 0:n.call(f))??f.search("")),T.loading=!1}),de(()=>{var c;(c=t.edit)!=null&&c.objectId&&(d.value=t.edit.orig),se(()=>d.value,n=>{const{highlighter:f,texRenderer:H}=r.value;ue.value=n,E.value=Ol(n,{emojiMap:j.value.map,highlighter:f,texRenderer:H}),V.value=Xl(n),n?He(b.value):He.destroy(b.value)}),se(()=>r.value.emoji,async n=>{j.value=await Wl(n)})}),(c,n)=>{var f,H;return i(),s("div",{key:w(k).token,class:"wl-comment"},[w(r).login!=="disable"&&F.value&&!((f=c.edit)!=null&&f.objectId)?(i(),s("div",Jl,[u("div",Ql,[u("button",{type:"submit",class:"wl-logout-btn",title:g.value.logout,onClick:mt},[O(w(Te),{size:14})],8,ea),u("a",{href:"#",class:"wl-login-nick","aria-label":"Profile",title:g.value.profile,onClick:Me},[u("img",{src:w(k).avatar,alt:"avatar"},null,8,la)],8,ta)]),u("a",{href:"#",class:"wl-login-nick","aria-label":"Profile",title:g.value.profile,onClick:Me,textContent:L(w(k).display_name)},null,8,aa)])):$("v-if",!0),u("div",na,[w(r).login!=="force"&&w(r).meta.length&&!F.value?(i(),s("div",{key:0,class:P(["wl-header",`item${w(r).meta.length}`])},[(i(!0),s(B,null,Z(w(r).meta,h=>(i(),s("div",{key:h,class:"wl-header-item"},[u("label",{for:`wl-${h}`,textContent:L(g.value[h]+(w(r).requiredMeta.includes(h)||!w(r).requiredMeta.length?"":`(${g.value.optional})`))},null,8,ia),pe(u("input",{id:`wl-${h}`,ref_for:!0,ref:D=>{D&&(C.value[h]=D)},"onUpdate:modelValue":D=>w(M)[h]=D,class:P(["wl-input",`wl-${h}`]),name:h,type:h==="mail"?"email":"text"},null,10,ra),[[gt,w(M)[h]]])]))),128))],2)):$("v-if",!0),pe(u("textarea",{id:"wl-edit",ref:"textarea","onUpdate:modelValue":n[0]||(n[0]=h=>ht(d)?d.value=h:null),class:"wl-editor",placeholder:c.replyUser?`@${c.replyUser}`:g.value.placeholder,onKeydown:re,onDrop:fe,onPaste:st},null,40,oa),[[ft,w(d)]]),pe(u("div",sa,[n[7]||(n[7]=u("hr",null,null,-1)),u("h4",null,L(g.value.preview)+":",1),u("div",{class:"wl-content",innerHTML:E.value},null,8,ca)],512),[[Ve,X.value]]),u("div",ua,[u("div",ma,[u("a",va,[O(w(Tt))]),pe(u("button",{ref:"emoji-button",type:"button",class:P(["wl-action",{active:v.value}]),title:g.value.emoji,onClick:n[1]||(n[1]=h=>v.value=!v.value)},[O(w(Vt))],10,da),[[Ve,j.value.tabs.length]]),w(r).search?(i(),s("button",{key:0,ref:"gif-button",type:"button",class:P(["wl-action",{active:K.value}]),title:g.value.gif,onClick:n[2]||(n[2]=h=>K.value=!K.value)},[O(w(Bt))],10,pa)):$("v-if",!0),u("input",{id:"wl-image-upload",ref:"image-uploader",class:"upload","aria-hidden":"true",type:"file",accept:".png,.jpg,.jpeg,.webp,.bmp,.gif",onChange:ct},null,544),q.value?(i(),s("label",{key:1,for:"wl-image-upload",class:"wl-action",title:g.value.uploadImage,"aria-label":g.value.uploadImage},[O(w(Ut))],8,ga)):$("v-if",!0),u("button",{type:"button",class:P(["wl-action",{active:X.value}]),title:g.value.preview,onClick:n[3]||(n[3]=h=>X.value=!X.value)},[O(w(Ht))],10,ha)]),u("div",fa,[n[9]||(n[9]=u("div",{class:"wl-captcha-container"},null,-1)),u("div",ya,[le(L(V.value)+" ",1),w(r).wordLimit?(i(),s("span",wa,[n[8]||(n[8]=le(" / ")),u("span",{class:P({illegal:!Q.value}),textContent:L(ae.value)},null,10,ka)])):$("v-if",!0),le(" "+L(g.value.word),1)]),w(r).login!=="disable"&&!F.value?(i(),s("button",{key:0,type:"button",class:"wl-btn",onClick:ut,textContent:L(g.value.login)},null,8,ba)):$("v-if",!0),w(r).login!=="force"||F.value?(i(),s("button",{key:1,type:"submit",class:"primary wl-btn",title:"Cmd|Ctrl + Enter",disabled:p.value,onClick:xe},[p.value?(i(),ee(w(ce),{key:0,size:16})):(i(),s(B,{key:1},[le(L(g.value.submit),1)],64))],8,Ca)):$("v-if",!0)]),u("div",{ref:"gif-popup",class:P(["wl-gif-popup",{display:K.value}])},[u("input",{ref:"gif-search",type:"text",placeholder:g.value.gifSearchPlaceholder,onInput:n[4]||(n[4]=(...h)=>w(Se)&&w(Se)(...h))},null,40,$a),T.list.length?(i(),ee(Ml,{key:0,items:T.list,"column-width":200,gap:6,onInsert:n[5]||(n[5]=h=>G(h)),onScroll:Ae},null,8,["items"])):$("v-if",!0),T.loading?(i(),s("div",Ia,[O(w(ce),{size:30})])):$("v-if",!0)],2),u("div",{ref:"emoji-popup",class:P(["wl-emoji-popup",{display:v.value}])},[(i(!0),s(B,null,Z(j.value.tabs,(h,D)=>(i(),s(B,{key:h.name},[D===o.value?(i(),s("div",Ea,[(i(!0),s(B,null,Z(h.items,N=>(i(),s("button",{key:N,type:"button",title:N,onClick:Y=>G(`:${N}:`)},[v.value?(i(),s("img",{key:0,class:"wl-emoji",src:j.value.map[N],alt:N,loading:"lazy",referrerPolicy:"no-referrer"},null,8,xa)):$("v-if",!0)],8,La))),128))])):$("v-if",!0)],64))),128)),j.value.tabs.length>1?(i(),s("div",Ma,[(i(!0),s(B,null,Z(j.value.tabs,(h,D)=>(i(),s("button",{key:h.name,type:"button",class:P(["wl-tab",{active:o.value===D}]),onClick:N=>o.value=D},[u("img",{class:"wl-emoji",src:h.icon,alt:h.name,title:h.name,loading:"lazy",referrerPolicy:"no-referrer"},null,8,Sa)],10,Aa))),128))])):$("v-if",!0)],2)])]),c.replyId||(H=c.edit)!=null&&H.objectId?(i(),s("button",{key:1,type:"button",class:"wl-close",title:g.value.cancelReply,onClick:n[6]||(n[6]=h=>c.replyId?l("cancelReply"):l("cancelEdit"))},[O(w(Te),{size:24})],8,ja)):$("v-if",!0)])}}});const za=["id"],Ra={class:"wl-user","aria-hidden":"true"},Va=["src"],Ua={class:"wl-card"},_a={class:"wl-head"},Ha=["href"],Ta={key:1,class:"wl-nick"},Fa=["textContent"],Na=["textContent"],Wa=["textContent"],Ba=["textContent"],Da=["textContent"],Pa={class:"wl-comment-actions"},qa=["title"],Ga=["title"],Oa={class:"wl-meta","aria-hidden":"true"},Ka=["data-value","textContent"],Za={key:0,class:"wl-content"},Xa={key:0},Ya=["href"],Ja=["innerHTML"],Qa={key:1,class:"wl-admin-actions"},en={class:"wl-comment-status"},tn=["disabled","onClick","textContent"],ln={key:3,class:"wl-quote"};var an=oe({__name:"CommentCard",props:{comment:{},edit:{},rootId:{},reply:{}},emits:["log","submit","delete","like","sticky","edit","reply","status"],setup(e,{emit:a}){const t=e,l=a,r=["approved","waiting","spam"],d=we(he),M=Fe(),k=$t(),C=be(),b=W(()=>d.value.locale),A=W(()=>{const{link:o}=t.comment;return o?tt(o)?o:`https://${o}`:""}),m=W(()=>M.value.includes(t.comment.objectId)),S=W(()=>Ul(new Date(t.comment.time),k.value,b.value)),U=W(()=>C.value.type==="administrator"),I=W(()=>t.comment.user_id&&C.value.objectId===t.comment.user_id),y=W(()=>{var o;return t.comment.objectId===((o=t.reply)==null?void 0:o.objectId)}),j=W(()=>{var o;return t.comment.objectId===((o=t.edit)==null?void 0:o.objectId)});return(o,v)=>{var K;const X=yt("CommentCard",!0);return i(),s("div",{id:o.comment.objectId.toString(),class:"wl-card-item"},[u("div",Ra,[o.comment.avatar?(i(),s("img",{key:0,class:"wl-user-avatar",src:o.comment.avatar,alt:""},null,8,Va)):$("v-if",!0),o.comment.type?(i(),ee(w(Wt),{key:1})):$("v-if",!0)]),u("div",Ua,[u("div",_a,[A.value?(i(),s("a",{key:0,class:"wl-nick",href:A.value,target:"_blank",rel:"nofollow noopener noreferrer"},L(o.comment.nick),9,Ha)):(i(),s("span",Ta,L(o.comment.nick),1)),o.comment.type==="administrator"?(i(),s("span",{key:2,class:"wl-badge",textContent:L(b.value.admin)},null,8,Fa)):$("v-if",!0),o.comment.label?(i(),s("span",{key:3,class:"wl-badge",textContent:L(o.comment.label)},null,8,Na)):$("v-if",!0),o.comment.sticky?(i(),s("span",{key:4,class:"wl-badge",textContent:L(b.value.sticky)},null,8,Wa)):$("v-if",!0),typeof o.comment.level=="number"?(i(),s("span",{key:5,class:P(`wl-badge level${o.comment.level}`),textContent:L(b.value[`level${o.comment.level}`]||`Level ${o.comment.level}`)},null,10,Ba)):$("v-if",!0),u("span",{class:"wl-time",textContent:L(S.value)},null,8,Da),u("div",Pa,[U.value||I.value?(i(),s(B,{key:0},[u("button",{type:"button",class:"wl-edit",onClick:v[0]||(v[0]=E=>l("edit",o.comment))},[O(w(Nt))]),u("button",{type:"button",class:"wl-delete",onClick:v[1]||(v[1]=E=>l("delete",o.comment))},[O(w(Rt))])],64)):$("v-if",!0),u("button",{type:"button",class:"wl-like",title:m.value?b.value.cancelLike:b.value.like,onClick:v[2]||(v[2]=E=>l("like",o.comment))},[O(w(_t),{active:m.value},null,8,["active"]),le(" "+L("like"in o.comment?o.comment.like:""),1)],8,qa),u("button",{type:"button",class:P(["wl-reply",{active:y.value}]),title:y.value?b.value.cancelReply:b.value.reply,onClick:v[3]||(v[3]=E=>l("reply",y.value?null:o.comment))},[O(w(Ft))],10,Ga)])]),u("div",Oa,[(i(),s(B,null,Z(["addr","browser","os"],E=>(i(),s(B,null,[o.comment[E]?(i(),s("span",{key:E,class:P(`wl-${E}`),"data-value":o.comment[E],textContent:L(o.comment[E])},null,10,Ka)):$("v-if",!0)],64))),64))]),j.value?$("v-if",!0):(i(),s("div",Za,["reply_user"in o.comment&&o.comment.reply_user?(i(),s("p",Xa,[u("a",{href:"#"+o.comment.pid},"@"+L(o.comment.reply_user.nick),9,Ya),v[17]||(v[17]=u("span",null,": ",-1))])):$("v-if",!0),u("div",{innerHTML:o.comment.comment},null,8,Ja)])),U.value&&!j.value?(i(),s("div",Qa,[u("span",en,[(i(),s(B,null,Z(r,E=>u("button",{key:E,type:"submit",class:P(`wl-btn wl-${E}`),disabled:o.comment.status===E,onClick:V=>l("status",{status:E,comment:o.comment}),textContent:L(b.value[E])},null,10,tn)),64))]),U.value&&!("rid"in o.comment)?(i(),s("button",{key:0,type:"submit",class:"wl-btn wl-sticky",onClick:v[4]||(v[4]=E=>l("sticky",o.comment))},L(o.comment.sticky?b.value.unsticky:b.value.sticky),1)):$("v-if",!0)])):$("v-if",!0),y.value||j.value?(i(),s("div",{key:2,class:P({"wl-reply-wrapper":y.value,"wl-edit-wrapper":j.value})},[O(rt,{edit:o.edit,"reply-id":(K=o.reply)==null?void 0:K.objectId,"reply-user":o.comment.nick,"root-id":o.rootId,onLog:v[5]||(v[5]=E=>l("log")),onCancelReply:v[6]||(v[6]=E=>l("reply",null)),onCancelEdit:v[7]||(v[7]=E=>l("edit",null)),onSubmit:v[8]||(v[8]=E=>l("submit",E))},null,8,["edit","reply-id","reply-user","root-id"])],2)):$("v-if",!0),"children"in o.comment?(i(),s("div",ln,[(i(!0),s(B,null,Z(o.comment.children,E=>(i(),ee(X,{key:E.objectId,comment:E,reply:o.reply,edit:o.edit,"root-id":o.rootId,onLog:v[9]||(v[9]=V=>l("log")),onDelete:v[10]||(v[10]=V=>l("delete",V)),onEdit:v[11]||(v[11]=V=>l("edit",V)),onLike:v[12]||(v[12]=V=>l("like",V)),onReply:v[13]||(v[13]=V=>l("reply",V)),onStatus:v[14]||(v[14]=V=>l("status",V)),onSticky:v[15]||(v[15]=V=>l("sticky",V)),onSubmit:v[16]||(v[16]=V=>l("submit",V))},null,8,["comment","reply","edit","root-id"]))),128))])):$("v-if",!0)])],8,za)}}});const ot="3.5.3",nn={"data-waline":""},rn={class:"wl-meta-head"},on={class:"wl-count"},sn=["textContent"],cn={class:"wl-sort"},un=["onClick"],mn={class:"wl-cards"},vn={key:1,class:"wl-operation"},dn=["textContent"],pn={key:2,class:"wl-loading"},gn=["textContent"],hn={key:4,class:"wl-operation"},fn=["textContent"],yn={key:5,class:"wl-power"};var wn=oe({__name:"WalineComment",props:{serverURL:{},path:{},meta:{},requiredMeta:{},wordLimit:{},pageSize:{},lang:{},locale:{},commentSorting:{},dark:{type:[String,Boolean]},login:{},noCopyright:{type:Boolean},recaptchaV3Key:{},turnstileKey:{},reaction:{},emoji:{},search:{},highlighter:{type:Function},imageUploader:{type:Function},texRenderer:{type:Function}},setup(e){const a=e,t=be(),l=Fe(),r=R("loading"),d=R(0),M=R(1),k=R(0),C=W(()=>zl(a)),b=R(C.value.commentSorting),A=R([]),m=R(null),S=R(null),U=W(()=>Rl(C.value.dark)),I=W(()=>C.value.locale);It(U,{id:"waline-darkmode"});let y=null;const j=p=>{const{serverURL:z,path:g,pageSize:F}=C.value,q=new AbortController;r.value="loading",y==null||y(),At({serverURL:z,lang:C.value.lang,path:g,pageSize:F,sortBy:Qe[b.value],page:p,signal:q.signal,token:t.value.token}).then(G=>{r.value="success",d.value=G.count,A.value.push(...G.data),M.value=p,k.value=G.totalPages}).catch(G=>{G.name!=="AbortError"&&(console.error(G.message),r.value="error")}),y=q.abort.bind(q)},o=()=>{j(M.value+1)},v=()=>{d.value=0,A.value=[],j(1)},K=p=>{b.value!==p&&(b.value=p,v())},X=p=>{m.value=p},E=p=>{S.value=p},V=p=>{if(S.value)S.value.comment=p.comment,S.value.orig=p.orig;else if("rid"in p){const z=A.value.find(({objectId:g})=>g===p.rid);if(!z)return;Array.isArray(z.children)||(z.children=[]),z.children.push(p)}else A.value.unshift(p),d.value+=1},T=async({comment:p,status:z})=>{if(p.status===z)return;const{serverURL:g,lang:F}=C.value;await ge({serverURL:g,lang:F,token:t.value.token,objectId:p.objectId,comment:{status:z}}),p.status=z},ae=async p=>{if("rid"in p)return;const{serverURL:z,lang:g}=C.value;await ge({serverURL:z,lang:g,token:t.value.token,objectId:p.objectId,comment:{sticky:p.sticky?0:1}}),p.sticky=!p.sticky},Q=async({objectId:p})=>{if(!confirm("Are you sure you want to delete this comment?"))return;const{serverURL:z,lang:g}=C.value;await Mt({serverURL:z,lang:g,token:t.value.token,objectId:p}),A.value.some((F,q)=>F.objectId===p?(A.value=A.value.filter((G,re)=>re!==q),!0):F.children.some((G,re)=>G.objectId===p?(A.value[q].children=F.children.filter((me,fe)=>fe!==re),!0):!1))},ue=async p=>{const{serverURL:z,lang:g}=C.value,{objectId:F}=p,q=l.value.includes(F);await ge({serverURL:z,lang:g,objectId:F,token:t.value.token,comment:{like:!q}}),q?l.value=l.value.filter(G=>G!==F):(l.value=[...l.value,F],l.value.length>50&&(l.value=l.value.slice(-50))),p.like=Math.max(0,(p.like||0)+(q?-1:1))};return wt(he,C),de(()=>{se(()=>[a.serverURL,a.path],()=>{v()})}),je(()=>{y==null||y()}),(p,z)=>(i(),s("div",nn,[O(El),!m.value&&!S.value?(i(),ee(rt,{key:0,onLog:v,onSubmit:V})):$("v-if",!0),u("div",rn,[u("div",on,[d.value?(i(),s("span",{key:0,class:"wl-num",textContent:L(d.value)},null,8,sn)):$("v-if",!0),le(" "+L(I.value.comment),1)]),u("ul",cn,[(i(!0),s(B,null,Z(w(hl),g=>(i(),s("li",{key:g,class:P([g===b.value?"active":""]),onClick:F=>K(g)},L(I.value[g]),11,un))),128))])]),u("div",mn,[(i(!0),s(B,null,Z(A.value,g=>(i(),ee(an,{key:g.objectId,"root-id":g.objectId,comment:g,reply:m.value,edit:S.value,onLog:v,onReply:X,onEdit:E,onSubmit:V,onStatus:T,onDelete:Q,onSticky:ae,onLike:ue},null,8,["root-id","comment","reply","edit"]))),128))]),r.value==="error"?(i(),s("div",vn,[u("button",{type:"button",class:"wl-btn",onClick:v,textContent:L(I.value.refresh)},null,8,dn)])):r.value==="loading"?(i(),s("div",pn,[O(w(ce),{size:30})])):A.value.length?M.value<k.value?(i(),s("div",hn,[u("button",{type:"button",class:"wl-btn",onClick:o,textContent:L(I.value.more)},null,8,fn)])):$("v-if",!0):(i(),s("div",{key:3,class:"wl-empty",textContent:L(I.value.sofa)},null,8,gn)),C.value.noCopyright?$("v-if",!0):(i(),s("div",yn,[z[0]||(z[0]=le(" Powered by ")),z[1]||(z[1]=u("a",{href:"https://github.com/walinejs/waline",target:"_blank",rel:"noopener noreferrer"}," Waline ",-1)),le(" v"+L(w(ot)),1)]))]))}});export{wn as Waline,ot as version};
|
|
11
|
+
`)}catch(f){alert(f.message),d.value=d.value.replace(n,"")}finally{p.value=!1}},fe=c=>{var n;if((n=c.dataTransfer)!=null&&n.items){const f=nt(c.dataTransfer.items);f&&q.value&&(me(f),c.preventDefault())}},st=c=>{if(c.clipboardData){const n=nt(c.clipboardData.items);n&&q.value&&me(n)}},ct=()=>{const c=A.value;c.files&&q.value&&me(c.files[0]).then(()=>{c.value=""})},xe=async()=>{var c;const{serverURL:n,lang:f,login:H,wordLimit:h,requiredMeta:D,recaptchaV3Key:N,turnstileKey:Y}=r.value,_={comment:ue.value,nick:M.value.nick,mail:M.value.mail,link:M.value.link,url:r.value.path,ua:await Yl()};if(!t.edit)if(k.value.token)_.nick=k.value.display_name,_.mail=k.value.email,_.link=k.value.url;else{if(H==="force")return;if(D.includes("nick")&&!_.nick){C.value.nick.focus(),alert(g.value.nickError);return}if(D.includes("mail")&&!_.mail||_.mail&&!Hl(_.mail)){C.value.mail.focus(),alert(g.value.mailError);return}_.nick||(_.nick=g.value.anonymous)}if(!_.comment){b.value.focus();return}if(!Q.value){alert(g.value.wordHint.replace("$0",h[0].toString()).replace("$1",h[1].toString()).replace("$2",V.value.toString()));return}_.comment=it(_.comment,j.value.map),t.replyId&&t.rootId&&(_.pid=t.replyId,_.rid=t.rootId,_.at=t.replyUser),p.value=!0;try{N&&(_.recaptchaV3=await Xt(N).execute("social")),Y&&(_.turnstile=await Yt(Y).execute("social"));const ve={serverURL:n,lang:f,token:k.value.token,comment:_},ye=await(t.edit?ge({objectId:t.edit.objectId,...ve}):Lt(ve));if(p.value=!1,ye.errmsg){alert(ye.errmsg);return}l("submit",ye.data),d.value="",E.value="",await Re(),t.replyId&&l("cancelReply"),(c=t.edit)!=null&&c.objectId&&l("cancelEdit")}catch(ve){p.value=!1,alert(ve.message)}},ut=c=>{c.preventDefault();const{lang:n,serverURL:f}=r.value;xt({serverURL:f,lang:n}).then(H=>{k.value=H,(H.remember?localStorage:sessionStorage).setItem("WALINE_USER",JSON.stringify(H)),l("log")})},mt=()=>{k.value={},localStorage.setItem("WALINE_USER","null"),sessionStorage.setItem("WALINE_USER","null"),l("log")},Me=c=>{c.preventDefault();const{lang:n,serverURL:f}=r.value,H=800,h=800,D=(window.innerWidth-H)/2,N=(window.innerHeight-h)/2,Y=new URLSearchParams({lng:n,token:k.value.token}),_=window.open(`${f}/ui/profile?${Y.toString()}`,"_blank",`width=${H},height=${h},left=${D},top=${N},scrollbars=no,resizable=no,status=no,location=no,toolbar=no,menubar=no`);_==null||_.postMessage({type:"TOKEN",data:k.value.token},"*")},vt=c=>{var n,f,H,h;!((n=m.value)!=null&&n.contains(c.target))&&!((f=S.value)!=null&&f.contains(c.target))&&(v.value=!1),!((H=U.value)!=null&&H.contains(c.target))&&!((h=I.value)!=null&&h.contains(c.target))&&(K.value=!1)},Ae=async c=>{var n;const{scrollTop:f,clientHeight:H,scrollHeight:h}=c.target,D=(H+f)/h,N=r.value.search,Y=((n=y.value)==null?void 0:n.value)??"";D<.9||T.loading||z.value||(T.loading=!0,(N.more&&T.list.length?await N.more(Y,T.list.length):await N.search(Y)).length?T.list=[...T.list,...N.more&&T.list.length?await N.more(Y,T.list.length):await N.search(Y)]:z.value=!0,T.loading=!1,setTimeout(()=>{c.target.scrollTop=f},50))},Se=Ct(c=>{T.list=[],z.value=!1,Ae(c)},300);return Ue("click",vt),Ue("message",({data:c})=>{!c||c.type!=="profile"||(k.value={...k.value,...c.data},[localStorage,sessionStorage].filter(n=>n.getItem("WALINE_USER")).forEach(n=>{n.setItem("WALINE_USER",JSON.stringify(k))}))}),se([r,V],([c,n])=>{const{wordLimit:f}=c;f?n<f[0]&&f[0]!==0?(ae.value=f[0],Q.value=!1):n>f[1]?(ae.value=f[1],Q.value=!1):(ae.value=f[1],Q.value=!0):(ae.value=0,Q.value=!0)}),ke(K,async c=>{var n;if(!c)return;const f=r.value.search;y.value&&(y.value.value=""),T.loading=!0,T.list=await(((n=f.default)==null?void 0:n.call(f))??f.search("")),T.loading=!1}),de(()=>{var c;(c=t.edit)!=null&&c.objectId&&(d.value=t.edit.orig),se(()=>d.value,n=>{const{highlighter:f,texRenderer:H}=r.value;ue.value=n,E.value=Ol(n,{emojiMap:j.value.map,highlighter:f,texRenderer:H}),V.value=Xl(n),n?He(b.value):He.destroy(b.value)}),se(()=>r.value.emoji,async n=>{j.value=await Wl(n)})}),(c,n)=>{var f,H;return i(),s("div",{key:w(k).token,class:"wl-comment"},[w(r).login!=="disable"&&F.value&&!((f=c.edit)!=null&&f.objectId)?(i(),s("div",Jl,[u("div",Ql,[u("button",{type:"submit",class:"wl-logout-btn",title:g.value.logout,onClick:mt},[O(w(Te),{size:14})],8,ea),u("a",{href:"#",class:"wl-login-nick","aria-label":"Profile",title:g.value.profile,onClick:Me},[u("img",{src:w(k).avatar,alt:"avatar"},null,8,la)],8,ta)]),u("a",{href:"#",class:"wl-login-nick","aria-label":"Profile",title:g.value.profile,onClick:Me,textContent:L(w(k).display_name)},null,8,aa)])):$("v-if",!0),u("div",na,[w(r).login!=="force"&&w(r).meta.length&&!F.value?(i(),s("div",{key:0,class:P(["wl-header",`item${w(r).meta.length}`])},[(i(!0),s(B,null,Z(w(r).meta,h=>(i(),s("div",{key:h,class:"wl-header-item"},[u("label",{for:`wl-${h}`,textContent:L(g.value[h]+(w(r).requiredMeta.includes(h)||!w(r).requiredMeta.length?"":`(${g.value.optional})`))},null,8,ia),pe(u("input",{id:`wl-${h}`,ref_for:!0,ref:D=>{D&&(C.value[h]=D)},"onUpdate:modelValue":D=>w(M)[h]=D,class:P(["wl-input",`wl-${h}`]),name:h,type:h==="mail"?"email":"text"},null,10,ra),[[gt,w(M)[h]]])]))),128))],2)):$("v-if",!0),pe(u("textarea",{id:"wl-edit",ref:"textarea","onUpdate:modelValue":n[0]||(n[0]=h=>ht(d)?d.value=h:null),class:"wl-editor",placeholder:c.replyUser?`@${c.replyUser}`:g.value.placeholder,onKeydown:re,onDrop:fe,onPaste:st},null,40,oa),[[ft,w(d)]]),pe(u("div",sa,[n[7]||(n[7]=u("hr",null,null,-1)),u("h4",null,L(g.value.preview)+":",1),u("div",{class:"wl-content",innerHTML:E.value},null,8,ca)],512),[[Ve,X.value]]),u("div",ua,[u("div",ma,[u("a",va,[O(w(Tt))]),pe(u("button",{ref:"emoji-button",type:"button",class:P(["wl-action",{active:v.value}]),title:g.value.emoji,onClick:n[1]||(n[1]=h=>v.value=!v.value)},[O(w(Vt))],10,da),[[Ve,j.value.tabs.length]]),w(r).search?(i(),s("button",{key:0,ref:"gif-button",type:"button",class:P(["wl-action",{active:K.value}]),title:g.value.gif,onClick:n[2]||(n[2]=h=>K.value=!K.value)},[O(w(Bt))],10,pa)):$("v-if",!0),u("input",{id:"wl-image-upload",ref:"image-uploader",class:"upload","aria-hidden":"true",type:"file",accept:".png,.jpg,.jpeg,.webp,.bmp,.gif",onChange:ct},null,544),q.value?(i(),s("label",{key:1,for:"wl-image-upload",class:"wl-action",title:g.value.uploadImage,"aria-label":g.value.uploadImage},[O(w(Ut))],8,ga)):$("v-if",!0),u("button",{type:"button",class:P(["wl-action",{active:X.value}]),title:g.value.preview,onClick:n[3]||(n[3]=h=>X.value=!X.value)},[O(w(Ht))],10,ha)]),u("div",fa,[n[9]||(n[9]=u("div",{class:"wl-captcha-container"},null,-1)),u("div",ya,[le(L(V.value)+" ",1),w(r).wordLimit?(i(),s("span",wa,[n[8]||(n[8]=le(" / ")),u("span",{class:P({illegal:!Q.value}),textContent:L(ae.value)},null,10,ka)])):$("v-if",!0),le(" "+L(g.value.word),1)]),w(r).login!=="disable"&&!F.value?(i(),s("button",{key:0,type:"button",class:"wl-btn",onClick:ut,textContent:L(g.value.login)},null,8,ba)):$("v-if",!0),w(r).login!=="force"||F.value?(i(),s("button",{key:1,type:"submit",class:"primary wl-btn",title:"Cmd|Ctrl + Enter",disabled:p.value,onClick:xe},[p.value?(i(),ee(w(ce),{key:0,size:16})):(i(),s(B,{key:1},[le(L(g.value.submit),1)],64))],8,Ca)):$("v-if",!0)]),u("div",{ref:"gif-popup",class:P(["wl-gif-popup",{display:K.value}])},[u("input",{ref:"gif-search",type:"text",placeholder:g.value.gifSearchPlaceholder,onInput:n[4]||(n[4]=(...h)=>w(Se)&&w(Se)(...h))},null,40,$a),T.list.length?(i(),ee(Ml,{key:0,items:T.list,"column-width":200,gap:6,onInsert:n[5]||(n[5]=h=>G(h)),onScroll:Ae},null,8,["items"])):$("v-if",!0),T.loading?(i(),s("div",Ia,[O(w(ce),{size:30})])):$("v-if",!0)],2),u("div",{ref:"emoji-popup",class:P(["wl-emoji-popup",{display:v.value}])},[(i(!0),s(B,null,Z(j.value.tabs,(h,D)=>(i(),s(B,{key:h.name},[D===o.value?(i(),s("div",Ea,[(i(!0),s(B,null,Z(h.items,N=>(i(),s("button",{key:N,type:"button",title:N,onClick:Y=>G(`:${N}:`)},[v.value?(i(),s("img",{key:0,class:"wl-emoji",src:j.value.map[N],alt:N,loading:"lazy",referrerPolicy:"no-referrer"},null,8,xa)):$("v-if",!0)],8,La))),128))])):$("v-if",!0)],64))),128)),j.value.tabs.length>1?(i(),s("div",Ma,[(i(!0),s(B,null,Z(j.value.tabs,(h,D)=>(i(),s("button",{key:h.name,type:"button",class:P(["wl-tab",{active:o.value===D}]),onClick:N=>o.value=D},[u("img",{class:"wl-emoji",src:h.icon,alt:h.name,title:h.name,loading:"lazy",referrerPolicy:"no-referrer"},null,8,Sa)],10,Aa))),128))])):$("v-if",!0)],2)])]),c.replyId||(H=c.edit)!=null&&H.objectId?(i(),s("button",{key:1,type:"button",class:"wl-close",title:g.value.cancelReply,onClick:n[6]||(n[6]=h=>c.replyId?l("cancelReply"):l("cancelEdit"))},[O(w(Te),{size:24})],8,ja)):$("v-if",!0)])}}});const za=["id"],Ra={class:"wl-user","aria-hidden":"true"},Va=["src"],Ua={class:"wl-card"},_a={class:"wl-head"},Ha=["href"],Ta={key:1,class:"wl-nick"},Fa=["textContent"],Na=["textContent"],Wa=["textContent"],Ba=["textContent"],Da=["textContent"],Pa={class:"wl-comment-actions"},qa=["title"],Ga=["title"],Oa={class:"wl-meta","aria-hidden":"true"},Ka=["data-value","textContent"],Za={key:0,class:"wl-content"},Xa={key:0},Ya=["href"],Ja=["innerHTML"],Qa={key:1,class:"wl-admin-actions"},en={class:"wl-comment-status"},tn=["disabled","onClick","textContent"],ln={key:3,class:"wl-quote"};var an=oe({__name:"CommentCard",props:{comment:{},edit:{},rootId:{},reply:{}},emits:["log","submit","delete","like","sticky","edit","reply","status"],setup(e,{emit:a}){const t=e,l=a,r=["approved","waiting","spam"],d=we(he),M=Fe(),k=$t(),C=be(),b=W(()=>d.value.locale),A=W(()=>{const{link:o}=t.comment;return o?tt(o)?o:`https://${o}`:""}),m=W(()=>M.value.includes(t.comment.objectId)),S=W(()=>Ul(new Date(t.comment.time),k.value,b.value)),U=W(()=>C.value.type==="administrator"),I=W(()=>t.comment.user_id&&C.value.objectId===t.comment.user_id),y=W(()=>{var o;return t.comment.objectId===((o=t.reply)==null?void 0:o.objectId)}),j=W(()=>{var o;return t.comment.objectId===((o=t.edit)==null?void 0:o.objectId)});return(o,v)=>{var K;const X=yt("CommentCard",!0);return i(),s("div",{id:o.comment.objectId.toString(),class:"wl-card-item"},[u("div",Ra,[o.comment.avatar?(i(),s("img",{key:0,class:"wl-user-avatar",src:o.comment.avatar,alt:""},null,8,Va)):$("v-if",!0),o.comment.type?(i(),ee(w(Wt),{key:1})):$("v-if",!0)]),u("div",Ua,[u("div",_a,[A.value?(i(),s("a",{key:0,class:"wl-nick",href:A.value,target:"_blank",rel:"nofollow noopener noreferrer"},L(o.comment.nick),9,Ha)):(i(),s("span",Ta,L(o.comment.nick),1)),o.comment.type==="administrator"?(i(),s("span",{key:2,class:"wl-badge",textContent:L(b.value.admin)},null,8,Fa)):$("v-if",!0),o.comment.label?(i(),s("span",{key:3,class:"wl-badge",textContent:L(o.comment.label)},null,8,Na)):$("v-if",!0),o.comment.sticky?(i(),s("span",{key:4,class:"wl-badge",textContent:L(b.value.sticky)},null,8,Wa)):$("v-if",!0),typeof o.comment.level=="number"?(i(),s("span",{key:5,class:P(`wl-badge level${o.comment.level}`),textContent:L(b.value[`level${o.comment.level}`]||`Level ${o.comment.level}`)},null,10,Ba)):$("v-if",!0),u("span",{class:"wl-time",textContent:L(S.value)},null,8,Da),u("div",Pa,[U.value||I.value?(i(),s(B,{key:0},[u("button",{type:"button",class:"wl-edit",onClick:v[0]||(v[0]=E=>l("edit",o.comment))},[O(w(Nt))]),u("button",{type:"button",class:"wl-delete",onClick:v[1]||(v[1]=E=>l("delete",o.comment))},[O(w(Rt))])],64)):$("v-if",!0),u("button",{type:"button",class:"wl-like",title:m.value?b.value.cancelLike:b.value.like,onClick:v[2]||(v[2]=E=>l("like",o.comment))},[O(w(_t),{active:m.value},null,8,["active"]),le(" "+L("like"in o.comment?o.comment.like:""),1)],8,qa),u("button",{type:"button",class:P(["wl-reply",{active:y.value}]),title:y.value?b.value.cancelReply:b.value.reply,onClick:v[3]||(v[3]=E=>l("reply",y.value?null:o.comment))},[O(w(Ft))],10,Ga)])]),u("div",Oa,[(i(),s(B,null,Z(["addr","browser","os"],E=>(i(),s(B,null,[o.comment[E]?(i(),s("span",{key:E,class:P(`wl-${E}`),"data-value":o.comment[E],textContent:L(o.comment[E])},null,10,Ka)):$("v-if",!0)],64))),64))]),j.value?$("v-if",!0):(i(),s("div",Za,["reply_user"in o.comment&&o.comment.reply_user?(i(),s("p",Xa,[u("a",{href:"#"+o.comment.pid},"@"+L(o.comment.reply_user.nick),9,Ya),v[17]||(v[17]=u("span",null,": ",-1))])):$("v-if",!0),u("div",{innerHTML:o.comment.comment},null,8,Ja)])),U.value&&!j.value?(i(),s("div",Qa,[u("span",en,[(i(),s(B,null,Z(r,E=>u("button",{key:E,type:"submit",class:P(`wl-btn wl-${E}`),disabled:o.comment.status===E,onClick:V=>l("status",{status:E,comment:o.comment}),textContent:L(b.value[E])},null,10,tn)),64))]),U.value&&!("rid"in o.comment)?(i(),s("button",{key:0,type:"submit",class:"wl-btn wl-sticky",onClick:v[4]||(v[4]=E=>l("sticky",o.comment))},L(o.comment.sticky?b.value.unsticky:b.value.sticky),1)):$("v-if",!0)])):$("v-if",!0),y.value||j.value?(i(),s("div",{key:2,class:P({"wl-reply-wrapper":y.value,"wl-edit-wrapper":j.value})},[O(rt,{edit:o.edit,"reply-id":(K=o.reply)==null?void 0:K.objectId,"reply-user":o.comment.nick,"root-id":o.rootId,onLog:v[5]||(v[5]=E=>l("log")),onCancelReply:v[6]||(v[6]=E=>l("reply",null)),onCancelEdit:v[7]||(v[7]=E=>l("edit",null)),onSubmit:v[8]||(v[8]=E=>l("submit",E))},null,8,["edit","reply-id","reply-user","root-id"])],2)):$("v-if",!0),"children"in o.comment?(i(),s("div",ln,[(i(!0),s(B,null,Z(o.comment.children,E=>(i(),ee(X,{key:E.objectId,comment:E,reply:o.reply,edit:o.edit,"root-id":o.rootId,onLog:v[9]||(v[9]=V=>l("log")),onDelete:v[10]||(v[10]=V=>l("delete",V)),onEdit:v[11]||(v[11]=V=>l("edit",V)),onLike:v[12]||(v[12]=V=>l("like",V)),onReply:v[13]||(v[13]=V=>l("reply",V)),onStatus:v[14]||(v[14]=V=>l("status",V)),onSticky:v[15]||(v[15]=V=>l("sticky",V)),onSubmit:v[16]||(v[16]=V=>l("submit",V))},null,8,["comment","reply","edit","root-id"]))),128))])):$("v-if",!0)])],8,za)}}});const ot="3.5.5",nn={"data-waline":""},rn={class:"wl-meta-head"},on={class:"wl-count"},sn=["textContent"],cn={class:"wl-sort"},un=["onClick"],mn={class:"wl-cards"},vn={key:1,class:"wl-operation"},dn=["textContent"],pn={key:2,class:"wl-loading"},gn=["textContent"],hn={key:4,class:"wl-operation"},fn=["textContent"],yn={key:5,class:"wl-power"};var wn=oe({__name:"WalineComment",props:{serverURL:{},path:{},meta:{},requiredMeta:{},wordLimit:{},pageSize:{},lang:{},locale:{},commentSorting:{},dark:{type:[String,Boolean]},login:{},noCopyright:{type:Boolean},recaptchaV3Key:{},turnstileKey:{},reaction:{},emoji:{},search:{},highlighter:{type:Function},imageUploader:{type:Function},texRenderer:{type:Function}},setup(e){const a=e,t=be(),l=Fe(),r=R("loading"),d=R(0),M=R(1),k=R(0),C=W(()=>zl(a)),b=R(C.value.commentSorting),A=R([]),m=R(null),S=R(null),U=W(()=>Rl(C.value.dark)),I=W(()=>C.value.locale);It(U,{id:"waline-darkmode"});let y=null;const j=p=>{const{serverURL:z,path:g,pageSize:F}=C.value,q=new AbortController;r.value="loading",y==null||y(),At({serverURL:z,lang:C.value.lang,path:g,pageSize:F,sortBy:Qe[b.value],page:p,signal:q.signal,token:t.value.token}).then(G=>{r.value="success",d.value=G.count,A.value.push(...G.data),M.value=p,k.value=G.totalPages}).catch(G=>{G.name!=="AbortError"&&(console.error(G.message),r.value="error")}),y=q.abort.bind(q)},o=()=>{j(M.value+1)},v=()=>{d.value=0,A.value=[],j(1)},K=p=>{b.value!==p&&(b.value=p,v())},X=p=>{m.value=p},E=p=>{S.value=p},V=p=>{if(S.value)S.value.comment=p.comment,S.value.orig=p.orig;else if("rid"in p){const z=A.value.find(({objectId:g})=>g===p.rid);if(!z)return;Array.isArray(z.children)||(z.children=[]),z.children.push(p)}else A.value.unshift(p),d.value+=1},T=async({comment:p,status:z})=>{if(p.status===z)return;const{serverURL:g,lang:F}=C.value;await ge({serverURL:g,lang:F,token:t.value.token,objectId:p.objectId,comment:{status:z}}),p.status=z},ae=async p=>{if("rid"in p)return;const{serverURL:z,lang:g}=C.value;await ge({serverURL:z,lang:g,token:t.value.token,objectId:p.objectId,comment:{sticky:p.sticky?0:1}}),p.sticky=!p.sticky},Q=async({objectId:p})=>{if(!confirm("Are you sure you want to delete this comment?"))return;const{serverURL:z,lang:g}=C.value;await Mt({serverURL:z,lang:g,token:t.value.token,objectId:p}),A.value.some((F,q)=>F.objectId===p?(A.value=A.value.filter((G,re)=>re!==q),!0):F.children.some((G,re)=>G.objectId===p?(A.value[q].children=F.children.filter((me,fe)=>fe!==re),!0):!1))},ue=async p=>{const{serverURL:z,lang:g}=C.value,{objectId:F}=p,q=l.value.includes(F);await ge({serverURL:z,lang:g,objectId:F,token:t.value.token,comment:{like:!q}}),q?l.value=l.value.filter(G=>G!==F):(l.value=[...l.value,F],l.value.length>50&&(l.value=l.value.slice(-50))),p.like=Math.max(0,(p.like||0)+(q?-1:1))};return wt(he,C),de(()=>{se(()=>[a.serverURL,a.path],()=>{v()})}),je(()=>{y==null||y()}),(p,z)=>(i(),s("div",nn,[O(El),!m.value&&!S.value?(i(),ee(rt,{key:0,onLog:v,onSubmit:V})):$("v-if",!0),u("div",rn,[u("div",on,[d.value?(i(),s("span",{key:0,class:"wl-num",textContent:L(d.value)},null,8,sn)):$("v-if",!0),le(" "+L(I.value.comment),1)]),u("ul",cn,[(i(!0),s(B,null,Z(w(hl),g=>(i(),s("li",{key:g,class:P([g===b.value?"active":""]),onClick:F=>K(g)},L(I.value[g]),11,un))),128))])]),u("div",mn,[(i(!0),s(B,null,Z(A.value,g=>(i(),ee(an,{key:g.objectId,"root-id":g.objectId,comment:g,reply:m.value,edit:S.value,onLog:v,onReply:X,onEdit:E,onSubmit:V,onStatus:T,onDelete:Q,onSticky:ae,onLike:ue},null,8,["root-id","comment","reply","edit"]))),128))]),r.value==="error"?(i(),s("div",vn,[u("button",{type:"button",class:"wl-btn",onClick:v,textContent:L(I.value.refresh)},null,8,dn)])):r.value==="loading"?(i(),s("div",pn,[O(w(ce),{size:30})])):A.value.length?M.value<k.value?(i(),s("div",hn,[u("button",{type:"button",class:"wl-btn",onClick:o,textContent:L(I.value.more)},null,8,fn)])):$("v-if",!0):(i(),s("div",{key:3,class:"wl-empty",textContent:L(I.value.sofa)},null,8,gn)),C.value.noCopyright?$("v-if",!0):(i(),s("div",yn,[z[0]||(z[0]=le(" Powered by ")),z[1]||(z[1]=u("a",{href:"https://github.com/walinejs/waline",target:"_blank",rel:"noopener noreferrer"}," Waline ",-1)),le(" v"+L(w(ot)),1)]))]))}});export{wn as Waline,ot as version};
|
|
12
12
|
//# sourceMappingURL=component.js.map
|
package/dist/pageview.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
const v="3.5.
|
|
1
|
+
const v="3.5.5",$={"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},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=>U({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 Lt,getArticleCounter as Et,updateArticleCounter as V
|
|
|
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?"]),Je=J(["昵称","昵称不能少于3个字符","邮箱","请填写正确的邮件地址","网址","可选","欢迎评论","来发评论吧~","提交","喜欢","取消喜欢","回复","取消回复","评论","刷新","加载更多...","预览","表情","上传图片","秒前","分钟前","小时前","天前","刚刚","正在上传","登录","退出","博主","置顶","字",`评论字数应在 $0 到 $1 字之间!
|
|
9
9
|
当前字数:$2`,"匿名","潜水","冒泡","吐槽","活跃","话痨","传说","表情包","搜索表情包","个人资料","通过","待审核","垃圾","取消置顶","按倒序","按正序","按热度","你认为这篇文章怎么样?"]),ca=J(["暱稱","暱稱不能少於3個字元","郵箱","請填寫正確的郵件地址","網址","可選","歡迎留言","來發留言吧~","送出","喜歡","取消喜歡","回覆","取消回覆","留言","重整","載入更多...","預覽","表情","上傳圖片","秒前","分鐘前","小時前","天前","剛剛","正在上傳","登入","登出","管理者","置頂","字",`留言字數應在 $0 到 $1 字之間!
|
|
10
10
|
目前字數:$2`,"匿名","潛水","冒泡","吐槽","活躍","多話","傳說","表情包","搜尋表情包","個人資料","通過","待審核","垃圾","取消置頂","最早","最新","熱門","你認為這篇文章怎麼樣?"]);const Qe="en-US",fe={zh:Je,"zh-cn":Je,"zh-tw":ca,en:Oe,"en-us":Oe,fr:Ke,"fr-fr":Ke,jp:Ze,"jp-jp":Ze,"pt-br":sa,ru:Xe,"ru-ru":Xe,vi:Ye,"vi-vn":Ye,de:ia,es:Ge,"es-mx":Ge},et=e=>fe[e.toLowerCase()]||fe[Qe.toLowerCase()],tt=e=>Object.keys(fe).includes(e.toLowerCase())?e:Qe,at={latest:"insertedAt_desc",oldest:"insertedAt_asc",hottest:"like_desc"},ua=Object.keys(at),we=Symbol("waline-config"),lt=e=>{try{e=decodeURI(e)}catch{}return e},nt=(e="")=>e.replace(/\/$/u,""),rt=e=>/^(https?:)?\/\//.test(e),ye=e=>{const l=nt(e);return rt(l)?l:`https://${l}`},ma=e=>Array.isArray(e)?e:e?[0,e]:!1,re=(e,l)=>e==null||e===!0?l:e===!1?null:e,va=({serverURL:e,path:l=location.pathname,lang:t=typeof navigator>"u"?"en-US":navigator.language,locale:a,meta:n=["nick","mail","link"],requiredMeta:s=[],dark:h=!1,pageSize:c=10,wordLimit:f,noCopyright:v=!1,login:y="enable",recaptchaV3Key:m="",turnstileKey:R="",commentSorting:j="latest",emoji:E=Pe,imageUploader:$,highlighter:S,texRenderer:i,search:g,reaction:K,...X})=>({serverURL:ye(e),path:lt(l),lang:tt(t),locale:{...et(tt(t)),...typeof a=="object"?a:{}},wordLimit:ma(f),meta:De(n),requiredMeta:De(s),dark:h,pageSize:c,commentSorting:j,login:y,noCopyright:v,recaptchaV3Key:m,turnstileKey:R,...X,reaction:re(K,Xt),imageUploader:re($,Yt),highlighter:re(S,ra),texRenderer:re(i,Jt),emoji:re(E,Pe),search:re(g,Qt(t))}),oe=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}",da=e=>oe(e)?e==="auto"?`@media(prefers-color-scheme:dark){body${Ae}}`:`${e}${Ae}`:e===!0?`:root${Ae}`:"",Me=(e,l)=>{let t=e.toString();for(;t.length<l;)t="0"+t;return t},pa=e=>{const l=Me(e.getDate(),2),t=Me(e.getMonth()+1,2);return`${Me(e.getFullYear(),2)}-${t}-${l}`},ga=(e,l,t)=>{if(!e)return"";const a=oe(e)?new Date(e.includes(" ")?e.replace(/-/g,"/"):e):e,n=l.getTime()-a.getTime(),s=Math.floor(n/(24*3600*1e3));if(s===0){const h=n%864e5,c=Math.floor(h/(3600*1e3));if(c===0){const f=h%36e5,v=Math.floor(f/(60*1e3));if(v===0){const y=f%6e4;return`${Math.round(y/1e3)} ${t.seconds}`}return`${v} ${t.minutes}`}return`${c} ${t.hours}`}return s<0?t.now:s<8?`${s} ${t.days}`:pa(a)},ha=/^[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])?)*$/,fa=e=>ha.test(e),wa="WALINE_EMOJI",ot=ne(wa,{}),ya=e=>!!/@[0-9]+\.[0-9]+\.[0-9]+/.test(e),ba=e=>{const l=ya(e);if(l){const t=ot.value[e];if(t)return Promise.resolve(t)}return fetch(`${e}/info.json`).then(t=>t.json()).then(t=>{const a={folder:e,...t};return l&&(ot.value[e]=a),a})},it=(e,l="",t="",a="")=>`${l?`${l}/`:""}${t}${e}${a?`.${a}`:""}`,ka=e=>Promise.all(e?e.map(l=>oe(l)?ba(nt(l)):Promise.resolve(l)):[]).then(l=>{const t={tabs:[],map:{}};return l.forEach(a=>{const{name:n,folder:s,icon:h,prefix:c="",type:f,items:v}=a;t.tabs.push({name:n,icon:it(h,s,c,f),items:v.map(y=>{const m=`${c}${y}`;return t.map[m]=it(y,s,c,f),m})})}),t}),st=e=>{e.name!=="AbortError"&&console.error(e.message)},xe=e=>e instanceof HTMLElement?e:oe(e)?document.querySelector(e):null,Ca=e=>e.type.includes("image"),ct=e=>{const l=Array.from(e).find(Ca);return l?l.getAsFile():null},$a=/\$.*?\$/,La=/^\$(.*?)\$/,Ea=/^(?:\s{0,3})\$\$((?:[^\n]|\n[^\n])+?)\n{0,1}\$\$/,Ia=e=>[{name:"blockMath",level:"block",tokenizer(l){const t=Ea.exec(l);if(t!==null)return{type:"html",raw:t[0],text:e(!0,t[1])}}},{name:"inlineMath",level:"inline",start(l){const t=l.search($a);return t!==-1?t:l.length},tokenizer(l){const t=La.exec(l);if(t!==null)return{type:"html",raw:t[0],text:e(!1,t[1])}}}],ut=(e="",l={})=>e.replace(/:(.+?):/g,(t,a)=>l[a]?`<img class="wl-emoji" src="${l[a]}" alt="${a}">`:t),Aa=(e,{emojiMap:l,highlighter:t,texRenderer:a})=>{const n=new Ot;if(n.setOptions({breaks:!0}),t&&n.use(Gt({highlight:t})),a){const s=Ia(a);n.use({extensions:s})}return n.parse(ut(e,l))},Re=e=>{const{path:l}=e.dataset;return l!=null&&l.length?l:null},Ma=e=>e.match(/[\w\d\s,.\u00C0-\u024F\u0400-\u04FF]+/giu),xa=e=>e.match(/[\u4E00-\u9FD5]/gu),Ra=e=>{var l,t;return(((l=Ma(e))==null?void 0:l.reduce((a,n)=>a+(["",",","."].includes(n.trim())?0:n.trim().split(/\s+/u).length),0))??0)+(((t=xa(e))==null?void 0:t.length)??0)},Sa=async()=>{const{userAgentData:e}=navigator;let l=navigator.userAgent;if(!e||e.platform!=="Windows")return l;const{platformVersion:t}=await e.getHighEntropyValues(["platformVersion"]);return t&&parseInt(t.split(".")[0])>=13&&(l=l.replace("Windows NT 10.0","Windows NT 11.0")),l},mt=({serverURL:e,path:l=window.location.pathname,selector:t=".waline-comment-count",lang:a=navigator.language})=>{const n=new AbortController,s=document.querySelectorAll(t);return s.length&&Lt({serverURL:ye(e),paths:Array.from(s).map(h=>lt(Re(h)??l)),lang:a,signal:n.signal}).then(h=>{s.forEach((c,f)=>{c.innerText=h[f].toString()})}).catch(st),n.abort.bind(n)},vt=({size:e})=>M("svg",{class:"wl-close-icon",viewBox:"0 0 1024 1024",width:e,height:e},[M("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"}),M("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"})]),ja=()=>M("svg",{viewBox:"0 0 1024 1024",width:"24",height:"24"},M("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"})),Ua=()=>M("svg",{viewBox:"0 0 1024 1024",width:"24",height:"24"},M("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"})),za=()=>M("svg",{viewBox:"0 0 1024 1024",width:"24",height:"24"},[M("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"}),M("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"})]),Va=({active:e=!1})=>M("svg",{viewBox:"0 0 1024 1024",width:"24",height:"24"},[M("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"})]),_a=()=>M("svg",{viewBox:"0 0 1024 1024",width:"24",height:"24"},[M("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"}),M("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"})]),Ha=()=>M("svg",{width:"16",height:"16",ariaHidden:"true"},M("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"})),Ta=()=>M("svg",{viewBox:"0 0 1024 1024",width:"24",height:"24"},M("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"})),Fa=()=>M("svg",{viewBox:"0 0 1024 1024",width:"24",height:"24"},M("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"})),Na=()=>M("svg",{class:"verified-icon",viewBox:"0 0 1024 1024",width:"14",height:"14"},M("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"})),ue=({size:e=100})=>M("svg",{width:e,height:e,viewBox:"0 0 100 100",preserveAspectRatio:"xMidYMid"},M("circle",{cx:50,cy:50,fill:"none",stroke:"currentColor",strokeWidth:"4",r:"40","stroke-dasharray":"85 30"},M("animateTransform",{attributeName:"transform",type:"rotate",repeatCount:"indefinite",dur:"1s",values:"0 50 50;360 50 50",keyTimes:"0;1"}))),Wa=()=>M("svg",{width:24,height:24,fill:"currentcolor",viewBox:"0 0 24 24"},[M("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"}),M("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"})]),Ba=()=>ne("WALINE_USER_META",{nick:"",mail:"",link:""}),Da=()=>ne("WALINE_COMMENT_BOX_EDITOR",""),Pa="WALINE_LIKE",qa=ne(Pa,[]),dt=()=>qa,Oa="WALINE_REACTION",Ga=ne(Oa,{}),Ka=()=>Ga,pt={},Za=e=>{const l=pt[e]??(pt[e]=Kt(e,{useRecaptchaNet:!0,autoHideBadge:!0}));return{execute:t=>l.then(a=>a.execute(t))}},Xa=e=>({execute:async l=>{const{load:t}=Wt("https://challenges.cloudflare.com/turnstile/v0/api.js",void 0,{async:!1});await t();const a=window.turnstile;return new Promise(n=>{a==null||a.ready(()=>{a.render(".wl-captcha-container",{sitekey:e,action:l,size:"compact",callback:n})})})}}),Ya="WALINE_USER",Ja=ne(Ya,{}),be=()=>Ja,Qa={key:0,class:"wl-reaction"},el=["textContent"],tl={class:"wl-reaction-list"},al=["onClick"],ll={class:"wl-reaction-img"},nl=["src","alt"],rl=["textContent"],ol=["textContent"];var il=se({__name:"ArticleReaction",setup(e){const l=Ka(),t=$e(we),a=z(-1),n=z([]),s=W(()=>t.value.locale),h=W(()=>{const{reaction:m}=t.value;return m!=null&&m.length?m:null}),c=W(()=>{var m;const{path:R}=t.value;return((m=h.value)==null?void 0:m.map((j,E)=>({icon:j,desc:s.value[`reaction${E}`],active:l.value[R]===E})))??null});let f;const v=async()=>{const{serverURL:m,lang:R,path:j}=t.value;if(!h.value)return;const E=new AbortController;f=E.abort.bind(E);const[$]=await Et({serverURL:m,lang:R,paths:[j],type:h.value.map((S,i)=>`reaction${i}`),signal:E.signal});n.value=h.value.map((S,i)=>$[`reaction${i}`])},y=async m=>{if(a.value!==-1)return;const{serverURL:R,lang:j,path:E}=t.value,$=l.value[E];a.value=m,$!==void 0&&(await Ve({serverURL:R,lang:j,path:E,type:`reaction${$}`,action:"desc"}),n.value[$]=Math.max(n.value[$]-1,0)),$!==m&&(await Ve({serverURL:R,lang:j,path:E,type:`reaction${m}`}),n.value[m]=(n.value[m]||0)+1),$===m?delete l.value[E]:l.value[E]=m,a.value=-1};return ge(()=>{ce(()=>[t.value.serverURL,t.value.path],()=>v())}),_e(()=>{f==null||f()}),(m,R)=>c.value?(o(),u("div",Qa,[p("div",{class:"wl-reaction-title",textContent:x(s.value.reactionTitle)},null,8,el),p("ul",tl,[(o(!0),u(B,null,Z(c.value,({active:j,icon:E,desc:$},S)=>(o(),u("li",{key:S,class:P(["wl-reaction-item",{active:j}]),onClick:i=>y(S)},[p("div",ll,[p("img",{src:E,alt:$},null,8,nl),a.value===S?(o(),ee(L(ue),{key:0,class:"wl-reaction-loading"})):(o(),u("div",{key:1,class:"wl-reaction-votes",textContent:x(n.value[S]||0)},null,8,rl))]),p("div",{class:"wl-reaction-text",textContent:x($)},null,8,ol)],10,al))),128))])])):I("v-if",!0)}});const sl=["data-index"],cl=["src","title","onClick"];var ul=se({__name:"ImageWall",props:{items:{default:()=>[]},columnWidth:{default:300},gap:{default:0}},emits:["insert"],setup(e){const l=e;let t=null;const a=te("wall"),n=z({}),s=z([]),h=()=>{const m=Math.floor((a.value.getBoundingClientRect().width+l.gap)/(l.columnWidth+l.gap));return m>0?m:1},c=m=>new Array(m).fill(null).map(()=>[]),f=async m=>{var R;if(m>=l.items.length)return;await Te();const j=Array.from(((R=a.value)==null?void 0:R.children)??[]).reduce((E,$)=>$.getBoundingClientRect().height<E.getBoundingClientRect().height?$:E);s.value[Number(j.dataset.index)].push(m),await f(m+1)},v=async(m=!1)=>{if(s.value.length===h()&&!m)return;s.value=c(h());const R=window.scrollY;await f(0),window.scrollTo({top:R})},y=m=>{n.value[m.target.src]=!0};return ge(()=>{v(!0),t=new ResizeObserver(()=>{v()}),t.observe(a.value),Le(()=>[l.items],()=>{n.value={},v(!0)}),Le(()=>[l.columnWidth,l.gap],()=>{v()})}),zt(()=>{t.unobserve(a.value)}),(m,R)=>(o(),u("div",{ref_key:"wall",ref:a,class:"wl-gallery",style:He({gap:`${m.gap}px`})},[(o(!0),u(B,null,Z(s.value,(j,E)=>(o(),u("div",{key:E,class:"wl-gallery-column","data-index":E,style:He({gap:`${m.gap}px`})},[(o(!0),u(B,null,Z(j,$=>(o(),u(B,{key:$},[n.value[m.items[$].src]?I("v-if",!0):(o(),ee(L(ue),{key:0,size:36,style:{margin:"20px auto"}})),p("img",{class:"wl-gallery-item",src:m.items[$].src,title:m.items[$].title,loading:"lazy",onLoad:y,onClick:S=>m.$emit("insert",``)},null,40,cl)],64))),128))],12,sl))),128))],4))}});const ml={key:0,class:"wl-login-info"},vl={class:"wl-avatar"},dl=["title"],pl=["title"],gl=["src"],hl=["title","textContent"],fl={class:"wl-panel"},wl=["for","textContent"],yl=["id","onUpdate:modelValue","name","type"],bl=["placeholder"],kl={class:"wl-preview"},Cl=["innerHTML"],$l={class:"wl-footer"},Ll={class:"wl-actions"},El={href:"https://guides.github.com/features/mastering-markdown/",title:"Markdown Guide","aria-label":"Markdown is supported",class:"wl-action",target:"_blank",rel:"noopener noreferrer"},Il=["title"],Al=["title"],Ml=["title","aria-label"],xl=["title"],Rl={class:"wl-info"},Sl={class:"wl-text-number"},jl={key:0},Ul=["textContent"],zl=["textContent"],Vl=["disabled"],_l=["placeholder"],Hl={key:1,class:"wl-loading"},Tl={key:0,class:"wl-tab-wrapper"},Fl=["title","onClick"],Nl=["src","alt"],Wl={key:0,class:"wl-tabs"},Bl=["onClick"],Dl=["src","alt","title"],Pl=["title"];var gt=se({__name:"CommentBox",props:{edit:{},rootId:{},replyId:{},replyUser:{}},emits:["log","cancelEdit","cancelReply","submit"],setup(e,{emit:l}){const t=e,a=l,n=$e(we),s=Da(),h=Ba(),c=be(),f=z({}),v=te("textarea"),y=te("image-uploader"),m=te("emoji-button"),R=te("emoji-popup"),j=te("gif-button"),E=te("gif-popup"),$=te("gif-search"),S=z({tabs:[],map:{}}),i=z(0),g=z(!1),K=z(!1),X=z(!1),A=z(""),V=z(0),T=Ee({loading:!0,list:[]}),le=z(0),Q=z(!1),me=z(""),w=z(!1),U=z(!1),b=W(()=>n.value.locale),F=W(()=>!!c.value.token),q=W(()=>Bt(n.value.imageUploader)),O=d=>{const r=v.value,C=r.selectionStart,H=r.selectionEnd||0,k=r.scrollTop;s.value=r.value.substring(0,C)+d+r.value.substring(H,r.value.length),r.focus(),r.selectionStart=C+d.length,r.selectionEnd=C+d.length,r.scrollTop=k},ie=({key:d,ctrlKey:r,metaKey:C})=>{w.value||(r||C)&&d==="Enter"&&Se()},ve=async d=>{const r=`![${n.value.locale.uploading} ${d.name}]()`;O(r),w.value=!0;try{const C=await n.value.imageUploader(d);s.value=s.value.replace(r,`\r
|
|
11
|
-
`)}catch(C){alert(C.message),s.value=s.value.replace(r,"")}finally{w.value=!1}},ke=d=>{var r;if((r=d.dataTransfer)!=null&&r.items){const C=ct(d.dataTransfer.items);C&&q.value&&(ve(C),d.preventDefault())}},yt=d=>{if(d.clipboardData){const r=ct(d.clipboardData.items);r&&q.value&&ve(r)}},bt=()=>{const d=y.value;d.files&&q.value&&ve(d.files[0]).then(()=>{d.value=""})},Se=async()=>{var d;const{serverURL:r,lang:C,login:H,wordLimit:k,requiredMeta:D,recaptchaV3Key:N,turnstileKey:Y}=n.value,_={comment:me.value,nick:h.value.nick,mail:h.value.mail,link:h.value.link,url:n.value.path,ua:await Sa()};if(!t.edit)if(c.value.token)_.nick=c.value.display_name,_.mail=c.value.email,_.link=c.value.url;else{if(H==="force")return;if(D.includes("nick")&&!_.nick){f.value.nick.focus(),alert(b.value.nickError);return}if(D.includes("mail")&&!_.mail||_.mail&&!fa(_.mail)){f.value.mail.focus(),alert(b.value.mailError);return}_.nick||(_.nick=b.value.anonymous)}if(!_.comment){v.value.focus();return}if(!Q.value){alert(b.value.wordHint.replace("$0",k[0].toString()).replace("$1",k[1].toString()).replace("$2",V.value.toString()));return}_.comment=ut(_.comment,S.value.map),t.replyId&&t.rootId&&(_.pid=t.replyId,_.rid=t.rootId,_.at=t.replyUser),w.value=!0;try{N&&(_.recaptchaV3=await Za(N).execute("social")),Y&&(_.turnstile=await Xa(Y).execute("social"));const de={serverURL:r,lang:C,token:c.value.token,comment:_},Ce=await(t.edit?pe({objectId:t.edit.objectId,...de}):It(de));if(w.value=!1,Ce.errmsg){alert(Ce.errmsg);return}a("submit",Ce.data),s.value="",A.value="",await Te(),t.replyId&&a("cancelReply"),(d=t.edit)!=null&&d.objectId&&a("cancelEdit")}catch(de){w.value=!1,alert(de.message)}},kt=d=>{d.preventDefault();const{lang:r,serverURL:C}=n.value;At({serverURL:C,lang:r}).then(H=>{c.value=H,(H.remember?localStorage:sessionStorage).setItem("WALINE_USER",JSON.stringify(H)),a("log")})},Ct=()=>{c.value={},localStorage.setItem("WALINE_USER","null"),sessionStorage.setItem("WALINE_USER","null"),a("log")},je=d=>{d.preventDefault();const{lang:r,serverURL:C}=n.value,H=800,k=800,D=(window.innerWidth-H)/2,N=(window.innerHeight-k)/2,Y=new URLSearchParams({lng:r,token:c.value.token}),_=window.open(`${C}/ui/profile?${Y.toString()}`,"_blank",`width=${H},height=${k},left=${D},top=${N},scrollbars=no,resizable=no,status=no,location=no,toolbar=no,menubar=no`);_==null||_.postMessage({type:"TOKEN",data:c.value.token},"*")},$t=d=>{var r,C,H,k;!((r=m.value)!=null&&r.contains(d.target))&&!((C=R.value)!=null&&C.contains(d.target))&&(g.value=!1),!((H=j.value)!=null&&H.contains(d.target))&&!((k=E.value)!=null&&k.contains(d.target))&&(K.value=!1)},Ue=async d=>{var r;const{scrollTop:C,clientHeight:H,scrollHeight:k}=d.target,D=(H+C)/k,N=n.value.search,Y=((r=$.value)==null?void 0:r.value)??"";D<.9||T.loading||U.value||(T.loading=!0,(N.more&&T.list.length?await N.more(Y,T.list.length):await N.search(Y)).length?T.list=[...T.list,...N.more&&T.list.length?await N.more(Y,T.list.length):await N.search(Y)]:U.value=!0,T.loading=!1,setTimeout(()=>{d.target.scrollTop=C},50))},ze=Dt(d=>{T.list=[],U.value=!1,Ue(d)},300);return We("click",$t),We("message",({data:d})=>{!d||d.type!=="profile"||(c.value={...c.value,...d.data},[localStorage,sessionStorage].filter(r=>r.getItem("WALINE_USER")).forEach(r=>{r.setItem("WALINE_USER",JSON.stringify(c))}))}),ce([n,V],([d,r])=>{const{wordLimit:C}=d;C?r<C[0]&&C[0]!==0?(le.value=C[0],Q.value=!1):r>C[1]?(le.value=C[1],Q.value=!1):(le.value=C[1],Q.value=!0):(le.value=0,Q.value=!0)}),Le(K,async d=>{var r;if(!d)return;const C=n.value.search;$.value&&($.value.value=""),T.loading=!0,T.list=await(((r=C.default)==null?void 0:r.call(C))??C.search("")),T.loading=!1}),ge(()=>{var d;(d=t.edit)!=null&&d.objectId&&(s.value=t.edit.orig),ce(()=>s.value,r=>{const{highlighter:C,texRenderer:H}=n.value;me.value=r,A.value=Aa(r,{emojiMap:S.value.map,highlighter:C,texRenderer:H}),V.value=Ra(r),r?Be(v.value):Be.destroy(v.value)}),ce(()=>n.value.emoji,async r=>{S.value=await ka(r)})}),(d,r)=>{var C,H;return o(),u("div",{key:L(c).token,class:"wl-comment"},[L(n).login!=="disable"&&F.value&&!((C=d.edit)!=null&&C.objectId)?(o(),u("div",ml,[p("div",vl,[p("button",{type:"submit",class:"wl-logout-btn",title:b.value.logout,onClick:Ct},[G(L(vt),{size:14})],8,dl),p("a",{href:"#",class:"wl-login-nick","aria-label":"Profile",title:b.value.profile,onClick:je},[p("img",{src:L(c).avatar,alt:"avatar"},null,8,gl)],8,pl)]),p("a",{href:"#",class:"wl-login-nick","aria-label":"Profile",title:b.value.profile,onClick:je,textContent:x(L(c).display_name)},null,8,hl)])):I("v-if",!0),p("div",fl,[L(n).login!=="force"&&L(n).meta.length&&!F.value?(o(),u("div",{key:0,class:P(["wl-header",`item${L(n).meta.length}`])},[(o(!0),u(B,null,Z(L(n).meta,k=>(o(),u("div",{key:k,class:"wl-header-item"},[p("label",{for:`wl-${k}`,textContent:x(b.value[k]+(L(n).requiredMeta.includes(k)||!L(n).requiredMeta.length?"":`(${b.value.optional})`))},null,8,wl),he(p("input",{id:`wl-${k}`,ref_for:!0,ref:D=>{D&&(f.value[k]=D)},"onUpdate:modelValue":D=>L(h)[k]=D,class:P(["wl-input",`wl-${k}`]),name:k,type:k==="mail"?"email":"text"},null,10,yl),[[Vt,L(h)[k]]])]))),128))],2)):I("v-if",!0),he(p("textarea",{id:"wl-edit",ref:"textarea","onUpdate:modelValue":r[0]||(r[0]=k=>_t(s)?s.value=k:null),class:"wl-editor",placeholder:d.replyUser?`@${d.replyUser}`:b.value.placeholder,onKeydown:ie,onDrop:ke,onPaste:yt},null,40,bl),[[Ht,L(s)]]),he(p("div",kl,[r[7]||(r[7]=p("hr",null,null,-1)),p("h4",null,x(b.value.preview)+":",1),p("div",{class:"wl-content",innerHTML:A.value},null,8,Cl)],512),[[Fe,X.value]]),p("div",$l,[p("div",Ll,[p("a",El,[G(L(Ha))]),he(p("button",{ref:"emoji-button",type:"button",class:P(["wl-action",{active:g.value}]),title:b.value.emoji,onClick:r[1]||(r[1]=k=>g.value=!g.value)},[G(L(Ua))],10,Il),[[Fe,S.value.tabs.length]]),L(n).search?(o(),u("button",{key:0,ref:"gif-button",type:"button",class:P(["wl-action",{active:K.value}]),title:b.value.gif,onClick:r[2]||(r[2]=k=>K.value=!K.value)},[G(L(Wa))],10,Al)):I("v-if",!0),p("input",{id:"wl-image-upload",ref:"image-uploader",class:"upload","aria-hidden":"true",type:"file",accept:".png,.jpg,.jpeg,.webp,.bmp,.gif",onChange:bt},null,544),q.value?(o(),u("label",{key:1,for:"wl-image-upload",class:"wl-action",title:b.value.uploadImage,"aria-label":b.value.uploadImage},[G(L(za))],8,Ml)):I("v-if",!0),p("button",{type:"button",class:P(["wl-action",{active:X.value}]),title:b.value.preview,onClick:r[3]||(r[3]=k=>X.value=!X.value)},[G(L(_a))],10,xl)]),p("div",Rl,[r[9]||(r[9]=p("div",{class:"wl-captcha-container"},null,-1)),p("div",Sl,[ae(x(V.value)+" ",1),L(n).wordLimit?(o(),u("span",jl,[r[8]||(r[8]=ae(" / ")),p("span",{class:P({illegal:!Q.value}),textContent:x(le.value)},null,10,Ul)])):I("v-if",!0),ae(" "+x(b.value.word),1)]),L(n).login!=="disable"&&!F.value?(o(),u("button",{key:0,type:"button",class:"wl-btn",onClick:kt,textContent:x(b.value.login)},null,8,zl)):I("v-if",!0),L(n).login!=="force"||F.value?(o(),u("button",{key:1,type:"submit",class:"primary wl-btn",title:"Cmd|Ctrl + Enter",disabled:w.value,onClick:Se},[w.value?(o(),ee(L(ue),{key:0,size:16})):(o(),u(B,{key:1},[ae(x(b.value.submit),1)],64))],8,Vl)):I("v-if",!0)]),p("div",{ref:"gif-popup",class:P(["wl-gif-popup",{display:K.value}])},[p("input",{ref:"gif-search",type:"text",placeholder:b.value.gifSearchPlaceholder,onInput:r[4]||(r[4]=(...k)=>L(ze)&&L(ze)(...k))},null,40,_l),T.list.length?(o(),ee(ul,{key:0,items:T.list,"column-width":200,gap:6,onInsert:r[5]||(r[5]=k=>O(k)),onScroll:Ue},null,8,["items"])):I("v-if",!0),T.loading?(o(),u("div",Hl,[G(L(ue),{size:30})])):I("v-if",!0)],2),p("div",{ref:"emoji-popup",class:P(["wl-emoji-popup",{display:g.value}])},[(o(!0),u(B,null,Z(S.value.tabs,(k,D)=>(o(),u(B,{key:k.name},[D===i.value?(o(),u("div",Tl,[(o(!0),u(B,null,Z(k.items,N=>(o(),u("button",{key:N,type:"button",title:N,onClick:Y=>O(`:${N}:`)},[g.value?(o(),u("img",{key:0,class:"wl-emoji",src:S.value.map[N],alt:N,loading:"lazy",referrerPolicy:"no-referrer"},null,8,Nl)):I("v-if",!0)],8,Fl))),128))])):I("v-if",!0)],64))),128)),S.value.tabs.length>1?(o(),u("div",Wl,[(o(!0),u(B,null,Z(S.value.tabs,(k,D)=>(o(),u("button",{key:k.name,type:"button",class:P(["wl-tab",{active:i.value===D}]),onClick:N=>i.value=D},[p("img",{class:"wl-emoji",src:k.icon,alt:k.name,title:k.name,loading:"lazy",referrerPolicy:"no-referrer"},null,8,Dl)],10,Bl))),128))])):I("v-if",!0)],2)])]),d.replyId||(H=d.edit)!=null&&H.objectId?(o(),u("button",{key:1,type:"button",class:"wl-close",title:b.value.cancelReply,onClick:r[6]||(r[6]=k=>d.replyId?a("cancelReply"):a("cancelEdit"))},[G(L(vt),{size:24})],8,Pl)):I("v-if",!0)])}}});const ql=["id"],Ol={class:"wl-user","aria-hidden":"true"},Gl=["src"],Kl={class:"wl-card"},Zl={class:"wl-head"},Xl=["href"],Yl={key:1,class:"wl-nick"},Jl=["textContent"],Ql=["textContent"],en=["textContent"],tn=["textContent"],an=["textContent"],ln={class:"wl-comment-actions"},nn=["title"],rn=["title"],on={class:"wl-meta","aria-hidden":"true"},sn=["data-value","textContent"],cn={key:0,class:"wl-content"},un={key:0},mn=["href"],vn=["innerHTML"],dn={key:1,class:"wl-admin-actions"},pn={class:"wl-comment-status"},gn=["disabled","onClick","textContent"],hn={key:3,class:"wl-quote"};var fn=se({__name:"CommentCard",props:{comment:{},edit:{},rootId:{},reply:{}},emits:["log","submit","delete","like","sticky","edit","reply","status"],setup(e,{emit:l}){const t=e,a=l,n=["approved","waiting","spam"],s=$e(we),h=dt(),c=Pt(),f=be(),v=W(()=>s.value.locale),y=W(()=>{const{link:i}=t.comment;return i?rt(i)?i:`https://${i}`:""}),m=W(()=>h.value.includes(t.comment.objectId)),R=W(()=>ga(new Date(t.comment.time),c.value,v.value)),j=W(()=>f.value.type==="administrator"),E=W(()=>t.comment.user_id&&f.value.objectId===t.comment.user_id),$=W(()=>{var i;return t.comment.objectId===((i=t.reply)==null?void 0:i.objectId)}),S=W(()=>{var i;return t.comment.objectId===((i=t.edit)==null?void 0:i.objectId)});return(i,g)=>{var K;const X=Tt("CommentCard",!0);return o(),u("div",{id:i.comment.objectId.toString(),class:"wl-card-item"},[p("div",Ol,[i.comment.avatar?(o(),u("img",{key:0,class:"wl-user-avatar",src:i.comment.avatar,alt:""},null,8,Gl)):I("v-if",!0),i.comment.type?(o(),ee(L(Na),{key:1})):I("v-if",!0)]),p("div",Kl,[p("div",Zl,[y.value?(o(),u("a",{key:0,class:"wl-nick",href:y.value,target:"_blank",rel:"nofollow noopener noreferrer"},x(i.comment.nick),9,Xl)):(o(),u("span",Yl,x(i.comment.nick),1)),i.comment.type==="administrator"?(o(),u("span",{key:2,class:"wl-badge",textContent:x(v.value.admin)},null,8,Jl)):I("v-if",!0),i.comment.label?(o(),u("span",{key:3,class:"wl-badge",textContent:x(i.comment.label)},null,8,Ql)):I("v-if",!0),i.comment.sticky?(o(),u("span",{key:4,class:"wl-badge",textContent:x(v.value.sticky)},null,8,en)):I("v-if",!0),typeof i.comment.level=="number"?(o(),u("span",{key:5,class:P(`wl-badge level${i.comment.level}`),textContent:x(v.value[`level${i.comment.level}`]||`Level ${i.comment.level}`)},null,10,tn)):I("v-if",!0),p("span",{class:"wl-time",textContent:x(R.value)},null,8,an),p("div",ln,[j.value||E.value?(o(),u(B,{key:0},[p("button",{type:"button",class:"wl-edit",onClick:g[0]||(g[0]=A=>a("edit",i.comment))},[G(L(Fa))]),p("button",{type:"button",class:"wl-delete",onClick:g[1]||(g[1]=A=>a("delete",i.comment))},[G(L(ja))])],64)):I("v-if",!0),p("button",{type:"button",class:"wl-like",title:m.value?v.value.cancelLike:v.value.like,onClick:g[2]||(g[2]=A=>a("like",i.comment))},[G(L(Va),{active:m.value},null,8,["active"]),ae(" "+x("like"in i.comment?i.comment.like:""),1)],8,nn),p("button",{type:"button",class:P(["wl-reply",{active:$.value}]),title:$.value?v.value.cancelReply:v.value.reply,onClick:g[3]||(g[3]=A=>a("reply",$.value?null:i.comment))},[G(L(Ta))],10,rn)])]),p("div",on,[(o(),u(B,null,Z(["addr","browser","os"],A=>(o(),u(B,null,[i.comment[A]?(o(),u("span",{key:A,class:P(`wl-${A}`),"data-value":i.comment[A],textContent:x(i.comment[A])},null,10,sn)):I("v-if",!0)],64))),64))]),S.value?I("v-if",!0):(o(),u("div",cn,["reply_user"in i.comment&&i.comment.reply_user?(o(),u("p",un,[p("a",{href:"#"+i.comment.pid},"@"+x(i.comment.reply_user.nick),9,mn),g[17]||(g[17]=p("span",null,": ",-1))])):I("v-if",!0),p("div",{innerHTML:i.comment.comment},null,8,vn)])),j.value&&!S.value?(o(),u("div",dn,[p("span",pn,[(o(),u(B,null,Z(n,A=>p("button",{key:A,type:"submit",class:P(`wl-btn wl-${A}`),disabled:i.comment.status===A,onClick:V=>a("status",{status:A,comment:i.comment}),textContent:x(v.value[A])},null,10,gn)),64))]),j.value&&!("rid"in i.comment)?(o(),u("button",{key:0,type:"submit",class:"wl-btn wl-sticky",onClick:g[4]||(g[4]=A=>a("sticky",i.comment))},x(i.comment.sticky?v.value.unsticky:v.value.sticky),1)):I("v-if",!0)])):I("v-if",!0),$.value||S.value?(o(),u("div",{key:2,class:P({"wl-reply-wrapper":$.value,"wl-edit-wrapper":S.value})},[G(gt,{edit:i.edit,"reply-id":(K=i.reply)==null?void 0:K.objectId,"reply-user":i.comment.nick,"root-id":i.rootId,onLog:g[5]||(g[5]=A=>a("log")),onCancelReply:g[6]||(g[6]=A=>a("reply",null)),onCancelEdit:g[7]||(g[7]=A=>a("edit",null)),onSubmit:g[8]||(g[8]=A=>a("submit",A))},null,8,["edit","reply-id","reply-user","root-id"])],2)):I("v-if",!0),"children"in i.comment?(o(),u("div",hn,[(o(!0),u(B,null,Z(i.comment.children,A=>(o(),ee(X,{key:A.objectId,comment:A,reply:i.reply,edit:i.edit,"root-id":i.rootId,onLog:g[9]||(g[9]=V=>a("log")),onDelete:g[10]||(g[10]=V=>a("delete",V)),onEdit:g[11]||(g[11]=V=>a("edit",V)),onLike:g[12]||(g[12]=V=>a("like",V)),onReply:g[13]||(g[13]=V=>a("reply",V)),onStatus:g[14]||(g[14]=V=>a("status",V)),onSticky:g[15]||(g[15]=V=>a("sticky",V)),onSubmit:g[16]||(g[16]=V=>a("submit",V))},null,8,["comment","reply","edit","root-id"]))),128))])):I("v-if",!0)])],8,ql)}}});const ht="3.5.3",wn={"data-waline":""},yn={class:"wl-meta-head"},bn={class:"wl-count"},kn=["textContent"],Cn={class:"wl-sort"},$n=["onClick"],Ln={class:"wl-cards"},En={key:1,class:"wl-operation"},In=["textContent"],An={key:2,class:"wl-loading"},Mn=["textContent"],xn={key:4,class:"wl-operation"},Rn=["textContent"],Sn={key:5,class:"wl-power"};var jn=se({__name:"WalineComment",props:{serverURL:{},path:{},meta:{},requiredMeta:{},wordLimit:{},pageSize:{},lang:{},locale:{},commentSorting:{},dark:{type:[String,Boolean]},login:{},noCopyright:{type:Boolean},recaptchaV3Key:{},turnstileKey:{},reaction:{},emoji:{},search:{},highlighter:{type:Function},imageUploader:{type:Function},texRenderer:{type:Function}},setup(e){const l=e,t=be(),a=dt(),n=z("loading"),s=z(0),h=z(1),c=z(0),f=W(()=>va(l)),v=z(f.value.commentSorting),y=z([]),m=z(null),R=z(null),j=W(()=>da(f.value.dark)),E=W(()=>f.value.locale);qt(j,{id:"waline-darkmode"});let $=null;const S=w=>{const{serverURL:U,path:b,pageSize:F}=f.value,q=new AbortController;n.value="loading",$==null||$(),xt({serverURL:U,lang:f.value.lang,path:b,pageSize:F,sortBy:at[v.value],page:w,signal:q.signal,token:t.value.token}).then(O=>{n.value="success",s.value=O.count,y.value.push(...O.data),h.value=w,c.value=O.totalPages}).catch(O=>{O.name!=="AbortError"&&(console.error(O.message),n.value="error")}),$=q.abort.bind(q)},i=()=>{S(h.value+1)},g=()=>{s.value=0,y.value=[],S(1)},K=w=>{v.value!==w&&(v.value=w,g())},X=w=>{m.value=w},A=w=>{R.value=w},V=w=>{if(R.value)R.value.comment=w.comment,R.value.orig=w.orig;else if("rid"in w){const U=y.value.find(({objectId:b})=>b===w.rid);if(!U)return;Array.isArray(U.children)||(U.children=[]),U.children.push(w)}else y.value.unshift(w),s.value+=1},T=async({comment:w,status:U})=>{if(w.status===U)return;const{serverURL:b,lang:F}=f.value;await pe({serverURL:b,lang:F,token:t.value.token,objectId:w.objectId,comment:{status:U}}),w.status=U},le=async w=>{if("rid"in w)return;const{serverURL:U,lang:b}=f.value;await pe({serverURL:U,lang:b,token:t.value.token,objectId:w.objectId,comment:{sticky:w.sticky?0:1}}),w.sticky=!w.sticky},Q=async({objectId:w})=>{if(!confirm("Are you sure you want to delete this comment?"))return;const{serverURL:U,lang:b}=f.value;await Mt({serverURL:U,lang:b,token:t.value.token,objectId:w}),y.value.some((F,q)=>F.objectId===w?(y.value=y.value.filter((O,ie)=>ie!==q),!0):F.children.some((O,ie)=>O.objectId===w?(y.value[q].children=F.children.filter((ve,ke)=>ke!==ie),!0):!1))},me=async w=>{const{serverURL:U,lang:b}=f.value,{objectId:F}=w,q=a.value.includes(F);await pe({serverURL:U,lang:b,objectId:F,token:t.value.token,comment:{like:!q}}),q?a.value=a.value.filter(O=>O!==F):(a.value=[...a.value,F],a.value.length>50&&(a.value=a.value.slice(-50))),w.like=Math.max(0,(w.like||0)+(q?-1:1))};return Ft(we,f),ge(()=>{ce(()=>[l.serverURL,l.path],()=>{g()})}),_e(()=>{$==null||$()}),(w,U)=>(o(),u("div",wn,[G(il),!m.value&&!R.value?(o(),ee(gt,{key:0,onLog:g,onSubmit:V})):I("v-if",!0),p("div",yn,[p("div",bn,[s.value?(o(),u("span",{key:0,class:"wl-num",textContent:x(s.value)},null,8,kn)):I("v-if",!0),ae(" "+x(E.value.comment),1)]),p("ul",Cn,[(o(!0),u(B,null,Z(L(ua),b=>(o(),u("li",{key:b,class:P([b===v.value?"active":""]),onClick:F=>K(b)},x(E.value[b]),11,$n))),128))])]),p("div",Ln,[(o(!0),u(B,null,Z(y.value,b=>(o(),ee(fn,{key:b.objectId,"root-id":b.objectId,comment:b,reply:m.value,edit:R.value,onLog:g,onReply:X,onEdit:A,onSubmit:V,onStatus:T,onDelete:Q,onSticky:le,onLike:me},null,8,["root-id","comment","reply","edit"]))),128))]),n.value==="error"?(o(),u("div",En,[p("button",{type:"button",class:"wl-btn",onClick:g,textContent:x(E.value.refresh)},null,8,In)])):n.value==="loading"?(o(),u("div",An,[G(L(ue),{size:30})])):y.value.length?h.value<c.value?(o(),u("div",xn,[p("button",{type:"button",class:"wl-btn",onClick:i,textContent:x(E.value.more)},null,8,Rn)])):I("v-if",!0):(o(),u("div",{key:3,class:"wl-empty",textContent:x(E.value.sofa)},null,8,Mn)),f.value.noCopyright?I("v-if",!0):(o(),u("div",Sn,[U[0]||(U[0]=ae(" Powered by ")),U[1]||(U[1]=p("a",{href:"https://github.com/walinejs/waline",target:"_blank",rel:"noopener noreferrer"}," Waline ",-1)),ae(" v"+x(L(ht)),1)]))]))}});const ft=(e,l)=>{l.forEach((t,a)=>{const n=e[a].time;typeof n=="number"&&(t.innerText=n.toString())})},wt=({serverURL:e,path:l=window.location.pathname,selector:t=".waline-pageview-count",update:a=!0,lang:n=navigator.language})=>{const s=new AbortController,h=Array.from(document.querySelectorAll(t)),c=v=>{const y=Re(v);return y!==null&&l!==y},f=v=>St({serverURL:ye(e),paths:v.map(y=>Re(y)??l),lang:n,signal:s.signal}).then(y=>ft(y,v)).catch(st);if(a){const v=h.filter(m=>!c(m)),y=h.filter(c);Rt({serverURL:ye(e),path:l,lang:n}).then(m=>ft(m,v)),y.length&&f(y)}else f(h);return s.abort.bind(s)},Un=({el:e="#waline",path:l=window.location.pathname,comment:t=!1,pageview:a=!1,...n})=>{const s=e?xe(e):null;if(e&&!s)throw new Error("Option 'el' do not match any domElement!");if(!n.serverURL)throw new Error("Option 'serverURL' is missing!");const h=Ee({...n}),c=Ee({comment:t,pageview:a,path:l}),f=()=>{c.comment&&mt({serverURL:h.serverURL,path:c.path,...oe(c.comment)?{selector:c.comment}:{}})},v=()=>{c.pageview&&wt({serverURL:h.serverURL,path:c.path,...oe(c.pageview)?{selector:c.pageview}:{}})};let y=null;s&&(y=Nt(()=>M(jn,{path:c.path,...h})),y.mount(s));const m=Ne(f),R=Ne(v);return{el:s,update:({comment:j,pageview:E,path:$=window.location.pathname,...S}={})=>{Object.entries(S).forEach(([i,g])=>{h[i]=g}),c.path=$,j!==void 0&&(c.comment=j),E!==void 0&&(c.pageview=E)},destroy:()=>{y==null||y.unmount(),m(),R()}}},zn=({el:e,serverURL:l,count:t,lang:a=navigator.language})=>{const n=be(),s=xe(e),h=new AbortController;return jt({serverURL:l,count:t,lang:a,signal:h.signal,token:n.value.token}).then(c=>s&&c.length?(s.innerHTML=`<ul class="wl-recent-list">${c.map(f=>`<li class="wl-recent-item"><a href="${f.url}">${f.nick}</a>:${f.comment}</li>`).join("")}</ul>`,{comments:c,destroy:()=>{h.abort(),s.innerHTML=""}}):{comments:c,destroy:()=>h.abort()})},Vn=({el:e,serverURL:l,count:t,locale:a,lang:n=navigator.language,mode:s="list"})=>{const h=xe(e),c=new AbortController;return Ut({serverURL:l,pageSize:t,lang:n,signal:c.signal}).then(f=>!h||!f.length?{users:f,destroy:()=>c.abort()}:(a={...et(n),...typeof a=="object"?a:{}},h.innerHTML=`<ul class="wl-user-${s}">${f.map((v,y)=>[`<li class="wl-user-item" aria-label="${v.nick}">`,v.link&&`<a href="${v.link}" target="_blank">`,'<div class="wl-user-avatar">',`<img src="${v.avatar}" alt="${v.nick}">`,`<span class="wl-user-badge">${y+1}</span>`,"</div>",'<div class="wl-user-meta">','<div class="wl-user-name">',v.nick,v.level&&`<span class="wl-badge">${a?a[`level${v.level}`]:`Level ${v.level}`}</span>`,v.label&&`<span class="wl-badge">${v.label}</span>`,"</div>",v.link&&v.link,"</div>",v.link&&"</a>","</li>"].filter(m=>m).join("")).join("")}</ul>`,{users:f,destroy:()=>{c.abort(),h.innerHTML=""}}))};export{zn as RecentComments,Vn as UserList,mt as commentCount,fe as defaultLocales,Un as init,wt as pageviewCount,ht as version};
|
|
11
|
+
`)}catch(C){alert(C.message),s.value=s.value.replace(r,"")}finally{w.value=!1}},ke=d=>{var r;if((r=d.dataTransfer)!=null&&r.items){const C=ct(d.dataTransfer.items);C&&q.value&&(ve(C),d.preventDefault())}},yt=d=>{if(d.clipboardData){const r=ct(d.clipboardData.items);r&&q.value&&ve(r)}},bt=()=>{const d=y.value;d.files&&q.value&&ve(d.files[0]).then(()=>{d.value=""})},Se=async()=>{var d;const{serverURL:r,lang:C,login:H,wordLimit:k,requiredMeta:D,recaptchaV3Key:N,turnstileKey:Y}=n.value,_={comment:me.value,nick:h.value.nick,mail:h.value.mail,link:h.value.link,url:n.value.path,ua:await Sa()};if(!t.edit)if(c.value.token)_.nick=c.value.display_name,_.mail=c.value.email,_.link=c.value.url;else{if(H==="force")return;if(D.includes("nick")&&!_.nick){f.value.nick.focus(),alert(b.value.nickError);return}if(D.includes("mail")&&!_.mail||_.mail&&!fa(_.mail)){f.value.mail.focus(),alert(b.value.mailError);return}_.nick||(_.nick=b.value.anonymous)}if(!_.comment){v.value.focus();return}if(!Q.value){alert(b.value.wordHint.replace("$0",k[0].toString()).replace("$1",k[1].toString()).replace("$2",V.value.toString()));return}_.comment=ut(_.comment,S.value.map),t.replyId&&t.rootId&&(_.pid=t.replyId,_.rid=t.rootId,_.at=t.replyUser),w.value=!0;try{N&&(_.recaptchaV3=await Za(N).execute("social")),Y&&(_.turnstile=await Xa(Y).execute("social"));const de={serverURL:r,lang:C,token:c.value.token,comment:_},Ce=await(t.edit?pe({objectId:t.edit.objectId,...de}):It(de));if(w.value=!1,Ce.errmsg){alert(Ce.errmsg);return}a("submit",Ce.data),s.value="",A.value="",await Te(),t.replyId&&a("cancelReply"),(d=t.edit)!=null&&d.objectId&&a("cancelEdit")}catch(de){w.value=!1,alert(de.message)}},kt=d=>{d.preventDefault();const{lang:r,serverURL:C}=n.value;At({serverURL:C,lang:r}).then(H=>{c.value=H,(H.remember?localStorage:sessionStorage).setItem("WALINE_USER",JSON.stringify(H)),a("log")})},Ct=()=>{c.value={},localStorage.setItem("WALINE_USER","null"),sessionStorage.setItem("WALINE_USER","null"),a("log")},je=d=>{d.preventDefault();const{lang:r,serverURL:C}=n.value,H=800,k=800,D=(window.innerWidth-H)/2,N=(window.innerHeight-k)/2,Y=new URLSearchParams({lng:r,token:c.value.token}),_=window.open(`${C}/ui/profile?${Y.toString()}`,"_blank",`width=${H},height=${k},left=${D},top=${N},scrollbars=no,resizable=no,status=no,location=no,toolbar=no,menubar=no`);_==null||_.postMessage({type:"TOKEN",data:c.value.token},"*")},$t=d=>{var r,C,H,k;!((r=m.value)!=null&&r.contains(d.target))&&!((C=R.value)!=null&&C.contains(d.target))&&(g.value=!1),!((H=j.value)!=null&&H.contains(d.target))&&!((k=E.value)!=null&&k.contains(d.target))&&(K.value=!1)},Ue=async d=>{var r;const{scrollTop:C,clientHeight:H,scrollHeight:k}=d.target,D=(H+C)/k,N=n.value.search,Y=((r=$.value)==null?void 0:r.value)??"";D<.9||T.loading||U.value||(T.loading=!0,(N.more&&T.list.length?await N.more(Y,T.list.length):await N.search(Y)).length?T.list=[...T.list,...N.more&&T.list.length?await N.more(Y,T.list.length):await N.search(Y)]:U.value=!0,T.loading=!1,setTimeout(()=>{d.target.scrollTop=C},50))},ze=Dt(d=>{T.list=[],U.value=!1,Ue(d)},300);return We("click",$t),We("message",({data:d})=>{!d||d.type!=="profile"||(c.value={...c.value,...d.data},[localStorage,sessionStorage].filter(r=>r.getItem("WALINE_USER")).forEach(r=>{r.setItem("WALINE_USER",JSON.stringify(c))}))}),ce([n,V],([d,r])=>{const{wordLimit:C}=d;C?r<C[0]&&C[0]!==0?(le.value=C[0],Q.value=!1):r>C[1]?(le.value=C[1],Q.value=!1):(le.value=C[1],Q.value=!0):(le.value=0,Q.value=!0)}),Le(K,async d=>{var r;if(!d)return;const C=n.value.search;$.value&&($.value.value=""),T.loading=!0,T.list=await(((r=C.default)==null?void 0:r.call(C))??C.search("")),T.loading=!1}),ge(()=>{var d;(d=t.edit)!=null&&d.objectId&&(s.value=t.edit.orig),ce(()=>s.value,r=>{const{highlighter:C,texRenderer:H}=n.value;me.value=r,A.value=Aa(r,{emojiMap:S.value.map,highlighter:C,texRenderer:H}),V.value=Ra(r),r?Be(v.value):Be.destroy(v.value)}),ce(()=>n.value.emoji,async r=>{S.value=await ka(r)})}),(d,r)=>{var C,H;return o(),u("div",{key:L(c).token,class:"wl-comment"},[L(n).login!=="disable"&&F.value&&!((C=d.edit)!=null&&C.objectId)?(o(),u("div",ml,[p("div",vl,[p("button",{type:"submit",class:"wl-logout-btn",title:b.value.logout,onClick:Ct},[G(L(vt),{size:14})],8,dl),p("a",{href:"#",class:"wl-login-nick","aria-label":"Profile",title:b.value.profile,onClick:je},[p("img",{src:L(c).avatar,alt:"avatar"},null,8,gl)],8,pl)]),p("a",{href:"#",class:"wl-login-nick","aria-label":"Profile",title:b.value.profile,onClick:je,textContent:x(L(c).display_name)},null,8,hl)])):I("v-if",!0),p("div",fl,[L(n).login!=="force"&&L(n).meta.length&&!F.value?(o(),u("div",{key:0,class:P(["wl-header",`item${L(n).meta.length}`])},[(o(!0),u(B,null,Z(L(n).meta,k=>(o(),u("div",{key:k,class:"wl-header-item"},[p("label",{for:`wl-${k}`,textContent:x(b.value[k]+(L(n).requiredMeta.includes(k)||!L(n).requiredMeta.length?"":`(${b.value.optional})`))},null,8,wl),he(p("input",{id:`wl-${k}`,ref_for:!0,ref:D=>{D&&(f.value[k]=D)},"onUpdate:modelValue":D=>L(h)[k]=D,class:P(["wl-input",`wl-${k}`]),name:k,type:k==="mail"?"email":"text"},null,10,yl),[[Vt,L(h)[k]]])]))),128))],2)):I("v-if",!0),he(p("textarea",{id:"wl-edit",ref:"textarea","onUpdate:modelValue":r[0]||(r[0]=k=>_t(s)?s.value=k:null),class:"wl-editor",placeholder:d.replyUser?`@${d.replyUser}`:b.value.placeholder,onKeydown:ie,onDrop:ke,onPaste:yt},null,40,bl),[[Ht,L(s)]]),he(p("div",kl,[r[7]||(r[7]=p("hr",null,null,-1)),p("h4",null,x(b.value.preview)+":",1),p("div",{class:"wl-content",innerHTML:A.value},null,8,Cl)],512),[[Fe,X.value]]),p("div",$l,[p("div",Ll,[p("a",El,[G(L(Ha))]),he(p("button",{ref:"emoji-button",type:"button",class:P(["wl-action",{active:g.value}]),title:b.value.emoji,onClick:r[1]||(r[1]=k=>g.value=!g.value)},[G(L(Ua))],10,Il),[[Fe,S.value.tabs.length]]),L(n).search?(o(),u("button",{key:0,ref:"gif-button",type:"button",class:P(["wl-action",{active:K.value}]),title:b.value.gif,onClick:r[2]||(r[2]=k=>K.value=!K.value)},[G(L(Wa))],10,Al)):I("v-if",!0),p("input",{id:"wl-image-upload",ref:"image-uploader",class:"upload","aria-hidden":"true",type:"file",accept:".png,.jpg,.jpeg,.webp,.bmp,.gif",onChange:bt},null,544),q.value?(o(),u("label",{key:1,for:"wl-image-upload",class:"wl-action",title:b.value.uploadImage,"aria-label":b.value.uploadImage},[G(L(za))],8,Ml)):I("v-if",!0),p("button",{type:"button",class:P(["wl-action",{active:X.value}]),title:b.value.preview,onClick:r[3]||(r[3]=k=>X.value=!X.value)},[G(L(_a))],10,xl)]),p("div",Rl,[r[9]||(r[9]=p("div",{class:"wl-captcha-container"},null,-1)),p("div",Sl,[ae(x(V.value)+" ",1),L(n).wordLimit?(o(),u("span",jl,[r[8]||(r[8]=ae(" / ")),p("span",{class:P({illegal:!Q.value}),textContent:x(le.value)},null,10,Ul)])):I("v-if",!0),ae(" "+x(b.value.word),1)]),L(n).login!=="disable"&&!F.value?(o(),u("button",{key:0,type:"button",class:"wl-btn",onClick:kt,textContent:x(b.value.login)},null,8,zl)):I("v-if",!0),L(n).login!=="force"||F.value?(o(),u("button",{key:1,type:"submit",class:"primary wl-btn",title:"Cmd|Ctrl + Enter",disabled:w.value,onClick:Se},[w.value?(o(),ee(L(ue),{key:0,size:16})):(o(),u(B,{key:1},[ae(x(b.value.submit),1)],64))],8,Vl)):I("v-if",!0)]),p("div",{ref:"gif-popup",class:P(["wl-gif-popup",{display:K.value}])},[p("input",{ref:"gif-search",type:"text",placeholder:b.value.gifSearchPlaceholder,onInput:r[4]||(r[4]=(...k)=>L(ze)&&L(ze)(...k))},null,40,_l),T.list.length?(o(),ee(ul,{key:0,items:T.list,"column-width":200,gap:6,onInsert:r[5]||(r[5]=k=>O(k)),onScroll:Ue},null,8,["items"])):I("v-if",!0),T.loading?(o(),u("div",Hl,[G(L(ue),{size:30})])):I("v-if",!0)],2),p("div",{ref:"emoji-popup",class:P(["wl-emoji-popup",{display:g.value}])},[(o(!0),u(B,null,Z(S.value.tabs,(k,D)=>(o(),u(B,{key:k.name},[D===i.value?(o(),u("div",Tl,[(o(!0),u(B,null,Z(k.items,N=>(o(),u("button",{key:N,type:"button",title:N,onClick:Y=>O(`:${N}:`)},[g.value?(o(),u("img",{key:0,class:"wl-emoji",src:S.value.map[N],alt:N,loading:"lazy",referrerPolicy:"no-referrer"},null,8,Nl)):I("v-if",!0)],8,Fl))),128))])):I("v-if",!0)],64))),128)),S.value.tabs.length>1?(o(),u("div",Wl,[(o(!0),u(B,null,Z(S.value.tabs,(k,D)=>(o(),u("button",{key:k.name,type:"button",class:P(["wl-tab",{active:i.value===D}]),onClick:N=>i.value=D},[p("img",{class:"wl-emoji",src:k.icon,alt:k.name,title:k.name,loading:"lazy",referrerPolicy:"no-referrer"},null,8,Dl)],10,Bl))),128))])):I("v-if",!0)],2)])]),d.replyId||(H=d.edit)!=null&&H.objectId?(o(),u("button",{key:1,type:"button",class:"wl-close",title:b.value.cancelReply,onClick:r[6]||(r[6]=k=>d.replyId?a("cancelReply"):a("cancelEdit"))},[G(L(vt),{size:24})],8,Pl)):I("v-if",!0)])}}});const ql=["id"],Ol={class:"wl-user","aria-hidden":"true"},Gl=["src"],Kl={class:"wl-card"},Zl={class:"wl-head"},Xl=["href"],Yl={key:1,class:"wl-nick"},Jl=["textContent"],Ql=["textContent"],en=["textContent"],tn=["textContent"],an=["textContent"],ln={class:"wl-comment-actions"},nn=["title"],rn=["title"],on={class:"wl-meta","aria-hidden":"true"},sn=["data-value","textContent"],cn={key:0,class:"wl-content"},un={key:0},mn=["href"],vn=["innerHTML"],dn={key:1,class:"wl-admin-actions"},pn={class:"wl-comment-status"},gn=["disabled","onClick","textContent"],hn={key:3,class:"wl-quote"};var fn=se({__name:"CommentCard",props:{comment:{},edit:{},rootId:{},reply:{}},emits:["log","submit","delete","like","sticky","edit","reply","status"],setup(e,{emit:l}){const t=e,a=l,n=["approved","waiting","spam"],s=$e(we),h=dt(),c=Pt(),f=be(),v=W(()=>s.value.locale),y=W(()=>{const{link:i}=t.comment;return i?rt(i)?i:`https://${i}`:""}),m=W(()=>h.value.includes(t.comment.objectId)),R=W(()=>ga(new Date(t.comment.time),c.value,v.value)),j=W(()=>f.value.type==="administrator"),E=W(()=>t.comment.user_id&&f.value.objectId===t.comment.user_id),$=W(()=>{var i;return t.comment.objectId===((i=t.reply)==null?void 0:i.objectId)}),S=W(()=>{var i;return t.comment.objectId===((i=t.edit)==null?void 0:i.objectId)});return(i,g)=>{var K;const X=Tt("CommentCard",!0);return o(),u("div",{id:i.comment.objectId.toString(),class:"wl-card-item"},[p("div",Ol,[i.comment.avatar?(o(),u("img",{key:0,class:"wl-user-avatar",src:i.comment.avatar,alt:""},null,8,Gl)):I("v-if",!0),i.comment.type?(o(),ee(L(Na),{key:1})):I("v-if",!0)]),p("div",Kl,[p("div",Zl,[y.value?(o(),u("a",{key:0,class:"wl-nick",href:y.value,target:"_blank",rel:"nofollow noopener noreferrer"},x(i.comment.nick),9,Xl)):(o(),u("span",Yl,x(i.comment.nick),1)),i.comment.type==="administrator"?(o(),u("span",{key:2,class:"wl-badge",textContent:x(v.value.admin)},null,8,Jl)):I("v-if",!0),i.comment.label?(o(),u("span",{key:3,class:"wl-badge",textContent:x(i.comment.label)},null,8,Ql)):I("v-if",!0),i.comment.sticky?(o(),u("span",{key:4,class:"wl-badge",textContent:x(v.value.sticky)},null,8,en)):I("v-if",!0),typeof i.comment.level=="number"?(o(),u("span",{key:5,class:P(`wl-badge level${i.comment.level}`),textContent:x(v.value[`level${i.comment.level}`]||`Level ${i.comment.level}`)},null,10,tn)):I("v-if",!0),p("span",{class:"wl-time",textContent:x(R.value)},null,8,an),p("div",ln,[j.value||E.value?(o(),u(B,{key:0},[p("button",{type:"button",class:"wl-edit",onClick:g[0]||(g[0]=A=>a("edit",i.comment))},[G(L(Fa))]),p("button",{type:"button",class:"wl-delete",onClick:g[1]||(g[1]=A=>a("delete",i.comment))},[G(L(ja))])],64)):I("v-if",!0),p("button",{type:"button",class:"wl-like",title:m.value?v.value.cancelLike:v.value.like,onClick:g[2]||(g[2]=A=>a("like",i.comment))},[G(L(Va),{active:m.value},null,8,["active"]),ae(" "+x("like"in i.comment?i.comment.like:""),1)],8,nn),p("button",{type:"button",class:P(["wl-reply",{active:$.value}]),title:$.value?v.value.cancelReply:v.value.reply,onClick:g[3]||(g[3]=A=>a("reply",$.value?null:i.comment))},[G(L(Ta))],10,rn)])]),p("div",on,[(o(),u(B,null,Z(["addr","browser","os"],A=>(o(),u(B,null,[i.comment[A]?(o(),u("span",{key:A,class:P(`wl-${A}`),"data-value":i.comment[A],textContent:x(i.comment[A])},null,10,sn)):I("v-if",!0)],64))),64))]),S.value?I("v-if",!0):(o(),u("div",cn,["reply_user"in i.comment&&i.comment.reply_user?(o(),u("p",un,[p("a",{href:"#"+i.comment.pid},"@"+x(i.comment.reply_user.nick),9,mn),g[17]||(g[17]=p("span",null,": ",-1))])):I("v-if",!0),p("div",{innerHTML:i.comment.comment},null,8,vn)])),j.value&&!S.value?(o(),u("div",dn,[p("span",pn,[(o(),u(B,null,Z(n,A=>p("button",{key:A,type:"submit",class:P(`wl-btn wl-${A}`),disabled:i.comment.status===A,onClick:V=>a("status",{status:A,comment:i.comment}),textContent:x(v.value[A])},null,10,gn)),64))]),j.value&&!("rid"in i.comment)?(o(),u("button",{key:0,type:"submit",class:"wl-btn wl-sticky",onClick:g[4]||(g[4]=A=>a("sticky",i.comment))},x(i.comment.sticky?v.value.unsticky:v.value.sticky),1)):I("v-if",!0)])):I("v-if",!0),$.value||S.value?(o(),u("div",{key:2,class:P({"wl-reply-wrapper":$.value,"wl-edit-wrapper":S.value})},[G(gt,{edit:i.edit,"reply-id":(K=i.reply)==null?void 0:K.objectId,"reply-user":i.comment.nick,"root-id":i.rootId,onLog:g[5]||(g[5]=A=>a("log")),onCancelReply:g[6]||(g[6]=A=>a("reply",null)),onCancelEdit:g[7]||(g[7]=A=>a("edit",null)),onSubmit:g[8]||(g[8]=A=>a("submit",A))},null,8,["edit","reply-id","reply-user","root-id"])],2)):I("v-if",!0),"children"in i.comment?(o(),u("div",hn,[(o(!0),u(B,null,Z(i.comment.children,A=>(o(),ee(X,{key:A.objectId,comment:A,reply:i.reply,edit:i.edit,"root-id":i.rootId,onLog:g[9]||(g[9]=V=>a("log")),onDelete:g[10]||(g[10]=V=>a("delete",V)),onEdit:g[11]||(g[11]=V=>a("edit",V)),onLike:g[12]||(g[12]=V=>a("like",V)),onReply:g[13]||(g[13]=V=>a("reply",V)),onStatus:g[14]||(g[14]=V=>a("status",V)),onSticky:g[15]||(g[15]=V=>a("sticky",V)),onSubmit:g[16]||(g[16]=V=>a("submit",V))},null,8,["comment","reply","edit","root-id"]))),128))])):I("v-if",!0)])],8,ql)}}});const ht="3.5.5",wn={"data-waline":""},yn={class:"wl-meta-head"},bn={class:"wl-count"},kn=["textContent"],Cn={class:"wl-sort"},$n=["onClick"],Ln={class:"wl-cards"},En={key:1,class:"wl-operation"},In=["textContent"],An={key:2,class:"wl-loading"},Mn=["textContent"],xn={key:4,class:"wl-operation"},Rn=["textContent"],Sn={key:5,class:"wl-power"};var jn=se({__name:"WalineComment",props:{serverURL:{},path:{},meta:{},requiredMeta:{},wordLimit:{},pageSize:{},lang:{},locale:{},commentSorting:{},dark:{type:[String,Boolean]},login:{},noCopyright:{type:Boolean},recaptchaV3Key:{},turnstileKey:{},reaction:{},emoji:{},search:{},highlighter:{type:Function},imageUploader:{type:Function},texRenderer:{type:Function}},setup(e){const l=e,t=be(),a=dt(),n=z("loading"),s=z(0),h=z(1),c=z(0),f=W(()=>va(l)),v=z(f.value.commentSorting),y=z([]),m=z(null),R=z(null),j=W(()=>da(f.value.dark)),E=W(()=>f.value.locale);qt(j,{id:"waline-darkmode"});let $=null;const S=w=>{const{serverURL:U,path:b,pageSize:F}=f.value,q=new AbortController;n.value="loading",$==null||$(),xt({serverURL:U,lang:f.value.lang,path:b,pageSize:F,sortBy:at[v.value],page:w,signal:q.signal,token:t.value.token}).then(O=>{n.value="success",s.value=O.count,y.value.push(...O.data),h.value=w,c.value=O.totalPages}).catch(O=>{O.name!=="AbortError"&&(console.error(O.message),n.value="error")}),$=q.abort.bind(q)},i=()=>{S(h.value+1)},g=()=>{s.value=0,y.value=[],S(1)},K=w=>{v.value!==w&&(v.value=w,g())},X=w=>{m.value=w},A=w=>{R.value=w},V=w=>{if(R.value)R.value.comment=w.comment,R.value.orig=w.orig;else if("rid"in w){const U=y.value.find(({objectId:b})=>b===w.rid);if(!U)return;Array.isArray(U.children)||(U.children=[]),U.children.push(w)}else y.value.unshift(w),s.value+=1},T=async({comment:w,status:U})=>{if(w.status===U)return;const{serverURL:b,lang:F}=f.value;await pe({serverURL:b,lang:F,token:t.value.token,objectId:w.objectId,comment:{status:U}}),w.status=U},le=async w=>{if("rid"in w)return;const{serverURL:U,lang:b}=f.value;await pe({serverURL:U,lang:b,token:t.value.token,objectId:w.objectId,comment:{sticky:w.sticky?0:1}}),w.sticky=!w.sticky},Q=async({objectId:w})=>{if(!confirm("Are you sure you want to delete this comment?"))return;const{serverURL:U,lang:b}=f.value;await Mt({serverURL:U,lang:b,token:t.value.token,objectId:w}),y.value.some((F,q)=>F.objectId===w?(y.value=y.value.filter((O,ie)=>ie!==q),!0):F.children.some((O,ie)=>O.objectId===w?(y.value[q].children=F.children.filter((ve,ke)=>ke!==ie),!0):!1))},me=async w=>{const{serverURL:U,lang:b}=f.value,{objectId:F}=w,q=a.value.includes(F);await pe({serverURL:U,lang:b,objectId:F,token:t.value.token,comment:{like:!q}}),q?a.value=a.value.filter(O=>O!==F):(a.value=[...a.value,F],a.value.length>50&&(a.value=a.value.slice(-50))),w.like=Math.max(0,(w.like||0)+(q?-1:1))};return Ft(we,f),ge(()=>{ce(()=>[l.serverURL,l.path],()=>{g()})}),_e(()=>{$==null||$()}),(w,U)=>(o(),u("div",wn,[G(il),!m.value&&!R.value?(o(),ee(gt,{key:0,onLog:g,onSubmit:V})):I("v-if",!0),p("div",yn,[p("div",bn,[s.value?(o(),u("span",{key:0,class:"wl-num",textContent:x(s.value)},null,8,kn)):I("v-if",!0),ae(" "+x(E.value.comment),1)]),p("ul",Cn,[(o(!0),u(B,null,Z(L(ua),b=>(o(),u("li",{key:b,class:P([b===v.value?"active":""]),onClick:F=>K(b)},x(E.value[b]),11,$n))),128))])]),p("div",Ln,[(o(!0),u(B,null,Z(y.value,b=>(o(),ee(fn,{key:b.objectId,"root-id":b.objectId,comment:b,reply:m.value,edit:R.value,onLog:g,onReply:X,onEdit:A,onSubmit:V,onStatus:T,onDelete:Q,onSticky:le,onLike:me},null,8,["root-id","comment","reply","edit"]))),128))]),n.value==="error"?(o(),u("div",En,[p("button",{type:"button",class:"wl-btn",onClick:g,textContent:x(E.value.refresh)},null,8,In)])):n.value==="loading"?(o(),u("div",An,[G(L(ue),{size:30})])):y.value.length?h.value<c.value?(o(),u("div",xn,[p("button",{type:"button",class:"wl-btn",onClick:i,textContent:x(E.value.more)},null,8,Rn)])):I("v-if",!0):(o(),u("div",{key:3,class:"wl-empty",textContent:x(E.value.sofa)},null,8,Mn)),f.value.noCopyright?I("v-if",!0):(o(),u("div",Sn,[U[0]||(U[0]=ae(" Powered by ")),U[1]||(U[1]=p("a",{href:"https://github.com/walinejs/waline",target:"_blank",rel:"noopener noreferrer"}," Waline ",-1)),ae(" v"+x(L(ht)),1)]))]))}});const ft=(e,l)=>{l.forEach((t,a)=>{const n=e[a].time;typeof n=="number"&&(t.innerText=n.toString())})},wt=({serverURL:e,path:l=window.location.pathname,selector:t=".waline-pageview-count",update:a=!0,lang:n=navigator.language})=>{const s=new AbortController,h=Array.from(document.querySelectorAll(t)),c=v=>{const y=Re(v);return y!==null&&l!==y},f=v=>St({serverURL:ye(e),paths:v.map(y=>Re(y)??l),lang:n,signal:s.signal}).then(y=>ft(y,v)).catch(st);if(a){const v=h.filter(m=>!c(m)),y=h.filter(c);Rt({serverURL:ye(e),path:l,lang:n}).then(m=>ft(m,v)),y.length&&f(y)}else f(h);return s.abort.bind(s)},Un=({el:e="#waline",path:l=window.location.pathname,comment:t=!1,pageview:a=!1,...n})=>{const s=e?xe(e):null;if(e&&!s)throw new Error("Option 'el' do not match any domElement!");if(!n.serverURL)throw new Error("Option 'serverURL' is missing!");const h=Ee({...n}),c=Ee({comment:t,pageview:a,path:l}),f=()=>{c.comment&&mt({serverURL:h.serverURL,path:c.path,...oe(c.comment)?{selector:c.comment}:{}})},v=()=>{c.pageview&&wt({serverURL:h.serverURL,path:c.path,...oe(c.pageview)?{selector:c.pageview}:{}})};let y=null;s&&(y=Nt(()=>M(jn,{path:c.path,...h})),y.mount(s));const m=Ne(f),R=Ne(v);return{el:s,update:({comment:j,pageview:E,path:$=window.location.pathname,...S}={})=>{Object.entries(S).forEach(([i,g])=>{h[i]=g}),c.path=$,j!==void 0&&(c.comment=j),E!==void 0&&(c.pageview=E)},destroy:()=>{y==null||y.unmount(),m(),R()}}},zn=({el:e,serverURL:l,count:t,lang:a=navigator.language})=>{const n=be(),s=xe(e),h=new AbortController;return jt({serverURL:l,count:t,lang:a,signal:h.signal,token:n.value.token}).then(c=>s&&c.length?(s.innerHTML=`<ul class="wl-recent-list">${c.map(f=>`<li class="wl-recent-item"><a href="${f.url}">${f.nick}</a>:${f.comment}</li>`).join("")}</ul>`,{comments:c,destroy:()=>{h.abort(),s.innerHTML=""}}):{comments:c,destroy:()=>h.abort()})},Vn=({el:e,serverURL:l,count:t,locale:a,lang:n=navigator.language,mode:s="list"})=>{const h=xe(e),c=new AbortController;return Ut({serverURL:l,pageSize:t,lang:n,signal:c.signal}).then(f=>!h||!f.length?{users:f,destroy:()=>c.abort()}:(a={...et(n),...typeof a=="object"?a:{}},h.innerHTML=`<ul class="wl-user-${s}">${f.map((v,y)=>[`<li class="wl-user-item" aria-label="${v.nick}">`,v.link&&`<a href="${v.link}" target="_blank">`,'<div class="wl-user-avatar">',`<img src="${v.avatar}" alt="${v.nick}">`,`<span class="wl-user-badge">${y+1}</span>`,"</div>",'<div class="wl-user-meta">','<div class="wl-user-name">',v.nick,v.level&&`<span class="wl-badge">${a?a[`level${v.level}`]:`Level ${v.level}`}</span>`,v.label&&`<span class="wl-badge">${v.label}</span>`,"</div>",v.link&&v.link,"</div>",v.link&&"</a>","</li>"].filter(m=>m).join("")).join("")}</ul>`,{users:f,destroy:()=>{c.abort(),h.innerHTML=""}}))};export{zn as RecentComments,Vn as UserList,mt as commentCount,fe as defaultLocales,Un as init,wt as pageviewCount,ht as version};
|
|
12
12
|
//# sourceMappingURL=slim.js.map
|
package/dist/waline.js
CHANGED
|
@@ -80,5 +80,5 @@ ${t}</tr>
|
|
|
80
80
|
`+this.renderer.text(c);n?r+=this.renderer.paragraph({type:"paragraph",raw:u,text:u,tokens:[{type:"text",raw:u,text:u,escaped:!0}]}):r+=u;continue}default:{const c='Token with "'+a.type+'" type was not found.';if(this.options.silent)return console.error(c),"";throw new Error(c)}}}return r}parseInline(t,n=this.renderer){var s,i;let r="";for(let l=0;l<t.length;l++){const o=t[l];if((i=(s=this.options.extensions)==null?void 0:s.renderers)!=null&&i[o.type]){const c=this.options.extensions.renderers[o.type].call({parser:this},o);if(c!==!1||!["escape","html","link","image","strong","em","codespan","br","del","text"].includes(o.type)){r+=c||"";continue}}const a=o;switch(a.type){case"escape":{r+=n.text(a);break}case"html":{r+=n.html(a);break}case"link":{r+=n.link(a);break}case"image":{r+=n.image(a);break}case"strong":{r+=n.strong(a);break}case"em":{r+=n.em(a);break}case"codespan":{r+=n.codespan(a);break}case"br":{r+=n.br(a);break}case"del":{r+=n.del(a);break}case"text":{r+=n.text(a);break}default:{const c='Token with "'+a.type+'" type was not found.';if(this.options.silent)return console.error(c),"";throw new Error(c)}}}return r}}class Tn{options;block;constructor(t){this.options=t||Lt}preprocess(t){return t}postprocess(t){return t}processAllTokens(t){return t}provideLexer(){return this.block?Be.lex:Be.lexInline}provideParser(){return this.block?Ve.parse:Ve.parseInline}}Ts(Tn,"passThroughHooks",new Set(["preprocess","postprocess","processAllTokens"]));class no{defaults=ms();options=this.setOptions;parse=this.parseMarkdown(!0);parseInline=this.parseMarkdown(!1);Parser=Ve;Renderer=Cr;TextRenderer=Ss;Lexer=Be;Tokenizer=_r;Hooks=Tn;constructor(...t){this.use(...t)}walkTokens(t,n){var s,i;let r=[];for(const l of t)switch(r=r.concat(n.call(this,l)),l.type){case"table":{const o=l;for(const a of o.header)r=r.concat(this.walkTokens(a.tokens,n));for(const a of o.rows)for(const c of a)r=r.concat(this.walkTokens(c.tokens,n));break}case"list":{const o=l;r=r.concat(this.walkTokens(o.items,n));break}default:{const o=l;(i=(s=this.defaults.extensions)==null?void 0:s.childTokens)!=null&&i[o.type]?this.defaults.extensions.childTokens[o.type].forEach(a=>{const c=o[a].flat(1/0);r=r.concat(this.walkTokens(c,n))}):o.tokens&&(r=r.concat(this.walkTokens(o.tokens,n)))}}return r}use(...t){const n=this.defaults.extensions||{renderers:{},childTokens:{}};return t.forEach(r=>{const s={...r};if(s.async=this.defaults.async||s.async||!1,r.extensions&&(r.extensions.forEach(i=>{if(!i.name)throw new Error("extension name required");if("renderer"in i){const l=n.renderers[i.name];l?n.renderers[i.name]=function(...o){let a=i.renderer.apply(this,o);return a===!1&&(a=l.apply(this,o)),a}:n.renderers[i.name]=i.renderer}if("tokenizer"in i){if(!i.level||i.level!=="block"&&i.level!=="inline")throw new Error("extension level must be 'block' or 'inline'");const l=n[i.level];l?l.unshift(i.tokenizer):n[i.level]=[i.tokenizer],i.start&&(i.level==="block"?n.startBlock?n.startBlock.push(i.start):n.startBlock=[i.start]:i.level==="inline"&&(n.startInline?n.startInline.push(i.start):n.startInline=[i.start]))}"childTokens"in i&&i.childTokens&&(n.childTokens[i.name]=i.childTokens)}),s.extensions=n),r.renderer){const i=this.defaults.renderer||new Cr(this.defaults);for(const l in r.renderer){if(!(l in i))throw new Error(`renderer '${l}' does not exist`);if(["options","parser"].includes(l))continue;const o=l,a=r.renderer[o],c=i[o];i[o]=(...u)=>{let f=a.apply(i,u);return f===!1&&(f=c.apply(i,u)),f||""}}s.renderer=i}if(r.tokenizer){const i=this.defaults.tokenizer||new _r(this.defaults);for(const l in r.tokenizer){if(!(l in i))throw new Error(`tokenizer '${l}' does not exist`);if(["options","rules","lexer"].includes(l))continue;const o=l,a=r.tokenizer[o],c=i[o];i[o]=(...u)=>{let f=a.apply(i,u);return f===!1&&(f=c.apply(i,u)),f}}s.tokenizer=i}if(r.hooks){const i=this.defaults.hooks||new Tn;for(const l in r.hooks){if(!(l in i))throw new Error(`hook '${l}' does not exist`);if(["options","block"].includes(l))continue;const o=l,a=r.hooks[o],c=i[o];Tn.passThroughHooks.has(l)?i[o]=u=>{if(this.defaults.async)return Promise.resolve(a.call(i,u)).then(d=>c.call(i,d));const f=a.call(i,u);return c.call(i,f)}:i[o]=(...u)=>{let f=a.apply(i,u);return f===!1&&(f=c.apply(i,u)),f}}s.hooks=i}if(r.walkTokens){const i=this.defaults.walkTokens,l=r.walkTokens;s.walkTokens=function(o){let a=[];return a.push(l.call(this,o)),i&&(a=a.concat(i.call(this,o))),a}}this.defaults={...this.defaults,...s}}),this}setOptions(t){return this.defaults={...this.defaults,...t},this}lexer(t,n){return Be.lex(t,n??this.defaults)}parser(t,n){return Ve.parse(t,n??this.defaults)}parseMarkdown(t){return(r,s)=>{const i={...s},l={...this.defaults,...i},o=this.onError(!!l.silent,!!l.async);if(this.defaults.async===!0&&i.async===!1)return o(new Error("marked(): The async option was set to true by an extension. Remove async: false from the parse options object to return a Promise."));if(typeof r>"u"||r===null)return o(new Error("marked(): input parameter is undefined or null"));if(typeof r!="string")return o(new Error("marked(): input parameter is of type "+Object.prototype.toString.call(r)+", string expected"));l.hooks&&(l.hooks.options=l,l.hooks.block=t);const a=l.hooks?l.hooks.provideLexer():t?Be.lex:Be.lexInline,c=l.hooks?l.hooks.provideParser():t?Ve.parse:Ve.parseInline;if(l.async)return Promise.resolve(l.hooks?l.hooks.preprocess(r):r).then(u=>a(u,l)).then(u=>l.hooks?l.hooks.processAllTokens(u):u).then(u=>l.walkTokens?Promise.all(this.walkTokens(u,l.walkTokens)).then(()=>u):u).then(u=>c(u,l)).then(u=>l.hooks?l.hooks.postprocess(u):u).catch(o);try{l.hooks&&(r=l.hooks.preprocess(r));let u=a(r,l);l.hooks&&(u=l.hooks.processAllTokens(u)),l.walkTokens&&this.walkTokens(u,l.walkTokens);let f=c(u,l);return l.hooks&&(f=l.hooks.postprocess(f)),f}catch(u){return o(u)}}}onError(t,n){return r=>{if(r.message+=`
|
|
81
81
|
Please report this to https://github.com/markedjs/marked.`,t){const s="<p>An error occurred:</p><pre>"+Ye(r.message+"",!0)+"</pre>";return n?Promise.resolve(s):s}if(n)return Promise.reject(r);throw r}}}const Mt=new no;function pe(e,t){return Mt.parse(e,t)}pe.options=pe.setOptions=function(e){return Mt.setOptions(e),pe.defaults=Mt.defaults,Hl(pe.defaults),pe},pe.getDefaults=ms,pe.defaults=Lt,pe.use=function(...e){return Mt.use(...e),pe.defaults=Mt.defaults,Hl(pe.defaults),pe},pe.walkTokens=function(e,t){return Mt.walkTokens(e,t)},pe.parseInline=Mt.parseInline,pe.Parser=Ve,pe.parser=Ve.parse,pe.Renderer=Cr,pe.TextRenderer=Ss,pe.Lexer=Be,pe.lexer=Be.lex,pe.Tokenizer=_r,pe.Hooks=Tn,pe.parse=pe;function Sf(e){if(typeof e=="function"&&(e={highlight:e}),!e||typeof e.highlight!="function")throw new Error("Must provide highlight function");return typeof e.langPrefix!="string"&&(e.langPrefix="language-"),typeof e.emptyLangClass!="string"&&(e.emptyLangClass=""),{async:!!e.async,walkTokens(t){if(t.type!=="code")return;const n=ro(t.lang);if(e.async)return Promise.resolve(e.highlight(t.text,n,t.lang||"")).then(so(t));const r=e.highlight(t.text,n,t.lang||"");if(r instanceof Promise)throw new Error("markedHighlight is not set to async but the highlight function is async. Set the async option to true on markedHighlight to await the async highlight function.");so(t)(r)},useNewRenderer:!0,renderer:{code(t,n,r){typeof t=="object"&&(r=t.escaped,n=t.lang,t=t.text);const s=ro(n),i=s?e.langPrefix+ao(s):e.emptyLangClass,l=i?` class="${i}"`:"";return t=t.replace(/\n$/,""),`<pre><code${l}>${r?t:ao(t,!0)}
|
|
82
82
|
</code></pre>`}}}}function ro(e){return(e||"").match(/\S*/)[0]}function so(e){return t=>{typeof t=="string"&&t!==e.text&&(e.escaped=!0,e.text=t)}}const io=/[&<>"']/,$f=new RegExp(io.source,"g"),lo=/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/,Rf=new RegExp(lo.source,"g"),Af={"&":"&","<":"<",">":">",'"':""","'":"'"},oo=e=>Af[e];function ao(e,t){if(t){if(io.test(e))return e.replace($f,oo)}else if(lo.test(e))return e.replace(Rf,oo);return e}const Ef=/\$.*?\$/,Tf=/^\$(.*?)\$/,If=/^(?:\s{0,3})\$\$((?:[^\n]|\n[^\n])+?)\n{0,1}\$\$/,Lf=e=>[{name:"blockMath",level:"block",tokenizer(t){const n=If.exec(t);if(n!==null)return{type:"html",raw:n[0],text:e(!0,n[1])}}},{name:"inlineMath",level:"inline",start(t){const n=t.search(Ef);return n!==-1?n:t.length},tokenizer(t){const n=Tf.exec(t);if(n!==null)return{type:"html",raw:n[0],text:e(!1,n[1])}}}],co=(e="",t={})=>e.replace(/:(.+?):/g,(n,r)=>t[r]?`<img class="wl-emoji" src="${t[r]}" alt="${r}">`:n),Mf=(e,{emojiMap:t,highlighter:n,texRenderer:r})=>{const s=new no;if(s.setOptions({breaks:!0}),n&&s.use(Sf({highlight:n})),r){const i=Lf(r);s.use({extensions:i})}return s.parse(co(e,t))},$s=e=>{const{path:t}=e.dataset;return t!=null&&t.length?t:null},Pf=e=>e.match(/[\w\d\s,.\u00C0-\u024F\u0400-\u04FF]+/giu),Of=e=>e.match(/[\u4E00-\u9FD5]/gu),jf=e=>{var t,n;return(((t=Pf(e))==null?void 0:t.reduce((r,s)=>r+(["",",","."].includes(s.trim())?0:s.trim().split(/\s+/u).length),0))??0)+(((n=Of(e))==null?void 0:n.length)??0)},zf=async()=>{const{userAgentData:e}=navigator;let t=navigator.userAgent;if(!e||e.platform!=="Windows")return t;const{platformVersion:n}=await e.getHighEntropyValues(["platformVersion"]);return n&&parseInt(n.split(".")[0])>=13&&(t=t.replace("Windows NT 10.0","Windows NT 11.0")),t},uo=({serverURL:e,path:t=window.location.pathname,selector:n=".waline-comment-count",lang:r=navigator.language})=>{const s=new AbortController,i=document.querySelectorAll(n);return i.length&&Os({serverURL:Hn(e),paths:Array.from(i).map(l=>ti($s(l)??t)),lang:r,signal:s.signal}).then(l=>{i.forEach((o,a)=>{o.innerText=l[a].toString()})}).catch(Dl),s.abort.bind(s)},fo=({size:e})=>ne("svg",{class:"wl-close-icon",viewBox:"0 0 1024 1024",width:e,height:e},[ne("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"}),ne("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"})]),Df=()=>ne("svg",{viewBox:"0 0 1024 1024",width:"24",height:"24"},ne("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"})),Ff=()=>ne("svg",{viewBox:"0 0 1024 1024",width:"24",height:"24"},ne("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"})),Hf=()=>ne("svg",{viewBox:"0 0 1024 1024",width:"24",height:"24"},[ne("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"}),ne("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"})]),Uf=({active:e=!1})=>ne("svg",{viewBox:"0 0 1024 1024",width:"24",height:"24"},[ne("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"})]),Nf=()=>ne("svg",{viewBox:"0 0 1024 1024",width:"24",height:"24"},[ne("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"}),ne("path",{d:"M703.319 121.603H321.03c-109.8 0-199.469 89.146-199.469 199.38v382.034c0 109.796 89.236 199.38 199.469 199.38h207.397c20.653 0 37.384-16.645 37.384-37.299 0-20.649-16.731-37.296-37.384-37.296H321.03c-68.582 0-124.352-55.77-124.352-124.267V321.421c0-68.496 55.77-124.267 124.352-124.267h382.289c68.582 0 124.352 55.771 124.352 124.267V524.72c0 20.654 16.736 37.299 37.385 37.299 20.654 0 37.384-16.645 37.384-37.299V320.549c-.085-109.8-89.321-198.946-199.121-198.946zm0 0",fill:"currentColor"})]),Bf=()=>ne("svg",{width:"16",height:"16",ariaHidden:"true"},ne("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"})),Vf=()=>ne("svg",{viewBox:"0 0 1024 1024",width:"24",height:"24"},ne("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"})),Wf=()=>ne("svg",{viewBox:"0 0 1024 1024",width:"24",height:"24"},ne("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"})),qf=()=>ne("svg",{class:"verified-icon",viewBox:"0 0 1024 1024",width:"14",height:"14"},ne("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"})),In=({size:e=100})=>ne("svg",{width:e,height:e,viewBox:"0 0 100 100",preserveAspectRatio:"xMidYMid"},ne("circle",{cx:50,cy:50,fill:"none",stroke:"currentColor",strokeWidth:"4",r:"40","stroke-dasharray":"85 30"},ne("animateTransform",{attributeName:"transform",type:"rotate",repeatCount:"indefinite",dur:"1s",values:"0 50 50;360 50 50",keyTimes:"0;1"}))),Kf=()=>ne("svg",{width:24,height:24,fill:"currentcolor",viewBox:"0 0 24 24"},[ne("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"}),ne("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"})]),Gf=()=>Qt("WALINE_USER_META",{nick:"",mail:"",link:""}),Zf=()=>Qt("WALINE_COMMENT_BOX_EDITOR",""),Jf="WALINE_LIKE",Yf=Qt(Jf,[]),ho=()=>Yf,Qf="WALINE_REACTION",Xf=Qt(Qf,{}),eh=()=>Xf;var Rs={},at={},ct={},po;function go(){if(po)return ct;po=1;var e=ct&&ct.__awaiter||function(r,s,i,l){function o(a){return a instanceof i?a:new i(function(c){c(a)})}return new(i||(i=Promise))(function(a,c){function u(m){try{d(l.next(m))}catch(x){c(x)}}function f(m){try{d(l.throw(m))}catch(x){c(x)}}function d(m){m.done?a(m.value):o(m.value).then(u,f)}d((l=l.apply(r,s||[])).next())})},t=ct&&ct.__generator||function(r,s){var i={label:0,sent:function(){if(a[0]&1)throw a[1];return a[1]},trys:[],ops:[]},l,o,a,c;return c={next:u(0),throw:u(1),return:u(2)},typeof Symbol=="function"&&(c[Symbol.iterator]=function(){return this}),c;function u(d){return function(m){return f([d,m])}}function f(d){if(l)throw new TypeError("Generator is already executing.");for(;c&&(c=0,d[0]&&(i=0)),i;)try{if(l=1,o&&(a=d[0]&2?o.return:d[0]?o.throw||((a=o.return)&&a.call(o),0):o.next)&&!(a=a.call(o,d[1])).done)return a;switch(o=0,a&&(d=[d[0]&2,a.value]),d[0]){case 0:case 1:a=d;break;case 4:return i.label++,{value:d[1],done:!1};case 5:i.label++,o=d[1],d=[0];continue;case 7:d=i.ops.pop(),i.trys.pop();continue;default:if(a=i.trys,!(a=a.length>0&&a[a.length-1])&&(d[0]===6||d[0]===2)){i=0;continue}if(d[0]===3&&(!a||d[1]>a[0]&&d[1]<a[3])){i.label=d[1];break}if(d[0]===6&&i.label<a[1]){i.label=a[1],a=d;break}if(a&&i.label<a[2]){i.label=a[2],i.ops.push(d);break}a[2]&&i.ops.pop(),i.trys.pop();continue}d=s.call(r,i)}catch(m){d=[6,m],o=0}finally{l=a=0}if(d[0]&5)throw d[1];return{value:d[0]?d[1]:void 0,done:!0}}};Object.defineProperty(ct,"__esModule",{value:!0}),ct.ReCaptchaInstance=void 0;var n=function(){function r(s,i,l){this.siteKey=s,this.recaptchaID=i,this.recaptcha=l,this.styleContainer=null}return r.prototype.execute=function(s){return e(this,void 0,void 0,function(){var i;return t(this,function(l){switch(l.label){case 0:return this.recaptcha.enterprise?[4,this.recaptcha.enterprise.execute(this.recaptchaID,{action:s})]:[3,2];case 1:return i=l.sent(),[3,4];case 2:return[4,this.recaptcha.execute(this.recaptchaID,{action:s})];case 3:i=l.sent(),l.label=4;case 4:return[2,i]}})})},r.prototype.getSiteKey=function(){return this.siteKey},r.prototype.hideBadge=function(){this.styleContainer===null&&(this.styleContainer=document.createElement("style"),this.styleContainer.innerHTML=".grecaptcha-badge{visibility:hidden !important;}",document.head.appendChild(this.styleContainer))},r.prototype.showBadge=function(){this.styleContainer!==null&&(document.head.removeChild(this.styleContainer),this.styleContainer=null)},r}();return ct.ReCaptchaInstance=n,ct}var mo;function th(){if(mo)return at;mo=1;var e=at&&at.__assign||function(){return e=Object.assign||function(s){for(var i,l=1,o=arguments.length;l<o;l++){i=arguments[l];for(var a in i)Object.prototype.hasOwnProperty.call(i,a)&&(s[a]=i[a])}return s},e.apply(this,arguments)};Object.defineProperty(at,"__esModule",{value:!0}),at.getInstance=at.load=void 0;var t=go(),n;(function(s){s[s.NOT_LOADED=0]="NOT_LOADED",s[s.LOADING=1]="LOADING",s[s.LOADED=2]="LOADED"})(n||(n={}));var r=function(){function s(){}return s.load=function(i,l){if(l===void 0&&(l={}),typeof document>"u")return Promise.reject(new Error("This is a library for the browser!"));if(s.getLoadingState()===n.LOADED)return s.instance.getSiteKey()===i?Promise.resolve(s.instance):Promise.reject(new Error("reCAPTCHA already loaded with different site key!"));if(s.getLoadingState()===n.LOADING)return i!==s.instanceSiteKey?Promise.reject(new Error("reCAPTCHA already loaded with different site key!")):new Promise(function(a,c){s.successfulLoadingConsumers.push(function(u){return a(u)}),s.errorLoadingRunnable.push(function(u){return c(u)})});s.instanceSiteKey=i,s.setLoadingState(n.LOADING);var o=new s;return new Promise(function(a,c){o.loadScript(i,l.useRecaptchaNet||!1,l.useEnterprise||!1,l.renderParameters?l.renderParameters:{},l.customUrl).then(function(){s.setLoadingState(n.LOADED);var u=o.doExplicitRender(grecaptcha,i,l.explicitRenderParameters?l.explicitRenderParameters:{},l.useEnterprise||!1),f=new t.ReCaptchaInstance(i,u,grecaptcha);s.successfulLoadingConsumers.forEach(function(d){return d(f)}),s.successfulLoadingConsumers=[],l.autoHideBadge&&f.hideBadge(),s.instance=f,a(f)}).catch(function(u){s.errorLoadingRunnable.forEach(function(f){return f(u)}),s.errorLoadingRunnable=[],c(u)})})},s.getInstance=function(){return s.instance},s.setLoadingState=function(i){s.loadingState=i},s.getLoadingState=function(){return s.loadingState===null?n.NOT_LOADED:s.loadingState},s.prototype.loadScript=function(i,l,o,a,c){var u=this;l===void 0&&(l=!1),o===void 0&&(o=!1),a===void 0&&(a={}),c===void 0&&(c="");var f=document.createElement("script");f.setAttribute("recaptcha-v3-script",""),f.setAttribute("async",""),f.setAttribute("defer","");var d="https://www.google.com/recaptcha/api.js";l?o?d="https://recaptcha.net/recaptcha/enterprise.js":d="https://recaptcha.net/recaptcha/api.js":o&&(d="https://www.google.com/recaptcha/enterprise.js"),c&&(d=c),a.render&&(a.render=void 0);var m=this.buildQueryString(a);return f.src=d+"?render=explicit"+m,new Promise(function(x,b){f.addEventListener("load",u.waitForScriptToLoad(function(){x(f)},o),!1),f.onerror=function(T){s.setLoadingState(n.NOT_LOADED),b(T)},document.head.appendChild(f)})},s.prototype.buildQueryString=function(i){var l=Object.keys(i);return l.length<1?"":"&"+Object.keys(i).filter(function(o){return!!i[o]}).map(function(o){return o+"="+i[o]}).join("&")},s.prototype.waitForScriptToLoad=function(i,l){var o=this;return function(){window.grecaptcha===void 0?setTimeout(function(){o.waitForScriptToLoad(i,l)},s.SCRIPT_LOAD_DELAY):l?window.grecaptcha.enterprise.ready(function(){i()}):window.grecaptcha.ready(function(){i()})}},s.prototype.doExplicitRender=function(i,l,o,a){var c=e({sitekey:l},o);return o.container?a?i.enterprise.render(o.container,c):i.render(o.container,c):a?i.enterprise.render(c):i.render(c)},s.loadingState=null,s.instance=null,s.instanceSiteKey=null,s.successfulLoadingConsumers=[],s.errorLoadingRunnable=[],s.SCRIPT_LOAD_DELAY=25,s}();return at.load=r.load,at.getInstance=r.getInstance,at}var vo;function nh(){return vo||(vo=1,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.ReCaptchaInstance=e.getInstance=e.load=void 0;var t=th();Object.defineProperty(e,"load",{enumerable:!0,get:function(){return t.load}}),Object.defineProperty(e,"getInstance",{enumerable:!0,get:function(){return t.getInstance}});var n=go();Object.defineProperty(e,"ReCaptchaInstance",{enumerable:!0,get:function(){return n.ReCaptchaInstance}})}(Rs)),Rs}var rh=nh();const bo={},sh=e=>{const t=bo[e]??(bo[e]=rh.load(e,{useRecaptchaNet:!0,autoHideBadge:!0}));return{execute:n=>t.then(r=>r.execute(n))}},ih=e=>({execute:async t=>{const{load:n}=Ou("https://challenges.cloudflare.com/turnstile/v0/api.js",void 0,{async:!1});await n();const r=window.turnstile;return new Promise(s=>{r==null||r.ready(()=>{r.render(".wl-captcha-container",{sitekey:e,action:t,size:"compact",callback:s})})})}}),lh="WALINE_USER",oh=Qt(lh,{}),Sr=()=>oh,ah={key:0,class:"wl-reaction"},ch=["textContent"],uh={class:"wl-reaction-list"},fh=["onClick"],hh={class:"wl-reaction-img"},ph=["src","alt"],dh=["textContent"],gh=["textContent"];var mh=mn({__name:"ArticleReaction",setup(e){const t=eh(),n=sr(Fn),r=te(-1),s=te([]),i=ge(()=>n.value.locale),l=ge(()=>{const{reaction:f}=n.value;return f!=null&&f.length?f:null}),o=ge(()=>{var f;const{path:d}=n.value;return((f=l.value)==null?void 0:f.map((m,x)=>({icon:m,desc:i.value[`reaction${x}`],active:t.value[d]===x})))??null});let a;const c=async()=>{const{serverURL:f,lang:d,path:m}=n.value;if(!l.value)return;const x=new AbortController;a=x.abort.bind(x);const[b]=await Rr({serverURL:f,lang:d,paths:[m],type:l.value.map((T,w)=>`reaction${w}`),signal:x.signal});s.value=l.value.map((T,w)=>b[`reaction${w}`])},u=async f=>{if(r.value!==-1)return;const{serverURL:d,lang:m,path:x}=n.value,b=t.value[x];r.value=f,b!==void 0&&(await zn({serverURL:d,lang:m,path:x,type:`reaction${b}`,action:"desc"}),s.value[b]=Math.max(s.value[b]-1,0)),b!==f&&(await zn({serverURL:d,lang:m,path:x,type:`reaction${f}`}),s.value[f]=(s.value[f]||0)+1),b===f?delete t.value[x]:t.value[x]=f,r.value=-1};return bn(()=>{Yt(()=>[n.value.serverURL,n.value.path],()=>c())}),Xr(()=>{a==null||a()}),(f,d)=>o.value?(L(),P("div",ah,[D("div",{class:"wl-reaction-title",textContent:Y(i.value.reactionTitle)},null,8,ch),D("ul",uh,[(L(!0),P(fe,null,Fe(o.value,({active:m,icon:x,desc:b},T)=>(L(),P("li",{key:T,class:me(["wl-reaction-item",{active:m}]),onClick:w=>u(T)},[D("div",hh,[D("img",{src:x,alt:b},null,8,ph),r.value===T?(L(),st(K(In),{key:0,class:"wl-reaction-loading"})):(L(),P("div",{key:1,class:"wl-reaction-votes",textContent:Y(s.value[T]||0)},null,8,dh))]),D("div",{class:"wl-reaction-text",textContent:Y(b)},null,8,gh)],10,fh))),128))])])):J("v-if",!0)}}),Ln=new Map;function vh(e){var t=Ln.get(e);t&&t.destroy()}function bh(e){var t=Ln.get(e);t&&t.update()}var Mn=null;typeof window>"u"?((Mn=function(e){return e}).destroy=function(e){return e},Mn.update=function(e){return e}):((Mn=function(e,t){return e&&Array.prototype.forEach.call(e.length?e:[e],function(n){return function(r){if(r&&r.nodeName&&r.nodeName==="TEXTAREA"&&!Ln.has(r)){var s,i=null,l=window.getComputedStyle(r),o=(s=r.value,function(){c({testForHeightReduction:s===""||!r.value.startsWith(s),restoreTextAlign:null}),s=r.value}),a=(function(f){r.removeEventListener("autosize:destroy",a),r.removeEventListener("autosize:update",u),r.removeEventListener("input",o),window.removeEventListener("resize",u),Object.keys(f).forEach(function(d){return r.style[d]=f[d]}),Ln.delete(r)}).bind(r,{height:r.style.height,resize:r.style.resize,textAlign:r.style.textAlign,overflowY:r.style.overflowY,overflowX:r.style.overflowX,wordWrap:r.style.wordWrap});r.addEventListener("autosize:destroy",a),r.addEventListener("autosize:update",u),r.addEventListener("input",o),window.addEventListener("resize",u),r.style.overflowX="hidden",r.style.wordWrap="break-word",Ln.set(r,{destroy:a,update:u}),u()}function c(f){var d,m,x=f.restoreTextAlign,b=x===void 0?null:x,T=f.testForHeightReduction,w=T===void 0||T,C=l.overflowY;if(r.scrollHeight!==0&&(l.resize==="vertical"?r.style.resize="none":l.resize==="both"&&(r.style.resize="horizontal"),w&&(d=function(I){for(var O=[];I&&I.parentNode&&I.parentNode instanceof Element;)I.parentNode.scrollTop&&O.push([I.parentNode,I.parentNode.scrollTop]),I=I.parentNode;return function(){return O.forEach(function(G){var j=G[0],oe=G[1];j.style.scrollBehavior="auto",j.scrollTop=oe,j.style.scrollBehavior=null})}}(r),r.style.height=""),m=l.boxSizing==="content-box"?r.scrollHeight-(parseFloat(l.paddingTop)+parseFloat(l.paddingBottom)):r.scrollHeight+parseFloat(l.borderTopWidth)+parseFloat(l.borderBottomWidth),l.maxHeight!=="none"&&m>parseFloat(l.maxHeight)?(l.overflowY==="hidden"&&(r.style.overflow="scroll"),m=parseFloat(l.maxHeight)):l.overflowY!=="hidden"&&(r.style.overflow="hidden"),r.style.height=m+"px",b&&(r.style.textAlign=b),d&&d(),i!==m&&(r.dispatchEvent(new Event("autosize:resized",{bubbles:!0})),i=m),C!==l.overflow&&!b)){var N=l.textAlign;l.overflow==="hidden"&&(r.style.textAlign=N==="start"?"end":"start"),c({restoreTextAlign:N,testForHeightReduction:!0})}}function u(){c({testForHeightReduction:!0,restoreTextAlign:null})}}(n)}),e}).destroy=function(e){return e&&Array.prototype.forEach.call(e.length?e:[e],vh),e},Mn.update=function(e){return e&&Array.prototype.forEach.call(e.length?e:[e],bh),e});var yo=Mn;const yh=["data-index"],wh=["src","title","onClick"];var kh=mn({__name:"ImageWall",props:{items:{default:()=>[]},columnWidth:{default:300},gap:{default:0}},emits:["insert"],setup(e){const t=e;let n=null;const r=pt("wall"),s=te({}),i=te([]),l=()=>{const f=Math.floor((r.value.getBoundingClientRect().width+t.gap)/(t.columnWidth+t.gap));return f>0?f:1},o=f=>new Array(f).fill(null).map(()=>[]),a=async f=>{var d;if(f>=t.items.length)return;await Kt();const m=Array.from(((d=r.value)==null?void 0:d.children)??[]).reduce((x,b)=>b.getBoundingClientRect().height<x.getBoundingClientRect().height?b:x);i.value[Number(m.dataset.index)].push(f),await a(f+1)},c=async(f=!1)=>{if(i.value.length===l()&&!f)return;i.value=o(l());const d=window.scrollY;await a(0),window.scrollTo({top:d})},u=f=>{s.value[f.target.src]=!0};return bn(()=>{c(!0),n=new ResizeObserver(()=>{c()}),n.observe(r.value),dt(()=>[t.items],()=>{s.value={},c(!0)}),dt(()=>[t.columnWidth,t.gap],()=>{c()})}),Ya(()=>{n.unobserve(r.value)}),(f,d)=>(L(),P("div",{ref_key:"wall",ref:r,class:"wl-gallery",style:on({gap:`${f.gap}px`})},[(L(!0),P(fe,null,Fe(i.value,(m,x)=>(L(),P("div",{key:x,class:"wl-gallery-column","data-index":x,style:on({gap:`${f.gap}px`})},[(L(!0),P(fe,null,Fe(m,b=>(L(),P(fe,{key:b},[s.value[f.items[b].src]?J("v-if",!0):(L(),st(K(In),{key:0,size:36,style:{margin:"20px auto"}})),D("img",{class:"wl-gallery-item",src:f.items[b].src,title:f.items[b].title,loading:"lazy",onLoad:u,onClick:T=>f.$emit("insert",``)},null,40,wh)],64))),128))],12,yh))),128))],4))}});const xh={key:0,class:"wl-login-info"},_h={class:"wl-avatar"},Ch=["title"],Sh=["title"],$h=["src"],Rh=["title","textContent"],Ah={class:"wl-panel"},Eh=["for","textContent"],Th=["id","onUpdate:modelValue","name","type"],Ih=["placeholder"],Lh={class:"wl-preview"},Mh=["innerHTML"],Ph={class:"wl-footer"},Oh={class:"wl-actions"},jh={href:"https://guides.github.com/features/mastering-markdown/",title:"Markdown Guide","aria-label":"Markdown is supported",class:"wl-action",target:"_blank",rel:"noopener noreferrer"},zh=["title"],Dh=["title"],Fh=["title","aria-label"],Hh=["title"],Uh={class:"wl-info"},Nh={class:"wl-text-number"},Bh={key:0},Vh=["textContent"],Wh=["textContent"],qh=["disabled"],Kh=["placeholder"],Gh={key:1,class:"wl-loading"},Zh={key:0,class:"wl-tab-wrapper"},Jh=["title","onClick"],Yh=["src","alt"],Qh={key:0,class:"wl-tabs"},Xh=["onClick"],ep=["src","alt","title"],tp=["title"];var wo=mn({__name:"CommentBox",props:{edit:{},rootId:{},replyId:{},replyUser:{}},emits:["log","cancelEdit","cancelReply","submit"],setup(e,{emit:t}){const n=e,r=t,s=sr(Fn),i=Zf(),l=Gf(),o=Sr(),a=te({}),c=pt("textarea"),u=pt("image-uploader"),f=pt("emoji-button"),d=pt("emoji-popup"),m=pt("gif-button"),x=pt("gif-popup"),b=pt("gif-search"),T=te({tabs:[],map:{}}),w=te(0),C=te(!1),N=te(!1),I=te(!1),O=te(""),G=te(0),j=pn({loading:!0,list:[]}),oe=te(0),ae=te(!1),Me=te(""),E=te(!1),B=te(!1),F=ge(()=>s.value.locale),de=ge(()=>!!o.value.token),we=ge(()=>mu(s.value.imageUploader)),be=z=>{const R=c.value,W=R.selectionStart,h=R.selectionEnd||0,p=R.scrollTop;i.value=R.value.substring(0,W)+z+R.value.substring(h,R.value.length),R.focus(),R.selectionStart=W+z.length,R.selectionEnd=W+z.length,R.scrollTop=p},Qe=({key:z,ctrlKey:R,metaKey:W})=>{E.value||(R||W)&&z==="Enter"&&Ue()},ut=async z=>{const R=`![${s.value.locale.uploading} ${z.name}]()`;be(R),E.value=!0;try{const W=await s.value.imageUploader(z);i.value=i.value.replace(R,`\r
|
|
83
|
-
`)}catch(W){alert(W.message),i.value=i.value.replace(R,"")}finally{E.value=!1}},Xt=z=>{var R;if((R=z.dataTransfer)!=null&&R.items){const W=Fl(z.dataTransfer.items);W&&we.value&&(ut(W),z.preventDefault())}},Pn=z=>{if(z.clipboardData){const R=Fl(z.clipboardData.items);R&&we.value&&ut(R)}},Pt=()=>{const z=u.value;z.files&&we.value&&ut(z.files[0]).then(()=>{z.value=""})},Ue=async()=>{var z;const{serverURL:R,lang:W,login:h,wordLimit:p,requiredMeta:g,recaptchaV3Key:y,turnstileKey:k}=s.value,v={comment:Me.value,nick:l.value.nick,mail:l.value.mail,link:l.value.link,url:s.value.path,ua:await zf()};if(!n.edit)if(o.value.token)v.nick=o.value.display_name,v.mail=o.value.email,v.link=o.value.url;else{if(h==="force")return;if(g.includes("nick")&&!v.nick){a.value.nick.focus(),alert(F.value.nickError);return}if(g.includes("mail")&&!v.mail||v.mail&&!Go(v.mail)){a.value.mail.focus(),alert(F.value.mailError);return}v.nick||(v.nick=F.value.anonymous)}if(!v.comment){c.value.focus();return}if(!ae.value){alert(F.value.wordHint.replace("$0",p[0].toString()).replace("$1",p[1].toString()).replace("$2",G.value.toString()));return}v.comment=co(v.comment,T.value.map),n.replyId&&n.rootId&&(v.pid=n.replyId,v.rid=n.rootId,v.at=n.replyUser),E.value=!0;try{y&&(v.recaptchaV3=await sh(y).execute("social")),k&&(v.turnstile=await ih(k).execute("social"));const A={serverURL:R,lang:W,token:o.value.token,comment:v},S=await(n.edit?nn({objectId:n.edit.objectId,...A}):Ms(A));if(E.value=!1,S.errmsg){alert(S.errmsg);return}r("submit",S.data),i.value="",O.value="",await Kt(),n.replyId&&r("cancelReply"),(z=n.edit)!=null&&z.objectId&&r("cancelEdit")}catch(A){E.value=!1,alert(A.message)}},On=z=>{z.preventDefault();const{lang:R,serverURL:W}=s.value;js({serverURL:W,lang:R}).then(h=>{o.value=h,(h.remember?localStorage:sessionStorage).setItem("WALINE_USER",JSON.stringify(h)),r("log")})},$r=()=>{o.value={},localStorage.setItem("WALINE_USER","null"),sessionStorage.setItem("WALINE_USER","null"),r("log")},jn=z=>{z.preventDefault();const{lang:R,serverURL:W}=s.value,h=800,p=800,g=(window.innerWidth-h)/2,y=(window.innerHeight-p)/2,k=new URLSearchParams({lng:R,token:o.value.token}),v=window.open(`${W}/ui/profile?${k.toString()}`,"_blank",`width=${h},height=${p},left=${g},top=${y},scrollbars=no,resizable=no,status=no,location=no,toolbar=no,menubar=no`);v==null||v.postMessage({type:"TOKEN",data:o.value.token},"*")},vt=z=>{var R,W,h,p;!((R=f.value)!=null&&R.contains(z.target))&&!((W=d.value)!=null&&W.contains(z.target))&&(C.value=!1),!((h=m.value)!=null&&h.contains(z.target))&&!((p=x.value)!=null&&p.contains(z.target))&&(N.value=!1)},bt=async z=>{var R;const{scrollTop:W,clientHeight:h,scrollHeight:p}=z.target,g=(h+W)/p,y=s.value.search,k=((R=b.value)==null?void 0:R.value)??"";g<.9||j.loading||B.value||(j.loading=!0,(y.more&&j.list.length?await y.more(k,j.list.length):await y.search(k)).length?j.list=[...j.list,...y.more&&j.list.length?await y.more(k,j.list.length):await y.search(k)]:B.value=!0,j.loading=!1,setTimeout(()=>{z.target.scrollTop=W},50))},Ot=xu(z=>{j.list=[],B.value=!1,bt(z)},300);return It("click",vt),It("message",({data:z})=>{!z||z.type!=="profile"||(o.value={...o.value,...z.data},[localStorage,sessionStorage].filter(R=>R.getItem("WALINE_USER")).forEach(R=>{R.setItem("WALINE_USER",JSON.stringify(o))}))}),Yt([s,G],([z,R])=>{const{wordLimit:W}=z;W?R<W[0]&&W[0]!==0?(oe.value=W[0],ae.value=!1):R>W[1]?(oe.value=W[1],ae.value=!1):(oe.value=W[1],ae.value=!0):(oe.value=0,ae.value=!0)}),dt(N,async z=>{var R;if(!z)return;const W=s.value.search;b.value&&(b.value.value=""),j.loading=!0,j.list=await(((R=W.default)==null?void 0:R.call(W))??W.search("")),j.loading=!1}),bn(()=>{var z;(z=n.edit)!=null&&z.objectId&&(i.value=n.edit.orig),Yt(()=>i.value,R=>{const{highlighter:W,texRenderer:h}=s.value;Me.value=R,O.value=Mf(R,{emojiMap:T.value.map,highlighter:W,texRenderer:h}),G.value=jf(R),R?yo(c.value):yo.destroy(c.value)}),Yt(()=>s.value.emoji,async R=>{T.value=await Uu(R)})}),(z,R)=>{var W,h;return L(),P("div",{key:K(o).token,class:"wl-comment"},[K(s).login!=="disable"&&de.value&&!((W=z.edit)!=null&&W.objectId)?(L(),P("div",xh,[D("div",_h,[D("button",{type:"submit",class:"wl-logout-btn",title:F.value.logout,onClick:$r},[le(K(fo),{size:14})],8,Ch),D("a",{href:"#",class:"wl-login-nick","aria-label":"Profile",title:F.value.profile,onClick:jn},[D("img",{src:K(o).avatar,alt:"avatar"},null,8,$h)],8,Sh)]),D("a",{href:"#",class:"wl-login-nick","aria-label":"Profile",title:F.value.profile,onClick:jn,textContent:Y(K(o).display_name)},null,8,Rh)])):J("v-if",!0),D("div",Ah,[K(s).login!=="force"&&K(s).meta.length&&!de.value?(L(),P("div",{key:0,class:me(["wl-header",`item${K(s).meta.length}`])},[(L(!0),P(fe,null,Fe(K(s).meta,p=>(L(),P("div",{key:p,class:"wl-header-item"},[D("label",{for:`wl-${p}`,textContent:Y(F.value[p]+(K(s).requiredMeta.includes(p)||!K(s).requiredMeta.length?"":`(${F.value.optional})`))},null,8,Eh),nr(D("input",{id:`wl-${p}`,ref_for:!0,ref:g=>{g&&(a.value[p]=g)},"onUpdate:modelValue":g=>K(l)[p]=g,class:me(["wl-input",`wl-${p}`]),name:p,type:p==="mail"?"email":"text"},null,10,Th),[[cu,K(l)[p]]])]))),128))],2)):J("v-if",!0),nr(D("textarea",{id:"wl-edit",ref:"textarea","onUpdate:modelValue":R[0]||(R[0]=p=>ve(i)?i.value=p:null),class:"wl-editor",placeholder:z.replyUser?`@${z.replyUser}`:F.value.placeholder,onKeydown:Qe,onDrop:Xt,onPaste:Pn},null,40,Ih),[[hs,K(i)]]),nr(D("div",Lh,[R[7]||(R[7]=D("hr",null,null,-1)),D("h4",null,Y(F.value.preview)+":",1),D("div",{class:"wl-content",innerHTML:O.value},null,8,Mh)],512),[[vl,I.value]]),D("div",Ph,[D("div",Oh,[D("a",jh,[le(K(Bf))]),nr(D("button",{ref:"emoji-button",type:"button",class:me(["wl-action",{active:C.value}]),title:F.value.emoji,onClick:R[1]||(R[1]=p=>C.value=!C.value)},[le(K(Ff))],10,zh),[[vl,T.value.tabs.length]]),K(s).search?(L(),P("button",{key:0,ref:"gif-button",type:"button",class:me(["wl-action",{active:N.value}]),title:F.value.gif,onClick:R[2]||(R[2]=p=>N.value=!N.value)},[le(K(Kf))],10,Dh)):J("v-if",!0),D("input",{id:"wl-image-upload",ref:"image-uploader",class:"upload","aria-hidden":"true",type:"file",accept:".png,.jpg,.jpeg,.webp,.bmp,.gif",onChange:Pt},null,544),we.value?(L(),P("label",{key:1,for:"wl-image-upload",class:"wl-action",title:F.value.uploadImage,"aria-label":F.value.uploadImage},[le(K(Hf))],8,Fh)):J("v-if",!0),D("button",{type:"button",class:me(["wl-action",{active:I.value}]),title:F.value.preview,onClick:R[3]||(R[3]=p=>I.value=!I.value)},[le(K(Nf))],10,Hh)]),D("div",Uh,[R[9]||(R[9]=D("div",{class:"wl-captcha-container"},null,-1)),D("div",Nh,[it(Y(G.value)+" ",1),K(s).wordLimit?(L(),P("span",Bh,[R[8]||(R[8]=it(" / ")),D("span",{class:me({illegal:!ae.value}),textContent:Y(oe.value)},null,10,Vh)])):J("v-if",!0),it(" "+Y(F.value.word),1)]),K(s).login!=="disable"&&!de.value?(L(),P("button",{key:0,type:"button",class:"wl-btn",onClick:On,textContent:Y(F.value.login)},null,8,Wh)):J("v-if",!0),K(s).login!=="force"||de.value?(L(),P("button",{key:1,type:"submit",class:"primary wl-btn",title:"Cmd|Ctrl + Enter",disabled:E.value,onClick:Ue},[E.value?(L(),st(K(In),{key:0,size:16})):(L(),P(fe,{key:1},[it(Y(F.value.submit),1)],64))],8,qh)):J("v-if",!0)]),D("div",{ref:"gif-popup",class:me(["wl-gif-popup",{display:N.value}])},[D("input",{ref:"gif-search",type:"text",placeholder:F.value.gifSearchPlaceholder,onInput:R[4]||(R[4]=(...p)=>K(Ot)&&K(Ot)(...p))},null,40,Kh),j.list.length?(L(),st(kh,{key:0,items:j.list,"column-width":200,gap:6,onInsert:R[5]||(R[5]=p=>be(p)),onScroll:bt},null,8,["items"])):J("v-if",!0),j.loading?(L(),P("div",Gh,[le(K(In),{size:30})])):J("v-if",!0)],2),D("div",{ref:"emoji-popup",class:me(["wl-emoji-popup",{display:C.value}])},[(L(!0),P(fe,null,Fe(T.value.tabs,(p,g)=>(L(),P(fe,{key:p.name},[g===w.value?(L(),P("div",Zh,[(L(!0),P(fe,null,Fe(p.items,y=>(L(),P("button",{key:y,type:"button",title:y,onClick:k=>be(`:${y}:`)},[C.value?(L(),P("img",{key:0,class:"wl-emoji",src:T.value.map[y],alt:y,loading:"lazy",referrerPolicy:"no-referrer"},null,8,Yh)):J("v-if",!0)],8,Jh))),128))])):J("v-if",!0)],64))),128)),T.value.tabs.length>1?(L(),P("div",Qh,[(L(!0),P(fe,null,Fe(T.value.tabs,(p,g)=>(L(),P("button",{key:p.name,type:"button",class:me(["wl-tab",{active:w.value===g}]),onClick:y=>w.value=g},[D("img",{class:"wl-emoji",src:p.icon,alt:p.name,title:p.name,loading:"lazy",referrerPolicy:"no-referrer"},null,8,ep)],10,Xh))),128))])):J("v-if",!0)],2)])]),z.replyId||(h=z.edit)!=null&&h.objectId?(L(),P("button",{key:1,type:"button",class:"wl-close",title:F.value.cancelReply,onClick:R[6]||(R[6]=p=>z.replyId?r("cancelReply"):r("cancelEdit"))},[le(K(fo),{size:24})],8,tp)):J("v-if",!0)])}}});const np=["id"],rp={class:"wl-user","aria-hidden":"true"},sp=["src"],ip={class:"wl-card"},lp={class:"wl-head"},op=["href"],ap={key:1,class:"wl-nick"},cp=["textContent"],up=["textContent"],fp=["textContent"],hp=["textContent"],pp=["textContent"],dp={class:"wl-comment-actions"},gp=["title"],mp=["title"],vp={class:"wl-meta","aria-hidden":"true"},bp=["data-value","textContent"],yp={key:0,class:"wl-content"},wp={key:0},kp=["href"],xp=["innerHTML"],_p={key:1,class:"wl-admin-actions"},Cp={class:"wl-comment-status"},Sp=["disabled","onClick","textContent"],$p={key:3,class:"wl-quote"};var Rp=mn({__name:"CommentCard",props:{comment:{},edit:{},rootId:{},reply:{}},emits:["log","submit","delete","like","sticky","edit","reply","status"],setup(e,{emit:t}){const n=e,r=t,s=["approved","waiting","spam"],i=sr(Fn),l=ho(),o=Pu(),a=Sr(),c=ge(()=>i.value.locale),u=ge(()=>{const{link:w}=n.comment;return w?ri(w)?w:`https://${w}`:""}),f=ge(()=>l.value.includes(n.comment.objectId)),d=ge(()=>qo(new Date(n.comment.time),o.value,c.value)),m=ge(()=>a.value.type==="administrator"),x=ge(()=>n.comment.user_id&&a.value.objectId===n.comment.user_id),b=ge(()=>{var w;return n.comment.objectId===((w=n.reply)==null?void 0:w.objectId)}),T=ge(()=>{var w;return n.comment.objectId===((w=n.edit)==null?void 0:w.objectId)});return(w,C)=>{var N;const I=Xa("CommentCard",!0);return L(),P("div",{id:w.comment.objectId.toString(),class:"wl-card-item"},[D("div",rp,[w.comment.avatar?(L(),P("img",{key:0,class:"wl-user-avatar",src:w.comment.avatar,alt:""},null,8,sp)):J("v-if",!0),w.comment.type?(L(),st(K(qf),{key:1})):J("v-if",!0)]),D("div",ip,[D("div",lp,[u.value?(L(),P("a",{key:0,class:"wl-nick",href:u.value,target:"_blank",rel:"nofollow noopener noreferrer"},Y(w.comment.nick),9,op)):(L(),P("span",ap,Y(w.comment.nick),1)),w.comment.type==="administrator"?(L(),P("span",{key:2,class:"wl-badge",textContent:Y(c.value.admin)},null,8,cp)):J("v-if",!0),w.comment.label?(L(),P("span",{key:3,class:"wl-badge",textContent:Y(w.comment.label)},null,8,up)):J("v-if",!0),w.comment.sticky?(L(),P("span",{key:4,class:"wl-badge",textContent:Y(c.value.sticky)},null,8,fp)):J("v-if",!0),typeof w.comment.level=="number"?(L(),P("span",{key:5,class:me(`wl-badge level${w.comment.level}`),textContent:Y(c.value[`level${w.comment.level}`]||`Level ${w.comment.level}`)},null,10,hp)):J("v-if",!0),D("span",{class:"wl-time",textContent:Y(d.value)},null,8,pp),D("div",dp,[m.value||x.value?(L(),P(fe,{key:0},[D("button",{type:"button",class:"wl-edit",onClick:C[0]||(C[0]=O=>r("edit",w.comment))},[le(K(Wf))]),D("button",{type:"button",class:"wl-delete",onClick:C[1]||(C[1]=O=>r("delete",w.comment))},[le(K(Df))])],64)):J("v-if",!0),D("button",{type:"button",class:"wl-like",title:f.value?c.value.cancelLike:c.value.like,onClick:C[2]||(C[2]=O=>r("like",w.comment))},[le(K(Uf),{active:f.value},null,8,["active"]),it(" "+Y("like"in w.comment?w.comment.like:""),1)],8,gp),D("button",{type:"button",class:me(["wl-reply",{active:b.value}]),title:b.value?c.value.cancelReply:c.value.reply,onClick:C[3]||(C[3]=O=>r("reply",b.value?null:w.comment))},[le(K(Vf))],10,mp)])]),D("div",vp,[(L(),P(fe,null,Fe(["addr","browser","os"],O=>(L(),P(fe,null,[w.comment[O]?(L(),P("span",{key:O,class:me(`wl-${O}`),"data-value":w.comment[O],textContent:Y(w.comment[O])},null,10,bp)):J("v-if",!0)],64))),64))]),T.value?J("v-if",!0):(L(),P("div",yp,["reply_user"in w.comment&&w.comment.reply_user?(L(),P("p",wp,[D("a",{href:"#"+w.comment.pid},"@"+Y(w.comment.reply_user.nick),9,kp),C[17]||(C[17]=D("span",null,": ",-1))])):J("v-if",!0),D("div",{innerHTML:w.comment.comment},null,8,xp)])),m.value&&!T.value?(L(),P("div",_p,[D("span",Cp,[(L(),P(fe,null,Fe(s,O=>D("button",{key:O,type:"submit",class:me(`wl-btn wl-${O}`),disabled:w.comment.status===O,onClick:G=>r("status",{status:O,comment:w.comment}),textContent:Y(c.value[O])},null,10,Sp)),64))]),m.value&&!("rid"in w.comment)?(L(),P("button",{key:0,type:"submit",class:"wl-btn wl-sticky",onClick:C[4]||(C[4]=O=>r("sticky",w.comment))},Y(w.comment.sticky?c.value.unsticky:c.value.sticky),1)):J("v-if",!0)])):J("v-if",!0),b.value||T.value?(L(),P("div",{key:2,class:me({"wl-reply-wrapper":b.value,"wl-edit-wrapper":T.value})},[le(wo,{edit:w.edit,"reply-id":(N=w.reply)==null?void 0:N.objectId,"reply-user":w.comment.nick,"root-id":w.rootId,onLog:C[5]||(C[5]=O=>r("log")),onCancelReply:C[6]||(C[6]=O=>r("reply",null)),onCancelEdit:C[7]||(C[7]=O=>r("edit",null)),onSubmit:C[8]||(C[8]=O=>r("submit",O))},null,8,["edit","reply-id","reply-user","root-id"])],2)):J("v-if",!0),"children"in w.comment?(L(),P("div",$p,[(L(!0),P(fe,null,Fe(w.comment.children,O=>(L(),st(I,{key:O.objectId,comment:O,reply:w.reply,edit:w.edit,"root-id":w.rootId,onLog:C[9]||(C[9]=G=>r("log")),onDelete:C[10]||(C[10]=G=>r("delete",G)),onEdit:C[11]||(C[11]=G=>r("edit",G)),onLike:C[12]||(C[12]=G=>r("like",G)),onReply:C[13]||(C[13]=G=>r("reply",G)),onStatus:C[14]||(C[14]=G=>r("status",G)),onSticky:C[15]||(C[15]=G=>r("sticky",G)),onSubmit:C[16]||(C[16]=G=>r("submit",G))},null,8,["comment","reply","edit","root-id"]))),128))])):J("v-if",!0)])],8,np)}}});const ko="3.5.3",Ap={"data-waline":""},Ep={class:"wl-meta-head"},Tp={class:"wl-count"},Ip=["textContent"],Lp={class:"wl-sort"},Mp=["onClick"],Pp={class:"wl-cards"},Op={key:1,class:"wl-operation"},jp=["textContent"],zp={key:2,class:"wl-loading"},Dp=["textContent"],Fp={key:4,class:"wl-operation"},Hp=["textContent"],Up={key:5,class:"wl-power"};var Np=mn({__name:"WalineComment",props:{serverURL:{},path:{},meta:{},requiredMeta:{},wordLimit:{},pageSize:{},lang:{},locale:{},commentSorting:{},dark:{type:[String,Boolean]},login:{},noCopyright:{type:Boolean},recaptchaV3Key:{},turnstileKey:{},reaction:{},emoji:{},search:{},highlighter:{type:Function},imageUploader:{type:Function},texRenderer:{type:Function}},setup(e){const t=e,n=Sr(),r=ho(),s=te("loading"),i=te(0),l=te(1),o=te(0),a=ge(()=>Bo(t)),c=te(a.value.commentSorting),u=te([]),f=te(null),d=te(null),m=ge(()=>Vo(a.value.dark)),x=ge(()=>a.value.locale);zu(m,{id:"waline-darkmode"});let b=null;const T=E=>{const{serverURL:B,path:F,pageSize:de}=a.value,we=new AbortController;s.value="loading",b==null||b(),Ls({serverURL:B,lang:a.value.lang,path:F,pageSize:de,sortBy:ei[c.value],page:E,signal:we.signal,token:n.value.token}).then(be=>{s.value="success",i.value=be.count,u.value.push(...be.data),l.value=E,o.value=be.totalPages}).catch(be=>{be.name!=="AbortError"&&(console.error(be.message),s.value="error")}),b=we.abort.bind(we)},w=()=>{T(l.value+1)},C=()=>{i.value=0,u.value=[],T(1)},N=E=>{c.value!==E&&(c.value=E,C())},I=E=>{f.value=E},O=E=>{d.value=E},G=E=>{if(d.value)d.value.comment=E.comment,d.value.orig=E.orig;else if("rid"in E){const B=u.value.find(({objectId:F})=>F===E.rid);if(!B)return;Array.isArray(B.children)||(B.children=[]),B.children.push(E)}else u.value.unshift(E),i.value+=1},j=async({comment:E,status:B})=>{if(E.status===B)return;const{serverURL:F,lang:de}=a.value;await nn({serverURL:F,lang:de,token:n.value.token,objectId:E.objectId,comment:{status:B}}),E.status=B},oe=async E=>{if("rid"in E)return;const{serverURL:B,lang:F}=a.value;await nn({serverURL:B,lang:F,token:n.value.token,objectId:E.objectId,comment:{sticky:E.sticky?0:1}}),E.sticky=!E.sticky},ae=async({objectId:E})=>{if(!confirm("Are you sure you want to delete this comment?"))return;const{serverURL:B,lang:F}=a.value;await Ps({serverURL:B,lang:F,token:n.value.token,objectId:E}),u.value.some((de,we)=>de.objectId===E?(u.value=u.value.filter((be,Qe)=>Qe!==we),!0):de.children.some((be,Qe)=>be.objectId===E?(u.value[we].children=de.children.filter((ut,Xt)=>Xt!==Qe),!0):!1))},Me=async E=>{const{serverURL:B,lang:F}=a.value,{objectId:de}=E,we=r.value.includes(de);await nn({serverURL:B,lang:F,objectId:de,token:n.value.token,comment:{like:!we}}),we?r.value=r.value.filter(be=>be!==de):(r.value=[...r.value,de],r.value.length>50&&(r.value=r.value.slice(-50))),E.like=Math.max(0,(E.like||0)+(we?-1:1))};return ic(Fn,a),bn(()=>{Yt(()=>[t.serverURL,t.path],()=>{C()})}),Xr(()=>{b==null||b()}),(E,B)=>(L(),P("div",Ap,[le(mh),!f.value&&!d.value?(L(),st(wo,{key:0,onLog:C,onSubmit:G})):J("v-if",!0),D("div",Ep,[D("div",Tp,[i.value?(L(),P("span",{key:0,class:"wl-num",textContent:Y(i.value)},null,8,Ip)):J("v-if",!0),it(" "+Y(x.value.comment),1)]),D("ul",Lp,[(L(!0),P(fe,null,Fe(K(Uo),F=>(L(),P("li",{key:F,class:me([F===c.value?"active":""]),onClick:de=>N(F)},Y(x.value[F]),11,Mp))),128))])]),D("div",Pp,[(L(!0),P(fe,null,Fe(u.value,F=>(L(),st(Rp,{key:F.objectId,"root-id":F.objectId,comment:F,reply:f.value,edit:d.value,onLog:C,onReply:I,onEdit:O,onSubmit:G,onStatus:j,onDelete:ae,onSticky:oe,onLike:Me},null,8,["root-id","comment","reply","edit"]))),128))]),s.value==="error"?(L(),P("div",Op,[D("button",{type:"button",class:"wl-btn",onClick:C,textContent:Y(x.value.refresh)},null,8,jp)])):s.value==="loading"?(L(),P("div",zp,[le(K(In),{size:30})])):u.value.length?l.value<o.value?(L(),P("div",Fp,[D("button",{type:"button",class:"wl-btn",onClick:w,textContent:Y(x.value.more)},null,8,Hp)])):J("v-if",!0):(L(),P("div",{key:3,class:"wl-empty",textContent:Y(x.value.sofa)},null,8,Dp)),a.value.noCopyright?J("v-if",!0):(L(),P("div",Up,[B[0]||(B[0]=it(" Powered by ")),B[1]||(B[1]=D("a",{href:"https://github.com/walinejs/waline",target:"_blank",rel:"noopener noreferrer"}," Waline ",-1)),it(" v"+Y(K(ko)),1)]))]))}});const xo=(e,t)=>{t.forEach((n,r)=>{const s=e[r].time;typeof s=="number"&&(n.innerText=s.toString())})},_o=({serverURL:e,path:t=window.location.pathname,selector:n=".waline-pageview-count",update:r=!0,lang:s=navigator.language})=>{const i=new AbortController,l=Array.from(document.querySelectorAll(n)),o=c=>{const u=$s(c);return u!==null&&t!==u},a=c=>zs({serverURL:Hn(e),paths:c.map(u=>$s(u)??t),lang:s,signal:i.signal}).then(u=>xo(u,c)).catch(Dl);if(r){const c=l.filter(f=>!o(f)),u=l.filter(o);Ds({serverURL:Hn(e),path:t,lang:s}).then(f=>xo(f,c)),u.length&&a(u)}else a(l);return i.abort.bind(i)},Bp=({el:e="#waline",path:t=window.location.pathname,comment:n=!1,pageview:r=!1,...s})=>{const i=e?gs(e):null;if(e&&!i)throw new Error("Option 'el' do not match any domElement!");if(!s.serverURL)throw new Error("Option 'serverURL' is missing!");const l=pn({...s}),o=pn({comment:n,pageview:r,path:t}),a=()=>{o.comment&&uo({serverURL:l.serverURL,path:o.path,...zt(o.comment)?{selector:o.comment}:{}})},c=()=>{o.pageview&&_o({serverURL:l.serverURL,path:o.path,...zt(o.pageview)?{selector:o.pageview}:{}})};let u=null;i&&(u=pu(()=>ne(Np,{path:o.path,...l})),u.mount(i));const f=Xi(a),d=Xi(c);return{el:i,update:({comment:m,pageview:x,path:b=window.location.pathname,...T}={})=>{Object.entries(T).forEach(([w,C])=>{l[w]=C}),o.path=b,m!==void 0&&(o.comment=m),x!==void 0&&(o.pageview=x)},destroy:()=>{u==null||u.unmount(),f(),d()}}},Vp=({el:e,serverURL:t,count:n,lang:r=navigator.language})=>{const s=Sr(),i=gs(e),l=new AbortController;return Fs({serverURL:t,count:n,lang:r,signal:l.signal,token:s.value.token}).then(o=>i&&o.length?(i.innerHTML=`<ul class="wl-recent-list">${o.map(a=>`<li class="wl-recent-item"><a href="${a.url}">${a.nick}</a>:${a.comment}</li>`).join("")}</ul>`,{comments:o,destroy:()=>{l.abort(),i.innerHTML=""}}):{comments:o,destroy:()=>l.abort()})},Wp=({el:e,serverURL:t,count:n,locale:r,lang:s=navigator.language,mode:i="list"})=>{const l=gs(e),o=new AbortController;return Hs({serverURL:t,pageSize:n,lang:s,signal:o.signal}).then(a=>!l||!a.length?{users:a,destroy:()=>o.abort()}:(r={...Qs(s),...typeof r=="object"?r:{}},l.innerHTML=`<ul class="wl-user-${i}">${a.map((c,u)=>[`<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">${u+1}</span>`,"</div>",'<div class="wl-user-meta">','<div class="wl-user-name">',c.nick,c.level&&`<span class="wl-badge">${r?r[`level${c.level}`]:`Level ${c.level}`}</span>`,c.label&&`<span class="wl-badge">${c.label}</span>`,"</div>",c.link&&c.link,"</div>",c.link&&"</a>","</li>"].filter(f=>f).join("")).join("")}</ul>`,{users:a,destroy:()=>{o.abort(),l.innerHTML=""}}))};export{Vp as RecentComments,Wp as UserList,Ms as addComment,uo as commentCount,Dn as defaultLocales,Ps as deleteComment,Os as fetchCommentCount,Rr as getArticleCounter,Ls as getComment,zs as getPageview,Fs as getRecentComment,Hs as getUserList,Bp as init,js as login,_o as pageviewCount,zn as updateArticleCounter,nn as updateComment,Ds as updatePageview,ko as version};
|
|
83
|
+
`)}catch(W){alert(W.message),i.value=i.value.replace(R,"")}finally{E.value=!1}},Xt=z=>{var R;if((R=z.dataTransfer)!=null&&R.items){const W=Fl(z.dataTransfer.items);W&&we.value&&(ut(W),z.preventDefault())}},Pn=z=>{if(z.clipboardData){const R=Fl(z.clipboardData.items);R&&we.value&&ut(R)}},Pt=()=>{const z=u.value;z.files&&we.value&&ut(z.files[0]).then(()=>{z.value=""})},Ue=async()=>{var z;const{serverURL:R,lang:W,login:h,wordLimit:p,requiredMeta:g,recaptchaV3Key:y,turnstileKey:k}=s.value,v={comment:Me.value,nick:l.value.nick,mail:l.value.mail,link:l.value.link,url:s.value.path,ua:await zf()};if(!n.edit)if(o.value.token)v.nick=o.value.display_name,v.mail=o.value.email,v.link=o.value.url;else{if(h==="force")return;if(g.includes("nick")&&!v.nick){a.value.nick.focus(),alert(F.value.nickError);return}if(g.includes("mail")&&!v.mail||v.mail&&!Go(v.mail)){a.value.mail.focus(),alert(F.value.mailError);return}v.nick||(v.nick=F.value.anonymous)}if(!v.comment){c.value.focus();return}if(!ae.value){alert(F.value.wordHint.replace("$0",p[0].toString()).replace("$1",p[1].toString()).replace("$2",G.value.toString()));return}v.comment=co(v.comment,T.value.map),n.replyId&&n.rootId&&(v.pid=n.replyId,v.rid=n.rootId,v.at=n.replyUser),E.value=!0;try{y&&(v.recaptchaV3=await sh(y).execute("social")),k&&(v.turnstile=await ih(k).execute("social"));const A={serverURL:R,lang:W,token:o.value.token,comment:v},S=await(n.edit?nn({objectId:n.edit.objectId,...A}):Ms(A));if(E.value=!1,S.errmsg){alert(S.errmsg);return}r("submit",S.data),i.value="",O.value="",await Kt(),n.replyId&&r("cancelReply"),(z=n.edit)!=null&&z.objectId&&r("cancelEdit")}catch(A){E.value=!1,alert(A.message)}},On=z=>{z.preventDefault();const{lang:R,serverURL:W}=s.value;js({serverURL:W,lang:R}).then(h=>{o.value=h,(h.remember?localStorage:sessionStorage).setItem("WALINE_USER",JSON.stringify(h)),r("log")})},$r=()=>{o.value={},localStorage.setItem("WALINE_USER","null"),sessionStorage.setItem("WALINE_USER","null"),r("log")},jn=z=>{z.preventDefault();const{lang:R,serverURL:W}=s.value,h=800,p=800,g=(window.innerWidth-h)/2,y=(window.innerHeight-p)/2,k=new URLSearchParams({lng:R,token:o.value.token}),v=window.open(`${W}/ui/profile?${k.toString()}`,"_blank",`width=${h},height=${p},left=${g},top=${y},scrollbars=no,resizable=no,status=no,location=no,toolbar=no,menubar=no`);v==null||v.postMessage({type:"TOKEN",data:o.value.token},"*")},vt=z=>{var R,W,h,p;!((R=f.value)!=null&&R.contains(z.target))&&!((W=d.value)!=null&&W.contains(z.target))&&(C.value=!1),!((h=m.value)!=null&&h.contains(z.target))&&!((p=x.value)!=null&&p.contains(z.target))&&(N.value=!1)},bt=async z=>{var R;const{scrollTop:W,clientHeight:h,scrollHeight:p}=z.target,g=(h+W)/p,y=s.value.search,k=((R=b.value)==null?void 0:R.value)??"";g<.9||j.loading||B.value||(j.loading=!0,(y.more&&j.list.length?await y.more(k,j.list.length):await y.search(k)).length?j.list=[...j.list,...y.more&&j.list.length?await y.more(k,j.list.length):await y.search(k)]:B.value=!0,j.loading=!1,setTimeout(()=>{z.target.scrollTop=W},50))},Ot=xu(z=>{j.list=[],B.value=!1,bt(z)},300);return It("click",vt),It("message",({data:z})=>{!z||z.type!=="profile"||(o.value={...o.value,...z.data},[localStorage,sessionStorage].filter(R=>R.getItem("WALINE_USER")).forEach(R=>{R.setItem("WALINE_USER",JSON.stringify(o))}))}),Yt([s,G],([z,R])=>{const{wordLimit:W}=z;W?R<W[0]&&W[0]!==0?(oe.value=W[0],ae.value=!1):R>W[1]?(oe.value=W[1],ae.value=!1):(oe.value=W[1],ae.value=!0):(oe.value=0,ae.value=!0)}),dt(N,async z=>{var R;if(!z)return;const W=s.value.search;b.value&&(b.value.value=""),j.loading=!0,j.list=await(((R=W.default)==null?void 0:R.call(W))??W.search("")),j.loading=!1}),bn(()=>{var z;(z=n.edit)!=null&&z.objectId&&(i.value=n.edit.orig),Yt(()=>i.value,R=>{const{highlighter:W,texRenderer:h}=s.value;Me.value=R,O.value=Mf(R,{emojiMap:T.value.map,highlighter:W,texRenderer:h}),G.value=jf(R),R?yo(c.value):yo.destroy(c.value)}),Yt(()=>s.value.emoji,async R=>{T.value=await Uu(R)})}),(z,R)=>{var W,h;return L(),P("div",{key:K(o).token,class:"wl-comment"},[K(s).login!=="disable"&&de.value&&!((W=z.edit)!=null&&W.objectId)?(L(),P("div",xh,[D("div",_h,[D("button",{type:"submit",class:"wl-logout-btn",title:F.value.logout,onClick:$r},[le(K(fo),{size:14})],8,Ch),D("a",{href:"#",class:"wl-login-nick","aria-label":"Profile",title:F.value.profile,onClick:jn},[D("img",{src:K(o).avatar,alt:"avatar"},null,8,$h)],8,Sh)]),D("a",{href:"#",class:"wl-login-nick","aria-label":"Profile",title:F.value.profile,onClick:jn,textContent:Y(K(o).display_name)},null,8,Rh)])):J("v-if",!0),D("div",Ah,[K(s).login!=="force"&&K(s).meta.length&&!de.value?(L(),P("div",{key:0,class:me(["wl-header",`item${K(s).meta.length}`])},[(L(!0),P(fe,null,Fe(K(s).meta,p=>(L(),P("div",{key:p,class:"wl-header-item"},[D("label",{for:`wl-${p}`,textContent:Y(F.value[p]+(K(s).requiredMeta.includes(p)||!K(s).requiredMeta.length?"":`(${F.value.optional})`))},null,8,Eh),nr(D("input",{id:`wl-${p}`,ref_for:!0,ref:g=>{g&&(a.value[p]=g)},"onUpdate:modelValue":g=>K(l)[p]=g,class:me(["wl-input",`wl-${p}`]),name:p,type:p==="mail"?"email":"text"},null,10,Th),[[cu,K(l)[p]]])]))),128))],2)):J("v-if",!0),nr(D("textarea",{id:"wl-edit",ref:"textarea","onUpdate:modelValue":R[0]||(R[0]=p=>ve(i)?i.value=p:null),class:"wl-editor",placeholder:z.replyUser?`@${z.replyUser}`:F.value.placeholder,onKeydown:Qe,onDrop:Xt,onPaste:Pn},null,40,Ih),[[hs,K(i)]]),nr(D("div",Lh,[R[7]||(R[7]=D("hr",null,null,-1)),D("h4",null,Y(F.value.preview)+":",1),D("div",{class:"wl-content",innerHTML:O.value},null,8,Mh)],512),[[vl,I.value]]),D("div",Ph,[D("div",Oh,[D("a",jh,[le(K(Bf))]),nr(D("button",{ref:"emoji-button",type:"button",class:me(["wl-action",{active:C.value}]),title:F.value.emoji,onClick:R[1]||(R[1]=p=>C.value=!C.value)},[le(K(Ff))],10,zh),[[vl,T.value.tabs.length]]),K(s).search?(L(),P("button",{key:0,ref:"gif-button",type:"button",class:me(["wl-action",{active:N.value}]),title:F.value.gif,onClick:R[2]||(R[2]=p=>N.value=!N.value)},[le(K(Kf))],10,Dh)):J("v-if",!0),D("input",{id:"wl-image-upload",ref:"image-uploader",class:"upload","aria-hidden":"true",type:"file",accept:".png,.jpg,.jpeg,.webp,.bmp,.gif",onChange:Pt},null,544),we.value?(L(),P("label",{key:1,for:"wl-image-upload",class:"wl-action",title:F.value.uploadImage,"aria-label":F.value.uploadImage},[le(K(Hf))],8,Fh)):J("v-if",!0),D("button",{type:"button",class:me(["wl-action",{active:I.value}]),title:F.value.preview,onClick:R[3]||(R[3]=p=>I.value=!I.value)},[le(K(Nf))],10,Hh)]),D("div",Uh,[R[9]||(R[9]=D("div",{class:"wl-captcha-container"},null,-1)),D("div",Nh,[it(Y(G.value)+" ",1),K(s).wordLimit?(L(),P("span",Bh,[R[8]||(R[8]=it(" / ")),D("span",{class:me({illegal:!ae.value}),textContent:Y(oe.value)},null,10,Vh)])):J("v-if",!0),it(" "+Y(F.value.word),1)]),K(s).login!=="disable"&&!de.value?(L(),P("button",{key:0,type:"button",class:"wl-btn",onClick:On,textContent:Y(F.value.login)},null,8,Wh)):J("v-if",!0),K(s).login!=="force"||de.value?(L(),P("button",{key:1,type:"submit",class:"primary wl-btn",title:"Cmd|Ctrl + Enter",disabled:E.value,onClick:Ue},[E.value?(L(),st(K(In),{key:0,size:16})):(L(),P(fe,{key:1},[it(Y(F.value.submit),1)],64))],8,qh)):J("v-if",!0)]),D("div",{ref:"gif-popup",class:me(["wl-gif-popup",{display:N.value}])},[D("input",{ref:"gif-search",type:"text",placeholder:F.value.gifSearchPlaceholder,onInput:R[4]||(R[4]=(...p)=>K(Ot)&&K(Ot)(...p))},null,40,Kh),j.list.length?(L(),st(kh,{key:0,items:j.list,"column-width":200,gap:6,onInsert:R[5]||(R[5]=p=>be(p)),onScroll:bt},null,8,["items"])):J("v-if",!0),j.loading?(L(),P("div",Gh,[le(K(In),{size:30})])):J("v-if",!0)],2),D("div",{ref:"emoji-popup",class:me(["wl-emoji-popup",{display:C.value}])},[(L(!0),P(fe,null,Fe(T.value.tabs,(p,g)=>(L(),P(fe,{key:p.name},[g===w.value?(L(),P("div",Zh,[(L(!0),P(fe,null,Fe(p.items,y=>(L(),P("button",{key:y,type:"button",title:y,onClick:k=>be(`:${y}:`)},[C.value?(L(),P("img",{key:0,class:"wl-emoji",src:T.value.map[y],alt:y,loading:"lazy",referrerPolicy:"no-referrer"},null,8,Yh)):J("v-if",!0)],8,Jh))),128))])):J("v-if",!0)],64))),128)),T.value.tabs.length>1?(L(),P("div",Qh,[(L(!0),P(fe,null,Fe(T.value.tabs,(p,g)=>(L(),P("button",{key:p.name,type:"button",class:me(["wl-tab",{active:w.value===g}]),onClick:y=>w.value=g},[D("img",{class:"wl-emoji",src:p.icon,alt:p.name,title:p.name,loading:"lazy",referrerPolicy:"no-referrer"},null,8,ep)],10,Xh))),128))])):J("v-if",!0)],2)])]),z.replyId||(h=z.edit)!=null&&h.objectId?(L(),P("button",{key:1,type:"button",class:"wl-close",title:F.value.cancelReply,onClick:R[6]||(R[6]=p=>z.replyId?r("cancelReply"):r("cancelEdit"))},[le(K(fo),{size:24})],8,tp)):J("v-if",!0)])}}});const np=["id"],rp={class:"wl-user","aria-hidden":"true"},sp=["src"],ip={class:"wl-card"},lp={class:"wl-head"},op=["href"],ap={key:1,class:"wl-nick"},cp=["textContent"],up=["textContent"],fp=["textContent"],hp=["textContent"],pp=["textContent"],dp={class:"wl-comment-actions"},gp=["title"],mp=["title"],vp={class:"wl-meta","aria-hidden":"true"},bp=["data-value","textContent"],yp={key:0,class:"wl-content"},wp={key:0},kp=["href"],xp=["innerHTML"],_p={key:1,class:"wl-admin-actions"},Cp={class:"wl-comment-status"},Sp=["disabled","onClick","textContent"],$p={key:3,class:"wl-quote"};var Rp=mn({__name:"CommentCard",props:{comment:{},edit:{},rootId:{},reply:{}},emits:["log","submit","delete","like","sticky","edit","reply","status"],setup(e,{emit:t}){const n=e,r=t,s=["approved","waiting","spam"],i=sr(Fn),l=ho(),o=Pu(),a=Sr(),c=ge(()=>i.value.locale),u=ge(()=>{const{link:w}=n.comment;return w?ri(w)?w:`https://${w}`:""}),f=ge(()=>l.value.includes(n.comment.objectId)),d=ge(()=>qo(new Date(n.comment.time),o.value,c.value)),m=ge(()=>a.value.type==="administrator"),x=ge(()=>n.comment.user_id&&a.value.objectId===n.comment.user_id),b=ge(()=>{var w;return n.comment.objectId===((w=n.reply)==null?void 0:w.objectId)}),T=ge(()=>{var w;return n.comment.objectId===((w=n.edit)==null?void 0:w.objectId)});return(w,C)=>{var N;const I=Xa("CommentCard",!0);return L(),P("div",{id:w.comment.objectId.toString(),class:"wl-card-item"},[D("div",rp,[w.comment.avatar?(L(),P("img",{key:0,class:"wl-user-avatar",src:w.comment.avatar,alt:""},null,8,sp)):J("v-if",!0),w.comment.type?(L(),st(K(qf),{key:1})):J("v-if",!0)]),D("div",ip,[D("div",lp,[u.value?(L(),P("a",{key:0,class:"wl-nick",href:u.value,target:"_blank",rel:"nofollow noopener noreferrer"},Y(w.comment.nick),9,op)):(L(),P("span",ap,Y(w.comment.nick),1)),w.comment.type==="administrator"?(L(),P("span",{key:2,class:"wl-badge",textContent:Y(c.value.admin)},null,8,cp)):J("v-if",!0),w.comment.label?(L(),P("span",{key:3,class:"wl-badge",textContent:Y(w.comment.label)},null,8,up)):J("v-if",!0),w.comment.sticky?(L(),P("span",{key:4,class:"wl-badge",textContent:Y(c.value.sticky)},null,8,fp)):J("v-if",!0),typeof w.comment.level=="number"?(L(),P("span",{key:5,class:me(`wl-badge level${w.comment.level}`),textContent:Y(c.value[`level${w.comment.level}`]||`Level ${w.comment.level}`)},null,10,hp)):J("v-if",!0),D("span",{class:"wl-time",textContent:Y(d.value)},null,8,pp),D("div",dp,[m.value||x.value?(L(),P(fe,{key:0},[D("button",{type:"button",class:"wl-edit",onClick:C[0]||(C[0]=O=>r("edit",w.comment))},[le(K(Wf))]),D("button",{type:"button",class:"wl-delete",onClick:C[1]||(C[1]=O=>r("delete",w.comment))},[le(K(Df))])],64)):J("v-if",!0),D("button",{type:"button",class:"wl-like",title:f.value?c.value.cancelLike:c.value.like,onClick:C[2]||(C[2]=O=>r("like",w.comment))},[le(K(Uf),{active:f.value},null,8,["active"]),it(" "+Y("like"in w.comment?w.comment.like:""),1)],8,gp),D("button",{type:"button",class:me(["wl-reply",{active:b.value}]),title:b.value?c.value.cancelReply:c.value.reply,onClick:C[3]||(C[3]=O=>r("reply",b.value?null:w.comment))},[le(K(Vf))],10,mp)])]),D("div",vp,[(L(),P(fe,null,Fe(["addr","browser","os"],O=>(L(),P(fe,null,[w.comment[O]?(L(),P("span",{key:O,class:me(`wl-${O}`),"data-value":w.comment[O],textContent:Y(w.comment[O])},null,10,bp)):J("v-if",!0)],64))),64))]),T.value?J("v-if",!0):(L(),P("div",yp,["reply_user"in w.comment&&w.comment.reply_user?(L(),P("p",wp,[D("a",{href:"#"+w.comment.pid},"@"+Y(w.comment.reply_user.nick),9,kp),C[17]||(C[17]=D("span",null,": ",-1))])):J("v-if",!0),D("div",{innerHTML:w.comment.comment},null,8,xp)])),m.value&&!T.value?(L(),P("div",_p,[D("span",Cp,[(L(),P(fe,null,Fe(s,O=>D("button",{key:O,type:"submit",class:me(`wl-btn wl-${O}`),disabled:w.comment.status===O,onClick:G=>r("status",{status:O,comment:w.comment}),textContent:Y(c.value[O])},null,10,Sp)),64))]),m.value&&!("rid"in w.comment)?(L(),P("button",{key:0,type:"submit",class:"wl-btn wl-sticky",onClick:C[4]||(C[4]=O=>r("sticky",w.comment))},Y(w.comment.sticky?c.value.unsticky:c.value.sticky),1)):J("v-if",!0)])):J("v-if",!0),b.value||T.value?(L(),P("div",{key:2,class:me({"wl-reply-wrapper":b.value,"wl-edit-wrapper":T.value})},[le(wo,{edit:w.edit,"reply-id":(N=w.reply)==null?void 0:N.objectId,"reply-user":w.comment.nick,"root-id":w.rootId,onLog:C[5]||(C[5]=O=>r("log")),onCancelReply:C[6]||(C[6]=O=>r("reply",null)),onCancelEdit:C[7]||(C[7]=O=>r("edit",null)),onSubmit:C[8]||(C[8]=O=>r("submit",O))},null,8,["edit","reply-id","reply-user","root-id"])],2)):J("v-if",!0),"children"in w.comment?(L(),P("div",$p,[(L(!0),P(fe,null,Fe(w.comment.children,O=>(L(),st(I,{key:O.objectId,comment:O,reply:w.reply,edit:w.edit,"root-id":w.rootId,onLog:C[9]||(C[9]=G=>r("log")),onDelete:C[10]||(C[10]=G=>r("delete",G)),onEdit:C[11]||(C[11]=G=>r("edit",G)),onLike:C[12]||(C[12]=G=>r("like",G)),onReply:C[13]||(C[13]=G=>r("reply",G)),onStatus:C[14]||(C[14]=G=>r("status",G)),onSticky:C[15]||(C[15]=G=>r("sticky",G)),onSubmit:C[16]||(C[16]=G=>r("submit",G))},null,8,["comment","reply","edit","root-id"]))),128))])):J("v-if",!0)])],8,np)}}});const ko="3.5.5",Ap={"data-waline":""},Ep={class:"wl-meta-head"},Tp={class:"wl-count"},Ip=["textContent"],Lp={class:"wl-sort"},Mp=["onClick"],Pp={class:"wl-cards"},Op={key:1,class:"wl-operation"},jp=["textContent"],zp={key:2,class:"wl-loading"},Dp=["textContent"],Fp={key:4,class:"wl-operation"},Hp=["textContent"],Up={key:5,class:"wl-power"};var Np=mn({__name:"WalineComment",props:{serverURL:{},path:{},meta:{},requiredMeta:{},wordLimit:{},pageSize:{},lang:{},locale:{},commentSorting:{},dark:{type:[String,Boolean]},login:{},noCopyright:{type:Boolean},recaptchaV3Key:{},turnstileKey:{},reaction:{},emoji:{},search:{},highlighter:{type:Function},imageUploader:{type:Function},texRenderer:{type:Function}},setup(e){const t=e,n=Sr(),r=ho(),s=te("loading"),i=te(0),l=te(1),o=te(0),a=ge(()=>Bo(t)),c=te(a.value.commentSorting),u=te([]),f=te(null),d=te(null),m=ge(()=>Vo(a.value.dark)),x=ge(()=>a.value.locale);zu(m,{id:"waline-darkmode"});let b=null;const T=E=>{const{serverURL:B,path:F,pageSize:de}=a.value,we=new AbortController;s.value="loading",b==null||b(),Ls({serverURL:B,lang:a.value.lang,path:F,pageSize:de,sortBy:ei[c.value],page:E,signal:we.signal,token:n.value.token}).then(be=>{s.value="success",i.value=be.count,u.value.push(...be.data),l.value=E,o.value=be.totalPages}).catch(be=>{be.name!=="AbortError"&&(console.error(be.message),s.value="error")}),b=we.abort.bind(we)},w=()=>{T(l.value+1)},C=()=>{i.value=0,u.value=[],T(1)},N=E=>{c.value!==E&&(c.value=E,C())},I=E=>{f.value=E},O=E=>{d.value=E},G=E=>{if(d.value)d.value.comment=E.comment,d.value.orig=E.orig;else if("rid"in E){const B=u.value.find(({objectId:F})=>F===E.rid);if(!B)return;Array.isArray(B.children)||(B.children=[]),B.children.push(E)}else u.value.unshift(E),i.value+=1},j=async({comment:E,status:B})=>{if(E.status===B)return;const{serverURL:F,lang:de}=a.value;await nn({serverURL:F,lang:de,token:n.value.token,objectId:E.objectId,comment:{status:B}}),E.status=B},oe=async E=>{if("rid"in E)return;const{serverURL:B,lang:F}=a.value;await nn({serverURL:B,lang:F,token:n.value.token,objectId:E.objectId,comment:{sticky:E.sticky?0:1}}),E.sticky=!E.sticky},ae=async({objectId:E})=>{if(!confirm("Are you sure you want to delete this comment?"))return;const{serverURL:B,lang:F}=a.value;await Ps({serverURL:B,lang:F,token:n.value.token,objectId:E}),u.value.some((de,we)=>de.objectId===E?(u.value=u.value.filter((be,Qe)=>Qe!==we),!0):de.children.some((be,Qe)=>be.objectId===E?(u.value[we].children=de.children.filter((ut,Xt)=>Xt!==Qe),!0):!1))},Me=async E=>{const{serverURL:B,lang:F}=a.value,{objectId:de}=E,we=r.value.includes(de);await nn({serverURL:B,lang:F,objectId:de,token:n.value.token,comment:{like:!we}}),we?r.value=r.value.filter(be=>be!==de):(r.value=[...r.value,de],r.value.length>50&&(r.value=r.value.slice(-50))),E.like=Math.max(0,(E.like||0)+(we?-1:1))};return ic(Fn,a),bn(()=>{Yt(()=>[t.serverURL,t.path],()=>{C()})}),Xr(()=>{b==null||b()}),(E,B)=>(L(),P("div",Ap,[le(mh),!f.value&&!d.value?(L(),st(wo,{key:0,onLog:C,onSubmit:G})):J("v-if",!0),D("div",Ep,[D("div",Tp,[i.value?(L(),P("span",{key:0,class:"wl-num",textContent:Y(i.value)},null,8,Ip)):J("v-if",!0),it(" "+Y(x.value.comment),1)]),D("ul",Lp,[(L(!0),P(fe,null,Fe(K(Uo),F=>(L(),P("li",{key:F,class:me([F===c.value?"active":""]),onClick:de=>N(F)},Y(x.value[F]),11,Mp))),128))])]),D("div",Pp,[(L(!0),P(fe,null,Fe(u.value,F=>(L(),st(Rp,{key:F.objectId,"root-id":F.objectId,comment:F,reply:f.value,edit:d.value,onLog:C,onReply:I,onEdit:O,onSubmit:G,onStatus:j,onDelete:ae,onSticky:oe,onLike:Me},null,8,["root-id","comment","reply","edit"]))),128))]),s.value==="error"?(L(),P("div",Op,[D("button",{type:"button",class:"wl-btn",onClick:C,textContent:Y(x.value.refresh)},null,8,jp)])):s.value==="loading"?(L(),P("div",zp,[le(K(In),{size:30})])):u.value.length?l.value<o.value?(L(),P("div",Fp,[D("button",{type:"button",class:"wl-btn",onClick:w,textContent:Y(x.value.more)},null,8,Hp)])):J("v-if",!0):(L(),P("div",{key:3,class:"wl-empty",textContent:Y(x.value.sofa)},null,8,Dp)),a.value.noCopyright?J("v-if",!0):(L(),P("div",Up,[B[0]||(B[0]=it(" Powered by ")),B[1]||(B[1]=D("a",{href:"https://github.com/walinejs/waline",target:"_blank",rel:"noopener noreferrer"}," Waline ",-1)),it(" v"+Y(K(ko)),1)]))]))}});const xo=(e,t)=>{t.forEach((n,r)=>{const s=e[r].time;typeof s=="number"&&(n.innerText=s.toString())})},_o=({serverURL:e,path:t=window.location.pathname,selector:n=".waline-pageview-count",update:r=!0,lang:s=navigator.language})=>{const i=new AbortController,l=Array.from(document.querySelectorAll(n)),o=c=>{const u=$s(c);return u!==null&&t!==u},a=c=>zs({serverURL:Hn(e),paths:c.map(u=>$s(u)??t),lang:s,signal:i.signal}).then(u=>xo(u,c)).catch(Dl);if(r){const c=l.filter(f=>!o(f)),u=l.filter(o);Ds({serverURL:Hn(e),path:t,lang:s}).then(f=>xo(f,c)),u.length&&a(u)}else a(l);return i.abort.bind(i)},Bp=({el:e="#waline",path:t=window.location.pathname,comment:n=!1,pageview:r=!1,...s})=>{const i=e?gs(e):null;if(e&&!i)throw new Error("Option 'el' do not match any domElement!");if(!s.serverURL)throw new Error("Option 'serverURL' is missing!");const l=pn({...s}),o=pn({comment:n,pageview:r,path:t}),a=()=>{o.comment&&uo({serverURL:l.serverURL,path:o.path,...zt(o.comment)?{selector:o.comment}:{}})},c=()=>{o.pageview&&_o({serverURL:l.serverURL,path:o.path,...zt(o.pageview)?{selector:o.pageview}:{}})};let u=null;i&&(u=pu(()=>ne(Np,{path:o.path,...l})),u.mount(i));const f=Xi(a),d=Xi(c);return{el:i,update:({comment:m,pageview:x,path:b=window.location.pathname,...T}={})=>{Object.entries(T).forEach(([w,C])=>{l[w]=C}),o.path=b,m!==void 0&&(o.comment=m),x!==void 0&&(o.pageview=x)},destroy:()=>{u==null||u.unmount(),f(),d()}}},Vp=({el:e,serverURL:t,count:n,lang:r=navigator.language})=>{const s=Sr(),i=gs(e),l=new AbortController;return Fs({serverURL:t,count:n,lang:r,signal:l.signal,token:s.value.token}).then(o=>i&&o.length?(i.innerHTML=`<ul class="wl-recent-list">${o.map(a=>`<li class="wl-recent-item"><a href="${a.url}">${a.nick}</a>:${a.comment}</li>`).join("")}</ul>`,{comments:o,destroy:()=>{l.abort(),i.innerHTML=""}}):{comments:o,destroy:()=>l.abort()})},Wp=({el:e,serverURL:t,count:n,locale:r,lang:s=navigator.language,mode:i="list"})=>{const l=gs(e),o=new AbortController;return Hs({serverURL:t,pageSize:n,lang:s,signal:o.signal}).then(a=>!l||!a.length?{users:a,destroy:()=>o.abort()}:(r={...Qs(s),...typeof r=="object"?r:{}},l.innerHTML=`<ul class="wl-user-${i}">${a.map((c,u)=>[`<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">${u+1}</span>`,"</div>",'<div class="wl-user-meta">','<div class="wl-user-name">',c.nick,c.level&&`<span class="wl-badge">${r?r[`level${c.level}`]:`Level ${c.level}`}</span>`,c.label&&`<span class="wl-badge">${c.label}</span>`,"</div>",c.link&&c.link,"</div>",c.link&&"</a>","</li>"].filter(f=>f).join("")).join("")}</ul>`,{users:a,destroy:()=>{o.abort(),l.innerHTML=""}}))};export{Vp as RecentComments,Wp as UserList,Ms as addComment,uo as commentCount,Dn as defaultLocales,Ps as deleteComment,Os as fetchCommentCount,Rr as getArticleCounter,Ls as getComment,zs as getPageview,Fs as getRecentComment,Hs as getUserList,Bp as init,js as login,_o as pageviewCount,zn as updateArticleCounter,nn as updateComment,Ds as updatePageview,ko as version};
|
|
84
84
|
//# sourceMappingURL=waline.js.map
|
package/dist/waline.umd.js
CHANGED
|
@@ -80,5 +80,5 @@ ${t}</tr>
|
|
|
80
80
|
`+this.renderer.text(c);n?r+=this.renderer.paragraph({type:"paragraph",raw:u,text:u,tokens:[{type:"text",raw:u,text:u,escaped:!0}]}):r+=u;continue}default:{const c='Token with "'+a.type+'" type was not found.';if(this.options.silent)return console.error(c),"";throw new Error(c)}}}return r}parseInline(t,n=this.renderer){var i,s;let r="";for(let l=0;l<t.length;l++){const o=t[l];if((s=(i=this.options.extensions)==null?void 0:i.renderers)!=null&&s[o.type]){const c=this.options.extensions.renderers[o.type].call({parser:this},o);if(c!==!1||!["escape","html","link","image","strong","em","codespan","br","del","text"].includes(o.type)){r+=c||"";continue}}const a=o;switch(a.type){case"escape":{r+=n.text(a);break}case"html":{r+=n.html(a);break}case"link":{r+=n.link(a);break}case"image":{r+=n.image(a);break}case"strong":{r+=n.strong(a);break}case"em":{r+=n.em(a);break}case"codespan":{r+=n.codespan(a);break}case"br":{r+=n.br(a);break}case"del":{r+=n.del(a);break}case"text":{r+=n.text(a);break}default:{const c='Token with "'+a.type+'" type was not found.';if(this.options.silent)return console.error(c),"";throw new Error(c)}}}return r}}class En{options;block;constructor(t){this.options=t||Lt}preprocess(t){return t}postprocess(t){return t}processAllTokens(t){return t}provideLexer(){return this.block?We.lex:We.lexInline}provideParser(){return this.block?qe.parse:qe.parseInline}}Co(En,"passThroughHooks",new Set(["preprocess","postprocess","processAllTokens"]));class eo{defaults=vi();options=this.setOptions;parse=this.parseMarkdown(!0);parseInline=this.parseMarkdown(!1);Parser=qe;Renderer=_r;TextRenderer=$i;Lexer=We;Tokenizer=xr;Hooks=En;constructor(...t){this.use(...t)}walkTokens(t,n){var i,s;let r=[];for(const l of t)switch(r=r.concat(n.call(this,l)),l.type){case"table":{const o=l;for(const a of o.header)r=r.concat(this.walkTokens(a.tokens,n));for(const a of o.rows)for(const c of a)r=r.concat(this.walkTokens(c.tokens,n));break}case"list":{const o=l;r=r.concat(this.walkTokens(o.items,n));break}default:{const o=l;(s=(i=this.defaults.extensions)==null?void 0:i.childTokens)!=null&&s[o.type]?this.defaults.extensions.childTokens[o.type].forEach(a=>{const c=o[a].flat(1/0);r=r.concat(this.walkTokens(c,n))}):o.tokens&&(r=r.concat(this.walkTokens(o.tokens,n)))}}return r}use(...t){const n=this.defaults.extensions||{renderers:{},childTokens:{}};return t.forEach(r=>{const i={...r};if(i.async=this.defaults.async||i.async||!1,r.extensions&&(r.extensions.forEach(s=>{if(!s.name)throw new Error("extension name required");if("renderer"in s){const l=n.renderers[s.name];l?n.renderers[s.name]=function(...o){let a=s.renderer.apply(this,o);return a===!1&&(a=l.apply(this,o)),a}:n.renderers[s.name]=s.renderer}if("tokenizer"in s){if(!s.level||s.level!=="block"&&s.level!=="inline")throw new Error("extension level must be 'block' or 'inline'");const l=n[s.level];l?l.unshift(s.tokenizer):n[s.level]=[s.tokenizer],s.start&&(s.level==="block"?n.startBlock?n.startBlock.push(s.start):n.startBlock=[s.start]:s.level==="inline"&&(n.startInline?n.startInline.push(s.start):n.startInline=[s.start]))}"childTokens"in s&&s.childTokens&&(n.childTokens[s.name]=s.childTokens)}),i.extensions=n),r.renderer){const s=this.defaults.renderer||new _r(this.defaults);for(const l in r.renderer){if(!(l in s))throw new Error(`renderer '${l}' does not exist`);if(["options","parser"].includes(l))continue;const o=l,a=r.renderer[o],c=s[o];s[o]=(...u)=>{let f=a.apply(s,u);return f===!1&&(f=c.apply(s,u)),f||""}}i.renderer=s}if(r.tokenizer){const s=this.defaults.tokenizer||new xr(this.defaults);for(const l in r.tokenizer){if(!(l in s))throw new Error(`tokenizer '${l}' does not exist`);if(["options","rules","lexer"].includes(l))continue;const o=l,a=r.tokenizer[o],c=s[o];s[o]=(...u)=>{let f=a.apply(s,u);return f===!1&&(f=c.apply(s,u)),f}}i.tokenizer=s}if(r.hooks){const s=this.defaults.hooks||new En;for(const l in r.hooks){if(!(l in s))throw new Error(`hook '${l}' does not exist`);if(["options","block"].includes(l))continue;const o=l,a=r.hooks[o],c=s[o];En.passThroughHooks.has(l)?s[o]=u=>{if(this.defaults.async)return Promise.resolve(a.call(s,u)).then(d=>c.call(s,d));const f=a.call(s,u);return c.call(s,f)}:s[o]=(...u)=>{let f=a.apply(s,u);return f===!1&&(f=c.apply(s,u)),f}}i.hooks=s}if(r.walkTokens){const s=this.defaults.walkTokens,l=r.walkTokens;i.walkTokens=function(o){let a=[];return a.push(l.call(this,o)),s&&(a=a.concat(s.call(this,o))),a}}this.defaults={...this.defaults,...i}}),this}setOptions(t){return this.defaults={...this.defaults,...t},this}lexer(t,n){return We.lex(t,n??this.defaults)}parser(t,n){return qe.parse(t,n??this.defaults)}parseMarkdown(t){return(r,i)=>{const s={...i},l={...this.defaults,...s},o=this.onError(!!l.silent,!!l.async);if(this.defaults.async===!0&&s.async===!1)return o(new Error("marked(): The async option was set to true by an extension. Remove async: false from the parse options object to return a Promise."));if(typeof r>"u"||r===null)return o(new Error("marked(): input parameter is undefined or null"));if(typeof r!="string")return o(new Error("marked(): input parameter is of type "+Object.prototype.toString.call(r)+", string expected"));l.hooks&&(l.hooks.options=l,l.hooks.block=t);const a=l.hooks?l.hooks.provideLexer():t?We.lex:We.lexInline,c=l.hooks?l.hooks.provideParser():t?qe.parse:qe.parseInline;if(l.async)return Promise.resolve(l.hooks?l.hooks.preprocess(r):r).then(u=>a(u,l)).then(u=>l.hooks?l.hooks.processAllTokens(u):u).then(u=>l.walkTokens?Promise.all(this.walkTokens(u,l.walkTokens)).then(()=>u):u).then(u=>c(u,l)).then(u=>l.hooks?l.hooks.postprocess(u):u).catch(o);try{l.hooks&&(r=l.hooks.preprocess(r));let u=a(r,l);l.hooks&&(u=l.hooks.processAllTokens(u)),l.walkTokens&&this.walkTokens(u,l.walkTokens);let f=c(u,l);return l.hooks&&(f=l.hooks.postprocess(f)),f}catch(u){return o(u)}}}onError(t,n){return r=>{if(r.message+=`
|
|
81
81
|
Please report this to https://github.com/markedjs/marked.`,t){const i="<p>An error occurred:</p><pre>"+Xe(r.message+"",!0)+"</pre>";return n?Promise.resolve(i):i}if(n)return Promise.reject(r);throw r}}}const Mt=new eo;function de(e,t){return Mt.parse(e,t)}de.options=de.setOptions=function(e){return Mt.setOptions(e),de.defaults=Mt.defaults,Dl(de.defaults),de},de.getDefaults=vi,de.defaults=Lt,de.use=function(...e){return Mt.use(...e),de.defaults=Mt.defaults,Dl(de.defaults),de},de.walkTokens=function(e,t){return Mt.walkTokens(e,t)},de.parseInline=Mt.parseInline,de.Parser=qe,de.parser=qe.parse,de.Renderer=_r,de.TextRenderer=$i,de.Lexer=We,de.lexer=We.lex,de.Tokenizer=xr,de.Hooks=En,de.parse=de;function xf(e){if(typeof e=="function"&&(e={highlight:e}),!e||typeof e.highlight!="function")throw new Error("Must provide highlight function");return typeof e.langPrefix!="string"&&(e.langPrefix="language-"),typeof e.emptyLangClass!="string"&&(e.emptyLangClass=""),{async:!!e.async,walkTokens(t){if(t.type!=="code")return;const n=to(t.lang);if(e.async)return Promise.resolve(e.highlight(t.text,n,t.lang||"")).then(no(t));const r=e.highlight(t.text,n,t.lang||"");if(r instanceof Promise)throw new Error("markedHighlight is not set to async but the highlight function is async. Set the async option to true on markedHighlight to await the async highlight function.");no(t)(r)},useNewRenderer:!0,renderer:{code(t,n,r){typeof t=="object"&&(r=t.escaped,n=t.lang,t=t.text);const i=to(n),s=i?e.langPrefix+lo(i):e.emptyLangClass,l=s?` class="${s}"`:"";return t=t.replace(/\n$/,""),`<pre><code${l}>${r?t:lo(t,!0)}
|
|
82
82
|
</code></pre>`}}}}function to(e){return(e||"").match(/\S*/)[0]}function no(e){return t=>{typeof t=="string"&&t!==e.text&&(e.escaped=!0,e.text=t)}}const ro=/[&<>"']/,_f=new RegExp(ro.source,"g"),io=/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/,Cf=new RegExp(io.source,"g"),Sf={"&":"&","<":"<",">":">",'"':""","'":"'"},so=e=>Sf[e];function lo(e,t){if(t){if(ro.test(e))return e.replace(_f,so)}else if(io.test(e))return e.replace(Cf,so);return e}const $f=/\$.*?\$/,Rf=/^\$(.*?)\$/,Af=/^(?:\s{0,3})\$\$((?:[^\n]|\n[^\n])+?)\n{0,1}\$\$/,Ef=e=>[{name:"blockMath",level:"block",tokenizer(t){const n=Af.exec(t);if(n!==null)return{type:"html",raw:n[0],text:e(!0,n[1])}}},{name:"inlineMath",level:"inline",start(t){const n=t.search($f);return n!==-1?n:t.length},tokenizer(t){const n=Rf.exec(t);if(n!==null)return{type:"html",raw:n[0],text:e(!1,n[1])}}}],oo=(e="",t={})=>e.replace(/:(.+?):/g,(n,r)=>t[r]?`<img class="wl-emoji" src="${t[r]}" alt="${r}">`:n),Tf=(e,{emojiMap:t,highlighter:n,texRenderer:r})=>{const i=new eo;if(i.setOptions({breaks:!0}),n&&i.use(xf({highlight:n})),r){const s=Ef(r);i.use({extensions:s})}return i.parse(oo(e,t))},Ri=e=>{const{path:t}=e.dataset;return t!=null&&t.length?t:null},If=e=>e.match(/[\w\d\s,.\u00C0-\u024F\u0400-\u04FF]+/giu),Lf=e=>e.match(/[\u4E00-\u9FD5]/gu),Mf=e=>{var t,n;return(((t=If(e))==null?void 0:t.reduce((r,i)=>r+(["",",","."].includes(i.trim())?0:i.trim().split(/\s+/u).length),0))??0)+(((n=Lf(e))==null?void 0:n.length)??0)},Pf=async()=>{const{userAgentData:e}=navigator;let t=navigator.userAgent;if(!e||e.platform!=="Windows")return t;const{platformVersion:n}=await e.getHighEntropyValues(["platformVersion"]);return n&&parseInt(n.split(".")[0])>=13&&(t=t.replace("Windows NT 10.0","Windows NT 11.0")),t},ao=({serverURL:e,path:t=window.location.pathname,selector:n=".waline-comment-count",lang:r=navigator.language})=>{const i=new AbortController,s=document.querySelectorAll(n);return s.length&&Mi({serverURL:Fn(e),paths:Array.from(s).map(l=>Xi(Ri(l)??t)),lang:r,signal:i.signal}).then(l=>{s.forEach((o,a)=>{o.innerText=l[a].toString()})}).catch(jl),i.abort.bind(i)},co=({size:e})=>ne("svg",{class:"wl-close-icon",viewBox:"0 0 1024 1024",width:e,height:e},[ne("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"}),ne("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"})]),Of=()=>ne("svg",{viewBox:"0 0 1024 1024",width:"24",height:"24"},ne("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"})),jf=()=>ne("svg",{viewBox:"0 0 1024 1024",width:"24",height:"24"},ne("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"})),zf=()=>ne("svg",{viewBox:"0 0 1024 1024",width:"24",height:"24"},[ne("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"}),ne("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"})]),Df=({active:e=!1})=>ne("svg",{viewBox:"0 0 1024 1024",width:"24",height:"24"},[ne("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"})]),Ff=()=>ne("svg",{viewBox:"0 0 1024 1024",width:"24",height:"24"},[ne("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"}),ne("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"})]),Hf=()=>ne("svg",{width:"16",height:"16",ariaHidden:"true"},ne("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"})),Uf=()=>ne("svg",{viewBox:"0 0 1024 1024",width:"24",height:"24"},ne("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"})),Nf=()=>ne("svg",{viewBox:"0 0 1024 1024",width:"24",height:"24"},ne("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"})),Bf=()=>ne("svg",{class:"verified-icon",viewBox:"0 0 1024 1024",width:"14",height:"14"},ne("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"})),Tn=({size:e=100})=>ne("svg",{width:e,height:e,viewBox:"0 0 100 100",preserveAspectRatio:"xMidYMid"},ne("circle",{cx:50,cy:50,fill:"none",stroke:"currentColor",strokeWidth:"4",r:"40","stroke-dasharray":"85 30"},ne("animateTransform",{attributeName:"transform",type:"rotate",repeatCount:"indefinite",dur:"1s",values:"0 50 50;360 50 50",keyTimes:"0;1"}))),Vf=()=>ne("svg",{width:24,height:24,fill:"currentcolor",viewBox:"0 0 24 24"},[ne("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"}),ne("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"})]),Wf=()=>Qt("WALINE_USER_META",{nick:"",mail:"",link:""}),qf=()=>Qt("WALINE_COMMENT_BOX_EDITOR",""),Kf="WALINE_LIKE",Gf=Qt(Kf,[]),uo=()=>Gf,Zf="WALINE_REACTION",Yf=Qt(Zf,{}),Jf=()=>Yf;var Ai={},ct={},ut={},fo;function ho(){if(fo)return ut;fo=1;var e=ut&&ut.__awaiter||function(r,i,s,l){function o(a){return a instanceof s?a:new s(function(c){c(a)})}return new(s||(s=Promise))(function(a,c){function u(m){try{d(l.next(m))}catch(x){c(x)}}function f(m){try{d(l.throw(m))}catch(x){c(x)}}function d(m){m.done?a(m.value):o(m.value).then(u,f)}d((l=l.apply(r,i||[])).next())})},t=ut&&ut.__generator||function(r,i){var s={label:0,sent:function(){if(a[0]&1)throw a[1];return a[1]},trys:[],ops:[]},l,o,a,c;return c={next:u(0),throw:u(1),return:u(2)},typeof Symbol=="function"&&(c[Symbol.iterator]=function(){return this}),c;function u(d){return function(m){return f([d,m])}}function f(d){if(l)throw new TypeError("Generator is already executing.");for(;c&&(c=0,d[0]&&(s=0)),s;)try{if(l=1,o&&(a=d[0]&2?o.return:d[0]?o.throw||((a=o.return)&&a.call(o),0):o.next)&&!(a=a.call(o,d[1])).done)return a;switch(o=0,a&&(d=[d[0]&2,a.value]),d[0]){case 0:case 1:a=d;break;case 4:return s.label++,{value:d[1],done:!1};case 5:s.label++,o=d[1],d=[0];continue;case 7:d=s.ops.pop(),s.trys.pop();continue;default:if(a=s.trys,!(a=a.length>0&&a[a.length-1])&&(d[0]===6||d[0]===2)){s=0;continue}if(d[0]===3&&(!a||d[1]>a[0]&&d[1]<a[3])){s.label=d[1];break}if(d[0]===6&&s.label<a[1]){s.label=a[1],a=d;break}if(a&&s.label<a[2]){s.label=a[2],s.ops.push(d);break}a[2]&&s.ops.pop(),s.trys.pop();continue}d=i.call(r,s)}catch(m){d=[6,m],o=0}finally{l=a=0}if(d[0]&5)throw d[1];return{value:d[0]?d[1]:void 0,done:!0}}};Object.defineProperty(ut,"__esModule",{value:!0}),ut.ReCaptchaInstance=void 0;var n=function(){function r(i,s,l){this.siteKey=i,this.recaptchaID=s,this.recaptcha=l,this.styleContainer=null}return r.prototype.execute=function(i){return e(this,void 0,void 0,function(){var s;return t(this,function(l){switch(l.label){case 0:return this.recaptcha.enterprise?[4,this.recaptcha.enterprise.execute(this.recaptchaID,{action:i})]:[3,2];case 1:return s=l.sent(),[3,4];case 2:return[4,this.recaptcha.execute(this.recaptchaID,{action:i})];case 3:s=l.sent(),l.label=4;case 4:return[2,s]}})})},r.prototype.getSiteKey=function(){return this.siteKey},r.prototype.hideBadge=function(){this.styleContainer===null&&(this.styleContainer=document.createElement("style"),this.styleContainer.innerHTML=".grecaptcha-badge{visibility:hidden !important;}",document.head.appendChild(this.styleContainer))},r.prototype.showBadge=function(){this.styleContainer!==null&&(document.head.removeChild(this.styleContainer),this.styleContainer=null)},r}();return ut.ReCaptchaInstance=n,ut}var po;function Qf(){if(po)return ct;po=1;var e=ct&&ct.__assign||function(){return e=Object.assign||function(i){for(var s,l=1,o=arguments.length;l<o;l++){s=arguments[l];for(var a in s)Object.prototype.hasOwnProperty.call(s,a)&&(i[a]=s[a])}return i},e.apply(this,arguments)};Object.defineProperty(ct,"__esModule",{value:!0}),ct.getInstance=ct.load=void 0;var t=ho(),n;(function(i){i[i.NOT_LOADED=0]="NOT_LOADED",i[i.LOADING=1]="LOADING",i[i.LOADED=2]="LOADED"})(n||(n={}));var r=function(){function i(){}return i.load=function(s,l){if(l===void 0&&(l={}),typeof document>"u")return Promise.reject(new Error("This is a library for the browser!"));if(i.getLoadingState()===n.LOADED)return i.instance.getSiteKey()===s?Promise.resolve(i.instance):Promise.reject(new Error("reCAPTCHA already loaded with different site key!"));if(i.getLoadingState()===n.LOADING)return s!==i.instanceSiteKey?Promise.reject(new Error("reCAPTCHA already loaded with different site key!")):new Promise(function(a,c){i.successfulLoadingConsumers.push(function(u){return a(u)}),i.errorLoadingRunnable.push(function(u){return c(u)})});i.instanceSiteKey=s,i.setLoadingState(n.LOADING);var o=new i;return new Promise(function(a,c){o.loadScript(s,l.useRecaptchaNet||!1,l.useEnterprise||!1,l.renderParameters?l.renderParameters:{},l.customUrl).then(function(){i.setLoadingState(n.LOADED);var u=o.doExplicitRender(grecaptcha,s,l.explicitRenderParameters?l.explicitRenderParameters:{},l.useEnterprise||!1),f=new t.ReCaptchaInstance(s,u,grecaptcha);i.successfulLoadingConsumers.forEach(function(d){return d(f)}),i.successfulLoadingConsumers=[],l.autoHideBadge&&f.hideBadge(),i.instance=f,a(f)}).catch(function(u){i.errorLoadingRunnable.forEach(function(f){return f(u)}),i.errorLoadingRunnable=[],c(u)})})},i.getInstance=function(){return i.instance},i.setLoadingState=function(s){i.loadingState=s},i.getLoadingState=function(){return i.loadingState===null?n.NOT_LOADED:i.loadingState},i.prototype.loadScript=function(s,l,o,a,c){var u=this;l===void 0&&(l=!1),o===void 0&&(o=!1),a===void 0&&(a={}),c===void 0&&(c="");var f=document.createElement("script");f.setAttribute("recaptcha-v3-script",""),f.setAttribute("async",""),f.setAttribute("defer","");var d="https://www.google.com/recaptcha/api.js";l?o?d="https://recaptcha.net/recaptcha/enterprise.js":d="https://recaptcha.net/recaptcha/api.js":o&&(d="https://www.google.com/recaptcha/enterprise.js"),c&&(d=c),a.render&&(a.render=void 0);var m=this.buildQueryString(a);return f.src=d+"?render=explicit"+m,new Promise(function(x,b){f.addEventListener("load",u.waitForScriptToLoad(function(){x(f)},o),!1),f.onerror=function(T){i.setLoadingState(n.NOT_LOADED),b(T)},document.head.appendChild(f)})},i.prototype.buildQueryString=function(s){var l=Object.keys(s);return l.length<1?"":"&"+Object.keys(s).filter(function(o){return!!s[o]}).map(function(o){return o+"="+s[o]}).join("&")},i.prototype.waitForScriptToLoad=function(s,l){var o=this;return function(){window.grecaptcha===void 0?setTimeout(function(){o.waitForScriptToLoad(s,l)},i.SCRIPT_LOAD_DELAY):l?window.grecaptcha.enterprise.ready(function(){s()}):window.grecaptcha.ready(function(){s()})}},i.prototype.doExplicitRender=function(s,l,o,a){var c=e({sitekey:l},o);return o.container?a?s.enterprise.render(o.container,c):s.render(o.container,c):a?s.enterprise.render(c):s.render(c)},i.loadingState=null,i.instance=null,i.instanceSiteKey=null,i.successfulLoadingConsumers=[],i.errorLoadingRunnable=[],i.SCRIPT_LOAD_DELAY=25,i}();return ct.load=r.load,ct.getInstance=r.getInstance,ct}var go;function Xf(){return go||(go=1,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.ReCaptchaInstance=e.getInstance=e.load=void 0;var t=Qf();Object.defineProperty(e,"load",{enumerable:!0,get:function(){return t.load}}),Object.defineProperty(e,"getInstance",{enumerable:!0,get:function(){return t.getInstance}});var n=ho();Object.defineProperty(e,"ReCaptchaInstance",{enumerable:!0,get:function(){return n.ReCaptchaInstance}})}(Ai)),Ai}var eh=Xf();const mo={},th=e=>{const t=mo[e]??(mo[e]=eh.load(e,{useRecaptchaNet:!0,autoHideBadge:!0}));return{execute:n=>t.then(r=>r.execute(n))}},nh=e=>({execute:async t=>{const{load:n}=Mu("https://challenges.cloudflare.com/turnstile/v0/api.js",void 0,{async:!1});await n();const r=window.turnstile;return new Promise(i=>{r==null||r.ready(()=>{r.render(".wl-captcha-container",{sitekey:e,action:t,size:"compact",callback:i})})})}}),rh=Qt("WALINE_USER",{}),Cr=()=>rh,ih={key:0,class:"wl-reaction"},sh=["textContent"],lh={class:"wl-reaction-list"},oh=["onClick"],ah={class:"wl-reaction-img"},ch=["src","alt"],uh=["textContent"],fh=["textContent"];var hh=gn({__name:"ArticleReaction",setup(e){const t=Jf(),n=rr(Dn),r=te(-1),i=te([]),s=me(()=>n.value.locale),l=me(()=>{const{reaction:f}=n.value;return f!=null&&f.length?f:null}),o=me(()=>{var f;const{path:d}=n.value;return((f=l.value)==null?void 0:f.map((m,x)=>({icon:m,desc:s.value[`reaction${x}`],active:t.value[d]===x})))??null});let a;const c=async()=>{const{serverURL:f,lang:d,path:m}=n.value;if(!l.value)return;const x=new AbortController;a=x.abort.bind(x);const[b]=await Ar({serverURL:f,lang:d,paths:[m],type:l.value.map((T,w)=>`reaction${w}`),signal:x.signal});i.value=l.value.map((T,w)=>b[`reaction${w}`])},u=async f=>{if(r.value!==-1)return;const{serverURL:d,lang:m,path:x}=n.value,b=t.value[x];r.value=f,b!==void 0&&(await jn({serverURL:d,lang:m,path:x,type:`reaction${b}`,action:"desc"}),i.value[b]=Math.max(i.value[b]-1,0)),b!==f&&(await jn({serverURL:d,lang:m,path:x,type:`reaction${f}`}),i.value[f]=(i.value[f]||0)+1),b===f?delete t.value[x]:t.value[x]=f,r.value=-1};return vn(()=>{Jt(()=>[n.value.serverURL,n.value.path],()=>c())}),ei(()=>{a==null||a()}),(f,d)=>o.value?(L(),P("div",ih,[D("div",{class:"wl-reaction-title",textContent:J(s.value.reactionTitle)},null,8,sh),D("ul",lh,[(L(!0),P(ue,null,Fe(o.value,({active:m,icon:x,desc:b},T)=>(L(),P("li",{key:T,class:ve(["wl-reaction-item",{active:m}]),onClick:w=>u(T)},[D("div",ah,[D("img",{src:x,alt:b},null,8,ch),r.value===T?(L(),st(K(Tn),{key:0,class:"wl-reaction-loading"})):(L(),P("div",{key:1,class:"wl-reaction-votes",textContent:J(i.value[T]||0)},null,8,uh))]),D("div",{class:"wl-reaction-text",textContent:J(b)},null,8,fh)],10,oh))),128))])])):Y("v-if",!0)}}),In=new Map;function ph(e){var t=In.get(e);t&&t.destroy()}function dh(e){var t=In.get(e);t&&t.update()}var Ln=null;typeof window>"u"?((Ln=function(e){return e}).destroy=function(e){return e},Ln.update=function(e){return e}):((Ln=function(e,t){return e&&Array.prototype.forEach.call(e.length?e:[e],function(n){return function(r){if(r&&r.nodeName&&r.nodeName==="TEXTAREA"&&!In.has(r)){var i,s=null,l=window.getComputedStyle(r),o=(i=r.value,function(){c({testForHeightReduction:i===""||!r.value.startsWith(i),restoreTextAlign:null}),i=r.value}),a=(function(f){r.removeEventListener("autosize:destroy",a),r.removeEventListener("autosize:update",u),r.removeEventListener("input",o),window.removeEventListener("resize",u),Object.keys(f).forEach(function(d){return r.style[d]=f[d]}),In.delete(r)}).bind(r,{height:r.style.height,resize:r.style.resize,textAlign:r.style.textAlign,overflowY:r.style.overflowY,overflowX:r.style.overflowX,wordWrap:r.style.wordWrap});r.addEventListener("autosize:destroy",a),r.addEventListener("autosize:update",u),r.addEventListener("input",o),window.addEventListener("resize",u),r.style.overflowX="hidden",r.style.wordWrap="break-word",In.set(r,{destroy:a,update:u}),u()}function c(f){var d,m,x=f.restoreTextAlign,b=x===void 0?null:x,T=f.testForHeightReduction,w=T===void 0||T,C=l.overflowY;if(r.scrollHeight!==0&&(l.resize==="vertical"?r.style.resize="none":l.resize==="both"&&(r.style.resize="horizontal"),w&&(d=function(I){for(var O=[];I&&I.parentNode&&I.parentNode instanceof Element;)I.parentNode.scrollTop&&O.push([I.parentNode,I.parentNode.scrollTop]),I=I.parentNode;return function(){return O.forEach(function(G){var j=G[0],ae=G[1];j.style.scrollBehavior="auto",j.scrollTop=ae,j.style.scrollBehavior=null})}}(r),r.style.height=""),m=l.boxSizing==="content-box"?r.scrollHeight-(parseFloat(l.paddingTop)+parseFloat(l.paddingBottom)):r.scrollHeight+parseFloat(l.borderTopWidth)+parseFloat(l.borderBottomWidth),l.maxHeight!=="none"&&m>parseFloat(l.maxHeight)?(l.overflowY==="hidden"&&(r.style.overflow="scroll"),m=parseFloat(l.maxHeight)):l.overflowY!=="hidden"&&(r.style.overflow="hidden"),r.style.height=m+"px",b&&(r.style.textAlign=b),d&&d(),s!==m&&(r.dispatchEvent(new Event("autosize:resized",{bubbles:!0})),s=m),C!==l.overflow&&!b)){var N=l.textAlign;l.overflow==="hidden"&&(r.style.textAlign=N==="start"?"end":"start"),c({restoreTextAlign:N,testForHeightReduction:!0})}}function u(){c({testForHeightReduction:!0,restoreTextAlign:null})}}(n)}),e}).destroy=function(e){return e&&Array.prototype.forEach.call(e.length?e:[e],ph),e},Ln.update=function(e){return e&&Array.prototype.forEach.call(e.length?e:[e],dh),e});var vo=Ln;const gh=["data-index"],mh=["src","title","onClick"];var vh=gn({__name:"ImageWall",props:{items:{default:()=>[]},columnWidth:{default:300},gap:{default:0}},emits:["insert"],setup(e){const t=e;let n=null;const r=dt("wall"),i=te({}),s=te([]),l=()=>{const f=Math.floor((r.value.getBoundingClientRect().width+t.gap)/(t.columnWidth+t.gap));return f>0?f:1},o=f=>new Array(f).fill(null).map(()=>[]),a=async f=>{var d;if(f>=t.items.length)return;await Kt();const m=Array.from(((d=r.value)==null?void 0:d.children)??[]).reduce((x,b)=>b.getBoundingClientRect().height<x.getBoundingClientRect().height?b:x);s.value[Number(m.dataset.index)].push(f),await a(f+1)},c=async(f=!1)=>{if(s.value.length===l()&&!f)return;s.value=o(l());const d=window.scrollY;await a(0),window.scrollTo({top:d})},u=f=>{i.value[f.target.src]=!0};return vn(()=>{c(!0),n=new ResizeObserver(()=>{c()}),n.observe(r.value),gt(()=>[t.items],()=>{i.value={},c(!0)}),gt(()=>[t.columnWidth,t.gap],()=>{c()})}),Za(()=>{n.unobserve(r.value)}),(f,d)=>(L(),P("div",{ref_key:"wall",ref:r,class:"wl-gallery",style:ln({gap:`${f.gap}px`})},[(L(!0),P(ue,null,Fe(s.value,(m,x)=>(L(),P("div",{key:x,class:"wl-gallery-column","data-index":x,style:ln({gap:`${f.gap}px`})},[(L(!0),P(ue,null,Fe(m,b=>(L(),P(ue,{key:b},[i.value[f.items[b].src]?Y("v-if",!0):(L(),st(K(Tn),{key:0,size:36,style:{margin:"20px auto"}})),D("img",{class:"wl-gallery-item",src:f.items[b].src,title:f.items[b].title,loading:"lazy",onLoad:u,onClick:T=>f.$emit("insert",``)},null,40,mh)],64))),128))],12,gh))),128))],4))}});const bh={key:0,class:"wl-login-info"},yh={class:"wl-avatar"},wh=["title"],kh=["title"],xh=["src"],_h=["title","textContent"],Ch={class:"wl-panel"},Sh=["for","textContent"],$h=["id","onUpdate:modelValue","name","type"],Rh=["placeholder"],Ah={class:"wl-preview"},Eh=["innerHTML"],Th={class:"wl-footer"},Ih={class:"wl-actions"},Lh={href:"https://guides.github.com/features/mastering-markdown/",title:"Markdown Guide","aria-label":"Markdown is supported",class:"wl-action",target:"_blank",rel:"noopener noreferrer"},Mh=["title"],Ph=["title"],Oh=["title","aria-label"],jh=["title"],zh={class:"wl-info"},Dh={class:"wl-text-number"},Fh={key:0},Hh=["textContent"],Uh=["textContent"],Nh=["disabled"],Bh=["placeholder"],Vh={key:1,class:"wl-loading"},Wh={key:0,class:"wl-tab-wrapper"},qh=["title","onClick"],Kh=["src","alt"],Gh={key:0,class:"wl-tabs"},Zh=["onClick"],Yh=["src","alt","title"],Jh=["title"];var bo=gn({__name:"CommentBox",props:{edit:{},rootId:{},replyId:{},replyUser:{}},emits:["log","cancelEdit","cancelReply","submit"],setup(e,{emit:t}){const n=e,r=t,i=rr(Dn),s=qf(),l=Wf(),o=Cr(),a=te({}),c=dt("textarea"),u=dt("image-uploader"),f=dt("emoji-button"),d=dt("emoji-popup"),m=dt("gif-button"),x=dt("gif-popup"),b=dt("gif-search"),T=te({tabs:[],map:{}}),w=te(0),C=te(!1),N=te(!1),I=te(!1),O=te(""),G=te(0),j=hn({loading:!0,list:[]}),ae=te(0),fe=te(!1),Ue=te(""),E=te(!1),B=te(!1),F=me(()=>i.value.locale),ge=me(()=>!!o.value.token),ke=me(()=>du(i.value.imageUploader)),we=z=>{const R=c.value,W=R.selectionStart,h=R.selectionEnd||0,p=R.scrollTop;s.value=R.value.substring(0,W)+z+R.value.substring(h,R.value.length),R.focus(),R.selectionStart=W+z.length,R.selectionEnd=W+z.length,R.scrollTop=p},ft=({key:z,ctrlKey:R,metaKey:W})=>{E.value||(R||W)&&z==="Enter"&&Ke()},bt=async z=>{const R=`![${i.value.locale.uploading} ${z.name}]()`;we(R),E.value=!0;try{const W=await i.value.imageUploader(z);s.value=s.value.replace(R,`\r
|
|
83
|
-
`)}catch(W){alert(W.message),s.value=s.value.replace(R,"")}finally{E.value=!1}},Mn=z=>{var R;if((R=z.dataTransfer)!=null&&R.items){const W=zl(z.dataTransfer.items);W&&ke.value&&(bt(W),z.preventDefault())}},Sr=z=>{if(z.clipboardData){const R=zl(z.clipboardData.items);R&&ke.value&&bt(R)}},Xt=()=>{const z=u.value;z.files&&ke.value&&bt(z.files[0]).then(()=>{z.value=""})},Ke=async()=>{var z;const{serverURL:R,lang:W,login:h,wordLimit:p,requiredMeta:g,recaptchaV3Key:y,turnstileKey:k}=i.value,v={comment:Ue.value,nick:l.value.nick,mail:l.value.mail,link:l.value.link,url:i.value.path,ua:await Pf()};if(!n.edit)if(o.value.token)v.nick=o.value.display_name,v.mail=o.value.email,v.link=o.value.url;else{if(h==="force")return;if(g.includes("nick")&&!v.nick){a.value.nick.focus(),alert(F.value.nickError);return}if(g.includes("mail")&&!v.mail||v.mail&&!Ko(v.mail)){a.value.mail.focus(),alert(F.value.mailError);return}v.nick||(v.nick=F.value.anonymous)}if(!v.comment){c.value.focus();return}if(!fe.value){alert(F.value.wordHint.replace("$0",p[0].toString()).replace("$1",p[1].toString()).replace("$2",G.value.toString()));return}v.comment=oo(v.comment,T.value.map),n.replyId&&n.rootId&&(v.pid=n.replyId,v.rid=n.rootId,v.at=n.replyUser),E.value=!0;try{y&&(v.recaptchaV3=await th(y).execute("social")),k&&(v.turnstile=await nh(k).execute("social"));const A={serverURL:R,lang:W,token:o.value.token,comment:v},S=await(n.edit?tn({objectId:n.edit.objectId,...A}):Ii(A));if(E.value=!1,S.errmsg){alert(S.errmsg);return}r("submit",S.data),s.value="",O.value="",await Kt(),n.replyId&&r("cancelReply"),(z=n.edit)!=null&&z.objectId&&r("cancelEdit")}catch(A){E.value=!1,alert(A.message)}},$r=z=>{z.preventDefault();const{lang:R,serverURL:W}=i.value;Pi({serverURL:W,lang:R}).then(h=>{o.value=h,(h.remember?localStorage:sessionStorage).setItem("WALINE_USER",JSON.stringify(h)),r("log")})},Ei=()=>{o.value={},localStorage.setItem("WALINE_USER","null"),sessionStorage.setItem("WALINE_USER","null"),r("log")},Rr=z=>{z.preventDefault();const{lang:R,serverURL:W}=i.value,h=800,p=800,g=(window.innerWidth-h)/2,y=(window.innerHeight-p)/2,k=new URLSearchParams({lng:R,token:o.value.token}),v=window.open(`${W}/ui/profile?${k.toString()}`,"_blank",`width=${h},height=${p},left=${g},top=${y},scrollbars=no,resizable=no,status=no,location=no,toolbar=no,menubar=no`);v==null||v.postMessage({type:"TOKEN",data:o.value.token},"*")},Pt=z=>{var R,W,h,p;!((R=f.value)!=null&&R.contains(z.target))&&!((W=d.value)!=null&&W.contains(z.target))&&(C.value=!1),!((h=m.value)!=null&&h.contains(z.target))&&!((p=x.value)!=null&&p.contains(z.target))&&(N.value=!1)},Ot=async z=>{var R;const{scrollTop:W,clientHeight:h,scrollHeight:p}=z.target,g=(h+W)/p,y=i.value.search,k=((R=b.value)==null?void 0:R.value)??"";g<.9||j.loading||B.value||(j.loading=!0,(y.more&&j.list.length?await y.more(k,j.list.length):await y.search(k)).length?j.list=[...j.list,...y.more&&j.list.length?await y.more(k,j.list.length):await y.search(k)]:B.value=!0,j.loading=!1,setTimeout(()=>{z.target.scrollTop=W},50))},en=wu(z=>{j.list=[],B.value=!1,Ot(z)},300);return It("click",Pt),It("message",({data:z})=>{!z||z.type!=="profile"||(o.value={...o.value,...z.data},[localStorage,sessionStorage].filter(R=>R.getItem("WALINE_USER")).forEach(R=>{R.setItem("WALINE_USER",JSON.stringify(o))}))}),Jt([i,G],([z,R])=>{const{wordLimit:W}=z;W?R<W[0]&&W[0]!==0?(ae.value=W[0],fe.value=!1):R>W[1]?(ae.value=W[1],fe.value=!1):(ae.value=W[1],fe.value=!0):(ae.value=0,fe.value=!0)}),gt(N,async z=>{var R;if(!z)return;const W=i.value.search;b.value&&(b.value.value=""),j.loading=!0,j.list=await(((R=W.default)==null?void 0:R.call(W))??W.search("")),j.loading=!1}),vn(()=>{var z;(z=n.edit)!=null&&z.objectId&&(s.value=n.edit.orig),Jt(()=>s.value,R=>{const{highlighter:W,texRenderer:h}=i.value;Ue.value=R,O.value=Tf(R,{emojiMap:T.value.map,highlighter:W,texRenderer:h}),G.value=Mf(R),R?vo(c.value):vo.destroy(c.value)}),Jt(()=>i.value.emoji,async R=>{T.value=await Fu(R)})}),(z,R)=>{var W,h;return L(),P("div",{key:K(o).token,class:"wl-comment"},[K(i).login!=="disable"&&ge.value&&!((W=z.edit)!=null&&W.objectId)?(L(),P("div",bh,[D("div",yh,[D("button",{type:"submit",class:"wl-logout-btn",title:F.value.logout,onClick:Ei},[oe(K(co),{size:14})],8,wh),D("a",{href:"#",class:"wl-login-nick","aria-label":"Profile",title:F.value.profile,onClick:Rr},[D("img",{src:K(o).avatar,alt:"avatar"},null,8,xh)],8,kh)]),D("a",{href:"#",class:"wl-login-nick","aria-label":"Profile",title:F.value.profile,onClick:Rr,textContent:J(K(o).display_name)},null,8,_h)])):Y("v-if",!0),D("div",Ch,[K(i).login!=="force"&&K(i).meta.length&&!ge.value?(L(),P("div",{key:0,class:ve(["wl-header",`item${K(i).meta.length}`])},[(L(!0),P(ue,null,Fe(K(i).meta,p=>(L(),P("div",{key:p,class:"wl-header-item"},[D("label",{for:`wl-${p}`,textContent:J(F.value[p]+(K(i).requiredMeta.includes(p)||!K(i).requiredMeta.length?"":`(${F.value.optional})`))},null,8,Sh),tr(D("input",{id:`wl-${p}`,ref_for:!0,ref:g=>{g&&(a.value[p]=g)},"onUpdate:modelValue":g=>K(l)[p]=g,class:ve(["wl-input",`wl-${p}`]),name:p,type:p==="mail"?"email":"text"},null,10,$h),[[ou,K(l)[p]]])]))),128))],2)):Y("v-if",!0),tr(D("textarea",{id:"wl-edit",ref:"textarea","onUpdate:modelValue":R[0]||(R[0]=p=>be(s)?s.value=p:null),class:"wl-editor",placeholder:z.replyUser?`@${z.replyUser}`:F.value.placeholder,onKeydown:ft,onDrop:Mn,onPaste:Sr},null,40,Rh),[[pi,K(s)]]),tr(D("div",Ah,[R[7]||(R[7]=D("hr",null,null,-1)),D("h4",null,J(F.value.preview)+":",1),D("div",{class:"wl-content",innerHTML:O.value},null,8,Eh)],512),[[gl,I.value]]),D("div",Th,[D("div",Ih,[D("a",Lh,[oe(K(Hf))]),tr(D("button",{ref:"emoji-button",type:"button",class:ve(["wl-action",{active:C.value}]),title:F.value.emoji,onClick:R[1]||(R[1]=p=>C.value=!C.value)},[oe(K(jf))],10,Mh),[[gl,T.value.tabs.length]]),K(i).search?(L(),P("button",{key:0,ref:"gif-button",type:"button",class:ve(["wl-action",{active:N.value}]),title:F.value.gif,onClick:R[2]||(R[2]=p=>N.value=!N.value)},[oe(K(Vf))],10,Ph)):Y("v-if",!0),D("input",{id:"wl-image-upload",ref:"image-uploader",class:"upload","aria-hidden":"true",type:"file",accept:".png,.jpg,.jpeg,.webp,.bmp,.gif",onChange:Xt},null,544),ke.value?(L(),P("label",{key:1,for:"wl-image-upload",class:"wl-action",title:F.value.uploadImage,"aria-label":F.value.uploadImage},[oe(K(zf))],8,Oh)):Y("v-if",!0),D("button",{type:"button",class:ve(["wl-action",{active:I.value}]),title:F.value.preview,onClick:R[3]||(R[3]=p=>I.value=!I.value)},[oe(K(Ff))],10,jh)]),D("div",zh,[R[9]||(R[9]=D("div",{class:"wl-captcha-container"},null,-1)),D("div",Dh,[lt(J(G.value)+" ",1),K(i).wordLimit?(L(),P("span",Fh,[R[8]||(R[8]=lt(" / ")),D("span",{class:ve({illegal:!fe.value}),textContent:J(ae.value)},null,10,Hh)])):Y("v-if",!0),lt(" "+J(F.value.word),1)]),K(i).login!=="disable"&&!ge.value?(L(),P("button",{key:0,type:"button",class:"wl-btn",onClick:$r,textContent:J(F.value.login)},null,8,Uh)):Y("v-if",!0),K(i).login!=="force"||ge.value?(L(),P("button",{key:1,type:"submit",class:"primary wl-btn",title:"Cmd|Ctrl + Enter",disabled:E.value,onClick:Ke},[E.value?(L(),st(K(Tn),{key:0,size:16})):(L(),P(ue,{key:1},[lt(J(F.value.submit),1)],64))],8,Nh)):Y("v-if",!0)]),D("div",{ref:"gif-popup",class:ve(["wl-gif-popup",{display:N.value}])},[D("input",{ref:"gif-search",type:"text",placeholder:F.value.gifSearchPlaceholder,onInput:R[4]||(R[4]=(...p)=>K(en)&&K(en)(...p))},null,40,Bh),j.list.length?(L(),st(vh,{key:0,items:j.list,"column-width":200,gap:6,onInsert:R[5]||(R[5]=p=>we(p)),onScroll:Ot},null,8,["items"])):Y("v-if",!0),j.loading?(L(),P("div",Vh,[oe(K(Tn),{size:30})])):Y("v-if",!0)],2),D("div",{ref:"emoji-popup",class:ve(["wl-emoji-popup",{display:C.value}])},[(L(!0),P(ue,null,Fe(T.value.tabs,(p,g)=>(L(),P(ue,{key:p.name},[g===w.value?(L(),P("div",Wh,[(L(!0),P(ue,null,Fe(p.items,y=>(L(),P("button",{key:y,type:"button",title:y,onClick:k=>we(`:${y}:`)},[C.value?(L(),P("img",{key:0,class:"wl-emoji",src:T.value.map[y],alt:y,loading:"lazy",referrerPolicy:"no-referrer"},null,8,Kh)):Y("v-if",!0)],8,qh))),128))])):Y("v-if",!0)],64))),128)),T.value.tabs.length>1?(L(),P("div",Gh,[(L(!0),P(ue,null,Fe(T.value.tabs,(p,g)=>(L(),P("button",{key:p.name,type:"button",class:ve(["wl-tab",{active:w.value===g}]),onClick:y=>w.value=g},[D("img",{class:"wl-emoji",src:p.icon,alt:p.name,title:p.name,loading:"lazy",referrerPolicy:"no-referrer"},null,8,Yh)],10,Zh))),128))])):Y("v-if",!0)],2)])]),z.replyId||(h=z.edit)!=null&&h.objectId?(L(),P("button",{key:1,type:"button",class:"wl-close",title:F.value.cancelReply,onClick:R[6]||(R[6]=p=>z.replyId?r("cancelReply"):r("cancelEdit"))},[oe(K(co),{size:24})],8,Jh)):Y("v-if",!0)])}}});const Qh=["id"],Xh={class:"wl-user","aria-hidden":"true"},ep=["src"],tp={class:"wl-card"},np={class:"wl-head"},rp=["href"],ip={key:1,class:"wl-nick"},sp=["textContent"],lp=["textContent"],op=["textContent"],ap=["textContent"],cp=["textContent"],up={class:"wl-comment-actions"},fp=["title"],hp=["title"],pp={class:"wl-meta","aria-hidden":"true"},dp=["data-value","textContent"],gp={key:0,class:"wl-content"},mp={key:0},vp=["href"],bp=["innerHTML"],yp={key:1,class:"wl-admin-actions"},wp={class:"wl-comment-status"},kp=["disabled","onClick","textContent"],xp={key:3,class:"wl-quote"};var _p=gn({__name:"CommentCard",props:{comment:{},edit:{},rootId:{},reply:{}},emits:["log","submit","delete","like","sticky","edit","reply","status"],setup(e,{emit:t}){const n=e,r=t,i=["approved","waiting","spam"],s=rr(Dn),l=uo(),o=Lu(),a=Cr(),c=me(()=>s.value.locale),u=me(()=>{const{link:w}=n.comment;return w?ts(w)?w:`https://${w}`:""}),f=me(()=>l.value.includes(n.comment.objectId)),d=me(()=>Wo(new Date(n.comment.time),o.value,c.value)),m=me(()=>a.value.type==="administrator"),x=me(()=>n.comment.user_id&&a.value.objectId===n.comment.user_id),b=me(()=>{var w;return n.comment.objectId===((w=n.reply)==null?void 0:w.objectId)}),T=me(()=>{var w;return n.comment.objectId===((w=n.edit)==null?void 0:w.objectId)});return(w,C)=>{var N;const I=Ja("CommentCard",!0);return L(),P("div",{id:w.comment.objectId.toString(),class:"wl-card-item"},[D("div",Xh,[w.comment.avatar?(L(),P("img",{key:0,class:"wl-user-avatar",src:w.comment.avatar,alt:""},null,8,ep)):Y("v-if",!0),w.comment.type?(L(),st(K(Bf),{key:1})):Y("v-if",!0)]),D("div",tp,[D("div",np,[u.value?(L(),P("a",{key:0,class:"wl-nick",href:u.value,target:"_blank",rel:"nofollow noopener noreferrer"},J(w.comment.nick),9,rp)):(L(),P("span",ip,J(w.comment.nick),1)),w.comment.type==="administrator"?(L(),P("span",{key:2,class:"wl-badge",textContent:J(c.value.admin)},null,8,sp)):Y("v-if",!0),w.comment.label?(L(),P("span",{key:3,class:"wl-badge",textContent:J(w.comment.label)},null,8,lp)):Y("v-if",!0),w.comment.sticky?(L(),P("span",{key:4,class:"wl-badge",textContent:J(c.value.sticky)},null,8,op)):Y("v-if",!0),typeof w.comment.level=="number"?(L(),P("span",{key:5,class:ve(`wl-badge level${w.comment.level}`),textContent:J(c.value[`level${w.comment.level}`]||`Level ${w.comment.level}`)},null,10,ap)):Y("v-if",!0),D("span",{class:"wl-time",textContent:J(d.value)},null,8,cp),D("div",up,[m.value||x.value?(L(),P(ue,{key:0},[D("button",{type:"button",class:"wl-edit",onClick:C[0]||(C[0]=O=>r("edit",w.comment))},[oe(K(Nf))]),D("button",{type:"button",class:"wl-delete",onClick:C[1]||(C[1]=O=>r("delete",w.comment))},[oe(K(Of))])],64)):Y("v-if",!0),D("button",{type:"button",class:"wl-like",title:f.value?c.value.cancelLike:c.value.like,onClick:C[2]||(C[2]=O=>r("like",w.comment))},[oe(K(Df),{active:f.value},null,8,["active"]),lt(" "+J("like"in w.comment?w.comment.like:""),1)],8,fp),D("button",{type:"button",class:ve(["wl-reply",{active:b.value}]),title:b.value?c.value.cancelReply:c.value.reply,onClick:C[3]||(C[3]=O=>r("reply",b.value?null:w.comment))},[oe(K(Uf))],10,hp)])]),D("div",pp,[(L(),P(ue,null,Fe(["addr","browser","os"],O=>(L(),P(ue,null,[w.comment[O]?(L(),P("span",{key:O,class:ve(`wl-${O}`),"data-value":w.comment[O],textContent:J(w.comment[O])},null,10,dp)):Y("v-if",!0)],64))),64))]),T.value?Y("v-if",!0):(L(),P("div",gp,["reply_user"in w.comment&&w.comment.reply_user?(L(),P("p",mp,[D("a",{href:"#"+w.comment.pid},"@"+J(w.comment.reply_user.nick),9,vp),C[17]||(C[17]=D("span",null,": ",-1))])):Y("v-if",!0),D("div",{innerHTML:w.comment.comment},null,8,bp)])),m.value&&!T.value?(L(),P("div",yp,[D("span",wp,[(L(),P(ue,null,Fe(i,O=>D("button",{key:O,type:"submit",class:ve(`wl-btn wl-${O}`),disabled:w.comment.status===O,onClick:G=>r("status",{status:O,comment:w.comment}),textContent:J(c.value[O])},null,10,kp)),64))]),m.value&&!("rid"in w.comment)?(L(),P("button",{key:0,type:"submit",class:"wl-btn wl-sticky",onClick:C[4]||(C[4]=O=>r("sticky",w.comment))},J(w.comment.sticky?c.value.unsticky:c.value.sticky),1)):Y("v-if",!0)])):Y("v-if",!0),b.value||T.value?(L(),P("div",{key:2,class:ve({"wl-reply-wrapper":b.value,"wl-edit-wrapper":T.value})},[oe(bo,{edit:w.edit,"reply-id":(N=w.reply)==null?void 0:N.objectId,"reply-user":w.comment.nick,"root-id":w.rootId,onLog:C[5]||(C[5]=O=>r("log")),onCancelReply:C[6]||(C[6]=O=>r("reply",null)),onCancelEdit:C[7]||(C[7]=O=>r("edit",null)),onSubmit:C[8]||(C[8]=O=>r("submit",O))},null,8,["edit","reply-id","reply-user","root-id"])],2)):Y("v-if",!0),"children"in w.comment?(L(),P("div",xp,[(L(!0),P(ue,null,Fe(w.comment.children,O=>(L(),st(I,{key:O.objectId,comment:O,reply:w.reply,edit:w.edit,"root-id":w.rootId,onLog:C[9]||(C[9]=G=>r("log")),onDelete:C[10]||(C[10]=G=>r("delete",G)),onEdit:C[11]||(C[11]=G=>r("edit",G)),onLike:C[12]||(C[12]=G=>r("like",G)),onReply:C[13]||(C[13]=G=>r("reply",G)),onStatus:C[14]||(C[14]=G=>r("status",G)),onSticky:C[15]||(C[15]=G=>r("sticky",G)),onSubmit:C[16]||(C[16]=G=>r("submit",G))},null,8,["comment","reply","edit","root-id"]))),128))])):Y("v-if",!0)])],8,Qh)}}});const yo="3.5.3",Cp={"data-waline":""},Sp={class:"wl-meta-head"},$p={class:"wl-count"},Rp=["textContent"],Ap={class:"wl-sort"},Ep=["onClick"],Tp={class:"wl-cards"},Ip={key:1,class:"wl-operation"},Lp=["textContent"],Mp={key:2,class:"wl-loading"},Pp=["textContent"],Op={key:4,class:"wl-operation"},jp=["textContent"],zp={key:5,class:"wl-power"};var Dp=gn({__name:"WalineComment",props:{serverURL:{},path:{},meta:{},requiredMeta:{},wordLimit:{},pageSize:{},lang:{},locale:{},commentSorting:{},dark:{type:[String,Boolean]},login:{},noCopyright:{type:Boolean},recaptchaV3Key:{},turnstileKey:{},reaction:{},emoji:{},search:{},highlighter:{type:Function},imageUploader:{type:Function},texRenderer:{type:Function}},setup(e){const t=e,n=Cr(),r=uo(),i=te("loading"),s=te(0),l=te(1),o=te(0),a=me(()=>No(t)),c=te(a.value.commentSorting),u=te([]),f=te(null),d=te(null),m=me(()=>Bo(a.value.dark)),x=me(()=>a.value.locale);Ou(m,{id:"waline-darkmode"});let b=null;const T=E=>{const{serverURL:B,path:F,pageSize:ge}=a.value,ke=new AbortController;i.value="loading",b==null||b(),Ti({serverURL:B,lang:a.value.lang,path:F,pageSize:ge,sortBy:Qi[c.value],page:E,signal:ke.signal,token:n.value.token}).then(we=>{i.value="success",s.value=we.count,u.value.push(...we.data),l.value=E,o.value=we.totalPages}).catch(we=>{we.name!=="AbortError"&&(console.error(we.message),i.value="error")}),b=ke.abort.bind(ke)},w=()=>{T(l.value+1)},C=()=>{s.value=0,u.value=[],T(1)},N=E=>{c.value!==E&&(c.value=E,C())},I=E=>{f.value=E},O=E=>{d.value=E},G=E=>{if(d.value)d.value.comment=E.comment,d.value.orig=E.orig;else if("rid"in E){const B=u.value.find(({objectId:F})=>F===E.rid);if(!B)return;Array.isArray(B.children)||(B.children=[]),B.children.push(E)}else u.value.unshift(E),s.value+=1},j=async({comment:E,status:B})=>{if(E.status===B)return;const{serverURL:F,lang:ge}=a.value;await tn({serverURL:F,lang:ge,token:n.value.token,objectId:E.objectId,comment:{status:B}}),E.status=B},ae=async E=>{if("rid"in E)return;const{serverURL:B,lang:F}=a.value;await tn({serverURL:B,lang:F,token:n.value.token,objectId:E.objectId,comment:{sticky:E.sticky?0:1}}),E.sticky=!E.sticky},fe=async({objectId:E})=>{if(!confirm("Are you sure you want to delete this comment?"))return;const{serverURL:B,lang:F}=a.value;await Li({serverURL:B,lang:F,token:n.value.token,objectId:E}),u.value.some((ge,ke)=>ge.objectId===E?(u.value=u.value.filter((we,ft)=>ft!==ke),!0):ge.children.some((we,ft)=>we.objectId===E?(u.value[ke].children=ge.children.filter((bt,Mn)=>Mn!==ft),!0):!1))},Ue=async E=>{const{serverURL:B,lang:F}=a.value,{objectId:ge}=E,ke=r.value.includes(ge);await tn({serverURL:B,lang:F,objectId:ge,token:n.value.token,comment:{like:!ke}}),ke?r.value=r.value.filter(we=>we!==ge):(r.value=[...r.value,ge],r.value.length>50&&(r.value=r.value.slice(-50))),E.like=Math.max(0,(E.like||0)+(ke?-1:1))};return rc(Dn,a),vn(()=>{Jt(()=>[t.serverURL,t.path],()=>{C()})}),ei(()=>{b==null||b()}),(E,B)=>(L(),P("div",Cp,[oe(hh),!f.value&&!d.value?(L(),st(bo,{key:0,onLog:C,onSubmit:G})):Y("v-if",!0),D("div",Sp,[D("div",$p,[s.value?(L(),P("span",{key:0,class:"wl-num",textContent:J(s.value)},null,8,Rp)):Y("v-if",!0),lt(" "+J(x.value.comment),1)]),D("ul",Ap,[(L(!0),P(ue,null,Fe(K(Ho),F=>(L(),P("li",{key:F,class:ve([F===c.value?"active":""]),onClick:ge=>N(F)},J(x.value[F]),11,Ep))),128))])]),D("div",Tp,[(L(!0),P(ue,null,Fe(u.value,F=>(L(),st(_p,{key:F.objectId,"root-id":F.objectId,comment:F,reply:f.value,edit:d.value,onLog:C,onReply:I,onEdit:O,onSubmit:G,onStatus:j,onDelete:fe,onSticky:ae,onLike:Ue},null,8,["root-id","comment","reply","edit"]))),128))]),i.value==="error"?(L(),P("div",Ip,[D("button",{type:"button",class:"wl-btn",onClick:C,textContent:J(x.value.refresh)},null,8,Lp)])):i.value==="loading"?(L(),P("div",Mp,[oe(K(Tn),{size:30})])):u.value.length?l.value<o.value?(L(),P("div",Op,[D("button",{type:"button",class:"wl-btn",onClick:w,textContent:J(x.value.more)},null,8,jp)])):Y("v-if",!0):(L(),P("div",{key:3,class:"wl-empty",textContent:J(x.value.sofa)},null,8,Pp)),a.value.noCopyright?Y("v-if",!0):(L(),P("div",zp,[B[0]||(B[0]=lt(" Powered by ")),B[1]||(B[1]=D("a",{href:"https://github.com/walinejs/waline",target:"_blank",rel:"noopener noreferrer"}," Waline ",-1)),lt(" v"+J(K(yo)),1)]))]))}});const wo=(e,t)=>{t.forEach((n,r)=>{const i=e[r].time;typeof i=="number"&&(n.innerText=i.toString())})},ko=({serverURL:e,path:t=window.location.pathname,selector:n=".waline-pageview-count",update:r=!0,lang:i=navigator.language})=>{const s=new AbortController,l=Array.from(document.querySelectorAll(n)),o=c=>{const u=Ri(c);return u!==null&&t!==u},a=c=>Oi({serverURL:Fn(e),paths:c.map(u=>Ri(u)??t),lang:i,signal:s.signal}).then(u=>wo(u,c)).catch(jl);if(r){const c=l.filter(f=>!o(f)),u=l.filter(o);ji({serverURL:Fn(e),path:t,lang:i}).then(f=>wo(f,c)),u.length&&a(u)}else a(l);return s.abort.bind(s)},Fp=({el:e="#waline",path:t=window.location.pathname,comment:n=!1,pageview:r=!1,...i})=>{const s=e?mi(e):null;if(e&&!s)throw new Error("Option 'el' do not match any domElement!");if(!i.serverURL)throw new Error("Option 'serverURL' is missing!");const l=hn({...i}),o=hn({comment:n,pageview:r,path:t}),a=()=>{o.comment&&ao({serverURL:l.serverURL,path:o.path,...zt(o.comment)?{selector:o.comment}:{}})},c=()=>{o.pageview&&ko({serverURL:l.serverURL,path:o.path,...zt(o.pageview)?{selector:o.pageview}:{}})};let u=null;s&&(u=fu(()=>ne(Dp,{path:o.path,...l})),u.mount(s));const f=Js(a),d=Js(c);return{el:s,update:({comment:m,pageview:x,path:b=window.location.pathname,...T}={})=>{Object.entries(T).forEach(([w,C])=>{l[w]=C}),o.path=b,m!==void 0&&(o.comment=m),x!==void 0&&(o.pageview=x)},destroy:()=>{u==null||u.unmount(),f(),d()}}},Hp=({el:e,serverURL:t,count:n,lang:r=navigator.language})=>{const i=Cr(),s=mi(e),l=new AbortController;return zi({serverURL:t,count:n,lang:r,signal:l.signal,token:i.value.token}).then(o=>s&&o.length?(s.innerHTML=`<ul class="wl-recent-list">${o.map(a=>`<li class="wl-recent-item"><a href="${a.url}">${a.nick}</a>:${a.comment}</li>`).join("")}</ul>`,{comments:o,destroy:()=>{l.abort(),s.innerHTML=""}}):{comments:o,destroy:()=>l.abort()})},Up=({el:e,serverURL:t,count:n,locale:r,lang:i=navigator.language,mode:s="list"})=>{const l=mi(e),o=new AbortController;return Di({serverURL:t,pageSize:n,lang:i,signal:o.signal}).then(a=>!l||!a.length?{users:a,destroy:()=>o.abort()}:(r={...Yi(i),...typeof r=="object"?r:{}},l.innerHTML=`<ul class="wl-user-${s}">${a.map((c,u)=>[`<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">${u+1}</span>`,"</div>",'<div class="wl-user-meta">','<div class="wl-user-name">',c.nick,c.level&&`<span class="wl-badge">${r?r[`level${c.level}`]:`Level ${c.level}`}</span>`,c.label&&`<span class="wl-badge">${c.label}</span>`,"</div>",c.link&&c.link,"</div>",c.link&&"</a>","</li>"].filter(f=>f).join("")).join("")}</ul>`,{users:a,destroy:()=>{o.abort(),l.innerHTML=""}}))};ie.RecentComments=Hp,ie.UserList=Up,ie.addComment=Ii,ie.commentCount=ao,ie.defaultLocales=zn,ie.deleteComment=Li,ie.fetchCommentCount=Mi,ie.getArticleCounter=Ar,ie.getComment=Ti,ie.getPageview=Oi,ie.getRecentComment=zi,ie.getUserList=Di,ie.init=Fp,ie.login=Pi,ie.pageviewCount=ko,ie.updateArticleCounter=jn,ie.updateComment=tn,ie.updatePageview=ji,ie.version=yo});
|
|
83
|
+
`)}catch(W){alert(W.message),s.value=s.value.replace(R,"")}finally{E.value=!1}},Mn=z=>{var R;if((R=z.dataTransfer)!=null&&R.items){const W=zl(z.dataTransfer.items);W&&ke.value&&(bt(W),z.preventDefault())}},Sr=z=>{if(z.clipboardData){const R=zl(z.clipboardData.items);R&&ke.value&&bt(R)}},Xt=()=>{const z=u.value;z.files&&ke.value&&bt(z.files[0]).then(()=>{z.value=""})},Ke=async()=>{var z;const{serverURL:R,lang:W,login:h,wordLimit:p,requiredMeta:g,recaptchaV3Key:y,turnstileKey:k}=i.value,v={comment:Ue.value,nick:l.value.nick,mail:l.value.mail,link:l.value.link,url:i.value.path,ua:await Pf()};if(!n.edit)if(o.value.token)v.nick=o.value.display_name,v.mail=o.value.email,v.link=o.value.url;else{if(h==="force")return;if(g.includes("nick")&&!v.nick){a.value.nick.focus(),alert(F.value.nickError);return}if(g.includes("mail")&&!v.mail||v.mail&&!Ko(v.mail)){a.value.mail.focus(),alert(F.value.mailError);return}v.nick||(v.nick=F.value.anonymous)}if(!v.comment){c.value.focus();return}if(!fe.value){alert(F.value.wordHint.replace("$0",p[0].toString()).replace("$1",p[1].toString()).replace("$2",G.value.toString()));return}v.comment=oo(v.comment,T.value.map),n.replyId&&n.rootId&&(v.pid=n.replyId,v.rid=n.rootId,v.at=n.replyUser),E.value=!0;try{y&&(v.recaptchaV3=await th(y).execute("social")),k&&(v.turnstile=await nh(k).execute("social"));const A={serverURL:R,lang:W,token:o.value.token,comment:v},S=await(n.edit?tn({objectId:n.edit.objectId,...A}):Ii(A));if(E.value=!1,S.errmsg){alert(S.errmsg);return}r("submit",S.data),s.value="",O.value="",await Kt(),n.replyId&&r("cancelReply"),(z=n.edit)!=null&&z.objectId&&r("cancelEdit")}catch(A){E.value=!1,alert(A.message)}},$r=z=>{z.preventDefault();const{lang:R,serverURL:W}=i.value;Pi({serverURL:W,lang:R}).then(h=>{o.value=h,(h.remember?localStorage:sessionStorage).setItem("WALINE_USER",JSON.stringify(h)),r("log")})},Ei=()=>{o.value={},localStorage.setItem("WALINE_USER","null"),sessionStorage.setItem("WALINE_USER","null"),r("log")},Rr=z=>{z.preventDefault();const{lang:R,serverURL:W}=i.value,h=800,p=800,g=(window.innerWidth-h)/2,y=(window.innerHeight-p)/2,k=new URLSearchParams({lng:R,token:o.value.token}),v=window.open(`${W}/ui/profile?${k.toString()}`,"_blank",`width=${h},height=${p},left=${g},top=${y},scrollbars=no,resizable=no,status=no,location=no,toolbar=no,menubar=no`);v==null||v.postMessage({type:"TOKEN",data:o.value.token},"*")},Pt=z=>{var R,W,h,p;!((R=f.value)!=null&&R.contains(z.target))&&!((W=d.value)!=null&&W.contains(z.target))&&(C.value=!1),!((h=m.value)!=null&&h.contains(z.target))&&!((p=x.value)!=null&&p.contains(z.target))&&(N.value=!1)},Ot=async z=>{var R;const{scrollTop:W,clientHeight:h,scrollHeight:p}=z.target,g=(h+W)/p,y=i.value.search,k=((R=b.value)==null?void 0:R.value)??"";g<.9||j.loading||B.value||(j.loading=!0,(y.more&&j.list.length?await y.more(k,j.list.length):await y.search(k)).length?j.list=[...j.list,...y.more&&j.list.length?await y.more(k,j.list.length):await y.search(k)]:B.value=!0,j.loading=!1,setTimeout(()=>{z.target.scrollTop=W},50))},en=wu(z=>{j.list=[],B.value=!1,Ot(z)},300);return It("click",Pt),It("message",({data:z})=>{!z||z.type!=="profile"||(o.value={...o.value,...z.data},[localStorage,sessionStorage].filter(R=>R.getItem("WALINE_USER")).forEach(R=>{R.setItem("WALINE_USER",JSON.stringify(o))}))}),Jt([i,G],([z,R])=>{const{wordLimit:W}=z;W?R<W[0]&&W[0]!==0?(ae.value=W[0],fe.value=!1):R>W[1]?(ae.value=W[1],fe.value=!1):(ae.value=W[1],fe.value=!0):(ae.value=0,fe.value=!0)}),gt(N,async z=>{var R;if(!z)return;const W=i.value.search;b.value&&(b.value.value=""),j.loading=!0,j.list=await(((R=W.default)==null?void 0:R.call(W))??W.search("")),j.loading=!1}),vn(()=>{var z;(z=n.edit)!=null&&z.objectId&&(s.value=n.edit.orig),Jt(()=>s.value,R=>{const{highlighter:W,texRenderer:h}=i.value;Ue.value=R,O.value=Tf(R,{emojiMap:T.value.map,highlighter:W,texRenderer:h}),G.value=Mf(R),R?vo(c.value):vo.destroy(c.value)}),Jt(()=>i.value.emoji,async R=>{T.value=await Fu(R)})}),(z,R)=>{var W,h;return L(),P("div",{key:K(o).token,class:"wl-comment"},[K(i).login!=="disable"&&ge.value&&!((W=z.edit)!=null&&W.objectId)?(L(),P("div",bh,[D("div",yh,[D("button",{type:"submit",class:"wl-logout-btn",title:F.value.logout,onClick:Ei},[oe(K(co),{size:14})],8,wh),D("a",{href:"#",class:"wl-login-nick","aria-label":"Profile",title:F.value.profile,onClick:Rr},[D("img",{src:K(o).avatar,alt:"avatar"},null,8,xh)],8,kh)]),D("a",{href:"#",class:"wl-login-nick","aria-label":"Profile",title:F.value.profile,onClick:Rr,textContent:J(K(o).display_name)},null,8,_h)])):Y("v-if",!0),D("div",Ch,[K(i).login!=="force"&&K(i).meta.length&&!ge.value?(L(),P("div",{key:0,class:ve(["wl-header",`item${K(i).meta.length}`])},[(L(!0),P(ue,null,Fe(K(i).meta,p=>(L(),P("div",{key:p,class:"wl-header-item"},[D("label",{for:`wl-${p}`,textContent:J(F.value[p]+(K(i).requiredMeta.includes(p)||!K(i).requiredMeta.length?"":`(${F.value.optional})`))},null,8,Sh),tr(D("input",{id:`wl-${p}`,ref_for:!0,ref:g=>{g&&(a.value[p]=g)},"onUpdate:modelValue":g=>K(l)[p]=g,class:ve(["wl-input",`wl-${p}`]),name:p,type:p==="mail"?"email":"text"},null,10,$h),[[ou,K(l)[p]]])]))),128))],2)):Y("v-if",!0),tr(D("textarea",{id:"wl-edit",ref:"textarea","onUpdate:modelValue":R[0]||(R[0]=p=>be(s)?s.value=p:null),class:"wl-editor",placeholder:z.replyUser?`@${z.replyUser}`:F.value.placeholder,onKeydown:ft,onDrop:Mn,onPaste:Sr},null,40,Rh),[[pi,K(s)]]),tr(D("div",Ah,[R[7]||(R[7]=D("hr",null,null,-1)),D("h4",null,J(F.value.preview)+":",1),D("div",{class:"wl-content",innerHTML:O.value},null,8,Eh)],512),[[gl,I.value]]),D("div",Th,[D("div",Ih,[D("a",Lh,[oe(K(Hf))]),tr(D("button",{ref:"emoji-button",type:"button",class:ve(["wl-action",{active:C.value}]),title:F.value.emoji,onClick:R[1]||(R[1]=p=>C.value=!C.value)},[oe(K(jf))],10,Mh),[[gl,T.value.tabs.length]]),K(i).search?(L(),P("button",{key:0,ref:"gif-button",type:"button",class:ve(["wl-action",{active:N.value}]),title:F.value.gif,onClick:R[2]||(R[2]=p=>N.value=!N.value)},[oe(K(Vf))],10,Ph)):Y("v-if",!0),D("input",{id:"wl-image-upload",ref:"image-uploader",class:"upload","aria-hidden":"true",type:"file",accept:".png,.jpg,.jpeg,.webp,.bmp,.gif",onChange:Xt},null,544),ke.value?(L(),P("label",{key:1,for:"wl-image-upload",class:"wl-action",title:F.value.uploadImage,"aria-label":F.value.uploadImage},[oe(K(zf))],8,Oh)):Y("v-if",!0),D("button",{type:"button",class:ve(["wl-action",{active:I.value}]),title:F.value.preview,onClick:R[3]||(R[3]=p=>I.value=!I.value)},[oe(K(Ff))],10,jh)]),D("div",zh,[R[9]||(R[9]=D("div",{class:"wl-captcha-container"},null,-1)),D("div",Dh,[lt(J(G.value)+" ",1),K(i).wordLimit?(L(),P("span",Fh,[R[8]||(R[8]=lt(" / ")),D("span",{class:ve({illegal:!fe.value}),textContent:J(ae.value)},null,10,Hh)])):Y("v-if",!0),lt(" "+J(F.value.word),1)]),K(i).login!=="disable"&&!ge.value?(L(),P("button",{key:0,type:"button",class:"wl-btn",onClick:$r,textContent:J(F.value.login)},null,8,Uh)):Y("v-if",!0),K(i).login!=="force"||ge.value?(L(),P("button",{key:1,type:"submit",class:"primary wl-btn",title:"Cmd|Ctrl + Enter",disabled:E.value,onClick:Ke},[E.value?(L(),st(K(Tn),{key:0,size:16})):(L(),P(ue,{key:1},[lt(J(F.value.submit),1)],64))],8,Nh)):Y("v-if",!0)]),D("div",{ref:"gif-popup",class:ve(["wl-gif-popup",{display:N.value}])},[D("input",{ref:"gif-search",type:"text",placeholder:F.value.gifSearchPlaceholder,onInput:R[4]||(R[4]=(...p)=>K(en)&&K(en)(...p))},null,40,Bh),j.list.length?(L(),st(vh,{key:0,items:j.list,"column-width":200,gap:6,onInsert:R[5]||(R[5]=p=>we(p)),onScroll:Ot},null,8,["items"])):Y("v-if",!0),j.loading?(L(),P("div",Vh,[oe(K(Tn),{size:30})])):Y("v-if",!0)],2),D("div",{ref:"emoji-popup",class:ve(["wl-emoji-popup",{display:C.value}])},[(L(!0),P(ue,null,Fe(T.value.tabs,(p,g)=>(L(),P(ue,{key:p.name},[g===w.value?(L(),P("div",Wh,[(L(!0),P(ue,null,Fe(p.items,y=>(L(),P("button",{key:y,type:"button",title:y,onClick:k=>we(`:${y}:`)},[C.value?(L(),P("img",{key:0,class:"wl-emoji",src:T.value.map[y],alt:y,loading:"lazy",referrerPolicy:"no-referrer"},null,8,Kh)):Y("v-if",!0)],8,qh))),128))])):Y("v-if",!0)],64))),128)),T.value.tabs.length>1?(L(),P("div",Gh,[(L(!0),P(ue,null,Fe(T.value.tabs,(p,g)=>(L(),P("button",{key:p.name,type:"button",class:ve(["wl-tab",{active:w.value===g}]),onClick:y=>w.value=g},[D("img",{class:"wl-emoji",src:p.icon,alt:p.name,title:p.name,loading:"lazy",referrerPolicy:"no-referrer"},null,8,Yh)],10,Zh))),128))])):Y("v-if",!0)],2)])]),z.replyId||(h=z.edit)!=null&&h.objectId?(L(),P("button",{key:1,type:"button",class:"wl-close",title:F.value.cancelReply,onClick:R[6]||(R[6]=p=>z.replyId?r("cancelReply"):r("cancelEdit"))},[oe(K(co),{size:24})],8,Jh)):Y("v-if",!0)])}}});const Qh=["id"],Xh={class:"wl-user","aria-hidden":"true"},ep=["src"],tp={class:"wl-card"},np={class:"wl-head"},rp=["href"],ip={key:1,class:"wl-nick"},sp=["textContent"],lp=["textContent"],op=["textContent"],ap=["textContent"],cp=["textContent"],up={class:"wl-comment-actions"},fp=["title"],hp=["title"],pp={class:"wl-meta","aria-hidden":"true"},dp=["data-value","textContent"],gp={key:0,class:"wl-content"},mp={key:0},vp=["href"],bp=["innerHTML"],yp={key:1,class:"wl-admin-actions"},wp={class:"wl-comment-status"},kp=["disabled","onClick","textContent"],xp={key:3,class:"wl-quote"};var _p=gn({__name:"CommentCard",props:{comment:{},edit:{},rootId:{},reply:{}},emits:["log","submit","delete","like","sticky","edit","reply","status"],setup(e,{emit:t}){const n=e,r=t,i=["approved","waiting","spam"],s=rr(Dn),l=uo(),o=Lu(),a=Cr(),c=me(()=>s.value.locale),u=me(()=>{const{link:w}=n.comment;return w?ts(w)?w:`https://${w}`:""}),f=me(()=>l.value.includes(n.comment.objectId)),d=me(()=>Wo(new Date(n.comment.time),o.value,c.value)),m=me(()=>a.value.type==="administrator"),x=me(()=>n.comment.user_id&&a.value.objectId===n.comment.user_id),b=me(()=>{var w;return n.comment.objectId===((w=n.reply)==null?void 0:w.objectId)}),T=me(()=>{var w;return n.comment.objectId===((w=n.edit)==null?void 0:w.objectId)});return(w,C)=>{var N;const I=Ja("CommentCard",!0);return L(),P("div",{id:w.comment.objectId.toString(),class:"wl-card-item"},[D("div",Xh,[w.comment.avatar?(L(),P("img",{key:0,class:"wl-user-avatar",src:w.comment.avatar,alt:""},null,8,ep)):Y("v-if",!0),w.comment.type?(L(),st(K(Bf),{key:1})):Y("v-if",!0)]),D("div",tp,[D("div",np,[u.value?(L(),P("a",{key:0,class:"wl-nick",href:u.value,target:"_blank",rel:"nofollow noopener noreferrer"},J(w.comment.nick),9,rp)):(L(),P("span",ip,J(w.comment.nick),1)),w.comment.type==="administrator"?(L(),P("span",{key:2,class:"wl-badge",textContent:J(c.value.admin)},null,8,sp)):Y("v-if",!0),w.comment.label?(L(),P("span",{key:3,class:"wl-badge",textContent:J(w.comment.label)},null,8,lp)):Y("v-if",!0),w.comment.sticky?(L(),P("span",{key:4,class:"wl-badge",textContent:J(c.value.sticky)},null,8,op)):Y("v-if",!0),typeof w.comment.level=="number"?(L(),P("span",{key:5,class:ve(`wl-badge level${w.comment.level}`),textContent:J(c.value[`level${w.comment.level}`]||`Level ${w.comment.level}`)},null,10,ap)):Y("v-if",!0),D("span",{class:"wl-time",textContent:J(d.value)},null,8,cp),D("div",up,[m.value||x.value?(L(),P(ue,{key:0},[D("button",{type:"button",class:"wl-edit",onClick:C[0]||(C[0]=O=>r("edit",w.comment))},[oe(K(Nf))]),D("button",{type:"button",class:"wl-delete",onClick:C[1]||(C[1]=O=>r("delete",w.comment))},[oe(K(Of))])],64)):Y("v-if",!0),D("button",{type:"button",class:"wl-like",title:f.value?c.value.cancelLike:c.value.like,onClick:C[2]||(C[2]=O=>r("like",w.comment))},[oe(K(Df),{active:f.value},null,8,["active"]),lt(" "+J("like"in w.comment?w.comment.like:""),1)],8,fp),D("button",{type:"button",class:ve(["wl-reply",{active:b.value}]),title:b.value?c.value.cancelReply:c.value.reply,onClick:C[3]||(C[3]=O=>r("reply",b.value?null:w.comment))},[oe(K(Uf))],10,hp)])]),D("div",pp,[(L(),P(ue,null,Fe(["addr","browser","os"],O=>(L(),P(ue,null,[w.comment[O]?(L(),P("span",{key:O,class:ve(`wl-${O}`),"data-value":w.comment[O],textContent:J(w.comment[O])},null,10,dp)):Y("v-if",!0)],64))),64))]),T.value?Y("v-if",!0):(L(),P("div",gp,["reply_user"in w.comment&&w.comment.reply_user?(L(),P("p",mp,[D("a",{href:"#"+w.comment.pid},"@"+J(w.comment.reply_user.nick),9,vp),C[17]||(C[17]=D("span",null,": ",-1))])):Y("v-if",!0),D("div",{innerHTML:w.comment.comment},null,8,bp)])),m.value&&!T.value?(L(),P("div",yp,[D("span",wp,[(L(),P(ue,null,Fe(i,O=>D("button",{key:O,type:"submit",class:ve(`wl-btn wl-${O}`),disabled:w.comment.status===O,onClick:G=>r("status",{status:O,comment:w.comment}),textContent:J(c.value[O])},null,10,kp)),64))]),m.value&&!("rid"in w.comment)?(L(),P("button",{key:0,type:"submit",class:"wl-btn wl-sticky",onClick:C[4]||(C[4]=O=>r("sticky",w.comment))},J(w.comment.sticky?c.value.unsticky:c.value.sticky),1)):Y("v-if",!0)])):Y("v-if",!0),b.value||T.value?(L(),P("div",{key:2,class:ve({"wl-reply-wrapper":b.value,"wl-edit-wrapper":T.value})},[oe(bo,{edit:w.edit,"reply-id":(N=w.reply)==null?void 0:N.objectId,"reply-user":w.comment.nick,"root-id":w.rootId,onLog:C[5]||(C[5]=O=>r("log")),onCancelReply:C[6]||(C[6]=O=>r("reply",null)),onCancelEdit:C[7]||(C[7]=O=>r("edit",null)),onSubmit:C[8]||(C[8]=O=>r("submit",O))},null,8,["edit","reply-id","reply-user","root-id"])],2)):Y("v-if",!0),"children"in w.comment?(L(),P("div",xp,[(L(!0),P(ue,null,Fe(w.comment.children,O=>(L(),st(I,{key:O.objectId,comment:O,reply:w.reply,edit:w.edit,"root-id":w.rootId,onLog:C[9]||(C[9]=G=>r("log")),onDelete:C[10]||(C[10]=G=>r("delete",G)),onEdit:C[11]||(C[11]=G=>r("edit",G)),onLike:C[12]||(C[12]=G=>r("like",G)),onReply:C[13]||(C[13]=G=>r("reply",G)),onStatus:C[14]||(C[14]=G=>r("status",G)),onSticky:C[15]||(C[15]=G=>r("sticky",G)),onSubmit:C[16]||(C[16]=G=>r("submit",G))},null,8,["comment","reply","edit","root-id"]))),128))])):Y("v-if",!0)])],8,Qh)}}});const yo="3.5.5",Cp={"data-waline":""},Sp={class:"wl-meta-head"},$p={class:"wl-count"},Rp=["textContent"],Ap={class:"wl-sort"},Ep=["onClick"],Tp={class:"wl-cards"},Ip={key:1,class:"wl-operation"},Lp=["textContent"],Mp={key:2,class:"wl-loading"},Pp=["textContent"],Op={key:4,class:"wl-operation"},jp=["textContent"],zp={key:5,class:"wl-power"};var Dp=gn({__name:"WalineComment",props:{serverURL:{},path:{},meta:{},requiredMeta:{},wordLimit:{},pageSize:{},lang:{},locale:{},commentSorting:{},dark:{type:[String,Boolean]},login:{},noCopyright:{type:Boolean},recaptchaV3Key:{},turnstileKey:{},reaction:{},emoji:{},search:{},highlighter:{type:Function},imageUploader:{type:Function},texRenderer:{type:Function}},setup(e){const t=e,n=Cr(),r=uo(),i=te("loading"),s=te(0),l=te(1),o=te(0),a=me(()=>No(t)),c=te(a.value.commentSorting),u=te([]),f=te(null),d=te(null),m=me(()=>Bo(a.value.dark)),x=me(()=>a.value.locale);Ou(m,{id:"waline-darkmode"});let b=null;const T=E=>{const{serverURL:B,path:F,pageSize:ge}=a.value,ke=new AbortController;i.value="loading",b==null||b(),Ti({serverURL:B,lang:a.value.lang,path:F,pageSize:ge,sortBy:Qi[c.value],page:E,signal:ke.signal,token:n.value.token}).then(we=>{i.value="success",s.value=we.count,u.value.push(...we.data),l.value=E,o.value=we.totalPages}).catch(we=>{we.name!=="AbortError"&&(console.error(we.message),i.value="error")}),b=ke.abort.bind(ke)},w=()=>{T(l.value+1)},C=()=>{s.value=0,u.value=[],T(1)},N=E=>{c.value!==E&&(c.value=E,C())},I=E=>{f.value=E},O=E=>{d.value=E},G=E=>{if(d.value)d.value.comment=E.comment,d.value.orig=E.orig;else if("rid"in E){const B=u.value.find(({objectId:F})=>F===E.rid);if(!B)return;Array.isArray(B.children)||(B.children=[]),B.children.push(E)}else u.value.unshift(E),s.value+=1},j=async({comment:E,status:B})=>{if(E.status===B)return;const{serverURL:F,lang:ge}=a.value;await tn({serverURL:F,lang:ge,token:n.value.token,objectId:E.objectId,comment:{status:B}}),E.status=B},ae=async E=>{if("rid"in E)return;const{serverURL:B,lang:F}=a.value;await tn({serverURL:B,lang:F,token:n.value.token,objectId:E.objectId,comment:{sticky:E.sticky?0:1}}),E.sticky=!E.sticky},fe=async({objectId:E})=>{if(!confirm("Are you sure you want to delete this comment?"))return;const{serverURL:B,lang:F}=a.value;await Li({serverURL:B,lang:F,token:n.value.token,objectId:E}),u.value.some((ge,ke)=>ge.objectId===E?(u.value=u.value.filter((we,ft)=>ft!==ke),!0):ge.children.some((we,ft)=>we.objectId===E?(u.value[ke].children=ge.children.filter((bt,Mn)=>Mn!==ft),!0):!1))},Ue=async E=>{const{serverURL:B,lang:F}=a.value,{objectId:ge}=E,ke=r.value.includes(ge);await tn({serverURL:B,lang:F,objectId:ge,token:n.value.token,comment:{like:!ke}}),ke?r.value=r.value.filter(we=>we!==ge):(r.value=[...r.value,ge],r.value.length>50&&(r.value=r.value.slice(-50))),E.like=Math.max(0,(E.like||0)+(ke?-1:1))};return rc(Dn,a),vn(()=>{Jt(()=>[t.serverURL,t.path],()=>{C()})}),ei(()=>{b==null||b()}),(E,B)=>(L(),P("div",Cp,[oe(hh),!f.value&&!d.value?(L(),st(bo,{key:0,onLog:C,onSubmit:G})):Y("v-if",!0),D("div",Sp,[D("div",$p,[s.value?(L(),P("span",{key:0,class:"wl-num",textContent:J(s.value)},null,8,Rp)):Y("v-if",!0),lt(" "+J(x.value.comment),1)]),D("ul",Ap,[(L(!0),P(ue,null,Fe(K(Ho),F=>(L(),P("li",{key:F,class:ve([F===c.value?"active":""]),onClick:ge=>N(F)},J(x.value[F]),11,Ep))),128))])]),D("div",Tp,[(L(!0),P(ue,null,Fe(u.value,F=>(L(),st(_p,{key:F.objectId,"root-id":F.objectId,comment:F,reply:f.value,edit:d.value,onLog:C,onReply:I,onEdit:O,onSubmit:G,onStatus:j,onDelete:fe,onSticky:ae,onLike:Ue},null,8,["root-id","comment","reply","edit"]))),128))]),i.value==="error"?(L(),P("div",Ip,[D("button",{type:"button",class:"wl-btn",onClick:C,textContent:J(x.value.refresh)},null,8,Lp)])):i.value==="loading"?(L(),P("div",Mp,[oe(K(Tn),{size:30})])):u.value.length?l.value<o.value?(L(),P("div",Op,[D("button",{type:"button",class:"wl-btn",onClick:w,textContent:J(x.value.more)},null,8,jp)])):Y("v-if",!0):(L(),P("div",{key:3,class:"wl-empty",textContent:J(x.value.sofa)},null,8,Pp)),a.value.noCopyright?Y("v-if",!0):(L(),P("div",zp,[B[0]||(B[0]=lt(" Powered by ")),B[1]||(B[1]=D("a",{href:"https://github.com/walinejs/waline",target:"_blank",rel:"noopener noreferrer"}," Waline ",-1)),lt(" v"+J(K(yo)),1)]))]))}});const wo=(e,t)=>{t.forEach((n,r)=>{const i=e[r].time;typeof i=="number"&&(n.innerText=i.toString())})},ko=({serverURL:e,path:t=window.location.pathname,selector:n=".waline-pageview-count",update:r=!0,lang:i=navigator.language})=>{const s=new AbortController,l=Array.from(document.querySelectorAll(n)),o=c=>{const u=Ri(c);return u!==null&&t!==u},a=c=>Oi({serverURL:Fn(e),paths:c.map(u=>Ri(u)??t),lang:i,signal:s.signal}).then(u=>wo(u,c)).catch(jl);if(r){const c=l.filter(f=>!o(f)),u=l.filter(o);ji({serverURL:Fn(e),path:t,lang:i}).then(f=>wo(f,c)),u.length&&a(u)}else a(l);return s.abort.bind(s)},Fp=({el:e="#waline",path:t=window.location.pathname,comment:n=!1,pageview:r=!1,...i})=>{const s=e?mi(e):null;if(e&&!s)throw new Error("Option 'el' do not match any domElement!");if(!i.serverURL)throw new Error("Option 'serverURL' is missing!");const l=hn({...i}),o=hn({comment:n,pageview:r,path:t}),a=()=>{o.comment&&ao({serverURL:l.serverURL,path:o.path,...zt(o.comment)?{selector:o.comment}:{}})},c=()=>{o.pageview&&ko({serverURL:l.serverURL,path:o.path,...zt(o.pageview)?{selector:o.pageview}:{}})};let u=null;s&&(u=fu(()=>ne(Dp,{path:o.path,...l})),u.mount(s));const f=Js(a),d=Js(c);return{el:s,update:({comment:m,pageview:x,path:b=window.location.pathname,...T}={})=>{Object.entries(T).forEach(([w,C])=>{l[w]=C}),o.path=b,m!==void 0&&(o.comment=m),x!==void 0&&(o.pageview=x)},destroy:()=>{u==null||u.unmount(),f(),d()}}},Hp=({el:e,serverURL:t,count:n,lang:r=navigator.language})=>{const i=Cr(),s=mi(e),l=new AbortController;return zi({serverURL:t,count:n,lang:r,signal:l.signal,token:i.value.token}).then(o=>s&&o.length?(s.innerHTML=`<ul class="wl-recent-list">${o.map(a=>`<li class="wl-recent-item"><a href="${a.url}">${a.nick}</a>:${a.comment}</li>`).join("")}</ul>`,{comments:o,destroy:()=>{l.abort(),s.innerHTML=""}}):{comments:o,destroy:()=>l.abort()})},Up=({el:e,serverURL:t,count:n,locale:r,lang:i=navigator.language,mode:s="list"})=>{const l=mi(e),o=new AbortController;return Di({serverURL:t,pageSize:n,lang:i,signal:o.signal}).then(a=>!l||!a.length?{users:a,destroy:()=>o.abort()}:(r={...Yi(i),...typeof r=="object"?r:{}},l.innerHTML=`<ul class="wl-user-${s}">${a.map((c,u)=>[`<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">${u+1}</span>`,"</div>",'<div class="wl-user-meta">','<div class="wl-user-name">',c.nick,c.level&&`<span class="wl-badge">${r?r[`level${c.level}`]:`Level ${c.level}`}</span>`,c.label&&`<span class="wl-badge">${c.label}</span>`,"</div>",c.link&&c.link,"</div>",c.link&&"</a>","</li>"].filter(f=>f).join("")).join("")}</ul>`,{users:a,destroy:()=>{o.abort(),l.innerHTML=""}}))};ie.RecentComments=Hp,ie.UserList=Up,ie.addComment=Ii,ie.commentCount=ao,ie.defaultLocales=zn,ie.deleteComment=Li,ie.fetchCommentCount=Mi,ie.getArticleCounter=Ar,ie.getComment=Ti,ie.getPageview=Oi,ie.getRecentComment=zi,ie.getUserList=Di,ie.init=Fp,ie.login=Pi,ie.pageviewCount=ko,ie.updateArticleCounter=jn,ie.updateComment=tn,ie.updatePageview=ji,ie.version=yo});
|
|
84
84
|
//# sourceMappingURL=waline.umd.js.map
|