Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@waline/client

Package Overview
Dependencies
Maintainers
2
Versions
173
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@waline/client - npm Package Compare versions

Comparing version 3.0.0-alpha.6 to 3.0.0-alpha.7

2

dist/comment.umd.js

@@ -1,2 +0,2 @@

(function(o,r){typeof exports=="object"&&typeof module<"u"?r(exports):typeof define=="function"&&define.amd?define(["exports"],r):(o=typeof globalThis<"u"?globalThis:o||self,r(o.Waline={}))})(this,function(o){"use strict";const r=e=>`${e.replace(/\/?$/,"/")}api/`,l=(e,n="")=>{if(typeof e=="object"&&e.errno)throw new TypeError(`${n} failed with ${e.errno}: ${e.errmsg}`);return e},p=({serverURL:e,lang:n,paths:a,signal:s})=>fetch(`${r(e)}comment?type=count&url=${encodeURIComponent(a.join(","))}&lang=${n}`,{signal:s}).then(t=>t.json()).then(t=>l(t,"Get comment count").data),h=e=>{try{e=decodeURI(e)}catch{}return e},u=(e="")=>e.replace(/\/$/u,""),d=e=>/^(https?:)?\/\//.test(e),m=e=>{const n=u(e);return d(n)?n:`https://${n}`},f=e=>{e.name!=="AbortError"&&console.error(e.message)},g=e=>e.dataset.path||null,$=({serverURL:e,path:n=window.location.pathname,selector:a=".waline-comment-count",lang:s=navigator.language})=>{const t=new AbortController,c=document.querySelectorAll(a);return c.length&&p({serverURL:m(e),paths:Array.from(c).map(i=>h(g(i)||n)),lang:s,signal:t.signal}).then(i=>{c.forEach((v,w)=>{v.innerText=i[w].toString()})}).catch(f),t.abort.bind(t)},y="3.0.0-alpha.6";o.commentCount=$,o.version=y});
(function(o,r){typeof exports=="object"&&typeof module<"u"?r(exports):typeof define=="function"&&define.amd?define(["exports"],r):(o=typeof globalThis<"u"?globalThis:o||self,r(o.Waline={}))})(this,function(o){"use strict";const r=e=>`${e.replace(/\/?$/,"/")}api/`,l=(e,n="")=>{if(typeof e=="object"&&e.errno)throw new TypeError(`${n} failed with ${e.errno}: ${e.errmsg}`);return e},p=({serverURL:e,lang:n,paths:a,signal:s})=>fetch(`${r(e)}comment?type=count&url=${encodeURIComponent(a.join(","))}&lang=${n}`,{signal:s}).then(t=>t.json()).then(t=>l(t,"Get comment count").data),h=e=>{try{e=decodeURI(e)}catch{}return e},u=(e="")=>e.replace(/\/$/u,""),d=e=>/^(https?:)?\/\//.test(e),m=e=>{const n=u(e);return d(n)?n:`https://${n}`},f=e=>{e.name!=="AbortError"&&console.error(e.message)},g=e=>e.dataset.path||null,$=({serverURL:e,path:n=window.location.pathname,selector:a=".waline-comment-count",lang:s=navigator.language})=>{const t=new AbortController,c=document.querySelectorAll(a);return c.length&&p({serverURL:m(e),paths:Array.from(c).map(i=>h(g(i)||n)),lang:s,signal:t.signal}).then(i=>{c.forEach((v,w)=>{v.innerText=i[w].toString()})}).catch(f),t.abort.bind(t)},y="3.0.0-alpha.7";o.commentCount=$,o.version=y});
//# sourceMappingURL=comment.umd.js.map

@@ -8,3 +8,3 @@ import{h as R,defineComponent as ce,inject as be,ref as L,computed as N,onMounted as ge,watch as te,onUnmounted as Ce,openBlock as i,createElementBlock as s,createElementVNode as v,toDisplayString as _,Fragment as B,renderList as X,normalizeClass as q,createBlock as le,unref as w,createCommentVNode as x,onBeforeUnmount as pt,normalizeStyle as Pe,nextTick as gt,reactive as ht,createVNode as G,withDirectives as he,vModelDynamic as ft,isRef as yt,vModelText as wt,vShow as De,createTextVNode as ae,resolveComponent as kt,provide as bt}from"vue";import{useStorage as oe,useScriptTag as Ct,useDebounceFn as $t,useNow as Lt,useStyleTag as It}from"@vueuse/core";import{getArticleCounter as xt,updateArticleCounter as Oe,updateComment as fe,addComment as Et,login as Rt,deleteComment as _t,getComment as Mt}from"@waline/api";import qe from"autosize";import{Marked as St}from"marked";import{markedHighlight as jt}from"marked-highlight";import{load as At}from"recaptcha-v3";const Ke=({size:e})=>R("svg",{class:"wl-close-icon",viewBox:"0 0 1024 1024",width:e,height:e},[R("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"}),R("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"})]),zt=()=>R("svg",{viewBox:"0 0 1024 1024",width:"24",height:"24"},R("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"})),Ut=()=>R("svg",{viewBox:"0 0 1024 1024",width:"24",height:"24"},R("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"})),Vt=()=>R("svg",{viewBox:"0 0 1024 1024",width:"24",height:"24"},[R("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"}),R("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"})]),Ht=({active:e=!1})=>R("svg",{viewBox:"0 0 1024 1024",width:"24",height:"24"},[R("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"})]),Tt=()=>R("svg",{viewBox:"0 0 1024 1024",width:"24",height:"24"},[R("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"}),R("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"})]),Wt=()=>R("svg",{width:"16",height:"16",ariaHidden:"true"},R("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=()=>R("svg",{viewBox:"0 0 1024 1024",width:"24",height:"24"},R("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=()=>R("svg",{viewBox:"0 0 1024 1024",width:"24",height:"24"},R("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"})),Bt=()=>R("svg",{class:"verified-icon",viewBox:"0 0 1024 1024",width:"14",height:"14"},R("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})=>R("svg",{width:e,height:e,viewBox:"0 0 100 100",preserveAspectRatio:"xMidYMid"},R("circle",{cx:50,cy:50,fill:"none",stroke:"currentColor",strokeWidth:"4",r:"40","stroke-dasharray":"85 30"},R("animateTransform",{attributeName:"transform",type:"rotate",repeatCount:"indefinite",dur:"1s",values:"0 50 50;360 50 50",keyTimes:"0;1"}))),Pt=()=>R("svg",{width:24,height:24,fill:"currentcolor",viewBox:"0 0 24 24"},[R("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"}),R("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=()=>oe("WALINE_USER_META",{nick:"",mail:"",link:""}),Ot=()=>oe("WALINE_COMMENT_BOX_EDITOR",""),qt="WALINE_LIKE";let Ze=null;const Ge=()=>Ze||(Ze=oe(qt,[])),Kt="WALINE_REACTION";let Je=null;const Zt=()=>Je??(Je=oe(Kt,{})),Xe={},Gt=e=>{const a=Xe[e]??(Xe[e]=At(e,{useRecaptchaNet:!0,autoHideBadge:!0}));return{execute:t=>a.then(l=>l.execute(t))}},Jt=e=>({execute:async a=>{const{load:t}=Ct("https://challenges.cloudflare.com/turnstile/v0/api.js",void 0,{async:!1});await t();const l=window==null?void 0:window.turnstile;return new Promise(u=>{l==null||l.ready(()=>{l==null||l.render(".wl-captcha-container",{sitekey:e,action:a,size:"compact",callback:u})})})}}),Xt="WALINE_USER";let Ye=null;const $e=()=>Ye??(Ye=oe(Xt,{})),Yt={key:0,class:"wl-reaction"},Qt=["textContent"],el={class:"wl-reaction-list"},tl=["onClick"],ll={class:"wl-reaction-img"},al=["src","alt"],nl=["textContent"],il=["textContent"];var ol=ce({__name:"ArticleReaction",setup(e,{expose:a}){a();const t=Zt(),l=be("config"),u=L(-1),o=L([]),k=N(()=>l.value.locale),M=N(()=>l.value.reaction.length>0),b=N(()=>{const{reaction:m,path:S}=l.value;return m.map((A,$)=>({icon:A,desc:k.value[`reaction${$}`],active:t.value[S]===$}))});let I;const C=async()=>{if(M.value){const{serverURL:m,lang:S,path:A,reaction:$}=l.value,p=new AbortController;I=p.abort.bind(p);const n=await xt({serverURL:m,lang:S,paths:[A],type:$.map((d,W)=>`reaction${W}`),signal:p.signal});if(Array.isArray(n)||typeof n=="number")return;o.value=$.map((d,W)=>n[`reaction${W}`])}},V=async m=>{if(u.value===-1){const{serverURL:S,lang:A,path:$}=l.value,p=t.value[$];u.value=m,p!==void 0&&(await Oe({serverURL:S,lang:A,path:$,type:`reaction${p}`,action:"desc"}),o.value[p]=Math.max(o.value[p]-1,0)),p!==m&&(await Oe({serverURL:S,lang:A,path:$,type:`reaction${m}`}),o.value[m]=(o.value[m]||0)+1),p===m?delete t.value[$]:t.value[$]=m,u.value=-1}};return ge(()=>{te(()=>[l.value.serverURL,l.value.path],()=>{C()},{immediate:!0})}),Ce(()=>I==null?void 0:I()),(m,S)=>b.value.length?(i(),s("div",Yt,[v("div",{class:"wl-reaction-title",textContent:_(k.value.reactionTitle)},null,8,Qt),v("ul",el,[(i(!0),s(B,null,X(b.value,({active:A,icon:$,desc:p},n)=>(i(),s("li",{key:n,class:q(["wl-reaction-item",{active:A}]),onClick:d=>V(n)},[v("div",ll,[v("img",{src:$,alt:p},null,8,al),u.value===n?(i(),le(w(ue),{key:0,class:"wl-reaction-loading"})):(i(),s("div",{key:1,class:"wl-reaction-votes",textContent:_(o.value[n]||0)},null,8,nl))]),v("div",{class:"wl-reaction-text",textContent:_(p)},null,8,il)],10,tl))),128))])])):x("v-if",!0)}}),ve=(e,a)=>{const t=e.__vccOpts||e;for(const[l,u]of a)t[l]=u;return t},rl=ve(ol,[["__file","ArticleReaction.vue"]]);const sl=["data-index"],cl=["src","title","onClick"];var ul=ce({__name:"ImageWall",props:{items:{default:()=>[]},columnWidth:{default:300},gap:{default:0}},emits:["insert"],setup(e,{expose:a}){const t=e;a();let l=null;const u=L(null),o=L({}),k=L([]),M=()=>{const m=Math.floor((u.value.getBoundingClientRect().width+t.gap)/(t.columnWidth+t.gap));return m>0?m:1},b=m=>new Array(m).fill(null).map(()=>[]),I=async m=>{var S;if(m>=t.items.length)return;await gt();const A=Array.from(((S=u.value)==null?void 0:S.children)||[]).reduce(($,p)=>p.getBoundingClientRect().height<$.getBoundingClientRect().height?p:$);k.value[Number(A.dataset.index)].push(m),await I(m+1)},C=async(m=!1)=>{if(k.value.length===M()&&!m)return;k.value=b(M());const S=window.scrollY;await I(0),window.scrollTo({top:S})},V=m=>{o.value[m.target.src]=!0};return ge(()=>{C(!0),l=new ResizeObserver(()=>{C()}),l.observe(u.value),te(()=>[t.items],()=>{o.value={},C(!0)}),te(()=>[t.columnWidth,t.gap],()=>{C()})}),pt(()=>l.unobserve(u.value)),(m,S)=>(i(),s("div",{ref_key:"wall",ref:u,class:"wl-gallery",style:Pe({gap:`${m.gap}px`})},[(i(!0),s(B,null,X(k.value,(A,$)=>(i(),s("div",{key:$,class:"wl-gallery-column","data-index":$,style:Pe({gap:`${m.gap}px`})},[(i(!0),s(B,null,X(A,p=>(i(),s(B,{key:p},[o.value[m.items[p].src]?x("v-if",!0):(i(),le(w(ue),{key:0,size:36,style:{margin:"20px auto"}})),v("img",{class:"wl-gallery-item",src:m.items[p].src,title:m.items[p].title,loading:"lazy",onLoad:V,onClick:n=>m.$emit("insert",`![](${m.items[p].src})`)},null,40,cl)],64))),128))],12,sl))),128))],4))}}),vl=ve(ul,[["__file","ImageWall.vue"]]);const ml=e=>{try{e=decodeURI(e)}catch{}return e},Qe=(e="")=>e.replace(/\/$/u,""),et=e=>/^(https?:)?\/\//.test(e),dl=["nick","mail","link"],tt=e=>e.filter(a=>dl.includes(a)),lt=["//unpkg.com/@waline/emojis@1.1.0/weibo"],pl="en-US",gl=["//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"],hl=e=>new Promise((a,t)=>{if(e.size>128*1e3)return t(new Error("File too large! File size limit 128KB"));const l=new FileReader;l.readAsDataURL(e),l.onload=()=>{var u;return a(((u=l.result)==null?void 0:u.toString())||"")},l.onerror=t}),fl=e=>e===!0?'<p class="wl-tex">TeX is not available in preview</p>':'<span class="wl-tex">TeX is not available in preview</span>',yl=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(u=>u.json()).then(({data:u})=>u.map(o=>({title:o.title,src:o.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()})}},wl=/[\u4E00-\u9FFF\u3400-\u4dbf\uf900-\ufaff\u3040-\u309f\uac00-\ud7af\u0400-\u04FF]+|\w+/,kl=/</,bl=/(?:^|\s)\/\/(.+?)$/gm,Cl=/\/\*([\S\s]*?)\*\//gm,$l=new RegExp(`(${wl.source}|${kl.source})|((?:${bl.source})|(?:${Cl.source}))`,"gmi"),at=["23AC69","91C132","F19726","E8552D","1AAB8E","E1147F","2980C1","1BA1E6","9FA0A0","F19726","E30B20","E30B20","A3338B"],Le={},Ll=e=>{let a=0;return e.replace($l,(t,l,u)=>{if(u)return`<span style="color: slategray">${u}</span>`;if(l==="<")return"&lt;";let o;Le[l]?o=Le[l]:(o=at[a],Le[l]=o);const k=`<span style="color: #${o}">${l}</span>`;return a=++a%at.length,k})},Il=["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"],re=e=>Object.fromEntries(e.map((a,t)=>[Il[t],a]));var Ie=re(["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 Re={zh:Ee,"zh-cn":Ee,"zh-CN":Ee,"zh-tw":it,"zh-TW":it,en:Ie,"en-US":Ie,"en-us":Ie,jp:ye,ja:ye,"jp-jp":ye,"jp-JP":ye,"pt-br":nt,"pt-BR":nt,ru:xe,"ru-ru":xe,"ru-RU":xe},xl=e=>{const a=Qe(e);return et(a)?a:`https://${a}`},El=e=>Array.isArray(e)?e:e?[0,e]:!1,_e=(e,a)=>typeof e=="function"?e:e===!1?!1:a,Rl=({serverURL:e,path:a=location.pathname,lang:t=typeof navigator>"u"?"en-US":navigator.language,locale:l,emoji:u=lt,meta:o=["nick","mail","link"],requiredMeta:k=[],dark:M=!1,pageSize:b=10,wordLimit:I,imageUploader:C,highlighter:V,texRenderer:m,copyright:S=!0,login:A="enable",search:$,reaction:p,recaptchaV3Key:n="",turnstileKey:d="",commentSorting:W="latest",...P})=>({serverURL:xl(e),path:ml(a),locale:{...Re[t]||Re[pl],...typeof l=="object"?l:{}},wordLimit:El(I),meta:tt(o),requiredMeta:tt(k),imageUploader:_e(C,hl),highlighter:_e(V,Ll),texRenderer:_e(m,fl),lang:Object.keys(Re).includes(t)?t:"en-US",dark:M,emoji:typeof u=="boolean"?u?lt:[]:u,pageSize:b,login:A,copyright:S,search:$===!1?!1:typeof $=="object"?$:yl(t),recaptchaV3Key:n,turnstileKey:d,reaction:Array.isArray(p)?p:p===!0?gl:[],commentSorting:W,...P}),Me="{--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}",_l=e=>typeof e=="string"?e==="auto"?`@media(prefers-color-scheme:dark){body${Me}}`:`${e}${Me}`:e===!0?`:root${Me}`:"",Se=(e,a)=>{let t=e.toString();for(;t.length<a;)t="0"+t;return t},Ml=e=>{const a=Se(e.getDate(),2),t=Se(e.getMonth()+1,2);return`${Se(e.getFullYear(),2)}-${t}-${a}`},Sl=(e,a,t)=>{if(!e)return"";const l=typeof e=="string"?new Date(e.indexOf(" ")!==-1?e.replace(/-/g,"/"):e):e,u=a.getTime()-l.getTime(),o=Math.floor(u/(24*3600*1e3));if(o===0){const k=u%864e5,M=Math.floor(k/(3600*1e3));if(M===0){const b=k%36e5,I=Math.floor(b/(60*1e3));if(I===0){const C=b%6e4;return`${Math.round(C/1e3)} ${t.seconds}`}return`${I} ${t.minutes}`}return`${M} ${t.hours}`}return o<0?t.now:o<8?`${o} ${t.days}`:Ml(l)},jl=/^[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])?)*$/,Al=e=>jl.test(e),zl=e=>!!/@[0-9]+\.[0-9]+\.[0-9]+/.test(e),Ul=e=>{const a=oe("WALINE_EMOJI",{}),t=zl(e);if(t){const l=a.value[e];if(l)return Promise.resolve(l)}return fetch(`${e}/info.json`).then(l=>l.json()).then(l=>{const u={folder:e,...l};return t&&(a.value[e]=u),u})},ot=(e,a="",t="",l="")=>`${a?`${a}/`:""}${t}${e}${l?`.${l}`:""}`,Vl=e=>Promise.all(e.map(a=>typeof a=="string"?Ul(Qe(a)):Promise.resolve(a))).then(a=>{const t={tabs:[],map:{}};return a.forEach(l=>{const{name:u,folder:o,icon:k,prefix:M,type:b,items:I}=l;t.tabs.push({name:u,icon:ot(k,o,M,b),items:I.map(C=>{const V=`${M||""}${C}`;return t.map[V]=ot(C,o,M,b),V})})}),t}),Hl=e=>e.type.includes("image"),rt=e=>{const a=Array.from(e).find(Hl);return a?a.getAsFile():null},Tl=/\$.*?\$/,Wl=/^\$(.*?)\$/,Fl=/^(?:\s{0,3})\$\$((?:[^\n]|\n[^\n])+?)\n{0,1}\$\$/,Nl=e=>[{name:"blockMath",level:"block",tokenizer(a){const t=Fl.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(Tl);return t!==-1?t:a.length},tokenizer(a){const t=Wl.exec(a);if(t!==null)return{type:"html",raw:t[0],text:e(!1,t[1])}}}],st=(e="",a={})=>e.replace(/:(.+?):/g,(t,l)=>a[l]?`<img class="wl-emoji" src="${a[l]}" alt="${l}">`:t),Bl=(e,{emojiMap:a,highlighter:t,texRenderer:l})=>{const u=new St;if(u.setOptions({breaks:!0}),t&&u.use(jt({highlight:t})),l){const o=Nl(l);u.use({extensions:o})}return u.parse(st(e,a))},Pl=e=>e.match(/[\w\d\s,.\u00C0-\u024F\u0400-\u04FF]+/giu),Dl=e=>e.match(/[\u4E00-\u9FD5]/gu),Ol=e=>{var a,t;return(((a=Pl(e))==null?void 0:a.reduce((l,u)=>l+(["",",","."].includes(u.trim())?0:u.trim().split(/\s+/u).length),0))||0)+(((t=Dl(e))==null?void 0:t.length)||0)},ql=async()=>{if(!navigator)return"";const{userAgentData:e}=navigator;let a=navigator.userAgent;if(!e||e.platform!=="Windows")return a;const{platformVersion:t}=await e.getHighEntropyValues(["platformVersion"]);return t&&parseInt(t.split(".")[0])>=13&&(a=a.replace("Windows NT 10.0","Windows NT 11.0")),a},Kl={class:"wl-comment"},Zl={key:0,class:"wl-login-info"},Gl={class:"wl-avatar"},Jl=["title"],Xl=["title"],Yl=["src"],Ql=["title","textContent"],ea={class:"wl-panel"},ta=["for","textContent"],la=["id","onUpdate:modelValue","name","type"],aa=["placeholder"],na={class:"wl-preview"},ia=v("hr",null,null,-1),oa=["innerHTML"],ra={class:"wl-footer"},sa={class:"wl-actions"},ca={href:"https://guides.github.com/features/mastering-markdown/",title:"Markdown Guide","aria-label":"Markdown is supported",class:"wl-action",target:"_blank",rel:"noopener noreferrer"},ua=["title"],va=["title"],ma=["title"],da=["title"],pa={class:"wl-info"},ga=v("div",{class:"wl-captcha-container"},null,-1),ha={class:"wl-text-number"},fa={key:0},ya=["textContent"],wa=["textContent"],ka=["disabled"],ba=["placeholder"],Ca={key:1,class:"wl-loading"},$a={key:0,class:"wl-tab-wrapper"},La=["title","onClick"],Ia=["src","alt"],xa={key:0,class:"wl-tabs"},Ea=["onClick"],Ra=["src","alt","title"],_a=["title"];var Ma=ce({__name:"CommentBox",props:{edit:{default:null},rootId:{default:""},replyId:{default:""},replyUser:{default:""}},emits:["log","cancelEdit","cancelReply","submit"],setup(e,{expose:a,emit:t}){const l=e,u=t;a();const o=be("config"),k=Ot(),M=Dt(),b=$e(),I=L({}),C=L(null),V=L(null),m=L(null),S=L(null),A=L(null),$=L(null),p=L(null),n=L({tabs:[],map:{}}),d=L(0),W=L(!1),P=L(!1),E=L(!1),z=L(""),ie=L(0),H=ht({loading:!0,list:[]}),ne=L(0),ee=L(!1),me=L(""),Y=L(!1),y=L(!1),g=N(()=>o.value.locale),j=N(()=>{var c;return!!((c=b.value)!=null&&c.token)}),K=N(()=>o.value.imageUploader!==!1),D=c=>{const r=C.value,h=r.selectionStart,U=r.selectionEnd||0,f=r.scrollTop;k.value=r.value.substring(0,h)+c+r.value.substring(U,r.value.length),r.focus(),r.selectionStart=h+c.length,r.selectionEnd=h+c.length,r.scrollTop=f},J=c=>{const r=c.key;(c.ctrlKey||c.metaKey)&&r==="Enter"&&Ae()},Z=c=>{const r=`![${o.value.locale.uploading} ${c.name}]()`;return D(r),Y.value=!0,Promise.resolve().then(()=>o.value.imageUploader(c)).then(h=>{k.value=k.value.replace(r,`\r
![${c.name}](${h})`)}).catch(h=>{alert(h.message),k.value=k.value.replace(r,"")}).then(()=>{Y.value=!1})},se=c=>{var r;if((r=c.dataTransfer)!=null&&r.items){const h=rt(c.dataTransfer.items);h&&K.value&&(Z(h),c.preventDefault())}},je=c=>{if(c.clipboardData){const r=rt(c.clipboardData.items);r&&K.value&&Z(r)}},we=()=>{const c=V.value;c.files&&K.value&&Z(c.files[0]).then(()=>{c.value=""})},Ae=async()=>{var c,r,h,U,f,O;const{serverURL:F,lang:Q,login:de,wordLimit:We,requiredMeta:Fe,recaptchaV3Key:Ne,turnstileKey:Be}=o.value,dt=await ql(),T={comment:me.value,nick:M.value.nick,mail:M.value.mail,link:M.value.link,url:o.value.path,ua:dt};if((c=b.value)!=null&&c.token)T.nick=b.value.display_name,T.mail=b.value.email,T.link=b.value.url;else{if(de==="force")return;if(Fe.indexOf("nick")>-1&&!T.nick)return(r=I.value.nick)==null||r.focus(),alert(g.value.nickError);if(Fe.indexOf("mail")>-1&&!T.mail||T.mail&&!Al(T.mail))return(h=I.value.mail)==null||h.focus(),alert(g.value.mailError);T.nick||(T.nick=g.value.anonymous)}if(!T.comment){(U=C.value)==null||U.focus();return}if(!ee.value)return alert(g.value.wordHint.replace("$0",We[0].toString()).replace("$1",We[1].toString()).replace("$2",ie.value.toString()));T.comment=st(T.comment,n.value.map),l.replyId&&l.rootId&&(T.pid=l.replyId,T.rid=l.rootId,T.at=l.replyUser),Y.value=!0;try{Ne&&(T.recaptchaV3=await Gt(Ne).execute("social")),Be&&(T.turnstile=await Jt(Be).execute("social"));const pe={serverURL:F,lang:Q,token:(f=b.value)==null?void 0:f.token,comment:T},ke=await(l.edit?fe({objectId:l.edit.objectId,...pe}):Et(pe));if(Y.value=!1,ke.errmsg)return alert(ke.errmsg);u("submit",ke.data),k.value="",z.value="",l.replyId&&u("cancelReply"),(O=l.edit)!=null&&O.objectId&&u("cancelEdit")}catch(pe){Y.value=!1,alert(pe.message)}},vt=c=>{c.preventDefault();const{lang:r,serverURL:h}=o.value;Rt({serverURL:h,lang:r}).then(U=>{b.value=U,(U.remember?localStorage:sessionStorage).setItem("WALINE_USER",JSON.stringify(U)),u("log")})},mt=()=>{b.value={},localStorage.setItem("WALINE_USER","null"),sessionStorage.setItem("WALINE_USER","null"),u("log")},ze=c=>{c.preventDefault();const{lang:r,serverURL:h}=o.value,U=800,f=800,O=(window.innerWidth-U)/2,F=(window.innerHeight-f)/2,Q=new URLSearchParams({lng:r,token:b.value.token}),de=window.open(`${h}/ui/profile?${Q.toString()}`,"_blank",`width=${U},height=${f},left=${O},top=${F},scrollbars=no,resizable=no,status=no,location=no,toolbar=no,menubar=no`);de==null||de.postMessage({type:"TOKEN",data:b.value.token},"*")},Ue=c=>{var r,h,U,f;!((r=m.value)!=null&&r.contains(c.target))&&!((h=S.value)!=null&&h.contains(c.target))&&(W.value=!1),!((U=A.value)!=null&&U.contains(c.target))&&!((f=$.value)!=null&&f.contains(c.target))&&(P.value=!1)},Ve=async c=>{var r;const{scrollTop:h,clientHeight:U,scrollHeight:f}=c.target,O=(U+h)/f,F=o.value.search,Q=((r=p.value)==null?void 0:r.value)||"";O<.9||H.loading||y.value||(H.loading=!0,(F.more&&H.list.length?await F.more(Q,H.list.length):await F.search(Q)).length?H.list=[...H.list,...F.more&&H.list.length?await F.more(Q,H.list.length):await F.search(Q)]:y.value=!0,H.loading=!1,setTimeout(()=>{c.target.scrollTop=h},50))},He=$t(c=>{H.list=[],y.value=!1,Ve(c)},300);te([o,ie],([c,r])=>{const{wordLimit:h}=c;h?r<h[0]&&h[0]!==0?(ne.value=h[0],ee.value=!1):r>h[1]?(ne.value=h[1],ee.value=!1):(ne.value=h[1],ee.value=!0):(ne.value=0,ee.value=!0)},{immediate:!0});const Te=({data:c})=>{!c||c.type!=="profile"||(b.value={...b.value,...c.data},[localStorage,sessionStorage].filter(r=>r.getItem("WALINE_USER")).forEach(r=>r.setItem("WALINE_USER",JSON.stringify(b))))};return ge(()=>{var c;document.body.addEventListener("click",Ue),window.addEventListener("message",Te),(c=l.edit)!=null&&c.objectId&&(k.value=l.edit.orig),te(P,async r=>{if(!r)return;const h=o.value.search;p.value&&(p.value.value=""),H.loading=!0,H.list=h.default?await h.default():await h.search(""),H.loading=!1}),te(()=>k.value,r=>{const{highlighter:h,texRenderer:U}=o.value;me.value=r,z.value=Bl(r,{emojiMap:n.value.map,highlighter:h,texRenderer:U}),ie.value=Ol(r),r?qe(C.value):qe.destroy(C.value)},{immediate:!0}),te(()=>o.value.emoji,r=>Vl(r).then(h=>{n.value=h}),{immediate:!0})}),Ce(()=>{document.body.removeEventListener("click",Ue),window.removeEventListener("message",Te)}),(c,r)=>{var h,U;return i(),s("div",Kl,[w(o).login!=="disable"&&j.value&&!((h=c.edit)!=null&&h.objectId)?(i(),s("div",Zl,[v("div",Gl,[v("button",{type:"submit",class:"wl-logout-btn",title:g.value.logout,onClick:mt},[G(w(Ke),{size:14})],8,Jl),v("a",{href:"#",class:"wl-login-nick","aria-label":"Profile",title:g.value.profile,onClick:ze},[v("img",{src:w(b).avatar,alt:"avatar"},null,8,Yl)],8,Xl)]),v("a",{href:"#",class:"wl-login-nick","aria-label":"Profile",title:g.value.profile,onClick:ze,textContent:_(w(b).display_name)},null,8,Ql)])):x("v-if",!0),v("div",ea,[w(o).login!=="force"&&w(o).meta.length&&!j.value?(i(),s("div",{key:0,class:q(["wl-header",`item${w(o).meta.length}`])},[(i(!0),s(B,null,X(w(o).meta,f=>(i(),s("div",{key:f,class:"wl-header-item"},[v("label",{for:`wl-${f}`,textContent:_(g.value[f]+(w(o).requiredMeta.includes(f)||!w(o).requiredMeta.length?"":`(${g.value.optional})`))},null,8,ta),he(v("input",{id:`wl-${f}`,ref_for:!0,ref:O=>{O&&(I.value[f]=O)},"onUpdate:modelValue":O=>w(M)[f]=O,class:q(["wl-input",`wl-${f}`]),name:f,type:f==="mail"?"email":"text"},null,10,la),[[ft,w(M)[f]]])]))),128))],2)):x("v-if",!0),he(v("textarea",{id:"wl-edit",ref_key:"editorRef",ref:C,"onUpdate:modelValue":r[0]||(r[0]=f=>yt(k)?k.value=f:null),class:"wl-editor",placeholder:c.replyUser?`@${c.replyUser}`:g.value.placeholder,onKeydown:J,onDrop:se,onPaste:je},null,40,aa),[[wt,w(k)]]),he(v("div",na,[ia,v("h4",null,_(g.value.preview)+":",1),v("div",{class:"wl-content",innerHTML:z.value},null,8,oa)],512),[[De,E.value]]),v("div",ra,[v("div",sa,[v("a",ca,[G(w(Wt))]),he(v("button",{ref_key:"emojiButtonRef",ref:m,type:"button",class:q(["wl-action",{active:W.value}]),title:g.value.emoji,onClick:r[1]||(r[1]=f=>W.value=!W.value)},[G(w(Ut))],10,ua),[[De,n.value.tabs.length]]),w(o).search?(i(),s("button",{key:0,ref_key:"gifButtonRef",ref:A,type:"button",class:q(["wl-action",{active:P.value}]),title:g.value.gif,onClick:r[2]||(r[2]=f=>P.value=!P.value)},[G(w(Pt))],10,va)):x("v-if",!0),v("input",{id:"wl-image-upload",ref_key:"imageUploadRef",ref:V,class:"upload",type:"file",accept:".png,.jpg,.jpeg,.webp,.bmp,.gif",onChange:we},null,544),K.value?(i(),s("label",{key:1,for:"wl-image-upload",class:"wl-action",title:g.value.uploadImage},[G(w(Vt))],8,ma)):x("v-if",!0),v("button",{type:"button",class:q(["wl-action",{active:E.value}]),title:g.value.preview,onClick:r[3]||(r[3]=f=>E.value=!E.value)},[G(w(Tt))],10,da)]),v("div",pa,[ga,v("div",ha,[ae(_(ie.value)+" ",1),w(o).wordLimit?(i(),s("span",fa,[ae("  /  "),v("span",{class:q({illegal:!ee.value}),textContent:_(ne.value)},null,10,ya)])):x("v-if",!0),ae("  "+_(g.value.word),1)]),w(o).login!=="disable"&&!j.value?(i(),s("button",{key:0,type:"button",class:"wl-btn",onClick:vt,textContent:_(g.value.login)},null,8,wa)):x("v-if",!0),w(o).login!=="force"||j.value?(i(),s("button",{key:1,type:"submit",class:"primary wl-btn",title:"Cmd|Ctrl + Enter",disabled:Y.value,onClick:Ae},[Y.value?(i(),le(w(ue),{key:0,size:16})):(i(),s(B,{key:1},[ae(_(g.value.submit),1)],64))],8,ka)):x("v-if",!0)]),v("div",{ref_key:"gifPopupRef",ref:$,class:q(["wl-gif-popup",{display:P.value}])},[v("input",{ref_key:"gifSearchInputRef",ref:p,type:"text",placeholder:g.value.gifSearchPlaceholder,onInput:r[4]||(r[4]=(...f)=>w(He)&&w(He)(...f))},null,40,ba),H.list.length?(i(),le(vl,{key:0,items:H.list,"column-width":200,gap:6,onInsert:r[5]||(r[5]=f=>D(f)),onScroll:Ve},null,8,["items"])):x("v-if",!0),H.loading?(i(),s("div",Ca,[G(w(ue),{size:30})])):x("v-if",!0)],2),v("div",{ref_key:"emojiPopupRef",ref:S,class:q(["wl-emoji-popup",{display:W.value}])},[(i(!0),s(B,null,X(n.value.tabs,(f,O)=>(i(),s(B,{key:f.name},[O===d.value?(i(),s("div",$a,[(i(!0),s(B,null,X(f.items,F=>(i(),s("button",{key:F,type:"button",title:F,onClick:Q=>D(`:${F}:`)},[W.value?(i(),s("img",{key:0,class:"wl-emoji",src:n.value.map[F],alt:F,loading:"lazy",referrerPolicy:"no-referrer"},null,8,Ia)):x("v-if",!0)],8,La))),128))])):x("v-if",!0)],64))),128)),n.value.tabs.length>1?(i(),s("div",xa,[(i(!0),s(B,null,X(n.value.tabs,(f,O)=>(i(),s("button",{key:f.name,type:"button",class:q(["wl-tab",{active:d.value===O}]),onClick:F=>d.value=O},[v("img",{class:"wl-emoji",src:f.icon,alt:f.name,title:f.name,loading:"lazy",referrerPolicy:"no-referrer"},null,8,Ra)],10,Ea))),128))])):x("v-if",!0)],2)])]),c.replyId||(U=c.edit)!=null&&U.objectId?(i(),s("button",{key:1,type:"button",class:"wl-close",title:g.value.cancelReply,onClick:r[6]||(r[6]=f=>c.$emit(c.replyId?"cancelReply":"cancelEdit"))},[G(w(Ke),{size:24})],8,_a)):x("v-if",!0)])}}}),ct=ve(Ma,[["__file","CommentBox.vue"]]);const Sa=["id"],ja={class:"wl-user","aria-hidden":"true"},Aa=["src"],za={class:"wl-card"},Ua={class:"wl-head"},Va=["href"],Ha={key:1,class:"wl-nick"},Ta=["textContent"],Wa=["textContent"],Fa=["textContent"],Na=["textContent"],Ba=["textContent"],Pa={class:"wl-comment-actions"},Da=["title"],Oa=["title"],qa={class:"wl-meta","aria-hidden":"true"},Ka=["data-value","textContent"],Za=["innerHTML"],Ga={key:1,class:"wl-admin-actions"},Ja={class:"wl-comment-status"},Xa=["disabled","onClick","textContent"],Ya={key:3,class:"wl-quote"};var Qa=ce({__name:"CommentCard",props:{comment:{},edit:{default:null},rootId:{},reply:{default:null}},emits:["log","submit","delete","edit","like","status","sticky","reply"],setup(e,{emit:a}){const t=e,l=a,u=["approved","waiting","spam"],o=be("config"),k=Ge(),M=Lt(),b=$e(),I=N(()=>o.value.locale),C=N(()=>{const{link:n}=t.comment;return n?et(n)?n:`https://${n}`:""}),V=N(()=>k.value.includes(t.comment.objectId)),m=N(()=>Sl(t.comment.insertedAt,M.value,I.value)),S=N(()=>b.value.type==="administrator"),A=N(()=>t.comment.user_id&&b.value.objectId===t.comment.user_id),$=N(()=>{var n;return t.comment.objectId===((n=t.reply)==null?void 0:n.objectId)}),p=N(()=>{var n;return t.comment.objectId===((n=t.edit)==null?void 0:n.objectId)});return(n,d)=>{var W;const P=kt("CommentCard",!0);return i(),s("div",{id:n.comment.objectId,class:"wl-card-item"},[v("div",ja,[n.comment.avatar?(i(),s("img",{key:0,class:"wl-user-avatar",src:n.comment.avatar},null,8,Aa)):x("v-if",!0),n.comment.type?(i(),le(w(Bt),{key:1})):x("v-if",!0)]),v("div",za,[v("div",Ua,[C.value?(i(),s("a",{key:0,class:"wl-nick",href:C.value,target:"_blank",rel:"nofollow noopener noreferrer"},_(n.comment.nick),9,Va)):(i(),s("span",Ha,_(n.comment.nick),1)),n.comment.type==="administrator"?(i(),s("span",{key:2,class:"wl-badge",textContent:_(I.value.admin)},null,8,Ta)):x("v-if",!0),n.comment.label?(i(),s("span",{key:3,class:"wl-badge",textContent:_(n.comment.label)},null,8,Wa)):x("v-if",!0),n.comment.sticky?(i(),s("span",{key:4,class:"wl-badge",textContent:_(I.value.sticky)},null,8,Fa)):x("v-if",!0),typeof n.comment.level=="number"?(i(),s("span",{key:5,class:q(`wl-badge level${n.comment.level}`),textContent:_(I.value[`level${n.comment.level}`]||`Level ${n.comment.level}`)},null,10,Na)):x("v-if",!0),v("span",{class:"wl-time",textContent:_(m.value)},null,8,Ba),v("div",Pa,[S.value||A.value?(i(),s(B,{key:0},[v("button",{type:"button",class:"wl-edit",onClick:d[0]||(d[0]=E=>l("edit",n.comment))},[G(w(Nt))]),v("button",{type:"button",class:"wl-delete",onClick:d[1]||(d[1]=E=>l("delete",n.comment))},[G(w(zt))])],64)):x("v-if",!0),v("button",{type:"button",class:"wl-like",title:V.value?I.value.cancelLike:I.value.like,onClick:d[2]||(d[2]=E=>l("like",n.comment))},[G(w(Ht),{active:V.value},null,8,["active"]),ae(" "+_("like"in n.comment?n.comment.like:""),1)],8,Da),v("button",{type:"button",class:q(["wl-reply",{active:$.value}]),title:$.value?I.value.cancelReply:I.value.reply,onClick:d[3]||(d[3]=E=>l("reply",$.value?null:n.comment))},[G(w(Ft))],10,Oa)])]),v("div",qa,[(i(),s(B,null,X(["addr","browser","os"],E=>(i(),s(B,null,[n.comment[E]?(i(),s("span",{key:E,class:q(`wl-${E}`),"data-value":n.comment[E],textContent:_(n.comment[E])},null,10,Ka)):x("v-if",!0)],64))),64))]),p.value?x("v-if",!0):(i(),s("div",{key:0,class:"wl-content",innerHTML:n.comment.comment},null,8,Za)),S.value&&!p.value?(i(),s("div",Ga,[v("span",Ja,[(i(),s(B,null,X(u,E=>v("button",{key:E,type:"submit",class:q(`wl-btn wl-${E}`),disabled:n.comment.status===E,onClick:z=>l("status",{status:E,comment:n.comment}),textContent:_(I.value[E])},null,10,Xa)),64))]),S.value&&!("rid"in n.comment)?(i(),s("button",{key:0,type:"submit",class:"wl-btn wl-sticky",onClick:d[4]||(d[4]=E=>l("sticky",n.comment))},_(n.comment.sticky?I.value.unsticky:I.value.sticky),1)):x("v-if",!0)])):x("v-if",!0),$.value||p.value?(i(),s("div",{key:2,class:q({"wl-reply-wrapper":$.value,"wl-edit-wrapper":p.value})},[G(ct,{edit:n.edit,"reply-id":(W=n.reply)==null?void 0:W.objectId,"reply-user":n.comment.nick,"root-id":n.rootId,onLog:d[5]||(d[5]=E=>l("log")),onCancelReply:d[6]||(d[6]=E=>l("reply",null)),onCancelEdit:d[7]||(d[7]=E=>l("edit",null)),onSubmit:d[8]||(d[8]=E=>l("submit",E))},null,8,["edit","reply-id","reply-user","root-id"])],2)):x("v-if",!0),"children"in n.comment?(i(),s("div",Ya,[(i(!0),s(B,null,X(n.comment.children,E=>(i(),le(P,{key:E.objectId,comment:E,reply:n.reply,edit:n.edit,"root-id":n.rootId,onLog:d[9]||(d[9]=z=>l("log")),onDelete:d[10]||(d[10]=z=>l("delete",z)),onEdit:d[11]||(d[11]=z=>l("edit",z)),onLike:d[12]||(d[12]=z=>l("like",z)),onReply:d[13]||(d[13]=z=>l("reply",z)),onStatus:d[14]||(d[14]=z=>l("status",z)),onSticky:d[15]||(d[15]=z=>l("sticky",z)),onSubmit:d[16]||(d[16]=z=>l("submit",z))},null,8,["comment","reply","edit","root-id"]))),128))])):x("v-if",!0)])],8,Sa)}}}),en=ve(Qa,[["__file","CommentCard.vue"]]);const ut="3.0.0-alpha.6",tn={"data-waline":""},ln={class:"wl-meta-head"},an={class:"wl-count"},nn=["textContent"],on={class:"wl-sort"},rn=["onClick"],sn={class:"wl-cards"},cn={key:1,class:"wl-operation"},un=["textContent"],vn={key:2,class:"wl-loading"},mn=["textContent"],dn={key:4,class:"wl-operation"},pn=["textContent"],gn={key:5,class:"wl-power"},hn=v("a",{href:"https://github.com/walinejs/waline",target:"_blank",rel:"noopener noreferrer"}," Waline ",-1);var fn=ce({__name:"WalineComment",props:["serverURL","path","meta","requiredMeta","dark","commentSorting","lang","locale","pageSize","wordLimit","emoji","login","highlighter","texRenderer","imageUploader","search","copyright","recaptchaV3Key","turnstileKey","reaction"],setup(e){const a=e,t={latest:"insertedAt_desc",oldest:"insertedAt_asc",hottest:"like_desc"},l=Object.keys(t),u=$e(),o=Ge(),k=L("loading"),M=L(0),b=L(1),I=L(0),C=N(()=>Rl(a)),V=L(C.value.commentSorting),m=L([]),S=L(null),A=L(null),$=N(()=>_l(C.value.dark)),p=N(()=>C.value.locale);It($,{id:"waline-darkmode"});let n;const d=y=>{var g;const{serverURL:j,path:K,pageSize:D}=C.value,J=new AbortController;k.value="loading",n==null||n(),Mt({serverURL:j,lang:C.value.lang,path:K,pageSize:D,sortBy:t[V.value],page:y,signal:J.signal,token:(g=u.value)==null?void 0:g.token}).then(Z=>{k.value="success",M.value=Z.count,m.value.push(...Z.data),b.value=y,I.value=Z.totalPages}).catch(Z=>{Z.name!=="AbortError"&&(console.error(Z.message),k.value="error")}),n=J.abort.bind(J)},W=()=>d(b.value+1),P=()=>{M.value=0,m.value=[],d(1)},E=y=>{V.value!==y&&(V.value=y,P())},z=y=>{S.value=y},ie=y=>{A.value=y},H=y=>{if(A.value)A.value.comment=y.comment,A.value.orig=y.orig;else if("rid"in y){const g=m.value.find(({objectId:j})=>j===y.rid);if(!g)return;Array.isArray(g.children)||(g.children=[]),g.children.push(y)}else m.value.unshift(y),M.value+=1},ne=async({comment:y,status:g})=>{var j;if(y.status===g)return;const{serverURL:K,lang:D}=C.value;await fe({serverURL:K,lang:D,token:(j=u.value)==null?void 0:j.token,objectId:y.objectId,comment:{status:g}}),y.status=g},ee=async y=>{var g;if("rid"in y)return;const{serverURL:j,lang:K}=C.value;await fe({serverURL:j,lang:K,token:(g=u.value)==null?void 0:g.token,objectId:y.objectId,comment:{sticky:y.sticky?0:1}}),y.sticky=!y.sticky},me=async({objectId:y})=>{var g;if(!confirm("Are you sure you want to delete this comment?"))return;const{serverURL:j,lang:K}=C.value;await _t({serverURL:j,lang:K,token:(g=u.value)==null?void 0:g.token,objectId:y}),m.value.some((D,J)=>D.objectId===y?(m.value=m.value.filter((Z,se)=>se!==J),!0):D.children.some((Z,se)=>Z.objectId===y?(m.value[J].children=D.children.filter((je,we)=>we!==se),!0):!1))},Y=async y=>{var g;const{serverURL:j,lang:K}=C.value,{objectId:D}=y,J=o.value.includes(D);await fe({serverURL:j,lang:K,objectId:D,token:(g=u.value)==null?void 0:g.token,comment:{like:!J}}),J?o.value=o.value.filter(Z=>Z!==D):(o.value=[...o.value,D],o.value.length>50&&(o.value=o.value.slice(-50))),y.like=(y.like||0)+(J?-1:1)};return bt("config",C),ge(()=>{te(()=>[a.serverURL,a.path],()=>P(),{immediate:!0})}),Ce(()=>n==null?void 0:n()),(y,g)=>(i(),s("div",tn,[G(rl),S.value?x("v-if",!0):(i(),le(ct,{key:0,onLog:P,onSubmit:H})),v("div",ln,[v("div",an,[M.value?(i(),s("span",{key:0,class:"wl-num",textContent:_(M.value)},null,8,nn)):x("v-if",!0),ae(" "+_(p.value.comment),1)]),v("ul",on,[(i(!0),s(B,null,X(w(l),j=>(i(),s("li",{key:j,class:q([j===V.value?"active":""]),onClick:K=>E(j)},_(p.value[j]),11,rn))),128))])]),v("div",sn,[(i(!0),s(B,null,X(m.value,j=>(i(),le(en,{key:j.objectId,"root-id":j.objectId,comment:j,reply:S.value,edit:A.value,onLog:P,onReply:z,onEdit:ie,onSubmit:H,onStatus:ne,onDelete:me,onSticky:ee,onLike:Y},null,8,["root-id","comment","reply","edit"]))),128))]),k.value==="error"?(i(),s("div",cn,[v("button",{type:"button",class:"wl-btn",onClick:P,textContent:_(p.value.refresh)},null,8,un)])):k.value==="loading"?(i(),s("div",vn,[G(w(ue),{size:30})])):m.value.length?b.value<I.value?(i(),s("div",dn,[v("button",{type:"button",class:"wl-btn",onClick:W,textContent:_(p.value.more)},null,8,pn)])):x("v-if",!0):(i(),s("div",{key:3,class:"wl-empty",textContent:_(p.value.sofa)},null,8,mn)),C.value.copyright?(i(),s("div",gn,[ae(" Powered by "),hn,ae(" v"+_(w(ut)),1)])):x("v-if",!0)]))}}),yn=ve(fn,[["__file","WalineComment.vue"]]);export{yn as Waline,ut as version};
![${c.name}](${h})`)}).catch(h=>{alert(h.message),k.value=k.value.replace(r,"")}).then(()=>{Y.value=!1})},se=c=>{var r;if((r=c.dataTransfer)!=null&&r.items){const h=rt(c.dataTransfer.items);h&&K.value&&(Z(h),c.preventDefault())}},je=c=>{if(c.clipboardData){const r=rt(c.clipboardData.items);r&&K.value&&Z(r)}},we=()=>{const c=V.value;c.files&&K.value&&Z(c.files[0]).then(()=>{c.value=""})},Ae=async()=>{var c,r,h,U,f,O;const{serverURL:F,lang:Q,login:de,wordLimit:We,requiredMeta:Fe,recaptchaV3Key:Ne,turnstileKey:Be}=o.value,dt=await ql(),T={comment:me.value,nick:M.value.nick,mail:M.value.mail,link:M.value.link,url:o.value.path,ua:dt};if((c=b.value)!=null&&c.token)T.nick=b.value.display_name,T.mail=b.value.email,T.link=b.value.url;else{if(de==="force")return;if(Fe.indexOf("nick")>-1&&!T.nick)return(r=I.value.nick)==null||r.focus(),alert(g.value.nickError);if(Fe.indexOf("mail")>-1&&!T.mail||T.mail&&!Al(T.mail))return(h=I.value.mail)==null||h.focus(),alert(g.value.mailError);T.nick||(T.nick=g.value.anonymous)}if(!T.comment){(U=C.value)==null||U.focus();return}if(!ee.value)return alert(g.value.wordHint.replace("$0",We[0].toString()).replace("$1",We[1].toString()).replace("$2",ie.value.toString()));T.comment=st(T.comment,n.value.map),l.replyId&&l.rootId&&(T.pid=l.replyId,T.rid=l.rootId,T.at=l.replyUser),Y.value=!0;try{Ne&&(T.recaptchaV3=await Gt(Ne).execute("social")),Be&&(T.turnstile=await Jt(Be).execute("social"));const pe={serverURL:F,lang:Q,token:(f=b.value)==null?void 0:f.token,comment:T},ke=await(l.edit?fe({objectId:l.edit.objectId,...pe}):Et(pe));if(Y.value=!1,ke.errmsg)return alert(ke.errmsg);u("submit",ke.data),k.value="",z.value="",l.replyId&&u("cancelReply"),(O=l.edit)!=null&&O.objectId&&u("cancelEdit")}catch(pe){Y.value=!1,alert(pe.message)}},vt=c=>{c.preventDefault();const{lang:r,serverURL:h}=o.value;Rt({serverURL:h,lang:r}).then(U=>{b.value=U,(U.remember?localStorage:sessionStorage).setItem("WALINE_USER",JSON.stringify(U)),u("log")})},mt=()=>{b.value={},localStorage.setItem("WALINE_USER","null"),sessionStorage.setItem("WALINE_USER","null"),u("log")},ze=c=>{c.preventDefault();const{lang:r,serverURL:h}=o.value,U=800,f=800,O=(window.innerWidth-U)/2,F=(window.innerHeight-f)/2,Q=new URLSearchParams({lng:r,token:b.value.token}),de=window.open(`${h}/ui/profile?${Q.toString()}`,"_blank",`width=${U},height=${f},left=${O},top=${F},scrollbars=no,resizable=no,status=no,location=no,toolbar=no,menubar=no`);de==null||de.postMessage({type:"TOKEN",data:b.value.token},"*")},Ue=c=>{var r,h,U,f;!((r=m.value)!=null&&r.contains(c.target))&&!((h=S.value)!=null&&h.contains(c.target))&&(W.value=!1),!((U=A.value)!=null&&U.contains(c.target))&&!((f=$.value)!=null&&f.contains(c.target))&&(P.value=!1)},Ve=async c=>{var r;const{scrollTop:h,clientHeight:U,scrollHeight:f}=c.target,O=(U+h)/f,F=o.value.search,Q=((r=p.value)==null?void 0:r.value)||"";O<.9||H.loading||y.value||(H.loading=!0,(F.more&&H.list.length?await F.more(Q,H.list.length):await F.search(Q)).length?H.list=[...H.list,...F.more&&H.list.length?await F.more(Q,H.list.length):await F.search(Q)]:y.value=!0,H.loading=!1,setTimeout(()=>{c.target.scrollTop=h},50))},He=$t(c=>{H.list=[],y.value=!1,Ve(c)},300);te([o,ie],([c,r])=>{const{wordLimit:h}=c;h?r<h[0]&&h[0]!==0?(ne.value=h[0],ee.value=!1):r>h[1]?(ne.value=h[1],ee.value=!1):(ne.value=h[1],ee.value=!0):(ne.value=0,ee.value=!0)},{immediate:!0});const Te=({data:c})=>{!c||c.type!=="profile"||(b.value={...b.value,...c.data},[localStorage,sessionStorage].filter(r=>r.getItem("WALINE_USER")).forEach(r=>r.setItem("WALINE_USER",JSON.stringify(b))))};return ge(()=>{var c;document.body.addEventListener("click",Ue),window.addEventListener("message",Te),(c=l.edit)!=null&&c.objectId&&(k.value=l.edit.orig),te(P,async r=>{if(!r)return;const h=o.value.search;p.value&&(p.value.value=""),H.loading=!0,H.list=h.default?await h.default():await h.search(""),H.loading=!1}),te(()=>k.value,r=>{const{highlighter:h,texRenderer:U}=o.value;me.value=r,z.value=Bl(r,{emojiMap:n.value.map,highlighter:h,texRenderer:U}),ie.value=Ol(r),r?qe(C.value):qe.destroy(C.value)},{immediate:!0}),te(()=>o.value.emoji,r=>Vl(r).then(h=>{n.value=h}),{immediate:!0})}),Ce(()=>{document.body.removeEventListener("click",Ue),window.removeEventListener("message",Te)}),(c,r)=>{var h,U;return i(),s("div",Kl,[w(o).login!=="disable"&&j.value&&!((h=c.edit)!=null&&h.objectId)?(i(),s("div",Zl,[v("div",Gl,[v("button",{type:"submit",class:"wl-logout-btn",title:g.value.logout,onClick:mt},[G(w(Ke),{size:14})],8,Jl),v("a",{href:"#",class:"wl-login-nick","aria-label":"Profile",title:g.value.profile,onClick:ze},[v("img",{src:w(b).avatar,alt:"avatar"},null,8,Yl)],8,Xl)]),v("a",{href:"#",class:"wl-login-nick","aria-label":"Profile",title:g.value.profile,onClick:ze,textContent:_(w(b).display_name)},null,8,Ql)])):x("v-if",!0),v("div",ea,[w(o).login!=="force"&&w(o).meta.length&&!j.value?(i(),s("div",{key:0,class:q(["wl-header",`item${w(o).meta.length}`])},[(i(!0),s(B,null,X(w(o).meta,f=>(i(),s("div",{key:f,class:"wl-header-item"},[v("label",{for:`wl-${f}`,textContent:_(g.value[f]+(w(o).requiredMeta.includes(f)||!w(o).requiredMeta.length?"":`(${g.value.optional})`))},null,8,ta),he(v("input",{id:`wl-${f}`,ref_for:!0,ref:O=>{O&&(I.value[f]=O)},"onUpdate:modelValue":O=>w(M)[f]=O,class:q(["wl-input",`wl-${f}`]),name:f,type:f==="mail"?"email":"text"},null,10,la),[[ft,w(M)[f]]])]))),128))],2)):x("v-if",!0),he(v("textarea",{id:"wl-edit",ref_key:"editorRef",ref:C,"onUpdate:modelValue":r[0]||(r[0]=f=>yt(k)?k.value=f:null),class:"wl-editor",placeholder:c.replyUser?`@${c.replyUser}`:g.value.placeholder,onKeydown:J,onDrop:se,onPaste:je},null,40,aa),[[wt,w(k)]]),he(v("div",na,[ia,v("h4",null,_(g.value.preview)+":",1),v("div",{class:"wl-content",innerHTML:z.value},null,8,oa)],512),[[De,E.value]]),v("div",ra,[v("div",sa,[v("a",ca,[G(w(Wt))]),he(v("button",{ref_key:"emojiButtonRef",ref:m,type:"button",class:q(["wl-action",{active:W.value}]),title:g.value.emoji,onClick:r[1]||(r[1]=f=>W.value=!W.value)},[G(w(Ut))],10,ua),[[De,n.value.tabs.length]]),w(o).search?(i(),s("button",{key:0,ref_key:"gifButtonRef",ref:A,type:"button",class:q(["wl-action",{active:P.value}]),title:g.value.gif,onClick:r[2]||(r[2]=f=>P.value=!P.value)},[G(w(Pt))],10,va)):x("v-if",!0),v("input",{id:"wl-image-upload",ref_key:"imageUploadRef",ref:V,class:"upload",type:"file",accept:".png,.jpg,.jpeg,.webp,.bmp,.gif",onChange:we},null,544),K.value?(i(),s("label",{key:1,for:"wl-image-upload",class:"wl-action",title:g.value.uploadImage},[G(w(Vt))],8,ma)):x("v-if",!0),v("button",{type:"button",class:q(["wl-action",{active:E.value}]),title:g.value.preview,onClick:r[3]||(r[3]=f=>E.value=!E.value)},[G(w(Tt))],10,da)]),v("div",pa,[ga,v("div",ha,[ae(_(ie.value)+" ",1),w(o).wordLimit?(i(),s("span",fa,[ae("  /  "),v("span",{class:q({illegal:!ee.value}),textContent:_(ne.value)},null,10,ya)])):x("v-if",!0),ae("  "+_(g.value.word),1)]),w(o).login!=="disable"&&!j.value?(i(),s("button",{key:0,type:"button",class:"wl-btn",onClick:vt,textContent:_(g.value.login)},null,8,wa)):x("v-if",!0),w(o).login!=="force"||j.value?(i(),s("button",{key:1,type:"submit",class:"primary wl-btn",title:"Cmd|Ctrl + Enter",disabled:Y.value,onClick:Ae},[Y.value?(i(),le(w(ue),{key:0,size:16})):(i(),s(B,{key:1},[ae(_(g.value.submit),1)],64))],8,ka)):x("v-if",!0)]),v("div",{ref_key:"gifPopupRef",ref:$,class:q(["wl-gif-popup",{display:P.value}])},[v("input",{ref_key:"gifSearchInputRef",ref:p,type:"text",placeholder:g.value.gifSearchPlaceholder,onInput:r[4]||(r[4]=(...f)=>w(He)&&w(He)(...f))},null,40,ba),H.list.length?(i(),le(vl,{key:0,items:H.list,"column-width":200,gap:6,onInsert:r[5]||(r[5]=f=>D(f)),onScroll:Ve},null,8,["items"])):x("v-if",!0),H.loading?(i(),s("div",Ca,[G(w(ue),{size:30})])):x("v-if",!0)],2),v("div",{ref_key:"emojiPopupRef",ref:S,class:q(["wl-emoji-popup",{display:W.value}])},[(i(!0),s(B,null,X(n.value.tabs,(f,O)=>(i(),s(B,{key:f.name},[O===d.value?(i(),s("div",$a,[(i(!0),s(B,null,X(f.items,F=>(i(),s("button",{key:F,type:"button",title:F,onClick:Q=>D(`:${F}:`)},[W.value?(i(),s("img",{key:0,class:"wl-emoji",src:n.value.map[F],alt:F,loading:"lazy",referrerPolicy:"no-referrer"},null,8,Ia)):x("v-if",!0)],8,La))),128))])):x("v-if",!0)],64))),128)),n.value.tabs.length>1?(i(),s("div",xa,[(i(!0),s(B,null,X(n.value.tabs,(f,O)=>(i(),s("button",{key:f.name,type:"button",class:q(["wl-tab",{active:d.value===O}]),onClick:F=>d.value=O},[v("img",{class:"wl-emoji",src:f.icon,alt:f.name,title:f.name,loading:"lazy",referrerPolicy:"no-referrer"},null,8,Ra)],10,Ea))),128))])):x("v-if",!0)],2)])]),c.replyId||(U=c.edit)!=null&&U.objectId?(i(),s("button",{key:1,type:"button",class:"wl-close",title:g.value.cancelReply,onClick:r[6]||(r[6]=f=>c.$emit(c.replyId?"cancelReply":"cancelEdit"))},[G(w(Ke),{size:24})],8,_a)):x("v-if",!0)])}}}),ct=ve(Ma,[["__file","CommentBox.vue"]]);const Sa=["id"],ja={class:"wl-user","aria-hidden":"true"},Aa=["src"],za={class:"wl-card"},Ua={class:"wl-head"},Va=["href"],Ha={key:1,class:"wl-nick"},Ta=["textContent"],Wa=["textContent"],Fa=["textContent"],Na=["textContent"],Ba=["textContent"],Pa={class:"wl-comment-actions"},Da=["title"],Oa=["title"],qa={class:"wl-meta","aria-hidden":"true"},Ka=["data-value","textContent"],Za=["innerHTML"],Ga={key:1,class:"wl-admin-actions"},Ja={class:"wl-comment-status"},Xa=["disabled","onClick","textContent"],Ya={key:3,class:"wl-quote"};var Qa=ce({__name:"CommentCard",props:{comment:{},edit:{default:null},rootId:{},reply:{default:null}},emits:["log","submit","delete","edit","like","status","sticky","reply"],setup(e,{emit:a}){const t=e,l=a,u=["approved","waiting","spam"],o=be("config"),k=Ge(),M=Lt(),b=$e(),I=N(()=>o.value.locale),C=N(()=>{const{link:n}=t.comment;return n?et(n)?n:`https://${n}`:""}),V=N(()=>k.value.includes(t.comment.objectId)),m=N(()=>Sl(t.comment.insertedAt,M.value,I.value)),S=N(()=>b.value.type==="administrator"),A=N(()=>t.comment.user_id&&b.value.objectId===t.comment.user_id),$=N(()=>{var n;return t.comment.objectId===((n=t.reply)==null?void 0:n.objectId)}),p=N(()=>{var n;return t.comment.objectId===((n=t.edit)==null?void 0:n.objectId)});return(n,d)=>{var W;const P=kt("CommentCard",!0);return i(),s("div",{id:n.comment.objectId,class:"wl-card-item"},[v("div",ja,[n.comment.avatar?(i(),s("img",{key:0,class:"wl-user-avatar",src:n.comment.avatar},null,8,Aa)):x("v-if",!0),n.comment.type?(i(),le(w(Bt),{key:1})):x("v-if",!0)]),v("div",za,[v("div",Ua,[C.value?(i(),s("a",{key:0,class:"wl-nick",href:C.value,target:"_blank",rel:"nofollow noopener noreferrer"},_(n.comment.nick),9,Va)):(i(),s("span",Ha,_(n.comment.nick),1)),n.comment.type==="administrator"?(i(),s("span",{key:2,class:"wl-badge",textContent:_(I.value.admin)},null,8,Ta)):x("v-if",!0),n.comment.label?(i(),s("span",{key:3,class:"wl-badge",textContent:_(n.comment.label)},null,8,Wa)):x("v-if",!0),n.comment.sticky?(i(),s("span",{key:4,class:"wl-badge",textContent:_(I.value.sticky)},null,8,Fa)):x("v-if",!0),typeof n.comment.level=="number"?(i(),s("span",{key:5,class:q(`wl-badge level${n.comment.level}`),textContent:_(I.value[`level${n.comment.level}`]||`Level ${n.comment.level}`)},null,10,Na)):x("v-if",!0),v("span",{class:"wl-time",textContent:_(m.value)},null,8,Ba),v("div",Pa,[S.value||A.value?(i(),s(B,{key:0},[v("button",{type:"button",class:"wl-edit",onClick:d[0]||(d[0]=E=>l("edit",n.comment))},[G(w(Nt))]),v("button",{type:"button",class:"wl-delete",onClick:d[1]||(d[1]=E=>l("delete",n.comment))},[G(w(zt))])],64)):x("v-if",!0),v("button",{type:"button",class:"wl-like",title:V.value?I.value.cancelLike:I.value.like,onClick:d[2]||(d[2]=E=>l("like",n.comment))},[G(w(Ht),{active:V.value},null,8,["active"]),ae(" "+_("like"in n.comment?n.comment.like:""),1)],8,Da),v("button",{type:"button",class:q(["wl-reply",{active:$.value}]),title:$.value?I.value.cancelReply:I.value.reply,onClick:d[3]||(d[3]=E=>l("reply",$.value?null:n.comment))},[G(w(Ft))],10,Oa)])]),v("div",qa,[(i(),s(B,null,X(["addr","browser","os"],E=>(i(),s(B,null,[n.comment[E]?(i(),s("span",{key:E,class:q(`wl-${E}`),"data-value":n.comment[E],textContent:_(n.comment[E])},null,10,Ka)):x("v-if",!0)],64))),64))]),p.value?x("v-if",!0):(i(),s("div",{key:0,class:"wl-content",innerHTML:n.comment.comment},null,8,Za)),S.value&&!p.value?(i(),s("div",Ga,[v("span",Ja,[(i(),s(B,null,X(u,E=>v("button",{key:E,type:"submit",class:q(`wl-btn wl-${E}`),disabled:n.comment.status===E,onClick:z=>l("status",{status:E,comment:n.comment}),textContent:_(I.value[E])},null,10,Xa)),64))]),S.value&&!("rid"in n.comment)?(i(),s("button",{key:0,type:"submit",class:"wl-btn wl-sticky",onClick:d[4]||(d[4]=E=>l("sticky",n.comment))},_(n.comment.sticky?I.value.unsticky:I.value.sticky),1)):x("v-if",!0)])):x("v-if",!0),$.value||p.value?(i(),s("div",{key:2,class:q({"wl-reply-wrapper":$.value,"wl-edit-wrapper":p.value})},[G(ct,{edit:n.edit,"reply-id":(W=n.reply)==null?void 0:W.objectId,"reply-user":n.comment.nick,"root-id":n.rootId,onLog:d[5]||(d[5]=E=>l("log")),onCancelReply:d[6]||(d[6]=E=>l("reply",null)),onCancelEdit:d[7]||(d[7]=E=>l("edit",null)),onSubmit:d[8]||(d[8]=E=>l("submit",E))},null,8,["edit","reply-id","reply-user","root-id"])],2)):x("v-if",!0),"children"in n.comment?(i(),s("div",Ya,[(i(!0),s(B,null,X(n.comment.children,E=>(i(),le(P,{key:E.objectId,comment:E,reply:n.reply,edit:n.edit,"root-id":n.rootId,onLog:d[9]||(d[9]=z=>l("log")),onDelete:d[10]||(d[10]=z=>l("delete",z)),onEdit:d[11]||(d[11]=z=>l("edit",z)),onLike:d[12]||(d[12]=z=>l("like",z)),onReply:d[13]||(d[13]=z=>l("reply",z)),onStatus:d[14]||(d[14]=z=>l("status",z)),onSticky:d[15]||(d[15]=z=>l("sticky",z)),onSubmit:d[16]||(d[16]=z=>l("submit",z))},null,8,["comment","reply","edit","root-id"]))),128))])):x("v-if",!0)])],8,Sa)}}}),en=ve(Qa,[["__file","CommentCard.vue"]]);const ut="3.0.0-alpha.7",tn={"data-waline":""},ln={class:"wl-meta-head"},an={class:"wl-count"},nn=["textContent"],on={class:"wl-sort"},rn=["onClick"],sn={class:"wl-cards"},cn={key:1,class:"wl-operation"},un=["textContent"],vn={key:2,class:"wl-loading"},mn=["textContent"],dn={key:4,class:"wl-operation"},pn=["textContent"],gn={key:5,class:"wl-power"},hn=v("a",{href:"https://github.com/walinejs/waline",target:"_blank",rel:"noopener noreferrer"}," Waline ",-1);var fn=ce({__name:"WalineComment",props:["serverURL","path","meta","requiredMeta","dark","commentSorting","lang","locale","pageSize","wordLimit","emoji","login","highlighter","texRenderer","imageUploader","search","copyright","recaptchaV3Key","turnstileKey","reaction"],setup(e){const a=e,t={latest:"insertedAt_desc",oldest:"insertedAt_asc",hottest:"like_desc"},l=Object.keys(t),u=$e(),o=Ge(),k=L("loading"),M=L(0),b=L(1),I=L(0),C=N(()=>Rl(a)),V=L(C.value.commentSorting),m=L([]),S=L(null),A=L(null),$=N(()=>_l(C.value.dark)),p=N(()=>C.value.locale);It($,{id:"waline-darkmode"});let n;const d=y=>{var g;const{serverURL:j,path:K,pageSize:D}=C.value,J=new AbortController;k.value="loading",n==null||n(),Mt({serverURL:j,lang:C.value.lang,path:K,pageSize:D,sortBy:t[V.value],page:y,signal:J.signal,token:(g=u.value)==null?void 0:g.token}).then(Z=>{k.value="success",M.value=Z.count,m.value.push(...Z.data),b.value=y,I.value=Z.totalPages}).catch(Z=>{Z.name!=="AbortError"&&(console.error(Z.message),k.value="error")}),n=J.abort.bind(J)},W=()=>d(b.value+1),P=()=>{M.value=0,m.value=[],d(1)},E=y=>{V.value!==y&&(V.value=y,P())},z=y=>{S.value=y},ie=y=>{A.value=y},H=y=>{if(A.value)A.value.comment=y.comment,A.value.orig=y.orig;else if("rid"in y){const g=m.value.find(({objectId:j})=>j===y.rid);if(!g)return;Array.isArray(g.children)||(g.children=[]),g.children.push(y)}else m.value.unshift(y),M.value+=1},ne=async({comment:y,status:g})=>{var j;if(y.status===g)return;const{serverURL:K,lang:D}=C.value;await fe({serverURL:K,lang:D,token:(j=u.value)==null?void 0:j.token,objectId:y.objectId,comment:{status:g}}),y.status=g},ee=async y=>{var g;if("rid"in y)return;const{serverURL:j,lang:K}=C.value;await fe({serverURL:j,lang:K,token:(g=u.value)==null?void 0:g.token,objectId:y.objectId,comment:{sticky:y.sticky?0:1}}),y.sticky=!y.sticky},me=async({objectId:y})=>{var g;if(!confirm("Are you sure you want to delete this comment?"))return;const{serverURL:j,lang:K}=C.value;await _t({serverURL:j,lang:K,token:(g=u.value)==null?void 0:g.token,objectId:y}),m.value.some((D,J)=>D.objectId===y?(m.value=m.value.filter((Z,se)=>se!==J),!0):D.children.some((Z,se)=>Z.objectId===y?(m.value[J].children=D.children.filter((je,we)=>we!==se),!0):!1))},Y=async y=>{var g;const{serverURL:j,lang:K}=C.value,{objectId:D}=y,J=o.value.includes(D);await fe({serverURL:j,lang:K,objectId:D,token:(g=u.value)==null?void 0:g.token,comment:{like:!J}}),J?o.value=o.value.filter(Z=>Z!==D):(o.value=[...o.value,D],o.value.length>50&&(o.value=o.value.slice(-50))),y.like=(y.like||0)+(J?-1:1)};return bt("config",C),ge(()=>{te(()=>[a.serverURL,a.path],()=>P(),{immediate:!0})}),Ce(()=>n==null?void 0:n()),(y,g)=>(i(),s("div",tn,[G(rl),S.value?x("v-if",!0):(i(),le(ct,{key:0,onLog:P,onSubmit:H})),v("div",ln,[v("div",an,[M.value?(i(),s("span",{key:0,class:"wl-num",textContent:_(M.value)},null,8,nn)):x("v-if",!0),ae(" "+_(p.value.comment),1)]),v("ul",on,[(i(!0),s(B,null,X(w(l),j=>(i(),s("li",{key:j,class:q([j===V.value?"active":""]),onClick:K=>E(j)},_(p.value[j]),11,rn))),128))])]),v("div",sn,[(i(!0),s(B,null,X(m.value,j=>(i(),le(en,{key:j.objectId,"root-id":j.objectId,comment:j,reply:S.value,edit:A.value,onLog:P,onReply:z,onEdit:ie,onSubmit:H,onStatus:ne,onDelete:me,onSticky:ee,onLike:Y},null,8,["root-id","comment","reply","edit"]))),128))]),k.value==="error"?(i(),s("div",cn,[v("button",{type:"button",class:"wl-btn",onClick:P,textContent:_(p.value.refresh)},null,8,un)])):k.value==="loading"?(i(),s("div",vn,[G(w(ue),{size:30})])):m.value.length?b.value<I.value?(i(),s("div",dn,[v("button",{type:"button",class:"wl-btn",onClick:W,textContent:_(p.value.more)},null,8,pn)])):x("v-if",!0):(i(),s("div",{key:3,class:"wl-empty",textContent:_(p.value.sofa)},null,8,mn)),C.value.copyright?(i(),s("div",gn,[ae(" Powered by "),hn,ae(" v"+_(w(ut)),1)])):x("v-if",!0)]))}}),yn=ve(fn,[["__file","WalineComment.vue"]]);export{yn as Waline,ut as version};
//# sourceMappingURL=component.js.map

@@ -1,2 +0,2 @@

const u="3.0.0-alpha.6",v={"Content-Type":"application/json"},g=e=>`${e.replace(/\/?$/,"/")}api/`,$=(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:a,signal:n})=>fetch(`${g(e)}article?path=${encodeURIComponent(r.join(","))}&type=${encodeURIComponent(a.join(","))}&lang=${t}`,{signal:n}).then(o=>o.json()),R=({serverURL:e,lang:t,path:r,type:a,action:n})=>fetch(`${g(e)}article?lang=${t}`,{method:"POST",headers:v,body:JSON.stringify({path:r,type:a,action:n})}).then(o=>o.json()).then(o=>$(o,"Update counter").data),U=({serverURL:e,lang:t,paths:r,signal:a})=>f({serverURL:e,lang:t,paths:r,type:["time"],signal:a}).then(n=>Array.isArray(n)?n:[n]),w=e=>R({...e,type:"time",action:"inc"}),L=(e="")=>e.replace(/\/$/u,""),A=e=>/^(https?:)?\/\//.test(e),y=e=>{const t=L(e);return A(t)?t:`https://${t}`},b=e=>{e.name!=="AbortError"&&console.error(e.message)},d=e=>e.dataset.path||null,m=(e,t)=>{t.forEach((r,a)=>{r.innerText=e[a].toString()})},j=({serverURL:e,path:t=window.location.pathname,selector:r=".waline-pageview-count",update:a=!0,lang:n=navigator.language})=>{const o=new AbortController,i=Array.from(document.querySelectorAll(r)),c=l=>{const s=d(l);return s!==null&&t!==s},h=l=>U({serverURL:y(e),paths:l.map(s=>d(s)||t),lang:n,signal:o.signal}).then(s=>m(s,l)).catch(b);if(a){const l=i.filter(p=>!c(p)),s=i.filter(c);w({serverURL:y(e),path:t,lang:n}).then(([p])=>m(new Array(l.length).fill(p),l)),s.length&&h(s)}else h(i);return o.abort.bind(o)};export{j as pageviewCount,u as version};
const u="3.0.0-alpha.7",v={"Content-Type":"application/json"},g=e=>`${e.replace(/\/?$/,"/")}api/`,$=(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:a,signal:n})=>fetch(`${g(e)}article?path=${encodeURIComponent(r.join(","))}&type=${encodeURIComponent(a.join(","))}&lang=${t}`,{signal:n}).then(o=>o.json()),R=({serverURL:e,lang:t,path:r,type:a,action:n})=>fetch(`${g(e)}article?lang=${t}`,{method:"POST",headers:v,body:JSON.stringify({path:r,type:a,action:n})}).then(o=>o.json()).then(o=>$(o,"Update counter").data),U=({serverURL:e,lang:t,paths:r,signal:a})=>f({serverURL:e,lang:t,paths:r,type:["time"],signal:a}).then(n=>Array.isArray(n)?n:[n]),w=e=>R({...e,type:"time",action:"inc"}),L=(e="")=>e.replace(/\/$/u,""),A=e=>/^(https?:)?\/\//.test(e),y=e=>{const t=L(e);return A(t)?t:`https://${t}`},b=e=>{e.name!=="AbortError"&&console.error(e.message)},d=e=>e.dataset.path||null,m=(e,t)=>{t.forEach((r,a)=>{r.innerText=e[a].toString()})},j=({serverURL:e,path:t=window.location.pathname,selector:r=".waline-pageview-count",update:a=!0,lang:n=navigator.language})=>{const o=new AbortController,i=Array.from(document.querySelectorAll(r)),c=l=>{const s=d(l);return s!==null&&t!==s},h=l=>U({serverURL:y(e),paths:l.map(s=>d(s)||t),lang:n,signal:o.signal}).then(s=>m(s,l)).catch(b);if(a){const l=i.filter(p=>!c(p)),s=i.filter(c);w({serverURL:y(e),path:t,lang:n}).then(([p])=>m(new Array(l.length).fill(p),l)),s.length&&h(s)}else h(i);return o.abort.bind(o)};export{j as pageviewCount,u as version};
//# sourceMappingURL=pageview.js.map

@@ -1,2 +0,2 @@

(function(l,p){typeof exports=="object"&&typeof module<"u"?p(exports):typeof define=="function"&&define.amd?define(["exports"],p):(l=typeof globalThis<"u"?globalThis:l||self,p(l.Waline={}))})(this,function(l){"use strict";const p="3.0.0-alpha.6",v={"Content-Type":"application/json"},g=e=>`${e.replace(/\/?$/,"/")}api/`,$=(e,t="")=>{if(typeof e=="object"&&e.errno)throw new TypeError(`${t} failed with ${e.errno}: ${e.errmsg}`);return e},w=({serverURL:e,lang:t,paths:r,type:o,signal:n})=>fetch(`${g(e)}article?path=${encodeURIComponent(r.join(","))}&type=${encodeURIComponent(o.join(","))}&lang=${t}`,{signal:n}).then(a=>a.json()),R=({serverURL:e,lang:t,path:r,type:o,action:n})=>fetch(`${g(e)}article?lang=${t}`,{method:"POST",headers:v,body:JSON.stringify({path:r,type:o,action:n})}).then(a=>a.json()).then(a=>$(a,"Update counter").data),U=({serverURL:e,lang:t,paths:r,signal:o})=>w({serverURL:e,lang:t,paths:r,type:["time"],signal:o}).then(n=>Array.isArray(n)?n:[n]),L=e=>R({...e,type:"time",action:"inc"}),b=(e="")=>e.replace(/\/$/u,""),j=e=>/^(https?:)?\/\//.test(e),d=e=>{const t=b(e);return j(t)?t:`https://${t}`},A=e=>{e.name!=="AbortError"&&console.error(e.message)},f=e=>e.dataset.path||null,u=(e,t)=>{t.forEach((r,o)=>{r.innerText=e[o].toString()})},C=({serverURL:e,path:t=window.location.pathname,selector:r=".waline-pageview-count",update:o=!0,lang:n=navigator.language})=>{const a=new AbortController,c=Array.from(document.querySelectorAll(r)),y=s=>{const i=f(s);return i!==null&&t!==i},m=s=>U({serverURL:d(e),paths:s.map(i=>f(i)||t),lang:n,signal:a.signal}).then(i=>u(i,s)).catch(A);if(o){const s=c.filter(h=>!y(h)),i=c.filter(y);L({serverURL:d(e),path:t,lang:n}).then(([h])=>u(new Array(s.length).fill(h),s)),i.length&&m(i)}else m(c);return a.abort.bind(a)};l.pageviewCount=C,l.version=p});
(function(l,p){typeof exports=="object"&&typeof module<"u"?p(exports):typeof define=="function"&&define.amd?define(["exports"],p):(l=typeof globalThis<"u"?globalThis:l||self,p(l.Waline={}))})(this,function(l){"use strict";const p="3.0.0-alpha.7",v={"Content-Type":"application/json"},g=e=>`${e.replace(/\/?$/,"/")}api/`,$=(e,t="")=>{if(typeof e=="object"&&e.errno)throw new TypeError(`${t} failed with ${e.errno}: ${e.errmsg}`);return e},w=({serverURL:e,lang:t,paths:r,type:o,signal:n})=>fetch(`${g(e)}article?path=${encodeURIComponent(r.join(","))}&type=${encodeURIComponent(o.join(","))}&lang=${t}`,{signal:n}).then(a=>a.json()),R=({serverURL:e,lang:t,path:r,type:o,action:n})=>fetch(`${g(e)}article?lang=${t}`,{method:"POST",headers:v,body:JSON.stringify({path:r,type:o,action:n})}).then(a=>a.json()).then(a=>$(a,"Update counter").data),U=({serverURL:e,lang:t,paths:r,signal:o})=>w({serverURL:e,lang:t,paths:r,type:["time"],signal:o}).then(n=>Array.isArray(n)?n:[n]),L=e=>R({...e,type:"time",action:"inc"}),b=(e="")=>e.replace(/\/$/u,""),j=e=>/^(https?:)?\/\//.test(e),d=e=>{const t=b(e);return j(t)?t:`https://${t}`},A=e=>{e.name!=="AbortError"&&console.error(e.message)},f=e=>e.dataset.path||null,u=(e,t)=>{t.forEach((r,o)=>{r.innerText=e[o].toString()})},C=({serverURL:e,path:t=window.location.pathname,selector:r=".waline-pageview-count",update:o=!0,lang:n=navigator.language})=>{const a=new AbortController,c=Array.from(document.querySelectorAll(r)),y=s=>{const i=f(s);return i!==null&&t!==i},m=s=>U({serverURL:d(e),paths:s.map(i=>f(i)||t),lang:n,signal:a.signal}).then(i=>u(i,s)).catch(A);if(o){const s=c.filter(h=>!y(h)),i=c.filter(y);L({serverURL:d(e),path:t,lang:n}).then(([h])=>u(new Array(s.length).fill(h),s)),i.length&&m(i)}else m(c);return a.abort.bind(a)};l.pageviewCount=C,l.version=p});
//# sourceMappingURL=pageview.umd.js.map

@@ -8,3 +8,3 @@ import{fetchCommentCount as Rt,getArticleCounter as xt,updateArticleCounter as Ke,updateComment as he,addComment as Et,login as It,deleteComment as Ut,getComment as At,updatePageview as _t,getPageview as Mt,getRecentComment as St,getUserList as jt}from"@waline/api";export*from"@waline/api";import{h as U,defineComponent as ue,inject as Le,ref as x,computed as W,onMounted as fe,watch as te,onUnmounted as Re,openBlock as r,createElementBlock as u,createElementVNode as h,toDisplayString as _,Fragment as P,renderList as X,normalizeClass as q,createBlock as le,unref as L,createCommentVNode as E,onBeforeUnmount as zt,normalizeStyle as Ze,nextTick as Ht,reactive as xe,createVNode as G,withDirectives as we,vModelDynamic as Vt,isRef as Tt,vModelText as Ft,vShow as Ge,createTextVNode as ae,resolveComponent as Nt,provide as Wt,createApp as Pt,watchEffect as Je}from"vue";import{useStorage as ie,useScriptTag as Bt,useDebounceFn as Dt,useNow as Ot,useStyleTag as qt}from"@vueuse/core";import Xe from"autosize";import{Marked as Kt}from"marked";import{markedHighlight as Zt}from"marked-highlight";import{load as Gt}from"recaptcha-v3";const Jt=["nick","mail","link"],Ye=e=>e.filter(a=>Jt.includes(a)),Qe=["//unpkg.com/@waline/emojis@1.1.0/weibo"],et="en-US",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((a,l)=>{if(e.size>128*1e3)return l(new Error("File too large! File size limit 128KB"));const t=new FileReader;t.readAsDataURL(e),t.onload=()=>{var i;return a(((i=t.result)==null?void 0:i.toString())||"")},t.onerror=l}),Qt=e=>e===!0?'<p class="wl-tex">TeX is not available in preview</p>':'<span class="wl-tex">TeX is not available in preview</span>',el=e=>{const a=async(l,t={})=>fetch(`https://api.giphy.com/v1/gifs/${l}?${new URLSearchParams({lang:e,limit:"20",rating:"g",api_key:"6CIMLkNMMOhRcXPoMCPkFy4Ybk2XUiMp",...t}).toString()}`).then(i=>i.json()).then(({data:i})=>i.map(n=>({title:n.title,src:n.images.downsized_medium.url})));return{search:l=>a("search",{q:l,offset:"0"}),default:()=>a("trending",{}),more:(l,t=0)=>a("search",{q:l,offset:t.toString()})}},tl=/[\u4E00-\u9FFF\u3400-\u4dbf\uf900-\ufaff\u3040-\u309f\uac00-\ud7af\u0400-\u04FF]+|\w+/,ll=/</,al=/(?:^|\s)\/\/(.+?)$/gm,nl=/\/\*([\S\s]*?)\*\//gm,ol=new RegExp(`(${tl.source}|${ll.source})|((?:${al.source})|(?:${nl.source}))`,"gmi"),tt=["23AC69","91C132","F19726","E8552D","1AAB8E","E1147F","2980C1","1BA1E6","9FA0A0","F19726","E30B20","E30B20","A3338B"],Ee={},il=e=>{let a=0;return e.replace(ol,(l,t,i)=>{if(i)return`<span style="color: slategray">${i}</span>`;if(t==="<")return"&lt;";let n;Ee[t]?n=Ee[t]:(n=tt[a],Ee[t]=n);const m=`<span style="color: #${n}">${t}</span>`;return a=++a%tt.length,m})},rl=["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"],re=e=>Object.fromEntries(e.map((a,l)=>[rl[l],a]));var Ie=re(["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 se={zh:Ae,"zh-cn":Ae,"zh-CN":Ae,"zh-tw":at,"zh-TW":at,en:Ie,"en-US":Ie,"en-us":Ie,jp:ye,ja:ye,"jp-jp":ye,"jp-JP":ye,"pt-br":lt,"pt-BR":lt,ru:Ue,"ru-ru":Ue,"ru-RU":Ue},nt=e=>{try{e=decodeURI(e)}catch{}return e},ot=(e="")=>e.replace(/\/$/u,""),it=e=>/^(https?:)?\/\//.test(e),ke=e=>{const a=ot(e);return it(a)?a:`https://${a}`},sl=e=>Array.isArray(e)?e:e?[0,e]:!1,_e=(e,a)=>typeof e=="function"?e:e===!1?!1:a,cl=({serverURL:e,path:a=location.pathname,lang:l=typeof navigator>"u"?"en-US":navigator.language,locale:t,emoji:i=Qe,meta:n=["nick","mail","link"],requiredMeta:m=[],dark:d=!1,pageSize:g=10,wordLimit:c,imageUploader:f,highlighter:S,texRenderer:p,copyright:A=!0,login:M="enable",search:R,reaction:y,recaptchaV3Key:o="",turnstileKey:w="",commentSorting:F="latest",...B})=>({serverURL:ke(e),path:nt(a),locale:{...se[l]||se[et],...typeof t=="object"?t:{}},wordLimit:sl(c),meta:Ye(n),requiredMeta:Ye(m),imageUploader:_e(f,Yt),highlighter:_e(S,il),texRenderer:_e(p,Qt),lang:Object.keys(se).includes(l)?l:"en-US",dark:d,emoji:typeof i=="boolean"?i?Qe:[]:i,pageSize:g,login:M,copyright:A,search:R===!1?!1:typeof R=="object"?R:el(l),recaptchaV3Key:o,turnstileKey:w,reaction:Array.isArray(y)?y:y===!0?Xt:[],commentSorting:F,...B}),Me="{--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}",ul=e=>typeof e=="string"?e==="auto"?`@media(prefers-color-scheme:dark){body${Me}}`:`${e}${Me}`:e===!0?`:root${Me}`:"",Se=(e,a)=>{let l=e.toString();for(;l.length<a;)l="0"+l;return l},vl=e=>{const a=Se(e.getDate(),2),l=Se(e.getMonth()+1,2);return`${Se(e.getFullYear(),2)}-${l}-${a}`},ml=(e,a,l)=>{if(!e)return"";const t=typeof e=="string"?new Date(e.indexOf(" ")!==-1?e.replace(/-/g,"/"):e):e,i=a.getTime()-t.getTime(),n=Math.floor(i/(24*3600*1e3));if(n===0){const m=i%864e5,d=Math.floor(m/(3600*1e3));if(d===0){const g=m%36e5,c=Math.floor(g/(60*1e3));if(c===0){const f=g%6e4;return`${Math.round(f/1e3)} ${l.seconds}`}return`${c} ${l.minutes}`}return`${d} ${l.hours}`}return n<0?l.now:n<8?`${n} ${l.days}`:vl(t)},dl=/^[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])?)*$/,pl=e=>dl.test(e),gl=e=>!!/@[0-9]+\.[0-9]+\.[0-9]+/.test(e),hl=e=>{const a=ie("WALINE_EMOJI",{}),l=gl(e);if(l){const t=a.value[e];if(t)return Promise.resolve(t)}return fetch(`${e}/info.json`).then(t=>t.json()).then(t=>{const i={folder:e,...t};return l&&(a.value[e]=i),i})},rt=(e,a="",l="",t="")=>`${a?`${a}/`:""}${l}${e}${t?`.${t}`:""}`,fl=e=>Promise.all(e.map(a=>typeof a=="string"?hl(ot(a)):Promise.resolve(a))).then(a=>{const l={tabs:[],map:{}};return a.forEach(t=>{const{name:i,folder:n,icon:m,prefix:d,type:g,items:c}=t;l.tabs.push({name:i,icon:rt(m,n,d,g),items:c.map(f=>{const S=`${d||""}${f}`;return l.map[S]=rt(f,n,d,g),S})})}),l}),st=e=>{e.name!=="AbortError"&&console.error(e.message)},je=e=>e instanceof HTMLElement?e:typeof e=="string"?document.querySelector(e):null,wl=e=>e.type.includes("image"),ct=e=>{const a=Array.from(e).find(wl);return a?a.getAsFile():null},yl=/\$.*?\$/,kl=/^\$(.*?)\$/,bl=/^(?:\s{0,3})\$\$((?:[^\n]|\n[^\n])+?)\n{0,1}\$\$/,Cl=e=>[{name:"blockMath",level:"block",tokenizer(a){const l=bl.exec(a);if(l!==null)return{type:"html",raw:l[0],text:e(!0,l[1])}}},{name:"inlineMath",level:"inline",start(a){const l=a.search(yl);return l!==-1?l:a.length},tokenizer(a){const l=kl.exec(a);if(l!==null)return{type:"html",raw:l[0],text:e(!1,l[1])}}}],ut=(e="",a={})=>e.replace(/:(.+?):/g,(l,t)=>a[t]?`<img class="wl-emoji" src="${a[t]}" alt="${t}">`:l),$l=(e,{emojiMap:a,highlighter:l,texRenderer:t})=>{const i=new Kt;if(i.setOptions({breaks:!0}),l&&i.use(Zt({highlight:l})),t){const n=Cl(t);i.use({extensions:n})}return i.parse(ut(e,a))},ze=e=>e.dataset.path||null,Ll=e=>e.match(/[\w\d\s,.\u00C0-\u024F\u0400-\u04FF]+/giu),Rl=e=>e.match(/[\u4E00-\u9FD5]/gu),xl=e=>{var a,l;return(((a=Ll(e))==null?void 0:a.reduce((t,i)=>t+(["",",","."].includes(i.trim())?0:i.trim().split(/\s+/u).length),0))||0)+(((l=Rl(e))==null?void 0:l.length)||0)},El=async()=>{if(!navigator)return"";const{userAgentData:e}=navigator;let a=navigator.userAgent;if(!e||e.platform!=="Windows")return a;const{platformVersion:l}=await e.getHighEntropyValues(["platformVersion"]);return l&&parseInt(l.split(".")[0])>=13&&(a=a.replace("Windows NT 10.0","Windows NT 11.0")),a},vt=({serverURL:e,path:a=window.location.pathname,selector:l=".waline-comment-count",lang:t=navigator.language})=>{const i=new AbortController,n=document.querySelectorAll(l);return n.length&&Rt({serverURL:ke(e),paths:Array.from(n).map(m=>nt(ze(m)||a)),lang:t,signal:i.signal}).then(m=>{n.forEach((d,g)=>{d.innerText=m[g].toString()})}).catch(st),i.abort.bind(i)},mt=({size:e})=>U("svg",{class:"wl-close-icon",viewBox:"0 0 1024 1024",width:e,height:e},[U("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"}),U("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"})]),Il=()=>U("svg",{viewBox:"0 0 1024 1024",width:"24",height:"24"},U("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"})),Ul=()=>U("svg",{viewBox:"0 0 1024 1024",width:"24",height:"24"},U("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"})),Al=()=>U("svg",{viewBox:"0 0 1024 1024",width:"24",height:"24"},[U("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"}),U("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"})]),_l=({active:e=!1})=>U("svg",{viewBox:"0 0 1024 1024",width:"24",height:"24"},[U("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"})]),Ml=()=>U("svg",{viewBox:"0 0 1024 1024",width:"24",height:"24"},[U("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"}),U("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"})]),Sl=()=>U("svg",{width:"16",height:"16",ariaHidden:"true"},U("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"})),jl=()=>U("svg",{viewBox:"0 0 1024 1024",width:"24",height:"24"},U("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"})),zl=()=>U("svg",{viewBox:"0 0 1024 1024",width:"24",height:"24"},U("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"})),Hl=()=>U("svg",{class:"verified-icon",viewBox:"0 0 1024 1024",width:"14",height:"14"},U("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"})),ve=({size:e=100})=>U("svg",{width:e,height:e,viewBox:"0 0 100 100",preserveAspectRatio:"xMidYMid"},U("circle",{cx:50,cy:50,fill:"none",stroke:"currentColor",strokeWidth:"4",r:"40","stroke-dasharray":"85 30"},U("animateTransform",{attributeName:"transform",type:"rotate",repeatCount:"indefinite",dur:"1s",values:"0 50 50;360 50 50",keyTimes:"0;1"}))),Vl=()=>U("svg",{width:24,height:24,fill:"currentcolor",viewBox:"0 0 24 24"},[U("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"}),U("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"})]),Tl=()=>ie("WALINE_USER_META",{nick:"",mail:"",link:""}),Fl=()=>ie("WALINE_COMMENT_BOX_EDITOR",""),Nl="WALINE_LIKE";let dt=null;const pt=()=>dt||(dt=ie(Nl,[])),Wl="WALINE_REACTION";let gt=null;const Pl=()=>gt??(gt=ie(Wl,{})),ht={},Bl=e=>{const a=ht[e]??(ht[e]=Gt(e,{useRecaptchaNet:!0,autoHideBadge:!0}));return{execute:l=>a.then(t=>t.execute(l))}},Dl=e=>({execute:async a=>{const{load:l}=Bt("https://challenges.cloudflare.com/turnstile/v0/api.js",void 0,{async:!1});await l();const t=window==null?void 0:window.turnstile;return new Promise(i=>{t==null||t.ready(()=>{t==null||t.render(".wl-captcha-container",{sitekey:e,action:a,size:"compact",callback:i})})})}}),Ol="WALINE_USER";let ft=null;const be=()=>ft??(ft=ie(Ol,{})),ql={key:0,class:"wl-reaction"},Kl=["textContent"],Zl={class:"wl-reaction-list"},Gl=["onClick"],Jl={class:"wl-reaction-img"},Xl=["src","alt"],Yl=["textContent"],Ql=["textContent"];var ea=ue({__name:"ArticleReaction",setup(e,{expose:a}){a();const l=Pl(),t=Le("config"),i=x(-1),n=x([]),m=W(()=>t.value.locale),d=W(()=>t.value.reaction.length>0),g=W(()=>{const{reaction:p,path:A}=t.value;return p.map((M,R)=>({icon:M,desc:m.value[`reaction${R}`],active:l.value[A]===R}))});let c;const f=async()=>{if(d.value){const{serverURL:p,lang:A,path:M,reaction:R}=t.value,y=new AbortController;c=y.abort.bind(y);const o=await xt({serverURL:p,lang:A,paths:[M],type:R.map((w,F)=>`reaction${F}`),signal:y.signal});if(Array.isArray(o)||typeof o=="number")return;n.value=R.map((w,F)=>o[`reaction${F}`])}},S=async p=>{if(i.value===-1){const{serverURL:A,lang:M,path:R}=t.value,y=l.value[R];i.value=p,y!==void 0&&(await Ke({serverURL:A,lang:M,path:R,type:`reaction${y}`,action:"desc"}),n.value[y]=Math.max(n.value[y]-1,0)),y!==p&&(await Ke({serverURL:A,lang:M,path:R,type:`reaction${p}`}),n.value[p]=(n.value[p]||0)+1),y===p?delete l.value[R]:l.value[R]=p,i.value=-1}};return fe(()=>{te(()=>[t.value.serverURL,t.value.path],()=>{f()},{immediate:!0})}),Re(()=>c==null?void 0:c()),(p,A)=>g.value.length?(r(),u("div",ql,[h("div",{class:"wl-reaction-title",textContent:_(m.value.reactionTitle)},null,8,Kl),h("ul",Zl,[(r(!0),u(P,null,X(g.value,({active:M,icon:R,desc:y},o)=>(r(),u("li",{key:o,class:q(["wl-reaction-item",{active:M}]),onClick:w=>S(o)},[h("div",Jl,[h("img",{src:R,alt:y},null,8,Xl),i.value===o?(r(),le(L(ve),{key:0,class:"wl-reaction-loading"})):(r(),u("div",{key:1,class:"wl-reaction-votes",textContent:_(n.value[o]||0)},null,8,Yl))]),h("div",{class:"wl-reaction-text",textContent:_(y)},null,8,Ql)],10,Gl))),128))])])):E("v-if",!0)}}),me=(e,a)=>{const l=e.__vccOpts||e;for(const[t,i]of a)l[t]=i;return l},ta=me(ea,[["__file","ArticleReaction.vue"]]);const la=["data-index"],aa=["src","title","onClick"];var na=ue({__name:"ImageWall",props:{items:{default:()=>[]},columnWidth:{default:300},gap:{default:0}},emits:["insert"],setup(e,{expose:a}){const l=e;a();let t=null;const i=x(null),n=x({}),m=x([]),d=()=>{const p=Math.floor((i.value.getBoundingClientRect().width+l.gap)/(l.columnWidth+l.gap));return p>0?p:1},g=p=>new Array(p).fill(null).map(()=>[]),c=async p=>{var A;if(p>=l.items.length)return;await Ht();const M=Array.from(((A=i.value)==null?void 0:A.children)||[]).reduce((R,y)=>y.getBoundingClientRect().height<R.getBoundingClientRect().height?y:R);m.value[Number(M.dataset.index)].push(p),await c(p+1)},f=async(p=!1)=>{if(m.value.length===d()&&!p)return;m.value=g(d());const A=window.scrollY;await c(0),window.scrollTo({top:A})},S=p=>{n.value[p.target.src]=!0};return fe(()=>{f(!0),t=new ResizeObserver(()=>{f()}),t.observe(i.value),te(()=>[l.items],()=>{n.value={},f(!0)}),te(()=>[l.columnWidth,l.gap],()=>{f()})}),zt(()=>t.unobserve(i.value)),(p,A)=>(r(),u("div",{ref_key:"wall",ref:i,class:"wl-gallery",style:Ze({gap:`${p.gap}px`})},[(r(!0),u(P,null,X(m.value,(M,R)=>(r(),u("div",{key:R,class:"wl-gallery-column","data-index":R,style:Ze({gap:`${p.gap}px`})},[(r(!0),u(P,null,X(M,y=>(r(),u(P,{key:y},[n.value[p.items[y].src]?E("v-if",!0):(r(),le(L(ve),{key:0,size:36,style:{margin:"20px auto"}})),h("img",{class:"wl-gallery-item",src:p.items[y].src,title:p.items[y].title,loading:"lazy",onLoad:S,onClick:o=>p.$emit("insert",`![](${p.items[y].src})`)},null,40,aa)],64))),128))],12,la))),128))],4))}}),oa=me(na,[["__file","ImageWall.vue"]]);const ia={class:"wl-comment"},ra={key:0,class:"wl-login-info"},sa={class:"wl-avatar"},ca=["title"],ua=["title"],va=["src"],ma=["title","textContent"],da={class:"wl-panel"},pa=["for","textContent"],ga=["id","onUpdate:modelValue","name","type"],ha=["placeholder"],fa={class:"wl-preview"},wa=h("hr",null,null,-1),ya=["innerHTML"],ka={class:"wl-footer"},ba={class:"wl-actions"},Ca={href:"https://guides.github.com/features/mastering-markdown/",title:"Markdown Guide","aria-label":"Markdown is supported",class:"wl-action",target:"_blank",rel:"noopener noreferrer"},$a=["title"],La=["title"],Ra=["title"],xa=["title"],Ea={class:"wl-info"},Ia=h("div",{class:"wl-captcha-container"},null,-1),Ua={class:"wl-text-number"},Aa={key:0},_a=["textContent"],Ma=["textContent"],Sa=["disabled"],ja=["placeholder"],za={key:1,class:"wl-loading"},Ha={key:0,class:"wl-tab-wrapper"},Va=["title","onClick"],Ta=["src","alt"],Fa={key:0,class:"wl-tabs"},Na=["onClick"],Wa=["src","alt","title"],Pa=["title"];var Ba=ue({__name:"CommentBox",props:{edit:{default:null},rootId:{default:""},replyId:{default:""},replyUser:{default:""}},emits:["log","cancelEdit","cancelReply","submit"],setup(e,{expose:a,emit:l}){const t=e,i=l;a();const n=Le("config"),m=Fl(),d=Tl(),g=be(),c=x({}),f=x(null),S=x(null),p=x(null),A=x(null),M=x(null),R=x(null),y=x(null),o=x({tabs:[],map:{}}),w=x(0),F=x(!1),B=x(!1),I=x(!1),z=x(""),oe=x(0),V=xe({loading:!0,list:[]}),ne=x(0),ee=x(!1),de=x(""),Y=x(!1),$=x(!1),k=W(()=>n.value.locale),j=W(()=>{var v;return!!((v=g.value)!=null&&v.token)}),K=W(()=>n.value.imageUploader!==!1),D=v=>{const s=f.value,b=s.selectionStart,H=s.selectionEnd||0,C=s.scrollTop;m.value=s.value.substring(0,b)+v+s.value.substring(H,s.value.length),s.focus(),s.selectionStart=b+v.length,s.selectionEnd=b+v.length,s.scrollTop=C},J=v=>{const s=v.key;(v.ctrlKey||v.metaKey)&&s==="Enter"&&Ve()},Z=v=>{const s=`![${n.value.locale.uploading} ${v.name}]()`;return D(s),Y.value=!0,Promise.resolve().then(()=>n.value.imageUploader(v)).then(b=>{m.value=m.value.replace(s,`\r
![${v.name}](${b})`)}).catch(b=>{alert(b.message),m.value=m.value.replace(s,"")}).then(()=>{Y.value=!1})},ce=v=>{var s;if((s=v.dataTransfer)!=null&&s.items){const b=ct(v.dataTransfer.items);b&&K.value&&(Z(b),v.preventDefault())}},He=v=>{if(v.clipboardData){const s=ct(v.clipboardData.items);s&&K.value&&Z(s)}},Ce=()=>{const v=S.value;v.files&&K.value&&Z(v.files[0]).then(()=>{v.value=""})},Ve=async()=>{var v,s,b,H,C,O;const{serverURL:N,lang:Q,login:pe,wordLimit:Be,requiredMeta:De,recaptchaV3Key:Oe,turnstileKey:qe}=n.value,Lt=await El(),T={comment:de.value,nick:d.value.nick,mail:d.value.mail,link:d.value.link,url:n.value.path,ua:Lt};if((v=g.value)!=null&&v.token)T.nick=g.value.display_name,T.mail=g.value.email,T.link=g.value.url;else{if(pe==="force")return;if(De.indexOf("nick")>-1&&!T.nick)return(s=c.value.nick)==null||s.focus(),alert(k.value.nickError);if(De.indexOf("mail")>-1&&!T.mail||T.mail&&!pl(T.mail))return(b=c.value.mail)==null||b.focus(),alert(k.value.mailError);T.nick||(T.nick=k.value.anonymous)}if(!T.comment){(H=f.value)==null||H.focus();return}if(!ee.value)return alert(k.value.wordHint.replace("$0",Be[0].toString()).replace("$1",Be[1].toString()).replace("$2",oe.value.toString()));T.comment=ut(T.comment,o.value.map),t.replyId&&t.rootId&&(T.pid=t.replyId,T.rid=t.rootId,T.at=t.replyUser),Y.value=!0;try{Oe&&(T.recaptchaV3=await Bl(Oe).execute("social")),qe&&(T.turnstile=await Dl(qe).execute("social"));const ge={serverURL:N,lang:Q,token:(C=g.value)==null?void 0:C.token,comment:T},$e=await(t.edit?he({objectId:t.edit.objectId,...ge}):Et(ge));if(Y.value=!1,$e.errmsg)return alert($e.errmsg);i("submit",$e.data),m.value="",z.value="",t.replyId&&i("cancelReply"),(O=t.edit)!=null&&O.objectId&&i("cancelEdit")}catch(ge){Y.value=!1,alert(ge.message)}},Ct=v=>{v.preventDefault();const{lang:s,serverURL:b}=n.value;It({serverURL:b,lang:s}).then(H=>{g.value=H,(H.remember?localStorage:sessionStorage).setItem("WALINE_USER",JSON.stringify(H)),i("log")})},$t=()=>{g.value={},localStorage.setItem("WALINE_USER","null"),sessionStorage.setItem("WALINE_USER","null"),i("log")},Te=v=>{v.preventDefault();const{lang:s,serverURL:b}=n.value,H=800,C=800,O=(window.innerWidth-H)/2,N=(window.innerHeight-C)/2,Q=new URLSearchParams({lng:s,token:g.value.token}),pe=window.open(`${b}/ui/profile?${Q.toString()}`,"_blank",`width=${H},height=${C},left=${O},top=${N},scrollbars=no,resizable=no,status=no,location=no,toolbar=no,menubar=no`);pe==null||pe.postMessage({type:"TOKEN",data:g.value.token},"*")},Fe=v=>{var s,b,H,C;!((s=p.value)!=null&&s.contains(v.target))&&!((b=A.value)!=null&&b.contains(v.target))&&(F.value=!1),!((H=M.value)!=null&&H.contains(v.target))&&!((C=R.value)!=null&&C.contains(v.target))&&(B.value=!1)},Ne=async v=>{var s;const{scrollTop:b,clientHeight:H,scrollHeight:C}=v.target,O=(H+b)/C,N=n.value.search,Q=((s=y.value)==null?void 0:s.value)||"";O<.9||V.loading||$.value||(V.loading=!0,(N.more&&V.list.length?await N.more(Q,V.list.length):await N.search(Q)).length?V.list=[...V.list,...N.more&&V.list.length?await N.more(Q,V.list.length):await N.search(Q)]:$.value=!0,V.loading=!1,setTimeout(()=>{v.target.scrollTop=b},50))},We=Dt(v=>{V.list=[],$.value=!1,Ne(v)},300);te([n,oe],([v,s])=>{const{wordLimit:b}=v;b?s<b[0]&&b[0]!==0?(ne.value=b[0],ee.value=!1):s>b[1]?(ne.value=b[1],ee.value=!1):(ne.value=b[1],ee.value=!0):(ne.value=0,ee.value=!0)},{immediate:!0});const Pe=({data:v})=>{!v||v.type!=="profile"||(g.value={...g.value,...v.data},[localStorage,sessionStorage].filter(s=>s.getItem("WALINE_USER")).forEach(s=>s.setItem("WALINE_USER",JSON.stringify(g))))};return fe(()=>{var v;document.body.addEventListener("click",Fe),window.addEventListener("message",Pe),(v=t.edit)!=null&&v.objectId&&(m.value=t.edit.orig),te(B,async s=>{if(!s)return;const b=n.value.search;y.value&&(y.value.value=""),V.loading=!0,V.list=b.default?await b.default():await b.search(""),V.loading=!1}),te(()=>m.value,s=>{const{highlighter:b,texRenderer:H}=n.value;de.value=s,z.value=$l(s,{emojiMap:o.value.map,highlighter:b,texRenderer:H}),oe.value=xl(s),s?Xe(f.value):Xe.destroy(f.value)},{immediate:!0}),te(()=>n.value.emoji,s=>fl(s).then(b=>{o.value=b}),{immediate:!0})}),Re(()=>{document.body.removeEventListener("click",Fe),window.removeEventListener("message",Pe)}),(v,s)=>{var b,H;return r(),u("div",ia,[L(n).login!=="disable"&&j.value&&!((b=v.edit)!=null&&b.objectId)?(r(),u("div",ra,[h("div",sa,[h("button",{type:"submit",class:"wl-logout-btn",title:k.value.logout,onClick:$t},[G(L(mt),{size:14})],8,ca),h("a",{href:"#",class:"wl-login-nick","aria-label":"Profile",title:k.value.profile,onClick:Te},[h("img",{src:L(g).avatar,alt:"avatar"},null,8,va)],8,ua)]),h("a",{href:"#",class:"wl-login-nick","aria-label":"Profile",title:k.value.profile,onClick:Te,textContent:_(L(g).display_name)},null,8,ma)])):E("v-if",!0),h("div",da,[L(n).login!=="force"&&L(n).meta.length&&!j.value?(r(),u("div",{key:0,class:q(["wl-header",`item${L(n).meta.length}`])},[(r(!0),u(P,null,X(L(n).meta,C=>(r(),u("div",{key:C,class:"wl-header-item"},[h("label",{for:`wl-${C}`,textContent:_(k.value[C]+(L(n).requiredMeta.includes(C)||!L(n).requiredMeta.length?"":`(${k.value.optional})`))},null,8,pa),we(h("input",{id:`wl-${C}`,ref_for:!0,ref:O=>{O&&(c.value[C]=O)},"onUpdate:modelValue":O=>L(d)[C]=O,class:q(["wl-input",`wl-${C}`]),name:C,type:C==="mail"?"email":"text"},null,10,ga),[[Vt,L(d)[C]]])]))),128))],2)):E("v-if",!0),we(h("textarea",{id:"wl-edit",ref_key:"editorRef",ref:f,"onUpdate:modelValue":s[0]||(s[0]=C=>Tt(m)?m.value=C:null),class:"wl-editor",placeholder:v.replyUser?`@${v.replyUser}`:k.value.placeholder,onKeydown:J,onDrop:ce,onPaste:He},null,40,ha),[[Ft,L(m)]]),we(h("div",fa,[wa,h("h4",null,_(k.value.preview)+":",1),h("div",{class:"wl-content",innerHTML:z.value},null,8,ya)],512),[[Ge,I.value]]),h("div",ka,[h("div",ba,[h("a",Ca,[G(L(Sl))]),we(h("button",{ref_key:"emojiButtonRef",ref:p,type:"button",class:q(["wl-action",{active:F.value}]),title:k.value.emoji,onClick:s[1]||(s[1]=C=>F.value=!F.value)},[G(L(Ul))],10,$a),[[Ge,o.value.tabs.length]]),L(n).search?(r(),u("button",{key:0,ref_key:"gifButtonRef",ref:M,type:"button",class:q(["wl-action",{active:B.value}]),title:k.value.gif,onClick:s[2]||(s[2]=C=>B.value=!B.value)},[G(L(Vl))],10,La)):E("v-if",!0),h("input",{id:"wl-image-upload",ref_key:"imageUploadRef",ref:S,class:"upload",type:"file",accept:".png,.jpg,.jpeg,.webp,.bmp,.gif",onChange:Ce},null,544),K.value?(r(),u("label",{key:1,for:"wl-image-upload",class:"wl-action",title:k.value.uploadImage},[G(L(Al))],8,Ra)):E("v-if",!0),h("button",{type:"button",class:q(["wl-action",{active:I.value}]),title:k.value.preview,onClick:s[3]||(s[3]=C=>I.value=!I.value)},[G(L(Ml))],10,xa)]),h("div",Ea,[Ia,h("div",Ua,[ae(_(oe.value)+" ",1),L(n).wordLimit?(r(),u("span",Aa,[ae("  /  "),h("span",{class:q({illegal:!ee.value}),textContent:_(ne.value)},null,10,_a)])):E("v-if",!0),ae("  "+_(k.value.word),1)]),L(n).login!=="disable"&&!j.value?(r(),u("button",{key:0,type:"button",class:"wl-btn",onClick:Ct,textContent:_(k.value.login)},null,8,Ma)):E("v-if",!0),L(n).login!=="force"||j.value?(r(),u("button",{key:1,type:"submit",class:"primary wl-btn",title:"Cmd|Ctrl + Enter",disabled:Y.value,onClick:Ve},[Y.value?(r(),le(L(ve),{key:0,size:16})):(r(),u(P,{key:1},[ae(_(k.value.submit),1)],64))],8,Sa)):E("v-if",!0)]),h("div",{ref_key:"gifPopupRef",ref:R,class:q(["wl-gif-popup",{display:B.value}])},[h("input",{ref_key:"gifSearchInputRef",ref:y,type:"text",placeholder:k.value.gifSearchPlaceholder,onInput:s[4]||(s[4]=(...C)=>L(We)&&L(We)(...C))},null,40,ja),V.list.length?(r(),le(oa,{key:0,items:V.list,"column-width":200,gap:6,onInsert:s[5]||(s[5]=C=>D(C)),onScroll:Ne},null,8,["items"])):E("v-if",!0),V.loading?(r(),u("div",za,[G(L(ve),{size:30})])):E("v-if",!0)],2),h("div",{ref_key:"emojiPopupRef",ref:A,class:q(["wl-emoji-popup",{display:F.value}])},[(r(!0),u(P,null,X(o.value.tabs,(C,O)=>(r(),u(P,{key:C.name},[O===w.value?(r(),u("div",Ha,[(r(!0),u(P,null,X(C.items,N=>(r(),u("button",{key:N,type:"button",title:N,onClick:Q=>D(`:${N}:`)},[F.value?(r(),u("img",{key:0,class:"wl-emoji",src:o.value.map[N],alt:N,loading:"lazy",referrerPolicy:"no-referrer"},null,8,Ta)):E("v-if",!0)],8,Va))),128))])):E("v-if",!0)],64))),128)),o.value.tabs.length>1?(r(),u("div",Fa,[(r(!0),u(P,null,X(o.value.tabs,(C,O)=>(r(),u("button",{key:C.name,type:"button",class:q(["wl-tab",{active:w.value===O}]),onClick:N=>w.value=O},[h("img",{class:"wl-emoji",src:C.icon,alt:C.name,title:C.name,loading:"lazy",referrerPolicy:"no-referrer"},null,8,Wa)],10,Na))),128))])):E("v-if",!0)],2)])]),v.replyId||(H=v.edit)!=null&&H.objectId?(r(),u("button",{key:1,type:"button",class:"wl-close",title:k.value.cancelReply,onClick:s[6]||(s[6]=C=>v.$emit(v.replyId?"cancelReply":"cancelEdit"))},[G(L(mt),{size:24})],8,Pa)):E("v-if",!0)])}}}),wt=me(Ba,[["__file","CommentBox.vue"]]);const Da=["id"],Oa={class:"wl-user","aria-hidden":"true"},qa=["src"],Ka={class:"wl-card"},Za={class:"wl-head"},Ga=["href"],Ja={key:1,class:"wl-nick"},Xa=["textContent"],Ya=["textContent"],Qa=["textContent"],en=["textContent"],tn=["textContent"],ln={class:"wl-comment-actions"},an=["title"],nn=["title"],on={class:"wl-meta","aria-hidden":"true"},rn=["data-value","textContent"],sn=["innerHTML"],cn={key:1,class:"wl-admin-actions"},un={class:"wl-comment-status"},vn=["disabled","onClick","textContent"],mn={key:3,class:"wl-quote"};var dn=ue({__name:"CommentCard",props:{comment:{},edit:{default:null},rootId:{},reply:{default:null}},emits:["log","submit","delete","edit","like","status","sticky","reply"],setup(e,{emit:a}){const l=e,t=a,i=["approved","waiting","spam"],n=Le("config"),m=pt(),d=Ot(),g=be(),c=W(()=>n.value.locale),f=W(()=>{const{link:o}=l.comment;return o?it(o)?o:`https://${o}`:""}),S=W(()=>m.value.includes(l.comment.objectId)),p=W(()=>ml(l.comment.insertedAt,d.value,c.value)),A=W(()=>g.value.type==="administrator"),M=W(()=>l.comment.user_id&&g.value.objectId===l.comment.user_id),R=W(()=>{var o;return l.comment.objectId===((o=l.reply)==null?void 0:o.objectId)}),y=W(()=>{var o;return l.comment.objectId===((o=l.edit)==null?void 0:o.objectId)});return(o,w)=>{var F;const B=Nt("CommentCard",!0);return r(),u("div",{id:o.comment.objectId,class:"wl-card-item"},[h("div",Oa,[o.comment.avatar?(r(),u("img",{key:0,class:"wl-user-avatar",src:o.comment.avatar},null,8,qa)):E("v-if",!0),o.comment.type?(r(),le(L(Hl),{key:1})):E("v-if",!0)]),h("div",Ka,[h("div",Za,[f.value?(r(),u("a",{key:0,class:"wl-nick",href:f.value,target:"_blank",rel:"nofollow noopener noreferrer"},_(o.comment.nick),9,Ga)):(r(),u("span",Ja,_(o.comment.nick),1)),o.comment.type==="administrator"?(r(),u("span",{key:2,class:"wl-badge",textContent:_(c.value.admin)},null,8,Xa)):E("v-if",!0),o.comment.label?(r(),u("span",{key:3,class:"wl-badge",textContent:_(o.comment.label)},null,8,Ya)):E("v-if",!0),o.comment.sticky?(r(),u("span",{key:4,class:"wl-badge",textContent:_(c.value.sticky)},null,8,Qa)):E("v-if",!0),typeof o.comment.level=="number"?(r(),u("span",{key:5,class:q(`wl-badge level${o.comment.level}`),textContent:_(c.value[`level${o.comment.level}`]||`Level ${o.comment.level}`)},null,10,en)):E("v-if",!0),h("span",{class:"wl-time",textContent:_(p.value)},null,8,tn),h("div",ln,[A.value||M.value?(r(),u(P,{key:0},[h("button",{type:"button",class:"wl-edit",onClick:w[0]||(w[0]=I=>t("edit",o.comment))},[G(L(zl))]),h("button",{type:"button",class:"wl-delete",onClick:w[1]||(w[1]=I=>t("delete",o.comment))},[G(L(Il))])],64)):E("v-if",!0),h("button",{type:"button",class:"wl-like",title:S.value?c.value.cancelLike:c.value.like,onClick:w[2]||(w[2]=I=>t("like",o.comment))},[G(L(_l),{active:S.value},null,8,["active"]),ae(" "+_("like"in o.comment?o.comment.like:""),1)],8,an),h("button",{type:"button",class:q(["wl-reply",{active:R.value}]),title:R.value?c.value.cancelReply:c.value.reply,onClick:w[3]||(w[3]=I=>t("reply",R.value?null:o.comment))},[G(L(jl))],10,nn)])]),h("div",on,[(r(),u(P,null,X(["addr","browser","os"],I=>(r(),u(P,null,[o.comment[I]?(r(),u("span",{key:I,class:q(`wl-${I}`),"data-value":o.comment[I],textContent:_(o.comment[I])},null,10,rn)):E("v-if",!0)],64))),64))]),y.value?E("v-if",!0):(r(),u("div",{key:0,class:"wl-content",innerHTML:o.comment.comment},null,8,sn)),A.value&&!y.value?(r(),u("div",cn,[h("span",un,[(r(),u(P,null,X(i,I=>h("button",{key:I,type:"submit",class:q(`wl-btn wl-${I}`),disabled:o.comment.status===I,onClick:z=>t("status",{status:I,comment:o.comment}),textContent:_(c.value[I])},null,10,vn)),64))]),A.value&&!("rid"in o.comment)?(r(),u("button",{key:0,type:"submit",class:"wl-btn wl-sticky",onClick:w[4]||(w[4]=I=>t("sticky",o.comment))},_(o.comment.sticky?c.value.unsticky:c.value.sticky),1)):E("v-if",!0)])):E("v-if",!0),R.value||y.value?(r(),u("div",{key:2,class:q({"wl-reply-wrapper":R.value,"wl-edit-wrapper":y.value})},[G(wt,{edit:o.edit,"reply-id":(F=o.reply)==null?void 0:F.objectId,"reply-user":o.comment.nick,"root-id":o.rootId,onLog:w[5]||(w[5]=I=>t("log")),onCancelReply:w[6]||(w[6]=I=>t("reply",null)),onCancelEdit:w[7]||(w[7]=I=>t("edit",null)),onSubmit:w[8]||(w[8]=I=>t("submit",I))},null,8,["edit","reply-id","reply-user","root-id"])],2)):E("v-if",!0),"children"in o.comment?(r(),u("div",mn,[(r(!0),u(P,null,X(o.comment.children,I=>(r(),le(B,{key:I.objectId,comment:I,reply:o.reply,edit:o.edit,"root-id":o.rootId,onLog:w[9]||(w[9]=z=>t("log")),onDelete:w[10]||(w[10]=z=>t("delete",z)),onEdit:w[11]||(w[11]=z=>t("edit",z)),onLike:w[12]||(w[12]=z=>t("like",z)),onReply:w[13]||(w[13]=z=>t("reply",z)),onStatus:w[14]||(w[14]=z=>t("status",z)),onSticky:w[15]||(w[15]=z=>t("sticky",z)),onSubmit:w[16]||(w[16]=z=>t("submit",z))},null,8,["comment","reply","edit","root-id"]))),128))])):E("v-if",!0)])],8,Da)}}}),pn=me(dn,[["__file","CommentCard.vue"]]);const yt="3.0.0-alpha.6",gn={"data-waline":""},hn={class:"wl-meta-head"},fn={class:"wl-count"},wn=["textContent"],yn={class:"wl-sort"},kn=["onClick"],bn={class:"wl-cards"},Cn={key:1,class:"wl-operation"},$n=["textContent"],Ln={key:2,class:"wl-loading"},Rn=["textContent"],xn={key:4,class:"wl-operation"},En=["textContent"],In={key:5,class:"wl-power"},Un=h("a",{href:"https://github.com/walinejs/waline",target:"_blank",rel:"noopener noreferrer"}," Waline ",-1);var An=ue({__name:"WalineComment",props:["serverURL","path","meta","requiredMeta","dark","commentSorting","lang","locale","pageSize","wordLimit","emoji","login","highlighter","texRenderer","imageUploader","search","copyright","recaptchaV3Key","turnstileKey","reaction"],setup(e){const a=e,l={latest:"insertedAt_desc",oldest:"insertedAt_asc",hottest:"like_desc"},t=Object.keys(l),i=be(),n=pt(),m=x("loading"),d=x(0),g=x(1),c=x(0),f=W(()=>cl(a)),S=x(f.value.commentSorting),p=x([]),A=x(null),M=x(null),R=W(()=>ul(f.value.dark)),y=W(()=>f.value.locale);qt(R,{id:"waline-darkmode"});let o;const w=$=>{var k;const{serverURL:j,path:K,pageSize:D}=f.value,J=new AbortController;m.value="loading",o==null||o(),At({serverURL:j,lang:f.value.lang,path:K,pageSize:D,sortBy:l[S.value],page:$,signal:J.signal,token:(k=i.value)==null?void 0:k.token}).then(Z=>{m.value="success",d.value=Z.count,p.value.push(...Z.data),g.value=$,c.value=Z.totalPages}).catch(Z=>{Z.name!=="AbortError"&&(console.error(Z.message),m.value="error")}),o=J.abort.bind(J)},F=()=>w(g.value+1),B=()=>{d.value=0,p.value=[],w(1)},I=$=>{S.value!==$&&(S.value=$,B())},z=$=>{A.value=$},oe=$=>{M.value=$},V=$=>{if(M.value)M.value.comment=$.comment,M.value.orig=$.orig;else if("rid"in $){const k=p.value.find(({objectId:j})=>j===$.rid);if(!k)return;Array.isArray(k.children)||(k.children=[]),k.children.push($)}else p.value.unshift($),d.value+=1},ne=async({comment:$,status:k})=>{var j;if($.status===k)return;const{serverURL:K,lang:D}=f.value;await he({serverURL:K,lang:D,token:(j=i.value)==null?void 0:j.token,objectId:$.objectId,comment:{status:k}}),$.status=k},ee=async $=>{var k;if("rid"in $)return;const{serverURL:j,lang:K}=f.value;await he({serverURL:j,lang:K,token:(k=i.value)==null?void 0:k.token,objectId:$.objectId,comment:{sticky:$.sticky?0:1}}),$.sticky=!$.sticky},de=async({objectId:$})=>{var k;if(!confirm("Are you sure you want to delete this comment?"))return;const{serverURL:j,lang:K}=f.value;await Ut({serverURL:j,lang:K,token:(k=i.value)==null?void 0:k.token,objectId:$}),p.value.some((D,J)=>D.objectId===$?(p.value=p.value.filter((Z,ce)=>ce!==J),!0):D.children.some((Z,ce)=>Z.objectId===$?(p.value[J].children=D.children.filter((He,Ce)=>Ce!==ce),!0):!1))},Y=async $=>{var k;const{serverURL:j,lang:K}=f.value,{objectId:D}=$,J=n.value.includes(D);await he({serverURL:j,lang:K,objectId:D,token:(k=i.value)==null?void 0:k.token,comment:{like:!J}}),J?n.value=n.value.filter(Z=>Z!==D):(n.value=[...n.value,D],n.value.length>50&&(n.value=n.value.slice(-50))),$.like=($.like||0)+(J?-1:1)};return Wt("config",f),fe(()=>{te(()=>[a.serverURL,a.path],()=>B(),{immediate:!0})}),Re(()=>o==null?void 0:o()),($,k)=>(r(),u("div",gn,[G(ta),A.value?E("v-if",!0):(r(),le(wt,{key:0,onLog:B,onSubmit:V})),h("div",hn,[h("div",fn,[d.value?(r(),u("span",{key:0,class:"wl-num",textContent:_(d.value)},null,8,wn)):E("v-if",!0),ae(" "+_(y.value.comment),1)]),h("ul",yn,[(r(!0),u(P,null,X(L(t),j=>(r(),u("li",{key:j,class:q([j===S.value?"active":""]),onClick:K=>I(j)},_(y.value[j]),11,kn))),128))])]),h("div",bn,[(r(!0),u(P,null,X(p.value,j=>(r(),le(pn,{key:j.objectId,"root-id":j.objectId,comment:j,reply:A.value,edit:M.value,onLog:B,onReply:z,onEdit:oe,onSubmit:V,onStatus:ne,onDelete:de,onSticky:ee,onLike:Y},null,8,["root-id","comment","reply","edit"]))),128))]),m.value==="error"?(r(),u("div",Cn,[h("button",{type:"button",class:"wl-btn",onClick:B,textContent:_(y.value.refresh)},null,8,$n)])):m.value==="loading"?(r(),u("div",Ln,[G(L(ve),{size:30})])):p.value.length?g.value<c.value?(r(),u("div",xn,[h("button",{type:"button",class:"wl-btn",onClick:F,textContent:_(y.value.more)},null,8,En)])):E("v-if",!0):(r(),u("div",{key:3,class:"wl-empty",textContent:_(y.value.sofa)},null,8,Rn)),f.value.copyright?(r(),u("div",In,[ae(" Powered by "),Un,ae(" v"+_(L(yt)),1)])):E("v-if",!0)]))}}),_n=me(An,[["__file","WalineComment.vue"]]);const kt=(e,a)=>{a.forEach((l,t)=>{l.innerText=e[t].toString()})},bt=({serverURL:e,path:a=window.location.pathname,selector:l=".waline-pageview-count",update:t=!0,lang:i=navigator.language})=>{const n=new AbortController,m=Array.from(document.querySelectorAll(l)),d=c=>{const f=ze(c);return f!==null&&a!==f},g=c=>Mt({serverURL:ke(e),paths:c.map(f=>ze(f)||a),lang:i,signal:n.signal}).then(f=>kt(f,c)).catch(st);if(t){const c=m.filter(S=>!d(S)),f=m.filter(d);_t({serverURL:ke(e),path:a,lang:i}).then(([S])=>kt(new Array(c.length).fill(S),c)),f.length&&g(f)}else g(m);return n.abort.bind(n)},Mn=({el:e="#waline",path:a=window.location.pathname,comment:l=!1,pageview:t=!1,...i})=>{const n=e?je(e):null;if(e&&!n)throw new Error("Option 'el' do not match any domElement!");if(!i.serverURL)throw new Error("Option 'serverURL' is missing!");const m=xe({...i}),d=xe({comment:l,pageview:t,path:a}),g=()=>{d.comment&&vt({serverURL:m.serverURL,path:d.path,...typeof d.comment=="string"?{selector:d.comment}:{}})},c=()=>{d.pageview&&bt({serverURL:m.serverURL,path:d.path,...typeof d.pageview=="string"?{selector:d.pageview}:{}})},f=n?Pt(()=>U(_n,{path:d.path,...m})):null;f&&f.mount(n);const S=Je(g),p=Je(c);return{el:n,update:({comment:A,pageview:M,path:R=window.location.pathname,...y}={})=>{Object.entries(y).forEach(([o,w])=>{m[o]=w}),d.path=R,A!==void 0&&(d.comment=A),M!==void 0&&(d.pageview=M)},destroy:()=>{f==null||f.unmount(),S(),p()}}},Sn=({el:e,serverURL:a,count:l,lang:t=navigator.language})=>{var i;const n=be(),m=je(e),d=new AbortController;return St({serverURL:a,count:l,lang:t,signal:d.signal,token:(i=n.value)==null?void 0:i.token}).then(g=>m&&g.length?(m.innerHTML=`<ul class="wl-recent-list">${g.map(c=>`<li class="wl-recent-item"><a href="${c.url}">${c.nick}</a>:${c.comment}</li>`).join("")}</ul>`,{comments:g,destroy:()=>{d.abort(),m.innerHTML=""}}):{comments:g,destroy:()=>d.abort()})},jn=({el:e,serverURL:a,count:l,locale:t,lang:i=navigator.language,mode:n="list"})=>{const m=je(e),d=new AbortController;return jt({serverURL:a,pageSize:l,lang:i,signal:d.signal}).then(g=>!m||!g.length?{users:g,destroy:()=>d.abort()}:(t={...se[i]||se[et],...typeof t=="object"?t:{}},m.innerHTML=`<ul class="wl-user-${n}">${g.map((c,f)=>[`<li class="wl-user-item" aria-label="${c.nick}">`,c.link&&`<a href="${c.link}" target="_blank">`,'<div class="wl-user-avatar">',`<img src="${c.avatar}" alt="${c.nick}">`,`<span class="wl-user-badge">${f+1}</span>`,"</div>",'<div class="wl-user-meta">','<div class="wl-user-name">',c.nick,c.level&&`<span class="wl-badge">${t?t[`level${c.level}`]:`Level ${c.level}`}</span>`,c.label&&`<span class="wl-badge">${c.label}</span>`,"</div>",c.link&&c.link,"</div>",c.link&&"</a>","</li>"].filter(S=>S).join("")).join("")}</ul>`,{users:g,destroy:()=>{d.abort(),m.innerHTML=""}}))};export{Sn as RecentComments,jn as UserList,vt as commentCount,se as defaultLocales,Mn as init,bt as pageviewCount,yt as version};
![${v.name}](${b})`)}).catch(b=>{alert(b.message),m.value=m.value.replace(s,"")}).then(()=>{Y.value=!1})},ce=v=>{var s;if((s=v.dataTransfer)!=null&&s.items){const b=ct(v.dataTransfer.items);b&&K.value&&(Z(b),v.preventDefault())}},He=v=>{if(v.clipboardData){const s=ct(v.clipboardData.items);s&&K.value&&Z(s)}},Ce=()=>{const v=S.value;v.files&&K.value&&Z(v.files[0]).then(()=>{v.value=""})},Ve=async()=>{var v,s,b,H,C,O;const{serverURL:N,lang:Q,login:pe,wordLimit:Be,requiredMeta:De,recaptchaV3Key:Oe,turnstileKey:qe}=n.value,Lt=await El(),T={comment:de.value,nick:d.value.nick,mail:d.value.mail,link:d.value.link,url:n.value.path,ua:Lt};if((v=g.value)!=null&&v.token)T.nick=g.value.display_name,T.mail=g.value.email,T.link=g.value.url;else{if(pe==="force")return;if(De.indexOf("nick")>-1&&!T.nick)return(s=c.value.nick)==null||s.focus(),alert(k.value.nickError);if(De.indexOf("mail")>-1&&!T.mail||T.mail&&!pl(T.mail))return(b=c.value.mail)==null||b.focus(),alert(k.value.mailError);T.nick||(T.nick=k.value.anonymous)}if(!T.comment){(H=f.value)==null||H.focus();return}if(!ee.value)return alert(k.value.wordHint.replace("$0",Be[0].toString()).replace("$1",Be[1].toString()).replace("$2",oe.value.toString()));T.comment=ut(T.comment,o.value.map),t.replyId&&t.rootId&&(T.pid=t.replyId,T.rid=t.rootId,T.at=t.replyUser),Y.value=!0;try{Oe&&(T.recaptchaV3=await Bl(Oe).execute("social")),qe&&(T.turnstile=await Dl(qe).execute("social"));const ge={serverURL:N,lang:Q,token:(C=g.value)==null?void 0:C.token,comment:T},$e=await(t.edit?he({objectId:t.edit.objectId,...ge}):Et(ge));if(Y.value=!1,$e.errmsg)return alert($e.errmsg);i("submit",$e.data),m.value="",z.value="",t.replyId&&i("cancelReply"),(O=t.edit)!=null&&O.objectId&&i("cancelEdit")}catch(ge){Y.value=!1,alert(ge.message)}},Ct=v=>{v.preventDefault();const{lang:s,serverURL:b}=n.value;It({serverURL:b,lang:s}).then(H=>{g.value=H,(H.remember?localStorage:sessionStorage).setItem("WALINE_USER",JSON.stringify(H)),i("log")})},$t=()=>{g.value={},localStorage.setItem("WALINE_USER","null"),sessionStorage.setItem("WALINE_USER","null"),i("log")},Te=v=>{v.preventDefault();const{lang:s,serverURL:b}=n.value,H=800,C=800,O=(window.innerWidth-H)/2,N=(window.innerHeight-C)/2,Q=new URLSearchParams({lng:s,token:g.value.token}),pe=window.open(`${b}/ui/profile?${Q.toString()}`,"_blank",`width=${H},height=${C},left=${O},top=${N},scrollbars=no,resizable=no,status=no,location=no,toolbar=no,menubar=no`);pe==null||pe.postMessage({type:"TOKEN",data:g.value.token},"*")},Fe=v=>{var s,b,H,C;!((s=p.value)!=null&&s.contains(v.target))&&!((b=A.value)!=null&&b.contains(v.target))&&(F.value=!1),!((H=M.value)!=null&&H.contains(v.target))&&!((C=R.value)!=null&&C.contains(v.target))&&(B.value=!1)},Ne=async v=>{var s;const{scrollTop:b,clientHeight:H,scrollHeight:C}=v.target,O=(H+b)/C,N=n.value.search,Q=((s=y.value)==null?void 0:s.value)||"";O<.9||V.loading||$.value||(V.loading=!0,(N.more&&V.list.length?await N.more(Q,V.list.length):await N.search(Q)).length?V.list=[...V.list,...N.more&&V.list.length?await N.more(Q,V.list.length):await N.search(Q)]:$.value=!0,V.loading=!1,setTimeout(()=>{v.target.scrollTop=b},50))},We=Dt(v=>{V.list=[],$.value=!1,Ne(v)},300);te([n,oe],([v,s])=>{const{wordLimit:b}=v;b?s<b[0]&&b[0]!==0?(ne.value=b[0],ee.value=!1):s>b[1]?(ne.value=b[1],ee.value=!1):(ne.value=b[1],ee.value=!0):(ne.value=0,ee.value=!0)},{immediate:!0});const Pe=({data:v})=>{!v||v.type!=="profile"||(g.value={...g.value,...v.data},[localStorage,sessionStorage].filter(s=>s.getItem("WALINE_USER")).forEach(s=>s.setItem("WALINE_USER",JSON.stringify(g))))};return fe(()=>{var v;document.body.addEventListener("click",Fe),window.addEventListener("message",Pe),(v=t.edit)!=null&&v.objectId&&(m.value=t.edit.orig),te(B,async s=>{if(!s)return;const b=n.value.search;y.value&&(y.value.value=""),V.loading=!0,V.list=b.default?await b.default():await b.search(""),V.loading=!1}),te(()=>m.value,s=>{const{highlighter:b,texRenderer:H}=n.value;de.value=s,z.value=$l(s,{emojiMap:o.value.map,highlighter:b,texRenderer:H}),oe.value=xl(s),s?Xe(f.value):Xe.destroy(f.value)},{immediate:!0}),te(()=>n.value.emoji,s=>fl(s).then(b=>{o.value=b}),{immediate:!0})}),Re(()=>{document.body.removeEventListener("click",Fe),window.removeEventListener("message",Pe)}),(v,s)=>{var b,H;return r(),u("div",ia,[L(n).login!=="disable"&&j.value&&!((b=v.edit)!=null&&b.objectId)?(r(),u("div",ra,[h("div",sa,[h("button",{type:"submit",class:"wl-logout-btn",title:k.value.logout,onClick:$t},[G(L(mt),{size:14})],8,ca),h("a",{href:"#",class:"wl-login-nick","aria-label":"Profile",title:k.value.profile,onClick:Te},[h("img",{src:L(g).avatar,alt:"avatar"},null,8,va)],8,ua)]),h("a",{href:"#",class:"wl-login-nick","aria-label":"Profile",title:k.value.profile,onClick:Te,textContent:_(L(g).display_name)},null,8,ma)])):E("v-if",!0),h("div",da,[L(n).login!=="force"&&L(n).meta.length&&!j.value?(r(),u("div",{key:0,class:q(["wl-header",`item${L(n).meta.length}`])},[(r(!0),u(P,null,X(L(n).meta,C=>(r(),u("div",{key:C,class:"wl-header-item"},[h("label",{for:`wl-${C}`,textContent:_(k.value[C]+(L(n).requiredMeta.includes(C)||!L(n).requiredMeta.length?"":`(${k.value.optional})`))},null,8,pa),we(h("input",{id:`wl-${C}`,ref_for:!0,ref:O=>{O&&(c.value[C]=O)},"onUpdate:modelValue":O=>L(d)[C]=O,class:q(["wl-input",`wl-${C}`]),name:C,type:C==="mail"?"email":"text"},null,10,ga),[[Vt,L(d)[C]]])]))),128))],2)):E("v-if",!0),we(h("textarea",{id:"wl-edit",ref_key:"editorRef",ref:f,"onUpdate:modelValue":s[0]||(s[0]=C=>Tt(m)?m.value=C:null),class:"wl-editor",placeholder:v.replyUser?`@${v.replyUser}`:k.value.placeholder,onKeydown:J,onDrop:ce,onPaste:He},null,40,ha),[[Ft,L(m)]]),we(h("div",fa,[wa,h("h4",null,_(k.value.preview)+":",1),h("div",{class:"wl-content",innerHTML:z.value},null,8,ya)],512),[[Ge,I.value]]),h("div",ka,[h("div",ba,[h("a",Ca,[G(L(Sl))]),we(h("button",{ref_key:"emojiButtonRef",ref:p,type:"button",class:q(["wl-action",{active:F.value}]),title:k.value.emoji,onClick:s[1]||(s[1]=C=>F.value=!F.value)},[G(L(Ul))],10,$a),[[Ge,o.value.tabs.length]]),L(n).search?(r(),u("button",{key:0,ref_key:"gifButtonRef",ref:M,type:"button",class:q(["wl-action",{active:B.value}]),title:k.value.gif,onClick:s[2]||(s[2]=C=>B.value=!B.value)},[G(L(Vl))],10,La)):E("v-if",!0),h("input",{id:"wl-image-upload",ref_key:"imageUploadRef",ref:S,class:"upload",type:"file",accept:".png,.jpg,.jpeg,.webp,.bmp,.gif",onChange:Ce},null,544),K.value?(r(),u("label",{key:1,for:"wl-image-upload",class:"wl-action",title:k.value.uploadImage},[G(L(Al))],8,Ra)):E("v-if",!0),h("button",{type:"button",class:q(["wl-action",{active:I.value}]),title:k.value.preview,onClick:s[3]||(s[3]=C=>I.value=!I.value)},[G(L(Ml))],10,xa)]),h("div",Ea,[Ia,h("div",Ua,[ae(_(oe.value)+" ",1),L(n).wordLimit?(r(),u("span",Aa,[ae("  /  "),h("span",{class:q({illegal:!ee.value}),textContent:_(ne.value)},null,10,_a)])):E("v-if",!0),ae("  "+_(k.value.word),1)]),L(n).login!=="disable"&&!j.value?(r(),u("button",{key:0,type:"button",class:"wl-btn",onClick:Ct,textContent:_(k.value.login)},null,8,Ma)):E("v-if",!0),L(n).login!=="force"||j.value?(r(),u("button",{key:1,type:"submit",class:"primary wl-btn",title:"Cmd|Ctrl + Enter",disabled:Y.value,onClick:Ve},[Y.value?(r(),le(L(ve),{key:0,size:16})):(r(),u(P,{key:1},[ae(_(k.value.submit),1)],64))],8,Sa)):E("v-if",!0)]),h("div",{ref_key:"gifPopupRef",ref:R,class:q(["wl-gif-popup",{display:B.value}])},[h("input",{ref_key:"gifSearchInputRef",ref:y,type:"text",placeholder:k.value.gifSearchPlaceholder,onInput:s[4]||(s[4]=(...C)=>L(We)&&L(We)(...C))},null,40,ja),V.list.length?(r(),le(oa,{key:0,items:V.list,"column-width":200,gap:6,onInsert:s[5]||(s[5]=C=>D(C)),onScroll:Ne},null,8,["items"])):E("v-if",!0),V.loading?(r(),u("div",za,[G(L(ve),{size:30})])):E("v-if",!0)],2),h("div",{ref_key:"emojiPopupRef",ref:A,class:q(["wl-emoji-popup",{display:F.value}])},[(r(!0),u(P,null,X(o.value.tabs,(C,O)=>(r(),u(P,{key:C.name},[O===w.value?(r(),u("div",Ha,[(r(!0),u(P,null,X(C.items,N=>(r(),u("button",{key:N,type:"button",title:N,onClick:Q=>D(`:${N}:`)},[F.value?(r(),u("img",{key:0,class:"wl-emoji",src:o.value.map[N],alt:N,loading:"lazy",referrerPolicy:"no-referrer"},null,8,Ta)):E("v-if",!0)],8,Va))),128))])):E("v-if",!0)],64))),128)),o.value.tabs.length>1?(r(),u("div",Fa,[(r(!0),u(P,null,X(o.value.tabs,(C,O)=>(r(),u("button",{key:C.name,type:"button",class:q(["wl-tab",{active:w.value===O}]),onClick:N=>w.value=O},[h("img",{class:"wl-emoji",src:C.icon,alt:C.name,title:C.name,loading:"lazy",referrerPolicy:"no-referrer"},null,8,Wa)],10,Na))),128))])):E("v-if",!0)],2)])]),v.replyId||(H=v.edit)!=null&&H.objectId?(r(),u("button",{key:1,type:"button",class:"wl-close",title:k.value.cancelReply,onClick:s[6]||(s[6]=C=>v.$emit(v.replyId?"cancelReply":"cancelEdit"))},[G(L(mt),{size:24})],8,Pa)):E("v-if",!0)])}}}),wt=me(Ba,[["__file","CommentBox.vue"]]);const Da=["id"],Oa={class:"wl-user","aria-hidden":"true"},qa=["src"],Ka={class:"wl-card"},Za={class:"wl-head"},Ga=["href"],Ja={key:1,class:"wl-nick"},Xa=["textContent"],Ya=["textContent"],Qa=["textContent"],en=["textContent"],tn=["textContent"],ln={class:"wl-comment-actions"},an=["title"],nn=["title"],on={class:"wl-meta","aria-hidden":"true"},rn=["data-value","textContent"],sn=["innerHTML"],cn={key:1,class:"wl-admin-actions"},un={class:"wl-comment-status"},vn=["disabled","onClick","textContent"],mn={key:3,class:"wl-quote"};var dn=ue({__name:"CommentCard",props:{comment:{},edit:{default:null},rootId:{},reply:{default:null}},emits:["log","submit","delete","edit","like","status","sticky","reply"],setup(e,{emit:a}){const l=e,t=a,i=["approved","waiting","spam"],n=Le("config"),m=pt(),d=Ot(),g=be(),c=W(()=>n.value.locale),f=W(()=>{const{link:o}=l.comment;return o?it(o)?o:`https://${o}`:""}),S=W(()=>m.value.includes(l.comment.objectId)),p=W(()=>ml(l.comment.insertedAt,d.value,c.value)),A=W(()=>g.value.type==="administrator"),M=W(()=>l.comment.user_id&&g.value.objectId===l.comment.user_id),R=W(()=>{var o;return l.comment.objectId===((o=l.reply)==null?void 0:o.objectId)}),y=W(()=>{var o;return l.comment.objectId===((o=l.edit)==null?void 0:o.objectId)});return(o,w)=>{var F;const B=Nt("CommentCard",!0);return r(),u("div",{id:o.comment.objectId,class:"wl-card-item"},[h("div",Oa,[o.comment.avatar?(r(),u("img",{key:0,class:"wl-user-avatar",src:o.comment.avatar},null,8,qa)):E("v-if",!0),o.comment.type?(r(),le(L(Hl),{key:1})):E("v-if",!0)]),h("div",Ka,[h("div",Za,[f.value?(r(),u("a",{key:0,class:"wl-nick",href:f.value,target:"_blank",rel:"nofollow noopener noreferrer"},_(o.comment.nick),9,Ga)):(r(),u("span",Ja,_(o.comment.nick),1)),o.comment.type==="administrator"?(r(),u("span",{key:2,class:"wl-badge",textContent:_(c.value.admin)},null,8,Xa)):E("v-if",!0),o.comment.label?(r(),u("span",{key:3,class:"wl-badge",textContent:_(o.comment.label)},null,8,Ya)):E("v-if",!0),o.comment.sticky?(r(),u("span",{key:4,class:"wl-badge",textContent:_(c.value.sticky)},null,8,Qa)):E("v-if",!0),typeof o.comment.level=="number"?(r(),u("span",{key:5,class:q(`wl-badge level${o.comment.level}`),textContent:_(c.value[`level${o.comment.level}`]||`Level ${o.comment.level}`)},null,10,en)):E("v-if",!0),h("span",{class:"wl-time",textContent:_(p.value)},null,8,tn),h("div",ln,[A.value||M.value?(r(),u(P,{key:0},[h("button",{type:"button",class:"wl-edit",onClick:w[0]||(w[0]=I=>t("edit",o.comment))},[G(L(zl))]),h("button",{type:"button",class:"wl-delete",onClick:w[1]||(w[1]=I=>t("delete",o.comment))},[G(L(Il))])],64)):E("v-if",!0),h("button",{type:"button",class:"wl-like",title:S.value?c.value.cancelLike:c.value.like,onClick:w[2]||(w[2]=I=>t("like",o.comment))},[G(L(_l),{active:S.value},null,8,["active"]),ae(" "+_("like"in o.comment?o.comment.like:""),1)],8,an),h("button",{type:"button",class:q(["wl-reply",{active:R.value}]),title:R.value?c.value.cancelReply:c.value.reply,onClick:w[3]||(w[3]=I=>t("reply",R.value?null:o.comment))},[G(L(jl))],10,nn)])]),h("div",on,[(r(),u(P,null,X(["addr","browser","os"],I=>(r(),u(P,null,[o.comment[I]?(r(),u("span",{key:I,class:q(`wl-${I}`),"data-value":o.comment[I],textContent:_(o.comment[I])},null,10,rn)):E("v-if",!0)],64))),64))]),y.value?E("v-if",!0):(r(),u("div",{key:0,class:"wl-content",innerHTML:o.comment.comment},null,8,sn)),A.value&&!y.value?(r(),u("div",cn,[h("span",un,[(r(),u(P,null,X(i,I=>h("button",{key:I,type:"submit",class:q(`wl-btn wl-${I}`),disabled:o.comment.status===I,onClick:z=>t("status",{status:I,comment:o.comment}),textContent:_(c.value[I])},null,10,vn)),64))]),A.value&&!("rid"in o.comment)?(r(),u("button",{key:0,type:"submit",class:"wl-btn wl-sticky",onClick:w[4]||(w[4]=I=>t("sticky",o.comment))},_(o.comment.sticky?c.value.unsticky:c.value.sticky),1)):E("v-if",!0)])):E("v-if",!0),R.value||y.value?(r(),u("div",{key:2,class:q({"wl-reply-wrapper":R.value,"wl-edit-wrapper":y.value})},[G(wt,{edit:o.edit,"reply-id":(F=o.reply)==null?void 0:F.objectId,"reply-user":o.comment.nick,"root-id":o.rootId,onLog:w[5]||(w[5]=I=>t("log")),onCancelReply:w[6]||(w[6]=I=>t("reply",null)),onCancelEdit:w[7]||(w[7]=I=>t("edit",null)),onSubmit:w[8]||(w[8]=I=>t("submit",I))},null,8,["edit","reply-id","reply-user","root-id"])],2)):E("v-if",!0),"children"in o.comment?(r(),u("div",mn,[(r(!0),u(P,null,X(o.comment.children,I=>(r(),le(B,{key:I.objectId,comment:I,reply:o.reply,edit:o.edit,"root-id":o.rootId,onLog:w[9]||(w[9]=z=>t("log")),onDelete:w[10]||(w[10]=z=>t("delete",z)),onEdit:w[11]||(w[11]=z=>t("edit",z)),onLike:w[12]||(w[12]=z=>t("like",z)),onReply:w[13]||(w[13]=z=>t("reply",z)),onStatus:w[14]||(w[14]=z=>t("status",z)),onSticky:w[15]||(w[15]=z=>t("sticky",z)),onSubmit:w[16]||(w[16]=z=>t("submit",z))},null,8,["comment","reply","edit","root-id"]))),128))])):E("v-if",!0)])],8,Da)}}}),pn=me(dn,[["__file","CommentCard.vue"]]);const yt="3.0.0-alpha.7",gn={"data-waline":""},hn={class:"wl-meta-head"},fn={class:"wl-count"},wn=["textContent"],yn={class:"wl-sort"},kn=["onClick"],bn={class:"wl-cards"},Cn={key:1,class:"wl-operation"},$n=["textContent"],Ln={key:2,class:"wl-loading"},Rn=["textContent"],xn={key:4,class:"wl-operation"},En=["textContent"],In={key:5,class:"wl-power"},Un=h("a",{href:"https://github.com/walinejs/waline",target:"_blank",rel:"noopener noreferrer"}," Waline ",-1);var An=ue({__name:"WalineComment",props:["serverURL","path","meta","requiredMeta","dark","commentSorting","lang","locale","pageSize","wordLimit","emoji","login","highlighter","texRenderer","imageUploader","search","copyright","recaptchaV3Key","turnstileKey","reaction"],setup(e){const a=e,l={latest:"insertedAt_desc",oldest:"insertedAt_asc",hottest:"like_desc"},t=Object.keys(l),i=be(),n=pt(),m=x("loading"),d=x(0),g=x(1),c=x(0),f=W(()=>cl(a)),S=x(f.value.commentSorting),p=x([]),A=x(null),M=x(null),R=W(()=>ul(f.value.dark)),y=W(()=>f.value.locale);qt(R,{id:"waline-darkmode"});let o;const w=$=>{var k;const{serverURL:j,path:K,pageSize:D}=f.value,J=new AbortController;m.value="loading",o==null||o(),At({serverURL:j,lang:f.value.lang,path:K,pageSize:D,sortBy:l[S.value],page:$,signal:J.signal,token:(k=i.value)==null?void 0:k.token}).then(Z=>{m.value="success",d.value=Z.count,p.value.push(...Z.data),g.value=$,c.value=Z.totalPages}).catch(Z=>{Z.name!=="AbortError"&&(console.error(Z.message),m.value="error")}),o=J.abort.bind(J)},F=()=>w(g.value+1),B=()=>{d.value=0,p.value=[],w(1)},I=$=>{S.value!==$&&(S.value=$,B())},z=$=>{A.value=$},oe=$=>{M.value=$},V=$=>{if(M.value)M.value.comment=$.comment,M.value.orig=$.orig;else if("rid"in $){const k=p.value.find(({objectId:j})=>j===$.rid);if(!k)return;Array.isArray(k.children)||(k.children=[]),k.children.push($)}else p.value.unshift($),d.value+=1},ne=async({comment:$,status:k})=>{var j;if($.status===k)return;const{serverURL:K,lang:D}=f.value;await he({serverURL:K,lang:D,token:(j=i.value)==null?void 0:j.token,objectId:$.objectId,comment:{status:k}}),$.status=k},ee=async $=>{var k;if("rid"in $)return;const{serverURL:j,lang:K}=f.value;await he({serverURL:j,lang:K,token:(k=i.value)==null?void 0:k.token,objectId:$.objectId,comment:{sticky:$.sticky?0:1}}),$.sticky=!$.sticky},de=async({objectId:$})=>{var k;if(!confirm("Are you sure you want to delete this comment?"))return;const{serverURL:j,lang:K}=f.value;await Ut({serverURL:j,lang:K,token:(k=i.value)==null?void 0:k.token,objectId:$}),p.value.some((D,J)=>D.objectId===$?(p.value=p.value.filter((Z,ce)=>ce!==J),!0):D.children.some((Z,ce)=>Z.objectId===$?(p.value[J].children=D.children.filter((He,Ce)=>Ce!==ce),!0):!1))},Y=async $=>{var k;const{serverURL:j,lang:K}=f.value,{objectId:D}=$,J=n.value.includes(D);await he({serverURL:j,lang:K,objectId:D,token:(k=i.value)==null?void 0:k.token,comment:{like:!J}}),J?n.value=n.value.filter(Z=>Z!==D):(n.value=[...n.value,D],n.value.length>50&&(n.value=n.value.slice(-50))),$.like=($.like||0)+(J?-1:1)};return Wt("config",f),fe(()=>{te(()=>[a.serverURL,a.path],()=>B(),{immediate:!0})}),Re(()=>o==null?void 0:o()),($,k)=>(r(),u("div",gn,[G(ta),A.value?E("v-if",!0):(r(),le(wt,{key:0,onLog:B,onSubmit:V})),h("div",hn,[h("div",fn,[d.value?(r(),u("span",{key:0,class:"wl-num",textContent:_(d.value)},null,8,wn)):E("v-if",!0),ae(" "+_(y.value.comment),1)]),h("ul",yn,[(r(!0),u(P,null,X(L(t),j=>(r(),u("li",{key:j,class:q([j===S.value?"active":""]),onClick:K=>I(j)},_(y.value[j]),11,kn))),128))])]),h("div",bn,[(r(!0),u(P,null,X(p.value,j=>(r(),le(pn,{key:j.objectId,"root-id":j.objectId,comment:j,reply:A.value,edit:M.value,onLog:B,onReply:z,onEdit:oe,onSubmit:V,onStatus:ne,onDelete:de,onSticky:ee,onLike:Y},null,8,["root-id","comment","reply","edit"]))),128))]),m.value==="error"?(r(),u("div",Cn,[h("button",{type:"button",class:"wl-btn",onClick:B,textContent:_(y.value.refresh)},null,8,$n)])):m.value==="loading"?(r(),u("div",Ln,[G(L(ve),{size:30})])):p.value.length?g.value<c.value?(r(),u("div",xn,[h("button",{type:"button",class:"wl-btn",onClick:F,textContent:_(y.value.more)},null,8,En)])):E("v-if",!0):(r(),u("div",{key:3,class:"wl-empty",textContent:_(y.value.sofa)},null,8,Rn)),f.value.copyright?(r(),u("div",In,[ae(" Powered by "),Un,ae(" v"+_(L(yt)),1)])):E("v-if",!0)]))}}),_n=me(An,[["__file","WalineComment.vue"]]);const kt=(e,a)=>{a.forEach((l,t)=>{l.innerText=e[t].toString()})},bt=({serverURL:e,path:a=window.location.pathname,selector:l=".waline-pageview-count",update:t=!0,lang:i=navigator.language})=>{const n=new AbortController,m=Array.from(document.querySelectorAll(l)),d=c=>{const f=ze(c);return f!==null&&a!==f},g=c=>Mt({serverURL:ke(e),paths:c.map(f=>ze(f)||a),lang:i,signal:n.signal}).then(f=>kt(f,c)).catch(st);if(t){const c=m.filter(S=>!d(S)),f=m.filter(d);_t({serverURL:ke(e),path:a,lang:i}).then(([S])=>kt(new Array(c.length).fill(S),c)),f.length&&g(f)}else g(m);return n.abort.bind(n)},Mn=({el:e="#waline",path:a=window.location.pathname,comment:l=!1,pageview:t=!1,...i})=>{const n=e?je(e):null;if(e&&!n)throw new Error("Option 'el' do not match any domElement!");if(!i.serverURL)throw new Error("Option 'serverURL' is missing!");const m=xe({...i}),d=xe({comment:l,pageview:t,path:a}),g=()=>{d.comment&&vt({serverURL:m.serverURL,path:d.path,...typeof d.comment=="string"?{selector:d.comment}:{}})},c=()=>{d.pageview&&bt({serverURL:m.serverURL,path:d.path,...typeof d.pageview=="string"?{selector:d.pageview}:{}})},f=n?Pt(()=>U(_n,{path:d.path,...m})):null;f&&f.mount(n);const S=Je(g),p=Je(c);return{el:n,update:({comment:A,pageview:M,path:R=window.location.pathname,...y}={})=>{Object.entries(y).forEach(([o,w])=>{m[o]=w}),d.path=R,A!==void 0&&(d.comment=A),M!==void 0&&(d.pageview=M)},destroy:()=>{f==null||f.unmount(),S(),p()}}},Sn=({el:e,serverURL:a,count:l,lang:t=navigator.language})=>{var i;const n=be(),m=je(e),d=new AbortController;return St({serverURL:a,count:l,lang:t,signal:d.signal,token:(i=n.value)==null?void 0:i.token}).then(g=>m&&g.length?(m.innerHTML=`<ul class="wl-recent-list">${g.map(c=>`<li class="wl-recent-item"><a href="${c.url}">${c.nick}</a>:${c.comment}</li>`).join("")}</ul>`,{comments:g,destroy:()=>{d.abort(),m.innerHTML=""}}):{comments:g,destroy:()=>d.abort()})},jn=({el:e,serverURL:a,count:l,locale:t,lang:i=navigator.language,mode:n="list"})=>{const m=je(e),d=new AbortController;return jt({serverURL:a,pageSize:l,lang:i,signal:d.signal}).then(g=>!m||!g.length?{users:g,destroy:()=>d.abort()}:(t={...se[i]||se[et],...typeof t=="object"?t:{}},m.innerHTML=`<ul class="wl-user-${n}">${g.map((c,f)=>[`<li class="wl-user-item" aria-label="${c.nick}">`,c.link&&`<a href="${c.link}" target="_blank">`,'<div class="wl-user-avatar">',`<img src="${c.avatar}" alt="${c.nick}">`,`<span class="wl-user-badge">${f+1}</span>`,"</div>",'<div class="wl-user-meta">','<div class="wl-user-name">',c.nick,c.level&&`<span class="wl-badge">${t?t[`level${c.level}`]:`Level ${c.level}`}</span>`,c.label&&`<span class="wl-badge">${c.label}</span>`,"</div>",c.link&&c.link,"</div>",c.link&&"</a>","</li>"].filter(S=>S).join("")).join("")}</ul>`,{users:g,destroy:()=>{d.abort(),m.innerHTML=""}}))};export{Sn as RecentComments,jn as UserList,vt as commentCount,se as defaultLocales,Mn as init,bt as pageviewCount,yt as version};
//# sourceMappingURL=shim.js.map
{
"name": "@waline/client",
"version": "3.0.0-alpha.6",
"version": "3.0.0-alpha.7",
"description": "client for waline comment system",

@@ -94,2 +94,3 @@ "keywords": [

"marked-highlight": "^2.0.9",
"recaptcha-v3": "^1.10.0",
"vue": "^3.3.11"

@@ -104,3 +105,2 @@ },

"@vitejs/plugin-vue": "4.5.2",
"recaptcha-v3": "1.10.0",
"user-agent-data-types": "0.4.2",

@@ -107,0 +107,0 @@ "vite": "5.0.8"

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc