slimshadow commited on
Commit
b3d2e4b
·
verified ·
1 Parent(s): 0343011

Upload 41 files

Browse files
.github/workflows/main.yml ADDED
@@ -0,0 +1,38 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ name: goreleaser
2
+ on:
3
+ # Trigger the workflow on push or pull request,
4
+ # but only if a semver tag is created.
5
+ push:
6
+ tags:
7
+ - v*.*.*
8
+ jobs:
9
+ goreleaser:
10
+ runs-on: ubuntu-latest
11
+ steps:
12
+ -
13
+ name: Checkout
14
+ uses: actions/checkout@v1
15
+
16
+ -
17
+ name: Set up Go
18
+ uses: actions/setup-go@v1
19
+ with:
20
+ go-version: 1.14.x
21
+
22
+ -
23
+ name: Set Go tools bin path
24
+ run: |
25
+ echo "::add-path::$(go env GOPATH)/bin"
26
+
27
+ -
28
+ name: Login to DockerHub Registry
29
+ run: echo ${{ secrets.DOCKER_PASSWORD }} | docker login -u ${{ secrets.DOCKER_USERNAME }} --password-stdin
30
+
31
+ -
32
+ name: Run goreleaser
33
+ uses: goreleaser/goreleaser-action@v1
34
+ with:
35
+ version: latest
36
+ args: release --rm-dist --skip-validate
37
+ env:
38
+ GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
.goreleaser.yml ADDED
@@ -0,0 +1,43 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ env:
2
+ - GO111MODULE=on
3
+ - CGO_ENABLED=0
4
+
5
+ builds:
6
+ - binary: niltalk
7
+ main: ./
8
+ goos:
9
+ - windows
10
+ - darwin
11
+ - linux
12
+ - freebsd
13
+ - openbsd
14
+ - netbsd
15
+ goarch:
16
+ - amd64
17
+ ldflags:
18
+ - -s -w -X "main.buildString={{ .Tag }} ({{ .ShortCommit }} {{ .Date }})" -X "main.versionString={{ .Tag }}"
19
+
20
+ hooks:
21
+ # stuff executables with static assets.
22
+ post: make pack-bin BIN={{ .Path }}
23
+
24
+ archives:
25
+ - format: tar.gz
26
+ files:
27
+ - README.md
28
+ - LICENSE
29
+
30
+ dockers:
31
+ -
32
+ goos: linux
33
+ goarch: amd64
34
+ goarm: ''
35
+ binaries:
36
+ - niltalk
37
+ image_templates:
38
+ - "kailashnadh/niltalk:latest"
39
+ - "kailashnadh/niltalk:{{ .Tag }}"
40
+ skip_push: false
41
+ dockerfile: Dockerfile
42
+ extra_files:
43
+ - config.toml.sample
Dockerfile ADDED
@@ -0,0 +1,23 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Use an appropriate base image
2
+ FROM golang:1.19-alpine as build
3
+
4
+ # Set the working directory
5
+ WORKDIR /app
6
+
7
+ # Copy the project files
8
+ COPY . .
9
+
10
+ # Build the Niltalk binary
11
+ RUN go build -o niltalk
12
+
13
+ # Create the final image
14
+ FROM alpine:latest
15
+ WORKDIR /app
16
+ COPY --from=build /app/niltalk .
17
+ COPY config.toml.sample config.toml
18
+
19
+ # Expose the necessary port
20
+ EXPOSE 7860
21
+
22
+ # Run the application
23
+ ENTRYPOINT ["./niltalk"]
LICENSE ADDED
@@ -0,0 +1,661 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ GNU AFFERO GENERAL PUBLIC LICENSE
2
+ Version 3, 19 November 2007
3
+
4
+ Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
5
+ Everyone is permitted to copy and distribute verbatim copies
6
+ of this license document, but changing it is not allowed.
7
+
8
+ Preamble
9
+
10
+ The GNU Affero General Public License is a free, copyleft license for
11
+ software and other kinds of works, specifically designed to ensure
12
+ cooperation with the community in the case of network server software.
13
+
14
+ The licenses for most software and other practical works are designed
15
+ to take away your freedom to share and change the works. By contrast,
16
+ our General Public Licenses are intended to guarantee your freedom to
17
+ share and change all versions of a program--to make sure it remains free
18
+ software for all its users.
19
+
20
+ When we speak of free software, we are referring to freedom, not
21
+ price. Our General Public Licenses are designed to make sure that you
22
+ have the freedom to distribute copies of free software (and charge for
23
+ them if you wish), that you receive source code or can get it if you
24
+ want it, that you can change the software or use pieces of it in new
25
+ free programs, and that you know you can do these things.
26
+
27
+ Developers that use our General Public Licenses protect your rights
28
+ with two steps: (1) assert copyright on the software, and (2) offer
29
+ you this License which gives you legal permission to copy, distribute
30
+ and/or modify the software.
31
+
32
+ A secondary benefit of defending all users' freedom is that
33
+ improvements made in alternate versions of the program, if they
34
+ receive widespread use, become available for other developers to
35
+ incorporate. Many developers of free software are heartened and
36
+ encouraged by the resulting cooperation. However, in the case of
37
+ software used on network servers, this result may fail to come about.
38
+ The GNU General Public License permits making a modified version and
39
+ letting the public access it on a server without ever releasing its
40
+ source code to the public.
41
+
42
+ The GNU Affero General Public License is designed specifically to
43
+ ensure that, in such cases, the modified source code becomes available
44
+ to the community. It requires the operator of a network server to
45
+ provide the source code of the modified version running there to the
46
+ users of that server. Therefore, public use of a modified version, on
47
+ a publicly accessible server, gives the public access to the source
48
+ code of the modified version.
49
+
50
+ An older license, called the Affero General Public License and
51
+ published by Affero, was designed to accomplish similar goals. This is
52
+ a different license, not a version of the Affero GPL, but Affero has
53
+ released a new version of the Affero GPL which permits relicensing under
54
+ this license.
55
+
56
+ The precise terms and conditions for copying, distribution and
57
+ modification follow.
58
+
59
+ TERMS AND CONDITIONS
60
+
61
+ 0. Definitions.
62
+
63
+ "This License" refers to version 3 of the GNU Affero General Public License.
64
+
65
+ "Copyright" also means copyright-like laws that apply to other kinds of
66
+ works, such as semiconductor masks.
67
+
68
+ "The Program" refers to any copyrightable work licensed under this
69
+ License. Each licensee is addressed as "you". "Licensees" and
70
+ "recipients" may be individuals or organizations.
71
+
72
+ To "modify" a work means to copy from or adapt all or part of the work
73
+ in a fashion requiring copyright permission, other than the making of an
74
+ exact copy. The resulting work is called a "modified version" of the
75
+ earlier work or a work "based on" the earlier work.
76
+
77
+ A "covered work" means either the unmodified Program or a work based
78
+ on the Program.
79
+
80
+ To "propagate" a work means to do anything with it that, without
81
+ permission, would make you directly or secondarily liable for
82
+ infringement under applicable copyright law, except executing it on a
83
+ computer or modifying a private copy. Propagation includes copying,
84
+ distribution (with or without modification), making available to the
85
+ public, and in some countries other activities as well.
86
+
87
+ To "convey" a work means any kind of propagation that enables other
88
+ parties to make or receive copies. Mere interaction with a user through
89
+ a computer network, with no transfer of a copy, is not conveying.
90
+
91
+ An interactive user interface displays "Appropriate Legal Notices"
92
+ to the extent that it includes a convenient and prominently visible
93
+ feature that (1) displays an appropriate copyright notice, and (2)
94
+ tells the user that there is no warranty for the work (except to the
95
+ extent that warranties are provided), that licensees may convey the
96
+ work under this License, and how to view a copy of this License. If
97
+ the interface presents a list of user commands or options, such as a
98
+ menu, a prominent item in the list meets this criterion.
99
+
100
+ 1. Source Code.
101
+
102
+ The "source code" for a work means the preferred form of the work
103
+ for making modifications to it. "Object code" means any non-source
104
+ form of a work.
105
+
106
+ A "Standard Interface" means an interface that either is an official
107
+ standard defined by a recognized standards body, or, in the case of
108
+ interfaces specified for a particular programming language, one that
109
+ is widely used among developers working in that language.
110
+
111
+ The "System Libraries" of an executable work include anything, other
112
+ than the work as a whole, that (a) is included in the normal form of
113
+ packaging a Major Component, but which is not part of that Major
114
+ Component, and (b) serves only to enable use of the work with that
115
+ Major Component, or to implement a Standard Interface for which an
116
+ implementation is available to the public in source code form. A
117
+ "Major Component", in this context, means a major essential component
118
+ (kernel, window system, and so on) of the specific operating system
119
+ (if any) on which the executable work runs, or a compiler used to
120
+ produce the work, or an object code interpreter used to run it.
121
+
122
+ The "Corresponding Source" for a work in object code form means all
123
+ the source code needed to generate, install, and (for an executable
124
+ work) run the object code and to modify the work, including scripts to
125
+ control those activities. However, it does not include the work's
126
+ System Libraries, or general-purpose tools or generally available free
127
+ programs which are used unmodified in performing those activities but
128
+ which are not part of the work. For example, Corresponding Source
129
+ includes interface definition files associated with source files for
130
+ the work, and the source code for shared libraries and dynamically
131
+ linked subprograms that the work is specifically designed to require,
132
+ such as by intimate data communication or control flow between those
133
+ subprograms and other parts of the work.
134
+
135
+ The Corresponding Source need not include anything that users
136
+ can regenerate automatically from other parts of the Corresponding
137
+ Source.
138
+
139
+ The Corresponding Source for a work in source code form is that
140
+ same work.
141
+
142
+ 2. Basic Permissions.
143
+
144
+ All rights granted under this License are granted for the term of
145
+ copyright on the Program, and are irrevocable provided the stated
146
+ conditions are met. This License explicitly affirms your unlimited
147
+ permission to run the unmodified Program. The output from running a
148
+ covered work is covered by this License only if the output, given its
149
+ content, constitutes a covered work. This License acknowledges your
150
+ rights of fair use or other equivalent, as provided by copyright law.
151
+
152
+ You may make, run and propagate covered works that you do not
153
+ convey, without conditions so long as your license otherwise remains
154
+ in force. You may convey covered works to others for the sole purpose
155
+ of having them make modifications exclusively for you, or provide you
156
+ with facilities for running those works, provided that you comply with
157
+ the terms of this License in conveying all material for which you do
158
+ not control copyright. Those thus making or running the covered works
159
+ for you must do so exclusively on your behalf, under your direction
160
+ and control, on terms that prohibit them from making any copies of
161
+ your copyrighted material outside their relationship with you.
162
+
163
+ Conveying under any other circumstances is permitted solely under
164
+ the conditions stated below. Sublicensing is not allowed; section 10
165
+ makes it unnecessary.
166
+
167
+ 3. Protecting Users' Legal Rights From Anti-Circumvention Law.
168
+
169
+ No covered work shall be deemed part of an effective technological
170
+ measure under any applicable law fulfilling obligations under article
171
+ 11 of the WIPO copyright treaty adopted on 20 December 1996, or
172
+ similar laws prohibiting or restricting circumvention of such
173
+ measures.
174
+
175
+ When you convey a covered work, you waive any legal power to forbid
176
+ circumvention of technological measures to the extent such circumvention
177
+ is effected by exercising rights under this License with respect to
178
+ the covered work, and you disclaim any intention to limit operation or
179
+ modification of the work as a means of enforcing, against the work's
180
+ users, your or third parties' legal rights to forbid circumvention of
181
+ technological measures.
182
+
183
+ 4. Conveying Verbatim Copies.
184
+
185
+ You may convey verbatim copies of the Program's source code as you
186
+ receive it, in any medium, provided that you conspicuously and
187
+ appropriately publish on each copy an appropriate copyright notice;
188
+ keep intact all notices stating that this License and any
189
+ non-permissive terms added in accord with section 7 apply to the code;
190
+ keep intact all notices of the absence of any warranty; and give all
191
+ recipients a copy of this License along with the Program.
192
+
193
+ You may charge any price or no price for each copy that you convey,
194
+ and you may offer support or warranty protection for a fee.
195
+
196
+ 5. Conveying Modified Source Versions.
197
+
198
+ You may convey a work based on the Program, or the modifications to
199
+ produce it from the Program, in the form of source code under the
200
+ terms of section 4, provided that you also meet all of these conditions:
201
+
202
+ a) The work must carry prominent notices stating that you modified
203
+ it, and giving a relevant date.
204
+
205
+ b) The work must carry prominent notices stating that it is
206
+ released under this License and any conditions added under section
207
+ 7. This requirement modifies the requirement in section 4 to
208
+ "keep intact all notices".
209
+
210
+ c) You must license the entire work, as a whole, under this
211
+ License to anyone who comes into possession of a copy. This
212
+ License will therefore apply, along with any applicable section 7
213
+ additional terms, to the whole of the work, and all its parts,
214
+ regardless of how they are packaged. This License gives no
215
+ permission to license the work in any other way, but it does not
216
+ invalidate such permission if you have separately received it.
217
+
218
+ d) If the work has interactive user interfaces, each must display
219
+ Appropriate Legal Notices; however, if the Program has interactive
220
+ interfaces that do not display Appropriate Legal Notices, your
221
+ work need not make them do so.
222
+
223
+ A compilation of a covered work with other separate and independent
224
+ works, which are not by their nature extensions of the covered work,
225
+ and which are not combined with it such as to form a larger program,
226
+ in or on a volume of a storage or distribution medium, is called an
227
+ "aggregate" if the compilation and its resulting copyright are not
228
+ used to limit the access or legal rights of the compilation's users
229
+ beyond what the individual works permit. Inclusion of a covered work
230
+ in an aggregate does not cause this License to apply to the other
231
+ parts of the aggregate.
232
+
233
+ 6. Conveying Non-Source Forms.
234
+
235
+ You may convey a covered work in object code form under the terms
236
+ of sections 4 and 5, provided that you also convey the
237
+ machine-readable Corresponding Source under the terms of this License,
238
+ in one of these ways:
239
+
240
+ a) Convey the object code in, or embodied in, a physical product
241
+ (including a physical distribution medium), accompanied by the
242
+ Corresponding Source fixed on a durable physical medium
243
+ customarily used for software interchange.
244
+
245
+ b) Convey the object code in, or embodied in, a physical product
246
+ (including a physical distribution medium), accompanied by a
247
+ written offer, valid for at least three years and valid for as
248
+ long as you offer spare parts or customer support for that product
249
+ model, to give anyone who possesses the object code either (1) a
250
+ copy of the Corresponding Source for all the software in the
251
+ product that is covered by this License, on a durable physical
252
+ medium customarily used for software interchange, for a price no
253
+ more than your reasonable cost of physically performing this
254
+ conveying of source, or (2) access to copy the
255
+ Corresponding Source from a network server at no charge.
256
+
257
+ c) Convey individual copies of the object code with a copy of the
258
+ written offer to provide the Corresponding Source. This
259
+ alternative is allowed only occasionally and noncommercially, and
260
+ only if you received the object code with such an offer, in accord
261
+ with subsection 6b.
262
+
263
+ d) Convey the object code by offering access from a designated
264
+ place (gratis or for a charge), and offer equivalent access to the
265
+ Corresponding Source in the same way through the same place at no
266
+ further charge. You need not require recipients to copy the
267
+ Corresponding Source along with the object code. If the place to
268
+ copy the object code is a network server, the Corresponding Source
269
+ may be on a different server (operated by you or a third party)
270
+ that supports equivalent copying facilities, provided you maintain
271
+ clear directions next to the object code saying where to find the
272
+ Corresponding Source. Regardless of what server hosts the
273
+ Corresponding Source, you remain obligated to ensure that it is
274
+ available for as long as needed to satisfy these requirements.
275
+
276
+ e) Convey the object code using peer-to-peer transmission, provided
277
+ you inform other peers where the object code and Corresponding
278
+ Source of the work are being offered to the general public at no
279
+ charge under subsection 6d.
280
+
281
+ A separable portion of the object code, whose source code is excluded
282
+ from the Corresponding Source as a System Library, need not be
283
+ included in conveying the object code work.
284
+
285
+ A "User Product" is either (1) a "consumer product", which means any
286
+ tangible personal property which is normally used for personal, family,
287
+ or household purposes, or (2) anything designed or sold for incorporation
288
+ into a dwelling. In determining whether a product is a consumer product,
289
+ doubtful cases shall be resolved in favor of coverage. For a particular
290
+ product received by a particular user, "normally used" refers to a
291
+ typical or common use of that class of product, regardless of the status
292
+ of the particular user or of the way in which the particular user
293
+ actually uses, or expects or is expected to use, the product. A product
294
+ is a consumer product regardless of whether the product has substantial
295
+ commercial, industrial or non-consumer uses, unless such uses represent
296
+ the only significant mode of use of the product.
297
+
298
+ "Installation Information" for a User Product means any methods,
299
+ procedures, authorization keys, or other information required to install
300
+ and execute modified versions of a covered work in that User Product from
301
+ a modified version of its Corresponding Source. The information must
302
+ suffice to ensure that the continued functioning of the modified object
303
+ code is in no case prevented or interfered with solely because
304
+ modification has been made.
305
+
306
+ If you convey an object code work under this section in, or with, or
307
+ specifically for use in, a User Product, and the conveying occurs as
308
+ part of a transaction in which the right of possession and use of the
309
+ User Product is transferred to the recipient in perpetuity or for a
310
+ fixed term (regardless of how the transaction is characterized), the
311
+ Corresponding Source conveyed under this section must be accompanied
312
+ by the Installation Information. But this requirement does not apply
313
+ if neither you nor any third party retains the ability to install
314
+ modified object code on the User Product (for example, the work has
315
+ been installed in ROM).
316
+
317
+ The requirement to provide Installation Information does not include a
318
+ requirement to continue to provide support service, warranty, or updates
319
+ for a work that has been modified or installed by the recipient, or for
320
+ the User Product in which it has been modified or installed. Access to a
321
+ network may be denied when the modification itself materially and
322
+ adversely affects the operation of the network or violates the rules and
323
+ protocols for communication across the network.
324
+
325
+ Corresponding Source conveyed, and Installation Information provided,
326
+ in accord with this section must be in a format that is publicly
327
+ documented (and with an implementation available to the public in
328
+ source code form), and must require no special password or key for
329
+ unpacking, reading or copying.
330
+
331
+ 7. Additional Terms.
332
+
333
+ "Additional permissions" are terms that supplement the terms of this
334
+ License by making exceptions from one or more of its conditions.
335
+ Additional permissions that are applicable to the entire Program shall
336
+ be treated as though they were included in this License, to the extent
337
+ that they are valid under applicable law. If additional permissions
338
+ apply only to part of the Program, that part may be used separately
339
+ under those permissions, but the entire Program remains governed by
340
+ this License without regard to the additional permissions.
341
+
342
+ When you convey a copy of a covered work, you may at your option
343
+ remove any additional permissions from that copy, or from any part of
344
+ it. (Additional permissions may be written to require their own
345
+ removal in certain cases when you modify the work.) You may place
346
+ additional permissions on material, added by you to a covered work,
347
+ for which you have or can give appropriate copyright permission.
348
+
349
+ Notwithstanding any other provision of this License, for material you
350
+ add to a covered work, you may (if authorized by the copyright holders of
351
+ that material) supplement the terms of this License with terms:
352
+
353
+ a) Disclaiming warranty or limiting liability differently from the
354
+ terms of sections 15 and 16 of this License; or
355
+
356
+ b) Requiring preservation of specified reasonable legal notices or
357
+ author attributions in that material or in the Appropriate Legal
358
+ Notices displayed by works containing it; or
359
+
360
+ c) Prohibiting misrepresentation of the origin of that material, or
361
+ requiring that modified versions of such material be marked in
362
+ reasonable ways as different from the original version; or
363
+
364
+ d) Limiting the use for publicity purposes of names of licensors or
365
+ authors of the material; or
366
+
367
+ e) Declining to grant rights under trademark law for use of some
368
+ trade names, trademarks, or service marks; or
369
+
370
+ f) Requiring indemnification of licensors and authors of that
371
+ material by anyone who conveys the material (or modified versions of
372
+ it) with contractual assumptions of liability to the recipient, for
373
+ any liability that these contractual assumptions directly impose on
374
+ those licensors and authors.
375
+
376
+ All other non-permissive additional terms are considered "further
377
+ restrictions" within the meaning of section 10. If the Program as you
378
+ received it, or any part of it, contains a notice stating that it is
379
+ governed by this License along with a term that is a further
380
+ restriction, you may remove that term. If a license document contains
381
+ a further restriction but permits relicensing or conveying under this
382
+ License, you may add to a covered work material governed by the terms
383
+ of that license document, provided that the further restriction does
384
+ not survive such relicensing or conveying.
385
+
386
+ If you add terms to a covered work in accord with this section, you
387
+ must place, in the relevant source files, a statement of the
388
+ additional terms that apply to those files, or a notice indicating
389
+ where to find the applicable terms.
390
+
391
+ Additional terms, permissive or non-permissive, may be stated in the
392
+ form of a separately written license, or stated as exceptions;
393
+ the above requirements apply either way.
394
+
395
+ 8. Termination.
396
+
397
+ You may not propagate or modify a covered work except as expressly
398
+ provided under this License. Any attempt otherwise to propagate or
399
+ modify it is void, and will automatically terminate your rights under
400
+ this License (including any patent licenses granted under the third
401
+ paragraph of section 11).
402
+
403
+ However, if you cease all violation of this License, then your
404
+ license from a particular copyright holder is reinstated (a)
405
+ provisionally, unless and until the copyright holder explicitly and
406
+ finally terminates your license, and (b) permanently, if the copyright
407
+ holder fails to notify you of the violation by some reasonable means
408
+ prior to 60 days after the cessation.
409
+
410
+ Moreover, your license from a particular copyright holder is
411
+ reinstated permanently if the copyright holder notifies you of the
412
+ violation by some reasonable means, this is the first time you have
413
+ received notice of violation of this License (for any work) from that
414
+ copyright holder, and you cure the violation prior to 30 days after
415
+ your receipt of the notice.
416
+
417
+ Termination of your rights under this section does not terminate the
418
+ licenses of parties who have received copies or rights from you under
419
+ this License. If your rights have been terminated and not permanently
420
+ reinstated, you do not qualify to receive new licenses for the same
421
+ material under section 10.
422
+
423
+ 9. Acceptance Not Required for Having Copies.
424
+
425
+ You are not required to accept this License in order to receive or
426
+ run a copy of the Program. Ancillary propagation of a covered work
427
+ occurring solely as a consequence of using peer-to-peer transmission
428
+ to receive a copy likewise does not require acceptance. However,
429
+ nothing other than this License grants you permission to propagate or
430
+ modify any covered work. These actions infringe copyright if you do
431
+ not accept this License. Therefore, by modifying or propagating a
432
+ covered work, you indicate your acceptance of this License to do so.
433
+
434
+ 10. Automatic Licensing of Downstream Recipients.
435
+
436
+ Each time you convey a covered work, the recipient automatically
437
+ receives a license from the original licensors, to run, modify and
438
+ propagate that work, subject to this License. You are not responsible
439
+ for enforcing compliance by third parties with this License.
440
+
441
+ An "entity transaction" is a transaction transferring control of an
442
+ organization, or substantially all assets of one, or subdividing an
443
+ organization, or merging organizations. If propagation of a covered
444
+ work results from an entity transaction, each party to that
445
+ transaction who receives a copy of the work also receives whatever
446
+ licenses to the work the party's predecessor in interest had or could
447
+ give under the previous paragraph, plus a right to possession of the
448
+ Corresponding Source of the work from the predecessor in interest, if
449
+ the predecessor has it or can get it with reasonable efforts.
450
+
451
+ You may not impose any further restrictions on the exercise of the
452
+ rights granted or affirmed under this License. For example, you may
453
+ not impose a license fee, royalty, or other charge for exercise of
454
+ rights granted under this License, and you may not initiate litigation
455
+ (including a cross-claim or counterclaim in a lawsuit) alleging that
456
+ any patent claim is infringed by making, using, selling, offering for
457
+ sale, or importing the Program or any portion of it.
458
+
459
+ 11. Patents.
460
+
461
+ A "contributor" is a copyright holder who authorizes use under this
462
+ License of the Program or a work on which the Program is based. The
463
+ work thus licensed is called the contributor's "contributor version".
464
+
465
+ A contributor's "essential patent claims" are all patent claims
466
+ owned or controlled by the contributor, whether already acquired or
467
+ hereafter acquired, that would be infringed by some manner, permitted
468
+ by this License, of making, using, or selling its contributor version,
469
+ but do not include claims that would be infringed only as a
470
+ consequence of further modification of the contributor version. For
471
+ purposes of this definition, "control" includes the right to grant
472
+ patent sublicenses in a manner consistent with the requirements of
473
+ this License.
474
+
475
+ Each contributor grants you a non-exclusive, worldwide, royalty-free
476
+ patent license under the contributor's essential patent claims, to
477
+ make, use, sell, offer for sale, import and otherwise run, modify and
478
+ propagate the contents of its contributor version.
479
+
480
+ In the following three paragraphs, a "patent license" is any express
481
+ agreement or commitment, however denominated, not to enforce a patent
482
+ (such as an express permission to practice a patent or covenant not to
483
+ sue for patent infringement). To "grant" such a patent license to a
484
+ party means to make such an agreement or commitment not to enforce a
485
+ patent against the party.
486
+
487
+ If you convey a covered work, knowingly relying on a patent license,
488
+ and the Corresponding Source of the work is not available for anyone
489
+ to copy, free of charge and under the terms of this License, through a
490
+ publicly available network server or other readily accessible means,
491
+ then you must either (1) cause the Corresponding Source to be so
492
+ available, or (2) arrange to deprive yourself of the benefit of the
493
+ patent license for this particular work, or (3) arrange, in a manner
494
+ consistent with the requirements of this License, to extend the patent
495
+ license to downstream recipients. "Knowingly relying" means you have
496
+ actual knowledge that, but for the patent license, your conveying the
497
+ covered work in a country, or your recipient's use of the covered work
498
+ in a country, would infringe one or more identifiable patents in that
499
+ country that you have reason to believe are valid.
500
+
501
+ If, pursuant to or in connection with a single transaction or
502
+ arrangement, you convey, or propagate by procuring conveyance of, a
503
+ covered work, and grant a patent license to some of the parties
504
+ receiving the covered work authorizing them to use, propagate, modify
505
+ or convey a specific copy of the covered work, then the patent license
506
+ you grant is automatically extended to all recipients of the covered
507
+ work and works based on it.
508
+
509
+ A patent license is "discriminatory" if it does not include within
510
+ the scope of its coverage, prohibits the exercise of, or is
511
+ conditioned on the non-exercise of one or more of the rights that are
512
+ specifically granted under this License. You may not convey a covered
513
+ work if you are a party to an arrangement with a third party that is
514
+ in the business of distributing software, under which you make payment
515
+ to the third party based on the extent of your activity of conveying
516
+ the work, and under which the third party grants, to any of the
517
+ parties who would receive the covered work from you, a discriminatory
518
+ patent license (a) in connection with copies of the covered work
519
+ conveyed by you (or copies made from those copies), or (b) primarily
520
+ for and in connection with specific products or compilations that
521
+ contain the covered work, unless you entered into that arrangement,
522
+ or that patent license was granted, prior to 28 March 2007.
523
+
524
+ Nothing in this License shall be construed as excluding or limiting
525
+ any implied license or other defenses to infringement that may
526
+ otherwise be available to you under applicable patent law.
527
+
528
+ 12. No Surrender of Others' Freedom.
529
+
530
+ If conditions are imposed on you (whether by court order, agreement or
531
+ otherwise) that contradict the conditions of this License, they do not
532
+ excuse you from the conditions of this License. If you cannot convey a
533
+ covered work so as to satisfy simultaneously your obligations under this
534
+ License and any other pertinent obligations, then as a consequence you may
535
+ not convey it at all. For example, if you agree to terms that obligate you
536
+ to collect a royalty for further conveying from those to whom you convey
537
+ the Program, the only way you could satisfy both those terms and this
538
+ License would be to refrain entirely from conveying the Program.
539
+
540
+ 13. Remote Network Interaction; Use with the GNU General Public License.
541
+
542
+ Notwithstanding any other provision of this License, if you modify the
543
+ Program, your modified version must prominently offer all users
544
+ interacting with it remotely through a computer network (if your version
545
+ supports such interaction) an opportunity to receive the Corresponding
546
+ Source of your version by providing access to the Corresponding Source
547
+ from a network server at no charge, through some standard or customary
548
+ means of facilitating copying of software. This Corresponding Source
549
+ shall include the Corresponding Source for any work covered by version 3
550
+ of the GNU General Public License that is incorporated pursuant to the
551
+ following paragraph.
552
+
553
+ Notwithstanding any other provision of this License, you have
554
+ permission to link or combine any covered work with a work licensed
555
+ under version 3 of the GNU General Public License into a single
556
+ combined work, and to convey the resulting work. The terms of this
557
+ License will continue to apply to the part which is the covered work,
558
+ but the work with which it is combined will remain governed by version
559
+ 3 of the GNU General Public License.
560
+
561
+ 14. Revised Versions of this License.
562
+
563
+ The Free Software Foundation may publish revised and/or new versions of
564
+ the GNU Affero General Public License from time to time. Such new versions
565
+ will be similar in spirit to the present version, but may differ in detail to
566
+ address new problems or concerns.
567
+
568
+ Each version is given a distinguishing version number. If the
569
+ Program specifies that a certain numbered version of the GNU Affero General
570
+ Public License "or any later version" applies to it, you have the
571
+ option of following the terms and conditions either of that numbered
572
+ version or of any later version published by the Free Software
573
+ Foundation. If the Program does not specify a version number of the
574
+ GNU Affero General Public License, you may choose any version ever published
575
+ by the Free Software Foundation.
576
+
577
+ If the Program specifies that a proxy can decide which future
578
+ versions of the GNU Affero General Public License can be used, that proxy's
579
+ public statement of acceptance of a version permanently authorizes you
580
+ to choose that version for the Program.
581
+
582
+ Later license versions may give you additional or different
583
+ permissions. However, no additional obligations are imposed on any
584
+ author or copyright holder as a result of your choosing to follow a
585
+ later version.
586
+
587
+ 15. Disclaimer of Warranty.
588
+
589
+ THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
590
+ APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
591
+ HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
592
+ OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
593
+ THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
594
+ PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
595
+ IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
596
+ ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
597
+
598
+ 16. Limitation of Liability.
599
+
600
+ IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
601
+ WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
602
+ THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
603
+ GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
604
+ USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
605
+ DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
606
+ PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
607
+ EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
608
+ SUCH DAMAGES.
609
+
610
+ 17. Interpretation of Sections 15 and 16.
611
+
612
+ If the disclaimer of warranty and limitation of liability provided
613
+ above cannot be given local legal effect according to their terms,
614
+ reviewing courts shall apply local law that most closely approximates
615
+ an absolute waiver of all civil liability in connection with the
616
+ Program, unless a warranty or assumption of liability accompanies a
617
+ copy of the Program in return for a fee.
618
+
619
+ END OF TERMS AND CONDITIONS
620
+
621
+ How to Apply These Terms to Your New Programs
622
+
623
+ If you develop a new program, and you want it to be of the greatest
624
+ possible use to the public, the best way to achieve this is to make it
625
+ free software which everyone can redistribute and change under these terms.
626
+
627
+ To do so, attach the following notices to the program. It is safest
628
+ to attach them to the start of each source file to most effectively
629
+ state the exclusion of warranty; and each file should have at least
630
+ the "copyright" line and a pointer to where the full notice is found.
631
+
632
+ <one line to give the program's name and a brief idea of what it does.>
633
+ Copyright (C) <year> <name of author>
634
+
635
+ This program is free software: you can redistribute it and/or modify
636
+ it under the terms of the GNU Affero General Public License as published
637
+ by the Free Software Foundation, either version 3 of the License, or
638
+ (at your option) any later version.
639
+
640
+ This program is distributed in the hope that it will be useful,
641
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
642
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
643
+ GNU Affero General Public License for more details.
644
+
645
+ You should have received a copy of the GNU Affero General Public License
646
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
647
+
648
+ Also add information on how to contact you by electronic and paper mail.
649
+
650
+ If your software can interact with users remotely through a computer
651
+ network, you should also make sure that it provides a way for users to
652
+ get its source. For example, if your program is a web application, its
653
+ interface could display a "Source" link that leads users to an archive
654
+ of the code. There are many ways you could offer source, and different
655
+ solutions will be better for different programs; see section 13 for the
656
+ specific requirements.
657
+
658
+ You should also get your employer (if you work as a programmer) or school,
659
+ if any, to sign a "copyright disclaimer" for the program, if necessary.
660
+ For more information on this, and how to apply and follow the GNU AGPL, see
661
+ <http://www.gnu.org/licenses/>.
Makefile ADDED
@@ -0,0 +1,51 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Try to get the commit hash from 1) git 2) the VERSION file 3) fallback.
2
+ LAST_COMMIT := $(or $(shell git rev-parse --short HEAD 2> /dev/null),$(shell head -n 1 VERSION | grep -oP -m 1 "^[a-z0-9]+$$"),"UNKNOWN")
3
+
4
+ # Try to get the semver from 1) git 2) the VERSION file 3) fallback.
5
+ VERSION := $(or $(shell git describe --tags --abbrev=0 2> /dev/null),$(shell grep -oP "tag: \K(.*)(?=,)" VERSION),"v0.0.0")
6
+
7
+ BUILDSTR := ${VERSION} (\#${LAST_COMMIT} $(shell date -u +"%Y-%m-%dT%H:%M:%S%z"))
8
+
9
+ YARN ?= yarn
10
+ GOPATH ?= $(HOME)/go
11
+ STUFFBIN ?= $(GOPATH)/bin/stuffbin
12
+
13
+ BIN := niltalk
14
+ STATIC := static/templates static/static:/static config.toml.sample
15
+
16
+ .PHONY: build
17
+ build: $(BIN)
18
+
19
+ $(STUFFBIN):
20
+ go install github.com/knadh/stuffbin/...
21
+
22
+ $(BIN): $(shell find . -type f -name "*.go")
23
+ CGO_ENABLED=0 go build -o ${BIN} -ldflags="-s -w -X 'main.buildString=${BUILDSTR}' -X 'main.versionString=${VERSION}'" *.go
24
+
25
+ .PHONY: run
26
+ run:
27
+ CGO_ENABLED=0 go run -ldflags="-s -w -X 'main.buildString=${BUILDSTR}' -X 'main.versionString=${VERSION}'" *.go
28
+
29
+ # Run Go tests.
30
+ .PHONY: test
31
+ test:
32
+ go test ./...
33
+
34
+ .PHONY: dist
35
+ dist: $(STUFFBIN) build pack-bin
36
+
37
+ # pack-releases runns stuffbin packing on the given binary. This is used
38
+ # in the .goreleaser post-build hook.
39
+ .PHONY: pack-bin
40
+ pack-bin: $(BIN) $(STUFFBIN)
41
+ $(STUFFBIN) -a stuff -in ${BIN} -out ${BIN} ${STATIC}
42
+
43
+ # Use goreleaser to do a dry run producing local builds.
44
+ .PHONY: release-dry
45
+ release-dry:
46
+ goreleaser --parallelism 1 --rm-dist --snapshot --skip-validate --skip-publish
47
+
48
+ # Use goreleaser to build production releases and publish them.
49
+ .PHONY: release
50
+ release:
51
+ goreleaser --parallelism 1 --rm-dist --skip-validate
README.md CHANGED
@@ -1,11 +1,25 @@
1
- ---
2
- title: Chat Qq
3
- emoji: 🔥
4
- colorFrom: purple
5
- colorTo: indigo
6
- sdk: docker
7
- pinned: false
8
- license: mit
9
- ---
10
-
11
- Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Niltalk
2
+
3
+ Niltalk is a web based disposable chat server. It allows users to create
4
+ password protected disposable, ephemeral chatrooms and invite peers to chat rooms. Rooms can
5
+ be disposed of at any time.
6
+
7
+ ![niltalk](https://user-images.githubusercontent.com/547147/78459728-9f8c3180-76d8-11ea-8c0a-9cf9bfe64341.png)
8
+
9
+ ## Installation
10
+ Niltalk supports in-memory / file / Redis as the backend for persisting room and session states.
11
+
12
+ ### Manual
13
+ - Download the [latest release](https://github.com/knadh/niltalk/releases) for your platform and extract the binary.
14
+ - Run `./niltalk --new-config` to generate a sample config.toml and add your configuration.
15
+ - Run `./niltalk` and visit http://localhost:9000.
16
+
17
+ ### Docker
18
+ The official Docker image `niltalk:latest` is [available here](https://hub.docker.com/r/kailashnadh/niltalk). To try out the app, copy [docker-compose.yml](docker-compose.yml) and run `docker-compose run niltalk`.
19
+
20
+ ### Customisation
21
+ The static HTML/JS/CSS assets can be customized. Copy the `static` directory from the repository, change the files, and do: `./niltalk --static-dir=/path/to/custom/static`
22
+
23
+ > This is a complete rewrite of the old version that had been dead and obsolete for several years (can be found in the `old` branch). These codebases are not compatible with each other and `master` has been overwritten.
24
+
25
+ Licensed under AGPL3
config.toml.sample ADDED
@@ -0,0 +1,63 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ [app]
2
+ # Address to listen, use "tor" to run an hidden service.
3
+ address = "0.0.0.0:9000"
4
+
5
+ # No trailing slashes.
6
+ root_url = "http://localhost:9000"
7
+
8
+ name = "Niltalk chat"
9
+
10
+ max_rooms = 1000
11
+ max_peers_per_room = 25
12
+
13
+ # Peer handle format (%s for ID) for peers who don't pick handles.
14
+ peer_handle_format = "Peer:%s"
15
+
16
+ # Length of the randomly generated room ID.
17
+ room_id_length = 8
18
+
19
+ # The number of messages and events (join / leave) etc. that has to be cached
20
+ # in a room to send to peers when they first join.
21
+ max_cached_messages = 100
22
+
23
+ # Maximum message length in bytes.
24
+ max_message_length = 3000
25
+
26
+ # Permitted message rate (messages / interval) after which a peer is kicked.
27
+ rate_limit_messages = 25
28
+ rate_limit_interval = "3s"
29
+
30
+ # How long will the room id persist in the db before first use?
31
+ room_age = "24h"
32
+
33
+ # Timeout in seconds for which the server will wait when sending
34
+ # a message to a peer before closing the connection. Useful for
35
+ # kicking out peers with slow connections.
36
+ websocket_timeout = "3s"
37
+
38
+ # Session cookie name.
39
+ session_cookie = "niltoken"
40
+
41
+ # Storage kind, one of redis|memory|fs.
42
+ storage = "redis"
43
+
44
+ # Redis cache server.
45
+ # Rooms are cached until they expires. Messages are not cached.
46
+ [store]
47
+ address = "redis:6379" # Eg: 127.0.0.1:6379
48
+ password = ""
49
+ db = 0
50
+ active_conns = 100
51
+ idle_conns = 20
52
+ timeout = "3s"
53
+
54
+ prefix_room = "NIL:ROOM:%s"
55
+ prefix_session = "NIL:SESS:ROOM:%s"
56
+
57
+ # InMemory store config.
58
+ # [store]
59
+ # no options available.
60
+
61
+ # FileSystem store config.
62
+ # [store]
63
+ # path = "db.json"
docker-compose.yml ADDED
@@ -0,0 +1,30 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # NOTE: This docker-compose.yml is meant to be just an example guideline
2
+ # on how you can achieve the same. It is not intented to run out of the box
3
+ # and you must edit the below configurations to suit your needs.
4
+
5
+ version: "3.7"
6
+
7
+ services:
8
+ redis:
9
+ image: redis:alpine
10
+ networks:
11
+ - niltalk
12
+ volumes:
13
+ - niltalk-data
14
+ restart: unless-stopped
15
+
16
+ niltalk:
17
+ image: kailashnadh/niltalk:latest
18
+ ports:
19
+ - "9000:9000"
20
+ networks:
21
+ - niltalk
22
+ depends_on:
23
+ - redis
24
+ restart: unless-stopped
25
+
26
+ networks:
27
+ niltalk:
28
+
29
+ volumes:
30
+ niltalk-data:
go.mod ADDED
@@ -0,0 +1,17 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ module github.com/knadh/niltalk
2
+
3
+ go 1.13
4
+
5
+ require (
6
+ github.com/clementauger/tor-prebuilt v0.0.0-20200815153310-0d7058794224
7
+ github.com/cretz/bine v0.2.0
8
+ github.com/fsnotify/fsnotify v1.6.0 // indirect
9
+ github.com/go-chi/chi v4.1.2+incompatible
10
+ github.com/gomodule/redigo v2.0.0+incompatible
11
+ github.com/gorilla/websocket v1.5.0
12
+ github.com/knadh/koanf v1.5.0
13
+ github.com/knadh/stuffbin v1.1.0
14
+ github.com/pelletier/go-toml v1.9.5 // indirect
15
+ github.com/spf13/pflag v1.0.5
16
+ golang.org/x/crypto v0.8.0
17
+ )
go.sum ADDED
@@ -0,0 +1,453 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ cloud.google.com/go v0.26.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw=
2
+ cloud.google.com/go v0.34.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw=
3
+ github.com/BurntSushi/toml v0.3.1 h1:WXkYYl6Yr3qBf1K79EBnL4mak0OimBfB0XUf9Vl28OQ=
4
+ github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU=
5
+ github.com/alecthomas/template v0.0.0-20160405071501-a0175ee3bccc/go.mod h1:LOuyumcjzFXgccqObfd/Ljyb9UuFJ6TxHnclSeseNhc=
6
+ github.com/alecthomas/template v0.0.0-20190718012654-fb15b899a751/go.mod h1:LOuyumcjzFXgccqObfd/Ljyb9UuFJ6TxHnclSeseNhc=
7
+ github.com/alecthomas/units v0.0.0-20151022065526-2efee857e7cf/go.mod h1:ybxpYRFXyAe+OPACYpWeL0wqObRcbAqCMya13uyzqw0=
8
+ github.com/alecthomas/units v0.0.0-20190717042225-c3de453c63f4/go.mod h1:ybxpYRFXyAe+OPACYpWeL0wqObRcbAqCMya13uyzqw0=
9
+ github.com/alecthomas/units v0.0.0-20190924025748-f65c72e2690d/go.mod h1:rBZYJk541a8SKzHPHnH3zbiI+7dagKZ0cgpgrD7Fyho=
10
+ github.com/antihax/optional v1.0.0/go.mod h1:uupD/76wgC+ih3iEmQUL+0Ugr19nfwCT1kdvxnR2qWY=
11
+ github.com/armon/circbuf v0.0.0-20150827004946-bbbad097214e/go.mod h1:3U/XgcO3hCbHZ8TKRvWD2dDTCfh9M9ya+I9JpbB7O8o=
12
+ github.com/armon/go-metrics v0.0.0-20180917152333-f0300d1749da/go.mod h1:Q73ZrmVTwzkszR9V5SSuryQ31EELlFMUz1kKyl939pY=
13
+ github.com/armon/go-radix v0.0.0-20180808171621-7fddfc383310/go.mod h1:ufUuZ+zHj4x4TnLV4JWEpy2hxWSpsRywHrMgIH9cCH8=
14
+ github.com/armon/go-radix v1.0.0/go.mod h1:ufUuZ+zHj4x4TnLV4JWEpy2hxWSpsRywHrMgIH9cCH8=
15
+ github.com/aws/aws-sdk-go-v2 v1.9.2/go.mod h1:cK/D0BBs0b/oWPIcX/Z/obahJK1TT7IPVjy53i/mX/4=
16
+ github.com/aws/aws-sdk-go-v2/config v1.8.3/go.mod h1:4AEiLtAb8kLs7vgw2ZV3p2VZ1+hBavOc84hqxVNpCyw=
17
+ github.com/aws/aws-sdk-go-v2/credentials v1.4.3/go.mod h1:FNNC6nQZQUuyhq5aE5c7ata8o9e4ECGmS4lAXC7o1mQ=
18
+ github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.6.0/go.mod h1:gqlclDEZp4aqJOancXK6TN24aKhT0W0Ae9MHk3wzTMM=
19
+ github.com/aws/aws-sdk-go-v2/internal/ini v1.2.4/go.mod h1:ZcBrrI3zBKlhGFNYWvju0I3TR93I7YIgAfy82Fh4lcQ=
20
+ github.com/aws/aws-sdk-go-v2/service/appconfig v1.4.2/go.mod h1:FZ3HkCe+b10uFZZkFdvf98LHW21k49W8o8J366lqVKY=
21
+ github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.3.2/go.mod h1:72HRZDLMtmVQiLG2tLfQcaWLCssELvGl+Zf2WVxMmR8=
22
+ github.com/aws/aws-sdk-go-v2/service/sso v1.4.2/go.mod h1:NBvT9R1MEF+Ud6ApJKM0G+IkPchKS7p7c2YPKwHmBOk=
23
+ github.com/aws/aws-sdk-go-v2/service/sts v1.7.2/go.mod h1:8EzeIqfWt2wWT4rJVu3f21TfrhJ8AEMzVybRNSb/b4g=
24
+ github.com/aws/smithy-go v1.8.0/go.mod h1:SObp3lf9smib00L/v3U2eAKG8FyQ7iLrJnQiAmR5n+E=
25
+ github.com/beorn7/perks v0.0.0-20180321164747-3a771d992973/go.mod h1:Dwedo/Wpr24TaqPxmxbtue+5NUziq4I4S80YR8gNf3Q=
26
+ github.com/beorn7/perks v1.0.0/go.mod h1:KWe93zE9D1o94FZ5RNwFwVgaQK1VOXiVxmqh+CedLV8=
27
+ github.com/beorn7/perks v1.0.1/go.mod h1:G2ZrVWU2WbWT9wwq4/hrbKbnv/1ERSJQ0ibhJ6rlkpw=
28
+ github.com/bgentry/speakeasy v0.1.0/go.mod h1:+zsyZBPWlz7T6j88CTgSN5bM796AkVf0kBD4zp0CCIs=
29
+ github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU=
30
+ github.com/cespare/xxhash/v2 v2.1.1/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs=
31
+ github.com/clementauger/tor-prebuilt v0.0.0-20200815153310-0d7058794224 h1:Bm1RJ6O3xTpatREKCjtK3kCmG8SYDgHNGp/qUy0fYek=
32
+ github.com/clementauger/tor-prebuilt v0.0.0-20200815153310-0d7058794224/go.mod h1:QVD8AVR2PuMTcxIbUiUBgexRjeVUtymMMVNrGagoVA4=
33
+ github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw=
34
+ github.com/cncf/udpa/go v0.0.0-20191209042840-269d4d468f6f/go.mod h1:M8M6+tZqaGXZJjfX53e64911xZQV5JYwmTeXPW+k8Sc=
35
+ github.com/cncf/udpa/go v0.0.0-20201120205902-5459f2c99403/go.mod h1:WmhPx2Nbnhtbo57+VJT5O0JRkEi1Wbu0z5j0R8u5Hbk=
36
+ github.com/coreos/go-semver v0.3.0/go.mod h1:nnelYz7RCh+5ahJtPPxZlU+153eP4D4r3EedlOD2RNk=
37
+ github.com/coreos/go-systemd/v22 v22.3.2/go.mod h1:Y58oyj3AT4RCenI/lSvhwexgC+NSVTIJ3seZv2GcEnc=
38
+ github.com/cretz/bine v0.1.0 h1:1/fvhLE+fk0bPzjdO5Ci+0ComYxEMuB1JhM4X5skT3g=
39
+ github.com/cretz/bine v0.1.0/go.mod h1:6PF6fWAvYtwjRGkAuDEJeWNOv3a2hUouSP/yRYXmvHw=
40
+ github.com/cretz/bine v0.2.0 h1:8GiDRGlTgz+o8H9DSnsl+5MeBK4HsExxgl6WgzOCuZo=
41
+ github.com/cretz/bine v0.2.0/go.mod h1:WU4o9QR9wWp8AVKtTM1XD5vUHkEqnf2vVSo6dBqbetI=
42
+ github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
43
+ github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
44
+ github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
45
+ github.com/dustin/go-humanize v1.0.0/go.mod h1:HtrtbFcZ19U5GC7JDqmcUSB87Iq5E25KnS6fMYU6eOk=
46
+ github.com/envoyproxy/go-control-plane v0.9.0/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4=
47
+ github.com/envoyproxy/go-control-plane v0.9.1-0.20191026205805-5f8ba28d4473/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4=
48
+ github.com/envoyproxy/go-control-plane v0.9.4/go.mod h1:6rpuAdCZL397s3pYoYcLgu1mIlRU8Am5FuJP05cCM98=
49
+ github.com/envoyproxy/go-control-plane v0.9.9-0.20210217033140-668b12f5399d/go.mod h1:cXg6YxExXjJnVBQHBLXeUAgxn2UodCpnH306RInaBQk=
50
+ github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c=
51
+ github.com/fatih/color v1.7.0/go.mod h1:Zm6kSWBoL9eyXnKyktHP6abPY2pDugNf5KwzbycvMj4=
52
+ github.com/fatih/color v1.9.0/go.mod h1:eQcE1qtQxscV5RaZvpXrrb8Drkc3/DdQ+uUYCNjL+zU=
53
+ github.com/fatih/structs v1.1.0/go.mod h1:9NiDSp5zOcgEDl+j00MP/WkGVPOlPRLejGD8Ga6PJ7M=
54
+ github.com/fsnotify/fsnotify v1.4.9 h1:hsms1Qyu0jgnwNXIxa+/V/PDsU6CfLf6CNO8H7IWoS4=
55
+ github.com/fsnotify/fsnotify v1.4.9/go.mod h1:znqG4EE+3YCdAaPaxE2ZRY/06pZUdp0tY4IgpuI1SZQ=
56
+ github.com/fsnotify/fsnotify v1.6.0 h1:n+5WquG0fcWoWp6xPWfHdbskMCQaFnG6PfBrh1Ky4HY=
57
+ github.com/fsnotify/fsnotify v1.6.0/go.mod h1:sl3t1tCWJFWoRz9R8WJCbQihKKwmorjAbSClcnxKAGw=
58
+ github.com/ghodss/yaml v1.0.0/go.mod h1:4dBDuWmgqj2HViK6kFavaiC9ZROes6MMH2rRYeMEF04=
59
+ github.com/go-chi/chi v4.1.0+incompatible h1:ETj3cggsVIY2Xao5ExCu6YhEh5MD6JTfcBzS37R260w=
60
+ github.com/go-chi/chi v4.1.0+incompatible/go.mod h1:eB3wogJHnLi3x/kFX2A+IbTBlXxmMeXJVKy9tTv1XzQ=
61
+ github.com/go-chi/chi v4.1.2+incompatible h1:fGFk2Gmi/YKXk0OmGfBh0WgmN3XB8lVnEyNz34tQRec=
62
+ github.com/go-chi/chi v4.1.2+incompatible/go.mod h1:eB3wogJHnLi3x/kFX2A+IbTBlXxmMeXJVKy9tTv1XzQ=
63
+ github.com/go-kit/kit v0.8.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2as=
64
+ github.com/go-kit/kit v0.9.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2as=
65
+ github.com/go-kit/log v0.1.0/go.mod h1:zbhenjAZHb184qTLMA9ZjW7ThYL0H2mk7Q6pNt4vbaY=
66
+ github.com/go-ldap/ldap v3.0.2+incompatible/go.mod h1:qfd9rJvER9Q0/D/Sqn1DfHRoBp40uXYvFoEVrNEPqRc=
67
+ github.com/go-logfmt/logfmt v0.3.0/go.mod h1:Qt1PoO58o5twSAckw1HlFXLmHsOX5/0LbT9GBnD5lWE=
68
+ github.com/go-logfmt/logfmt v0.4.0/go.mod h1:3RMwSq7FuexP4Kalkev3ejPJsZTpXXBr9+V4qmtdjCk=
69
+ github.com/go-logfmt/logfmt v0.5.0/go.mod h1:wCYkCAKZfumFQihp8CzCvQ3paCTfi41vtzG1KdI/P7A=
70
+ github.com/go-stack/stack v1.8.0/go.mod h1:v0f6uXyyMGvRgIKkXu+yp6POWl0qKG85gN/melR3HDY=
71
+ github.com/go-test/deep v1.0.2-0.20181118220953-042da051cf31/go.mod h1:wGDj63lr65AM2AQyKZd/NYHGb0R+1RLqB8NKt3aSFNA=
72
+ github.com/godbus/dbus/v5 v5.0.4/go.mod h1:xhWf0FNVPg57R7Z0UbKHbJfkEywrmjJnf7w5xrFpKfA=
73
+ github.com/gogo/protobuf v1.1.1/go.mod h1:r8qH/GZQm5c6nD/R0oafs1akxWv10x8SbQlK7atdtwQ=
74
+ github.com/gogo/protobuf v1.3.2/go.mod h1:P1XiOD3dCwIKUDQYPy72D8LYyHL2YPYrpS2s69NZV8Q=
75
+ github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q=
76
+ github.com/golang/mock v1.1.1/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A=
77
+ github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U=
78
+ github.com/golang/protobuf v1.3.1/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U=
79
+ github.com/golang/protobuf v1.3.2/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U=
80
+ github.com/golang/protobuf v1.3.3/go.mod h1:vzj43D7+SQXF/4pzW/hwtAqwc6iTitCiVSaWz5lYuqw=
81
+ github.com/golang/protobuf v1.4.0-rc.1/go.mod h1:ceaxUfeHdC40wWswd/P6IGgMaK3YpKi5j83Wpe3EHw8=
82
+ github.com/golang/protobuf v1.4.0-rc.1.0.20200221234624-67d41d38c208/go.mod h1:xKAWHe0F5eneWXFV3EuXVDTCmh+JuBKY0li0aMyXATA=
83
+ github.com/golang/protobuf v1.4.0-rc.2/go.mod h1:LlEzMj4AhA7rCAGe4KMBDvJI+AwstrUpVNzEA03Pprs=
84
+ github.com/golang/protobuf v1.4.0-rc.4.0.20200313231945-b860323f09d0/go.mod h1:WU3c8KckQ9AFe+yFwt9sWVRKCVIyN9cPHBJSNnbL67w=
85
+ github.com/golang/protobuf v1.4.0/go.mod h1:jodUvKwWbYaEsadDk5Fwe5c77LiNKVO9IDvqG2KuDX0=
86
+ github.com/golang/protobuf v1.4.1/go.mod h1:U8fpvMrcmy5pZrNK1lt4xCsGvpyWQ/VVv6QDs8UjoX8=
87
+ github.com/golang/protobuf v1.4.2/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI=
88
+ github.com/golang/protobuf v1.4.3/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI=
89
+ github.com/golang/protobuf v1.5.0/go.mod h1:FsONVRAS9T7sI+LIUmWTfcYkHO4aIWwzhcaSAoJOfIk=
90
+ github.com/golang/protobuf v1.5.2/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY=
91
+ github.com/golang/snappy v0.0.1/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q=
92
+ github.com/gomodule/redigo v2.0.0+incompatible h1:K/R+8tc58AaqLkqG2Ol3Qk+DR/TlNuhuh457pBFPtt0=
93
+ github.com/gomodule/redigo v2.0.0+incompatible/go.mod h1:B4C85qUVwatsJoIUNIfCRsp7qO0iAmpGFZ4EELWSbC4=
94
+ github.com/google/btree v0.0.0-20180813153112-4030bb1f1f0c/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ=
95
+ github.com/google/go-cmp v0.2.0/go.mod h1:oXzfMopK8JAjlY9xF4vHSVASa0yLyX7SntLO5aqRK0M=
96
+ github.com/google/go-cmp v0.3.0/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU=
97
+ github.com/google/go-cmp v0.3.1/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU=
98
+ github.com/google/go-cmp v0.4.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
99
+ github.com/google/go-cmp v0.5.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
100
+ github.com/google/go-cmp v0.5.4/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
101
+ github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
102
+ github.com/google/go-cmp v0.5.6/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
103
+ github.com/google/go-cmp v0.5.7/go.mod h1:n+brtR0CgQNWTVd5ZUFpTBC8YFBDLK/h/bpaJ8/DtOE=
104
+ github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg=
105
+ github.com/google/uuid v1.1.2/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
106
+ github.com/gorilla/websocket v1.4.2 h1:+/TMaTYc4QFitKJxsQ7Yye35DkWvkdLcvGKqM+x0Ufc=
107
+ github.com/gorilla/websocket v1.4.2/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE=
108
+ github.com/gorilla/websocket v1.5.0 h1:PPwGk2jz7EePpoHN/+ClbZu8SPxiqlu12wZP/3sWmnc=
109
+ github.com/gorilla/websocket v1.5.0/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE=
110
+ github.com/grpc-ecosystem/go-grpc-prometheus v1.2.0/go.mod h1:8NvIoxWQoOIhqOTXgfV/d3M/q6VIi02HzZEHgUlZvzk=
111
+ github.com/grpc-ecosystem/grpc-gateway v1.16.0/go.mod h1:BDjrQk3hbvj6Nolgz8mAMFbcEtjT1g+wF4CSlocrBnw=
112
+ github.com/hashicorp/consul/api v1.13.0/go.mod h1:ZlVrynguJKcYr54zGaDbaL3fOvKC9m72FhPvA8T35KQ=
113
+ github.com/hashicorp/consul/sdk v0.8.0/go.mod h1:GBvyrGALthsZObzUGsfgHZQDXjg4lOjagTIwIR1vPms=
114
+ github.com/hashicorp/errwrap v1.0.0/go.mod h1:YH+1FKiLXxHSkmPseP+kNlulaMuP3n2brvKWEqk/Jc4=
115
+ github.com/hashicorp/go-cleanhttp v0.5.0/go.mod h1:JpRdi6/HCYpAwUzNwuwqhbovhLtngrth3wmdIIUrZ80=
116
+ github.com/hashicorp/go-cleanhttp v0.5.1/go.mod h1:JpRdi6/HCYpAwUzNwuwqhbovhLtngrth3wmdIIUrZ80=
117
+ github.com/hashicorp/go-hclog v0.0.0-20180709165350-ff2cf002a8dd/go.mod h1:9bjs9uLqI8l75knNv3lV1kA55veR+WUPSiKIWcQHudI=
118
+ github.com/hashicorp/go-hclog v0.8.0/go.mod h1:5CU+agLiy3J7N7QjHK5d05KxGsuXiQLrjA0H7acj2lQ=
119
+ github.com/hashicorp/go-hclog v0.12.0/go.mod h1:whpDNt7SSdeAju8AWKIWsul05p54N/39EeqMAyrmvFQ=
120
+ github.com/hashicorp/go-immutable-radix v1.0.0/go.mod h1:0y9vanUI8NX6FsYoO3zeMjhV/C5i9g4Q3DwcSNZ4P60=
121
+ github.com/hashicorp/go-msgpack v0.5.3/go.mod h1:ahLV/dePpqEmjfWmKiqvPkv/twdG7iPBM1vqhUKIvfM=
122
+ github.com/hashicorp/go-multierror v1.0.0/go.mod h1:dHtQlpGsu+cZNNAkkCN/P3hoUDHhCYQXV3UM06sGGrk=
123
+ github.com/hashicorp/go-multierror v1.1.0/go.mod h1:spPvp8C1qA32ftKqdAHm4hHTbPw+vmowP0z+KUhOZdA=
124
+ github.com/hashicorp/go-plugin v1.0.1/go.mod h1:++UyYGoz3o5w9ZzAdZxtQKrWWP+iqPBn3cQptSMzBuY=
125
+ github.com/hashicorp/go-retryablehttp v0.5.4/go.mod h1:9B5zBasrRhHXnJnui7y6sL7es7NDiJgTc6Er0maI1Xs=
126
+ github.com/hashicorp/go-rootcerts v1.0.1/go.mod h1:pqUvnprVnM5bf7AOirdbb01K4ccR319Vf4pU3K5EGc8=
127
+ github.com/hashicorp/go-rootcerts v1.0.2/go.mod h1:pqUvnprVnM5bf7AOirdbb01K4ccR319Vf4pU3K5EGc8=
128
+ github.com/hashicorp/go-sockaddr v1.0.0/go.mod h1:7Xibr9yA9JjQq1JpNB2Vw7kxv8xerXegt+ozgdvDeDU=
129
+ github.com/hashicorp/go-sockaddr v1.0.2/go.mod h1:rB4wwRAUzs07qva3c5SdrY/NEtAUjGlgmH/UkBUC97A=
130
+ github.com/hashicorp/go-syslog v1.0.0/go.mod h1:qPfqrKkXGihmCqbJM2mZgkZGvKG1dFdvsLplgctolz4=
131
+ github.com/hashicorp/go-uuid v1.0.0/go.mod h1:6SBZvOh/SIDV7/2o3Jml5SYk/TvGqwFJ/bN7x4byOro=
132
+ github.com/hashicorp/go-uuid v1.0.1/go.mod h1:6SBZvOh/SIDV7/2o3Jml5SYk/TvGqwFJ/bN7x4byOro=
133
+ github.com/hashicorp/go-version v1.1.0/go.mod h1:fltr4n8CU8Ke44wwGCBoEymUuxUHl09ZGVZPK5anwXA=
134
+ github.com/hashicorp/golang-lru v0.5.0/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8=
135
+ github.com/hashicorp/golang-lru v0.5.1/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8=
136
+ github.com/hashicorp/hcl v1.0.0 h1:0Anlzjpi4vEasTeNFn2mLJgTSwt0+6sfsiTG8qcWGx4=
137
+ github.com/hashicorp/hcl v1.0.0/go.mod h1:E5yfLk+7swimpb2L/Alb/PJmXilQ/rhwaUYs4T20WEQ=
138
+ github.com/hashicorp/logutils v1.0.0/go.mod h1:QIAnNjmIWmVIIkWDTG1z5v++HQmx9WQRO+LraFDTW64=
139
+ github.com/hashicorp/mdns v1.0.4/go.mod h1:mtBihi+LeNXGtG8L9dX59gAEa12BDtBQSp4v/YAJqrc=
140
+ github.com/hashicorp/memberlist v0.3.0/go.mod h1:MS2lj3INKhZjWNqd3N0m3J+Jxf3DAOnAH9VT3Sh9MUE=
141
+ github.com/hashicorp/serf v0.9.6/go.mod h1:TXZNMjZQijwlDvp+r0b63xZ45H7JmCmgg4gpTwn9UV4=
142
+ github.com/hashicorp/vault/api v1.0.4/go.mod h1:gDcqh3WGcR1cpF5AJz/B1UFheUEneMoIospckxBxk6Q=
143
+ github.com/hashicorp/vault/sdk v0.1.13/go.mod h1:B+hVj7TpuQY1Y/GPbCpffmgd+tSEwvhkWnjtSYCaS2M=
144
+ github.com/hashicorp/yamux v0.0.0-20180604194846-3520598351bb/go.mod h1:+NfK9FKeTrX5uv1uIXGdwYDTeHna2qgaIlx54MXqjAM=
145
+ github.com/hashicorp/yamux v0.0.0-20181012175058-2f1d1f20f75d/go.mod h1:+NfK9FKeTrX5uv1uIXGdwYDTeHna2qgaIlx54MXqjAM=
146
+ github.com/hjson/hjson-go/v4 v4.0.0/go.mod h1:KaYt3bTw3zhBjYqnXkYywcYctk0A2nxeEFTse3rH13E=
147
+ github.com/jmespath/go-jmespath v0.4.0/go.mod h1:T8mJZnbsbmF+m6zOOFylbeCJqk5+pHWvzYPziyZiYoo=
148
+ github.com/jmespath/go-jmespath/internal/testify v1.5.1/go.mod h1:L3OGu8Wl2/fWfCI6z80xFu9LTZmf1ZRjMHUOPmWr69U=
149
+ github.com/joho/godotenv v1.3.0/go.mod h1:7hK45KPybAkOC6peb+G5yklZfMxEjkZhHbwpqxOKXbg=
150
+ github.com/jpillora/backoff v1.0.0/go.mod h1:J/6gKK9jxlEcS3zixgDgUAsiuZ7yrSoa/FX5e0EB2j4=
151
+ github.com/json-iterator/go v1.1.6/go.mod h1:+SdeFBvtyEkXs7REEP0seUULqWtbJapLOCVDaaPEHmU=
152
+ github.com/json-iterator/go v1.1.10/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4=
153
+ github.com/json-iterator/go v1.1.11/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4=
154
+ github.com/julienschmidt/httprouter v1.2.0/go.mod h1:SYymIcj16QtmaHHD7aYtjjsJG7VTCxuUUipMqKk8s4w=
155
+ github.com/julienschmidt/httprouter v1.3.0/go.mod h1:JR6WtHb+2LUe8TCKY3cZOxFyyO8IZAc4RVcycCCAKdM=
156
+ github.com/kisielk/errcheck v1.5.0/go.mod h1:pFxgyoBC7bSaBwPgfKdkLd5X25qrDl4LWUI2bnpBCr8=
157
+ github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck=
158
+ github.com/knadh/koanf v0.9.1 h1:qfcwiF9/Z8buTJ0QXaZvOxJ6eKJmOiiWKP/PktiW5RE=
159
+ github.com/knadh/koanf v0.9.1/go.mod h1:31bzRSM7vS5Vm9LNLo7B2Re1zhLOZT6EQKeodixBikE=
160
+ github.com/knadh/koanf v1.5.0 h1:q2TSd/3Pyc/5yP9ldIrSdIz26MCcyNQzW0pEAugLPNs=
161
+ github.com/knadh/koanf v1.5.0/go.mod h1:Hgyjp4y8v44hpZtPzs7JZfRAW5AhN7KfZcwv1RYggDs=
162
+ github.com/knadh/stuffbin v1.1.0 h1:f5S5BHzZALjuJEgTIOMC9NidEnBJM7Ze6Lu1GHR/lwU=
163
+ github.com/knadh/stuffbin v1.1.0/go.mod h1:yVCFaWaKPubSNibBsTAJ939q2ABHudJQxRWZWV5yh+4=
164
+ github.com/konsorten/go-windows-terminal-sequences v1.0.1/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ=
165
+ github.com/konsorten/go-windows-terminal-sequences v1.0.3/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ=
166
+ github.com/kr/logfmt v0.0.0-20140226030751-b84e30acd515/go.mod h1:+0opPa2QZZtGFBFZlji/RkVcI2GknAs/DXo4wKdlNEc=
167
+ github.com/kr/pretty v0.1.0 h1:L/CwN0zerZDmRFUapSPitk6f+Q3+0za1rQkzVuMiMFI=
168
+ github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo=
169
+ github.com/kr/pretty v0.2.0 h1:s5hAObm+yFO5uHYt5dYjxi2rXrsnmRpJx4OYvIWUaQs=
170
+ github.com/kr/pretty v0.2.0/go.mod h1:ipq/a2n7PKx3OHsz4KJII5eveXtPO4qwEXGdVfWzfnI=
171
+ github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ=
172
+ github.com/kr/text v0.1.0 h1:45sCR5RtlFHMR4UwH9sdQ5TC8v0qDQCHnXt+kaKSTVE=
173
+ github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI=
174
+ github.com/mattn/go-colorable v0.0.9/go.mod h1:9vuHe8Xs5qXnSaW/c/ABM9alt+Vo+STaOChaDxuIBZU=
175
+ github.com/mattn/go-colorable v0.1.4/go.mod h1:U0ppj6V5qS13XJ6of8GYAs25YV2eR4EVcfRqFIhoBtE=
176
+ github.com/mattn/go-colorable v0.1.6/go.mod h1:u6P/XSegPjTcexA+o6vUJrdnUu04hMope9wVRipJSqc=
177
+ github.com/mattn/go-isatty v0.0.3/go.mod h1:M+lRXTBqGeGNdLjl/ufCoiOlB5xdOkqRJdNxMWT7Zi4=
178
+ github.com/mattn/go-isatty v0.0.8/go.mod h1:Iq45c/XA43vh69/j3iqttzPXn0bhXyGjM0Hdxcsrc5s=
179
+ github.com/mattn/go-isatty v0.0.10/go.mod h1:qgIWMr58cqv1PHHyhnkY9lrL7etaEgOFcMEpPG5Rm84=
180
+ github.com/mattn/go-isatty v0.0.11/go.mod h1:PhnuNfih5lzO57/f3n+odYbM4JtupLOxQOAqxQCu2WE=
181
+ github.com/mattn/go-isatty v0.0.12/go.mod h1:cbi8OIDigv2wuxKPP5vlRcQ1OAZbq2CE4Kysco4FUpU=
182
+ github.com/matttproud/golang_protobuf_extensions v1.0.1/go.mod h1:D8He9yQNgCq6Z5Ld7szi9bcBfOoFv/3dc6xSMkL2PC0=
183
+ github.com/miekg/dns v1.1.26/go.mod h1:bPDLeHnStXmXAq1m/Ch/hvfNHr14JKNPMBo3VZKjuso=
184
+ github.com/miekg/dns v1.1.41/go.mod h1:p6aan82bvRIyn+zDIv9xYNUpwa73JcSh9BKwknJysuI=
185
+ github.com/mitchellh/cli v1.0.0/go.mod h1:hNIlj7HEI86fIcpObd7a0FcrxTWetlwJDGcceTlRvqc=
186
+ github.com/mitchellh/cli v1.1.0/go.mod h1:xcISNoH86gajksDmfB23e/pu+B+GeFRMYmoHXxx3xhI=
187
+ github.com/mitchellh/copystructure v1.0.0/go.mod h1:SNtv71yrdKgLRyLFxmLdkAbkKEFWgYaq1OVrnRcwhnw=
188
+ github.com/mitchellh/copystructure v1.2.0 h1:vpKXTN4ewci03Vljg/q9QvCGUDttBOGBIa15WveJJGw=
189
+ github.com/mitchellh/copystructure v1.2.0/go.mod h1:qLl+cE2AmVv+CoeAwDPye/v+N2HKCj9FbZEVFJRxO9s=
190
+ github.com/mitchellh/go-homedir v1.1.0/go.mod h1:SfyaCUpYCn1Vlf4IUYiD9fPX4A5wJrkLzIz1N1q0pr0=
191
+ github.com/mitchellh/go-testing-interface v0.0.0-20171004221916-a61a99592b77/go.mod h1:kRemZodwjscx+RGhAo8eIhFbs2+BFgRtFPeD/KE+zxI=
192
+ github.com/mitchellh/go-testing-interface v1.0.0/go.mod h1:kRemZodwjscx+RGhAo8eIhFbs2+BFgRtFPeD/KE+zxI=
193
+ github.com/mitchellh/go-wordwrap v1.0.0/go.mod h1:ZXFpozHsX6DPmq2I0TCekCxypsnAUbP2oI0UX1GXzOo=
194
+ github.com/mitchellh/mapstructure v0.0.0-20160808181253-ca63d7c062ee/go.mod h1:FVVH3fgwuzCH5S8UJGiWEs2h04kUh9fWfEaFds41c1Y=
195
+ github.com/mitchellh/mapstructure v1.1.2/go.mod h1:FVVH3fgwuzCH5S8UJGiWEs2h04kUh9fWfEaFds41c1Y=
196
+ github.com/mitchellh/mapstructure v1.2.2 h1:dxe5oCinTXiTIcfgmZecdCzPmAJKd46KsCWc35r0TV4=
197
+ github.com/mitchellh/mapstructure v1.2.2/go.mod h1:bFUtVrKA4DC2yAKiSyO/QUcy7e+RRV2QTWOzhPopBRo=
198
+ github.com/mitchellh/mapstructure v1.5.0 h1:jeMsZIYE/09sWLaz43PL7Gy6RuMjD2eJVyuac5Z2hdY=
199
+ github.com/mitchellh/mapstructure v1.5.0/go.mod h1:bFUtVrKA4DC2yAKiSyO/QUcy7e+RRV2QTWOzhPopBRo=
200
+ github.com/mitchellh/reflectwalk v1.0.0/go.mod h1:mSTlrgnPZtwu0c4WaC2kGObEpuNDbx0jmZXqmk4esnw=
201
+ github.com/mitchellh/reflectwalk v1.0.2 h1:G2LzWKi524PWgd3mLHV8Y5k7s6XUvT0Gef6zxSIeXaQ=
202
+ github.com/mitchellh/reflectwalk v1.0.2/go.mod h1:mSTlrgnPZtwu0c4WaC2kGObEpuNDbx0jmZXqmk4esnw=
203
+ github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q=
204
+ github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q=
205
+ github.com/modern-go/reflect2 v0.0.0-20180701023420-4b7aa43c6742/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0=
206
+ github.com/modern-go/reflect2 v1.0.1/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0=
207
+ github.com/mwitkow/go-conntrack v0.0.0-20161129095857-cc309e4a2223/go.mod h1:qRWi+5nqEBWmkhHvq77mSJWrCKwh8bxhgT7d/eI7P4U=
208
+ github.com/mwitkow/go-conntrack v0.0.0-20190716064945-2f068394615f/go.mod h1:qRWi+5nqEBWmkhHvq77mSJWrCKwh8bxhgT7d/eI7P4U=
209
+ github.com/npillmayer/nestext v0.1.3/go.mod h1:h2lrijH8jpicr25dFY+oAJLyzlya6jhnuG+zWp9L0Uk=
210
+ github.com/oklog/run v1.0.0/go.mod h1:dlhp/R75TPv97u0XWUtDeV/lRKWPKSdTuV0TZvrmrQA=
211
+ github.com/pascaldekloe/goe v0.0.0-20180627143212-57f6aae5913c/go.mod h1:lzWF7FIEvWOWxwDKqyGYQf6ZUaNfKdP144TG7ZOy1lc=
212
+ github.com/pascaldekloe/goe v0.1.0/go.mod h1:lzWF7FIEvWOWxwDKqyGYQf6ZUaNfKdP144TG7ZOy1lc=
213
+ github.com/pelletier/go-toml v1.7.0 h1:7utD74fnzVc/cpcyy8sjrlFr5vYpypUixARcHIMIGuI=
214
+ github.com/pelletier/go-toml v1.7.0/go.mod h1:vwGMzjaWMwyfHwgIBhI2YUM4fB6nL6lVAvS1LBMMhTE=
215
+ github.com/pelletier/go-toml v1.9.5 h1:4yBQzkHv+7BHq2PQUZF3Mx0IYxG7LsP222s7Agd3ve8=
216
+ github.com/pelletier/go-toml v1.9.5/go.mod h1:u1nR/EPcESfeI/szUZKdtJ0xRNbUoANCkoOuaOx1Y+c=
217
+ github.com/pierrec/lz4 v2.0.5+incompatible/go.mod h1:pdkljMzZIN41W+lC3N2tnIh5sFi+IEE17M5jbnwPHcY=
218
+ github.com/pkg/errors v0.8.0/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
219
+ github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
220
+ github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
221
+ github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
222
+ github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
223
+ github.com/posener/complete v1.1.1/go.mod h1:em0nMJCgc9GFtwrmVmEMR/ZL6WyhyjMBndrE9hABlRI=
224
+ github.com/posener/complete v1.2.3/go.mod h1:WZIdtGGp+qx0sLrYKtIRAruyNpv6hFCicSgv7Sy7s/s=
225
+ github.com/prometheus/client_golang v0.9.1/go.mod h1:7SWBe2y4D6OKWSNQJUaRYU/AaXPKyh/dDVn+NZz0KFw=
226
+ github.com/prometheus/client_golang v1.0.0/go.mod h1:db9x61etRT2tGnBNRi70OPL5FsnadC4Ky3P0J6CfImo=
227
+ github.com/prometheus/client_golang v1.7.1/go.mod h1:PY5Wy2awLA44sXw4AOSfFBetzPP4j5+D6mVACh+pe2M=
228
+ github.com/prometheus/client_golang v1.11.1/go.mod h1:Z6t4BnS23TR94PD6BsDNk8yVqroYurpAkEiz0P2BEV0=
229
+ github.com/prometheus/client_model v0.0.0-20180712105110-5c3871d89910/go.mod h1:MbSGuTsp3dbXC40dX6PRTWyKYBIrTGTE9sqQNg2J8bo=
230
+ github.com/prometheus/client_model v0.0.0-20190129233127-fd36f4220a90/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA=
231
+ github.com/prometheus/client_model v0.0.0-20190812154241-14fe0d1b01d4/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA=
232
+ github.com/prometheus/client_model v0.2.0/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA=
233
+ github.com/prometheus/common v0.4.1/go.mod h1:TNfzLD0ON7rHzMJeJkieUDPYmFC7Snx/y86RQel1bk4=
234
+ github.com/prometheus/common v0.10.0/go.mod h1:Tlit/dnDKsSWFlCLTWaA1cyBgKHSMdTB80sz/V91rCo=
235
+ github.com/prometheus/common v0.26.0/go.mod h1:M7rCNAaPfAosfx8veZJCuw84e35h3Cfd9VFqTh1DIvc=
236
+ github.com/prometheus/procfs v0.0.0-20181005140218-185b4288413d/go.mod h1:c3At6R/oaqEKCNdg8wHV1ftS6bRYblBhIjjI8uT2IGk=
237
+ github.com/prometheus/procfs v0.0.2/go.mod h1:TjEm7ze935MbeOT/UhFTIMYKhuLP4wbCsTZCD3I8kEA=
238
+ github.com/prometheus/procfs v0.1.3/go.mod h1:lV6e/gmhEcM9IjHGsFOCxxuZ+z1YqCvr4OA4YeYWdaU=
239
+ github.com/prometheus/procfs v0.6.0/go.mod h1:cz+aTbrPOrUb4q7XlbU9ygM+/jj0fzG6c1xBZuNvfVA=
240
+ github.com/rhnvrm/simples3 v0.5.0/go.mod h1:Y+3vYm2V7Y4VijFoJHHTrja6OgPrJ2cBti8dPGkC3sA=
241
+ github.com/rhnvrm/simples3 v0.6.1/go.mod h1:Y+3vYm2V7Y4VijFoJHHTrja6OgPrJ2cBti8dPGkC3sA=
242
+ github.com/rogpeppe/fastuuid v1.2.0/go.mod h1:jVj6XXZzXRy/MSR5jhDC/2q6DgLz+nrA6LYCDYWNEvQ=
243
+ github.com/ryanuber/columnize v0.0.0-20160712163229-9b3edd62028f/go.mod h1:sm1tb6uqfes/u+d4ooFouqFdy9/2g9QGwK3SQygK0Ts=
244
+ github.com/ryanuber/columnize v2.1.0+incompatible/go.mod h1:sm1tb6uqfes/u+d4ooFouqFdy9/2g9QGwK3SQygK0Ts=
245
+ github.com/ryanuber/go-glob v1.0.0/go.mod h1:807d1WSdnB0XRJzKNil9Om6lcp/3a0v4qIHxIXzX/Yc=
246
+ github.com/sean-/seed v0.0.0-20170313163322-e2103e2c3529/go.mod h1:DxrIzT+xaE7yg65j358z/aeFdxmN0P9QXhEzd20vsDc=
247
+ github.com/sirupsen/logrus v1.2.0/go.mod h1:LxeOpSwHxABJmUn/MG1IvRgCAasNZTLOkJPxbbu5VWo=
248
+ github.com/sirupsen/logrus v1.4.2/go.mod h1:tLMulIdttU9McNUspp0xgXVQah82FyeX6MwdIuYE2rE=
249
+ github.com/sirupsen/logrus v1.6.0/go.mod h1:7uNnSEd1DgxDLC74fIahvMZmmYsHGZGEOFrfsX/uA88=
250
+ github.com/spf13/pflag v1.0.5 h1:iy+VFUOCP1a+8yFto/drg2CJ5u0yRoB7fZw3DKv/JXA=
251
+ github.com/spf13/pflag v1.0.5/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg=
252
+ github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
253
+ github.com/stretchr/objx v0.1.1/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
254
+ github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs=
255
+ github.com/stretchr/testify v1.3.0 h1:TivCn/peBQ7UY8ooIcPgZFpTNSz0Q2U6UrFlUfqbe0Q=
256
+ github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI=
257
+ github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4=
258
+ github.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5cxcmMvtA=
259
+ github.com/stretchr/testify v1.7.0 h1:nwc3DEeHmmLAfoZucVR881uASk0Mfjw8xYJ99tb5CcY=
260
+ github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
261
+ github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74=
262
+ github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74=
263
+ github.com/yuin/goldmark v1.3.5/go.mod h1:mwnBkeHKe2W/ZEtQ+71ViKU8L12m81fl3OWwC1Zlc8k=
264
+ github.com/yuin/goldmark v1.4.13/go.mod h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5taEt/CY=
265
+ go.etcd.io/etcd/api/v3 v3.5.4/go.mod h1:5GB2vv4A4AOn3yk7MftYGHkUfGtDHnEraIjym4dYz5A=
266
+ go.etcd.io/etcd/client/pkg/v3 v3.5.4/go.mod h1:IJHfcCEKxYu1Os13ZdwCwIUTUVGYTSAM3YSwc9/Ac1g=
267
+ go.etcd.io/etcd/client/v3 v3.5.4/go.mod h1:ZaRkVgBZC+L+dLCjTcF1hRXpgZXQPOvnA/Ak/gq3kiY=
268
+ go.uber.org/atomic v1.7.0/go.mod h1:fEN4uk6kAWBTFdckzkM89CLk9XfWZrxpCo0nPH17wJc=
269
+ go.uber.org/multierr v1.6.0/go.mod h1:cdWPpRnG4AhwMwsgIHip0KRBQjJy5kYEpYjJxpXp9iU=
270
+ go.uber.org/zap v1.17.0/go.mod h1:MXVU+bhUf/A7Xi2HNOnopQOrmycQ5Ih87HtOu4q5SSo=
271
+ golang.org/x/crypto v0.0.0-20180904163835-0709b304e793/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4=
272
+ golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
273
+ golang.org/x/crypto v0.0.0-20190923035154-9ee001bba392/go.mod h1:/lpIB1dKB+9EgE3H3cr1v9wB50oz8l4C4h62xy7jSTY=
274
+ golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=
275
+ golang.org/x/crypto v0.0.0-20200403201458-baeed622b8d8 h1:fpnn/HnJONpIu6hkXi1u/7rR0NzilgWr4T0JmWkEitk=
276
+ golang.org/x/crypto v0.0.0-20200403201458-baeed622b8d8/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto=
277
+ golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto=
278
+ golang.org/x/crypto v0.0.0-20210513164829-c07d793c2f9a/go.mod h1:P+XmwS30IXTQdn5tA2iutPOUgjI07+tq3H3K9MVA1s8=
279
+ golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc=
280
+ golang.org/x/crypto v0.8.0 h1:pd9TJtTueMTVQXzk8E2XESSMQDj/U7OUu0PqJqPXQjQ=
281
+ golang.org/x/crypto v0.8.0/go.mod h1:mRqEX+O9/h5TFCrQhkgjo2yKi0yYA+9ecGkdQoHrywE=
282
+ golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA=
283
+ golang.org/x/lint v0.0.0-20181026193005-c67002cb31c3/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE=
284
+ golang.org/x/lint v0.0.0-20190227174305-5b3e6a55c961/go.mod h1:wehouNa3lNwaWXcvxsM5YxQ5yQlVC4a0KAMCusXpPoU=
285
+ golang.org/x/lint v0.0.0-20190313153728-d0100b6bd8b3/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc=
286
+ golang.org/x/lint v0.0.0-20210508222113-6edffad5e616/go.mod h1:3xt1FjdF8hUf6vQPIChWIBhFzV8gjjsPE/fR3IyQdNY=
287
+ golang.org/x/mod v0.1.1-0.20191105210325-c90efee705ee/go.mod h1:QqPTAvyqsEbceGzBzNggFXnrqF1CaUcvgkdR5Ot7KZg=
288
+ golang.org/x/mod v0.2.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA=
289
+ golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA=
290
+ golang.org/x/mod v0.4.2/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA=
291
+ golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod h1:jJ57K6gSWd91VN4djpZkiMVwK6gcyfeH4XE8wZrZaV4=
292
+ golang.org/x/mod v0.8.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs=
293
+ golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
294
+ golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
295
+ golang.org/x/net v0.0.0-20181114220301-adae6a3d119a/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
296
+ golang.org/x/net v0.0.0-20190108225652-1e06a53dbb7e/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
297
+ golang.org/x/net v0.0.0-20190213061140-3a22650c66bd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
298
+ golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
299
+ golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3 h1:0GoQqolDA55aaLxZyTzK/Y2ePZzZTUrRacwib7cNsYQ=
300
+ golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
301
+ golang.org/x/net v0.0.0-20190613194153-d28f0bde5980/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
302
+ golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
303
+ golang.org/x/net v0.0.0-20190923162816-aa69164e4478/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
304
+ golang.org/x/net v0.0.0-20200226121028-0de0cce0169b/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
305
+ golang.org/x/net v0.0.0-20200625001655-4c5254603344/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA=
306
+ golang.org/x/net v0.0.0-20200822124328-c89045814202/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA=
307
+ golang.org/x/net v0.0.0-20201021035429-f5854403a974/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU=
308
+ golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg=
309
+ golang.org/x/net v0.0.0-20210405180319-a5a99cb37ef4/go.mod h1:p54w0d4576C0XHj96bSt6lcn1PtDYWL6XObtHCRCNQM=
310
+ golang.org/x/net v0.0.0-20210410081132-afb366fc7cd1/go.mod h1:9tjilg8BloeKEkVJvy7fQ90B1CfIiPueXVOjqfkSzI8=
311
+ golang.org/x/net v0.0.0-20210525063256-abc453219eb5/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y=
312
+ golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c=
313
+ golang.org/x/net v0.6.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs=
314
+ golang.org/x/net v0.9.0 h1:aWJ/m6xSmxWBx+V0XRHTlrYrPG56jKsLdTFmsSsCzOM=
315
+ golang.org/x/net v0.9.0/go.mod h1:d48xBJpPfHeWQsugry2m+kC02ZBRGRgulfHnEXEuWns=
316
+ golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U=
317
+ golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw=
318
+ golang.org/x/oauth2 v0.0.0-20200107190931-bf48bf16ab8d/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw=
319
+ golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
320
+ golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
321
+ golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
322
+ golang.org/x/sync v0.0.0-20190227155943-e225da77a7e6/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
323
+ golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
324
+ golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
325
+ golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
326
+ golang.org/x/sync v0.0.0-20201207232520-09787c993a3a/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
327
+ golang.org/x/sync v0.0.0-20210220032951-036812b2e83c/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
328
+ golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
329
+ golang.org/x/sync v0.1.0/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
330
+ golang.org/x/sys v0.0.0-20180823144017-11551d06cbcc/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
331
+ golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
332
+ golang.org/x/sys v0.0.0-20180905080454-ebe1bf3edb33/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
333
+ golang.org/x/sys v0.0.0-20181116152217-5ac8a444bdc5/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
334
+ golang.org/x/sys v0.0.0-20190129075346-302c3dd5f1cc/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
335
+ golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
336
+ golang.org/x/sys v0.0.0-20190222072716-a9d3bda3a223/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
337
+ golang.org/x/sys v0.0.0-20190403152447-81d4e9dc473e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
338
+ golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
339
+ golang.org/x/sys v0.0.0-20190422165155-953cdadca894/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
340
+ golang.org/x/sys v0.0.0-20190922100055-0a153f010e69/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
341
+ golang.org/x/sys v0.0.0-20190924154521-2837fb4f24fe/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
342
+ golang.org/x/sys v0.0.0-20191005200804-aed5e4c7ecf9/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
343
+ golang.org/x/sys v0.0.0-20191008105621-543471e840be/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
344
+ golang.org/x/sys v0.0.0-20191026070338-33540a1f6037/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
345
+ golang.org/x/sys v0.0.0-20200106162015-b016eb3dc98e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
346
+ golang.org/x/sys v0.0.0-20200116001909-b77594299b42/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
347
+ golang.org/x/sys v0.0.0-20200124204421-9fbb57f87de9/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
348
+ golang.org/x/sys v0.0.0-20200223170610-d5e6a3e2c0ae/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
349
+ golang.org/x/sys v0.0.0-20200323222414-85ca7c5b95cd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
350
+ golang.org/x/sys v0.0.0-20200331124033-c3d80250170d h1:nc5K6ox/4lTFbMVSL9WRR81ixkcwXThoiF6yf+R9scA=
351
+ golang.org/x/sys v0.0.0-20200331124033-c3d80250170d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
352
+ golang.org/x/sys v0.0.0-20200615200032-f1bc736245b1/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
353
+ golang.org/x/sys v0.0.0-20200625212154-ddb9806d33ae/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
354
+ golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
355
+ golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
356
+ golang.org/x/sys v0.0.0-20210124154548-22da62e12c0c/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
357
+ golang.org/x/sys v0.0.0-20210303074136-134d130e1a04/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
358
+ golang.org/x/sys v0.0.0-20210330210617-4fbd30eecc44/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
359
+ golang.org/x/sys v0.0.0-20210403161142-5e06dd20ab57/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
360
+ golang.org/x/sys v0.0.0-20210423082822-04245dca01da/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
361
+ golang.org/x/sys v0.0.0-20210510120138-977fb7262007/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
362
+ golang.org/x/sys v0.0.0-20210603081109-ebe580a85c40/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
363
+ golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
364
+ golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
365
+ golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
366
+ golang.org/x/sys v0.0.0-20220908164124-27713097b956/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
367
+ golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
368
+ golang.org/x/sys v0.7.0 h1:3jlCCIQZPdOYu1h8BkNvLz8Kgwtae2cagcG/VamtZRU=
369
+ golang.org/x/sys v0.7.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
370
+ golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
371
+ golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8=
372
+ golang.org/x/term v0.5.0/go.mod h1:jMB1sMXY+tzblOD4FWmEbocvup2/aLOaQEp7JmGp78k=
373
+ golang.org/x/term v0.7.0/go.mod h1:P32HKFT3hSsZrRxla30E9HqToFYAQPCMs/zFMBUFqPY=
374
+ golang.org/x/text v0.3.0 h1:g61tztE5qeGQ89tm6NTjjM9VPIm088od1l6aSorWRWg=
375
+ golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
376
+ golang.org/x/text v0.3.1-0.20181227161524-e6919f6577db/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk=
377
+ golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk=
378
+ golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
379
+ golang.org/x/text v0.3.5/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
380
+ golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
381
+ golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ=
382
+ golang.org/x/text v0.7.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8=
383
+ golang.org/x/text v0.9.0 h1:2sjJmO8cDvYveuX97RDLsxlyUxLl+GHoLxBiRdHllBE=
384
+ golang.org/x/text v0.9.0/go.mod h1:e1OnstbJyHTd6l/uOt8jFFHp6TRDWZR/bV3emEE/zU8=
385
+ golang.org/x/time v0.0.0-20190308202827-9d24e82272b4/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ=
386
+ golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
387
+ golang.org/x/tools v0.0.0-20190114222345-bf090417da8b/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
388
+ golang.org/x/tools v0.0.0-20190226205152-f727befe758c/go.mod h1:9Yl7xja0Znq3iFh3HoIrodX9oNMXvdceNzlUR8zjMvY=
389
+ golang.org/x/tools v0.0.0-20190311212946-11955173bddd/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs=
390
+ golang.org/x/tools v0.0.0-20190524140312-2c0ae7006135/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q=
391
+ golang.org/x/tools v0.0.0-20190907020128-2ca718005c18/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
392
+ golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
393
+ golang.org/x/tools v0.0.0-20200130002326-2f3ba24bd6e7/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28=
394
+ golang.org/x/tools v0.0.0-20200619180055-7c47624df98f/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE=
395
+ golang.org/x/tools v0.0.0-20210106214847-113979e3529a/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA=
396
+ golang.org/x/tools v0.1.2/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk=
397
+ golang.org/x/tools v0.1.12/go.mod h1:hNGJHUnrk76NpqgfD5Aqm5Crs+Hm0VOH/i9J2+nxYbc=
398
+ golang.org/x/tools v0.6.0/go.mod h1:Xwgl3UAJ/d3gWutnCtw505GrjyAbvKui8lOU390QaIU=
399
+ golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
400
+ golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
401
+ golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
402
+ golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
403
+ google.golang.org/appengine v1.1.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9YwlJXL52JkM=
404
+ google.golang.org/appengine v1.4.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4=
405
+ google.golang.org/genproto v0.0.0-20180817151627-c66870c02cf8/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc=
406
+ google.golang.org/genproto v0.0.0-20190404172233-64821d5d2107/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE=
407
+ google.golang.org/genproto v0.0.0-20190819201941-24fa4b261c55/go.mod h1:DMBHOl98Agz4BDEuKkezgsaosCRResVns1a3J2ZsMNc=
408
+ google.golang.org/genproto v0.0.0-20200513103714-09dca8ec2884/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c=
409
+ google.golang.org/genproto v0.0.0-20200526211855-cb27e3aa2013/go.mod h1:NbSheEEYHJ7i3ixzK3sjbqSGDJWnxyFXZblF3eUsNvo=
410
+ google.golang.org/genproto v0.0.0-20210602131652-f16073e35f0c/go.mod h1:UODoCrxHCcBojKKwX1terBiRUaqAsFqJiF615XL43r0=
411
+ google.golang.org/grpc v1.14.0/go.mod h1:yo6s7OP7yaDglbqo1J04qKzAhqBH6lvTonzMVmEdcZw=
412
+ google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c=
413
+ google.golang.org/grpc v1.22.0/go.mod h1:Y5yQAOtifL1yxbo5wqy6BxZv8vAUGQwXBOALyacEbxg=
414
+ google.golang.org/grpc v1.23.0/go.mod h1:Y5yQAOtifL1yxbo5wqy6BxZv8vAUGQwXBOALyacEbxg=
415
+ google.golang.org/grpc v1.25.1/go.mod h1:c3i+UQWmh7LiEpx4sFZnkU36qjEYZ0imhYfXVyQciAY=
416
+ google.golang.org/grpc v1.27.0/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk=
417
+ google.golang.org/grpc v1.33.1/go.mod h1:fr5YgcSWrqhRRxogOsw7RzIpsmvOZ6IcH4kBYTpR3n0=
418
+ google.golang.org/grpc v1.38.0/go.mod h1:NREThFqKR1f3iQ6oBuvc5LadQuXVGo9rkm5ZGrQdJfM=
419
+ google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8=
420
+ google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0=
421
+ google.golang.org/protobuf v0.0.0-20200228230310-ab0ca4ff8a60/go.mod h1:cfTl7dwQJ+fmap5saPgwCLgHXTUD7jkjRqWcaiX5VyM=
422
+ google.golang.org/protobuf v1.20.1-0.20200309200217-e05f789c0967/go.mod h1:A+miEFZTKqfCUM6K7xSMQL9OKL/b6hQv+e19PK+JZNE=
423
+ google.golang.org/protobuf v1.21.0/go.mod h1:47Nbq4nVaFHyn7ilMalzfO3qCViNmqZ2kzikPIcrTAo=
424
+ google.golang.org/protobuf v1.22.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU=
425
+ google.golang.org/protobuf v1.23.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU=
426
+ google.golang.org/protobuf v1.23.1-0.20200526195155-81db48ad09cc/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU=
427
+ google.golang.org/protobuf v1.25.0/go.mod h1:9JNX74DMeImyA3h4bdi1ymwjUzf21/xIlbajtzgsN7c=
428
+ google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw=
429
+ google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc=
430
+ gopkg.in/alecthomas/kingpin.v2 v2.2.6/go.mod h1:FMv+mEhP44yOT+4EoQTLFTRgOQ1FBLkstjWtayDeSgw=
431
+ gopkg.in/asn1-ber.v1 v1.0.0-20181015200546-f715ec2f112d/go.mod h1:cuepJuh7vyXfUyUwEgHQXw849cJrilpS5NeIjOWESAw=
432
+ gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
433
+ gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127 h1:qIbj1fsPNlZgppZ+VLlY7N33q108Sa+fhmuc+sWQYwY=
434
+ gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
435
+ gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15 h1:YR8cESwS4TdDjEe65xsg0ogRM/Nc3DYOhEAlW+xobZo=
436
+ gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
437
+ gopkg.in/square/go-jose.v2 v2.3.1/go.mod h1:M9dMgbHiYLoDGQrXy7OpJDJWiKiU//h+vD76mk0e1AI=
438
+ gopkg.in/yaml.v2 v2.2.1/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
439
+ gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
440
+ gopkg.in/yaml.v2 v2.2.3/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
441
+ gopkg.in/yaml.v2 v2.2.4/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
442
+ gopkg.in/yaml.v2 v2.2.5/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
443
+ gopkg.in/yaml.v2 v2.2.8 h1:obN1ZagJSUGI0Ek/LBmuj4SNLPfIny3KsKFopxRdj10=
444
+ gopkg.in/yaml.v2 v2.2.8/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
445
+ gopkg.in/yaml.v2 v2.3.0/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
446
+ gopkg.in/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY=
447
+ gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ=
448
+ gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
449
+ gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
450
+ gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
451
+ honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4=
452
+ honnef.co/go/tools v0.0.0-20190523083050-ea95bdfd59fc/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4=
453
+ sigs.k8s.io/yaml v1.2.0/go.mod h1:yfXDCHCao9+ENCvLSE62v9VSji2MKu5jeNfTrofGhJc=
handlers.go ADDED
@@ -0,0 +1,339 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ package main
2
+
3
+ import (
4
+ "context"
5
+ "encoding/json"
6
+ "errors"
7
+ "io/ioutil"
8
+ "net/http"
9
+
10
+ "github.com/go-chi/chi"
11
+ "github.com/gorilla/websocket"
12
+ "github.com/knadh/niltalk/internal/hub"
13
+ "golang.org/x/crypto/bcrypt"
14
+ )
15
+
16
+ const (
17
+ hasAuth = 1 << iota
18
+ hasRoom
19
+ )
20
+
21
+ type sess struct {
22
+ ID string
23
+ Handle string
24
+ }
25
+
26
+ // reqCtx is the context injected into every request.
27
+ type reqCtx struct {
28
+ app *App
29
+ room *hub.Room
30
+ sess sess
31
+ }
32
+
33
+ // jsonResp is the envelope for all JSON API responses.
34
+ type jsonResp struct {
35
+ Error *string `json:"error"`
36
+ Data interface{} `json:"data"`
37
+ }
38
+
39
+ // tplWrap is the envelope for all HTML template executions.
40
+ type tpl struct {
41
+ Config *hub.Config
42
+ Data tplData
43
+ }
44
+
45
+ type tplData struct {
46
+ Title string
47
+ Description string
48
+ Room interface{}
49
+ Auth bool
50
+ }
51
+
52
+ type reqRoom struct {
53
+ Name string `json:"name"`
54
+ Handle string `json:"handle"`
55
+ Password string `json:"password"`
56
+ }
57
+
58
+ var upgrader = websocket.Upgrader{CheckOrigin: func(r *http.Request) bool {
59
+ return true
60
+ }}
61
+
62
+ // handleIndex renders the homepage.
63
+ func handleIndex(w http.ResponseWriter, r *http.Request) {
64
+ var (
65
+ ctx = r.Context().Value("ctx").(*reqCtx)
66
+ app = ctx.app
67
+ )
68
+ respondHTML("index", tplData{
69
+ Title: app.cfg.Name,
70
+ }, http.StatusOK, w, app)
71
+ }
72
+
73
+ // handleRoomPage renders the chat room page.
74
+ func handleRoomPage(w http.ResponseWriter, r *http.Request) {
75
+ var (
76
+ ctx = r.Context().Value("ctx").(*reqCtx)
77
+ app = ctx.app
78
+ room = ctx.room
79
+ )
80
+
81
+ if room == nil {
82
+ respondHTML("room-not-found", tplData{}, http.StatusNotFound, w, app)
83
+ return
84
+ }
85
+
86
+ out := tplData{
87
+ Title: room.Name,
88
+ Room: room,
89
+ }
90
+ if ctx.sess.ID != "" {
91
+ out.Auth = true
92
+ }
93
+
94
+ // Disable browser caching.
95
+ w.Header().Set("Cache-Control", "no-cache, no-store, must-revalidate")
96
+ w.Header().Set("Pragma", "no-cache")
97
+ w.Header().Set("Expires", "0")
98
+ respondHTML("room", out, http.StatusOK, w, app)
99
+ }
100
+
101
+ // handleLogin authenticates a peer into a room.
102
+ func handleLogin(w http.ResponseWriter, r *http.Request) {
103
+ var (
104
+ ctx = r.Context().Value("ctx").(*reqCtx)
105
+ app = ctx.app
106
+ room = ctx.room
107
+ )
108
+
109
+ if room == nil {
110
+ respondJSON(w, nil, errors.New("room is invalid or has expired"), http.StatusBadRequest)
111
+ return
112
+ }
113
+
114
+ var req reqRoom
115
+ if err := readJSONReq(r, &req); err != nil {
116
+ respondJSON(w, nil, errors.New("error parsing JSON request"), http.StatusBadRequest)
117
+ return
118
+ }
119
+
120
+ if req.Handle == "" {
121
+ h, err := hub.GenerateGUID(8)
122
+ if err != nil {
123
+ app.logger.Printf("error generating uniq handle: %v", err)
124
+ respondJSON(w, nil, errors.New("error generating uniq handle"), http.StatusInternalServerError)
125
+ return
126
+ }
127
+ req.Handle = h
128
+ }
129
+
130
+ // Validate password.
131
+ if err := bcrypt.CompareHashAndPassword(room.Password, []byte(req.Password)); err != nil {
132
+ respondJSON(w, nil, errors.New("incorrect password"), http.StatusForbidden)
133
+ return
134
+ }
135
+
136
+ // Register a new session for the peer in the DB.
137
+ sessID, err := hub.GenerateGUID(32)
138
+ if err != nil {
139
+ app.logger.Printf("error generating session ID: %v", err)
140
+ respondJSON(w, nil, errors.New("error generating session ID"), http.StatusInternalServerError)
141
+ return
142
+ }
143
+
144
+ if err := app.hub.Store.AddSession(sessID, req.Handle, room.ID, app.cfg.RoomAge); err != nil {
145
+ app.logger.Printf("error creating session: %v", err)
146
+ respondJSON(w, nil, errors.New("error creating session"), http.StatusInternalServerError)
147
+ return
148
+ }
149
+
150
+ // Set the session cookie.
151
+ ck := &http.Cookie{Name: app.cfg.SessionCookie, Value: sessID, Path: "/"}
152
+ http.SetCookie(w, ck)
153
+ respondJSON(w, true, nil, http.StatusOK)
154
+ }
155
+
156
+ // handleLogout logs out a peer.
157
+ func handleLogout(w http.ResponseWriter, r *http.Request) {
158
+ var (
159
+ ctx = r.Context().Value("ctx").(*reqCtx)
160
+ app = ctx.app
161
+ room = ctx.room
162
+ )
163
+
164
+ if room == nil {
165
+ respondJSON(w, nil, errors.New("room is invalid or has expired"), http.StatusBadRequest)
166
+ return
167
+ }
168
+
169
+ if err := app.hub.Store.RemoveSession(ctx.sess.ID, room.ID); err != nil {
170
+ app.logger.Printf("error removing session: %v", err)
171
+ respondJSON(w, nil, errors.New("error removing session"), http.StatusInternalServerError)
172
+ return
173
+ }
174
+
175
+ // Delete the session cookie.
176
+ ck := &http.Cookie{Name: app.cfg.SessionCookie, Value: "", MaxAge: -1, Path: "/"}
177
+ http.SetCookie(w, ck)
178
+ respondJSON(w, true, nil, http.StatusOK)
179
+ }
180
+
181
+ // handleWS handles incoming connections.
182
+ func handleWS(w http.ResponseWriter, r *http.Request) {
183
+ var (
184
+ ctx = r.Context().Value("ctx").(*reqCtx)
185
+ app = ctx.app
186
+ room = ctx.room
187
+ )
188
+
189
+ if ctx.sess.ID == "" {
190
+ respondJSON(w, nil, errors.New("invalid session"), http.StatusForbidden)
191
+ return
192
+ }
193
+
194
+ // Create the WS connection.
195
+ ws, err := upgrader.Upgrade(w, r, nil)
196
+ if err != nil {
197
+ app.logger.Printf("Websocket upgrade failed: %s: %v", r.RemoteAddr, err)
198
+ return
199
+ }
200
+
201
+ // Create a new peer instance and add to the room.
202
+ room.AddPeer(ctx.sess.ID, ctx.sess.Handle, ws)
203
+ }
204
+
205
+ // respondJSON responds to an HTTP request with a generic payload or an error.
206
+ func respondJSON(w http.ResponseWriter, data interface{}, err error, statusCode int) {
207
+ if statusCode == 0 {
208
+ statusCode = http.StatusOK
209
+ }
210
+
211
+ w.WriteHeader(statusCode)
212
+ w.Header().Set("Content-Type", "application/json; charset=utf-8")
213
+
214
+ out := jsonResp{Data: data}
215
+ if err != nil {
216
+ e := err.Error()
217
+ out.Error = &e
218
+ }
219
+ b, err := json.Marshal(out)
220
+ if err != nil {
221
+ logger.Printf("error marshalling JSON response: %v", err)
222
+ http.Error(w, "Internal server error", http.StatusInternalServerError)
223
+ return
224
+ }
225
+ w.Write(b)
226
+ }
227
+
228
+ // respondHTML responds to an HTTP request with the HTML output of a given template.
229
+ func respondHTML(tplName string, data tplData, statusCode int, w http.ResponseWriter, app *App) {
230
+ if statusCode > 0 {
231
+ w.WriteHeader(statusCode)
232
+ }
233
+
234
+ w.Header().Set("Content-Type", "text/html; charset=utf-8")
235
+ err := app.tpl.ExecuteTemplate(w, tplName, tpl{
236
+ Config: app.cfg,
237
+ Data: data,
238
+ })
239
+ if err != nil {
240
+ app.logger.Printf("error rendering template %s: %s", tplName, err)
241
+ w.Write([]byte("error rendering template"))
242
+ }
243
+ }
244
+
245
+ // handleCreateRoom handles the creation of a new room.
246
+ func handleCreateRoom(w http.ResponseWriter, r *http.Request) {
247
+ var (
248
+ ctx = r.Context().Value("ctx").(*reqCtx)
249
+ app = ctx.app
250
+ )
251
+
252
+ var req reqRoom
253
+ if err := readJSONReq(r, &req); err != nil {
254
+ respondJSON(w, nil, errors.New("error parsing JSON request"), http.StatusBadRequest)
255
+ return
256
+ }
257
+
258
+ if req.Name != "" && (len(req.Name) < 3 || len(req.Name) > 100) {
259
+ respondJSON(w, nil, errors.New("invalid room name (6 - 100 chars)"), http.StatusBadRequest)
260
+ return
261
+ }
262
+
263
+ if len(req.Password) < 6 || len(req.Password) > 100 {
264
+ respondJSON(w, nil, errors.New("invalid password (6 - 100 chars)"), http.StatusBadRequest)
265
+ return
266
+ }
267
+
268
+ // Hash the password.
269
+ pwdHash, err := bcrypt.GenerateFromPassword([]byte(req.Password), 8)
270
+ if err != nil {
271
+ app.logger.Printf("error hashing password: %v", err)
272
+ respondJSON(w, "Error hashing password", nil, http.StatusInternalServerError)
273
+ return
274
+ }
275
+
276
+ // Create and activate the new room.
277
+ room, err := app.hub.AddRoom(req.Name, pwdHash)
278
+ if err != nil {
279
+ respondJSON(w, nil, err, http.StatusInternalServerError)
280
+ return
281
+ }
282
+
283
+ respondJSON(w, struct {
284
+ ID string `json:"id"`
285
+ }{room.ID}, nil, http.StatusOK)
286
+ }
287
+
288
+ // wrap is a middleware that handles auth and room check for various HTTP handlers.
289
+ // It attaches the app and room contexts to handlers.
290
+ func wrap(next http.HandlerFunc, app *App, opts uint8) http.HandlerFunc {
291
+ return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
292
+ var (
293
+ req = &reqCtx{app: app}
294
+ roomID = chi.URLParam(r, "roomID")
295
+ )
296
+
297
+ // Check if the request is authenticated.
298
+ if opts&hasAuth != 0 {
299
+ ck, _ := r.Cookie(app.cfg.SessionCookie)
300
+ if ck != nil && ck.Value != "" {
301
+ s, err := app.hub.Store.GetSession(ck.Value, roomID)
302
+ if err != nil {
303
+ app.logger.Printf("error checking session: %v", err)
304
+ respondJSON(w, nil, errors.New("error checking session"), http.StatusForbidden)
305
+ return
306
+ }
307
+ req.sess = sess{
308
+ ID: s.ID,
309
+ Handle: s.Handle,
310
+ }
311
+ }
312
+ }
313
+
314
+ // Check if the room is valid and active.
315
+ if opts&hasRoom != 0 {
316
+ // If the room's not found, req.room will be null in the target
317
+ // handler. It's the handler's responsibility to throw an error,
318
+ // API or HTML response.
319
+ room, err := app.hub.ActivateRoom(roomID)
320
+ if err == nil {
321
+ req.room = room
322
+ }
323
+ }
324
+
325
+ // Attach the request context.
326
+ ctx := context.WithValue(r.Context(), "ctx", req)
327
+ next.ServeHTTP(w, r.WithContext(ctx))
328
+ })
329
+ }
330
+
331
+ // readJSONReq reads the JSON body from a request and unmarshals it to the given target.
332
+ func readJSONReq(r *http.Request, o interface{}) error {
333
+ defer r.Body.Close()
334
+ b, err := ioutil.ReadAll(r.Body)
335
+ if err != nil {
336
+ return err
337
+ }
338
+ return json.Unmarshal(b, o)
339
+ }
internal/hub/hub.go ADDED
@@ -0,0 +1,188 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ package hub
2
+
3
+ import (
4
+ "crypto/rand"
5
+ "errors"
6
+ "log"
7
+ "sync"
8
+ "time"
9
+
10
+ "github.com/knadh/niltalk/store"
11
+ )
12
+
13
+ // Types of messages sent to peers.
14
+ const (
15
+ TypeTyping = "typing"
16
+ TypeMessage = "message"
17
+ TypePeerList = "peer.list"
18
+ TypePeerInfo = "peer.info"
19
+ TypePeerJoin = "peer.join"
20
+ TypePeerLeave = "peer.leave"
21
+ TypePeerRateLimited = "peer.ratelimited"
22
+ TypeRoomDispose = "room.dispose"
23
+ TypeRoomFull = "room.full"
24
+ TypeNotice = "notice"
25
+ TypeHandle = "handle"
26
+ )
27
+
28
+ // Config represents the app configuration.
29
+ type Config struct {
30
+ Address string `koanf:"address"`
31
+ RootURL string `koanf:"root_url"`
32
+
33
+ Name string `koanf:"name"`
34
+ RoomIDLen int `koanf:"room_id_length"`
35
+ MaxCachedMessages int `koanf:"max_cached_messages"`
36
+ MaxMessageLen int `koanf:"max_message_length"`
37
+ WSTimeout time.Duration `koanf:"websocket_timeout"`
38
+ MaxMessageQueue int `koanf:"max_message_queue"`
39
+ RateLimitInterval time.Duration `koanf:"rate_limit_interval"`
40
+ RateLimitMessages int `koanf:"rate_limit_messages"`
41
+ MaxRooms int `koanf:"max_rooms"`
42
+ MaxPeersPerRoom int `koanf:"max_peers_per_room"`
43
+ PeerHandleFormat string `koanf:"peer_handle_format"`
44
+ RoomTimeout time.Duration `koanf:"room_timeout"`
45
+ RoomAge time.Duration `koanf:"room_age"`
46
+ SessionCookie string `koanf:"session_cookie"`
47
+ Storage string `koanf:"storage"`
48
+ }
49
+
50
+ // Hub acts as the controller and container for all chat rooms.
51
+ type Hub struct {
52
+ Store store.Store
53
+ rooms map[string]*Room
54
+
55
+ cfg *Config
56
+ mut sync.RWMutex
57
+ log *log.Logger
58
+ }
59
+
60
+ // NewHub returns a new instance of Hub.
61
+ func NewHub(cfg *Config, store store.Store, l *log.Logger) *Hub {
62
+ return &Hub{
63
+ rooms: make(map[string]*Room),
64
+
65
+ cfg: cfg,
66
+ Store: store,
67
+ log: l,
68
+ }
69
+ }
70
+
71
+ // AddRoom creates a new room in the store, adds it to the hub, and
72
+ // returns the room (which has to be .Run() on a goroutine then).
73
+ func (h *Hub) AddRoom(name string, password []byte) (*Room, error) {
74
+ id, err := h.generateRoomID(h.cfg.RoomIDLen, 5)
75
+ if err != nil {
76
+ return nil, err
77
+ }
78
+
79
+ // Add the room to DB.
80
+ if err := h.Store.AddRoom(store.Room{ID: id,
81
+ Name: name,
82
+ CreatedAt: time.Now(),
83
+ Password: password}, h.cfg.RoomAge); err != nil {
84
+ h.log.Printf("error creating room in the store: %v", err)
85
+ return nil, errors.New("error creating room")
86
+ }
87
+
88
+ // Initialize the room.
89
+ return h.initRoom(id, name, password), nil
90
+ }
91
+
92
+ // ActivateRoom loads a room from the store into the hub if it's not already active.
93
+ func (h *Hub) ActivateRoom(id string) (*Room, error) {
94
+ h.mut.RLock()
95
+ room, ok := h.rooms[id]
96
+ h.mut.RUnlock()
97
+ if ok {
98
+ return room, nil
99
+ }
100
+
101
+ r, err := h.Store.GetRoom(id)
102
+ if err != nil {
103
+ return nil, errors.New("room doesn't exist")
104
+ }
105
+
106
+ // Initialize the room.
107
+ return h.initRoom(r.ID, r.Name, r.Password), nil
108
+ }
109
+
110
+ // GetRoom retrives an active room from the hub.
111
+ func (h *Hub) GetRoom(id string) *Room {
112
+ h.mut.Lock()
113
+ r, _ := h.rooms[id]
114
+ h.mut.Unlock()
115
+ return r
116
+ }
117
+
118
+ // initRoom initializes a room on the Hub.
119
+ func (h *Hub) initRoom(id, name string, password []byte) *Room {
120
+ r := NewRoom(id, name, password, h)
121
+ h.mut.Lock()
122
+ h.rooms[id] = r
123
+ h.mut.Unlock()
124
+ go r.run()
125
+ return r
126
+ }
127
+
128
+ // getRooms returns the list of active rooms.
129
+ func (h *Hub) getRooms() []*Room {
130
+ h.mut.RLock()
131
+ out := make([]*Room, 0, len(h.rooms))
132
+ for _, r := range h.rooms {
133
+ out = append(out, r)
134
+ }
135
+ h.mut.RUnlock()
136
+ return out
137
+ }
138
+
139
+ // removeRoom removes a room from the hub and the store.
140
+ func (h *Hub) removeRoom(id string) error {
141
+ h.mut.Lock()
142
+ delete(h.rooms, id)
143
+ h.mut.Unlock()
144
+
145
+ err := h.Store.RemoveRoom(id)
146
+ if err != nil {
147
+ h.log.Printf("error removing room from store: %v", err)
148
+ return err
149
+ }
150
+ return nil
151
+ }
152
+
153
+ // generateRoomID generates a random room ID while checking the store for
154
+ // uniqueness up to numTries times.
155
+ func (h *Hub) generateRoomID(length, numTries int) (string, error) {
156
+ for i := 0; i < numTries; i++ {
157
+ id, err := GenerateGUID(length)
158
+ if err != nil {
159
+ h.log.Printf("error generating room ID: %v", err)
160
+ return "", errors.New("error generating room ID")
161
+ }
162
+
163
+ exists, err := h.Store.RoomExists(id)
164
+ if err != nil {
165
+ h.log.Printf("error checking room ID in store: %v", err)
166
+ return "", errors.New("error checking room ID")
167
+ }
168
+
169
+ // Got a unique ID.
170
+ if !exists {
171
+ return id, nil
172
+ }
173
+ }
174
+ return "", errors.New("unable to generate unique room ID")
175
+ }
176
+
177
+ // GenerateGUID generates a cryptographically random, alphanumeric string of length n.
178
+ func GenerateGUID(n int) (string, error) {
179
+ const dictionary = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"
180
+ var bytes = make([]byte, n)
181
+ if _, err := rand.Read(bytes); err != nil {
182
+ return "", err
183
+ }
184
+ for k, v := range bytes {
185
+ bytes[k] = dictionary[v%byte(len(dictionary))]
186
+ }
187
+ return string(bytes), nil
188
+ }
internal/hub/peer.go ADDED
@@ -0,0 +1,145 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ package hub
2
+
3
+ import (
4
+ "encoding/json"
5
+ "time"
6
+
7
+ "github.com/gorilla/websocket"
8
+ )
9
+
10
+ // Peer represents an individual peer / connection into a room.
11
+ type Peer struct {
12
+ // Peer's chat handle.
13
+ ID string
14
+ Handle string
15
+
16
+ ws *websocket.Conn
17
+
18
+ // Channel for outbound messages.
19
+ dataQ chan []byte
20
+
21
+ // Peer's room.
22
+ room *Room
23
+
24
+ // Rate limiting.
25
+ numMessages int
26
+ lastMessage time.Time
27
+ }
28
+
29
+ type peerInfo struct {
30
+ ID string `json:"id"`
31
+ Handle string `json:"handle"`
32
+ }
33
+
34
+ // newPeer returns a new instance of Peer.
35
+ func newPeer(id, handle string, ws *websocket.Conn, room *Room) *Peer {
36
+ return &Peer{
37
+ ID: id,
38
+ Handle: handle,
39
+ ws: ws,
40
+ dataQ: make(chan []byte, 100),
41
+ room: room,
42
+ }
43
+ }
44
+
45
+ // RunListener is a blocking function that reads incoming messages from a peer's
46
+ // WS connection until its dropped or there's an error. This should be invoked
47
+ // as a goroutine.
48
+ func (p *Peer) RunListener() {
49
+ p.ws.SetReadLimit(int64(p.room.hub.cfg.MaxMessageLen))
50
+ for {
51
+ _, m, err := p.ws.ReadMessage()
52
+ if err != nil {
53
+ break
54
+ }
55
+ p.processMessage(m)
56
+ }
57
+
58
+ // WS connection is closed.
59
+ p.ws.Close()
60
+ p.room.queuePeerReq(TypePeerLeave, p)
61
+ }
62
+
63
+ // RunWriter is a blocking function that writes messages in a peer's queue to the
64
+ // peer's WS connection. This should be invoked as a goroutine.
65
+ func (p *Peer) RunWriter() {
66
+ defer p.ws.Close()
67
+ for {
68
+ select {
69
+ // Wait for outgoing message to appear in the channel.
70
+ case message, ok := <-p.dataQ:
71
+ if !ok {
72
+ p.writeWSData(websocket.CloseMessage, []byte{})
73
+ return
74
+ }
75
+ if err := p.writeWSData(websocket.TextMessage, message); err != nil {
76
+ return
77
+ }
78
+ }
79
+ }
80
+ }
81
+
82
+ // SendData queues a message to be written to the peer's WS.
83
+ func (p *Peer) SendData(b []byte) {
84
+ p.dataQ <- b
85
+ }
86
+
87
+ // writeWSData writes the given payload to the peer's WS connection.
88
+ func (p *Peer) writeWSData(msgType int, payload []byte) error {
89
+ p.ws.SetWriteDeadline(time.Now().Add(p.room.hub.cfg.WSTimeout))
90
+ return p.ws.WriteMessage(msgType, payload)
91
+ }
92
+
93
+ // writeWSControl writes the given control payload to the peer's WS connection.
94
+ func (p *Peer) writeWSControl(control int, payload []byte) error {
95
+ return p.ws.WriteControl(websocket.CloseMessage, payload, time.Time{})
96
+ }
97
+
98
+ // processMessage processes incoming messages from peers.
99
+ func (p *Peer) processMessage(b []byte) {
100
+ var m payloadMsgWrap
101
+
102
+ if err := json.Unmarshal(b, &m); err != nil {
103
+ // TODO: Respond
104
+ return
105
+ }
106
+
107
+ switch m.Type {
108
+ // Message to the room.
109
+ case TypeMessage:
110
+ // Check rate limits and update counters.
111
+ now := time.Now()
112
+ if p.numMessages > 0 {
113
+ if (p.numMessages%p.room.hub.cfg.RateLimitMessages+1) >= p.room.hub.cfg.RateLimitMessages &&
114
+ time.Since(p.lastMessage) < p.room.hub.cfg.RateLimitInterval {
115
+ p.room.hub.Store.RemoveSession(p.ID, p.room.ID)
116
+ p.writeWSControl(websocket.CloseMessage,
117
+ websocket.FormatCloseMessage(websocket.CloseNormalClosure, TypePeerRateLimited))
118
+ p.ws.Close()
119
+ return
120
+ }
121
+ }
122
+ p.lastMessage = now
123
+ p.numMessages++
124
+
125
+ msg, ok := m.Data.(string)
126
+ if !ok {
127
+ // TODO: Respond
128
+ return
129
+ }
130
+ p.room.Broadcast(p.room.makeMessagePayload(msg, p), true)
131
+
132
+ // "Typing" status.
133
+ case TypeTyping:
134
+ p.room.Broadcast(p.room.makePeerUpdatePayload(p, TypeTyping), false)
135
+
136
+ // Request for peers list
137
+ case TypePeerList:
138
+ p.room.sendPeerList(p)
139
+
140
+ // Dipose of a room.
141
+ case TypeRoomDispose:
142
+ p.room.Dispose()
143
+ default:
144
+ }
145
+ }
internal/hub/room.go ADDED
@@ -0,0 +1,279 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ package hub
2
+
3
+ import (
4
+ "encoding/json"
5
+ "sync"
6
+ "time"
7
+
8
+ "github.com/gorilla/websocket"
9
+ )
10
+
11
+ type payloadMsgWrap struct {
12
+ Type string `json:"type"`
13
+ Timestamp time.Time `json:"timestamp"`
14
+ Data interface{} `json:"data"`
15
+ }
16
+
17
+ type payloadMsgPeer struct {
18
+ ID string `json:"id"`
19
+ Handle string `json:"handle"`
20
+ }
21
+
22
+ type payloadMsgChat struct {
23
+ PeerID string `json:"peer_id"`
24
+ PeerHandle string `json:"peer_handle"`
25
+ Msg string `json:"message"`
26
+ }
27
+
28
+ // peerReq represents a peer request (join, leave etc.) that's processed
29
+ // by a Room.
30
+ type peerReq struct {
31
+ reqType string
32
+ peer *Peer
33
+ }
34
+
35
+ // Room represents a chat room.
36
+ type Room struct {
37
+ ID string
38
+ Name string
39
+ Password []byte
40
+ hub *Hub
41
+ mut *sync.RWMutex
42
+
43
+ lastActivity time.Time
44
+
45
+ // List of connected peers.
46
+ peers map[*Peer]bool
47
+
48
+ // Broadcast channel for messages.
49
+ broadcastQ chan []byte
50
+
51
+ // Peer related requests.
52
+ peerQ chan peerReq
53
+
54
+ // Dispose signal.
55
+ disposeSig chan bool
56
+ closed bool
57
+
58
+ // Message / payload cache.
59
+ payloadCache [][]byte
60
+
61
+ timestamp time.Time
62
+ }
63
+
64
+ // NewRoom returns a new instance of Room.
65
+ func NewRoom(id, name string, password []byte, h *Hub) *Room {
66
+ return &Room{
67
+ ID: id,
68
+ Name: name,
69
+ Password: password,
70
+ hub: h,
71
+ peers: make(map[*Peer]bool, 100),
72
+ broadcastQ: make(chan []byte, 100),
73
+ peerQ: make(chan peerReq, 100),
74
+ disposeSig: make(chan bool),
75
+ payloadCache: make([][]byte, 0, h.cfg.MaxCachedMessages),
76
+ }
77
+ }
78
+
79
+ // AddPeer adds a new peer to the room given a WS connection from an HTTP
80
+ // handler.
81
+ func (r *Room) AddPeer(id, handle string, ws *websocket.Conn) {
82
+ r.queuePeerReq(TypePeerJoin, newPeer(id, handle, ws, r))
83
+ }
84
+
85
+ // Dispose signals the room to notify all connected peer messages, and dispose
86
+ // of itself.
87
+ func (r *Room) Dispose() {
88
+ r.disposeSig <- true
89
+ }
90
+
91
+ // Broadcast broadcasts a message to all connected peers.
92
+ func (r *Room) Broadcast(data []byte, record bool) {
93
+ r.broadcastQ <- data
94
+ if record {
95
+ r.recordMsgPayload(data)
96
+ }
97
+ }
98
+
99
+ // run is a blocking function that starts the main event loop for a room that
100
+ // handles peer connection events and message broadcasts. This should be invoked
101
+ // as a goroutine.
102
+ func (r *Room) run() {
103
+ loop:
104
+ for {
105
+ select {
106
+ // Dispose request.
107
+ case <-r.disposeSig:
108
+ r.hub.Store.ClearSessions(r.ID)
109
+ break loop
110
+
111
+ // Incoming peer request.
112
+ case req, ok := <-r.peerQ:
113
+ if !ok {
114
+ break loop
115
+ }
116
+
117
+ switch req.reqType {
118
+ // A new peer has joined.
119
+ case TypePeerJoin:
120
+ // Room's capacity is exchausted. Kick the peer out.
121
+ if len(r.peers) >= r.hub.cfg.MaxPeersPerRoom {
122
+ r.hub.Store.RemoveSession(req.peer.ID, r.ID)
123
+ req.peer.writeWSControl(websocket.CloseMessage,
124
+ websocket.FormatCloseMessage(websocket.CloseNormalClosure, TypeRoomFull))
125
+ req.peer.ws.Close()
126
+ continue
127
+ }
128
+
129
+ r.peers[req.peer] = true
130
+ go req.peer.RunListener()
131
+ go req.peer.RunWriter()
132
+
133
+ // Send the peer its info.
134
+ req.peer.SendData(r.makePeerUpdatePayload(req.peer, TypePeerInfo))
135
+
136
+ // Send the peer last N message.
137
+ if r.hub.cfg.MaxCachedMessages > 0 {
138
+ for _, b := range r.payloadCache {
139
+ req.peer.SendData(b)
140
+ }
141
+ }
142
+
143
+ // Notify all peers of the new addition.
144
+ r.Broadcast(r.makePeerUpdatePayload(req.peer, TypePeerJoin), true)
145
+ r.hub.log.Printf("%s@%s joined %s", req.peer.Handle, req.peer.ID, r.ID)
146
+
147
+ // A peer has left.
148
+ case TypePeerLeave:
149
+ r.removePeer(req.peer)
150
+ r.Broadcast(r.makePeerUpdatePayload(req.peer, TypePeerLeave), true)
151
+ r.hub.log.Printf("%s@%s left %s", req.peer.Handle, req.peer.ID, r.ID)
152
+
153
+ // A peer has requested the room's peer list.
154
+ case TypePeerList:
155
+ req.peer.SendData(r.makePeerListPayload())
156
+ }
157
+
158
+ // Fanout broadcast to all peers.
159
+ case m, ok := <-r.broadcastQ:
160
+ if !ok {
161
+ break loop
162
+ }
163
+ for p := range r.peers {
164
+ p.SendData(m)
165
+ }
166
+
167
+ // Extend the room's expiry (once every 30 seconds).
168
+ if time.Since(r.timestamp) > time.Duration(30)*time.Second {
169
+ r.timestamp = time.Now()
170
+ r.extendTTL()
171
+ }
172
+
173
+ // Kill the room after the inactivity period.
174
+ case <-time.After(r.hub.cfg.RoomAge):
175
+ break loop
176
+ }
177
+ }
178
+
179
+ r.hub.log.Printf("stopped room: %v", r.ID)
180
+ r.remove()
181
+ }
182
+
183
+ // extendTTL extends a room's TTL in the store.
184
+ func (r *Room) extendTTL() {
185
+ r.hub.Store.ExtendRoomTTL(r.ID, r.hub.cfg.RoomAge)
186
+ }
187
+
188
+ // remove disposes a room by notifying and disconnecting all peers and
189
+ // removing the room from the store.
190
+ func (r *Room) remove() {
191
+ r.closed = true
192
+
193
+ // Close all peer WS connections.
194
+ for peer := range r.peers {
195
+ peer.writeWSControl(websocket.CloseMessage,
196
+ websocket.FormatCloseMessage(websocket.CloseNormalClosure, TypeRoomDispose))
197
+ delete(r.peers, peer)
198
+ }
199
+
200
+ // Close all room channels.
201
+ close(r.broadcastQ)
202
+ close(r.peerQ)
203
+ r.hub.removeRoom(r.ID)
204
+ }
205
+
206
+ // recordMsgPayload records message payloads (events) sent out. It maintains last
207
+ // N messages to be sent to new users when they join.
208
+ func (r *Room) recordMsgPayload(b []byte) {
209
+ if r.hub.cfg.MaxCachedMessages == 0 {
210
+ return
211
+ }
212
+
213
+ n := len(r.payloadCache)
214
+ if n >= r.hub.cfg.MaxCachedMessages {
215
+ r.payloadCache = r.payloadCache[1:]
216
+ }
217
+
218
+ r.payloadCache = append(r.payloadCache, b)
219
+ }
220
+
221
+ // queuePeerReq queues a peer addition / removal request to the room.
222
+ func (r *Room) queuePeerReq(reqType string, p *Peer) {
223
+ if r.closed {
224
+ return
225
+ }
226
+ p.room.peerQ <- peerReq{reqType: reqType, peer: p}
227
+ }
228
+
229
+ // removePeer removes a peer from the room and broadcasts a message to the
230
+ // room notifying all peers of the action.
231
+ func (r *Room) removePeer(p *Peer) {
232
+ close(p.dataQ)
233
+ delete(r.peers, p)
234
+ }
235
+
236
+ // sendPeerList sends the peer list to the given peer.
237
+ func (r *Room) sendPeerList(p *Peer) {
238
+ r.peerQ <- peerReq{reqType: TypePeerList, peer: p}
239
+ }
240
+
241
+ // makePeerListPayload prepares a message payload with the list of peers.
242
+ func (r *Room) makePeerListPayload() []byte {
243
+ peers := make([]payloadMsgPeer, 0, len(r.peers))
244
+ for p := range r.peers {
245
+ peers = append(peers, payloadMsgPeer{ID: p.ID, Handle: p.Handle})
246
+ }
247
+ return r.makePayload(peers, TypePeerList)
248
+ }
249
+
250
+ // makePeerUpdatePayload prepares a message payload representing a peer
251
+ // join / leave event.
252
+ func (r *Room) makePeerUpdatePayload(p *Peer, peerUpdateType string) []byte {
253
+ d := payloadMsgPeer{
254
+ ID: p.ID,
255
+ Handle: p.Handle,
256
+ }
257
+ return r.makePayload(d, peerUpdateType)
258
+ }
259
+
260
+ // makeMessagePayload prepares a chat message.
261
+ func (r *Room) makeMessagePayload(msg string, p *Peer) []byte {
262
+ d := payloadMsgChat{
263
+ PeerID: p.ID,
264
+ PeerHandle: p.Handle,
265
+ Msg: msg,
266
+ }
267
+ return r.makePayload(d, TypeMessage)
268
+ }
269
+
270
+ // makePayload prepares a message payload.
271
+ func (r *Room) makePayload(data interface{}, typ string) []byte {
272
+ m := payloadMsgWrap{
273
+ Timestamp: time.Now(),
274
+ Type: typ,
275
+ Data: data,
276
+ }
277
+ b, _ := json.Marshal(m)
278
+ return b
279
+ }
main.go ADDED
@@ -0,0 +1,305 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ // Niltalk, April 2015
2
+ // License AGPL3
3
+
4
+ package main
5
+
6
+ import (
7
+ "errors"
8
+ "fmt"
9
+ "html/template"
10
+ "io/ioutil"
11
+ "log"
12
+ "net/http"
13
+ "os"
14
+ "os/signal"
15
+ "path/filepath"
16
+ "strings"
17
+ "syscall"
18
+ "time"
19
+
20
+ "github.com/go-chi/chi"
21
+ "github.com/knadh/koanf"
22
+ "github.com/knadh/koanf/parsers/toml"
23
+ "github.com/knadh/koanf/providers/env"
24
+ "github.com/knadh/koanf/providers/file"
25
+ "github.com/knadh/koanf/providers/posflag"
26
+ "github.com/knadh/niltalk/internal/hub"
27
+ "github.com/knadh/niltalk/store"
28
+ "github.com/knadh/niltalk/store/fs"
29
+ "github.com/knadh/niltalk/store/mem"
30
+ "github.com/knadh/niltalk/store/redis"
31
+ "github.com/knadh/stuffbin"
32
+ flag "github.com/spf13/pflag"
33
+ )
34
+
35
+ var (
36
+ logger = log.New(os.Stdout, "", log.Ldate|log.Ltime|log.Lshortfile)
37
+ ko = koanf.New(".")
38
+
39
+ // Version of the build injected at build time.
40
+ buildString = "unknown"
41
+ )
42
+
43
+ // App is the global app context that's passed around.
44
+ type App struct {
45
+ hub *hub.Hub
46
+ cfg *hub.Config
47
+ tpl *template.Template
48
+ fs stuffbin.FileSystem
49
+ logger *log.Logger
50
+ }
51
+
52
+ func loadConfig() {
53
+ // Register --help handler.
54
+ f := flag.NewFlagSet("config", flag.ContinueOnError)
55
+ f.Usage = func() {
56
+ fmt.Println(f.FlagUsages())
57
+ os.Exit(0)
58
+ }
59
+ f.StringSlice("config", []string{"config.toml"},
60
+ "Path to one or more TOML config files to load in order")
61
+ f.Bool("new-config", false, "generate sample config file")
62
+ f.Bool("onion", false, "Show the onion URL")
63
+ f.String("static-dir", "", "(optional) path to directory with static files")
64
+ f.Bool("version", false, "Show build version")
65
+ f.Parse(os.Args[1:])
66
+
67
+ // Display version.
68
+ if ok, _ := f.GetBool("version"); ok {
69
+ fmt.Println(buildString)
70
+ os.Exit(0)
71
+ }
72
+
73
+ // Generate new config.
74
+ if ok, _ := f.GetBool("new-config"); ok {
75
+ if err := newConfigFile(); err != nil {
76
+ logger.Println(err)
77
+ os.Exit(1)
78
+ }
79
+ logger.Println("generated config.toml. Edit and run the app.")
80
+ os.Exit(0)
81
+ }
82
+
83
+ // Read the config files.
84
+ cFiles, _ := f.GetStringSlice("config")
85
+ for _, f := range cFiles {
86
+ logger.Printf("reading config: %s", f)
87
+ if err := ko.Load(file.Provider(f), toml.Parser()); err != nil {
88
+ if os.IsNotExist(err) {
89
+ logger.Fatal("config file not found. If there isn't one yet, run --new-config to generate one.")
90
+ }
91
+ logger.Fatalf("error loadng config from file: %v.", err)
92
+ }
93
+ }
94
+
95
+ // Merge env flags into config.
96
+ if err := ko.Load(env.Provider("NILTALK_", ".", func(s string) string {
97
+ return strings.Replace(strings.ToLower(
98
+ strings.TrimPrefix(s, "NILTALK_")), "__", ".", -1)
99
+ }), nil); err != nil {
100
+ logger.Printf("error loading env config: %v", err)
101
+ }
102
+
103
+ // Merge command line flags into config.
104
+ ko.Load(posflag.Provider(f, ".", ko), nil)
105
+ }
106
+
107
+ // initFS initializes the stuffbin embedded static filesystem.
108
+ func initFS(staticDir string) stuffbin.FileSystem {
109
+ // Get self executable path to initialise stuffed FS.
110
+ exe, err := os.Executable()
111
+ if err != nil {
112
+ log.Fatalf("error getting executable path: %v", err)
113
+ }
114
+
115
+ // Read stuffed data from self.
116
+ fs, err := stuffbin.UnStuff(exe)
117
+ if err != nil {
118
+ // Binary is unstuffed or is running in dev mode.
119
+ // Can halt here or fall back to the local filesystem.
120
+ if err == stuffbin.ErrNoID {
121
+ // First argument is to the root to mount the files in the FileSystem
122
+ // and the rest of the arguments are paths to embed.
123
+ fs, err = stuffbin.NewLocalFS("./",
124
+ "./static/templates",
125
+ "./static/static:/static",
126
+ "config.toml.sample")
127
+ if err != nil {
128
+ log.Fatalf("error falling back to local filesystem: %v", err)
129
+ }
130
+ } else {
131
+ log.Fatalf("error reading stuffed binary: %v", err)
132
+ }
133
+ }
134
+
135
+ // Optional static directory to override files.
136
+ if staticDir != "" {
137
+ logger.Printf("loading static files from: %v", staticDir)
138
+ fStatic, err := stuffbin.NewLocalFS("/",
139
+ filepath.Join(staticDir, "/templates")+":/static/templates",
140
+ filepath.Join(staticDir, "/static")+":/static",
141
+ )
142
+ if err != nil {
143
+ logger.Fatalf("failed reading static directory: %s: %v", staticDir, err)
144
+ }
145
+ if err := fs.Merge(fStatic); err != nil {
146
+ logger.Fatalf("error merging static directory: %s: %v", staticDir, err)
147
+ }
148
+ }
149
+ return fs
150
+ }
151
+
152
+ // Catch OS interrupts and respond accordingly.
153
+ // This is not fool proof as http keeps listening while
154
+ // existing rooms are shut down.
155
+ func catchInterrupts() {
156
+ c := make(chan os.Signal, 1)
157
+ signal.Notify(c, syscall.SIGINT, syscall.SIGTERM, syscall.SIGKILL)
158
+ go func() {
159
+ for sig := range c {
160
+ // Shutdown.
161
+ logger.Printf("shutting down: %v", sig)
162
+ os.Exit(0)
163
+ }
164
+ }()
165
+ }
166
+
167
+ func newConfigFile() error {
168
+ if _, err := os.Stat("config.toml"); !os.IsNotExist(err) {
169
+ return errors.New("config.toml exists. Remove it to generate a new one")
170
+ }
171
+
172
+ // Initialize the static file system into which all
173
+ // required static assets (.sql, .js files etc.) are loaded.
174
+ fs := initFS("")
175
+ b, err := fs.Read("config.toml.sample")
176
+ if err != nil {
177
+ return fmt.Errorf("error reading sample config (is binary stuffed?): %v", err)
178
+ }
179
+
180
+ return ioutil.WriteFile("config.toml", b, 0644)
181
+ }
182
+
183
+ func main() {
184
+ // Load configuration from files.
185
+ loadConfig()
186
+
187
+ // Initialize global app context.
188
+ app := &App{
189
+ logger: logger,
190
+ fs: initFS(ko.String("static-dir")),
191
+ }
192
+ if err := ko.Unmarshal("app", &app.cfg); err != nil {
193
+ logger.Fatalf("error unmarshalling 'app' config: %v", err)
194
+ }
195
+
196
+ minTime := time.Duration(3) * time.Second
197
+ if app.cfg.RoomAge < minTime || app.cfg.WSTimeout < minTime {
198
+ logger.Fatal("app.websocket_timeout and app.roomage should be > 3s")
199
+ }
200
+
201
+ // Initialize store.
202
+ var store store.Store
203
+ if app.cfg.Storage == "redis" {
204
+ var storeCfg redis.Config
205
+ if err := ko.Unmarshal("store", &storeCfg); err != nil {
206
+ logger.Fatalf("error unmarshalling 'store' config: %v", err)
207
+ }
208
+
209
+ s, err := redis.New(storeCfg)
210
+ if err != nil {
211
+ log.Fatalf("error initializing store: %v", err)
212
+ }
213
+ store = s
214
+
215
+ } else if app.cfg.Storage == "memory" {
216
+ var storeCfg mem.Config
217
+ if err := ko.Unmarshal("store", &storeCfg); err != nil {
218
+ logger.Fatalf("error unmarshalling 'store' config: %v", err)
219
+ }
220
+
221
+ s, err := mem.New(storeCfg)
222
+ if err != nil {
223
+ log.Fatalf("error initializing store: %v", err)
224
+ }
225
+ store = s
226
+
227
+ } else if app.cfg.Storage == "fs" {
228
+ var storeCfg fs.Config
229
+ if err := ko.Unmarshal("store", &storeCfg); err != nil {
230
+ logger.Fatalf("error unmarshalling 'store' config: %v", err)
231
+ }
232
+
233
+ s, err := fs.New(storeCfg, logger)
234
+ if err != nil {
235
+ log.Fatalf("error initializing store: %v", err)
236
+ }
237
+ store = s
238
+
239
+ } else {
240
+ logger.Fatal("app.storage must be one of redis|memory|fs")
241
+ }
242
+
243
+ if ko.Bool("onion") {
244
+ pk, err := getOrCreatePK(store)
245
+ if err != nil {
246
+ logger.Fatal(err)
247
+ }
248
+ fmt.Printf("http://%v.onion\n", onionAddr(pk))
249
+ os.Exit(0)
250
+ }
251
+
252
+ app.hub = hub.NewHub(app.cfg, store, logger)
253
+
254
+ // Compile static templates.
255
+ tpl, err := stuffbin.ParseTemplatesGlob(nil, app.fs, "/static/templates/*.html")
256
+ if err != nil {
257
+ logger.Fatalf("error compiling templates: %v", err)
258
+ }
259
+ app.tpl = tpl
260
+
261
+ // Register HTTP routes.
262
+ r := chi.NewRouter()
263
+ r.Get("/", wrap(handleIndex, app, 0))
264
+ r.Get("/ws/{roomID}", wrap(handleWS, app, hasAuth|hasRoom))
265
+
266
+ // API.
267
+ r.Post("/api/rooms/{roomID}/login", wrap(handleLogin, app, hasRoom))
268
+ r.Delete("/api/rooms/{roomID}/login", wrap(handleLogout, app, hasAuth|hasRoom))
269
+ r.Post("/api/rooms", wrap(handleCreateRoom, app, 0))
270
+
271
+ // Views.
272
+ r.Get("/r/{roomID}", wrap(handleRoomPage, app, hasAuth|hasRoom))
273
+ r.Get("/static/*", func(w http.ResponseWriter, r *http.Request) {
274
+ app.fs.FileServer().ServeHTTP(w, r)
275
+ })
276
+
277
+ // Start the app.
278
+ var srv interface {
279
+ ListenAndServe() error
280
+ }
281
+
282
+ if appAddress := ko.String("app.address"); appAddress == "tor" {
283
+ pk, err := getOrCreatePK(store)
284
+ if err != nil {
285
+ logger.Fatalf("could not create the private key file: %v", err)
286
+ }
287
+
288
+ srv = &torServer{
289
+ PrivateKey: pk,
290
+ Handler: r,
291
+ }
292
+ logger.Printf("starting server on http://%v.onion", onionAddr(pk))
293
+
294
+ } else {
295
+ srv = &http.Server{
296
+ Addr: appAddress,
297
+ Handler: r,
298
+ }
299
+ logger.Printf("starting server on http://%v", appAddress)
300
+ }
301
+
302
+ if err := srv.ListenAndServe(); err != nil {
303
+ logger.Fatalf("couldn't start server: %v", err)
304
+ }
305
+ }
static/static/app.js ADDED
@@ -0,0 +1,448 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ const linkifyExpr = /(\b(https?|ftp|file):\/\/[-A-Z0-9+&@#\/%?=~_|!:,.;]*[-A-Z0-9+&@#\/%=~_|])/ig;
2
+ const notifType = {
3
+ notice: "notice",
4
+ error: "error"
5
+ };
6
+ const typingDebounceInterval = 3000;
7
+
8
+ Vue.component("expand-link", {
9
+ props: ["link"],
10
+ data: function () {
11
+ return {
12
+ visible: false
13
+ }
14
+ },
15
+ methods: {
16
+ select(e) {
17
+ e.target.select();
18
+ }
19
+ },
20
+ template: `
21
+ <div class="expand-link">
22
+ <a href="#" v-on:click.prevent="visible = !visible">🔗</a>
23
+ <input v-if="visible" v-on:click="select" readonly type="text" :value="link" />
24
+ </div>
25
+ `
26
+ });
27
+
28
+ var app = new Vue({
29
+ el: "#app",
30
+ delimiters: ["{(", ")}"],
31
+ data: {
32
+ isBusy: false,
33
+ chatOn: false,
34
+ sidebarOn: true,
35
+ disposed: false,
36
+ hasSound: true,
37
+
38
+ // Global flash / notifcation properties.
39
+ notifTimer: null,
40
+ notifMessage: "",
41
+ notifType: "",
42
+
43
+ // New activity animation in title bar. Page title is cached on load
44
+ // to use in the animation.
45
+ newActivity: false,
46
+ newActivityCounter: 0,
47
+ pageTitle: document.title,
48
+
49
+ typingTimer: null,
50
+ typingPeers: new Map(),
51
+
52
+ // Form fields.
53
+ roomName: "",
54
+ handle: "",
55
+ password: "",
56
+ message: "",
57
+
58
+ // Chat data.
59
+ self: {},
60
+ messages: [],
61
+ peers: []
62
+ },
63
+ created: function () {
64
+ this.initClient();
65
+ this.initTimers();
66
+
67
+ if (window.hasOwnProperty("_room") && _room.auth) {
68
+ this.toggleChat();
69
+ Client.init(_room.id);
70
+ Client.connect();
71
+ }
72
+ },
73
+ computed: {
74
+ Client() {
75
+ return window.Client;
76
+ }
77
+ },
78
+ methods: {
79
+ // Handle room creation.
80
+ handleCreateRoom() {
81
+ fetch("/api/rooms", {
82
+ method: "post",
83
+ body: JSON.stringify({
84
+ name: this.roomName,
85
+ password: this.password
86
+ }),
87
+ headers: { "Content-Type": "application/json; charset=utf-8" }
88
+ })
89
+ .then(resp => resp.json())
90
+ .then(resp => {
91
+ this.toggleBusy();
92
+ if (resp.error) {
93
+ this.notify(resp.error, notifType.error);
94
+ } else {
95
+ document.location.replace("/r/" + resp.data.id);
96
+ }
97
+ })
98
+ .catch(err => {
99
+ this.toggleBusy();
100
+ this.notify(err, notifType.error);
101
+ });
102
+ },
103
+
104
+ // Login to a room.
105
+ handleLogin() {
106
+ const handle = this.handle.replace(/[^a-z0-9_\-\.@]/ig, "");
107
+
108
+ this.notify("Logging in", notifType.notice);
109
+ fetch("/api/rooms/" + _room.id + "/login", {
110
+ method: "post",
111
+ body: JSON.stringify({ handle: handle, password: this.password }),
112
+ headers: { "Content-Type": "application/json; charset=utf-8" }
113
+ })
114
+ .then(resp => resp.json())
115
+ .then(resp => {
116
+ this.toggleBusy();
117
+ if (resp.error) {
118
+ this.notify(resp.error, notifType.error);
119
+ // pwdField.focus();
120
+ return;
121
+ }
122
+
123
+ this.clear();
124
+ this.deNotify();
125
+ this.toggleChat();
126
+ Client.init(_room.id);
127
+ Client.connect();
128
+ })
129
+ .catch(err => {
130
+ this.toggleBusy();
131
+ this.notify(err, notifType.error);
132
+ });
133
+ },
134
+
135
+ // Capture keypresses to send message on Enter key and to broadcast
136
+ // "typing" statuses.
137
+ handleChatKeyPress(e) {
138
+ if (e.keyCode == 13 && !e.shiftKey) {
139
+ e.preventDefault();
140
+ this.handleSendMessage();
141
+ return;
142
+ }
143
+
144
+ // If it's a non "text" key, ignore.
145
+ if (!String.fromCharCode(e.keyCode).match(/(\w|\s)/g)) {
146
+ return;
147
+ }
148
+
149
+ // Debounce and wait for N seconds before sending a typing status.
150
+ if (this.typingTimer) {
151
+ return;
152
+ }
153
+
154
+ // Send the 'typing' status.
155
+ Client.sendMessage(Client.MsgType["typing"]);
156
+
157
+ this.typingTimer = window.setTimeout(() => {
158
+ this.typingTimer = null;
159
+ }, typingDebounceInterval);
160
+ },
161
+
162
+ handleSendMessage() {
163
+ Client.sendMessage(Client.MsgType["message"], this.message);
164
+ this.message = "";
165
+ window.clearTimeout(this.typingTimer);
166
+ this.typingTimer = null;
167
+ },
168
+
169
+ handleLogout() {
170
+ if (!confirm("Logout?")) {
171
+ return;
172
+ }
173
+ fetch("/api/rooms/" + _room.id + "/login", {
174
+ method: "delete",
175
+ headers: { "Content-Type": "application/json; charset=utf-8" }
176
+ })
177
+ .then(resp => resp.json())
178
+ .then(resp => {
179
+ this.toggleChat();
180
+ document.location.reload();
181
+ })
182
+ .catch(err => {
183
+ this.notify(err, notifType.error);
184
+ });
185
+ },
186
+
187
+ handleDisposeRoom() {
188
+ if (!confirm("Disconnect all peers and destroy this room?")) {
189
+ return;
190
+ }
191
+ Client.sendMessage(Client.MsgType["room.dispose"]);
192
+ },
193
+
194
+ // Flash notification.
195
+ notify(msg, typ, timeout) {
196
+ clearTimeout(this.notifTimer);
197
+ this.notifTimer = setTimeout(function () {
198
+ this.notifMessage = "";
199
+ this.notifType = "";
200
+ }.bind(this), timeout ? timeout : 3000);
201
+
202
+ this.notifMessage = msg;
203
+ if (typ) {
204
+ this.notifType = typ;
205
+ }
206
+ },
207
+
208
+ beep() {
209
+ const b = document.querySelector("#beep");
210
+ b.pause();
211
+ b.load();
212
+ b.play();
213
+ },
214
+
215
+ deNotify() {
216
+ clearTimeout(this.notifTimer);
217
+ this.notifMessage = "";
218
+ this.notifType = "";
219
+ },
220
+
221
+ hashColor(str) {
222
+ for (var i = 0, hash = 0; i < str.length; hash = str.charCodeAt(i++) + ((hash << 5) - hash));
223
+ for (var i = 0, colour = "#"; i < 3; colour += ("00" + ((hash >> i++ * 8) & 0xFF).toString(16)).slice(-2));
224
+ return colour;
225
+ },
226
+
227
+ formatDate(ts) {
228
+ var t = new Date(ts),
229
+ h = t.getHours(),
230
+ minutes = t.getMinutes(),
231
+ hours = ((h + 11) % 12 + 1);
232
+ return (hours < 10 ? "0" : "")
233
+ + hours.toString()
234
+ + ":"
235
+ + (minutes < 10 ? "0" : "")
236
+ + minutes.toString()
237
+ + " " + (h > 12 ? "PM" : "AM");
238
+ },
239
+
240
+ formatMessage(text) {
241
+ const div = document.createElement("div");
242
+ div.appendChild(document.createTextNode(text));
243
+ return div.innerHTML.replace(/\n+/ig, "<br />")
244
+ .replace(linkifyExpr, "<a refl='noopener noreferrer' href='$1' target='_blank'>$1</a>");
245
+ },
246
+
247
+ scrollToNewester() {
248
+ this.$nextTick().then(function () {
249
+ this.$refs["messages"].querySelector(".message:last-child").scrollIntoView();
250
+ }.bind(this));
251
+ },
252
+
253
+ // Toggle busy (form button) state.
254
+ toggleBusy() {
255
+ this.isRequesting = !this.isRequesting;
256
+ },
257
+
258
+ toggleSidebar() {
259
+ this.sidebarOn = !this.sidebarOn;
260
+ },
261
+
262
+ toggleChat() {
263
+ this.chatOn = !this.chatOn;
264
+
265
+ this.$nextTick().then(function () {
266
+ if (!this.chatOn && this.$refs["form-password"]) {
267
+ this.$refs["form-password"].focus();
268
+ return
269
+ }
270
+ if (this.$refs["form-message"]) {
271
+ this.$refs["form-message"].focus();
272
+ }
273
+ }.bind(this));
274
+ },
275
+
276
+ // Clear all states.
277
+ clear() {
278
+ this.handle = "";
279
+ this.password = "";
280
+ this.password = "";
281
+ this.message = "";
282
+ this.self = {};
283
+ this.messages = [];
284
+ this.peers = [];
285
+ },
286
+
287
+ // WebSocket client event handlers.
288
+ onConnect() {
289
+ Client.getPeers();
290
+ },
291
+
292
+ onDisconnect(typ) {
293
+ switch (typ) {
294
+ case Client.MsgType["disconnect"]:
295
+ this.notify("Disconnected. Retrying ...", notifType.notice);
296
+ break;
297
+
298
+ case Client.MsgType["peer.ratelimited"]:
299
+ this.notify("You sent too many messages", notifType.error);
300
+ this.toggleChat();
301
+ break;
302
+
303
+ case Client.MsgType["room.full"]:
304
+ this.notify("Room is full", notifType.error);
305
+ this.toggleChat();
306
+ break;
307
+
308
+ case Client.MsgType["room.dispose"]:
309
+ this.notify("Room diposed", notifType.error);
310
+ this.toggleChat();
311
+ this.disposed = true;
312
+ break;
313
+ }
314
+ // window.location.reload();
315
+ },
316
+
317
+ onReconnecting(timeout) {
318
+ this.notify("Disconnected. Retrying ...", notifType.notice, timeout);
319
+ },
320
+
321
+ onPeerSelf(data) {
322
+ this.self = {
323
+ ...data.data,
324
+ avatar: this.hashColor(data.data.id)
325
+ };
326
+ },
327
+
328
+ onPeerJoinLeave(data, typ) {
329
+ const peer = data.data;
330
+ let peers = JSON.parse(JSON.stringify(this.peers));
331
+
332
+ // Add / remove the peer from the existing list.
333
+ if (typ === Client.MsgType["peer.join"]) {
334
+ peers.push(peer);
335
+ } else {
336
+ peers = peers.filter((e) => { return e.id !== peer.id; });
337
+ }
338
+ this.onPeers(peers);
339
+
340
+ // Notice in the message area;
341
+ peer.avatar = this.hashColor(peer.id);
342
+ this.messages.push({
343
+ type: typ,
344
+ peer: peer,
345
+ timestamp: data.timestamp
346
+ });
347
+ this.scrollToNewester();
348
+ },
349
+
350
+ onPeers(data) {
351
+ const peers = data.sort(function (a, b) {
352
+ if (a.handle < b.handle) {
353
+ return -1;
354
+ } else if (a.handle > b.handle) {
355
+ return 1;
356
+ } else {
357
+ return 0;
358
+ }
359
+ });
360
+
361
+ peers.forEach(p => {
362
+ p.avatar = this.hashColor(p.id);
363
+ });
364
+
365
+ this.peers = peers;
366
+ },
367
+
368
+ onTyping(data) {
369
+ if (data.data.id === this.self.id) {
370
+ return;
371
+ }
372
+ this.typingPeers.set(data.data.id, { ...data.data, time: Date.now() });
373
+ this.$forceUpdate();
374
+ },
375
+
376
+ onMessage(data) {
377
+ // If the window isn't in focus, start the "new activity" animation
378
+ // in the title bar.
379
+ if (!document.hasFocus()) {
380
+ this.newActivity = true;
381
+ this.beep();
382
+ }
383
+
384
+ this.typingPeers.delete(data.data.peer_id);
385
+ this.messages.push({
386
+ type: Client.MsgType["message"],
387
+ timestamp: data.timestamp,
388
+ message: data.data.message,
389
+ peer: {
390
+ id: data.data.peer_id,
391
+ handle: data.data.peer_handle,
392
+ avatar: this.hashColor(data.data.peer_id)
393
+ }
394
+ });
395
+ this.scrollToNewester();
396
+ },
397
+
398
+ // Register chat client events.
399
+ initClient() {
400
+ Client.on(Client.MsgType["connect"], this.onConnect);
401
+ Client.on(Client.MsgType["disconnect"], (data) => { this.onDisconnect(Client.MsgType["disconnect"]); });
402
+ Client.on(Client.MsgType["peer.ratelimited"], (data) => { this.onDisconnect(Client.MsgType["peer.ratelimited"]); });
403
+ Client.on(Client.MsgType["room.dispose"], (data) => { this.onDisconnect(Client.MsgType["room.dispose"]); });
404
+ Client.on(Client.MsgType["room.full"], (data) => { this.onDisconnect(Client.MsgType["room.full"]); });
405
+ Client.on(Client.MsgType["reconnecting"], this.onReconnecting);
406
+
407
+ Client.on(Client.MsgType["peer.info"], this.onPeerSelf);
408
+ Client.on(Client.MsgType["peer.list"], (data) => { this.onPeers(data.data); });
409
+ Client.on(Client.MsgType["peer.join"], (data) => { this.onPeerJoinLeave(data, Client.MsgType["peer.join"]); });
410
+ Client.on(Client.MsgType["peer.leave"], (data) => { this.onPeerJoinLeave(data, Client.MsgType["peer.leave"]); });
411
+ Client.on(Client.MsgType["message"], this.onMessage);
412
+ Client.on(Client.MsgType["typing"], this.onTyping);
413
+ },
414
+
415
+ initTimers() {
416
+ // Title bar "new activity" animation.
417
+ window.setInterval(() => {
418
+ if (!this.newActivity) {
419
+ return;
420
+ }
421
+ if (this.newActivityCounter % 2 === 0) {
422
+ document.title = "[•] " + this.pageTitle;
423
+ } else {
424
+ document.title = this.pageTitle;
425
+ }
426
+ this.newActivityCounter++;
427
+ }, 2500);
428
+ window.onfocus = () => {
429
+ this.newActivity = false;
430
+ document.title = this.pageTitle;
431
+ };
432
+
433
+ // Sweep "typing" statuses at regular intervals.
434
+ window.setInterval(() => {
435
+ let changed = false;
436
+ this.typingPeers.forEach((p) => {
437
+ if ((p.time + typingDebounceInterval) < Date.now()) {
438
+ this.typingPeers.delete(p.id);
439
+ changed = true;
440
+ }
441
+ });
442
+ if (changed) {
443
+ this.$forceUpdate();
444
+ }
445
+ }, typingDebounceInterval);
446
+ }
447
+ }
448
+ });
static/static/base.css ADDED
@@ -0,0 +1,528 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /*! normalize.css v3.0.1 | MIT License | git.io/normalize */
2
+
3
+ /**
4
+ * 1. Set default font family to sans-serif.
5
+ * 2. Prevent iOS text size adjust after orientation change, without disabling
6
+ * user zoom.
7
+ */
8
+
9
+ html {
10
+ font-family: sans-serif; /* 1 */
11
+ -ms-text-size-adjust: 100%; /* 2 */
12
+ -webkit-text-size-adjust: 100%; /* 2 */
13
+ box-sizing: border-box;
14
+ }
15
+
16
+ *, *:before, *:after {
17
+ box-sizing: inherit;
18
+ }
19
+
20
+
21
+ /**
22
+ * Remove default margin.
23
+ */
24
+
25
+ body {
26
+ margin: 0;
27
+ }
28
+
29
+ /* HTML5 display definitions
30
+ ========================================================================== */
31
+
32
+ /**
33
+ * Correct `block` display not defined for any HTML5 element in IE 8/9.
34
+ * Correct `block` display not defined for `details` or `summary` in IE 10/11 and Firefox.
35
+ * Correct `block` display not defined for `main` in IE 11.
36
+ */
37
+
38
+ article,
39
+ aside,
40
+ details,
41
+ figcaption,
42
+ figure,
43
+ footer,
44
+ header,
45
+ hgroup,
46
+ main,
47
+ nav,
48
+ section,
49
+ summary {
50
+ display: block;
51
+ }
52
+
53
+ /**
54
+ * 1. Correct `inline-block` display not defined in IE 8/9.
55
+ * 2. Normalize vertical alignment of `progress` in Chrome, Firefox, and Opera.
56
+ */
57
+
58
+ audio,
59
+ canvas,
60
+ progress,
61
+ video {
62
+ display: inline-block; /* 1 */
63
+ vertical-align: baseline; /* 2 */
64
+ }
65
+
66
+ /**
67
+ * Prevent modern browsers from displaying `audio` without controls.
68
+ * Remove excess height in iOS 5 devices.
69
+ */
70
+
71
+ audio:not([controls]) {
72
+ display: none;
73
+ height: 0;
74
+ }
75
+
76
+ /**
77
+ * Address `[hidden]` styling not present in IE 8/9/10.
78
+ * Hide the `template` element in IE 8/9/11, Safari, and Firefox < 22.
79
+ */
80
+
81
+ [hidden],
82
+ template {
83
+ display: none;
84
+ }
85
+
86
+ /* Links
87
+ ========================================================================== */
88
+
89
+ /**
90
+ * Remove the gray background color from active links in IE 10.
91
+ */
92
+
93
+ a {
94
+ background: transparent;
95
+ }
96
+
97
+ /**
98
+ * Improve readability when focused and also mouse hovered in all browsers.
99
+ */
100
+
101
+ a:active,
102
+ a:hover {
103
+ outline: 0;
104
+ }
105
+
106
+ /* Text-level semantics
107
+ ========================================================================== */
108
+
109
+ /**
110
+ * Address styling not present in IE 8/9/10/11, Safari, and Chrome.
111
+ */
112
+
113
+ abbr[title] {
114
+ border-bottom: 1px dotted;
115
+ }
116
+
117
+ /**
118
+ * Address style set to `bolder` in Firefox 4+, Safari, and Chrome.
119
+ */
120
+
121
+ b,
122
+ strong {
123
+ font-weight: bold;
124
+ }
125
+
126
+ /**
127
+ * Address styling not present in Safari and Chrome.
128
+ */
129
+
130
+ dfn {
131
+ font-style: italic;
132
+ }
133
+
134
+ /**
135
+ * Address variable `h1` font-size and margin within `section` and `article`
136
+ * contexts in Firefox 4+, Safari, and Chrome.
137
+ */
138
+
139
+ h1 {
140
+ font-size: 2em;
141
+ margin: 0.67em 0;
142
+ }
143
+
144
+ /**
145
+ * Address styling not present in IE 8/9.
146
+ */
147
+
148
+ mark {
149
+ background: #ff0;
150
+ color: #000;
151
+ }
152
+
153
+ /**
154
+ * Address inconsistent and variable font size in all browsers.
155
+ */
156
+
157
+ small {
158
+ font-size: 80%;
159
+ }
160
+
161
+ /**
162
+ * Prevent `sub` and `sup` affecting `line-height` in all browsers.
163
+ */
164
+
165
+ sub,
166
+ sup {
167
+ font-size: 75%;
168
+ line-height: 0;
169
+ position: relative;
170
+ vertical-align: baseline;
171
+ }
172
+
173
+ sup {
174
+ top: -0.5em;
175
+ }
176
+
177
+ sub {
178
+ bottom: -0.25em;
179
+ }
180
+
181
+
182
+ /* Embedded content
183
+ ========================================================================== */
184
+
185
+ /**
186
+ * Remove border when inside `a` element in IE 8/9/10.
187
+ */
188
+
189
+ img {
190
+ border: 0;
191
+ }
192
+
193
+ /**
194
+ * Correct overflow not hidden in IE 9/10/11.
195
+ */
196
+
197
+ svg:not(:root) {
198
+ overflow: hidden;
199
+ }
200
+
201
+ /* Grouping content
202
+ ========================================================================== */
203
+
204
+ /**
205
+ * Address margin not present in IE 8/9 and Safari.
206
+ */
207
+
208
+ figure {
209
+ margin: 1em 40px;
210
+ }
211
+
212
+ /**
213
+ * Address differences between Firefox and other browsers.
214
+ */
215
+
216
+ hr {
217
+ -moz-box-sizing: content-box;
218
+ box-sizing: content-box;
219
+ height: 0;
220
+ }
221
+
222
+ /**
223
+ * Contain overflow in all browsers.
224
+ */
225
+
226
+ pre {
227
+ overflow: auto;
228
+ }
229
+
230
+ /**
231
+ * Address odd `em`-unit font size rendering in all browsers.
232
+ */
233
+
234
+ code,
235
+ kbd,
236
+ pre,
237
+ samp {
238
+ font-family: monospace, monospace;
239
+ font-size: 1em;
240
+ }
241
+
242
+ /* Forms
243
+ ========================================================================== */
244
+
245
+ /**
246
+ * Known limitation: by default, Chrome and Safari on OS X allow very limited
247
+ * styling of `select`, unless a `border` property is set.
248
+ */
249
+
250
+ /**
251
+ * 1. Correct color not being inherited.
252
+ * Known issue: affects color of disabled elements.
253
+ * 2. Correct font properties not being inherited.
254
+ * 3. Address margins set differently in Firefox 4+, Safari, and Chrome.
255
+ */
256
+
257
+ button,
258
+ input,
259
+ optgroup,
260
+ select,
261
+ textarea {
262
+ color: inherit; /* 1 */
263
+ font: inherit; /* 2 */
264
+ margin: 0; /* 3 */
265
+ }
266
+
267
+ /**
268
+ * Address `overflow` set to `hidden` in IE 8/9/10/11.
269
+ */
270
+
271
+ button {
272
+ overflow: visible;
273
+ }
274
+
275
+ /**
276
+ * Address inconsistent `text-transform` inheritance for `button` and `select`.
277
+ * All other form control elements do not inherit `text-transform` values.
278
+ * Correct `button` style inheritance in Firefox, IE 8/9/10/11, and Opera.
279
+ * Correct `select` style inheritance in Firefox.
280
+ */
281
+
282
+ button,
283
+ select {
284
+ text-transform: none;
285
+ }
286
+
287
+ /**
288
+ * 1. Avoid the WebKit bug in Android 4.0.* where (2) destroys native `audio`
289
+ * and `video` controls.
290
+ * 2. Correct inability to style clickable `input` types in iOS.
291
+ * 3. Improve usability and consistency of cursor style between image-type
292
+ * `input` and others.
293
+ */
294
+
295
+ button,
296
+ html input[type="button"], /* 1 */
297
+ input[type="reset"],
298
+ input[type="submit"] {
299
+ -webkit-appearance: button; /* 2 */
300
+ cursor: pointer; /* 3 */
301
+ }
302
+
303
+ /**
304
+ * Re-set default cursor for disabled elements.
305
+ */
306
+
307
+ button[disabled],
308
+ html input[disabled] {
309
+ cursor: default;
310
+ }
311
+
312
+ /**
313
+ * Remove inner padding and border in Firefox 4+.
314
+ */
315
+
316
+ button::-moz-focus-inner,
317
+ input::-moz-focus-inner {
318
+ border: 0;
319
+ padding: 0;
320
+ }
321
+
322
+ /**
323
+ * Address Firefox 4+ setting `line-height` on `input` using `!important` in
324
+ * the UA stylesheet.
325
+ */
326
+
327
+ input {
328
+ line-height: normal;
329
+ }
330
+
331
+ /**
332
+ * It's recommended that you don't attempt to style these elements.
333
+ * Firefox's implementation doesn't respect box-sizing, padding, or width.
334
+ *
335
+ * 1. Address box sizing set to `content-box` in IE 8/9/10.
336
+ * 2. Remove excess padding in IE 8/9/10.
337
+ */
338
+
339
+ input[type="checkbox"],
340
+ input[type="radio"] {
341
+ box-sizing: border-box; /* 1 */
342
+ padding: 0; /* 2 */
343
+ }
344
+
345
+ /**
346
+ * Fix the cursor style for Chrome's increment/decrement buttons. For certain
347
+ * `font-size` values of the `input`, it causes the cursor style of the
348
+ * decrement button to change from `default` to `text`.
349
+ */
350
+
351
+ input[type="number"]::-webkit-inner-spin-button,
352
+ input[type="number"]::-webkit-outer-spin-button {
353
+ height: auto;
354
+ }
355
+
356
+ /**
357
+ * 1. Address `appearance` set to `searchfield` in Safari and Chrome.
358
+ * 2. Address `box-sizing` set to `border-box` in Safari and Chrome
359
+ * (include `-moz` to future-proof).
360
+ */
361
+
362
+ input[type="search"] {
363
+ -webkit-appearance: textfield; /* 1 */
364
+ -moz-box-sizing: content-box;
365
+ -webkit-box-sizing: content-box; /* 2 */
366
+ box-sizing: content-box;
367
+ }
368
+
369
+ /**
370
+ * Remove inner padding and search cancel button in Safari and Chrome on OS X.
371
+ * Safari (but not Chrome) clips the cancel button when the search input has
372
+ * padding (and `textfield` appearance).
373
+ */
374
+
375
+ input[type="search"]::-webkit-search-cancel-button,
376
+ input[type="search"]::-webkit-search-decoration {
377
+ -webkit-appearance: none;
378
+ }
379
+
380
+ /**
381
+ * Define consistent border, margin, and padding.
382
+ */
383
+
384
+ fieldset {
385
+ border: 0;
386
+ margin: 0;
387
+ padding: 0;
388
+ }
389
+
390
+ /**
391
+ * 1. Correct `color` not being inherited in IE 8/9/10/11.
392
+ * 2. Remove padding so people aren't caught out if they zero out fieldsets.
393
+ */
394
+
395
+ legend {
396
+ border: 0; /* 1 */
397
+ padding: 0; /* 2 */
398
+ }
399
+
400
+ /**
401
+ * Remove default vertical scrollbar in IE 8/9/10/11.
402
+ */
403
+
404
+ textarea {
405
+ overflow: auto;
406
+ }
407
+
408
+ /**
409
+ * Don't inherit the `font-weight` (applied by a rule above).
410
+ * NOTE: the default cannot safely be changed in Chrome and Safari on OS X.
411
+ */
412
+
413
+ optgroup {
414
+ font-weight: bold;
415
+ }
416
+
417
+ /* Tables
418
+ ========================================================================== */
419
+
420
+ /**
421
+ * Remove most spacing between table cells.
422
+ */
423
+
424
+ table {
425
+ border-collapse: collapse;
426
+ border-spacing: 0;
427
+ }
428
+
429
+ td,
430
+ th {
431
+ padding: 0;
432
+ }
433
+
434
+
435
+
436
+
437
+ /* _______ grid _______ */
438
+
439
+ /* grid
440
+ * Main container for all
441
+ */
442
+ .grid-1000, .grid-1200 {
443
+ margin: 0 auto;
444
+ padding: 0 0 0 1%;
445
+ }
446
+ .grid-1000.no-center,
447
+ .grid-1200.no-center {
448
+ margin: 0;
449
+ }
450
+
451
+ .grid-1200 {
452
+ max-width: 1220px;
453
+ }
454
+
455
+ .grid-1000 {
456
+ max-width: 1020px;
457
+ }
458
+
459
+ .row {
460
+ clear: both !important;
461
+ padding: 0 10px;
462
+ overflow: auto;
463
+ }
464
+ .row-gut {
465
+ padding: 0 15px;
466
+ }
467
+
468
+
469
+ /* grid
470
+ * Common columns definitions
471
+ */
472
+ .col1, .col2, .col3, .col4, .col5, .col6, .col7, .col8, .col9, .col10, .col11, .col12 {
473
+ float: left;
474
+ margin: 0 3% 0 0;
475
+ }
476
+
477
+ .col1.last, .col2.last, .col3.last, .col4.last, .col5.last, .col6.last, .col7.last, .col8.last, .col9.last, .col10.last, .col11.last, .col12 {
478
+ margin: 0;
479
+ }
480
+
481
+ .col1 { width: 5.5%; }
482
+ .col2 { width: 14%; }
483
+ .col3 { width: 22.5%; }
484
+ .col4 { width: 31%; }
485
+ .col5 { width: 39.5%; }
486
+ .col6 { width: 48%; }
487
+ .col7 { width: 56.5%; }
488
+ .col8 { width: 65%; }
489
+ .col9 { width: 73.5%; }
490
+ .col10 { width: 82%; }
491
+ .col11 { width: 90.5%; }
492
+ .col12 { width: 99%; margin: 0; }
493
+
494
+ .row img {
495
+ max-width: 100%;
496
+ height: auto;
497
+ }
498
+
499
+ /* grid
500
+ * Disable padding left/right 10px if I'm 1024 or gibber - correct percentage math
501
+ */
502
+ @media all and (min-width: 1024px) {
503
+ .grid-1000 {
504
+ max-width: 1000px;
505
+ }
506
+
507
+ .grid-1000 .row {
508
+ padding: 0;
509
+ }
510
+ }
511
+
512
+ /* grid
513
+ * Small devices
514
+ */
515
+ @media all and (max-width: 768px) {
516
+ .row {
517
+ }
518
+
519
+ .col1, .col2, .col3, .col4, .col5, .col6, .col7, .col8, .col9, .col10, .col11 {
520
+ float: none;
521
+ width: 99%;
522
+ }
523
+
524
+ .small-no-float {
525
+ float: none !important;
526
+ }
527
+ }
528
+
static/static/beep.mp3 ADDED
Binary file (11.5 kB). View file
 
static/static/beep.ogg ADDED
Binary file (9.37 kB). View file
 
static/static/client.js ADDED
@@ -0,0 +1,133 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ var Client = new function () {
2
+ const MsgType = {
3
+ "connect": "connect",
4
+ "disconnect": "disconnect",
5
+ "reconnecting": "reconnecting",
6
+ "room.dispose": "room.dispose",
7
+ "room.full": "room.full",
8
+ "message": "message",
9
+ "typing": "typing",
10
+ "peer.list": "peer.list",
11
+ "peer.info": "peer.info",
12
+ "peer.join": "peer.join",
13
+ "peer.leave": "peer.leave",
14
+ "peer.ratelimited": "peer.ratelimited",
15
+ "notice": "notice",
16
+ "handle": "handle"
17
+ };
18
+ this.MsgType = MsgType;
19
+
20
+ var wsURL = null,
21
+ pingInterval = 5, // seconds
22
+ reconnectInterval = 4000;
23
+
24
+ var ws = null,
25
+ // event hooks
26
+ triggers = {},
27
+ ping_timer = null,
28
+ reconnect_timer = null,
29
+ peer = { id: null, handle: null };
30
+
31
+
32
+ // Initialize and connect the websocket.
33
+ this.init = function (roomID) {
34
+ wsURL = document.location.protocol.replace(/http(s?):/, "ws$1:") +
35
+ document.location.host + "/ws/" + roomID;
36
+ };
37
+
38
+ // Peer identification info.
39
+ this.peer = function () {
40
+ return peer;
41
+ }
42
+
43
+ // websocket hooks
44
+ this.connect = function () {
45
+ ws = new WebSocket(wsURL);
46
+ ws.onopen = function () {
47
+ trigger(MsgType["connect"]);
48
+ };
49
+
50
+ ws.onmessage = function (e) {
51
+ var data = {};
52
+ try {
53
+ data = JSON.parse(e.data);
54
+ } catch (e) {
55
+ return null;
56
+ }
57
+ trigger(data.type, data);
58
+ };
59
+
60
+ ws.onerror = function (e) {
61
+ ws.close();
62
+ ws = null;
63
+ };
64
+
65
+ ws.onclose = function (e) {
66
+ if (e.code == 1000) {
67
+ if (e.reason && MsgType.hasOwnProperty(e.reason)) {
68
+ trigger(e.reason);
69
+ return
70
+ }
71
+ trigger(MsgType["disconnect"]);
72
+ } else if (e.code != 1005) {
73
+ trigger(MsgType["disconnect"]);
74
+ attemptReconnection();
75
+ }
76
+ };
77
+ };
78
+
79
+ // register callbacks
80
+ this.on = function (typ, callback) {
81
+ if (!triggers.hasOwnProperty(typ)) {
82
+ triggers[typ] = [];
83
+ }
84
+ triggers[typ].push(callback);
85
+ };
86
+
87
+ // fetch peers list
88
+ this.getPeers = function () {
89
+ send({ "type": MsgType["peer.list"] });
90
+ };
91
+
92
+ // send a message
93
+ this.sendMessage = function (typ, data) {
94
+ send({ "type": typ, "data": data });
95
+ }
96
+
97
+ // ___ private
98
+ // send a message via the socket
99
+ // automatically encodes json if possible
100
+ function send(message, json) {
101
+ if (!ws || ws.readyState == ws.CLOSED || ws.readyState == ws.CLOSING) return;
102
+
103
+ try {
104
+ if (typeof (message) == "object") {
105
+ message = JSON.stringify(message);
106
+ }
107
+ ws.send(message);
108
+ } catch (e) {
109
+ console.log("error: " + e);
110
+ };
111
+ }
112
+
113
+ // trigger event callbacks
114
+ function trigger(typ, data) {
115
+ if (!triggers.hasOwnProperty(typ)) {
116
+ return;
117
+ }
118
+
119
+ for (var n = 0; n < triggers[typ].length; n++) {
120
+ triggers[typ][n].call(triggers[typ][n], data);
121
+ }
122
+ }
123
+
124
+ function attemptReconnection() {
125
+ trigger(MsgType["reconnecting"], reconnectInterval);
126
+ reconnect_timer = setTimeout(function () {
127
+ reconnect_timer = null;
128
+ self.connect();
129
+ }, reconnectInterval);
130
+ }
131
+
132
+ var self = this;
133
+ };
static/static/images/chat.png ADDED
static/static/images/favicon.png ADDED
static/static/images/logo.png ADDED
static/static/images/pixel.png ADDED
static/static/images/sound.png ADDED
static/static/images/thumbnail.png ADDED
static/static/index.html ADDED
File without changes
static/static/lib.js ADDED
The diff for this file is too large to render. See raw diff
 
static/static/message.wav ADDED
Binary file (207 kB). View file
 
static/static/style.css ADDED
@@ -0,0 +1,437 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ [v-cloak] {
2
+ display: none;
3
+ }
4
+
5
+ * {
6
+ box-sizing: border-box;
7
+ }
8
+
9
+ html,
10
+ body {
11
+ margin: 0;
12
+ padding: 0;
13
+ }
14
+
15
+ body {
16
+ font-family: "Inter", "Helvetica Neue", "Segoe UI", sans-serif;
17
+ font-weight: 400;
18
+ font-size: 18px;
19
+ line-height: 30px;
20
+ color: #222;
21
+ }
22
+
23
+ /* Base styles */
24
+ h1,
25
+ h2,
26
+ h3,
27
+ h4,
28
+ h5 {
29
+ font-weight: 500;
30
+ }
31
+ h1 {
32
+ font-size: 2em;
33
+ line-height: 1.2em;
34
+ margin: 0 0 30px 0;
35
+ }
36
+ h2,
37
+ h3 {
38
+ margin: 0 0 15px 0;
39
+ }
40
+ fieldset {
41
+ margin: 0 0 15px 0;
42
+ padding: 0;
43
+ border: 0;
44
+ }
45
+ fieldset p {
46
+ margin: 15px 0 30px 0;
47
+ }
48
+ a {
49
+ text-decoration: none;
50
+ color: #f74600;
51
+ }
52
+ a:hover {
53
+ color: #222;
54
+ }
55
+
56
+ ul.no {
57
+ list-style-type: none;
58
+ margin: 0 0 15px 0;
59
+ padding: 0;
60
+ }
61
+
62
+ input,
63
+ textarea {
64
+ font-family: "Inter", "Helvetica Neue", "Segoe UI", sans-serif;
65
+ font-size: 1.5em;
66
+ color: #222;
67
+
68
+ border-radius: 3px;
69
+ border: 1px solid #ddd;
70
+ box-shadow: 2px 2px 0px #ddd;
71
+ padding: 10px 15px;
72
+ }
73
+ input:focus {
74
+ border-color: #aaa;
75
+ box-shadow: 2px 2px 0px #aaa;
76
+ }
77
+
78
+ /* Dot spinner */
79
+ .dot-spinner {
80
+ display: inline-block;
81
+ }
82
+ .dot-spinner i {
83
+ display: inline-block;
84
+ width: 6px;
85
+ height: 6px;
86
+
87
+ border-radius: 50%;
88
+ background: #777;
89
+ vertical-align: middle;
90
+ }
91
+ .dot-spinner i:first-child {
92
+ transform: translate(-5px);
93
+ animation: dot-spinner-ani2 0.5s linear infinite;
94
+ opacity: 0;
95
+ }
96
+ .dot-spinner i:nth-child(2),
97
+ .dot-spinner i:nth-child(3) {
98
+ animation: dot-spinner-ani3 0.5s linear infinite;
99
+ }
100
+ .dot-spinner i:last-child {
101
+ animation: dot-spinner-ani1 0.5s linear infinite;
102
+ }
103
+
104
+ @keyframes dot-spinner-ani1 {
105
+ 100% {
106
+ transform: translate(10px);
107
+ opacity: 0;
108
+ }
109
+ }
110
+ @keyframes dot-spinner-ani2 {
111
+ 100% {
112
+ transform: translate(5px);
113
+ opacity: 1;
114
+ }
115
+ }
116
+ @keyframes dot-spinner-ani3 {
117
+ 100% {
118
+ transform: translate(5px);
119
+ }
120
+ }
121
+
122
+ /* Helpers */
123
+ .text-center {
124
+ text-align: center;
125
+ }
126
+
127
+ button,
128
+ .button {
129
+ background: #f74600;
130
+ font-size: 1.5em;
131
+ color: #fff;
132
+
133
+ border-radius: 3px;
134
+ border: 1px solid #f74600;
135
+ padding: 10px 30px;
136
+ box-shadow: none;
137
+ cursor: pointer;
138
+ }
139
+ button:hover,
140
+ .button:hover,
141
+ button:focus,
142
+ .button:focus {
143
+ border-color: #222;
144
+ background: #222;
145
+ color: #fff;
146
+ box-shadow: none;
147
+ }
148
+ button:disabled,
149
+ .button:disabled {
150
+ cursor: wait;
151
+ background: #aaa;
152
+ }
153
+
154
+ @keyframes fadein {
155
+ from {
156
+ opacity: 0;
157
+ }
158
+ to {
159
+ opacity: 0.8;
160
+ }
161
+ }
162
+
163
+ .notification {
164
+ background: #eee;
165
+ position: fixed;
166
+ top: 0;
167
+ left: 0;
168
+ right: 0;
169
+ padding: 10px 15px;
170
+ opacity: 0.7;
171
+ animation: fadein 300ms;
172
+ z-index: 1000;
173
+
174
+ text-transform: capitalize;
175
+ text-align: center;
176
+ font-weight: bold;
177
+ }
178
+ .notification.error {
179
+ background: #f00;
180
+ color: #fff;
181
+ }
182
+ .notification.notice {
183
+ background: #fffac6;
184
+ }
185
+
186
+ form .charlimited-container {
187
+ position: relative;
188
+ }
189
+ form .charlimited {
190
+ padding-bottom: 25px;
191
+ }
192
+ form .charlimit-counter {
193
+ font-size: 0.6em;
194
+ text-align: right;
195
+ position: absolute;
196
+ padding: 1px 6px;
197
+ bottom: 5px;
198
+ right: 40px;
199
+ color: #777;
200
+ }
201
+ form .help {
202
+ display: block;
203
+ font-size: 0.75em;
204
+ color: #777;
205
+ }
206
+
207
+ /* Expand link component */
208
+ .expand-link {
209
+ display: inline-block;
210
+ }
211
+ .expand-link input {
212
+ padding: 3px;
213
+ border-width: 0 0 1px 0;
214
+ box-shadow: none;
215
+ font-size: 1em;
216
+ width: 100%;
217
+ }
218
+
219
+ /* Layout */
220
+ #app {
221
+ min-height: 400px;
222
+ }
223
+ .container {
224
+ min-width: 320px;
225
+ max-width: 900px;
226
+ margin: 0 auto;
227
+ }
228
+ .header {
229
+ margin: 30px 0 30px 0;
230
+ }
231
+ .header .logo img {
232
+ width: auto;
233
+ max-height: 28px;
234
+ }
235
+ .intro {
236
+ text-align: center;
237
+ margin-bottom: 90px;
238
+ }
239
+ .intro .splash {
240
+ margin: 60px;
241
+ }
242
+ .faq .entry {
243
+ margin-bottom: 60px;
244
+ }
245
+
246
+ .footer {
247
+ margin: 30px 0 30px 0;
248
+ font-size: 0.8em;
249
+ text-align: center;
250
+ }
251
+ .footer a {
252
+ color: #777;
253
+ margin: 0 15px;
254
+ }
255
+ .footer a:hover {
256
+ color: inherit;
257
+ }
258
+
259
+ /* Chat */
260
+ .chat {
261
+ display: flex;
262
+ flex-wrap: wrap;
263
+ justify-content: space-between;
264
+ }
265
+ .chat .messages {
266
+ width: 70%;
267
+ height: 70vh;
268
+ overflow-y: auto;
269
+ padding-right: 15px;
270
+ }
271
+ .chat .messages .message {
272
+ border-bottom: 1px solid #eee;
273
+ padding: 15px 0;
274
+ }
275
+ .chat .messages .message:hover {
276
+ background: #fafafa;
277
+ }
278
+ .chat .messages .notice {
279
+ color: #777;
280
+ text-align: center;
281
+ }
282
+ .chat .messages,
283
+ .form-chat textarea {
284
+ font-size: 0.875em;
285
+ line-height: 1.5em;
286
+ }
287
+ .chat .messages .handle {
288
+ font-size: 0.95em;
289
+ color: #777;
290
+ font-weight: 500;
291
+ }
292
+ .chat .messages .avatar {
293
+ width: 12px;
294
+ height: 12px;
295
+ }
296
+
297
+ .chat .sidebar-handle {
298
+ display: inline-block;
299
+ position: fixed;
300
+ top: 15px;
301
+ right: 15px;
302
+ z-index: 100;
303
+ display: none;
304
+ cursor: pointer;
305
+ }
306
+ .chat .sidebar-handle .icon {
307
+ display: inline-block;
308
+ background: #eee;
309
+ border-radius: 100%;
310
+ width: 32px;
311
+ text-align: center;
312
+ }
313
+
314
+ /* Peer list sidebar */
315
+ .chat .sidebar {
316
+ background: #fff;
317
+ width: 25%;
318
+ }
319
+ .chat .peers {
320
+ max-height: 95%;
321
+ overflow-y: auto;
322
+ }
323
+ .chat .meta {
324
+ display: flex;
325
+ flex-wrap: wrap;
326
+ margin-bottom: 5px;
327
+ }
328
+ .chat .meta .peer {
329
+ flex: 20%;
330
+ }
331
+ .chat .meta .timestamp {
332
+ flex: 20%;
333
+ text-align: right;
334
+ color: #777;
335
+ padding-right: 15px;
336
+ }
337
+ .peer .peer {
338
+ white-space: nowrap;
339
+ overflow: hidden;
340
+ text-overflow: ellipsis;
341
+
342
+ margin-bottom: 10px;
343
+ }
344
+ .peer .self .handle:after {
345
+ content: " *";
346
+ }
347
+ .peer .avatar {
348
+ display: inline-block;
349
+ width: 15px;
350
+ height: 15px;
351
+ border-radius: 100%;
352
+ }
353
+
354
+ .form-chat {
355
+ position: fixed;
356
+ bottom: 0;
357
+ left: 0;
358
+ right: 0;
359
+ }
360
+ .form-chat .typing {
361
+ background: #fff;
362
+ color: #777;
363
+ font-size: 0.775em;
364
+ }
365
+ .form-chat .typing .handle {
366
+ margin-left: 10px;
367
+ display: inline-block;
368
+ }
369
+ .form-chat fieldset {
370
+ position: relative;
371
+ margin: 0;
372
+ }
373
+ .form-chat textarea {
374
+ padding-bottom: 60px;
375
+ width: 100%;
376
+ }
377
+ .form-chat .controls {
378
+ position: absolute;
379
+ left: 15px;
380
+ bottom: 15px;
381
+ right: 15px;
382
+ }
383
+ .form-chat .controls .button,
384
+ .form-chat .controls button {
385
+ font-size: 1em;
386
+ padding: 5px 30px;
387
+ }
388
+ .form-chat .controls .right {
389
+ float: right;
390
+ }
391
+ .form-chat .controls .right a {
392
+ display: inline-block;
393
+ margin-left: 15px;
394
+ }
395
+
396
+ @media screen and (max-width: 990px) {
397
+ body {
398
+ padding: 0 15px;
399
+ }
400
+
401
+ .chat .messages {
402
+ width: 100%;
403
+ height: 58vh;
404
+ }
405
+ .form-chat textarea {
406
+ height: 150px;
407
+ }
408
+ .chat .sidebar {
409
+ width: 25%;
410
+ position: fixed;
411
+ top: 0;
412
+ right: 0;
413
+ height: 84vh;
414
+ width: 90%;
415
+ box-shadow: -3px 0 3px #eee;
416
+ padding: 30px;
417
+ opacity: 0.9;
418
+ }
419
+ .chat .sidebar-handle {
420
+ display: block;
421
+ }
422
+ .form-chat textarea {
423
+ border: 0;
424
+ box-shadow: none;
425
+ border-top: 1px solid #ddd;
426
+ }
427
+ }
428
+
429
+ @media screen and (max-width: 500px) {
430
+ .header {
431
+ margin: 15px 0;
432
+ }
433
+ input,
434
+ textarea {
435
+ width: 100%;
436
+ }
437
+ }
static/static/vue.min.js ADDED
@@ -0,0 +1,6 @@
 
 
 
 
 
 
 
1
+ /*!
2
+ * Vue.js v2.6.11
3
+ * (c) 2014-2019 Evan You
4
+ * Released under the MIT License.
5
+ */
6
+ !function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):(e=e||self).Vue=t()}(this,function(){"use strict";var e=Object.freeze({});function t(e){return null==e}function n(e){return null!=e}function r(e){return!0===e}function i(e){return"string"==typeof e||"number"==typeof e||"symbol"==typeof e||"boolean"==typeof e}function o(e){return null!==e&&"object"==typeof e}var a=Object.prototype.toString;function s(e){return"[object Object]"===a.call(e)}function c(e){var t=parseFloat(String(e));return t>=0&&Math.floor(t)===t&&isFinite(e)}function u(e){return n(e)&&"function"==typeof e.then&&"function"==typeof e.catch}function l(e){return null==e?"":Array.isArray(e)||s(e)&&e.toString===a?JSON.stringify(e,null,2):String(e)}function f(e){var t=parseFloat(e);return isNaN(t)?e:t}function p(e,t){for(var n=Object.create(null),r=e.split(","),i=0;i<r.length;i++)n[r[i]]=!0;return t?function(e){return n[e.toLowerCase()]}:function(e){return n[e]}}var d=p("slot,component",!0),v=p("key,ref,slot,slot-scope,is");function h(e,t){if(e.length){var n=e.indexOf(t);if(n>-1)return e.splice(n,1)}}var m=Object.prototype.hasOwnProperty;function y(e,t){return m.call(e,t)}function g(e){var t=Object.create(null);return function(n){return t[n]||(t[n]=e(n))}}var _=/-(\w)/g,b=g(function(e){return e.replace(_,function(e,t){return t?t.toUpperCase():""})}),$=g(function(e){return e.charAt(0).toUpperCase()+e.slice(1)}),w=/\B([A-Z])/g,C=g(function(e){return e.replace(w,"-$1").toLowerCase()});var x=Function.prototype.bind?function(e,t){return e.bind(t)}:function(e,t){function n(n){var r=arguments.length;return r?r>1?e.apply(t,arguments):e.call(t,n):e.call(t)}return n._length=e.length,n};function k(e,t){t=t||0;for(var n=e.length-t,r=new Array(n);n--;)r[n]=e[n+t];return r}function A(e,t){for(var n in t)e[n]=t[n];return e}function O(e){for(var t={},n=0;n<e.length;n++)e[n]&&A(t,e[n]);return t}function S(e,t,n){}var T=function(e,t,n){return!1},E=function(e){return e};function N(e,t){if(e===t)return!0;var n=o(e),r=o(t);if(!n||!r)return!n&&!r&&String(e)===String(t);try{var i=Array.isArray(e),a=Array.isArray(t);if(i&&a)return e.length===t.length&&e.every(function(e,n){return N(e,t[n])});if(e instanceof Date&&t instanceof Date)return e.getTime()===t.getTime();if(i||a)return!1;var s=Object.keys(e),c=Object.keys(t);return s.length===c.length&&s.every(function(n){return N(e[n],t[n])})}catch(e){return!1}}function j(e,t){for(var n=0;n<e.length;n++)if(N(e[n],t))return n;return-1}function D(e){var t=!1;return function(){t||(t=!0,e.apply(this,arguments))}}var L="data-server-rendered",M=["component","directive","filter"],I=["beforeCreate","created","beforeMount","mounted","beforeUpdate","updated","beforeDestroy","destroyed","activated","deactivated","errorCaptured","serverPrefetch"],F={optionMergeStrategies:Object.create(null),silent:!1,productionTip:!1,devtools:!1,performance:!1,errorHandler:null,warnHandler:null,ignoredElements:[],keyCodes:Object.create(null),isReservedTag:T,isReservedAttr:T,isUnknownElement:T,getTagNamespace:S,parsePlatformTagName:E,mustUseProp:T,async:!0,_lifecycleHooks:I},P=/a-zA-Z\u00B7\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u037D\u037F-\u1FFF\u200C-\u200D\u203F-\u2040\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD/;function R(e,t,n,r){Object.defineProperty(e,t,{value:n,enumerable:!!r,writable:!0,configurable:!0})}var H=new RegExp("[^"+P.source+".$_\\d]");var B,U="__proto__"in{},z="undefined"!=typeof window,V="undefined"!=typeof WXEnvironment&&!!WXEnvironment.platform,K=V&&WXEnvironment.platform.toLowerCase(),J=z&&window.navigator.userAgent.toLowerCase(),q=J&&/msie|trident/.test(J),W=J&&J.indexOf("msie 9.0")>0,Z=J&&J.indexOf("edge/")>0,G=(J&&J.indexOf("android"),J&&/iphone|ipad|ipod|ios/.test(J)||"ios"===K),X=(J&&/chrome\/\d+/.test(J),J&&/phantomjs/.test(J),J&&J.match(/firefox\/(\d+)/)),Y={}.watch,Q=!1;if(z)try{var ee={};Object.defineProperty(ee,"passive",{get:function(){Q=!0}}),window.addEventListener("test-passive",null,ee)}catch(e){}var te=function(){return void 0===B&&(B=!z&&!V&&"undefined"!=typeof global&&(global.process&&"server"===global.process.env.VUE_ENV)),B},ne=z&&window.__VUE_DEVTOOLS_GLOBAL_HOOK__;function re(e){return"function"==typeof e&&/native code/.test(e.toString())}var ie,oe="undefined"!=typeof Symbol&&re(Symbol)&&"undefined"!=typeof Reflect&&re(Reflect.ownKeys);ie="undefined"!=typeof Set&&re(Set)?Set:function(){function e(){this.set=Object.create(null)}return e.prototype.has=function(e){return!0===this.set[e]},e.prototype.add=function(e){this.set[e]=!0},e.prototype.clear=function(){this.set=Object.create(null)},e}();var ae=S,se=0,ce=function(){this.id=se++,this.subs=[]};ce.prototype.addSub=function(e){this.subs.push(e)},ce.prototype.removeSub=function(e){h(this.subs,e)},ce.prototype.depend=function(){ce.target&&ce.target.addDep(this)},ce.prototype.notify=function(){for(var e=this.subs.slice(),t=0,n=e.length;t<n;t++)e[t].update()},ce.target=null;var ue=[];function le(e){ue.push(e),ce.target=e}function fe(){ue.pop(),ce.target=ue[ue.length-1]}var pe=function(e,t,n,r,i,o,a,s){this.tag=e,this.data=t,this.children=n,this.text=r,this.elm=i,this.ns=void 0,this.context=o,this.fnContext=void 0,this.fnOptions=void 0,this.fnScopeId=void 0,this.key=t&&t.key,this.componentOptions=a,this.componentInstance=void 0,this.parent=void 0,this.raw=!1,this.isStatic=!1,this.isRootInsert=!0,this.isComment=!1,this.isCloned=!1,this.isOnce=!1,this.asyncFactory=s,this.asyncMeta=void 0,this.isAsyncPlaceholder=!1},de={child:{configurable:!0}};de.child.get=function(){return this.componentInstance},Object.defineProperties(pe.prototype,de);var ve=function(e){void 0===e&&(e="");var t=new pe;return t.text=e,t.isComment=!0,t};function he(e){return new pe(void 0,void 0,void 0,String(e))}function me(e){var t=new pe(e.tag,e.data,e.children&&e.children.slice(),e.text,e.elm,e.context,e.componentOptions,e.asyncFactory);return t.ns=e.ns,t.isStatic=e.isStatic,t.key=e.key,t.isComment=e.isComment,t.fnContext=e.fnContext,t.fnOptions=e.fnOptions,t.fnScopeId=e.fnScopeId,t.asyncMeta=e.asyncMeta,t.isCloned=!0,t}var ye=Array.prototype,ge=Object.create(ye);["push","pop","shift","unshift","splice","sort","reverse"].forEach(function(e){var t=ye[e];R(ge,e,function(){for(var n=[],r=arguments.length;r--;)n[r]=arguments[r];var i,o=t.apply(this,n),a=this.__ob__;switch(e){case"push":case"unshift":i=n;break;case"splice":i=n.slice(2)}return i&&a.observeArray(i),a.dep.notify(),o})});var _e=Object.getOwnPropertyNames(ge),be=!0;function $e(e){be=e}var we=function(e){var t;this.value=e,this.dep=new ce,this.vmCount=0,R(e,"__ob__",this),Array.isArray(e)?(U?(t=ge,e.__proto__=t):function(e,t,n){for(var r=0,i=n.length;r<i;r++){var o=n[r];R(e,o,t[o])}}(e,ge,_e),this.observeArray(e)):this.walk(e)};function Ce(e,t){var n;if(o(e)&&!(e instanceof pe))return y(e,"__ob__")&&e.__ob__ instanceof we?n=e.__ob__:be&&!te()&&(Array.isArray(e)||s(e))&&Object.isExtensible(e)&&!e._isVue&&(n=new we(e)),t&&n&&n.vmCount++,n}function xe(e,t,n,r,i){var o=new ce,a=Object.getOwnPropertyDescriptor(e,t);if(!a||!1!==a.configurable){var s=a&&a.get,c=a&&a.set;s&&!c||2!==arguments.length||(n=e[t]);var u=!i&&Ce(n);Object.defineProperty(e,t,{enumerable:!0,configurable:!0,get:function(){var t=s?s.call(e):n;return ce.target&&(o.depend(),u&&(u.dep.depend(),Array.isArray(t)&&function e(t){for(var n=void 0,r=0,i=t.length;r<i;r++)(n=t[r])&&n.__ob__&&n.__ob__.dep.depend(),Array.isArray(n)&&e(n)}(t))),t},set:function(t){var r=s?s.call(e):n;t===r||t!=t&&r!=r||s&&!c||(c?c.call(e,t):n=t,u=!i&&Ce(t),o.notify())}})}}function ke(e,t,n){if(Array.isArray(e)&&c(t))return e.length=Math.max(e.length,t),e.splice(t,1,n),n;if(t in e&&!(t in Object.prototype))return e[t]=n,n;var r=e.__ob__;return e._isVue||r&&r.vmCount?n:r?(xe(r.value,t,n),r.dep.notify(),n):(e[t]=n,n)}function Ae(e,t){if(Array.isArray(e)&&c(t))e.splice(t,1);else{var n=e.__ob__;e._isVue||n&&n.vmCount||y(e,t)&&(delete e[t],n&&n.dep.notify())}}we.prototype.walk=function(e){for(var t=Object.keys(e),n=0;n<t.length;n++)xe(e,t[n])},we.prototype.observeArray=function(e){for(var t=0,n=e.length;t<n;t++)Ce(e[t])};var Oe=F.optionMergeStrategies;function Se(e,t){if(!t)return e;for(var n,r,i,o=oe?Reflect.ownKeys(t):Object.keys(t),a=0;a<o.length;a++)"__ob__"!==(n=o[a])&&(r=e[n],i=t[n],y(e,n)?r!==i&&s(r)&&s(i)&&Se(r,i):ke(e,n,i));return e}function Te(e,t,n){return n?function(){var r="function"==typeof t?t.call(n,n):t,i="function"==typeof e?e.call(n,n):e;return r?Se(r,i):i}:t?e?function(){return Se("function"==typeof t?t.call(this,this):t,"function"==typeof e?e.call(this,this):e)}:t:e}function Ee(e,t){var n=t?e?e.concat(t):Array.isArray(t)?t:[t]:e;return n?function(e){for(var t=[],n=0;n<e.length;n++)-1===t.indexOf(e[n])&&t.push(e[n]);return t}(n):n}function Ne(e,t,n,r){var i=Object.create(e||null);return t?A(i,t):i}Oe.data=function(e,t,n){return n?Te(e,t,n):t&&"function"!=typeof t?e:Te(e,t)},I.forEach(function(e){Oe[e]=Ee}),M.forEach(function(e){Oe[e+"s"]=Ne}),Oe.watch=function(e,t,n,r){if(e===Y&&(e=void 0),t===Y&&(t=void 0),!t)return Object.create(e||null);if(!e)return t;var i={};for(var o in A(i,e),t){var a=i[o],s=t[o];a&&!Array.isArray(a)&&(a=[a]),i[o]=a?a.concat(s):Array.isArray(s)?s:[s]}return i},Oe.props=Oe.methods=Oe.inject=Oe.computed=function(e,t,n,r){if(!e)return t;var i=Object.create(null);return A(i,e),t&&A(i,t),i},Oe.provide=Te;var je=function(e,t){return void 0===t?e:t};function De(e,t,n){if("function"==typeof t&&(t=t.options),function(e,t){var n=e.props;if(n){var r,i,o={};if(Array.isArray(n))for(r=n.length;r--;)"string"==typeof(i=n[r])&&(o[b(i)]={type:null});else if(s(n))for(var a in n)i=n[a],o[b(a)]=s(i)?i:{type:i};e.props=o}}(t),function(e,t){var n=e.inject;if(n){var r=e.inject={};if(Array.isArray(n))for(var i=0;i<n.length;i++)r[n[i]]={from:n[i]};else if(s(n))for(var o in n){var a=n[o];r[o]=s(a)?A({from:o},a):{from:a}}}}(t),function(e){var t=e.directives;if(t)for(var n in t){var r=t[n];"function"==typeof r&&(t[n]={bind:r,update:r})}}(t),!t._base&&(t.extends&&(e=De(e,t.extends,n)),t.mixins))for(var r=0,i=t.mixins.length;r<i;r++)e=De(e,t.mixins[r],n);var o,a={};for(o in e)c(o);for(o in t)y(e,o)||c(o);function c(r){var i=Oe[r]||je;a[r]=i(e[r],t[r],n,r)}return a}function Le(e,t,n,r){if("string"==typeof n){var i=e[t];if(y(i,n))return i[n];var o=b(n);if(y(i,o))return i[o];var a=$(o);return y(i,a)?i[a]:i[n]||i[o]||i[a]}}function Me(e,t,n,r){var i=t[e],o=!y(n,e),a=n[e],s=Pe(Boolean,i.type);if(s>-1)if(o&&!y(i,"default"))a=!1;else if(""===a||a===C(e)){var c=Pe(String,i.type);(c<0||s<c)&&(a=!0)}if(void 0===a){a=function(e,t,n){if(!y(t,"default"))return;var r=t.default;if(e&&e.$options.propsData&&void 0===e.$options.propsData[n]&&void 0!==e._props[n])return e._props[n];return"function"==typeof r&&"Function"!==Ie(t.type)?r.call(e):r}(r,i,e);var u=be;$e(!0),Ce(a),$e(u)}return a}function Ie(e){var t=e&&e.toString().match(/^\s*function (\w+)/);return t?t[1]:""}function Fe(e,t){return Ie(e)===Ie(t)}function Pe(e,t){if(!Array.isArray(t))return Fe(t,e)?0:-1;for(var n=0,r=t.length;n<r;n++)if(Fe(t[n],e))return n;return-1}function Re(e,t,n){le();try{if(t)for(var r=t;r=r.$parent;){var i=r.$options.errorCaptured;if(i)for(var o=0;o<i.length;o++)try{if(!1===i[o].call(r,e,t,n))return}catch(e){Be(e,r,"errorCaptured hook")}}Be(e,t,n)}finally{fe()}}function He(e,t,n,r,i){var o;try{(o=n?e.apply(t,n):e.call(t))&&!o._isVue&&u(o)&&!o._handled&&(o.catch(function(e){return Re(e,r,i+" (Promise/async)")}),o._handled=!0)}catch(e){Re(e,r,i)}return o}function Be(e,t,n){if(F.errorHandler)try{return F.errorHandler.call(null,e,t,n)}catch(t){t!==e&&Ue(t,null,"config.errorHandler")}Ue(e,t,n)}function Ue(e,t,n){if(!z&&!V||"undefined"==typeof console)throw e;console.error(e)}var ze,Ve=!1,Ke=[],Je=!1;function qe(){Je=!1;var e=Ke.slice(0);Ke.length=0;for(var t=0;t<e.length;t++)e[t]()}if("undefined"!=typeof Promise&&re(Promise)){var We=Promise.resolve();ze=function(){We.then(qe),G&&setTimeout(S)},Ve=!0}else if(q||"undefined"==typeof MutationObserver||!re(MutationObserver)&&"[object MutationObserverConstructor]"!==MutationObserver.toString())ze="undefined"!=typeof setImmediate&&re(setImmediate)?function(){setImmediate(qe)}:function(){setTimeout(qe,0)};else{var Ze=1,Ge=new MutationObserver(qe),Xe=document.createTextNode(String(Ze));Ge.observe(Xe,{characterData:!0}),ze=function(){Ze=(Ze+1)%2,Xe.data=String(Ze)},Ve=!0}function Ye(e,t){var n;if(Ke.push(function(){if(e)try{e.call(t)}catch(e){Re(e,t,"nextTick")}else n&&n(t)}),Je||(Je=!0,ze()),!e&&"undefined"!=typeof Promise)return new Promise(function(e){n=e})}var Qe=new ie;function et(e){!function e(t,n){var r,i;var a=Array.isArray(t);if(!a&&!o(t)||Object.isFrozen(t)||t instanceof pe)return;if(t.__ob__){var s=t.__ob__.dep.id;if(n.has(s))return;n.add(s)}if(a)for(r=t.length;r--;)e(t[r],n);else for(i=Object.keys(t),r=i.length;r--;)e(t[i[r]],n)}(e,Qe),Qe.clear()}var tt=g(function(e){var t="&"===e.charAt(0),n="~"===(e=t?e.slice(1):e).charAt(0),r="!"===(e=n?e.slice(1):e).charAt(0);return{name:e=r?e.slice(1):e,once:n,capture:r,passive:t}});function nt(e,t){function n(){var e=arguments,r=n.fns;if(!Array.isArray(r))return He(r,null,arguments,t,"v-on handler");for(var i=r.slice(),o=0;o<i.length;o++)He(i[o],null,e,t,"v-on handler")}return n.fns=e,n}function rt(e,n,i,o,a,s){var c,u,l,f;for(c in e)u=e[c],l=n[c],f=tt(c),t(u)||(t(l)?(t(u.fns)&&(u=e[c]=nt(u,s)),r(f.once)&&(u=e[c]=a(f.name,u,f.capture)),i(f.name,u,f.capture,f.passive,f.params)):u!==l&&(l.fns=u,e[c]=l));for(c in n)t(e[c])&&o((f=tt(c)).name,n[c],f.capture)}function it(e,i,o){var a;e instanceof pe&&(e=e.data.hook||(e.data.hook={}));var s=e[i];function c(){o.apply(this,arguments),h(a.fns,c)}t(s)?a=nt([c]):n(s.fns)&&r(s.merged)?(a=s).fns.push(c):a=nt([s,c]),a.merged=!0,e[i]=a}function ot(e,t,r,i,o){if(n(t)){if(y(t,r))return e[r]=t[r],o||delete t[r],!0;if(y(t,i))return e[r]=t[i],o||delete t[i],!0}return!1}function at(e){return i(e)?[he(e)]:Array.isArray(e)?function e(o,a){var s=[];var c,u,l,f;for(c=0;c<o.length;c++)t(u=o[c])||"boolean"==typeof u||(l=s.length-1,f=s[l],Array.isArray(u)?u.length>0&&(st((u=e(u,(a||"")+"_"+c))[0])&&st(f)&&(s[l]=he(f.text+u[0].text),u.shift()),s.push.apply(s,u)):i(u)?st(f)?s[l]=he(f.text+u):""!==u&&s.push(he(u)):st(u)&&st(f)?s[l]=he(f.text+u.text):(r(o._isVList)&&n(u.tag)&&t(u.key)&&n(a)&&(u.key="__vlist"+a+"_"+c+"__"),s.push(u)));return s}(e):void 0}function st(e){return n(e)&&n(e.text)&&!1===e.isComment}function ct(e,t){if(e){for(var n=Object.create(null),r=oe?Reflect.ownKeys(e):Object.keys(e),i=0;i<r.length;i++){var o=r[i];if("__ob__"!==o){for(var a=e[o].from,s=t;s;){if(s._provided&&y(s._provided,a)){n[o]=s._provided[a];break}s=s.$parent}if(!s&&"default"in e[o]){var c=e[o].default;n[o]="function"==typeof c?c.call(t):c}}}return n}}function ut(e,t){if(!e||!e.length)return{};for(var n={},r=0,i=e.length;r<i;r++){var o=e[r],a=o.data;if(a&&a.attrs&&a.attrs.slot&&delete a.attrs.slot,o.context!==t&&o.fnContext!==t||!a||null==a.slot)(n.default||(n.default=[])).push(o);else{var s=a.slot,c=n[s]||(n[s]=[]);"template"===o.tag?c.push.apply(c,o.children||[]):c.push(o)}}for(var u in n)n[u].every(lt)&&delete n[u];return n}function lt(e){return e.isComment&&!e.asyncFactory||" "===e.text}function ft(t,n,r){var i,o=Object.keys(n).length>0,a=t?!!t.$stable:!o,s=t&&t.$key;if(t){if(t._normalized)return t._normalized;if(a&&r&&r!==e&&s===r.$key&&!o&&!r.$hasNormal)return r;for(var c in i={},t)t[c]&&"$"!==c[0]&&(i[c]=pt(n,c,t[c]))}else i={};for(var u in n)u in i||(i[u]=dt(n,u));return t&&Object.isExtensible(t)&&(t._normalized=i),R(i,"$stable",a),R(i,"$key",s),R(i,"$hasNormal",o),i}function pt(e,t,n){var r=function(){var e=arguments.length?n.apply(null,arguments):n({});return(e=e&&"object"==typeof e&&!Array.isArray(e)?[e]:at(e))&&(0===e.length||1===e.length&&e[0].isComment)?void 0:e};return n.proxy&&Object.defineProperty(e,t,{get:r,enumerable:!0,configurable:!0}),r}function dt(e,t){return function(){return e[t]}}function vt(e,t){var r,i,a,s,c;if(Array.isArray(e)||"string"==typeof e)for(r=new Array(e.length),i=0,a=e.length;i<a;i++)r[i]=t(e[i],i);else if("number"==typeof e)for(r=new Array(e),i=0;i<e;i++)r[i]=t(i+1,i);else if(o(e))if(oe&&e[Symbol.iterator]){r=[];for(var u=e[Symbol.iterator](),l=u.next();!l.done;)r.push(t(l.value,r.length)),l=u.next()}else for(s=Object.keys(e),r=new Array(s.length),i=0,a=s.length;i<a;i++)c=s[i],r[i]=t(e[c],c,i);return n(r)||(r=[]),r._isVList=!0,r}function ht(e,t,n,r){var i,o=this.$scopedSlots[e];o?(n=n||{},r&&(n=A(A({},r),n)),i=o(n)||t):i=this.$slots[e]||t;var a=n&&n.slot;return a?this.$createElement("template",{slot:a},i):i}function mt(e){return Le(this.$options,"filters",e)||E}function yt(e,t){return Array.isArray(e)?-1===e.indexOf(t):e!==t}function gt(e,t,n,r,i){var o=F.keyCodes[t]||n;return i&&r&&!F.keyCodes[t]?yt(i,r):o?yt(o,e):r?C(r)!==t:void 0}function _t(e,t,n,r,i){if(n)if(o(n)){var a;Array.isArray(n)&&(n=O(n));var s=function(o){if("class"===o||"style"===o||v(o))a=e;else{var s=e.attrs&&e.attrs.type;a=r||F.mustUseProp(t,s,o)?e.domProps||(e.domProps={}):e.attrs||(e.attrs={})}var c=b(o),u=C(o);c in a||u in a||(a[o]=n[o],i&&((e.on||(e.on={}))["update:"+o]=function(e){n[o]=e}))};for(var c in n)s(c)}else;return e}function bt(e,t){var n=this._staticTrees||(this._staticTrees=[]),r=n[e];return r&&!t?r:(wt(r=n[e]=this.$options.staticRenderFns[e].call(this._renderProxy,null,this),"__static__"+e,!1),r)}function $t(e,t,n){return wt(e,"__once__"+t+(n?"_"+n:""),!0),e}function wt(e,t,n){if(Array.isArray(e))for(var r=0;r<e.length;r++)e[r]&&"string"!=typeof e[r]&&Ct(e[r],t+"_"+r,n);else Ct(e,t,n)}function Ct(e,t,n){e.isStatic=!0,e.key=t,e.isOnce=n}function xt(e,t){if(t)if(s(t)){var n=e.on=e.on?A({},e.on):{};for(var r in t){var i=n[r],o=t[r];n[r]=i?[].concat(i,o):o}}else;return e}function kt(e,t,n,r){t=t||{$stable:!n};for(var i=0;i<e.length;i++){var o=e[i];Array.isArray(o)?kt(o,t,n):o&&(o.proxy&&(o.fn.proxy=!0),t[o.key]=o.fn)}return r&&(t.$key=r),t}function At(e,t){for(var n=0;n<t.length;n+=2){var r=t[n];"string"==typeof r&&r&&(e[t[n]]=t[n+1])}return e}function Ot(e,t){return"string"==typeof e?t+e:e}function St(e){e._o=$t,e._n=f,e._s=l,e._l=vt,e._t=ht,e._q=N,e._i=j,e._m=bt,e._f=mt,e._k=gt,e._b=_t,e._v=he,e._e=ve,e._u=kt,e._g=xt,e._d=At,e._p=Ot}function Tt(t,n,i,o,a){var s,c=this,u=a.options;y(o,"_uid")?(s=Object.create(o))._original=o:(s=o,o=o._original);var l=r(u._compiled),f=!l;this.data=t,this.props=n,this.children=i,this.parent=o,this.listeners=t.on||e,this.injections=ct(u.inject,o),this.slots=function(){return c.$slots||ft(t.scopedSlots,c.$slots=ut(i,o)),c.$slots},Object.defineProperty(this,"scopedSlots",{enumerable:!0,get:function(){return ft(t.scopedSlots,this.slots())}}),l&&(this.$options=u,this.$slots=this.slots(),this.$scopedSlots=ft(t.scopedSlots,this.$slots)),u._scopeId?this._c=function(e,t,n,r){var i=Pt(s,e,t,n,r,f);return i&&!Array.isArray(i)&&(i.fnScopeId=u._scopeId,i.fnContext=o),i}:this._c=function(e,t,n,r){return Pt(s,e,t,n,r,f)}}function Et(e,t,n,r,i){var o=me(e);return o.fnContext=n,o.fnOptions=r,t.slot&&((o.data||(o.data={})).slot=t.slot),o}function Nt(e,t){for(var n in t)e[b(n)]=t[n]}St(Tt.prototype);var jt={init:function(e,t){if(e.componentInstance&&!e.componentInstance._isDestroyed&&e.data.keepAlive){var r=e;jt.prepatch(r,r)}else{(e.componentInstance=function(e,t){var r={_isComponent:!0,_parentVnode:e,parent:t},i=e.data.inlineTemplate;n(i)&&(r.render=i.render,r.staticRenderFns=i.staticRenderFns);return new e.componentOptions.Ctor(r)}(e,Wt)).$mount(t?e.elm:void 0,t)}},prepatch:function(t,n){var r=n.componentOptions;!function(t,n,r,i,o){var a=i.data.scopedSlots,s=t.$scopedSlots,c=!!(a&&!a.$stable||s!==e&&!s.$stable||a&&t.$scopedSlots.$key!==a.$key),u=!!(o||t.$options._renderChildren||c);t.$options._parentVnode=i,t.$vnode=i,t._vnode&&(t._vnode.parent=i);if(t.$options._renderChildren=o,t.$attrs=i.data.attrs||e,t.$listeners=r||e,n&&t.$options.props){$e(!1);for(var l=t._props,f=t.$options._propKeys||[],p=0;p<f.length;p++){var d=f[p],v=t.$options.props;l[d]=Me(d,v,n,t)}$e(!0),t.$options.propsData=n}r=r||e;var h=t.$options._parentListeners;t.$options._parentListeners=r,qt(t,r,h),u&&(t.$slots=ut(o,i.context),t.$forceUpdate())}(n.componentInstance=t.componentInstance,r.propsData,r.listeners,n,r.children)},insert:function(e){var t,n=e.context,r=e.componentInstance;r._isMounted||(r._isMounted=!0,Yt(r,"mounted")),e.data.keepAlive&&(n._isMounted?((t=r)._inactive=!1,en.push(t)):Xt(r,!0))},destroy:function(e){var t=e.componentInstance;t._isDestroyed||(e.data.keepAlive?function e(t,n){if(n&&(t._directInactive=!0,Gt(t)))return;if(!t._inactive){t._inactive=!0;for(var r=0;r<t.$children.length;r++)e(t.$children[r]);Yt(t,"deactivated")}}(t,!0):t.$destroy())}},Dt=Object.keys(jt);function Lt(i,a,s,c,l){if(!t(i)){var f=s.$options._base;if(o(i)&&(i=f.extend(i)),"function"==typeof i){var p;if(t(i.cid)&&void 0===(i=function(e,i){if(r(e.error)&&n(e.errorComp))return e.errorComp;if(n(e.resolved))return e.resolved;var a=Ht;a&&n(e.owners)&&-1===e.owners.indexOf(a)&&e.owners.push(a);if(r(e.loading)&&n(e.loadingComp))return e.loadingComp;if(a&&!n(e.owners)){var s=e.owners=[a],c=!0,l=null,f=null;a.$on("hook:destroyed",function(){return h(s,a)});var p=function(e){for(var t=0,n=s.length;t<n;t++)s[t].$forceUpdate();e&&(s.length=0,null!==l&&(clearTimeout(l),l=null),null!==f&&(clearTimeout(f),f=null))},d=D(function(t){e.resolved=Bt(t,i),c?s.length=0:p(!0)}),v=D(function(t){n(e.errorComp)&&(e.error=!0,p(!0))}),m=e(d,v);return o(m)&&(u(m)?t(e.resolved)&&m.then(d,v):u(m.component)&&(m.component.then(d,v),n(m.error)&&(e.errorComp=Bt(m.error,i)),n(m.loading)&&(e.loadingComp=Bt(m.loading,i),0===m.delay?e.loading=!0:l=setTimeout(function(){l=null,t(e.resolved)&&t(e.error)&&(e.loading=!0,p(!1))},m.delay||200)),n(m.timeout)&&(f=setTimeout(function(){f=null,t(e.resolved)&&v(null)},m.timeout)))),c=!1,e.loading?e.loadingComp:e.resolved}}(p=i,f)))return function(e,t,n,r,i){var o=ve();return o.asyncFactory=e,o.asyncMeta={data:t,context:n,children:r,tag:i},o}(p,a,s,c,l);a=a||{},$n(i),n(a.model)&&function(e,t){var r=e.model&&e.model.prop||"value",i=e.model&&e.model.event||"input";(t.attrs||(t.attrs={}))[r]=t.model.value;var o=t.on||(t.on={}),a=o[i],s=t.model.callback;n(a)?(Array.isArray(a)?-1===a.indexOf(s):a!==s)&&(o[i]=[s].concat(a)):o[i]=s}(i.options,a);var d=function(e,r,i){var o=r.options.props;if(!t(o)){var a={},s=e.attrs,c=e.props;if(n(s)||n(c))for(var u in o){var l=C(u);ot(a,c,u,l,!0)||ot(a,s,u,l,!1)}return a}}(a,i);if(r(i.options.functional))return function(t,r,i,o,a){var s=t.options,c={},u=s.props;if(n(u))for(var l in u)c[l]=Me(l,u,r||e);else n(i.attrs)&&Nt(c,i.attrs),n(i.props)&&Nt(c,i.props);var f=new Tt(i,c,a,o,t),p=s.render.call(null,f._c,f);if(p instanceof pe)return Et(p,i,f.parent,s);if(Array.isArray(p)){for(var d=at(p)||[],v=new Array(d.length),h=0;h<d.length;h++)v[h]=Et(d[h],i,f.parent,s);return v}}(i,d,a,s,c);var v=a.on;if(a.on=a.nativeOn,r(i.options.abstract)){var m=a.slot;a={},m&&(a.slot=m)}!function(e){for(var t=e.hook||(e.hook={}),n=0;n<Dt.length;n++){var r=Dt[n],i=t[r],o=jt[r];i===o||i&&i._merged||(t[r]=i?Mt(o,i):o)}}(a);var y=i.options.name||l;return new pe("vue-component-"+i.cid+(y?"-"+y:""),a,void 0,void 0,void 0,s,{Ctor:i,propsData:d,listeners:v,tag:l,children:c},p)}}}function Mt(e,t){var n=function(n,r){e(n,r),t(n,r)};return n._merged=!0,n}var It=1,Ft=2;function Pt(e,a,s,c,u,l){return(Array.isArray(s)||i(s))&&(u=c,c=s,s=void 0),r(l)&&(u=Ft),function(e,i,a,s,c){if(n(a)&&n(a.__ob__))return ve();n(a)&&n(a.is)&&(i=a.is);if(!i)return ve();Array.isArray(s)&&"function"==typeof s[0]&&((a=a||{}).scopedSlots={default:s[0]},s.length=0);c===Ft?s=at(s):c===It&&(s=function(e){for(var t=0;t<e.length;t++)if(Array.isArray(e[t]))return Array.prototype.concat.apply([],e);return e}(s));var u,l;if("string"==typeof i){var f;l=e.$vnode&&e.$vnode.ns||F.getTagNamespace(i),u=F.isReservedTag(i)?new pe(F.parsePlatformTagName(i),a,s,void 0,void 0,e):a&&a.pre||!n(f=Le(e.$options,"components",i))?new pe(i,a,s,void 0,void 0,e):Lt(f,a,e,s,i)}else u=Lt(i,a,e,s);return Array.isArray(u)?u:n(u)?(n(l)&&function e(i,o,a){i.ns=o;"foreignObject"===i.tag&&(o=void 0,a=!0);if(n(i.children))for(var s=0,c=i.children.length;s<c;s++){var u=i.children[s];n(u.tag)&&(t(u.ns)||r(a)&&"svg"!==u.tag)&&e(u,o,a)}}(u,l),n(a)&&function(e){o(e.style)&&et(e.style);o(e.class)&&et(e.class)}(a),u):ve()}(e,a,s,c,u)}var Rt,Ht=null;function Bt(e,t){return(e.__esModule||oe&&"Module"===e[Symbol.toStringTag])&&(e=e.default),o(e)?t.extend(e):e}function Ut(e){return e.isComment&&e.asyncFactory}function zt(e){if(Array.isArray(e))for(var t=0;t<e.length;t++){var r=e[t];if(n(r)&&(n(r.componentOptions)||Ut(r)))return r}}function Vt(e,t){Rt.$on(e,t)}function Kt(e,t){Rt.$off(e,t)}function Jt(e,t){var n=Rt;return function r(){null!==t.apply(null,arguments)&&n.$off(e,r)}}function qt(e,t,n){Rt=e,rt(t,n||{},Vt,Kt,Jt,e),Rt=void 0}var Wt=null;function Zt(e){var t=Wt;return Wt=e,function(){Wt=t}}function Gt(e){for(;e&&(e=e.$parent);)if(e._inactive)return!0;return!1}function Xt(e,t){if(t){if(e._directInactive=!1,Gt(e))return}else if(e._directInactive)return;if(e._inactive||null===e._inactive){e._inactive=!1;for(var n=0;n<e.$children.length;n++)Xt(e.$children[n]);Yt(e,"activated")}}function Yt(e,t){le();var n=e.$options[t],r=t+" hook";if(n)for(var i=0,o=n.length;i<o;i++)He(n[i],e,null,e,r);e._hasHookEvent&&e.$emit("hook:"+t),fe()}var Qt=[],en=[],tn={},nn=!1,rn=!1,on=0;var an=0,sn=Date.now;if(z&&!q){var cn=window.performance;cn&&"function"==typeof cn.now&&sn()>document.createEvent("Event").timeStamp&&(sn=function(){return cn.now()})}function un(){var e,t;for(an=sn(),rn=!0,Qt.sort(function(e,t){return e.id-t.id}),on=0;on<Qt.length;on++)(e=Qt[on]).before&&e.before(),t=e.id,tn[t]=null,e.run();var n=en.slice(),r=Qt.slice();on=Qt.length=en.length=0,tn={},nn=rn=!1,function(e){for(var t=0;t<e.length;t++)e[t]._inactive=!0,Xt(e[t],!0)}(n),function(e){var t=e.length;for(;t--;){var n=e[t],r=n.vm;r._watcher===n&&r._isMounted&&!r._isDestroyed&&Yt(r,"updated")}}(r),ne&&F.devtools&&ne.emit("flush")}var ln=0,fn=function(e,t,n,r,i){this.vm=e,i&&(e._watcher=this),e._watchers.push(this),r?(this.deep=!!r.deep,this.user=!!r.user,this.lazy=!!r.lazy,this.sync=!!r.sync,this.before=r.before):this.deep=this.user=this.lazy=this.sync=!1,this.cb=n,this.id=++ln,this.active=!0,this.dirty=this.lazy,this.deps=[],this.newDeps=[],this.depIds=new ie,this.newDepIds=new ie,this.expression="","function"==typeof t?this.getter=t:(this.getter=function(e){if(!H.test(e)){var t=e.split(".");return function(e){for(var n=0;n<t.length;n++){if(!e)return;e=e[t[n]]}return e}}}(t),this.getter||(this.getter=S)),this.value=this.lazy?void 0:this.get()};fn.prototype.get=function(){var e;le(this);var t=this.vm;try{e=this.getter.call(t,t)}catch(e){if(!this.user)throw e;Re(e,t,'getter for watcher "'+this.expression+'"')}finally{this.deep&&et(e),fe(),this.cleanupDeps()}return e},fn.prototype.addDep=function(e){var t=e.id;this.newDepIds.has(t)||(this.newDepIds.add(t),this.newDeps.push(e),this.depIds.has(t)||e.addSub(this))},fn.prototype.cleanupDeps=function(){for(var e=this.deps.length;e--;){var t=this.deps[e];this.newDepIds.has(t.id)||t.removeSub(this)}var n=this.depIds;this.depIds=this.newDepIds,this.newDepIds=n,this.newDepIds.clear(),n=this.deps,this.deps=this.newDeps,this.newDeps=n,this.newDeps.length=0},fn.prototype.update=function(){this.lazy?this.dirty=!0:this.sync?this.run():function(e){var t=e.id;if(null==tn[t]){if(tn[t]=!0,rn){for(var n=Qt.length-1;n>on&&Qt[n].id>e.id;)n--;Qt.splice(n+1,0,e)}else Qt.push(e);nn||(nn=!0,Ye(un))}}(this)},fn.prototype.run=function(){if(this.active){var e=this.get();if(e!==this.value||o(e)||this.deep){var t=this.value;if(this.value=e,this.user)try{this.cb.call(this.vm,e,t)}catch(e){Re(e,this.vm,'callback for watcher "'+this.expression+'"')}else this.cb.call(this.vm,e,t)}}},fn.prototype.evaluate=function(){this.value=this.get(),this.dirty=!1},fn.prototype.depend=function(){for(var e=this.deps.length;e--;)this.deps[e].depend()},fn.prototype.teardown=function(){if(this.active){this.vm._isBeingDestroyed||h(this.vm._watchers,this);for(var e=this.deps.length;e--;)this.deps[e].removeSub(this);this.active=!1}};var pn={enumerable:!0,configurable:!0,get:S,set:S};function dn(e,t,n){pn.get=function(){return this[t][n]},pn.set=function(e){this[t][n]=e},Object.defineProperty(e,n,pn)}function vn(e){e._watchers=[];var t=e.$options;t.props&&function(e,t){var n=e.$options.propsData||{},r=e._props={},i=e.$options._propKeys=[];e.$parent&&$e(!1);var o=function(o){i.push(o);var a=Me(o,t,n,e);xe(r,o,a),o in e||dn(e,"_props",o)};for(var a in t)o(a);$e(!0)}(e,t.props),t.methods&&function(e,t){e.$options.props;for(var n in t)e[n]="function"!=typeof t[n]?S:x(t[n],e)}(e,t.methods),t.data?function(e){var t=e.$options.data;s(t=e._data="function"==typeof t?function(e,t){le();try{return e.call(t,t)}catch(e){return Re(e,t,"data()"),{}}finally{fe()}}(t,e):t||{})||(t={});var n=Object.keys(t),r=e.$options.props,i=(e.$options.methods,n.length);for(;i--;){var o=n[i];r&&y(r,o)||(a=void 0,36!==(a=(o+"").charCodeAt(0))&&95!==a&&dn(e,"_data",o))}var a;Ce(t,!0)}(e):Ce(e._data={},!0),t.computed&&function(e,t){var n=e._computedWatchers=Object.create(null),r=te();for(var i in t){var o=t[i],a="function"==typeof o?o:o.get;r||(n[i]=new fn(e,a||S,S,hn)),i in e||mn(e,i,o)}}(e,t.computed),t.watch&&t.watch!==Y&&function(e,t){for(var n in t){var r=t[n];if(Array.isArray(r))for(var i=0;i<r.length;i++)_n(e,n,r[i]);else _n(e,n,r)}}(e,t.watch)}var hn={lazy:!0};function mn(e,t,n){var r=!te();"function"==typeof n?(pn.get=r?yn(t):gn(n),pn.set=S):(pn.get=n.get?r&&!1!==n.cache?yn(t):gn(n.get):S,pn.set=n.set||S),Object.defineProperty(e,t,pn)}function yn(e){return function(){var t=this._computedWatchers&&this._computedWatchers[e];if(t)return t.dirty&&t.evaluate(),ce.target&&t.depend(),t.value}}function gn(e){return function(){return e.call(this,this)}}function _n(e,t,n,r){return s(n)&&(r=n,n=n.handler),"string"==typeof n&&(n=e[n]),e.$watch(t,n,r)}var bn=0;function $n(e){var t=e.options;if(e.super){var n=$n(e.super);if(n!==e.superOptions){e.superOptions=n;var r=function(e){var t,n=e.options,r=e.sealedOptions;for(var i in n)n[i]!==r[i]&&(t||(t={}),t[i]=n[i]);return t}(e);r&&A(e.extendOptions,r),(t=e.options=De(n,e.extendOptions)).name&&(t.components[t.name]=e)}}return t}function wn(e){this._init(e)}function Cn(e){e.cid=0;var t=1;e.extend=function(e){e=e||{};var n=this,r=n.cid,i=e._Ctor||(e._Ctor={});if(i[r])return i[r];var o=e.name||n.options.name,a=function(e){this._init(e)};return(a.prototype=Object.create(n.prototype)).constructor=a,a.cid=t++,a.options=De(n.options,e),a.super=n,a.options.props&&function(e){var t=e.options.props;for(var n in t)dn(e.prototype,"_props",n)}(a),a.options.computed&&function(e){var t=e.options.computed;for(var n in t)mn(e.prototype,n,t[n])}(a),a.extend=n.extend,a.mixin=n.mixin,a.use=n.use,M.forEach(function(e){a[e]=n[e]}),o&&(a.options.components[o]=a),a.superOptions=n.options,a.extendOptions=e,a.sealedOptions=A({},a.options),i[r]=a,a}}function xn(e){return e&&(e.Ctor.options.name||e.tag)}function kn(e,t){return Array.isArray(e)?e.indexOf(t)>-1:"string"==typeof e?e.split(",").indexOf(t)>-1:(n=e,"[object RegExp]"===a.call(n)&&e.test(t));var n}function An(e,t){var n=e.cache,r=e.keys,i=e._vnode;for(var o in n){var a=n[o];if(a){var s=xn(a.componentOptions);s&&!t(s)&&On(n,o,r,i)}}}function On(e,t,n,r){var i=e[t];!i||r&&i.tag===r.tag||i.componentInstance.$destroy(),e[t]=null,h(n,t)}!function(t){t.prototype._init=function(t){var n=this;n._uid=bn++,n._isVue=!0,t&&t._isComponent?function(e,t){var n=e.$options=Object.create(e.constructor.options),r=t._parentVnode;n.parent=t.parent,n._parentVnode=r;var i=r.componentOptions;n.propsData=i.propsData,n._parentListeners=i.listeners,n._renderChildren=i.children,n._componentTag=i.tag,t.render&&(n.render=t.render,n.staticRenderFns=t.staticRenderFns)}(n,t):n.$options=De($n(n.constructor),t||{},n),n._renderProxy=n,n._self=n,function(e){var t=e.$options,n=t.parent;if(n&&!t.abstract){for(;n.$options.abstract&&n.$parent;)n=n.$parent;n.$children.push(e)}e.$parent=n,e.$root=n?n.$root:e,e.$children=[],e.$refs={},e._watcher=null,e._inactive=null,e._directInactive=!1,e._isMounted=!1,e._isDestroyed=!1,e._isBeingDestroyed=!1}(n),function(e){e._events=Object.create(null),e._hasHookEvent=!1;var t=e.$options._parentListeners;t&&qt(e,t)}(n),function(t){t._vnode=null,t._staticTrees=null;var n=t.$options,r=t.$vnode=n._parentVnode,i=r&&r.context;t.$slots=ut(n._renderChildren,i),t.$scopedSlots=e,t._c=function(e,n,r,i){return Pt(t,e,n,r,i,!1)},t.$createElement=function(e,n,r,i){return Pt(t,e,n,r,i,!0)};var o=r&&r.data;xe(t,"$attrs",o&&o.attrs||e,null,!0),xe(t,"$listeners",n._parentListeners||e,null,!0)}(n),Yt(n,"beforeCreate"),function(e){var t=ct(e.$options.inject,e);t&&($e(!1),Object.keys(t).forEach(function(n){xe(e,n,t[n])}),$e(!0))}(n),vn(n),function(e){var t=e.$options.provide;t&&(e._provided="function"==typeof t?t.call(e):t)}(n),Yt(n,"created"),n.$options.el&&n.$mount(n.$options.el)}}(wn),function(e){var t={get:function(){return this._data}},n={get:function(){return this._props}};Object.defineProperty(e.prototype,"$data",t),Object.defineProperty(e.prototype,"$props",n),e.prototype.$set=ke,e.prototype.$delete=Ae,e.prototype.$watch=function(e,t,n){if(s(t))return _n(this,e,t,n);(n=n||{}).user=!0;var r=new fn(this,e,t,n);if(n.immediate)try{t.call(this,r.value)}catch(e){Re(e,this,'callback for immediate watcher "'+r.expression+'"')}return function(){r.teardown()}}}(wn),function(e){var t=/^hook:/;e.prototype.$on=function(e,n){var r=this;if(Array.isArray(e))for(var i=0,o=e.length;i<o;i++)r.$on(e[i],n);else(r._events[e]||(r._events[e]=[])).push(n),t.test(e)&&(r._hasHookEvent=!0);return r},e.prototype.$once=function(e,t){var n=this;function r(){n.$off(e,r),t.apply(n,arguments)}return r.fn=t,n.$on(e,r),n},e.prototype.$off=function(e,t){var n=this;if(!arguments.length)return n._events=Object.create(null),n;if(Array.isArray(e)){for(var r=0,i=e.length;r<i;r++)n.$off(e[r],t);return n}var o,a=n._events[e];if(!a)return n;if(!t)return n._events[e]=null,n;for(var s=a.length;s--;)if((o=a[s])===t||o.fn===t){a.splice(s,1);break}return n},e.prototype.$emit=function(e){var t=this._events[e];if(t){t=t.length>1?k(t):t;for(var n=k(arguments,1),r='event handler for "'+e+'"',i=0,o=t.length;i<o;i++)He(t[i],this,n,this,r)}return this}}(wn),function(e){e.prototype._update=function(e,t){var n=this,r=n.$el,i=n._vnode,o=Zt(n);n._vnode=e,n.$el=i?n.__patch__(i,e):n.__patch__(n.$el,e,t,!1),o(),r&&(r.__vue__=null),n.$el&&(n.$el.__vue__=n),n.$vnode&&n.$parent&&n.$vnode===n.$parent._vnode&&(n.$parent.$el=n.$el)},e.prototype.$forceUpdate=function(){this._watcher&&this._watcher.update()},e.prototype.$destroy=function(){var e=this;if(!e._isBeingDestroyed){Yt(e,"beforeDestroy"),e._isBeingDestroyed=!0;var t=e.$parent;!t||t._isBeingDestroyed||e.$options.abstract||h(t.$children,e),e._watcher&&e._watcher.teardown();for(var n=e._watchers.length;n--;)e._watchers[n].teardown();e._data.__ob__&&e._data.__ob__.vmCount--,e._isDestroyed=!0,e.__patch__(e._vnode,null),Yt(e,"destroyed"),e.$off(),e.$el&&(e.$el.__vue__=null),e.$vnode&&(e.$vnode.parent=null)}}}(wn),function(e){St(e.prototype),e.prototype.$nextTick=function(e){return Ye(e,this)},e.prototype._render=function(){var e,t=this,n=t.$options,r=n.render,i=n._parentVnode;i&&(t.$scopedSlots=ft(i.data.scopedSlots,t.$slots,t.$scopedSlots)),t.$vnode=i;try{Ht=t,e=r.call(t._renderProxy,t.$createElement)}catch(n){Re(n,t,"render"),e=t._vnode}finally{Ht=null}return Array.isArray(e)&&1===e.length&&(e=e[0]),e instanceof pe||(e=ve()),e.parent=i,e}}(wn);var Sn=[String,RegExp,Array],Tn={KeepAlive:{name:"keep-alive",abstract:!0,props:{include:Sn,exclude:Sn,max:[String,Number]},created:function(){this.cache=Object.create(null),this.keys=[]},destroyed:function(){for(var e in this.cache)On(this.cache,e,this.keys)},mounted:function(){var e=this;this.$watch("include",function(t){An(e,function(e){return kn(t,e)})}),this.$watch("exclude",function(t){An(e,function(e){return!kn(t,e)})})},render:function(){var e=this.$slots.default,t=zt(e),n=t&&t.componentOptions;if(n){var r=xn(n),i=this.include,o=this.exclude;if(i&&(!r||!kn(i,r))||o&&r&&kn(o,r))return t;var a=this.cache,s=this.keys,c=null==t.key?n.Ctor.cid+(n.tag?"::"+n.tag:""):t.key;a[c]?(t.componentInstance=a[c].componentInstance,h(s,c),s.push(c)):(a[c]=t,s.push(c),this.max&&s.length>parseInt(this.max)&&On(a,s[0],s,this._vnode)),t.data.keepAlive=!0}return t||e&&e[0]}}};!function(e){var t={get:function(){return F}};Object.defineProperty(e,"config",t),e.util={warn:ae,extend:A,mergeOptions:De,defineReactive:xe},e.set=ke,e.delete=Ae,e.nextTick=Ye,e.observable=function(e){return Ce(e),e},e.options=Object.create(null),M.forEach(function(t){e.options[t+"s"]=Object.create(null)}),e.options._base=e,A(e.options.components,Tn),function(e){e.use=function(e){var t=this._installedPlugins||(this._installedPlugins=[]);if(t.indexOf(e)>-1)return this;var n=k(arguments,1);return n.unshift(this),"function"==typeof e.install?e.install.apply(e,n):"function"==typeof e&&e.apply(null,n),t.push(e),this}}(e),function(e){e.mixin=function(e){return this.options=De(this.options,e),this}}(e),Cn(e),function(e){M.forEach(function(t){e[t]=function(e,n){return n?("component"===t&&s(n)&&(n.name=n.name||e,n=this.options._base.extend(n)),"directive"===t&&"function"==typeof n&&(n={bind:n,update:n}),this.options[t+"s"][e]=n,n):this.options[t+"s"][e]}})}(e)}(wn),Object.defineProperty(wn.prototype,"$isServer",{get:te}),Object.defineProperty(wn.prototype,"$ssrContext",{get:function(){return this.$vnode&&this.$vnode.ssrContext}}),Object.defineProperty(wn,"FunctionalRenderContext",{value:Tt}),wn.version="2.6.11";var En=p("style,class"),Nn=p("input,textarea,option,select,progress"),jn=function(e,t,n){return"value"===n&&Nn(e)&&"button"!==t||"selected"===n&&"option"===e||"checked"===n&&"input"===e||"muted"===n&&"video"===e},Dn=p("contenteditable,draggable,spellcheck"),Ln=p("events,caret,typing,plaintext-only"),Mn=function(e,t){return Hn(t)||"false"===t?"false":"contenteditable"===e&&Ln(t)?t:"true"},In=p("allowfullscreen,async,autofocus,autoplay,checked,compact,controls,declare,default,defaultchecked,defaultmuted,defaultselected,defer,disabled,enabled,formnovalidate,hidden,indeterminate,inert,ismap,itemscope,loop,multiple,muted,nohref,noresize,noshade,novalidate,nowrap,open,pauseonexit,readonly,required,reversed,scoped,seamless,selected,sortable,translate,truespeed,typemustmatch,visible"),Fn="http://www.w3.org/1999/xlink",Pn=function(e){return":"===e.charAt(5)&&"xlink"===e.slice(0,5)},Rn=function(e){return Pn(e)?e.slice(6,e.length):""},Hn=function(e){return null==e||!1===e};function Bn(e){for(var t=e.data,r=e,i=e;n(i.componentInstance);)(i=i.componentInstance._vnode)&&i.data&&(t=Un(i.data,t));for(;n(r=r.parent);)r&&r.data&&(t=Un(t,r.data));return function(e,t){if(n(e)||n(t))return zn(e,Vn(t));return""}(t.staticClass,t.class)}function Un(e,t){return{staticClass:zn(e.staticClass,t.staticClass),class:n(e.class)?[e.class,t.class]:t.class}}function zn(e,t){return e?t?e+" "+t:e:t||""}function Vn(e){return Array.isArray(e)?function(e){for(var t,r="",i=0,o=e.length;i<o;i++)n(t=Vn(e[i]))&&""!==t&&(r&&(r+=" "),r+=t);return r}(e):o(e)?function(e){var t="";for(var n in e)e[n]&&(t&&(t+=" "),t+=n);return t}(e):"string"==typeof e?e:""}var Kn={svg:"http://www.w3.org/2000/svg",math:"http://www.w3.org/1998/Math/MathML"},Jn=p("html,body,base,head,link,meta,style,title,address,article,aside,footer,header,h1,h2,h3,h4,h5,h6,hgroup,nav,section,div,dd,dl,dt,figcaption,figure,picture,hr,img,li,main,ol,p,pre,ul,a,b,abbr,bdi,bdo,br,cite,code,data,dfn,em,i,kbd,mark,q,rp,rt,rtc,ruby,s,samp,small,span,strong,sub,sup,time,u,var,wbr,area,audio,map,track,video,embed,object,param,source,canvas,script,noscript,del,ins,caption,col,colgroup,table,thead,tbody,td,th,tr,button,datalist,fieldset,form,input,label,legend,meter,optgroup,option,output,progress,select,textarea,details,dialog,menu,menuitem,summary,content,element,shadow,template,blockquote,iframe,tfoot"),qn=p("svg,animate,circle,clippath,cursor,defs,desc,ellipse,filter,font-face,foreignObject,g,glyph,image,line,marker,mask,missing-glyph,path,pattern,polygon,polyline,rect,switch,symbol,text,textpath,tspan,use,view",!0),Wn=function(e){return Jn(e)||qn(e)};function Zn(e){return qn(e)?"svg":"math"===e?"math":void 0}var Gn=Object.create(null);var Xn=p("text,number,password,search,email,tel,url");function Yn(e){if("string"==typeof e){var t=document.querySelector(e);return t||document.createElement("div")}return e}var Qn=Object.freeze({createElement:function(e,t){var n=document.createElement(e);return"select"!==e?n:(t.data&&t.data.attrs&&void 0!==t.data.attrs.multiple&&n.setAttribute("multiple","multiple"),n)},createElementNS:function(e,t){return document.createElementNS(Kn[e],t)},createTextNode:function(e){return document.createTextNode(e)},createComment:function(e){return document.createComment(e)},insertBefore:function(e,t,n){e.insertBefore(t,n)},removeChild:function(e,t){e.removeChild(t)},appendChild:function(e,t){e.appendChild(t)},parentNode:function(e){return e.parentNode},nextSibling:function(e){return e.nextSibling},tagName:function(e){return e.tagName},setTextContent:function(e,t){e.textContent=t},setStyleScope:function(e,t){e.setAttribute(t,"")}}),er={create:function(e,t){tr(t)},update:function(e,t){e.data.ref!==t.data.ref&&(tr(e,!0),tr(t))},destroy:function(e){tr(e,!0)}};function tr(e,t){var r=e.data.ref;if(n(r)){var i=e.context,o=e.componentInstance||e.elm,a=i.$refs;t?Array.isArray(a[r])?h(a[r],o):a[r]===o&&(a[r]=void 0):e.data.refInFor?Array.isArray(a[r])?a[r].indexOf(o)<0&&a[r].push(o):a[r]=[o]:a[r]=o}}var nr=new pe("",{},[]),rr=["create","activate","update","remove","destroy"];function ir(e,i){return e.key===i.key&&(e.tag===i.tag&&e.isComment===i.isComment&&n(e.data)===n(i.data)&&function(e,t){if("input"!==e.tag)return!0;var r,i=n(r=e.data)&&n(r=r.attrs)&&r.type,o=n(r=t.data)&&n(r=r.attrs)&&r.type;return i===o||Xn(i)&&Xn(o)}(e,i)||r(e.isAsyncPlaceholder)&&e.asyncFactory===i.asyncFactory&&t(i.asyncFactory.error))}function or(e,t,r){var i,o,a={};for(i=t;i<=r;++i)n(o=e[i].key)&&(a[o]=i);return a}var ar={create:sr,update:sr,destroy:function(e){sr(e,nr)}};function sr(e,t){(e.data.directives||t.data.directives)&&function(e,t){var n,r,i,o=e===nr,a=t===nr,s=ur(e.data.directives,e.context),c=ur(t.data.directives,t.context),u=[],l=[];for(n in c)r=s[n],i=c[n],r?(i.oldValue=r.value,i.oldArg=r.arg,fr(i,"update",t,e),i.def&&i.def.componentUpdated&&l.push(i)):(fr(i,"bind",t,e),i.def&&i.def.inserted&&u.push(i));if(u.length){var f=function(){for(var n=0;n<u.length;n++)fr(u[n],"inserted",t,e)};o?it(t,"insert",f):f()}l.length&&it(t,"postpatch",function(){for(var n=0;n<l.length;n++)fr(l[n],"componentUpdated",t,e)});if(!o)for(n in s)c[n]||fr(s[n],"unbind",e,e,a)}(e,t)}var cr=Object.create(null);function ur(e,t){var n,r,i=Object.create(null);if(!e)return i;for(n=0;n<e.length;n++)(r=e[n]).modifiers||(r.modifiers=cr),i[lr(r)]=r,r.def=Le(t.$options,"directives",r.name);return i}function lr(e){return e.rawName||e.name+"."+Object.keys(e.modifiers||{}).join(".")}function fr(e,t,n,r,i){var o=e.def&&e.def[t];if(o)try{o(n.elm,e,n,r,i)}catch(r){Re(r,n.context,"directive "+e.name+" "+t+" hook")}}var pr=[er,ar];function dr(e,r){var i=r.componentOptions;if(!(n(i)&&!1===i.Ctor.options.inheritAttrs||t(e.data.attrs)&&t(r.data.attrs))){var o,a,s=r.elm,c=e.data.attrs||{},u=r.data.attrs||{};for(o in n(u.__ob__)&&(u=r.data.attrs=A({},u)),u)a=u[o],c[o]!==a&&vr(s,o,a);for(o in(q||Z)&&u.value!==c.value&&vr(s,"value",u.value),c)t(u[o])&&(Pn(o)?s.removeAttributeNS(Fn,Rn(o)):Dn(o)||s.removeAttribute(o))}}function vr(e,t,n){e.tagName.indexOf("-")>-1?hr(e,t,n):In(t)?Hn(n)?e.removeAttribute(t):(n="allowfullscreen"===t&&"EMBED"===e.tagName?"true":t,e.setAttribute(t,n)):Dn(t)?e.setAttribute(t,Mn(t,n)):Pn(t)?Hn(n)?e.removeAttributeNS(Fn,Rn(t)):e.setAttributeNS(Fn,t,n):hr(e,t,n)}function hr(e,t,n){if(Hn(n))e.removeAttribute(t);else{if(q&&!W&&"TEXTAREA"===e.tagName&&"placeholder"===t&&""!==n&&!e.__ieph){var r=function(t){t.stopImmediatePropagation(),e.removeEventListener("input",r)};e.addEventListener("input",r),e.__ieph=!0}e.setAttribute(t,n)}}var mr={create:dr,update:dr};function yr(e,r){var i=r.elm,o=r.data,a=e.data;if(!(t(o.staticClass)&&t(o.class)&&(t(a)||t(a.staticClass)&&t(a.class)))){var s=Bn(r),c=i._transitionClasses;n(c)&&(s=zn(s,Vn(c))),s!==i._prevClass&&(i.setAttribute("class",s),i._prevClass=s)}}var gr,_r,br,$r,wr,Cr,xr={create:yr,update:yr},kr=/[\w).+\-_$\]]/;function Ar(e){var t,n,r,i,o,a=!1,s=!1,c=!1,u=!1,l=0,f=0,p=0,d=0;for(r=0;r<e.length;r++)if(n=t,t=e.charCodeAt(r),a)39===t&&92!==n&&(a=!1);else if(s)34===t&&92!==n&&(s=!1);else if(c)96===t&&92!==n&&(c=!1);else if(u)47===t&&92!==n&&(u=!1);else if(124!==t||124===e.charCodeAt(r+1)||124===e.charCodeAt(r-1)||l||f||p){switch(t){case 34:s=!0;break;case 39:a=!0;break;case 96:c=!0;break;case 40:p++;break;case 41:p--;break;case 91:f++;break;case 93:f--;break;case 123:l++;break;case 125:l--}if(47===t){for(var v=r-1,h=void 0;v>=0&&" "===(h=e.charAt(v));v--);h&&kr.test(h)||(u=!0)}}else void 0===i?(d=r+1,i=e.slice(0,r).trim()):m();function m(){(o||(o=[])).push(e.slice(d,r).trim()),d=r+1}if(void 0===i?i=e.slice(0,r).trim():0!==d&&m(),o)for(r=0;r<o.length;r++)i=Or(i,o[r]);return i}function Or(e,t){var n=t.indexOf("(");if(n<0)return'_f("'+t+'")('+e+")";var r=t.slice(0,n),i=t.slice(n+1);return'_f("'+r+'")('+e+(")"!==i?","+i:i)}function Sr(e,t){console.error("[Vue compiler]: "+e)}function Tr(e,t){return e?e.map(function(e){return e[t]}).filter(function(e){return e}):[]}function Er(e,t,n,r,i){(e.props||(e.props=[])).push(Rr({name:t,value:n,dynamic:i},r)),e.plain=!1}function Nr(e,t,n,r,i){(i?e.dynamicAttrs||(e.dynamicAttrs=[]):e.attrs||(e.attrs=[])).push(Rr({name:t,value:n,dynamic:i},r)),e.plain=!1}function jr(e,t,n,r){e.attrsMap[t]=n,e.attrsList.push(Rr({name:t,value:n},r))}function Dr(e,t,n,r,i,o,a,s){(e.directives||(e.directives=[])).push(Rr({name:t,rawName:n,value:r,arg:i,isDynamicArg:o,modifiers:a},s)),e.plain=!1}function Lr(e,t,n){return n?"_p("+t+',"'+e+'")':e+t}function Mr(t,n,r,i,o,a,s,c){var u;(i=i||e).right?c?n="("+n+")==='click'?'contextmenu':("+n+")":"click"===n&&(n="contextmenu",delete i.right):i.middle&&(c?n="("+n+")==='click'?'mouseup':("+n+")":"click"===n&&(n="mouseup")),i.capture&&(delete i.capture,n=Lr("!",n,c)),i.once&&(delete i.once,n=Lr("~",n,c)),i.passive&&(delete i.passive,n=Lr("&",n,c)),i.native?(delete i.native,u=t.nativeEvents||(t.nativeEvents={})):u=t.events||(t.events={});var l=Rr({value:r.trim(),dynamic:c},s);i!==e&&(l.modifiers=i);var f=u[n];Array.isArray(f)?o?f.unshift(l):f.push(l):u[n]=f?o?[l,f]:[f,l]:l,t.plain=!1}function Ir(e,t,n){var r=Fr(e,":"+t)||Fr(e,"v-bind:"+t);if(null!=r)return Ar(r);if(!1!==n){var i=Fr(e,t);if(null!=i)return JSON.stringify(i)}}function Fr(e,t,n){var r;if(null!=(r=e.attrsMap[t]))for(var i=e.attrsList,o=0,a=i.length;o<a;o++)if(i[o].name===t){i.splice(o,1);break}return n&&delete e.attrsMap[t],r}function Pr(e,t){for(var n=e.attrsList,r=0,i=n.length;r<i;r++){var o=n[r];if(t.test(o.name))return n.splice(r,1),o}}function Rr(e,t){return t&&(null!=t.start&&(e.start=t.start),null!=t.end&&(e.end=t.end)),e}function Hr(e,t,n){var r=n||{},i=r.number,o="$$v";r.trim&&(o="(typeof $$v === 'string'? $$v.trim(): $$v)"),i&&(o="_n("+o+")");var a=Br(t,o);e.model={value:"("+t+")",expression:JSON.stringify(t),callback:"function ($$v) {"+a+"}"}}function Br(e,t){var n=function(e){if(e=e.trim(),gr=e.length,e.indexOf("[")<0||e.lastIndexOf("]")<gr-1)return($r=e.lastIndexOf("."))>-1?{exp:e.slice(0,$r),key:'"'+e.slice($r+1)+'"'}:{exp:e,key:null};_r=e,$r=wr=Cr=0;for(;!zr();)Vr(br=Ur())?Jr(br):91===br&&Kr(br);return{exp:e.slice(0,wr),key:e.slice(wr+1,Cr)}}(e);return null===n.key?e+"="+t:"$set("+n.exp+", "+n.key+", "+t+")"}function Ur(){return _r.charCodeAt(++$r)}function zr(){return $r>=gr}function Vr(e){return 34===e||39===e}function Kr(e){var t=1;for(wr=$r;!zr();)if(Vr(e=Ur()))Jr(e);else if(91===e&&t++,93===e&&t--,0===t){Cr=$r;break}}function Jr(e){for(var t=e;!zr()&&(e=Ur())!==t;);}var qr,Wr="__r",Zr="__c";function Gr(e,t,n){var r=qr;return function i(){null!==t.apply(null,arguments)&&Qr(e,i,n,r)}}var Xr=Ve&&!(X&&Number(X[1])<=53);function Yr(e,t,n,r){if(Xr){var i=an,o=t;t=o._wrapper=function(e){if(e.target===e.currentTarget||e.timeStamp>=i||e.timeStamp<=0||e.target.ownerDocument!==document)return o.apply(this,arguments)}}qr.addEventListener(e,t,Q?{capture:n,passive:r}:n)}function Qr(e,t,n,r){(r||qr).removeEventListener(e,t._wrapper||t,n)}function ei(e,r){if(!t(e.data.on)||!t(r.data.on)){var i=r.data.on||{},o=e.data.on||{};qr=r.elm,function(e){if(n(e[Wr])){var t=q?"change":"input";e[t]=[].concat(e[Wr],e[t]||[]),delete e[Wr]}n(e[Zr])&&(e.change=[].concat(e[Zr],e.change||[]),delete e[Zr])}(i),rt(i,o,Yr,Qr,Gr,r.context),qr=void 0}}var ti,ni={create:ei,update:ei};function ri(e,r){if(!t(e.data.domProps)||!t(r.data.domProps)){var i,o,a=r.elm,s=e.data.domProps||{},c=r.data.domProps||{};for(i in n(c.__ob__)&&(c=r.data.domProps=A({},c)),s)i in c||(a[i]="");for(i in c){if(o=c[i],"textContent"===i||"innerHTML"===i){if(r.children&&(r.children.length=0),o===s[i])continue;1===a.childNodes.length&&a.removeChild(a.childNodes[0])}if("value"===i&&"PROGRESS"!==a.tagName){a._value=o;var u=t(o)?"":String(o);ii(a,u)&&(a.value=u)}else if("innerHTML"===i&&qn(a.tagName)&&t(a.innerHTML)){(ti=ti||document.createElement("div")).innerHTML="<svg>"+o+"</svg>";for(var l=ti.firstChild;a.firstChild;)a.removeChild(a.firstChild);for(;l.firstChild;)a.appendChild(l.firstChild)}else if(o!==s[i])try{a[i]=o}catch(e){}}}}function ii(e,t){return!e.composing&&("OPTION"===e.tagName||function(e,t){var n=!0;try{n=document.activeElement!==e}catch(e){}return n&&e.value!==t}(e,t)||function(e,t){var r=e.value,i=e._vModifiers;if(n(i)){if(i.number)return f(r)!==f(t);if(i.trim)return r.trim()!==t.trim()}return r!==t}(e,t))}var oi={create:ri,update:ri},ai=g(function(e){var t={},n=/:(.+)/;return e.split(/;(?![^(]*\))/g).forEach(function(e){if(e){var r=e.split(n);r.length>1&&(t[r[0].trim()]=r[1].trim())}}),t});function si(e){var t=ci(e.style);return e.staticStyle?A(e.staticStyle,t):t}function ci(e){return Array.isArray(e)?O(e):"string"==typeof e?ai(e):e}var ui,li=/^--/,fi=/\s*!important$/,pi=function(e,t,n){if(li.test(t))e.style.setProperty(t,n);else if(fi.test(n))e.style.setProperty(C(t),n.replace(fi,""),"important");else{var r=vi(t);if(Array.isArray(n))for(var i=0,o=n.length;i<o;i++)e.style[r]=n[i];else e.style[r]=n}},di=["Webkit","Moz","ms"],vi=g(function(e){if(ui=ui||document.createElement("div").style,"filter"!==(e=b(e))&&e in ui)return e;for(var t=e.charAt(0).toUpperCase()+e.slice(1),n=0;n<di.length;n++){var r=di[n]+t;if(r in ui)return r}});function hi(e,r){var i=r.data,o=e.data;if(!(t(i.staticStyle)&&t(i.style)&&t(o.staticStyle)&&t(o.style))){var a,s,c=r.elm,u=o.staticStyle,l=o.normalizedStyle||o.style||{},f=u||l,p=ci(r.data.style)||{};r.data.normalizedStyle=n(p.__ob__)?A({},p):p;var d=function(e,t){var n,r={};if(t)for(var i=e;i.componentInstance;)(i=i.componentInstance._vnode)&&i.data&&(n=si(i.data))&&A(r,n);(n=si(e.data))&&A(r,n);for(var o=e;o=o.parent;)o.data&&(n=si(o.data))&&A(r,n);return r}(r,!0);for(s in f)t(d[s])&&pi(c,s,"");for(s in d)(a=d[s])!==f[s]&&pi(c,s,null==a?"":a)}}var mi={create:hi,update:hi},yi=/\s+/;function gi(e,t){if(t&&(t=t.trim()))if(e.classList)t.indexOf(" ")>-1?t.split(yi).forEach(function(t){return e.classList.add(t)}):e.classList.add(t);else{var n=" "+(e.getAttribute("class")||"")+" ";n.indexOf(" "+t+" ")<0&&e.setAttribute("class",(n+t).trim())}}function _i(e,t){if(t&&(t=t.trim()))if(e.classList)t.indexOf(" ")>-1?t.split(yi).forEach(function(t){return e.classList.remove(t)}):e.classList.remove(t),e.classList.length||e.removeAttribute("class");else{for(var n=" "+(e.getAttribute("class")||"")+" ",r=" "+t+" ";n.indexOf(r)>=0;)n=n.replace(r," ");(n=n.trim())?e.setAttribute("class",n):e.removeAttribute("class")}}function bi(e){if(e){if("object"==typeof e){var t={};return!1!==e.css&&A(t,$i(e.name||"v")),A(t,e),t}return"string"==typeof e?$i(e):void 0}}var $i=g(function(e){return{enterClass:e+"-enter",enterToClass:e+"-enter-to",enterActiveClass:e+"-enter-active",leaveClass:e+"-leave",leaveToClass:e+"-leave-to",leaveActiveClass:e+"-leave-active"}}),wi=z&&!W,Ci="transition",xi="animation",ki="transition",Ai="transitionend",Oi="animation",Si="animationend";wi&&(void 0===window.ontransitionend&&void 0!==window.onwebkittransitionend&&(ki="WebkitTransition",Ai="webkitTransitionEnd"),void 0===window.onanimationend&&void 0!==window.onwebkitanimationend&&(Oi="WebkitAnimation",Si="webkitAnimationEnd"));var Ti=z?window.requestAnimationFrame?window.requestAnimationFrame.bind(window):setTimeout:function(e){return e()};function Ei(e){Ti(function(){Ti(e)})}function Ni(e,t){var n=e._transitionClasses||(e._transitionClasses=[]);n.indexOf(t)<0&&(n.push(t),gi(e,t))}function ji(e,t){e._transitionClasses&&h(e._transitionClasses,t),_i(e,t)}function Di(e,t,n){var r=Mi(e,t),i=r.type,o=r.timeout,a=r.propCount;if(!i)return n();var s=i===Ci?Ai:Si,c=0,u=function(){e.removeEventListener(s,l),n()},l=function(t){t.target===e&&++c>=a&&u()};setTimeout(function(){c<a&&u()},o+1),e.addEventListener(s,l)}var Li=/\b(transform|all)(,|$)/;function Mi(e,t){var n,r=window.getComputedStyle(e),i=(r[ki+"Delay"]||"").split(", "),o=(r[ki+"Duration"]||"").split(", "),a=Ii(i,o),s=(r[Oi+"Delay"]||"").split(", "),c=(r[Oi+"Duration"]||"").split(", "),u=Ii(s,c),l=0,f=0;return t===Ci?a>0&&(n=Ci,l=a,f=o.length):t===xi?u>0&&(n=xi,l=u,f=c.length):f=(n=(l=Math.max(a,u))>0?a>u?Ci:xi:null)?n===Ci?o.length:c.length:0,{type:n,timeout:l,propCount:f,hasTransform:n===Ci&&Li.test(r[ki+"Property"])}}function Ii(e,t){for(;e.length<t.length;)e=e.concat(e);return Math.max.apply(null,t.map(function(t,n){return Fi(t)+Fi(e[n])}))}function Fi(e){return 1e3*Number(e.slice(0,-1).replace(",","."))}function Pi(e,r){var i=e.elm;n(i._leaveCb)&&(i._leaveCb.cancelled=!0,i._leaveCb());var a=bi(e.data.transition);if(!t(a)&&!n(i._enterCb)&&1===i.nodeType){for(var s=a.css,c=a.type,u=a.enterClass,l=a.enterToClass,p=a.enterActiveClass,d=a.appearClass,v=a.appearToClass,h=a.appearActiveClass,m=a.beforeEnter,y=a.enter,g=a.afterEnter,_=a.enterCancelled,b=a.beforeAppear,$=a.appear,w=a.afterAppear,C=a.appearCancelled,x=a.duration,k=Wt,A=Wt.$vnode;A&&A.parent;)k=A.context,A=A.parent;var O=!k._isMounted||!e.isRootInsert;if(!O||$||""===$){var S=O&&d?d:u,T=O&&h?h:p,E=O&&v?v:l,N=O&&b||m,j=O&&"function"==typeof $?$:y,L=O&&w||g,M=O&&C||_,I=f(o(x)?x.enter:x),F=!1!==s&&!W,P=Bi(j),R=i._enterCb=D(function(){F&&(ji(i,E),ji(i,T)),R.cancelled?(F&&ji(i,S),M&&M(i)):L&&L(i),i._enterCb=null});e.data.show||it(e,"insert",function(){var t=i.parentNode,n=t&&t._pending&&t._pending[e.key];n&&n.tag===e.tag&&n.elm._leaveCb&&n.elm._leaveCb(),j&&j(i,R)}),N&&N(i),F&&(Ni(i,S),Ni(i,T),Ei(function(){ji(i,S),R.cancelled||(Ni(i,E),P||(Hi(I)?setTimeout(R,I):Di(i,c,R)))})),e.data.show&&(r&&r(),j&&j(i,R)),F||P||R()}}}function Ri(e,r){var i=e.elm;n(i._enterCb)&&(i._enterCb.cancelled=!0,i._enterCb());var a=bi(e.data.transition);if(t(a)||1!==i.nodeType)return r();if(!n(i._leaveCb)){var s=a.css,c=a.type,u=a.leaveClass,l=a.leaveToClass,p=a.leaveActiveClass,d=a.beforeLeave,v=a.leave,h=a.afterLeave,m=a.leaveCancelled,y=a.delayLeave,g=a.duration,_=!1!==s&&!W,b=Bi(v),$=f(o(g)?g.leave:g),w=i._leaveCb=D(function(){i.parentNode&&i.parentNode._pending&&(i.parentNode._pending[e.key]=null),_&&(ji(i,l),ji(i,p)),w.cancelled?(_&&ji(i,u),m&&m(i)):(r(),h&&h(i)),i._leaveCb=null});y?y(C):C()}function C(){w.cancelled||(!e.data.show&&i.parentNode&&((i.parentNode._pending||(i.parentNode._pending={}))[e.key]=e),d&&d(i),_&&(Ni(i,u),Ni(i,p),Ei(function(){ji(i,u),w.cancelled||(Ni(i,l),b||(Hi($)?setTimeout(w,$):Di(i,c,w)))})),v&&v(i,w),_||b||w())}}function Hi(e){return"number"==typeof e&&!isNaN(e)}function Bi(e){if(t(e))return!1;var r=e.fns;return n(r)?Bi(Array.isArray(r)?r[0]:r):(e._length||e.length)>1}function Ui(e,t){!0!==t.data.show&&Pi(t)}var zi=function(e){var o,a,s={},c=e.modules,u=e.nodeOps;for(o=0;o<rr.length;++o)for(s[rr[o]]=[],a=0;a<c.length;++a)n(c[a][rr[o]])&&s[rr[o]].push(c[a][rr[o]]);function l(e){var t=u.parentNode(e);n(t)&&u.removeChild(t,e)}function f(e,t,i,o,a,c,l){if(n(e.elm)&&n(c)&&(e=c[l]=me(e)),e.isRootInsert=!a,!function(e,t,i,o){var a=e.data;if(n(a)){var c=n(e.componentInstance)&&a.keepAlive;if(n(a=a.hook)&&n(a=a.init)&&a(e,!1),n(e.componentInstance))return d(e,t),v(i,e.elm,o),r(c)&&function(e,t,r,i){for(var o,a=e;a.componentInstance;)if(a=a.componentInstance._vnode,n(o=a.data)&&n(o=o.transition)){for(o=0;o<s.activate.length;++o)s.activate[o](nr,a);t.push(a);break}v(r,e.elm,i)}(e,t,i,o),!0}}(e,t,i,o)){var f=e.data,p=e.children,m=e.tag;n(m)?(e.elm=e.ns?u.createElementNS(e.ns,m):u.createElement(m,e),g(e),h(e,p,t),n(f)&&y(e,t),v(i,e.elm,o)):r(e.isComment)?(e.elm=u.createComment(e.text),v(i,e.elm,o)):(e.elm=u.createTextNode(e.text),v(i,e.elm,o))}}function d(e,t){n(e.data.pendingInsert)&&(t.push.apply(t,e.data.pendingInsert),e.data.pendingInsert=null),e.elm=e.componentInstance.$el,m(e)?(y(e,t),g(e)):(tr(e),t.push(e))}function v(e,t,r){n(e)&&(n(r)?u.parentNode(r)===e&&u.insertBefore(e,t,r):u.appendChild(e,t))}function h(e,t,n){if(Array.isArray(t))for(var r=0;r<t.length;++r)f(t[r],n,e.elm,null,!0,t,r);else i(e.text)&&u.appendChild(e.elm,u.createTextNode(String(e.text)))}function m(e){for(;e.componentInstance;)e=e.componentInstance._vnode;return n(e.tag)}function y(e,t){for(var r=0;r<s.create.length;++r)s.create[r](nr,e);n(o=e.data.hook)&&(n(o.create)&&o.create(nr,e),n(o.insert)&&t.push(e))}function g(e){var t;if(n(t=e.fnScopeId))u.setStyleScope(e.elm,t);else for(var r=e;r;)n(t=r.context)&&n(t=t.$options._scopeId)&&u.setStyleScope(e.elm,t),r=r.parent;n(t=Wt)&&t!==e.context&&t!==e.fnContext&&n(t=t.$options._scopeId)&&u.setStyleScope(e.elm,t)}function _(e,t,n,r,i,o){for(;r<=i;++r)f(n[r],o,e,t,!1,n,r)}function b(e){var t,r,i=e.data;if(n(i))for(n(t=i.hook)&&n(t=t.destroy)&&t(e),t=0;t<s.destroy.length;++t)s.destroy[t](e);if(n(t=e.children))for(r=0;r<e.children.length;++r)b(e.children[r])}function $(e,t,r){for(;t<=r;++t){var i=e[t];n(i)&&(n(i.tag)?(w(i),b(i)):l(i.elm))}}function w(e,t){if(n(t)||n(e.data)){var r,i=s.remove.length+1;for(n(t)?t.listeners+=i:t=function(e,t){function n(){0==--n.listeners&&l(e)}return n.listeners=t,n}(e.elm,i),n(r=e.componentInstance)&&n(r=r._vnode)&&n(r.data)&&w(r,t),r=0;r<s.remove.length;++r)s.remove[r](e,t);n(r=e.data.hook)&&n(r=r.remove)?r(e,t):t()}else l(e.elm)}function C(e,t,r,i){for(var o=r;o<i;o++){var a=t[o];if(n(a)&&ir(e,a))return o}}function x(e,i,o,a,c,l){if(e!==i){n(i.elm)&&n(a)&&(i=a[c]=me(i));var p=i.elm=e.elm;if(r(e.isAsyncPlaceholder))n(i.asyncFactory.resolved)?O(e.elm,i,o):i.isAsyncPlaceholder=!0;else if(r(i.isStatic)&&r(e.isStatic)&&i.key===e.key&&(r(i.isCloned)||r(i.isOnce)))i.componentInstance=e.componentInstance;else{var d,v=i.data;n(v)&&n(d=v.hook)&&n(d=d.prepatch)&&d(e,i);var h=e.children,y=i.children;if(n(v)&&m(i)){for(d=0;d<s.update.length;++d)s.update[d](e,i);n(d=v.hook)&&n(d=d.update)&&d(e,i)}t(i.text)?n(h)&&n(y)?h!==y&&function(e,r,i,o,a){for(var s,c,l,p=0,d=0,v=r.length-1,h=r[0],m=r[v],y=i.length-1,g=i[0],b=i[y],w=!a;p<=v&&d<=y;)t(h)?h=r[++p]:t(m)?m=r[--v]:ir(h,g)?(x(h,g,o,i,d),h=r[++p],g=i[++d]):ir(m,b)?(x(m,b,o,i,y),m=r[--v],b=i[--y]):ir(h,b)?(x(h,b,o,i,y),w&&u.insertBefore(e,h.elm,u.nextSibling(m.elm)),h=r[++p],b=i[--y]):ir(m,g)?(x(m,g,o,i,d),w&&u.insertBefore(e,m.elm,h.elm),m=r[--v],g=i[++d]):(t(s)&&(s=or(r,p,v)),t(c=n(g.key)?s[g.key]:C(g,r,p,v))?f(g,o,e,h.elm,!1,i,d):ir(l=r[c],g)?(x(l,g,o,i,d),r[c]=void 0,w&&u.insertBefore(e,l.elm,h.elm)):f(g,o,e,h.elm,!1,i,d),g=i[++d]);p>v?_(e,t(i[y+1])?null:i[y+1].elm,i,d,y,o):d>y&&$(r,p,v)}(p,h,y,o,l):n(y)?(n(e.text)&&u.setTextContent(p,""),_(p,null,y,0,y.length-1,o)):n(h)?$(h,0,h.length-1):n(e.text)&&u.setTextContent(p,""):e.text!==i.text&&u.setTextContent(p,i.text),n(v)&&n(d=v.hook)&&n(d=d.postpatch)&&d(e,i)}}}function k(e,t,i){if(r(i)&&n(e.parent))e.parent.data.pendingInsert=t;else for(var o=0;o<t.length;++o)t[o].data.hook.insert(t[o])}var A=p("attrs,class,staticClass,staticStyle,key");function O(e,t,i,o){var a,s=t.tag,c=t.data,u=t.children;if(o=o||c&&c.pre,t.elm=e,r(t.isComment)&&n(t.asyncFactory))return t.isAsyncPlaceholder=!0,!0;if(n(c)&&(n(a=c.hook)&&n(a=a.init)&&a(t,!0),n(a=t.componentInstance)))return d(t,i),!0;if(n(s)){if(n(u))if(e.hasChildNodes())if(n(a=c)&&n(a=a.domProps)&&n(a=a.innerHTML)){if(a!==e.innerHTML)return!1}else{for(var l=!0,f=e.firstChild,p=0;p<u.length;p++){if(!f||!O(f,u[p],i,o)){l=!1;break}f=f.nextSibling}if(!l||f)return!1}else h(t,u,i);if(n(c)){var v=!1;for(var m in c)if(!A(m)){v=!0,y(t,i);break}!v&&c.class&&et(c.class)}}else e.data!==t.text&&(e.data=t.text);return!0}return function(e,i,o,a){if(!t(i)){var c,l=!1,p=[];if(t(e))l=!0,f(i,p);else{var d=n(e.nodeType);if(!d&&ir(e,i))x(e,i,p,null,null,a);else{if(d){if(1===e.nodeType&&e.hasAttribute(L)&&(e.removeAttribute(L),o=!0),r(o)&&O(e,i,p))return k(i,p,!0),e;c=e,e=new pe(u.tagName(c).toLowerCase(),{},[],void 0,c)}var v=e.elm,h=u.parentNode(v);if(f(i,p,v._leaveCb?null:h,u.nextSibling(v)),n(i.parent))for(var y=i.parent,g=m(i);y;){for(var _=0;_<s.destroy.length;++_)s.destroy[_](y);if(y.elm=i.elm,g){for(var w=0;w<s.create.length;++w)s.create[w](nr,y);var C=y.data.hook.insert;if(C.merged)for(var A=1;A<C.fns.length;A++)C.fns[A]()}else tr(y);y=y.parent}n(h)?$([e],0,0):n(e.tag)&&b(e)}}return k(i,p,l),i.elm}n(e)&&b(e)}}({nodeOps:Qn,modules:[mr,xr,ni,oi,mi,z?{create:Ui,activate:Ui,remove:function(e,t){!0!==e.data.show?Ri(e,t):t()}}:{}].concat(pr)});W&&document.addEventListener("selectionchange",function(){var e=document.activeElement;e&&e.vmodel&&Xi(e,"input")});var Vi={inserted:function(e,t,n,r){"select"===n.tag?(r.elm&&!r.elm._vOptions?it(n,"postpatch",function(){Vi.componentUpdated(e,t,n)}):Ki(e,t,n.context),e._vOptions=[].map.call(e.options,Wi)):("textarea"===n.tag||Xn(e.type))&&(e._vModifiers=t.modifiers,t.modifiers.lazy||(e.addEventListener("compositionstart",Zi),e.addEventListener("compositionend",Gi),e.addEventListener("change",Gi),W&&(e.vmodel=!0)))},componentUpdated:function(e,t,n){if("select"===n.tag){Ki(e,t,n.context);var r=e._vOptions,i=e._vOptions=[].map.call(e.options,Wi);if(i.some(function(e,t){return!N(e,r[t])}))(e.multiple?t.value.some(function(e){return qi(e,i)}):t.value!==t.oldValue&&qi(t.value,i))&&Xi(e,"change")}}};function Ki(e,t,n){Ji(e,t,n),(q||Z)&&setTimeout(function(){Ji(e,t,n)},0)}function Ji(e,t,n){var r=t.value,i=e.multiple;if(!i||Array.isArray(r)){for(var o,a,s=0,c=e.options.length;s<c;s++)if(a=e.options[s],i)o=j(r,Wi(a))>-1,a.selected!==o&&(a.selected=o);else if(N(Wi(a),r))return void(e.selectedIndex!==s&&(e.selectedIndex=s));i||(e.selectedIndex=-1)}}function qi(e,t){return t.every(function(t){return!N(t,e)})}function Wi(e){return"_value"in e?e._value:e.value}function Zi(e){e.target.composing=!0}function Gi(e){e.target.composing&&(e.target.composing=!1,Xi(e.target,"input"))}function Xi(e,t){var n=document.createEvent("HTMLEvents");n.initEvent(t,!0,!0),e.dispatchEvent(n)}function Yi(e){return!e.componentInstance||e.data&&e.data.transition?e:Yi(e.componentInstance._vnode)}var Qi={model:Vi,show:{bind:function(e,t,n){var r=t.value,i=(n=Yi(n)).data&&n.data.transition,o=e.__vOriginalDisplay="none"===e.style.display?"":e.style.display;r&&i?(n.data.show=!0,Pi(n,function(){e.style.display=o})):e.style.display=r?o:"none"},update:function(e,t,n){var r=t.value;!r!=!t.oldValue&&((n=Yi(n)).data&&n.data.transition?(n.data.show=!0,r?Pi(n,function(){e.style.display=e.__vOriginalDisplay}):Ri(n,function(){e.style.display="none"})):e.style.display=r?e.__vOriginalDisplay:"none")},unbind:function(e,t,n,r,i){i||(e.style.display=e.__vOriginalDisplay)}}},eo={name:String,appear:Boolean,css:Boolean,mode:String,type:String,enterClass:String,leaveClass:String,enterToClass:String,leaveToClass:String,enterActiveClass:String,leaveActiveClass:String,appearClass:String,appearActiveClass:String,appearToClass:String,duration:[Number,String,Object]};function to(e){var t=e&&e.componentOptions;return t&&t.Ctor.options.abstract?to(zt(t.children)):e}function no(e){var t={},n=e.$options;for(var r in n.propsData)t[r]=e[r];var i=n._parentListeners;for(var o in i)t[b(o)]=i[o];return t}function ro(e,t){if(/\d-keep-alive$/.test(t.tag))return e("keep-alive",{props:t.componentOptions.propsData})}var io=function(e){return e.tag||Ut(e)},oo=function(e){return"show"===e.name},ao={name:"transition",props:eo,abstract:!0,render:function(e){var t=this,n=this.$slots.default;if(n&&(n=n.filter(io)).length){var r=this.mode,o=n[0];if(function(e){for(;e=e.parent;)if(e.data.transition)return!0}(this.$vnode))return o;var a=to(o);if(!a)return o;if(this._leaving)return ro(e,o);var s="__transition-"+this._uid+"-";a.key=null==a.key?a.isComment?s+"comment":s+a.tag:i(a.key)?0===String(a.key).indexOf(s)?a.key:s+a.key:a.key;var c=(a.data||(a.data={})).transition=no(this),u=this._vnode,l=to(u);if(a.data.directives&&a.data.directives.some(oo)&&(a.data.show=!0),l&&l.data&&!function(e,t){return t.key===e.key&&t.tag===e.tag}(a,l)&&!Ut(l)&&(!l.componentInstance||!l.componentInstance._vnode.isComment)){var f=l.data.transition=A({},c);if("out-in"===r)return this._leaving=!0,it(f,"afterLeave",function(){t._leaving=!1,t.$forceUpdate()}),ro(e,o);if("in-out"===r){if(Ut(a))return u;var p,d=function(){p()};it(c,"afterEnter",d),it(c,"enterCancelled",d),it(f,"delayLeave",function(e){p=e})}}return o}}},so=A({tag:String,moveClass:String},eo);function co(e){e.elm._moveCb&&e.elm._moveCb(),e.elm._enterCb&&e.elm._enterCb()}function uo(e){e.data.newPos=e.elm.getBoundingClientRect()}function lo(e){var t=e.data.pos,n=e.data.newPos,r=t.left-n.left,i=t.top-n.top;if(r||i){e.data.moved=!0;var o=e.elm.style;o.transform=o.WebkitTransform="translate("+r+"px,"+i+"px)",o.transitionDuration="0s"}}delete so.mode;var fo={Transition:ao,TransitionGroup:{props:so,beforeMount:function(){var e=this,t=this._update;this._update=function(n,r){var i=Zt(e);e.__patch__(e._vnode,e.kept,!1,!0),e._vnode=e.kept,i(),t.call(e,n,r)}},render:function(e){for(var t=this.tag||this.$vnode.data.tag||"span",n=Object.create(null),r=this.prevChildren=this.children,i=this.$slots.default||[],o=this.children=[],a=no(this),s=0;s<i.length;s++){var c=i[s];c.tag&&null!=c.key&&0!==String(c.key).indexOf("__vlist")&&(o.push(c),n[c.key]=c,(c.data||(c.data={})).transition=a)}if(r){for(var u=[],l=[],f=0;f<r.length;f++){var p=r[f];p.data.transition=a,p.data.pos=p.elm.getBoundingClientRect(),n[p.key]?u.push(p):l.push(p)}this.kept=e(t,null,u),this.removed=l}return e(t,null,o)},updated:function(){var e=this.prevChildren,t=this.moveClass||(this.name||"v")+"-move";e.length&&this.hasMove(e[0].elm,t)&&(e.forEach(co),e.forEach(uo),e.forEach(lo),this._reflow=document.body.offsetHeight,e.forEach(function(e){if(e.data.moved){var n=e.elm,r=n.style;Ni(n,t),r.transform=r.WebkitTransform=r.transitionDuration="",n.addEventListener(Ai,n._moveCb=function e(r){r&&r.target!==n||r&&!/transform$/.test(r.propertyName)||(n.removeEventListener(Ai,e),n._moveCb=null,ji(n,t))})}}))},methods:{hasMove:function(e,t){if(!wi)return!1;if(this._hasMove)return this._hasMove;var n=e.cloneNode();e._transitionClasses&&e._transitionClasses.forEach(function(e){_i(n,e)}),gi(n,t),n.style.display="none",this.$el.appendChild(n);var r=Mi(n);return this.$el.removeChild(n),this._hasMove=r.hasTransform}}}};wn.config.mustUseProp=jn,wn.config.isReservedTag=Wn,wn.config.isReservedAttr=En,wn.config.getTagNamespace=Zn,wn.config.isUnknownElement=function(e){if(!z)return!0;if(Wn(e))return!1;if(e=e.toLowerCase(),null!=Gn[e])return Gn[e];var t=document.createElement(e);return e.indexOf("-")>-1?Gn[e]=t.constructor===window.HTMLUnknownElement||t.constructor===window.HTMLElement:Gn[e]=/HTMLUnknownElement/.test(t.toString())},A(wn.options.directives,Qi),A(wn.options.components,fo),wn.prototype.__patch__=z?zi:S,wn.prototype.$mount=function(e,t){return function(e,t,n){var r;return e.$el=t,e.$options.render||(e.$options.render=ve),Yt(e,"beforeMount"),r=function(){e._update(e._render(),n)},new fn(e,r,S,{before:function(){e._isMounted&&!e._isDestroyed&&Yt(e,"beforeUpdate")}},!0),n=!1,null==e.$vnode&&(e._isMounted=!0,Yt(e,"mounted")),e}(this,e=e&&z?Yn(e):void 0,t)},z&&setTimeout(function(){F.devtools&&ne&&ne.emit("init",wn)},0);var po=/\{\{((?:.|\r?\n)+?)\}\}/g,vo=/[-.*+?^${}()|[\]\/\\]/g,ho=g(function(e){var t=e[0].replace(vo,"\\$&"),n=e[1].replace(vo,"\\$&");return new RegExp(t+"((?:.|\\n)+?)"+n,"g")});var mo={staticKeys:["staticClass"],transformNode:function(e,t){t.warn;var n=Fr(e,"class");n&&(e.staticClass=JSON.stringify(n));var r=Ir(e,"class",!1);r&&(e.classBinding=r)},genData:function(e){var t="";return e.staticClass&&(t+="staticClass:"+e.staticClass+","),e.classBinding&&(t+="class:"+e.classBinding+","),t}};var yo,go={staticKeys:["staticStyle"],transformNode:function(e,t){t.warn;var n=Fr(e,"style");n&&(e.staticStyle=JSON.stringify(ai(n)));var r=Ir(e,"style",!1);r&&(e.styleBinding=r)},genData:function(e){var t="";return e.staticStyle&&(t+="staticStyle:"+e.staticStyle+","),e.styleBinding&&(t+="style:("+e.styleBinding+"),"),t}},_o=function(e){return(yo=yo||document.createElement("div")).innerHTML=e,yo.textContent},bo=p("area,base,br,col,embed,frame,hr,img,input,isindex,keygen,link,meta,param,source,track,wbr"),$o=p("colgroup,dd,dt,li,options,p,td,tfoot,th,thead,tr,source"),wo=p("address,article,aside,base,blockquote,body,caption,col,colgroup,dd,details,dialog,div,dl,dt,fieldset,figcaption,figure,footer,form,h1,h2,h3,h4,h5,h6,head,header,hgroup,hr,html,legend,li,menuitem,meta,optgroup,option,param,rp,rt,source,style,summary,tbody,td,tfoot,th,thead,title,tr,track"),Co=/^\s*([^\s"'<>\/=]+)(?:\s*(=)\s*(?:"([^"]*)"+|'([^']*)'+|([^\s"'=<>`]+)))?/,xo=/^\s*((?:v-[\w-]+:|@|:|#)\[[^=]+\][^\s"'<>\/=]*)(?:\s*(=)\s*(?:"([^"]*)"+|'([^']*)'+|([^\s"'=<>`]+)))?/,ko="[a-zA-Z_][\\-\\.0-9_a-zA-Z"+P.source+"]*",Ao="((?:"+ko+"\\:)?"+ko+")",Oo=new RegExp("^<"+Ao),So=/^\s*(\/?)>/,To=new RegExp("^<\\/"+Ao+"[^>]*>"),Eo=/^<!DOCTYPE [^>]+>/i,No=/^<!\--/,jo=/^<!\[/,Do=p("script,style,textarea",!0),Lo={},Mo={"&lt;":"<","&gt;":">","&quot;":'"',"&amp;":"&","&#10;":"\n","&#9;":"\t","&#39;":"'"},Io=/&(?:lt|gt|quot|amp|#39);/g,Fo=/&(?:lt|gt|quot|amp|#39|#10|#9);/g,Po=p("pre,textarea",!0),Ro=function(e,t){return e&&Po(e)&&"\n"===t[0]};function Ho(e,t){var n=t?Fo:Io;return e.replace(n,function(e){return Mo[e]})}var Bo,Uo,zo,Vo,Ko,Jo,qo,Wo,Zo=/^@|^v-on:/,Go=/^v-|^@|^:|^#/,Xo=/([\s\S]*?)\s+(?:in|of)\s+([\s\S]*)/,Yo=/,([^,\}\]]*)(?:,([^,\}\]]*))?$/,Qo=/^\(|\)$/g,ea=/^\[.*\]$/,ta=/:(.*)$/,na=/^:|^\.|^v-bind:/,ra=/\.[^.\]]+(?=[^\]]*$)/g,ia=/^v-slot(:|$)|^#/,oa=/[\r\n]/,aa=/\s+/g,sa=g(_o),ca="_empty_";function ua(e,t,n){return{type:1,tag:e,attrsList:t,attrsMap:ma(t),rawAttrsMap:{},parent:n,children:[]}}function la(e,t){Bo=t.warn||Sr,Jo=t.isPreTag||T,qo=t.mustUseProp||T,Wo=t.getTagNamespace||T;t.isReservedTag;zo=Tr(t.modules,"transformNode"),Vo=Tr(t.modules,"preTransformNode"),Ko=Tr(t.modules,"postTransformNode"),Uo=t.delimiters;var n,r,i=[],o=!1!==t.preserveWhitespace,a=t.whitespace,s=!1,c=!1;function u(e){if(l(e),s||e.processed||(e=fa(e,t)),i.length||e===n||n.if&&(e.elseif||e.else)&&da(n,{exp:e.elseif,block:e}),r&&!e.forbidden)if(e.elseif||e.else)a=e,(u=function(e){var t=e.length;for(;t--;){if(1===e[t].type)return e[t];e.pop()}}(r.children))&&u.if&&da(u,{exp:a.elseif,block:a});else{if(e.slotScope){var o=e.slotTarget||'"default"';(r.scopedSlots||(r.scopedSlots={}))[o]=e}r.children.push(e),e.parent=r}var a,u;e.children=e.children.filter(function(e){return!e.slotScope}),l(e),e.pre&&(s=!1),Jo(e.tag)&&(c=!1);for(var f=0;f<Ko.length;f++)Ko[f](e,t)}function l(e){if(!c)for(var t;(t=e.children[e.children.length-1])&&3===t.type&&" "===t.text;)e.children.pop()}return function(e,t){for(var n,r,i=[],o=t.expectHTML,a=t.isUnaryTag||T,s=t.canBeLeftOpenTag||T,c=0;e;){if(n=e,r&&Do(r)){var u=0,l=r.toLowerCase(),f=Lo[l]||(Lo[l]=new RegExp("([\\s\\S]*?)(</"+l+"[^>]*>)","i")),p=e.replace(f,function(e,n,r){return u=r.length,Do(l)||"noscript"===l||(n=n.replace(/<!\--([\s\S]*?)-->/g,"$1").replace(/<!\[CDATA\[([\s\S]*?)]]>/g,"$1")),Ro(l,n)&&(n=n.slice(1)),t.chars&&t.chars(n),""});c+=e.length-p.length,e=p,A(l,c-u,c)}else{var d=e.indexOf("<");if(0===d){if(No.test(e)){var v=e.indexOf("--\x3e");if(v>=0){t.shouldKeepComment&&t.comment(e.substring(4,v),c,c+v+3),C(v+3);continue}}if(jo.test(e)){var h=e.indexOf("]>");if(h>=0){C(h+2);continue}}var m=e.match(Eo);if(m){C(m[0].length);continue}var y=e.match(To);if(y){var g=c;C(y[0].length),A(y[1],g,c);continue}var _=x();if(_){k(_),Ro(_.tagName,e)&&C(1);continue}}var b=void 0,$=void 0,w=void 0;if(d>=0){for($=e.slice(d);!(To.test($)||Oo.test($)||No.test($)||jo.test($)||(w=$.indexOf("<",1))<0);)d+=w,$=e.slice(d);b=e.substring(0,d)}d<0&&(b=e),b&&C(b.length),t.chars&&b&&t.chars(b,c-b.length,c)}if(e===n){t.chars&&t.chars(e);break}}function C(t){c+=t,e=e.substring(t)}function x(){var t=e.match(Oo);if(t){var n,r,i={tagName:t[1],attrs:[],start:c};for(C(t[0].length);!(n=e.match(So))&&(r=e.match(xo)||e.match(Co));)r.start=c,C(r[0].length),r.end=c,i.attrs.push(r);if(n)return i.unarySlash=n[1],C(n[0].length),i.end=c,i}}function k(e){var n=e.tagName,c=e.unarySlash;o&&("p"===r&&wo(n)&&A(r),s(n)&&r===n&&A(n));for(var u=a(n)||!!c,l=e.attrs.length,f=new Array(l),p=0;p<l;p++){var d=e.attrs[p],v=d[3]||d[4]||d[5]||"",h="a"===n&&"href"===d[1]?t.shouldDecodeNewlinesForHref:t.shouldDecodeNewlines;f[p]={name:d[1],value:Ho(v,h)}}u||(i.push({tag:n,lowerCasedTag:n.toLowerCase(),attrs:f,start:e.start,end:e.end}),r=n),t.start&&t.start(n,f,u,e.start,e.end)}function A(e,n,o){var a,s;if(null==n&&(n=c),null==o&&(o=c),e)for(s=e.toLowerCase(),a=i.length-1;a>=0&&i[a].lowerCasedTag!==s;a--);else a=0;if(a>=0){for(var u=i.length-1;u>=a;u--)t.end&&t.end(i[u].tag,n,o);i.length=a,r=a&&i[a-1].tag}else"br"===s?t.start&&t.start(e,[],!0,n,o):"p"===s&&(t.start&&t.start(e,[],!1,n,o),t.end&&t.end(e,n,o))}A()}(e,{warn:Bo,expectHTML:t.expectHTML,isUnaryTag:t.isUnaryTag,canBeLeftOpenTag:t.canBeLeftOpenTag,shouldDecodeNewlines:t.shouldDecodeNewlines,shouldDecodeNewlinesForHref:t.shouldDecodeNewlinesForHref,shouldKeepComment:t.comments,outputSourceRange:t.outputSourceRange,start:function(e,o,a,l,f){var p=r&&r.ns||Wo(e);q&&"svg"===p&&(o=function(e){for(var t=[],n=0;n<e.length;n++){var r=e[n];ya.test(r.name)||(r.name=r.name.replace(ga,""),t.push(r))}return t}(o));var d,v=ua(e,o,r);p&&(v.ns=p),"style"!==(d=v).tag&&("script"!==d.tag||d.attrsMap.type&&"text/javascript"!==d.attrsMap.type)||te()||(v.forbidden=!0);for(var h=0;h<Vo.length;h++)v=Vo[h](v,t)||v;s||(!function(e){null!=Fr(e,"v-pre")&&(e.pre=!0)}(v),v.pre&&(s=!0)),Jo(v.tag)&&(c=!0),s?function(e){var t=e.attrsList,n=t.length;if(n)for(var r=e.attrs=new Array(n),i=0;i<n;i++)r[i]={name:t[i].name,value:JSON.stringify(t[i].value)},null!=t[i].start&&(r[i].start=t[i].start,r[i].end=t[i].end);else e.pre||(e.plain=!0)}(v):v.processed||(pa(v),function(e){var t=Fr(e,"v-if");if(t)e.if=t,da(e,{exp:t,block:e});else{null!=Fr(e,"v-else")&&(e.else=!0);var n=Fr(e,"v-else-if");n&&(e.elseif=n)}}(v),function(e){null!=Fr(e,"v-once")&&(e.once=!0)}(v)),n||(n=v),a?u(v):(r=v,i.push(v))},end:function(e,t,n){var o=i[i.length-1];i.length-=1,r=i[i.length-1],u(o)},chars:function(e,t,n){if(r&&(!q||"textarea"!==r.tag||r.attrsMap.placeholder!==e)){var i,u,l,f=r.children;if(e=c||e.trim()?"script"===(i=r).tag||"style"===i.tag?e:sa(e):f.length?a?"condense"===a&&oa.test(e)?"":" ":o?" ":"":"")c||"condense"!==a||(e=e.replace(aa," ")),!s&&" "!==e&&(u=function(e,t){var n=t?ho(t):po;if(n.test(e)){for(var r,i,o,a=[],s=[],c=n.lastIndex=0;r=n.exec(e);){(i=r.index)>c&&(s.push(o=e.slice(c,i)),a.push(JSON.stringify(o)));var u=Ar(r[1].trim());a.push("_s("+u+")"),s.push({"@binding":u}),c=i+r[0].length}return c<e.length&&(s.push(o=e.slice(c)),a.push(JSON.stringify(o))),{expression:a.join("+"),tokens:s}}}(e,Uo))?l={type:2,expression:u.expression,tokens:u.tokens,text:e}:" "===e&&f.length&&" "===f[f.length-1].text||(l={type:3,text:e}),l&&f.push(l)}},comment:function(e,t,n){if(r){var i={type:3,text:e,isComment:!0};r.children.push(i)}}}),n}function fa(e,t){var n,r;(r=Ir(n=e,"key"))&&(n.key=r),e.plain=!e.key&&!e.scopedSlots&&!e.attrsList.length,function(e){var t=Ir(e,"ref");t&&(e.ref=t,e.refInFor=function(e){var t=e;for(;t;){if(void 0!==t.for)return!0;t=t.parent}return!1}(e))}(e),function(e){var t;"template"===e.tag?(t=Fr(e,"scope"),e.slotScope=t||Fr(e,"slot-scope")):(t=Fr(e,"slot-scope"))&&(e.slotScope=t);var n=Ir(e,"slot");n&&(e.slotTarget='""'===n?'"default"':n,e.slotTargetDynamic=!(!e.attrsMap[":slot"]&&!e.attrsMap["v-bind:slot"]),"template"===e.tag||e.slotScope||Nr(e,"slot",n,function(e,t){return e.rawAttrsMap[":"+t]||e.rawAttrsMap["v-bind:"+t]||e.rawAttrsMap[t]}(e,"slot")));if("template"===e.tag){var r=Pr(e,ia);if(r){var i=va(r),o=i.name,a=i.dynamic;e.slotTarget=o,e.slotTargetDynamic=a,e.slotScope=r.value||ca}}else{var s=Pr(e,ia);if(s){var c=e.scopedSlots||(e.scopedSlots={}),u=va(s),l=u.name,f=u.dynamic,p=c[l]=ua("template",[],e);p.slotTarget=l,p.slotTargetDynamic=f,p.children=e.children.filter(function(e){if(!e.slotScope)return e.parent=p,!0}),p.slotScope=s.value||ca,e.children=[],e.plain=!1}}}(e),function(e){"slot"===e.tag&&(e.slotName=Ir(e,"name"))}(e),function(e){var t;(t=Ir(e,"is"))&&(e.component=t);null!=Fr(e,"inline-template")&&(e.inlineTemplate=!0)}(e);for(var i=0;i<zo.length;i++)e=zo[i](e,t)||e;return function(e){var t,n,r,i,o,a,s,c,u=e.attrsList;for(t=0,n=u.length;t<n;t++)if(r=i=u[t].name,o=u[t].value,Go.test(r))if(e.hasBindings=!0,(a=ha(r.replace(Go,"")))&&(r=r.replace(ra,"")),na.test(r))r=r.replace(na,""),o=Ar(o),(c=ea.test(r))&&(r=r.slice(1,-1)),a&&(a.prop&&!c&&"innerHtml"===(r=b(r))&&(r="innerHTML"),a.camel&&!c&&(r=b(r)),a.sync&&(s=Br(o,"$event"),c?Mr(e,'"update:"+('+r+")",s,null,!1,0,u[t],!0):(Mr(e,"update:"+b(r),s,null,!1,0,u[t]),C(r)!==b(r)&&Mr(e,"update:"+C(r),s,null,!1,0,u[t])))),a&&a.prop||!e.component&&qo(e.tag,e.attrsMap.type,r)?Er(e,r,o,u[t],c):Nr(e,r,o,u[t],c);else if(Zo.test(r))r=r.replace(Zo,""),(c=ea.test(r))&&(r=r.slice(1,-1)),Mr(e,r,o,a,!1,0,u[t],c);else{var l=(r=r.replace(Go,"")).match(ta),f=l&&l[1];c=!1,f&&(r=r.slice(0,-(f.length+1)),ea.test(f)&&(f=f.slice(1,-1),c=!0)),Dr(e,r,i,o,f,c,a,u[t])}else Nr(e,r,JSON.stringify(o),u[t]),!e.component&&"muted"===r&&qo(e.tag,e.attrsMap.type,r)&&Er(e,r,"true",u[t])}(e),e}function pa(e){var t;if(t=Fr(e,"v-for")){var n=function(e){var t=e.match(Xo);if(!t)return;var n={};n.for=t[2].trim();var r=t[1].trim().replace(Qo,""),i=r.match(Yo);i?(n.alias=r.replace(Yo,"").trim(),n.iterator1=i[1].trim(),i[2]&&(n.iterator2=i[2].trim())):n.alias=r;return n}(t);n&&A(e,n)}}function da(e,t){e.ifConditions||(e.ifConditions=[]),e.ifConditions.push(t)}function va(e){var t=e.name.replace(ia,"");return t||"#"!==e.name[0]&&(t="default"),ea.test(t)?{name:t.slice(1,-1),dynamic:!0}:{name:'"'+t+'"',dynamic:!1}}function ha(e){var t=e.match(ra);if(t){var n={};return t.forEach(function(e){n[e.slice(1)]=!0}),n}}function ma(e){for(var t={},n=0,r=e.length;n<r;n++)t[e[n].name]=e[n].value;return t}var ya=/^xmlns:NS\d+/,ga=/^NS\d+:/;function _a(e){return ua(e.tag,e.attrsList.slice(),e.parent)}var ba=[mo,go,{preTransformNode:function(e,t){if("input"===e.tag){var n,r=e.attrsMap;if(!r["v-model"])return;if((r[":type"]||r["v-bind:type"])&&(n=Ir(e,"type")),r.type||n||!r["v-bind"]||(n="("+r["v-bind"]+").type"),n){var i=Fr(e,"v-if",!0),o=i?"&&("+i+")":"",a=null!=Fr(e,"v-else",!0),s=Fr(e,"v-else-if",!0),c=_a(e);pa(c),jr(c,"type","checkbox"),fa(c,t),c.processed=!0,c.if="("+n+")==='checkbox'"+o,da(c,{exp:c.if,block:c});var u=_a(e);Fr(u,"v-for",!0),jr(u,"type","radio"),fa(u,t),da(c,{exp:"("+n+")==='radio'"+o,block:u});var l=_a(e);return Fr(l,"v-for",!0),jr(l,":type",n),fa(l,t),da(c,{exp:i,block:l}),a?c.else=!0:s&&(c.elseif=s),c}}}}];var $a,wa,Ca={expectHTML:!0,modules:ba,directives:{model:function(e,t,n){var r=t.value,i=t.modifiers,o=e.tag,a=e.attrsMap.type;if(e.component)return Hr(e,r,i),!1;if("select"===o)!function(e,t,n){var r='var $$selectedVal = Array.prototype.filter.call($event.target.options,function(o){return o.selected}).map(function(o){var val = "_value" in o ? o._value : o.value;return '+(n&&n.number?"_n(val)":"val")+"});";r=r+" "+Br(t,"$event.target.multiple ? $$selectedVal : $$selectedVal[0]"),Mr(e,"change",r,null,!0)}(e,r,i);else if("input"===o&&"checkbox"===a)!function(e,t,n){var r=n&&n.number,i=Ir(e,"value")||"null",o=Ir(e,"true-value")||"true",a=Ir(e,"false-value")||"false";Er(e,"checked","Array.isArray("+t+")?_i("+t+","+i+")>-1"+("true"===o?":("+t+")":":_q("+t+","+o+")")),Mr(e,"change","var $$a="+t+",$$el=$event.target,$$c=$$el.checked?("+o+"):("+a+");if(Array.isArray($$a)){var $$v="+(r?"_n("+i+")":i)+",$$i=_i($$a,$$v);if($$el.checked){$$i<0&&("+Br(t,"$$a.concat([$$v])")+")}else{$$i>-1&&("+Br(t,"$$a.slice(0,$$i).concat($$a.slice($$i+1))")+")}}else{"+Br(t,"$$c")+"}",null,!0)}(e,r,i);else if("input"===o&&"radio"===a)!function(e,t,n){var r=n&&n.number,i=Ir(e,"value")||"null";Er(e,"checked","_q("+t+","+(i=r?"_n("+i+")":i)+")"),Mr(e,"change",Br(t,i),null,!0)}(e,r,i);else if("input"===o||"textarea"===o)!function(e,t,n){var r=e.attrsMap.type,i=n||{},o=i.lazy,a=i.number,s=i.trim,c=!o&&"range"!==r,u=o?"change":"range"===r?Wr:"input",l="$event.target.value";s&&(l="$event.target.value.trim()"),a&&(l="_n("+l+")");var f=Br(t,l);c&&(f="if($event.target.composing)return;"+f),Er(e,"value","("+t+")"),Mr(e,u,f,null,!0),(s||a)&&Mr(e,"blur","$forceUpdate()")}(e,r,i);else if(!F.isReservedTag(o))return Hr(e,r,i),!1;return!0},text:function(e,t){t.value&&Er(e,"textContent","_s("+t.value+")",t)},html:function(e,t){t.value&&Er(e,"innerHTML","_s("+t.value+")",t)}},isPreTag:function(e){return"pre"===e},isUnaryTag:bo,mustUseProp:jn,canBeLeftOpenTag:$o,isReservedTag:Wn,getTagNamespace:Zn,staticKeys:function(e){return e.reduce(function(e,t){return e.concat(t.staticKeys||[])},[]).join(",")}(ba)},xa=g(function(e){return p("type,tag,attrsList,attrsMap,plain,parent,children,attrs,start,end,rawAttrsMap"+(e?","+e:""))});function ka(e,t){e&&($a=xa(t.staticKeys||""),wa=t.isReservedTag||T,function e(t){t.static=function(e){if(2===e.type)return!1;if(3===e.type)return!0;return!(!e.pre&&(e.hasBindings||e.if||e.for||d(e.tag)||!wa(e.tag)||function(e){for(;e.parent;){if("template"!==(e=e.parent).tag)return!1;if(e.for)return!0}return!1}(e)||!Object.keys(e).every($a)))}(t);if(1===t.type){if(!wa(t.tag)&&"slot"!==t.tag&&null==t.attrsMap["inline-template"])return;for(var n=0,r=t.children.length;n<r;n++){var i=t.children[n];e(i),i.static||(t.static=!1)}if(t.ifConditions)for(var o=1,a=t.ifConditions.length;o<a;o++){var s=t.ifConditions[o].block;e(s),s.static||(t.static=!1)}}}(e),function e(t,n){if(1===t.type){if((t.static||t.once)&&(t.staticInFor=n),t.static&&t.children.length&&(1!==t.children.length||3!==t.children[0].type))return void(t.staticRoot=!0);if(t.staticRoot=!1,t.children)for(var r=0,i=t.children.length;r<i;r++)e(t.children[r],n||!!t.for);if(t.ifConditions)for(var o=1,a=t.ifConditions.length;o<a;o++)e(t.ifConditions[o].block,n)}}(e,!1))}var Aa=/^([\w$_]+|\([^)]*?\))\s*=>|^function(?:\s+[\w$]+)?\s*\(/,Oa=/\([^)]*?\);*$/,Sa=/^[A-Za-z_$][\w$]*(?:\.[A-Za-z_$][\w$]*|\['[^']*?']|\["[^"]*?"]|\[\d+]|\[[A-Za-z_$][\w$]*])*$/,Ta={esc:27,tab:9,enter:13,space:32,up:38,left:37,right:39,down:40,delete:[8,46]},Ea={esc:["Esc","Escape"],tab:"Tab",enter:"Enter",space:[" ","Spacebar"],up:["Up","ArrowUp"],left:["Left","ArrowLeft"],right:["Right","ArrowRight"],down:["Down","ArrowDown"],delete:["Backspace","Delete","Del"]},Na=function(e){return"if("+e+")return null;"},ja={stop:"$event.stopPropagation();",prevent:"$event.preventDefault();",self:Na("$event.target !== $event.currentTarget"),ctrl:Na("!$event.ctrlKey"),shift:Na("!$event.shiftKey"),alt:Na("!$event.altKey"),meta:Na("!$event.metaKey"),left:Na("'button' in $event && $event.button !== 0"),middle:Na("'button' in $event && $event.button !== 1"),right:Na("'button' in $event && $event.button !== 2")};function Da(e,t){var n=t?"nativeOn:":"on:",r="",i="";for(var o in e){var a=La(e[o]);e[o]&&e[o].dynamic?i+=o+","+a+",":r+='"'+o+'":'+a+","}return r="{"+r.slice(0,-1)+"}",i?n+"_d("+r+",["+i.slice(0,-1)+"])":n+r}function La(e){if(!e)return"function(){}";if(Array.isArray(e))return"["+e.map(function(e){return La(e)}).join(",")+"]";var t=Sa.test(e.value),n=Aa.test(e.value),r=Sa.test(e.value.replace(Oa,""));if(e.modifiers){var i="",o="",a=[];for(var s in e.modifiers)if(ja[s])o+=ja[s],Ta[s]&&a.push(s);else if("exact"===s){var c=e.modifiers;o+=Na(["ctrl","shift","alt","meta"].filter(function(e){return!c[e]}).map(function(e){return"$event."+e+"Key"}).join("||"))}else a.push(s);return a.length&&(i+=function(e){return"if(!$event.type.indexOf('key')&&"+e.map(Ma).join("&&")+")return null;"}(a)),o&&(i+=o),"function($event){"+i+(t?"return "+e.value+"($event)":n?"return ("+e.value+")($event)":r?"return "+e.value:e.value)+"}"}return t||n?e.value:"function($event){"+(r?"return "+e.value:e.value)+"}"}function Ma(e){var t=parseInt(e,10);if(t)return"$event.keyCode!=="+t;var n=Ta[e],r=Ea[e];return"_k($event.keyCode,"+JSON.stringify(e)+","+JSON.stringify(n)+",$event.key,"+JSON.stringify(r)+")"}var Ia={on:function(e,t){e.wrapListeners=function(e){return"_g("+e+","+t.value+")"}},bind:function(e,t){e.wrapData=function(n){return"_b("+n+",'"+e.tag+"',"+t.value+","+(t.modifiers&&t.modifiers.prop?"true":"false")+(t.modifiers&&t.modifiers.sync?",true":"")+")"}},cloak:S},Fa=function(e){this.options=e,this.warn=e.warn||Sr,this.transforms=Tr(e.modules,"transformCode"),this.dataGenFns=Tr(e.modules,"genData"),this.directives=A(A({},Ia),e.directives);var t=e.isReservedTag||T;this.maybeComponent=function(e){return!!e.component||!t(e.tag)},this.onceId=0,this.staticRenderFns=[],this.pre=!1};function Pa(e,t){var n=new Fa(t);return{render:"with(this){return "+(e?Ra(e,n):'_c("div")')+"}",staticRenderFns:n.staticRenderFns}}function Ra(e,t){if(e.parent&&(e.pre=e.pre||e.parent.pre),e.staticRoot&&!e.staticProcessed)return Ha(e,t);if(e.once&&!e.onceProcessed)return Ba(e,t);if(e.for&&!e.forProcessed)return za(e,t);if(e.if&&!e.ifProcessed)return Ua(e,t);if("template"!==e.tag||e.slotTarget||t.pre){if("slot"===e.tag)return function(e,t){var n=e.slotName||'"default"',r=qa(e,t),i="_t("+n+(r?","+r:""),o=e.attrs||e.dynamicAttrs?Ga((e.attrs||[]).concat(e.dynamicAttrs||[]).map(function(e){return{name:b(e.name),value:e.value,dynamic:e.dynamic}})):null,a=e.attrsMap["v-bind"];!o&&!a||r||(i+=",null");o&&(i+=","+o);a&&(i+=(o?"":",null")+","+a);return i+")"}(e,t);var n;if(e.component)n=function(e,t,n){var r=t.inlineTemplate?null:qa(t,n,!0);return"_c("+e+","+Va(t,n)+(r?","+r:"")+")"}(e.component,e,t);else{var r;(!e.plain||e.pre&&t.maybeComponent(e))&&(r=Va(e,t));var i=e.inlineTemplate?null:qa(e,t,!0);n="_c('"+e.tag+"'"+(r?","+r:"")+(i?","+i:"")+")"}for(var o=0;o<t.transforms.length;o++)n=t.transforms[o](e,n);return n}return qa(e,t)||"void 0"}function Ha(e,t){e.staticProcessed=!0;var n=t.pre;return e.pre&&(t.pre=e.pre),t.staticRenderFns.push("with(this){return "+Ra(e,t)+"}"),t.pre=n,"_m("+(t.staticRenderFns.length-1)+(e.staticInFor?",true":"")+")"}function Ba(e,t){if(e.onceProcessed=!0,e.if&&!e.ifProcessed)return Ua(e,t);if(e.staticInFor){for(var n="",r=e.parent;r;){if(r.for){n=r.key;break}r=r.parent}return n?"_o("+Ra(e,t)+","+t.onceId+++","+n+")":Ra(e,t)}return Ha(e,t)}function Ua(e,t,n,r){return e.ifProcessed=!0,function e(t,n,r,i){if(!t.length)return i||"_e()";var o=t.shift();return o.exp?"("+o.exp+")?"+a(o.block)+":"+e(t,n,r,i):""+a(o.block);function a(e){return r?r(e,n):e.once?Ba(e,n):Ra(e,n)}}(e.ifConditions.slice(),t,n,r)}function za(e,t,n,r){var i=e.for,o=e.alias,a=e.iterator1?","+e.iterator1:"",s=e.iterator2?","+e.iterator2:"";return e.forProcessed=!0,(r||"_l")+"(("+i+"),function("+o+a+s+"){return "+(n||Ra)(e,t)+"})"}function Va(e,t){var n="{",r=function(e,t){var n=e.directives;if(!n)return;var r,i,o,a,s="directives:[",c=!1;for(r=0,i=n.length;r<i;r++){o=n[r],a=!0;var u=t.directives[o.name];u&&(a=!!u(e,o,t.warn)),a&&(c=!0,s+='{name:"'+o.name+'",rawName:"'+o.rawName+'"'+(o.value?",value:("+o.value+"),expression:"+JSON.stringify(o.value):"")+(o.arg?",arg:"+(o.isDynamicArg?o.arg:'"'+o.arg+'"'):"")+(o.modifiers?",modifiers:"+JSON.stringify(o.modifiers):"")+"},")}if(c)return s.slice(0,-1)+"]"}(e,t);r&&(n+=r+","),e.key&&(n+="key:"+e.key+","),e.ref&&(n+="ref:"+e.ref+","),e.refInFor&&(n+="refInFor:true,"),e.pre&&(n+="pre:true,"),e.component&&(n+='tag:"'+e.tag+'",');for(var i=0;i<t.dataGenFns.length;i++)n+=t.dataGenFns[i](e);if(e.attrs&&(n+="attrs:"+Ga(e.attrs)+","),e.props&&(n+="domProps:"+Ga(e.props)+","),e.events&&(n+=Da(e.events,!1)+","),e.nativeEvents&&(n+=Da(e.nativeEvents,!0)+","),e.slotTarget&&!e.slotScope&&(n+="slot:"+e.slotTarget+","),e.scopedSlots&&(n+=function(e,t,n){var r=e.for||Object.keys(t).some(function(e){var n=t[e];return n.slotTargetDynamic||n.if||n.for||Ka(n)}),i=!!e.if;if(!r)for(var o=e.parent;o;){if(o.slotScope&&o.slotScope!==ca||o.for){r=!0;break}o.if&&(i=!0),o=o.parent}var a=Object.keys(t).map(function(e){return Ja(t[e],n)}).join(",");return"scopedSlots:_u(["+a+"]"+(r?",null,true":"")+(!r&&i?",null,false,"+function(e){var t=5381,n=e.length;for(;n;)t=33*t^e.charCodeAt(--n);return t>>>0}(a):"")+")"}(e,e.scopedSlots,t)+","),e.model&&(n+="model:{value:"+e.model.value+",callback:"+e.model.callback+",expression:"+e.model.expression+"},"),e.inlineTemplate){var o=function(e,t){var n=e.children[0];if(n&&1===n.type){var r=Pa(n,t.options);return"inlineTemplate:{render:function(){"+r.render+"},staticRenderFns:["+r.staticRenderFns.map(function(e){return"function(){"+e+"}"}).join(",")+"]}"}}(e,t);o&&(n+=o+",")}return n=n.replace(/,$/,"")+"}",e.dynamicAttrs&&(n="_b("+n+',"'+e.tag+'",'+Ga(e.dynamicAttrs)+")"),e.wrapData&&(n=e.wrapData(n)),e.wrapListeners&&(n=e.wrapListeners(n)),n}function Ka(e){return 1===e.type&&("slot"===e.tag||e.children.some(Ka))}function Ja(e,t){var n=e.attrsMap["slot-scope"];if(e.if&&!e.ifProcessed&&!n)return Ua(e,t,Ja,"null");if(e.for&&!e.forProcessed)return za(e,t,Ja);var r=e.slotScope===ca?"":String(e.slotScope),i="function("+r+"){return "+("template"===e.tag?e.if&&n?"("+e.if+")?"+(qa(e,t)||"undefined")+":undefined":qa(e,t)||"undefined":Ra(e,t))+"}",o=r?"":",proxy:true";return"{key:"+(e.slotTarget||'"default"')+",fn:"+i+o+"}"}function qa(e,t,n,r,i){var o=e.children;if(o.length){var a=o[0];if(1===o.length&&a.for&&"template"!==a.tag&&"slot"!==a.tag){var s=n?t.maybeComponent(a)?",1":",0":"";return""+(r||Ra)(a,t)+s}var c=n?function(e,t){for(var n=0,r=0;r<e.length;r++){var i=e[r];if(1===i.type){if(Wa(i)||i.ifConditions&&i.ifConditions.some(function(e){return Wa(e.block)})){n=2;break}(t(i)||i.ifConditions&&i.ifConditions.some(function(e){return t(e.block)}))&&(n=1)}}return n}(o,t.maybeComponent):0,u=i||Za;return"["+o.map(function(e){return u(e,t)}).join(",")+"]"+(c?","+c:"")}}function Wa(e){return void 0!==e.for||"template"===e.tag||"slot"===e.tag}function Za(e,t){return 1===e.type?Ra(e,t):3===e.type&&e.isComment?(r=e,"_e("+JSON.stringify(r.text)+")"):"_v("+(2===(n=e).type?n.expression:Xa(JSON.stringify(n.text)))+")";var n,r}function Ga(e){for(var t="",n="",r=0;r<e.length;r++){var i=e[r],o=Xa(i.value);i.dynamic?n+=i.name+","+o+",":t+='"'+i.name+'":'+o+","}return t="{"+t.slice(0,-1)+"}",n?"_d("+t+",["+n.slice(0,-1)+"])":t}function Xa(e){return e.replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}new RegExp("\\b"+"do,if,for,let,new,try,var,case,else,with,await,break,catch,class,const,super,throw,while,yield,delete,export,import,return,switch,default,extends,finally,continue,debugger,function,arguments".split(",").join("\\b|\\b")+"\\b");function Ya(e,t){try{return new Function(e)}catch(n){return t.push({err:n,code:e}),S}}function Qa(e){var t=Object.create(null);return function(n,r,i){(r=A({},r)).warn;delete r.warn;var o=r.delimiters?String(r.delimiters)+n:n;if(t[o])return t[o];var a=e(n,r),s={},c=[];return s.render=Ya(a.render,c),s.staticRenderFns=a.staticRenderFns.map(function(e){return Ya(e,c)}),t[o]=s}}var es,ts,ns=(es=function(e,t){var n=la(e.trim(),t);!1!==t.optimize&&ka(n,t);var r=Pa(n,t);return{ast:n,render:r.render,staticRenderFns:r.staticRenderFns}},function(e){function t(t,n){var r=Object.create(e),i=[],o=[];if(n)for(var a in n.modules&&(r.modules=(e.modules||[]).concat(n.modules)),n.directives&&(r.directives=A(Object.create(e.directives||null),n.directives)),n)"modules"!==a&&"directives"!==a&&(r[a]=n[a]);r.warn=function(e,t,n){(n?o:i).push(e)};var s=es(t.trim(),r);return s.errors=i,s.tips=o,s}return{compile:t,compileToFunctions:Qa(t)}})(Ca),rs=(ns.compile,ns.compileToFunctions);function is(e){return(ts=ts||document.createElement("div")).innerHTML=e?'<a href="\n"/>':'<div a="\n"/>',ts.innerHTML.indexOf("&#10;")>0}var os=!!z&&is(!1),as=!!z&&is(!0),ss=g(function(e){var t=Yn(e);return t&&t.innerHTML}),cs=wn.prototype.$mount;return wn.prototype.$mount=function(e,t){if((e=e&&Yn(e))===document.body||e===document.documentElement)return this;var n=this.$options;if(!n.render){var r=n.template;if(r)if("string"==typeof r)"#"===r.charAt(0)&&(r=ss(r));else{if(!r.nodeType)return this;r=r.innerHTML}else e&&(r=function(e){if(e.outerHTML)return e.outerHTML;var t=document.createElement("div");return t.appendChild(e.cloneNode(!0)),t.innerHTML}(e));if(r){var i=rs(r,{outputSourceRange:!1,shouldDecodeNewlines:os,shouldDecodeNewlinesForHref:as,delimiters:n.delimiters,comments:n.comments},this),o=i.render,a=i.staticRenderFns;n.render=o,n.staticRenderFns=a}}return cs.call(this,e,t)},wn.compile=rs,wn});
static/templates/base.html ADDED
@@ -0,0 +1,48 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {{ define "header" }}
2
+ <!DOCTYPE html>
3
+ <html lang="en">
4
+ <head>
5
+ <title>{{ if .Data.Title }} {{ .Data.Title }} - Niltalk {{ else }}Niltalk &mdash; Instant disposable chat rooms{{ end }}</title>
6
+ <base href="{{ .Config.RootURL }}">
7
+ <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
8
+ <meta name="description" content="{{ .Data.Description }}" />
9
+ <meta name="keywords" content="instant chat, disposable chat" />
10
+ <meta name="viewport" content="width=device-width, initial-scale=1, minimum-scale=1" />
11
+ <meta property="og:image" content="/static/images/thumbnail.png" />
12
+ <link rel="shortcut icon" href="/static/images/favicon.png" type="image/x-icon" />
13
+ <link href="https://fonts.googleapis.com/css?family=Inter:400,500&display=swap" rel="stylesheet">
14
+ <link href="/static/style.css" rel="stylesheet" />
15
+ <script>
16
+ {{ if .Data.Room }}
17
+ window._room = {
18
+ id: "{{ .Data.Room.ID }}",
19
+ name: "{{ .Data.Room.Name }}",
20
+ auth: {{ .Data.Auth }}
21
+ };
22
+ {{ end }}
23
+ </script>
24
+ </head>
25
+ <body>
26
+ <div class="container">
27
+ <header class="header">
28
+ <div class="logo">
29
+ <a href="{{ .Config.RootURL }}"><img src="/static/images/logo.png" /></a>
30
+ </div>
31
+ </header>
32
+ <div id="app" v-cloak>
33
+ {{ end }}
34
+
35
+
36
+
37
+ {{ define "footer" }}
38
+ <div v-if="notifMessage" :class="notifType" class="notification">{( notifMessage )}</div>
39
+ </div><!-- app -->
40
+ </div><!-- container -->
41
+
42
+ <script src="/static/vue.min.js"></script>
43
+ <script src="/static/client.js"></script>
44
+ <script src="/static/app.js"></script>
45
+
46
+ </body>
47
+ </html>
48
+ {{ end }}
static/templates/error.html ADDED
@@ -0,0 +1,10 @@
 
 
 
 
 
 
 
 
 
 
 
1
+ {{ define "error" }}
2
+ {{ template "header" }}
3
+ <div id="error" class="compact">
4
+ <h1>{{.ErrorTitle}}</h1>
5
+ {{if .ErrorDescription}}
6
+ {{.ErrorDescription}}
7
+ {{end}}
8
+ </div>
9
+ {{ template "footer" }}
10
+ {{ end }}
static/templates/index.html ADDED
@@ -0,0 +1,55 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {{define "index"}}
2
+ {{ template "header" . }}
3
+ <section class="intro">
4
+ <div class="splash">
5
+ <img src="/static/images/chat.png" alt="" />
6
+ </div>
7
+
8
+ <div class="create">
9
+ <h1>Instant disposable chat rooms</h1>
10
+ <form v-on:submit.prevent="handleCreateRoom" method="post">
11
+ <fieldset :disabled="isBusy">
12
+ <p>
13
+ <input v-model="password" :autofocus="'autofocus'" name="password" type="password"
14
+ placeholder="Password" required minlength="6" maxlength="100" />
15
+ </p>
16
+ <p>
17
+ <input v-model="roomName" name="name" type="text"
18
+ placeholder="Room name (optional)" minlength="3" maxlength="100" />
19
+ </p>
20
+ <p>
21
+ <input type="submit" class="button" value="Create room" />
22
+ </p>
23
+ </fieldset>
24
+ </form>
25
+ </div>
26
+ </section>
27
+
28
+ <article class="faq">
29
+ <h2>How does it work?</h2>
30
+ <div class="entry">
31
+ <p>Create instant, password protected chat rooms without the
32
+ need to signup. Simply click the "Create" button, and share the unique chat URL with your peers.</p>
33
+
34
+ <p>
35
+ A room has a lifetime of {{ .Config.RoomAge }} before the first login.
36
+ Up to {{ .Config.MaxPeersPerRoom }} peers can join a room.
37
+ Rooms are automatically deleted after {{ .Config.RoomTimeout }} of inactivity (no messages exchanged).</p>
38
+ <p>
39
+ While in a room, any of the peers can dispose of the room with the click of a button.
40
+ </p>
41
+ </div>
42
+ <div class="entry">
43
+ <h2>Why can any connected peer dispose of a room?</h2>
44
+ <p>Niltalk is meant for holding short private conversations between groups of people who have mutually
45
+ agreed to converse. There is no concept of ownership of a room, and introducing ownership complicates
46
+ the otherwise simple privacy feature of instant disposal by any participant. This also means that Niltalk
47
+ isn't really meant for starting conversations by opening up a room to a large number of uninvited participants.</p>
48
+ </div>
49
+ </article>
50
+ <p class="text-center">
51
+ <a class="github-button" href="https://github.com/knadh/niltalk" data-size="large" data-show-count="true" aria-label="Star knadh/niltalk on GitHub">Star</a>
52
+ </p>
53
+ <script async defer src="https://buttons.github.io/buttons.js"></script>
54
+ {{ template "footer" . }}
55
+ {{ end }}
static/templates/room-not-found.html ADDED
@@ -0,0 +1,11 @@
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {{ define "room-not-found" }}
2
+ {{ template "header" . }}
3
+ <div id="error" class="compact">
4
+ <h1>Room not found</h1>
5
+ <p>
6
+ That room was not found. It may have been deleted or may have expired.
7
+ <a href="/">Create a new room</a>.
8
+ </p>
9
+ </div>
10
+ {{ template "footer" . }}
11
+ {{ end }}
static/templates/room.html ADDED
@@ -0,0 +1,127 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {{ define "room" }}
2
+ {{ template "header" . }}
3
+
4
+ <!-- Login form. -->
5
+ <form v-if="!chatOn && !disposed" v-on:submit.prevent="handleLogin" method="post" autocomplete="off" class="form-login">
6
+ <fieldset>
7
+ <h1>
8
+ {{ if .Data.Room.Name }}
9
+ {{ .Data.Room.Name }} (#{{ .Data.Room.ID }})
10
+ {{ else }}
11
+ #{{ .Data.Room.ID }}
12
+ {{ end }}
13
+ </h1>
14
+ <h3>Join room</h3>
15
+ <p>
16
+ <input :autofocus="'autofocus'" v-model="password" ref="form-password" type="password" name="password" placeholder="Password"
17
+ required minlength="6" maxlength="100" autocomplete="off" />
18
+ </p>
19
+ <p>
20
+ <input v-model="handle" type="text" name="handle" placeholder="Nick name (optional)" pattern=".{3,30}"
21
+ maxlength="30" autocomplete="off" />
22
+ <span class="help">3 to 30 characters</span>
23
+ </p>
24
+ <p>
25
+ <input type="submit" class="button" value="Login" />
26
+ </p>
27
+ </fieldset>
28
+ <expand-link link="{{ .Config.RootURL }}/r/{{ .Data.Room.ID }}"></expand-link>
29
+ </form>
30
+
31
+ <!-- Chat area. -->
32
+ <section v-if="chatOn">
33
+ <section class="chat">
34
+ <span class="sidebar-handle" v-on:click.prevent="toggleSidebar">
35
+ {( sidebarOn ? "&rarr;" : "&larr;" )}
36
+ <span class="icon">👥<sup>{( peers.length )}</sup></span>
37
+ </span>
38
+ <div class="messages" ref="messages">
39
+ <ul class="no peers">
40
+ <li v-for="m in messages" class="message">
41
+ <div class="wrap" v-if="m.type === Client.MsgType['message']">
42
+ <div class="meta">
43
+ <span class="peer">
44
+ <span class="avatar" :style="{'background-color': m.peer.avatar}"></span>
45
+ <span class="handle">{( m.peer.handle )}</span>
46
+ </span>
47
+ <span class="timestamp" :title="m.timestamp">{( formatDate(m.timestamp) )}</span>
48
+ </div>
49
+ <div class="content" v-html="formatMessage(m.message)"></div>
50
+ </div>
51
+ <div class="wrap notice" v-else>
52
+ <span class="timestamp" :title="m.timestamp">{( formatDate(m.timestamp) )}</span>
53
+ &mdash;
54
+ <span class="peer">
55
+ <span class="avatar" :style="{'background-color': m.peer.avatar}"></span>
56
+ <span class="handle">{( m.peer.handle )}</span>
57
+ {(m.type === Client.MsgType['peer.join'] ? "joined" : "left")}
58
+ </span>
59
+ </div>
60
+ </li>
61
+ </ul>
62
+ </div>
63
+ <div v-if="sidebarOn" class="sidebar">
64
+ <h2 class="title">
65
+ <span v-if="peers.length > 1">{( peers.length )} peers</span>
66
+ <span v-else>Just you</span>
67
+ </h2>
68
+ <ul class="no peers">
69
+ <li v-for="p in peers">
70
+ <span class="peer">
71
+ <span class="avatar" :style="{'background-color': p.avatar}"></span>
72
+ <span class="handle">{( p.handle )}
73
+ {( p.id === self.id ? "*" : "" )}</span>
74
+ </span>
75
+ </li>
76
+ </ul>
77
+ </div>
78
+ </section>
79
+ <form v-on:submit.prevent="handleSendMessage" method="post" class="form-chat">
80
+ <div class="container">
81
+ <fieldset>
82
+ <div v-if="typingPeers.size > 0" class="typing">
83
+ <span class="dot-spinner"><i></i><i></i><i></i><i></i></span>
84
+ <span class="handle" v-for="p in Array.from(typingPeers)">{( p[1].handle )}</span>
85
+ </div>
86
+ <textarea ref="form-message" v-on:keydown="handleChatKeyPress" v-model="message" :autofocus="'autofocus'"
87
+ placeholder="Message" class="charlimited" maxlength="{{ .Config.MaxMessageLen }}"></textarea>
88
+ <div class="controls">
89
+ <button type="submit" class="button">Send</button>
90
+
91
+ <div class="right">
92
+ <a href="" v-on:click.prevent="handleLogout" class="btn-dispose">Logout</a>
93
+ <a href="" v-on:click.prevent="handleDisposeRoom" class="btn-dispose">Dispose &times;</a>
94
+ </div>
95
+ <!-- <div class="sounds">
96
+ <input v-model="hasSound" type="checkbox" checked="true" id="chk-sounds" />
97
+ <label for="chk-sounds"></label>
98
+ </div> -->
99
+ </div>
100
+ </fieldset>
101
+ </div>
102
+ <!-- <div class="row">
103
+ <div class="room-url">
104
+ <a href="#" data-value="{{ .Config.RootURL }}/r/{{ .Data.Room.ID }}">&#9741;</a>
105
+ </div>
106
+ </div> -->
107
+ </form>
108
+ </section>
109
+
110
+ <div v-if="disposed">
111
+ <h1>Room diposed</h1>
112
+ <p>
113
+ The room was disposed of and is now unavailable. <a href="/">Create a new room</a>.
114
+ </p>
115
+ </div>
116
+
117
+ <audio id="beep">
118
+ <source src="{{ .Config.RootURL }}/static/beep.ogg" type="audio/ogg">
119
+ <source src="{{ .Config.RootURL }}/static/beep.mp3" type="audio/mpeg">
120
+ </audio>
121
+
122
+ <!-- <div class="reconnect">
123
+ <h1>Disconnected.</h1>
124
+ </div> -->
125
+
126
+ {{ template "footer" . }}
127
+ {{end}}
store/fs/fs.go ADDED
@@ -0,0 +1,288 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ package fs
2
+
3
+ import (
4
+ "encoding/json"
5
+ "fmt"
6
+ "io/ioutil"
7
+ "log"
8
+ "os"
9
+ "sync"
10
+ "time"
11
+
12
+ "github.com/knadh/niltalk/store"
13
+ )
14
+
15
+ // Config represents the file store config structure.
16
+ type Config struct {
17
+ Path string `koanf:"path"`
18
+ }
19
+
20
+ // File represents the file implementation of the Store interface.
21
+ type File struct {
22
+ cfg *Config
23
+ rooms map[string]*room
24
+ data map[string][]byte
25
+ mu sync.Mutex
26
+ dirty bool
27
+ log *log.Logger
28
+ }
29
+
30
+ type room struct {
31
+ store.Room
32
+ Sessions map[string]string
33
+ Expire time.Time
34
+ }
35
+
36
+ // New returns a new Redis store.
37
+ func New(cfg Config, log *log.Logger) (*File, error) {
38
+ store := &File{
39
+ cfg: &cfg,
40
+ rooms: map[string]*room{},
41
+ data: map[string][]byte{},
42
+ log: log,
43
+ }
44
+ err := store.load()
45
+ go store.watch()
46
+ return store, err
47
+ }
48
+
49
+ // watch the store to clean it up.
50
+ func (m *File) watch() {
51
+ t := time.NewTicker(time.Minute)
52
+ defer t.Stop()
53
+ for range t.C {
54
+ m.cleanup()
55
+ m.save()
56
+ }
57
+ }
58
+
59
+ // cleanup the store to removes expired items.
60
+ func (m *File) cleanup() {
61
+ m.mu.Lock()
62
+ defer m.mu.Unlock()
63
+
64
+ now := time.Now()
65
+
66
+ for id, r := range m.rooms {
67
+ if r.Expire.Before(now) {
68
+ delete(m.rooms, id)
69
+ m.dirty = true
70
+ continue
71
+ }
72
+ }
73
+ }
74
+
75
+ // load the data from the file system.
76
+ func (m *File) load() error {
77
+ if _, err := os.Stat(m.cfg.Path); os.IsExist(err) {
78
+ x := struct {
79
+ Rooms map[string]*room
80
+ Data map[string][]byte
81
+ }{}
82
+ var data []byte
83
+ data, err = ioutil.ReadFile(m.cfg.Path)
84
+ if err != nil {
85
+ return err
86
+ }
87
+ err = json.Unmarshal(data, &x)
88
+ if err != nil {
89
+ return err
90
+ }
91
+ m.rooms = x.Rooms
92
+ m.data = x.Data
93
+ }
94
+ return nil
95
+ }
96
+
97
+ // save the data to the file system.
98
+ func (m *File) save() {
99
+ m.mu.Lock()
100
+ defer m.mu.Unlock()
101
+ if m.dirty {
102
+ data, err := json.Marshal(struct {
103
+ Rooms map[string]*room
104
+ Data map[string][]byte
105
+ }{
106
+ Rooms: m.rooms,
107
+ Data: m.data,
108
+ })
109
+ if err == nil {
110
+ m.dirty = false
111
+ go func() {
112
+ err := ioutil.WriteFile(m.cfg.Path, data, os.ModePerm)
113
+ if err != nil {
114
+ m.log.Printf("error writing file %q: %v", m.cfg.Path, err)
115
+ }
116
+ }()
117
+ }
118
+ }
119
+ }
120
+
121
+ // AddRoom adds a room to the store.
122
+ func (m *File) AddRoom(r store.Room, ttl time.Duration) error {
123
+ m.mu.Lock()
124
+ defer m.mu.Unlock()
125
+
126
+ key := r.ID
127
+ m.rooms[key] = &room{
128
+ Room: r,
129
+ Expire: r.CreatedAt.Add(ttl),
130
+ Sessions: map[string]string{},
131
+ }
132
+ m.dirty = true
133
+
134
+ return nil
135
+ }
136
+
137
+ // ExtendRoomTTL extends a room's TTL.
138
+ func (m *File) ExtendRoomTTL(id string, ttl time.Duration) error {
139
+ m.mu.Lock()
140
+ defer m.mu.Unlock()
141
+
142
+ room, ok := m.rooms[id]
143
+ if !ok {
144
+ return store.ErrRoomNotFound
145
+ }
146
+
147
+ room.Expire = room.Expire.Add(ttl)
148
+ m.rooms[id] = room
149
+ m.dirty = true
150
+ return nil
151
+ }
152
+
153
+ // GetRoom gets a room from the store.
154
+ func (m *File) GetRoom(id string) (store.Room, error) {
155
+ m.mu.Lock()
156
+ defer m.mu.Unlock()
157
+
158
+ out, ok := m.rooms[id]
159
+
160
+ if !ok {
161
+ return out.Room, store.ErrRoomNotFound
162
+ }
163
+ return out.Room, nil
164
+ }
165
+
166
+ // RoomExists checks if a room exists in the store.
167
+ func (m *File) RoomExists(id string) (bool, error) {
168
+ m.mu.Lock()
169
+ defer m.mu.Unlock()
170
+
171
+ _, ok := m.rooms[id]
172
+
173
+ return ok, nil
174
+ }
175
+
176
+ // RemoveRoom deletes a room from the store.
177
+ func (m *File) RemoveRoom(id string) error {
178
+ m.mu.Lock()
179
+ defer m.mu.Unlock()
180
+
181
+ if _, ok := m.rooms[id]; ok {
182
+ delete(m.rooms, id)
183
+ m.dirty = true
184
+ }
185
+
186
+ return nil
187
+ }
188
+
189
+ // AddSession adds a sessionID room to the store.
190
+ func (m *File) AddSession(sessID, handle, roomID string, ttl time.Duration) error {
191
+ m.mu.Lock()
192
+ defer m.mu.Unlock()
193
+
194
+ room, ok := m.rooms[roomID]
195
+
196
+ if !ok {
197
+ return store.ErrRoomNotFound
198
+ }
199
+
200
+ room.Sessions[sessID] = handle
201
+ m.rooms[roomID] = room
202
+ m.dirty = true
203
+
204
+ return nil
205
+ }
206
+
207
+ // GetSession retrieves a peer session from the store.
208
+ func (m *File) GetSession(sessID, roomID string) (store.Sess, error) {
209
+ m.mu.Lock()
210
+ defer m.mu.Unlock()
211
+
212
+ room, ok := m.rooms[roomID]
213
+
214
+ if !ok {
215
+ return store.Sess{}, store.ErrRoomNotFound
216
+ }
217
+
218
+ handle, ok := room.Sessions[sessID]
219
+
220
+ if !ok {
221
+ return store.Sess{}, nil
222
+ }
223
+
224
+ return store.Sess{
225
+ ID: sessID,
226
+ Handle: handle,
227
+ }, nil
228
+ }
229
+
230
+ // RemoveSession deletes a session ID from a room.
231
+ func (m *File) RemoveSession(sessID, roomID string) error {
232
+ m.mu.Lock()
233
+ defer m.mu.Unlock()
234
+
235
+ room, ok := m.rooms[roomID]
236
+
237
+ if !ok {
238
+ return store.ErrRoomNotFound
239
+ }
240
+
241
+ if _, ok := room.Sessions[sessID]; ok {
242
+ delete(room.Sessions, sessID)
243
+ m.rooms[roomID] = room
244
+ m.dirty = true
245
+ }
246
+
247
+ return nil
248
+ }
249
+
250
+ // ClearSessions deletes all the sessions in a room.
251
+ func (m *File) ClearSessions(roomID string) error {
252
+ m.mu.Lock()
253
+ defer m.mu.Unlock()
254
+
255
+ room, ok := m.rooms[roomID]
256
+
257
+ if !ok {
258
+ return store.ErrRoomNotFound
259
+ }
260
+
261
+ room.Sessions = map[string]string{}
262
+
263
+ m.rooms[roomID] = room
264
+ m.dirty = true
265
+
266
+ return nil
267
+ }
268
+
269
+ // Get value from a key.
270
+ func (m *File) Get(key string) ([]byte, error) {
271
+ m.mu.Lock()
272
+ defer m.mu.Unlock()
273
+ d, ok := m.data[key]
274
+ if !ok {
275
+ return nil, fmt.Errorf("key %q not found", key)
276
+ }
277
+ return d, nil
278
+ }
279
+
280
+ // Set a value.
281
+ func (m *File) Set(key string, data []byte) error {
282
+ m.mu.Lock()
283
+ defer m.mu.Unlock()
284
+ m.data[key] = make([]byte, len(data), len(data))
285
+ copy(m.data[key], data)
286
+ m.dirty = true
287
+ return nil
288
+ }
store/mem/mem.go ADDED
@@ -0,0 +1,218 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ package mem
2
+
3
+ import (
4
+ "fmt"
5
+ "sync"
6
+ "time"
7
+
8
+ "github.com/knadh/niltalk/store"
9
+ )
10
+
11
+ // Config represents the InMemory store config structure.
12
+ type Config struct{}
13
+
14
+ // InMemory represents the in-memory implementation of the Store interface.
15
+ type InMemory struct {
16
+ cfg *Config
17
+ rooms map[string]*room
18
+ data map[string][]byte
19
+ mu sync.Mutex
20
+ }
21
+
22
+ type room struct {
23
+ store.Room
24
+ Sessions map[string]string
25
+ Expire time.Time
26
+ }
27
+
28
+ // New returns a new Redis store.
29
+ func New(cfg Config) (*InMemory, error) {
30
+ store := &InMemory{
31
+ cfg: &cfg,
32
+ rooms: map[string]*room{},
33
+ data: map[string][]byte{},
34
+ }
35
+ go store.watch()
36
+ return store, nil
37
+ }
38
+
39
+ // watch the store to clean it up.
40
+ func (m *InMemory) watch() {
41
+ t := time.NewTicker(time.Minute)
42
+ defer t.Stop()
43
+ for range t.C {
44
+ m.cleanup()
45
+ }
46
+ }
47
+
48
+ // cleanup the store to removes expired items.
49
+ func (m *InMemory) cleanup() {
50
+ m.mu.Lock()
51
+ defer m.mu.Unlock()
52
+
53
+ now := time.Now()
54
+
55
+ for id, r := range m.rooms {
56
+ if r.Expire.Before(now) {
57
+ delete(m.rooms, id)
58
+ continue
59
+ }
60
+ }
61
+ }
62
+
63
+ // AddRoom adds a room to the store.
64
+ func (m *InMemory) AddRoom(r store.Room, ttl time.Duration) error {
65
+ m.mu.Lock()
66
+ defer m.mu.Unlock()
67
+
68
+ m.rooms[r.ID] = &room{
69
+ Room: r,
70
+ Expire: r.CreatedAt.Add(ttl),
71
+ Sessions: map[string]string{},
72
+ }
73
+
74
+ return nil
75
+ }
76
+
77
+ // ExtendRoomTTL extends a room's TTL.
78
+ func (m *InMemory) ExtendRoomTTL(id string, ttl time.Duration) error {
79
+ m.mu.Lock()
80
+ defer m.mu.Unlock()
81
+
82
+ room, ok := m.rooms[id]
83
+ if !ok {
84
+ return store.ErrRoomNotFound
85
+ }
86
+
87
+ room.Expire = room.Expire.Add(ttl)
88
+ m.rooms[id] = room
89
+ return nil
90
+ }
91
+
92
+ // GetRoom gets a room from the store.
93
+ func (m *InMemory) GetRoom(id string) (store.Room, error) {
94
+ m.mu.Lock()
95
+ defer m.mu.Unlock()
96
+
97
+ out, ok := m.rooms[id]
98
+
99
+ if !ok {
100
+ return out.Room, store.ErrRoomNotFound
101
+ }
102
+ return out.Room, nil
103
+ }
104
+
105
+ // RoomExists checks if a room exists in the store.
106
+ func (m *InMemory) RoomExists(id string) (bool, error) {
107
+ m.mu.Lock()
108
+ defer m.mu.Unlock()
109
+
110
+ _, ok := m.rooms[id]
111
+
112
+ return ok, nil
113
+ }
114
+
115
+ // RemoveRoom deletes a room from the store.
116
+ func (m *InMemory) RemoveRoom(id string) error {
117
+ m.mu.Lock()
118
+ defer m.mu.Unlock()
119
+
120
+ delete(m.rooms, id)
121
+
122
+ return nil
123
+ }
124
+
125
+ // AddSession adds a sessionID room to the store.
126
+ func (m *InMemory) AddSession(sessID, handle, roomID string, ttl time.Duration) error {
127
+ m.mu.Lock()
128
+ defer m.mu.Unlock()
129
+
130
+ room, ok := m.rooms[roomID]
131
+
132
+ if !ok {
133
+ return store.ErrRoomNotFound
134
+ }
135
+
136
+ room.Sessions[sessID] = handle
137
+ m.rooms[roomID] = room
138
+
139
+ return nil
140
+ }
141
+
142
+ // GetSession retrieves a peer session from the store.
143
+ func (m *InMemory) GetSession(sessID, roomID string) (store.Sess, error) {
144
+ m.mu.Lock()
145
+ defer m.mu.Unlock()
146
+
147
+ room, ok := m.rooms[roomID]
148
+
149
+ if !ok {
150
+ return store.Sess{}, store.ErrRoomNotFound
151
+ }
152
+
153
+ handle, ok := room.Sessions[sessID]
154
+
155
+ if !ok {
156
+ return store.Sess{}, nil
157
+ }
158
+
159
+ return store.Sess{
160
+ ID: sessID,
161
+ Handle: handle,
162
+ }, nil
163
+ }
164
+
165
+ // RemoveSession deletes a session ID from a room.
166
+ func (m *InMemory) RemoveSession(sessID, roomID string) error {
167
+ m.mu.Lock()
168
+ defer m.mu.Unlock()
169
+
170
+ room, ok := m.rooms[roomID]
171
+
172
+ if !ok {
173
+ return store.ErrRoomNotFound
174
+ }
175
+
176
+ delete(room.Sessions, sessID)
177
+ m.rooms[roomID] = room
178
+
179
+ return nil
180
+ }
181
+
182
+ // ClearSessions deletes all the sessions in a room.
183
+ func (m *InMemory) ClearSessions(roomID string) error {
184
+ m.mu.Lock()
185
+ defer m.mu.Unlock()
186
+
187
+ room, ok := m.rooms[roomID]
188
+
189
+ if !ok {
190
+ return store.ErrRoomNotFound
191
+ }
192
+
193
+ room.Sessions = map[string]string{}
194
+
195
+ m.rooms[roomID] = room
196
+
197
+ return nil
198
+ }
199
+
200
+ // Get value from a key.
201
+ func (m *InMemory) Get(key string) ([]byte, error) {
202
+ m.mu.Lock()
203
+ defer m.mu.Unlock()
204
+ d, ok := m.data[key]
205
+ if !ok {
206
+ return nil, fmt.Errorf("key %q not found", key)
207
+ }
208
+ return d, nil
209
+ }
210
+
211
+ // Set a value.
212
+ func (m *InMemory) Set(key string, data []byte) error {
213
+ m.mu.Lock()
214
+ defer m.mu.Unlock()
215
+ m.data[key] = make([]byte, len(data), len(data))
216
+ copy(m.data[key], data)
217
+ return nil
218
+ }
store/redis/redis.go ADDED
@@ -0,0 +1,205 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ package redis
2
+
3
+ import (
4
+ "fmt"
5
+ "time"
6
+
7
+ "github.com/gomodule/redigo/redis"
8
+ "github.com/knadh/niltalk/store"
9
+ )
10
+
11
+ // Config represents the Redis store config structure.
12
+ type Config struct {
13
+ Address string `koanf:"address"`
14
+ Password string `koanf:"password"`
15
+ DB int `koanf:"db"`
16
+ ActiveConns int `koanf:"active_conns"`
17
+ IdleConns int `koanf:"idle_conns"`
18
+ Timeout time.Duration `koanf:"timeout"`
19
+
20
+ PrefixRoom string `koanf:"prefix_room"`
21
+ PrefixSession string `koanf:"prefix_session"`
22
+ }
23
+
24
+ // Redis represents the Redis implementation of the Store interface.
25
+ type Redis struct {
26
+ cfg *Config
27
+ pool *redis.Pool
28
+ }
29
+
30
+ type room struct {
31
+ ID string `redis:"id"`
32
+ Name string `redis:"name"`
33
+ Password []byte `redis:"password"`
34
+ CreatedAt string `redis:"created_at"`
35
+ }
36
+
37
+ // New returns a new Redis store.
38
+ func New(cfg Config) (*Redis, error) {
39
+ pool := &redis.Pool{
40
+ Wait: true,
41
+ MaxActive: cfg.ActiveConns,
42
+ MaxIdle: cfg.IdleConns,
43
+ Dial: func() (redis.Conn, error) {
44
+ return redis.Dial(
45
+ "tcp",
46
+ cfg.Address,
47
+ redis.DialPassword(cfg.Password),
48
+ redis.DialConnectTimeout(cfg.Timeout),
49
+ redis.DialReadTimeout(cfg.Timeout),
50
+ redis.DialWriteTimeout(cfg.Timeout),
51
+ redis.DialDatabase(cfg.DB),
52
+ )
53
+ },
54
+ }
55
+
56
+ // Test connection.
57
+ c := pool.Get()
58
+ defer c.Close()
59
+
60
+ if err := c.Err(); err != nil {
61
+ return nil, err
62
+ }
63
+ return &Redis{cfg: &cfg, pool: pool}, nil
64
+ }
65
+
66
+ // AddRoom adds a room to the store.
67
+ func (r *Redis) AddRoom(room store.Room, ttl time.Duration) error {
68
+ c := r.pool.Get()
69
+ defer c.Close()
70
+
71
+ key := fmt.Sprintf(r.cfg.PrefixRoom, room.ID)
72
+ c.Send("HMSET", key,
73
+ "name", room.Name,
74
+ "created_at", room.CreatedAt.Format(time.RFC3339),
75
+ "password", room.Password)
76
+ c.Send("EXPIRE", key, int(ttl.Seconds()))
77
+ return c.Flush()
78
+ }
79
+
80
+ // ExtendRoomTTL extends a room's TTL.
81
+ func (r *Redis) ExtendRoomTTL(id string, ttl time.Duration) error {
82
+ c := r.pool.Get()
83
+ defer c.Close()
84
+
85
+ c.Send("EXPIRE", fmt.Sprintf(r.cfg.PrefixRoom, id), int(ttl.Seconds()))
86
+ c.Send("EXPIRE", fmt.Sprintf(r.cfg.PrefixSession, id), int(ttl.Seconds()))
87
+ return c.Flush()
88
+ }
89
+
90
+ // GetRoom gets a room from the store.
91
+ func (r *Redis) GetRoom(id string) (store.Room, error) {
92
+ c := r.pool.Get()
93
+ defer c.Close()
94
+
95
+ var (
96
+ out store.Room
97
+ room room
98
+ key = fmt.Sprintf(r.cfg.PrefixRoom, id)
99
+ )
100
+ res, err := redis.Values(c.Do("HGETALL", key))
101
+ if err != nil {
102
+ return out, err
103
+ }
104
+ if err := redis.ScanStruct(res, &room); err != nil {
105
+ return out, err
106
+ }
107
+
108
+ t, err := time.Parse(time.RFC3339, room.CreatedAt)
109
+ if err != nil {
110
+ return out, err
111
+ }
112
+ if t.Year() == 1 {
113
+ return out, store.ErrRoomNotFound
114
+ }
115
+ return store.Room{
116
+ ID: id,
117
+ Name: room.Name,
118
+ Password: room.Password,
119
+ CreatedAt: t,
120
+ }, nil
121
+ }
122
+
123
+ // RoomExists checks if a room exists in the store.
124
+ func (r *Redis) RoomExists(id string) (bool, error) {
125
+ c := r.pool.Get()
126
+ defer c.Close()
127
+
128
+ ok, err := redis.Bool(c.Do("EXISTS", fmt.Sprintf(r.cfg.PrefixRoom, id)))
129
+ if err != nil && err != redis.ErrNil {
130
+ return false, err
131
+ }
132
+ return ok, err
133
+ }
134
+
135
+ // RemoveRoom deletes a room from the store.
136
+ func (r *Redis) RemoveRoom(id string) error {
137
+ c := r.pool.Get()
138
+ defer c.Close()
139
+
140
+ _, err := redis.Bool(c.Do("DEL", fmt.Sprintf(r.cfg.PrefixRoom, id)))
141
+ return err
142
+ }
143
+
144
+ // AddSession adds a sessionID room to the store.
145
+ func (r *Redis) AddSession(sessID, handle, roomID string, ttl time.Duration) error {
146
+ c := r.pool.Get()
147
+ defer c.Close()
148
+
149
+ key := fmt.Sprintf(r.cfg.PrefixSession, roomID)
150
+ c.Send("HMSET", key, sessID, handle)
151
+ c.Send("EXPIRE", key, ttl.Seconds)
152
+ return c.Flush()
153
+ }
154
+
155
+ // GetSession retrieves a peer session from th store.
156
+ func (r *Redis) GetSession(sessID, roomID string) (store.Sess, error) {
157
+ c := r.pool.Get()
158
+ defer c.Close()
159
+
160
+ h, err := redis.String(c.Do("HGET", fmt.Sprintf(r.cfg.PrefixSession, roomID), sessID))
161
+ if err != nil && err != redis.ErrNil {
162
+ return store.Sess{}, err
163
+ }
164
+ if h == "" {
165
+ return store.Sess{}, nil
166
+ }
167
+
168
+ return store.Sess{
169
+ ID: sessID,
170
+ Handle: h,
171
+ }, nil
172
+ }
173
+
174
+ // RemoveSession deletes a session ID from a room.
175
+ func (r *Redis) RemoveSession(sessID, roomID string) error {
176
+ c := r.pool.Get()
177
+ defer c.Close()
178
+
179
+ _, err := redis.Bool(c.Do("HDEL", fmt.Sprintf(r.cfg.PrefixSession, roomID), sessID))
180
+ return err
181
+ }
182
+
183
+ // ClearSessions deletes all the sessions in a room.
184
+ func (r *Redis) ClearSessions(roomID string) error {
185
+ c := r.pool.Get()
186
+ defer c.Close()
187
+
188
+ _, err := redis.Bool(c.Do("DEL", fmt.Sprintf(r.cfg.PrefixSession, roomID)))
189
+ return err
190
+ }
191
+
192
+ // Get value from a key.
193
+ func (r *Redis) Get(key string) ([]byte, error) {
194
+ c := r.pool.Get()
195
+ defer c.Close()
196
+ return redis.Bytes(c.Do("GET", key))
197
+ }
198
+
199
+ // Set a value.
200
+ func (r *Redis) Set(key string, data []byte) error {
201
+ c := r.pool.Get()
202
+ defer c.Close()
203
+ _, err := c.Do("SET", key, data)
204
+ return err
205
+ }
store/store.go ADDED
@@ -0,0 +1,40 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ package store
2
+
3
+ import (
4
+ "errors"
5
+ "time"
6
+ )
7
+
8
+ // Store represents a backend store.
9
+ type Store interface {
10
+ AddRoom(r Room, ttl time.Duration) error
11
+ GetRoom(id string) (Room, error)
12
+ ExtendRoomTTL(id string, ttl time.Duration) error
13
+ RoomExists(id string) (bool, error)
14
+ RemoveRoom(id string) error
15
+
16
+ AddSession(sessID, handle, roomID string, ttl time.Duration) error
17
+ GetSession(sessID, roomID string) (Sess, error)
18
+ RemoveSession(sessID, roomID string) error
19
+ ClearSessions(roomID string) error
20
+
21
+ Get(key string) ([]byte, error)
22
+ Set(key string, value []byte) error
23
+ }
24
+
25
+ // Room represents the properties of a room in the store.
26
+ type Room struct {
27
+ ID string `json:"id"`
28
+ Name string `json:"name"`
29
+ Password []byte `json:"password"`
30
+ CreatedAt time.Time `json:"created_at"`
31
+ }
32
+
33
+ // Sess represents an authenticated peer session.
34
+ type Sess struct {
35
+ ID string `json:"id"`
36
+ Handle string `json:"name"`
37
+ }
38
+
39
+ // ErrRoomNotFound indicates that the requested room was not found.
40
+ var ErrRoomNotFound = errors.New("room not found")
tor.go ADDED
@@ -0,0 +1,91 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ package main
2
+
3
+ import (
4
+ "context"
5
+ "crypto/ed25519"
6
+ "crypto/rand"
7
+ "crypto/x509"
8
+ "encoding/pem"
9
+ "fmt"
10
+ "io/ioutil"
11
+ "net/http"
12
+ "time"
13
+
14
+ "github.com/clementauger/tor-prebuilt/embedded"
15
+ "github.com/cretz/bine/tor"
16
+ "github.com/cretz/bine/torutil"
17
+ tued25519 "github.com/cretz/bine/torutil/ed25519"
18
+ "github.com/knadh/niltalk/store"
19
+ )
20
+
21
+ func getOrCreatePK(store store.Store) (privateKey ed25519.PrivateKey, err error) {
22
+ key := "onionkey"
23
+ d, err := store.Get(key)
24
+ if len(d) == 0 || err != nil {
25
+ _, privateKey, err = ed25519.GenerateKey(rand.Reader)
26
+ if err != nil {
27
+ return nil, err
28
+ }
29
+ var x509Encoded []byte
30
+ x509Encoded, err = x509.MarshalPKCS8PrivateKey(privateKey)
31
+ if err != nil {
32
+ return nil, err
33
+ }
34
+ pemEncoded := pem.EncodeToMemory(&pem.Block{Type: "ED25519 PRIVATE KEY", Bytes: x509Encoded})
35
+ err = store.Set(key, pemEncoded)
36
+ } else {
37
+ block, _ := pem.Decode(d)
38
+ x509Encoded := block.Bytes
39
+ var tPk interface{}
40
+ tPk, err = x509.ParsePKCS8PrivateKey(x509Encoded)
41
+ if err != nil {
42
+ return nil, err
43
+ }
44
+ if x, ok := tPk.(ed25519.PrivateKey); ok {
45
+ privateKey = x
46
+ } else {
47
+ err = fmt.Errorf("invalid key type %T wanted ed25519.PrivateKey", tPk)
48
+ }
49
+ }
50
+ return privateKey, err
51
+ }
52
+
53
+ type torServer struct {
54
+ Handler http.Handler
55
+ // PrivateKey path to a pem encoded ed25519 private key
56
+ PrivateKey ed25519.PrivateKey
57
+ }
58
+
59
+ func onionAddr(pk ed25519.PrivateKey) string {
60
+ return torutil.OnionServiceIDFromV3PublicKey(tued25519.PublicKey([]byte(pk.Public().(ed25519.PublicKey))))
61
+ }
62
+
63
+ func (ts *torServer) ListenAndServe() error {
64
+
65
+ d, err := ioutil.TempDir("", "")
66
+ if err != nil {
67
+ return err
68
+ }
69
+
70
+ // Start tor with default config (can set start conf's DebugWriter to os.Stdout for debug logs)
71
+ // fmt.Println("Starting and registering onion service, please wait a couple of minutes...")
72
+ t, err := tor.Start(nil, &tor.StartConf{TempDataDirBase: d, ProcessCreator: embedded.NewCreator(), NoHush: true})
73
+ if err != nil {
74
+ return fmt.Errorf("unable to start Tor: %v", err)
75
+ }
76
+ defer t.Close()
77
+
78
+ // Wait at most a few minutes to publish the service
79
+ listenCtx, listenCancel := context.WithTimeout(context.Background(), 3*time.Minute)
80
+ defer listenCancel()
81
+ // Create a v3 onion service to listen on any port but show as 80
82
+ onion, err := t.Listen(listenCtx, &tor.ListenConf{Key: ts.PrivateKey, Version3: true, RemotePorts: []int{80}})
83
+ if err != nil {
84
+ return fmt.Errorf("unable to create onion service: %v", err)
85
+ }
86
+ defer onion.Close()
87
+
88
+ // fmt.Printf("server listening at http://%v.onion\n", onion.ID)
89
+
90
+ return http.Serve(onion, ts.Handler)
91
+ }