@waline/client
Advanced tools
Comparing version 3.5.4 to 3.5.5
@@ -1,2 +0,2 @@ | ||
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.4";export{v as commentCount,w as version}; | ||
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}; | ||
//# sourceMappingURL=comment.js.map |
@@ -442,3 +442,3 @@ import { DefineComponent, ComponentOptionsMixin, PublicProps, ComponentProvideOptions } from 'vue'; | ||
declare const _default: DefineComponent< | ||
declare const Waline: DefineComponent< | ||
WalineProps, | ||
@@ -465,3 +465,4 @@ {}, | ||
>; | ||
declare const version: string; | ||
export { _default as default }; | ||
export { Waline, version }; |
@@ -11,3 +11,3 @@ import{h as x,defineComponent as oe,inject as we,ref as R,computed as W,createElementBlock as s,createCommentVNode as $,onMounted as de,onUnmounted as je,openBlock as i,createElementVNode as u,toDisplayString as L,Fragment as B,renderList as Z,normalizeClass as P,createBlock as ee,unref as w,useTemplateRef as te,watch as ke,onBeforeUnmount as dt,normalizeStyle as ze,nextTick as Re,reactive as pt,createVNode as O,withDirectives as pe,vModelDynamic as gt,isRef as ht,vModelText as ft,vShow as Ve,createTextVNode as le,resolveComponent as yt,provide as wt}from"vue";import{useStorage as ne,useScriptTag as kt,watchImmediate as se,isDef as bt,useDebounceFn as Ct,useEventListener as Ue,useNow as $t,useStyleTag as It}from"@vueuse/core";import{getArticleCounter as Et,updateArticleCounter as _e,updateComment as ge,addComment as Lt,login as xt,deleteComment as Mt,getComment as At}from"@waline/api";import He from"autosize";import{Marked as St}from"marked";import{markedHighlight as jt}from"marked-highlight";import{load as zt}from"recaptcha-v3";const Te=({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"})]),Rt=()=>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"})),Vt=()=>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"})),Ut=()=>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"})]),_t=({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"})]),Ht=()=>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"})]),Tt=()=>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"})),Ft=()=>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"})),Nt=()=>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"})),Wt=()=>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"})),ce=({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"}))),Bt=()=>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"})]),Dt=()=>ne("WALINE_USER_META",{nick:"",mail:"",link:""}),Pt=()=>ne("WALINE_COMMENT_BOX_EDITOR",""),qt="WALINE_LIKE",Gt=ne(qt,[]),Fe=()=>Gt,Ot="WALINE_REACTION",Kt=ne(Ot,{}),Zt=()=>Kt,Ne={},Xt=e=>{const a=Ne[e]??(Ne[e]=zt(e,{useRecaptchaNet:!0,autoHideBadge:!0}));return{execute:t=>a.then(l=>l.execute(t))}},Yt=e=>({execute:async a=>{const{load:t}=kt("https://challenges.cloudflare.com/turnstile/v0/api.js",void 0,{async:!1});await t();const l=window.turnstile;return new Promise(r=>{l==null||l.ready(()=>{l.render(".wl-captcha-container",{sitekey:e,action:a,size:"compact",callback:r})})})}}),Jt="WALINE_USER",Qt=ne(Jt,{}),be=()=>Qt,el=["nick","mail","link"],We=e=>e.filter(a=>el.includes(a)),Be=["//unpkg.com/@waline/emojis@1.1.0/weibo"],tl=["//unpkg.com/@waline/emojis/tieba/tieba_agree.png","//unpkg.com/@waline/emojis/tieba/tieba_look_down.png","//unpkg.com/@waline/emojis/tieba/tieba_sunglasses.png","//unpkg.com/@waline/emojis/tieba/tieba_pick_nose.png","//unpkg.com/@waline/emojis/tieba/tieba_awkward.png","//unpkg.com/@waline/emojis/tieba/tieba_sleep.png"],ll=e=>new Promise((a,t)=>{if(e.size>128e3)return t(new Error("File too large! File size limit 128KB"));const l=new FileReader;l.readAsDataURL(e),l.onload=()=>a(l.result),l.onerror=t}),al=e=>e?'<p class="wl-tex">TeX is not available in preview</p>':'<span class="wl-tex">TeX is not available in preview</span>',nl=e=>{const a=async(t,l={})=>fetch(`https://api.giphy.com/v1/gifs/${t}?${new URLSearchParams({lang:e,limit:"20",rating:"g",api_key:"6CIMLkNMMOhRcXPoMCPkFy4Ybk2XUiMp",...l}).toString()}`).then(r=>r.json()).then(({data:r})=>r.map(d=>({title:d.title,src:d.images.downsized_medium.url})));return{search:t=>a("search",{q:t,offset:"0"}),default:()=>a("trending",{}),more:(t,l=0)=>a("search",{q:t,offset:l.toString()})}},il=/[\u4E00-\u9FFF\u3400-\u4dbf\uf900-\ufaff\u3040-\u309f\uac00-\ud7af\u0400-\u04FF]+|\w+/,rl=/</,ol=/(?:^|\s)\/\/(.+?)$/gm,sl=/\/\*([\S\s]*?)\*\//gm,cl=new RegExp(`(${il.source}|${rl.source})|((?:${ol.source})|(?:${sl.source}))`,"gmi"),De=["23AC69","91C132","F19726","E8552D","1AAB8E","E1147F","2980C1","1BA1E6","9FA0A0","F19726","E30B20","E30B20","A3338B"],Ce={},ul=e=>{let a=0;return e.replace(cl,(t,l,r)=>{if(r)return`<span style="color: slategray">${r}</span>`;if(l==="<")return"<";let d;Ce[l]?d=Ce[l]:(d=De[a],Ce[l]=d);const M=`<span style="color: #${d}">${l}</span>`;return a=++a%De.length,M})},ml=["nick","nickError","mail","mailError","link","optional","placeholder","sofa","submit","like","cancelLike","reply","cancelReply","comment","refresh","more","preview","emoji","uploadImage","seconds","minutes","hours","days","now","uploading","login","logout","admin","sticky","word","wordHint","anonymous","level0","level1","level2","level3","level4","level5","gif","gifSearchPlaceholder","profile","approved","waiting","spam","unsticky","oldest","latest","hottest","reactionTitle"],J=e=>Object.fromEntries(e.map((a,t)=>[ml[t],a]));var vl=J(["Benutzername","Der Benutzername darf nicht weniger als 3 Bytes umfassen.","E-Mail","Bitte bestätigen Sie Ihre E-Mail-Adresse.","Webseite","Optional","Kommentieren Sie hier...","Noch keine Kommentare.","Senden","Gefällt mir","Gefällt mir nicht mehr","Antworten","Antwort abbrechen","Kommentare","Aktualisieren","Mehr laden...","Vorschau","Emoji","Ein Bild hochladen","Vor einigen Sekunden","Vor einigen Minuten","Vor einigen Stunden","Vor einigen Tagen","Gerade eben","Hochladen läuft","Anmelden","Abmelden","Admin","Angeheftet","Wörter","Bitte geben Sie Kommentare zwischen $0 und $1 Wörtern ein! Aktuelle Anzahl der Wörter: $2","Anonym","Zwerge","Hobbits","Ents","Magier","Elfen","Maïar","GIF","Nach einem GIF suchen","Profil","Genehmigt","Ausstehend","Spam","Lösen","Älteste","Neueste","Am beliebtesten","Was denken Sie?"]),Pe=J(["NickName","NickName cannot be less than 3 bytes.","E-Mail","Please confirm your email address.","Website","Optional","Comment here...","No comment yet.","Submit","Like","Cancel like","Reply","Cancel reply","Comments","Refresh","Load More...","Preview","Emoji","Upload Image","seconds ago","minutes ago","hours ago","days ago","just now","Uploading","Login","logout","Admin","Sticky","Words",`Please input comments between $0 and $1 words! | ||
目前字數:$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 | ||
`)}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.4",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}; | ||
`)}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}; | ||
//# sourceMappingURL=component.js.map |
@@ -1,2 +0,2 @@ | ||
const v="3.5.4",$={"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}; | ||
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}; | ||
//# sourceMappingURL=pageview.js.map |
@@ -11,3 +11,3 @@ import{fetchCommentCount as Lt,getArticleCounter as Et,updateArticleCounter as Ve,updateComment as pe,addComment as It,login as At,deleteComment as Mt,getComment as xt,updatePageview as Rt,getPageview as St,getRecentComment as jt,getUserList as Ut}from"@waline/api";export*from"@waline/api";import{h as M,defineComponent as se,inject as $e,ref as z,computed as W,createElementBlock as u,createCommentVNode as I,onMounted as ge,onUnmounted as _e,openBlock as o,createElementVNode as p,toDisplayString as x,Fragment as B,renderList as Z,normalizeClass as P,createBlock as ee,unref as L,useTemplateRef as te,watch as Le,onBeforeUnmount as zt,normalizeStyle as He,nextTick as Te,reactive as Ee,createVNode as G,withDirectives as he,vModelDynamic as Vt,isRef as _t,vModelText as Ht,vShow as Fe,createTextVNode as ae,resolveComponent as Tt,provide as Ft,createApp as Nt,watchEffect as Ne}from"vue";import{useStorage as ne,useScriptTag as Wt,watchImmediate as ce,isDef as Bt,useDebounceFn as Dt,useEventListener as We,useNow as Pt,useStyleTag as qt}from"@vueuse/core";import Be from"autosize";import{Marked as Ot}from"marked";import{markedHighlight as Gt}from"marked-highlight";import{load as Kt}from"recaptcha-v3";const Zt=["nick","mail","link"],De=e=>e.filter(l=>Zt.includes(l)),Pe=["//unpkg.com/@waline/emojis@1.1.0/weibo"],Xt=["//unpkg.com/@waline/emojis/tieba/tieba_agree.png","//unpkg.com/@waline/emojis/tieba/tieba_look_down.png","//unpkg.com/@waline/emojis/tieba/tieba_sunglasses.png","//unpkg.com/@waline/emojis/tieba/tieba_pick_nose.png","//unpkg.com/@waline/emojis/tieba/tieba_awkward.png","//unpkg.com/@waline/emojis/tieba/tieba_sleep.png"],Yt=e=>new Promise((l,t)=>{if(e.size>128e3)return t(new Error("File too large! File size limit 128KB"));const a=new FileReader;a.readAsDataURL(e),a.onload=()=>l(a.result),a.onerror=t}),Jt=e=>e?'<p class="wl-tex">TeX is not available in preview</p>':'<span class="wl-tex">TeX is not available in preview</span>',Qt=e=>{const l=async(t,a={})=>fetch(`https://api.giphy.com/v1/gifs/${t}?${new URLSearchParams({lang:e,limit:"20",rating:"g",api_key:"6CIMLkNMMOhRcXPoMCPkFy4Ybk2XUiMp",...a}).toString()}`).then(n=>n.json()).then(({data:n})=>n.map(s=>({title:s.title,src:s.images.downsized_medium.url})));return{search:t=>l("search",{q:t,offset:"0"}),default:()=>l("trending",{}),more:(t,a=0)=>l("search",{q:t,offset:a.toString()})}},ea=/[\u4E00-\u9FFF\u3400-\u4dbf\uf900-\ufaff\u3040-\u309f\uac00-\ud7af\u0400-\u04FF]+|\w+/,ta=/</,aa=/(?:^|\s)\/\/(.+?)$/gm,la=/\/\*([\S\s]*?)\*\//gm,na=new RegExp(`(${ea.source}|${ta.source})|((?:${aa.source})|(?:${la.source}))`,"gmi"),qe=["23AC69","91C132","F19726","E8552D","1AAB8E","E1147F","2980C1","1BA1E6","9FA0A0","F19726","E30B20","E30B20","A3338B"],Ie={},ra=e=>{let l=0;return e.replace(na,(t,a,n)=>{if(n)return`<span style="color: slategray">${n}</span>`;if(a==="<")return"<";let s;Ie[a]?s=Ie[a]:(s=qe[l],Ie[a]=s);const h=`<span style="color: #${s}">${a}</span>`;return l=++l%qe.length,h})},oa=["nick","nickError","mail","mailError","link","optional","placeholder","sofa","submit","like","cancelLike","reply","cancelReply","comment","refresh","more","preview","emoji","uploadImage","seconds","minutes","hours","days","now","uploading","login","logout","admin","sticky","word","wordHint","anonymous","level0","level1","level2","level3","level4","level5","gif","gifSearchPlaceholder","profile","approved","waiting","spam","unsticky","oldest","latest","hottest","reactionTitle"],J=e=>Object.fromEntries(e.map((l,t)=>[oa[t],l]));var ia=J(["Benutzername","Der Benutzername darf nicht weniger als 3 Bytes umfassen.","E-Mail","Bitte bestätigen Sie Ihre E-Mail-Adresse.","Webseite","Optional","Kommentieren Sie hier...","Noch keine Kommentare.","Senden","Gefällt mir","Gefällt mir nicht mehr","Antworten","Antwort abbrechen","Kommentare","Aktualisieren","Mehr laden...","Vorschau","Emoji","Ein Bild hochladen","Vor einigen Sekunden","Vor einigen Minuten","Vor einigen Stunden","Vor einigen Tagen","Gerade eben","Hochladen läuft","Anmelden","Abmelden","Admin","Angeheftet","Wörter","Bitte geben Sie Kommentare zwischen $0 und $1 Wörtern ein! Aktuelle Anzahl der Wörter: $2","Anonym","Zwerge","Hobbits","Ents","Magier","Elfen","Maïar","GIF","Nach einem GIF suchen","Profil","Genehmigt","Ausstehend","Spam","Lösen","Älteste","Neueste","Am beliebtesten","Was denken Sie?"]),Oe=J(["NickName","NickName cannot be less than 3 bytes.","E-Mail","Please confirm your email address.","Website","Optional","Comment here...","No comment yet.","Submit","Like","Cancel like","Reply","Cancel reply","Comments","Refresh","Load More...","Preview","Emoji","Upload Image","seconds ago","minutes ago","hours ago","days ago","just now","Uploading","Login","logout","Admin","Sticky","Words",`Please input comments between $0 and $1 words! | ||
目前字數:$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 | ||
`)}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.4",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}; | ||
`)}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}; | ||
//# sourceMappingURL=slim.js.map |
{ | ||
"name": "@waline/client", | ||
"version": "3.5.4", | ||
"version": "3.5.5", | ||
"description": "client for waline comment system", | ||
@@ -5,0 +5,0 @@ "keywords": [ |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
3193847
3826