filecat 3.3.3 → 3.4.5
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.
- package/README.md +1 -0
- package/build/dist/165.bundle.js +1 -0
- package/build/dist/450.bundle.js +1 -1
- package/build/dist/523.bundle.js +1 -1
- package/build/dist/542.bundle.js +2 -0
- package/build/dist/567.bundle.js +1 -1
- package/build/dist/663.bundle.js +1 -1
- package/build/dist/757.bundle.js +1 -0
- package/build/dist/943.bundle.js +1 -1
- package/build/dist/998.bundle.js +2 -0
- package/build/dist/998.bundle.js.LICENSE.txt +1 -0
- package/build/dist/bundle.js +1 -1
- package/build/dist/bundle.js.LICENSE.txt +3 -3
- package/build/main.js +8 -8
- package/package.json +1 -1
- package/build/dist/382.bundle.js +0 -2
- /package/build/dist/{382.bundle.js.LICENSE.txt → 542.bundle.js.LICENSE.txt} +0 -0
package/package.json
CHANGED
package/build/dist/382.bundle.js
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
/*! For license information please see 382.bundle.js.LICENSE.txt */
|
|
2
|
-
"use strict";(self.webpackChunkfilecat=self.webpackChunkfilecat||[]).push([[382],{447:(e,t,n)=>{n.d(t,{WA:()=>d,ZI:()=>h,Zp:()=>u,fq:()=>y,gz:()=>m,uF:()=>f,xP:()=>p});var r=n(6540),o=n(3413),i=n.n(o),c=n(505);function s(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 a=function(e){return e[e.common=0]="common",e[e.full=1]="full",e}(a||{});function l(e,t){var n=t===a.common?"card-content":t===a.full?"card-content full":"";return r.createElement("div",{className:"card",style:{}},r.createElement("div",{className:"card-title"},e.self_title?e.self_title:r.createElement("h2",null,e.title),r.createElement("div",{className:"not-select-div"},e.titleCom&&e.titleCom)),r.createElement("div",{className:n},e.children),r.createElement("div",{className:"card-action card-action-bottom-right"},e.rightBottomCom))}function u(e){return l(e,a.common)}function f(e){return l(e,a.full)}function p(e){var t,n,o=(0,r.useRef)(null);return r.createElement("div",{className:"card-text"},r.createElement("div",{className:"card-text-context"},null!==(t=e.context)&&void 0!==t?t:e.children),r.createElement("div",{className:"card-text-tip",ref:o,onClick:function(){var t;(0,c.l)(null!==(t=e.context)&&void 0!==t?t:e.children),new(i())({type:"info",text:"复制完成",timeout:1e3,layout:"bottomLeft"}).show()}},null!==(n=e.context)&&void 0!==n?n:e.children))}function d(e){var t,n;return r.createElement("div",{className:"card-text"},r.createElement("div",{className:"card-text-context"},null!==(t=e.context)&&void 0!==t?t:e.children),r.createElement("div",{className:"card-text-tip"},null!==(n=e.context)&&void 0!==n?n:e.children))}function h(e){var t,n;return r.createElement("div",{className:"card floating",onKeyPress:function(t){"Enter"===t.key&&e.confirm_enter&&e.confirm_enter()}},r.createElement("div",{className:"card-title"},r.createElement("h2",null,e.title)),r.createElement("div",{className:"card-content"},e.context&&e.context.map((function(e,t){return r.createElement("div",{key:t},e)}))),r.createElement("div",{className:"card-action"},r.createElement("button",{className:"button button--flat button--grey",onClick:e.cancel},null!==(t=e.cancel_t)&&void 0!==t?t:"cancel"),r.createElement("button",{className:"button button--flat",onClick:e.confirm},null!==(n=e.confirm_t)&&void 0!==n?n:"confirm")))}function m(e){return r.createElement("div",{className:"progress-card"},r.createElement("div",{className:"progress-per"},r.createElement("div",{style:{width:"".concat(e.progress,"%")}})))}var y=function(e){var t,n,o=(t=(0,r.useState)("var(--iconTertiary)"),n=2,function(e){if(Array.isArray(e))return e}(t)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,o,i,c,s=[],a=!0,l=!1;try{if(i=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;a=!1}else for(;!(a=(r=i.call(n)).done)&&(s.push(r.value),s.length!==t);a=!0);}catch(e){l=!0,o=e}finally{try{if(!a&&null!=n.return&&(c=n.return(),Object(c)!==c))return}finally{if(l)throw o}}return s}}(t,n)||function(e,t){if(e){if("string"==typeof e)return s(e,t);var n={}.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)?s(e,t):void 0}}(t,n)||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.")}()),i=o[0],c=o[1];(0,r.useEffect)((function(){void 0===e.ok?void 0===e.success?void 0!==e.running&&c("var(--icon-yellow)"):!0===e.success?c("var(--icon-green)"):!1===e.success&&c("var(--icon-red)"):c(e.ok?"var(--icon-green)":"var(--iconTertiary)")}),[e]);var a={width:"10px",height:"10px",borderRadius:"50%",backgroundColor:i,display:"inline-block"};return r.createElement("div",{style:a})}},505:(e,t,n)=>{function r(e){var t=document.createElement("textarea");t.value=e,t.style.position="fixed",t.style.left="-9999px",document.body.appendChild(t),t.select(),t.setSelectionRange(0,99999),document.execCommand("copy"),document.body.removeChild(t)}n.d(t,{l:()=>r})},1140:(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{function _typeof(e){return _typeof="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},_typeof(e)}function _classCallCheck(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function _defineProperties(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,_toPropertyKey(r.key),r)}}function _createClass(e,t,n){return t&&_defineProperties(e.prototype,t),n&&_defineProperties(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e}function _toPropertyKey(e){var t=_toPrimitive(e,"string");return"symbol"==_typeof(t)?t:t+""}function _toPrimitive(e,t){if("object"!=_typeof(e)||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=_typeof(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}__webpack_require__.d(__webpack_exports__,{h:()=>JsonUtil});var serialize=__webpack_require__(5840),JsonUtil=function(){function JsonUtil(){_classCallCheck(this,JsonUtil)}return _createClass(JsonUtil,null,[{key:"getJson",value:function(e){return serialize(e)}},{key:"fromJson",value:function fromJson(str){return eval("(".concat(str,")"))}}])}()},4238:(e,t,n)=>{n.d(t,{HK:()=>p,b$:()=>f,hF:()=>d,hf:()=>h});var r=n(1140),o=n(7613),i=n(1869),c=n(3459);function s(e){return s="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},s(e)}function a(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,l(r.key),r)}}function l(e){var t=function(e){if("object"!=s(e)||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,"string");if("object"!=s(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==s(t)?t:t+""}var u=new i.Nz,f=!0,p=function(e){return e[e.connection=0]="connection",e[e.sys_get=1]="sys_get",e[e.sys_getting=2]="sys_getting",e[e.shell_open=3]="shell_open",e[e.shell_send=4]="shell_send",e[e.shell_getting=5]="shell_getting",e[e.shell_copy=6]="shell_copy",e[e.shell_cd=7]="shell_cd",e[e.docker_get=8]="docker_get",e[e.docker_getting=9]="docker_getting",e[e.docker_shell_logs=10]="docker_shell_logs",e[e.docker_shell_logs_getting=11]="docker_shell_logs_getting",e[e.docker_shell_logs_cancel=12]="docker_shell_logs_cancel",e[e.docker_shell_exec_open=13]="docker_shell_exec_open",e[e.docker_shell_exec=14]="docker_shell_exec",e[e.docker_shell_exec_getting=15]="docker_shell_exec_getting",e[e.docker_shell_exec_cancel=16]="docker_shell_exec_cancel",e[e.docker_switch=17]="docker_switch",e[e.docker_del_container=18]="docker_del_container",e[e.process_get=19]="process_get",e[e.process_getting=20]="process_getting",e[e.process_close=21]="process_close",e[e.systemd_inside_get=22]="systemd_inside_get",e[e.systemd_inside_getting=23]="systemd_inside_getting",e[e.systemd_logs_get=24]="systemd_logs_get",e[e.systemd_logs_getting=25]="systemd_logs_getting",e[e.remote_shell_open=26]="remote_shell_open",e[e.remote_shell_send=27]="remote_shell_send",e[e.remote_shell_getting=28]="remote_shell_getting",e[e.remote_shell_cancel=29]="remote_shell_cancel",e[e.remote_shell_cd=30]="remote_shell_cd",e[e.infos=31]="infos",e[e.connect=32]="connect",e[e.rdp_connect=33]="rdp_connect",e[e.rdp_bitmap=34]="rdp_bitmap",e[e.rdp_close=35]="rdp_close",e[e.rdp_error=36]="rdp_error",e[e.mouse=37]="mouse",e[e.wheel=38]="wheel",e[e.scancode=39]="scancode",e[e.unicode=40]="unicode",e[e.rdp_disconnect=41]="rdp_disconnect",e[e.vir_net_serverIno_get=42]="vir_net_serverIno_get",e[e.file_info=43]="file_info",e[e.file_video_trans=44]="file_video_trans",e[e.file_video_trans_progress=45]="file_video_trans_progress",e[e.file_uncompress=46]="file_uncompress",e[e.file_uncompress_progress=47]="file_uncompress_progress",e[e.file_compress=48]="file_compress",e[e.file_compress_progress=49]="file_compress_progress",e[e.log_viewer=50]="log_viewer",e[e.log_viewer_watch=51]="log_viewer_watch",e[e.search_file=52]="search_file",e[e.search_file_progress=53]="search_file_progress",e[e.search_file_index=54]="search_file_index",e[e.search_file_cancel=55]="search_file_cancel",e[e.rtsp_get=56]="rtsp_get",e[e.rtsp_cancel=57]="rtsp_cancel",e[e.workflow_exec=58]="workflow_exec",e[e.workflow_get=59]="workflow_get",e[e.workflow_realtime=60]="workflow_realtime",e[e.workflow_realtime_one_req=61]="workflow_realtime_one_req",e[e.workflow_realtime_one_rsq=62]="workflow_realtime_one_rsq",e[e.workflow_search_by_run_name=63]="workflow_search_by_run_name",e}({}),d=function(e){return e[e.data=0]="data",e[e.other=1]="other",e}({}),h=function(){function e(t,n,r){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.cmdType=t,this.context=n,this.bin_context=r,this.code=c.m.Sucess}return t=e,s=[{key:"decode",value:function(t){var n=o.WsMessage.decode(t),i=new e(n.cmdType,r.h.fromJson(n.context),n.binContext);return i.code=n.code,i.message=n.message,i}}],(n=[{key:"encode",value:function(){if(f)return o.WsMessage.encode(o.WsMessage.create({cmdType:this.cmdType,context:r.h.getJson(this.context),code:this.code,message:this.message,binContext:this.bin_context})).finish();var e={type:i.LP.EVENT,data:[this.cmdType,this.context,this.code,this.message]};return u.encode(e)}}])&&a(t.prototype,n),s&&a(t,s),Object.defineProperty(t,"prototype",{writable:!1}),t;var t,n,s}()},4944:(e,t,n)=>{n.d(t,{ws:()=>r});var r=new(n(8965).I)(window.location.host,(function(e){}))},7613:(e,t,n)=>{function r(e){return r="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},r(e)}var o=n(6946),i=o.Reader,c=o.Writer,s=o.util,a=o.roots.default||(o.roots.default={});a.WsMessage=function(){function e(e){if(e)for(var t=Object.keys(e),n=0;n<t.length;++n)null!=e[t[n]]&&(this[t[n]]=e[t[n]])}return e.prototype.cmdType=0,e.prototype.context="",e.prototype.binContext=s.newBuffer([]),e.prototype.message="",e.prototype.code=0,e.create=function(t){return new e(t)},e.encode=function(e,t){return t||(t=c.create()),null!=e.cmdType&&Object.hasOwnProperty.call(e,"cmdType")&&t.uint32(8).int32(e.cmdType),null!=e.context&&Object.hasOwnProperty.call(e,"context")&&t.uint32(18).string(e.context),null!=e.binContext&&Object.hasOwnProperty.call(e,"binContext")&&t.uint32(26).bytes(e.binContext),null!=e.message&&Object.hasOwnProperty.call(e,"message")&&t.uint32(34).string(e.message),null!=e.code&&Object.hasOwnProperty.call(e,"code")&&t.uint32(40).int32(e.code),t},e.encodeDelimited=function(e,t){return this.encode(e,t).ldelim()},e.decode=function(e,t){e instanceof i||(e=i.create(e));for(var n=void 0===t?e.len:e.pos+t,r=new a.WsMessage;e.pos<n;){var o=e.uint32();switch(o>>>3){case 1:r.cmdType=e.int32();break;case 2:r.context=e.string();break;case 3:r.binContext=e.bytes();break;case 4:r.message=e.string();break;case 5:r.code=e.int32();break;default:e.skipType(7&o)}}return r},e.decodeDelimited=function(e){return e instanceof i||(e=new i(e)),this.decode(e,e.uint32())},e.verify=function(e){return"object"!==r(e)||null===e?"object expected":null!=e.cmdType&&e.hasOwnProperty("cmdType")&&!s.isInteger(e.cmdType)?"cmdType: integer expected":null!=e.context&&e.hasOwnProperty("context")&&!s.isString(e.context)?"context: string expected":null!=e.binContext&&e.hasOwnProperty("binContext")&&!(e.binContext&&"number"==typeof e.binContext.length||s.isString(e.binContext))?"binContext: buffer expected":null!=e.message&&e.hasOwnProperty("message")&&!s.isString(e.message)?"message: string expected":null!=e.code&&e.hasOwnProperty("code")&&!s.isInteger(e.code)?"code: integer expected":null},e.fromObject=function(e){if(e instanceof a.WsMessage)return e;var t=new a.WsMessage;return null!=e.cmdType&&(t.cmdType=0|e.cmdType),null!=e.context&&(t.context=String(e.context)),null!=e.binContext&&("string"==typeof e.binContext?s.base64.decode(e.binContext,t.binContext=s.newBuffer(s.base64.length(e.binContext)),0):e.binContext.length>=0&&(t.binContext=e.binContext)),null!=e.message&&(t.message=String(e.message)),null!=e.code&&(t.code=0|e.code),t},e.toObject=function(e,t){t||(t={});var n={};return t.defaults&&(n.cmdType=0,n.context="",t.bytes===String?n.binContext="":(n.binContext=[],t.bytes!==Array&&(n.binContext=s.newBuffer(n.binContext))),n.message="",n.code=0),null!=e.cmdType&&e.hasOwnProperty("cmdType")&&(n.cmdType=e.cmdType),null!=e.context&&e.hasOwnProperty("context")&&(n.context=e.context),null!=e.binContext&&e.hasOwnProperty("binContext")&&(n.binContext=t.bytes===String?s.base64.encode(e.binContext,0,e.binContext.length):t.bytes===Array?Array.prototype.slice.call(e.binContext):e.binContext),null!=e.message&&e.hasOwnProperty("message")&&(n.message=e.message),null!=e.code&&e.hasOwnProperty("code")&&(n.code=e.code),n},e.prototype.toJSON=function(){return this.constructor.toObject(this,o.util.toJSONOptions)},e.getTypeUrl=function(e){return void 0===e&&(e="type.googleapis.com"),e+"/WsMessage"},e}(),e.exports=a},8965:(e,t,n)=>{n.d(t,{I:()=>m});var r=n(4238),o=n(1869),i=n(3459),c=n(2042);function s(e){return s="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},s(e)}function a(){a=function(){return t};var e,t={},n=Object.prototype,r=n.hasOwnProperty,o=Object.defineProperty||function(e,t,n){e[t]=n.value},i="function"==typeof Symbol?Symbol:{},c=i.iterator||"@@iterator",l=i.asyncIterator||"@@asyncIterator",u=i.toStringTag||"@@toStringTag";function f(e,t,n){return Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{f({},"")}catch(e){f=function(e,t,n){return e[t]=n}}function p(e,t,n,r){var i=t&&t.prototype instanceof g?t:g,c=Object.create(i.prototype),s=new N(r||[]);return o(c,"_invoke",{value:T(e,n,s)}),c}function d(e,t,n){try{return{type:"normal",arg:e.call(t,n)}}catch(e){return{type:"throw",arg:e}}}t.wrap=p;var h="suspendedStart",m="suspendedYield",y="executing",_="completed",v={};function g(){}function b(){}function w(){}var x={};f(x,c,(function(){return this}));var k=Object.getPrototypeOf,E=k&&k(k(M([])));E&&E!==n&&r.call(E,c)&&(x=E);var S=w.prototype=g.prototype=Object.create(x);function C(e){["next","throw","return"].forEach((function(t){f(e,t,(function(e){return this._invoke(t,e)}))}))}function O(e,t){function n(o,i,c,a){var l=d(e[o],e,i);if("throw"!==l.type){var u=l.arg,f=u.value;return f&&"object"==s(f)&&r.call(f,"__await")?t.resolve(f.__await).then((function(e){n("next",e,c,a)}),(function(e){n("throw",e,c,a)})):t.resolve(f).then((function(e){u.value=e,c(u)}),(function(e){return n("throw",e,c,a)}))}a(l.arg)}var i;o(this,"_invoke",{value:function(e,r){function o(){return new t((function(t,o){n(e,r,t,o)}))}return i=i?i.then(o,o):o()}})}function T(t,n,r){var o=h;return function(i,c){if(o===y)throw Error("Generator is already running");if(o===_){if("throw"===i)throw c;return{value:e,done:!0}}for(r.method=i,r.arg=c;;){var s=r.delegate;if(s){var a=P(s,r);if(a){if(a===v)continue;return a}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if(o===h)throw o=_,r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);o=y;var l=d(t,n,r);if("normal"===l.type){if(o=r.done?_:m,l.arg===v)continue;return{value:l.arg,done:r.done}}"throw"===l.type&&(o=_,r.method="throw",r.arg=l.arg)}}}function P(t,n){var r=n.method,o=t.iterator[r];if(o===e)return n.delegate=null,"throw"===r&&t.iterator.return&&(n.method="return",n.arg=e,P(t,n),"throw"===n.method)||"return"!==r&&(n.method="throw",n.arg=new TypeError("The iterator does not provide a '"+r+"' method")),v;var i=d(o,t.iterator,n.arg);if("throw"===i.type)return n.method="throw",n.arg=i.arg,n.delegate=null,v;var c=i.arg;return c?c.done?(n[t.resultName]=c.value,n.next=t.nextLoc,"return"!==n.method&&(n.method="next",n.arg=e),n.delegate=null,v):c:(n.method="throw",n.arg=new TypeError("iterator result is not an object"),n.delegate=null,v)}function j(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function L(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function N(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(j,this),this.reset(!0)}function M(t){if(t||""===t){var n=t[c];if(n)return n.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var o=-1,i=function n(){for(;++o<t.length;)if(r.call(t,o))return n.value=t[o],n.done=!1,n;return n.value=e,n.done=!0,n};return i.next=i}}throw new TypeError(s(t)+" is not iterable")}return b.prototype=w,o(S,"constructor",{value:w,configurable:!0}),o(w,"constructor",{value:b,configurable:!0}),b.displayName=f(w,u,"GeneratorFunction"),t.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===b||"GeneratorFunction"===(t.displayName||t.name))},t.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,w):(e.__proto__=w,f(e,u,"GeneratorFunction")),e.prototype=Object.create(S),e},t.awrap=function(e){return{__await:e}},C(O.prototype),f(O.prototype,l,(function(){return this})),t.AsyncIterator=O,t.async=function(e,n,r,o,i){void 0===i&&(i=Promise);var c=new O(p(e,n,r,o),i);return t.isGeneratorFunction(n)?c:c.next().then((function(e){return e.done?e.value:c.next()}))},C(S),f(S,u,"Generator"),f(S,c,(function(){return this})),f(S,"toString",(function(){return"[object Generator]"})),t.keys=function(e){var t=Object(e),n=[];for(var r in t)n.push(r);return n.reverse(),function e(){for(;n.length;){var r=n.pop();if(r in t)return e.value=r,e.done=!1,e}return e.done=!0,e}},t.values=M,N.prototype={constructor:N,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=e,this.done=!1,this.delegate=null,this.method="next",this.arg=e,this.tryEntries.forEach(L),!t)for(var n in this)"t"===n.charAt(0)&&r.call(this,n)&&!isNaN(+n.slice(1))&&(this[n]=e)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(t){if(this.done)throw t;var n=this;function o(r,o){return s.type="throw",s.arg=t,n.next=r,o&&(n.method="next",n.arg=e),!!o}for(var i=this.tryEntries.length-1;i>=0;--i){var c=this.tryEntries[i],s=c.completion;if("root"===c.tryLoc)return o("end");if(c.tryLoc<=this.prev){var a=r.call(c,"catchLoc"),l=r.call(c,"finallyLoc");if(a&&l){if(this.prev<c.catchLoc)return o(c.catchLoc,!0);if(this.prev<c.finallyLoc)return o(c.finallyLoc)}else if(a){if(this.prev<c.catchLoc)return o(c.catchLoc,!0)}else{if(!l)throw Error("try statement without catch or finally");if(this.prev<c.finallyLoc)return o(c.finallyLoc)}}}},abrupt:function(e,t){for(var n=this.tryEntries.length-1;n>=0;--n){var o=this.tryEntries[n];if(o.tryLoc<=this.prev&&r.call(o,"finallyLoc")&&this.prev<o.finallyLoc){var i=o;break}}i&&("break"===e||"continue"===e)&&i.tryLoc<=t&&t<=i.finallyLoc&&(i=null);var c=i?i.completion:{};return c.type=e,c.arg=t,i?(this.method="next",this.next=i.finallyLoc,v):this.complete(c)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),v},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.finallyLoc===e)return this.complete(n.completion,n.afterLoc),L(n),v}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.tryLoc===e){var r=n.completion;if("throw"===r.type){var o=r.arg;L(n)}return o}}throw Error("illegal catch attempt")},delegateYield:function(t,n,r){return this.delegate={iterator:M(t),resultName:n,nextLoc:r},"next"===this.method&&(this.arg=e),v}},t}function l(e,t,n,r,o,i,c){try{var s=e[i](c),a=s.value}catch(e){return void n(e)}s.done?t(a):Promise.resolve(a).then(r,o)}function u(e){return function(){var t=this,n=arguments;return new Promise((function(r,o){var i=e.apply(t,n);function c(e){l(i,r,o,c,s,"next",e)}function s(e){l(i,r,o,c,s,"throw",e)}c(void 0)}))}}function f(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,d(r.key),r)}}function p(e,t,n){return(t=d(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function d(e){var t=function(e){if("object"!=s(e)||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,"string");if("object"!=s(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==s(t)?t:t+""}var h=new o.XM,m=function(){return e=function e(t,n){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),p(this,"_status",0),p(this,"_self_close",!1),p(this,"_msgHandlerMap",new Map),p(this,"_msgResolveMap",new Map),p(this,"_msgResolveTimeoutMap",new Map),this._url=t,this._authHandle=n},t=[{key:"handMsg",value:function(e,t){t.code===i.m.Fail&&(0,c.zN)(t.message);var n=this._msgResolveMap.get(t.cmdType);n&&(n(t),this._msgResolveMap.delete(t.cmdType));var r=this._msgResolveTimeoutMap.get(e);r&&(clearTimeout(r),this._msgResolveTimeoutMap.delete(e));var o=this._msgHandlerMap.get(t.cmdType);o&&o(t)}},{key:"connect",value:(m=u(a().mark((function e(){var t,n=this;return a().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return t=function(e){if(0===n._status){var t=function(){n._status=0,h.removeAllListeners(),h.destroy(),n._subscribeUnconnect&&!n._self_close&&n._subscribeUnconnect(),n._self_close=!1},o=function(){var t=u(a().mark((function t(o){return a().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:console.log("ws连接成功"),n._authHandle&&n._authHandle(n._socket),n._status=1,e(!0),h.on("decoded",(function(e){var t=new r.hf(e.data[0],e.data[1]);t.code=e.data[2],t.message=e.data[3],t.wss=n._socket,n.handMsg(t.cmdType,t)}));case 5:case"end":return t.stop()}}),t)})));return function(e){return t.apply(this,arguments)}}(),i=[],c=!1,s=function(){var e=u(a().mark((function e(t){var o;return a().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:r.b$?((o=r.hf.decode(t)).wss=n._socket,n.handMsg(o.cmdType,o)):h.add(t),l();case 2:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}(),l=function(){if(0!==i.length){c=!0;var e=i.shift();if(e instanceof ArrayBuffer)s(new Uint8Array(e));else if(e instanceof Blob){var t=new FileReader;t.onload=u(a().mark((function e(){return a().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:s(new Uint8Array(t.result));case 1:case"end":return e.stop()}}),e)}))),t.readAsArrayBuffer(e)}else s(e)}else c=!1},f=function(){var e=u(a().mark((function e(t){return a().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:i.push(t.data),c||l();case 2:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}();if(n.isAilive())e(!0);else{var p=new WebSocket("ws://".concat(n._url,"?token=").concat(localStorage.getItem("token"),"&type=").concat(r.hF.data));p.addEventListener("open",o),p.addEventListener("message",f),p.addEventListener("close",function(){var e=u(a().mark((function e(n){return a().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return console.log("Disconnected from WebSocket server"),e.next=3,t();case 3:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}()),p.addEventListener("error",(function(e){console.error("WebSocket error:",e),t()})),n._socket=p}}else e(!0)},e.abrupt("return",new Promise(t));case 2:case"end":return e.stop()}}),e)}))),function(){return m.apply(this,arguments)})},{key:"sendData",value:(d=u(a().mark((function e(t,n){var o;return a().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return(o=new r.hf(t)).context=n,e.abrupt("return",this.send(o));case 3:case"end":return e.stop()}}),e,this)}))),function(e,t){return d.apply(this,arguments)})},{key:"send",value:(l=u(a().mark((function e(t){var n,r,o=this;return a().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!this._promise){e.next=4;break}return e.next=3,this._promise;case 3:this._promise=null;case 4:return e.next=6,this.connect();case 6:if(n=t.encode(),Array.isArray(n))for(r=0;r<n.length;r++)this._socket.send(n[r]);else this._socket.send(n);return e.abrupt("return",new Promise((function(e,n){var r=setTimeout((function(){e(null),console.log("ws超时",t.cmdType)}),6e3);o._msgResolveMap.set(t.cmdType,e),o._msgResolveTimeoutMap.set(t.cmdType,r)})));case 9:case"end":return e.stop()}}),e,this)}))),function(e){return l.apply(this,arguments)})},{key:"setPromise",value:function(e){this._promise=new Promise(function(){var t=u(a().mark((function t(n){return a().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,e(n);case 2:case"end":return t.stop()}}),t)})));return function(e){return t.apply(this,arguments)}}())}},{key:"isAilive",value:function(){return!(1!==this._status||!this._socket||this._socket.readyState!==WebSocket.OPEN)}},{key:"subscribeUnconnect",value:function(e){this._subscribeUnconnect=e}},{key:"unSubscribeUnconnect",value:function(){this._subscribeUnconnect=null}},{key:"unConnect",value:(s=u(a().mark((function e(){return a().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:this.isAilive()&&(console.log("主动关闭客户端"),this._self_close=!0,this._socket.close()),this._status=0;case 2:case"end":return e.stop()}}),e,this)}))),function(){return s.apply(this,arguments)})},{key:"addMsg",value:(o=u(a().mark((function e(t,n){return a().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:this._msgHandlerMap.set(t,n);case 1:case"end":return e.stop()}}),e,this)}))),function(e,t){return o.apply(this,arguments)})},{key:"removeMsg",value:function(e){this._msgHandlerMap.delete(e)}}],n=[{key:"getOtherWebSocket",value:function(e){return new WebSocket("ws://".concat(window.location.host,"?token=").concat(localStorage.getItem("token"),"&type=").concat(r.hF.other,"&code=").concat(e))}},{key:"getOtherWebSocketUrl",value:function(e,t){for(var n="ws://".concat(window.location.host,"?token=").concat(localStorage.getItem("token"),"&type=").concat(r.hF.other,"&code=").concat(e),o=0,i=Object.keys(t);o<i.length;o++){var c=i[o];n+="&".concat(c,"=").concat(encodeURIComponent(t[c]))}return n}}],t&&f(e.prototype,t),n&&f(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e;var e,t,n,o,s,l,d,m}()}}]);
|
|
File without changes
|