hfs 0.45.0 → 0.46.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (49) hide show
  1. package/README.md +7 -16
  2. package/admin/assets/index-963c15a5.js +517 -0
  3. package/{frontend/assets/sha512-b32d8af7.js → admin/assets/sha512-471fbd54.js} +2 -2
  4. package/admin/index.html +1 -1
  5. package/frontend/assets/index-c0f02a72.js +94 -0
  6. package/frontend/assets/index-f2f8fd6b.css +1 -0
  7. package/{admin/assets/sha512-c0389c0d.js → frontend/assets/sha512-7dcc825b.js} +2 -2
  8. package/frontend/fontello.css +1 -1
  9. package/frontend/index.html +2 -3
  10. package/package.json +4 -3
  11. package/plugins/download-counter/plugin.js +3 -1
  12. package/plugins/download-counter/public/main.js +3 -2
  13. package/plugins/list-uploader/plugin.js +21 -0
  14. package/plugins/list-uploader/public/main.js +27 -0
  15. package/plugins/vhosting/plugin.js +6 -3
  16. package/src/adminApis.js +9 -3
  17. package/src/api.auth.js +4 -4
  18. package/src/api.file_list.js +4 -5
  19. package/src/api.monitor.js +7 -5
  20. package/src/api.plugins.js +57 -13
  21. package/src/api.vfs.js +2 -1
  22. package/src/apiMiddleware.js +4 -0
  23. package/src/commands.js +11 -0
  24. package/src/config.js +9 -5
  25. package/src/connections.js +1 -1
  26. package/src/const.js +4 -3
  27. package/src/frontEndApis.js +33 -1
  28. package/src/github.js +65 -33
  29. package/src/index.js +4 -4
  30. package/src/lang.js +3 -2
  31. package/src/langs/embedded.js +2 -1
  32. package/src/langs/hfs-lang-fr.json +16 -4
  33. package/src/langs/hfs-lang-it.json +11 -4
  34. package/src/langs/hfs-lang-ru.json +16 -4
  35. package/src/langs/hfs-lang-vi.json +116 -0
  36. package/src/log.js +50 -47
  37. package/src/middlewares.js +10 -3
  38. package/src/plugins.js +181 -98
  39. package/src/serveFile.js +13 -5
  40. package/src/serveGuiFiles.js +8 -10
  41. package/src/throttler.js +11 -6
  42. package/src/update.js +1 -4
  43. package/src/upload.js +26 -9
  44. package/src/util-files.js +25 -6
  45. package/src/vfs.js +6 -12
  46. package/src/zip.js +2 -2
  47. package/admin/assets/index-101f19c9.js +0 -510
  48. package/frontend/assets/index-59572489.css +0 -1
  49. package/frontend/assets/index-5aeff3af.js +0 -94
@@ -0,0 +1 @@
1
+ @charset "UTF-8";:root{height:100dvh;--bg: #fff;--text: #555;--ghost-contrast: #8882;--ghost-contrast-alt: #eee;--faint-contrast: #8884;--mild-contrast: #8886;--good-contrast: #000a;--button-bg: #6080aa;--button-text: #eaeaea;--focus-color: #468;--separator: " – "}:root .highlightedText,:root .file-menu a:hover{color:#0006;text-shadow:0 0 3px rgba(0,0,0,.4)}:root .theme-dark{--bg: #000;--text: #999;--ghost-contrast-alt: #181818;--good-contrast: #fffa;--button-bg: #345;--button-text: #999;color-scheme:dark}:root .theme-dark .highlightedText,:root .theme-dark .file-menu a:hover,:root .file-menu .theme-dark a:hover{color:#fff;text-shadow:0 0 3px #fff}:root .theme-dark a{color:#8ac}:root .theme-dark .dialog-closer{background:#633}:root .theme-dark .dialog-icon{color:#ccc}:root .theme-dark .dialog-icon .icon{color:#aaa}:root .theme-dark .dialog-backdrop{background:rgba(51,51,51,.7333333333)}:root .theme-dark .error-msg{color:#b88;background-color:#623}:root .theme-dark button.toggled{color:#eee}body{background-color:var(--bg);margin:0;font-family:-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Oxygen,Ubuntu,Cantarell,Fira Sans,Droid Sans,Helvetica Neue,sans-serif;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale}body,button,select,input{font-size:12pt}#root>div{max-width:50em;margin:auto;min-height:100vh;display:flex;flex-direction:column}body,input{color:var(--text)}code{font-family:source-code-pro,Menlo,Monaco,Consolas,Courier New,monospace}input:not([type=checkbox]),select{padding:.3em .4em;border-radius:.5em;background:var(--bg);border-color:var(--mild-contrast);color:var(--good-contrast);max-width:100%;box-sizing:border-box;width:100%}input[type=checkbox]{transform:scale(1.7);accent-color:var(--button-bg)}label input[type=checkbox]{margin-right:.8em}select{text-align:center}.hidden{display:none!important}[class^=fa-]:before,[class*=" fa-"]:before{margin:0}.icon{font-size:1.2em;height:1.2em;width:1.4em}.emoji-icon,.file-icon{display:inline-block;width:1.4em;text-align:center}.file-icon{height:1em;background-size:contain;background-repeat:no-repeat;background-position:center;vertical-align:text-bottom}.icon.mirror:before{transform:scaleX(-1)}a{text-decoration:none;color:var(--button-bg)}button{background-color:var(--button-bg);color:var(--button-text);padding:.5em 1em;border:transparent;text-decoration:none;border-radius:.3em;vertical-align:middle;cursor:pointer}button:hover{outline:1px solid var(--mild-contrast)}button.toggled{color:#fff;text-shadow:0 0 3px #fff}button:focus-visible,.breadcrumb:focus-visible{outline:3px solid var(--focus-color)}a>button{width:100%}input:focus-visible,select:focus-visible,ul a:focus-visible{border-radius:.3em;border-color:transparent;outline:2px solid var(--focus-color)}.icon-button,ul.dir li .entry-panel .file-menu-button{font-size:.7em;padding:.2em .4em;margin-left:.4em;vertical-align:bottom}.error-msg{background-color:#faa;color:#833;padding:.5em 1em}.hide-back,.upload-toolbar,header{background-color:var(--bg)}header{position:sticky;top:0;padding:.2em .1em;z-index:3}.before-sliding{width:0!important;flex:0!important;margin:0!important;height:0!important;padding:0!important;overflow:hidden!important;transition:flex .5s}.show-sliding{transition:flex .5s;overflow:clip;flex:1;white-space:nowrap}.ani-working{animation:1s blink infinite}@keyframes blink{0%{opacity:1}50%{opacity:.2}}@keyframes spin{to{transform:rotate(360deg)}}@keyframes fade-in{0%{opacity:0}to{opacity:1}}.spinner,.icon.spinner:before{animation:1.5s spin infinite linear;display:inline-flex;justify-content:center;align-items:center;width:min-content}.breadcrumb{padding:.1em .6em .2em;line-height:1.8em;border-radius:.7em;background-color:var(--button-bg);color:var(--button-text);border-top:1px solid #666;margin-right:-.1em}.breadcrumb:nth-child(-n+3) .icon{padding:0 .2em}#folder-stats,#filter-bar>span{font-size:90%}#folder-stats{margin:.5em 0 0 .5em;float:right}#folder-stats .icon{margin-right:.3em}#filter{flex:1;box-sizing:border-box}#filter-bar{display:flex;align-items:center;gap:.8em;margin:.2em 0 0;padding:2px 0 1px 3px;height:1.8em}#filter-bar input[type=checkbox]{margin-top:.3em}#filter-bar span:empty{display:none}ul.dir{flex:1;padding:0;margin:0;clear:both}ul.dir>p{text-align:center}ul.dir li{display:block;list-style-type:none;padding:.3em .3em .4em;border-bottom:1px solid var(--faint-contrast)}ul.dir li:nth-of-type(odd){background-color:var(--ghost-contrast)}ul.dir li input[type=checkbox]{margin-right:1em}ul.dir li .link-wrapper:not(:hover) .popup-menu-button{display:none}ul.dir li .link-wrapper:hover{padding:1em;margin:-1em}ul.dir li .link-wrapper a:last-of-type{word-break:break-word;padding-right:.3em}ul.dir li .link-wrapper a .icon{margin-right:.5em;vertical-align:text-bottom;display:inline-block;text-align:center}ul.dir li .link-wrapper a:hover{text-decoration:underline}ul.dir li .entry-panel{float:right;padding-top:.3em;display:flex;align-items:center}ul.dir li .entry-panel .file-menu-button{margin:-3px 0 -3px .4em}ul.dir li .entry-panel .entry-details{font-size:90%;margin-left:4px;font-variant-numeric:tabular-nums}ul.dir li .entry-panel .entry-details .entry-size-unit{margin-left:.3em}ul.dir li>div:last-of-type{clear:both}ul.dir li.page-separator{margin-top:1em;position:relative}ul.dir li.page-separator:before{content:attr(label);position:absolute;top:-1.8em;font-size:smaller;margin-left:calc(50% - 1em);opacity:.9}#menu-bar{display:flex;justify-content:space-evenly;flex-wrap:wrap}#menu-bar>*{flex:1;margin:.1em}#menu-bar>*:first-child{margin-left:0}#menu-bar>*:last-child{margin-right:0}#menu-bar button{padding:min(1vh,.5em) 0}#searched{margin:.2em}#user-panel{display:flex;flex-direction:column;gap:1em}#user-panel a>button{width:100%}button label{cursor:inherit;margin-left:.7em}.dialog-backdrop.working{font-size:5em;animation:1s fade-in}.dialog-content{padding:.2em}.dialog-alert .dialog-content{text-align:center}.dialog-alert .dialog-content p{text-align:left;display:inline-block}.dialog{min-width:11em;--color: var(--button-bg)}.dialog-icon .icon{margin-left:-1px;font-size:95%;margin-top:.4em;border-radius:.6em 0}#paging{position:sticky;bottom:0;display:flex;gap:.1em;background-color:var(--bg);padding:0 .2em .2em}#paging>button{z-index:1}#paging button{box-shadow:0 0 .3em .3em #0003}#paging #paging-middle{padding:0 .5em;margin:0 -.3em;display:flex;gap:.5em;flex:1;overflow-x:auto}#paging #paging-middle>button{flex:1;padding-top:0;padding-bottom:0}#paging button{background:var(--button-bg);text-align:center;white-space:nowrap;padding:.5em}.upload-toolbar{position:sticky;top:-4px}.upload-progress:before{content:var(--separator)}.entry-size:after{content:var(--separator)}.upload-progress{min-width:4em;display:inline-block;margin-left:.5em}.upload-list td:nth-child(1){width:0}.upload-list td:nth-child(2){text-align:right;width:0;white-space:nowrap;padding-left:.5em}.upload-list td:nth-child(3){padding:.2em .5em;word-break:break-word}.dialog-login form{display:flex;flex-direction:column;gap:1.2em}.dialog-login label{display:block;margin-bottom:.5em;margin-left:.1em}.miss-perm{margin:.3em}.popup-menu-button{font-size:.8em;padding:.2em .3em;position:absolute;opacity:.8}.popup-menu-button:hover{opacity:1}.file-dialog .dialog-content{min-width:calc(100% - 1em)}.file-dialog .dialog{min-width:13em}.file-dialog-properties{word-break:break-word;line-height:1.5em;margin:0}.file-dialog-properties dt{font-weight:700}.file-dialog-properties dd{margin-left:1.5em}.file-menu{margin-top:1em;padding-top:1em;border-top:1px solid var(--faint-contrast);display:flex;flex-direction:column;gap:1em}.file-menu a .icon{margin-right:.5em}#root>.tiles-mode{max-width:none;margin:0 1em;--tile-size: 5;--name-lines: 3;--name-height: calc(4.7em + var(--tile-size) * .4em + 1.2em * var(--name-lines));--tile-width: calc(5em + 1em * var(--tile-size))}#root>.tiles-mode ul.dir{display:grid;grid-template-columns:repeat(auto-fill,minmax(var(--tile-width),1fr));grid-auto-rows:calc(var(--name-height) + 1.3em);gap:0 20px}#root>.tiles-mode ul.dir li{text-align:center;position:relative;display:flex;flex-direction:column;border-bottom:none;overflow-x:clip;padding:.5em 0 0}#root>.tiles-mode ul.dir li .link-wrapper:not(:hover){max-height:var(--name-height);display:block;display:-webkit-box;overflow:hidden;-webkit-line-clamp:calc(var(--name-lines) + 1);-webkit-box-orient:vertical}#root>.tiles-mode ul.dir li .link-wrapper a:last-of-type{padding:0}#root>.tiles-mode ul.dir li .link-wrapper a span{display:block}#root>.tiles-mode ul.dir li .link-wrapper a .icon.icon{font-size:calc(1.2rem + .6rem * var(--tile-size))}#root>.tiles-mode ul.dir li .link-wrapper a img.icon{width:auto;height:1em;padding:.1em 0}#root>.tiles-mode ul.dir li .link-wrapper a .icon{font-size:4rem;display:block;margin:auto}#root>.tiles-mode ul.dir li .link-wrapper:hover{overflow:visible;display:block;z-index:1}#root>.tiles-mode ul.dir li .link-wrapper:hover .icon:before{text-decoration:none}#root>.tiles-mode ul.dir li .link-wrapper:hover{padding:0;margin:0}#root>.tiles-mode ul.dir li:nth-of-type(odd){background-color:var(--bg)}#root>.tiles-mode ul.dir li .entry-panel{justify-content:center;font-size:10pt}#root>.tiles-mode ul.dir li .entry-details{font-size:80%}#root>.tiles-mode ul.dir li.page-separator:before{content:""}#root>.tiles-mode ul.dir li input[type=checkbox]{margin:0;position:absolute;top:.3em;right:1em}#root>.tiles-mode ul.dir li .link-wrapper a{display:inline}#root>.tiles-mode ul.dir li:hover{--bg: var(--ghost-contrast-alt);background:var(--bg)}#root>.tiles-mode ul.dir li:hover .link-wrapper,#root>.tiles-mode ul.dir li:hover .entry-panel{z-index:1;background:var(--bg)}#root>.tiles-mode ul.dir li:hover input[type=checkbox]{z-index:2}#root>.tiles-mode ul.dir li:hover .entry-panel{padding-bottom:.3em}#root>.tiles-mode .entry-size:after{content:none}#root>.tiles-mode .entry-ts{display:none}#root>.tiles-mode .popup-menu-button{position:absolute;top:0;left:0}#root>.tiles-mode #filter-bar{margin-bottom:1em}#root>.tiles-mode #paging{z-index:1}#root .file-show{--nav-size: min(25vh, 15vw)}#root .file-show>div{height:100%;width:100%}#root .file-show .showing{max-width:calc(100% - var(--nav-size) * 2);max-height:100%}#root .file-show img.showing{max-width:100%}#root .file-show .nav{position:absolute;margin:-.4em;font-size:var(--nav-size);cursor:pointer;opacity:.3;-webkit-text-stroke:2px black;user-select:none;transition:opacity .3s}#root .file-show .nav:hover{opacity:.7}#root .file-show .bar{padding:.5em 1em;background:var(--bg);opacity:.8;display:flex;flex-wrap:wrap;align-items:center;justify-content:flex-end;gap:.5em 1.5em}#root .file-show .bar .entry-details{font-size:smaller}#root .file-show .bar .entry-ts{display:inherit}#root .file-show .bar .entry-size:after{display:none}@media (min-width: 42em){body{scrollbar-width:thin;scrollbar-color:var(--button-bg) var(--ghost-contrast)}body::-webkit-scrollbar{width:12px}body::-webkit-scrollbar-track{background:var(--ghost-contrast)}body::-webkit-scrollbar-thumb{background-color:var(--button-bg);border-radius:20px;border:1px solid var(--ghost-contrast)}}@media (max-width: 42em){:root{--ghost-contrast: #8883}body,button,select{font-size:14pt}#menu-bar button label,#filter-bar button label{display:none}#filter-bar{margin-top:.4em}#filter-bar button{width:17.6vw;height:2.3em}.breadcrumb{word-break:break-all}.breadcrumb .icon{font-size:24px}#root>.tiles-mode{margin:0}}@media (max-height: 600px){.file-dialog .dialog-content{display:flex;gap:3em;margin:1em}.file-dialog .dialog-content .file-menu{margin-top:0;padding-top:0;border-top:none;margin-left:2em;padding-left:2em;border-left:1px solid var(--faint-contrast)}}@media (max-width: 42em),(max-height: 600px){#root>.tiles-mode .file-menu-button{font-size:1em;margin-top:.3em}}.dialog-backdrop{position:fixed;inset:0;background:#8886;backdrop-filter:blur(2px);display:flex;justify-content:center;align-items:center;z-index:1000}.dialog{background:#fff;background:var(--bg);padding:max(.5em,1vw,2vh);border-radius:1em;position:relative;margin:0 3vw;overflow:hidden;max-height:calc(100vh - 2em);display:flex;flex-direction:column;justify-content:center}.dialog-icon{color:#fff;background-color:var(--color);position:absolute;top:0;width:2em;height:1.8em;text-align:center;border-radius:.8em 0}.dialog-title{font-size:120%;margin-top:-.4em;padding:0 .5em;min-height:1.2em}.dialog-closer~.dialog-title{margin-right:2em}.dialog-type~.dialog-title{margin-left:2em}.dialog-icon~.dialog-title{text-align:center}.dialog-closer{border-radius:0 .8em;right:0;padding:0;background-color:#c88}.dialog-icon~.dialog-content{margin-top:.5em}.dialog-type{left:0;top:0;overflow:hidden;line-height:1.8em;opacity:.8}.dialog-content{overflow:auto;max-height:calc(100vh - 4.5em)}.dialog-content p{white-space:pre-wrap;margin:.5em 0}.dialog-confirm .dialog-content button{margin-top:1em}.dialog-alert-info{--color: #282 }.dialog-alert-warning{--color: #c91 }.dialog-alert-error{--color: #822}@media (max-width: 42em){.dialog-icon{font-size:120%}.dialog-icon~.dialog-content{margin-top:1.5em}.dialog-title{margin-top:-.2em}}.dialog-prompt label{display:block;margin:.5em .1em}
@@ -1,8 +1,8 @@
1
- import{c as SF}from"./index-101f19c9.js";function OF(iF,hF){for(var eF=0;eF<hF.length;eF++){const tF=hF[eF];if(typeof tF!="string"&&!Array.isArray(tF)){for(const w in tF)if(w!=="default"&&!(w in iF)){const lF=Object.getOwnPropertyDescriptor(tF,w);lF&&Object.defineProperty(iF,w,lF.get?lF:{enumerable:!0,get:()=>tF[w]})}}}return Object.freeze(Object.defineProperty(iF,Symbol.toStringTag,{value:"Module"}))}var EF={},UF={get exports(){return EF},set exports(iF){EF=iF}};/*
1
+ import{g as OF,c as UF}from"./index-c0f02a72.js";function gF(sF,hF){for(var eF=0;eF<hF.length;eF++){const tF=hF[eF];if(typeof tF!="string"&&!Array.isArray(tF)){for(const w in tF)if(w!=="default"&&!(w in sF)){const lF=Object.getOwnPropertyDescriptor(tF,w);lF&&Object.defineProperty(sF,w,lF.get?lF:{enumerable:!0,get:()=>tF[w]})}}}return Object.freeze(Object.defineProperty(sF,Symbol.toStringTag,{value:"Module"}))}var dF={exports:{}};/*
2
2
  * [js-sha512]{@link https://github.com/emn178/js-sha512}
3
3
  *
4
4
  * @version 0.8.0
5
5
  * @author Chen, Yi-Cyuan [emn178@gmail.com]
6
6
  * @copyright Chen, Yi-Cyuan 2014-2018
7
7
  * @license MIT
8
- */(function(iF){(function(){var hF="input is invalid type",eF="finalize already called",tF=typeof window=="object",w=tF?window:{};w.JS_SHA512_NO_WINDOW&&(tF=!1);var lF=!tF&&typeof self=="object",_F=!w.JS_SHA512_NO_NODE_JS&&typeof process=="object"&&process.versions&&process.versions.node;_F?w=SF:lF&&(w=self);var bF=!w.JS_SHA512_NO_COMMON_JS&&!0&&iF.exports,aF=!w.JS_SHA512_NO_ARRAY_BUFFER&&typeof ArrayBuffer!="undefined",F="0123456789abcdef".split(""),wF=[-2147483648,8388608,32768,128],xF=[24,16,8,0],sF=[1116352408,3609767458,1899447441,602891725,3049323471,3964484399,3921009573,2173295548,961987163,4081628472,1508970993,3053834265,2453635748,2937671579,2870763221,3664609560,3624381080,2734883394,310598401,1164996542,607225278,1323610764,1426881987,3590304994,1925078388,4068182383,2162078206,991336113,2614888103,633803317,3248222580,3479774868,3835390401,2666613458,4022224774,944711139,264347078,2341262773,604807628,2007800933,770255983,1495990901,1249150122,1856431235,1555081692,3175218132,1996064986,2198950837,2554220882,3999719339,2821834349,766784016,2952996808,2566594879,3210313671,3203337956,3336571891,1034457026,3584528711,2466948901,113926993,3758326383,338241895,168717936,666307205,1188179964,773529912,1546045734,1294757372,1522805485,1396182291,2643833823,1695183700,2343527390,1986661051,1014477480,2177026350,1206759142,2456956037,344077627,2730485921,1290863460,2820302411,3158454273,3259730800,3505952657,3345764771,106217008,3516065817,3606008344,3600352804,1432725776,4094571909,1467031594,275423344,851169720,430227734,3100823752,506948616,1363258195,659060556,3750685593,883997877,3785050280,958139571,3318307427,1322822218,3812723403,1537002063,2003034995,1747873779,3602036899,1955562222,1575990012,2024104815,1125592928,2227730452,2716904306,2361852424,442776044,2428436474,593698344,2756734187,3733110249,3204031479,2999351573,3329325298,3815920427,3391569614,3928383900,3515267271,566280711,3940187606,3454069534,4118630271,4000239992,116418474,1914138554,174292421,2731055270,289380356,3203993006,460393269,320620315,685471733,587496836,852142971,1086792851,1017036298,365543100,1126000580,2618297676,1288033470,3409855158,1501505948,4234509866,1607167915,987167468,1816402316,1246189591],fF=["hex","array","digest","arrayBuffer"],C=[];(w.JS_SHA512_NO_NODE_JS||!Array.isArray)&&(Array.isArray=function(x){return Object.prototype.toString.call(x)==="[object Array]"}),aF&&(w.JS_SHA512_NO_ARRAY_BUFFER_IS_VIEW||!ArrayBuffer.isView)&&(ArrayBuffer.isView=function(x){return typeof x=="object"&&x.buffer&&x.buffer.constructor===ArrayBuffer});var vF=function(x,r){return function(e){return new v(r,!0).update(e)[x]()}},nF=function(x){var r=vF("hex",x);r.create=function(){return new v(x)},r.update=function(B){return r.create().update(B)};for(var e=0;e<fF.length;++e){var o=fF[e];r[o]=vF(o,x)}return r},dF=function(x,r){return function(e,o){return new rF(e,r,!0).update(o)[x]()}},oF=function(x){var r=dF("hex",x);r.create=function(B){return new rF(B,x)},r.update=function(B,l){return r.create(B).update(l)};for(var e=0;e<fF.length;++e){var o=fF[e];r[o]=dF(o,x)}return r};function v(x,r){r?(C[0]=C[1]=C[2]=C[3]=C[4]=C[5]=C[6]=C[7]=C[8]=C[9]=C[10]=C[11]=C[12]=C[13]=C[14]=C[15]=C[16]=C[17]=C[18]=C[19]=C[20]=C[21]=C[22]=C[23]=C[24]=C[25]=C[26]=C[27]=C[28]=C[29]=C[30]=C[31]=C[32]=0,this.blocks=C):this.blocks=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],x==384?(this.h0h=3418070365,this.h0l=3238371032,this.h1h=1654270250,this.h1l=914150663,this.h2h=2438529370,this.h2l=812702999,this.h3h=355462360,this.h3l=4144912697,this.h4h=1731405415,this.h4l=4290775857,this.h5h=2394180231,this.h5l=1750603025,this.h6h=3675008525,this.h6l=1694076839,this.h7h=1203062813,this.h7l=3204075428):x==256?(this.h0h=573645204,this.h0l=4230739756,this.h1h=2673172387,this.h1l=3360449730,this.h2h=596883563,this.h2l=1867755857,this.h3h=2520282905,this.h3l=1497426621,this.h4h=2519219938,this.h4l=2827943907,this.h5h=3193839141,this.h5l=1401305490,this.h6h=721525244,this.h6l=746961066,this.h7h=246885852,this.h7l=2177182882):x==224?(this.h0h=2352822216,this.h0l=424955298,this.h1h=1944164710,this.h1l=2312950998,this.h2h=502970286,this.h2l=855612546,this.h3h=1738396948,this.h3l=1479516111,this.h4h=258812777,this.h4l=2077511080,this.h5h=2011393907,this.h5l=79989058,this.h6h=1067287976,this.h6l=1780299464,this.h7h=286451373,this.h7l=2446758561):(this.h0h=1779033703,this.h0l=4089235720,this.h1h=3144134277,this.h1l=2227873595,this.h2h=1013904242,this.h2l=4271175723,this.h3h=2773480762,this.h3l=1595750129,this.h4h=1359893119,this.h4l=2917565137,this.h5h=2600822924,this.h5l=725511199,this.h6h=528734635,this.h6l=4215389547,this.h7h=1541459225,this.h7l=327033209),this.bits=x,this.block=this.start=this.bytes=this.hBytes=0,this.finalized=this.hashed=!1}v.prototype.update=function(x){if(this.finalized)throw new Error(eF);var r,e=typeof x;if(e!=="string"){if(e==="object"){if(x===null)throw new Error(hF);if(aF&&x.constructor===ArrayBuffer)x=new Uint8Array(x);else if(!Array.isArray(x)&&(!aF||!ArrayBuffer.isView(x)))throw new Error(hF)}else throw new Error(hF);r=!0}for(var o,B=0,l,c=x.length,s=this.blocks;B<c;){if(this.hashed&&(this.hashed=!1,s[0]=this.block,s[1]=s[2]=s[3]=s[4]=s[5]=s[6]=s[7]=s[8]=s[9]=s[10]=s[11]=s[12]=s[13]=s[14]=s[15]=s[16]=s[17]=s[18]=s[19]=s[20]=s[21]=s[22]=s[23]=s[24]=s[25]=s[26]=s[27]=s[28]=s[29]=s[30]=s[31]=s[32]=0),r)for(l=this.start;B<c&&l<128;++B)s[l>>2]|=x[B]<<xF[l++&3];else for(l=this.start;B<c&&l<128;++B)o=x.charCodeAt(B),o<128?s[l>>2]|=o<<xF[l++&3]:o<2048?(s[l>>2]|=(192|o>>6)<<xF[l++&3],s[l>>2]|=(128|o&63)<<xF[l++&3]):o<55296||o>=57344?(s[l>>2]|=(224|o>>12)<<xF[l++&3],s[l>>2]|=(128|o>>6&63)<<xF[l++&3],s[l>>2]|=(128|o&63)<<xF[l++&3]):(o=65536+((o&1023)<<10|x.charCodeAt(++B)&1023),s[l>>2]|=(240|o>>18)<<xF[l++&3],s[l>>2]|=(128|o>>12&63)<<xF[l++&3],s[l>>2]|=(128|o>>6&63)<<xF[l++&3],s[l>>2]|=(128|o&63)<<xF[l++&3]);this.lastByteIndex=l,this.bytes+=l-this.start,l>=128?(this.block=s[32],this.start=l-128,this.hash(),this.hashed=!0):this.start=l}return this.bytes>4294967295&&(this.hBytes+=this.bytes/4294967296<<0,this.bytes=this.bytes%4294967296),this},v.prototype.finalize=function(){if(!this.finalized){this.finalized=!0;var x=this.blocks,r=this.lastByteIndex;x[32]=this.block,x[r>>2]|=wF[r&3],this.block=x[32],r>=112&&(this.hashed||this.hash(),x[0]=this.block,x[1]=x[2]=x[3]=x[4]=x[5]=x[6]=x[7]=x[8]=x[9]=x[10]=x[11]=x[12]=x[13]=x[14]=x[15]=x[16]=x[17]=x[18]=x[19]=x[20]=x[21]=x[22]=x[23]=x[24]=x[25]=x[26]=x[27]=x[28]=x[29]=x[30]=x[31]=x[32]=0),x[30]=this.hBytes<<3|this.bytes>>>29,x[31]=this.bytes<<3,this.hash()}},v.prototype.hash=function(){var x=this.h0h,r=this.h0l,e=this.h1h,o=this.h1l,B=this.h2h,l=this.h2l,c=this.h3h,s=this.h3l,E=this.h4h,D=this.h4l,d=this.h5h,_=this.h5l,b=this.h6h,S=this.h6l,O=this.h7h,U=this.h7l,y=this.blocks,A,z,P,H,I,h,t,i,a,CF,cF,DF,uF,pF,yF,AF,BF,Z,q,f,n,u,p,Q,FF;for(A=32;A<160;A+=2)f=y[A-30],n=y[A-29],z=(f>>>1|n<<31)^(f>>>8|n<<24)^f>>>7,P=(n>>>1|f<<31)^(n>>>8|f<<24)^(n>>>7|f<<25),f=y[A-4],n=y[A-3],H=(f>>>19|n<<13)^(n>>>29|f<<3)^f>>>6,I=(n>>>19|f<<13)^(f>>>29|n<<3)^(n>>>6|f<<26),f=y[A-32],n=y[A-31],u=y[A-14],p=y[A-13],h=(p&65535)+(n&65535)+(P&65535)+(I&65535),t=(p>>>16)+(n>>>16)+(P>>>16)+(I>>>16)+(h>>>16),i=(u&65535)+(f&65535)+(z&65535)+(H&65535)+(t>>>16),a=(u>>>16)+(f>>>16)+(z>>>16)+(H>>>16)+(i>>>16),y[A]=a<<16|i&65535,y[A+1]=t<<16|h&65535;var J=x,M=r,g=e,R=o,j=B,N=l,T=c,K=s,m=E,V=D,W=d,k=_,Y=b,X=S,$=O,G=U;for(AF=g&j,BF=R&N,A=0;A<160;A+=8)z=(J>>>28|M<<4)^(M>>>2|J<<30)^(M>>>7|J<<25),P=(M>>>28|J<<4)^(J>>>2|M<<30)^(J>>>7|M<<25),H=(m>>>14|V<<18)^(m>>>18|V<<14)^(V>>>9|m<<23),I=(V>>>14|m<<18)^(V>>>18|m<<14)^(m>>>9|V<<23),CF=J&g,cF=M&R,Z=CF^J&j^AF,q=cF^M&N^BF,Q=m&W^~m&Y,FF=V&k^~V&X,f=y[A],n=y[A+1],u=sF[A],p=sF[A+1],h=(p&65535)+(n&65535)+(FF&65535)+(I&65535)+(G&65535),t=(p>>>16)+(n>>>16)+(FF>>>16)+(I>>>16)+(G>>>16)+(h>>>16),i=(u&65535)+(f&65535)+(Q&65535)+(H&65535)+($&65535)+(t>>>16),a=(u>>>16)+(f>>>16)+(Q>>>16)+(H>>>16)+($>>>16)+(i>>>16),f=a<<16|i&65535,n=t<<16|h&65535,h=(q&65535)+(P&65535),t=(q>>>16)+(P>>>16)+(h>>>16),i=(Z&65535)+(z&65535)+(t>>>16),a=(Z>>>16)+(z>>>16)+(i>>>16),u=a<<16|i&65535,p=t<<16|h&65535,h=(K&65535)+(n&65535),t=(K>>>16)+(n>>>16)+(h>>>16),i=(T&65535)+(f&65535)+(t>>>16),a=(T>>>16)+(f>>>16)+(i>>>16),$=a<<16|i&65535,G=t<<16|h&65535,h=(p&65535)+(n&65535),t=(p>>>16)+(n>>>16)+(h>>>16),i=(u&65535)+(f&65535)+(t>>>16),a=(u>>>16)+(f>>>16)+(i>>>16),T=a<<16|i&65535,K=t<<16|h&65535,z=(T>>>28|K<<4)^(K>>>2|T<<30)^(K>>>7|T<<25),P=(K>>>28|T<<4)^(T>>>2|K<<30)^(T>>>7|K<<25),H=($>>>14|G<<18)^($>>>18|G<<14)^(G>>>9|$<<23),I=(G>>>14|$<<18)^(G>>>18|$<<14)^($>>>9|G<<23),DF=T&J,uF=K&M,Z=DF^T&g^CF,q=uF^K&R^cF,Q=$&m^~$&W,FF=G&V^~G&k,f=y[A+2],n=y[A+3],u=sF[A+2],p=sF[A+3],h=(p&65535)+(n&65535)+(FF&65535)+(I&65535)+(X&65535),t=(p>>>16)+(n>>>16)+(FF>>>16)+(I>>>16)+(X>>>16)+(h>>>16),i=(u&65535)+(f&65535)+(Q&65535)+(H&65535)+(Y&65535)+(t>>>16),a=(u>>>16)+(f>>>16)+(Q>>>16)+(H>>>16)+(Y>>>16)+(i>>>16),f=a<<16|i&65535,n=t<<16|h&65535,h=(q&65535)+(P&65535),t=(q>>>16)+(P>>>16)+(h>>>16),i=(Z&65535)+(z&65535)+(t>>>16),a=(Z>>>16)+(z>>>16)+(i>>>16),u=a<<16|i&65535,p=t<<16|h&65535,h=(N&65535)+(n&65535),t=(N>>>16)+(n>>>16)+(h>>>16),i=(j&65535)+(f&65535)+(t>>>16),a=(j>>>16)+(f>>>16)+(i>>>16),Y=a<<16|i&65535,X=t<<16|h&65535,h=(p&65535)+(n&65535),t=(p>>>16)+(n>>>16)+(h>>>16),i=(u&65535)+(f&65535)+(t>>>16),a=(u>>>16)+(f>>>16)+(i>>>16),j=a<<16|i&65535,N=t<<16|h&65535,z=(j>>>28|N<<4)^(N>>>2|j<<30)^(N>>>7|j<<25),P=(N>>>28|j<<4)^(j>>>2|N<<30)^(j>>>7|N<<25),H=(Y>>>14|X<<18)^(Y>>>18|X<<14)^(X>>>9|Y<<23),I=(X>>>14|Y<<18)^(X>>>18|Y<<14)^(Y>>>9|X<<23),pF=j&T,yF=N&K,Z=pF^j&J^DF,q=yF^N&M^uF,Q=Y&$^~Y&m,FF=X&G^~X&V,f=y[A+4],n=y[A+5],u=sF[A+4],p=sF[A+5],h=(p&65535)+(n&65535)+(FF&65535)+(I&65535)+(k&65535),t=(p>>>16)+(n>>>16)+(FF>>>16)+(I>>>16)+(k>>>16)+(h>>>16),i=(u&65535)+(f&65535)+(Q&65535)+(H&65535)+(W&65535)+(t>>>16),a=(u>>>16)+(f>>>16)+(Q>>>16)+(H>>>16)+(W>>>16)+(i>>>16),f=a<<16|i&65535,n=t<<16|h&65535,h=(q&65535)+(P&65535),t=(q>>>16)+(P>>>16)+(h>>>16),i=(Z&65535)+(z&65535)+(t>>>16),a=(Z>>>16)+(z>>>16)+(i>>>16),u=a<<16|i&65535,p=t<<16|h&65535,h=(R&65535)+(n&65535),t=(R>>>16)+(n>>>16)+(h>>>16),i=(g&65535)+(f&65535)+(t>>>16),a=(g>>>16)+(f>>>16)+(i>>>16),W=a<<16|i&65535,k=t<<16|h&65535,h=(p&65535)+(n&65535),t=(p>>>16)+(n>>>16)+(h>>>16),i=(u&65535)+(f&65535)+(t>>>16),a=(u>>>16)+(f>>>16)+(i>>>16),g=a<<16|i&65535,R=t<<16|h&65535,z=(g>>>28|R<<4)^(R>>>2|g<<30)^(R>>>7|g<<25),P=(R>>>28|g<<4)^(g>>>2|R<<30)^(g>>>7|R<<25),H=(W>>>14|k<<18)^(W>>>18|k<<14)^(k>>>9|W<<23),I=(k>>>14|W<<18)^(k>>>18|W<<14)^(W>>>9|k<<23),AF=g&j,BF=R&N,Z=AF^g&T^pF,q=BF^R&K^yF,Q=W&Y^~W&$,FF=k&X^~k&G,f=y[A+6],n=y[A+7],u=sF[A+6],p=sF[A+7],h=(p&65535)+(n&65535)+(FF&65535)+(I&65535)+(V&65535),t=(p>>>16)+(n>>>16)+(FF>>>16)+(I>>>16)+(V>>>16)+(h>>>16),i=(u&65535)+(f&65535)+(Q&65535)+(H&65535)+(m&65535)+(t>>>16),a=(u>>>16)+(f>>>16)+(Q>>>16)+(H>>>16)+(m>>>16)+(i>>>16),f=a<<16|i&65535,n=t<<16|h&65535,h=(q&65535)+(P&65535),t=(q>>>16)+(P>>>16)+(h>>>16),i=(Z&65535)+(z&65535)+(t>>>16),a=(Z>>>16)+(z>>>16)+(i>>>16),u=a<<16|i&65535,p=t<<16|h&65535,h=(M&65535)+(n&65535),t=(M>>>16)+(n>>>16)+(h>>>16),i=(J&65535)+(f&65535)+(t>>>16),a=(J>>>16)+(f>>>16)+(i>>>16),m=a<<16|i&65535,V=t<<16|h&65535,h=(p&65535)+(n&65535),t=(p>>>16)+(n>>>16)+(h>>>16),i=(u&65535)+(f&65535)+(t>>>16),a=(u>>>16)+(f>>>16)+(i>>>16),J=a<<16|i&65535,M=t<<16|h&65535;h=(r&65535)+(M&65535),t=(r>>>16)+(M>>>16)+(h>>>16),i=(x&65535)+(J&65535)+(t>>>16),a=(x>>>16)+(J>>>16)+(i>>>16),this.h0h=a<<16|i&65535,this.h0l=t<<16|h&65535,h=(o&65535)+(R&65535),t=(o>>>16)+(R>>>16)+(h>>>16),i=(e&65535)+(g&65535)+(t>>>16),a=(e>>>16)+(g>>>16)+(i>>>16),this.h1h=a<<16|i&65535,this.h1l=t<<16|h&65535,h=(l&65535)+(N&65535),t=(l>>>16)+(N>>>16)+(h>>>16),i=(B&65535)+(j&65535)+(t>>>16),a=(B>>>16)+(j>>>16)+(i>>>16),this.h2h=a<<16|i&65535,this.h2l=t<<16|h&65535,h=(s&65535)+(K&65535),t=(s>>>16)+(K>>>16)+(h>>>16),i=(c&65535)+(T&65535)+(t>>>16),a=(c>>>16)+(T>>>16)+(i>>>16),this.h3h=a<<16|i&65535,this.h3l=t<<16|h&65535,h=(D&65535)+(V&65535),t=(D>>>16)+(V>>>16)+(h>>>16),i=(E&65535)+(m&65535)+(t>>>16),a=(E>>>16)+(m>>>16)+(i>>>16),this.h4h=a<<16|i&65535,this.h4l=t<<16|h&65535,h=(_&65535)+(k&65535),t=(_>>>16)+(k>>>16)+(h>>>16),i=(d&65535)+(W&65535)+(t>>>16),a=(d>>>16)+(W>>>16)+(i>>>16),this.h5h=a<<16|i&65535,this.h5l=t<<16|h&65535,h=(S&65535)+(X&65535),t=(S>>>16)+(X>>>16)+(h>>>16),i=(b&65535)+(Y&65535)+(t>>>16),a=(b>>>16)+(Y>>>16)+(i>>>16),this.h6h=a<<16|i&65535,this.h6l=t<<16|h&65535,h=(U&65535)+(G&65535),t=(U>>>16)+(G>>>16)+(h>>>16),i=(O&65535)+($&65535)+(t>>>16),a=(O>>>16)+($>>>16)+(i>>>16),this.h7h=a<<16|i&65535,this.h7l=t<<16|h&65535},v.prototype.hex=function(){this.finalize();var x=this.h0h,r=this.h0l,e=this.h1h,o=this.h1l,B=this.h2h,l=this.h2l,c=this.h3h,s=this.h3l,E=this.h4h,D=this.h4l,d=this.h5h,_=this.h5l,b=this.h6h,S=this.h6l,O=this.h7h,U=this.h7l,y=this.bits,A=F[x>>28&15]+F[x>>24&15]+F[x>>20&15]+F[x>>16&15]+F[x>>12&15]+F[x>>8&15]+F[x>>4&15]+F[x&15]+F[r>>28&15]+F[r>>24&15]+F[r>>20&15]+F[r>>16&15]+F[r>>12&15]+F[r>>8&15]+F[r>>4&15]+F[r&15]+F[e>>28&15]+F[e>>24&15]+F[e>>20&15]+F[e>>16&15]+F[e>>12&15]+F[e>>8&15]+F[e>>4&15]+F[e&15]+F[o>>28&15]+F[o>>24&15]+F[o>>20&15]+F[o>>16&15]+F[o>>12&15]+F[o>>8&15]+F[o>>4&15]+F[o&15]+F[B>>28&15]+F[B>>24&15]+F[B>>20&15]+F[B>>16&15]+F[B>>12&15]+F[B>>8&15]+F[B>>4&15]+F[B&15]+F[l>>28&15]+F[l>>24&15]+F[l>>20&15]+F[l>>16&15]+F[l>>12&15]+F[l>>8&15]+F[l>>4&15]+F[l&15]+F[c>>28&15]+F[c>>24&15]+F[c>>20&15]+F[c>>16&15]+F[c>>12&15]+F[c>>8&15]+F[c>>4&15]+F[c&15];return y>=256&&(A+=F[s>>28&15]+F[s>>24&15]+F[s>>20&15]+F[s>>16&15]+F[s>>12&15]+F[s>>8&15]+F[s>>4&15]+F[s&15]),y>=384&&(A+=F[E>>28&15]+F[E>>24&15]+F[E>>20&15]+F[E>>16&15]+F[E>>12&15]+F[E>>8&15]+F[E>>4&15]+F[E&15]+F[D>>28&15]+F[D>>24&15]+F[D>>20&15]+F[D>>16&15]+F[D>>12&15]+F[D>>8&15]+F[D>>4&15]+F[D&15]+F[d>>28&15]+F[d>>24&15]+F[d>>20&15]+F[d>>16&15]+F[d>>12&15]+F[d>>8&15]+F[d>>4&15]+F[d&15]+F[_>>28&15]+F[_>>24&15]+F[_>>20&15]+F[_>>16&15]+F[_>>12&15]+F[_>>8&15]+F[_>>4&15]+F[_&15]),y==512&&(A+=F[b>>28&15]+F[b>>24&15]+F[b>>20&15]+F[b>>16&15]+F[b>>12&15]+F[b>>8&15]+F[b>>4&15]+F[b&15]+F[S>>28&15]+F[S>>24&15]+F[S>>20&15]+F[S>>16&15]+F[S>>12&15]+F[S>>8&15]+F[S>>4&15]+F[S&15]+F[O>>28&15]+F[O>>24&15]+F[O>>20&15]+F[O>>16&15]+F[O>>12&15]+F[O>>8&15]+F[O>>4&15]+F[O&15]+F[U>>28&15]+F[U>>24&15]+F[U>>20&15]+F[U>>16&15]+F[U>>12&15]+F[U>>8&15]+F[U>>4&15]+F[U&15]),A},v.prototype.toString=v.prototype.hex,v.prototype.digest=function(){this.finalize();var x=this.h0h,r=this.h0l,e=this.h1h,o=this.h1l,B=this.h2h,l=this.h2l,c=this.h3h,s=this.h3l,E=this.h4h,D=this.h4l,d=this.h5h,_=this.h5l,b=this.h6h,S=this.h6l,O=this.h7h,U=this.h7l,y=this.bits,A=[x>>24&255,x>>16&255,x>>8&255,x&255,r>>24&255,r>>16&255,r>>8&255,r&255,e>>24&255,e>>16&255,e>>8&255,e&255,o>>24&255,o>>16&255,o>>8&255,o&255,B>>24&255,B>>16&255,B>>8&255,B&255,l>>24&255,l>>16&255,l>>8&255,l&255,c>>24&255,c>>16&255,c>>8&255,c&255];return y>=256&&A.push(s>>24&255,s>>16&255,s>>8&255,s&255),y>=384&&A.push(E>>24&255,E>>16&255,E>>8&255,E&255,D>>24&255,D>>16&255,D>>8&255,D&255,d>>24&255,d>>16&255,d>>8&255,d&255,_>>24&255,_>>16&255,_>>8&255,_&255),y==512&&A.push(b>>24&255,b>>16&255,b>>8&255,b&255,S>>24&255,S>>16&255,S>>8&255,S&255,O>>24&255,O>>16&255,O>>8&255,O&255,U>>24&255,U>>16&255,U>>8&255,U&255),A},v.prototype.array=v.prototype.digest,v.prototype.arrayBuffer=function(){this.finalize();var x=this.bits,r=new ArrayBuffer(x/8),e=new DataView(r);return e.setUint32(0,this.h0h),e.setUint32(4,this.h0l),e.setUint32(8,this.h1h),e.setUint32(12,this.h1l),e.setUint32(16,this.h2h),e.setUint32(20,this.h2l),e.setUint32(24,this.h3h),x>=256&&e.setUint32(28,this.h3l),x>=384&&(e.setUint32(32,this.h4h),e.setUint32(36,this.h4l),e.setUint32(40,this.h5h),e.setUint32(44,this.h5l)),x==512&&(e.setUint32(48,this.h6h),e.setUint32(52,this.h6l),e.setUint32(56,this.h7h),e.setUint32(60,this.h7l)),r},v.prototype.clone=function(){var x=new v(this.bits,!1);return this.copyTo(x),x},v.prototype.copyTo=function(x){var r=0,e=["h0h","h0l","h1h","h1l","h2h","h2l","h3h","h3l","h4h","h4l","h5h","h5l","h6h","h6l","h7h","h7l","start","bytes","hBytes","finalized","hashed","lastByteIndex"];for(r=0;r<e.length;++r)x[e[r]]=this[e[r]];for(r=0;r<this.blocks.length;++r)x.blocks[r]=this.blocks[r]};function rF(x,r,e){var o,B=typeof x;if(B!=="string"){if(B==="object"){if(x===null)throw new Error(hF);if(aF&&x.constructor===ArrayBuffer)x=new Uint8Array(x);else if(!Array.isArray(x)&&(!aF||!ArrayBuffer.isView(x)))throw new Error(hF)}else throw new Error(hF);o=!0}var l=x.length;if(!o){for(var c=[],l=x.length,s=0,E,D=0;D<l;++D)E=x.charCodeAt(D),E<128?c[s++]=E:E<2048?(c[s++]=192|E>>6,c[s++]=128|E&63):E<55296||E>=57344?(c[s++]=224|E>>12,c[s++]=128|E>>6&63,c[s++]=128|E&63):(E=65536+((E&1023)<<10|x.charCodeAt(++D)&1023),c[s++]=240|E>>18,c[s++]=128|E>>12&63,c[s++]=128|E>>6&63,c[s++]=128|E&63);x=c}x.length>128&&(x=new v(r,!0).update(x).array());for(var d=[],_=[],D=0;D<128;++D){var b=x[D]||0;d[D]=92^b,_[D]=54^b}v.call(this,r,e),this.update(_),this.oKeyPad=d,this.inner=!0,this.sharedMemory=e}rF.prototype=new v,rF.prototype.finalize=function(){if(v.prototype.finalize.call(this),this.inner){this.inner=!1;var x=this.array();v.call(this,this.bits,this.sharedMemory),this.update(this.oKeyPad),this.update(x),v.prototype.finalize.call(this)}},rF.prototype.clone=function(){var x=new rF([],this.bits,!1);this.copyTo(x),x.inner=this.inner;for(var r=0;r<this.oKeyPad.length;++r)x.oKeyPad[r]=this.oKeyPad[r];return x};var L=nF(512);L.sha512=L,L.sha384=nF(384),L.sha512_256=nF(256),L.sha512_224=nF(224),L.sha512.hmac=oF(512),L.sha384.hmac=oF(384),L.sha512_256.hmac=oF(256),L.sha512_224.hmac=oF(224),bF?iF.exports=L:(w.sha512=L.sha512,w.sha384=L.sha384,w.sha512_256=L.sha512_256,w.sha512_224=L.sha512_224)})()})(UF);const gF=EF,jF=OF({__proto__:null,default:gF},[EF]);export{jF as s};
8
+ */(function(sF){(function(){var hF="input is invalid type",eF="finalize already called",tF=typeof window=="object",w=tF?window:{};w.JS_SHA512_NO_WINDOW&&(tF=!1);var lF=!tF&&typeof self=="object",bF=!w.JS_SHA512_NO_NODE_JS&&typeof process=="object"&&process.versions&&process.versions.node;bF?w=UF:lF&&(w=self);var wF=!w.JS_SHA512_NO_COMMON_JS&&!0&&sF.exports,aF=!w.JS_SHA512_NO_ARRAY_BUFFER&&typeof ArrayBuffer!="undefined",F="0123456789abcdef".split(""),SF=[-2147483648,8388608,32768,128],xF=[24,16,8,0],iF=[1116352408,3609767458,1899447441,602891725,3049323471,3964484399,3921009573,2173295548,961987163,4081628472,1508970993,3053834265,2453635748,2937671579,2870763221,3664609560,3624381080,2734883394,310598401,1164996542,607225278,1323610764,1426881987,3590304994,1925078388,4068182383,2162078206,991336113,2614888103,633803317,3248222580,3479774868,3835390401,2666613458,4022224774,944711139,264347078,2341262773,604807628,2007800933,770255983,1495990901,1249150122,1856431235,1555081692,3175218132,1996064986,2198950837,2554220882,3999719339,2821834349,766784016,2952996808,2566594879,3210313671,3203337956,3336571891,1034457026,3584528711,2466948901,113926993,3758326383,338241895,168717936,666307205,1188179964,773529912,1546045734,1294757372,1522805485,1396182291,2643833823,1695183700,2343527390,1986661051,1014477480,2177026350,1206759142,2456956037,344077627,2730485921,1290863460,2820302411,3158454273,3259730800,3505952657,3345764771,106217008,3516065817,3606008344,3600352804,1432725776,4094571909,1467031594,275423344,851169720,430227734,3100823752,506948616,1363258195,659060556,3750685593,883997877,3785050280,958139571,3318307427,1322822218,3812723403,1537002063,2003034995,1747873779,3602036899,1955562222,1575990012,2024104815,1125592928,2227730452,2716904306,2361852424,442776044,2428436474,593698344,2756734187,3733110249,3204031479,2999351573,3329325298,3815920427,3391569614,3928383900,3515267271,566280711,3940187606,3454069534,4118630271,4000239992,116418474,1914138554,174292421,2731055270,289380356,3203993006,460393269,320620315,685471733,587496836,852142971,1086792851,1017036298,365543100,1126000580,2618297676,1288033470,3409855158,1501505948,4234509866,1607167915,987167468,1816402316,1246189591],fF=["hex","array","digest","arrayBuffer"],C=[];(w.JS_SHA512_NO_NODE_JS||!Array.isArray)&&(Array.isArray=function(x){return Object.prototype.toString.call(x)==="[object Array]"}),aF&&(w.JS_SHA512_NO_ARRAY_BUFFER_IS_VIEW||!ArrayBuffer.isView)&&(ArrayBuffer.isView=function(x){return typeof x=="object"&&x.buffer&&x.buffer.constructor===ArrayBuffer});var yF=function(x,r){return function(e){return new v(r,!0).update(e)[x]()}},oF=function(x){var r=yF("hex",x);r.create=function(){return new v(x)},r.update=function(B){return r.create().update(B)};for(var e=0;e<fF.length;++e){var n=fF[e];r[n]=yF(n,x)}return r},vF=function(x,r){return function(e,n){return new rF(e,r,!0).update(n)[x]()}},nF=function(x){var r=vF("hex",x);r.create=function(B){return new rF(B,x)},r.update=function(B,l){return r.create(B).update(l)};for(var e=0;e<fF.length;++e){var n=fF[e];r[n]=vF(n,x)}return r};function v(x,r){r?(C[0]=C[1]=C[2]=C[3]=C[4]=C[5]=C[6]=C[7]=C[8]=C[9]=C[10]=C[11]=C[12]=C[13]=C[14]=C[15]=C[16]=C[17]=C[18]=C[19]=C[20]=C[21]=C[22]=C[23]=C[24]=C[25]=C[26]=C[27]=C[28]=C[29]=C[30]=C[31]=C[32]=0,this.blocks=C):this.blocks=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],x==384?(this.h0h=3418070365,this.h0l=3238371032,this.h1h=1654270250,this.h1l=914150663,this.h2h=2438529370,this.h2l=812702999,this.h3h=355462360,this.h3l=4144912697,this.h4h=1731405415,this.h4l=4290775857,this.h5h=2394180231,this.h5l=1750603025,this.h6h=3675008525,this.h6l=1694076839,this.h7h=1203062813,this.h7l=3204075428):x==256?(this.h0h=573645204,this.h0l=4230739756,this.h1h=2673172387,this.h1l=3360449730,this.h2h=596883563,this.h2l=1867755857,this.h3h=2520282905,this.h3l=1497426621,this.h4h=2519219938,this.h4l=2827943907,this.h5h=3193839141,this.h5l=1401305490,this.h6h=721525244,this.h6l=746961066,this.h7h=246885852,this.h7l=2177182882):x==224?(this.h0h=2352822216,this.h0l=424955298,this.h1h=1944164710,this.h1l=2312950998,this.h2h=502970286,this.h2l=855612546,this.h3h=1738396948,this.h3l=1479516111,this.h4h=258812777,this.h4l=2077511080,this.h5h=2011393907,this.h5l=79989058,this.h6h=1067287976,this.h6l=1780299464,this.h7h=286451373,this.h7l=2446758561):(this.h0h=1779033703,this.h0l=4089235720,this.h1h=3144134277,this.h1l=2227873595,this.h2h=1013904242,this.h2l=4271175723,this.h3h=2773480762,this.h3l=1595750129,this.h4h=1359893119,this.h4l=2917565137,this.h5h=2600822924,this.h5l=725511199,this.h6h=528734635,this.h6l=4215389547,this.h7h=1541459225,this.h7l=327033209),this.bits=x,this.block=this.start=this.bytes=this.hBytes=0,this.finalized=this.hashed=!1}v.prototype.update=function(x){if(this.finalized)throw new Error(eF);var r,e=typeof x;if(e!=="string"){if(e==="object"){if(x===null)throw new Error(hF);if(aF&&x.constructor===ArrayBuffer)x=new Uint8Array(x);else if(!Array.isArray(x)&&(!aF||!ArrayBuffer.isView(x)))throw new Error(hF)}else throw new Error(hF);r=!0}for(var n,B=0,l,c=x.length,s=this.blocks;B<c;){if(this.hashed&&(this.hashed=!1,s[0]=this.block,s[1]=s[2]=s[3]=s[4]=s[5]=s[6]=s[7]=s[8]=s[9]=s[10]=s[11]=s[12]=s[13]=s[14]=s[15]=s[16]=s[17]=s[18]=s[19]=s[20]=s[21]=s[22]=s[23]=s[24]=s[25]=s[26]=s[27]=s[28]=s[29]=s[30]=s[31]=s[32]=0),r)for(l=this.start;B<c&&l<128;++B)s[l>>2]|=x[B]<<xF[l++&3];else for(l=this.start;B<c&&l<128;++B)n=x.charCodeAt(B),n<128?s[l>>2]|=n<<xF[l++&3]:n<2048?(s[l>>2]|=(192|n>>6)<<xF[l++&3],s[l>>2]|=(128|n&63)<<xF[l++&3]):n<55296||n>=57344?(s[l>>2]|=(224|n>>12)<<xF[l++&3],s[l>>2]|=(128|n>>6&63)<<xF[l++&3],s[l>>2]|=(128|n&63)<<xF[l++&3]):(n=65536+((n&1023)<<10|x.charCodeAt(++B)&1023),s[l>>2]|=(240|n>>18)<<xF[l++&3],s[l>>2]|=(128|n>>12&63)<<xF[l++&3],s[l>>2]|=(128|n>>6&63)<<xF[l++&3],s[l>>2]|=(128|n&63)<<xF[l++&3]);this.lastByteIndex=l,this.bytes+=l-this.start,l>=128?(this.block=s[32],this.start=l-128,this.hash(),this.hashed=!0):this.start=l}return this.bytes>4294967295&&(this.hBytes+=this.bytes/4294967296<<0,this.bytes=this.bytes%4294967296),this},v.prototype.finalize=function(){if(!this.finalized){this.finalized=!0;var x=this.blocks,r=this.lastByteIndex;x[32]=this.block,x[r>>2]|=SF[r&3],this.block=x[32],r>=112&&(this.hashed||this.hash(),x[0]=this.block,x[1]=x[2]=x[3]=x[4]=x[5]=x[6]=x[7]=x[8]=x[9]=x[10]=x[11]=x[12]=x[13]=x[14]=x[15]=x[16]=x[17]=x[18]=x[19]=x[20]=x[21]=x[22]=x[23]=x[24]=x[25]=x[26]=x[27]=x[28]=x[29]=x[30]=x[31]=x[32]=0),x[30]=this.hBytes<<3|this.bytes>>>29,x[31]=this.bytes<<3,this.hash()}},v.prototype.hash=function(){var x=this.h0h,r=this.h0l,e=this.h1h,n=this.h1l,B=this.h2h,l=this.h2l,c=this.h3h,s=this.h3l,E=this.h4h,D=this.h4l,d=this.h5h,_=this.h5l,b=this.h6h,S=this.h6l,O=this.h7h,U=this.h7l,y=this.blocks,A,z,P,H,I,h,t,i,a,EF,CF,cF,DF,uF,pF,AF,BF,Z,q,f,o,u,p,Q,FF;for(A=32;A<160;A+=2)f=y[A-30],o=y[A-29],z=(f>>>1|o<<31)^(f>>>8|o<<24)^f>>>7,P=(o>>>1|f<<31)^(o>>>8|f<<24)^(o>>>7|f<<25),f=y[A-4],o=y[A-3],H=(f>>>19|o<<13)^(o>>>29|f<<3)^f>>>6,I=(o>>>19|f<<13)^(f>>>29|o<<3)^(o>>>6|f<<26),f=y[A-32],o=y[A-31],u=y[A-14],p=y[A-13],h=(p&65535)+(o&65535)+(P&65535)+(I&65535),t=(p>>>16)+(o>>>16)+(P>>>16)+(I>>>16)+(h>>>16),i=(u&65535)+(f&65535)+(z&65535)+(H&65535)+(t>>>16),a=(u>>>16)+(f>>>16)+(z>>>16)+(H>>>16)+(i>>>16),y[A]=a<<16|i&65535,y[A+1]=t<<16|h&65535;var J=x,M=r,g=e,R=n,j=B,N=l,T=c,m=s,K=E,V=D,W=d,k=_,Y=b,X=S,$=O,G=U;for(AF=g&j,BF=R&N,A=0;A<160;A+=8)z=(J>>>28|M<<4)^(M>>>2|J<<30)^(M>>>7|J<<25),P=(M>>>28|J<<4)^(J>>>2|M<<30)^(J>>>7|M<<25),H=(K>>>14|V<<18)^(K>>>18|V<<14)^(V>>>9|K<<23),I=(V>>>14|K<<18)^(V>>>18|K<<14)^(K>>>9|V<<23),EF=J&g,CF=M&R,Z=EF^J&j^AF,q=CF^M&N^BF,Q=K&W^~K&Y,FF=V&k^~V&X,f=y[A],o=y[A+1],u=iF[A],p=iF[A+1],h=(p&65535)+(o&65535)+(FF&65535)+(I&65535)+(G&65535),t=(p>>>16)+(o>>>16)+(FF>>>16)+(I>>>16)+(G>>>16)+(h>>>16),i=(u&65535)+(f&65535)+(Q&65535)+(H&65535)+($&65535)+(t>>>16),a=(u>>>16)+(f>>>16)+(Q>>>16)+(H>>>16)+($>>>16)+(i>>>16),f=a<<16|i&65535,o=t<<16|h&65535,h=(q&65535)+(P&65535),t=(q>>>16)+(P>>>16)+(h>>>16),i=(Z&65535)+(z&65535)+(t>>>16),a=(Z>>>16)+(z>>>16)+(i>>>16),u=a<<16|i&65535,p=t<<16|h&65535,h=(m&65535)+(o&65535),t=(m>>>16)+(o>>>16)+(h>>>16),i=(T&65535)+(f&65535)+(t>>>16),a=(T>>>16)+(f>>>16)+(i>>>16),$=a<<16|i&65535,G=t<<16|h&65535,h=(p&65535)+(o&65535),t=(p>>>16)+(o>>>16)+(h>>>16),i=(u&65535)+(f&65535)+(t>>>16),a=(u>>>16)+(f>>>16)+(i>>>16),T=a<<16|i&65535,m=t<<16|h&65535,z=(T>>>28|m<<4)^(m>>>2|T<<30)^(m>>>7|T<<25),P=(m>>>28|T<<4)^(T>>>2|m<<30)^(T>>>7|m<<25),H=($>>>14|G<<18)^($>>>18|G<<14)^(G>>>9|$<<23),I=(G>>>14|$<<18)^(G>>>18|$<<14)^($>>>9|G<<23),cF=T&J,DF=m&M,Z=cF^T&g^EF,q=DF^m&R^CF,Q=$&K^~$&W,FF=G&V^~G&k,f=y[A+2],o=y[A+3],u=iF[A+2],p=iF[A+3],h=(p&65535)+(o&65535)+(FF&65535)+(I&65535)+(X&65535),t=(p>>>16)+(o>>>16)+(FF>>>16)+(I>>>16)+(X>>>16)+(h>>>16),i=(u&65535)+(f&65535)+(Q&65535)+(H&65535)+(Y&65535)+(t>>>16),a=(u>>>16)+(f>>>16)+(Q>>>16)+(H>>>16)+(Y>>>16)+(i>>>16),f=a<<16|i&65535,o=t<<16|h&65535,h=(q&65535)+(P&65535),t=(q>>>16)+(P>>>16)+(h>>>16),i=(Z&65535)+(z&65535)+(t>>>16),a=(Z>>>16)+(z>>>16)+(i>>>16),u=a<<16|i&65535,p=t<<16|h&65535,h=(N&65535)+(o&65535),t=(N>>>16)+(o>>>16)+(h>>>16),i=(j&65535)+(f&65535)+(t>>>16),a=(j>>>16)+(f>>>16)+(i>>>16),Y=a<<16|i&65535,X=t<<16|h&65535,h=(p&65535)+(o&65535),t=(p>>>16)+(o>>>16)+(h>>>16),i=(u&65535)+(f&65535)+(t>>>16),a=(u>>>16)+(f>>>16)+(i>>>16),j=a<<16|i&65535,N=t<<16|h&65535,z=(j>>>28|N<<4)^(N>>>2|j<<30)^(N>>>7|j<<25),P=(N>>>28|j<<4)^(j>>>2|N<<30)^(j>>>7|N<<25),H=(Y>>>14|X<<18)^(Y>>>18|X<<14)^(X>>>9|Y<<23),I=(X>>>14|Y<<18)^(X>>>18|Y<<14)^(Y>>>9|X<<23),uF=j&T,pF=N&m,Z=uF^j&J^cF,q=pF^N&M^DF,Q=Y&$^~Y&K,FF=X&G^~X&V,f=y[A+4],o=y[A+5],u=iF[A+4],p=iF[A+5],h=(p&65535)+(o&65535)+(FF&65535)+(I&65535)+(k&65535),t=(p>>>16)+(o>>>16)+(FF>>>16)+(I>>>16)+(k>>>16)+(h>>>16),i=(u&65535)+(f&65535)+(Q&65535)+(H&65535)+(W&65535)+(t>>>16),a=(u>>>16)+(f>>>16)+(Q>>>16)+(H>>>16)+(W>>>16)+(i>>>16),f=a<<16|i&65535,o=t<<16|h&65535,h=(q&65535)+(P&65535),t=(q>>>16)+(P>>>16)+(h>>>16),i=(Z&65535)+(z&65535)+(t>>>16),a=(Z>>>16)+(z>>>16)+(i>>>16),u=a<<16|i&65535,p=t<<16|h&65535,h=(R&65535)+(o&65535),t=(R>>>16)+(o>>>16)+(h>>>16),i=(g&65535)+(f&65535)+(t>>>16),a=(g>>>16)+(f>>>16)+(i>>>16),W=a<<16|i&65535,k=t<<16|h&65535,h=(p&65535)+(o&65535),t=(p>>>16)+(o>>>16)+(h>>>16),i=(u&65535)+(f&65535)+(t>>>16),a=(u>>>16)+(f>>>16)+(i>>>16),g=a<<16|i&65535,R=t<<16|h&65535,z=(g>>>28|R<<4)^(R>>>2|g<<30)^(R>>>7|g<<25),P=(R>>>28|g<<4)^(g>>>2|R<<30)^(g>>>7|R<<25),H=(W>>>14|k<<18)^(W>>>18|k<<14)^(k>>>9|W<<23),I=(k>>>14|W<<18)^(k>>>18|W<<14)^(W>>>9|k<<23),AF=g&j,BF=R&N,Z=AF^g&T^uF,q=BF^R&m^pF,Q=W&Y^~W&$,FF=k&X^~k&G,f=y[A+6],o=y[A+7],u=iF[A+6],p=iF[A+7],h=(p&65535)+(o&65535)+(FF&65535)+(I&65535)+(V&65535),t=(p>>>16)+(o>>>16)+(FF>>>16)+(I>>>16)+(V>>>16)+(h>>>16),i=(u&65535)+(f&65535)+(Q&65535)+(H&65535)+(K&65535)+(t>>>16),a=(u>>>16)+(f>>>16)+(Q>>>16)+(H>>>16)+(K>>>16)+(i>>>16),f=a<<16|i&65535,o=t<<16|h&65535,h=(q&65535)+(P&65535),t=(q>>>16)+(P>>>16)+(h>>>16),i=(Z&65535)+(z&65535)+(t>>>16),a=(Z>>>16)+(z>>>16)+(i>>>16),u=a<<16|i&65535,p=t<<16|h&65535,h=(M&65535)+(o&65535),t=(M>>>16)+(o>>>16)+(h>>>16),i=(J&65535)+(f&65535)+(t>>>16),a=(J>>>16)+(f>>>16)+(i>>>16),K=a<<16|i&65535,V=t<<16|h&65535,h=(p&65535)+(o&65535),t=(p>>>16)+(o>>>16)+(h>>>16),i=(u&65535)+(f&65535)+(t>>>16),a=(u>>>16)+(f>>>16)+(i>>>16),J=a<<16|i&65535,M=t<<16|h&65535;h=(r&65535)+(M&65535),t=(r>>>16)+(M>>>16)+(h>>>16),i=(x&65535)+(J&65535)+(t>>>16),a=(x>>>16)+(J>>>16)+(i>>>16),this.h0h=a<<16|i&65535,this.h0l=t<<16|h&65535,h=(n&65535)+(R&65535),t=(n>>>16)+(R>>>16)+(h>>>16),i=(e&65535)+(g&65535)+(t>>>16),a=(e>>>16)+(g>>>16)+(i>>>16),this.h1h=a<<16|i&65535,this.h1l=t<<16|h&65535,h=(l&65535)+(N&65535),t=(l>>>16)+(N>>>16)+(h>>>16),i=(B&65535)+(j&65535)+(t>>>16),a=(B>>>16)+(j>>>16)+(i>>>16),this.h2h=a<<16|i&65535,this.h2l=t<<16|h&65535,h=(s&65535)+(m&65535),t=(s>>>16)+(m>>>16)+(h>>>16),i=(c&65535)+(T&65535)+(t>>>16),a=(c>>>16)+(T>>>16)+(i>>>16),this.h3h=a<<16|i&65535,this.h3l=t<<16|h&65535,h=(D&65535)+(V&65535),t=(D>>>16)+(V>>>16)+(h>>>16),i=(E&65535)+(K&65535)+(t>>>16),a=(E>>>16)+(K>>>16)+(i>>>16),this.h4h=a<<16|i&65535,this.h4l=t<<16|h&65535,h=(_&65535)+(k&65535),t=(_>>>16)+(k>>>16)+(h>>>16),i=(d&65535)+(W&65535)+(t>>>16),a=(d>>>16)+(W>>>16)+(i>>>16),this.h5h=a<<16|i&65535,this.h5l=t<<16|h&65535,h=(S&65535)+(X&65535),t=(S>>>16)+(X>>>16)+(h>>>16),i=(b&65535)+(Y&65535)+(t>>>16),a=(b>>>16)+(Y>>>16)+(i>>>16),this.h6h=a<<16|i&65535,this.h6l=t<<16|h&65535,h=(U&65535)+(G&65535),t=(U>>>16)+(G>>>16)+(h>>>16),i=(O&65535)+($&65535)+(t>>>16),a=(O>>>16)+($>>>16)+(i>>>16),this.h7h=a<<16|i&65535,this.h7l=t<<16|h&65535},v.prototype.hex=function(){this.finalize();var x=this.h0h,r=this.h0l,e=this.h1h,n=this.h1l,B=this.h2h,l=this.h2l,c=this.h3h,s=this.h3l,E=this.h4h,D=this.h4l,d=this.h5h,_=this.h5l,b=this.h6h,S=this.h6l,O=this.h7h,U=this.h7l,y=this.bits,A=F[x>>28&15]+F[x>>24&15]+F[x>>20&15]+F[x>>16&15]+F[x>>12&15]+F[x>>8&15]+F[x>>4&15]+F[x&15]+F[r>>28&15]+F[r>>24&15]+F[r>>20&15]+F[r>>16&15]+F[r>>12&15]+F[r>>8&15]+F[r>>4&15]+F[r&15]+F[e>>28&15]+F[e>>24&15]+F[e>>20&15]+F[e>>16&15]+F[e>>12&15]+F[e>>8&15]+F[e>>4&15]+F[e&15]+F[n>>28&15]+F[n>>24&15]+F[n>>20&15]+F[n>>16&15]+F[n>>12&15]+F[n>>8&15]+F[n>>4&15]+F[n&15]+F[B>>28&15]+F[B>>24&15]+F[B>>20&15]+F[B>>16&15]+F[B>>12&15]+F[B>>8&15]+F[B>>4&15]+F[B&15]+F[l>>28&15]+F[l>>24&15]+F[l>>20&15]+F[l>>16&15]+F[l>>12&15]+F[l>>8&15]+F[l>>4&15]+F[l&15]+F[c>>28&15]+F[c>>24&15]+F[c>>20&15]+F[c>>16&15]+F[c>>12&15]+F[c>>8&15]+F[c>>4&15]+F[c&15];return y>=256&&(A+=F[s>>28&15]+F[s>>24&15]+F[s>>20&15]+F[s>>16&15]+F[s>>12&15]+F[s>>8&15]+F[s>>4&15]+F[s&15]),y>=384&&(A+=F[E>>28&15]+F[E>>24&15]+F[E>>20&15]+F[E>>16&15]+F[E>>12&15]+F[E>>8&15]+F[E>>4&15]+F[E&15]+F[D>>28&15]+F[D>>24&15]+F[D>>20&15]+F[D>>16&15]+F[D>>12&15]+F[D>>8&15]+F[D>>4&15]+F[D&15]+F[d>>28&15]+F[d>>24&15]+F[d>>20&15]+F[d>>16&15]+F[d>>12&15]+F[d>>8&15]+F[d>>4&15]+F[d&15]+F[_>>28&15]+F[_>>24&15]+F[_>>20&15]+F[_>>16&15]+F[_>>12&15]+F[_>>8&15]+F[_>>4&15]+F[_&15]),y==512&&(A+=F[b>>28&15]+F[b>>24&15]+F[b>>20&15]+F[b>>16&15]+F[b>>12&15]+F[b>>8&15]+F[b>>4&15]+F[b&15]+F[S>>28&15]+F[S>>24&15]+F[S>>20&15]+F[S>>16&15]+F[S>>12&15]+F[S>>8&15]+F[S>>4&15]+F[S&15]+F[O>>28&15]+F[O>>24&15]+F[O>>20&15]+F[O>>16&15]+F[O>>12&15]+F[O>>8&15]+F[O>>4&15]+F[O&15]+F[U>>28&15]+F[U>>24&15]+F[U>>20&15]+F[U>>16&15]+F[U>>12&15]+F[U>>8&15]+F[U>>4&15]+F[U&15]),A},v.prototype.toString=v.prototype.hex,v.prototype.digest=function(){this.finalize();var x=this.h0h,r=this.h0l,e=this.h1h,n=this.h1l,B=this.h2h,l=this.h2l,c=this.h3h,s=this.h3l,E=this.h4h,D=this.h4l,d=this.h5h,_=this.h5l,b=this.h6h,S=this.h6l,O=this.h7h,U=this.h7l,y=this.bits,A=[x>>24&255,x>>16&255,x>>8&255,x&255,r>>24&255,r>>16&255,r>>8&255,r&255,e>>24&255,e>>16&255,e>>8&255,e&255,n>>24&255,n>>16&255,n>>8&255,n&255,B>>24&255,B>>16&255,B>>8&255,B&255,l>>24&255,l>>16&255,l>>8&255,l&255,c>>24&255,c>>16&255,c>>8&255,c&255];return y>=256&&A.push(s>>24&255,s>>16&255,s>>8&255,s&255),y>=384&&A.push(E>>24&255,E>>16&255,E>>8&255,E&255,D>>24&255,D>>16&255,D>>8&255,D&255,d>>24&255,d>>16&255,d>>8&255,d&255,_>>24&255,_>>16&255,_>>8&255,_&255),y==512&&A.push(b>>24&255,b>>16&255,b>>8&255,b&255,S>>24&255,S>>16&255,S>>8&255,S&255,O>>24&255,O>>16&255,O>>8&255,O&255,U>>24&255,U>>16&255,U>>8&255,U&255),A},v.prototype.array=v.prototype.digest,v.prototype.arrayBuffer=function(){this.finalize();var x=this.bits,r=new ArrayBuffer(x/8),e=new DataView(r);return e.setUint32(0,this.h0h),e.setUint32(4,this.h0l),e.setUint32(8,this.h1h),e.setUint32(12,this.h1l),e.setUint32(16,this.h2h),e.setUint32(20,this.h2l),e.setUint32(24,this.h3h),x>=256&&e.setUint32(28,this.h3l),x>=384&&(e.setUint32(32,this.h4h),e.setUint32(36,this.h4l),e.setUint32(40,this.h5h),e.setUint32(44,this.h5l)),x==512&&(e.setUint32(48,this.h6h),e.setUint32(52,this.h6l),e.setUint32(56,this.h7h),e.setUint32(60,this.h7l)),r},v.prototype.clone=function(){var x=new v(this.bits,!1);return this.copyTo(x),x},v.prototype.copyTo=function(x){var r=0,e=["h0h","h0l","h1h","h1l","h2h","h2l","h3h","h3l","h4h","h4l","h5h","h5l","h6h","h6l","h7h","h7l","start","bytes","hBytes","finalized","hashed","lastByteIndex"];for(r=0;r<e.length;++r)x[e[r]]=this[e[r]];for(r=0;r<this.blocks.length;++r)x.blocks[r]=this.blocks[r]};function rF(x,r,e){var n,B=typeof x;if(B!=="string"){if(B==="object"){if(x===null)throw new Error(hF);if(aF&&x.constructor===ArrayBuffer)x=new Uint8Array(x);else if(!Array.isArray(x)&&(!aF||!ArrayBuffer.isView(x)))throw new Error(hF)}else throw new Error(hF);n=!0}var l=x.length;if(!n){for(var c=[],l=x.length,s=0,E,D=0;D<l;++D)E=x.charCodeAt(D),E<128?c[s++]=E:E<2048?(c[s++]=192|E>>6,c[s++]=128|E&63):E<55296||E>=57344?(c[s++]=224|E>>12,c[s++]=128|E>>6&63,c[s++]=128|E&63):(E=65536+((E&1023)<<10|x.charCodeAt(++D)&1023),c[s++]=240|E>>18,c[s++]=128|E>>12&63,c[s++]=128|E>>6&63,c[s++]=128|E&63);x=c}x.length>128&&(x=new v(r,!0).update(x).array());for(var d=[],_=[],D=0;D<128;++D){var b=x[D]||0;d[D]=92^b,_[D]=54^b}v.call(this,r,e),this.update(_),this.oKeyPad=d,this.inner=!0,this.sharedMemory=e}rF.prototype=new v,rF.prototype.finalize=function(){if(v.prototype.finalize.call(this),this.inner){this.inner=!1;var x=this.array();v.call(this,this.bits,this.sharedMemory),this.update(this.oKeyPad),this.update(x),v.prototype.finalize.call(this)}},rF.prototype.clone=function(){var x=new rF([],this.bits,!1);this.copyTo(x),x.inner=this.inner;for(var r=0;r<this.oKeyPad.length;++r)x.oKeyPad[r]=this.oKeyPad[r];return x};var L=oF(512);L.sha512=L,L.sha384=oF(384),L.sha512_256=oF(256),L.sha512_224=oF(224),L.sha512.hmac=nF(512),L.sha384.hmac=nF(384),L.sha512_256.hmac=nF(256),L.sha512_224.hmac=nF(224),wF?sF.exports=L:(w.sha512=L.sha512,w.sha384=L.sha384,w.sha512_256=L.sha512_256,w.sha512_224=L.sha512_224)})()})(dF);var _F=dF.exports;const RF=OF(_F),NF=gF({__proto__:null,default:RF},[_F]);export{NF as s};
@@ -65,7 +65,7 @@
65
65
  .fa-trash:before { content: '\e80d'; } /* '' */
66
66
  .fa-to_start:before { content: '\e80e'; } /* '' */
67
67
  .fa-to_end:before { content: '\e810'; } /* '' */
68
- .fa-picture:before { content: '\e811'; } /* '' */
68
+ .fa-image:before { content: '\e811'; } /* '' */
69
69
  .fa-camera:before { content: '\e812'; } /* '' */
70
70
  .fa-search:before { content: '\e813'; } /* '' */
71
71
  .fa-logout:before { content: '\e814'; } /* '' */
@@ -5,9 +5,8 @@
5
5
  <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1.0, user-scalable=0" />
6
6
  <link href="/fontello.css" rel="stylesheet" />
7
7
 
8
- <script>HFS={}</script>
9
- <script type="module" crossorigin src="/assets/index-5aeff3af.js"></script>
10
- <link rel="stylesheet" href="/assets/index-59572489.css">
8
+ <script type="module" crossorigin src="/assets/index-c0f02a72.js"></script>
9
+ <link rel="stylesheet" href="/assets/index-f2f8fd6b.css">
11
10
  </head>
12
11
  <body>
13
12
  <noscript>You need to enable JavaScript to run this app.</noscript>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "hfs",
3
- "version": "0.45.0",
3
+ "version": "0.46.0",
4
4
  "description": "HTTP File Server",
5
5
  "keywords": [
6
6
  "file server",
@@ -26,13 +26,13 @@
26
26
  "dist": "npm run build-all && npm run dist-bin",
27
27
  "dist-bin": "npm run dist-modules && cd dist && pkg . --public -C gzip && mv -f hfs-win-x64.exe hfs.exe && zip hfs-windows.zip hfs.exe -r plugins && cp -f hfs-linux-x64 hfs && zip hfs-linux.zip hfs -r plugins && cp -f hfs-macos-x64 hfs && zip hfs-mac.zip hfs -r plugins && cp -f hfs-macos-arm64 hfs && zip hfs-mac-arm.zip hfs -r plugins && rm hfs",
28
28
  "dist-modules": "cp package*.json dist && cd dist && npm ci --omit=dev && npm run dist-crclib && rm package-lock.json && cd .. && node prune_modules",
29
- "dist-crclib": "npm i -f --no-save --omit=dev @node-rs/crc32-win32-x64-msvc @node-rs/crc32-darwin-arm64 @node-rs/crc32-darwin-x64 ",
29
+ "dist-crclib": "npm i -f --no-save --omit=dev @node-rs/crc32-win32-x64-msvc @node-rs/crc32-darwin-arm64 @node-rs/crc32-darwin-x64 @node-rs/crc32-linux-x64-gnu",
30
30
  "dist-win": "cp package*.json dist && cd dist && npm ci --omit=dev && npm i -f --no-save --omit=dev @node-rs/crc32-win32 && pkg . --public -C gzip -t node16-win-x64",
31
31
  "dist-mac": "cp package*.json dist && cd dist && npm ci --omit=dev && pkg . --public -C gzip -t node16-macos-arm64",
32
32
  "dist-node": "npm run dist-modules && cd dist && zip hfs-node.zip -r * -x *.zip *.exe hfs-* *.log logs"
33
33
  },
34
34
  "engines": {
35
- "node": ">=16.13.0"
35
+ "node": ">=18.12.0"
36
36
  },
37
37
  "files": [
38
38
  "src/*",
@@ -68,6 +68,7 @@
68
68
  "fast-glob": "^3.2.7",
69
69
  "find-process": "^1.4.7",
70
70
  "formidable": "^2.1.1",
71
+ "fs-extended-attributes": "^1.0.1",
71
72
  "koa": "^2.13.4",
72
73
  "koa-compress": "^5.1.0",
73
74
  "koa-mount": "^4.0.0",
@@ -1,3 +1,5 @@
1
+ // other plugins can use ctx.state.download_counter_ignore to mark downloads that shouldn't be counted
2
+
1
3
  exports.description = "Counts downloads for each file, and displays the total in the list or file menu"
2
4
  exports.version = 4.1 // fix: different cases and encodings with urls weren't properly counted
3
5
  exports.apiRequired = 8
@@ -43,7 +45,7 @@ exports.init = async api => {
43
45
  unload: () => save.flush(), // we may have pending savings
44
46
  middleware: (ctx) =>
45
47
  () => { // execute after other middlewares are done
46
- if (ctx.status >= 300 || !ctx.vfsNode) return
48
+ if (ctx.status >= 300 || !ctx.vfsNode || ctx.state.download_counter_ignore) return
47
49
  const k = uri2key(ctx.path)
48
50
  counters[k] = counters[k] + 1 || 1
49
51
  save()
@@ -1,12 +1,13 @@
1
1
  { // this wrapper avoids name clashing of outer variables and functions
2
2
  const config = HFS.getPluginConfig()
3
3
 
4
+ const label = HFS.t(["Download counter", "download counter"])
4
5
  const inMenu = config.where === 'menu'
5
6
  HFS.onEvent('additionalEntryDetails', ({ entry: { hits } }) =>
6
- hits && !inMenu && `<span class="download-counter" title="${HFS.t`download counter`}">${hits}</span>`)
7
+ hits && !inMenu && `<span class="download-counter" title="${label}">${hits}</span>`)
7
8
 
8
9
  HFS.onEvent('fileMenu', ({ entry, props }) => {
9
10
  if (inMenu && !entry.isFolder)
10
- props.push(["Downloads", entry.hits || 0])
11
+ props.push([label, entry.hits || 0])
11
12
  })
12
13
  }
@@ -0,0 +1,21 @@
1
+ exports.version = 1.0
2
+ exports.description = "Show uploader info in list"
3
+ exports.apiRequired = 8.23
4
+ exports.frontend_js = "main.js"
5
+
6
+ exports.configDialog = {
7
+ sx: { maxWidth: '15em' },
8
+ }
9
+
10
+ exports.config = {
11
+ display: {
12
+ type: 'select',
13
+ options: {
14
+ "IP only": 'ip',
15
+ "Username only": 'user',
16
+ "IP + username": 'ip+user',
17
+ },
18
+ defaultValue: 'ip+user',
19
+ frontend: true,
20
+ }
21
+ }
@@ -0,0 +1,27 @@
1
+ {
2
+ const { display } = HFS.getPluginConfig()
3
+
4
+ HFS.onEvent('additionalEntryDetails', ({ entry }) =>
5
+ HFS.h(Uploader, entry))
6
+
7
+ const cache = {}
8
+
9
+ function Uploader({ uri }) {
10
+ const fullUri = location.pathname + uri
11
+ const cachedData = cache[fullUri]
12
+ const [freshData, error] = HFS.useApi(!cachedData && 'get_file_details', { uri: fullUri })
13
+ if (!cachedData)
14
+ cache[fullUri] = freshData || Boolean(error)
15
+ const data = freshData || cachedData
16
+ const text = HFS.React.useMemo(() => {
17
+ if (!data || data === true) return ''
18
+ const { upload: x } = data
19
+ return !x ? ''
20
+ : display === 'user' ? x.username
21
+ : display === 'ip' || !x.username ? x.ip
22
+ : x.ip + ' (' + x.username + ')'
23
+ })
24
+ return text && HFS.h('span', { className: 'uploader', title: HFS.t`Uploader` },
25
+ HFS.hIcon('upload'), ' ', text, ' – ')
26
+ }
27
+ }
@@ -1,5 +1,5 @@
1
1
  exports.description = "If you want to have different home folders, based on domain"
2
- exports.version = 3.1 // support masks for host
2
+ exports.version = 3.11
3
3
  exports.apiRequired = 2 // 2 is for the config 'array'
4
4
 
5
5
  exports.config = {
@@ -41,12 +41,15 @@ exports.init = api => {
41
41
  }
42
42
  return
43
43
  }
44
+ let { root='' } = row
45
+ if (root.endsWith('/'))
46
+ root = root.slice(0, -1)
44
47
  if (!params)
45
- ctx.path = row.root + ctx.path
48
+ ctx.path = root + ctx.path
46
49
  else
47
50
  for (const [k,v] of Object.entries(params))
48
51
  if (k.startsWith('uri'))
49
- params[k] = row.root + v
52
+ params[k] = root + v
50
53
  }
51
54
  }
52
55
  }
package/src/adminApis.js CHANGED
@@ -100,6 +100,7 @@ exports.adminApis = {
100
100
  compatibleApiVersion: const_1.COMPATIBLE_API_VERSION,
101
101
  ...await (0, listen_1.getServerStatus)(),
102
102
  urls: (0, listen_1.getUrls)(),
103
+ baseUrl: middlewares_1.baseUrl.get(),
103
104
  update: !(0, update_1.updateSupported)() ? false : await (0, update_1.localUpdateAvailable)() ? 'local' : true,
104
105
  proxyDetected: (0, middlewares_1.getProxyDetected)(),
105
106
  frpDetected: exports.localhostAdmin.get() && !(0, middlewares_1.getProxyDetected)()
@@ -179,7 +180,7 @@ exports.adminNet = (0, config_1.defineConfig)('admin_net', '', v => (0, misc_1.m
179
180
  exports.favicon = (0, config_1.defineConfig)('favicon', '');
180
181
  exports.title = (0, config_1.defineConfig)('title', "File server");
181
182
  function ctxAdminAccess(ctx) {
182
- return !ctx.ips.length // we consider localhost_admin only if no proxy is being usedø
183
+ return !ctx.ips.length // we consider localhost_admin only if no proxy is being used
183
184
  && exports.localhostAdmin.get() && (0, misc_1.isLocalHost)(ctx)
184
185
  || (0, perm_1.getFromAccount)(ctx.state.account, a => a.admin);
185
186
  }
@@ -187,8 +188,13 @@ exports.ctxAdminAccess = ctxAdminAccess;
187
188
  const frpDebounced = (0, misc_1.debounceAsync)(async () => {
188
189
  if (!const_1.IS_WINDOWS)
189
190
  return false;
190
- const { stdout } = await (0, util_1.promisify)(child_process_1.execFile)('tasklist', ['/fi', 'imagename eq frpc.exe', '/nh']);
191
- return stdout.includes('frpc');
191
+ try { // guy with win11 reported missing tasklist, so don't take it for granted
192
+ const { stdout } = await (0, util_1.promisify)(child_process_1.execFile)('tasklist', ['/fi', 'imagename eq frpc.exe', '/nh']);
193
+ return stdout.includes('frpc');
194
+ }
195
+ catch (_a) {
196
+ return false;
197
+ }
192
198
  });
193
199
  function anyAccountCanLoginAdmin() {
194
200
  return Boolean(lodash_1.default.find(perm_1.accountsConfig.get(), perm_1.accountCanLoginAdmin));
package/src/api.auth.js CHANGED
@@ -27,7 +27,6 @@ async function loggedIn(ctx, username) {
27
27
  }
28
28
  s.username = (0, perm_1.normalizeUsername)(username);
29
29
  await (0, middlewares_1.prepareState)(ctx, async () => { }); // updating the state is necessary to send complete session data so that frontend shows admin button
30
- delete s.login;
31
30
  ctx.cookies.set('csrf', (0, misc_1.randomId)(), { signed: false, httpOnly: false });
32
31
  }
33
32
  function makeExp() {
@@ -63,7 +62,7 @@ const loginSrp1 = async ({ username }, ctx) => {
63
62
  const sid = Math.random();
64
63
  ongoingLogins[sid] = step1;
65
64
  setTimeout(() => delete ongoingLogins[sid], 60000);
66
- ctx.session.login = { username, sid };
65
+ ctx.session.loggingIn = { username, sid };
67
66
  return rest;
68
67
  }
69
68
  catch (code) {
@@ -86,15 +85,16 @@ const loginSrp2 = async ({ pubKey, proof }, ctx) => {
86
85
  var _a;
87
86
  if (!ctx.session)
88
87
  return new apiMiddleware_1.ApiError(const_1.HTTP_SERVER_ERROR);
89
- if (!ctx.session.login)
88
+ if (!ctx.session.loggingIn)
90
89
  return new apiMiddleware_1.ApiError(const_1.HTTP_CONFLICT);
91
- const { username, sid } = ctx.session.login;
90
+ const { username, sid } = ctx.session.loggingIn;
92
91
  const step1 = ongoingLogins[sid];
93
92
  if (!step1)
94
93
  return new apiMiddleware_1.ApiError(const_1.HTTP_NOT_FOUND);
95
94
  try {
96
95
  const M2 = await step1.step2(BigInt(pubKey), BigInt(proof));
97
96
  await loggedIn(ctx, username);
97
+ delete ctx.session.loggingIn;
98
98
  return {
99
99
  proof: String(M2),
100
100
  redirect: (_a = ctx.state.account) === null || _a === void 0 ? void 0 : _a.redirect,
@@ -12,7 +12,7 @@ const plugins_1 = require("./plugins");
12
12
  const misc_1 = require("./misc");
13
13
  const lodash_1 = __importDefault(require("lodash"));
14
14
  const const_1 = require("./const");
15
- const file_list = async ({ uri, offset, limit, search, omit, sse }, ctx) => {
15
+ const file_list = async ({ uri, offset, limit, search, c, sse }, ctx) => {
16
16
  const node = await (0, vfs_1.urlToNode)(uri || '/', ctx);
17
17
  const list = new apiMiddleware_1.SendListReadable();
18
18
  if (!node)
@@ -72,12 +72,11 @@ const file_list = async ({ uri, offset, limit, search, omit, sse }, ctx) => {
72
72
  --offset;
73
73
  continue;
74
74
  }
75
- if (omit) {
76
- if (omit !== 'c')
77
- ctx.throw(const_1.HTTP_BAD_REQUEST, 'omit');
75
+ if (!c) { // include c field?
78
76
  if (!entry.m)
79
77
  entry.m = entry.c;
80
- delete entry.c;
78
+ if (entry.c)
79
+ entry.c = undefined;
81
80
  }
82
81
  yield entry;
83
82
  if (limit && !--limit)
@@ -37,7 +37,7 @@ const apis = {
37
37
  connectionClosed(conn) {
38
38
  if (cancel(conn))
39
39
  return;
40
- list.remove(serializeConnection(conn, true));
40
+ list.remove(getConnAddress(conn));
41
41
  conn[state] = false;
42
42
  },
43
43
  connectionUpdated(conn, change) {
@@ -65,19 +65,21 @@ const apis = {
65
65
  function update(conn, change) {
66
66
  if (conn[state] === false)
67
67
  return;
68
- list.update(serializeConnection(conn, true), change);
68
+ list.update(getConnAddress(conn), change);
69
69
  }
70
- function serializeConnection(conn, minimal) {
70
+ function serializeConnection(conn) {
71
71
  var _a;
72
72
  const { socket, started, secure } = conn;
73
- return Object.assign(getConnAddress(conn), !minimal && {
73
+ return {
74
+ ...getConnAddress(conn),
74
75
  v: (((_a = socket.remoteFamily) === null || _a === void 0 ? void 0 : _a.endsWith('6')) ? 6 : 4),
75
76
  got: socket.bytesRead,
76
77
  sent: socket.bytesWritten,
78
+ ...lodash_1.default.pick(conn, ['op', 'opTotal', 'opOffset', 'opProgress']),
77
79
  started,
78
80
  secure: (secure || undefined),
79
81
  ...fromCtx(conn.ctx),
80
- });
82
+ };
81
83
  }
82
84
  function fromCtx(ctx) {
83
85
  return ctx && {
@@ -12,6 +12,7 @@ const apiMiddleware_1 = require("./apiMiddleware");
12
12
  const events_1 = __importDefault(require("./events"));
13
13
  const promises_1 = require("fs/promises");
14
14
  const github_1 = require("./github");
15
+ const const_1 = require("./const");
15
16
  const apis = {
16
17
  get_plugins({}, ctx) {
17
18
  const list = new apiMiddleware_1.SendListReadable({ addAtStart: [...(0, plugins_1.mapPlugins)(serialize), ...(0, plugins_1.getAvailablePlugins)()] });
@@ -32,30 +33,49 @@ const apis = {
32
33
  async get_plugin_updates() {
33
34
  const list = new apiMiddleware_1.SendListReadable();
34
35
  setTimeout(async () => {
35
- for (const [folder, repo] of Object.entries((0, github_1.getFolder2repo)()))
36
+ const errs = await Promise.all(lodash_1.default.map((0, github_1.getFolder2repo)(), async (repo, folder) => {
36
37
  try {
37
38
  if (!repo)
38
- continue;
39
- const online = await (0, github_1.readOnlinePlugin)(await (0, github_1.getRepoInfo)(repo));
39
+ return;
40
+ //TODO shouldn't we consider other branches here?
41
+ const online = await (0, github_1.readOnlinePlugin)(repo);
40
42
  if (!online.apiRequired || online.badApi)
41
- continue;
43
+ return;
42
44
  const disk = (0, plugins_1.getPluginInfo)(folder);
43
45
  if (online.version > disk.version)
44
46
  list.add(online);
45
47
  }
46
48
  catch (err) {
47
- list.error(err.code || err.message);
49
+ if (err.message === '404') // the plugin is declaring a wrong repo
50
+ return;
51
+ return err.code || err.message;
48
52
  }
53
+ }));
54
+ for (const x of lodash_1.default.uniq((0, misc_1.onlyTruthy)(errs)))
55
+ list.error(x);
49
56
  list.close();
50
57
  });
51
58
  return list;
52
59
  },
60
+ async start_plugin({ id }) {
61
+ if ((0, plugins_1.isPluginRunning)(id))
62
+ return { msg: 'already running' };
63
+ await (0, plugins_1.stopPlugin)(id);
64
+ await (0, plugins_1.startPlugin)(id);
65
+ return {};
66
+ },
67
+ async stop_plugin({ id }) {
68
+ if (!(0, plugins_1.isPluginRunning)(id))
69
+ return { msg: 'already stopped' };
70
+ await (0, plugins_1.stopPlugin)(id);
71
+ return {};
72
+ },
53
73
  async set_plugin({ id, enabled, config }) {
54
74
  (0, assert_1.default)(id, 'id');
55
- if (enabled !== undefined)
56
- (0, plugins_1.enablePlugin)(id, enabled);
57
75
  if (config)
58
76
  (0, plugins_1.setPluginConfig)(id, config);
77
+ if (enabled !== undefined)
78
+ (0, plugins_1.enablePlugin)(id, enabled);
59
79
  return {};
60
80
  },
61
81
  async get_plugin({ id }) {
@@ -77,10 +97,11 @@ const apis = {
77
97
  const folder2repo = (0, github_1.getFolder2repo)();
78
98
  for await (const pl of (0, github_1.searchPlugins)(text)) {
79
99
  const repo = pl.id;
100
+ if (lodash_1.default.includes(folder2repo, repo))
101
+ continue;
80
102
  const folder = lodash_1.default.findKey(folder2repo, x => x === repo);
81
103
  const installed = folder && (0, plugins_1.getPluginInfo)(folder);
82
104
  Object.assign(pl, {
83
- installed: lodash_1.default.includes(folder2repo, repo),
84
105
  update: installed && installed.version < pl.version,
85
106
  });
86
107
  list.add(pl);
@@ -112,20 +133,43 @@ const apis = {
112
133
  });
113
134
  },
114
135
  async download_plugin(pl) {
136
+ await checkDependencies(pl.id, pl.branch);
115
137
  const res = await (0, github_1.downloadPlugin)(pl.id, pl.branch);
116
- return typeof res === 'string' ? (0, plugins_1.getPluginInfo)(res) : res;
138
+ if (typeof res !== 'string')
139
+ return res;
140
+ return (await (0, misc_1.waitFor)(() => (0, plugins_1.getPluginInfo)(res), { timeout: 5000 }))
141
+ || new apiMiddleware_1.ApiError(const_1.HTTP_SERVER_ERROR);
117
142
  },
118
143
  async update_plugin(pl) {
144
+ await checkDependencies(pl.id, pl.branch);
145
+ const found = (0, plugins_1.findPluginByRepo)(pl.id); // github id !== local id
146
+ if (!found)
147
+ return new apiMiddleware_1.ApiError(const_1.HTTP_NOT_FOUND);
148
+ const enabled = (0, plugins_1.isPluginEnabled)(found.id);
149
+ await (0, plugins_1.stopPlugin)(found.id);
119
150
  await (0, github_1.downloadPlugin)(pl.id, pl.branch, true);
151
+ if (enabled)
152
+ (0, plugins_1.startPlugin)(found.id).then(); // don't wait, in case it fails to start
120
153
  return {};
121
154
  },
122
155
  async uninstall_plugin({ id }) {
123
- while ((0, plugins_1.isPluginRunning)(id)) {
124
- (0, plugins_1.enablePlugin)(id, false);
125
- await (0, misc_1.wait)(500);
126
- }
156
+ await (0, plugins_1.stopPlugin)(id);
127
157
  await (0, promises_1.rm)(plugins_1.PATH + '/' + id, { recursive: true, force: true });
128
158
  return {};
129
159
  }
130
160
  };
131
161
  exports.default = apis;
162
+ async function checkDependencies(repo, branch) {
163
+ const rec = await (0, github_1.readOnlinePlugin)(repo, branch);
164
+ const miss = rec.depend && rec.depend.map((dep) => {
165
+ const res = (0, plugins_1.findPluginByRepo)(dep.repo);
166
+ const error = !res ? 'missing'
167
+ : (res.version || 0) < dep.version ? 'version'
168
+ : !(0, plugins_1.isPluginEnabled)(res.id) ? 'disabled'
169
+ : !(0, plugins_1.isPluginRunning)(res.id) ? 'stopped'
170
+ : '';
171
+ return error && { repo: dep.repo, error, id: res === null || res === void 0 ? void 0 : res.id };
172
+ }).filter(Boolean);
173
+ if (miss === null || miss === void 0 ? void 0 : miss.length)
174
+ throw new apiMiddleware_1.ApiError(const_1.HTTP_FAILED_DEPENDENCY, miss);
175
+ }
package/src/api.vfs.js CHANGED
@@ -110,7 +110,8 @@ const apis = {
110
110
  while ((_a = parent.children) === null || _a === void 0 ? void 0 : _a.find((0, vfs_1.isSameFilenameAs)(name)))
111
111
  name = `${noExt} ${idx++}${ext}`;
112
112
  child.name = name;
113
- (parent.children || (parent.children = [])).unshift({ source, name });
113
+ simplifyName(child);
114
+ (parent.children || (parent.children = [])).unshift(child);
114
115
  await (0, vfs_1.saveVfs)();
115
116
  return { name };
116
117
  },
@@ -11,6 +11,7 @@ const misc_1 = require("./misc");
11
11
  const events_1 = __importDefault(require("./events"));
12
12
  const const_1 = require("./const");
13
13
  const lodash_1 = __importDefault(require("lodash"));
14
+ const config_1 = require("./config");
14
15
  class ApiError extends Error {
15
16
  constructor(status, message) {
16
17
  super(typeof message === 'string' ? message : message && message instanceof Error ? message.message : JSON.stringify(message));
@@ -18,8 +19,11 @@ class ApiError extends Error {
18
19
  }
19
20
  }
20
21
  exports.ApiError = ApiError;
22
+ const logApi = (0, config_1.defineConfig)('log_api', true);
21
23
  function apiMiddleware(apis) {
22
24
  return async (ctx) => {
25
+ if (!logApi.get())
26
+ ctx.state.dont_log = true;
23
27
  const { params } = ctx;
24
28
  console.debug('API', ctx.method, ctx.path, { ...params });
25
29
  const apiFun = apis.hasOwnProperty(ctx.path) && apis[ctx.path];