forked from josephrocca/OpenCharacters
-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
9050 lines (7751 loc) · 728 KB
/
index.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width">
<meta name="referrer" content="no-referrer">
<title>OpenCharacters - Create and share ChatGPT/AI characters</title>
<!-- <script src="https://cdnjs.cloudflare.com/ajax/libs/dexie/3.2.3/dexie.min.js"></script> -->
<script>(function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):(e="undefined"!=typeof globalThis?globalThis:e||self).Dexie=t()})(this,function(){"use strict";var g=function(){return(g=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var i in t=arguments[n])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e}).apply(this,arguments)};function i(e,t,n){if(n||2===arguments.length)for(var r,i=0,o=t.length;i<o;i++)!r&&i in t||((r=r||Array.prototype.slice.call(t,0,i))[i]=t[i]);return e.concat(r||Array.prototype.slice.call(t))}var h="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:"undefined"!=typeof window?window:global,x=Object.keys,b=Array.isArray;function u(t,n){return"object"!=typeof n||x(n).forEach(function(e){t[e]=n[e]}),t}"undefined"==typeof Promise||h.Promise||(h.Promise=Promise);var s=Object.getPrototypeOf,n={}.hasOwnProperty;function m(e,t){return n.call(e,t)}function r(t,n){"function"==typeof n&&(n=n(s(t))),("undefined"==typeof Reflect?x:Reflect.ownKeys)(n).forEach(function(e){c(t,e,n[e])})}var a=Object.defineProperty;function c(e,t,n,r){a(e,t,u(n&&m(n,"get")&&"function"==typeof n.get?{get:n.get,set:n.set,configurable:!0}:{value:n,configurable:!0,writable:!0},r))}function o(t){return{from:function(e){return t.prototype=Object.create(e.prototype),c(t.prototype,"constructor",t),{extend:r.bind(null,t.prototype)}}}}var l=Object.getOwnPropertyDescriptor;function f(e,t){return l(e,t)||(e=s(e))&&f(e,t)}var d=[].slice;function y(e,t,n){return d.call(e,t,n)}function p(e,t){return t(e)}function v(e){if(!e)throw new Error("Assertion Failed")}function _(e){h.setImmediate?setImmediate(e):setTimeout(e,0)}function w(e,r){return e.reduce(function(e,t,n){n=r(t,n);return n&&(e[n[0]]=n[1]),e},{})}function k(e,t){if(m(e,t))return e[t];if(!t)return e;if("string"!=typeof t){for(var n=[],r=0,i=t.length;r<i;++r){var o=k(e,t[r]);n.push(o)}return n}var a=t.indexOf(".");if(-1!==a){var u=e[t.substr(0,a)];return void 0===u?void 0:k(u,t.substr(a+1))}}function E(e,t,n){if(e&&void 0!==t&&!("isFrozen"in Object&&Object.isFrozen(e)))if("string"!=typeof t&&"length"in t){v("string"!=typeof n&&"length"in n);for(var r=0,i=t.length;r<i;++r)E(e,t[r],n[r])}else{var o,a,u=t.indexOf(".");-1!==u?(o=t.substr(0,u),""===(a=t.substr(u+1))?void 0===n?b(e)&&!isNaN(parseInt(o))?e.splice(o,1):delete e[o]:e[o]=n:E(u=!(u=e[o])||!m(e,o)?e[o]={}:u,a,n)):void 0===n?b(e)&&!isNaN(parseInt(t))?e.splice(t,1):delete e[t]:e[t]=n}}function P(e){var t,n={};for(t in e)m(e,t)&&(n[t]=e[t]);return n}var t=[].concat;function K(e){return t.apply([],e)}var e="Boolean,String,Date,RegExp,Blob,File,FileList,FileSystemFileHandle,ArrayBuffer,DataView,Uint8ClampedArray,ImageBitmap,ImageData,Map,Set,CryptoKey".split(",").concat(K([8,16,32,64].map(function(t){return["Int","Uint","Float"].map(function(e){return e+t+"Array"})}))).filter(function(e){return h[e]}),O=e.map(function(e){return h[e]});w(e,function(e){return[e,!0]});var S=null;function A(e){S="undefined"!=typeof WeakMap&&new WeakMap;e=function e(t){if(!t||"object"!=typeof t)return t;var n=S&&S.get(t);if(n)return n;if(b(t)){n=[],S&&S.set(t,n);for(var r=0,i=t.length;r<i;++r)n.push(e(t[r]))}else if(0<=O.indexOf(t.constructor))n=t;else{var o,a=s(t);for(o in n=a===Object.prototype?{}:Object.create(a),S&&S.set(t,n),t)m(t,o)&&(n[o]=e(t[o]))}return n}(e);return S=null,e}var C={}.toString;function j(e){return C.call(e).slice(8,-1)}var D="undefined"!=typeof Symbol?Symbol.iterator:"@@iterator",I="symbol"==typeof D?function(e){var t;return null!=e&&(t=e[D])&&t.apply(e)}:function(){return null},B={};function T(e){var t,n,r,i;if(1===arguments.length){if(b(e))return e.slice();if(this===B&&"string"==typeof e)return[e];if(i=I(e)){for(n=[];!(r=i.next()).done;)n.push(r.value);return n}if(null==e)return[e];if("number"!=typeof(t=e.length))return[e];for(n=new Array(t);t--;)n[t]=e[t];return n}for(t=arguments.length,n=new Array(t);t--;)n[t]=arguments[t];return n}var R="undefined"!=typeof Symbol?function(e){return"AsyncFunction"===e[Symbol.toStringTag]}:function(){return!1},F="undefined"!=typeof location&&/^(http|https):\/\/(localhost|127\.0\.0\.1)/.test(location.href);function M(e,t){F=e,N=t}var N=function(){return!0},q=!new Error("").stack;function U(){if(q)try{throw new Error}catch(e){return e}return new Error}function L(e,t){var n=e.stack;return n?(t=t||0,0===n.indexOf(e.name)&&(t+=(e.name+e.message).split("\n").length),n.split("\n").slice(t).filter(N).map(function(e){return"\n"+e}).join("")):""}var V=["Unknown","Constraint","Data","TransactionInactive","ReadOnly","Version","NotFound","InvalidState","InvalidAccess","Abort","Timeout","QuotaExceeded","Syntax","DataClone"],e=["Modify","Bulk","OpenFailed","VersionChange","Schema","Upgrade","InvalidTable","MissingAPI","NoSuchDatabase","InvalidArgument","SubTransaction","Unsupported","Internal","DatabaseClosed","PrematureCommit","ForeignAwait"].concat(V),W={VersionChanged:"Database version changed by other database connection",DatabaseClosed:"Database has been closed",Abort:"Transaction aborted",TransactionInactive:"Transaction has already completed or failed",MissingAPI:"IndexedDB API missing. Please visit https://tinyurl.com/y2uuvskb"};function z(e,t){this._e=U(),this.name=e,this.message=t}function Y(e,t){return e+". Errors: "+Object.keys(t).map(function(e){return t[e].toString()}).filter(function(e,t,n){return n.indexOf(e)===t}).join("\n")}function G(e,t,n,r){this._e=U(),this.failures=t,this.failedKeys=r,this.successCount=n,this.message=Y(e,t)}function H(e,t){this._e=U(),this.name="BulkError",this.failures=Object.keys(t).map(function(e){return t[e]}),this.failuresByPos=t,this.message=Y(e,t)}o(z).from(Error).extend({stack:{get:function(){return this._stack||(this._stack=this.name+": "+this.message+L(this._e,2))}},toString:function(){return this.name+": "+this.message}}),o(G).from(z),o(H).from(z);var Q=e.reduce(function(e,t){return e[t]=t+"Error",e},{}),X=z,J=e.reduce(function(e,n){var r=n+"Error";function t(e,t){this._e=U(),this.name=r,e?"string"==typeof e?(this.message=e+(t?"\n "+t:""),this.inner=t||null):"object"==typeof e&&(this.message=e.name+" "+e.message,this.inner=e):(this.message=W[n]||r,this.inner=null)}return o(t).from(X),e[n]=t,e},{});J.Syntax=SyntaxError,J.Type=TypeError,J.Range=RangeError;var $=V.reduce(function(e,t){return e[t+"Error"]=J[t],e},{});V=e.reduce(function(e,t){return-1===["Syntax","Type","Range"].indexOf(t)&&(e[t+"Error"]=J[t]),e},{});function Z(){}function ee(e){return e}function te(t,n){return null==t||t===ee?n:function(e){return n(t(e))}}function ne(e,t){return function(){e.apply(this,arguments),t.apply(this,arguments)}}function re(i,o){return i===Z?o:function(){var e=i.apply(this,arguments);void 0!==e&&(arguments[0]=e);var t=this.onsuccess,n=this.onerror;this.onsuccess=null,this.onerror=null;var r=o.apply(this,arguments);return t&&(this.onsuccess=this.onsuccess?ne(t,this.onsuccess):t),n&&(this.onerror=this.onerror?ne(n,this.onerror):n),void 0!==r?r:e}}function ie(n,r){return n===Z?r:function(){n.apply(this,arguments);var e=this.onsuccess,t=this.onerror;this.onsuccess=this.onerror=null,r.apply(this,arguments),e&&(this.onsuccess=this.onsuccess?ne(e,this.onsuccess):e),t&&(this.onerror=this.onerror?ne(t,this.onerror):t)}}function oe(i,o){return i===Z?o:function(e){var t=i.apply(this,arguments);u(e,t);var n=this.onsuccess,r=this.onerror;this.onsuccess=null,this.onerror=null;e=o.apply(this,arguments);return n&&(this.onsuccess=this.onsuccess?ne(n,this.onsuccess):n),r&&(this.onerror=this.onerror?ne(r,this.onerror):r),void 0===t?void 0===e?void 0:e:u(t,e)}}function ae(e,t){return e===Z?t:function(){return!1!==t.apply(this,arguments)&&e.apply(this,arguments)}}function ue(i,o){return i===Z?o:function(){var e=i.apply(this,arguments);if(e&&"function"==typeof e.then){for(var t=this,n=arguments.length,r=new Array(n);n--;)r[n]=arguments[n];return e.then(function(){return o.apply(t,r)})}return o.apply(this,arguments)}}V.ModifyError=G,V.DexieError=z,V.BulkError=H;var se={},ce=100,le=100,e="undefined"==typeof Promise?[]:function(){var e=Promise.resolve();if("undefined"==typeof crypto||!crypto.subtle)return[e,s(e),e];var t=crypto.subtle.digest("SHA-512",new Uint8Array([0]));return[t,s(t),e]}(),fe=e[0],he=e[1],de=e[2],pe=he&&he.then,ye=fe&&fe.constructor,ve=!!de,me=!1,ge=de?function(){de.then(Ne)}:h.setImmediate?setImmediate.bind(null,Ne):h.MutationObserver?function(){var e=document.createElement("div");new MutationObserver(function(){Ne(),e=null}).observe(e,{attributes:!0}),e.setAttribute("i","1")}:function(){setTimeout(Ne,0)},be=function(e,t){Se.push([e,t]),we&&(ge(),we=!1)},_e=!0,we=!0,xe=[],ke=[],Ee=null,Pe=ee,Ke={id:"global",global:!0,ref:0,unhandleds:[],onunhandled:ct,pgp:!1,env:{},finalize:function(){this.unhandleds.forEach(function(e){try{ct(e[0],e[1])}catch(e){}})}},Oe=Ke,Se=[],Ae=0,Ce=[];function je(e){if("object"!=typeof this)throw new TypeError("Promises must be constructed via new");this._listeners=[],this.onuncatched=Z,this._lib=!1;var t=this._PSD=Oe;if(F&&(this._stackHolder=U(),this._prev=null,this._numPrev=0),"function"!=typeof e){if(e!==se)throw new TypeError("Not a function");return this._state=arguments[1],this._value=arguments[2],void(!1===this._state&&Be(this,this._value))}this._state=null,this._value=null,++t.ref,function t(r,e){try{e(function(n){if(null===r._state){if(n===r)throw new TypeError("A promise cannot be resolved with itself.");var e=r._lib&&qe();n&&"function"==typeof n.then?t(r,function(e,t){n instanceof je?n._then(e,t):n.then(e,t)}):(r._state=!0,r._value=n,Te(r)),e&&Ue()}},Be.bind(null,r))}catch(e){Be(r,e)}}(this,e)}var De={get:function(){var u=Oe,t=Qe;function e(n,r){var i=this,o=!u.global&&(u!==Oe||t!==Qe),a=o&&!Ze(),e=new je(function(e,t){Re(i,new Ie(at(n,u,o,a),at(r,u,o,a),e,t,u))});return F&&Me(e,this),e}return e.prototype=se,e},set:function(e){c(this,"then",e&&e.prototype===se?De:{get:function(){return e},set:De.set})}};function Ie(e,t,n,r,i){this.onFulfilled="function"==typeof e?e:null,this.onRejected="function"==typeof t?t:null,this.resolve=n,this.reject=r,this.psd=i}function Be(t,n){var e,r;ke.push(n),null===t._state&&(e=t._lib&&qe(),n=Pe(n),t._state=!1,t._value=n,F&&null!==n&&"object"==typeof n&&!n._promise&&function(e,t,n){try{e.apply(null,n)}catch(e){t&&t(e)}}(function(){var e=f(n,"stack");n._promise=t,c(n,"stack",{get:function(){return me?e&&(e.get?e.get.apply(n):e.value):t.stack}})}),r=t,xe.some(function(e){return e._value===r._value})||xe.push(r),Te(t),e&&Ue())}function Te(e){var t=e._listeners;e._listeners=[];for(var n=0,r=t.length;n<r;++n)Re(e,t[n]);var i=e._PSD;--i.ref||i.finalize(),0===Ae&&(++Ae,be(function(){0==--Ae&&Le()},[]))}function Re(e,t){if(null!==e._state){var n=e._state?t.onFulfilled:t.onRejected;if(null===n)return(e._state?t.resolve:t.reject)(e._value);++t.psd.ref,++Ae,be(Fe,[n,e,t])}else e._listeners.push(t)}function Fe(e,t,n){try{var r,i=(Ee=t)._value;t._state?r=e(i):(ke.length&&(ke=[]),r=e(i),-1===ke.indexOf(i)&&function(e){var t=xe.length;for(;t;)if(xe[--t]._value===e._value)return xe.splice(t,1)}(t)),n.resolve(r)}catch(e){n.reject(e)}finally{Ee=null,0==--Ae&&Le(),--n.psd.ref||n.psd.finalize()}}function Me(e,t){var n=t?t._numPrev+1:0;n<ce&&(e._prev=t,e._numPrev=n)}function Ne(){qe()&&Ue()}function qe(){var e=_e;return we=_e=!1,e}function Ue(){var e,t,n;do{for(;0<Se.length;)for(e=Se,Se=[],n=e.length,t=0;t<n;++t){var r=e[t];r[0].apply(null,r[1])}}while(0<Se.length);we=_e=!0}function Le(){var e=xe;xe=[],e.forEach(function(e){e._PSD.onunhandled.call(null,e._value,e)});for(var t=Ce.slice(0),n=t.length;n;)t[--n]()}function Ve(e){return new je(se,!1,e)}function We(n,r){var i=Oe;return function(){var e=qe(),t=Oe;try{return nt(i,!0),n.apply(this,arguments)}catch(e){r&&r(e)}finally{nt(t,!1),e&&Ue()}}}r(je.prototype,{then:De,_then:function(e,t){Re(this,new Ie(null,null,e,t,Oe))},catch:function(e){if(1===arguments.length)return this.then(null,e);var t=e,n=arguments[1];return"function"==typeof t?this.then(null,function(e){return(e instanceof t?n:Ve)(e)}):this.then(null,function(e){return(e&&e.name===t?n:Ve)(e)})},finally:function(t){return this.then(function(e){return t(),e},function(e){return t(),Ve(e)})},stack:{get:function(){if(this._stack)return this._stack;try{me=!0;var e=function e(t,n,r){if(n.length===r)return n;var i="";{var o,a,u;!1===t._state&&(null!=(o=t._value)?(a=o.name||"Error",u=o.message||o,i=L(o,0)):(a=o,u=""),n.push(a+(u?": "+u:"")+i))}F&&((i=L(t._stackHolder,2))&&-1===n.indexOf(i)&&n.push(i),t._prev&&e(t._prev,n,r));return n}(this,[],20).join("\nFrom previous: ");return null!==this._state&&(this._stack=e),e}finally{me=!1}}},timeout:function(r,i){var o=this;return r<1/0?new je(function(e,t){var n=setTimeout(function(){return t(new J.Timeout(i))},r);o.then(e,t).finally(clearTimeout.bind(null,n))}):this}}),"undefined"!=typeof Symbol&&Symbol.toStringTag&&c(je.prototype,Symbol.toStringTag,"Dexie.Promise"),Ke.env=rt(),r(je,{all:function(){var o=T.apply(null,arguments).map(et);return new je(function(n,r){0===o.length&&n([]);var i=o.length;o.forEach(function(e,t){return je.resolve(e).then(function(e){o[t]=e,--i||n(o)},r)})})},resolve:function(n){if(n instanceof je)return n;if(n&&"function"==typeof n.then)return new je(function(e,t){n.then(e,t)});var e=new je(se,!0,n);return Me(e,Ee),e},reject:Ve,race:function(){var e=T.apply(null,arguments).map(et);return new je(function(t,n){e.map(function(e){return je.resolve(e).then(t,n)})})},PSD:{get:function(){return Oe},set:function(e){return Oe=e}},totalEchoes:{get:function(){return Qe}},newPSD:Je,usePSD:it,scheduler:{get:function(){return be},set:function(e){be=e}},rejectionMapper:{get:function(){return Pe},set:function(e){Pe=e}},follow:function(i,n){return new je(function(e,t){return Je(function(n,r){var e=Oe;e.unhandleds=[],e.onunhandled=r,e.finalize=ne(function(){var t,e=this;t=function(){0===e.unhandleds.length?n():r(e.unhandleds[0])},Ce.push(function e(){t(),Ce.splice(Ce.indexOf(e),1)}),++Ae,be(function(){0==--Ae&&Le()},[])},e.finalize),i()},n,e,t)})}}),ye&&(ye.allSettled&&c(je,"allSettled",function(){var e=T.apply(null,arguments).map(et);return new je(function(n){0===e.length&&n([]);var r=e.length,i=new Array(r);e.forEach(function(e,t){return je.resolve(e).then(function(e){return i[t]={status:"fulfilled",value:e}},function(e){return i[t]={status:"rejected",reason:e}}).then(function(){return--r||n(i)})})})}),ye.any&&"undefined"!=typeof AggregateError&&c(je,"any",function(){var e=T.apply(null,arguments).map(et);return new je(function(n,r){0===e.length&&r(new AggregateError([]));var i=e.length,o=new Array(i);e.forEach(function(e,t){return je.resolve(e).then(function(e){return n(e)},function(e){o[t]=e,--i||r(new AggregateError(o))})})})}));var ze={awaits:0,echoes:0,id:0},Ye=0,Ge=[],He=0,Qe=0,Xe=0;function Je(e,t,n,r){var i=Oe,o=Object.create(i);o.parent=i,o.ref=0,o.global=!1,o.id=++Xe;var a=Ke.env;o.env=ve?{Promise:je,PromiseProp:{value:je,configurable:!0,writable:!0},all:je.all,race:je.race,allSettled:je.allSettled,any:je.any,resolve:je.resolve,reject:je.reject,nthen:ut(a.nthen,o),gthen:ut(a.gthen,o)}:{},t&&u(o,t),++i.ref,o.finalize=function(){--this.parent.ref||this.parent.finalize()};r=it(o,e,n,r);return 0===o.ref&&o.finalize(),r}function $e(){return ze.id||(ze.id=++Ye),++ze.awaits,ze.echoes+=le,ze.id}function Ze(){return!!ze.awaits&&(0==--ze.awaits&&(ze.id=0),ze.echoes=ze.awaits*le,!0)}function et(e){return ze.echoes&&e&&e.constructor===ye?($e(),e.then(function(e){return Ze(),e},function(e){return Ze(),lt(e)})):e}function tt(){var e=Ge[Ge.length-1];Ge.pop(),nt(e,!1)}function nt(e,t){var n,r=Oe;(t?!ze.echoes||He++&&e===Oe:!He||--He&&e===Oe)||ot(t?function(e){++Qe,ze.echoes&&0!=--ze.echoes||(ze.echoes=ze.id=0),Ge.push(Oe),nt(e,!0)}.bind(null,e):tt),e!==Oe&&(Oe=e,r===Ke&&(Ke.env=rt()),ve&&(n=Ke.env.Promise,t=e.env,he.then=t.nthen,n.prototype.then=t.gthen,(r.global||e.global)&&(Object.defineProperty(h,"Promise",t.PromiseProp),n.all=t.all,n.race=t.race,n.resolve=t.resolve,n.reject=t.reject,t.allSettled&&(n.allSettled=t.allSettled),t.any&&(n.any=t.any))))}function rt(){var e=h.Promise;return ve?{Promise:e,PromiseProp:Object.getOwnPropertyDescriptor(h,"Promise"),all:e.all,race:e.race,allSettled:e.allSettled,any:e.any,resolve:e.resolve,reject:e.reject,nthen:he.then,gthen:e.prototype.then}:{}}function it(e,t,n,r,i){var o=Oe;try{return nt(e,!0),t(n,r,i)}finally{nt(o,!1)}}function ot(e){pe.call(fe,e)}function at(t,n,r,i){return"function"!=typeof t?t:function(){var e=Oe;r&&$e(),nt(n,!0);try{return t.apply(this,arguments)}finally{nt(e,!1),i&&ot(Ze)}}}function ut(n,r){return function(e,t){return n.call(this,at(e,r),at(t,r))}}-1===(""+pe).indexOf("[native code]")&&($e=Ze=Z);var st="unhandledrejection";function ct(e,t){var n;try{n=t.onuncatched(e)}catch(e){}if(!1!==n)try{var r,i={promise:t,reason:e};if(h.document&&document.createEvent?((r=document.createEvent("Event")).initEvent(st,!0,!0),u(r,i)):h.CustomEvent&&u(r=new CustomEvent(st,{detail:i}),i),r&&h.dispatchEvent&&(dispatchEvent(r),!h.PromiseRejectionEvent&&h.onunhandledrejection))try{h.onunhandledrejection(r)}catch(e){}F&&r&&!r.defaultPrevented&&console.warn("Unhandled rejection: "+(e.stack||e))}catch(e){}}var lt=je.reject;function ft(e){return!/(dexie\.js|dexie\.min\.js)/.test(e)}var ht=String.fromCharCode(65535),dt="Invalid key provided. Keys must be of type string, number, Date or Array<string | number | Date>.",pt="String expected.",yt=[],vt="undefined"!=typeof navigator&&/(MSIE|Trident|Edge)/.test(navigator.userAgent),mt=vt,gt=vt,bt="__dbnames",_t="readonly",wt="readwrite";function xt(e,t){return e?t?function(){return e.apply(this,arguments)&&t.apply(this,arguments)}:e:t}var kt={type:3,lower:-1/0,lowerOpen:!1,upper:[[]],upperOpen:!1};function Et(t){return"string"!=typeof t||/\./.test(t)?function(e){return e}:function(e){return void 0===e[t]&&t in e&&delete(e=A(e))[t],e}}var Pt=(Kt.prototype._trans=function(e,r,t){var n=this._tx||Oe.trans,i=this.name;function o(e,t,n){if(!n.schema[i])throw new J.NotFound("Table "+i+" not part of transaction");return r(n.idbtrans,n)}var a=qe();try{return n&&n.db===this.db?n===Oe.trans?n._promise(e,o,t):Je(function(){return n._promise(e,o,t)},{trans:n,transless:Oe.transless||Oe}):function t(n,r,i,o){if(n.idbdb&&(n._state.openComplete||Oe.letThrough||n._vip)){var a=n._createTransaction(r,i,n._dbSchema);try{a.create(),n._state.PR1398_maxLoop=3}catch(e){return e.name===Q.InvalidState&&n.isOpen()&&0<--n._state.PR1398_maxLoop?(console.warn("Dexie: Need to reopen db"),n._close(),n.open().then(function(){return t(n,r,i,o)})):lt(e)}return a._promise(r,function(e,t){return Je(function(){return Oe.trans=a,o(e,t,a)})}).then(function(e){return a._completion.then(function(){return e})})}if(n._state.openComplete)return lt(new J.DatabaseClosed(n._state.dbOpenError));if(!n._state.isBeingOpened){if(!n._options.autoOpen)return lt(new J.DatabaseClosed);n.open().catch(Z)}return n._state.dbReadyPromise.then(function(){return t(n,r,i,o)})}(this.db,e,[this.name],o)}finally{a&&Ue()}},Kt.prototype.get=function(t,e){var n=this;return t&&t.constructor===Object?this.where(t).first(e):this._trans("readonly",function(e){return n.core.get({trans:e,key:t}).then(function(e){return n.hook.reading.fire(e)})}).then(e)},Kt.prototype.where=function(o){if("string"==typeof o)return new this.db.WhereClause(this,o);if(b(o))return new this.db.WhereClause(this,"["+o.join("+")+"]");var n=x(o);if(1===n.length)return this.where(n[0]).equals(o[n[0]]);var e=this.schema.indexes.concat(this.schema.primKey).filter(function(t){return t.compound&&n.every(function(e){return 0<=t.keyPath.indexOf(e)})&&t.keyPath.every(function(e){return 0<=n.indexOf(e)})})[0];if(e&&this.db._maxKey!==ht)return this.where(e.name).equals(e.keyPath.map(function(e){return o[e]}));!e&&F&&console.warn("The query "+JSON.stringify(o)+" on "+this.name+" would benefit of a compound index ["+n.join("+")+"]");var a=this.schema.idxByName,r=this.db._deps.indexedDB;function u(e,t){try{return 0===r.cmp(e,t)}catch(e){return!1}}var t=n.reduce(function(e,t){var n=e[0],r=e[1],e=a[t],i=o[t];return[n||e,n||!e?xt(r,e&&e.multi?function(e){e=k(e,t);return b(e)&&e.some(function(e){return u(i,e)})}:function(e){return u(i,k(e,t))}):r]},[null,null]),i=t[0],t=t[1];return i?this.where(i.name).equals(o[i.keyPath]).filter(t):e?this.filter(t):this.where(n).equals("")},Kt.prototype.filter=function(e){return this.toCollection().and(e)},Kt.prototype.count=function(e){return this.toCollection().count(e)},Kt.prototype.offset=function(e){return this.toCollection().offset(e)},Kt.prototype.limit=function(e){return this.toCollection().limit(e)},Kt.prototype.each=function(e){return this.toCollection().each(e)},Kt.prototype.toArray=function(e){return this.toCollection().toArray(e)},Kt.prototype.toCollection=function(){return new this.db.Collection(new this.db.WhereClause(this))},Kt.prototype.orderBy=function(e){return new this.db.Collection(new this.db.WhereClause(this,b(e)?"["+e.join("+")+"]":e))},Kt.prototype.reverse=function(){return this.toCollection().reverse()},Kt.prototype.mapToClass=function(r){this.schema.mappedClass=r;function e(e){if(!e)return e;var t,n=Object.create(r.prototype);for(t in e)if(m(e,t))try{n[t]=e[t]}catch(e){}return n}return this.schema.readHook&&this.hook.reading.unsubscribe(this.schema.readHook),this.schema.readHook=e,this.hook("reading",e),r},Kt.prototype.defineClass=function(){return this.mapToClass(function(e){u(this,e)})},Kt.prototype.add=function(t,n){var r=this,e=this.schema.primKey,i=e.auto,o=e.keyPath,a=t;return o&&i&&(a=Et(o)(t)),this._trans("readwrite",function(e){return r.core.mutate({trans:e,type:"add",keys:null!=n?[n]:null,values:[a]})}).then(function(e){return e.numFailures?je.reject(e.failures[0]):e.lastResult}).then(function(e){if(o)try{E(t,o,e)}catch(e){}return e})},Kt.prototype.update=function(t,n){if("object"!=typeof t||b(t))return this.where(":id").equals(t).modify(n);var e=k(t,this.schema.primKey.keyPath);if(void 0===e)return lt(new J.InvalidArgument("Given object does not contain its primary key"));try{"function"!=typeof n?x(n).forEach(function(e){E(t,e,n[e])}):n(t,{value:t,primKey:e})}catch(e){}return this.where(":id").equals(e).modify(n)},Kt.prototype.put=function(t,n){var r=this,e=this.schema.primKey,i=e.auto,o=e.keyPath,a=t;return o&&i&&(a=Et(o)(t)),this._trans("readwrite",function(e){return r.core.mutate({trans:e,type:"put",values:[a],keys:null!=n?[n]:null})}).then(function(e){return e.numFailures?je.reject(e.failures[0]):e.lastResult}).then(function(e){if(o)try{E(t,o,e)}catch(e){}return e})},Kt.prototype.delete=function(t){var n=this;return this._trans("readwrite",function(e){return n.core.mutate({trans:e,type:"delete",keys:[t]})}).then(function(e){return e.numFailures?je.reject(e.failures[0]):void 0})},Kt.prototype.clear=function(){var t=this;return this._trans("readwrite",function(e){return t.core.mutate({trans:e,type:"deleteRange",range:kt})}).then(function(e){return e.numFailures?je.reject(e.failures[0]):void 0})},Kt.prototype.bulkGet=function(t){var n=this;return this._trans("readonly",function(e){return n.core.getMany({keys:t,trans:e}).then(function(e){return e.map(function(e){return n.hook.reading.fire(e)})})})},Kt.prototype.bulkAdd=function(r,e,t){var o=this,a=Array.isArray(e)?e:void 0,u=(t=t||(a?void 0:e))?t.allKeys:void 0;return this._trans("readwrite",function(e){var t=o.schema.primKey,n=t.auto,t=t.keyPath;if(t&&a)throw new J.InvalidArgument("bulkAdd(): keys argument invalid on tables with inbound keys");if(a&&a.length!==r.length)throw new J.InvalidArgument("Arguments objects and keys must have the same length");var i=r.length,t=t&&n?r.map(Et(t)):r;return o.core.mutate({trans:e,type:"add",keys:a,values:t,wantResults:u}).then(function(e){var t=e.numFailures,n=e.results,r=e.lastResult,e=e.failures;if(0===t)return u?n:r;throw new H(o.name+".bulkAdd(): "+t+" of "+i+" operations failed",e)})})},Kt.prototype.bulkPut=function(r,e,t){var o=this,a=Array.isArray(e)?e:void 0,u=(t=t||(a?void 0:e))?t.allKeys:void 0;return this._trans("readwrite",function(e){var t=o.schema.primKey,n=t.auto,t=t.keyPath;if(t&&a)throw new J.InvalidArgument("bulkPut(): keys argument invalid on tables with inbound keys");if(a&&a.length!==r.length)throw new J.InvalidArgument("Arguments objects and keys must have the same length");var i=r.length,t=t&&n?r.map(Et(t)):r;return o.core.mutate({trans:e,type:"put",keys:a,values:t,wantResults:u}).then(function(e){var t=e.numFailures,n=e.results,r=e.lastResult,e=e.failures;if(0===t)return u?n:r;throw new H(o.name+".bulkPut(): "+t+" of "+i+" operations failed",e)})})},Kt.prototype.bulkDelete=function(t){var r=this,i=t.length;return this._trans("readwrite",function(e){return r.core.mutate({trans:e,type:"delete",keys:t})}).then(function(e){var t=e.numFailures,n=e.lastResult,e=e.failures;if(0===t)return n;throw new H(r.name+".bulkDelete(): "+t+" of "+i+" operations failed",e)})},Kt);function Kt(){}function Ot(i){function t(e,t){if(t){for(var n=arguments.length,r=new Array(n-1);--n;)r[n-1]=arguments[n];return a[e].subscribe.apply(null,r),i}if("string"==typeof e)return a[e]}var a={};t.addEventType=u;for(var e=1,n=arguments.length;e<n;++e)u(arguments[e]);return t;function u(e,n,r){if("object"!=typeof e){var i;n=n||ae;var o={subscribers:[],fire:r=r||Z,subscribe:function(e){-1===o.subscribers.indexOf(e)&&(o.subscribers.push(e),o.fire=n(o.fire,e))},unsubscribe:function(t){o.subscribers=o.subscribers.filter(function(e){return e!==t}),o.fire=o.subscribers.reduce(n,r)}};return a[e]=t[e]=o}x(i=e).forEach(function(e){var t=i[e];if(b(t))u(e,i[e][0],i[e][1]);else{if("asap"!==t)throw new J.InvalidArgument("Invalid event config");var n=u(e,ee,function(){for(var e=arguments.length,t=new Array(e);e--;)t[e]=arguments[e];n.subscribers.forEach(function(e){_(function(){e.apply(null,t)})})})}})}}function St(e,t){return o(t).from({prototype:e}),t}function At(e,t){return!(e.filter||e.algorithm||e.or)&&(t?e.justLimit:!e.replayFilter)}function Ct(e,t){e.filter=xt(e.filter,t)}function jt(e,t,n){var r=e.replayFilter;e.replayFilter=r?function(){return xt(r(),t())}:t,e.justLimit=n&&!r}function Dt(e,t){if(e.isPrimKey)return t.primaryKey;var n=t.getIndexByKeyPath(e.index);if(!n)throw new J.Schema("KeyPath "+e.index+" on object store "+t.name+" is not indexed");return n}function It(e,t,n){var r=Dt(e,t.schema);return t.openCursor({trans:n,values:!e.keysOnly,reverse:"prev"===e.dir,unique:!!e.unique,query:{index:r,range:e.range}})}function Bt(e,o,t,n){var a=e.replayFilter?xt(e.filter,e.replayFilter()):e.filter;if(e.or){var u={},r=function(e,t,n){var r,i;a&&!a(t,n,function(e){return t.stop(e)},function(e){return t.fail(e)})||("[object ArrayBuffer]"===(i=""+(r=t.primaryKey))&&(i=""+new Uint8Array(r)),m(u,i)||(u[i]=!0,o(e,t,n)))};return Promise.all([e.or._iterate(r,t),Tt(It(e,n,t),e.algorithm,r,!e.keysOnly&&e.valueMapper)])}return Tt(It(e,n,t),xt(e.algorithm,a),o,!e.keysOnly&&e.valueMapper)}function Tt(e,r,i,o){var a=We(o?function(e,t,n){return i(o(e),t,n)}:i);return e.then(function(n){if(n)return n.start(function(){var t=function(){return n.continue()};r&&!r(n,function(e){return t=e},function(e){n.stop(e),t=Z},function(e){n.fail(e),t=Z})||a(n.value,n,function(e){return t=e}),t()})})}function Rt(e,t){try{var n=Ft(e),r=Ft(t);if(n!==r)return"Array"===n?1:"Array"===r?-1:"binary"===n?1:"binary"===r?-1:"string"===n?1:"string"===r?-1:"Date"===n?1:"Date"!==r?NaN:-1;switch(n){case"number":case"Date":case"string":return t<e?1:e<t?-1:0;case"binary":return function(e,t){for(var n=e.length,r=t.length,i=n<r?n:r,o=0;o<i;++o)if(e[o]!==t[o])return e[o]<t[o]?-1:1;return n===r?0:n<r?-1:1}(Mt(e),Mt(t));case"Array":return function(e,t){for(var n=e.length,r=t.length,i=n<r?n:r,o=0;o<i;++o){var a=Rt(e[o],t[o]);if(0!==a)return a}return n===r?0:n<r?-1:1}(e,t)}}catch(e){}return NaN}function Ft(e){var t=typeof e;if("object"!=t)return t;if(ArrayBuffer.isView(e))return"binary";e=j(e);return"ArrayBuffer"===e?"binary":e}function Mt(e){return e instanceof Uint8Array?e:ArrayBuffer.isView(e)?new Uint8Array(e.buffer,e.byteOffset,e.byteLength):new Uint8Array(e)}var Nt=(qt.prototype._read=function(e,t){var n=this._ctx;return n.error?n.table._trans(null,lt.bind(null,n.error)):n.table._trans("readonly",e).then(t)},qt.prototype._write=function(e){var t=this._ctx;return t.error?t.table._trans(null,lt.bind(null,t.error)):t.table._trans("readwrite",e,"locked")},qt.prototype._addAlgorithm=function(e){var t=this._ctx;t.algorithm=xt(t.algorithm,e)},qt.prototype._iterate=function(e,t){return Bt(this._ctx,e,t,this._ctx.table.core)},qt.prototype.clone=function(e){var t=Object.create(this.constructor.prototype),n=Object.create(this._ctx);return e&&u(n,e),t._ctx=n,t},qt.prototype.raw=function(){return this._ctx.valueMapper=null,this},qt.prototype.each=function(t){var n=this._ctx;return this._read(function(e){return Bt(n,t,e,n.table.core)})},qt.prototype.count=function(e){var i=this;return this._read(function(e){var t=i._ctx,n=t.table.core;if(At(t,!0))return n.count({trans:e,query:{index:Dt(t,n.schema),range:t.range}}).then(function(e){return Math.min(e,t.limit)});var r=0;return Bt(t,function(){return++r,!1},e,n).then(function(){return r})}).then(e)},qt.prototype.sortBy=function(e,t){var n=e.split(".").reverse(),r=n[0],i=n.length-1;function o(e,t){return t?o(e[n[t]],t-1):e[r]}var a="next"===this._ctx.dir?1:-1;function u(e,t){e=o(e,i),t=o(t,i);return e<t?-a:t<e?a:0}return this.toArray(function(e){return e.sort(u)}).then(t)},qt.prototype.toArray=function(e){var o=this;return this._read(function(e){var t=o._ctx;if("next"===t.dir&&At(t,!0)&&0<t.limit){var n=t.valueMapper,r=Dt(t,t.table.core.schema);return t.table.core.query({trans:e,limit:t.limit,values:!0,query:{index:r,range:t.range}}).then(function(e){e=e.result;return n?e.map(n):e})}var i=[];return Bt(t,function(e){return i.push(e)},e,t.table.core).then(function(){return i})},e)},qt.prototype.offset=function(t){var e=this._ctx;return t<=0||(e.offset+=t,At(e)?jt(e,function(){var n=t;return function(e,t){return 0===n||(1===n?--n:t(function(){e.advance(n),n=0}),!1)}}):jt(e,function(){var e=t;return function(){return--e<0}})),this},qt.prototype.limit=function(e){return this._ctx.limit=Math.min(this._ctx.limit,e),jt(this._ctx,function(){var r=e;return function(e,t,n){return--r<=0&&t(n),0<=r}},!0),this},qt.prototype.until=function(r,i){return Ct(this._ctx,function(e,t,n){return!r(e.value)||(t(n),i)}),this},qt.prototype.first=function(e){return this.limit(1).toArray(function(e){return e[0]}).then(e)},qt.prototype.last=function(e){return this.reverse().first(e)},qt.prototype.filter=function(t){var e;return Ct(this._ctx,function(e){return t(e.value)}),(e=this._ctx).isMatch=xt(e.isMatch,t),this},qt.prototype.and=function(e){return this.filter(e)},qt.prototype.or=function(e){return new this.db.WhereClause(this._ctx.table,e,this)},qt.prototype.reverse=function(){return this._ctx.dir="prev"===this._ctx.dir?"next":"prev",this._ondirectionchange&&this._ondirectionchange(this._ctx.dir),this},qt.prototype.desc=function(){return this.reverse()},qt.prototype.eachKey=function(n){var e=this._ctx;return e.keysOnly=!e.isMatch,this.each(function(e,t){n(t.key,t)})},qt.prototype.eachUniqueKey=function(e){return this._ctx.unique="unique",this.eachKey(e)},qt.prototype.eachPrimaryKey=function(n){var e=this._ctx;return e.keysOnly=!e.isMatch,this.each(function(e,t){n(t.primaryKey,t)})},qt.prototype.keys=function(e){var t=this._ctx;t.keysOnly=!t.isMatch;var n=[];return this.each(function(e,t){n.push(t.key)}).then(function(){return n}).then(e)},qt.prototype.primaryKeys=function(e){var n=this._ctx;if("next"===n.dir&&At(n,!0)&&0<n.limit)return this._read(function(e){var t=Dt(n,n.table.core.schema);return n.table.core.query({trans:e,values:!1,limit:n.limit,query:{index:t,range:n.range}})}).then(function(e){return e.result}).then(e);n.keysOnly=!n.isMatch;var r=[];return this.each(function(e,t){r.push(t.primaryKey)}).then(function(){return r}).then(e)},qt.prototype.uniqueKeys=function(e){return this._ctx.unique="unique",this.keys(e)},qt.prototype.firstKey=function(e){return this.limit(1).keys(function(e){return e[0]}).then(e)},qt.prototype.lastKey=function(e){return this.reverse().firstKey(e)},qt.prototype.distinct=function(){var e=this._ctx,e=e.index&&e.table.schema.idxByName[e.index];if(!e||!e.multi)return this;var n={};return Ct(this._ctx,function(e){var t=e.primaryKey.toString(),e=m(n,t);return n[t]=!0,!e}),this},qt.prototype.modify=function(_){var n=this,w=this._ctx;return this._write(function(d){var o,a,p;p="function"==typeof _?_:(o=x(_),a=o.length,function(e){for(var t=!1,n=0;n<a;++n){var r=o[n],i=_[r];k(e,r)!==i&&(E(e,r,i),t=!0)}return t});function y(e,t){var n=t.failures,t=t.numFailures;s+=e-t;for(var r=0,i=x(n);r<i.length;r++){var o=i[r];u.push(n[o])}}var v=w.table.core,e=v.schema.primaryKey,m=e.outbound,g=e.extractKey,b=n.db._options.modifyChunkSize||200,u=[],s=0,t=[];return n.clone().primaryKeys().then(function(f){function h(c){var l=Math.min(b,f.length-c);return v.getMany({trans:d,keys:f.slice(c,c+l),cache:"immutable"}).then(function(e){for(var n=[],t=[],r=m?[]:null,i=[],o=0;o<l;++o){var a=e[o],u={value:A(a),primKey:f[c+o]};!1!==p.call(u,u.value,u)&&(null==u.value?i.push(f[c+o]):m||0===Rt(g(a),g(u.value))?(t.push(u.value),m&&r.push(f[c+o])):(i.push(f[c+o]),n.push(u.value)))}var s=At(w)&&w.limit===1/0&&("function"!=typeof _||_===Ut)&&{index:w.index,range:w.range};return Promise.resolve(0<n.length&&v.mutate({trans:d,type:"add",values:n}).then(function(e){for(var t in e.failures)i.splice(parseInt(t),1);y(n.length,e)})).then(function(){return(0<t.length||s&&"object"==typeof _)&&v.mutate({trans:d,type:"put",keys:r,values:t,criteria:s,changeSpec:"function"!=typeof _&&_}).then(function(e){return y(t.length,e)})}).then(function(){return(0<i.length||s&&_===Ut)&&v.mutate({trans:d,type:"delete",keys:i,criteria:s}).then(function(e){return y(i.length,e)})}).then(function(){return f.length>c+l&&h(c+b)})})}return h(0).then(function(){if(0<u.length)throw new G("Error modifying one or more objects",u,s,t);return f.length})})})},qt.prototype.delete=function(){var i=this._ctx,n=i.range;return At(i)&&(i.isPrimKey&&!gt||3===n.type)?this._write(function(e){var t=i.table.core.schema.primaryKey,r=n;return i.table.core.count({trans:e,query:{index:t,range:r}}).then(function(n){return i.table.core.mutate({trans:e,type:"deleteRange",range:r}).then(function(e){var t=e.failures;e.lastResult,e.results;e=e.numFailures;if(e)throw new G("Could not delete some values",Object.keys(t).map(function(e){return t[e]}),n-e);return n-e})})}):this.modify(Ut)},qt);function qt(){}var Ut=function(e,t){return t.value=null};function Lt(e,t){return e<t?-1:e===t?0:1}function Vt(e,t){return t<e?-1:e===t?0:1}function Wt(e,t,n){e=e instanceof Qt?new e.Collection(e):e;return e._ctx.error=new(n||TypeError)(t),e}function zt(e){return new e.Collection(e,function(){return Ht("")}).limit(0)}function Yt(e,s,n,r){var i,c,l,f,h,d,p,y=n.length;if(!n.every(function(e){return"string"==typeof e}))return Wt(e,pt);function t(e){i="next"===e?function(e){return e.toUpperCase()}:function(e){return e.toLowerCase()},c="next"===e?function(e){return e.toLowerCase()}:function(e){return e.toUpperCase()},l="next"===e?Lt:Vt;var t=n.map(function(e){return{lower:c(e),upper:i(e)}}).sort(function(e,t){return l(e.lower,t.lower)});f=t.map(function(e){return e.upper}),h=t.map(function(e){return e.lower}),p="next"===(d=e)?"":r}t("next");e=new e.Collection(e,function(){return Gt(f[0],h[y-1]+r)});e._ondirectionchange=function(e){t(e)};var v=0;return e._addAlgorithm(function(e,t,n){var r=e.key;if("string"!=typeof r)return!1;var i=c(r);if(s(i,h,v))return!0;for(var o=null,a=v;a<y;++a){var u=function(e,t,n,r,i,o){for(var a=Math.min(e.length,r.length),u=-1,s=0;s<a;++s){var c=t[s];if(c!==r[s])return i(e[s],n[s])<0?e.substr(0,s)+n[s]+n.substr(s+1):i(e[s],r[s])<0?e.substr(0,s)+r[s]+n.substr(s+1):0<=u?e.substr(0,u)+t[u]+n.substr(u+1):null;i(e[s],c)<0&&(u=s)}return a<r.length&&"next"===o?e+n.substr(e.length):a<e.length&&"prev"===o?e.substr(0,n.length):u<0?null:e.substr(0,u)+r[u]+n.substr(u+1)}(r,i,f[a],h[a],l,d);null===u&&null===o?v=a+1:(null===o||0<l(o,u))&&(o=u)}return t(null!==o?function(){e.continue(o+p)}:n),!1}),e}function Gt(e,t,n,r){return{type:2,lower:e,upper:t,lowerOpen:n,upperOpen:r}}function Ht(e){return{type:1,lower:e,upper:e}}var Qt=(Object.defineProperty(Xt.prototype,"Collection",{get:function(){return this._ctx.table.db.Collection},enumerable:!1,configurable:!0}),Xt.prototype.between=function(e,t,n,r){n=!1!==n,r=!0===r;try{return 0<this._cmp(e,t)||0===this._cmp(e,t)&&(n||r)&&(!n||!r)?zt(this):new this.Collection(this,function(){return Gt(e,t,!n,!r)})}catch(e){return Wt(this,dt)}},Xt.prototype.equals=function(e){return null==e?Wt(this,dt):new this.Collection(this,function(){return Ht(e)})},Xt.prototype.above=function(e){return null==e?Wt(this,dt):new this.Collection(this,function(){return Gt(e,void 0,!0)})},Xt.prototype.aboveOrEqual=function(e){return null==e?Wt(this,dt):new this.Collection(this,function(){return Gt(e,void 0,!1)})},Xt.prototype.below=function(e){return null==e?Wt(this,dt):new this.Collection(this,function(){return Gt(void 0,e,!1,!0)})},Xt.prototype.belowOrEqual=function(e){return null==e?Wt(this,dt):new this.Collection(this,function(){return Gt(void 0,e)})},Xt.prototype.startsWith=function(e){return"string"!=typeof e?Wt(this,pt):this.between(e,e+ht,!0,!0)},Xt.prototype.startsWithIgnoreCase=function(e){return""===e?this.startsWith(e):Yt(this,function(e,t){return 0===e.indexOf(t[0])},[e],ht)},Xt.prototype.equalsIgnoreCase=function(e){return Yt(this,function(e,t){return e===t[0]},[e],"")},Xt.prototype.anyOfIgnoreCase=function(){var e=T.apply(B,arguments);return 0===e.length?zt(this):Yt(this,function(e,t){return-1!==t.indexOf(e)},e,"")},Xt.prototype.startsWithAnyOfIgnoreCase=function(){var e=T.apply(B,arguments);return 0===e.length?zt(this):Yt(this,function(t,e){return e.some(function(e){return 0===t.indexOf(e)})},e,ht)},Xt.prototype.anyOf=function(){var t=this,i=T.apply(B,arguments),o=this._cmp;try{i.sort(o)}catch(e){return Wt(this,dt)}if(0===i.length)return zt(this);var e=new this.Collection(this,function(){return Gt(i[0],i[i.length-1])});e._ondirectionchange=function(e){o="next"===e?t._ascending:t._descending,i.sort(o)};var a=0;return e._addAlgorithm(function(e,t,n){for(var r=e.key;0<o(r,i[a]);)if(++a===i.length)return t(n),!1;return 0===o(r,i[a])||(t(function(){e.continue(i[a])}),!1)}),e},Xt.prototype.notEqual=function(e){return this.inAnyRange([[-1/0,e],[e,this.db._maxKey]],{includeLowers:!1,includeUppers:!1})},Xt.prototype.noneOf=function(){var e=T.apply(B,arguments);if(0===e.length)return new this.Collection(this);try{e.sort(this._ascending)}catch(e){return Wt(this,dt)}var t=e.reduce(function(e,t){return e?e.concat([[e[e.length-1][1],t]]):[[-1/0,t]]},null);return t.push([e[e.length-1],this.db._maxKey]),this.inAnyRange(t,{includeLowers:!1,includeUppers:!1})},Xt.prototype.inAnyRange=function(e,t){var o=this,a=this._cmp,u=this._ascending,n=this._descending,s=this._min,c=this._max;if(0===e.length)return zt(this);if(!e.every(function(e){return void 0!==e[0]&&void 0!==e[1]&&u(e[0],e[1])<=0}))return Wt(this,"First argument to inAnyRange() must be an Array of two-value Arrays [lower,upper] where upper must not be lower than lower",J.InvalidArgument);var r=!t||!1!==t.includeLowers,i=t&&!0===t.includeUppers;var l,f=u;function h(e,t){return f(e[0],t[0])}try{(l=e.reduce(function(e,t){for(var n=0,r=e.length;n<r;++n){var i=e[n];if(a(t[0],i[1])<0&&0<a(t[1],i[0])){i[0]=s(i[0],t[0]),i[1]=c(i[1],t[1]);break}}return n===r&&e.push(t),e},[])).sort(h)}catch(e){return Wt(this,dt)}var d=0,p=i?function(e){return 0<u(e,l[d][1])}:function(e){return 0<=u(e,l[d][1])},y=r?function(e){return 0<n(e,l[d][0])}:function(e){return 0<=n(e,l[d][0])};var v=p,e=new this.Collection(this,function(){return Gt(l[0][0],l[l.length-1][1],!r,!i)});return e._ondirectionchange=function(e){f="next"===e?(v=p,u):(v=y,n),l.sort(h)},e._addAlgorithm(function(e,t,n){for(var r,i=e.key;v(i);)if(++d===l.length)return t(n),!1;return!p(r=i)&&!y(r)||(0===o._cmp(i,l[d][1])||0===o._cmp(i,l[d][0])||t(function(){f===u?e.continue(l[d][0]):e.continue(l[d][1])}),!1)}),e},Xt.prototype.startsWithAnyOf=function(){var e=T.apply(B,arguments);return e.every(function(e){return"string"==typeof e})?0===e.length?zt(this):this.inAnyRange(e.map(function(e){return[e,e+ht]})):Wt(this,"startsWithAnyOf() only works with strings")},Xt);function Xt(){}function Jt(t){return We(function(e){return $t(e),t(e.target.error),!1})}function $t(e){e.stopPropagation&&e.stopPropagation(),e.preventDefault&&e.preventDefault()}var Zt="storagemutated",en="x-storagemutated-1",tn=Ot(null,Zt),nn=(rn.prototype._lock=function(){return v(!Oe.global),++this._reculock,1!==this._reculock||Oe.global||(Oe.lockOwnerFor=this),this},rn.prototype._unlock=function(){if(v(!Oe.global),0==--this._reculock)for(Oe.global||(Oe.lockOwnerFor=null);0<this._blockedFuncs.length&&!this._locked();){var e=this._blockedFuncs.shift();try{it(e[1],e[0])}catch(e){}}return this},rn.prototype._locked=function(){return this._reculock&&Oe.lockOwnerFor!==this},rn.prototype.create=function(t){var n=this;if(!this.mode)return this;var e=this.db.idbdb,r=this.db._state.dbOpenError;if(v(!this.idbtrans),!t&&!e)switch(r&&r.name){case"DatabaseClosedError":throw new J.DatabaseClosed(r);case"MissingAPIError":throw new J.MissingAPI(r.message,r);default:throw new J.OpenFailed(r)}if(!this.active)throw new J.TransactionInactive;return v(null===this._completion._state),(t=this.idbtrans=t||(this.db.core||e).transaction(this.storeNames,this.mode,{durability:this.chromeTransactionDurability})).onerror=We(function(e){$t(e),n._reject(t.error)}),t.onabort=We(function(e){$t(e),n.active&&n._reject(new J.Abort(t.error)),n.active=!1,n.on("abort").fire(e)}),t.oncomplete=We(function(){n.active=!1,n._resolve(),"mutatedParts"in t&&tn.storagemutated.fire(t.mutatedParts)}),this},rn.prototype._promise=function(n,r,i){var o=this;if("readwrite"===n&&"readwrite"!==this.mode)return lt(new J.ReadOnly("Transaction is readonly"));if(!this.active)return lt(new J.TransactionInactive);if(this._locked())return new je(function(e,t){o._blockedFuncs.push([function(){o._promise(n,r,i).then(e,t)},Oe])});if(i)return Je(function(){var e=new je(function(e,t){o._lock();var n=r(e,t,o);n&&n.then&&n.then(e,t)});return e.finally(function(){return o._unlock()}),e._lib=!0,e});var e=new je(function(e,t){var n=r(e,t,o);n&&n.then&&n.then(e,t)});return e._lib=!0,e},rn.prototype._root=function(){return this.parent?this.parent._root():this},rn.prototype.waitFor=function(e){var t,r=this._root(),i=je.resolve(e);r._waitingFor?r._waitingFor=r._waitingFor.then(function(){return i}):(r._waitingFor=i,r._waitingQueue=[],t=r.idbtrans.objectStore(r.storeNames[0]),function e(){for(++r._spinCount;r._waitingQueue.length;)r._waitingQueue.shift()();r._waitingFor&&(t.get(-1/0).onsuccess=e)}());var o=r._waitingFor;return new je(function(t,n){i.then(function(e){return r._waitingQueue.push(We(t.bind(null,e)))},function(e){return r._waitingQueue.push(We(n.bind(null,e)))}).finally(function(){r._waitingFor===o&&(r._waitingFor=null)})})},rn.prototype.abort=function(){this.active&&(this.active=!1,this.idbtrans&&this.idbtrans.abort(),this._reject(new J.Abort))},rn.prototype.table=function(e){var t=this._memoizedTables||(this._memoizedTables={});if(m(t,e))return t[e];var n=this.schema[e];if(!n)throw new J.NotFound("Table "+e+" not part of transaction");n=new this.db.Table(e,n,this);return n.core=this.db.core.table(e),t[e]=n},rn);function rn(){}function on(e,t,n,r,i,o,a){return{name:e,keyPath:t,unique:n,multi:r,auto:i,compound:o,src:(n&&!a?"&":"")+(r?"*":"")+(i?"++":"")+an(t)}}function an(e){return"string"==typeof e?e:e?"["+[].join.call(e,"+")+"]":""}function un(e,t,n){return{name:e,primKey:t,indexes:n,mappedClass:null,idxByName:w(n,function(e){return[e.name,e]})}}var sn=function(e){try{return e.only([[]]),sn=function(){return[[]]},[[]]}catch(e){return sn=function(){return ht},ht}};function cn(t){return null==t?function(){}:"string"==typeof t?1===(n=t).split(".").length?function(e){return e[n]}:function(e){return k(e,n)}:function(e){return k(e,t)};var n}function ln(e){return[].slice.call(e)}var fn=0;function hn(e){return null==e?":id":"string"==typeof e?e:"["+e.join("+")+"]"}function dn(e,i,t){function w(e){if(3===e.type)return null;if(4===e.type)throw new Error("Cannot convert never type to IDBKeyRange");var t=e.lower,n=e.upper,r=e.lowerOpen,e=e.upperOpen;return void 0===t?void 0===n?null:i.upperBound(n,!!e):void 0===n?i.lowerBound(t,!!r):i.bound(t,n,!!r,!!e)}function n(e){var h,_=e.name;return{name:_,schema:e,mutate:function(e){var y=e.trans,v=e.type,m=e.keys,g=e.values,b=e.range;return new Promise(function(t,e){t=We(t);var n=y.objectStore(_),r=null==n.keyPath,i="put"===v||"add"===v;if(!i&&"delete"!==v&&"deleteRange"!==v)throw new Error("Invalid operation type: "+v);var o,a=(m||g||{length:1}).length;if(m&&g&&m.length!==g.length)throw new Error("Given keys array must have same length as given values array.");if(0===a)return t({numFailures:0,failures:{},results:[],lastResult:void 0});function u(e){++l,$t(e)}var s=[],c=[],l=0;if("deleteRange"===v){if(4===b.type)return t({numFailures:l,failures:c,results:[],lastResult:void 0});3===b.type?s.push(o=n.clear()):s.push(o=n.delete(w(b)))}else{var r=i?r?[g,m]:[g,null]:[m,null],f=r[0],h=r[1];if(i)for(var d=0;d<a;++d)s.push(o=h&&void 0!==h[d]?n[v](f[d],h[d]):n[v](f[d])),o.onerror=u;else for(d=0;d<a;++d)s.push(o=n[v](f[d])),o.onerror=u}function p(e){e=e.target.result,s.forEach(function(e,t){return null!=e.error&&(c[t]=e.error)}),t({numFailures:l,failures:c,results:"delete"===v?m:s.map(function(e){return e.result}),lastResult:e})}o.onerror=function(e){u(e),p(e)},o.onsuccess=p})},getMany:function(e){var f=e.trans,h=e.keys;return new Promise(function(t,e){t=We(t);for(var n,r=f.objectStore(_),i=h.length,o=new Array(i),a=0,u=0,s=function(e){e=e.target;o[e._pos]=e.result,++u===a&&t(o)},c=Jt(e),l=0;l<i;++l)null!=h[l]&&((n=r.get(h[l]))._pos=l,n.onsuccess=s,n.onerror=c,++a);0===a&&t(o)})},get:function(e){var r=e.trans,i=e.key;return new Promise(function(t,e){t=We(t);var n=r.objectStore(_).get(i);n.onsuccess=function(e){return t(e.target.result)},n.onerror=Jt(e)})},query:(h=s,function(f){return new Promise(function(n,e){n=We(n);var r,i,o,t=f.trans,a=f.values,u=f.limit,s=f.query,c=u===1/0?void 0:u,l=s.index,s=s.range,t=t.objectStore(_),l=l.isPrimaryKey?t:t.index(l.name),s=w(s);if(0===u)return n({result:[]});h?((c=a?l.getAll(s,c):l.getAllKeys(s,c)).onsuccess=function(e){return n({result:e.target.result})},c.onerror=Jt(e)):(r=0,i=!a&&"openKeyCursor"in l?l.openKeyCursor(s):l.openCursor(s),o=[],i.onsuccess=function(e){var t=i.result;return t?(o.push(a?t.value:t.primaryKey),++r===u?n({result:o}):void t.continue()):n({result:o})},i.onerror=Jt(e))})}),openCursor:function(e){var c=e.trans,o=e.values,a=e.query,u=e.reverse,l=e.unique;return new Promise(function(t,n){t=We(t);var e=a.index,r=a.range,i=c.objectStore(_),i=e.isPrimaryKey?i:i.index(e.name),e=u?l?"prevunique":"prev":l?"nextunique":"next",s=!o&&"openKeyCursor"in i?i.openKeyCursor(w(r),e):i.openCursor(w(r),e);s.onerror=Jt(n),s.onsuccess=We(function(e){var r,i,o,a,u=s.result;u?(u.___id=++fn,u.done=!1,r=u.continue.bind(u),i=(i=u.continuePrimaryKey)&&i.bind(u),o=u.advance.bind(u),a=function(){throw new Error("Cursor not stopped")},u.trans=c,u.stop=u.continue=u.continuePrimaryKey=u.advance=function(){throw new Error("Cursor not started")},u.fail=We(n),u.next=function(){var e=this,t=1;return this.start(function(){return t--?e.continue():e.stop()}).then(function(){return e})},u.start=function(e){function t(){if(s.result)try{e()}catch(e){u.fail(e)}else u.done=!0,u.start=function(){throw new Error("Cursor behind last entry")},u.stop()}var n=new Promise(function(t,e){t=We(t),s.onerror=Jt(e),u.fail=e,u.stop=function(e){u.stop=u.continue=u.continuePrimaryKey=u.advance=a,t(e)}});return s.onsuccess=We(function(e){s.onsuccess=t,t()}),u.continue=r,u.continuePrimaryKey=i,u.advance=o,t(),n},t(u)):t(null)},n)})},count:function(e){var t=e.query,i=e.trans,o=t.index,a=t.range;return new Promise(function(t,e){var n=i.objectStore(_),r=o.isPrimaryKey?n:n.index(o.name),n=w(a),r=n?r.count(n):r.count();r.onsuccess=We(function(e){return t(e.target.result)}),r.onerror=Jt(e)})}}}var r,o,a,u=(o=t,a=ln((r=e).objectStoreNames),{schema:{name:r.name,tables:a.map(function(e){return o.objectStore(e)}).map(function(t){var e=t.keyPath,n=t.autoIncrement,r=b(e),i={},n={name:t.name,primaryKey:{name:null,isPrimaryKey:!0,outbound:null==e,compound:r,keyPath:e,autoIncrement:n,unique:!0,extractKey:cn(e)},indexes:ln(t.indexNames).map(function(e){return t.index(e)}).map(function(e){var t=e.name,n=e.unique,r=e.multiEntry,e=e.keyPath,r={name:t,compound:b(e),keyPath:e,unique:n,multiEntry:r,extractKey:cn(e)};return i[hn(e)]=r}),getIndexByKeyPath:function(e){return i[hn(e)]}};return i[":id"]=n.primaryKey,null!=e&&(i[hn(e)]=n.primaryKey),n})},hasGetAll:0<a.length&&"getAll"in o.objectStore(a[0])&&!("undefined"!=typeof navigator&&/Safari/.test(navigator.userAgent)&&!/(Chrome\/|Edge\/)/.test(navigator.userAgent)&&[].concat(navigator.userAgent.match(/Safari\/(\d*)/))[1]<604)}),t=u.schema,s=u.hasGetAll,u=t.tables.map(n),c={};return u.forEach(function(e){return c[e.name]=e}),{stack:"dbcore",transaction:e.transaction.bind(e),table:function(e){if(!c[e])throw new Error("Table '"+e+"' not found");return c[e]},MIN_KEY:-1/0,MAX_KEY:sn(i),schema:t}}function pn(e,t,n,r){var i=n.IDBKeyRange;return n.indexedDB,{dbcore:(r=dn(t,i,r),e.dbcore.reduce(function(e,t){t=t.create;return g(g({},e),t(e))},r))}}function yn(e,t){var n=e._novip,e=t.db,t=pn(n._middlewares,e,n._deps,t);n.core=t.dbcore,n.tables.forEach(function(e){var t=e.name;n.core.schema.tables.some(function(e){return e.name===t})&&(e.core=n.core.table(t),n[t]instanceof n.Table&&(n[t].core=e.core))})}function vn(e,t,n,i){var o=e._novip;n.forEach(function(n){var r=i[n];t.forEach(function(e){var t=f(e,n);(!t||"value"in t&&void 0===t.value)&&(e===o.Transaction.prototype||e instanceof o.Transaction?c(e,n,{get:function(){return this.table(n)},set:function(e){a(this,n,{value:e,writable:!0,configurable:!0,enumerable:!0})}}):e[n]=new o.Table(n,r))})})}function mn(e,t){var n=e._novip;t.forEach(function(e){for(var t in e)e[t]instanceof n.Table&&delete e[t]})}function gn(e,t){return e._cfg.version-t._cfg.version}function bn(n,r,i,e){var o=n._dbSchema,a=n._createTransaction("readwrite",n._storeNames,o);a.create(i),a._completion.catch(e);var u=a._reject.bind(a),p=Oe.transless||Oe;Je(function(){var e,s,c,l,f,t,h,d;Oe.trans=a,Oe.transless=p,0===r?(x(o).forEach(function(e){wn(i,e,o[e].primKey,o[e].indexes)}),yn(n,i),je.follow(function(){return n.on.populate.fire(a)}).catch(u)):(s=r,c=a,l=i,f=(e=n)._novip,t=[],e=f._versions,h=f._dbSchema=kn(0,f.idbdb,l),d=!1,e.filter(function(e){return e._cfg.version>=s}).forEach(function(u){t.push(function(){var t=h,e=u._cfg.dbschema;En(f,t,l),En(f,e,l),h=f._dbSchema=e;var n=_n(t,e);n.add.forEach(function(e){wn(l,e[0],e[1].primKey,e[1].indexes)}),n.change.forEach(function(e){if(e.recreate)throw new J.Upgrade("Not yet support for changing primary key");var t=l.objectStore(e.name);e.add.forEach(function(e){return xn(t,e)}),e.change.forEach(function(e){t.deleteIndex(e.name),xn(t,e)}),e.del.forEach(function(e){return t.deleteIndex(e)})});var r=u._cfg.contentUpgrade;if(r&&u._cfg.version>s){yn(f,l),c._memoizedTables={},d=!0;var i=P(e);n.del.forEach(function(e){i[e]=t[e]}),mn(f,[f.Transaction.prototype]),vn(f,[f.Transaction.prototype],x(i),i),c.schema=i;var o,a=R(r);a&&$e();n=je.follow(function(){var e;(o=r(c))&&a&&(e=Ze.bind(null,null),o.then(e,e))});return o&&"function"==typeof o.then?je.resolve(o):n.then(function(){return o})}}),t.push(function(e){var t,n,r;d&&mt||(t=u._cfg.dbschema,n=t,r=e,[].slice.call(r.db.objectStoreNames).forEach(function(e){return null==n[e]&&r.db.deleteObjectStore(e)})),mn(f,[f.Transaction.prototype]),vn(f,[f.Transaction.prototype],f._storeNames,f._dbSchema),c.schema=f._dbSchema})}),function e(){return t.length?je.resolve(t.shift()(c.idbtrans)).then(e):je.resolve()}().then(function(){var t,n;n=l,x(t=h).forEach(function(e){n.db.objectStoreNames.contains(e)||wn(n,e,t[e].primKey,t[e].indexes)})}).catch(u))})}function _n(e,t){var n,r={del:[],add:[],change:[]};for(n in e)t[n]||r.del.push(n);for(n in t){var i=e[n],o=t[n];if(i){var a={name:n,def:o,recreate:!1,del:[],add:[],change:[]};if(""+(i.primKey.keyPath||"")!=""+(o.primKey.keyPath||"")||i.primKey.auto!==o.primKey.auto&&!vt)a.recreate=!0,r.change.push(a);else{var u=i.idxByName,s=o.idxByName,c=void 0;for(c in u)s[c]||a.del.push(c);for(c in s){var l=u[c],f=s[c];l?l.src!==f.src&&a.change.push(f):a.add.push(f)}(0<a.del.length||0<a.add.length||0<a.change.length)&&r.change.push(a)}}else r.add.push([n,o])}return r}function wn(e,t,n,r){var i=e.db.createObjectStore(t,n.keyPath?{keyPath:n.keyPath,autoIncrement:n.auto}:{autoIncrement:n.auto});return r.forEach(function(e){return xn(i,e)}),i}function xn(e,t){e.createIndex(t.name,t.keyPath,{unique:t.unique,multiEntry:t.multi})}function kn(e,t,u){var s={};return y(t.objectStoreNames,0).forEach(function(e){for(var t=u.objectStore(e),n=on(an(a=t.keyPath),a||"",!1,!1,!!t.autoIncrement,a&&"string"!=typeof a,!0),r=[],i=0;i<t.indexNames.length;++i){var o=t.index(t.indexNames[i]),a=o.keyPath,o=on(o.name,a,!!o.unique,!!o.multiEntry,!1,a&&"string"!=typeof a,!1);r.push(o)}s[e]=un(e,n,r)}),s}function En(e,t,n){for(var r=e._novip,i=n.db.objectStoreNames,o=0;o<i.length;++o){var a=i[o],u=n.objectStore(a);r._hasGetAll="getAll"in u;for(var s=0;s<u.indexNames.length;++s){var c=u.indexNames[s],l=u.index(c).keyPath,f="string"==typeof l?l:"["+y(l).join("+")+"]";!t[a]||(l=t[a].idxByName[f])&&(l.name=c,delete t[a].idxByName[f],t[a].idxByName[c]=l)}}"undefined"!=typeof navigator&&/Safari/.test(navigator.userAgent)&&!/(Chrome\/|Edge\/)/.test(navigator.userAgent)&&h.WorkerGlobalScope&&h instanceof h.WorkerGlobalScope&&[].concat(navigator.userAgent.match(/Safari\/(\d*)/))[1]<604&&(r._hasGetAll=!1)}var Pn=(Kn.prototype._parseStoresSpec=function(r,i){x(r).forEach(function(e){if(null!==r[e]){var t=r[e].split(",").map(function(e,t){var n=(e=e.trim()).replace(/([&*]|\+\+)/g,""),r=/^\[/.test(n)?n.match(/^\[(.*)\]$/)[1].split("+"):n;return on(n,r||null,/\&/.test(e),/\*/.test(e),/\+\+/.test(e),b(r),0===t)}),n=t.shift();if(n.multi)throw new J.Schema("Primary key cannot be multi-valued");t.forEach(function(e){if(e.auto)throw new J.Schema("Only primary key can be marked as autoIncrement (++)");if(!e.keyPath)throw new J.Schema("Index must have a name and cannot be an empty string")}),i[e]=un(e,n,t)}})},Kn.prototype.stores=function(e){var t=this.db;this._cfg.storesSource=this._cfg.storesSource?u(this._cfg.storesSource,e):e;var e=t._versions,n={},r={};return e.forEach(function(e){u(n,e._cfg.storesSource),r=e._cfg.dbschema={},e._parseStoresSpec(n,r)}),t._dbSchema=r,mn(t,[t._allTables,t,t.Transaction.prototype]),vn(t,[t._allTables,t,t.Transaction.prototype,this._cfg.tables],x(r),r),t._storeNames=x(r),this},Kn.prototype.upgrade=function(e){return this._cfg.contentUpgrade=ue(this._cfg.contentUpgrade||Z,e),this},Kn);function Kn(){}function On(e,t){var n=e._dbNamesDB;return n||(n=e._dbNamesDB=new Gn(bt,{addons:[],indexedDB:e,IDBKeyRange:t})).version(1).stores({dbnames:"name"}),n.table("dbnames")}function Sn(e){return e&&"function"==typeof e.databases}function An(e){return Je(function(){return Oe.letThrough=!0,e()})}function Cn(f){var h=f._state,r=f._deps.indexedDB;if(h.isBeingOpened||f.idbdb)return h.dbReadyPromise.then(function(){return h.dbOpenError?lt(h.dbOpenError):f});F&&(h.openCanceller._stackHolder=U()),h.isBeingOpened=!0,h.dbOpenError=null,h.openComplete=!1;var t=h.openCanceller;function e(){if(h.openCanceller!==t)throw new J.DatabaseClosed("db.open() was cancelled")}var n,i=h.dbReadyResolve,d=null,p=!1;return je.race([t,("undefined"==typeof navigator?je.resolve():!navigator.userAgentData&&/Safari\//.test(navigator.userAgent)&&!/Chrom(e|ium)\//.test(navigator.userAgent)&&indexedDB.databases?new Promise(function(e){function t(){return indexedDB.databases().finally(e)}n=setInterval(t,100),t()}).finally(function(){return clearInterval(n)}):Promise.resolve()).then(function(){return new je(function(s,n){if(e(),!r)throw new J.MissingAPI;var c=f.name,l=h.autoSchema?r.open(c):r.open(c,Math.round(10*f.verno));if(!l)throw new J.MissingAPI;l.onerror=Jt(n),l.onblocked=We(f._fireOnBlocked),l.onupgradeneeded=We(function(e){var t;d=l.transaction,h.autoSchema&&!f._options.allowEmptyDB?(l.onerror=$t,d.abort(),l.result.close(),(t=r.deleteDatabase(c)).onsuccess=t.onerror=We(function(){n(new J.NoSuchDatabase("Database "+c+" doesnt exist"))})):(d.onerror=Jt(n),e=e.oldVersion>Math.pow(2,62)?0:e.oldVersion,p=e<1,f._novip.idbdb=l.result,bn(f,e/10,d,n))},n),l.onsuccess=We(function(){d=null;var e,t,n,r,i,o=f._novip.idbdb=l.result,a=y(o.objectStoreNames);if(0<a.length)try{var u=o.transaction(1===(r=a).length?r[0]:r,"readonly");h.autoSchema?(t=o,n=u,(e=(e=f)._novip).verno=t.version/10,n=e._dbSchema=kn(0,t,n),e._storeNames=y(t.objectStoreNames,0),vn(e,[e._allTables],x(n),n)):(En(f,f._dbSchema,u),((i=_n(kn(0,(i=f).idbdb,u),i._dbSchema)).add.length||i.change.some(function(e){return e.add.length||e.change.length}))&&console.warn("Dexie SchemaDiff: Schema was extended without increasing the number passed to db.version(). Some queries may fail.")),yn(f,u)}catch(e){}yt.push(f),o.onversionchange=We(function(e){h.vcFired=!0,f.on("versionchange").fire(e)}),o.onclose=We(function(e){f.on("close").fire(e)}),p&&(i=f._deps,u=c,o=i.indexedDB,i=i.IDBKeyRange,Sn(o)||u===bt||On(o,i).put({name:u}).catch(Z)),s()},n)})})]).then(function(){return e(),h.onReadyBeingFired=[],je.resolve(An(function(){return f.on.ready.fire(f.vip)})).then(function e(){if(0<h.onReadyBeingFired.length){var t=h.onReadyBeingFired.reduce(ue,Z);return h.onReadyBeingFired=[],je.resolve(An(function(){return t(f.vip)})).then(e)}})}).finally(function(){h.onReadyBeingFired=null,h.isBeingOpened=!1}).then(function(){return f}).catch(function(e){h.dbOpenError=e;try{d&&d.abort()}catch(e){}return t===h.openCanceller&&f._close(),lt(e)}).finally(function(){h.openComplete=!0,i()})}function jn(t){function e(e){return t.next(e)}var r=n(e),i=n(function(e){return t.throw(e)});function n(n){return function(e){var t=n(e),e=t.value;return t.done?e:e&&"function"==typeof e.then?e.then(r,i):b(e)?Promise.all(e).then(r,i):r(e)}}return n(e)()}function Dn(e,t,n){for(var r=b(e)?e.slice():[e],i=0;i<n;++i)r.push(t);return r}var In={stack:"dbcore",name:"VirtualIndexMiddleware",level:1,create:function(f){return g(g({},f),{table:function(e){var a=f.table(e),t=a.schema,u={},s=[];function c(e,t,n){var r=hn(e),i=u[r]=u[r]||[],o=null==e?0:"string"==typeof e?1:e.length,r=0<t,r=g(g({},n),{isVirtual:r,keyTail:t,keyLength:o,extractKey:cn(e),unique:!r&&n.unique});return i.push(r),r.isPrimaryKey||s.push(r),1<o&&c(2===o?e[0]:e.slice(0,o-1),t+1,n),i.sort(function(e,t){return e.keyTail-t.keyTail}),r}e=c(t.primaryKey.keyPath,0,t.primaryKey);u[":id"]=[e];for(var n=0,r=t.indexes;n<r.length;n++){var i=r[n];c(i.keyPath,0,i)}function l(e){var t,n=e.query.index;return n.isVirtual?g(g({},e),{query:{index:n,range:(t=e.query.range,n=n.keyTail,{type:1===t.type?2:t.type,lower:Dn(t.lower,t.lowerOpen?f.MAX_KEY:f.MIN_KEY,n),lowerOpen:!0,upper:Dn(t.upper,t.upperOpen?f.MIN_KEY:f.MAX_KEY,n),upperOpen:!0})}}):e}return g(g({},a),{schema:g(g({},t),{primaryKey:e,indexes:s,getIndexByKeyPath:function(e){return(e=u[hn(e)])&&e[0]}}),count:function(e){return a.count(l(e))},query:function(e){return a.query(l(e))},openCursor:function(t){var e=t.query.index,r=e.keyTail,n=e.isVirtual,i=e.keyLength;return n?a.openCursor(l(t)).then(function(e){return e&&o(e)}):a.openCursor(t);function o(n){return Object.create(n,{continue:{value:function(e){null!=e?n.continue(Dn(e,t.reverse?f.MAX_KEY:f.MIN_KEY,r)):t.unique?n.continue(n.key.slice(0,i).concat(t.reverse?f.MIN_KEY:f.MAX_KEY,r)):n.continue()}},continuePrimaryKey:{value:function(e,t){n.continuePrimaryKey(Dn(e,f.MAX_KEY,r),t)}},primaryKey:{get:function(){return n.primaryKey}},key:{get:function(){var e=n.key;return 1===i?e[0]:e.slice(0,i)}},value:{get:function(){return n.value}}})}}})}})}};function Bn(i,o,a,u){return a=a||{},u=u||"",x(i).forEach(function(e){var t,n,r;m(o,e)?(t=i[e],n=o[e],"object"==typeof t&&"object"==typeof n&&t&&n?(r=j(t))!==j(n)?a[u+e]=o[e]:"Object"===r?Bn(t,n,a,u+e+"."):t!==n&&(a[u+e]=o[e]):t!==n&&(a[u+e]=o[e])):a[u+e]=void 0}),x(o).forEach(function(e){m(i,e)||(a[u+e]=o[e])}),a}var Tn={stack:"dbcore",name:"HooksMiddleware",level:2,create:function(e){return g(g({},e),{table:function(r){var y=e.table(r),v=y.schema.primaryKey;return g(g({},y),{mutate:function(e){var t=Oe.trans,n=t.table(r).hook,h=n.deleting,d=n.creating,p=n.updating;switch(e.type){case"add":if(d.fire===Z)break;return t._promise("readwrite",function(){return a(e)},!0);case"put":if(d.fire===Z&&p.fire===Z)break;return t._promise("readwrite",function(){return a(e)},!0);case"delete":if(h.fire===Z)break;return t._promise("readwrite",function(){return a(e)},!0);case"deleteRange":if(h.fire===Z)break;return t._promise("readwrite",function(){return function n(r,i,o){return y.query({trans:r,values:!1,query:{index:v,range:i},limit:o}).then(function(e){var t=e.result;return a({type:"delete",keys:t,trans:r}).then(function(e){return 0<e.numFailures?Promise.reject(e.failures[0]):t.length<o?{failures:[],numFailures:0,lastResult:void 0}:n(r,g(g({},i),{lower:t[t.length-1],lowerOpen:!0}),o)})})}(e.trans,e.range,1e4)},!0)}return y.mutate(e);function a(c){var e,t,n,l=Oe.trans,f=c.keys||(t=v,"delete"===(n=c).type?n.keys:n.keys||n.values.map(t.extractKey));if(!f)throw new Error("Keys missing");return"delete"!==(c="add"===c.type||"put"===c.type?g(g({},c),{keys:f}):g({},c)).type&&(c.values=i([],c.values,!0)),c.keys&&(c.keys=i([],c.keys,!0)),e=y,n=f,("add"===(t=c).type?Promise.resolve([]):e.getMany({trans:t.trans,keys:n,cache:"immutable"})).then(function(u){var s=f.map(function(e,t){var n,r,i,o=u[t],a={onerror:null,onsuccess:null};return"delete"===c.type?h.fire.call(a,e,o,l):"add"===c.type||void 0===o?(n=d.fire.call(a,e,c.values[t],l),null==e&&null!=n&&(c.keys[t]=e=n,v.outbound||E(c.values[t],v.keyPath,e))):(n=Bn(o,c.values[t]),(r=p.fire.call(a,n,e,o,l))&&(i=c.values[t],Object.keys(r).forEach(function(e){m(i,e)?i[e]=r[e]:E(i,e,r[e])}))),a});return y.mutate(c).then(function(e){for(var t=e.failures,n=e.results,r=e.numFailures,e=e.lastResult,i=0;i<f.length;++i){var o=(n||f)[i],a=s[i];null==o?a.onerror&&a.onerror(t[i]):a.onsuccess&&a.onsuccess("put"===c.type&&u[i]?c.values[i]:o)}return{failures:t,results:n,numFailures:r,lastResult:e}}).catch(function(t){return s.forEach(function(e){return e.onerror&&e.onerror(t)}),Promise.reject(t)})})}}})}})}};function Rn(e,t,n){try{if(!t)return null;if(t.keys.length<e.length)return null;for(var r=[],i=0,o=0;i<t.keys.length&&o<e.length;++i)0===Rt(t.keys[i],e[o])&&(r.push(n?A(t.values[i]):t.values[i]),++o);return r.length===e.length?r:null}catch(e){return null}}var Fn={stack:"dbcore",level:-1,create:function(t){return{table:function(e){var n=t.table(e);return g(g({},n),{getMany:function(t){if(!t.cache)return n.getMany(t);var e=Rn(t.keys,t.trans._cache,"clone"===t.cache);return e?je.resolve(e):n.getMany(t).then(function(e){return t.trans._cache={keys:t.keys,values:"clone"===t.cache?A(e):e},e})},mutate:function(e){return"add"!==e.type&&(e.trans._cache=null),n.mutate(e)}})}}}};function Mn(e){return!("from"in e)}var Nn=function(e,t){if(!this){var n=new Nn;return e&&"d"in e&&u(n,e),n}u(this,arguments.length?{d:1,from:e,to:1<arguments.length?t:e}:{d:0})};function qn(e,t,n){var r=Rt(t,n);if(!isNaN(r)){if(0<r)throw RangeError();if(Mn(e))return u(e,{from:t,to:n,d:1});var i=e.l,r=e.r;if(Rt(n,e.from)<0)return i?qn(i,t,n):e.l={from:t,to:n,d:1,l:null,r:null},Wn(e);if(0<Rt(t,e.to))return r?qn(r,t,n):e.r={from:t,to:n,d:1,l:null,r:null},Wn(e);Rt(t,e.from)<0&&(e.from=t,e.l=null,e.d=r?r.d+1:1),0<Rt(n,e.to)&&(e.to=n,e.r=null,e.d=e.l?e.l.d+1:1);n=!e.r;i&&!e.l&&Un(e,i),r&&n&&Un(e,r)}}function Un(e,t){Mn(t)||function e(t,n){var r=n.from,i=n.to,o=n.l,n=n.r;qn(t,r,i),o&&e(t,o),n&&e(t,n)}(e,t)}function Ln(e,t){var n=Vn(t),r=n.next();if(r.done)return!1;for(var i=r.value,o=Vn(e),a=o.next(i.from),u=a.value;!r.done&&!a.done;){if(Rt(u.from,i.to)<=0&&0<=Rt(u.to,i.from))return!0;Rt(i.from,u.from)<0?i=(r=n.next(u.from)).value:u=(a=o.next(i.from)).value}return!1}function Vn(e){var n=Mn(e)?null:{s:0,n:e};return{next:function(e){for(var t=0<arguments.length;n;)switch(n.s){case 0:if(n.s=1,t)for(;n.n.l&&Rt(e,n.n.from)<0;)n={up:n,n:n.n.l,s:1};else for(;n.n.l;)n={up:n,n:n.n.l,s:1};case 1:if(n.s=2,!t||Rt(e,n.n.to)<=0)return{value:n.n,done:!1};case 2:if(n.n.r){n.s=3,n={up:n,n:n.n.r,s:0};continue}case 3:n=n.up}return{done:!0}}}}function Wn(e){var t,n,r=((null===(t=e.r)||void 0===t?void 0:t.d)||0)-((null===(n=e.l)||void 0===n?void 0:n.d)||0),i=1<r?"r":r<-1?"l":"";i&&(t="r"==i?"l":"r",n=g({},e),r=e[i],e.from=r.from,e.to=r.to,e[i]=r[i],n[i]=r[t],(e[t]=n).d=zn(n)),e.d=zn(e)}function zn(e){var t=e.r,e=e.l;return(t?e?Math.max(t.d,e.d):t.d:e?e.d:0)+1}r(Nn.prototype,((e={add:function(e){return Un(this,e),this},addKey:function(e){return qn(this,e,e),this},addKeys:function(e){var t=this;return e.forEach(function(e){return qn(t,e,e)}),this}})[D]=function(){return Vn(this)},e));var Yn={stack:"dbcore",level:0,create:function(r){var v=r.schema.name,m=new Nn(r.MIN_KEY,r.MAX_KEY);return g(g({},r),{table:function(d){function e(e){var e=(t=e.query).index,t=t.range;return[e,new Nn(null!==(e=t.lower)&&void 0!==e?e:r.MIN_KEY,null!==(t=t.upper)&&void 0!==t?t:r.MAX_KEY)]}var p=r.table(d),y=p.schema,t=y.primaryKey,c=t.extractKey,l=t.outbound,n=g(g({},p),{mutate:function(e){function n(e){return r[e="idb://"+v+"/"+d+"/"+e]||(r[e]=new Nn)}var t=e.trans,r=t.mutatedParts||(t.mutatedParts={}),i=n(""),s=n(":dels"),c=e.type,t="deleteRange"===e.type?[e.range]:"delete"===e.type?[e.keys]:e.values.length<50?[[],e.values]:[],l=t[0],f=t[1],h=e.trans._cache;return p.mutate(e).then(function(e){var t,o,a,u;return b(l)?("delete"!==c&&(l=e.results),i.addKeys(l),(t=Rn(l,h))||"add"===c||s.addKeys(l),(t||f)&&(o=n,a=t,u=f,y.indexes.forEach(function(t){var n=o(t.name||"");function r(e){return null!=e?t.extractKey(e):null}function i(e){return t.multiEntry&&b(e)?e.forEach(function(e){return n.addKey(e)}):n.addKey(e)}(a||u).forEach(function(e,t){var n=a&&r(a[t]),t=u&&r(u[t]);0!==Rt(n,t)&&(null!=n&&i(n),null!=t&&i(t))})}))):l?(t={from:l.lower,to:l.upper},s.add(t),i.add(t)):(i.add(m),s.add(m),y.indexes.forEach(function(e){return n(e.name).add(m)})),e})}}),f={get:function(e){return[t,new Nn(e.key)]},getMany:function(e){return[t,(new Nn).addKeys(e.keys)]},count:e,query:e,openCursor:e};return x(f).forEach(function(s){n[s]=function(i){var t=Oe.subscr;if(t){var e=function(e){e="idb://"+v+"/"+d+"/"+e;return t[e]||(t[e]=new Nn)},o=e(""),a=e(":dels"),n=f[s](i),r=n[0],n=n[1];if(e(r.name||"").add(n),!r.isPrimaryKey){if("count"!==s){var u="query"===s&&l&&i.values&&p.query(g(g({},i),{values:!1}));return p[s].apply(this,arguments).then(function(t){if("query"===s){if(l&&i.values)return u.then(function(e){e=e.result;return o.addKeys(e),t});var e=i.values?t.result.map(c):t.result;(i.values?o:a).addKeys(e)}else if("openCursor"===s){var n=t,r=i.values;return n&&Object.create(n,{key:{get:function(){return a.addKey(n.primaryKey),n.key}},primaryKey:{get:function(){var e=n.primaryKey;return a.addKey(e),e}},value:{get:function(){return r&&o.addKey(n.primaryKey),n.value}}})}return t})}a.add(m)}}return p[s].apply(this,arguments)}}),n}})}};var Gn=(Hn.prototype.version=function(t){if(isNaN(t)||t<.1)throw new J.Type("Given version is not a positive number");if(t=Math.round(10*t)/10,this.idbdb||this._state.isBeingOpened)throw new J.Schema("Cannot add version when database is open");this.verno=Math.max(this.verno,t);var e=this._versions,n=e.filter(function(e){return e._cfg.version===t})[0];return n||(n=new this.Version(t),e.push(n),e.sort(gn),n.stores({}),this._state.autoSchema=!1,n)},Hn.prototype._whenReady=function(e){var n=this;return this.idbdb&&(this._state.openComplete||Oe.letThrough||this._vip)?e():new je(function(e,t){if(n._state.openComplete)return t(new J.DatabaseClosed(n._state.dbOpenError));if(!n._state.isBeingOpened){if(!n._options.autoOpen)return void t(new J.DatabaseClosed);n.open().catch(Z)}n._state.dbReadyPromise.then(e,t)}).then(e)},Hn.prototype.use=function(e){var t=e.stack,n=e.create,r=e.level,i=e.name;i&&this.unuse({stack:t,name:i});e=this._middlewares[t]||(this._middlewares[t]=[]);return e.push({stack:t,create:n,level:null==r?10:r,name:i}),e.sort(function(e,t){return e.level-t.level}),this},Hn.prototype.unuse=function(e){var t=e.stack,n=e.name,r=e.create;return t&&this._middlewares[t]&&(this._middlewares[t]=this._middlewares[t].filter(function(e){return r?e.create!==r:!!n&&e.name!==n})),this},Hn.prototype.open=function(){return Cn(this)},Hn.prototype._close=function(){var n=this._state,e=yt.indexOf(this);if(0<=e&&yt.splice(e,1),this.idbdb){try{this.idbdb.close()}catch(e){}this._novip.idbdb=null}n.dbReadyPromise=new je(function(e){n.dbReadyResolve=e}),n.openCanceller=new je(function(e,t){n.cancelOpen=t})},Hn.prototype.close=function(){this._close();var e=this._state;this._options.autoOpen=!1,e.dbOpenError=new J.DatabaseClosed,e.isBeingOpened&&e.cancelOpen(e.dbOpenError)},Hn.prototype.delete=function(){var i=this,n=0<arguments.length,o=this._state;return new je(function(r,t){function e(){i.close();var e=i._deps.indexedDB.deleteDatabase(i.name);e.onsuccess=We(function(){var e,t,n;e=i._deps,t=i.name,n=e.indexedDB,e=e.IDBKeyRange,Sn(n)||t===bt||On(n,e).delete(t).catch(Z),r()}),e.onerror=Jt(t),e.onblocked=i._fireOnBlocked}if(n)throw new J.InvalidArgument("Arguments not allowed in db.delete()");o.isBeingOpened?o.dbReadyPromise.then(e):e()})},Hn.prototype.backendDB=function(){return this.idbdb},Hn.prototype.isOpen=function(){return null!==this.idbdb},Hn.prototype.hasBeenClosed=function(){var e=this._state.dbOpenError;return e&&"DatabaseClosed"===e.name},Hn.prototype.hasFailed=function(){return null!==this._state.dbOpenError},Hn.prototype.dynamicallyOpened=function(){return this._state.autoSchema},Object.defineProperty(Hn.prototype,"tables",{get:function(){var t=this;return x(this._allTables).map(function(e){return t._allTables[e]})},enumerable:!1,configurable:!0}),Hn.prototype.transaction=function(){var e=function(e,t,n){var r=arguments.length;if(r<2)throw new J.InvalidArgument("Too few arguments");for(var i=new Array(r-1);--r;)i[r-1]=arguments[r];return n=i.pop(),[e,K(i),n]}.apply(this,arguments);return this._transaction.apply(this,e)},Hn.prototype._transaction=function(e,t,n){var r=this,i=Oe.trans;i&&i.db===this&&-1===e.indexOf("!")||(i=null);var o,a,u=-1!==e.indexOf("?");e=e.replace("!","").replace("?","");try{if(a=t.map(function(e){e=e instanceof r.Table?e.name:e;if("string"!=typeof e)throw new TypeError("Invalid table argument to Dexie.transaction(). Only Table or String are allowed");return e}),"r"==e||e===_t)o=_t;else{if("rw"!=e&&e!=wt)throw new J.InvalidArgument("Invalid transaction mode: "+e);o=wt}if(i){if(i.mode===_t&&o===wt){if(!u)throw new J.SubTransaction("Cannot enter a sub-transaction with READWRITE mode when parent transaction is READONLY");i=null}i&&a.forEach(function(e){if(i&&-1===i.storeNames.indexOf(e)){if(!u)throw new J.SubTransaction("Table "+e+" not included in parent transaction.");i=null}}),u&&i&&!i.active&&(i=null)}}catch(n){return i?i._promise(null,function(e,t){t(n)}):lt(n)}var s=function i(o,a,u,s,c){return je.resolve().then(function(){var e=Oe.transless||Oe,t=o._createTransaction(a,u,o._dbSchema,s),e={trans:t,transless:e};if(s)t.idbtrans=s.idbtrans;else try{t.create(),o._state.PR1398_maxLoop=3}catch(e){return e.name===Q.InvalidState&&o.isOpen()&&0<--o._state.PR1398_maxLoop?(console.warn("Dexie: Need to reopen db"),o._close(),o.open().then(function(){return i(o,a,u,null,c)})):lt(e)}var n,r=R(c);return r&&$e(),e=je.follow(function(){var e;(n=c.call(t,t))&&(r?(e=Ze.bind(null,null),n.then(e,e)):"function"==typeof n.next&&"function"==typeof n.throw&&(n=jn(n)))},e),(n&&"function"==typeof n.then?je.resolve(n).then(function(e){return t.active?e:lt(new J.PrematureCommit("Transaction committed too early. See http://bit.ly/2kdckMn"))}):e.then(function(){return n})).then(function(e){return s&&t._resolve(),t._completion.then(function(){return e})}).catch(function(e){return t._reject(e),lt(e)})})}.bind(null,this,o,a,i,n);return i?i._promise(o,s,"lock"):Oe.trans?it(Oe.transless,function(){return r._whenReady(s)}):this._whenReady(s)},Hn.prototype.table=function(e){if(!m(this._allTables,e))throw new J.InvalidTable("Table "+e+" does not exist");return this._allTables[e]},Hn);function Hn(e,t){var o=this;this._middlewares={},this.verno=0;var n=Hn.dependencies;this._options=t=g({addons:Hn.addons,autoOpen:!0,indexedDB:n.indexedDB,IDBKeyRange:n.IDBKeyRange},t),this._deps={indexedDB:t.indexedDB,IDBKeyRange:t.IDBKeyRange};n=t.addons;this._dbSchema={},this._versions=[],this._storeNames=[],this._allTables={},this.idbdb=null,this._novip=this;var a,r,u,i,s,c={dbOpenError:null,isBeingOpened:!1,onReadyBeingFired:null,openComplete:!1,dbReadyResolve:Z,dbReadyPromise:null,cancelOpen:Z,openCanceller:null,autoSchema:!0,PR1398_maxLoop:3};c.dbReadyPromise=new je(function(e){c.dbReadyResolve=e}),c.openCanceller=new je(function(e,t){c.cancelOpen=t}),this._state=c,this.name=e,this.on=Ot(this,"populate","blocked","versionchange","close",{ready:[ue,Z]}),this.on.ready.subscribe=p(this.on.ready.subscribe,function(i){return function(n,r){Hn.vip(function(){var t,e=o._state;e.openComplete?(e.dbOpenError||je.resolve().then(n),r&&i(n)):e.onReadyBeingFired?(e.onReadyBeingFired.push(n),r&&i(n)):(i(n),t=o,r||i(function e(){t.on.ready.unsubscribe(n),t.on.ready.unsubscribe(e)}))})}}),this.Collection=(a=this,St(Nt.prototype,function(e,t){this.db=a;var n=kt,r=null;if(t)try{n=t()}catch(e){r=e}var i=e._ctx,t=i.table,e=t.hook.reading.fire;this._ctx={table:t,index:i.index,isPrimKey:!i.index||t.schema.primKey.keyPath&&i.index===t.schema.primKey.name,range:n,keysOnly:!1,dir:"next",unique:"",algorithm:null,filter:null,replayFilter:null,justLimit:!0,isMatch:null,offset:0,limit:1/0,error:r,or:i.or,valueMapper:e!==ee?e:null}})),this.Table=(r=this,St(Pt.prototype,function(e,t,n){this.db=r,this._tx=n,this.name=e,this.schema=t,this.hook=r._allTables[e]?r._allTables[e].hook:Ot(null,{creating:[re,Z],reading:[te,ee],updating:[oe,Z],deleting:[ie,Z]})})),this.Transaction=(u=this,St(nn.prototype,function(e,t,n,r,i){var o=this;this.db=u,this.mode=e,this.storeNames=t,this.schema=n,this.chromeTransactionDurability=r,this.idbtrans=null,this.on=Ot(this,"complete","error","abort"),this.parent=i||null,this.active=!0,this._reculock=0,this._blockedFuncs=[],this._resolve=null,this._reject=null,this._waitingFor=null,this._waitingQueue=null,this._spinCount=0,this._completion=new je(function(e,t){o._resolve=e,o._reject=t}),this._completion.then(function(){o.active=!1,o.on.complete.fire()},function(e){var t=o.active;return o.active=!1,o.on.error.fire(e),o.parent?o.parent._reject(e):t&&o.idbtrans&&o.idbtrans.abort(),lt(e)})})),this.Version=(i=this,St(Pn.prototype,function(e){this.db=i,this._cfg={version:e,storesSource:null,dbschema:{},tables:{},contentUpgrade:null}})),this.WhereClause=(s=this,St(Qt.prototype,function(e,t,n){this.db=s,this._ctx={table:e,index:":id"===t?null:t,or:n};var r=s._deps.indexedDB;if(!r)throw new J.MissingAPI;this._cmp=this._ascending=r.cmp.bind(r),this._descending=function(e,t){return r.cmp(t,e)},this._max=function(e,t){return 0<r.cmp(e,t)?e:t},this._min=function(e,t){return r.cmp(e,t)<0?e:t},this._IDBKeyRange=s._deps.IDBKeyRange})),this.on("versionchange",function(e){0<e.newVersion?console.warn("Another connection wants to upgrade database '"+o.name+"'. Closing db now to resume the upgrade."):console.warn("Another connection wants to delete database '"+o.name+"'. Closing db now to resume the delete request."),o.close()}),this.on("blocked",function(e){!e.newVersion||e.newVersion<e.oldVersion?console.warn("Dexie.delete('"+o.name+"') was blocked"):console.warn("Upgrade '"+o.name+"' blocked by other connection holding version "+e.oldVersion/10)}),this._maxKey=sn(t.IDBKeyRange),this._createTransaction=function(e,t,n,r){return new o.Transaction(e,t,n,o._options.chromeTransactionDurability,r)},this._fireOnBlocked=function(t){o.on("blocked").fire(t),yt.filter(function(e){return e.name===o.name&&e!==o&&!e._state.vcFired}).map(function(e){return e.on("versionchange").fire(t)})},this.use(In),this.use(Tn),this.use(Yn),this.use(Fn),this.vip=Object.create(this,{_vip:{value:!0}}),n.forEach(function(e){return e(o)})}var e="undefined"!=typeof Symbol&&"observable"in Symbol?Symbol.observable:"@@observable",Qn=(Xn.prototype.subscribe=function(e,t,n){return this._subscribe(e&&"function"!=typeof e?e:{next:e,error:t,complete:n})},Xn.prototype[e]=function(){return this},Xn);function Xn(e){this._subscribe=e}function Jn(t,n){return x(n).forEach(function(e){Un(t[e]||(t[e]=new Nn),n[e])}),t}function $n(d){return new Qn(function(n){var r=R(d);var i=!1,o={},a={},u={get closed(){return i},unsubscribe:function(){i=!0,tn.storagemutated.unsubscribe(f)}};n.start&&n.start(u);var s=!1,c=!1;function l(){return x(a).some(function(e){return o[e]&&Ln(o[e],a[e])})}var f=function(e){Jn(o,e),l()&&h()},h=function(){var t,e;s||i||(o={},e=function(e){r&&$e();var t=function(){return Je(d,{subscr:e,trans:null})},t=Oe.trans?it(Oe.transless,t):t();return r&&t.then(Ze,Ze),t}(t={}),c||(tn(Zt,f),c=!0),s=!0,Promise.resolve(e).then(function(e){s=!1,i||(l()?h():(o={},a=t,n.next&&n.next(e)))},function(e){s=!1,n.error&&n.error(e),u.unsubscribe()}))};return h(),u})}try{nr={indexedDB:h.indexedDB||h.mozIndexedDB||h.webkitIndexedDB||h.msIndexedDB,IDBKeyRange:h.IDBKeyRange||h.webkitIDBKeyRange}}catch(e){nr={indexedDB:null,IDBKeyRange:null}}var Zn=Gn;function er(e){var t=rr;try{rr=!0,tn.storagemutated.fire(e)}finally{rr=t}}r(Zn,g(g({},V),{delete:function(e){return new Zn(e,{addons:[]}).delete()},exists:function(e){return new Zn(e,{addons:[]}).open().then(function(e){return e.close(),!0}).catch("NoSuchDatabaseError",function(){return!1})},getDatabaseNames:function(e){try{return t=Zn.dependencies,n=t.indexedDB,t=t.IDBKeyRange,(Sn(n)?Promise.resolve(n.databases()).then(function(e){return e.map(function(e){return e.name}).filter(function(e){return e!==bt})}):On(n,t).toCollection().primaryKeys()).then(e)}catch(e){return lt(new J.MissingAPI)}var t,n},defineClass:function(){return function(e){u(this,e)}},ignoreTransaction:function(e){return Oe.trans?it(Oe.transless,e):e()},vip:An,async:function(t){return function(){try{var e=jn(t.apply(this,arguments));return e&&"function"==typeof e.then?e:je.resolve(e)}catch(e){return lt(e)}}},spawn:function(e,t,n){try{var r=jn(e.apply(n,t||[]));return r&&"function"==typeof r.then?r:je.resolve(r)}catch(e){return lt(e)}},currentTransaction:{get:function(){return Oe.trans||null}},waitFor:function(e,t){t=je.resolve("function"==typeof e?Zn.ignoreTransaction(e):e).timeout(t||6e4);return Oe.trans?Oe.trans.waitFor(t):t},Promise:je,debug:{get:function(){return F},set:function(e){M(e,"dexie"===e?function(){return!0}:ft)}},derive:o,extend:u,props:r,override:p,Events:Ot,on:tn,liveQuery:$n,extendObservabilitySet:Jn,getByKeyPath:k,setByKeyPath:E,delByKeyPath:function(t,e){"string"==typeof e?E(t,e,void 0):"length"in e&&[].map.call(e,function(e){E(t,e,void 0)})},shallowClone:P,deepClone:A,getObjectDiff:Bn,cmp:Rt,asap:_,minKey:-1/0,addons:[],connections:yt,errnames:Q,dependencies:nr,semVer:"3.2.3",version:"3.2.3".split(".").map(function(e){return parseInt(e)}).reduce(function(e,t,n){return e+t/Math.pow(10,2*n)})})),Zn.maxKey=sn(Zn.dependencies.IDBKeyRange),"undefined"!=typeof dispatchEvent&&"undefined"!=typeof addEventListener&&(tn(Zt,function(e){var t;rr||(vt?(t=document.createEvent("CustomEvent")).initCustomEvent(en,!0,!0,e):t=new CustomEvent(en,{detail:e}),rr=!0,dispatchEvent(t),rr=!1)}),addEventListener(en,function(e){e=e.detail;rr||er(e)}));var tr,nr,rr=!1;return"undefined"!=typeof BroadcastChannel?("function"==typeof(tr=new BroadcastChannel(en)).unref&&tr.unref(),tn(Zt,function(e){rr||tr.postMessage(e)}),tr.onmessage=function(e){e.data&&er(e.data)}):"undefined"!=typeof self&&"undefined"!=typeof navigator&&(tn(Zt,function(t){try{rr||("undefined"!=typeof localStorage&&localStorage.setItem(en,JSON.stringify({trig:Math.random(),changedParts:t})),"object"==typeof self.clients&&i([],self.clients.matchAll({includeUncontrolled:!0}),!0).forEach(function(e){return e.postMessage({type:en,changedParts:t})}))}catch(e){}}),"undefined"!=typeof addEventListener&&addEventListener("storage",function(e){e.key!==en||(e=JSON.parse(e.newValue))&&er(e.changedParts)}),(nr=self.document&&navigator.serviceWorker)&&nr.addEventListener("message",function(e){e=e.data;e&&e.type===en&&er(e.changedParts)})),je.rejectionMapper=function(e,t){return!e||e instanceof z||e instanceof TypeError||e instanceof SyntaxError||!e.name||!$[e.name]?e:(t=new $[e.name](t||e.message,e),"stack"in e&&c(t,"stack",{get:function(){return this.inner.stack}}),t)},M(F,ft),g(Gn,Object.freeze({__proto__:null,Dexie:Gn,liveQuery:$n,default:Gn,RangeSet:Nn,mergeRanges:Un,rangesOverlap:Ln}),{default:Gn}),Gn});</script>
<!-- <script src="https://unpkg.com/[email protected]/dist/dexie-export-import.js"></script> -->
<script>!function(e,t){"object"==typeof exports&&"undchat#editefined"!=typeof module?t(exports,require("dexie")):"function"==typeof define&&define.amd?define(["exports","dexie"],t):(e="undefined"!=typeof globalThis?globalThis:e||self,t(e.DexieExportImport={},e.Dexie))}(this,function(e,t){"use strict";var n,r=(n=t)&&"object"==typeof n&&"default"in n?n:{default:n};function i(e,t,n,r){return new(n||(n=Promise))(function(i,o){function a(e){try{s(r.next(e))}catch(t){o(t)}}function u(e){try{s(r.throw(e))}catch(t){o(t)}}function s(e){var t;e.done?i(e.value):((t=e.value)instanceof n?t:new n(function(e){e(t)})).then(a,u)}s((r=r.apply(e,t||[])).next())})}function o(e,t){var n,r,i,o,a={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:u(0),throw:u(1),return:u(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function u(o){return function(u){return function o(u){if(n)throw TypeError("Generator is already executing.");for(;a;)try{if(n=1,r&&(i=2&u[0]?r.return:u[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,u[1])).done)return i;switch(r=0,i&&(u=[2&u[0],i.value]),u[0]){case 0:case 1:i=u;break;case 4:return a.label++,{value:u[1],done:!1};case 5:a.label++,r=u[1],u=[0];continue;case 7:u=a.ops.pop(),a.trys.pop();continue;default:if(!(i=(i=a.trys).length>0&&i[i.length-1])&&(6===u[0]||2===u[0])){a=0;continue}if(3===u[0]&&(!i||u[1]>i[0]&&u[1]<i[3])){a.label=u[1];break}if(6===u[0]&&a.label<i[1]){a.label=i[1],i=u;break}if(i&&a.label<i[2]){a.label=i[2],a.ops.push(u);break}i[2]&&a.ops.pop(),a.trys.pop();continue}u=t.call(e,a)}catch(s){u=[6,s],r=0}finally{n=i=0}if(5&u[0])throw u[1];return{value:u[0]?u[1]:void 0,done:!0}}([o,u])}}}function a(e,t){return new Promise(function(n,r){var i=new FileReader;i.onabort=function(e){return r(Error("file read aborted"))},i.onerror=function(e){return r(e.target.error)},i.onload=function(e){return n(e.target.result)},"binary"===t?i.readAsArrayBuffer(e):i.readAsText(e)})}function u(e,t){if("undefined"==typeof FileReaderSync)throw Error("FileReaderSync missing. Reading blobs synchronously requires code to run from within a web worker. Use TSON.encapsulateAsync() to do it from the main thread.");var n=new FileReaderSync;return"binary"===t?n.readAsArrayBuffer(e):n.readAsText(e)}var s="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function c(e,t){return e(t={exports:{}},t.exports),t.exports}for(var f=c(function(e,t){var n,r;r=function(){function e(t){return(e="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(t)}function t(e,t,n,r,i,o,a){try{var u=e[o](a),s=u.value}catch(c){n(c);return}u.done?t(s):Promise.resolve(s).then(r,i)}function n(e){return function(){var n=this,r=arguments;return new Promise(function(i,o){var a=e.apply(n,r);function u(e){t(a,i,o,u,s,"next",e)}function s(e){t(a,i,o,u,s,"throw",e)}u(void 0)})}}function r(e,t){if(!(e instanceof t))throw TypeError("Cannot call a class as a function")}function i(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function o(e,t,n){return(t in e)?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function a(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function u(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?a(Object(n),!0).forEach(function(t){o(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):a(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function s(e,t){return function e(t){if(Array.isArray(t))return t}(e)||function e(t,n){if((Symbol.iterator in Object(t))||"[object Arguments]"===Object.prototype.toString.call(t)){var r=[],i=!0,o=!1,a=void 0;try{for(var u,s=t[Symbol.iterator]();!(i=(u=s.next()).done)&&(r.push(u.value),!n||r.length!==n);i=!0);}catch(c){o=!0,a=c}finally{try{i||null==s.return||s.return()}finally{if(o)throw a}}return r}}(e,t)||function e(){throw TypeError("Invalid attempt to destructure non-iterable instance")}()}var c=function e(t){r(this,e),this.p=new Promise(t)};c.__typeson__type__="TypesonPromise","undefined"!=typeof Symbol&&(c.prototype[Symbol.toStringTag]="TypesonPromise"),c.prototype.then=function(e,t){var n=this;return new c(function(r,i){n.p.then(function(t){r(e?e(t):t)}).catch(function(e){return t?t(e):Promise.reject(e)}).then(r,i)})},c.prototype.catch=function(e){return this.then(null,e)},c.resolve=function(e){return new c(function(t){t(e)})},c.reject=function(e){return new c(function(t,n){n(e)})},["all","race"].forEach(function(e){c[e]=function(t){return new c(function(n,r){Promise[e](t.map(function(e){return e&&e.constructor&&"TypesonPromise"===e.constructor.__typeson__type__?e.p:e})).then(n,r)})}});var f={}.toString,l={}.hasOwnProperty,p=Object.getPrototypeOf,y=l.toString;function h(e,t){return $(e)&&"function"==typeof e.then&&(!t||"function"==typeof e.catch)}function d(e){return f.call(e).slice(8,-1)}function v(t,n){if(!t||"object"!==e(t))return!1;var r=p(t);if(!r)return null===n;var i=l.call(r,"constructor")&&r.constructor;return"function"!=typeof i?null===n:n===i||null!==n&&y.call(i)===y.call(n)||"function"==typeof n&&"string"==typeof i.__typeson__type__&&i.__typeson__type__===n.__typeson__type__}function b(e){return!!e&&"Object"===d(e)&&(!p(e)||v(e,Object))}function $(t){return t&&"object"===e(t)}function g(e){return e.replace(/~/g,"~0").replace(/\./g,"~1")}function m(e){return e.replace(/~1/g,".").replace(/~0/g,"~")}function w(e,t){if(""===t)return e;var n=t.indexOf(".");if(n>-1){var r=e[m(t.slice(0,n))];return void 0===r?void 0:w(r,t.slice(n+1))}return e[m(t)]}function _(e,t,n){if(""===t)return n;var r=t.indexOf(".");return r>-1?_(e[m(t.slice(0,r))],t.slice(r+1),n):(e[m(t)]=n,e)}var O=Object.keys,E=Array.isArray,T={}.hasOwnProperty,A=["type","replaced","iterateIn","iterateUnsetNumeric"];function N(e,t){if(""===e.keypath)return -1;var n=e.keypath.match(/\./g)||0,r=t.keypath.match(/\./g)||0;return n&&(n=n.length),r&&(r=r.length),n>r?-1:n<r?1:e.keypath<t.keypath?-1:e.keypath>t.keypath}var S=function(){var t,o,a;function f(e){r(this,f),this.options=e,this.plainObjectReplacers=[],this.nonplainObjectReplacers=[],this.revivers={},this.types={}}return t=f,o=[{key:"stringify",value:function e(t,n,r,i){i=u({},this.options,{},i,{stringification:!0});var o=this.encapsulate(t,null,i);return E(o)?JSON.stringify(o[0],n,r):o.then(function(e){return JSON.stringify(e,n,r)})}},{key:"stringifySync",value:function e(t,n,r,i){return this.stringify(t,n,r,u({throwOnBadSyncType:!0},i,{sync:!0}))}},{key:"stringifyAsync",value:function e(t,n,r,i){return this.stringify(t,n,r,u({throwOnBadSyncType:!0},i,{sync:!1}))}},{key:"parse",value:function e(t,n,r){return r=u({},this.options,{},r,{parse:!0}),this.revive(JSON.parse(t,n),r)}},{key:"parseSync",value:function e(t,n,r){return this.parse(t,n,u({throwOnBadSyncType:!0},r,{sync:!0}))}},{key:"parseAsync",value:function e(t,n,r){return this.parse(t,n,u({throwOnBadSyncType:!0},r,{sync:!1}))}},{key:"specialTypeNames",value:function e(t,n){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return r.returnTypeNames=!0,this.encapsulate(t,n,r)}},{key:"rootTypeName",value:function e(t,n){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return r.iterateNone=!0,this.encapsulate(t,n,r)}},{key:"encapsulate",value:function t(r,i,o){var a=(o=u({sync:!0},this.options,{},o)).sync,l=this,p={},y=[],h=[],d=[],m=!("cyclic"in o)||o.cyclic,w=o.encapsulateObserver,_=I("",r,m,i||{},d);function N(e){var t,n=Object.values(p);if(o.iterateNone)return n.length?n[0]:f.getJSONType(e);if(n.length){if(o.returnTypeNames)return function e(t){if(Array.isArray(t)){for(var n=0,r=Array(t.length);n<t.length;n++)r[n]=t[n];return r}}(t=new Set(n))||function e(t){if((Symbol.iterator in Object(t))||"[object Arguments]"===Object.prototype.toString.call(t))return Array.from(t)}(t)||function e(){throw TypeError("Invalid attempt to spread non-iterable instance")}();!e||!b(e)||T.call(e,"$types")?e={$:e,$types:{$:p}}:e.$types=p}else $(e)&&T.call(e,"$types")&&(e={$:e,$types:!0});return!o.returnTypeNames&&e}function S(e,t){return x.apply(this,arguments)}function x(){return(x=n(regeneratorRuntime.mark(function e(t,r){var i;return regeneratorRuntime.wrap(function e(o){for(;;)switch(o.prev=o.next){case 0:return o.next=2,Promise.all(r.map(function(e){return e[1].p}));case 2:return i=o.sent,o.next=5,Promise.all(i.map(function(){var e=n(regeneratorRuntime.mark(function e(n){var i,o,a,u,f,l,p,y,h,d,b,$,g,m;return regeneratorRuntime.wrap(function e(w){for(;;)switch(w.prev=w.next){case 0:if(i=[],u=(a=s(o=r.splice(0,1),1))[0],l=(f=s(u,7))[0],p=f[2],y=f[3],h=f[4],d=f[5],$=I(l,n,p,y,i,!0,b=f[6]),g=v($,c),!(l&&g)){w.next=11;break}return w.next=8,$.p;case 8:return m=w.sent,h[d]=m,w.abrupt("return",S(t,i));case 11:return l?h[d]=$:t=g?$.p:$,w.abrupt("return",S(t,i));case 13:case"end":return w.stop()}},e)}));return function(t){return e.apply(this,arguments)}}()));case 5:return o.abrupt("return",t);case 6:case"end":return o.stop()}},e)}))).apply(this,arguments)}function k(e,t,n){Object.assign(e,t);var r=A.map(function(t){var n=e[t];return delete e[t],n});n(),A.forEach(function(t,n){e[t]=r[n]})}function I(t,n,r,i,a,u,s){var d,$,m={},_=e(n),A=w?function(e){var o=s||i.type||f.getJSONType(n);w(Object.assign(e||m,{keypath:t,value:n,cyclic:r,stateObj:i,promisesData:a,resolvingTypesonPromise:u,awaitingTypesonPromise:v(n,c)},{type:o}))}:null;if(["string","boolean","number","undefined"].includes(_))return void 0===n||"number"===_&&(isNaN(n)||n===-1/0||n===1/0)?(d=i.replaced?n:P(t,n,i,a,!1,u,A))!==n&&(m={replaced:d}):d=n,A&&A(),d;if(null===n)return A&&A(),n;if(r&&!i.iterateIn&&!i.iterateUnsetNumeric&&n&&"object"===e(n)){var N=y.indexOf(n);if(!(N<0))return p[t]="#",A&&A({cyclicKeypath:h[N]}),"#"+h[N];!0===r&&(y.push(n),h.push(t))}var S=b(n),x=E(n),C=(S||x)&&(!l.plainObjectReplacers.length||i.replaced)||i.iterateIn?n:P(t,n,i,a,S||x,null,A);if(C!==n?(d=C,m={replaced:C}):""===t&&v(n,c)?(a.push([t,n,r,i,void 0,void 0,i.type]),d=n):x&&"object"!==i.iterateIn||"array"===i.iterateIn?m={clone:$=Array(n.length)}:(["function","symbol"].includes(e(n))||("toJSON"in n)||v(n,c)||v(n,Promise)||v(n,ArrayBuffer))&&!S&&"object"!==i.iterateIn?d=n:($={},i.addLength&&($.length=n.length),m={clone:$}),A&&A(),o.iterateNone)return $||d;if(!$)return d;if(i.iterateIn){var j=function e(o){var s={ownKeys:T.call(n,o)};k(i,s,function(){var e=t+(t?".":"")+g(o),s=I(e,n[o],Boolean(r),i,a,u);v(s,c)?a.push([e,s,Boolean(r),i,$,o,i.type]):void 0!==s&&($[o]=s)})};for(var B in n)j(B);A&&A({endIterateIn:!0,end:!0})}else O(n).forEach(function(e){var o=t+(t?".":"")+g(e);k(i,{ownKeys:!0},function(){var t=I(o,n[e],Boolean(r),i,a,u);v(t,c)?a.push([o,t,Boolean(r),i,$,e,i.type]):void 0!==t&&($[e]=t)})}),A&&A({endIterateOwn:!0,end:!0});if(i.iterateUnsetNumeric){for(var L=n.length,U=function e(o){if(!(o in n)){var s=t+(t?".":"")+o;k(i,{ownKeys:!1},function(){var e=I(s,void 0,Boolean(r),i,a,u);v(e,c)?a.push([s,e,Boolean(r),i,$,o,i.type]):void 0!==e&&($[o]=e)})}},R=0;R<L;R++)U(R);A&&A({endIterateUnsetNumeric:!0,end:!0})}return $}function P(e,t,n,r,i,o,u){for(var s=i?l.plainObjectReplacers:l.nonplainObjectReplacers,c=s.length;c--;){var f=s[c];if(f.test(t,n)){var y=f.type;if(l.revivers[y]){var h=p[e];p[e]=h?[y].concat(h):y}if(Object.assign(n,{type:y,replaced:!0}),(a||!f.replaceAsync)&&!f.replace)return u&&u({typeDetected:!0}),I(e,t,m&&"readonly",n,r,o,y);return u&&u({replacing:!0}),I(e,f[a||!f.replaceAsync?"replace":"replaceAsync"](t,n),m&&"readonly",n,r,o,y)}}return t}return d.length?a&&o.throwOnBadSyncType?function(){throw TypeError("Sync method requested but async result obtained")}():Promise.resolve(S(_,d)).then(N):!a&&o.throwOnBadSyncType?function(){throw TypeError("Async method requested but sync result obtained")}():o.stringification&&a?[N(_)]:a?N(_):Promise.resolve(N(_))}},{key:"encapsulateSync",value:function e(t,n,r){return this.encapsulate(t,n,u({throwOnBadSyncType:!0},r,{sync:!0}))}},{key:"encapsulateAsync",value:function e(t,n,r){return this.encapsulate(t,n,u({throwOnBadSyncType:!0},r,{sync:!1}))}},{key:"revive",value:function e(t,n){var r,i=t&&t.$types;if(!i)return t;if(!0===i)return t.$;var o=(n=u({sync:!0},this.options,{},n)).sync,a=[],f={},l=!0;i.$&&b(i.$)&&(t=t.$,i=i.$,l=!1);var p=this;function y(e,t){var n=s(p.revivers[e]||[],1)[0];if(!n)throw Error("Unregistered type: "+e);return!o||("revive"in n)?n[o&&n.revive?"revive":!o&&n.reviveAsync?"reviveAsync":"revive"](t,f):t}var d=[];function $(e){return v(e,x)?void 0:e}var m=function e(){var n=[];if(Object.entries(i).forEach(function(e){var t=s(e,2),r=t[0],o=t[1];"#"!==o&&[].concat(o).forEach(function(e){s(p.revivers[e]||[null,{}],2)[1].plain&&(n.push({keypath:r,type:e}),delete i[r])})}),n.length)return n.sort(N).reduce(function e(n,r){var i=r.keypath,o=r.type;if(h(n))return n.then(function(t){return e(t,{keypath:i,type:o})});var a=w(t,i);if(a=y(o,a),v(a,c))return a.then(function(e){var n=_(t,i,e);n===e&&(t=n)});var u=_(t,i,a);u===a&&(t=u)},void 0)}();return v(m,c)?r=m.then(function(){return t}):(r=function e(t,n,r,o,u){if(!l||"$types"!==t){var f=i[t],p=E(n);if(p||b(n)){var h=p?Array(n.length):{};for(O(n).forEach(function(i){var o=e(t+(t?".":"")+g(i),n[i],r||h,h,i),a=function e(t){return v(t,x)?h[i]=void 0:void 0!==t&&(h[i]=t),t};v(o,c)?d.push(o.then(function(e){return a(e)})):a(o)}),n=h;a.length;){var $=s(a[0],4),m=$[0],_=$[1],T=$[2],A=$[3],N=w(m,_);if(void 0!==N)T[A]=N;else break;a.splice(0,1)}}if(!f)return n;if("#"===f){var S=w(r,n.slice(1));return void 0===S&&a.push([r,n.slice(1),void 0,void 0]),S}return[].concat(f).reduce(function e(t,n){return v(t,c)?t.then(function(t){return e(t,n)}):y(n,t)},n)}}("",t,null),d.length&&(r=c.resolve(r).then(function(e){return c.all([e].concat(d))}).then(function(e){return s(e,1)[0]}))),h(r)?o&&n.throwOnBadSyncType?function(){throw TypeError("Sync method requested but async result obtained")}():v(r,c)?r.p.then($):r:!o&&n.throwOnBadSyncType?function(){throw TypeError("Async method requested but sync result obtained")}():o?$(r):Promise.resolve($(r))}},{key:"reviveSync",value:function e(t,n){return this.revive(t,u({throwOnBadSyncType:!0},n,{sync:!0}))}},{key:"reviveAsync",value:function e(t,n){return this.revive(t,u({throwOnBadSyncType:!0},n,{sync:!1}))}},{key:"register",value:function e(t,n){return n=n||{},[].concat(t).forEach(function e(t){var r=this;if(E(t))return t.map(function(t){return e.call(r,t)});t&&O(t).forEach(function(e){if("#"===e)throw TypeError("# cannot be used as a type name as it is reserved for cyclic objects");if(f.JSON_TYPES.includes(e))throw TypeError("Plain JSON object types are reserved as type names");var r=t[e],i=r&&r.testPlainObjects?this.plainObjectReplacers:this.nonplainObjectReplacers,o=i.filter(function(t){return t.type===e});if(o.length&&(i.splice(i.indexOf(o[0]),1),delete this.revivers[e],delete this.types[e]),"function"==typeof r){var a=r;r={test:function e(t){return t&&t.constructor===a},replace:function e(t){return u({},t)},revive:function e(t){return Object.assign(Object.create(a.prototype),t)}}}else if(E(r)){var c,l=r,p=s(l,3),y=p[0];r={test:y,replace:p[1],revive:p[2]}}if(r&&r.test){var h={type:e,test:r.test.bind(r)};r.replace&&(h.replace=r.replace.bind(r)),r.replaceAsync&&(h.replaceAsync=r.replaceAsync.bind(r));var d="number"==typeof n.fallback?n.fallback:n.fallback?0:1/0;if(r.testPlainObjects?this.plainObjectReplacers.splice(d,0,h):this.nonplainObjectReplacers.splice(d,0,h),r.revive||r.reviveAsync){var v={};r.revive&&(v.revive=r.revive.bind(r)),r.reviveAsync&&(v.reviveAsync=r.reviveAsync.bind(r)),this.revivers[e]=[v,{plain:r.testPlainObjects}]}this.types[e]=r}},this)},this),this}}],i(t.prototype,o),a&&i(t,a),f}(),x=function e(){r(this,e)};return x.__typeson__type__="TypesonUndefined",S.Undefined=x,S.Promise=c,S.isThenable=h,S.toStringTag=d,S.hasConstructorOf=v,S.isObject=$,S.isPlainObject=b,S.isUserObject=function e(t){if(!t||"Object"!==d(t))return!1;var n=p(t);return!n||v(t,Object)||e(n)},S.escapeKeyPathComponent=g,S.unescapeKeyPathComponent=m,S.getByKeyPath=w,S.getJSONType=function t(n){return null===n?"null":Array.isArray(n)?"array":e(n)},S.JSON_TYPES=["null","boolean","number","string","array","object"],S},e.exports=r()}),l=c(function(e,t){var n,r;r=function(){function e(t){return(e="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(t)}function t(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function n(e,t,n){return(t in e)?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function r(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function i(e){return function e(t){if(Array.isArray(t))return o(t)}(e)||function e(t){if("undefined"!=typeof Symbol&&(Symbol.iterator in Object(t)))return Array.from(t)}(e)||function e(t,n){if(t){if("string"==typeof t)return o(t,n);var r=Object.prototype.toString.call(t).slice(8,-1);if("Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r)return Array.from(t);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return o(t,n)}}(e)||function e(){throw TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function o(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function a(e){return(a="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function e(t){return typeof t}:function e(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(e)}function u(e,t){if(!(e instanceof t))throw TypeError("Cannot call a class as a function")}function c(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function f(e,t,n){return(t in e)?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function l(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function p(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?l(Object(n),!0).forEach(function(t){f(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):l(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function y(e,t){return function e(t){if(Array.isArray(t))return t}(e)||function e(t,n){if("undefined"!=typeof Symbol&&(Symbol.iterator in Object(t))){var r=[],i=!0,o=!1,a=void 0;try{for(var u,s=t[Symbol.iterator]();!(i=(u=s.next()).done)&&(r.push(u.value),!n||r.length!==n);i=!0);}catch(c){o=!0,a=c}finally{try{i||null==s.return||s.return()}finally{if(o)throw a}}return r}}(e,t)||h(e,t)||function e(){throw TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function h(e,t){if(e){if("string"==typeof e)return d(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?d(e,t):void 0}}function d(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}var v=function e(t){u(this,e),this.p=new Promise(t)};v.__typeson__type__="TypesonPromise","undefined"!=typeof Symbol&&(v.prototype[Symbol.toStringTag]="TypesonPromise"),v.prototype.then=function(e,t){var n=this;return new v(function(r,i){n.p.then(function(t){r(e?e(t):t)}).catch(function(e){return t?t(e):Promise.reject(e)}).then(r,i)})},v.prototype.catch=function(e){return this.then(null,e)},v.resolve=function(e){return new v(function(t){t(e)})},v.reject=function(e){return new v(function(t,n){n(e)})},["all","race"].forEach(function(e){v[e]=function(t){return new v(function(n,r){Promise[e](t.map(function(e){return e&&e.constructor&&"TypesonPromise"===e.constructor.__typeson__type__?e.p:e})).then(n,r)})}});var b={}.toString,$={}.hasOwnProperty,g=Object.getPrototypeOf,m=$.toString;function w(e,t){return T(e)&&"function"==typeof e.then&&(!t||"function"==typeof e.catch)}function _(e){return b.call(e).slice(8,-1)}function O(e,t){if(!e||"object"!==a(e))return!1;var n=g(e);if(!n)return null===t;var r=$.call(n,"constructor")&&n.constructor;return"function"!=typeof r?null===t:t===r||null!==t&&m.call(r)===m.call(t)||"function"==typeof t&&"string"==typeof r.__typeson__type__&&r.__typeson__type__===t.__typeson__type__}function E(e){return!(!e||"Object"!==_(e))&&(!g(e)||O(e,Object))}function T(e){return e&&"object"===a(e)}function A(e){return e.replace(/~/g,"~0").replace(/\./g,"~1")}function N(e){return e.replace(/~1/g,".").replace(/~0/g,"~")}function S(e,t){if(""===t)return e;var n=t.indexOf(".");if(n>-1){var r=e[N(t.slice(0,n))];return void 0===r?void 0:S(r,t.slice(n+1))}return e[N(t)]}function x(e,t,n){if(""===t)return n;var r=t.indexOf(".");return r>-1?x(e[N(t.slice(0,r))],t.slice(r+1),n):(e[N(t)]=n,e)}function k(e,t,n){return n?t?t(e):e:(e&&e.then||(e=Promise.resolve(e)),t?e.then(t):e)}var I=Object.keys,P=Array.isArray,C={}.hasOwnProperty,j=["type","replaced","iterateIn","iterateUnsetNumeric"];function B(e){return function(){for(var t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];try{return Promise.resolve(e.apply(this,t))}catch(r){return Promise.reject(r)}}}function L(e,t){if(""===e.keypath)return -1;var n=e.keypath.match(/\./g)||0,r=t.keypath.match(/\./g)||0;return n&&(n=n.length),r&&(r=r.length),n>r?-1:n<r?1:e.keypath<t.keypath?-1:e.keypath>t.keypath}var U=function(){var e,t,n;function r(e){u(this,r),this.options=e,this.plainObjectReplacers=[],this.nonplainObjectReplacers=[],this.revivers={},this.types={}}return e=r,t=[{key:"stringify",value:function e(t,n,r,i){i=p(p(p({},this.options),i),{},{stringification:!0});var o=this.encapsulate(t,null,i);return P(o)?JSON.stringify(o[0],n,r):o.then(function(e){return JSON.stringify(e,n,r)})}},{key:"stringifySync",value:function e(t,n,r,i){return this.stringify(t,n,r,p(p({throwOnBadSyncType:!0},i),{},{sync:!0}))}},{key:"stringifyAsync",value:function e(t,n,r,i){return this.stringify(t,n,r,p(p({throwOnBadSyncType:!0},i),{},{sync:!1}))}},{key:"parse",value:function e(t,n,r){return r=p(p(p({},this.options),r),{},{parse:!0}),this.revive(JSON.parse(t,n),r)}},{key:"parseSync",value:function e(t,n,r){return this.parse(t,n,p(p({throwOnBadSyncType:!0},r),{},{sync:!0}))}},{key:"parseAsync",value:function e(t,n,r){return this.parse(t,n,p(p({throwOnBadSyncType:!0},r),{},{sync:!1}))}},{key:"specialTypeNames",value:function e(t,n){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return r.returnTypeNames=!0,this.encapsulate(t,n,r)}},{key:"rootTypeName",value:function e(t,n){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return r.iterateNone=!0,this.encapsulate(t,n,r)}},{key:"encapsulate",value:function e(t,n,i){var o=B(function(e,t){return k(Promise.all(t.map(function(e){return e[1].p})),function(n){return k(Promise.all(n.map(B(function(n){var r,i,a,u=!1,s=[],c=y(t.splice(0,1),1),f=y(c[0],7),l=f[0],p=f[2],h=f[3],d=f[4],b=f[5],$=N(l,n,p,h,s,!0,f[6]),g=O($,v);return r=function(){if(l&&g)return k($.p,function(t){return d[b]=t,u=!0,o(e,s)})},i=function(t){return u?t:(l?d[b]=$:e=g?$.p:$,o(e,s))},(a=r())&&a.then?a.then(i):i(a)}))),function(){return e})})}),u=(i=p(p({sync:!0},this.options),i)).sync,s=this,c={},f=[],l=[],b=[],$=!("cyclic"in i)||i.cyclic,g=i.encapsulateObserver,m=N("",t,$,n||{},b);function w(e){var t,n=Object.values(c);if(i.iterateNone)return n.length?n[0]:r.getJSONType(e);if(n.length){if(i.returnTypeNames)return function e(t){if(Array.isArray(t))return d(t)}(t=new Set(n))||function e(t){if("undefined"!=typeof Symbol&&(Symbol.iterator in Object(t)))return Array.from(t)}(t)||h(t)||function e(){throw TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}();e&&E(e)&&!C.call(e,"$types")?e.$types=c:e={$:e,$types:{$:c}}}else T(e)&&C.call(e,"$types")&&(e={$:e,$types:!0});return!i.returnTypeNames&&e}function _(e,t,n){Object.assign(e,t);var r=j.map(function(t){var n=e[t];return delete e[t],n});n(),j.forEach(function(t,n){e[t]=r[n]})}function N(e,t,n,o,u,p,y){var h,d={},b=a(t),$=g?function(i){var a=y||o.type||r.getJSONType(t);g(Object.assign(i||d,{keypath:e,value:t,cyclic:n,stateObj:o,promisesData:u,resolvingTypesonPromise:p,awaitingTypesonPromise:O(t,v)},{type:a}))}:null;if(["string","boolean","number","undefined"].includes(b))return void 0===t||Number.isNaN(t)||t===Number.NEGATIVE_INFINITY||t===Number.POSITIVE_INFINITY?(h=o.replaced?t:S(e,t,o,u,!1,p,$))!==t&&(d={replaced:h}):h=t,$&&$(),h;if(null===t)return $&&$(),t;if(n&&!o.iterateIn&&!o.iterateUnsetNumeric&&t&&"object"===a(t)){var m=f.indexOf(t);if(!(m<0))return c[e]="#",$&&$({cyclicKeypath:l[m]}),"#"+l[m];!0===n&&(f.push(t),l.push(e))}var w,T=E(t),x=P(t),k=(T||x)&&(!s.plainObjectReplacers.length||o.replaced)||o.iterateIn?t:S(e,t,o,u,T||x,null,$);if(k!==t?(h=k,d={replaced:k}):""===e&&O(t,v)?(u.push([e,t,n,o,void 0,void 0,o.type]),h=t):x&&"object"!==o.iterateIn||"array"===o.iterateIn?d={clone:w=Array(t.length)}:(["function","symbol"].includes(a(t))||("toJSON"in t)||O(t,v)||O(t,Promise)||O(t,ArrayBuffer))&&!T&&"object"!==o.iterateIn?h=t:(w={},o.addLength&&(w.length=t.length),d={clone:w}),$&&$(),i.iterateNone)return w||h;if(!w)return h;if(o.iterateIn){var j=function r(i){var a={ownKeys:C.call(t,i)};_(o,a,function(){var r=e+(e?".":"")+A(i),a=N(r,t[i],Boolean(n),o,u,p);O(a,v)?u.push([r,a,Boolean(n),o,w,i,o.type]):void 0!==a&&(w[i]=a)})};for(var B in t)j(B);$&&$({endIterateIn:!0,end:!0})}else I(t).forEach(function(r){var i=e+(e?".":"")+A(r);_(o,{ownKeys:!0},function(){var e=N(i,t[r],Boolean(n),o,u,p);O(e,v)?u.push([i,e,Boolean(n),o,w,r,o.type]):void 0!==e&&(w[r]=e)})}),$&&$({endIterateOwn:!0,end:!0});if(o.iterateUnsetNumeric){for(var L=t.length,U=function r(i){if(!(i in t)){var a=e+(e?".":"")+i;_(o,{ownKeys:!1},function(){var e=N(a,void 0,Boolean(n),o,u,p);O(e,v)?u.push([a,e,Boolean(n),o,w,i,o.type]):void 0!==e&&(w[i]=e)})}},R=0;R<L;R++)U(R);$&&$({endIterateUnsetNumeric:!0,end:!0})}return w}function S(e,t,n,r,i,o,a){for(var f=i?s.plainObjectReplacers:s.nonplainObjectReplacers,l=f.length;l--;){var p=f[l];if(p.test(t,n)){var y=p.type;if(s.revivers[y]){var h=c[e];c[e]=h?[y].concat(h):y}return Object.assign(n,{type:y,replaced:!0}),!u&&p.replaceAsync||p.replace?(a&&a({replacing:!0}),N(e,p[u||!p.replaceAsync?"replace":"replaceAsync"](t,n),$&&"readonly",n,r,o,y)):(a&&a({typeDetected:!0}),N(e,t,$&&"readonly",n,r,o,y))}}return t}return b.length?u&&i.throwOnBadSyncType?function(){throw TypeError("Sync method requested but async result obtained")}():Promise.resolve(o(m,b)).then(w):!u&&i.throwOnBadSyncType?function(){throw TypeError("Async method requested but sync result obtained")}():i.stringification&&u?[w(m)]:u?w(m):Promise.resolve(w(m))}},{key:"encapsulateSync",value:function e(t,n,r){return this.encapsulate(t,n,p(p({throwOnBadSyncType:!0},r),{},{sync:!0}))}},{key:"encapsulateAsync",value:function e(t,n,r){return this.encapsulate(t,n,p(p({throwOnBadSyncType:!0},r),{},{sync:!1}))}},{key:"revive",value:function e(t,n){var r=t&&t.$types;if(!r)return t;if(!0===r)return t.$;var i=(n=p(p({sync:!0},this.options),n)).sync,o=[],a={},u=!0;r.$&&E(r.$)&&(t=t.$,r=r.$,u=!1);var s=this;function c(e,t){var n=y(s.revivers[e]||[],1)[0];if(!n)throw Error("Unregistered type: "+e);return!i||("revive"in n)?n[i&&n.revive?"revive":!i&&n.reviveAsync?"reviveAsync":"revive"](t,a):t}var f=[];function l(e){return O(e,R)?void 0:e}var h,d=function e(){var n=[];if(Object.entries(r).forEach(function(e){var t=y(e,2),i=t[0],o=t[1];"#"!==o&&[].concat(o).forEach(function(e){y(s.revivers[e]||[null,{}],2)[1].plain&&(n.push({keypath:i,type:e}),delete r[i])})}),n.length)return n.sort(L).reduce(function e(n,r){var i=r.keypath,o=r.type;if(w(n))return n.then(function(t){return e(t,{keypath:i,type:o})});var a=S(t,i);if(O(a=c(o,a),v))return a.then(function(e){var n=x(t,i,e);n===e&&(t=n)});var u=x(t,i,a);u===a&&(t=u)},void 0)}();return O(d,v)?h=d.then(function(){return t}):(h=function e(t,n,i,a,s){if(!u||"$types"!==t){var l=r[t],p=P(n);if(p||E(n)){var h=p?Array(n.length):{};for(I(n).forEach(function(r){var o=e(t+(t?".":"")+A(r),n[r],i||h,h,r),a=function e(t){return O(t,R)?h[r]=void 0:void 0!==t&&(h[r]=t),t};O(o,v)?f.push(o.then(function(e){return a(e)})):a(o)}),n=h;o.length;){var d=y(o[0],4),b=d[0],$=d[1],g=d[2],m=d[3],w=S(b,$);if(void 0===w)break;g[m]=w,o.splice(0,1)}}if(!l)return n;if("#"===l){var _=S(i,n.slice(1));return void 0===_&&o.push([i,n.slice(1),void 0,void 0]),_}return[].concat(l).reduce(function e(t,n){return O(t,v)?t.then(function(t){return e(t,n)}):c(n,t)},n)}}("",t,null),f.length&&(h=v.resolve(h).then(function(e){return v.all([e].concat(f))}).then(function(e){return y(e,1)[0]}))),w(h)?i&&n.throwOnBadSyncType?function(){throw TypeError("Sync method requested but async result obtained")}():O(h,v)?h.p.then(l):h:!i&&n.throwOnBadSyncType?function(){throw TypeError("Async method requested but sync result obtained")}():i?l(h):Promise.resolve(l(h))}},{key:"reviveSync",value:function e(t,n){return this.revive(t,p(p({throwOnBadSyncType:!0},n),{},{sync:!0}))}},{key:"reviveAsync",value:function e(t,n){return this.revive(t,p(p({throwOnBadSyncType:!0},n),{},{sync:!1}))}},{key:"register",value:function e(t,n){return n=n||{},[].concat(t).forEach(function e(t){var i=this;if(P(t))return t.map(function(t){return e.call(i,t)});t&&I(t).forEach(function(e){if("#"===e)throw TypeError("# cannot be used as a type name as it is reserved for cyclic objects");if(r.JSON_TYPES.includes(e))throw TypeError("Plain JSON object types are reserved as type names");var i=t[e],o=i&&i.testPlainObjects?this.plainObjectReplacers:this.nonplainObjectReplacers,a=o.filter(function(t){return t.type===e});if(a.length&&(o.splice(o.indexOf(a[0]),1),delete this.revivers[e],delete this.types[e]),"function"==typeof i){var u=i;i={test:function e(t){return t&&t.constructor===u},replace:function e(t){return p({},t)},revive:function e(t){return Object.assign(Object.create(u.prototype),t)}}}else if(P(i)){var s=y(i,3);i={test:s[0],replace:s[1],revive:s[2]}}if(i&&i.test){var c={type:e,test:i.test.bind(i)};i.replace&&(c.replace=i.replace.bind(i)),i.replaceAsync&&(c.replaceAsync=i.replaceAsync.bind(i));var f="number"==typeof n.fallback?n.fallback:n.fallback?0:Number.POSITIVE_INFINITY;if(i.testPlainObjects?this.plainObjectReplacers.splice(f,0,c):this.nonplainObjectReplacers.splice(f,0,c),i.revive||i.reviveAsync){var l={};i.revive&&(l.revive=i.revive.bind(i)),i.reviveAsync&&(l.reviveAsync=i.reviveAsync.bind(i)),this.revivers[e]=[l,{plain:i.testPlainObjects}]}this.types[e]=i}},this)},this),this}}],c(e.prototype,t),n&&c(e,n),r}(),R=function e(){u(this,e)};R.__typeson__type__="TypesonUndefined",U.Undefined=R,U.Promise=v,U.isThenable=w,U.toStringTag=_,U.hasConstructorOf=O,U.isObject=T,U.isPlainObject=E,U.isUserObject=function e(t){if(!t||"Object"!==_(t))return!1;var n=g(t);return!n||O(t,Object)||e(n)},U.escapeKeyPathComponent=A,U.unescapeKeyPathComponent=N,U.getByKeyPath=S,U.getJSONType=function e(t){return null===t?"null":Array.isArray(t)?"array":a(t)},U.JSON_TYPES=["null","boolean","number","string","array","object"];for(var F=[{arrayNonindexKeys:{testPlainObjects:!0,test:function e(t,n){return!!Array.isArray(t)&&(Object.keys(t).some(function(e){return String(Number.parseInt(e))!==e})&&(n.iterateIn="object",n.addLength=!0),!0)},replace:function e(t,n){return n.iterateUnsetNumeric=!0,t},revive:function e(t){if(Array.isArray(t))return t;var n=[];return Object.keys(t).forEach(function(e){var r=t[e];n[e]=r}),n}}},{sparseUndefined:{test:function e(t,n){return void 0===t&&!1===n.ownKeys},replace:function e(t){return 0},revive:function e(t){}}}],D="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",K=new Uint8Array(256),V=0;V<D.length;V++)K[D.charCodeAt(V)]=V;var M=function e(t,n,r){null==r&&(r=t.byteLength);for(var i=new Uint8Array(t,n||0,r),o=i.length,a="",u=0;u<o;u+=3)a+=D[i[u]>>2],a+=D[(3&i[u])<<4|i[u+1]>>4],a+=D[(15&i[u+1])<<2|i[u+2]>>6],a+=D[63&i[u+2]];return o%3==2?a=a.slice(0,-1)+"=":o%3==1&&(a=a.slice(0,-2)+"=="),a},G=function e(t){var n,r,i,o,a=t.length,u=.75*t.length,s=0;"="===t[t.length-1]&&(u--,"="===t[t.length-2]&&u--);for(var c=new ArrayBuffer(u),f=new Uint8Array(c),l=0;l<a;l+=4)n=K[t.charCodeAt(l)],r=K[t.charCodeAt(l+1)],i=K[t.charCodeAt(l+2)],o=K[t.charCodeAt(l+3)],f[s++]=n<<2|r>>4,f[s++]=(15&r)<<4|i>>2,f[s++]=(3&i)<<6|63&o;return c},Y="undefined"==typeof self?s:self,J={};function q(e){for(var t=new Uint8Array(e.length),n=0;n<e.length;n++)t[n]=e.charCodeAt(n);return t.buffer}["Int8Array","Uint8Array","Uint8ClampedArray","Int16Array","Uint16Array","Int32Array","Uint32Array","Float32Array","Float64Array"].forEach(function(e){var t=e,n=Y[t];n&&(J[e.toLowerCase()]={test:function e(n){return U.toStringTag(n)===t},replace:function e(t,n){var r=t.buffer,i=t.byteOffset,o=t.length;n.buffers||(n.buffers=[]);var a=n.buffers.indexOf(r);return a>-1?{index:a,byteOffset:i,length:o}:(n.buffers.push(r),{encoded:M(r),byteOffset:i,length:o})},revive:function e(t,r){r.buffers||(r.buffers=[]);var i,o=t.byteOffset,a=t.length,u=t.encoded,s=t.index;return("index"in t)?i=r.buffers[s]:(i=G(u),r.buffers.push(i)),new n(i,o,a)}})});var z={file:{test:function e(t){return"File"===U.toStringTag(t)},replace:function e(t){var n=new XMLHttpRequest;if(n.overrideMimeType("text/plain; charset=x-user-defined"),n.open("GET",URL.createObjectURL(t),!1),n.send(),200!==n.status&&0!==n.status)throw Error("Bad File access: "+n.status);return{type:t.type,stringContents:n.responseText,name:t.name,lastModified:t.lastModified}},revive:function e(t){var n=t.name,r=t.type,i=t.stringContents,o=t.lastModified;return new File([q(i)],n,{type:r,lastModified:o})},replaceAsync:function e(t){return new U.Promise(function(e,n){var r=new FileReader;r.addEventListener("load",function(){e({type:t.type,stringContents:r.result,name:t.name,lastModified:t.lastModified})}),r.addEventListener("error",function(){n(r.error)}),r.readAsBinaryString(t)})}}};return[{userObject:{test:function e(t,n){return U.isUserObject(t)},replace:function e(t){return function e(t){for(var i=1;i<arguments.length;i++){var o=null!=arguments[i]?arguments[i]:{};i%2?r(Object(o),!0).forEach(function(e){n(t,e,o[e])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(o)):r(Object(o)).forEach(function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(o,e))})}return t}({},t)},revive:function e(t){return t}}},{undef:{test:function e(t,n){return void 0===t&&(n.ownKeys||!("ownKeys"in n))},replace:function e(t){return 0},revive:function e(t){return new U.Undefined}}},F,{StringObject:{test:function t(n){return"String"===U.toStringTag(n)&&"object"===e(n)},replace:function e(t){return String(t)},revive:function e(t){return new String(t)}},BooleanObject:{test:function t(n){return"Boolean"===U.toStringTag(n)&&"object"===e(n)},replace:function e(t){return Boolean(t)},revive:function e(t){return new Boolean(t)}},NumberObject:{test:function t(n){return"Number"===U.toStringTag(n)&&"object"===e(n)},replace:function e(t){return Number(t)},revive:function e(t){return new Number(t)}}},[{nan:{test:function e(t){return Number.isNaN(t)},replace:function e(t){return"NaN"},revive:function e(t){return Number.NaN}}},{infinity:{test:function e(t){return t===Number.POSITIVE_INFINITY},replace:function e(t){return"Infinity"},revive:function e(t){return Number.POSITIVE_INFINITY}}},{negativeInfinity:{test:function e(t){return t===Number.NEGATIVE_INFINITY},replace:function e(t){return"-Infinity"},revive:function e(t){return Number.NEGATIVE_INFINITY}}}],{date:{test:function e(t){return"Date"===U.toStringTag(t)},replace:function e(t){var n=t.getTime();return Number.isNaN(n)?"NaN":n},revive:function e(t){return new Date("NaN"===t?Number.NaN:t)}}},{regexp:{test:function e(t){return"RegExp"===U.toStringTag(t)},replace:function e(t){return{source:t.source,flags:(t.global?"g":"")+(t.ignoreCase?"i":"")+(t.multiline?"m":"")+(t.sticky?"y":"")+(t.unicode?"u":"")}},revive:function e(t){var n;return RegExp(t.source,t.flags)}}},{imagedata:{test:function e(t){return"ImageData"===U.toStringTag(t)},replace:function e(t){return{array:i(t.data),width:t.width,height:t.height}},revive:function e(t){return new ImageData(new Uint8ClampedArray(t.array),t.width,t.height)}}},{imagebitmap:{test:function e(t){return"ImageBitmap"===U.toStringTag(t)||t&&t.dataset&&"ImageBitmap"===t.dataset.toStringTag},replace:function e(t){var n=document.createElement("canvas");return n.getContext("2d").drawImage(t,0,0),n.toDataURL()},revive:function e(t){var n=document.createElement("canvas"),r=n.getContext("2d"),i=document.createElement("img");return i.addEventListener("load",function(){r.drawImage(i,0,0)}),i.src=t,n},reviveAsync:function e(t){var n=document.createElement("canvas"),r=n.getContext("2d"),i=document.createElement("img");return i.addEventListener("load",function(){r.drawImage(i,0,0)}),i.src=t,createImageBitmap(n)}}},z,{file:z.file,filelist:{test:function e(t){return"FileList"===U.toStringTag(t)},replace:function e(t){for(var n=[],r=0;r<t.length;r++)n[r]=t.item(r);return n},revive:function e(n){return new(function(){var e,n,r;function i(){(function e(t,n){if(!(t instanceof n))throw TypeError("Cannot call a class as a function")})(this,i),this._files=arguments[0],this.length=this._files.length}return e=i,n=[{key:"item",value:function e(t){return this._files[t]}},{key:Symbol.toStringTag,get:function e(){return"FileList"}}],t(e.prototype,n),r&&t(e,r),i}())(n)}}},{blob:{test:function e(t){return"Blob"===U.toStringTag(t)},replace:function e(t){var n=new XMLHttpRequest;if(n.overrideMimeType("text/plain; charset=x-user-defined"),n.open("GET",URL.createObjectURL(t),!1),n.send(),200!==n.status&&0!==n.status)throw Error("Bad Blob access: "+n.status);return{type:t.type,stringContents:n.responseText}},revive:function e(t){var n=t.type,r=t.stringContents;return new Blob([q(r)],{type:n})},replaceAsync:function e(t){return new U.Promise(function(e,n){var r=new FileReader;r.addEventListener("load",function(){e({type:t.type,stringContents:r.result})}),r.addEventListener("error",function(){n(r.error)}),r.readAsBinaryString(t)})}}}].concat("function"==typeof Map?{map:{test:function e(t){return"Map"===U.toStringTag(t)},replace:function e(t){return i(t.entries())},revive:function e(t){return new Map(t)}}}:[],"function"==typeof Set?{set:{test:function e(t){return"Set"===U.toStringTag(t)},replace:function e(t){return i(t.values())},revive:function e(t){return new Set(t)}}}:[],"function"==typeof ArrayBuffer?{arraybuffer:{test:function e(t){return"ArrayBuffer"===U.toStringTag(t)},replace:function e(t,n){n.buffers||(n.buffers=[]);var r=n.buffers.indexOf(t);return r>-1?{index:r}:(n.buffers.push(t),M(t))},revive:function t(n,r){if(r.buffers||(r.buffers=[]),"object"===e(n))return r.buffers[n.index];var i=G(n);return r.buffers.push(i),i}}}:[],"function"==typeof Uint8Array?J:[],"function"==typeof DataView?{dataview:{test:function e(t){return"DataView"===U.toStringTag(t)},replace:function e(t,n){var r=t.buffer,i=t.byteOffset,o=t.byteLength;n.buffers||(n.buffers=[]);var a=n.buffers.indexOf(r);return a>-1?{index:a,byteOffset:i,byteLength:o}:(n.buffers.push(r),{encoded:M(r),byteOffset:i,byteLength:o})},revive:function e(t,n){n.buffers||(n.buffers=[]);var r,i=t.byteOffset,o=t.byteLength,a=t.encoded,u=t.index;return("index"in t)?r=n.buffers[u]:(r=G(a),n.buffers.push(r)),new DataView(r,i,o)}}}:[],"undefined"!=typeof Intl?{IntlCollator:{test:function e(t){return U.hasConstructorOf(t,Intl.Collator)},replace:function e(t){return t.resolvedOptions()},revive:function e(t){return new Intl.Collator(t.locale,t)}},IntlDateTimeFormat:{test:function e(t){return U.hasConstructorOf(t,Intl.DateTimeFormat)},replace:function e(t){return t.resolvedOptions()},revive:function e(t){return new Intl.DateTimeFormat(t.locale,t)}},IntlNumberFormat:{test:function e(t){return U.hasConstructorOf(t,Intl.NumberFormat)},replace:function e(t){return t.resolvedOptions()},revive:function e(t){return new Intl.NumberFormat(t.locale,t)}}}:[],"undefined"!=typeof crypto?{cryptokey:{test:function e(t){return"CryptoKey"===U.toStringTag(t)&&t.extractable},replaceAsync:function e(t){return new U.Promise(function(e,n){crypto.subtle.exportKey("jwk",t).catch(function(e){n(e)}).then(function(n){e({jwk:n,algorithm:t.algorithm,usages:t.usages})})})},revive:function e(t){var n=t.jwk,r=t.algorithm,i=t.usages;return crypto.subtle.importKey("jwk",n,r,!0,i)}}}:[],"undefined"!=typeof BigInt?[{bigint:{test:function e(t){return"bigint"==typeof t},replace:function e(t){return String(t)},revive:function e(t){return BigInt(t)}}},{bigintObject:{test:function t(n){return"object"===e(n)&&U.hasConstructorOf(n,BigInt)},replace:function e(t){return String(t)},revive:function e(t){return Object(BigInt(t))}}}]:[])},e.exports=r()}),p="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",y=new Uint8Array(256),h=0;h<p.length;h++)y[p.codePointAt(h)]=h;var d=function e(t,n,r){null==r&&(r=t.byteLength);for(var i=new Uint8Array(t,n||0,r),o=i.length,a="",u=0;u<o;u+=3)a+=p[i[u]>>2],a+=p[(3&i[u])<<4|i[u+1]>>4],a+=p[(15&i[u+1])<<2|i[u+2]>>6],a+=p[63&i[u+2]];return o%3==2?a=a.slice(0,-1)+"=":o%3==1&&(a=a.slice(0,-2)+"=="),a},v=function e(t){var n,r,i,o,a=t.length,u=.75*t.length,s=0;"="===t[t.length-1]&&(u--,"="===t[t.length-2]&&u--);for(var c=new ArrayBuffer(u),f=new Uint8Array(c),l=0;l<a;l+=4)n=y[t.codePointAt(l)],r=y[t.codePointAt(l+1)],i=y[t.codePointAt(l+2)],o=y[t.codePointAt(l+3)],f[s++]=n<<2|r>>4,f[s++]=(15&r)<<4|i>>2,f[s++]=(3&i)<<6|63&o;return c},b="undefined"==typeof self?global:self,$={};["Int8Array","Uint8Array","Uint8ClampedArray","Int16Array","Uint16Array","Int32Array","Uint32Array","Float32Array","Float64Array"].forEach(function(e){var t=e,n=b[t];n&&($[e.toLowerCase()+"2"]={test:function(e){return f.toStringTag(e)===t},replace:function(e){var t,n=e.buffer;return{buffer:n,byteOffset:e.byteOffset,length:e.length}},revive:function(e){var t=e.buffer,r=e.byteOffset,i=e.length;return new n(t,r,i)}})});var g=new f().register(l),m="FileReaderSync"in self,w=[],_=0;function O(e,t){return i(this,void 0,void 0,function(){var n,a,u,s,c,f;function l(){return i(this,void 0,void 0,function(){var i,l,p,y,h,d,v,b,$;return o(this,function(m){switch(m.label){case 0:return[4,Promise.all(e.tables.map(function(e){return e.count()}))];case 1:(i=m.sent()).forEach(function(e,t){return a[t].rowCount=e}),f.totalRows=i.reduce(function(e,t){return e+t}),p=(l=JSON.stringify(s,void 0,u?2:void 0)).lastIndexOf("]"),y=l.substring(0,p),n.push(y),h=t.filter,d=function(i){var a,s,l,p,y,d,v,b,$,m,w,_;return o(this,function(O){switch(O.label){case 0:l=!!(s=(a=e.table(i)).schema.primKey).keyPath,p=t.numRowsPerChunk||2e3,d=JSON.stringify(y=l?{tableName:a.name,inbound:!0,rows:[]}:{tableName:a.name,inbound:!1,rows:[]},void 0,u?2:void 0),u&&(d=d.split("\n").join("\n ")),v=d.lastIndexOf("]"),n.push(d.substring(0,v)),b=null,$=0,m=!0,w=function(){var e,t,y,d,v,w,_,O;return o(this,function(o){switch(o.label){case 0:return c&&r.default.ignoreTransaction(function(){return c(f)}),[4,(e=null==b?a.limit(p):a.where(":id").above(b).limit(p)).toArray()];case 1:if(0===(t=o.sent()).length)return[2,"break"];if(null!=b&&$>0&&(n.push(","),u&&n.push("\n ")),m=t.length===p,!l)return[3,4];if(d=(y=h?t.filter(function(e){return h(i,e)}):t).map(function(e){return g.encapsulate(e)}),!g.mustFinalize())return[3,3];return[4,r.default.waitFor(g.finalize(d))];case 2:o.sent(),o.label=3;case 3:return v=JSON.stringify(d,void 0,u?2:void 0),u&&(v=v.split("\n").join("\n ")),n.push(new Blob([v.substring(1,v.length-1)])),$=y.length,b=t.length>0?r.default.getByKeyPath(t[t.length-1],s.keyPath):null,[3,8];case 4:return[4,e.primaryKeys()];case 5:if(_=(w=o.sent()).map(function(e,n){return[e,t[n]]}),h&&(_=_.filter(function(e){var t=e[0];return h(i,e[1],t)})),O=_.map(function(e){return g.encapsulate(e)}),!g.mustFinalize())return[3,7];return[4,r.default.waitFor(g.finalize(O))];case 6:o.sent(),o.label=7;case 7:v=JSON.stringify(O,void 0,u?2:void 0),u&&(v=v.split("\n").join("\n ")),n.push(new Blob([v.substring(1,v.length-1)])),$=_.length,b=w.length>0?w[w.length-1]:null,o.label=8;case 8:return f.completedRows+=t.length,[2]}})},O.label=1;case 1:if(!m)return[3,3];return[5,w()];case 2:if("break"===(_=O.sent()))return[3,3];return[3,1];case 3:return n.push(d.substr(v)),f.completedTables+=1,f.completedTables<f.totalTables&&n.push(","),[2]}})},v=0,b=a,m.label=2;case 2:if(!(v<b.length))return[3,5];return[5,d($=b[v].name)];case 3:m.sent(),m.label=4;case 4:return v++,[3,2];case 5:return n.push(l.substr(p)),f.done=!0,c&&r.default.ignoreTransaction(function(){return c(f)}),[2]}})})}return o(this,function(i){switch(i.label){case 0:t=t||{},n=[],a=e.tables.map(function(e){var t;return{name:e.name,schema:[(t=e).schema.primKey].concat(t.schema.indexes).map(function(e){return e.src}).join(","),rowCount:0}}),u=t.prettyJson,s={formatName:"dexie",formatVersion:1,data:{databaseName:e.name,databaseVersion:e.verno,tables:a,data:[]}},c=t.progressCallback,f={done:!1,completedRows:0,completedTables:0,totalRows:NaN,totalTables:e.tables.length},i.label=1;case 1:if(i.trys.push([1,,6,7]),!t.noTransaction)return[3,3];return[4,l()];case 2:return i.sent(),[3,5];case 3:return[4,e.transaction("r",e.tables,l)];case 4:i.sent(),i.label=5;case 5:return[3,7];case 6:return g.finalize(),[7];case 7:return c&&r.default.ignoreTransaction(function(){return c(f)}),[2,new Blob(n,{type:"text/json"})]}})})}g.register([{arraybuffer:{test:function(e){return"ArrayBuffer"===f.toStringTag(e)},replace:function(e){return d(e,0,e.byteLength)},revive:function(e){return v(e)}}},$,{blob2:{test:function(e){return"Blob"===f.toStringTag(e)},replace:function(e){if(e.isClosed)throw Error("The Blob is closed");if(m){var t=u(e,"binary"),n=d(t,0,t.byteLength);return{type:e.type,data:n}}w.push(e);var r={type:e.type,data:{start:_,end:_+e.size}};return _+=e.size,r},finalize:function(e,t){e.data=d(t,0,t.byteLength)},revive:function(e){var t=e.type,n=e.data;return new Blob([v(n)],{type:t})}}}]),g.mustFinalize=function(){return w.length>0},g.finalize=function(e){return i(void 0,void 0,void 0,function(){var t,n,i,u,s,c,f,l,p,y;return o(this,function(o){switch(o.label){case 0:return[4,a(new Blob(w),"binary")];case 1:if(t=o.sent(),e){for(n=0,i=e;n<i.length;n++)if((u=i[n]).$types)for(f in(c=(s=u.$types).$)&&(s=s.$),s)l=s[f],(p=g.types[l])&&p.finalize&&(y=r.default.getByKeyPath(u,c?"$."+f:f),p.finalize(y,t.slice(y.start,y.end)))}return w=[],[2]}})})};var E={Stream:function(){}},T=c(function(e,t){!function(e){var t="object"==typeof process&&process.env?process.env:self;e.parser=function(e){return new f(e)},e.CParser=f,e.CStream=p,e.createStream=function e(t){return new p(t)},e.MAX_BUFFER_LENGTH=10485760,e.DEBUG="debug"===t.CDEBUG,e.INFO="debug"===t.CDEBUG||"info"===t.CDEBUG,e.EVENTS=["value","string","key","openobject","closeobject","openarray","closearray","error","end","ready"];var n,r={textNode:void 0,numberNode:""},i=e.EVENTS.filter(function(e){return"error"!==e&&"end"!==e}),o=0;for(var a in e.STATE={BEGIN:o++,VALUE:o++,OPEN_OBJECT:o++,CLOSE_OBJECT:o++,OPEN_ARRAY:o++,CLOSE_ARRAY:o++,TEXT_ESCAPE:o++,STRING:o++,BACKSLASH:o++,END:o++,OPEN_KEY:o++,CLOSE_KEY:o++,TRUE:o++,TRUE2:o++,TRUE3:o++,FALSE:o++,FALSE2:o++,FALSE3:o++,FALSE4:o++,NULL:o++,NULL2:o++,NULL3:o++,NUMBER_DECIMAL_POINT:o++,NUMBER_DIGIT:o++},e.STATE)e.STATE[e.STATE[a]]=a;o=e.STATE;let u={tab:9,lineFeed:10,carriageReturn:13,space:32,doubleQuote:34,plus:43,comma:44,minus:45,period:46,_0:48,_9:57,colon:58,E:69,openBracket:91,backslash:92,closeBracket:93,a:97,b:98,e:101,f:102,l:108,n:110,r:114,s:115,t:116,u:117,openBrace:123,closeBrace:125};function s(e){for(var t in r)e[t]=r[t]}Object.create||(Object.create=function(e){function t(){this.__proto__=e}return t.prototype=e,new t}),Object.getPrototypeOf||(Object.getPrototypeOf=function(e){return e.__proto__}),Object.keys||(Object.keys=function(e){var t=[];for(var n in e)e.hasOwnProperty(n)&&t.push(n);return t});var c=/[\\"\n]/g;function f(t){if(!(this instanceof f))return new f(t);var n=this;s(n),n.bufferCheckPosition=e.MAX_BUFFER_LENGTH,n.q=n.c=n.p="",n.opt=t||{},n.closed=n.closedRoot=n.sawRoot=!1,n.tag=n.error=null,n.state=o.BEGIN,n.stack=[],n.position=n.column=0,n.line=1,n.slashed=!1,n.unicodeI=0,n.unicodeS=null,n.depth=0,y(n,"onready")}f.prototype={end:function(){$(this)},write:function t(n){var i=this;if(this.error)throw this.error;if(i.closed)return b(i,"Cannot write after close. Assign an onready handler.");if(null===n)return $(i);var a=0,s=n.charCodeAt(0),f=i.p;for(e.DEBUG&&console.log("write -> ["+n+"]");s&&(f=s,i.c=s=n.charCodeAt(a++),f!==s?i.p=f:f=i.p,s);)switch(e.DEBUG&&console.log(a,s,e.STATE[i.state]),i.position++,s===u.lineFeed?(i.line++,i.column=0):i.column++,i.state){case o.BEGIN:s===u.openBrace?i.state=o.OPEN_OBJECT:s===u.openBracket?i.state=o.OPEN_ARRAY:g(s)||b(i,"Non-whitespace before {[.");continue;case o.OPEN_KEY:case o.OPEN_OBJECT:if(g(s))continue;if(i.state===o.OPEN_KEY)i.stack.push(o.CLOSE_KEY);else{if(s===u.closeBrace){y(i,"onopenobject"),this.depth++,y(i,"oncloseobject"),this.depth--,i.state=i.stack.pop()||o.VALUE;continue}i.stack.push(o.CLOSE_OBJECT)}s===u.doubleQuote?i.state=o.STRING:b(i,'Malformed object key should start with "');continue;case o.CLOSE_KEY:case o.CLOSE_OBJECT:if(g(s))continue;i.state,o.CLOSE_KEY,s===u.colon?(i.state===o.CLOSE_OBJECT?(i.stack.push(o.CLOSE_OBJECT),d(i,"onopenobject"),this.depth++):d(i,"onkey"),i.state=o.VALUE):s===u.closeBrace?(h(i,"oncloseobject"),this.depth--,i.state=i.stack.pop()||o.VALUE):s===u.comma?(i.state===o.CLOSE_OBJECT&&i.stack.push(o.CLOSE_OBJECT),d(i),i.state=o.OPEN_KEY):b(i,"Bad object");continue;case o.OPEN_ARRAY:case o.VALUE:if(g(s))continue;if(i.state===o.OPEN_ARRAY){if(y(i,"onopenarray"),this.depth++,i.state=o.VALUE,s===u.closeBracket){y(i,"onclosearray"),this.depth--,i.state=i.stack.pop()||o.VALUE;continue}i.stack.push(o.CLOSE_ARRAY)}s===u.doubleQuote?i.state=o.STRING:s===u.openBrace?i.state=o.OPEN_OBJECT:s===u.openBracket?i.state=o.OPEN_ARRAY:s===u.t?i.state=o.TRUE:s===u.f?i.state=o.FALSE:s===u.n?i.state=o.NULL:s===u.minus?i.numberNode+="-":u._0<=s&&s<=u._9?(i.numberNode+=String.fromCharCode(s),i.state=o.NUMBER_DIGIT):b(i,"Bad value");continue;case o.CLOSE_ARRAY:if(s===u.comma)i.stack.push(o.CLOSE_ARRAY),d(i,"onvalue"),i.state=o.VALUE;else if(s===u.closeBracket)h(i,"onclosearray"),this.depth--,i.state=i.stack.pop()||o.VALUE;else{if(g(s))continue;b(i,"Bad array")}continue;case o.STRING:void 0===i.textNode&&(i.textNode="");var l=a-1,p=i.slashed,m=i.unicodeI;STRING_BIGLOOP:for(;;){for(e.DEBUG&&console.log(a,s,e.STATE[i.state],p);m>0;)if(i.unicodeS+=String.fromCharCode(s),s=n.charCodeAt(a++),i.position++,4===m?(i.textNode+=String.fromCharCode(parseInt(i.unicodeS,16)),m=0,l=a-1):m++,!s)break STRING_BIGLOOP;if(s===u.doubleQuote&&!p){i.state=i.stack.pop()||o.VALUE,i.textNode+=n.substring(l,a-1),i.position+=a-1-l;break}if(s===u.backslash&&!p&&(p=!0,i.textNode+=n.substring(l,a-1),i.position+=a-1-l,s=n.charCodeAt(a++),i.position++,!s))break;if(p){if(p=!1,s===u.n?i.textNode+="\n":s===u.r?i.textNode+="\r":s===u.t?i.textNode+=" ":s===u.f?i.textNode+="\f":s===u.b?i.textNode+="\b":s===u.u?(m=1,i.unicodeS=""):i.textNode+=String.fromCharCode(s),s=n.charCodeAt(a++),i.position++,l=a-1,s)continue;break}c.lastIndex=a;var w=c.exec(n);if(null===w){a=n.length+1,i.textNode+=n.substring(l,a-1),i.position+=a-1-l;break}if(a=w.index+1,!(s=n.charCodeAt(w.index))){i.textNode+=n.substring(l,a-1),i.position+=a-1-l;break}}i.slashed=p,i.unicodeI=m;continue;case o.TRUE:s===u.r?i.state=o.TRUE2:b(i,"Invalid true started with t"+s);continue;case o.TRUE2:s===u.u?i.state=o.TRUE3:b(i,"Invalid true started with tr"+s);continue;case o.TRUE3:s===u.e?(y(i,"onvalue",!0),i.state=i.stack.pop()||o.VALUE):b(i,"Invalid true started with tru"+s);continue;case o.FALSE:s===u.a?i.state=o.FALSE2:b(i,"Invalid false started with f"+s);continue;case o.FALSE2:s===u.l?i.state=o.FALSE3:b(i,"Invalid false started with fa"+s);continue;case o.FALSE3:s===u.s?i.state=o.FALSE4:b(i,"Invalid false started with fal"+s);continue;case o.FALSE4:s===u.e?(y(i,"onvalue",!1),i.state=i.stack.pop()||o.VALUE):b(i,"Invalid false started with fals"+s);continue;case o.NULL:s===u.u?i.state=o.NULL2:b(i,"Invalid null started with n"+s);continue;case o.NULL2:s===u.l?i.state=o.NULL3:b(i,"Invalid null started with nu"+s);continue;case o.NULL3:s===u.l?(y(i,"onvalue",null),i.state=i.stack.pop()||o.VALUE):b(i,"Invalid null started with nul"+s);continue;case o.NUMBER_DECIMAL_POINT:s===u.period?(i.numberNode+=".",i.state=o.NUMBER_DIGIT):b(i,"Leading zero not followed by .");continue;case o.NUMBER_DIGIT:u._0<=s&&s<=u._9?i.numberNode+=String.fromCharCode(s):s===u.period?(-1!==i.numberNode.indexOf(".")&&b(i,"Invalid number has two dots"),i.numberNode+="."):s===u.e||s===u.E?((-1!==i.numberNode.indexOf("e")||-1!==i.numberNode.indexOf("E"))&&b(i,"Invalid number has two exponential"),i.numberNode+="e"):s===u.plus||s===u.minus?(f===u.e||f===u.E||b(i,"Invalid symbol in number"),i.numberNode+=String.fromCharCode(s)):(v(i),a--,i.state=i.stack.pop()||o.VALUE);continue;default:b(i,"Unknown state: "+i.state)}return i.position>=i.bufferCheckPosition&&function t(n){var i=Math.max(e.MAX_BUFFER_LENGTH,10),o=0;for(var a in r){var u=void 0===n[a]?0:n[a].length;u>i&&("text"===a?closeText(n):b(n,"Max buffer length exceeded: "+a)),o=Math.max(o,u)}n.bufferCheckPosition=e.MAX_BUFFER_LENGTH-o+n.position}(i),i},resume:function(){return this.error=null,this},close:function(){return this.write(null)}};try{n=E.Stream}catch(l){n=function(){}}function p(e){if(!(this instanceof p))return new p(e);this._parser=new f(e),this.writable=!0,this.readable=!0,this.bytes_remaining=0,this.bytes_in_sequence=0,this.temp_buffs={2:new Buffer(2),3:new Buffer(3),4:new Buffer(4)},this.string="";var t=this;n.apply(t),this._parser.onend=function(){t.emit("end")},this._parser.onerror=function(e){t.emit("error",e),t._parser.error=null},i.forEach(function(e){Object.defineProperty(t,"on"+e,{get:function(){return t._parser["on"+e]},set:function(n){if(!n)return t.removeAllListeners(e),t._parser["on"+e]=n,n;t.on(e,n)},enumerable:!0,configurable:!1})})}function y(t,n,r){e.INFO&&console.log("-- emit",n,r),t[n]&&t[n](r)}function h(e,t,n){d(e),y(e,t,n)}function d(e,t){var n,r;e.textNode=(n=e.opt,r=e.textNode,void 0===r||(n.trim&&(r=r.trim()),n.normalize&&(r=r.replace(/\s+/g," "))),r),void 0!==e.textNode&&y(e,t||"onvalue",e.textNode),e.textNode=void 0}function v(e){e.numberNode&&y(e,"onvalue",parseFloat(e.numberNode)),e.numberNode=""}function b(e,t){return d(e),t+="\nLine: "+e.line+"\nColumn: "+e.column+"\nChar: "+e.c,t=Error(t),e.error=t,y(e,"onerror",t),e}function $(e){return(e.state!==o.VALUE||0!==e.depth)&&b(e,"Unexpected end"),d(e),e.c="",e.closed=!0,y(e,"onend"),f.call(e,e.opt),e}function g(e){return e===u.carriageReturn||e===u.lineFeed||e===u.space||e===u.tab}p.prototype=Object.create(n.prototype,{constructor:{value:p}}),p.prototype.write=function(e){e=new Buffer(e);for(var t=0;t<e.length;t++){var n=e[t];if(this.bytes_remaining>0){for(var r=0;r<this.bytes_remaining;r++)this.temp_buffs[this.bytes_in_sequence][this.bytes_in_sequence-this.bytes_remaining+r]=e[r];this.string=this.temp_buffs[this.bytes_in_sequence].toString(),this.bytes_in_sequence=this.bytes_remaining=0,t=t+r-1,this._parser.write(this.string),this.emit("data",this.string);continue}if(0===this.bytes_remaining&&n>=128){if(n>=194&&n<=223&&(this.bytes_in_sequence=2),n>=224&&n<=239&&(this.bytes_in_sequence=3),n>=240&&n<=244&&(this.bytes_in_sequence=4),this.bytes_in_sequence+t>e.length){for(var i=0;i<=e.length-1-t;i++)this.temp_buffs[this.bytes_in_sequence][i]=e[t+i];return this.bytes_remaining=t+this.bytes_in_sequence-e.length,!0}this.string=e.slice(t,t+this.bytes_in_sequence).toString(),t=t+this.bytes_in_sequence-1,this._parser.write(this.string),this.emit("data",this.string);continue}for(var o=t;o<e.length&&!(e[o]>=128);o++);this.string=e.slice(t,o).toString(),this._parser.write(this.string),this.emit("data",this.string),t=o-1}},p.prototype.end=function(e){return e&&e.length&&this._parser.write(e.toString()),this._parser.end(),!0},p.prototype.on=function(e,t){var r=this;return r._parser["on"+e]||-1===i.indexOf(e)||(r._parser["on"+e]=function(){var t=1===arguments.length?[arguments[0]]:Array.apply(null,arguments);t.splice(0,0,e),r.emit.apply(r,t)}),n.prototype.on.call(r,e,t)},p.prototype.destroy=function(){s(this._parser),this.emit("close")}}(t)});function A(e){var t,n,r,s,c,f,l,p,y,h=0,d=(t=!0,c=T.parser(),f=0,l=[],p=!1,y=!1,c.onopenobject=function(e){var i={};i.incomplete=!0,n||(n=i),r&&(l.push([s,r,y]),t&&(y?r.push(i):r[s]=i)),r=i,s=e,y=!1,++f},c.onkey=function(e){return s=e},c.onvalue=function(e){return y?r.push(e):r[s]=e},c.oncloseobject=function(){var e;if(delete r.incomplete,s=null,0==--f)p=!0;else{var n=r;s=(e=l.pop())[0],r=e[1],y=e[2],t||(y?r.push(n):r[s]=n)}},c.onopenarray=function(){var e=[];e.incomplete=!0,n||(n=e),r&&(l.push([s,r,y]),t&&(y?r.push(e):r[s]=e)),r=e,y=!0,s=null,++f},c.onclosearray=function(){var e;if(delete r.incomplete,s=null,0==--f)p=!0;else{var n=r;s=(e=l.pop())[0],r=e[1],y=e[2],t||(y?r.push(n):r[s]=n)}},{write:function(e){return c.write(e),n},done:function(){return p}}),v={pullAsync:function(t){return i(this,void 0,void 0,function(){var n,r,i;return o(this,function(o){switch(o.label){case 0:return n=e.slice(h,h+t),h+=t,[4,a(n,"text")];case 1:return r=o.sent(),i=d.write(r),v.result=i||{},[2,i]}})})},pullSync:function(t){var n=e.slice(h,h+t);h+=t;var r=u(n,"text"),i=d.write(r);return v.result=i||{},i},done:function(){return d.done()},eof:function(){return h>=e.size},result:{}};return v}function N(e,t){return i(this,void 0,void 0,function(){var n,i,a,u;return o(this,function(o){switch(o.label){case 0:return[4,x(e,n=(t=t||{}).chunkSizeBytes||1048576)];case 1:return a=(i=o.sent()).result.data,(u=new r.default(a.databaseName)).version(a.databaseVersion).stores(function e(t){for(var n={},r=0,i=t.tables;r<i.length;r++){var o=i[r];n[o.name]=o.schema}return n}(a)),[4,S(u,i,t)];case 2:return o.sent(),[2,u]}})})}function S(e,t,n){return i(this,void 0,void 0,function(){var a,u,s,c,f,l,p,y,h,d;function v(){return i(this,void 0,void 0,function(){var t,i,s,y,h;return o(this,function(d){switch(d.label){case 0:t=function(t){var i,a,u,s,c,y,h,d,v,b,$,m;return o(this,function(o){switch(o.label){case 0:if(!t.rows)return[2,"break"];if(!t.rows.incomplete&&0===t.rows.length)return[2,"continue"];if(l&&r.default.ignoreTransaction(function(){return l(p)}),i=t.tableName,a=e.table(i),u=f.tables.filter(function(e){return e.name===i})[0].schema,!a){if(n.acceptMissingTables)return[2,"continue"];throw Error("Exported table ".concat(t.tableName," is missing in installed database"))}if(!n.acceptChangedPrimaryKey&&u.split(",")[0]!=a.schema.primKey.src)throw Error("Primary key differs for table ".concat(t.tableName,". "));for(y=0,s=t.rows,c=[];y<s.length&&!(h=s[y]).incomplete;y++)c.push(g.revive(h));if(v=(d=n.filter)?t.inbound?c.filter(function(e){return d(i,e)}):c.filter(function(e){var t=e[0];return d(i,e[1],t)}):c,$=(b=t.inbound?[void 0,v]:[v.map(function(e){return e[0]}),c.map(function(e){return e[1]})])[0],m=b[1],!n.overwriteValues)return[3,2];return[4,a.bulkPut(m,$)];case 1:return o.sent(),[3,4];case 2:return[4,a.bulkAdd(m,$)];case 3:o.sent(),o.label=4;case 4:return p.completedRows+=c.length,c.incomplete||(p.completedTables+=1),s.splice(0,c.length),[2]}})},i=0,s=f.data,d.label=1;case 1:if(!(i<s.length))return[3,4];return[5,t(y=s[i])];case 2:if("break"===(h=d.sent()))return[3,4];d.label=3;case 3:return i++,[3,1];case 4:for(;f.data.length>0&&f.data[0].rows&&!f.data[0].rows.incomplete;)f.data.splice(0,1);if(!(!u.done()&&!u.eof()))return[3,8];if(!c)return[3,5];return u.pullSync(a),[3,7];case 5:return[4,r.default.waitFor(u.pullAsync(a))];case 6:d.sent(),d.label=7;case 7:return[3,9];case 8:return[3,10];case 9:return[3,0];case 10:return[2]}})})}return o(this,function(i){switch(i.label){case 0:return[4,x(t,a=(n=n||{}).chunkSizeBytes||1048576)];case 1:if(s=(u=i.sent()).result,c="FileReaderSync"in self,f=s.data,!n.acceptNameDiff&&e.name!==f.databaseName)throw Error("Name differs. Current database name is ".concat(e.name," but export is ").concat(f.databaseName));if(!n.acceptVersionDiff&&e.verno!==f.databaseVersion)throw Error("Database version differs. Current database is in version ".concat(e.verno," but export is ").concat(f.databaseVersion));if(l=n.progressCallback,p={done:!1,completedRows:0,completedTables:0,totalRows:f.tables.reduce(function(e,t){return e+t.rowCount},0),totalTables:f.tables.length},l&&r.default.ignoreTransaction(function(){return l(p)}),!n.clearTablesBeforeImport)return[3,5];y=0,h=e.tables,i.label=2;case 2:if(!(y<h.length))return[3,5];return[4,(d=h[y]).clear()];case 3:i.sent(),i.label=4;case 4:return y++,[3,2];case 5:if(!n.noTransaction)return[3,7];return[4,v()];case 6:return i.sent(),[3,9];case 7:return[4,e.transaction("rw",e.tables,v)];case 8:i.sent(),i.label=9;case 9:return p.done=!0,l&&r.default.ignoreTransaction(function(){return l(p)}),[2]}})})}function x(e,t){return i(this,void 0,void 0,function(){var n,r;return o(this,function(i){switch(i.label){case 0:n="slice"in e?A(e):e,i.label=1;case 1:if(n.eof())return[3,3];return[4,n.pullAsync(t)];case 2:if(i.sent(),n.result.data&&n.result.data.data)return[3,3];return[3,1];case 3:if(!(r=n.result)||"dexie"!=r.formatName)throw Error("Given file is not a dexie export");if(r.formatVersion>1)throw Error("Format version ".concat(r.formatVersion," not supported"));if(!r.data)throw Error("No data in export file");if(!r.data.databaseName)throw Error("Missing databaseName in export file");if(!r.data.databaseVersion)throw Error("Missing databaseVersion in export file");if(!r.data.tables)throw Error("Missing tables in export file");return[2,n]}})})}r.default.prototype.export=function(e){return O(this,e)},r.default.prototype.import=function(e,t){return S(this,e,t)},r.default.import=function(e,t){return N(e,t)};var k=function(){throw Error("This addon extends Dexie.prototype globally and does not have be included in Dexie constructor's addons options.")};e.default=k,e.exportDB=O,e.importDB=N,e.importInto=S,e.peakImportFile=function e(t){return i(this,void 0,void 0,function(){var e;return o(this,function(n){switch(n.label){case 0:e=A(t),n.label=1;case 1:if(e.eof())return[3,3];return[4,e.pullAsync(5120)];case 2:if(n.sent(),e.result.data&&e.result.data.data)return delete e.result.data.data,[3,3];return[3,1];case 3:return[2,e.result]}})})},Object.defineProperty(e,"__esModule",{value:!0})});</script>
<!-- <script src="https://cdn.jsdelivr.net/npm/[email protected]/marked.min.js"></script> -->
<script>!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).marked={})}(this,function(r){"use strict";function i(e,t){for(var u=0;u<t.length;u++){var n=t[u];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,function(e){e=function(e,t){if("object"!=typeof e||null===e)return e;var u=e[Symbol.toPrimitive];if(void 0===u)return("string"===t?String:Number)(e);u=u.call(e,t||"default");if("object"!=typeof u)return u;throw new TypeError("@@toPrimitive must return a primitive value.")}(e,"string");return"symbol"==typeof e?e:String(e)}(n.key),n)}}function s(e,t){(null==t||t>e.length)&&(t=e.length);for(var u=0,n=new Array(t);u<t;u++)n[u]=e[u];return n}function D(e,t){var u,n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(n)return(n=n.call(e)).next.bind(n);if(Array.isArray(e)||(n=function(e,t){var u;if(e)return"string"==typeof e?s(e,t):"Map"===(u="Object"===(u=Object.prototype.toString.call(e).slice(8,-1))&&e.constructor?e.constructor.name:u)||"Set"===u?Array.from(e):"Arguments"===u||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(u)?s(e,t):void 0}(e))||t&&e&&"number"==typeof e.length)return n&&(e=n),u=0,function(){return u>=e.length?{done:!0}:{done:!1,value:e[u++]}};throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function e(){return{async:!1,baseUrl:null,breaks:!1,extensions:null,gfm:!0,headerIds:!0,headerPrefix:"",highlight:null,langPrefix:"language-",mangle:!0,pedantic:!1,renderer:null,sanitize:!1,sanitizer:null,silent:!1,smartypants:!1,tokenizer:null,walkTokens:null,xhtml:!1}}r.defaults=e();function u(e){return t[e]}var n=/[&<>"']/,l=new RegExp(n.source,"g"),a=/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/,o=new RegExp(a.source,"g"),t={"&":"&","<":"<",">":">",'"':""","'":"'"};function c(e,t){if(t){if(n.test(e))return e.replace(l,u)}else if(a.test(e))return e.replace(o,u);return e}var h=/&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/gi;function x(e){return e.replace(h,function(e,t){return"colon"===(t=t.toLowerCase())?":":"#"===t.charAt(0)?"x"===t.charAt(1)?String.fromCharCode(parseInt(t.substring(2),16)):String.fromCharCode(+t.substring(1)):""})}var p=/(^|[^\[])\^/g;function f(u,e){u="string"==typeof u?u:u.source,e=e||"";var n={replace:function(e,t){return t=(t=t.source||t).replace(p,"$1"),u=u.replace(e,t),n},getRegex:function(){return new RegExp(u,e)}};return n}var g=/[^\w:]/g,Z=/^$|^[a-z][a-z0-9+.-]*:|^[?#]/i;function F(e,t,u){if(e){try{n=decodeURIComponent(x(u)).replace(g,"").toLowerCase()}catch(e){return null}if(0===n.indexOf("javascript:")||0===n.indexOf("vbscript:")||0===n.indexOf("data:"))return null}var n;t&&!Z.test(u)&&(e=u,A[" "+(n=t)]||(q.test(n)?A[" "+n]=n+"/":A[" "+n]=E(n,"/",!0)),t=-1===(n=A[" "+n]).indexOf(":"),u="//"===e.substring(0,2)?t?e:n.replace(O,"$1")+e:"/"===e.charAt(0)?t?e:n.replace(j,"$1")+e:n+e);try{u=encodeURI(u).replace(/%25/g,"%")}catch(e){return null}return u}var A={},q=/^[^:]+:\/*[^/]*$/,O=/^([^:]+:)[\s\S]*$/,j=/^([^:]+:\/*[^/]*)[\s\S]*$/;var d={exec:function(){}};function C(e){for(var t,u,n=1;n<arguments.length;n++)for(u in t=arguments[n])Object.prototype.hasOwnProperty.call(t,u)&&(e[u]=t[u]);return e}function k(e,t){var u=e.replace(/\|/g,function(e,t,u){for(var n=!1,r=t;0<=--r&&"\\"===u[r];)n=!n;return n?"|":" |"}).split(/ \|/),n=0;if(u[0].trim()||u.shift(),0<u.length&&!u[u.length-1].trim()&&u.pop(),u.length>t)u.splice(t);else for(;u.length<t;)u.push("");for(;n<u.length;n++)u[n]=u[n].trim().replace(/\\\|/g,"|");return u}function E(e,t,u){var n=e.length;if(0===n)return"";for(var r=0;r<n;){var i=e.charAt(n-r-1);if((i!==t||u)&&(i===t||!u))break;r++}return e.slice(0,n-r)}function m(e){e&&e.sanitize&&!e.silent&&console.warn("marked(): sanitize and sanitizer parameters are deprecated since version 0.7.0, should not be used and will be removed in the future. Read more here: https://marked.js.org/#/USING_ADVANCED.md#options")}function b(e,t){if(t<1)return"";for(var u="";1<t;)1&t&&(u+=e),t>>=1,e+=e;return u+e}function B(e,t,u,n){var r=t.href,t=t.title?c(t.title):null,i=e[1].replace(/\\([\[\]])/g,"$1");return"!"!==e[0].charAt(0)?(n.state.inLink=!0,e={type:"link",raw:u,href:r,title:t,text:i,tokens:n.inlineTokens(i)},n.state.inLink=!1,e):{type:"image",raw:u,href:r,title:t,text:c(i)}}var w=function(){function e(e){this.options=e||r.defaults}var t=e.prototype;return t.space=function(e){e=this.rules.block.newline.exec(e);if(e&&0<e[0].length)return{type:"space",raw:e[0]}},t.code=function(e){var t,e=this.rules.block.code.exec(e);if(e)return t=e[0].replace(/^ {1,4}/gm,""),{type:"code",raw:e[0],codeBlockStyle:"indented",text:this.options.pedantic?t:E(t,"\n")}},t.fences=function(e){var t,u,n,r,e=this.rules.block.fences.exec(e);if(e)return t=e[0],u=t,n=e[3]||"",u=null===(u=t.match(/^(\s+)(?:```)/))?n:(r=u[1],n.split("\n").map(function(e){var t=e.match(/^\s+/);return null!==t&&t[0].length>=r.length?e.slice(r.length):e}).join("\n")),{type:"code",raw:t,lang:e[2]&&e[2].trim().replace(this.rules.inline._escapes,"$1"),text:u}},t.heading=function(e){var t,u,e=this.rules.block.heading.exec(e);if(e)return t=e[2].trim(),/#$/.test(t)&&(u=E(t,"#"),!this.options.pedantic&&u&&!/ $/.test(u)||(t=u.trim())),{type:"heading",raw:e[0],depth:e[1].length,text:t,tokens:this.lexer.inline(t)}},t.hr=function(e){e=this.rules.block.hr.exec(e);if(e)return{type:"hr",raw:e[0]}},t.blockquote=function(e){var t,u,n,e=this.rules.block.blockquote.exec(e);if(e)return t=e[0].replace(/^ *>[ \t]?/gm,""),u=this.lexer.state.top,this.lexer.state.top=!0,n=this.lexer.blockTokens(t),this.lexer.state.top=u,{type:"blockquote",raw:e[0],tokens:n,text:t}},t.list=function(e){var t=this.rules.block.list.exec(e);if(t){var u,n,r,i,s,l,a,o,D,c,h,p=1<(g=t[1].trim()).length,f={type:"list",raw:"",ordered:p,start:p?+g.slice(0,-1):"",loose:!1,items:[]},g=p?"\\d{1,9}\\"+g.slice(-1):"\\"+g;this.options.pedantic&&(g=p?g:"[*+-]");for(var F=new RegExp("^( {0,3}"+g+")((?:[\t ][^\\n]*)?(?:\\n|$))");e&&(h=!1,t=F.exec(e))&&!this.rules.block.hr.test(e);){if(u=t[0],e=e.substring(u.length),a=t[2].split("\n",1)[0].replace(/^\t+/,function(e){return" ".repeat(3*e.length)}),o=e.split("\n",1)[0],this.options.pedantic?(i=2,c=a.trimLeft()):(i=t[2].search(/[^ ]/),c=a.slice(i=4<i?1:i),i+=t[1].length),s=!1,!a&&/^ *$/.test(o)&&(u+=o+"\n",e=e.substring(o.length+1),h=!0),!h)for(var A=new RegExp("^ {0,"+Math.min(3,i-1)+"}(?:[*+-]|\\d{1,9}[.)])((?:[ \t][^\\n]*)?(?:\\n|$))"),d=new RegExp("^ {0,"+Math.min(3,i-1)+"}((?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$)"),C=new RegExp("^ {0,"+Math.min(3,i-1)+"}(?:```|~~~)"),k=new RegExp("^ {0,"+Math.min(3,i-1)+"}#");e&&(o=D=e.split("\n",1)[0],this.options.pedantic&&(o=o.replace(/^ {1,4}(?=( {4})*[^ ])/g," ")),!C.test(o))&&!k.test(o)&&!A.test(o)&&!d.test(e);){if(o.search(/[^ ]/)>=i||!o.trim())c+="\n"+o.slice(i);else{if(s)break;if(4<=a.search(/[^ ]/))break;if(C.test(a))break;if(k.test(a))break;if(d.test(a))break;c+="\n"+o}s||o.trim()||(s=!0),u+=D+"\n",e=e.substring(D.length+1),a=o.slice(i)}f.loose||(l?f.loose=!0:/\n *\n *$/.test(u)&&(l=!0)),this.options.gfm&&(n=/^\[[ xX]\] /.exec(c))&&(r="[ ] "!==n[0],c=c.replace(/^\[[ xX]\] +/,"")),f.items.push({type:"list_item",raw:u,task:!!n,checked:r,loose:!1,text:c}),f.raw+=u}f.items[f.items.length-1].raw=u.trimRight(),f.items[f.items.length-1].text=c.trimRight(),f.raw=f.raw.trimRight();for(var E,x=f.items.length,m=0;m<x;m++)this.lexer.state.top=!1,f.items[m].tokens=this.lexer.blockTokens(f.items[m].text,[]),f.loose||(E=0<(E=f.items[m].tokens.filter(function(e){return"space"===e.type})).length&&E.some(function(e){return/\n.*\n/.test(e.raw)}),f.loose=E);if(f.loose)for(m=0;m<x;m++)f.items[m].loose=!0;return f}},t.html=function(e){var t,e=this.rules.block.html.exec(e);if(e)return t={type:"html",raw:e[0],pre:!this.options.sanitizer&&("pre"===e[1]||"script"===e[1]||"style"===e[1]),text:e[0]},this.options.sanitize&&(e=this.options.sanitizer?this.options.sanitizer(e[0]):c(e[0]),t.type="paragraph",t.text=e,t.tokens=this.lexer.inline(e)),t},t.def=function(e){var t,u,n,e=this.rules.block.def.exec(e);if(e)return t=e[1].toLowerCase().replace(/\s+/g," "),u=e[2]?e[2].replace(/^<(.*)>$/,"$1").replace(this.rules.inline._escapes,"$1"):"",n=e[3]&&e[3].substring(1,e[3].length-1).replace(this.rules.inline._escapes,"$1"),{type:"def",tag:t,raw:e[0],href:u,title:n}},t.table=function(e){e=this.rules.block.table.exec(e);if(e){var t={type:"table",header:k(e[1]).map(function(e){return{text:e}}),align:e[2].replace(/^ *|\| *$/g,"").split(/ *\| */),rows:e[3]&&e[3].trim()?e[3].replace(/\n[ \t]*$/,"").split("\n"):[]};if(t.header.length===t.align.length){t.raw=e[0];for(var u,n,r,i=t.align.length,s=0;s<i;s++)/^ *-+: *$/.test(t.align[s])?t.align[s]="right":/^ *:-+: *$/.test(t.align[s])?t.align[s]="center":/^ *:-+ *$/.test(t.align[s])?t.align[s]="left":t.align[s]=null;for(i=t.rows.length,s=0;s<i;s++)t.rows[s]=k(t.rows[s],t.header.length).map(function(e){return{text:e}});for(i=t.header.length,u=0;u<i;u++)t.header[u].tokens=this.lexer.inline(t.header[u].text);for(i=t.rows.length,u=0;u<i;u++)for(r=t.rows[u],n=0;n<r.length;n++)r[n].tokens=this.lexer.inline(r[n].text);return t}}},t.lheading=function(e){e=this.rules.block.lheading.exec(e);if(e)return{type:"heading",raw:e[0],depth:"="===e[2].charAt(0)?1:2,text:e[1],tokens:this.lexer.inline(e[1])}},t.paragraph=function(e){var t,e=this.rules.block.paragraph.exec(e);if(e)return t="\n"===e[1].charAt(e[1].length-1)?e[1].slice(0,-1):e[1],{type:"paragraph",raw:e[0],text:t,tokens:this.lexer.inline(t)}},t.text=function(e){e=this.rules.block.text.exec(e);if(e)return{type:"text",raw:e[0],text:e[0],tokens:this.lexer.inline(e[0])}},t.escape=function(e){e=this.rules.inline.escape.exec(e);if(e)return{type:"escape",raw:e[0],text:c(e[1])}},t.tag=function(e){e=this.rules.inline.tag.exec(e);if(e)return!this.lexer.state.inLink&&/^<a /i.test(e[0])?this.lexer.state.inLink=!0:this.lexer.state.inLink&&/^<\/a>/i.test(e[0])&&(this.lexer.state.inLink=!1),!this.lexer.state.inRawBlock&&/^<(pre|code|kbd|script)(\s|>)/i.test(e[0])?this.lexer.state.inRawBlock=!0:this.lexer.state.inRawBlock&&/^<\/(pre|code|kbd|script)(\s|>)/i.test(e[0])&&(this.lexer.state.inRawBlock=!1),{type:this.options.sanitize?"text":"html",raw:e[0],inLink:this.lexer.state.inLink,inRawBlock:this.lexer.state.inRawBlock,text:this.options.sanitize?this.options.sanitizer?this.options.sanitizer(e[0]):c(e[0]):e[0]}},t.link=function(e){e=this.rules.inline.link.exec(e);if(e){var t=e[2].trim();if(!this.options.pedantic&&/^</.test(t)){if(!/>$/.test(t))return;var u=E(t.slice(0,-1),"\\");if((t.length-u.length)%2==0)return}else{u=function(e,t){if(-1!==e.indexOf(t[1]))for(var u=e.length,n=0,r=0;r<u;r++)if("\\"===e[r])r++;else if(e[r]===t[0])n++;else if(e[r]===t[1]&&--n<0)return r;return-1}(e[2],"()");-1<u&&(r=(0===e[0].indexOf("!")?5:4)+e[1].length+u,e[2]=e[2].substring(0,u),e[0]=e[0].substring(0,r).trim(),e[3]="")}var n,u=e[2],r="";return this.options.pedantic?(n=/^([^'"]*[^\s])\s+(['"])(.*)\2/.exec(u))&&(u=n[1],r=n[3]):r=e[3]?e[3].slice(1,-1):"",u=u.trim(),B(e,{href:(u=/^</.test(u)?this.options.pedantic&&!/>$/.test(t)?u.slice(1):u.slice(1,-1):u)&&u.replace(this.rules.inline._escapes,"$1"),title:r&&r.replace(this.rules.inline._escapes,"$1")},e[0],this.lexer)}},t.reflink=function(e,t){var u;if(u=(u=this.rules.inline.reflink.exec(e))||this.rules.inline.nolink.exec(e))return(e=t[(e=(u[2]||u[1]).replace(/\s+/g," ")).toLowerCase()])?B(u,e,u[0],this.lexer):{type:"text",raw:t=u[0].charAt(0),text:t}},t.emStrong=function(e,t,u){void 0===u&&(u="");var n=this.rules.inline.emStrong.lDelim.exec(e);if(n&&(!n[3]||!u.match(/(?:[0-9A-Za-z\xAA\xB2\xB3\xB5\xB9\xBA\xBC-\xBE\xC0-\xD6\xD8-\xF6\xF8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0370-\u0374\u0376\u0377\u037A-\u037D\u037F\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u048A-\u052F\u0531-\u0556\u0559\u0560-\u0588\u05D0-\u05EA\u05EF-\u05F2\u0620-\u064A\u0660-\u0669\u066E\u066F\u0671-\u06D3\u06D5\u06E5\u06E6\u06EE-\u06FC\u06FF\u0710\u0712-\u072F\u074D-\u07A5\u07B1\u07C0-\u07EA\u07F4\u07F5\u07FA\u0800-\u0815\u081A\u0824\u0828\u0840-\u0858\u0860-\u086A\u0870-\u0887\u0889-\u088E\u08A0-\u08C9\u0904-\u0939\u093D\u0950\u0958-\u0961\u0966-\u096F\u0971-\u0980\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BD\u09CE\u09DC\u09DD\u09DF-\u09E1\u09E6-\u09F1\u09F4-\u09F9\u09FC\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A59-\u0A5C\u0A5E\u0A66-\u0A6F\u0A72-\u0A74\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABD\u0AD0\u0AE0\u0AE1\u0AE6-\u0AEF\u0AF9\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3D\u0B5C\u0B5D\u0B5F-\u0B61\u0B66-\u0B6F\u0B71-\u0B77\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BD0\u0BE6-\u0BF2\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C39\u0C3D\u0C58-\u0C5A\u0C5D\u0C60\u0C61\u0C66-\u0C6F\u0C78-\u0C7E\u0C80\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBD\u0CDD\u0CDE\u0CE0\u0CE1\u0CE6-\u0CEF\u0CF1\u0CF2\u0D04-\u0D0C\u0D0E-\u0D10\u0D12-\u0D3A\u0D3D\u0D4E\u0D54-\u0D56\u0D58-\u0D61\u0D66-\u0D78\u0D7A-\u0D7F\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0DE6-\u0DEF\u0E01-\u0E30\u0E32\u0E33\u0E40-\u0E46\u0E50-\u0E59\u0E81\u0E82\u0E84\u0E86-\u0E8A\u0E8C-\u0EA3\u0EA5\u0EA7-\u0EB0\u0EB2\u0EB3\u0EBD\u0EC0-\u0EC4\u0EC6\u0ED0-\u0ED9\u0EDC-\u0EDF\u0F00\u0F20-\u0F33\u0F40-\u0F47\u0F49-\u0F6C\u0F88-\u0F8C\u1000-\u102A\u103F-\u1049\u1050-\u1055\u105A-\u105D\u1061\u1065\u1066\u106E-\u1070\u1075-\u1081\u108E\u1090-\u1099\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u1369-\u137C\u1380-\u138F\u13A0-\u13F5\u13F8-\u13FD\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u16EE-\u16F8\u1700-\u1711\u171F-\u1731\u1740-\u1751\u1760-\u176C\u176E-\u1770\u1780-\u17B3\u17D7\u17DC\u17E0-\u17E9\u17F0-\u17F9\u1810-\u1819\u1820-\u1878\u1880-\u1884\u1887-\u18A8\u18AA\u18B0-\u18F5\u1900-\u191E\u1946-\u196D\u1970-\u1974\u1980-\u19AB\u19B0-\u19C9\u19D0-\u19DA\u1A00-\u1A16\u1A20-\u1A54\u1A80-\u1A89\u1A90-\u1A99\u1AA7\u1B05-\u1B33\u1B45-\u1B4C\u1B50-\u1B59\u1B83-\u1BA0\u1BAE-\u1BE5\u1C00-\u1C23\u1C40-\u1C49\u1C4D-\u1C7D\u1C80-\u1C88\u1C90-\u1CBA\u1CBD-\u1CBF\u1CE9-\u1CEC\u1CEE-\u1CF3\u1CF5\u1CF6\u1CFA\u1D00-\u1DBF\u1E00-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u2070\u2071\u2074-\u2079\u207F-\u2089\u2090-\u209C\u2102\u2107\u210A-\u2113\u2115\u2119-\u211D\u2124\u2126\u2128\u212A-\u212D\u212F-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2150-\u2189\u2460-\u249B\u24EA-\u24FF\u2776-\u2793\u2C00-\u2CE4\u2CEB-\u2CEE\u2CF2\u2CF3\u2CFD\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D80-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u2E2F\u3005-\u3007\u3021-\u3029\u3031-\u3035\u3038-\u303C\u3041-\u3096\u309D-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312F\u3131-\u318E\u3192-\u3195\u31A0-\u31BF\u31F0-\u31FF\u3220-\u3229\u3248-\u324F\u3251-\u325F\u3280-\u3289\u32B1-\u32BF\u3400-\u4DBF\u4E00-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA62B\uA640-\uA66E\uA67F-\uA69D\uA6A0-\uA6EF\uA717-\uA71F\uA722-\uA788\uA78B-\uA7CA\uA7D0\uA7D1\uA7D3\uA7D5-\uA7D9\uA7F2-\uA801\uA803-\uA805\uA807-\uA80A\uA80C-\uA822\uA830-\uA835\uA840-\uA873\uA882-\uA8B3\uA8D0-\uA8D9\uA8F2-\uA8F7\uA8FB\uA8FD\uA8FE\uA900-\uA925\uA930-\uA946\uA960-\uA97C\uA984-\uA9B2\uA9CF-\uA9D9\uA9E0-\uA9E4\uA9E6-\uA9FE\uAA00-\uAA28\uAA40-\uAA42\uAA44-\uAA4B\uAA50-\uAA59\uAA60-\uAA76\uAA7A\uAA7E-\uAAAF\uAAB1\uAAB5\uAAB6\uAAB9-\uAABD\uAAC0\uAAC2\uAADB-\uAADD\uAAE0-\uAAEA\uAAF2-\uAAF4\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uAB30-\uAB5A\uAB5C-\uAB69\uAB70-\uABE2\uABF0-\uABF9\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D\uFB1F-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE70-\uFE74\uFE76-\uFEFC\uFF10-\uFF19\uFF21-\uFF3A\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC]|\uD800[\uDC00-\uDC0B\uDC0D-\uDC26\uDC28-\uDC3A\uDC3C\uDC3D\uDC3F-\uDC4D\uDC50-\uDC5D\uDC80-\uDCFA\uDD07-\uDD33\uDD40-\uDD78\uDD8A\uDD8B\uDE80-\uDE9C\uDEA0-\uDED0\uDEE1-\uDEFB\uDF00-\uDF23\uDF2D-\uDF4A\uDF50-\uDF75\uDF80-\uDF9D\uDFA0-\uDFC3\uDFC8-\uDFCF\uDFD1-\uDFD5]|\uD801[\uDC00-\uDC9D\uDCA0-\uDCA9\uDCB0-\uDCD3\uDCD8-\uDCFB\uDD00-\uDD27\uDD30-\uDD63\uDD70-\uDD7A\uDD7C-\uDD8A\uDD8C-\uDD92\uDD94\uDD95\uDD97-\uDDA1\uDDA3-\uDDB1\uDDB3-\uDDB9\uDDBB\uDDBC\uDE00-\uDF36\uDF40-\uDF55\uDF60-\uDF67\uDF80-\uDF85\uDF87-\uDFB0\uDFB2-\uDFBA]|\uD802[\uDC00-\uDC05\uDC08\uDC0A-\uDC35\uDC37\uDC38\uDC3C\uDC3F-\uDC55\uDC58-\uDC76\uDC79-\uDC9E\uDCA7-\uDCAF\uDCE0-\uDCF2\uDCF4\uDCF5\uDCFB-\uDD1B\uDD20-\uDD39\uDD80-\uDDB7\uDDBC-\uDDCF\uDDD2-\uDE00\uDE10-\uDE13\uDE15-\uDE17\uDE19-\uDE35\uDE40-\uDE48\uDE60-\uDE7E\uDE80-\uDE9F\uDEC0-\uDEC7\uDEC9-\uDEE4\uDEEB-\uDEEF\uDF00-\uDF35\uDF40-\uDF55\uDF58-\uDF72\uDF78-\uDF91\uDFA9-\uDFAF]|\uD803[\uDC00-\uDC48\uDC80-\uDCB2\uDCC0-\uDCF2\uDCFA-\uDD23\uDD30-\uDD39\uDE60-\uDE7E\uDE80-\uDEA9\uDEB0\uDEB1\uDF00-\uDF27\uDF30-\uDF45\uDF51-\uDF54\uDF70-\uDF81\uDFB0-\uDFCB\uDFE0-\uDFF6]|\uD804[\uDC03-\uDC37\uDC52-\uDC6F\uDC71\uDC72\uDC75\uDC83-\uDCAF\uDCD0-\uDCE8\uDCF0-\uDCF9\uDD03-\uDD26\uDD36-\uDD3F\uDD44\uDD47\uDD50-\uDD72\uDD76\uDD83-\uDDB2\uDDC1-\uDDC4\uDDD0-\uDDDA\uDDDC\uDDE1-\uDDF4\uDE00-\uDE11\uDE13-\uDE2B\uDE80-\uDE86\uDE88\uDE8A-\uDE8D\uDE8F-\uDE9D\uDE9F-\uDEA8\uDEB0-\uDEDE\uDEF0-\uDEF9\uDF05-\uDF0C\uDF0F\uDF10\uDF13-\uDF28\uDF2A-\uDF30\uDF32\uDF33\uDF35-\uDF39\uDF3D\uDF50\uDF5D-\uDF61]|\uD805[\uDC00-\uDC34\uDC47-\uDC4A\uDC50-\uDC59\uDC5F-\uDC61\uDC80-\uDCAF\uDCC4\uDCC5\uDCC7\uDCD0-\uDCD9\uDD80-\uDDAE\uDDD8-\uDDDB\uDE00-\uDE2F\uDE44\uDE50-\uDE59\uDE80-\uDEAA\uDEB8\uDEC0-\uDEC9\uDF00-\uDF1A\uDF30-\uDF3B\uDF40-\uDF46]|\uD806[\uDC00-\uDC2B\uDCA0-\uDCF2\uDCFF-\uDD06\uDD09\uDD0C-\uDD13\uDD15\uDD16\uDD18-\uDD2F\uDD3F\uDD41\uDD50-\uDD59\uDDA0-\uDDA7\uDDAA-\uDDD0\uDDE1\uDDE3\uDE00\uDE0B-\uDE32\uDE3A\uDE50\uDE5C-\uDE89\uDE9D\uDEB0-\uDEF8]|\uD807[\uDC00-\uDC08\uDC0A-\uDC2E\uDC40\uDC50-\uDC6C\uDC72-\uDC8F\uDD00-\uDD06\uDD08\uDD09\uDD0B-\uDD30\uDD46\uDD50-\uDD59\uDD60-\uDD65\uDD67\uDD68\uDD6A-\uDD89\uDD98\uDDA0-\uDDA9\uDEE0-\uDEF2\uDFB0\uDFC0-\uDFD4]|\uD808[\uDC00-\uDF99]|\uD809[\uDC00-\uDC6E\uDC80-\uDD43]|\uD80B[\uDF90-\uDFF0]|[\uD80C\uD81C-\uD820\uD822\uD840-\uD868\uD86A-\uD86C\uD86F-\uD872\uD874-\uD879\uD880-\uD883][\uDC00-\uDFFF]|\uD80D[\uDC00-\uDC2E]|\uD811[\uDC00-\uDE46]|\uD81A[\uDC00-\uDE38\uDE40-\uDE5E\uDE60-\uDE69\uDE70-\uDEBE\uDEC0-\uDEC9\uDED0-\uDEED\uDF00-\uDF2F\uDF40-\uDF43\uDF50-\uDF59\uDF5B-\uDF61\uDF63-\uDF77\uDF7D-\uDF8F]|\uD81B[\uDE40-\uDE96\uDF00-\uDF4A\uDF50\uDF93-\uDF9F\uDFE0\uDFE1\uDFE3]|\uD821[\uDC00-\uDFF7]|\uD823[\uDC00-\uDCD5\uDD00-\uDD08]|\uD82B[\uDFF0-\uDFF3\uDFF5-\uDFFB\uDFFD\uDFFE]|\uD82C[\uDC00-\uDD22\uDD50-\uDD52\uDD64-\uDD67\uDD70-\uDEFB]|\uD82F[\uDC00-\uDC6A\uDC70-\uDC7C\uDC80-\uDC88\uDC90-\uDC99]|\uD834[\uDEE0-\uDEF3\uDF60-\uDF78]|\uD835[\uDC00-\uDC54\uDC56-\uDC9C\uDC9E\uDC9F\uDCA2\uDCA5\uDCA6\uDCA9-\uDCAC\uDCAE-\uDCB9\uDCBB\uDCBD-\uDCC3\uDCC5-\uDD05\uDD07-\uDD0A\uDD0D-\uDD14\uDD16-\uDD1C\uDD1E-\uDD39\uDD3B-\uDD3E\uDD40-\uDD44\uDD46\uDD4A-\uDD50\uDD52-\uDEA5\uDEA8-\uDEC0\uDEC2-\uDEDA\uDEDC-\uDEFA\uDEFC-\uDF14\uDF16-\uDF34\uDF36-\uDF4E\uDF50-\uDF6E\uDF70-\uDF88\uDF8A-\uDFA8\uDFAA-\uDFC2\uDFC4-\uDFCB\uDFCE-\uDFFF]|\uD837[\uDF00-\uDF1E]|\uD838[\uDD00-\uDD2C\uDD37-\uDD3D\uDD40-\uDD49\uDD4E\uDE90-\uDEAD\uDEC0-\uDEEB\uDEF0-\uDEF9]|\uD839[\uDFE0-\uDFE6\uDFE8-\uDFEB\uDFED\uDFEE\uDFF0-\uDFFE]|\uD83A[\uDC00-\uDCC4\uDCC7-\uDCCF\uDD00-\uDD43\uDD4B\uDD50-\uDD59]|\uD83B[\uDC71-\uDCAB\uDCAD-\uDCAF\uDCB1-\uDCB4\uDD01-\uDD2D\uDD2F-\uDD3D\uDE00-\uDE03\uDE05-\uDE1F\uDE21\uDE22\uDE24\uDE27\uDE29-\uDE32\uDE34-\uDE37\uDE39\uDE3B\uDE42\uDE47\uDE49\uDE4B\uDE4D-\uDE4F\uDE51\uDE52\uDE54\uDE57\uDE59\uDE5B\uDE5D\uDE5F\uDE61\uDE62\uDE64\uDE67-\uDE6A\uDE6C-\uDE72\uDE74-\uDE77\uDE79-\uDE7C\uDE7E\uDE80-\uDE89\uDE8B-\uDE9B\uDEA1-\uDEA3\uDEA5-\uDEA9\uDEAB-\uDEBB]|\uD83C[\uDD00-\uDD0C]|\uD83E[\uDFF0-\uDFF9]|\uD869[\uDC00-\uDEDF\uDF00-\uDFFF]|\uD86D[\uDC00-\uDF38\uDF40-\uDFFF]|\uD86E[\uDC00-\uDC1D\uDC20-\uDFFF]|\uD873[\uDC00-\uDEA1\uDEB0-\uDFFF]|\uD87A[\uDC00-\uDFE0]|\uD87E[\uDC00-\uDE1D]|\uD884[\uDC00-\uDF4A])/))){var r=n[1]||n[2]||"";if(!r||""===u||this.rules.inline.punctuation.exec(u)){var i=n[0].length-1,s=i,l=0,a="*"===n[0][0]?this.rules.inline.emStrong.rDelimAst:this.rules.inline.emStrong.rDelimUnd;for(a.lastIndex=0,t=t.slice(-1*e.length+i);null!=(n=a.exec(t));){var o,D=n[1]||n[2]||n[3]||n[4]||n[5]||n[6];if(D)if(o=D.length,n[3]||n[4])s+=o;else if((n[5]||n[6])&&i%3&&!((i+o)%3))l+=o;else if(!(0<(s-=o)))return o=Math.min(o,o+s+l),D=e.slice(0,i+n.index+(n[0].length-D.length)+o),Math.min(i,o)%2?(o=D.slice(1,-1),{type:"em",raw:D,text:o,tokens:this.lexer.inlineTokens(o)}):(o=D.slice(2,-2),{type:"strong",raw:D,text:o,tokens:this.lexer.inlineTokens(o)})}}}},t.codespan=function(e){var t,u,n,e=this.rules.inline.code.exec(e);if(e)return n=e[2].replace(/\n/g," "),t=/[^ ]/.test(n),u=/^ /.test(n)&&/ $/.test(n),n=c(n=t&&u?n.substring(1,n.length-1):n,!0),{type:"codespan",raw:e[0],text:n}},t.br=function(e){e=this.rules.inline.br.exec(e);if(e)return{type:"br",raw:e[0]}},t.del=function(e){e=this.rules.inline.del.exec(e);if(e)return{type:"del",raw:e[0],text:e[2],tokens:this.lexer.inlineTokens(e[2])}},t.autolink=function(e,t){var u,e=this.rules.inline.autolink.exec(e);if(e)return t="@"===e[2]?"mailto:"+(u=c(this.options.mangle?t(e[1]):e[1])):u=c(e[1]),{type:"link",raw:e[0],text:u,href:t,tokens:[{type:"text",raw:u,text:u}]}},t.url=function(e,t){var u,n,r,i;if(u=this.rules.inline.url.exec(e)){if("@"===u[2])r="mailto:"+(n=c(this.options.mangle?t(u[0]):u[0]));else{for(;i=u[0],u[0]=this.rules.inline._backpedal.exec(u[0])[0],i!==u[0];);n=c(u[0]),r="www."===u[1]?"http://"+u[0]:u[0]}return{type:"link",raw:u[0],text:n,href:r,tokens:[{type:"text",raw:n,text:n}]}}},t.inlineText=function(e,t){e=this.rules.inline.text.exec(e);if(e)return t=this.lexer.state.inRawBlock?this.options.sanitize?this.options.sanitizer?this.options.sanitizer(e[0]):c(e[0]):e[0]:c(this.options.smartypants?t(e[0]):e[0]),{type:"text",raw:e[0],text:t}},e}(),y={newline:/^(?: *(?:\n|$))+/,code:/^( {4}[^\n]+(?:\n(?: *(?:\n|$))*)?)+/,fences:/^ {0,3}(`{3,}(?=[^`\n]*\n)|~{3,})([^\n]*)\n(?:|([\s\S]*?)\n)(?: {0,3}\1[~`]* *(?=\n|$)|$)/,hr:/^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/,heading:/^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/,blockquote:/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/,list:/^( {0,3}bull)([ \t][^\n]+?)?(?:\n|$)/,html:"^ {0,3}(?:<(script|pre|style|textarea)[\\s>][\\s\\S]*?(?:</\\1>[^\\n]*\\n+|$)|comment[^\\n]*(\\n+|$)|<\\?[\\s\\S]*?(?:\\?>\\n*|$)|<![A-Z][\\s\\S]*?(?:>\\n*|$)|<!\\[CDATA\\[[\\s\\S]*?(?:\\]\\]>\\n*|$)|</?(tag)(?: +|\\n|/?>)[\\s\\S]*?(?:(?:\\n *)+\\n|$)|<(?!script|pre|style|textarea)([a-z][\\w-]*)(?:attribute)*? */?>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n *)+\\n|$)|</(?!script|pre|style|textarea)[a-z][\\w-]*\\s*>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n *)+\\n|$))",def:/^ {0,3}\[(label)\]: *(?:\n *)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n *)?| *\n *)(title))? *(?:\n+|$)/,table:d,lheading:/^((?:.|\n(?!\n))+?)\n {0,3}(=+|-+) *(?:\n+|$)/,_paragraph:/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table| +\n)[^\n]+)*)/,text:/^[^\n]+/,_label:/(?!\s*\])(?:\\.|[^\[\]\\])+/,_title:/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/},v=(y.def=f(y.def).replace("label",y._label).replace("title",y._title).getRegex(),y.bullet=/(?:[*+-]|\d{1,9}[.)])/,y.listItemStart=f(/^( *)(bull) */).replace("bull",y.bullet).getRegex(),y.list=f(y.list).replace(/bull/g,y.bullet).replace("hr","\\n+(?=\\1?(?:(?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$))").replace("def","\\n+(?="+y.def.source+")").getRegex(),y._tag="address|article|aside|base|basefont|blockquote|body|caption|center|col|colgroup|dd|details|dialog|dir|div|dl|dt|fieldset|figcaption|figure|footer|form|frame|frameset|h[1-6]|head|header|hr|html|iframe|legend|li|link|main|menu|menuitem|meta|nav|noframes|ol|optgroup|option|p|param|section|source|summary|table|tbody|td|tfoot|th|thead|title|tr|track|ul",y._comment=/<!--(?!-?>)[\s\S]*?(?:-->|$)/,y.html=f(y.html,"i").replace("comment",y._comment).replace("tag",y._tag).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),y.paragraph=f(y._paragraph).replace("hr",y.hr).replace("heading"," {0,3}#{1,6} ").replace("|lheading","").replace("|table","").replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",y._tag).getRegex(),y.blockquote=f(y.blockquote).replace("paragraph",y.paragraph).getRegex(),y.normal=C({},y),y.gfm=C({},y.normal,{table:"^ *([^\\n ].*\\|.*)\\n {0,3}(?:\\| *)?(:?-+:? *(?:\\| *:?-+:? *)*)(?:\\| *)?(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)"}),y.gfm.table=f(y.gfm.table).replace("hr",y.hr).replace("heading"," {0,3}#{1,6} ").replace("blockquote"," {0,3}>").replace("code"," {4}[^\\n]").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",y._tag).getRegex(),y.gfm.paragraph=f(y._paragraph).replace("hr",y.hr).replace("heading"," {0,3}#{1,6} ").replace("|lheading","").replace("table",y.gfm.table).replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",y._tag).getRegex(),y.pedantic=C({},y.normal,{html:f("^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:\"[^\"]*\"|'[^']*'|\\s[^'\"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))").replace("comment",y._comment).replace(/tag/g,"(?!(?:a|em|strong|small|s|cite|q|dfn|abbr|data|time|code|var|samp|kbd|sub|sup|i|b|u|mark|ruby|rt|rp|bdi|bdo|span|br|wbr|ins|del|img)\\b)\\w+(?!:|[^\\w\\s@]*@)\\b").getRegex(),def:/^ *\[([^\]]+)\]: *<?([^\s>]+)>?(?: +(["(][^\n]+[")]))? *(?:\n+|$)/,heading:/^(#{1,6})(.*)(?:\n+|$)/,fences:d,lheading:/^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,paragraph:f(y.normal._paragraph).replace("hr",y.hr).replace("heading"," *#{1,6} *[^\n]").replace("lheading",y.lheading).replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").getRegex()}),{escape:/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,autolink:/^<(scheme:[^\s\x00-\x1f<>]*|email)>/,url:d,tag:"^comment|^</[a-zA-Z][\\w:-]*\\s*>|^<[a-zA-Z][\\w-]*(?:attribute)*?\\s*/?>|^<\\?[\\s\\S]*?\\?>|^<![a-zA-Z]+\\s[\\s\\S]*?>|^<!\\[CDATA\\[[\\s\\S]*?\\]\\]>",link:/^!?\[(label)\]\(\s*(href)(?:\s+(title))?\s*\)/,reflink:/^!?\[(label)\]\[(ref)\]/,nolink:/^!?\[(ref)\](?:\[\])?/,reflinkSearch:"reflink|nolink(?!\\()",emStrong:{lDelim:/^(?:\*+(?:([punct_])|[^\s*]))|^_+(?:([punct*])|([^\s_]))/,rDelimAst:/^(?:[^_*\\]|\\.)*?\_\_(?:[^_*\\]|\\.)*?\*(?:[^_*\\]|\\.)*?(?=\_\_)|(?:[^*\\]|\\.)+(?=[^*])|[punct_](\*+)(?=[\s]|$)|(?:[^punct*_\s\\]|\\.)(\*+)(?=[punct_\s]|$)|[punct_\s](\*+)(?=[^punct*_\s])|[\s](\*+)(?=[punct_])|[punct_](\*+)(?=[punct_])|(?:[^punct*_\s\\]|\\.)(\*+)(?=[^punct*_\s])/,rDelimUnd:/^(?:[^_*\\]|\\.)*?\*\*(?:[^_*\\]|\\.)*?\_(?:[^_*\\]|\\.)*?(?=\*\*)|(?:[^_\\]|\\.)+(?=[^_])|[punct*](\_+)(?=[\s]|$)|(?:[^punct*_\s\\]|\\.)(\_+)(?=[punct*\s]|$)|[punct*\s](\_+)(?=[^punct*_\s])|[\s](\_+)(?=[punct*])|[punct*](\_+)(?=[punct*])/},code:/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,br:/^( {2,}|\\)\n(?!\s*$)/,del:d,text:/^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/,punctuation:/^([\spunctuation])/});function L(e){return e.replace(/---/g,"—").replace(/--/g,"–").replace(/(^|[-\u2014/(\[{"\s])'/g,"$1‘").replace(/'/g,"’").replace(/(^|[-\u2014/(\[{\u2018\s])"/g,"$1“").replace(/"/g,"”").replace(/\.{3}/g,"…")}function _(e){for(var t,u="",n=e.length,r=0;r<n;r++)t=e.charCodeAt(r),u+="&#"+(t=.5<Math.random()?"x"+t.toString(16):t)+";";return u}v._punctuation="!\"#$%&'()+\\-.,/:;<=>?@\\[\\]`^{|}~",v.punctuation=f(v.punctuation).replace(/punctuation/g,v._punctuation).getRegex(),v.blockSkip=/\[[^\]]*?\]\([^\)]*?\)|`[^`]*?`|<[^>]*?>/g,v.escapedEmSt=/(?:^|[^\\])(?:\\\\)*\\[*_]/g,v._comment=f(y._comment).replace("(?:--\x3e|$)","--\x3e").getRegex(),v.emStrong.lDelim=f(v.emStrong.lDelim).replace(/punct/g,v._punctuation).getRegex(),v.emStrong.rDelimAst=f(v.emStrong.rDelimAst,"g").replace(/punct/g,v._punctuation).getRegex(),v.emStrong.rDelimUnd=f(v.emStrong.rDelimUnd,"g").replace(/punct/g,v._punctuation).getRegex(),v._escapes=/\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/g,v._scheme=/[a-zA-Z][a-zA-Z0-9+.-]{1,31}/,v._email=/[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+(@)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)+(?![-_])/,v.autolink=f(v.autolink).replace("scheme",v._scheme).replace("email",v._email).getRegex(),v._attribute=/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/,v.tag=f(v.tag).replace("comment",v._comment).replace("attribute",v._attribute).getRegex(),v._label=/(?:\[(?:\\.|[^\[\]\\])*\]|\\.|`[^`]*`|[^\[\]\\`])*?/,v._href=/<(?:\\.|[^\n<>\\])+>|[^\s\x00-\x1f]*/,v._title=/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/,v.link=f(v.link).replace("label",v._label).replace("href",v._href).replace("title",v._title).getRegex(),v.reflink=f(v.reflink).replace("label",v._label).replace("ref",y._label).getRegex(),v.nolink=f(v.nolink).replace("ref",y._label).getRegex(),v.reflinkSearch=f(v.reflinkSearch,"g").replace("reflink",v.reflink).replace("nolink",v.nolink).getRegex(),v.normal=C({},v),v.pedantic=C({},v.normal,{strong:{start:/^__|\*\*/,middle:/^__(?=\S)([\s\S]*?\S)__(?!_)|^\*\*(?=\S)([\s\S]*?\S)\*\*(?!\*)/,endAst:/\*\*(?!\*)/g,endUnd:/__(?!_)/g},em:{start:/^_|\*/,middle:/^()\*(?=\S)([\s\S]*?\S)\*(?!\*)|^_(?=\S)([\s\S]*?\S)_(?!_)/,endAst:/\*(?!\*)/g,endUnd:/_(?!_)/g},link:f(/^!?\[(label)\]\((.*?)\)/).replace("label",v._label).getRegex(),reflink:f(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label",v._label).getRegex()}),v.gfm=C({},v.normal,{escape:f(v.escape).replace("])","~|])").getRegex(),_extended_email:/[A-Za-z0-9._+-]+(@)[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![-_])/,url:/^((?:ftp|https?):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/,_backpedal:/(?:[^?!.,:;*_'"~()&]+|\([^)]*\)|&(?![a-zA-Z0-9]+;$)|[?!.,:;*_'"~)]+(?!$))+/,del:/^(~~?)(?=[^\s~])([\s\S]*?[^\s~])\1(?=[^~]|$)/,text:/^([`~]+|[^`~])(?:(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\<!\[`*~_]|\b_|https?:\/\/|ftp:\/\/|www\.|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)))/}),v.gfm.url=f(v.gfm.url,"i").replace("email",v.gfm._extended_email).getRegex(),v.breaks=C({},v.gfm,{br:f(v.br).replace("{2,}","*").getRegex(),text:f(v.gfm.text).replace("\\b_","\\b_| {2,}\\n").replace(/\{2,\}/g,"*").getRegex()});var z=function(){function u(e){this.tokens=[],this.tokens.links=Object.create(null),this.options=e||r.defaults,this.options.tokenizer=this.options.tokenizer||new w,this.tokenizer=this.options.tokenizer,this.tokenizer.options=this.options,(this.tokenizer.lexer=this).inlineQueue=[],this.state={inLink:!1,inRawBlock:!1,top:!0};e={block:y.normal,inline:v.normal};this.options.pedantic?(e.block=y.pedantic,e.inline=v.pedantic):this.options.gfm&&(e.block=y.gfm,this.options.breaks?e.inline=v.breaks:e.inline=v.gfm),this.tokenizer.rules=e}u.lex=function(e,t){return new u(t).lex(e)},u.lexInline=function(e,t){return new u(t).inlineTokens(e)};var e,t,n=u.prototype;return n.lex=function(e){var t;for(e=e.replace(/\r\n|\r/g,"\n"),this.blockTokens(e,this.tokens);t=this.inlineQueue.shift();)this.inlineTokens(t.src,t.tokens);return this.tokens},n.blockTokens=function(r,t){var u,e,i,n,s=this;for(void 0===t&&(t=[]),r=this.options.pedantic?r.replace(/\t/g," ").replace(/^ +$/gm,""):r.replace(/^( *)(\t+)/gm,function(e,t,u){return t+" ".repeat(u.length)});r;)if(!(this.options.extensions&&this.options.extensions.block&&this.options.extensions.block.some(function(e){return!!(u=e.call({lexer:s},r,t))&&(r=r.substring(u.raw.length),t.push(u),!0)})))if(u=this.tokenizer.space(r))r=r.substring(u.raw.length),1===u.raw.length&&0<t.length?t[t.length-1].raw+="\n":t.push(u);else if(u=this.tokenizer.code(r))r=r.substring(u.raw.length),!(e=t[t.length-1])||"paragraph"!==e.type&&"text"!==e.type?t.push(u):(e.raw+="\n"+u.raw,e.text+="\n"+u.text,this.inlineQueue[this.inlineQueue.length-1].src=e.text);else if(u=this.tokenizer.fences(r))r=r.substring(u.raw.length),t.push(u);else if(u=this.tokenizer.heading(r))r=r.substring(u.raw.length),t.push(u);else if(u=this.tokenizer.hr(r))r=r.substring(u.raw.length),t.push(u);else if(u=this.tokenizer.blockquote(r))r=r.substring(u.raw.length),t.push(u);else if(u=this.tokenizer.list(r))r=r.substring(u.raw.length),t.push(u);else if(u=this.tokenizer.html(r))r=r.substring(u.raw.length),t.push(u);else if(u=this.tokenizer.def(r))r=r.substring(u.raw.length),!(e=t[t.length-1])||"paragraph"!==e.type&&"text"!==e.type?this.tokens.links[u.tag]||(this.tokens.links[u.tag]={href:u.href,title:u.title}):(e.raw+="\n"+u.raw,e.text+="\n"+u.raw,this.inlineQueue[this.inlineQueue.length-1].src=e.text);else if(u=this.tokenizer.table(r))r=r.substring(u.raw.length),t.push(u);else if(u=this.tokenizer.lheading(r))r=r.substring(u.raw.length),t.push(u);else if(i=r,this.options.extensions&&this.options.extensions.startBlock&&!function(){var t=1/0,u=r.slice(1),n=void 0;s.options.extensions.startBlock.forEach(function(e){"number"==typeof(n=e.call({lexer:this},u))&&0<=n&&(t=Math.min(t,n))}),t<1/0&&0<=t&&(i=r.substring(0,t+1))}(),this.state.top&&(u=this.tokenizer.paragraph(i)))e=t[t.length-1],n&&"paragraph"===e.type?(e.raw+="\n"+u.raw,e.text+="\n"+u.text,this.inlineQueue.pop(),this.inlineQueue[this.inlineQueue.length-1].src=e.text):t.push(u),n=i.length!==r.length,r=r.substring(u.raw.length);else if(u=this.tokenizer.text(r))r=r.substring(u.raw.length),(e=t[t.length-1])&&"text"===e.type?(e.raw+="\n"+u.raw,e.text+="\n"+u.text,this.inlineQueue.pop(),this.inlineQueue[this.inlineQueue.length-1].src=e.text):t.push(u);else if(r){var l="Infinite loop on byte: "+r.charCodeAt(0);if(this.options.silent){console.error(l);break}throw new Error(l)}return this.state.top=!0,t},n.inline=function(e,t){return this.inlineQueue.push({src:e,tokens:t=void 0===t?[]:t}),t},n.inlineTokens=function(r,t){var u,e,i,n,s,l,a=this,o=(void 0===t&&(t=[]),r);if(this.tokens.links){var D=Object.keys(this.tokens.links);if(0<D.length)for(;null!=(n=this.tokenizer.rules.inline.reflinkSearch.exec(o));)D.includes(n[0].slice(n[0].lastIndexOf("[")+1,-1))&&(o=o.slice(0,n.index)+"["+b("a",n[0].length-2)+"]"+o.slice(this.tokenizer.rules.inline.reflinkSearch.lastIndex))}for(;null!=(n=this.tokenizer.rules.inline.blockSkip.exec(o));)o=o.slice(0,n.index)+"["+b("a",n[0].length-2)+"]"+o.slice(this.tokenizer.rules.inline.blockSkip.lastIndex);for(;null!=(n=this.tokenizer.rules.inline.escapedEmSt.exec(o));)o=o.slice(0,n.index+n[0].length-2)+"++"+o.slice(this.tokenizer.rules.inline.escapedEmSt.lastIndex),this.tokenizer.rules.inline.escapedEmSt.lastIndex--;for(;r;)if(s||(l=""),s=!1,!(this.options.extensions&&this.options.extensions.inline&&this.options.extensions.inline.some(function(e){return!!(u=e.call({lexer:a},r,t))&&(r=r.substring(u.raw.length),t.push(u),!0)})))if(u=this.tokenizer.escape(r))r=r.substring(u.raw.length),t.push(u);else if(u=this.tokenizer.tag(r))r=r.substring(u.raw.length),(e=t[t.length-1])&&"text"===u.type&&"text"===e.type?(e.raw+=u.raw,e.text+=u.text):t.push(u);else if(u=this.tokenizer.link(r))r=r.substring(u.raw.length),t.push(u);else if(u=this.tokenizer.reflink(r,this.tokens.links))r=r.substring(u.raw.length),(e=t[t.length-1])&&"text"===u.type&&"text"===e.type?(e.raw+=u.raw,e.text+=u.text):t.push(u);else if(u=this.tokenizer.emStrong(r,o,l))r=r.substring(u.raw.length),t.push(u);else if(u=this.tokenizer.codespan(r))r=r.substring(u.raw.length),t.push(u);else if(u=this.tokenizer.br(r))r=r.substring(u.raw.length),t.push(u);else if(u=this.tokenizer.del(r))r=r.substring(u.raw.length),t.push(u);else if(u=this.tokenizer.autolink(r,_))r=r.substring(u.raw.length),t.push(u);else if(!this.state.inLink&&(u=this.tokenizer.url(r,_)))r=r.substring(u.raw.length),t.push(u);else if(i=r,this.options.extensions&&this.options.extensions.startInline&&!function(){var t=1/0,u=r.slice(1),n=void 0;a.options.extensions.startInline.forEach(function(e){"number"==typeof(n=e.call({lexer:this},u))&&0<=n&&(t=Math.min(t,n))}),t<1/0&&0<=t&&(i=r.substring(0,t+1))}(),u=this.tokenizer.inlineText(i,L))r=r.substring(u.raw.length),"_"!==u.raw.slice(-1)&&(l=u.raw.slice(-1)),s=!0,(e=t[t.length-1])&&"text"===e.type?(e.raw+=u.raw,e.text+=u.text):t.push(u);else if(r){var c="Infinite loop on byte: "+r.charCodeAt(0);if(this.options.silent){console.error(c);break}throw new Error(c)}return t},n=u,t=[{key:"rules",get:function(){return{block:y,inline:v}}}],(e=null)&&i(n.prototype,e),t&&i(n,t),Object.defineProperty(n,"prototype",{writable:!1}),u}(),$=function(){function e(e){this.options=e||r.defaults}var t=e.prototype;return t.code=function(e,t,u){var n,t=(t||"").match(/\S*/)[0];return this.options.highlight&&null!=(n=this.options.highlight(e,t))&&n!==e&&(u=!0,e=n),e=e.replace(/\n$/,"")+"\n",t?'<pre><code class="'+this.options.langPrefix+c(t)+'">'+(u?e:c(e,!0))+"</code></pre>\n":"<pre><code>"+(u?e:c(e,!0))+"</code></pre>\n"},t.blockquote=function(e){return"<blockquote>\n"+e+"</blockquote>\n"},t.html=function(e){return e},t.heading=function(e,t,u,n){return this.options.headerIds?"<h"+t+' id="'+(this.options.headerPrefix+n.slug(u))+'">'+e+"</h"+t+">\n":"<h"+t+">"+e+"</h"+t+">\n"},t.hr=function(){return this.options.xhtml?"<hr/>\n":"<hr>\n"},t.list=function(e,t,u){var n=t?"ol":"ul";return"<"+n+(t&&1!==u?' start="'+u+'"':"")+">\n"+e+"</"+n+">\n"},t.listitem=function(e){return"<li>"+e+"</li>\n"},t.checkbox=function(e){return"<input "+(e?'checked="" ':"")+'disabled="" type="checkbox"'+(this.options.xhtml?" /":"")+"> "},t.paragraph=function(e){return"<p>"+e+"</p>\n"},t.table=function(e,t){return"<table>\n<thead>\n"+e+"</thead>\n"+(t=t&&"<tbody>"+t+"</tbody>")+"</table>\n"},t.tablerow=function(e){return"<tr>\n"+e+"</tr>\n"},t.tablecell=function(e,t){var u=t.header?"th":"td";return(t.align?"<"+u+' align="'+t.align+'">':"<"+u+">")+e+"</"+u+">\n"},t.strong=function(e){return"<strong>"+e+"</strong>"},t.em=function(e){return"<em>"+e+"</em>"},t.codespan=function(e){return"<code>"+e+"</code>"},t.br=function(){return this.options.xhtml?"<br/>":"<br>"},t.del=function(e){return"<del>"+e+"</del>"},t.link=function(e,t,u){return null===(e=F(this.options.sanitize,this.options.baseUrl,e))?u:(e='<a href="'+e+'"',t&&(e+=' title="'+t+'"'),e+">"+u+"</a>")},t.image=function(e,t,u){return null===(e=F(this.options.sanitize,this.options.baseUrl,e))?u:(e='<img src="'+e+'" alt="'+u+'"',t&&(e+=' title="'+t+'"'),e+(this.options.xhtml?"/>":">"))},t.text=function(e){return e},e}(),S=function(){function e(){}var t=e.prototype;return t.strong=function(e){return e},t.em=function(e){return e},t.codespan=function(e){return e},t.del=function(e){return e},t.html=function(e){return e},t.text=function(e){return e},t.link=function(e,t,u){return""+u},t.image=function(e,t,u){return""+u},t.br=function(){return""},e}(),T=function(){function e(){this.seen={}}var t=e.prototype;return t.serialize=function(e){return e.toLowerCase().trim().replace(/<[!\/a-z].*?>/gi,"").replace(/[\u2000-\u206F\u2E00-\u2E7F\\'!"#$%&()*+,./:;<=>?@[\]^`{|}~]/g,"").replace(/\s/g,"-")},t.getNextSafeSlug=function(e,t){var u=e,n=0;if(this.seen.hasOwnProperty(u))for(n=this.seen[e];u=e+"-"+ ++n,this.seen.hasOwnProperty(u););return t||(this.seen[e]=n,this.seen[u]=0),u},t.slug=function(e,t){void 0===t&&(t={});e=this.serialize(e);return this.getNextSafeSlug(e,t.dryrun)},e}(),R=function(){function u(e){this.options=e||r.defaults,this.options.renderer=this.options.renderer||new $,this.renderer=this.options.renderer,this.renderer.options=this.options,this.textRenderer=new S,this.slugger=new T}u.parse=function(e,t){return new u(t).parse(e)},u.parseInline=function(e,t){return new u(t).parseInline(e)};var e=u.prototype;return e.parse=function(e,t){void 0===t&&(t=!0);for(var u,n,r,i,s,l,a,o,D,c,h,p,f,g,F,A,d="",C=e.length,k=0;k<C;k++)if(o=e[k],this.options.extensions&&this.options.extensions.renderers&&this.options.extensions.renderers[o.type]&&(!1!==(A=this.options.extensions.renderers[o.type].call({parser:this},o))||!["space","hr","heading","code","table","blockquote","list","html","paragraph","text"].includes(o.type)))d+=A||"";else switch(o.type){case"space":continue;case"hr":d+=this.renderer.hr();continue;case"heading":d+=this.renderer.heading(this.parseInline(o.tokens),o.depth,x(this.parseInline(o.tokens,this.textRenderer)),this.slugger);continue;case"code":d+=this.renderer.code(o.text,o.lang,o.escaped);continue;case"table":for(l=D="",r=o.header.length,u=0;u<r;u++)l+=this.renderer.tablecell(this.parseInline(o.header[u].tokens),{header:!0,align:o.align[u]});for(D+=this.renderer.tablerow(l),a="",r=o.rows.length,u=0;u<r;u++){for(l="",i=(s=o.rows[u]).length,n=0;n<i;n++)l+=this.renderer.tablecell(this.parseInline(s[n].tokens),{header:!1,align:o.align[n]});a+=this.renderer.tablerow(l)}d+=this.renderer.table(D,a);continue;case"blockquote":a=this.parse(o.tokens),d+=this.renderer.blockquote(a);continue;case"list":for(D=o.ordered,E=o.start,c=o.loose,r=o.items.length,a="",u=0;u<r;u++)f=(p=o.items[u]).checked,g=p.task,h="",p.task&&(F=this.renderer.checkbox(f),c?0<p.tokens.length&&"paragraph"===p.tokens[0].type?(p.tokens[0].text=F+" "+p.tokens[0].text,p.tokens[0].tokens&&0<p.tokens[0].tokens.length&&"text"===p.tokens[0].tokens[0].type&&(p.tokens[0].tokens[0].text=F+" "+p.tokens[0].tokens[0].text)):p.tokens.unshift({type:"text",text:F}):h+=F),h+=this.parse(p.tokens,c),a+=this.renderer.listitem(h,g,f);d+=this.renderer.list(a,D,E);continue;case"html":d+=this.renderer.html(o.text);continue;case"paragraph":d+=this.renderer.paragraph(this.parseInline(o.tokens));continue;case"text":for(a=o.tokens?this.parseInline(o.tokens):o.text;k+1<C&&"text"===e[k+1].type;)a+="\n"+((o=e[++k]).tokens?this.parseInline(o.tokens):o.text);d+=t?this.renderer.paragraph(a):a;continue;default:var E='Token with "'+o.type+'" type was not found.';if(this.options.silent)return void console.error(E);throw new Error(E)}return d},e.parseInline=function(e,t){t=t||this.renderer;for(var u,n,r="",i=e.length,s=0;s<i;s++)if(u=e[s],this.options.extensions&&this.options.extensions.renderers&&this.options.extensions.renderers[u.type]&&(!1!==(n=this.options.extensions.renderers[u.type].call({parser:this},u))||!["escape","html","link","image","strong","em","codespan","br","del","text"].includes(u.type)))r+=n||"";else switch(u.type){case"escape":r+=t.text(u.text);break;case"html":r+=t.html(u.text);break;case"link":r+=t.link(u.href,u.title,this.parseInline(u.tokens,t));break;case"image":r+=t.image(u.href,u.title,u.text);break;case"strong":r+=t.strong(this.parseInline(u.tokens,t));break;case"em":r+=t.em(this.parseInline(u.tokens,t));break;case"codespan":r+=t.codespan(u.text);break;case"br":r+=t.br();break;case"del":r+=t.del(this.parseInline(u.tokens,t));break;case"text":r+=t.text(u.text);break;default:var l='Token with "'+u.type+'" type was not found.';if(this.options.silent)return void console.error(l);throw new Error(l)}return r},u}();function I(e,u,n){if(null==e)throw new Error("marked(): input parameter is undefined or null");if("string"!=typeof e)throw new Error("marked(): input parameter is of type "+Object.prototype.toString.call(e)+", string expected");if("function"==typeof u&&(n=u,u=null),m(u=C({},I.defaults,u||{})),n){var r,i=u.highlight;try{r=z.lex(e,u)}catch(e){return n(e)}var s,l=function(t){var e;if(!t)try{u.walkTokens&&I.walkTokens(r,u.walkTokens),e=R.parse(r,u)}catch(e){t=e}return u.highlight=i,t?n(t):n(null,e)};return!i||i.length<3?l():(delete u.highlight,r.length?(s=0,I.walkTokens(r,function(u){"code"===u.type&&(s++,setTimeout(function(){i(u.text,u.lang,function(e,t){if(e)return l(e);null!=t&&t!==u.text&&(u.text=t,u.escaped=!0),0===--s&&l()})},0))}),void(0===s&&l())):l())}function t(e){if(e.message+="\nPlease report this to https://github.com/markedjs/marked.",u.silent)return"<p>An error occurred:</p><pre>"+c(e.message+"",!0)+"</pre>";throw e}try{var a=z.lex(e,u);if(u.walkTokens){if(u.async)return Promise.all(I.walkTokens(a,u.walkTokens)).then(function(){return R.parse(a,u)}).catch(t);I.walkTokens(a,u.walkTokens)}return R.parse(a,u)}catch(e){t(e)}}I.options=I.setOptions=function(e){return C(I.defaults,e),e=I.defaults,r.defaults=e,I},I.getDefaults=e,I.defaults=r.defaults,I.use=function(){for(var o=I.defaults.extensions||{renderers:{},childTokens:{}},e=arguments.length,t=new Array(e),u=0;u<e;u++)t[u]=arguments[u];t.forEach(function(s){var u,e=C({},s);if(e.async=I.defaults.async||e.async,s.extensions&&(s.extensions.forEach(function(r){if(!r.name)throw new Error("extension name required");var i;if(r.renderer&&(i=o.renderers[r.name],o.renderers[r.name]=i?function(){for(var e=arguments.length,t=new Array(e),u=0;u<e;u++)t[u]=arguments[u];var n=r.renderer.apply(this,t);return n=!1===n?i.apply(this,t):n}:r.renderer),r.tokenizer){if(!r.level||"block"!==r.level&&"inline"!==r.level)throw new Error("extension level must be 'block' or 'inline'");o[r.level]?o[r.level].unshift(r.tokenizer):o[r.level]=[r.tokenizer],r.start&&("block"===r.level?o.startBlock?o.startBlock.push(r.start):o.startBlock=[r.start]:"inline"===r.level&&(o.startInline?o.startInline.push(r.start):o.startInline=[r.start]))}r.childTokens&&(o.childTokens[r.name]=r.childTokens)}),e.extensions=o),s.renderer){var t,l=I.defaults.renderer||new $;for(t in s.renderer)!function(r){var i=l[r];l[r]=function(){for(var e=arguments.length,t=new Array(e),u=0;u<e;u++)t[u]=arguments[u];var n=s.renderer[r].apply(l,t);return n=!1===n?i.apply(l,t):n}}(t);e.renderer=l}if(s.tokenizer){var n,a=I.defaults.tokenizer||new w;for(n in s.tokenizer)!function(r){var i=a[r];a[r]=function(){for(var e=arguments.length,t=new Array(e),u=0;u<e;u++)t[u]=arguments[u];var n=s.tokenizer[r].apply(a,t);return n=!1===n?i.apply(a,t):n}}(n);e.tokenizer=a}s.walkTokens&&(u=I.defaults.walkTokens,e.walkTokens=function(e){var t=[];return t.push(s.walkTokens.call(this,e)),t=u?t.concat(u.call(this,e)):t}),I.setOptions(e)})},I.walkTokens=function(e,l){for(var a,o=[],t=D(e);!(a=t()).done;)!function(){var t=a.value;switch(o=o.concat(l.call(I,t)),t.type){case"table":for(var e=D(t.header);!(u=e()).done;){var u=u.value;o=o.concat(I.walkTokens(u.tokens,l))}for(var n,r=D(t.rows);!(n=r()).done;)for(var i=D(n.value);!(s=i()).done;){var s=s.value;o=o.concat(I.walkTokens(s.tokens,l))}break;case"list":o=o.concat(I.walkTokens(t.items,l));break;default:I.defaults.extensions&&I.defaults.extensions.childTokens&&I.defaults.extensions.childTokens[t.type]?I.defaults.extensions.childTokens[t.type].forEach(function(e){o=o.concat(I.walkTokens(t[e],l))}):t.tokens&&(o=o.concat(I.walkTokens(t.tokens,l)))}}();return o},I.parseInline=function(e,t){if(null==e)throw new Error("marked.parseInline(): input parameter is undefined or null");if("string"!=typeof e)throw new Error("marked.parseInline(): input parameter is of type "+Object.prototype.toString.call(e)+", string expected");m(t=C({},I.defaults,t||{}));try{var u=z.lexInline(e,t);return t.walkTokens&&I.walkTokens(u,t.walkTokens),R.parseInline(u,t)}catch(e){if(e.message+="\nPlease report this to https://github.com/markedjs/marked.",t.silent)return"<p>An error occurred:</p><pre>"+c(e.message+"",!0)+"</pre>";throw e}},I.Parser=R,I.parser=R.parse,I.Renderer=$,I.TextRenderer=S,I.Lexer=z,I.lexer=z.lex,I.Tokenizer=w,I.Slugger=T;var d=(I.parse=I).options,P=I.setOptions,Q=I.use,U=I.walkTokens,M=I.parseInline,N=I,X=R.parse,G=z.lex;r.Lexer=z,r.Parser=R,r.Renderer=$,r.Slugger=T,r.TextRenderer=S,r.Tokenizer=w,r.getDefaults=e,r.lexer=G,r.marked=I,r.options=d,r.parse=N,r.parseInline=M,r.parser=X,r.setOptions=P,r.use=Q,r.walkTokens=U});</script>
<!-- <script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/purify.min.js"></script> -->
<script>!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):(e="undefined"!=typeof globalThis?globalThis:e||self).DOMPurify=t()}(this,(function(){"use strict";function e(t){return e="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},e(t)}function t(e,n){return t=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},t(e,n)}function n(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}function r(e,o,a){return r=n()?Reflect.construct:function(e,n,r){var o=[null];o.push.apply(o,n);var a=new(Function.bind.apply(e,o));return r&&t(a,r.prototype),a},r.apply(null,arguments)}function o(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null==n)return;var r,o,a=[],i=!0,l=!1;try{for(n=n.call(e);!(i=(r=n.next()).done)&&(a.push(r.value),!t||a.length!==t);i=!0);}catch(e){l=!0,o=e}finally{try{i||null==n.return||n.return()}finally{if(l)throw o}}return a}(e,t)||i(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function a(e){return function(e){if(Array.isArray(e))return l(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||i(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function i(e,t){if(e){if("string"==typeof e)return l(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?l(e,t):void 0}}function l(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}var c=Object.entries,u=Object.setPrototypeOf,s=Object.isFrozen,f=Object.getPrototypeOf,m=Object.getOwnPropertyDescriptor,p=Object.freeze,d=Object.seal,h=Object.create,y="undefined"!=typeof Reflect&&Reflect,g=y.apply,b=y.construct;g||(g=function(e,t,n){return e.apply(t,n)}),p||(p=function(e){return e}),d||(d=function(e){return e}),b||(b=function(e,t){return r(e,a(t))});var v,T=R(Array.prototype.forEach),N=R(Array.prototype.pop),A=R(Array.prototype.push),E=R(String.prototype.toLowerCase),w=R(String.prototype.toString),S=R(String.prototype.match),_=R(String.prototype.replace),x=R(String.prototype.indexOf),k=R(String.prototype.trim),O=R(RegExp.prototype.test),D=(v=TypeError,function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return b(v,t)});function R(e){return function(t){for(var n=arguments.length,r=new Array(n>1?n-1:0),o=1;o<n;o++)r[o-1]=arguments[o];return g(e,t,r)}}function C(e,t,n){n=n||E,u&&u(e,null);for(var r=t.length;r--;){var o=t[r];if("string"==typeof o){var a=n(o);a!==o&&(s(t)||(t[r]=a),o=a)}e[o]=!0}return e}function L(e){var t,n=h(null),r=function(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!n){if(Array.isArray(e)||(n=i(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var r=0,o=function(){};return{s:o,n:function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}},e:function(e){throw e},f:o}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var a,l=!0,c=!1;return{s:function(){n=n.call(e)},n:function(){var e=n.next();return l=e.done,e},e:function(e){c=!0,a=e},f:function(){try{l||null==n.return||n.return()}finally{if(c)throw a}}}}(c(e));try{for(r.s();!(t=r.n()).done;){var a=o(t.value,2),l=a[0],u=a[1];n[l]=u}}catch(e){r.e(e)}finally{r.f()}return n}function M(e,t){for(;null!==e;){var n=m(e,t);if(n){if(n.get)return R(n.get);if("function"==typeof n.value)return R(n.value)}e=f(e)}return function(e){return console.warn("fallback value for",e),null}}var I=p(["a","abbr","acronym","address","area","article","aside","audio","b","bdi","bdo","big","blink","blockquote","body","br","button","canvas","caption","center","cite","code","col","colgroup","content","data","datalist","dd","decorator","del","details","dfn","dialog","dir","div","dl","dt","element","em","fieldset","figcaption","figure","font","footer","form","h1","h2","h3","h4","h5","h6","head","header","hgroup","hr","html","i","img","input","ins","kbd","label","legend","li","main","map","mark","marquee","menu","menuitem","meter","nav","nobr","ol","optgroup","option","output","p","picture","pre","progress","q","rp","rt","ruby","s","samp","section","select","shadow","small","source","spacer","span","strike","strong","style","sub","summary","sup","table","tbody","td","template","textarea","tfoot","th","thead","time","tr","track","tt","u","ul","var","video","wbr"]),U=p(["svg","a","altglyph","altglyphdef","altglyphitem","animatecolor","animatemotion","animatetransform","circle","clippath","defs","desc","ellipse","filter","font","g","glyph","glyphref","hkern","image","line","lineargradient","marker","mask","metadata","mpath","path","pattern","polygon","polyline","radialgradient","rect","stop","style","switch","symbol","text","textpath","title","tref","tspan","view","vkern"]),F=p(["feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDistantLight","feFlood","feFuncA","feFuncB","feFuncG","feFuncR","feGaussianBlur","feImage","feMerge","feMergeNode","feMorphology","feOffset","fePointLight","feSpecularLighting","feSpotLight","feTile","feTurbulence"]),z=p(["animate","color-profile","cursor","discard","fedropshadow","font-face","font-face-format","font-face-name","font-face-src","font-face-uri","foreignobject","hatch","hatchpath","mesh","meshgradient","meshpatch","meshrow","missing-glyph","script","set","solidcolor","unknown","use"]),H=p(["math","menclose","merror","mfenced","mfrac","mglyph","mi","mlabeledtr","mmultiscripts","mn","mo","mover","mpadded","mphantom","mroot","mrow","ms","mspace","msqrt","mstyle","msub","msup","msubsup","mtable","mtd","mtext","mtr","munder","munderover"]),j=p(["maction","maligngroup","malignmark","mlongdiv","mscarries","mscarry","msgroup","mstack","msline","msrow","semantics","annotation","annotation-xml","mprescripts","none"]),P=p(["#text"]),B=p(["accept","action","align","alt","autocapitalize","autocomplete","autopictureinpicture","autoplay","background","bgcolor","border","capture","cellpadding","cellspacing","checked","cite","class","clear","color","cols","colspan","controls","controlslist","coords","crossorigin","datetime","decoding","default","dir","disabled","disablepictureinpicture","disableremoteplayback","download","draggable","enctype","enterkeyhint","face","for","headers","height","hidden","high","href","hreflang","id","inputmode","integrity","ismap","kind","label","lang","list","loading","loop","low","max","maxlength","media","method","min","minlength","multiple","muted","name","nonce","noshade","novalidate","nowrap","open","optimum","pattern","placeholder","playsinline","poster","preload","pubdate","radiogroup","readonly","rel","required","rev","reversed","role","rows","rowspan","spellcheck","scope","selected","shape","size","sizes","span","srclang","start","src","srcset","step","style","summary","tabindex","title","translate","type","usemap","valign","value","width","xmlns","slot"]),G=p(["accent-height","accumulate","additive","alignment-baseline","ascent","attributename","attributetype","azimuth","basefrequency","baseline-shift","begin","bias","by","class","clip","clippathunits","clip-path","clip-rule","color","color-interpolation","color-interpolation-filters","color-profile","color-rendering","cx","cy","d","dx","dy","diffuseconstant","direction","display","divisor","dur","edgemode","elevation","end","fill","fill-opacity","fill-rule","filter","filterunits","flood-color","flood-opacity","font-family","font-size","font-size-adjust","font-stretch","font-style","font-variant","font-weight","fx","fy","g1","g2","glyph-name","glyphref","gradientunits","gradienttransform","height","href","id","image-rendering","in","in2","k","k1","k2","k3","k4","kerning","keypoints","keysplines","keytimes","lang","lengthadjust","letter-spacing","kernelmatrix","kernelunitlength","lighting-color","local","marker-end","marker-mid","marker-start","markerheight","markerunits","markerwidth","maskcontentunits","maskunits","max","mask","media","method","mode","min","name","numoctaves","offset","operator","opacity","order","orient","orientation","origin","overflow","paint-order","path","pathlength","patterncontentunits","patterntransform","patternunits","points","preservealpha","preserveaspectratio","primitiveunits","r","rx","ry","radius","refx","refy","repeatcount","repeatdur","restart","result","rotate","scale","seed","shape-rendering","specularconstant","specularexponent","spreadmethod","startoffset","stddeviation","stitchtiles","stop-color","stop-opacity","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke","stroke-width","style","surfacescale","systemlanguage","tabindex","targetx","targety","transform","transform-origin","text-anchor","text-decoration","text-rendering","textlength","type","u1","u2","unicode","values","viewbox","visibility","version","vert-adv-y","vert-origin-x","vert-origin-y","width","word-spacing","wrap","writing-mode","xchannelselector","ychannelselector","x","x1","x2","xmlns","y","y1","y2","z","zoomandpan"]),W=p(["accent","accentunder","align","bevelled","close","columnsalign","columnlines","columnspan","denomalign","depth","dir","display","displaystyle","encoding","fence","frame","height","href","id","largeop","length","linethickness","lspace","lquote","mathbackground","mathcolor","mathsize","mathvariant","maxsize","minsize","movablelimits","notation","numalign","open","rowalign","rowlines","rowspacing","rowspan","rspace","rquote","scriptlevel","scriptminsize","scriptsizemultiplier","selection","separator","separators","stretchy","subscriptshift","supscriptshift","symmetric","voffset","width","xmlns"]),q=p(["xlink:href","xml:id","xlink:title","xml:space","xmlns:xlink"]),Y=d(/\{\{[\w\W]*|[\w\W]*\}\}/gm),$=d(/<%[\w\W]*|[\w\W]*%>/gm),K=d(/\${[\w\W]*}/gm),V=d(/^data-[\-\w.\u00B7-\uFFFF]/),X=d(/^aria-[\-\w]+$/),Z=d(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|cid|xmpp):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),J=d(/^(?:\w+script|data):/i),Q=d(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),ee=d(/^html$/i),te=function(){return"undefined"==typeof window?null:window},ne=function(t,n){if("object"!==e(t)||"function"!=typeof t.createPolicy)return null;var r=null,o="data-tt-policy-suffix";n.currentScript&&n.currentScript.hasAttribute(o)&&(r=n.currentScript.getAttribute(o));var a="dompurify"+(r?"#"+r:"");try{return t.createPolicy(a,{createHTML:function(e){return e},createScriptURL:function(e){return e}})}catch(e){return console.warn("TrustedTypes policy "+a+" could not be created."),null}};var re=function t(){var n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:te(),r=function(e){return t(e)};if(r.version="3.0.1",r.removed=[],!n||!n.document||9!==n.document.nodeType)return r.isSupported=!1,r;var o=n.document,i=n.document,l=n.DocumentFragment,u=n.HTMLTemplateElement,s=n.Node,f=n.Element,m=n.NodeFilter,d=n.NamedNodeMap,h=void 0===d?n.NamedNodeMap||n.MozNamedAttrMap:d,y=n.HTMLFormElement,g=n.DOMParser,b=n.trustedTypes,v=f.prototype,R=M(v,"cloneNode"),re=M(v,"nextSibling"),oe=M(v,"childNodes"),ae=M(v,"parentNode");if("function"==typeof u){var ie=i.createElement("template");ie.content&&ie.content.ownerDocument&&(i=ie.content.ownerDocument)}var le=ne(b,o),ce=le?le.createHTML(""):"",ue=i,se=ue.implementation,fe=ue.createNodeIterator,me=ue.createDocumentFragment,pe=ue.getElementsByTagName,de=o.importNode,he={};r.isSupported="function"==typeof c&&"function"==typeof ae&&se&&void 0!==se.createHTMLDocument;var ye,ge,be=Y,ve=$,Te=K,Ne=V,Ae=X,Ee=J,we=Q,Se=Z,_e=null,xe=C({},[].concat(a(I),a(U),a(F),a(H),a(P))),ke=null,Oe=C({},[].concat(a(B),a(G),a(W),a(q))),De=Object.seal(Object.create(null,{tagNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},allowCustomizedBuiltInElements:{writable:!0,configurable:!1,enumerable:!0,value:!1}})),Re=null,Ce=null,Le=!0,Me=!0,Ie=!1,Ue=!0,Fe=!1,ze=!1,He=!1,je=!1,Pe=!1,Be=!1,Ge=!1,We=!0,qe=!1,Ye="user-content-",$e=!0,Ke=!1,Ve={},Xe=null,Ze=C({},["annotation-xml","audio","colgroup","desc","foreignobject","head","iframe","math","mi","mn","mo","ms","mtext","noembed","noframes","noscript","plaintext","script","style","svg","template","thead","title","video","xmp"]),Je=null,Qe=C({},["audio","video","img","source","image","track"]),et=null,tt=C({},["alt","class","for","id","label","name","pattern","placeholder","role","summary","title","value","style","xmlns"]),nt="http://www.w3.org/1998/Math/MathML",rt="http://www.w3.org/2000/svg",ot="http://www.w3.org/1999/xhtml",at=ot,it=!1,lt=null,ct=C({},[nt,rt,ot],w),ut=["application/xhtml+xml","text/html"],st="text/html",ft=null,mt=i.createElement("form"),pt=function(e){return e instanceof RegExp||e instanceof Function},dt=function(t){ft&&ft===t||(t&&"object"===e(t)||(t={}),t=L(t),ye=ye=-1===ut.indexOf(t.PARSER_MEDIA_TYPE)?st:t.PARSER_MEDIA_TYPE,ge="application/xhtml+xml"===ye?w:E,_e="ALLOWED_TAGS"in t?C({},t.ALLOWED_TAGS,ge):xe,ke="ALLOWED_ATTR"in t?C({},t.ALLOWED_ATTR,ge):Oe,lt="ALLOWED_NAMESPACES"in t?C({},t.ALLOWED_NAMESPACES,w):ct,et="ADD_URI_SAFE_ATTR"in t?C(L(tt),t.ADD_URI_SAFE_ATTR,ge):tt,Je="ADD_DATA_URI_TAGS"in t?C(L(Qe),t.ADD_DATA_URI_TAGS,ge):Qe,Xe="FORBID_CONTENTS"in t?C({},t.FORBID_CONTENTS,ge):Ze,Re="FORBID_TAGS"in t?C({},t.FORBID_TAGS,ge):{},Ce="FORBID_ATTR"in t?C({},t.FORBID_ATTR,ge):{},Ve="USE_PROFILES"in t&&t.USE_PROFILES,Le=!1!==t.ALLOW_ARIA_ATTR,Me=!1!==t.ALLOW_DATA_ATTR,Ie=t.ALLOW_UNKNOWN_PROTOCOLS||!1,Ue=!1!==t.ALLOW_SELF_CLOSE_IN_ATTR,Fe=t.SAFE_FOR_TEMPLATES||!1,ze=t.WHOLE_DOCUMENT||!1,Pe=t.RETURN_DOM||!1,Be=t.RETURN_DOM_FRAGMENT||!1,Ge=t.RETURN_TRUSTED_TYPE||!1,je=t.FORCE_BODY||!1,We=!1!==t.SANITIZE_DOM,qe=t.SANITIZE_NAMED_PROPS||!1,$e=!1!==t.KEEP_CONTENT,Ke=t.IN_PLACE||!1,Se=t.ALLOWED_URI_REGEXP||Se,at=t.NAMESPACE||ot,De=t.CUSTOM_ELEMENT_HANDLING||{},t.CUSTOM_ELEMENT_HANDLING&&pt(t.CUSTOM_ELEMENT_HANDLING.tagNameCheck)&&(De.tagNameCheck=t.CUSTOM_ELEMENT_HANDLING.tagNameCheck),t.CUSTOM_ELEMENT_HANDLING&&pt(t.CUSTOM_ELEMENT_HANDLING.attributeNameCheck)&&(De.attributeNameCheck=t.CUSTOM_ELEMENT_HANDLING.attributeNameCheck),t.CUSTOM_ELEMENT_HANDLING&&"boolean"==typeof t.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements&&(De.allowCustomizedBuiltInElements=t.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements),Fe&&(Me=!1),Be&&(Pe=!0),Ve&&(_e=C({},a(P)),ke=[],!0===Ve.html&&(C(_e,I),C(ke,B)),!0===Ve.svg&&(C(_e,U),C(ke,G),C(ke,q)),!0===Ve.svgFilters&&(C(_e,F),C(ke,G),C(ke,q)),!0===Ve.mathMl&&(C(_e,H),C(ke,W),C(ke,q))),t.ADD_TAGS&&(_e===xe&&(_e=L(_e)),C(_e,t.ADD_TAGS,ge)),t.ADD_ATTR&&(ke===Oe&&(ke=L(ke)),C(ke,t.ADD_ATTR,ge)),t.ADD_URI_SAFE_ATTR&&C(et,t.ADD_URI_SAFE_ATTR,ge),t.FORBID_CONTENTS&&(Xe===Ze&&(Xe=L(Xe)),C(Xe,t.FORBID_CONTENTS,ge)),$e&&(_e["#text"]=!0),ze&&C(_e,["html","head","body"]),_e.table&&(C(_e,["tbody"]),delete Re.tbody),p&&p(t),ft=t)},ht=C({},["mi","mo","mn","ms","mtext"]),yt=C({},["foreignobject","desc","title","annotation-xml"]),gt=C({},["title","style","font","a","script"]),bt=C({},U);C(bt,F),C(bt,z);var vt=C({},H);C(vt,j);var Tt=function(e){var t=ae(e);t&&t.tagName||(t={namespaceURI:at,tagName:"template"});var n=E(e.tagName),r=E(t.tagName);return!!lt[e.namespaceURI]&&(e.namespaceURI===rt?t.namespaceURI===ot?"svg"===n:t.namespaceURI===nt?"svg"===n&&("annotation-xml"===r||ht[r]):Boolean(bt[n]):e.namespaceURI===nt?t.namespaceURI===ot?"math"===n:t.namespaceURI===rt?"math"===n&&yt[r]:Boolean(vt[n]):e.namespaceURI===ot?!(t.namespaceURI===rt&&!yt[r])&&(!(t.namespaceURI===nt&&!ht[r])&&(!vt[n]&&(gt[n]||!bt[n]))):!("application/xhtml+xml"!==ye||!lt[e.namespaceURI]))},Nt=function(e){A(r.removed,{element:e});try{e.parentNode.removeChild(e)}catch(t){e.remove()}},At=function(e,t){try{A(r.removed,{attribute:t.getAttributeNode(e),from:t})}catch(e){A(r.removed,{attribute:null,from:t})}if(t.removeAttribute(e),"is"===e&&!ke[e])if(Pe||Be)try{Nt(t)}catch(e){}else try{t.setAttribute(e,"")}catch(e){}},Et=function(e){var t,n;if(je)e="<remove></remove>"+e;else{var r=S(e,/^[\r\n\t ]+/);n=r&&r[0]}"application/xhtml+xml"===ye&&at===ot&&(e='<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>'+e+"</body></html>");var o=le?le.createHTML(e):e;if(at===ot)try{t=(new g).parseFromString(o,ye)}catch(e){}if(!t||!t.documentElement){t=se.createDocument(at,"template",null);try{t.documentElement.innerHTML=it?ce:o}catch(e){}}var a=t.body||t.documentElement;return e&&n&&a.insertBefore(i.createTextNode(n),a.childNodes[0]||null),at===ot?pe.call(t,ze?"html":"body")[0]:ze?t.documentElement:a},wt=function(e){return fe.call(e.ownerDocument||e,e,m.SHOW_ELEMENT|m.SHOW_COMMENT|m.SHOW_TEXT,null,!1)},St=function(e){return e instanceof y&&("string"!=typeof e.nodeName||"string"!=typeof e.textContent||"function"!=typeof e.removeChild||!(e.attributes instanceof h)||"function"!=typeof e.removeAttribute||"function"!=typeof e.setAttribute||"string"!=typeof e.namespaceURI||"function"!=typeof e.insertBefore||"function"!=typeof e.hasChildNodes)},_t=function(t){return"object"===e(s)?t instanceof s:t&&"object"===e(t)&&"number"==typeof t.nodeType&&"string"==typeof t.nodeName},xt=function(e,t,n){he[e]&&T(he[e],(function(e){e.call(r,t,n,ft)}))},kt=function(e){var t;if(xt("beforeSanitizeElements",e,null),St(e))return Nt(e),!0;var n=ge(e.nodeName);if(xt("uponSanitizeElement",e,{tagName:n,allowedTags:_e}),e.hasChildNodes()&&!_t(e.firstElementChild)&&(!_t(e.content)||!_t(e.content.firstElementChild))&&O(/<[/\w]/g,e.innerHTML)&&O(/<[/\w]/g,e.textContent))return Nt(e),!0;if(!_e[n]||Re[n]){if(!Re[n]&&Dt(n)){if(De.tagNameCheck instanceof RegExp&&O(De.tagNameCheck,n))return!1;if(De.tagNameCheck instanceof Function&&De.tagNameCheck(n))return!1}if($e&&!Xe[n]){var o=ae(e)||e.parentNode,a=oe(e)||e.childNodes;if(a&&o)for(var i=a.length-1;i>=0;--i)o.insertBefore(R(a[i],!0),re(e))}return Nt(e),!0}return e instanceof f&&!Tt(e)?(Nt(e),!0):"noscript"!==n&&"noembed"!==n||!O(/<\/no(script|embed)/i,e.innerHTML)?(Fe&&3===e.nodeType&&(t=e.textContent,t=_(t,be," "),t=_(t,ve," "),t=_(t,Te," "),e.textContent!==t&&(A(r.removed,{element:e.cloneNode()}),e.textContent=t)),xt("afterSanitizeElements",e,null),!1):(Nt(e),!0)},Ot=function(e,t,n){if(We&&("id"===t||"name"===t)&&(n in i||n in mt))return!1;if(Me&&!Ce[t]&&O(Ne,t));else if(Le&&O(Ae,t));else if(!ke[t]||Ce[t]){if(!(Dt(e)&&(De.tagNameCheck instanceof RegExp&&O(De.tagNameCheck,e)||De.tagNameCheck instanceof Function&&De.tagNameCheck(e))&&(De.attributeNameCheck instanceof RegExp&&O(De.attributeNameCheck,t)||De.attributeNameCheck instanceof Function&&De.attributeNameCheck(t))||"is"===t&&De.allowCustomizedBuiltInElements&&(De.tagNameCheck instanceof RegExp&&O(De.tagNameCheck,n)||De.tagNameCheck instanceof Function&&De.tagNameCheck(n))))return!1}else if(et[t]);else if(O(Se,_(n,we,"")));else if("src"!==t&&"xlink:href"!==t&&"href"!==t||"script"===e||0!==x(n,"data:")||!Je[e]){if(Ie&&!O(Ee,_(n,we,"")));else if(n)return!1}else;return!0},Dt=function(e){return e.indexOf("-")>0},Rt=function(t){var n,o,a,i;xt("beforeSanitizeAttributes",t,null);var l=t.attributes;if(l){var c={attrName:"",attrValue:"",keepAttr:!0,allowedAttributes:ke};for(i=l.length;i--;){var u=n=l[i],s=u.name,f=u.namespaceURI;if(o="value"===s?n.value:k(n.value),a=ge(s),c.attrName=a,c.attrValue=o,c.keepAttr=!0,c.forceKeepAttr=void 0,xt("uponSanitizeAttribute",t,c),o=c.attrValue,!c.forceKeepAttr&&(At(s,t),c.keepAttr))if(Ue||!O(/\/>/i,o)){Fe&&(o=_(o,be," "),o=_(o,ve," "),o=_(o,Te," "));var m=ge(t.nodeName);if(Ot(m,a,o)){if(!qe||"id"!==a&&"name"!==a||(At(s,t),o=Ye+o),le&&"object"===e(b)&&"function"==typeof b.getAttributeType)if(f);else switch(b.getAttributeType(m,a)){case"TrustedHTML":o=le.createHTML(o);break;case"TrustedScriptURL":o=le.createScriptURL(o)}try{f?t.setAttributeNS(f,s,o):t.setAttribute(s,o),N(r.removed)}catch(e){}}}else At(s,t)}xt("afterSanitizeAttributes",t,null)}},Ct=function e(t){var n,r=wt(t);for(xt("beforeSanitizeShadowDOM",t,null);n=r.nextNode();)xt("uponSanitizeShadowNode",n,null),kt(n)||(n.content instanceof l&&e(n.content),Rt(n));xt("afterSanitizeShadowDOM",t,null)};return r.sanitize=function(e){var t,n,a,i,c=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if((it=!e)&&(e="\x3c!--\x3e"),"string"!=typeof e&&!_t(e)){if("function"!=typeof e.toString)throw D("toString is not a function");if("string"!=typeof(e=e.toString()))throw D("dirty is not a string, aborting")}if(!r.isSupported)return e;if(He||dt(c),r.removed=[],"string"==typeof e&&(Ke=!1),Ke){if(e.nodeName){var u=ge(e.nodeName);if(!_e[u]||Re[u])throw D("root node is forbidden and cannot be sanitized in-place")}}else if(e instanceof s)1===(n=(t=Et("\x3c!----\x3e")).ownerDocument.importNode(e,!0)).nodeType&&"BODY"===n.nodeName||"HTML"===n.nodeName?t=n:t.appendChild(n);else{if(!Pe&&!Fe&&!ze&&-1===e.indexOf("<"))return le&&Ge?le.createHTML(e):e;if(!(t=Et(e)))return Pe?null:Ge?ce:""}t&&je&&Nt(t.firstChild);for(var f=wt(Ke?e:t);a=f.nextNode();)kt(a)||(a.content instanceof l&&Ct(a.content),Rt(a));if(Ke)return e;if(Pe){if(Be)for(i=me.call(t.ownerDocument);t.firstChild;)i.appendChild(t.firstChild);else i=t;return(ke.shadowroot||ke.shadowrootmod)&&(i=de.call(o,i,!0)),i}var m=ze?t.outerHTML:t.innerHTML;return ze&&_e["!doctype"]&&t.ownerDocument&&t.ownerDocument.doctype&&t.ownerDocument.doctype.name&&O(ee,t.ownerDocument.doctype.name)&&(m="<!DOCTYPE "+t.ownerDocument.doctype.name+">\n"+m),Fe&&(m=_(m,be," "),m=_(m,ve," "),m=_(m,Te," ")),le&&Ge?le.createHTML(m):m},r.setConfig=function(e){dt(e),He=!0},r.clearConfig=function(){ft=null,He=!1},r.isValidAttribute=function(e,t,n){ft||dt({});var r=ge(e),o=ge(t);return Ot(r,o,n)},r.addHook=function(e,t){"function"==typeof t&&(he[e]=he[e]||[],A(he[e],t))},r.removeHook=function(e){if(he[e])return N(he[e])},r.removeHooks=function(e){he[e]&&(he[e]=[])},r.removeAllHooks=function(){he={}},r}();return re}));</script>
</head>
<body>
<style>
:root, :root.light {
--background: #e8e8e8;
--button-bg: #c8c8c8;
--button-bg-hover: #b4b4b4;
--text-color: black;
--textarea-bg: #f1f1f1;
--selected-thread-bg: lightgray;
--border-color: #c8c8c8;
--border-radius: 3px;
--avatar-bg: lightgrey;
--notification-bg-color: #005ac2;
--button-border-color: #b4b4b4;
--button-font-size: 0.825rem;
}
/* Detect browser dark mode and change variables */
@media (prefers-color-scheme: dark) {
:root {
--background: #151515;
--button-bg: #333;
--button-bg-hover: #444;
--text-color: white;
--textarea-bg: #333;
--selected-thread-bg: #444;
--border-color: #333;
--avatar-bg: #333;
--button-border-color: #515151;
}
}
body, html {
margin:0;
background: var(--background);
color: var(--text-color);
font-family: sans-serif;
}
body * {
box-sizing:border-box;
color: inherit;
font-family: inherit;
}
body a {
color: blue;
}
.messageText pre[data-markdown-codeblock] {
font-family: monospace;
background: rgb(35 35 35);
padding: 0.5rem;
color: rgb(232, 232, 232);
border-radius: var(--border-radius);
overflow-x: auto;
}
.messageText p code {
font-family: monospace;
background: rgb(35 35 35);
padding: 0.125rem;
color: rgb(232, 232, 232);
border-radius: var(--border-radius);
}
.messageText table {
border-collapse: collapse;
}
.messageText table, .messageText th, .messageText td {
border: 1px solid var(--border-color);
}
button {
background: var(--button-bg);
border-radius: var(--border-radius);
cursor:pointer;
padding: 0.125rem;
border: 1px solid var(--button-border-color);
font-size: var(--button-font-size);
}
button:hover {
background: var(--button-bg-hover);
}
button:disabled {
cursor: not-allowed;
}
textarea {
background: var(--textarea-bg);
border: 1px solid var(--button-border-color);
border-radius: var(--border-radius);
}
input[type="text"], select {
background: var(--textarea-bg);
border: 1px solid var(--button-border-color);
border-radius: var(--border-radius);
}
#appOptions .appOptionButton {
width:100%;
cursor:pointer;
margin-top:0.5rem;
min-height: 2rem;
}
#chatThreads {
flex-grow:1;
overflow-y:auto;
margin-top:0.5rem;
-webkit-mask-image: linear-gradient(to bottom, black calc(100% - 30px), #ffffff00 100%);
mask-image: linear-gradient(to bottom, black calc(100% - 30px), #ffffff00 100%);
padding-bottom:2rem;
}
#chatThreads .thread, #chatThreads .threadFolder {
border-radius: var(--border-radius);
display:flex;
padding:0.5rem;
cursor:pointer;
border: 1px solid var(--border-color);
position: relative;
user-select:none;
}
#chatThreads .thread, #chatThreads .threadFolder {
margin-top: 0.5rem;
}
#chatThreads .thread:first-child, #chatThreads .threadFolder:first-child {
margin-top: 0;
}
#chatThreads .threadFolder {
display: flex;
justify-content: space-between;
align-items: center;
}
#chatThreads .thread .favStar, #chatThreads .thread .changeFolderPath {
position: absolute;
font-size: 80%;
opacity: 0.5;
display: none;
text-shadow: 0px 1px 2px #515151;
}
#chatThreads .thread .favStar {
top: 0.0625rem;
left: 0.0625rem;
}
#chatThreads .thread .changeFolderPath {
bottom: 0.0625rem;
left: 0.0625rem;
}
body:not(.isMobile) #chatThreads .thread .favStar:hover {
opacity: 1;
}
#chatThreads .thread .changeFolderPath:hover {
opacity: 1;
}
#chatThreads .thread:hover .favStar, #chatThreads .thread:hover .changeFolderPath {
display: inline;
}
/* can't hover on mobile, so display button on selected thread: */
body.isMobile #chatThreads .thread.selected .favStar, body.isMobile #chatThreads .thread.selected .changeFolderPath {
display: inline;
}
#chatThreads .thread .favStar[data-is-fav="true"] {
opacity: 1;
display: inline;
}
#chatThreads .thread:not(:first-child) {
margin-top: 0.5rem;
}
#chatThreads .thread .button {
opacity:0.5;
}
#chatThreads .thread .button:hover {
opacity:1;
}
#chatThreads .thread.selected {
background-color: var(--selected-thread-bg);
}
#chatThreads .thread .info {
max-width: 100%;
}
#chatThreads .thread .nameWrapper {
overflow: hidden;
white-space: nowrap;
max-width: 150px;
display: flex;
}
#chatThreads .thread .name {
/* truncate long thread names */
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
flex-grow: 1;
}
#chatThreads .thread .avatar, #characterSelection .character .avatar {
width:50px;
height:50px;
border-radius: var(--border-radius);
min-width:50px;
background-position: center;
background-size: cover;
background-repeat: no-repeat;
background-color: var(--avatar-bg);
}
#messageFeed .message .avatar {
width: 50px;
height: 50px;
border-radius: var(--border-radius);
min-width: 50px;
background-position: center;
background-size: cover;
background-repeat: no-repeat;
background-color: var(--avatar-bg);
}
#chatThreads .characterEditButton {
font-size: 0.65rem;
opacity: 0.5;
}
#chatThreads .characterEditButton:hover {
opacity: 1;
}
/* hide threads scrollbar */
#chatThreads {
-ms-overflow-style: none; /* Internet Explorer 10+ */
scrollbar-width: none; /* Firefox */
}
#chatThreads::-webkit-scrollbar {
display: none; /* Safari and Chrome */
}
/* hide message feed scrollbar */
/* #messageFeed {
-ms-overflow-style: none;
scrollbar-width: none;
}
#messageFeed::-webkit-scrollbar {
display: none;
} */
/* custom scrollbar */
::-webkit-scrollbar {
width: 10px;
height: 10px;
}
::-webkit-scrollbar-track {
background-color: transparent;
}
::-webkit-scrollbar-thumb {
background-color: var(--button-bg);
border-radius: 10px;
border: 3px solid transparent;
background-clip: content-box;
}
::-webkit-scrollbar-thumb:hover {
background-color: var(--button-bg-hover);
}
#builtInChatInterfaceWrapper {
display: flex;
flex-grow: 1;
flex-direction: column;
height: 100%;
position:relative;
padding-left: 0.5rem;
padding-right: 0.5rem;
}
#messageFeed .message {
margin-top:0.5rem;
margin-bottom:0.5rem;
}
#messageFeed .message .bottomButtons {
display:none;
position:absolute;
bottom: 0.25rem;
right: 0.5rem;
}
#messageFeed .message:hover .bottomButtons {
display: flex;
}
.emojiButton {
opacity:0.5;
cursor:pointer;
}
.emojiButton:hover {
opacity:1;
}
#messageFeed .message.hiddenFromUser .showHiddenMessageButton {
display: inline-block;
}
#messageFeed .message:not(.hiddenFromUser) .showHiddenMessageButton {
display: none;
}
#messageFeed .message.hiddenFromUser .messageWrap {
display: none;
}
#messageFeed .message:not(.hiddenFromUser) .messageWrap {
display: flex;
}
#messageFeed .messageText p {
white-space: pre-wrap;
}
#messageFeed .messageText {
margin-top: 0.125rem;
overflow: hidden; /* keep messageText content from "escaping" the message area */
}
#messageFeed .messageText p:first-child {
margin-top:0;
}
#messageFeed .messageText img {
max-width: 100%;
}
#messageFeed .message .avatar {
}
#messageFeed > *:first-child {
margin-top: 3rem;
}
#characterFoldersList {
display: grid;
grid-template-columns: repeat(auto-fill, 280px);
grid-gap: 0.5rem;
justify-content: center;
margin-bottom: 0.5rem;
}
#characterFoldersList .characterFolder {
border: 1px solid var(--border-color);
border-radius: var(--border-radius);
width: 100%;
padding:0.5rem;
cursor:pointer;
user-select:none;
}
#characterSelection .character {
border: 1px solid var(--border-color);
border-radius: var(--border-radius);
width: 100%;
}
#characterSelection .character .info .buttons {
margin-top: 0.25rem;
}
#characterSelection .character .info .buttons button {
font-size: 0.7rem;
margin-left: 0.25rem;
}
#characterList, #starterCharacterList {
display: grid;
grid-template-columns: repeat(auto-fill, 280px);
grid-gap: 0.5rem;
justify-content: center;
}
#characterFoldersList .characterFolder {
display: flex;
justify-content: space-between;
align-items: center;
}
#characterSelection .character {
user-select:none;
}
#customCodeIframeHorizontalResizeBar {
width:5px;
background:var(--button-bg);
cursor:ew-resize;
}
#customCodeIframeHorizontalResizeBar:hover {
background:var(--button-bg-hover);
}
#userMessagesSentHistoryCtn {
margin-bottom:0.25rem;
position:relative;
}
#userMessagesSentHistoryCtn:empty {
display: none;
}
#userMessagesSentHistoryCtn .historyItem {
cursor: pointer;
padding: 0.25rem;
font-size: 85%;
overflow: hidden;
white-space: pre;
display: flex;
}
#userMessagesSentHistoryCtn .historyItem .text {
text-overflow: ellipsis;
overflow: hidden;
margin-left: 0.25rem;
}
#userMessagesSentHistoryCtn .historyItem .deleteButton {
margin-left: auto;
}
#userMessagesSentHistoryCtn .historyItem:hover {
background: var(--background);
}
#userMessagesSentHistoryCtn .historyItem .pinButton,
#userMessagesSentHistoryCtn .historyItem .deleteButton {
opacity: 0.5;
}
#userMessagesSentHistoryCtn .historyItem[data-is-pinned="true"] .pinButton {
opacity: 1;
}
body:not(.isMobile) #userMessagesSentHistoryCtn .historyItem .pinButton:hover,
body:not(.isMobile) #userMessagesSentHistoryCtn .historyItem .deleteButton:hover {
opacity: 1;
}
#shortcutButtonsCtn {
margin-bottom:0.25rem;
position:relative;
overflow-y: auto;
}
#shortcutButtonsCtn:empty {
display:none;
}
#shortcutButtonsCtn button:not(:first-child) {
margin-left:0.25rem;
}
/* typing indicator from https://codepen.io/arthak/pen/rmqvgo */
.tiblock { align-items: center; display: flex; height: 17px; }
.ticontainer{ display: inline-block; }
.ticontainer .tidot { background-color: #90949c; }
.tidot { animation: mercuryTypingAnimation 1.5s infinite ease-in-out; border-radius: 2px; display: inline-block; height: 4px; margin-right: 2px; width: 4px; }
@keyframes mercuryTypingAnimation{ 0%{ -webkit-transform:translateY(0px); transform:translateY(0px); } 28% { transform:translateY(-5px); } 44%{ transform:translateY(0px); } } .tidot:nth-child(1){ animation-delay:200ms; } .tidot:nth-child(2){ animation-delay:300ms; } .tidot:nth-child(3){ animation-delay:400ms; }
</style>
<div id="topNotification" style="position:fixed; top:1rem; left:0; right:0; z-index:1000; display:none;">
<div id="topNotificationContent" style="margin:0 auto; max-width:350px; background:var(--notification-bg-color); color:white; text-align: center; padding: 0.5rem; border-radius: var(--border-radius);"></div>
</div>
<div id="main" style="display:flex; position:fixed; top:0; right:0; left:0; bottom:0;">
<div id="leftColumn" style="display:flex; flex-direction:column; width:270px; min-width:270px; padding:0.5rem; ">
<div style="display:flex;">
<button id="newThreadButton" style="width:100%; cursor:pointer; min-height:2rem;">💬 new chat</button>
<button id="closeLeftColumnButton" style="cursor:pointer;min-height:2rem;margin-left: 0.5rem;min-width: 2rem;">☰</button>
</div>
<div id="threadSearchCtn" style="display:flex; width:100%; margin-top:0.5rem;">
<input id="threadSearchInput" style="height: 100%; flex-grow: 1; min-width: 0; padding-left: 0.5rem;" type="text" placeholder="search threads...">
<button id="threadSearchButton" style="cursor:pointer;min-height: 2rem;min-width: 2rem;margin-left: 0.5rem;">🔎</button>
</div>
<!-- <div id="threadFolderNavigationBar" style="display:flex; width:100%; margin-top:0.5rem;">
<button id="threadFolderBackButton" style="cursor:pointer;min-height: 2rem;min-width: 2rem;margin-left: 0.5rem;">🔙</button>
</div> -->
<!-- <div id="chatThreadFolders" data-current-folder-path=""></div> -->
<div id="chatThreads" data-current-folder-path=""></div>
<div id="appOptions">
<div style="display:flex;">
<button id="settingsButton" class="appOptionButton">⚙️ settings</button>
<!-- <button id="statsButton" class="appOptionButton" style="margin-left: 0.5rem; width: 2rem;">📊</button> -->
</div>
<div style="display: flex;">
<button id="clearDataButton" class="appOptionButton" style="width: 4rem;">🗑️</button>
<button id="exportDataButton" class="appOptionButton" style="margin-left: 0.5rem; margin-right: 0.5rem;">💾 export</button>
<button class="appOptionButton" style="position:relative;">📁 import<input id="importDataFileInput" style="position:absolute; top:0; left:0; right:0; bottom:0; opacity:0; cursor:pointer;" type="file"></button>
</div>
<button onclick="window.open('https://github.com/josephrocca/OpenCharacters/blob/main/README.md')" class="appOptionButton">❓ about this project <span style="font-size:0.6rem; opacity:0.5;">001</span></button>
</div>
</div>
<div id="middleColumn" style="flex-grow:1; display:flex; flex-direction:column; position:relative; overflow:hidden; min-width:200px; z-index:1;">
<div id="middleColumnShadowOverlay" style="display:none; position:absolute;top:0;left:0;right:0;bottom:0;background:rgba(0,0,0,0.5); z-index:20;"></div>
<div id="characterSelection" class="middleColumnScreen" style="flex-grow:1; display:none; overflow: auto;">
<button id="characterSelectionOpenLeftColumnButton" class="openLeftColumnButton" style="background: var(--button-bg);border-radius: var(--border-radius);border: 1px solid var(--button-border-color);padding: 0.25rem;width: 2rem;min-height: 2rem;margin-right: 0.5rem;position: absolute;top: 0.5rem;left: 0.5rem;">☰</button>
<div>
<h2 style="text-align:center;margin-bottom: 0.5rem;">Your Characters</h2>
<div style="margin-bottom: 0.5rem;display: flex;justify-content: center;">
<button id="newCharacterButton" style="padding: 0.25rem;">🆕 new character</button>
<!-- <button id="newFolderCharacterButton" style="padding: 0.25rem; margin-left: 0.5rem;">📁 new folder</button> -->
</div>
</div>
<div id="characterFoldersList" data-current-folder-path=""></div>
<div id="characterList"></div>
<div><h2 style="text-align:center; margin-top:4rem;">Starter Characters</h2></div>
<div id="starterCharacterList"></div>
<br><br>
</div>
<div id="chatInterface" class="middleColumnScreen" style="display:flex; flex-grow:1; flex-direction:column; height:100%; position:relative;">
<div id="customCodeChatInterfaceWrapper" style="display:none;"></div>
<div id="builtInChatInterfaceWrapper">
<div id="messageFeedHeaderBar" style="display: flex; position:absolute;height: 2rem;right: 0;left: 0;margin: 0.5rem; z-index:30;">
<button id="messageFeedOpenLeftColumnButton" class="openLeftColumnButton" style="display:none; background: var(--button-bg);border-radius: var(--border-radius);border: 1px solid var(--button-border-color);padding: 0.25rem; min-width: 2rem; height: 100%; margin-right:0.5rem;">☰</button>
<div style="background: var(--button-bg); display:flex; height: 100%; border-radius: var(--border-radius);border: 1px solid var(--button-border-color);padding: 0.25rem;">
<div style="display: flex;align-items: center;font-size:var(--button-font-size);margin-right: 0.25rem;">model:</div>
<select id="threadModelSelector" style="max-width:130px;"></select>
</div>
<!-- <div id="threadSettingsButton" style="margin-left:0.5rem; cursor:pointer; background: var(--button-bg); display:flex; height: 100%; border-radius: var(--border-radius);border: 1px solid var(--button-border-color);padding: 0.25rem;">
<div style="display: flex;align-items: center;justify-content:center;font-size:var(--button-font-size);min-width:1.5rem;">⚙️</div>
</div> -->
</div>
<div id="chatBackgroundCtn" style="pointer-events:none; position:absolute; top:0; left:0; right:0; bottom:0; z-index:-10;"></div>
<div id="noMessagesNotice" style="display:none; text-align:center; padding:1rem; margin-top:4rem;">Type a message to begin the chat.</div>
<div id="messageFeed" style="flex-grow:1; overflow-y:auto;"></div>
<div id="statusNotifier" style="text-align: center; display: none; height: 0; position: relative; top: -0.4rem; display: flex; align-items: center; justify-content: center;"></div>
<div id="inputWrapper" style="display:flex; padding:0.5rem; padding-left:0; padding-right:0; flex-direction:column;">
<!-- <div style="display:flex;margin-bottom: 0.25rem;">
<button id="editReminderMessageButton" style="font-size:0.7rem;">✏️ reminder msg</button>
</div> -->
<div id="userMessagesSentHistoryCtn"></div>
<div id="shortcutButtonsCtn"></div>
<div style="display:flex;">
<textarea id="messageInput" style="flex-grow:1; min-height:4rem; font-size:100%;" title="commands: /ai - prompt a reply from ai /ai <instruction> - prompt reply with instruction /ai @CharName#123 <instruction> - prompt reply with another character (ID=123) /user <instruction> - generate a user reply /sys <message> - reply as system /sum - open summary editor /mem - open memory editor /lore - open lore editor /lore <text> - add a lore entry /name <name> - set your name for this thread /avatar <url> - set your avatar image for this thread /import - add chat messages in bulk • You can add '/ai <instruction>' as the final line in your normal messages to instruct AI for its reply. • Double-click this text box to show input history"></textarea>
<div style="display:flex; flex-direction:column; margin-left:0.25rem;">
<button id="sendButton" style="min-width:80px; flex-grow:1;">send</button>
<div style="position:relative;">
<div id="threadOptionsPopup" style="position:absolute; display:none; padding:0.5rem; background:var(--background); border-radius:var(--border-radius); width:max-content; right:0; bottom:0; border:1px solid var(--border-color);">
<button id="addShortcutButton">✨ add shortcut</button>
<!-- <button id="replyLoopButton">➰ reply loop</button> -->
</div>
</div>
<button id="threadOptionsButton" style="min-width:80px; margin-top:0.25rem;">options</button>
</div>
</div>
</div>
</div>
</div>
</div>
<div id="rightColumn" style="width:min-content;" data-visible="no">
<div id="customCodeColumn" style="width:min-content; display:none; height:100%;">
<div id="customCodeIframeHorizontalResizeBar"></div>
<div id="customCodeIframeCtn" style="height:100%; flex-grow:1;"></div>
</div>
</div>
</div>
<button id="toggleRightColumnButton" style="position:fixed; top:0.5rem; right:0.5rem; min-height:2rem; min-width:2rem; display:none; align-items:center; justify-content:center; z-index:500;">⚛️</button>
<audio id="musicPlayer" style="display:none;"></audio>
<script type="module">
import { $, $$, delay, showEl, hideEl, prompt2, createFloatingWindow, sanitizeHtml, textToSpeech, sha256Text, dedent, downloadTextOrBlob, createGpt3Tokenizer, cosineDistance, createLoadingModal, applyObjectOverrides, objectKeysAndTypesAreValid, addBackgroundToElement, importStylesheet, htmlToElement, jsonToBlob } from "./utils.js?v=34";
let JSON5;
(async function() {
JSON5 = await import('https://cdn.jsdelivr.net/npm/[email protected]/dist/index.min.mjs').then(m => m.default);
})();
// TODO: allow <style> when you work out how to scope it to the current message only - maybe just use a CSS parser and add .messageText prefix to selectors - https://github.com/jotform/css.js
// TODO: allow sandboxed iframes in messages? so devs can add dynamic/interactive message content? I think they may even be able to communicate with their custom code iframe?!
let domPurifyOptions = {
FORBID_TAGS: ['style'],
ADD_ATTR: ['onclick'], // WARNING: I'm using a hook (below) to make this safe. Be careful when editing this stuff.
};
DOMPurify.addHook('uponSanitizeAttribute', function (node, data) {
if(data.attrName === "onclick") {
node.dataset.onClickCode = data.attrValue;
data.attrValue = "window.runCodeInCustomCodeIframe(this.dataset.onClickCode)";
}
});
const markedRenderer = new marked.Renderer();
markedRenderer.code = (source, lang) => {
const escapedSource = sanitizeHtml(source);
if(lang) {
return `<pre data-markdown-codeblock="${sanitizeHtml(lang)}">${escapedSource}</pre>`;
} else {
return `<pre data-markdown-codeblock>${escapedSource}</pre>`;
}
};
marked.setOptions({
renderer: markedRenderer,
});
window.onerror = function(errorMsg, url, lineNumber, columnNumber, errorObj) {
alert(`Please report this error on the Discord or Github:\n\n${errorMsg}\n\nstack: ${errorObj?.stack}\n\nline: ${lineNumber}`);
if(errorObj?.stack.toLowerCase().includes("databaseclosederror")) {
}
return false;
}
if(!window.isSecureContext) {
alert("Hey, looks like you're trying to host this locally, but you have hosted it in an insecure context - i.e. you're serving it on HTTP instead of HTTPS. Unfortunately there are a bunch of features that are disabled on HTTP connections for modern browsers. localhost is treated as a secure context for development purposes, but if you want to server it on the internet, then I recommend using Cloudflare - you just switch your domain's nameservers to them and then it's basically a button click and you've got HTTPS. Much easier than setting up your own certificate stuff.");
}
$.messageFeed.addEventListener("keydown", async function(e) {
debugger;
});
// polyfill for navigator.userActivation
if(!navigator.userActivation) {
navigator.userActivation = {hasBeenActive:false};
let pageActivationClickHandler = (e) => {
if(e.isTrusted) {
navigator.userActivation.hasBeenActive = true;
window.removeEventListener("click", pageActivationClickHandler);
}
}
window.addEventListener("click", pageActivationClickHandler);
}
const sceneBackground = addBackgroundToElement($.chatBackgroundCtn);
// dragula([$.messageFeed], {
// moves: function (el, source, handle, sibling) {
// return el.classList.contains("message") && handle.classList.contains("avatar");
// },
// revertOnSpill: true,
// });
prompt2.defaults = {
backgroundColor: "var(--background)",
borderColor: "var(--border-color)",
};
createFloatingWindow.defaults = {
backgroundColor: "var(--background)",
borderColor: "var(--border-color)",
};
let summariesWindow = createFloatingWindow({header:"Logs"});
summariesWindow.hide();
function addToDebugLog(html) {
let ctn = document.createElement("div");
ctn.innerHTML = html;
ctn.style.cssText = "font-size:0.8rem; padding:0.5rem; solid var(--border-color); font-family:monospace;";
let initialScrollTop = summariesWindow.bodyEl.scrollTop;
summariesWindow.bodyEl.appendChild(ctn);
setTimeout(function() {
// wait for render and then scroll to bottom if it was near bottom previously
if(Math.abs(initialScrollTop - summariesWindow.bodyEl.scrollTop) < 10) {
summariesWindow.bodyEl.scrollTop = summariesWindow.bodyEl.scrollHeight;
}
}, 10);
// delete earlier children if there are too many
while(summariesWindow.bodyEl.children.length > 50) {
summariesWindow.bodyEl.removeChild(summariesWindow.bodyEl.children[0]);
}
}
// TODO: improve this heuristic. this isn't just about screen width - it's also about touch screens (no pointer hover events).
// ALSO: This is a bit of a misnomer. It's used for stuff like determining how to show the right column, which is really about screen width, not mobile/touchscreen stuff.
const isMobile = window.innerWidth < 700;
if(isMobile) {
document.body.classList.add("isMobile"); // to use in CSS selectors
}
function openLeftColumn() {
showEl($.leftColumn);
document.querySelectorAll(".openLeftColumnButton").forEach(el => hideEl(el));
showEl($.closeLeftColumnButton);
if(isMobile) {
showEl($.middleColumnShadowOverlay);
}
}
function closeLeftColumn() {
hideEl($.leftColumn);
document.querySelectorAll(".openLeftColumnButton").forEach(el => showEl(el));
hideEl($.closeLeftColumnButton);
if(isMobile) {
hideEl($.middleColumnShadowOverlay);
}
}
$.closeLeftColumnButton.addEventListener("click", closeLeftColumn);
document.querySelectorAll(".openLeftColumnButton").forEach(el => {
el.addEventListener("click", (e) => {
e.stopPropagation(); // <-- since this hovers over middle column, and on mobile we close left column when they tap middle column
openLeftColumn();
});
});
if(isMobile) {
closeLeftColumn();
// if they click anywhere in the middle column, close the menu
$.middleColumnShadowOverlay.addEventListener("click", (e) => {
e.stopPropagation();
closeLeftColumn();
});
}
{
let messageFeedHeaderBarHideTimeout = null;
let isMouseInTriggerArea = false;
function showMessageFeedTopMenu() {
clearTimeout(messageFeedHeaderBarHideTimeout);
messageFeedHeaderBarHideTimeout = null;
showEl($.messageFeedHeaderBar);
}
function hideMessageFeedTopMenu() {
if(messageFeedHeaderBarHideTimeout !== null) return; // hiding settimeout already in progress
clearTimeout(messageFeedHeaderBarHideTimeout);
messageFeedHeaderBarHideTimeout = setTimeout(() => {
hideEl($.messageFeedHeaderBar);
}, 2000);
}
window.addEventListener("mousemove", (e) => {
if (e.pageY < 80) { // show:
isMouseInTriggerArea = true;
showMessageFeedTopMenu();
} else { // hide if visible:
isMouseInTriggerArea = false;
if ($.messageFeedHeaderBar.offsetHeight > 0 && !lastMessageFeedScrollWasUp) {
hideMessageFeedTopMenu();
}
}
});
let messageFeedScrollTop = 0;
let lastMessageFeedScrollWasUp = true;
$.messageFeed.addEventListener("scroll", function (e) {
let newScrollTop = e.target.scrollTop;
if (newScrollTop < messageFeedScrollTop) { // they scrolled up, so show menu
lastMessageFeedScrollWasUp = true;
showMessageFeedTopMenu();
}
if (newScrollTop > messageFeedScrollTop) { // they scrolled down, so hide menu if their mouse isn't in trigger area
lastMessageFeedScrollWasUp = false;
if(!isMouseInTriggerArea || isMobile) {
hideMessageFeedTopMenu();
}
}
messageFeedScrollTop = newScrollTop;
}, { passive: true });
}
if(isMobile) {
$.customCodeIframeHorizontalResizeBar.style.display = "none";
$.customCodeColumn.style.width = "100%";
$.rightColumn.style.position = "fixed";
$.rightColumn.style.top = "0";
$.rightColumn.style.right = "0";
$.rightColumn.style.bottom = "0";
$.rightColumn.style.left = "0";
$.rightColumn.style.zIndex = "100";
$.rightColumn.style.width = "";
$.rightColumn.style.pointerEvents = "none";
$.rightColumn.style.opacity = "0";
$.toggleRightColumnButton.addEventListener("click", function() {
if($.rightColumn.dataset.visible === "yes") {
$.rightColumn.style.pointerEvents = "none";
$.rightColumn.style.opacity = "0";
$.rightColumn.dataset.visible = "no";
$.toggleRightColumnButton.textContent = "⚛️";
} else {
$.rightColumn.style.pointerEvents = "";
$.rightColumn.style.opacity = "1";
$.rightColumn.dataset.visible = "yes";
$.toggleRightColumnButton.textContent = "💬";
}
});
}
const dbName = "chatbot-ui-v1";
const dbVersion = 90;
let db = await new Dexie(dbName).open().catch(e => {
console.warn(e);
return false;
}); // throws if db doesn't exist
let dbLoadingModal;
if(db) {
console.log("Existing user, checking database version...");
let usersOriginalDbVersion = db.verno;
if(usersOriginalDbVersion < dbVersion) {
let result = await prompt2({
message: {type:"none", "html":`<p style="margin:0;">A database upgrade will be done when you click continue. A full export/backup will be downloaded first in case anything goes wrong.</p>`},
}, {cancelButtonText:null, submitButtonText:"Continue"});
dbLoadingModal = createLoadingModal(`Please wait...<br><span style="font-size:80%; opacity:0.6;">This could take a while if you have a lot of data.</span>`);
const originalDbJsonBlob = await db.export({prettyJson: true});
let yyyymmdd = new Date().toISOString().split("T")[0];
downloadTextOrBlob(originalDbJsonBlob, `opencharacters-export-${yyyymmdd}.json`);
}
await db.close(); // we need to close before db.version() call below and re-open afterwards
} else {
// brand new user, so create the db:
console.log("New user, creating database...");
db = new Dexie(dbName);
}
db.version(dbVersion).stores({
// REMEMBER: If you update the database schema, you may also need to update the export/import code
// in particular: the character hash code shouldn't include fields like `id` and `creationTime` and `lastMessageTime`.
// Things to check:
// - character hash computation
// - $.exportDataButton.addEventListener
// - import code
// NOTE: The properties listed here are just the INDEXES, not *all* the columns/properties.
characters: "++id,modelName,fitMessagesInContextMethod,uuid,creationTime,lastMessageTime",
threads: "++id,name,characterId,creationTime,lastMessageTime,lastViewTime",
messages: "++id,threadId,characterId,creationTime,order", // characterId is -1 for user, and for system it is -2.
misc: "key", // key=>value
summaries: "hash,threadId", // EDIT: This does not make sense, because the `hash` is used as the primary key, so in the case where two threads end up with the same summary hash (which is actually common because you can import a thread which you already have), then you can only have one entry for both threads. So for summary deletion you actually need to (OLD: we track threadId so when we delete threads, we can delete the associated summaries. we also need it for grabbing summaries for the edit interface.)
memories: "++id,[summaryHash+threadId],[characterId+status],[threadId+status],[threadId+index],threadId", // memories are associated with a summary hash because they are computed alongside the summary. We need to track the hash so that if earlier messages are edited (and therefore the summaries need to be recomputed), we know to only consider "valid"/"current" the memories that are associated with currently-"used". The "type" property is used to track the "currentness", and also to track whether a memory was manually added by the user (in which case it is *always* considered valid)
lore: "++id,bookId,bookUrl",
textEmbeddingCache: "++id,textHash,&[textHash+modelName]",
textCompressionCache: "++id,uncompressedTextHash,&[uncompressedTextHash+modelName+tokenLimit]",
usageStats: "[dateHour+threadId+modelName],threadId,characterId,dateHour", // note that characterId can be derived from threadId - it's just included for quick aggregation. modelName is like "gpt-3.5-turbo", dateHour is like "2023-3-29-14"
}).upgrade(async tx => {
await tx.table("characters").toCollection().modify(character => {
upgradeCharacterFromOldVersion(character);
});
await tx.table("messages").toCollection().modify(message => {
upgradeMessageFromOldVersion(message);
});
let characters = await tx.table("characters").toArray();
await tx.table("threads").toCollection().modify(async thread => {
await upgradeThreadFromOldVersion(thread, {characters});
});
if(db.apiUsage) await db.apiUsage.delete();
await tx.table("usageStats").toCollection().modify((entry, ref) => {
if(entry.threadId === undefined) delete ref.value; // delete rows/entries that don't have a threadId - this was caused by some sort of bug in early implementation
});
await tx.table("summaries").toCollection().modify((entry, ref) => {
if(entry.messageIds === undefined) delete ref.value; // old summaries didn't have messageIds or prevSummaryHash
});
let memories = await tx.table("memories").toArray();
let userWrittenMemories = memories.filter(m => m.type === "user-written");
if(userWrittenMemories.length > 0) {
let loreEntries = [];
for(let m of userWrittenMemories) {
loreEntries.push({ bookId:m.threadId, text:m.text, embedding:m.embedding, triggers:[] });
}
await tx.table("lore").bulkAdd(loreEntries);
await tx.table("memories").toCollection().modify((entry, ref) => {
if(entry.type === "user-written") delete ref.value;
});
memories = memories.filter(m => m.type !== "user-written");
}
let memoryIdToIndexMap = createMemoryIdToIndexMapForIncorrectlyIndexedOrUnindexedMemories(memories);
await tx.table("memories").toCollection().modify(memory => {
let opts = {};
if(memoryIdToIndexMap[memory.id] !== undefined) opts.index = memoryIdToIndexMap[memory.id];
upgradeMemoryFromOldVersion(memory, opts);
});
await tx.table("lore").toCollection().modify(entry => {
upgradeLoreFromOldVersion(entry);
});
});
await db.open();
if(dbLoadingModal) dbLoadingModal.delete();
console.log("Database ready.");
function upgradeCharacterInitialMessagesArrayIfNeeded(character) {
// upgrade from the ["foo", "bar"] format to [{author:"user", content:"foo"}, {author:"ai", content:"bar"}]
if(character.initialMessages && character.initialMessages.length === 1 && character.initialMessages[0] === "") {
// bugfix:
character.initialMessages = [];
} else if(character.initialMessages && character.initialMessages.length > 0 && character.initialMessages[0] === "" && typeof character.initialMessages[1] === "object") {
// bugfix:
character.initialMessages = character.initialMessages.slice(1);
} else if(character.initialMessages && character.initialMessages.length > 0 && typeof character.initialMessages[0] === "string") {
// actual upgrade:
let author = "user";
for(let i = 0; i < character.initialMessages.length; i++) {
let content = character.initialMessages[i];
if(content === "") { // if first message is empty, this indicates that character maker wanted AI to speak first
author = (author === "user" ? "ai" : "user");
continue;
}
character.initialMessages[i] = {
author,
content,
};
author = (author === "user" ? "ai" : "user");
}
if(character.initialMessages[0] === "") character.initialMessages = character.initialMessages.slice(1);
}
}
function upgradeCharacterFromOldVersion(character) {
upgradeCharacterInitialMessagesArrayIfNeeded(character);
if(character.customCode === undefined) character.customCode = "";
if(character.modelVersion) {
character.modelName = character.modelVersion;
delete character.modelVersion;
}
if(character.textEmbeddingModelName === undefined) {
character.textEmbeddingModelName = character.associativeMemoryEmbeddingModelName ?? "text-embedding-ada-002";
delete character.associativeMemoryEmbeddingModelName;
}
if(character.userCharacter === undefined) character.userCharacter = {};
if(character.avatar === undefined) character.avatar = {url:character.avatarUrl, size:1, shape:"square"};
if(character.hasOwnProperty("avatarUrl")) delete character.avatarUrl;
if(character.scene === undefined) character.scene = {background:{}, music:{}};
if(character.streamingResponse === undefined) character.streamingResponse = true;
if(character.roleInstruction === undefined) {
character.roleInstruction = character.systemMessage;
delete character.systemMessage;
}
if(character.folderPath === undefined) character.folderPath = "";
if(character.uuid === undefined) character.uuid = null;
if(character.customData === undefined) character.customData = {};
if(character.systemCharacter === undefined) character.systemCharacter = {avatar:{}};
if(character.loreBookUrls === undefined) character.loreBookUrls = [];
if(character.associativeMemoryMethod !== undefined) {
character.autoGenerateMemories = character.associativeMemoryMethod;
delete character.associativeMemoryMethod;
}
if(character.autoGenerateMemories === undefined) {
character.autoGenerateMemories = "none"; // we need this because very old characters could have had not had a associativeMemoryMethod property at all (it didn't exist in the original schema)
}
if(character.maxTokensPerMessage === undefined) character.maxTokensPerMessage = null;
// WARNING: If you add something here, you'll likely have to edit:
// - characterDetailsPrompt (characterDetailsPrompt should return a valid character object - addCharacter only adds creationTime and lastMessageTime, so characterDetailsPrompt should fill in everything else, even if it's not visible in the editor)
// - getUserCharacterObj
// - getSystemCharacterObj
// - characterPropertiesVisibleToCustomCode
// - addThread - for things like `character.scene` where it's copied over to the thread at the start, and custom code can only edit it from there
// - the "share link" creation code (if you add any other private/user-specific data like id, lastMessageTime, etc.)
return character;
}
function upgradeMessageFromOldVersion(message) {
if(!message.variants) message.variants = [null]; // null is the placeholder for the currently-chosen variant (stored in `message.message`)
if(!message.hasOwnProperty("expectsReply")) message.expectsReply = undefined;
if(!message.hasOwnProperty("summaryHashUsed")) message.summaryHashUsed = undefined; // undefined means that we don't know whether a summary was used because the message was created before this 'summaryUsed' feature was added
if(message.memoryIdBatchesUsed === undefined) message.memoryIdBatchesUsed = [];
if(message.loreIdsUsed === undefined) message.loreIdsUsed = [];
if(message.scene === undefined) message.scene = null;
if(message.avatar === undefined) message.avatar = {};
if(message.customData === undefined) message.customData = {};
if(message.wrapperStyle === undefined) message.wrapperStyle = "";
if(message.memoryQueriesUsed === undefined) message.memoryQueriesUsed = [];
if(message.messageIdsUsed === undefined) message.messageIdsUsed = [];
if(message.order === undefined) message.order = message.id; // <-- this is a little hacky, but it works because id is auto-incremented, and `order` values don't need to be contiguous
if(message.instruction === undefined) message.instruction = null;
// WARNING: If you add something here, you may need to edit
// - createMessageObj
// - messagesToCustomCodeFormat and messagesFromCustomCodeFormat (if the data should be readable/writable from custom code)
return message;
}
async function upgradeThreadFromOldVersion(thread, opts={}) {
if(thread.isFav === undefined) thread.isFav = false;
if(thread.userCharacter === undefined) thread.userCharacter = {avatar:{}}; // this overrides the default user character object (for this specific thread)
if(thread.lastViewTime === undefined) thread.lastViewTime = thread.lastMessageTime;
if(thread.customCodeWindow === undefined) thread.customCodeWindow = {visible:false, width:null};
if(thread.customData === undefined) thread.customData = {};
if(thread.modelName === undefined) {
let character;
if(opts.characters) {// need this specifically for the db upgrade() function (i.e. not needed in import code) since modify can't be `async`, so we get all characters beforehand and pass them to this function
// oh and I now use this in the import code too because we need to pass in the *new* characters as well, since new threads can obviously reference them.
character = opts.characters.find(c => c.id === thread.characterId);
} else {
character = await db.characters.get(thread.characterId);
}
thread.modelName = character.modelName; // don't need to do good/great conversion here because that was not a feature previous to this change
}
if(thread.textEmbeddingModelName === undefined) {
let character;
if(opts.characters) character = opts.characters.find(c => c.id === thread.characterId);
else character = await db.characters.get(thread.characterId);
thread.textEmbeddingModelName = character.textEmbeddingModelName;
}
if(thread.folderPath === undefined) thread.folderPath = "";
if(thread.character === undefined) thread.character = {avatar:{}};
if(thread.systemCharacter === undefined) thread.systemCharacter = {avatar:{}}; // this overrides the default user character object (for this specific thread)