@waline/client 3.2.5 → 3.2.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/comment.js +1 -1
- package/dist/component.js +1 -1
- package/dist/component.js.map +1 -1
- package/dist/pageview.js +1 -1
- package/dist/slim.js +3 -3
- package/dist/slim.js.map +1 -1
- package/dist/waline.js +1 -1
- package/dist/waline.js.map +1 -1
- package/dist/waline.umd.js +1 -1
- package/dist/waline.umd.js.map +1 -1
- package/package.json +1 -1
package/dist/waline.umd.js
CHANGED
|
@@ -69,5 +69,5 @@ ${t}</tr>
|
|
|
69
69
|
`+(s.tokens?this.parseInline(s.tokens):s.text);n+=i?this.renderer.paragraph(l):l;continue}default:{const s='Token with "'+o.type+'" type was not found.';if(this.options.silent)return console.error(s),"";throw new Error(s)}}}return n}parseInline(t,i){i=i||this.renderer;let n="";for(let r=0;r<t.length;r++){const o=t[r];if(this.options.extensions&&this.options.extensions.renderers&&this.options.extensions.renderers[o.type]){const s=this.options.extensions.renderers[o.type].call({parser:this},o);if(s!==!1||!["escape","html","link","image","strong","em","codespan","br","del","text"].includes(o.type)){n+=s||"";continue}}switch(o.type){case"escape":{const s=o;n+=i.text(s.text);break}case"html":{const s=o;n+=i.html(s.text);break}case"link":{const s=o;n+=i.link(s.href,s.title,this.parseInline(s.tokens,i));break}case"image":{const s=o;n+=i.image(s.href,s.title,s.text);break}case"strong":{const s=o;n+=i.strong(this.parseInline(s.tokens,i));break}case"em":{const s=o;n+=i.em(this.parseInline(s.tokens,i));break}case"codespan":{const s=o;n+=i.codespan(s.text);break}case"br":{n+=i.br();break}case"del":{const s=o;n+=i.del(this.parseInline(s.tokens,i));break}case"text":{const s=o;n+=i.text(s.text);break}default:{const s='Token with "'+o.type+'" type was not found.';if(this.options.silent)return console.error(s),"";throw new Error(s)}}}return n}}class wn{options;constructor(t){this.options=t||Tt}preprocess(t){return t}postprocess(t){return t}processAllTokens(t){return t}}Ne(wn,"passThroughHooks",new Set(["preprocess","postprocess","processAllTokens"]));class Gs{constructor(...t){xr(this,xn);xr(this,yi);Ne(this,"defaults",hr());Ne(this,"options",this.setOptions);Ne(this,"parse",_i(this,xn,Cr).call(this,rt.lex,ot.parse));Ne(this,"parseInline",_i(this,xn,Cr).call(this,rt.lexInline,ot.parseInline));Ne(this,"Parser",ot);Ne(this,"Renderer",gi);Ne(this,"TextRenderer",br);Ne(this,"Lexer",rt);Ne(this,"Tokenizer",fi);Ne(this,"Hooks",wn);this.use(...t)}walkTokens(t,i){var r,o;let n=[];for(const s of t)switch(n=n.concat(i.call(this,s)),s.type){case"table":{const l=s;for(const a of l.header)n=n.concat(this.walkTokens(a.tokens,i));for(const a of l.rows)for(const c of a)n=n.concat(this.walkTokens(c.tokens,i));break}case"list":{const l=s;n=n.concat(this.walkTokens(l.items,i));break}default:{const l=s;(o=(r=this.defaults.extensions)==null?void 0:r.childTokens)!=null&&o[l.type]?this.defaults.extensions.childTokens[l.type].forEach(a=>{const c=l[a].flat(1/0);n=n.concat(this.walkTokens(c,i))}):l.tokens&&(n=n.concat(this.walkTokens(l.tokens,i)))}}return n}use(...t){const i=this.defaults.extensions||{renderers:{},childTokens:{}};return t.forEach(n=>{const r={...n};if(r.async=this.defaults.async||r.async||!1,n.extensions&&(n.extensions.forEach(o=>{if(!o.name)throw new Error("extension name required");if("renderer"in o){const s=i.renderers[o.name];s?i.renderers[o.name]=function(...l){let a=o.renderer.apply(this,l);return a===!1&&(a=s.apply(this,l)),a}:i.renderers[o.name]=o.renderer}if("tokenizer"in o){if(!o.level||o.level!=="block"&&o.level!=="inline")throw new Error("extension level must be 'block' or 'inline'");const s=i[o.level];s?s.unshift(o.tokenizer):i[o.level]=[o.tokenizer],o.start&&(o.level==="block"?i.startBlock?i.startBlock.push(o.start):i.startBlock=[o.start]:o.level==="inline"&&(i.startInline?i.startInline.push(o.start):i.startInline=[o.start]))}"childTokens"in o&&o.childTokens&&(i.childTokens[o.name]=o.childTokens)}),r.extensions=i),n.renderer){const o=this.defaults.renderer||new gi(this.defaults);for(const s in n.renderer){if(!(s in o))throw new Error(`renderer '${s}' does not exist`);if(s==="options")continue;const l=s,a=n.renderer[l],c=o[l];o[l]=(...f)=>{let h=a.apply(o,f);return h===!1&&(h=c.apply(o,f)),h||""}}r.renderer=o}if(n.tokenizer){const o=this.defaults.tokenizer||new fi(this.defaults);for(const s in n.tokenizer){if(!(s in o))throw new Error(`tokenizer '${s}' does not exist`);if(["options","rules","lexer"].includes(s))continue;const l=s,a=n.tokenizer[l],c=o[l];o[l]=(...f)=>{let h=a.apply(o,f);return h===!1&&(h=c.apply(o,f)),h}}r.tokenizer=o}if(n.hooks){const o=this.defaults.hooks||new wn;for(const s in n.hooks){if(!(s in o))throw new Error(`hook '${s}' does not exist`);if(s==="options")continue;const l=s,a=n.hooks[l],c=o[l];wn.passThroughHooks.has(s)?o[l]=f=>{if(this.defaults.async)return Promise.resolve(a.call(o,f)).then(p=>c.call(o,p));const h=a.call(o,f);return c.call(o,h)}:o[l]=(...f)=>{let h=a.apply(o,f);return h===!1&&(h=c.apply(o,f)),h}}r.hooks=o}if(n.walkTokens){const o=this.defaults.walkTokens,s=n.walkTokens;r.walkTokens=function(l){let a=[];return a.push(s.call(this,l)),o&&(a=a.concat(o.call(this,l))),a}}this.defaults={...this.defaults,...r}}),this}setOptions(t){return this.defaults={...this.defaults,...t},this}lexer(t,i){return rt.lex(t,i??this.defaults)}parser(t,i){return ot.parse(t,i??this.defaults)}}xn=new WeakSet,Cr=function(t,i){return(n,r)=>{const o={...r},s={...this.defaults,...o};this.defaults.async===!0&&o.async===!1&&(s.silent||console.warn("marked(): The async option was set to true by an extension. The async: false option sent to parse will be ignored."),s.async=!0);const l=_i(this,yi,wl).call(this,!!s.silent,!!s.async);if(typeof n>"u"||n===null)return l(new Error("marked(): input parameter is undefined or null"));if(typeof n!="string")return l(new Error("marked(): input parameter is of type "+Object.prototype.toString.call(n)+", string expected"));if(s.hooks&&(s.hooks.options=s),s.async)return Promise.resolve(s.hooks?s.hooks.preprocess(n):n).then(a=>t(a,s)).then(a=>s.hooks?s.hooks.processAllTokens(a):a).then(a=>s.walkTokens?Promise.all(this.walkTokens(a,s.walkTokens)).then(()=>a):a).then(a=>i(a,s)).then(a=>s.hooks?s.hooks.postprocess(a):a).catch(l);try{s.hooks&&(n=s.hooks.preprocess(n));let a=t(n,s);s.hooks&&(a=s.hooks.processAllTokens(a)),s.walkTokens&&this.walkTokens(a,s.walkTokens);let c=i(a,s);return s.hooks&&(c=s.hooks.postprocess(c)),c}catch(a){return l(a)}}},yi=new WeakSet,wl=function(t,i){return n=>{if(n.message+=`
|
|
70
70
|
Please report this to https://github.com/markedjs/marked.`,t){const r="<p>An error occurred:</p><pre>"+Oe(n.message+"",!0)+"</pre>";return i?Promise.resolve(r):r}if(i)return Promise.reject(n);throw n}};const Lt=new Gs;function de(e,t){return Lt.parse(e,t)}de.options=de.setOptions=function(e){return Lt.setOptions(e),de.defaults=Lt.defaults,$s(de.defaults),de},de.getDefaults=hr,de.defaults=Tt,de.use=function(...e){return Lt.use(...e),de.defaults=Lt.defaults,$s(de.defaults),de},de.walkTokens=function(e,t){return Lt.walkTokens(e,t)},de.parseInline=Lt.parseInline,de.Parser=ot,de.parser=ot.parse,de.Renderer=gi,de.TextRenderer=br,de.Lexer=rt,de.lexer=rt.lex,de.Tokenizer=fi,de.Hooks=wn,de.parse=de;function uf(e){if(typeof e=="function"&&(e={highlight:e}),!e||typeof e.highlight!="function")throw new Error("Must provide highlight function");return typeof e.langPrefix!="string"&&(e.langPrefix="language-"),{async:!!e.async,walkTokens(t){if(t.type!=="code")return;const i=Zs(t.lang);if(e.async)return Promise.resolve(e.highlight(t.text,i,t.lang||"")).then(Qs(t));const n=e.highlight(t.text,i,t.lang||"");if(n 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.");Qs(t)(n)},renderer:{code(t,i,n){const r=Zs(i),o=r?` class="${e.langPrefix}${el(r)}"`:"";return t=t.replace(/\n$/,""),`<pre><code${o}>${n?t:el(t,!0)}
|
|
71
71
|
</code></pre>`}}}}function Zs(e){return(e||"").match(/\S*/)[0]}function Qs(e){return t=>{typeof t=="string"&&t!==e.text&&(e.escaped=!0,e.text=t)}}const Js=/[&<>"']/,ff=new RegExp(Js.source,"g"),Ys=/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/,df=new RegExp(Ys.source,"g"),hf={"&":"&","<":"<",">":">",'"':""","'":"'"},Xs=e=>hf[e];function el(e,t){if(t){if(Js.test(e))return e.replace(ff,Xs)}else if(Ys.test(e))return e.replace(df,Xs);return e}const pf=/\$.*?\$/,gf=/^\$(.*?)\$/,mf=/^(?:\s{0,3})\$\$((?:[^\n]|\n[^\n])+?)\n{0,1}\$\$/,vf=e=>[{name:"blockMath",level:"block",tokenizer(t){const i=mf.exec(t);if(i!==null)return{type:"html",raw:i[0],text:e(!0,i[1])}}},{name:"inlineMath",level:"inline",start(t){const i=t.search(pf);return i!==-1?i:t.length},tokenizer(t){const i=gf.exec(t);if(i!==null)return{type:"html",raw:i[0],text:e(!1,i[1])}}}],tl=(e="",t={})=>e.replace(/:(.+?):/g,(i,n)=>t[n]?`<img class="wl-emoji" src="${t[n]}" alt="${n}">`:i),wf=(e,{emojiMap:t,highlighter:i,texRenderer:n})=>{const r=new Gs;if(r.setOptions({breaks:!0}),i&&r.use(uf({highlight:i})),n){const o=vf(n);r.use({extensions:o})}return r.parse(tl(e,t))},_r=e=>{const{path:t}=e.dataset;return t!=null&&t.length?t:null},yf=e=>e.match(/[\w\d\s,.\u00C0-\u024F\u0400-\u04FF]+/giu),bf=e=>e.match(/[\u4E00-\u9FD5]/gu),_f=e=>{var t,i;return(((t=yf(e))==null?void 0:t.reduce((n,r)=>n+(["",",","."].includes(r.trim())?0:r.trim().split(/\s+/u).length),0))??0)+(((i=bf(e))==null?void 0:i.length)??0)},kf=async()=>{if(!navigator)return"";const{userAgentData:e}=navigator;let t=navigator.userAgent;if(!e||e.platform!=="Windows")return t;const{platformVersion:i}=await e.getHighEntropyValues(["platformVersion"]);return i&&parseInt(i.split(".")[0])>=13&&(t=t.replace("Windows NT 10.0","Windows NT 11.0")),t},nl=({serverURL:e,path:t=window.location.pathname,selector:i=".waline-comment-count",lang:n=navigator.language})=>{const r=new AbortController,o=document.querySelectorAll(i);return o.length&&Rr({serverURL:Rn(e),paths:Array.from(o).map(s=>Wr(_r(s)??t)),lang:n,signal:r.signal}).then(s=>{o.forEach((l,a)=>{l.innerText=s[a].toString()})}).catch(As),r.abort.bind(r)},xf=({size:e})=>X("svg",{class:"wl-close-icon",viewBox:"0 0 1024 1024",width:e,height:e},[X("path",{d:"M697.173 85.333h-369.92c-144.64 0-241.92 101.547-241.92 252.587v348.587c0 150.613 97.28 252.16 241.92 252.16h369.92c144.64 0 241.494-101.547 241.494-252.16V337.92c0-151.04-96.854-252.587-241.494-252.587z",fill:"currentColor"}),X("path",{d:"m640.683 587.52-75.947-75.861 75.904-75.862a37.29 37.29 0 0 0 0-52.778 37.205 37.205 0 0 0-52.779 0l-75.946 75.818-75.862-75.946a37.419 37.419 0 0 0-52.821 0 37.419 37.419 0 0 0 0 52.821l75.947 75.947-75.776 75.733a37.29 37.29 0 1 0 52.778 52.821l75.776-75.776 75.947 75.947a37.376 37.376 0 0 0 52.779-52.821z",fill:"#888"})]),Cf=()=>X("svg",{viewBox:"0 0 1024 1024",width:"24",height:"24"},X("path",{d:"m341.013 394.667 27.755 393.45h271.83l27.733-393.45h64.106l-28.01 397.952a64 64 0 0 1-63.83 59.498H368.768a64 64 0 0 1-63.83-59.52l-28.053-397.93h64.128zm139.307 19.818v298.667h-64V414.485h64zm117.013 0v298.667h-64V414.485h64zM181.333 288h640v64h-640v-64zm453.483-106.667v64h-256v-64h256z",fill:"red"})),Ef=()=>X("svg",{viewBox:"0 0 1024 1024",width:"24",height:"24"},X("path",{d:"M563.2 463.3 677 540c1.7 1.2 3.7 1.8 5.8 1.8.7 0 1.4-.1 2-.2 2.7-.5 5.1-2.1 6.6-4.4l25.3-37.8c1.5-2.3 2.1-5.1 1.6-7.8s-2.1-5.1-4.4-6.6l-73.6-49.1 73.6-49.1c2.3-1.5 3.9-3.9 4.4-6.6.5-2.7 0-5.5-1.6-7.8l-25.3-37.8a10.1 10.1 0 0 0-6.6-4.4c-.7-.1-1.3-.2-2-.2-2.1 0-4.1.6-5.8 1.8l-113.8 76.6c-9.2 6.2-14.7 16.4-14.7 27.5.1 11 5.5 21.3 14.7 27.4zM387 348.8h-45.5c-5.7 0-10.4 4.7-10.4 10.4v153.3c0 5.7 4.7 10.4 10.4 10.4H387c5.7 0 10.4-4.7 10.4-10.4V359.2c0-5.7-4.7-10.4-10.4-10.4zm333.8 241.3-41-20a10.3 10.3 0 0 0-8.1-.5c-2.6.9-4.8 2.9-5.9 5.4-30.1 64.9-93.1 109.1-164.4 115.2-5.7.5-9.9 5.5-9.5 11.2l3.9 45.5c.5 5.3 5 9.5 10.3 9.5h.9c94.8-8 178.5-66.5 218.6-152.7 2.4-5 .3-11.2-4.8-13.6zm186-186.1c-11.9-42-30.5-81.4-55.2-117.1-24.1-34.9-53.5-65.6-87.5-91.2-33.9-25.6-71.5-45.5-111.6-59.2-41.2-14-84.1-21.1-127.8-21.1h-1.2c-75.4 0-148.8 21.4-212.5 61.7-63.7 40.3-114.3 97.6-146.5 165.8-32.2 68.1-44.3 143.6-35.1 218.4 9.3 74.8 39.4 145 87.3 203.3.1.2.3.3.4.5l36.2 38.4c1.1 1.2 2.5 2.1 3.9 2.6 73.3 66.7 168.2 103.5 267.5 103.5 73.3 0 145.2-20.3 207.7-58.7 37.3-22.9 70.3-51.5 98.1-85 27.1-32.7 48.7-69.5 64.2-109.1 15.5-39.7 24.4-81.3 26.6-123.8 2.4-43.6-2.5-87-14.5-129zm-60.5 181.1c-8.3 37-22.8 72-43 104-19.7 31.1-44.3 58.6-73.1 81.7-28.8 23.1-61 41-95.7 53.4-35.6 12.7-72.9 19.1-110.9 19.1-82.6 0-161.7-30.6-222.8-86.2l-34.1-35.8c-23.9-29.3-42.4-62.2-55.1-97.7-12.4-34.7-18.8-71-19.2-107.9-.4-36.9 5.4-73.3 17.1-108.2 12-35.8 30-69.2 53.4-99.1 31.7-40.4 71.1-72 117.2-94.1 44.5-21.3 94-32.6 143.4-32.6 49.3 0 97 10.8 141.8 32 34.3 16.3 65.3 38.1 92 64.8 26.1 26 47.5 56 63.6 89.2 16.2 33.2 26.6 68.5 31 105.1 4.6 37.5 2.7 75.3-5.6 112.3z",fill:"currentColor"})),If=()=>X("svg",{viewBox:"0 0 1024 1024",width:"24",height:"24"},[X("path",{d:"M784 112H240c-88 0-160 72-160 160v480c0 88 72 160 160 160h544c88 0 160-72 160-160V272c0-88-72-160-160-160zm96 640c0 52.8-43.2 96-96 96H240c-52.8 0-96-43.2-96-96V272c0-52.8 43.2-96 96-96h544c52.8 0 96 43.2 96 96v480z",fill:"currentColor"}),X("path",{d:"M352 480c52.8 0 96-43.2 96-96s-43.2-96-96-96-96 43.2-96 96 43.2 96 96 96zm0-128c17.6 0 32 14.4 32 32s-14.4 32-32 32-32-14.4-32-32 14.4-32 32-32zm462.4 379.2-3.2-3.2-177.6-177.6c-25.6-25.6-65.6-25.6-91.2 0l-80 80-36.8-36.8c-25.6-25.6-65.6-25.6-91.2 0L200 728c-4.8 6.4-8 14.4-8 24 0 17.6 14.4 32 32 32 9.6 0 16-3.2 22.4-9.6L380.8 640l134.4 134.4c6.4 6.4 14.4 9.6 24 9.6 17.6 0 32-14.4 32-32 0-9.6-4.8-17.6-9.6-24l-52.8-52.8 80-80L769.6 776c6.4 4.8 12.8 8 20.8 8 17.6 0 32-14.4 32-32 0-8-3.2-16-8-20.8z",fill:"currentColor"})]),Sf=({active:e=!1})=>X("svg",{viewBox:"0 0 1024 1024",width:"24",height:"24"},[X("path",{d:`M850.654 323.804c-11.042-25.625-26.862-48.532-46.885-68.225-20.022-19.61-43.258-34.936-69.213-45.73-26.78-11.124-55.124-16.727-84.375-16.727-40.622 0-80.256 11.123-114.698 32.135A214.79 214.79 0 0 0 512 241.819a214.79 214.79 0 0 0-23.483-16.562c-34.442-21.012-74.076-32.135-114.698-32.135-29.25 0-57.595 5.603-84.375 16.727-25.872 10.711-49.19 26.12-69.213 45.73-20.105 19.693-35.843 42.6-46.885 68.225-11.453 26.615-17.303 54.877-17.303 83.963 0 27.439 5.603 56.03 16.727 85.117 9.31 24.307 22.659 49.52 39.715 74.981 27.027 40.293 64.188 82.316 110.33 124.915 76.465 70.615 152.189 119.394 155.402 121.371l19.528 12.525c8.652 5.52 19.776 5.52 28.427 0l19.529-12.525c3.213-2.06 78.854-50.756 155.401-121.371 46.143-42.6 83.304-84.622 110.33-124.915 17.057-25.46 30.487-50.674 39.716-74.981 11.124-29.087 16.727-57.678 16.727-85.117.082-29.086-5.768-57.348-17.221-83.963z${e?"":"M512 761.5S218.665 573.55 218.665 407.767c0-83.963 69.461-152.023 155.154-152.023 60.233 0 112.473 33.618 138.181 82.727 25.708-49.109 77.948-82.727 138.18-82.727 85.694 0 155.155 68.06 155.155 152.023C805.335 573.551 512 761.5 512 761.5z"}`,fill:e?"red":"currentColor"})]),Rf=()=>X("svg",{viewBox:"0 0 1024 1024",width:"24",height:"24"},[X("path",{d:"M710.816 654.301c70.323-96.639 61.084-230.578-23.705-314.843-46.098-46.098-107.183-71.109-172.28-71.109-65.008 0-126.092 25.444-172.28 71.109-45.227 46.098-70.756 107.183-70.756 172.106 0 64.923 25.444 126.007 71.194 172.106 46.099 46.098 107.184 71.109 172.28 71.109 51.414 0 100.648-16.212 142.824-47.404l126.53 126.006c7.058 7.06 16.297 10.979 26.406 10.979 10.105 0 19.343-3.919 26.402-10.979 14.467-14.467 14.467-38.172 0-52.723L710.816 654.301zm-315.107-23.265c-65.88-65.88-65.88-172.54 0-238.42 32.069-32.07 74.245-49.149 119.471-49.149 45.227 0 87.407 17.603 119.472 49.149 65.88 65.879 65.88 172.539 0 238.42-63.612 63.178-175.242 63.178-238.943 0zm0 0",fill:"currentColor"}),X("path",{d:"M703.319 121.603H321.03c-109.8 0-199.469 89.146-199.469 199.38v382.034c0 109.796 89.236 199.38 199.469 199.38h207.397c20.653 0 37.384-16.645 37.384-37.299 0-20.649-16.731-37.296-37.384-37.296H321.03c-68.582 0-124.352-55.77-124.352-124.267V321.421c0-68.496 55.77-124.267 124.352-124.267h382.289c68.582 0 124.352 55.771 124.352 124.267V524.72c0 20.654 16.736 37.299 37.385 37.299 20.654 0 37.384-16.645 37.384-37.299V320.549c-.085-109.8-89.321-198.946-199.121-198.946zm0 0",fill:"currentColor"})]),Tf=()=>X("svg",{width:"16",height:"16",ariaHidden:"true"},X("path",{d:"M14.85 3H1.15C.52 3 0 3.52 0 4.15v7.69C0 12.48.52 13 1.15 13h13.69c.64 0 1.15-.52 1.15-1.15v-7.7C16 3.52 15.48 3 14.85 3zM9 11H7V8L5.5 9.92 4 8v3H2V5h2l1.5 2L7 5h2v6zm2.99.5L9.5 8H11V5h2v3h1.5l-2.51 3.5z",fill:"currentColor"})),Lf=()=>X("svg",{viewBox:"0 0 1024 1024",width:"24",height:"24"},X("path",{d:"M810.667 213.333a64 64 0 0 1 64 64V704a64 64 0 0 1-64 64H478.336l-146.645 96.107a21.333 21.333 0 0 1-33.024-17.856V768h-85.334a64 64 0 0 1-64-64V277.333a64 64 0 0 1 64-64h597.334zm0 64H213.333V704h149.334v63.296L459.243 704h351.424V277.333zm-271.36 213.334v64h-176.64v-64h176.64zm122.026-128v64H362.667v-64h298.666z",fill:"currentColor"})),Af=()=>X("svg",{viewBox:"0 0 1024 1024",width:"24",height:"24"},X("path",{d:"M813.039 318.772L480.53 651.278H360.718V531.463L693.227 198.961C697.904 194.284 704.027 192 710.157 192C716.302 192 722.436 194.284 727.114 198.961L813.039 284.88C817.72 289.561 820 295.684 820 301.825C820 307.95 817.72 314.093 813.039 318.772ZM710.172 261.888L420.624 551.431V591.376H460.561L750.109 301.825L710.172 261.888ZM490.517 291.845H240.906V771.09H720.156V521.479C720.156 504.947 733.559 491.529 750.109 491.529C766.653 491.529 780.063 504.947 780.063 521.479V791.059C780.063 813.118 762.18 831 740.125 831H220.937C198.882 831 181 813.118 181 791.059V271.872C181 249.817 198.882 231.935 220.937 231.935H490.517C507.06 231.935 520.47 245.352 520.47 261.888C520.47 278.424 507.06 291.845 490.517 291.845Z",fill:"currentColor"})),Mf=()=>X("svg",{class:"verified-icon",viewBox:"0 0 1024 1024",width:"14",height:"14"},X("path",{d:"m894.4 461.56-54.4-63.2c-10.4-12-18.8-34.4-18.8-50.4v-68c0-42.4-34.8-77.2-77.2-77.2h-68c-15.6 0-38.4-8.4-50.4-18.8l-63.2-54.4c-27.6-23.6-72.8-23.6-100.8 0l-62.8 54.8c-12 10-34.8 18.4-50.4 18.4h-69.2c-42.4 0-77.2 34.8-77.2 77.2v68.4c0 15.6-8.4 38-18.4 50l-54 63.6c-23.2 27.6-23.2 72.4 0 100l54 63.6c10 12 18.4 34.4 18.4 50v68.4c0 42.4 34.8 77.2 77.2 77.2h69.2c15.6 0 38.4 8.4 50.4 18.8l63.2 54.4c27.6 23.6 72.8 23.6 100.8 0l63.2-54.4c12-10.4 34.4-18.8 50.4-18.8h68c42.4 0 77.2-34.8 77.2-77.2v-68c0-15.6 8.4-38.4 18.8-50.4l54.4-63.2c23.2-27.6 23.2-73.2-.4-100.8zm-216-25.2-193.2 193.2a30 30 0 0 1-42.4 0l-96.8-96.8a30.16 30.16 0 0 1 0-42.4c11.6-11.6 30.8-11.6 42.4 0l75.6 75.6 172-172c11.6-11.6 30.8-11.6 42.4 0 11.6 11.6 11.6 30.8 0 42.4z",fill:"#27ae60"})),mi=({size:e=100})=>X("svg",{width:e,height:e,viewBox:"0 0 100 100",preserveAspectRatio:"xMidYMid"},X("circle",{cx:50,cy:50,fill:"none",stroke:"currentColor",strokeWidth:"4",r:"40","stroke-dasharray":"85 30"},X("animateTransform",{attributeName:"transform",type:"rotate",repeatCount:"indefinite",dur:"1s",values:"0 50 50;360 50 50",keyTimes:"0;1"}))),$f=()=>X("svg",{width:24,height:24,fill:"currentcolor",viewBox:"0 0 24 24"},[X("path",{style:"transform: translateY(0.5px)",d:"M18.968 10.5H15.968V11.484H17.984V12.984H15.968V15H14.468V9H18.968V10.5V10.5ZM8.984 9C9.26533 9 9.49967 9.09367 9.687 9.281C9.87433 9.46833 9.968 9.70267 9.968 9.984V10.5H6.499V13.5H8.468V12H9.968V14.016C9.968 14.2973 9.87433 14.5317 9.687 14.719C9.49967 14.9063 9.26533 15 8.984 15H5.984C5.70267 15 5.46833 14.9063 5.281 14.719C5.09367 14.5317 5 14.2973 5 14.016V9.985C5 9.70367 5.09367 9.46933 5.281 9.282C5.46833 9.09467 5.70267 9.001 5.984 9.001H8.984V9ZM11.468 9H12.968V15H11.468V9V9Z"}),X("path",{d:"M18.5 3H5.75C3.6875 3 2 4.6875 2 6.75V18C2 20.0625 3.6875 21.75 5.75 21.75H18.5C20.5625 21.75 22.25 20.0625 22.25 18V6.75C22.25 4.6875 20.5625 3 18.5 3ZM20.75 18C20.75 19.2375 19.7375 20.25 18.5 20.25H5.75C4.5125 20.25 3.5 19.2375 3.5 18V6.75C3.5 5.5125 4.5125 4.5 5.75 4.5H18.5C19.7375 4.5 20.75 5.5125 20.75 6.75V18Z"})]),Of=()=>Ht("WALINE_USER_META",{nick:"",mail:"",link:""}),jf=()=>Ht("WALINE_COMMENT_BOX_EDITOR",""),zf="WALINE_LIKE";let il=null;const rl=()=>il??(il=Ht(zf,[])),Pf="WALINE_REACTION";let ol=null;const Uf=()=>ol??(ol=Ht(Pf,{}));var vi=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{},sl={},Dt={},yn={},Ff=vi&&vi.__awaiter||function(e,t,i,n){function r(o){return o instanceof i?o:new i(function(s){s(o)})}return new(i||(i=Promise))(function(o,s){function l(f){try{c(n.next(f))}catch(h){s(h)}}function a(f){try{c(n.throw(f))}catch(h){s(h)}}function c(f){f.done?o(f.value):r(f.value).then(l,a)}c((n=n.apply(e,t||[])).next())})},Nf=vi&&vi.__generator||function(e,t){var i={label:0,sent:function(){if(o[0]&1)throw o[1];return o[1]},trys:[],ops:[]},n,r,o,s;return s={next:l(0),throw:l(1),return:l(2)},typeof Symbol=="function"&&(s[Symbol.iterator]=function(){return this}),s;function l(c){return function(f){return a([c,f])}}function a(c){if(n)throw new TypeError("Generator is already executing.");for(;i;)try{if(n=1,r&&(o=c[0]&2?r.return:c[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,c[1])).done)return o;switch(r=0,o&&(c=[c[0]&2,o.value]),c[0]){case 0:case 1:o=c;break;case 4:return i.label++,{value:c[1],done:!1};case 5:i.label++,r=c[1],c=[0];continue;case 7:c=i.ops.pop(),i.trys.pop();continue;default:if(o=i.trys,!(o=o.length>0&&o[o.length-1])&&(c[0]===6||c[0]===2)){i=0;continue}if(c[0]===3&&(!o||c[1]>o[0]&&c[1]<o[3])){i.label=c[1];break}if(c[0]===6&&i.label<o[1]){i.label=o[1],o=c;break}if(o&&i.label<o[2]){i.label=o[2],i.ops.push(c);break}o[2]&&i.ops.pop(),i.trys.pop();continue}c=t.call(e,i)}catch(f){c=[6,f],r=0}finally{n=o=0}if(c[0]&5)throw c[1];return{value:c[0]?c[1]:void 0,done:!0}}};Object.defineProperty(yn,"__esModule",{value:!0}),yn.ReCaptchaInstance=void 0;var Hf=function(){function e(t,i,n){this.siteKey=t,this.recaptchaID=i,this.recaptcha=n,this.styleContainer=null}return e.prototype.execute=function(t){return Ff(this,void 0,void 0,function(){return Nf(this,function(i){return[2,this.recaptcha.enterprise?this.recaptcha.enterprise.execute(this.recaptchaID,{action:t}):this.recaptcha.execute(this.recaptchaID,{action:t})]})})},e.prototype.getSiteKey=function(){return this.siteKey},e.prototype.hideBadge=function(){this.styleContainer===null&&(this.styleContainer=document.createElement("style"),this.styleContainer.innerHTML=".grecaptcha-badge{visibility:hidden !important;}",document.head.appendChild(this.styleContainer))},e.prototype.showBadge=function(){this.styleContainer!==null&&(document.head.removeChild(this.styleContainer),this.styleContainer=null)},e}();yn.ReCaptchaInstance=Hf,Object.defineProperty(Dt,"__esModule",{value:!0}),Dt.getInstance=Dt.load=void 0;var Df=yn,gt;(function(e){e[e.NOT_LOADED=0]="NOT_LOADED",e[e.LOADING=1]="LOADING",e[e.LOADED=2]="LOADED"})(gt||(gt={}));var ll=function(){function e(){}return e.load=function(t,i){if(i===void 0&&(i={}),typeof document>"u")return Promise.reject(new Error("This is a library for the browser!"));if(e.getLoadingState()===gt.LOADED)return e.instance.getSiteKey()===t?Promise.resolve(e.instance):Promise.reject(new Error("reCAPTCHA already loaded with different site key!"));if(e.getLoadingState()===gt.LOADING)return t!==e.instanceSiteKey?Promise.reject(new Error("reCAPTCHA already loaded with different site key!")):new Promise(function(r,o){e.successfulLoadingConsumers.push(function(s){return r(s)}),e.errorLoadingRunnable.push(function(s){return o(s)})});e.instanceSiteKey=t,e.setLoadingState(gt.LOADING);var n=new e;return new Promise(function(r,o){n.loadScript(t,i.useRecaptchaNet||!1,i.useEnterprise||!1,i.renderParameters?i.renderParameters:{},i.customUrl).then(function(){e.setLoadingState(gt.LOADED);var s=n.doExplicitRender(grecaptcha,t,i.explicitRenderParameters?i.explicitRenderParameters:{},i.useEnterprise||!1),l=new Df.ReCaptchaInstance(t,s,grecaptcha);e.successfulLoadingConsumers.forEach(function(a){return a(l)}),e.successfulLoadingConsumers=[],i.autoHideBadge&&l.hideBadge(),e.instance=l,r(l)}).catch(function(s){e.errorLoadingRunnable.forEach(function(l){return l(s)}),e.errorLoadingRunnable=[],o(s)})})},e.getInstance=function(){return e.instance},e.setLoadingState=function(t){e.loadingState=t},e.getLoadingState=function(){return e.loadingState===null?gt.NOT_LOADED:e.loadingState},e.prototype.loadScript=function(t,i,n,r,o){var s=this;i===void 0&&(i=!1),n===void 0&&(n=!1),r===void 0&&(r={}),o===void 0&&(o="");var l=document.createElement("script");l.setAttribute("recaptcha-v3-script","");var a="https://www.google.com/recaptcha/api.js";i&&(n?a="https://recaptcha.net/recaptcha/enterprise.js":a="https://recaptcha.net/recaptcha/api.js"),n&&(a="https://www.google.com/recaptcha/enterprise.js"),o&&(a=o),r.render&&(r.render=void 0);var c=this.buildQueryString(r);return l.src=a+"?render=explicit"+c,new Promise(function(f,h){l.addEventListener("load",s.waitForScriptToLoad(function(){f(l)},n),!1),l.onerror=function(p){e.setLoadingState(gt.NOT_LOADED),h(p)},document.head.appendChild(l)})},e.prototype.buildQueryString=function(t){var i=Object.keys(t);return i.length<1?"":"&"+Object.keys(t).filter(function(n){return!!t[n]}).map(function(n){return n+"="+t[n]}).join("&")},e.prototype.waitForScriptToLoad=function(t,i){var n=this;return function(){window.grecaptcha===void 0?setTimeout(function(){n.waitForScriptToLoad(t,i)},e.SCRIPT_LOAD_DELAY):i?window.grecaptcha.enterprise.ready(function(){t()}):window.grecaptcha.ready(function(){t()})}},e.prototype.doExplicitRender=function(t,i,n,r){var o={sitekey:i,badge:n.badge,size:n.size,tabindex:n.tabindex};return n.container?r?t.enterprise.render(n.container,o):t.render(n.container,o):r?t.enterprise.render(o):t.render(o)},e.loadingState=null,e.instance=null,e.instanceSiteKey=null,e.successfulLoadingConsumers=[],e.errorLoadingRunnable=[],e.SCRIPT_LOAD_DELAY=25,e}();Dt.load=ll.load,Dt.getInstance=ll.getInstance,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.ReCaptchaInstance=e.getInstance=e.load=void 0;var t=Dt;Object.defineProperty(e,"load",{enumerable:!0,get:function(){return t.load}}),Object.defineProperty(e,"getInstance",{enumerable:!0,get:function(){return t.getInstance}});var i=yn;Object.defineProperty(e,"ReCaptchaInstance",{enumerable:!0,get:function(){return i.ReCaptchaInstance}})}(sl);const al={},Vf=e=>{const t=al[e]??(al[e]=sl.load(e,{useRecaptchaNet:!0,autoHideBadge:!0}));return{execute:i=>t.then(n=>n.execute(i))}},Bf=e=>({execute:async t=>{const{load:i}=xu("https://challenges.cloudflare.com/turnstile/v0/api.js",void 0,{async:!1});await i();const n=window==null?void 0:window.turnstile;return new Promise(r=>{n==null||n.ready(()=>{n==null||n.render(".wl-captcha-container",{sitekey:e,action:t,size:"compact",callback:r})})})}}),Wf="WALINE_USER";let cl=null;const wi=()=>cl??(cl=Ht(Wf,{}));var qf=rn({__name:"ArticleReaction",setup(e,{expose:t}){t();const i=Uf(),n=Zn("config"),r=V(-1),o=V([]),s=_e(()=>n.value.locale),l=_e(()=>n.value.reaction.length>0),a=_e(()=>{const{reaction:g,path:R}=n.value;return g.map((x,T)=>({icon:x,desc:s.value[`reaction${T}`],active:i.value[R]===T}))});let c;const f=async()=>{if(!l.value)return;const{serverURL:g,lang:R,path:x,reaction:T}=n.value,$=new AbortController;c=$.abort.bind($);const P=await ki({serverURL:g,lang:R,paths:[x],type:T.map((A,N)=>`reaction${N}`),signal:$.signal});o.value=T.map((A,N)=>P[0][`reaction${N}`])},h=async g=>{if(r.value===-1){const{serverURL:R,lang:x,path:T}=n.value,$=i.value[T];r.value=g,$!==void 0&&(await In({serverURL:R,lang:x,path:T,type:`reaction${$}`,action:"desc"}),o.value[$]=Math.max(o.value[$]-1,0)),$!==g&&(await In({serverURL:R,lang:x,path:T,type:`reaction${g}`}),o.value[g]=(o.value[g]||0)+1),$===g?delete i.value[T]:i.value[T]=g,r.value=-1}};on(()=>{Pe(()=>[n.value.serverURL,n.value.path],()=>{f()},{immediate:!0})}),Qi(()=>c==null?void 0:c());const p={reactionStorage:i,config:n,votingIndex:r,voteNumbers:o,locale:s,isReactionEnabled:l,reactionsInfo:a,get abort(){return c},set abort(g){c=g},fetchReaction:f,vote:h,get LoadingIcon(){return mi}};return Object.defineProperty(p,"__isScriptSetup",{enumerable:!1,value:!0}),p}}),bn=(e,t)=>{const i=e.__vccOpts||e;for(const[n,r]of t)i[n]=r;return i};const Kf={key:0,class:"wl-reaction"},Gf=["textContent"],Zf={class:"wl-reaction-list"},Qf=["onClick"],Jf={class:"wl-reaction-img"},Yf=["src","alt"],Xf=["textContent"],ed=["textContent"];function td(e,t,i,n,r,o){return n.reactionsInfo.length?(I(),L("div",Kf,[M("div",{class:"wl-reaction-title",textContent:J(n.locale.reactionTitle)},null,8,Gf),M("ul",Zf,[(I(!0),L(se,null,Ue(n.reactionsInfo,({active:s,icon:l,desc:a},c)=>(I(),L("li",{key:c,class:pe(["wl-reaction-item",{active:s}]),onClick:f=>n.vote(c)},[M("div",Jf,[M("img",{src:l,alt:a},null,8,Yf),n.votingIndex===c?(I(),et(n.LoadingIcon,{key:0,class:"wl-reaction-loading"})):(I(),L("div",{key:1,class:"wl-reaction-votes",textContent:J(n.voteNumbers[c]||0)},null,8,Xf))]),M("div",{class:"wl-reaction-text",textContent:J(a)},null,8,ed)],10,Qf))),128))])])):Q("v-if",!0)}var nd=bn(qf,[["render",td],["__file","ArticleReaction.vue"]]),_n=new Map;function id(e){var t=_n.get(e);t&&t.destroy()}function rd(e){var t=_n.get(e);t&&t.update()}var kn=null;typeof window>"u"?((kn=function(e){return e}).destroy=function(e){return e},kn.update=function(e){return e}):((kn=function(e,t){return e&&Array.prototype.forEach.call(e.length?e:[e],function(i){return function(n){if(n&&n.nodeName&&n.nodeName==="TEXTAREA"&&!_n.has(n)){var r,o=null,s=window.getComputedStyle(n),l=(r=n.value,function(){c({testForHeightReduction:r===""||!n.value.startsWith(r),restoreTextAlign:null}),r=n.value}),a=(function(h){n.removeEventListener("autosize:destroy",a),n.removeEventListener("autosize:update",f),n.removeEventListener("input",l),window.removeEventListener("resize",f),Object.keys(h).forEach(function(p){return n.style[p]=h[p]}),_n.delete(n)}).bind(n,{height:n.style.height,resize:n.style.resize,textAlign:n.style.textAlign,overflowY:n.style.overflowY,overflowX:n.style.overflowX,wordWrap:n.style.wordWrap});n.addEventListener("autosize:destroy",a),n.addEventListener("autosize:update",f),n.addEventListener("input",l),window.addEventListener("resize",f),n.style.overflowX="hidden",n.style.wordWrap="break-word",_n.set(n,{destroy:a,update:f}),f()}function c(h){var p,g,R=h.restoreTextAlign,x=R===void 0?null:R,T=h.testForHeightReduction,$=T===void 0||T,P=s.overflowY;if(n.scrollHeight!==0&&(s.resize==="vertical"?n.style.resize="none":s.resize==="both"&&(n.style.resize="horizontal"),$&&(p=function(N){for(var te=[];N&&N.parentNode&&N.parentNode instanceof Element;)N.parentNode.scrollTop&&te.push([N.parentNode,N.parentNode.scrollTop]),N=N.parentNode;return function(){return te.forEach(function(H){var D=H[0],B=H[1];D.style.scrollBehavior="auto",D.scrollTop=B,D.style.scrollBehavior=null})}}(n),n.style.height=""),g=s.boxSizing==="content-box"?n.scrollHeight-(parseFloat(s.paddingTop)+parseFloat(s.paddingBottom)):n.scrollHeight+parseFloat(s.borderTopWidth)+parseFloat(s.borderBottomWidth),s.maxHeight!=="none"&&g>parseFloat(s.maxHeight)?(s.overflowY==="hidden"&&(n.style.overflow="scroll"),g=parseFloat(s.maxHeight)):s.overflowY!=="hidden"&&(n.style.overflow="hidden"),n.style.height=g+"px",x&&(n.style.textAlign=x),p&&p(),o!==g&&(n.dispatchEvent(new Event("autosize:resized",{bubbles:!0})),o=g),P!==s.overflow&&!x)){var A=s.textAlign;s.overflow==="hidden"&&(n.style.textAlign=A==="start"?"end":"start"),c({restoreTextAlign:A,testForHeightReduction:!0})}}function f(){c({testForHeightReduction:!0,restoreTextAlign:null})}}(i)}),e}).destroy=function(e){return e&&Array.prototype.forEach.call(e.length?e:[e],id),e},kn.update=function(e){return e&&Array.prototype.forEach.call(e.length?e:[e],rd),e});var ul=kn,od=rn({__name:"ImageWall",props:{items:{default:()=>[]},columnWidth:{default:300},gap:{default:0}},emits:["insert"],setup(e,{expose:t}){const i=e;t();let n=null;const r=V(null),o=V({}),s=V([]),l=()=>{const g=Math.floor((r.value.getBoundingClientRect().width+i.gap)/(i.columnWidth+i.gap));return g>0?g:1},a=g=>new Array(g).fill(null).map(()=>[]),c=async g=>{var R;if(g>=i.items.length)return;await Ut();const x=Array.from(((R=r.value)==null?void 0:R.children)??[]).reduce((T,$)=>$.getBoundingClientRect().height<T.getBoundingClientRect().height?$:T);s.value[Number(x.dataset.index)].push(g),await c(g+1)},f=async(g=!1)=>{if(s.value.length===l()&&!g)return;s.value=a(l());const R=window.scrollY;await c(0),window.scrollTo({top:R})},h=g=>{o.value[g.target.src]=!0};on(()=>{f(!0),n=new ResizeObserver(()=>{f()}),n.observe(r.value),Pe(()=>[i.items],()=>{o.value={},f(!0)}),Pe(()=>[i.columnWidth,i.gap],()=>{f()})}),Ka(()=>n.unobserve(r.value));const p={props:i,get resizeObserver(){return n},set resizeObserver(g){n=g},wall:r,state:o,columns:s,getColumnCount:l,createColumns:a,fillColumns:c,redraw:f,imageLoad:h,get LoadingIcon(){return mi}};return Object.defineProperty(p,"__isScriptSetup",{enumerable:!1,value:!0}),p}});const sd=["data-index"],ld=["src","title","onClick"];function ad(e,t,i,n,r,o){return I(),L("div",{ref:"wall",class:"wl-gallery",style:Zt({gap:`${i.gap}px`})},[(I(!0),L(se,null,Ue(n.columns,(s,l)=>(I(),L("div",{key:l,class:"wl-gallery-column","data-index":l,style:Zt({gap:`${i.gap}px`})},[(I(!0),L(se,null,Ue(s,a=>(I(),L(se,{key:a},[n.state[i.items[a].src]?Q("v-if",!0):(I(),et(n.LoadingIcon,{key:0,size:36,style:{margin:"20px auto"}})),M("img",{class:"wl-gallery-item",src:i.items[a].src,title:i.items[a].title,loading:"lazy",onLoad:n.imageLoad,onClick:c=>e.$emit("insert",``)},null,40,ld)],64))),128))],12,sd))),128))],4)}var cd=bn(od,[["render",ad],["__file","ImageWall.vue"]]),ud=rn({__name:"CommentBox",props:{edit:{default:null},rootId:{default:""},replyId:{default:""},replyUser:{default:""}},emits:["log","cancelEdit","cancelReply","submit"],setup(e,{expose:t,emit:i}){t();const n=e,r=i,o=Zn("config"),s=jf(),l=Of(),a=wi(),c=V({}),f=V(null),h=V(null),p=V(null),g=V(null),R=V(null),x=V(null),T=V(null),$=V({tabs:[],map:{}}),P=V(0),A=V(!1),N=V(!1),te=V(!1),H=V(""),D=V(0),B=Qt({loading:!0,list:[]}),je=V(0),W=V(!1),ae=V(""),ge=V(!1),mt=V(!1),De=_e(()=>o.value.locale),q=_e(()=>{var O;return!!((O=a.value)!=null&&O.token)}),re=_e(()=>o.value.imageUploader!==!1),me=O=>{const j=f.value,u=j.selectionStart,d=j.selectionEnd||0,m=j.scrollTop;s.value=j.value.substring(0,u)+O+j.value.substring(d,j.value.length),j.focus(),j.selectionStart=u+O.length,j.selectionEnd=u+O.length,j.scrollTop=m},Se=O=>{const j=O.key;(O.ctrlKey||O.metaKey)&&j==="Enter"&&Vt()},ve=O=>{const j=`![${o.value.locale.uploading} ${O.name}]()`;return me(j),ge.value=!0,Promise.resolve().then(()=>o.value.imageUploader(O)).then(u=>{s.value=s.value.replace(j,`\r
|
|
72
|
-
`)}).catch(u=>{alert(u.message),s.value=s.value.replace(j,"")}).then(()=>{ge.value=!1})},Re=O=>{var j;if((j=O.dataTransfer)!=null&&j.items){const u=Ms(O.dataTransfer.items);u&&re.value&&(ve(u),O.preventDefault())}},we=O=>{if(O.clipboardData){const j=Ms(O.clipboardData.items);j&&re.value&&ve(j)}},Me=()=>{const O=h.value;O.files&&re.value&&ve(O.files[0]).then(()=>{O.value=""})},Vt=async()=>{var O,j,u,d,m,w;const{serverURL:v,lang:b,login:C,wordLimit:_,requiredMeta:k,recaptchaV3Key:y,turnstileKey:S}=o.value,z=await kf(),E={comment:ae.value,nick:l.value.nick,mail:l.value.mail,link:l.value.link,url:o.value.path,ua:z};if((O=a.value)!=null&&O.token&&!n.edit)E.nick=a.value.display_name,E.mail=a.value.email,E.link=a.value.url;else{if(C==="force")return;if(k.indexOf("nick")>-1&&!E.nick)return(j=c.value.nick)==null||j.focus(),alert(De.value.nickError);if(k.indexOf("mail")>-1&&!E.mail||E.mail&&!Nl(E.mail))return(u=c.value.mail)==null||u.focus(),alert(De.value.mailError);E.nick||(E.nick=De.value.anonymous)}if(!E.comment){(d=f.value)==null||d.focus();return}if(!W.value)return alert(De.value.wordHint.replace("$0",_[0].toString()).replace("$1",_[1].toString()).replace("$2",D.value.toString()));E.comment=tl(E.comment,$.value.map),n.replyId&&n.rootId&&(E.pid=n.replyId,E.rid=n.rootId,E.at=n.replyUser),ge.value=!0;try{y&&(E.recaptchaV3=await Vf(y).execute("social")),S&&(E.turnstile=await Bf(S).execute("social"));const U={serverURL:v,lang:b,token:(m=a.value)==null?void 0:m.token,comment:E},K=await(n.edit?qt({objectId:n.edit.objectId,...U}):Ir(U));if(ge.value=!1,K.errmsg)return alert(K.errmsg);r("submit",K.data),s.value="",H.value="",await Ut(),n.replyId&&r("cancelReply"),(w=n.edit)!=null&&w.objectId&&r("cancelEdit")}catch(U){ge.value=!1,alert(U.message)}},Cn=O=>{O.preventDefault();const{lang:j,serverURL:u}=o.value;Tr({serverURL:u,lang:j}).then(d=>{a.value=d,(d.remember?localStorage:sessionStorage).setItem("WALINE_USER",JSON.stringify(d)),r("log")})},kr=()=>{a.value={},localStorage.setItem("WALINE_USER","null"),sessionStorage.setItem("WALINE_USER","null"),r("log")},Ve=O=>{O.preventDefault();const{lang:j,serverURL:u}=o.value,d=800,m=800,w=(window.innerWidth-d)/2,v=(window.innerHeight-m)/2,b=new URLSearchParams({lng:j,token:a.value.token}),C=window.open(`${u}/ui/profile?${b.toString()}`,"_blank",`width=${d},height=${m},left=${w},top=${v},scrollbars=no,resizable=no,status=no,location=no,toolbar=no,menubar=no`);C==null||C.postMessage({type:"TOKEN",data:a.value.token},"*")},At=O=>{var j,u,d,m;!((j=p.value)!=null&&j.contains(O.target))&&!((u=g.value)!=null&&u.contains(O.target))&&(A.value=!1),!((d=R.value)!=null&&d.contains(O.target))&&!((m=x.value)!=null&&m.contains(O.target))&&(N.value=!1)},Bt=async O=>{var j;const{scrollTop:u,clientHeight:d,scrollHeight:m}=O.target,w=(d+u)/m,v=o.value.search,b=((j=T.value)==null?void 0:j.value)??"";w<.9||B.loading||mt.value||(B.loading=!0,(v.more&&B.list.length?await v.more(b,B.list.length):await v.search(b)).length?B.list=[...B.list,...v.more&&B.list.length?await v.more(b,B.list.length):await v.search(b)]:mt.value=!0,B.loading=!1,setTimeout(()=>{O.target.scrollTop=u},50))},bi=uu(O=>{B.list=[],mt.value=!1,Bt(O)},300);Pe([o,D],([O,j])=>{const{wordLimit:u}=O;u?j<u[0]&&u[0]!==0?(je.value=u[0],W.value=!1):j>u[1]?(je.value=u[1],W.value=!1):(je.value=u[1],W.value=!0):(je.value=0,W.value=!0)},{immediate:!0}),li("click",At),li("message",({data:O})=>{!O||O.type!=="profile"||(a.value={...a.value,...O.data},[localStorage,sessionStorage].filter(j=>j.getItem("WALINE_USER")).forEach(j=>j.setItem("WALINE_USER",JSON.stringify(a))))}),Pe(N,async O=>{var j;if(!O)return;const u=o.value.search;T.value&&(T.value.value=""),B.loading=!0,B.list=await(((j=u.default)==null?void 0:j.call(u))??u.search("")),B.loading=!1}),on(()=>{var O;(O=n.edit)!=null&&O.objectId&&(s.value=n.edit.orig),Pe(()=>s.value,j=>{const{highlighter:u,texRenderer:d}=o.value;ae.value=j,H.value=wf(j,{emojiMap:$.value.map,highlighter:u,texRenderer:d}),D.value=_f(j),j?ul(f.value):ul.destroy(f.value)},{immediate:!0}),Pe(()=>o.value.emoji,j=>Ru(j).then(u=>{$.value=u}),{immediate:!0})});const vt={props:n,emit:r,config:o,editor:s,userMeta:l,userInfo:a,inputRefs:c,editorRef:f,imageUploadRef:h,emojiButtonRef:p,emojiPopupRef:g,gifButtonRef:R,gifPopupRef:x,gifSearchInputRef:T,emoji:$,emojiTabIndex:P,showEmoji:A,showGif:N,showPreview:te,previewText:H,wordNumber:D,searchResults:B,wordLimit:je,isWordNumberLegal:W,content:ae,isSubmitting:ge,isImageListEnd:mt,locale:De,isLogin:q,canUploadImage:re,insert:me,onKeyDown:Se,uploadImage:ve,onDrop:Re,onPaste:we,onChange:Me,submitComment:Vt,onLogin:Cn,onLogout:kr,onProfile:Ve,popupHandler:At,onImageWallScroll:Bt,onGifSearch:bi,get CloseIcon(){return xf},get EmojiIcon(){return Ef},get GifIcon(){return $f},get ImageIcon(){return If},get LoadingIcon(){return mi},get MarkdownIcon(){return Tf},get PreviewIcon(){return Rf},ImageWall:cd};return Object.defineProperty(vt,"__isScriptSetup",{enumerable:!1,value:!0}),vt}});const fd={key:0,class:"wl-login-info"},dd={class:"wl-avatar"},hd=["title"],pd=["title"],gd=["src"],md=["title","textContent"],vd={class:"wl-panel"},wd=["for","textContent"],yd=["id","onUpdate:modelValue","name","type"],bd=["placeholder"],_d={class:"wl-preview"},kd=M("hr",null,null,-1),xd=["innerHTML"],Cd={class:"wl-footer"},Ed={class:"wl-actions"},Id={href:"https://guides.github.com/features/mastering-markdown/",title:"Markdown Guide","aria-label":"Markdown is supported",class:"wl-action",target:"_blank",rel:"noopener noreferrer"},Sd=["title"],Rd=["title"],Td=["title"],Ld=["title"],Ad={class:"wl-info"},Md=M("div",{class:"wl-captcha-container"},null,-1),$d={class:"wl-text-number"},Od={key:0},jd=["textContent"],zd=["textContent"],Pd=["disabled"],Ud=["placeholder"],Fd={key:1,class:"wl-loading"},Nd={key:0,class:"wl-tab-wrapper"},Hd=["title","onClick"],Dd=["src","alt"],Vd={key:0,class:"wl-tabs"},Bd=["onClick"],Wd=["src","alt","title"],qd=["title"];function Kd(e,t,i,n,r,o){var s,l;return I(),L("div",{key:Number(n.isLogin),class:"wl-comment"},[n.config.login!=="disable"&&n.isLogin&&!((s=i.edit)!=null&&s.objectId)?(I(),L("div",fd,[M("div",dd,[M("button",{type:"submit",class:"wl-logout-btn",title:n.locale.logout,onClick:n.onLogout},[ne(n.CloseIcon,{size:14})],8,hd),M("a",{href:"#",class:"wl-login-nick","aria-label":"Profile",title:n.locale.profile,onClick:n.onProfile},[M("img",{src:n.userInfo.avatar,alt:"avatar"},null,8,gd)],8,pd)]),M("a",{href:"#",class:"wl-login-nick","aria-label":"Profile",title:n.locale.profile,onClick:n.onProfile,textContent:J(n.userInfo.display_name)},null,8,md)])):Q("v-if",!0),M("div",vd,[n.config.login!=="force"&&n.config.meta.length&&!n.isLogin?(I(),L("div",{key:0,class:pe(["wl-header",`item${n.config.meta.length}`])},[(I(!0),L(se,null,Ue(n.config.meta,a=>(I(),L("div",{key:a,class:"wl-header-item"},[M("label",{for:`wl-${a}`,textContent:J(n.locale[a]+(n.config.requiredMeta.includes(a)||!n.config.requiredMeta.length?"":`(${n.locale.optional})`))},null,8,wd),qn(M("input",{id:`wl-${a}`,ref_for:!0,ref:c=>{c&&(n.inputRefs[a]=c)},"onUpdate:modelValue":c=>n.userMeta[a]=c,class:pe(["wl-input",`wl-${a}`]),name:a,type:a==="mail"?"email":"text"},null,10,yd),[[Xc,n.userMeta[a]]])]))),128))],2)):Q("v-if",!0),qn(M("textarea",{id:"wl-edit",ref:"editorRef","onUpdate:modelValue":t[0]||(t[0]=a=>n.editor=a),class:"wl-editor",placeholder:i.replyUser?`@${i.replyUser}`:n.locale.placeholder,onKeydown:n.onKeyDown,onDrop:n.onDrop,onPaste:n.onPaste},null,40,bd),[[ur,n.editor]]),qn(M("div",_d,[kd,M("h4",null,J(n.locale.preview)+":",1),M("div",{class:"wl-content",innerHTML:n.previewText},null,8,xd)],512),[[hs,n.showPreview]]),M("div",Cd,[M("div",Ed,[M("a",Id,[ne(n.MarkdownIcon)]),qn(M("button",{ref:"emojiButtonRef",type:"button",class:pe(["wl-action",{active:n.showEmoji}]),title:n.locale.emoji,onClick:t[1]||(t[1]=a=>n.showEmoji=!n.showEmoji)},[ne(n.EmojiIcon)],10,Sd),[[hs,n.emoji.tabs.length]]),n.config.search?(I(),L("button",{key:0,ref:"gifButtonRef",type:"button",class:pe(["wl-action",{active:n.showGif}]),title:n.locale.gif,onClick:t[2]||(t[2]=a=>n.showGif=!n.showGif)},[ne(n.GifIcon)],10,Rd)):Q("v-if",!0),M("input",{id:"wl-image-upload",ref:"imageUploadRef",class:"upload",type:"file",accept:".png,.jpg,.jpeg,.webp,.bmp,.gif",onChange:n.onChange},null,544),n.canUploadImage?(I(),L("label",{key:1,for:"wl-image-upload",class:"wl-action",title:n.locale.uploadImage},[ne(n.ImageIcon)],8,Td)):Q("v-if",!0),M("button",{type:"button",class:pe(["wl-action",{active:n.showPreview}]),title:n.locale.preview,onClick:t[3]||(t[3]=a=>n.showPreview=!n.showPreview)},[ne(n.PreviewIcon)],10,Ld)]),M("div",Ad,[Md,M("div",$d,[tt(J(n.wordNumber)+" ",1),n.config.wordLimit?(I(),L("span",Od,[tt(" / "),M("span",{class:pe({illegal:!n.isWordNumberLegal}),textContent:J(n.wordLimit)},null,10,jd)])):Q("v-if",!0),tt(" "+J(n.locale.word),1)]),n.config.login!=="disable"&&!n.isLogin?(I(),L("button",{key:0,type:"button",class:"wl-btn",onClick:n.onLogin,textContent:J(n.locale.login)},null,8,zd)):Q("v-if",!0),n.config.login!=="force"||n.isLogin?(I(),L("button",{key:1,type:"submit",class:"primary wl-btn",title:"Cmd|Ctrl + Enter",disabled:n.isSubmitting,onClick:n.submitComment},[n.isSubmitting?(I(),et(n.LoadingIcon,{key:0,size:16})):(I(),L(se,{key:1},[tt(J(n.locale.submit),1)],64))],8,Pd)):Q("v-if",!0)]),M("div",{ref:"gifPopupRef",class:pe(["wl-gif-popup",{display:n.showGif}])},[M("input",{ref:"gifSearchInputRef",type:"text",placeholder:n.locale.gifSearchPlaceholder,onInput:t[4]||(t[4]=(...a)=>n.onGifSearch&&n.onGifSearch(...a))},null,40,Ud),n.searchResults.list.length?(I(),et(n.ImageWall,{key:0,items:n.searchResults.list,"column-width":200,gap:6,onInsert:t[5]||(t[5]=a=>n.insert(a)),onScroll:n.onImageWallScroll},null,8,["items"])):Q("v-if",!0),n.searchResults.loading?(I(),L("div",Fd,[ne(n.LoadingIcon,{size:30})])):Q("v-if",!0)],2),M("div",{ref:"emojiPopupRef",class:pe(["wl-emoji-popup",{display:n.showEmoji}])},[(I(!0),L(se,null,Ue(n.emoji.tabs,(a,c)=>(I(),L(se,{key:a.name},[c===n.emojiTabIndex?(I(),L("div",Nd,[(I(!0),L(se,null,Ue(a.items,f=>(I(),L("button",{key:f,type:"button",title:f,onClick:h=>n.insert(`:${f}:`)},[n.showEmoji?(I(),L("img",{key:0,class:"wl-emoji",src:n.emoji.map[f],alt:f,loading:"lazy",referrerPolicy:"no-referrer"},null,8,Dd)):Q("v-if",!0)],8,Hd))),128))])):Q("v-if",!0)],64))),128)),n.emoji.tabs.length>1?(I(),L("div",Vd,[(I(!0),L(se,null,Ue(n.emoji.tabs,(a,c)=>(I(),L("button",{key:a.name,type:"button",class:pe(["wl-tab",{active:n.emojiTabIndex===c}]),onClick:f=>n.emojiTabIndex=c},[M("img",{class:"wl-emoji",src:a.icon,alt:a.name,title:a.name,loading:"lazy",referrerPolicy:"no-referrer"},null,8,Wd)],10,Bd))),128))])):Q("v-if",!0)],2)])]),i.replyId||(l=i.edit)!=null&&l.objectId?(I(),L("button",{key:1,type:"button",class:"wl-close",title:n.locale.cancelReply,onClick:t[6]||(t[6]=a=>i.replyId?n.emit("cancelReply"):n.emit("cancelEdit"))},[ne(n.CloseIcon,{size:24})],8,qd)):Q("v-if",!0)])}var fl=bn(ud,[["render",Kd],["__file","CommentBox.vue"]]),Gd=rn({__name:"CommentCard",props:{comment:{},edit:{default:null},rootId:{},reply:{default:null}},emits:["log","submit","delete","edit","like","status","sticky","reply"],setup(e,{expose:t,emit:i}){t();const n=e,r=i,o=["approved","waiting","spam"],s=Zn("config"),l=rl(),a=ku(),c=wi(),f=_e(()=>s.value.locale),h=_e(()=>{const{link:A}=n.comment;return A?Kr(A)?A:`https://${A}`:""}),p=_e(()=>l.value.includes(n.comment.objectId)),g=_e(()=>Ul(new Date(n.comment.time),a.value,f.value)),R=_e(()=>c.value.type==="administrator"),x=_e(()=>n.comment.user_id&&c.value.objectId===n.comment.user_id),T=_e(()=>{var A;return n.comment.objectId===((A=n.reply)==null?void 0:A.objectId)}),$=_e(()=>{var A;return n.comment.objectId===((A=n.edit)==null?void 0:A.objectId)}),P={props:n,emit:r,commentStatus:o,config:s,likes:l,now:a,userInfo:c,locale:f,link:h,like:p,time:g,isAdmin:R,isOwner:x,isReplyingCurrent:T,isEditingCurrent:$,CommentBox:fl,get DeleteIcon(){return Cf},get EditIcon(){return Af},get LikeIcon(){return Sf},get ReplyIcon(){return Lf},get VerifiedIcon(){return Mf}};return Object.defineProperty(P,"__isScriptSetup",{enumerable:!1,value:!0}),P}});const Zd=["id"],Qd={class:"wl-user","aria-hidden":"true"},Jd=["src"],Yd={class:"wl-card"},Xd={class:"wl-head"},eh=["href"],th={key:1,class:"wl-nick"},nh=["textContent"],ih=["textContent"],rh=["textContent"],oh=["textContent"],sh=["textContent"],lh={class:"wl-comment-actions"},ah=["title"],ch=["title"],uh={class:"wl-meta","aria-hidden":"true"},fh=["data-value","textContent"],dh={key:0,class:"wl-content"},hh={key:0},ph=["href"],gh=M("span",null,": ",-1),mh=["innerHTML"],vh={key:1,class:"wl-admin-actions"},wh={class:"wl-comment-status"},yh=["disabled","onClick","textContent"],bh={key:3,class:"wl-quote"};function _h(e,t,i,n,r,o){var l;const s=Ua("CommentCard",!0);return I(),L("div",{id:i.comment.objectId,class:"wl-card-item"},[M("div",Qd,[i.comment.avatar?(I(),L("img",{key:0,class:"wl-user-avatar",src:i.comment.avatar},null,8,Jd)):Q("v-if",!0),i.comment.type?(I(),et(n.VerifiedIcon,{key:1})):Q("v-if",!0)]),M("div",Yd,[M("div",Xd,[n.link?(I(),L("a",{key:0,class:"wl-nick",href:n.link,target:"_blank",rel:"nofollow noopener noreferrer"},J(i.comment.nick),9,eh)):(I(),L("span",th,J(i.comment.nick),1)),i.comment.type==="administrator"?(I(),L("span",{key:2,class:"wl-badge",textContent:J(n.locale.admin)},null,8,nh)):Q("v-if",!0),i.comment.label?(I(),L("span",{key:3,class:"wl-badge",textContent:J(i.comment.label)},null,8,ih)):Q("v-if",!0),i.comment.sticky?(I(),L("span",{key:4,class:"wl-badge",textContent:J(n.locale.sticky)},null,8,rh)):Q("v-if",!0),typeof i.comment.level=="number"?(I(),L("span",{key:5,class:pe(`wl-badge level${i.comment.level}`),textContent:J(n.locale[`level${i.comment.level}`]||`Level ${i.comment.level}`)},null,10,oh)):Q("v-if",!0),M("span",{class:"wl-time",textContent:J(n.time)},null,8,sh),M("div",lh,[n.isAdmin||n.isOwner?(I(),L(se,{key:0},[M("button",{type:"button",class:"wl-edit",onClick:t[0]||(t[0]=a=>n.emit("edit",i.comment))},[ne(n.EditIcon)]),M("button",{type:"button",class:"wl-delete",onClick:t[1]||(t[1]=a=>n.emit("delete",i.comment))},[ne(n.DeleteIcon)])],64)):Q("v-if",!0),M("button",{type:"button",class:"wl-like",title:n.like?n.locale.cancelLike:n.locale.like,onClick:t[2]||(t[2]=a=>n.emit("like",i.comment))},[ne(n.LikeIcon,{active:n.like},null,8,["active"]),tt(" "+J("like"in i.comment?i.comment.like:""),1)],8,ah),M("button",{type:"button",class:pe(["wl-reply",{active:n.isReplyingCurrent}]),title:n.isReplyingCurrent?n.locale.cancelReply:n.locale.reply,onClick:t[3]||(t[3]=a=>n.emit("reply",n.isReplyingCurrent?null:i.comment))},[ne(n.ReplyIcon)],10,ch)])]),M("div",uh,[(I(),L(se,null,Ue(["addr","browser","os"],a=>(I(),L(se,null,[i.comment[a]?(I(),L("span",{key:a,class:pe(`wl-${a}`),"data-value":i.comment[a],textContent:J(i.comment[a])},null,10,fh)):Q("v-if",!0)],64))),64))]),n.isEditingCurrent?Q("v-if",!0):(I(),L("div",dh,[i.comment.reply_user?(I(),L("p",hh,[M("a",{href:"#"+i.comment.pid},"@"+J(i.comment.reply_user.nick),9,ph),gh])):Q("v-if",!0),M("div",{innerHTML:i.comment.comment},null,8,mh)])),n.isAdmin&&!n.isEditingCurrent?(I(),L("div",vh,[M("span",wh,[(I(),L(se,null,Ue(n.commentStatus,a=>M("button",{key:a,type:"submit",class:pe(`wl-btn wl-${a}`),disabled:i.comment.status===a,onClick:c=>n.emit("status",{status:a,comment:i.comment}),textContent:J(n.locale[a])},null,10,yh)),64))]),n.isAdmin&&!("rid"in i.comment)?(I(),L("button",{key:0,type:"submit",class:"wl-btn wl-sticky",onClick:t[4]||(t[4]=a=>n.emit("sticky",i.comment))},J(i.comment.sticky?n.locale.unsticky:n.locale.sticky),1)):Q("v-if",!0)])):Q("v-if",!0),n.isReplyingCurrent||n.isEditingCurrent?(I(),L("div",{key:2,class:pe({"wl-reply-wrapper":n.isReplyingCurrent,"wl-edit-wrapper":n.isEditingCurrent})},[ne(n.CommentBox,{edit:i.edit,"reply-id":(l=i.reply)==null?void 0:l.objectId,"reply-user":i.comment.nick,"root-id":i.rootId,onLog:t[5]||(t[5]=a=>n.emit("log")),onCancelReply:t[6]||(t[6]=a=>n.emit("reply",null)),onCancelEdit:t[7]||(t[7]=a=>n.emit("edit",null)),onSubmit:t[8]||(t[8]=a=>n.emit("submit",a))},null,8,["edit","reply-id","reply-user","root-id"])],2)):Q("v-if",!0),"children"in i.comment?(I(),L("div",bh,[(I(!0),L(se,null,Ue(i.comment.children,a=>(I(),et(s,{key:a.objectId,comment:a,reply:i.reply,edit:i.edit,"root-id":i.rootId,onLog:t[9]||(t[9]=c=>n.emit("log")),onDelete:t[10]||(t[10]=c=>n.emit("delete",c)),onEdit:t[11]||(t[11]=c=>n.emit("edit",c)),onLike:t[12]||(t[12]=c=>n.emit("like",c)),onReply:t[13]||(t[13]=c=>n.emit("reply",c)),onStatus:t[14]||(t[14]=c=>n.emit("status",c)),onSticky:t[15]||(t[15]=c=>n.emit("sticky",c)),onSubmit:t[16]||(t[16]=c=>n.emit("submit",c))},null,8,["comment","reply","edit","root-id"]))),128))])):Q("v-if",!0)])],8,Zd)}var kh=bn(Gd,[["render",_h],["__file","CommentCard.vue"]]);const dl="3.2.5";var xh=rn({__name:"WalineComment",props:["serverURL","path","meta","requiredMeta","dark","commentSorting","lang","locale","pageSize","wordLimit","emoji","login","highlighter","texRenderer","imageUploader","search","copyright","recaptchaV3Key","turnstileKey","reaction"],setup(e,{expose:t}){t();const i=e,n={latest:"insertedAt_desc",oldest:"insertedAt_asc",hottest:"like_desc"},r=Object.keys(n),o=wi(),s=rl(),l=V("loading"),a=V(0),c=V(1),f=V(0),h=_e(()=>jl(i)),p=V(h.value.commentSorting),g=V([]),R=V(null),x=V(null),T=_e(()=>zl(h.value.dark)),$=_e(()=>h.value.locale);Eu(T,{id:"waline-darkmode"});let P;const A=q=>{var re;const{serverURL:me,path:Se,pageSize:ve}=h.value,Re=new AbortController;l.value="loading",P==null||P(),Er({serverURL:me,lang:h.value.lang,path:Se,pageSize:ve,sortBy:n[p.value],page:q,signal:Re.signal,token:(re=o.value)==null?void 0:re.token}).then(we=>{l.value="success",a.value=we.count,g.value.push(...we.data),c.value=q,f.value=we.totalPages}).catch(we=>{we.name!=="AbortError"&&(console.error(we.message),l.value="error")}),P=Re.abort.bind(Re)},N=()=>A(c.value+1),te=()=>{a.value=0,g.value=[],A(1)},H=q=>{p.value!==q&&(p.value=q,te())},D=q=>{R.value=q},B=q=>{x.value=q},je=q=>{if(x.value)x.value.comment=q.comment,x.value.orig=q.orig;else if("rid"in q){const re=g.value.find(({objectId:me})=>me===q.rid);if(!re)return;Array.isArray(re.children)||(re.children=[]),re.children.push(q)}else g.value.unshift(q),a.value+=1},W=async({comment:q,status:re})=>{var me;if(q.status===re)return;const{serverURL:Se,lang:ve}=h.value;await qt({serverURL:Se,lang:ve,token:(me=o.value)==null?void 0:me.token,objectId:q.objectId,comment:{status:re}}),q.status=re},ae=async q=>{var re;if("rid"in q)return;const{serverURL:me,lang:Se}=h.value;await qt({serverURL:me,lang:Se,token:(re=o.value)==null?void 0:re.token,objectId:q.objectId,comment:{sticky:q.sticky?0:1}}),q.sticky=!q.sticky},ge=async({objectId:q})=>{var re;if(!confirm("Are you sure you want to delete this comment?"))return;const{serverURL:me,lang:Se}=h.value;await Sr({serverURL:me,lang:Se,token:(re=o.value)==null?void 0:re.token,objectId:q}),g.value.some((ve,Re)=>ve.objectId===q?(g.value=g.value.filter((we,Me)=>Me!==Re),!0):ve.children.some((we,Me)=>we.objectId===q?(g.value[Re].children=ve.children.filter((Vt,Cn)=>Cn!==Me),!0):!1))},mt=async q=>{var re;const{serverURL:me,lang:Se}=h.value,{objectId:ve}=q,Re=s.value.includes(ve);await qt({serverURL:me,lang:Se,objectId:ve,token:(re=o.value)==null?void 0:re.token,comment:{like:!Re}}),Re?s.value=s.value.filter(we=>we!==ve):(s.value=[...s.value,ve],s.value.length>50&&(s.value=s.value.slice(-50))),q.like=(q.like||0)+(Re?-1:1)};tc("config",h),on(()=>{Pe(()=>[i.serverURL,i.path],()=>te(),{immediate:!0})}),Qi(()=>P==null?void 0:P());const De={props:i,sortKeyMap:n,sortingMethods:r,userInfo:o,likeStorage:s,status:l,count:a,page:c,totalPages:f,config:h,commentSortingRef:p,data:g,reply:R,edit:x,darkmodeStyle:T,i18n:$,get abort(){return P},set abort(q){P=q},getCommentData:A,loadMore:N,refresh:te,onSortByChange:H,onReply:D,onEdit:B,onSubmit:je,onStatusChange:W,onSticky:ae,onDelete:ge,onLike:mt,Reaction:nd,CommentBox:fl,CommentCard:kh,get LoadingIcon(){return mi},get version(){return dl}};return Object.defineProperty(De,"__isScriptSetup",{enumerable:!1,value:!0}),De}});const Ch={"data-waline":""},Eh={class:"wl-meta-head"},Ih={class:"wl-count"},Sh=["textContent"],Rh={class:"wl-sort"},Th=["onClick"],Lh={class:"wl-cards"},Ah={key:1,class:"wl-operation"},Mh=["textContent"],$h={key:2,class:"wl-loading"},Oh=["textContent"],jh={key:4,class:"wl-operation"},zh=["textContent"],Ph={key:5,class:"wl-power"},Uh=M("a",{href:"https://github.com/walinejs/waline",target:"_blank",rel:"noopener noreferrer"}," Waline ",-1);function Fh(e,t,i,n,r,o){return I(),L("div",Ch,[ne(n.Reaction),n.reply?Q("v-if",!0):(I(),et(n.CommentBox,{key:0,onLog:n.refresh,onSubmit:n.onSubmit})),M("div",Eh,[M("div",Ih,[n.count?(I(),L("span",{key:0,class:"wl-num",textContent:J(n.count)},null,8,Sh)):Q("v-if",!0),tt(" "+J(n.i18n.comment),1)]),M("ul",Rh,[(I(!0),L(se,null,Ue(n.sortingMethods,s=>(I(),L("li",{key:s,class:pe([s===n.commentSortingRef?"active":""]),onClick:l=>n.onSortByChange(s)},J(n.i18n[s]),11,Th))),128))])]),M("div",Lh,[(I(!0),L(se,null,Ue(n.data,s=>(I(),et(n.CommentCard,{key:s.objectId,"root-id":s.objectId,comment:s,reply:n.reply,edit:n.edit,onLog:n.refresh,onReply:n.onReply,onEdit:n.onEdit,onSubmit:n.onSubmit,onStatus:n.onStatusChange,onDelete:n.onDelete,onSticky:n.onSticky,onLike:n.onLike},null,8,["root-id","comment","reply","edit"]))),128))]),n.status==="error"?(I(),L("div",Ah,[M("button",{type:"button",class:"wl-btn",onClick:n.refresh,textContent:J(n.i18n.refresh)},null,8,Mh)])):n.status==="loading"?(I(),L("div",$h,[ne(n.LoadingIcon,{size:30})])):n.data.length?n.page<n.totalPages?(I(),L("div",jh,[M("button",{type:"button",class:"wl-btn",onClick:n.loadMore,textContent:J(n.i18n.more)},null,8,zh)])):Q("v-if",!0):(I(),L("div",{key:3,class:"wl-empty",textContent:J(n.i18n.sofa)},null,8,Oh)),n.config.copyright?(I(),L("div",Ph,[tt(" Powered by "),Uh,tt(" v"+J(n.version),1)])):Q("v-if",!0)])}var Nh=bn(xh,[["render",Fh],["__file","WalineComment.vue"]]);const hl=(e,t)=>{t.forEach((i,n)=>{const r=e[n].time;typeof r=="number"&&(i.innerText=r.toString())})},pl=({serverURL:e,path:t=window.location.pathname,selector:i=".waline-pageview-count",update:n=!0,lang:r=navigator.language})=>{const o=new AbortController,s=Array.from(document.querySelectorAll(i)),l=c=>{const f=_r(c);return f!==null&&t!==f},a=c=>Lr({serverURL:Rn(e),paths:c.map(f=>_r(f)??t),lang:r,signal:o.signal}).then(f=>hl(f,c)).catch(As);if(n){const c=s.filter(h=>!l(h)),f=s.filter(l);Ar({serverURL:Rn(e),path:t,lang:r}).then(h=>hl(h,c)),f.length&&a(f)}else a(s);return o.abort.bind(o)},Hh=({el:e="#waline",path:t=window.location.pathname,comment:i=!1,pageview:n=!1,...r})=>{const o=e?dr(e):null;if(e&&!o)throw new Error("Option 'el' do not match any domElement!");if(!r.serverURL)throw new Error("Option 'serverURL' is missing!");const s=Qt({...r}),l=Qt({comment:i,pageview:n,path:t}),a=()=>{l.comment&&nl({serverURL:s.serverURL,path:l.path,...Mt(l.comment)?{selector:l.comment}:{}})},c=()=>{l.pageview&&pl({serverURL:s.serverURL,path:l.path,...Mt(l.pageview)?{selector:l.pageview}:{}})},f=o?iu(()=>X(Nh,{path:l.path,...s})):null;f&&f.mount(o);const h=Po(a),p=Po(c);return{el:o,update:({comment:g,pageview:R,path:x=window.location.pathname,...T}={})=>{Object.entries(T).forEach(([$,P])=>{s[$]=P}),l.path=x,g!==void 0&&(l.comment=g),R!==void 0&&(l.pageview=R)},destroy:()=>{f==null||f.unmount(),h(),p()}}},Dh=({el:e,serverURL:t,count:i,lang:n=navigator.language})=>{var r;const o=wi(),s=dr(e),l=new AbortController;return Mr({serverURL:t,count:i,lang:n,signal:l.signal,token:(r=o.value)==null?void 0:r.token}).then(a=>s&&a.length?(s.innerHTML=`<ul class="wl-recent-list">${a.map(c=>`<li class="wl-recent-item"><a href="${c.url}">${c.nick}</a>:${c.comment}</li>`).join("")}</ul>`,{comments:a,destroy:()=>{l.abort(),s.innerHTML=""}}):{comments:a,destroy:()=>l.abort()})},Vh=({el:e,serverURL:t,count:i,locale:n,lang:r=navigator.language,mode:o="list"})=>{const s=dr(e),l=new AbortController;return $r({serverURL:t,pageSize:i,lang:r,signal:l.signal}).then(a=>!s||!a.length?{users:a,destroy:()=>l.abort()}:(n={...Br(r),...typeof n=="object"?n:{}},s.innerHTML=`<ul class="wl-user-${o}">${a.map((c,f)=>[`<li class="wl-user-item" aria-label="${c.nick}">`,c.link&&`<a href="${c.link}" target="_blank">`,'<div class="wl-user-avatar">',`<img src="${c.avatar}" alt="${c.nick}">`,`<span class="wl-user-badge">${f+1}</span>`,"</div>",'<div class="wl-user-meta">','<div class="wl-user-name">',c.nick,c.level&&`<span class="wl-badge">${n?n[`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(h=>h).join("")).join("")}</ul>`,{users:a,destroy:()=>{l.abort(),s.innerHTML=""}}))};G.RecentComments=Dh,G.UserList=Vh,G.addComment=Ir,G.commentCount=nl,G.defaultLocales=Sn,G.deleteComment=Sr,G.fetchCommentCount=Rr,G.getArticleCounter=ki,G.getComment=Er,G.getPageview=Lr,G.getRecentComment=Mr,G.getUserList=$r,G.init=Hh,G.login=Tr,G.pageviewCount=pl,G.updateArticleCounter=In,G.updateComment=qt,G.updatePageview=Ar,G.version=dl});
|
|
72
|
+
`)}).catch(u=>{alert(u.message),s.value=s.value.replace(j,"")}).then(()=>{ge.value=!1})},Re=O=>{var j;if((j=O.dataTransfer)!=null&&j.items){const u=Ms(O.dataTransfer.items);u&&re.value&&(ve(u),O.preventDefault())}},we=O=>{if(O.clipboardData){const j=Ms(O.clipboardData.items);j&&re.value&&ve(j)}},Me=()=>{const O=h.value;O.files&&re.value&&ve(O.files[0]).then(()=>{O.value=""})},Vt=async()=>{var O,j,u,d,m,w;const{serverURL:v,lang:b,login:C,wordLimit:_,requiredMeta:k,recaptchaV3Key:y,turnstileKey:S}=o.value,z=await kf(),E={comment:ae.value,nick:l.value.nick,mail:l.value.mail,link:l.value.link,url:o.value.path,ua:z};if((O=a.value)!=null&&O.token&&!n.edit)E.nick=a.value.display_name,E.mail=a.value.email,E.link=a.value.url;else{if(C==="force")return;if(k.indexOf("nick")>-1&&!E.nick)return(j=c.value.nick)==null||j.focus(),alert(De.value.nickError);if(k.indexOf("mail")>-1&&!E.mail||E.mail&&!Nl(E.mail))return(u=c.value.mail)==null||u.focus(),alert(De.value.mailError);E.nick||(E.nick=De.value.anonymous)}if(!E.comment){(d=f.value)==null||d.focus();return}if(!W.value)return alert(De.value.wordHint.replace("$0",_[0].toString()).replace("$1",_[1].toString()).replace("$2",D.value.toString()));E.comment=tl(E.comment,$.value.map),n.replyId&&n.rootId&&(E.pid=n.replyId,E.rid=n.rootId,E.at=n.replyUser),ge.value=!0;try{y&&(E.recaptchaV3=await Vf(y).execute("social")),S&&(E.turnstile=await Bf(S).execute("social"));const U={serverURL:v,lang:b,token:(m=a.value)==null?void 0:m.token,comment:E},K=await(n.edit?qt({objectId:n.edit.objectId,...U}):Ir(U));if(ge.value=!1,K.errmsg)return alert(K.errmsg);r("submit",K.data),s.value="",H.value="",await Ut(),n.replyId&&r("cancelReply"),(w=n.edit)!=null&&w.objectId&&r("cancelEdit")}catch(U){ge.value=!1,alert(U.message)}},Cn=O=>{O.preventDefault();const{lang:j,serverURL:u}=o.value;Tr({serverURL:u,lang:j}).then(d=>{a.value=d,(d.remember?localStorage:sessionStorage).setItem("WALINE_USER",JSON.stringify(d)),r("log")})},kr=()=>{a.value={},localStorage.setItem("WALINE_USER","null"),sessionStorage.setItem("WALINE_USER","null"),r("log")},Ve=O=>{O.preventDefault();const{lang:j,serverURL:u}=o.value,d=800,m=800,w=(window.innerWidth-d)/2,v=(window.innerHeight-m)/2,b=new URLSearchParams({lng:j,token:a.value.token}),C=window.open(`${u}/ui/profile?${b.toString()}`,"_blank",`width=${d},height=${m},left=${w},top=${v},scrollbars=no,resizable=no,status=no,location=no,toolbar=no,menubar=no`);C==null||C.postMessage({type:"TOKEN",data:a.value.token},"*")},At=O=>{var j,u,d,m;!((j=p.value)!=null&&j.contains(O.target))&&!((u=g.value)!=null&&u.contains(O.target))&&(A.value=!1),!((d=R.value)!=null&&d.contains(O.target))&&!((m=x.value)!=null&&m.contains(O.target))&&(N.value=!1)},Bt=async O=>{var j;const{scrollTop:u,clientHeight:d,scrollHeight:m}=O.target,w=(d+u)/m,v=o.value.search,b=((j=T.value)==null?void 0:j.value)??"";w<.9||B.loading||mt.value||(B.loading=!0,(v.more&&B.list.length?await v.more(b,B.list.length):await v.search(b)).length?B.list=[...B.list,...v.more&&B.list.length?await v.more(b,B.list.length):await v.search(b)]:mt.value=!0,B.loading=!1,setTimeout(()=>{O.target.scrollTop=u},50))},bi=uu(O=>{B.list=[],mt.value=!1,Bt(O)},300);Pe([o,D],([O,j])=>{const{wordLimit:u}=O;u?j<u[0]&&u[0]!==0?(je.value=u[0],W.value=!1):j>u[1]?(je.value=u[1],W.value=!1):(je.value=u[1],W.value=!0):(je.value=0,W.value=!0)},{immediate:!0}),li("click",At),li("message",({data:O})=>{!O||O.type!=="profile"||(a.value={...a.value,...O.data},[localStorage,sessionStorage].filter(j=>j.getItem("WALINE_USER")).forEach(j=>j.setItem("WALINE_USER",JSON.stringify(a))))}),Pe(N,async O=>{var j;if(!O)return;const u=o.value.search;T.value&&(T.value.value=""),B.loading=!0,B.list=await(((j=u.default)==null?void 0:j.call(u))??u.search("")),B.loading=!1}),on(()=>{var O;(O=n.edit)!=null&&O.objectId&&(s.value=n.edit.orig),Pe(()=>s.value,j=>{const{highlighter:u,texRenderer:d}=o.value;ae.value=j,H.value=wf(j,{emojiMap:$.value.map,highlighter:u,texRenderer:d}),D.value=_f(j),j?ul(f.value):ul.destroy(f.value)},{immediate:!0}),Pe(()=>o.value.emoji,j=>Ru(j).then(u=>{$.value=u}),{immediate:!0})});const vt={props:n,emit:r,config:o,editor:s,userMeta:l,userInfo:a,inputRefs:c,editorRef:f,imageUploadRef:h,emojiButtonRef:p,emojiPopupRef:g,gifButtonRef:R,gifPopupRef:x,gifSearchInputRef:T,emoji:$,emojiTabIndex:P,showEmoji:A,showGif:N,showPreview:te,previewText:H,wordNumber:D,searchResults:B,wordLimit:je,isWordNumberLegal:W,content:ae,isSubmitting:ge,isImageListEnd:mt,locale:De,isLogin:q,canUploadImage:re,insert:me,onKeyDown:Se,uploadImage:ve,onDrop:Re,onPaste:we,onChange:Me,submitComment:Vt,onLogin:Cn,onLogout:kr,onProfile:Ve,popupHandler:At,onImageWallScroll:Bt,onGifSearch:bi,get CloseIcon(){return xf},get EmojiIcon(){return Ef},get GifIcon(){return $f},get ImageIcon(){return If},get LoadingIcon(){return mi},get MarkdownIcon(){return Tf},get PreviewIcon(){return Rf},ImageWall:cd};return Object.defineProperty(vt,"__isScriptSetup",{enumerable:!1,value:!0}),vt}});const fd={key:0,class:"wl-login-info"},dd={class:"wl-avatar"},hd=["title"],pd=["title"],gd=["src"],md=["title","textContent"],vd={class:"wl-panel"},wd=["for","textContent"],yd=["id","onUpdate:modelValue","name","type"],bd=["placeholder"],_d={class:"wl-preview"},kd=M("hr",null,null,-1),xd=["innerHTML"],Cd={class:"wl-footer"},Ed={class:"wl-actions"},Id={href:"https://guides.github.com/features/mastering-markdown/",title:"Markdown Guide","aria-label":"Markdown is supported",class:"wl-action",target:"_blank",rel:"noopener noreferrer"},Sd=["title"],Rd=["title"],Td=["title"],Ld=["title"],Ad={class:"wl-info"},Md=M("div",{class:"wl-captcha-container"},null,-1),$d={class:"wl-text-number"},Od={key:0},jd=["textContent"],zd=["textContent"],Pd=["disabled"],Ud=["placeholder"],Fd={key:1,class:"wl-loading"},Nd={key:0,class:"wl-tab-wrapper"},Hd=["title","onClick"],Dd=["src","alt"],Vd={key:0,class:"wl-tabs"},Bd=["onClick"],Wd=["src","alt","title"],qd=["title"];function Kd(e,t,i,n,r,o){var s,l;return I(),L("div",{key:n.userInfo.token,class:"wl-comment"},[n.config.login!=="disable"&&n.isLogin&&!((s=i.edit)!=null&&s.objectId)?(I(),L("div",fd,[M("div",dd,[M("button",{type:"submit",class:"wl-logout-btn",title:n.locale.logout,onClick:n.onLogout},[ne(n.CloseIcon,{size:14})],8,hd),M("a",{href:"#",class:"wl-login-nick","aria-label":"Profile",title:n.locale.profile,onClick:n.onProfile},[M("img",{src:n.userInfo.avatar,alt:"avatar"},null,8,gd)],8,pd)]),M("a",{href:"#",class:"wl-login-nick","aria-label":"Profile",title:n.locale.profile,onClick:n.onProfile,textContent:J(n.userInfo.display_name)},null,8,md)])):Q("v-if",!0),M("div",vd,[n.config.login!=="force"&&n.config.meta.length&&!n.isLogin?(I(),L("div",{key:0,class:pe(["wl-header",`item${n.config.meta.length}`])},[(I(!0),L(se,null,Ue(n.config.meta,a=>(I(),L("div",{key:a,class:"wl-header-item"},[M("label",{for:`wl-${a}`,textContent:J(n.locale[a]+(n.config.requiredMeta.includes(a)||!n.config.requiredMeta.length?"":`(${n.locale.optional})`))},null,8,wd),qn(M("input",{id:`wl-${a}`,ref_for:!0,ref:c=>{c&&(n.inputRefs[a]=c)},"onUpdate:modelValue":c=>n.userMeta[a]=c,class:pe(["wl-input",`wl-${a}`]),name:a,type:a==="mail"?"email":"text"},null,10,yd),[[Xc,n.userMeta[a]]])]))),128))],2)):Q("v-if",!0),qn(M("textarea",{id:"wl-edit",ref:"editorRef","onUpdate:modelValue":t[0]||(t[0]=a=>n.editor=a),class:"wl-editor",placeholder:i.replyUser?`@${i.replyUser}`:n.locale.placeholder,onKeydown:n.onKeyDown,onDrop:n.onDrop,onPaste:n.onPaste},null,40,bd),[[ur,n.editor]]),qn(M("div",_d,[kd,M("h4",null,J(n.locale.preview)+":",1),M("div",{class:"wl-content",innerHTML:n.previewText},null,8,xd)],512),[[hs,n.showPreview]]),M("div",Cd,[M("div",Ed,[M("a",Id,[ne(n.MarkdownIcon)]),qn(M("button",{ref:"emojiButtonRef",type:"button",class:pe(["wl-action",{active:n.showEmoji}]),title:n.locale.emoji,onClick:t[1]||(t[1]=a=>n.showEmoji=!n.showEmoji)},[ne(n.EmojiIcon)],10,Sd),[[hs,n.emoji.tabs.length]]),n.config.search?(I(),L("button",{key:0,ref:"gifButtonRef",type:"button",class:pe(["wl-action",{active:n.showGif}]),title:n.locale.gif,onClick:t[2]||(t[2]=a=>n.showGif=!n.showGif)},[ne(n.GifIcon)],10,Rd)):Q("v-if",!0),M("input",{id:"wl-image-upload",ref:"imageUploadRef",class:"upload",type:"file",accept:".png,.jpg,.jpeg,.webp,.bmp,.gif",onChange:n.onChange},null,544),n.canUploadImage?(I(),L("label",{key:1,for:"wl-image-upload",class:"wl-action",title:n.locale.uploadImage},[ne(n.ImageIcon)],8,Td)):Q("v-if",!0),M("button",{type:"button",class:pe(["wl-action",{active:n.showPreview}]),title:n.locale.preview,onClick:t[3]||(t[3]=a=>n.showPreview=!n.showPreview)},[ne(n.PreviewIcon)],10,Ld)]),M("div",Ad,[Md,M("div",$d,[tt(J(n.wordNumber)+" ",1),n.config.wordLimit?(I(),L("span",Od,[tt(" / "),M("span",{class:pe({illegal:!n.isWordNumberLegal}),textContent:J(n.wordLimit)},null,10,jd)])):Q("v-if",!0),tt(" "+J(n.locale.word),1)]),n.config.login!=="disable"&&!n.isLogin?(I(),L("button",{key:0,type:"button",class:"wl-btn",onClick:n.onLogin,textContent:J(n.locale.login)},null,8,zd)):Q("v-if",!0),n.config.login!=="force"||n.isLogin?(I(),L("button",{key:1,type:"submit",class:"primary wl-btn",title:"Cmd|Ctrl + Enter",disabled:n.isSubmitting,onClick:n.submitComment},[n.isSubmitting?(I(),et(n.LoadingIcon,{key:0,size:16})):(I(),L(se,{key:1},[tt(J(n.locale.submit),1)],64))],8,Pd)):Q("v-if",!0)]),M("div",{ref:"gifPopupRef",class:pe(["wl-gif-popup",{display:n.showGif}])},[M("input",{ref:"gifSearchInputRef",type:"text",placeholder:n.locale.gifSearchPlaceholder,onInput:t[4]||(t[4]=(...a)=>n.onGifSearch&&n.onGifSearch(...a))},null,40,Ud),n.searchResults.list.length?(I(),et(n.ImageWall,{key:0,items:n.searchResults.list,"column-width":200,gap:6,onInsert:t[5]||(t[5]=a=>n.insert(a)),onScroll:n.onImageWallScroll},null,8,["items"])):Q("v-if",!0),n.searchResults.loading?(I(),L("div",Fd,[ne(n.LoadingIcon,{size:30})])):Q("v-if",!0)],2),M("div",{ref:"emojiPopupRef",class:pe(["wl-emoji-popup",{display:n.showEmoji}])},[(I(!0),L(se,null,Ue(n.emoji.tabs,(a,c)=>(I(),L(se,{key:a.name},[c===n.emojiTabIndex?(I(),L("div",Nd,[(I(!0),L(se,null,Ue(a.items,f=>(I(),L("button",{key:f,type:"button",title:f,onClick:h=>n.insert(`:${f}:`)},[n.showEmoji?(I(),L("img",{key:0,class:"wl-emoji",src:n.emoji.map[f],alt:f,loading:"lazy",referrerPolicy:"no-referrer"},null,8,Dd)):Q("v-if",!0)],8,Hd))),128))])):Q("v-if",!0)],64))),128)),n.emoji.tabs.length>1?(I(),L("div",Vd,[(I(!0),L(se,null,Ue(n.emoji.tabs,(a,c)=>(I(),L("button",{key:a.name,type:"button",class:pe(["wl-tab",{active:n.emojiTabIndex===c}]),onClick:f=>n.emojiTabIndex=c},[M("img",{class:"wl-emoji",src:a.icon,alt:a.name,title:a.name,loading:"lazy",referrerPolicy:"no-referrer"},null,8,Wd)],10,Bd))),128))])):Q("v-if",!0)],2)])]),i.replyId||(l=i.edit)!=null&&l.objectId?(I(),L("button",{key:1,type:"button",class:"wl-close",title:n.locale.cancelReply,onClick:t[6]||(t[6]=a=>i.replyId?n.emit("cancelReply"):n.emit("cancelEdit"))},[ne(n.CloseIcon,{size:24})],8,qd)):Q("v-if",!0)])}var fl=bn(ud,[["render",Kd],["__file","CommentBox.vue"]]),Gd=rn({__name:"CommentCard",props:{comment:{},edit:{default:null},rootId:{},reply:{default:null}},emits:["log","submit","delete","edit","like","status","sticky","reply"],setup(e,{expose:t,emit:i}){t();const n=e,r=i,o=["approved","waiting","spam"],s=Zn("config"),l=rl(),a=ku(),c=wi(),f=_e(()=>s.value.locale),h=_e(()=>{const{link:A}=n.comment;return A?Kr(A)?A:`https://${A}`:""}),p=_e(()=>l.value.includes(n.comment.objectId)),g=_e(()=>Ul(new Date(n.comment.time),a.value,f.value)),R=_e(()=>c.value.type==="administrator"),x=_e(()=>n.comment.user_id&&c.value.objectId===n.comment.user_id),T=_e(()=>{var A;return n.comment.objectId===((A=n.reply)==null?void 0:A.objectId)}),$=_e(()=>{var A;return n.comment.objectId===((A=n.edit)==null?void 0:A.objectId)}),P={props:n,emit:r,commentStatus:o,config:s,likes:l,now:a,userInfo:c,locale:f,link:h,like:p,time:g,isAdmin:R,isOwner:x,isReplyingCurrent:T,isEditingCurrent:$,CommentBox:fl,get DeleteIcon(){return Cf},get EditIcon(){return Af},get LikeIcon(){return Sf},get ReplyIcon(){return Lf},get VerifiedIcon(){return Mf}};return Object.defineProperty(P,"__isScriptSetup",{enumerable:!1,value:!0}),P}});const Zd=["id"],Qd={class:"wl-user","aria-hidden":"true"},Jd=["src"],Yd={class:"wl-card"},Xd={class:"wl-head"},eh=["href"],th={key:1,class:"wl-nick"},nh=["textContent"],ih=["textContent"],rh=["textContent"],oh=["textContent"],sh=["textContent"],lh={class:"wl-comment-actions"},ah=["title"],ch=["title"],uh={class:"wl-meta","aria-hidden":"true"},fh=["data-value","textContent"],dh={key:0,class:"wl-content"},hh={key:0},ph=["href"],gh=M("span",null,": ",-1),mh=["innerHTML"],vh={key:1,class:"wl-admin-actions"},wh={class:"wl-comment-status"},yh=["disabled","onClick","textContent"],bh={key:3,class:"wl-quote"};function _h(e,t,i,n,r,o){var l;const s=Ua("CommentCard",!0);return I(),L("div",{id:i.comment.objectId,class:"wl-card-item"},[M("div",Qd,[i.comment.avatar?(I(),L("img",{key:0,class:"wl-user-avatar",src:i.comment.avatar},null,8,Jd)):Q("v-if",!0),i.comment.type?(I(),et(n.VerifiedIcon,{key:1})):Q("v-if",!0)]),M("div",Yd,[M("div",Xd,[n.link?(I(),L("a",{key:0,class:"wl-nick",href:n.link,target:"_blank",rel:"nofollow noopener noreferrer"},J(i.comment.nick),9,eh)):(I(),L("span",th,J(i.comment.nick),1)),i.comment.type==="administrator"?(I(),L("span",{key:2,class:"wl-badge",textContent:J(n.locale.admin)},null,8,nh)):Q("v-if",!0),i.comment.label?(I(),L("span",{key:3,class:"wl-badge",textContent:J(i.comment.label)},null,8,ih)):Q("v-if",!0),i.comment.sticky?(I(),L("span",{key:4,class:"wl-badge",textContent:J(n.locale.sticky)},null,8,rh)):Q("v-if",!0),typeof i.comment.level=="number"?(I(),L("span",{key:5,class:pe(`wl-badge level${i.comment.level}`),textContent:J(n.locale[`level${i.comment.level}`]||`Level ${i.comment.level}`)},null,10,oh)):Q("v-if",!0),M("span",{class:"wl-time",textContent:J(n.time)},null,8,sh),M("div",lh,[n.isAdmin||n.isOwner?(I(),L(se,{key:0},[M("button",{type:"button",class:"wl-edit",onClick:t[0]||(t[0]=a=>n.emit("edit",i.comment))},[ne(n.EditIcon)]),M("button",{type:"button",class:"wl-delete",onClick:t[1]||(t[1]=a=>n.emit("delete",i.comment))},[ne(n.DeleteIcon)])],64)):Q("v-if",!0),M("button",{type:"button",class:"wl-like",title:n.like?n.locale.cancelLike:n.locale.like,onClick:t[2]||(t[2]=a=>n.emit("like",i.comment))},[ne(n.LikeIcon,{active:n.like},null,8,["active"]),tt(" "+J("like"in i.comment?i.comment.like:""),1)],8,ah),M("button",{type:"button",class:pe(["wl-reply",{active:n.isReplyingCurrent}]),title:n.isReplyingCurrent?n.locale.cancelReply:n.locale.reply,onClick:t[3]||(t[3]=a=>n.emit("reply",n.isReplyingCurrent?null:i.comment))},[ne(n.ReplyIcon)],10,ch)])]),M("div",uh,[(I(),L(se,null,Ue(["addr","browser","os"],a=>(I(),L(se,null,[i.comment[a]?(I(),L("span",{key:a,class:pe(`wl-${a}`),"data-value":i.comment[a],textContent:J(i.comment[a])},null,10,fh)):Q("v-if",!0)],64))),64))]),n.isEditingCurrent?Q("v-if",!0):(I(),L("div",dh,[i.comment.reply_user?(I(),L("p",hh,[M("a",{href:"#"+i.comment.pid},"@"+J(i.comment.reply_user.nick),9,ph),gh])):Q("v-if",!0),M("div",{innerHTML:i.comment.comment},null,8,mh)])),n.isAdmin&&!n.isEditingCurrent?(I(),L("div",vh,[M("span",wh,[(I(),L(se,null,Ue(n.commentStatus,a=>M("button",{key:a,type:"submit",class:pe(`wl-btn wl-${a}`),disabled:i.comment.status===a,onClick:c=>n.emit("status",{status:a,comment:i.comment}),textContent:J(n.locale[a])},null,10,yh)),64))]),n.isAdmin&&!("rid"in i.comment)?(I(),L("button",{key:0,type:"submit",class:"wl-btn wl-sticky",onClick:t[4]||(t[4]=a=>n.emit("sticky",i.comment))},J(i.comment.sticky?n.locale.unsticky:n.locale.sticky),1)):Q("v-if",!0)])):Q("v-if",!0),n.isReplyingCurrent||n.isEditingCurrent?(I(),L("div",{key:2,class:pe({"wl-reply-wrapper":n.isReplyingCurrent,"wl-edit-wrapper":n.isEditingCurrent})},[ne(n.CommentBox,{edit:i.edit,"reply-id":(l=i.reply)==null?void 0:l.objectId,"reply-user":i.comment.nick,"root-id":i.rootId,onLog:t[5]||(t[5]=a=>n.emit("log")),onCancelReply:t[6]||(t[6]=a=>n.emit("reply",null)),onCancelEdit:t[7]||(t[7]=a=>n.emit("edit",null)),onSubmit:t[8]||(t[8]=a=>n.emit("submit",a))},null,8,["edit","reply-id","reply-user","root-id"])],2)):Q("v-if",!0),"children"in i.comment?(I(),L("div",bh,[(I(!0),L(se,null,Ue(i.comment.children,a=>(I(),et(s,{key:a.objectId,comment:a,reply:i.reply,edit:i.edit,"root-id":i.rootId,onLog:t[9]||(t[9]=c=>n.emit("log")),onDelete:t[10]||(t[10]=c=>n.emit("delete",c)),onEdit:t[11]||(t[11]=c=>n.emit("edit",c)),onLike:t[12]||(t[12]=c=>n.emit("like",c)),onReply:t[13]||(t[13]=c=>n.emit("reply",c)),onStatus:t[14]||(t[14]=c=>n.emit("status",c)),onSticky:t[15]||(t[15]=c=>n.emit("sticky",c)),onSubmit:t[16]||(t[16]=c=>n.emit("submit",c))},null,8,["comment","reply","edit","root-id"]))),128))])):Q("v-if",!0)])],8,Zd)}var kh=bn(Gd,[["render",_h],["__file","CommentCard.vue"]]);const dl="3.2.6";var xh=rn({__name:"WalineComment",props:["serverURL","path","meta","requiredMeta","dark","commentSorting","lang","locale","pageSize","wordLimit","emoji","login","highlighter","texRenderer","imageUploader","search","copyright","recaptchaV3Key","turnstileKey","reaction"],setup(e,{expose:t}){t();const i=e,n={latest:"insertedAt_desc",oldest:"insertedAt_asc",hottest:"like_desc"},r=Object.keys(n),o=wi(),s=rl(),l=V("loading"),a=V(0),c=V(1),f=V(0),h=_e(()=>jl(i)),p=V(h.value.commentSorting),g=V([]),R=V(null),x=V(null),T=_e(()=>zl(h.value.dark)),$=_e(()=>h.value.locale);Eu(T,{id:"waline-darkmode"});let P;const A=q=>{var re;const{serverURL:me,path:Se,pageSize:ve}=h.value,Re=new AbortController;l.value="loading",P==null||P(),Er({serverURL:me,lang:h.value.lang,path:Se,pageSize:ve,sortBy:n[p.value],page:q,signal:Re.signal,token:(re=o.value)==null?void 0:re.token}).then(we=>{l.value="success",a.value=we.count,g.value.push(...we.data),c.value=q,f.value=we.totalPages}).catch(we=>{we.name!=="AbortError"&&(console.error(we.message),l.value="error")}),P=Re.abort.bind(Re)},N=()=>A(c.value+1),te=()=>{a.value=0,g.value=[],A(1)},H=q=>{p.value!==q&&(p.value=q,te())},D=q=>{R.value=q},B=q=>{x.value=q},je=q=>{if(x.value)x.value.comment=q.comment,x.value.orig=q.orig;else if("rid"in q){const re=g.value.find(({objectId:me})=>me===q.rid);if(!re)return;Array.isArray(re.children)||(re.children=[]),re.children.push(q)}else g.value.unshift(q),a.value+=1},W=async({comment:q,status:re})=>{var me;if(q.status===re)return;const{serverURL:Se,lang:ve}=h.value;await qt({serverURL:Se,lang:ve,token:(me=o.value)==null?void 0:me.token,objectId:q.objectId,comment:{status:re}}),q.status=re},ae=async q=>{var re;if("rid"in q)return;const{serverURL:me,lang:Se}=h.value;await qt({serverURL:me,lang:Se,token:(re=o.value)==null?void 0:re.token,objectId:q.objectId,comment:{sticky:q.sticky?0:1}}),q.sticky=!q.sticky},ge=async({objectId:q})=>{var re;if(!confirm("Are you sure you want to delete this comment?"))return;const{serverURL:me,lang:Se}=h.value;await Sr({serverURL:me,lang:Se,token:(re=o.value)==null?void 0:re.token,objectId:q}),g.value.some((ve,Re)=>ve.objectId===q?(g.value=g.value.filter((we,Me)=>Me!==Re),!0):ve.children.some((we,Me)=>we.objectId===q?(g.value[Re].children=ve.children.filter((Vt,Cn)=>Cn!==Me),!0):!1))},mt=async q=>{var re;const{serverURL:me,lang:Se}=h.value,{objectId:ve}=q,Re=s.value.includes(ve);await qt({serverURL:me,lang:Se,objectId:ve,token:(re=o.value)==null?void 0:re.token,comment:{like:!Re}}),Re?s.value=s.value.filter(we=>we!==ve):(s.value=[...s.value,ve],s.value.length>50&&(s.value=s.value.slice(-50))),q.like=(q.like||0)+(Re?-1:1)};tc("config",h),on(()=>{Pe(()=>[i.serverURL,i.path],()=>te(),{immediate:!0})}),Qi(()=>P==null?void 0:P());const De={props:i,sortKeyMap:n,sortingMethods:r,userInfo:o,likeStorage:s,status:l,count:a,page:c,totalPages:f,config:h,commentSortingRef:p,data:g,reply:R,edit:x,darkmodeStyle:T,i18n:$,get abort(){return P},set abort(q){P=q},getCommentData:A,loadMore:N,refresh:te,onSortByChange:H,onReply:D,onEdit:B,onSubmit:je,onStatusChange:W,onSticky:ae,onDelete:ge,onLike:mt,Reaction:nd,CommentBox:fl,CommentCard:kh,get LoadingIcon(){return mi},get version(){return dl}};return Object.defineProperty(De,"__isScriptSetup",{enumerable:!1,value:!0}),De}});const Ch={"data-waline":""},Eh={class:"wl-meta-head"},Ih={class:"wl-count"},Sh=["textContent"],Rh={class:"wl-sort"},Th=["onClick"],Lh={class:"wl-cards"},Ah={key:1,class:"wl-operation"},Mh=["textContent"],$h={key:2,class:"wl-loading"},Oh=["textContent"],jh={key:4,class:"wl-operation"},zh=["textContent"],Ph={key:5,class:"wl-power"},Uh=M("a",{href:"https://github.com/walinejs/waline",target:"_blank",rel:"noopener noreferrer"}," Waline ",-1);function Fh(e,t,i,n,r,o){return I(),L("div",Ch,[ne(n.Reaction),n.reply?Q("v-if",!0):(I(),et(n.CommentBox,{key:0,onLog:n.refresh,onSubmit:n.onSubmit})),M("div",Eh,[M("div",Ih,[n.count?(I(),L("span",{key:0,class:"wl-num",textContent:J(n.count)},null,8,Sh)):Q("v-if",!0),tt(" "+J(n.i18n.comment),1)]),M("ul",Rh,[(I(!0),L(se,null,Ue(n.sortingMethods,s=>(I(),L("li",{key:s,class:pe([s===n.commentSortingRef?"active":""]),onClick:l=>n.onSortByChange(s)},J(n.i18n[s]),11,Th))),128))])]),M("div",Lh,[(I(!0),L(se,null,Ue(n.data,s=>(I(),et(n.CommentCard,{key:s.objectId,"root-id":s.objectId,comment:s,reply:n.reply,edit:n.edit,onLog:n.refresh,onReply:n.onReply,onEdit:n.onEdit,onSubmit:n.onSubmit,onStatus:n.onStatusChange,onDelete:n.onDelete,onSticky:n.onSticky,onLike:n.onLike},null,8,["root-id","comment","reply","edit"]))),128))]),n.status==="error"?(I(),L("div",Ah,[M("button",{type:"button",class:"wl-btn",onClick:n.refresh,textContent:J(n.i18n.refresh)},null,8,Mh)])):n.status==="loading"?(I(),L("div",$h,[ne(n.LoadingIcon,{size:30})])):n.data.length?n.page<n.totalPages?(I(),L("div",jh,[M("button",{type:"button",class:"wl-btn",onClick:n.loadMore,textContent:J(n.i18n.more)},null,8,zh)])):Q("v-if",!0):(I(),L("div",{key:3,class:"wl-empty",textContent:J(n.i18n.sofa)},null,8,Oh)),n.config.copyright?(I(),L("div",Ph,[tt(" Powered by "),Uh,tt(" v"+J(n.version),1)])):Q("v-if",!0)])}var Nh=bn(xh,[["render",Fh],["__file","WalineComment.vue"]]);const hl=(e,t)=>{t.forEach((i,n)=>{const r=e[n].time;typeof r=="number"&&(i.innerText=r.toString())})},pl=({serverURL:e,path:t=window.location.pathname,selector:i=".waline-pageview-count",update:n=!0,lang:r=navigator.language})=>{const o=new AbortController,s=Array.from(document.querySelectorAll(i)),l=c=>{const f=_r(c);return f!==null&&t!==f},a=c=>Lr({serverURL:Rn(e),paths:c.map(f=>_r(f)??t),lang:r,signal:o.signal}).then(f=>hl(f,c)).catch(As);if(n){const c=s.filter(h=>!l(h)),f=s.filter(l);Ar({serverURL:Rn(e),path:t,lang:r}).then(h=>hl(h,c)),f.length&&a(f)}else a(s);return o.abort.bind(o)},Hh=({el:e="#waline",path:t=window.location.pathname,comment:i=!1,pageview:n=!1,...r})=>{const o=e?dr(e):null;if(e&&!o)throw new Error("Option 'el' do not match any domElement!");if(!r.serverURL)throw new Error("Option 'serverURL' is missing!");const s=Qt({...r}),l=Qt({comment:i,pageview:n,path:t}),a=()=>{l.comment&&nl({serverURL:s.serverURL,path:l.path,...Mt(l.comment)?{selector:l.comment}:{}})},c=()=>{l.pageview&&pl({serverURL:s.serverURL,path:l.path,...Mt(l.pageview)?{selector:l.pageview}:{}})},f=o?iu(()=>X(Nh,{path:l.path,...s})):null;f&&f.mount(o);const h=Po(a),p=Po(c);return{el:o,update:({comment:g,pageview:R,path:x=window.location.pathname,...T}={})=>{Object.entries(T).forEach(([$,P])=>{s[$]=P}),l.path=x,g!==void 0&&(l.comment=g),R!==void 0&&(l.pageview=R)},destroy:()=>{f==null||f.unmount(),h(),p()}}},Dh=({el:e,serverURL:t,count:i,lang:n=navigator.language})=>{var r;const o=wi(),s=dr(e),l=new AbortController;return Mr({serverURL:t,count:i,lang:n,signal:l.signal,token:(r=o.value)==null?void 0:r.token}).then(a=>s&&a.length?(s.innerHTML=`<ul class="wl-recent-list">${a.map(c=>`<li class="wl-recent-item"><a href="${c.url}">${c.nick}</a>:${c.comment}</li>`).join("")}</ul>`,{comments:a,destroy:()=>{l.abort(),s.innerHTML=""}}):{comments:a,destroy:()=>l.abort()})},Vh=({el:e,serverURL:t,count:i,locale:n,lang:r=navigator.language,mode:o="list"})=>{const s=dr(e),l=new AbortController;return $r({serverURL:t,pageSize:i,lang:r,signal:l.signal}).then(a=>!s||!a.length?{users:a,destroy:()=>l.abort()}:(n={...Br(r),...typeof n=="object"?n:{}},s.innerHTML=`<ul class="wl-user-${o}">${a.map((c,f)=>[`<li class="wl-user-item" aria-label="${c.nick}">`,c.link&&`<a href="${c.link}" target="_blank">`,'<div class="wl-user-avatar">',`<img src="${c.avatar}" alt="${c.nick}">`,`<span class="wl-user-badge">${f+1}</span>`,"</div>",'<div class="wl-user-meta">','<div class="wl-user-name">',c.nick,c.level&&`<span class="wl-badge">${n?n[`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(h=>h).join("")).join("")}</ul>`,{users:a,destroy:()=>{l.abort(),s.innerHTML=""}}))};G.RecentComments=Dh,G.UserList=Vh,G.addComment=Ir,G.commentCount=nl,G.defaultLocales=Sn,G.deleteComment=Sr,G.fetchCommentCount=Rr,G.getArticleCounter=ki,G.getComment=Er,G.getPageview=Lr,G.getRecentComment=Mr,G.getUserList=$r,G.init=Hh,G.login=Tr,G.pageviewCount=pl,G.updateArticleCounter=In,G.updateComment=qt,G.updatePageview=Ar,G.version=dl});
|
|
73
73
|
//# sourceMappingURL=waline.umd.js.map
|