@waline/client 2.7.1 → 2.9.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (61) hide show
  1. package/LICENSE +339 -0
  2. package/README.md +11 -0
  3. package/dist/component.mjs +2 -0
  4. package/dist/component.mjs.map +1 -0
  5. package/dist/{legacy.d.ts → legacy.umd.d.ts} +0 -0
  6. package/dist/legacy.umd.js +2 -0
  7. package/dist/legacy.umd.js.map +1 -0
  8. package/dist/{pageview.cjs.js → pageview.cjs} +2 -2
  9. package/dist/pageview.cjs.map +1 -0
  10. package/dist/{pageview.cjs.d.ts → pageview.d.cts} +0 -0
  11. package/dist/{pageview.esm.d.ts → pageview.d.mts} +0 -0
  12. package/dist/pageview.js +1 -1
  13. package/dist/pageview.js.map +1 -1
  14. package/dist/{pageview.esm.js → pageview.mjs} +2 -2
  15. package/dist/pageview.mjs.map +1 -0
  16. package/dist/shim.cjs +2 -0
  17. package/dist/shim.cjs.map +1 -0
  18. package/dist/{waline.esm.d.ts → shim.d.cts} +5 -0
  19. package/dist/{shim.d.ts → shim.d.mts} +5 -0
  20. package/dist/shim.mjs +2 -0
  21. package/dist/shim.mjs.map +1 -0
  22. package/dist/waline-meta.css +1 -0
  23. package/dist/waline-meta.css.map +1 -0
  24. package/dist/waline.cjs +2 -0
  25. package/dist/waline.cjs.map +1 -0
  26. package/dist/waline.css +1 -1
  27. package/dist/waline.css.map +1 -1
  28. package/dist/{shim.esm.d.ts → waline.d.cts} +5 -0
  29. package/dist/{waline.cjs.d.ts → waline.d.mts} +5 -0
  30. package/dist/waline.d.ts +5 -0
  31. package/dist/waline.js +1 -1
  32. package/dist/waline.js.map +1 -1
  33. package/dist/waline.mjs +2 -0
  34. package/dist/waline.mjs.map +1 -0
  35. package/package.json +51 -35
  36. package/src/components/CommentBox.vue +19 -4
  37. package/src/components/CommentCard.vue +71 -10
  38. package/src/components/Icons.ts +10 -0
  39. package/src/components/Waline.vue +13 -1
  40. package/src/styles/card.scss +2 -5
  41. package/src/styles/helpers/_svg.scss +51 -0
  42. package/src/styles/layout.scss +4 -4
  43. package/src/styles/meta.scss +86 -0
  44. package/src/typings/comment.ts +6 -0
  45. package/src/utils/fetch.ts +8 -0
  46. package/dist/component.esm.js +0 -2
  47. package/dist/component.esm.js.map +0 -1
  48. package/dist/component.js +0 -2
  49. package/dist/component.js.map +0 -1
  50. package/dist/legacy.js +0 -2
  51. package/dist/legacy.js.map +0 -1
  52. package/dist/pageview.cjs.js.map +0 -1
  53. package/dist/pageview.esm.js.map +0 -1
  54. package/dist/shim.esm.js +0 -2
  55. package/dist/shim.esm.js.map +0 -1
  56. package/dist/shim.js +0 -2
  57. package/dist/shim.js.map +0 -1
  58. package/dist/waline.cjs.js +0 -2
  59. package/dist/waline.cjs.js.map +0 -1
  60. package/dist/waline.esm.js +0 -2
  61. package/dist/waline.esm.js.map +0 -1
@@ -32,6 +32,14 @@
32
32
  <span class="wl-time" v-text="time" />
33
33
 
34
34
  <div class="wl-comment-actions">
35
+ <button
36
+ v-if="isAdmin || isOwner"
37
+ class="wl-edit"
38
+ @click="$emit('edit', comment)"
39
+ >
40
+ <EditIcon />
41
+ </button>
42
+
35
43
  <button
36
44
  v-if="isAdmin || isOwner"
37
45
  class="wl-delete"
@@ -60,14 +68,34 @@
60
68
  </div>
61
69
  </div>
62
70
  <div class="wl-meta" aria-hidden="true">
63
- <span v-if="comment.addr" v-text="comment.addr" />
64
- <span v-if="comment.browser" v-text="comment.browser" />
65
- <span v-if="comment.os" v-text="comment.os" />
71
+ <span
72
+ v-if="comment.addr"
73
+ class="wl-addr"
74
+ :data-value="comment.addr"
75
+ v-text="comment.addr"
76
+ />
77
+ <span
78
+ v-if="comment.browser"
79
+ class="wl-browser"
80
+ :data-value="comment.browser"
81
+ v-text="comment.browser"
82
+ />
83
+ <span
84
+ v-if="comment.os"
85
+ class="wl-os"
86
+ :data-value="comment.os"
87
+ v-text="comment.os"
88
+ />
66
89
  </div>
67
- <!-- eslint-disable-next-line vue/no-v-html -->
68
- <div class="wl-content" v-html="comment.comment" />
90
+ <!-- eslint-disable vue/no-v-html -->
91
+ <div
92
+ v-if="!isEditingCurrent"
93
+ class="wl-content"
94
+ v-html="comment.comment"
95
+ />
96
+ <!-- eslint-enable vue/no-v-html -->
69
97
 
70
- <div v-if="isAdmin" class="wl-admin-actions">
98
+ <div v-if="isAdmin && !isEditingCurrent" class="wl-admin-actions">
71
99
  <span class="wl-comment-status">
72
100
  <button
73
101
  v-for="status in commentStatus"
@@ -88,13 +116,21 @@
88
116
  </button>
89
117
  </div>
90
118
 
91
- <div v-if="isReplyingCurrent" class="wl-reply-wrapper">
119
+ <div
120
+ v-if="isReplyingCurrent || isEditingCurrent"
121
+ :class="{
122
+ 'wl-reply-wrapper': isReplyingCurrent,
123
+ 'wl-edit-wrapper': isEditingCurrent,
124
+ }"
125
+ >
92
126
  <CommentBox
93
- :reply-id="comment.objectId"
127
+ :edit="edit"
128
+ :reply-id="reply?.objectId"
94
129
  :reply-user="comment.nick"
95
130
  :root-id="rootId"
96
131
  @submit="$emit('submit', $event)"
97
132
  @cancel-reply="$emit('reply', null)"
133
+ @cancel-edit="$emit('edit', null)"
98
134
  />
99
135
  </div>
100
136
  <div v-if="comment.children" class="wl-quote">
@@ -103,10 +139,12 @@
103
139
  :key="child.objectId"
104
140
  :comment="child"
105
141
  :reply="reply"
142
+ :edit="edit"
106
143
  :root-id="rootId"
107
144
  @reply="$emit('reply', $event)"
108
145
  @submit="$emit('submit', $event)"
109
146
  @like="$emit('like', $event)"
147
+ @edit="$emit('edit', $event)"
110
148
  @delete="$emit('delete', $event)"
111
149
  @status="$emit('status', $event)"
112
150
  @sticky="$emit('sticky', $event)"
@@ -119,7 +157,13 @@
119
157
  <script lang="ts">
120
158
  import { computed, defineComponent, inject } from 'vue';
121
159
  import CommentBox from './CommentBox.vue';
122
- import { DeleteIcon, LikeIcon, ReplyIcon, VerifiedIcon } from './Icons';
160
+ import {
161
+ DeleteIcon,
162
+ LikeIcon,
163
+ ReplyIcon,
164
+ EditIcon,
165
+ VerifiedIcon,
166
+ } from './Icons';
123
167
  import { isLinkHttp } from '../utils';
124
168
  import { useTimeAgo, useLikeStorage, useUserInfo } from '../composables';
125
169
 
@@ -135,6 +179,7 @@ export default defineComponent({
135
179
  DeleteIcon,
136
180
  LikeIcon,
137
181
  ReplyIcon,
182
+ EditIcon,
138
183
  VerifiedIcon,
139
184
  },
140
185
 
@@ -151,9 +196,13 @@ export default defineComponent({
151
196
  type: Object as PropType<WalineComment | null>,
152
197
  default: null,
153
198
  },
199
+ edit: {
200
+ type: Object as PropType<WalineComment | null>,
201
+ default: null,
202
+ },
154
203
  },
155
204
 
156
- emits: ['submit', 'reply', 'like', 'delete', 'status', 'sticky'],
205
+ emits: ['submit', 'reply', 'like', 'delete', 'status', 'sticky', 'edit'],
157
206
 
158
207
  setup(props) {
159
208
  const config = inject<ComputedRef<WalineConfig>>(
@@ -182,15 +231,27 @@ export default defineComponent({
182
231
  userInfo.value.objectId === props.comment.user_id
183
232
  );
184
233
 
234
+ console.log(
235
+ 'lizheming:',
236
+ props.comment.user_id,
237
+ userInfo.value.objectId,
238
+ isOwner.value
239
+ );
240
+
185
241
  const isReplyingCurrent = computed(
186
242
  () => props.comment.objectId === props.reply?.objectId
187
243
  );
188
244
 
245
+ const isEditingCurrent = computed(
246
+ () => props.comment.objectId === props.edit?.objectId
247
+ );
248
+
189
249
  return {
190
250
  config,
191
251
  locale,
192
252
 
193
253
  isReplyingCurrent,
254
+ isEditingCurrent,
194
255
  link,
195
256
  like,
196
257
  time,
@@ -102,6 +102,16 @@ export const ReplyIcon: FunctionalComponent = () =>
102
102
  })
103
103
  );
104
104
 
105
+ export const EditIcon: FunctionalComponent = () =>
106
+ h(
107
+ 'svg',
108
+ { viewBox: '0 0 1024 1024', width: '24', height: '24' },
109
+ h('path', {
110
+ 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',
111
+ fill: 'currentColor',
112
+ })
113
+ );
114
+
105
115
  export const VerifiedIcon: FunctionalComponent = () =>
106
116
  h(
107
117
  'svg',
@@ -25,7 +25,9 @@
25
25
  :root-id="comment.objectId"
26
26
  :comment="comment"
27
27
  :reply="reply"
28
+ :edit="edit"
28
29
  @reply="onReply"
30
+ @edit="onEdit"
29
31
  @submit="onSubmit"
30
32
  @status="onStatusChange"
31
33
  @delete="onDelete"
@@ -263,6 +265,7 @@ export default defineComponent({
263
265
 
264
266
  const data = ref<WalineComment[]>([]);
265
267
  const reply = ref<WalineComment | null>(null);
268
+ const edit = ref<WalineComment | null>(null);
266
269
 
267
270
  const darkmodeStyle = computed(() => getDarkStyle(config.value.dark));
268
271
 
@@ -326,8 +329,15 @@ export default defineComponent({
326
329
  reply.value = comment;
327
330
  };
328
331
 
332
+ const onEdit = (comment: WalineComment | null): void => {
333
+ edit.value = comment;
334
+ };
335
+
329
336
  const onSubmit = (comment: WalineComment): void => {
330
- if (comment.rid) {
337
+ if (edit.value) {
338
+ edit.value.comment = comment.comment;
339
+ edit.value.orig = comment.orig;
340
+ } else if (comment.rid) {
331
341
  const repliedComment = data.value.find(
332
342
  ({ objectId }) => objectId === comment.rid
333
343
  );
@@ -456,6 +466,7 @@ export default defineComponent({
456
466
  sortByItems,
457
467
  data,
458
468
  reply,
469
+ edit,
459
470
 
460
471
  loadMore,
461
472
  refresh,
@@ -466,6 +477,7 @@ export default defineComponent({
466
477
  onDelete,
467
478
  onSticky,
468
479
  onLike,
480
+ onEdit,
469
481
 
470
482
  version: VERSION,
471
483
  };
@@ -118,10 +118,6 @@
118
118
  font-size: var(--waline-info-font-size);
119
119
  line-height: 1.5;
120
120
 
121
- @media (max-width: 520px) {
122
- display: none;
123
- }
124
-
125
121
  &:empty {
126
122
  display: none;
127
123
  }
@@ -134,7 +130,8 @@
134
130
 
135
131
  .wl-delete,
136
132
  .wl-like,
137
- .wl-reply {
133
+ .wl-reply,
134
+ .wl-edit {
138
135
  display: inline-flex;
139
136
  align-items: center;
140
137
 
@@ -0,0 +1,51 @@
1
+ @use "sass:math";
2
+ @use "sass:string";
3
+
4
+ /* stylelint-disable scss/operator-no-newline-after */
5
+
6
+ @function string-replace($string, $search, $replace: "") {
7
+ $index: string.index($string, $search);
8
+ @return if(
9
+ $index,
10
+ str-slice($string, 1, $index - 1) + $replace +
11
+ string-replace(
12
+ str-slice($string, $index + str-length($search)),
13
+ $search,
14
+ $replace
15
+ ),
16
+ $string
17
+ );
18
+ }
19
+
20
+ @function svg-url($svg) {
21
+ $encoded: "";
22
+ $slice: 2000;
23
+ $index: 0;
24
+ $loops: math.ceil(math.div(string.length($svg), $slice));
25
+
26
+ @if not str-index($svg, xmlns) {
27
+ $svg: string-replace(
28
+ $svg,
29
+ "<svg",
30
+ '<svg xmlns="http://www.w3.org/2000/svg"'
31
+ );
32
+ }
33
+
34
+ @for $i from 1 through $loops {
35
+ $chunk: string.slice($svg, $index, $index + $slice - 1);
36
+ $chunk: string-replace($chunk, '"', "'");
37
+ $chunk: string-replace($chunk, "%", "%25");
38
+ $chunk: string-replace($chunk, "#", "%23");
39
+ $chunk: string-replace($chunk, "{", "%7B");
40
+ $chunk: string-replace($chunk, "}", "%7D");
41
+ $chunk: string-replace($chunk, "<", "%3C");
42
+ $chunk: string-replace($chunk, ">", "%3E");
43
+ $encoded: #{$encoded}#{$chunk};
44
+ $index: $index + $slice;
45
+ }
46
+ @return url("data:image/svg+xml,#{$encoded}");
47
+ }
48
+
49
+ @mixin background-svg($svg) {
50
+ background-image: svg-url($svg);
51
+ }
@@ -50,9 +50,9 @@
50
50
  }
51
51
 
52
52
  .wl-count {
53
+ flex: 1;
53
54
  font-weight: bold;
54
55
  font-size: 1.25em;
55
- flex: 1;
56
56
  }
57
57
 
58
58
  .wl-empty {
@@ -85,14 +85,14 @@
85
85
  }
86
86
 
87
87
  ul.wl-sort {
88
- list-style-type: none;
89
88
  margin: 0;
89
+ list-style-type: none;
90
90
  }
91
91
 
92
92
  .wl-sort li {
93
93
  display: inline-block;
94
- font-size: 0.75em;
95
94
  color: var(--waline-info-color);
95
+ font-size: 0.75em;
96
96
  cursor: pointer;
97
97
  }
98
98
 
@@ -102,4 +102,4 @@ ul.wl-sort {
102
102
 
103
103
  .wl-sort li.active {
104
104
  color: var(--waline-theme-color);
105
- }
105
+ }
@@ -0,0 +1,86 @@
1
+ @use 'helpers/svg';
2
+
3
+ $address-icon: '<svg viewBox="0 0 512 512" fill="#999"><path d="M444.52 3.52 28.74 195.42c-47.97 22.39-31.98 92.75 19.19 92.75h175.91v175.91c0 51.17 70.36 67.17 92.75 19.19l191.9-415.78c15.99-38.39-25.59-79.97-63.97-63.97z"/></svg>';
4
+
5
+ $default-icon: '<svg viewBox="0 0 512 512" fill="#999"><path d="M464 32H48C21.5 32 0 53.5 0 80v352c0 26.5 21.5 48 48 48h416c26.5 0 48-21.5 48-48V80c0-26.5-21.5-48-48-48zm0 394c0 3.3-2.7 6-6 6H54c-3.3 0-6-2.7-6-6V192h416v234z"/></svg>';
6
+
7
+ $apple-icon: '<svg viewBox="0 0 384 512" fill="#999"><path d="M318.7 268.7c-.2-36.7 16.4-64.4 50-84.8-18.8-26.9-47.2-41.7-84.7-44.6-35.5-2.8-74.3 20.7-88.5 20.7-15 0-49.4-19.7-76.4-19.7C63.3 141.2 4 184.8 4 273.5q0 39.3 14.4 81.2c12.8 36.7 59 126.7 107.2 125.2 25.2-.6 43-17.9 75.8-17.9 31.8 0 48.3 17.9 76.4 17.9 48.6-.7 90.4-82.5 102.6-119.3-65.2-30.7-61.7-90-61.7-91.9zm-56.6-164.2c27.3-32.4 24.8-61.9 24-72.5-24.1 1.4-52 16.4-67.9 34.9-17.5 19.8-27.8 44.3-25.6 71.9 26.1 2 49.9-11.4 69.5-34.3z"/></svg>';
8
+
9
+ $android-icon: '<svg viewBox="0 0 576 512" fill="#999"><path d="M420.55 301.93a24 24 0 1 1 24-24 24 24 0 0 1-24 24m-265.1 0a24 24 0 1 1 24-24 24 24 0 0 1-24 24m273.7-144.48 47.94-83a10 10 0 1 0-17.27-10l-48.54 84.07a301.25 301.25 0 0 0-246.56 0l-48.54-84.07a10 10 0 1 0-17.27 10l47.94 83C64.53 202.22 8.24 285.55 0 384h576c-8.24-98.45-64.54-181.78-146.85-226.55"/></svg>';
10
+
11
+ $linux-icon: '<svg viewBox="0 0 448 512" fill="#999"><path d="M220.8 123.3c1 .5 1.8 1.7 3 1.7 1.1 0 2.8-.4 2.9-1.5.2-1.4-1.9-2.3-3.2-2.9-1.7-.7-3.9-1-5.5-.1-.4.2-.8.7-.6 1.1.3 1.3 2.3 1.1 3.4 1.7zm-21.9 1.7c1.2 0 2-1.2 3-1.7 1.1-.6 3.1-.4 3.5-1.6.2-.4-.2-.9-.6-1.1-1.6-.9-3.8-.6-5.5.1-1.3.6-3.4 1.5-3.2 2.9.1 1 1.8 1.5 2.8 1.4zM420 403.8c-3.6-4-5.3-11.6-7.2-19.7-1.8-8.1-3.9-16.8-10.5-22.4-1.3-1.1-2.6-2.1-4-2.9-1.3-.8-2.7-1.5-4.1-2 9.2-27.3 5.6-54.5-3.7-79.1-11.4-30.1-31.3-56.4-46.5-74.4-17.1-21.5-33.7-41.9-33.4-72C311.1 85.4 315.7.1 234.8 0 132.4-.2 158 103.4 156.9 135.2c-1.7 23.4-6.4 41.8-22.5 64.7-18.9 22.5-45.5 58.8-58.1 96.7-6 17.9-8.8 36.1-6.2 53.3-6.5 5.8-11.4 14.7-16.6 20.2-4.2 4.3-10.3 5.9-17 8.3s-14 6-18.5 14.5c-2.1 3.9-2.8 8.1-2.8 12.4 0 3.9.6 7.9 1.2 11.8 1.2 8.1 2.5 15.7.8 20.8-5.2 14.4-5.9 24.4-2.2 31.7 3.8 7.3 11.4 10.5 20.1 12.3 17.3 3.6 40.8 2.7 59.3 12.5 19.8 10.4 39.9 14.1 55.9 10.4 11.6-2.6 21.1-9.6 25.9-20.2 12.5-.1 26.3-5.4 48.3-6.6 14.9-1.2 33.6 5.3 55.1 4.1.6 2.3 1.4 4.6 2.5 6.7v.1c8.3 16.7 23.8 24.3 40.3 23 16.6-1.3 34.1-11 48.3-27.9 13.6-16.4 36-23.2 50.9-32.2 7.4-4.5 13.4-10.1 13.9-18.3.4-8.2-4.4-17.3-15.5-29.7zM223.7 87.3c9.8-22.2 34.2-21.8 44-.4 6.5 14.2 3.6 30.9-4.3 40.4-1.6-.8-5.9-2.6-12.6-4.9 1.1-1.2 3.1-2.7 3.9-4.6 4.8-11.8-.2-27-9.1-27.3-7.3-.5-13.9 10.8-11.8 23-4.1-2-9.4-3.5-13-4.4-1-6.9-.3-14.6 2.9-21.8zM183 75.8c10.1 0 20.8 14.2 19.1 33.5-3.5 1-7.1 2.5-10.2 4.6 1.2-8.9-3.3-20.1-9.6-19.6-8.4.7-9.8 21.2-1.8 28.1 1 .8 1.9-.2-5.9 5.5-15.6-14.6-10.5-52.1 8.4-52.1zm-13.6 60.7c6.2-4.6 13.6-10 14.1-10.5 4.7-4.4 13.5-14.2 27.9-14.2 7.1 0 15.6 2.3 25.9 8.9 6.3 4.1 11.3 4.4 22.6 9.3 8.4 3.5 13.7 9.7 10.5 18.2-2.6 7.1-11 14.4-22.7 18.1-11.1 3.6-19.8 16-38.2 14.9-3.9-.2-7-1-9.6-2.1-8-3.5-12.2-10.4-20-15-8.6-4.8-13.2-10.4-14.7-15.3-1.4-4.9 0-9 4.2-12.3zm3.3 334c-2.7 35.1-43.9 34.4-75.3 18-29.9-15.8-68.6-6.5-76.5-21.9-2.4-4.7-2.4-12.7 2.6-26.4v-.2c2.4-7.6.6-16-.6-23.9-1.2-7.8-1.8-15 .9-20 3.5-6.7 8.5-9.1 14.8-11.3 10.3-3.7 11.8-3.4 19.6-9.9 5.5-5.7 9.5-12.9 14.3-18 5.1-5.5 10-8.1 17.7-6.9 8.1 1.2 15.1 6.8 21.9 16l19.6 35.6c9.5 19.9 43.1 48.4 41 68.9zm-1.4-25.9c-4.1-6.6-9.6-13.6-14.4-19.6 7.1 0 14.2-2.2 16.7-8.9 2.3-6.2 0-14.9-7.4-24.9-13.5-18.2-38.3-32.5-38.3-32.5-13.5-8.4-21.1-18.7-24.6-29.9s-3-23.3-.3-35.2c5.2-22.9 18.6-45.2 27.2-59.2 2.3-1.7.8 3.2-8.7 20.8-8.5 16.1-24.4 53.3-2.6 82.4.6-20.7 5.5-41.8 13.8-61.5 12-27.4 37.3-74.9 39.3-112.7 1.1.8 4.6 3.2 6.2 4.1 4.6 2.7 8.1 6.7 12.6 10.3 12.4 10 28.5 9.2 42.4 1.2 6.2-3.5 11.2-7.5 15.9-9 9.9-3.1 17.8-8.6 22.3-15 7.7 30.4 25.7 74.3 37.2 95.7 6.1 11.4 18.3 35.5 23.6 64.6 3.3-.1 7 .4 10.9 1.4 13.8-35.7-11.7-74.2-23.3-84.9-4.7-4.6-4.9-6.6-2.6-6.5 12.6 11.2 29.2 33.7 35.2 59 2.8 11.6 3.3 23.7.4 35.7 16.4 6.8 35.9 17.9 30.7 34.8-2.2-.1-3.2 0-4.2 0 3.2-10.1-3.9-17.6-22.8-26.1-19.6-8.6-36-8.6-38.3 12.5-12.1 4.2-18.3 14.7-21.4 27.3-2.8 11.2-3.6 24.7-4.4 39.9-.5 7.7-3.6 18-6.8 29-32.1 22.9-76.7 32.9-114.3 7.2zm257.4-11.5c-.9 16.8-41.2 19.9-63.2 46.5-13.2 15.7-29.4 24.4-43.6 25.5s-26.5-4.8-33.7-19.3c-4.7-11.1-2.4-23.1 1.1-36.3 3.7-14.2 9.2-28.8 9.9-40.6.8-15.2 1.7-28.5 4.2-38.7 2.6-10.3 6.6-17.2 13.7-21.1.3-.2.7-.3 1-.5.8 13.2 7.3 26.6 18.8 29.5 12.6 3.3 30.7-7.5 38.4-16.3 9-.3 15.7-.9 22.6 5.1 9.9 8.5 7.1 30.3 17.1 41.6 10.6 11.6 14 19.5 13.7 24.6zM173.3 148.7c2 1.9 4.7 4.5 8 7.1 6.6 5.2 15.8 10.6 27.3 10.6 11.6 0 22.5-5.9 31.8-10.8 4.9-2.6 10.9-7 14.8-10.4s5.9-6.3 3.1-6.6-2.6 2.6-6 5.1c-4.4 3.2-9.7 7.4-13.9 9.8-7.4 4.2-19.5 10.2-29.9 10.2s-18.7-4.8-24.9-9.7c-3.1-2.5-5.7-5-7.7-6.9-1.5-1.4-1.9-4.6-4.3-4.9-1.4-.1-1.8 3.7 1.7 6.5z"/></svg>';
12
+
13
+ $ubuntu-icon: '<svg viewBox="0 0 496 512" fill="#999"><path d="M248 8C111 8 0 119 0 256s111 248 248 248 248-111 248-248S385 8 248 8zm52.7 93c8.8-15.2 28.3-20.5 43.5-11.7 15.3 8.8 20.5 28.3 11.7 43.6-8.8 15.2-28.3 20.5-43.5 11.7-15.3-8.9-20.5-28.4-11.7-43.6zM87.4 287.9c-17.6 0-31.9-14.3-31.9-31.9 0-17.6 14.3-31.9 31.9-31.9 17.6 0 31.9 14.3 31.9 31.9 0 17.6-14.3 31.9-31.9 31.9zm28.1 3.1c22.3-17.9 22.4-51.9 0-69.9 8.6-32.8 29.1-60.7 56.5-79.1l23.7 39.6c-51.5 36.3-51.5 112.5 0 148.8L172 370c-27.4-18.3-47.8-46.3-56.5-79zm228.7 131.7c-15.3 8.8-34.7 3.6-43.5-11.7-8.8-15.3-3.6-34.8 11.7-43.6 15.2-8.8 34.7-3.6 43.5 11.7 8.8 15.3 3.6 34.8-11.7 43.6zm.3-69.5c-26.7-10.3-56.1 6.6-60.5 35-5.2 1.4-48.9 14.3-96.7-9.4l22.5-40.3c57 26.5 123.4-11.7 128.9-74.4l46.1.7c-2.3 34.5-17.3 65.5-40.3 88.4zm-5.9-105.3c-5.4-62-71.3-101.2-128.9-74.4l-22.5-40.3c47.9-23.7 91.5-10.8 96.7-9.4 4.4 28.3 33.8 45.3 60.5 35 23.1 22.9 38 53.9 40.2 88.5l-46 .6z"/></svg>';
14
+
15
+ $window-icon: '<svg viewBox="0 0 448 512" fill="#999"><path d="m0 93.7 183.6-25.3v177.4H0V93.7zm0 324.6 183.6 25.3V268.4H0v149.9zm203.8 28L448 480V268.4H203.8v177.9zm0-380.6v180.1H448V32L203.8 65.7z"/></svg>';
16
+
17
+ $chrome-icon: '<svg viewBox="0 0 496 512" fill="#999"><path d="M131.5 217.5 55.1 100.1c47.6-59.2 119-91.8 192-92.1 42.3-.3 85.5 10.5 124.8 33.2 43.4 25.2 76.4 61.4 97.4 103L264 133.4c-58.1-3.4-113.4 29.3-132.5 84.1zm32.9 38.5c0 46.2 37.4 83.6 83.6 83.6s83.6-37.4 83.6-83.6-37.4-83.6-83.6-83.6-83.6 37.3-83.6 83.6zm314.9-89.2L339.6 174c37.9 44.3 38.5 108.2 6.6 157.2L234.1 503.6c46.5 2.5 94.4-7.7 137.8-32.9 107.4-62 150.9-192 107.4-303.9zM133.7 303.6 40.4 120.1C14.9 159.1 0 205.9 0 256c0 124 90.8 226.7 209.5 244.9l63.7-124.8c-57.6 10.8-113.2-20.8-139.5-72.5z"/></svg>';
18
+
19
+ $edge-icon: '<svg viewBox="0 0 512 512" fill="#999"><path d="M481.92 134.48C440.87 54.18 352.26 8 255.91 8 137.05 8 37.51 91.68 13.47 203.66c26-46.49 86.22-79.14 149.46-79.14 79.27 0 121.09 48.93 122.25 50.18 22 23.8 33 50.39 33 83.1 0 10.4-5.31 25.82-15.11 38.57-1.57 2-6.39 4.84-6.39 11 0 5.06 3.29 9.92 9.14 14 27.86 19.37 80.37 16.81 80.51 16.81A115.39 115.39 0 0 0 444.94 322a118.92 118.92 0 0 0 58.95-102.44c.5-43.43-15.5-72.3-21.97-85.08ZM212.77 475.67a154.88 154.88 0 0 1-46.64-45c-32.94-47.42-34.24-95.6-20.1-136A155.5 155.5 0 0 1 203 215.75c59-45.2 94.84-5.65 99.06-1a80 80 0 0 0-4.89-10.14c-9.24-15.93-24-36.41-56.56-53.51-33.72-17.69-70.59-18.59-77.64-18.59-38.71 0-77.9 13-107.53 35.69C35.68 183.3 12.77 208.72 8.6 243c-1.08 12.31-2.75 62.8 23 118.27a248 248 0 0 0 248.3 141.61c-38.12-6.62-65.85-26.64-67.13-27.21Zm250.72-98.33a7.76 7.76 0 0 0-7.92-.23 181.66 181.66 0 0 1-20.41 9.12 197.54 197.54 0 0 1-69.55 12.52c-91.67 0-171.52-63.06-171.52-144a61.12 61.12 0 0 1 6.52-26.75 168.72 168.72 0 0 0-38.76 50c-14.92 29.37-33 88.13 13.33 151.66 6.51 8.91 23 30 56 47.67 23.57 12.65 49 19.61 71.7 19.61 35.14 0 115.43-33.44 163-108.87a7.75 7.75 0 0 0-2.39-10.73Z"/></svg>';
20
+
21
+ $firefox-icon: '<svg viewBox="0 0 512 512" fill="#999"><path d="M189.37 152.86Zm-58.74-29.37c.16.01.08.01 0 0Zm351.42 45.35c-10.61-25.5-32.08-53-48.94-61.73 13.72 26.89 21.67 53.88 24.7 74 0 0 0 .14.05.41-27.58-68.75-74.35-96.47-112.55-156.83-1.93-3.05-3.86-6.11-5.74-9.33-1-1.65-1.86-3.34-2.69-5.05a44.88 44.88 0 0 1-3.64-9.62.63.63 0 0 0-.55-.66.9.9 0 0 0-.46 0l-.12.07-.18.1.1-.14c-54.23 31.77-76.72 87.38-82.5 122.78a130 130 0 0 0-48.33 12.33 6.25 6.25 0 0 0-3.09 7.75 6.13 6.13 0 0 0 7.79 3.79l.52-.21a117.84 117.84 0 0 1 42.11-11l1.42-.1c2-.12 4-.2 6-.22A122.61 122.61 0 0 1 291 140c.67.2 1.32.42 2 .63 1.89.57 3.76 1.2 5.62 1.87 1.36.5 2.71 1 4.05 1.58 1.09.44 2.18.88 3.25 1.35q2.52 1.13 5 2.35c.75.37 1.5.74 2.25 1.13q2.4 1.26 4.74 2.63 1.51.87 3 1.8a124.89 124.89 0 0 1 42.66 44.13c-13-9.15-36.35-18.19-58.82-14.28 87.74 43.86 64.18 194.9-57.39 189.2a108.43 108.43 0 0 1-31.74-6.12 139.5 139.5 0 0 1-7.16-2.93c-1.38-.63-2.76-1.27-4.12-2-29.84-15.34-54.44-44.42-57.51-79.75 0 0 11.25-41.95 80.62-41.95 7.5 0 28.93-20.92 29.33-27-.09-2-42.54-18.87-59.09-35.18-8.85-8.71-13.05-12.91-16.77-16.06a69.58 69.58 0 0 0-6.31-4.77 113.05 113.05 0 0 1-.69-59.63c-25.06 11.41-44.55 29.45-58.71 45.37h-.12c-9.67-12.25-9-52.65-8.43-61.08-.12-.53-7.22 3.68-8.15 4.31a178.54 178.54 0 0 0-23.84 20.43 214 214 0 0 0-22.77 27.33 205.84 205.84 0 0 0-32.73 73.9c-.06.27-2.33 10.21-4 22.48q-.42 2.87-.78 5.74c-.57 3.69-1 7.71-1.44 14 0 .24 0 .48-.05.72-.18 2.71-.34 5.41-.49 8.12v1.24c0 134.7 109.21 243.89 243.92 243.89 120.64 0 220.82-87.58 240.43-202.62.41-3.12.74-6.26 1.11-9.41 4.85-41.83-.54-85.79-15.82-122.55Z"/></svg>';
22
+
23
+ $ie-icon: '<svg viewBox="0 0 512 512" fill="#999"><path d="M483.049 159.706c10.855-24.575 21.424-60.438 21.424-87.871 0-72.722-79.641-98.371-209.673-38.577-107.632-7.181-211.221 73.67-237.098 186.457 30.852-34.862 78.271-82.298 121.977-101.158C125.404 166.85 79.128 228.002 43.992 291.725 23.246 329.651 0 390.94 0 436.747c0 98.575 92.854 86.5 180.251 42.006 31.423 15.43 66.559 15.573 101.695 15.573 97.124 0 184.249-54.294 216.814-146.022H377.927c-52.509 88.593-196.819 52.996-196.819-47.436H509.9c6.407-43.581-1.655-95.715-26.851-141.162zM64.559 346.877c17.711 51.15 53.703 95.871 100.266 123.304-88.741 48.94-173.267 29.096-100.266-123.304zm115.977-108.873c2-55.151 50.276-94.871 103.98-94.871 53.418 0 101.981 39.72 103.981 94.871H180.536zm184.536-187.6c21.425-10.287 48.563-22.003 72.558-22.003 31.422 0 54.274 21.717 54.274 53.722 0 20.003-7.427 49.007-14.569 67.867-26.28-42.292-65.986-81.584-112.263-99.586z"/></svg>';
24
+
25
+ $safari-icon: '<svg viewBox="0 0 512 512" fill="#999"><path d="m274.69 274.69-37.38-37.38L166 346ZM256 8C119 8 8 119 8 256s111 248 248 248 248-111 248-248S393 8 256 8Zm155.85 174.79 14.78-6.13a8 8 0 0 1 10.45 4.34 8 8 0 0 1-4.33 10.46L418 197.57a8 8 0 0 1-10.45-4.33 8 8 0 0 1 4.3-10.45ZM314.43 94l6.12-14.78a8 8 0 0 1 10.45-4.3 8 8 0 0 1 4.33 10.45l-6.13 14.78a8 8 0 0 1-10.45 4.33A8 8 0 0 1 314.43 94ZM256 60a8 8 0 0 1 8 8v16a8 8 0 0 1-8 8 8 8 0 0 1-8-8V68a8 8 0 0 1 8-8Zm-75 14.92a8 8 0 0 1 10.46 4.33L197.57 94a8 8 0 1 1-14.78 6.12l-6.13-14.78A8 8 0 0 1 181 74.92Zm-63.58 42.49a8 8 0 0 1 11.31 0L140 128.72a8 8 0 0 1 0 11.28 8 8 0 0 1-11.31 0l-11.31-11.31a8 8 0 0 1 .03-11.28ZM60 256a8 8 0 0 1 8-8h16a8 8 0 0 1 8 8 8 8 0 0 1-8 8H68a8 8 0 0 1-8-8Zm40.15 73.21-14.78 6.13A8 8 0 0 1 74.92 331a8 8 0 0 1 4.33-10.46L94 314.43a8 8 0 0 1 10.45 4.33 8 8 0 0 1-4.3 10.45Zm4.33-136A8 8 0 0 1 94 197.57l-14.78-6.12a8 8 0 0 1-4.3-10.45 8 8 0 0 1 10.45-4.33l14.78 6.13a8 8 0 0 1 4.33 10.44ZM197.57 418l-6.12 14.78a8 8 0 0 1-14.79-6.12l6.13-14.78a8 8 0 1 1 14.78 6.12ZM264 444a8 8 0 0 1-8 8 8 8 0 0 1-8-8v-16a8 8 0 0 1 8-8 8 8 0 0 1 8 8Zm67-6.92a8 8 0 0 1-10.46-4.33L314.43 418a8 8 0 0 1 4.33-10.45 8 8 0 0 1 10.45 4.33l6.13 14.78a8 8 0 0 1-4.34 10.42Zm63.58-42.49a8 8 0 0 1-11.31 0L372 383.28a8 8 0 0 1 0-11.28 8 8 0 0 1 11.31 0l11.31 11.31a8 8 0 0 1-.03 11.28ZM286.25 286.25 110.34 401.66l115.41-175.91 175.91-115.41ZM437.08 331a8 8 0 0 1-10.45 4.33l-14.78-6.13a8 8 0 0 1-4.33-10.45 8 8 0 0 1 10.48-4.32l14.78 6.12a8 8 0 0 1 4.3 10.45Zm6.92-67h-16a8 8 0 0 1-8-8 8 8 0 0 1 8-8h16a8 8 0 0 1 8 8 8 8 0 0 1-8 8Z"/></svg>';
26
+
27
+ .wl-meta > {
28
+ span::before {
29
+ content: '';
30
+ width: 1em;
31
+ height: 1em;
32
+ display: inline-block;
33
+ background-repeat: no-repeat;
34
+ background-position: center center;
35
+ margin-right: 2px;
36
+ }
37
+
38
+ .wl-addr::before {
39
+ @include svg.background-svg($address-icon);
40
+ }
41
+
42
+ .wl-os::before,
43
+ .wl-browser::before {
44
+ @include svg.background-svg($default-icon);
45
+ }
46
+
47
+ .wl-os[data-value^='windows' i]::before {
48
+ @include svg.background-svg($window-icon);
49
+ }
50
+ .wl-os[data-value^='mac' i]::before,
51
+ .wl-os[data-value^='ios' i]::before,
52
+ .wl-os[data-value^='iphone' i]::before,
53
+ .wl-os[data-value^='ipad' i]::before {
54
+ @include svg.background-svg($apple-icon);
55
+ }
56
+
57
+ .wl-os[data-value^='linux' i]::before {
58
+ @include svg.background-svg($linux-icon);
59
+ }
60
+
61
+ .wl-os[data-value^='ubuntu' i]::before {
62
+ @include svg.background-svg($ubuntu-icon);
63
+ }
64
+ .wl-os[data-value^='android' i]::before {
65
+ @include svg.background-svg($android-icon);
66
+ }
67
+
68
+ .wl-browser[data-value^='chrome' i]::before {
69
+ @include svg.background-svg($chrome-icon);
70
+ }
71
+
72
+ .wl-browser[data-value^='edge' i]::before {
73
+ @include svg.background-svg($edge-icon);
74
+ }
75
+
76
+ .wl-browser[data-value^='firefox' i]::before {
77
+ @include svg.background-svg($firefox-icon);
78
+ }
79
+ .wl-browser[data-value^='safari' i]::before {
80
+ @include svg.background-svg($safari-icon);
81
+ }
82
+ .wl-browser[data-value^='ie' i]::before,
83
+ .wl-browser[data-value^='explorer' i]::before {
84
+ @include svg.background-svg($ie-icon);
85
+ }
86
+ }
@@ -40,6 +40,11 @@ export interface WalineCommentData {
40
40
  */
41
41
  at?: string;
42
42
 
43
+ /**
44
+ * edit comment id
45
+ */
46
+ eid?: string;
47
+
43
48
  /**
44
49
  * Comment link
45
50
  */
@@ -80,4 +85,5 @@ export interface WalineComment extends Exclude<WalineCommentData, 'ua'> {
80
85
  user_id?: string | number;
81
86
  status?: WalineCommentStatus;
82
87
  like?: number;
88
+ orig?: string;
83
89
  }
@@ -146,6 +146,14 @@ export const postComment = ({
146
146
 
147
147
  if (token) headers.Authorization = `Bearer ${token}`;
148
148
 
149
+ if (comment.eid) {
150
+ return fetch(`${serverURL}/comment/${comment.eid}?lang=${lang}`, {
151
+ method: 'PUT',
152
+ headers,
153
+ body: JSON.stringify(comment),
154
+ }).then((resp) => resp.json() as Promise<PostCommentResponse>);
155
+ }
156
+
149
157
  return fetch(`${serverURL}/comment?lang=${lang}`, {
150
158
  method: 'POST',
151
159
  headers,
@@ -1,2 +0,0 @@
1
- import{getCurrentScope as e,onScopeDispose as t,getCurrentInstance as n,onMounted as l,nextTick as o,unref as a,ref as i,isRef as r,watch as s,readonly as c,shallowRef as u,h as m,defineComponent as d,onBeforeUnmount as v,resolveComponent as p,openBlock as f,createElementBlock as g,normalizeStyle as h,Fragment as y,renderList as w,createBlock as b,createCommentVNode as k,createElementVNode as C,computed as I,inject as $,reactive as x,onUnmounted as S,createVNode as j,toDisplayString as L,normalizeClass as E,withDirectives as R,vModelDynamic as O,vModelText as A,vShow as z,createTextVNode as M,provide as P}from"vue";import U from"autosize";import{marked as T}from"marked";var N;const B="undefined"!=typeof window,H=()=>{};function _(e){return"function"==typeof e?e():a(e)}function V(e,t){return function(...n){e((()=>t.apply(this,n)),{fn:t,thisArg:this,args:n})}}B&&(null==(N=null==window?void 0:window.navigator)?void 0:N.userAgent)&&/iP(ad|hone|od)/.test(window.navigator.userAgent);const F=e=>e();function D(n){return!!e()&&(t(n),!0)}function W(e,t=200,n={}){return V(function(e,t={}){let n,l;return o=>{const a=_(e),i=_(t.maxWait);if(n&&clearTimeout(n),a<=0||void 0!==i&&i<=0)return l&&(clearTimeout(l),l=null),o();i&&!l&&(l=setTimeout((()=>{n&&clearTimeout(n),l=null,o()}),i)),n=setTimeout((()=>{l&&clearTimeout(l),l=null,o()}),a)}}(t,n),e)}var G=Object.getOwnPropertySymbols,q=Object.prototype.hasOwnProperty,J=Object.prototype.propertyIsEnumerable;function K(e,t,n={}){const l=n,{eventFilter:o=F}=l,a=((e,t)=>{var n={};for(var l in e)q.call(e,l)&&t.indexOf(l)<0&&(n[l]=e[l]);if(null!=e&&G)for(var l of G(e))t.indexOf(l)<0&&J.call(e,l)&&(n[l]=e[l]);return n})(l,["eventFilter"]);return s(e,V(o,t),a)}var Q=Object.defineProperty,Y=Object.defineProperties,Z=Object.getOwnPropertyDescriptors,X=Object.getOwnPropertySymbols,ee=Object.prototype.hasOwnProperty,te=Object.prototype.propertyIsEnumerable,ne=(e,t,n)=>t in e?Q(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;function le(e,t,n={}){const l=n,{eventFilter:o}=l,a=((e,t)=>{var n={};for(var l in e)ee.call(e,l)&&t.indexOf(l)<0&&(n[l]=e[l]);if(null!=e&&X)for(var l of X(e))t.indexOf(l)<0&&te.call(e,l)&&(n[l]=e[l]);return n})(l,["eventFilter"]),{eventFilter:r,pause:s,resume:c,isActive:u}=function(e=F){const t=i(!0);return{isActive:t,pause:function(){t.value=!1},resume:function(){t.value=!0},eventFilter:(...n)=>{t.value&&e(...n)}}}(o),m=K(e,t,(d=((e,t)=>{for(var n in t||(t={}))ee.call(t,n)&&ne(e,n,t[n]);if(X)for(var n of X(t))te.call(t,n)&&ne(e,n,t[n]);return e})({},a),Y(d,Z({eventFilter:r}))));var d;return{stop:m,pause:s,resume:c,isActive:u}}const oe=B?window:void 0,ae=B?window.document:void 0;function ie(...e){let t,n,l,o;if("string"==typeof e[0]?([n,l,o]=e,t=oe):[t,n,l,o]=e,!t)return H;let a=H;const i=s((()=>function(e){var t;const n=_(e);return null!=(t=null==n?void 0:n.$el)?t:n}(t)),(e=>{a(),e&&(e.addEventListener(n,l,o),a=()=>{e.removeEventListener(n,l,o),a=H})}),{immediate:!0,flush:"post"}),r=()=>{i(),a()};return D(r),r}B&&window.navigator,B&&window.location;const re="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},se="__vueuse_ssr_handlers__";re[se]=re[se]||{};const ce=re[se];var ue=Object.defineProperty,me=Object.getOwnPropertySymbols,de=Object.prototype.hasOwnProperty,ve=Object.prototype.propertyIsEnumerable,pe=(e,t,n)=>t in e?ue(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,fe=(e,t)=>{for(var n in t||(t={}))de.call(t,n)&&pe(e,n,t[n]);if(me)for(var n of me(t))ve.call(t,n)&&pe(e,n,t[n]);return e};const ge={boolean:{read:e=>"true"===e,write:e=>String(e)},object:{read:e=>JSON.parse(e),write:e=>JSON.stringify(e)},number:{read:e=>Number.parseFloat(e),write:e=>String(e)},any:{read:e=>e,write:e=>String(e)},string:{read:e=>e,write:e=>String(e)},map:{read:e=>new Map(JSON.parse(e)),write:e=>JSON.stringify(Array.from(e.entries()))},set:{read:e=>new Set(JSON.parse(e)),write:e=>JSON.stringify(Array.from(e))},date:{read:e=>new Date(e),write:e=>e.toISOString()}};function he(e,t,n,l={}){var o;const{flush:a="pre",deep:r=!0,listenToStorageChanges:s=!0,writeDefaults:c=!0,mergeDefaults:m=!1,shallow:d,window:v=oe,eventFilter:p,onError:f=(e=>{console.error(e)})}=l,g=(d?u:i)(t);if(!n)try{n=function(e,t){return ce[e]||t}("getDefaultStorage",(()=>{var e;return null==(e=oe)?void 0:e.localStorage}))()}catch(e){f(e)}if(!n)return g;const h=_(t),y=function(e){return null==e?"any":e instanceof Set?"set":e instanceof Map?"map":e instanceof Date?"date":"boolean"==typeof e?"boolean":"string"==typeof e?"string":"object"==typeof e||Array.isArray(e)?"object":Number.isNaN(e)?"any":"number"}(h),w=null!=(o=l.serializer)?o:ge[y],{pause:b,resume:k}=le(g,(()=>function(t){try{null==t?n.removeItem(e):n.setItem(e,w.write(t))}catch(e){f(e)}}(g.value)),{flush:a,deep:r,eventFilter:p});return v&&s&&ie(v,"storage",C),C(),g;function C(t){t&&t.key!==e||(g.value=function(t){if(!t||t.key===e){b();try{const l=t?t.newValue:n.getItem(e);if(null==l)return c&&null!==h&&n.setItem(e,w.write(h)),h;if(!t&&m){const e=w.read(l);return"function"==typeof m?m(e,h):"object"!==y||Array.isArray(e)?e:fe(fe({},h),e)}return"string"!=typeof l?l:w.read(l)}catch(e){f(e)}finally{k()}}}(t))}}var ye,we,be=Object.defineProperty,ke=Object.getOwnPropertySymbols,Ce=Object.prototype.hasOwnProperty,Ie=Object.prototype.propertyIsEnumerable,$e=(e,t,n)=>t in e?be(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;function xe(e={}){const{controls:t=!1,interval:n="requestAnimationFrame"}=e,l=i(new Date),o=()=>l.value=new Date,c="requestAnimationFrame"===n?function(e,t={}){const{immediate:n=!0,window:l=oe}=t,o=i(!1);let a=null;function r(){o.value&&l&&(e(),a=l.requestAnimationFrame(r))}function s(){!o.value&&l&&(o.value=!0,r())}function c(){o.value=!1,null!=a&&l&&(l.cancelAnimationFrame(a),a=null)}return n&&s(),D(c),{isActive:o,pause:c,resume:s}}(o,{immediate:!0}):function(e,t=1e3,n={}){const{immediate:l=!0,immediateCallback:o=!1}=n;let c=null;const u=i(!1);function m(){c&&(clearInterval(c),c=null)}function d(){u.value=!1,m()}function v(){a(t)<=0||(u.value=!0,o&&e(),m(),c=setInterval(e,_(t)))}l&&B&&v(),r(t)&&D(s(t,(()=>{u.value&&B&&v()})));return D(d),{isActive:u,pause:d,resume:v}}(o,n,{immediate:!0});return t?((e,t)=>{for(var n in t||(t={}))Ce.call(t,n)&&$e(e,n,t[n]);if(ke)for(var n of ke(t))Ie.call(t,n)&&$e(e,n,t[n]);return e})({now:l},c):l}(we=ye||(ye={})).UP="UP",we.RIGHT="RIGHT",we.DOWN="DOWN",we.LEFT="LEFT",we.NONE="NONE";let Se=0;function je(e,t={}){const a=i(!1),{document:r=ae,immediate:u=!0,manual:m=!1,id:d="vueuse_styletag_"+ ++Se}=t,v=i(e);let p=()=>{};const f=()=>{if(!r)return;const e=r.getElementById(d)||r.createElement("style");e.type="text/css",e.id=d,t.media&&(e.media=t.media),r.head.appendChild(e),a.value||(p=s(v,(t=>{e.innerText=t}),{immediate:!0}),a.value=!0)},g=()=>{r&&a.value&&(p(),r.head.removeChild(r.getElementById(d)),a.value=!1)};return u&&!m&&function(e,t=!0){n()?l(e):t?e():o(e)}(f),m||D(g),{id:d,css:v,unload:g,load:f,isLoaded:c(a)}}var Le=Object.defineProperty,Ee=Object.getOwnPropertySymbols,Re=Object.prototype.hasOwnProperty,Oe=Object.prototype.propertyIsEnumerable,Ae=(e,t,n)=>t in e?Le(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;((e,t)=>{for(var n in t||(t={}))Re.call(t,n)&&Ae(e,n,t[n]);if(Ee)for(var n of Ee(t))Oe.call(t,n)&&Ae(e,n,t[n])})({linear:function(e){return e}},{easeInSine:[.12,0,.39,0],easeOutSine:[.61,1,.88,1],easeInOutSine:[.37,0,.63,1],easeInQuad:[.11,0,.5,0],easeOutQuad:[.5,1,.89,1],easeInOutQuad:[.45,0,.55,1],easeInCubic:[.32,0,.67,0],easeOutCubic:[.33,1,.68,1],easeInOutCubic:[.65,0,.35,1],easeInQuart:[.5,0,.75,0],easeOutQuart:[.25,1,.5,1],easeInOutQuart:[.76,0,.24,1],easeInQuint:[.64,0,.78,0],easeOutQuint:[.22,1,.36,1],easeInOutQuint:[.83,0,.17,1],easeInExpo:[.7,0,.84,0],easeOutExpo:[.16,1,.3,1],easeInOutExpo:[.87,0,.13,1],easeInCirc:[.55,0,1,.45],easeOutCirc:[0,.55,.45,1],easeInOutCirc:[.85,0,.15,1],easeInBack:[.36,0,.66,-.56],easeOutBack:[.34,1.56,.64,1],easeInOutBack:[.68,-.6,.32,1.6]});const ze=({size:e})=>m("svg",{width:e,height:e,viewBox:"0 0 100 100",preserveAspectRatio:"xMidYMid"},m("circle",{cx:50,cy:50,fill:"none",stroke:"currentColor",strokeWidth:"4",r:"40","stroke-dasharray":"85 30"},m("animateTransform",{attributeName:"transform",type:"rotate",repeatCount:"indefinite",dur:"1s",values:"0 50 50;360 50 50",keyTimes:"0;1"})));var Me=d({name:"ImageWall",components:{LoadingIcon:ze},props:{items:{type:Array,default:()=>[]},columnWidth:{type:Number,default:300},gap:{type:Number,default:0}},emits:["insert"],setup(e){let t=null;const n=i(null),a=i({}),r=i([]),c=()=>{const t=Math.floor((n.value.getBoundingClientRect().width+e.gap)/(e.columnWidth+e.gap));return t>0?t:1},u=async t=>{if(t>=e.items.length)return;await o();const l=Array.from(n.value?.children||[]).reduce(((e,t)=>t.getBoundingClientRect().height<e.getBoundingClientRect().height?t:e));r.value[Number(l.dataset.index)].push(t),await u(t+1)},m=async(e=!1)=>{if(r.value.length===c()&&!e)return;var t;r.value=(t=c(),new Array(t).fill(null).map((()=>[])));const n=window.scrollY;await u(0),window.scrollTo({top:n})};return s((()=>[e.items]),(()=>{a.value={},m(!0)})),s((()=>[e.columnWidth,e.gap]),(()=>m())),l((()=>{m(!0),t=new ResizeObserver((()=>m())),t.observe(n.value)})),v((()=>t.unobserve(n.value))),{columns:r,state:a,wall:n}}}),Pe=(e,t)=>{const n=e.__vccOpts||e;for(const[e,l]of t)n[e]=l;return n};const Ue=["data-index"],Te=["src","title","onLoad","onClick"];var Ne=Pe(Me,[["render",function(e,t,n,l,o,a){const i=p("LoadingIcon");return f(),g("div",{ref:"wall",class:"wl-gallery",style:h({gap:`${e.gap}px`})},[(f(!0),g(y,null,w(e.columns,((t,n)=>(f(),g("div",{key:n,class:"wl-gallery-column","data-index":n,style:h({gap:`${e.gap}px`})},[(f(!0),g(y,null,w(t,(t=>(f(),g(y,{key:t},[e.state[e.items[t].src]?k("v-if",!0):(f(),b(i,{key:0,size:36,style:{margin:"20px auto"}})),C("img",{class:"wl-gallery-item",src:e.items[t].src,title:e.items[t].title,loading:"lazy",onLoad:n=>e.state[e.items[t].src]=!0,onClick:n=>e.$emit("insert",`![](${e.items[t].src})`)},null,40,Te)],64)))),128))],12,Ue)))),128))],4)}],["__file","ImageWall.vue"]]);const Be=["nick","mail","link"],He=e=>e.filter((e=>Be.includes(e))),_e=e=>new Promise(((t,n)=>{if(e.size>128e3)return n(new Error("File too large! File size limit 128KB"));const l=new FileReader;l.readAsDataURL(e),l.onload=()=>t(l.result?.toString()||""),l.onerror=n})),Ve=e=>!0===e?'<p class="wl-tex">Tex is not available in preview</p>':'<span class="wl-tex">Tex is not available in preview</span>',Fe=()=>{const e={next:""},t=({keyword:e,pos:t})=>{const n=new URLSearchParams("media_filter=minimal");return n.set("key","PAY5JLFIH6V6"),n.set("limit","20"),n.set("pos",t||""),n.set("q",e),fetch(`https://g.tenor.com/v1/search?${n.toString()}`,{headers:{"Content-Type":"application/json"}}).then((e=>e.json())).catch((()=>({next:t||"",results:[]})))};return{search:(n="")=>t({keyword:n}).then((t=>(e.next=t.next,t.results.map((e=>({title:e.title,src:e.media[0].tinygif.url})))))),more:n=>t({keyword:n,pos:e.next}).then((t=>(e.next=t.next,t.results.map((e=>({title:e.title,src:e.media[0].tinygif.url}))))))}},De=new RegExp(`(${/[\u4E00-\u9FFF\u3400-\u4dbf\uf900-\ufaff\u3040-\u309f\uac00-\ud7af\u0400-\u04FF]+|\w+/.source}|${/</.source})|((?:${/(?:^|\s)\/\/(.+?)$/gm.source})|(?:${/\/\*([\S\s]*?)\*\//gm.source}))`,"gmi"),We=["23AC69","91C132","F19726","E8552D","1AAB8E","E1147F","2980C1","1BA1E6","9FA0A0","F19726","E30B20","E30B20","A3338B"],Ge={},qe=e=>{let t=0;return e.replace(De,((e,n,l)=>{if(l)return`<span style="color: slategray">${l}</span>`;if("<"===n)return"&lt;";let o;Ge[n]?o=Ge[n]:(o=We[t],Ge[n]=o);const a=`<span style="color: #${o}">${n}</span>`;return t=++t%We.length,a}))},Je=["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"],Ke=e=>Object.fromEntries(e.map(((e,t)=>[Je[t],e])));var Qe=Ke(["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!\n Current word number: $2","Anonymous","Dwarves","Hobbits","Ents","Wizards","Elves","Maiar","GIF","Search GIF","Profile","Approved","Waiting","Spam","Unsticky","Oldest","Latest","Hottest"]),Ye=Ke(["ニックネーム","3バイト以上のニックネームをご入力ください.","メールアドレス","メールアドレスをご確認ください.","サイト","オプション","ここにコメント","コメントしましょう~","提出する","Like","Cancel like","返信する","キャンセル","コメント","更新","さらに読み込む","プレビュー","絵文字","画像をアップロード","秒前","分前","時間前","日前","たっだ今","アップロード","ログインする","ログアウト","管理者","トップに置く","ワード","コメントは $0 から $1 ワードの間でなければなりません!\n 現在の単語番号: $2","匿名","うえにん","なかにん","しもおし","特にしもおし","かげ","なぬし","GIF","探す GIF","個人情報","承認済み","待っている","スパム","べたつかない","逆順","正順","人気順"]),Ze=Ke(["昵称","昵称不能少于3个字符","邮箱","请填写正确的邮件地址","网址","可选","欢迎评论","来发评论吧~","提交","喜欢","取消喜欢","回复","取消回复","评论","刷新","加载更多...","预览","表情","上传图片","秒前","分钟前","小时前","天前","刚刚","正在上传","登录","退出","博主","置顶","字","评论字数应在 $0 到 $1 字之间!\n当前字数:$2","匿名","潜水","冒泡","吐槽","活跃","话痨","传说","表情包","搜索表情包","个人资料","通过","待审核","垃圾","取消置顶","按倒序","按正序","按热度"]),Xe=Ke(["暱稱","暱稱不能少於3個字元","郵箱","請填寫正確的郵件地址","網址","可選","歡迎評論","來發評論吧~","提交","喜歡","取消喜歡","回覆","取消回覆","評論","刷新","載入更多...","預覽","表情","上傳圖片","秒前","分鐘前","小時前","天前","剛剛","正在上傳","登錄","退出","博主","置頂","字","評論字數應在 $0 到 $1 字之間!\n當前字數:$2","匿名","潛水","冒泡","吐槽","活躍","話癆","傳說","表情包","搜索表情包","個人資料","通過","待審核","垃圾","取消置頂","按倒序","按正序","按熱度"]),et=Ke(["Apelido","Apelido não pode ser menor que 3 bytes.","E-Mail","Por favor, confirme seu endereço de e-mail.","Website","Opcional","Comente aqui...","Nenhum comentário, ainda.","Enviar","Like","Cancel like","Responder","Cancelar resposta","Comentários","Refrescar","Carregar Mais...","Visualizar","Emoji","Enviar Imagem","segundos atrás","minutos atrás","horas atrás","dias atrás","agora mesmo","Enviando","Entrar","Sair","Admin","Sticky","Palavras","Favor enviar comentário com $0 a $1 palavras!\n Número de palavras atuais: $2","Anônimo","Dwarves","Hobbits","Ents","Wizards","Elves","Maiar","GIF","Pesquisar GIF","informação pessoal","Aprovado","Espera","Spam","Unsticky","Mais velho","Mais recentes","Mais quente"]),tt=Ke(["Псевдоним","Никнейм не может быть меньше 3 байт.","Эл. адрес","Пожалуйста, подтвердите адрес вашей электронной почты.","Веб-сайт","Необязательный","Комментарий здесь...","Пока нет комментариев.","Отправить","Like","Cancel like","Отвечать","Отменить ответ","Комментарии","Обновить","Загрузи больше...","Превью","эмодзи","Загрузить изображение","секунд назад","несколько минут назад","несколько часов назад","дней назад","прямо сейчас","Загрузка","Авторизоваться","Выход из системы","Админ","Липкий","Слова","Пожалуйста, введите комментарии от $0 до $1 слов!\nНомер текущего слова: $2","Анонимный","Dwarves","Hobbits","Ents","Wizards","Elves","Maiar","GIF","Поиск GIF","Персональные данные","Одобренный","Ожидающий","Спам","Нелипкий","самый старый","последний","самый горячий"]);const nt={zh:Ze,"zh-cn":Ze,"zh-CN":Ze,"zh-tw":Xe,"zh-TW":Xe,en:Qe,"en-US":Qe,"en-us":Qe,jp:Ye,"jp-jp":Ye,"jp-JP":Ye,"pt-br":et,"pt-BR":et,ru:tt,"ru-ru":tt,"ru-RU":tt},lt=e=>{try{e=decodeURI(e)}catch(e){}return e},ot=(e="")=>e.replace(/\/$/u,""),at=e=>/^(https?:)?\/\//.test(e),it=e=>{const t=ot(e);return at(t)?t:`https://${t}`},rt=e=>Array.isArray(e)?e:!!e&&[0,e],st=(e,t)=>"function"==typeof e?e:!1!==e&&t,ct="{--waline-white:#000;--waline-light-grey:#666;--waline-dark-grey:#999;--waline-color:#888;--waline-bgcolor:#1e1e1e;--waline-bgcolor-light:#272727;--waline-bgcolor-hover: #444;--waline-border-color:#333;--waline-disable-bgcolor:#444;--waline-disable-color:#272727;--waline-bq-color:#272727;--waline-info-bgcolor:#272727;--waline-info-color:#666}",ut=(e,t)=>{let n=e.toString();for(;n.length<t;)n="0"+n;return n},mt=(e,t,n)=>{if(!e)return"";const l="string"==typeof e?new Date(-1!==e.indexOf(" ")?e.replace(/-/g,"/"):e):e,o=t.getTime()-l.getTime(),a=Math.floor(o/864e5);if(0===a){const e=o%864e5,t=Math.floor(e/36e5);if(0===t){const t=e%36e5,l=Math.floor(t/6e4);if(0===l){const e=t%6e4;return`${Math.round(e/1e3)} ${n.seconds}`}return`${l} ${n.minutes}`}return`${t} ${n.hours}`}return a<0?n.now:a<8?`${a} ${n.days}`:(e=>{const t=ut(e.getDate(),2),n=ut(e.getMonth()+1,2);return`${ut(e.getFullYear(),2)}-${n}-${t}`})(l)},dt=e=>{const t=he("WALINE_EMOJI",{}),n=Boolean(/@[0-9]+\.[0-9]+\.[0-9]+/.test(e));if(n){const n=t.value[e];if(n)return Promise.resolve(n)}return fetch(`${e}/info.json`).then((e=>e.json())).then((l=>{const o={folder:e,...l};return n&&(t.value[e]=o),o}))},vt=(e,t="",n="",l="")=>`${t?`${t}/`:""}${n}${e}${l?`.${l}`:""}`,pt={"Content-Type":"application/json"},ft=({serverURL:e,lang:t,path:n,page:l,pageSize:o,sortBy:a,signal:i,token:r})=>{const s={};return r&&(s.Authorization=`Bearer ${r}`),fetch(`${e}/comment?path=${encodeURIComponent(n)}&pageSize=${o}&page=${l}&lang=${t}&sortBy=${a}`,{signal:i,headers:s}).then((e=>e.json())).then((e=>((e,t="")=>{if("object"==typeof e&&e.errno)throw new TypeError(`Fetch ${t} failed with ${e.errno}: ${e.errmsg}`);return e})(e,"comment list")))},gt=({serverURL:e,lang:t,token:n,objectId:l,...o})=>fetch(`${e}/comment/${l}?lang=${t}`,{method:"PUT",headers:{"Content-Type":"application/json",Authorization:`Bearer ${n}`},body:JSON.stringify(o)}).then((e=>e.json())),ht=e=>e.type.includes("image"),yt=e=>{const t=Array.from(e).find(ht);return t?t.getAsFile():null},wt=/\$.*?\$/,bt=/^\$(.*?)\$/,kt=/^(?:\s{0,3})\$\$((?:[^\n]|\n[^\n])+?)\n{0,1}\$\$/,Ct=(e="",t={})=>e.replace(/:(.+?):/g,((e,n)=>t[n]?`<img class="wl-emoji" src="${t[n]}" alt="${n}">`:e)),It=(e,{emojiMap:t,highlighter:n,texRenderer:l})=>{if(T.setOptions({highlight:n||void 0,breaks:!0,smartLists:!0,smartypants:!0}),l){const e=(e=>[{name:"blockMath",level:"block",tokenizer(t){const n=kt.exec(t);if(null!==n)return{type:"html",raw:n[0],text:e(!0,n[1])}}},{name:"inlineMath",level:"inline",start(e){const t=e.search(wt);return-1!==t?t:e.length},tokenizer(t){const n=bt.exec(t);if(null!==n)return{type:"html",raw:n[0],text:e(!1,n[1])}}}])(l);T.use({extensions:e})}return T.parse(Ct(e,t))};let $t=null;const xt=()=>$t||($t=he("WALINE_USER",{}));let St=null;const jt=()=>St||(St=he("WALINE_LIKE",[]));var Lt=d({name:"CommentBox",components:{CloseIcon:({size:e})=>m("svg",{class:"wl-close-icon",viewBox:"0 0 1024 1024",width:e,height:e},[m("path",{d:"M697.173 85.333h-369.92c-144.64 0-241.92 101.547-241.92 252.587v348.587c0 150.613 97.28 252.16 241.92 252.16h369.92c144.64 0 241.494-101.547 241.494-252.16V337.92c0-151.04-96.854-252.587-241.494-252.587z",fill:"currentColor"}),m("path",{d:"m640.683 587.52-75.947-75.861 75.904-75.862a37.29 37.29 0 0 0 0-52.778 37.205 37.205 0 0 0-52.779 0l-75.946 75.818-75.862-75.946a37.419 37.419 0 0 0-52.821 0 37.419 37.419 0 0 0 0 52.821l75.947 75.947-75.776 75.733a37.29 37.29 0 1 0 52.778 52.821l75.776-75.776 75.947 75.947a37.376 37.376 0 0 0 52.779-52.821z",fill:"#888"})]),EmojiIcon:()=>m("svg",{viewBox:"0 0 1024 1024",width:"24",height:"24"},m("path",{d:"M563.2 463.3 677 540c1.7 1.2 3.7 1.8 5.8 1.8.7 0 1.4-.1 2-.2 2.7-.5 5.1-2.1 6.6-4.4l25.3-37.8c1.5-2.3 2.1-5.1 1.6-7.8s-2.1-5.1-4.4-6.6l-73.6-49.1 73.6-49.1c2.3-1.5 3.9-3.9 4.4-6.6.5-2.7 0-5.5-1.6-7.8l-25.3-37.8a10.1 10.1 0 0 0-6.6-4.4c-.7-.1-1.3-.2-2-.2-2.1 0-4.1.6-5.8 1.8l-113.8 76.6c-9.2 6.2-14.7 16.4-14.7 27.5.1 11 5.5 21.3 14.7 27.4zM387 348.8h-45.5c-5.7 0-10.4 4.7-10.4 10.4v153.3c0 5.7 4.7 10.4 10.4 10.4H387c5.7 0 10.4-4.7 10.4-10.4V359.2c0-5.7-4.7-10.4-10.4-10.4zm333.8 241.3-41-20a10.3 10.3 0 0 0-8.1-.5c-2.6.9-4.8 2.9-5.9 5.4-30.1 64.9-93.1 109.1-164.4 115.2-5.7.5-9.9 5.5-9.5 11.2l3.9 45.5c.5 5.3 5 9.5 10.3 9.5h.9c94.8-8 178.5-66.5 218.6-152.7 2.4-5 .3-11.2-4.8-13.6zm186-186.1c-11.9-42-30.5-81.4-55.2-117.1-24.1-34.9-53.5-65.6-87.5-91.2-33.9-25.6-71.5-45.5-111.6-59.2-41.2-14-84.1-21.1-127.8-21.1h-1.2c-75.4 0-148.8 21.4-212.5 61.7-63.7 40.3-114.3 97.6-146.5 165.8-32.2 68.1-44.3 143.6-35.1 218.4 9.3 74.8 39.4 145 87.3 203.3.1.2.3.3.4.5l36.2 38.4c1.1 1.2 2.5 2.1 3.9 2.6 73.3 66.7 168.2 103.5 267.5 103.5 73.3 0 145.2-20.3 207.7-58.7 37.3-22.9 70.3-51.5 98.1-85 27.1-32.7 48.7-69.5 64.2-109.1 15.5-39.7 24.4-81.3 26.6-123.8 2.4-43.6-2.5-87-14.5-129zm-60.5 181.1c-8.3 37-22.8 72-43 104-19.7 31.1-44.3 58.6-73.1 81.7-28.8 23.1-61 41-95.7 53.4-35.6 12.7-72.9 19.1-110.9 19.1-82.6 0-161.7-30.6-222.8-86.2l-34.1-35.8c-23.9-29.3-42.4-62.2-55.1-97.7-12.4-34.7-18.8-71-19.2-107.9-.4-36.9 5.4-73.3 17.1-108.2 12-35.8 30-69.2 53.4-99.1 31.7-40.4 71.1-72 117.2-94.1 44.5-21.3 94-32.6 143.4-32.6 49.3 0 97 10.8 141.8 32 34.3 16.3 65.3 38.1 92 64.8 26.1 26 47.5 56 63.6 89.2 16.2 33.2 26.6 68.5 31 105.1 4.6 37.5 2.7 75.3-5.6 112.3z",fill:"currentColor"})),ImageIcon:()=>m("svg",{viewBox:"0 0 1024 1024",width:"24",height:"24"},[m("path",{d:"M784 112H240c-88 0-160 72-160 160v480c0 88 72 160 160 160h544c88 0 160-72 160-160V272c0-88-72-160-160-160zm96 640c0 52.8-43.2 96-96 96H240c-52.8 0-96-43.2-96-96V272c0-52.8 43.2-96 96-96h544c52.8 0 96 43.2 96 96v480z",fill:"currentColor"}),m("path",{d:"M352 480c52.8 0 96-43.2 96-96s-43.2-96-96-96-96 43.2-96 96 43.2 96 96 96zm0-128c17.6 0 32 14.4 32 32s-14.4 32-32 32-32-14.4-32-32 14.4-32 32-32zm462.4 379.2-3.2-3.2-177.6-177.6c-25.6-25.6-65.6-25.6-91.2 0l-80 80-36.8-36.8c-25.6-25.6-65.6-25.6-91.2 0L200 728c-4.8 6.4-8 14.4-8 24 0 17.6 14.4 32 32 32 9.6 0 16-3.2 22.4-9.6L380.8 640l134.4 134.4c6.4 6.4 14.4 9.6 24 9.6 17.6 0 32-14.4 32-32 0-9.6-4.8-17.6-9.6-24l-52.8-52.8 80-80L769.6 776c6.4 4.8 12.8 8 20.8 8 17.6 0 32-14.4 32-32 0-8-3.2-16-8-20.8z",fill:"currentColor"})]),ImageWall:Ne,MarkdownIcon:()=>m("svg",{width:"16",height:"16",ariaHidden:"true"},m("path",{d:"M14.85 3H1.15C.52 3 0 3.52 0 4.15v7.69C0 12.48.52 13 1.15 13h13.69c.64 0 1.15-.52 1.15-1.15v-7.7C16 3.52 15.48 3 14.85 3zM9 11H7V8L5.5 9.92 4 8v3H2V5h2l1.5 2L7 5h2v6zm2.99.5L9.5 8H11V5h2v3h1.5l-2.51 3.5z",fill:"currentColor"})),PreviewIcon:()=>m("svg",{viewBox:"0 0 1024 1024",width:"24",height:"24"},[m("path",{d:"M710.816 654.301c70.323-96.639 61.084-230.578-23.705-314.843-46.098-46.098-107.183-71.109-172.28-71.109-65.008 0-126.092 25.444-172.28 71.109-45.227 46.098-70.756 107.183-70.756 172.106 0 64.923 25.444 126.007 71.194 172.106 46.099 46.098 107.184 71.109 172.28 71.109 51.414 0 100.648-16.212 142.824-47.404l126.53 126.006c7.058 7.06 16.297 10.979 26.406 10.979 10.105 0 19.343-3.919 26.402-10.979 14.467-14.467 14.467-38.172 0-52.723L710.816 654.301zm-315.107-23.265c-65.88-65.88-65.88-172.54 0-238.42 32.069-32.07 74.245-49.149 119.471-49.149 45.227 0 87.407 17.603 119.472 49.149 65.88 65.879 65.88 172.539 0 238.42-63.612 63.178-175.242 63.178-238.943 0zm0 0",fill:"currentColor"}),m("path",{d:"M703.319 121.603H321.03c-109.8 0-199.469 89.146-199.469 199.38v382.034c0 109.796 89.236 199.38 199.469 199.38h207.397c20.653 0 37.384-16.645 37.384-37.299 0-20.649-16.731-37.296-37.384-37.296H321.03c-68.582 0-124.352-55.77-124.352-124.267V321.421c0-68.496 55.77-124.267 124.352-124.267h382.289c68.582 0 124.352 55.771 124.352 124.267V524.72c0 20.654 16.736 37.299 37.385 37.299 20.654 0 37.384-16.645 37.384-37.299V320.549c-.085-109.8-89.321-198.946-199.121-198.946zm0 0",fill:"currentColor"})]),LoadingIcon:ze,GifIcon:()=>m("svg",{width:24,height:24,fill:"currentcolor",viewBox:"0 0 24 24"},[m("path",{style:"transform: translateY(0.5px)",d:"M18.968 10.5H15.968V11.484H17.984V12.984H15.968V15H14.468V9H18.968V10.5V10.5ZM8.984 9C9.26533 9 9.49967 9.09367 9.687 9.281C9.87433 9.46833 9.968 9.70267 9.968 9.984V10.5H6.499V13.5H8.468V12H9.968V14.016C9.968 14.2973 9.87433 14.5317 9.687 14.719C9.49967 14.9063 9.26533 15 8.984 15H5.984C5.70267 15 5.46833 14.9063 5.281 14.719C5.09367 14.5317 5 14.2973 5 14.016V9.985C5 9.70367 5.09367 9.46933 5.281 9.282C5.46833 9.09467 5.70267 9.001 5.984 9.001H8.984V9ZM11.468 9H12.968V15H11.468V9V9Z"}),m("path",{d:"M18.5 3H5.75C3.6875 3 2 4.6875 2 6.75V18C2 20.0625 3.6875 21.75 5.75 21.75H18.5C20.5625 21.75 22.25 20.0625 22.25 18V6.75C22.25 4.6875 20.5625 3 18.5 3ZM20.75 18C20.75 19.2375 19.7375 20.25 18.5 20.25H5.75C4.5125 20.25 3.5 19.2375 3.5 18V6.75C3.5 5.5125 4.5125 4.5 5.75 4.5H18.5C19.7375 4.5 20.75 5.5125 20.75 6.75V18Z"})])},props:{rootId:{type:String,default:""},replyId:{type:String,default:""},replyUser:{type:String,default:""}},emits:["submit","cancel-reply"],setup(e,{emit:t}){const n=$("config"),o=he("WALINE_COMMENT_BOX_EDITOR",""),a=he("WALINE_USER_META",{nick:"",mail:"",link:""}),r=xt(),c=i({}),u=i(null),m=i(null),d=i(null),v=i(null),p=i(null),f=i(null),g=i(null),h=i({tabs:[],map:{}}),y=i(0),w=i(!1),b=i(!1),k=i(!1),C=i(""),j=i(0),L=x({loading:!0,list:[]}),E=i(0),R=i(!1),O=i(""),A=i(!1),z=I((()=>n.value.locale)),M=I((()=>Boolean(r.value?.token))),P=I((()=>!1!==n.value.imageUploader)),T=e=>{const t=u.value,n=t.selectionStart,l=t.selectionEnd||0,a=t.scrollTop;o.value=t.value.substring(0,n)+e+t.value.substring(l,t.value.length),t.focus(),t.selectionStart=n+e.length,t.selectionEnd=n+e.length,t.scrollTop=a},N=e=>{const t=`![${n.value.locale.uploading} ${e.name}]()`;return T(t),Promise.resolve().then((()=>n.value.imageUploader(e))).then((n=>{o.value=o.value.replace(t,`\r\n![${e.name}](${n})`)})).catch((e=>{alert(e.message),o.value=o.value.replace(t,"")}))},B=()=>{const{serverURL:l,lang:i,login:s,wordLimit:m,requiredMeta:d}=n.value,v={comment:O.value,nick:a.value.nick,mail:a.value.mail,link:a.value.link,ua:navigator.userAgent,url:n.value.path};if(r.value?.token)v.nick=r.value.display_name,v.mail=r.value.email,v.link=r.value.url;else{if("force"===s)return;if(d.indexOf("nick")>-1&&!v.nick)return c.value.nick?.focus(),alert(z.value.nickError);if(d.indexOf("mail")>-1&&!v.mail||v.mail&&!/^\w(?:[\w._-]*\w)?@(?:\w(?:[\w-]*\w)?\.)*\w+$/.exec(v.mail))return c.value.mail?.focus(),alert(z.value.mailError);if(!v.comment)return void u.value?.focus();v.nick||(v.nick=z.value.anonymous)}if(!R.value)return alert(z.value.wordHint.replace("$0",m[0].toString()).replace("$1",m[1].toString()).replace("$2",j.value.toString()));v.comment=Ct(v.comment,h.value.map),e.replyId&&e.rootId&&(v.pid=e.replyId,v.rid=e.rootId,v.at=e.replyUser),A.value=!0,(({serverURL:e,lang:t,token:n,comment:l})=>{const o={"Content-Type":"application/json"};return n&&(o.Authorization=`Bearer ${n}`),fetch(`${e}/comment?lang=${t}`,{method:"POST",headers:o,body:JSON.stringify(l)}).then((e=>e.json()))})({serverURL:l,lang:i,token:r.value?.token,comment:v}).then((n=>{if(A.value=!1,n.errmsg)return alert(n.errmsg);t("submit",n.data),o.value="",C.value="",e.replyId&&t("cancel-reply")})).catch((e=>{A.value=!1,alert(e.message)}))},H=e=>{d.value.contains(e.target)||v.value.contains(e.target)||(w.value=!1),p.value.contains(e.target)||f.value.contains(e.target)||(b.value=!1)},_=async e=>{const{scrollTop:t,clientHeight:l,scrollHeight:o}=e.target,a=(l+t)/o,i=n.value.search,r=g.value?.value||"";a<.9||L.loading||(L.loading=!0,L.list.push(...i.more?await i.more(r,L.list.length):await i.search(r)),L.loading=!1,setTimeout((()=>{e.target.scrollTop=t}),50))},V=W((e=>{L.list=[],_(e)}),300);s([n,j],(([e,t])=>{const{wordLimit:n}=e;n?t<n[0]&&0!==n[0]?(E.value=n[0],R.value=!1):t>n[1]?(E.value=n[1],R.value=!1):(E.value=n[1],R.value=!0):(E.value=0,R.value=!0)}),{immediate:!0}),s(b,(async e=>{if(!e)return;const t=n.value.search;g.value&&(g.value.value=""),L.loading=!0,L.list=t.default?await t.default():await t.search(""),L.loading=!1}));const F=({data:e})=>{e&&"profile"===e.type&&(r.value={...r.value,...e.data},[localStorage,sessionStorage].filter((e=>e.getItem("WALINE_USER"))).forEach((e=>e.setItem("WALINE_USER",JSON.stringify(r)))))};return l((()=>{document.body.addEventListener("click",H),window.addEventListener("message",F),s((()=>o.value),(e=>{const{highlighter:t,texRenderer:l}=n.value;O.value=e,C.value=It(e,{emojiMap:h.value.map,highlighter:t,texRenderer:l}),j.value=(e=>(e=>e.match(/[\w\d\s\u00C0-\u024F]+/giu)||[])(e).reduce(((e,t)=>e+(""===t.trim()?0:t.trim().split(/\s+/u).length)),0)+(e=>e.match(/[\u4E00-\u9FA5]/gu)||[])(e).length)(e),e?U(u.value):U.destroy(u.value)}),{immediate:!0}),s((()=>n.value.emoji),(e=>{return(t=Array.isArray(e)?e:[],Promise.all(t.map((e=>"string"==typeof e?dt(ot(e)):Promise.resolve(e)))).then((e=>{const t={tabs:[],map:{}};return e.forEach((e=>{const{name:n,folder:l,icon:o,prefix:a,type:i,items:r}=e;t.tabs.push({name:n,icon:vt(o,l,a,i),items:r.map((e=>{const n=`${a||""}${e}`;return t.map[n]=vt(e,l,a,i),n}))})})),t}))).then((e=>{h.value=e}));var t}),{immediate:!0})})),S((()=>{document.body.removeEventListener("click",H),window.removeEventListener("message",F)})),{config:n,locale:z,insert:T,onChange:()=>{const e=m.value;e.files&&P.value&&N(e.files[0]).then((()=>{e.value=""}))},onDrop:e=>{if(e.dataTransfer?.items){const t=yt(e.dataTransfer.items);t&&P.value&&(N(t),e.preventDefault())}},onKeyDown:e=>{const t=e.key;(e.ctrlKey||e.metaKey)&&"Enter"===t&&B()},onPaste:e=>{if(e.clipboardData){const t=yt(e.clipboardData.items);t&&P.value&&N(t)}},onLogin:e=>{e.preventDefault();const{lang:t,serverURL:l}=n.value,o=(window.innerWidth-450)/2,a=(window.innerHeight-450)/2,i=window.open(`${l}/ui/login?lng=${encodeURIComponent(t)}`,"_blank",`width=450,height=450,left=${o},top=${a},scrollbars=no,resizable=no,status=no,location=no,toolbar=no,menubar=no`);i?.postMessage({type:"TOKEN",data:null},"*");const s=({data:e})=>{e&&"userInfo"===e.type&&e.data.token&&(i?.close(),r.value=e.data,(e.data.remember?localStorage:sessionStorage).setItem("WALINE_USER",JSON.stringify(e.data)),window.removeEventListener("message",s))};window.addEventListener("message",s)},onLogout:()=>{r.value={},localStorage.setItem("WALINE_USER","null"),sessionStorage.setItem("WALINE_USER","null")},onProfile:e=>{e.preventDefault();const{lang:t,serverURL:l}=n.value,o=(window.innerWidth-800)/2,a=(window.innerHeight-800)/2;window.open(`${l}/ui/profile?lng=${encodeURIComponent(t)}`,"_blank",`width=800,height=800,left=${o},top=${a},scrollbars=no,resizable=no,status=no,location=no,toolbar=no,menubar=no`)?.postMessage({type:"TOKEN",data:r.value.token},"*")},submitComment:B,onImageWallScroll:_,onGifSearch:V,isLogin:M,userInfo:r,isSubmitting:A,wordNumber:j,wordLimit:E,isWordNumberLegal:R,editor:o,userMeta:a,emoji:h,emojiTabIndex:y,showEmoji:w,gifData:L,showGif:b,canUploadImage:P,previewText:C,showPreview:k,inputRefs:c,editorRef:u,emojiButtonRef:d,emojiPopupRef:v,gifButtonRef:p,gifPopupRef:f,imageUploadRef:m,gifSearchInputRef:g}}});const Et={class:"wl-comment"},Rt={key:0,class:"wl-login-info"},Ot={class:"wl-avatar"},At=["title"],zt=["title"],Mt=["src"],Pt=["title","textContent"],Ut={class:"wl-panel"},Tt=["for","textContent"],Nt=["id","onUpdate:modelValue","name","type"],Bt=["placeholder"],Ht={class:"wl-preview"},_t=C("hr",null,null,-1),Vt=["innerHTML"],Ft={class:"wl-footer"},Dt={class:"wl-actions"},Wt={href:"https://guides.github.com/features/mastering-markdown/",title:"Markdown Guide","aria-label":"Markdown is supported",class:"wl-action",target:"_blank",rel:"noreferrer"},Gt=["title"],qt=["title"],Jt=["title"],Kt=["title"],Qt={class:"wl-info"},Yt={class:"wl-text-number"},Zt={key:0},Xt=M("  /  "),en=["textContent"],tn=["textContent"],nn=["disabled"],ln=["placeholder"],on={key:0,class:"wl-loading"},an={key:0,class:"wl-tab-wrapper"},rn=["title","onClick"],sn=["src","alt"],cn={key:0,class:"wl-tabs"},un=["onClick"],mn=["src","alt","title"],dn=["title"];var vn=Pe(Lt,[["render",function(e,t,n,l,o,a){const i=p("CloseIcon"),r=p("MarkdownIcon"),s=p("EmojiIcon"),c=p("GifIcon"),u=p("ImageIcon"),m=p("PreviewIcon"),d=p("LoadingIcon"),v=p("ImageWall");return f(),g("div",Et,["disable"!==e.config.login&&e.isLogin?(f(),g("div",Rt,[C("div",Ot,[C("button",{class:"wl-logout-btn",title:e.locale.logout,onClick:t[0]||(t[0]=(...t)=>e.onLogout&&e.onLogout(...t))},[j(i,{size:14})],8,At),C("a",{href:"#",class:"wl-login-nick","aria-label":"Profile",title:e.locale.profile,onClick:t[1]||(t[1]=(...t)=>e.onProfile&&e.onProfile(...t))},[C("img",{src:e.userInfo.avatar,alt:"avatar"},null,8,Mt)],8,zt)]),C("a",{href:"#",class:"wl-login-nick","aria-label":"Profile",title:e.locale.profile,onClick:t[2]||(t[2]=(...t)=>e.onProfile&&e.onProfile(...t)),textContent:L(e.userInfo.display_name)},null,8,Pt)])):k("v-if",!0),C("div",Ut,["force"!==e.config.login&&e.config.meta.length&&!e.isLogin?(f(),g("div",{key:0,class:E(["wl-header",`item${e.config.meta.length}`])},[(f(!0),g(y,null,w(e.config.meta,(t=>(f(),g("div",{key:t,class:"wl-header-item"},[C("label",{for:t,textContent:L(e.locale[t]+(e.config.requiredMeta.includes(t)||!e.config.requiredMeta.length?"":`(${e.locale.optional})`))},null,8,Tt),R(C("input",{id:`wl-${t}`,ref_for:!0,ref:n=>{n&&(e.inputRefs[t]=n)},"onUpdate:modelValue":n=>e.userMeta[t]=n,class:E(["wl-input",`wl-${t}`]),name:t,type:"mail"===t?"email":"text"},null,10,Nt),[[O,e.userMeta[t]]])])))),128))],2)):k("v-if",!0),R(C("textarea",{id:"wl-edit",ref:"editorRef","onUpdate:modelValue":t[3]||(t[3]=t=>e.editor=t),class:"wl-editor",placeholder:e.replyUser?`@${e.replyUser}`:e.locale.placeholder,onKeydown:t[4]||(t[4]=(...t)=>e.onKeyDown&&e.onKeyDown(...t)),onDrop:t[5]||(t[5]=(...t)=>e.onDrop&&e.onDrop(...t)),onPaste:t[6]||(t[6]=(...t)=>e.onPaste&&e.onPaste(...t))},null,40,Bt),[[A,e.editor]]),R(C("div",Ht,[_t,C("h4",null,L(e.locale.preview)+":",1),k(" eslint-disable-next-line vue/no-v-html "),C("div",{class:"wl-content",innerHTML:e.previewText},null,8,Vt)],512),[[z,e.showPreview]]),C("div",Ft,[C("div",Dt,[C("a",Wt,[j(r)]),R(C("button",{ref:"emojiButtonRef",class:E(["wl-action",{actived:e.showEmoji}]),title:e.locale.emoji,onClick:t[7]||(t[7]=t=>e.showEmoji=!e.showEmoji)},[j(s)],10,Gt),[[z,e.emoji.tabs.length]]),e.config.search?(f(),g("button",{key:0,ref:"gifButtonRef",class:E(["wl-action",{actived:e.showGif}]),title:e.locale.gif,onClick:t[8]||(t[8]=t=>e.showGif=!e.showGif)},[j(c)],10,qt)):k("v-if",!0),C("input",{id:"wl-image-upload",ref:"imageUploadRef",class:"upload",type:"file",accept:".png,.jpg,.jpeg,.webp,.bmp,.gif",onChange:t[9]||(t[9]=(...t)=>e.onChange&&e.onChange(...t))},null,544),e.canUploadImage?(f(),g("label",{key:1,for:"wl-image-upload",class:"wl-action",title:e.locale.uploadImage},[j(u)],8,Jt)):k("v-if",!0),C("button",{class:E(["wl-action",{actived:e.showPreview}]),title:e.locale.preview,onClick:t[10]||(t[10]=t=>e.showPreview=!e.showPreview)},[j(m)],10,Kt)]),C("div",Qt,[C("div",Yt,[M(L(e.wordNumber)+" ",1),e.config.wordLimit?(f(),g("span",Zt,[Xt,C("span",{class:E({illegal:!e.isWordNumberLegal}),textContent:L(e.wordLimit)},null,10,en)])):k("v-if",!0),M("  "+L(e.locale.word),1)]),"disable"===e.config.login||e.isLogin?k("v-if",!0):(f(),g("button",{key:0,class:"wl-btn",onClick:t[11]||(t[11]=(...t)=>e.onLogin&&e.onLogin(...t)),textContent:L(e.locale.login)},null,8,tn)),"force"!==e.config.login||e.isLogin?(f(),g("button",{key:1,class:"wl-btn primary",title:"Cmd|Ctrl + Enter",disabled:e.isSubmitting,onClick:t[12]||(t[12]=(...t)=>e.submitComment&&e.submitComment(...t))},[e.isSubmitting?(f(),b(d,{key:0,size:16})):(f(),g(y,{key:1},[M(L(e.locale.submit),1)],64))],8,nn)):k("v-if",!0)]),C("div",{ref:"gifPopupRef",class:E(["wl-gif-popup",{display:e.showGif}])},[C("input",{ref:"gifSearchInputRef",type:"text",placeholder:e.locale.gifSearchPlaceholder,onInput:t[13]||(t[13]=(...t)=>e.onGifSearch&&e.onGifSearch(...t))},null,40,ln),j(v,{items:e.gifData.list,"column-width":200,gap:6,onInsert:t[14]||(t[14]=t=>e.insert(t)),onScroll:e.onImageWallScroll},null,8,["items","onScroll"]),e.gifData.loading?(f(),g("div",on,[j(d,{size:30})])):k("v-if",!0)],2),C("div",{ref:"emojiPopupRef",class:E(["wl-emoji-popup",{display:e.showEmoji}])},[(f(!0),g(y,null,w(e.emoji.tabs,((t,n)=>(f(),g(y,{key:t.name},[n===e.emojiTabIndex?(f(),g("div",an,[(f(!0),g(y,null,w(t.items,(t=>(f(),g("button",{key:t,title:t,onClick:n=>e.insert(`:${t}:`)},[e.showEmoji?(f(),g("img",{key:0,class:"wl-emoji",src:e.emoji.map[t],alt:t,loading:"lazy",referrerPolicy:"no-referrer"},null,8,sn)):k("v-if",!0)],8,rn)))),128))])):k("v-if",!0)],64)))),128)),e.emoji.tabs.length>1?(f(),g("div",cn,[(f(!0),g(y,null,w(e.emoji.tabs,((t,n)=>(f(),g("button",{key:t.name,class:E(["wl-tab",{active:e.emojiTabIndex===n}]),onClick:t=>e.emojiTabIndex=n},[C("img",{class:"wl-emoji",src:t.icon,alt:t.name,title:t.name,loading:"lazy",referrerPolicy:"no-referrer"},null,8,mn)],10,un)))),128))])):k("v-if",!0)],2)])]),e.replyId?(f(),g("button",{key:1,class:"wl-close",title:e.locale.cancelReply,onClick:t[15]||(t[15]=t=>e.$emit("cancel-reply"))},[j(i,{size:24})],8,dn)):k("v-if",!0)])}],["__file","CommentBox.vue"]]);const pn=["approved","waiting","spam"];var fn=d({components:{CommentBox:vn,DeleteIcon:()=>m("svg",{viewBox:"0 0 1024 1024",width:"24",height:"24"},m("path",{d:"m341.013 394.667 27.755 393.45h271.83l27.733-393.45h64.106l-28.01 397.952a64 64 0 0 1-63.83 59.498H368.768a64 64 0 0 1-63.83-59.52l-28.053-397.93h64.128zm139.307 19.818v298.667h-64V414.485h64zm117.013 0v298.667h-64V414.485h64zM181.333 288h640v64h-640v-64zm453.483-106.667v64h-256v-64h256z",fill:"red"})),LikeIcon:({active:e=!1})=>m("svg",{viewBox:"0 0 1024 1024",width:"24",height:"24"},[m("path",{d:"M850.654 323.804c-11.042-25.625-26.862-48.532-46.885-68.225-20.022-19.61-43.258-34.936-69.213-45.73-26.78-11.124-55.124-16.727-84.375-16.727-40.622 0-80.256 11.123-114.698 32.135A214.79 214.79 0 0 0 512 241.819a214.79 214.79 0 0 0-23.483-16.562c-34.442-21.012-74.076-32.135-114.698-32.135-29.25 0-57.595 5.603-84.375 16.727-25.872 10.711-49.19 26.12-69.213 45.73-20.105 19.693-35.843 42.6-46.885 68.225-11.453 26.615-17.303 54.877-17.303 83.963 0 27.439 5.603 56.03 16.727 85.117 9.31 24.307 22.659 49.52 39.715 74.981 27.027 40.293 64.188 82.316 110.33 124.915 76.465 70.615 152.189 119.394 155.402 121.371l19.528 12.525c8.652 5.52 19.776 5.52 28.427 0l19.529-12.525c3.213-2.06 78.854-50.756 155.401-121.371 46.143-42.6 83.304-84.622 110.33-124.915 17.057-25.46 30.487-50.674 39.716-74.981 11.124-29.087 16.727-57.678 16.727-85.117.082-29.086-5.768-57.348-17.221-83.963z"+(e?"":"M512 761.5S218.665 573.55 218.665 407.767c0-83.963 69.461-152.023 155.154-152.023 60.233 0 112.473 33.618 138.181 82.727 25.708-49.109 77.948-82.727 138.18-82.727 85.694 0 155.155 68.06 155.155 152.023C805.335 573.551 512 761.5 512 761.5z"),fill:e?"red":"currentColor"})]),ReplyIcon:()=>m("svg",{viewBox:"0 0 1024 1024",width:"24",height:"24"},m("path",{d:"M810.667 213.333a64 64 0 0 1 64 64V704a64 64 0 0 1-64 64H478.336l-146.645 96.107a21.333 21.333 0 0 1-33.024-17.856V768h-85.334a64 64 0 0 1-64-64V277.333a64 64 0 0 1 64-64h597.334zm0 64H213.333V704h149.334v63.296L459.243 704h351.424V277.333zm-271.36 213.334v64h-176.64v-64h176.64zm122.026-128v64H362.667v-64h298.666z",fill:"currentColor"})),VerifiedIcon:()=>m("svg",{class:"verified-icon",viewBox:"0 0 1024 1024",width:"14",height:"14"},m("path",{d:"m894.4 461.56-54.4-63.2c-10.4-12-18.8-34.4-18.8-50.4v-68c0-42.4-34.8-77.2-77.2-77.2h-68c-15.6 0-38.4-8.4-50.4-18.8l-63.2-54.4c-27.6-23.6-72.8-23.6-100.8 0l-62.8 54.8c-12 10-34.8 18.4-50.4 18.4h-69.2c-42.4 0-77.2 34.8-77.2 77.2v68.4c0 15.6-8.4 38-18.4 50l-54 63.6c-23.2 27.6-23.2 72.4 0 100l54 63.6c10 12 18.4 34.4 18.4 50v68.4c0 42.4 34.8 77.2 77.2 77.2h69.2c15.6 0 38.4 8.4 50.4 18.8l63.2 54.4c27.6 23.6 72.8 23.6 100.8 0l63.2-54.4c12-10.4 34.4-18.8 50.4-18.8h68c42.4 0 77.2-34.8 77.2-77.2v-68c0-15.6 8.4-38.4 18.8-50.4l54.4-63.2c23.2-27.6 23.2-73.2-.4-100.8zm-216-25.2-193.2 193.2a30 30 0 0 1-42.4 0l-96.8-96.8a30.16 30.16 0 0 1 0-42.4c11.6-11.6 30.8-11.6 42.4 0l75.6 75.6 172-172c11.6-11.6 30.8-11.6 42.4 0 11.6 11.6 11.6 30.8 0 42.4z",fill:"#27ae60"}))},props:{comment:{type:Object,required:!0},rootId:{type:String,required:!0},reply:{type:Object,default:null}},emits:["submit","reply","like","delete","status","sticky"],setup(e){const t=$("config"),n=jt(),l=xt(),o=I((()=>t.value.locale)),a=I((()=>{const{link:t}=e.comment;return t?at(t)?t:`https://${t}`:""})),i=I((()=>n.value.includes(e.comment.objectId))),r=((e,t)=>{const n=xe();return I((()=>mt(e,n.value,t)))})(e.comment.insertedAt,o.value),s=I((()=>"administrator"===l.value.type)),c=I((()=>e.comment.user_id&&l.value.objectId===e.comment.user_id)),u=I((()=>e.comment.objectId===e.reply?.objectId));return{config:t,locale:o,isReplyingCurrent:u,link:a,like:i,time:r,isAdmin:s,isOwner:c,commentStatus:pn}}});const gn=["id"],hn={class:"wl-user","aria-hidden":"true"},yn=["src"],wn={class:"wl-card"},bn={class:"wl-head"},kn=["href"],Cn={key:1,class:"wl-nick"},In=["textContent"],$n=["textContent"],xn=["textContent"],Sn=["textContent"],jn=["textContent"],Ln={class:"wl-comment-actions"},En=["title"],Rn=["textContent"],On=["title"],An={class:"wl-meta","aria-hidden":"true"},zn=["textContent"],Mn=["textContent"],Pn=["textContent"],Un=["innerHTML"],Tn={key:0,class:"wl-admin-actions"},Nn={class:"wl-comment-status"},Bn=["disabled","onClick","textContent"],Hn={key:1,class:"wl-reply-wrapper"},_n={key:2,class:"wl-quote"};const Vn=[{key:"insertedAt_desc",name:"latest"},{key:"insertedAt_asc",name:"oldest"},{key:"like_desc",name:"hottest"}];var Fn=d({name:"WalineRoot",components:{CommentBox:vn,CommentCard:Pe(fn,[["render",function(e,t,n,l,o,a){const i=p("VerifiedIcon"),r=p("DeleteIcon"),s=p("LikeIcon"),c=p("ReplyIcon"),u=p("CommentBox"),m=p("CommentCard",!0);return f(),g("div",{id:e.comment.objectId,class:"wl-item"},[C("div",hn,[e.comment.avatar?(f(),g("img",{key:0,src:e.comment.avatar},null,8,yn)):k("v-if",!0),e.comment.type?(f(),b(i,{key:1})):k("v-if",!0)]),C("div",wn,[C("div",bn,[e.link?(f(),g("a",{key:0,class:"wl-nick",href:e.link,target:"_blank",rel:"nofollow noreferrer"},L(e.comment.nick),9,kn)):(f(),g("span",Cn,L(e.comment.nick),1)),"administrator"===e.comment.type?(f(),g("span",{key:2,class:"wl-badge",textContent:L(e.locale.admin)},null,8,In)):k("v-if",!0),e.comment.label?(f(),g("span",{key:3,class:"wl-badge",textContent:L(e.comment.label)},null,8,$n)):k("v-if",!0),e.comment.sticky?(f(),g("span",{key:4,class:"wl-badge",textContent:L(e.locale.sticky)},null,8,xn)):k("v-if",!0),void 0!==e.comment.level&&e.comment.level>=0?(f(),g("span",{key:5,class:E(`wl-badge level${e.comment.level}`),textContent:L(e.locale[`level${e.comment.level}`]||`Level ${e.comment.level}`)},null,10,Sn)):k("v-if",!0),C("span",{class:"wl-time",textContent:L(e.time)},null,8,jn),C("div",Ln,[e.isAdmin||e.isOwner?(f(),g("button",{key:0,class:"wl-delete",onClick:t[0]||(t[0]=t=>e.$emit("delete",e.comment))},[j(r)])):k("v-if",!0),C("button",{class:"wl-like",title:e.like?e.locale.cancelLike:e.locale.like,onClick:t[1]||(t[1]=t=>e.$emit("like",e.comment))},[j(s,{active:e.like},null,8,["active"]),"like"in e.comment?(f(),g("span",{key:0,textContent:L(e.comment.like)},null,8,Rn)):k("v-if",!0)],8,En),C("button",{class:E(["wl-reply",{active:e.isReplyingCurrent}]),title:e.isReplyingCurrent?e.locale.cancelReply:e.locale.reply,onClick:t[2]||(t[2]=t=>e.$emit("reply",e.isReplyingCurrent?null:e.comment))},[j(c)],10,On)])]),C("div",An,[e.comment.addr?(f(),g("span",{key:0,textContent:L(e.comment.addr)},null,8,zn)):k("v-if",!0),e.comment.browser?(f(),g("span",{key:1,textContent:L(e.comment.browser)},null,8,Mn)):k("v-if",!0),e.comment.os?(f(),g("span",{key:2,textContent:L(e.comment.os)},null,8,Pn)):k("v-if",!0)]),k(" eslint-disable-next-line vue/no-v-html "),C("div",{class:"wl-content",innerHTML:e.comment.comment},null,8,Un),e.isAdmin?(f(),g("div",Tn,[C("span",Nn,[(f(!0),g(y,null,w(e.commentStatus,(t=>(f(),g("button",{key:t,class:E(`wl-btn wl-${t}`),disabled:e.comment.status===t,onClick:n=>e.$emit("status",{status:t,comment:e.comment}),textContent:L(e.locale[t])},null,10,Bn)))),128))]),e.isAdmin&&!e.comment.rid?(f(),g("button",{key:0,class:"wl-btn wl-sticky",onClick:t[3]||(t[3]=t=>e.$emit("sticky",e.comment))},L(e.comment.sticky?e.locale.unsticky:e.locale.sticky),1)):k("v-if",!0)])):k("v-if",!0),e.isReplyingCurrent?(f(),g("div",Hn,[j(u,{"reply-id":e.comment.objectId,"reply-user":e.comment.nick,"root-id":e.rootId,onSubmit:t[4]||(t[4]=t=>e.$emit("submit",t)),onCancelReply:t[5]||(t[5]=t=>e.$emit("reply",null))},null,8,["reply-id","reply-user","root-id"])])):k("v-if",!0),e.comment.children?(f(),g("div",_n,[(f(!0),g(y,null,w(e.comment.children,(n=>(f(),b(m,{key:n.objectId,comment:n,reply:e.reply,"root-id":e.rootId,onReply:t[6]||(t[6]=t=>e.$emit("reply",t)),onSubmit:t[7]||(t[7]=t=>e.$emit("submit",t)),onLike:t[8]||(t[8]=t=>e.$emit("like",t)),onDelete:t[9]||(t[9]=t=>e.$emit("delete",t)),onStatus:t[10]||(t[10]=t=>e.$emit("status",t)),onSticky:t[11]||(t[11]=t=>e.$emit("sticky",t))},null,8,["comment","reply","root-id"])))),128))])):k("v-if",!0)])],8,gn)}],["__file","CommentCard.vue"]]),LoadingIcon:ze},props:["serverURL","path","meta","requiredMeta","dark","lang","locale","pageSize","wordLimit","emoji","login","highlighter","texRenderer","imageUploader","search","copyright"],setup(e){const t=I((()=>(({serverURL:e,path:t=location.pathname,lang:n="zh-CN",locale:l,emoji:o=["//unpkg.com/@waline/emojis@1.1.0/weibo"],meta:a=["nick","mail","link"],requiredMeta:i=[],dark:r=!1,pageSize:s=10,wordLimit:c,imageUploader:u,highlighter:m,texRenderer:d,copyright:v=!0,login:p="enable",search:f=Fe(),...g})=>({serverURL:it(e),path:lt(t),locale:{...nt[n]||nt["zh-CN"],..."object"==typeof l?l:{}},wordLimit:rt(c),meta:He(a),requiredMeta:He(i),imageUploader:st(u,_e),highlighter:st(m,qe),texRenderer:st(d,Ve),lang:n,dark:r,emoji:o,pageSize:s,login:p,copyright:v,search:f,...g}))(e))),n=xt(),o=jt(),a=i("loading"),r=i(0),c=i(1),u=i(0),m=i(Vn[0].key),d=i([]),v=i(null),p=I((()=>{return"string"==typeof(e=t.value.dark)?"auto"===e?`@media(prefers-color-scheme:dark){body${ct}}`:`${e}${ct}`:!0===e?`:root${ct}`:"";var e}));let f;je(p);const g=e=>{const{serverURL:l,path:o,pageSize:i}=t.value,s=new AbortController;a.value="loading",f?.(),ft({serverURL:l,lang:t.value.lang,path:o,pageSize:i,sortBy:m.value,page:e,signal:s.signal,token:n.value?.token}).then((t=>{a.value="success",r.value=t.count,d.value.push(...t.data),c.value=e,u.value=t.totalPages})).catch((e=>{"AbortError"!==e.name&&(console.error(e.message),a.value="error")})),f=s.abort.bind(s)},h=()=>{r.value=0,d.value=[],g(1)};return P("config",t),s((()=>e.path),h),l((()=>h())),{config:t,darkmodeStyle:p,i18n:I((()=>t.value.locale)),status:a,count:r,page:c,totalPages:u,sortBy:m,sortByItems:Vn,data:d,reply:v,loadMore:()=>g(c.value+1),refresh:h,onSortByChange:e=>{m.value!==e&&(m.value=e,h())},onReply:e=>{v.value=e},onSubmit:e=>{if(e.rid){const t=d.value.find((({objectId:t})=>t===e.rid));if(!t)return;Array.isArray(t.children)||(t.children=[]),t.children.push(e)}else d.value.unshift(e)},onStatusChange:async({comment:e,status:l})=>{if(e.status===l)return;const{serverURL:o,lang:a}=t.value;await gt({serverURL:o,lang:a,token:n.value?.token,objectId:e.objectId,status:l}),e.status=l},onDelete:async({objectId:e})=>{if(!confirm("Are you sure you want to delete this comment?"))return;const{serverURL:l,lang:o}=t.value;await(({serverURL:e,lang:t,token:n,objectId:l})=>fetch(`${e}/comment/${l}?lang=${t}`,{method:"DELETE",headers:{Authorization:`Bearer ${n}`}}).then((e=>e.json())))({serverURL:l,lang:o,token:n.value?.token,objectId:e}),d.value.some(((t,n)=>t.objectId===e?(d.value=d.value.filter(((e,t)=>t!==n)),!0):t.children.some(((l,o)=>l.objectId===e&&(d.value[n].children=t.children.filter(((e,t)=>t!==o)),!0)))))},onSticky:async e=>{if(e.rid)return;const{serverURL:l,lang:o}=t.value;await gt({serverURL:l,lang:o,token:n.value?.token,objectId:e.objectId,sticky:e.sticky?0:1}),e.sticky=!e.sticky},onLike:async e=>{const{serverURL:n,lang:l}=t.value,{objectId:a}=e,i=o.value.includes(a);await(({serverURL:e,lang:t,objectId:n,like:l})=>fetch(`${e}/comment/${n}?lang=${t}`,{method:"PUT",headers:pt,body:JSON.stringify({like:l})}).then((e=>e.json())))({serverURL:n,lang:l,objectId:a,like:!i}),i?o.value=o.value.filter((e=>e!==a)):(o.value=[...o.value,a],o.value.length>50&&(o.value=o.value.slice(-50))),e.like=(e.like||0)+(i?-1:1)},version:"2.7.1"}}});const Dn={"data-waline":""},Wn={class:"wl-meta-head"},Gn={class:"wl-count"},qn=["textContent"],Jn={class:"wl-sort"},Kn=["onClick"],Qn={class:"wl-cards"},Yn={key:1,class:"wl-operation"},Zn=["textContent"],Xn={key:0,class:"wl-loading"},el=["textContent"],tl={class:"wl-operation"},nl=["textContent"],ll={key:3,class:"wl-power"},ol=M(" Powered by "),al=C("a",{href:"https://github.com/walinejs/waline",target:"_blank",rel:"noreferrer"}," Waline ",-1);var il=Pe(Fn,[["render",function(e,t,n,l,o,a){const i=p("CommentBox"),r=p("CommentCard"),s=p("LoadingIcon");return f(),g("div",Dn,[e.reply?k("v-if",!0):(f(),b(i,{key:0,onSubmit:e.onSubmit},null,8,["onSubmit"])),C("div",Wn,[C("div",Gn,[e.count?(f(),g("span",{key:0,class:"wl-num",textContent:L(e.count)},null,8,qn)):k("v-if",!0),M(" "+L(e.i18n.comment),1)]),C("ul",Jn,[(f(!0),g(y,null,w(e.sortByItems,(t=>(f(),g("li",{key:t.key,class:E([t.key===e.sortBy?"active":""]),onClick:n=>e.onSortByChange(t.key)},L(e.i18n[t.name]),11,Kn)))),128))])]),C("div",Qn,[(f(!0),g(y,null,w(e.data,(t=>(f(),b(r,{key:t.objectId,"root-id":t.objectId,comment:t,reply:e.reply,onReply:e.onReply,onSubmit:e.onSubmit,onStatus:e.onStatusChange,onDelete:e.onDelete,onSticky:e.onSticky,onLike:e.onLike},null,8,["root-id","comment","reply","onReply","onSubmit","onStatus","onDelete","onSticky","onLike"])))),128))]),"error"===e.status?(f(),g("div",Yn,[C("button",{type:"button",class:"wl-btn",onClick:t[0]||(t[0]=(...t)=>e.refresh&&e.refresh(...t)),textContent:L(e.i18n.refresh)},null,8,Zn)])):(f(),g(y,{key:2},["loading"===e.status?(f(),g("div",Xn,[j(s,{size:30})])):e.data.length?e.page<e.totalPages?(f(),g(y,{key:2},[k(" Load more button "),C("div",tl,[C("button",{type:"button",class:"wl-btn",onClick:t[1]||(t[1]=(...t)=>e.loadMore&&e.loadMore(...t)),textContent:L(e.i18n.more)},null,8,nl)])],2112)):k("v-if",!0):(f(),g("div",{key:1,class:"wl-empty",textContent:L(e.i18n.sofa)},null,8,el))],64)),k(" Copyright Information "),e.config.copyright?(f(),g("div",ll,[ol,al,M(" v"+L(e.version),1)])):k("v-if",!0)])}],["__file","Waline.vue"]]);const rl="2.7.1";export{il as Waline,rl as version};
2
- //# sourceMappingURL=component.esm.js.map