@colabo-flow/s-go 0.4.1 → 1.0.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 (50) hide show
  1. package/CHANGELOG.md +83 -0
  2. package/dist/cjs/index.js +1799 -7
  3. package/dist/cjs/index.js.map +7 -1
  4. package/dist/esm/index.js +1748 -7
  5. package/dist/esm/index.js.map +7 -1
  6. package/dist/{cjs → types}/demo/config.d.ts +10 -10
  7. package/dist/{esm → types}/demo/create-client.d.ts +1 -1
  8. package/dist/types/demo/create-host.d.ts +7 -0
  9. package/dist/{esm → types}/demo/create-orchestrator.d.ts +1 -1
  10. package/dist/{cjs → types}/demo/send.d.ts +1 -1
  11. package/dist/types/index.d.ts +13 -0
  12. package/dist/{cjs → types}/jest.config.d.ts +3 -3
  13. package/dist/{esm → types}/lib/client/index.d.ts +4 -4
  14. package/dist/{cjs/demo/create-client.d.ts → types/lib/flowchestrator/index.d.ts} +1 -1
  15. package/dist/types/lib/flowchestrator/store/flow.store.d.ts +57 -0
  16. package/dist/{cjs/demo/create-host.d.ts → types/lib/flowchestrator/store/flow.store.test.d.ts} +1 -1
  17. package/dist/{cjs/demo/create-orchestrator.d.ts → types/lib/flowchestrator/store/flowFlowchestrator.store.test.d.ts} +1 -1
  18. package/dist/types/lib/flowchestrator/store/flowchestrator.store.d.ts +82 -0
  19. package/dist/types/lib/flowchestrator/store/index.d.ts +42 -0
  20. package/dist/{esm → types}/lib/host/index.d.ts +7 -7
  21. package/dist/{cjs → types}/lib/host/omnipresentTasks.d.ts +13 -13
  22. package/dist/types/lib/host/vos.d.ts +4 -0
  23. package/dist/{cjs → types}/lib/operators.d.ts +5 -5
  24. package/dist/{esm → types}/lib/orchestrator/index.d.ts +2 -2
  25. package/dist/{cjs → types}/lib/params.d.ts +1 -1
  26. package/dist/{cjs → types}/lib/uuid_fix.d.ts +15 -15
  27. package/dist/{cjs → types}/lib/vos.d.ts +205 -205
  28. package/dist/types/vitest.config.d.ts +2 -0
  29. package/package.json +73 -13
  30. package/dist/cjs/index.d.ts +0 -4
  31. package/dist/cjs/lib/client/index.d.ts +0 -4
  32. package/dist/cjs/lib/host/index.d.ts +0 -7
  33. package/dist/cjs/lib/host/vos.d.ts +0 -4
  34. package/dist/cjs/lib/orchestrator/index.d.ts +0 -2
  35. package/dist/cjs/tests/units/chalk/index.d.ts +0 -21
  36. package/dist/cjs/tests/units/tests-vos/tasks-and-flows.vos.d.ts +0 -20
  37. package/dist/esm/demo/config.d.ts +0 -10
  38. package/dist/esm/demo/create-host.d.ts +0 -1
  39. package/dist/esm/demo/send.d.ts +0 -1
  40. package/dist/esm/index.d.ts +0 -4
  41. package/dist/esm/jest.config.d.ts +0 -3
  42. package/dist/esm/lib/host/omnipresentTasks.d.ts +0 -13
  43. package/dist/esm/lib/host/vos.d.ts +0 -4
  44. package/dist/esm/lib/operators.d.ts +0 -5
  45. package/dist/esm/lib/params.d.ts +0 -1
  46. package/dist/esm/lib/uuid_fix.d.ts +0 -15
  47. package/dist/esm/lib/vos.d.ts +0 -205
  48. package/dist/esm/tests/units/chalk/index.d.ts +0 -21
  49. package/dist/esm/tests/units/tests-vos/tasks-and-flows.vos.d.ts +0 -20
  50. package/dist/index.d.ts +0 -221
package/dist/cjs/index.js CHANGED
@@ -1,8 +1,1800 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("querystring"),t=require("tty"),r=require("util"),n=require("os"),o=require("buffer"),i=require("assert"),s=require("stream"),a=require("events"),u=require("string_decoder/"),c=require("net"),l=require("tls"),f=require("http"),h=require("https"),d=require("url"),p=require("zlib");function g(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var m=g(e),b=g(t),v=g(r),y=g(n),w=g(o),E=g(i),I=g(s),C=g(a),x=g(u),B=g(c),T=g(l),k=g(f),O=g(h),S=g(d),U=g(p),_="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},N={},A={},R=Object.prototype.hasOwnProperty;function M(e){try{return decodeURIComponent(e.replace(/\+/g," "))}catch(e){return null}}function L(e){try{return encodeURIComponent(e)}catch(e){return null}}A.stringify=function(e,t){t=t||"";var r,n,o=[];for(n in"string"!=typeof t&&(t="?"),e)if(R.call(e,n)){if((r=e[n])||null!=r&&!isNaN(r)||(r=""),n=L(n),r=L(r),null===n||null===r)continue;o.push(n+"="+r)}return o.length?t+o.join("&"):""},A.parse=function(e){for(var t,r=/([^=?#&]+)=?([^&]*)/g,n={};t=r.exec(e);){var o=M(t[1]),i=M(t[2]);null===o||null===i||o in n||(n[o]=i)}return n};var F=function(e,t){if(t=t.split(":")[0],!(e=+e))return!1;switch(t){case"http":case"ws":return 80!==e;case"https":case"wss":return 443!==e;case"ftp":return 21!==e;case"gopher":return 70!==e;case"file":return!1}return 0!==e},P=A,j=/^[\x00-\x20\u00a0\u1680\u2000-\u200a\u2028\u2029\u202f\u205f\u3000\ufeff]+/,D=/[\n\r\t]/g,q=/^[A-Za-z][A-Za-z0-9+-.]*:\/\//,$=/:\d+$/,H=/^([a-z][a-z0-9.+-]*:)?(\/\/)?([\\/]+)?([\S\s]*)/i,z=/^[a-zA-Z]:/;function G(e){return(e||"").toString().replace(j,"")}var K=[["#","hash"],["?","query"],function(e,t){return W(t.protocol)?e.replace(/\\/g,"/"):e},["/","pathname"],["@","auth",1],[NaN,"host",void 0,1,1],[/:(\d*)$/,"port",void 0,1],[NaN,"hostname",void 0,1,1]],V={hash:1,query:1};function Q(e){var t,r=("undefined"!=typeof window?window:void 0!==_?_:"undefined"!=typeof self?self:{}).location||{},n={},o=typeof(e=e||r);if("blob:"===e.protocol)n=new J(unescape(e.pathname),{});else if("string"===o)for(t in n=new J(e,{}),V)delete n[t];else if("object"===o){for(t in e)t in V||(n[t]=e[t]);void 0===n.slashes&&(n.slashes=q.test(e.href))}return n}function W(e){return"file:"===e||"ftp:"===e||"http:"===e||"https:"===e||"ws:"===e||"wss:"===e}function Y(e,t){e=(e=G(e)).replace(D,""),t=t||{};var r,n=H.exec(e),o=n[1]?n[1].toLowerCase():"",i=!!n[2],s=!!n[3],a=0;return i?s?(r=n[2]+n[3]+n[4],a=n[2].length+n[3].length):(r=n[2]+n[4],a=n[2].length):s?(r=n[3]+n[4],a=n[3].length):r=n[4],"file:"===o?a>=2&&(r=r.slice(2)):W(o)?r=n[4]:o?i&&(r=r.slice(2)):a>=2&&W(t.protocol)&&(r=n[4]),{protocol:o,slashes:i||W(o),slashesCount:a,rest:r}}function J(e,t,r){if(e=(e=G(e)).replace(D,""),!(this instanceof J))return new J(e,t,r);var n,o,i,s,a,u,c=K.slice(),l=typeof t,f=this,h=0;for("object"!==l&&"string"!==l&&(r=t,t=null),r&&"function"!=typeof r&&(r=P.parse),n=!(o=Y(e||"",t=Q(t))).protocol&&!o.slashes,f.slashes=o.slashes||n&&t.slashes,f.protocol=o.protocol||t.protocol||"",e=o.rest,("file:"===o.protocol&&(2!==o.slashesCount||z.test(e))||!o.slashes&&(o.protocol||o.slashesCount<2||!W(f.protocol)))&&(c[3]=[/(.*)/,"pathname"]);h<c.length;h++)"function"!=typeof(s=c[h])?(i=s[0],u=s[1],i!=i?f[u]=e:"string"==typeof i?~(a="@"===i?e.lastIndexOf(i):e.indexOf(i))&&("number"==typeof s[2]?(f[u]=e.slice(0,a),e=e.slice(a+s[2])):(f[u]=e.slice(a),e=e.slice(0,a))):(a=i.exec(e))&&(f[u]=a[1],e=e.slice(0,a.index)),f[u]=f[u]||n&&s[3]&&t[u]||"",s[4]&&(f[u]=f[u].toLowerCase())):e=s(e,f);r&&(f.query=r(f.query)),n&&t.slashes&&"/"!==f.pathname.charAt(0)&&(""!==f.pathname||""!==t.pathname)&&(f.pathname=function(e,t){if(""===e)return t;for(var r=(t||"/").split("/").slice(0,-1).concat(e.split("/")),n=r.length,o=r[n-1],i=!1,s=0;n--;)"."===r[n]?r.splice(n,1):".."===r[n]?(r.splice(n,1),s++):s&&(0===n&&(i=!0),r.splice(n,1),s--);return i&&r.unshift(""),"."!==o&&".."!==o||r.push(""),r.join("/")}(f.pathname,t.pathname)),"/"!==f.pathname.charAt(0)&&W(f.protocol)&&(f.pathname="/"+f.pathname),F(f.port,f.protocol)||(f.host=f.hostname,f.port=""),f.username=f.password="",f.auth&&(~(a=f.auth.indexOf(":"))?(f.username=f.auth.slice(0,a),f.username=encodeURIComponent(decodeURIComponent(f.username)),f.password=f.auth.slice(a+1),f.password=encodeURIComponent(decodeURIComponent(f.password))):f.username=encodeURIComponent(decodeURIComponent(f.auth)),f.auth=f.password?f.username+":"+f.password:f.username),f.origin="file:"!==f.protocol&&W(f.protocol)&&f.host?f.protocol+"//"+f.host:"null",f.href=f.toString()}J.prototype={set:function(e,t,r){var n=this;switch(e){case"query":"string"==typeof t&&t.length&&(t=(r||P.parse)(t)),n[e]=t;break;case"port":n[e]=t,F(t,n.protocol)?t&&(n.host=n.hostname+":"+t):(n.host=n.hostname,n[e]="");break;case"hostname":n[e]=t,n.port&&(t+=":"+n.port),n.host=t;break;case"host":n[e]=t,$.test(t)?(t=t.split(":"),n.port=t.pop(),n.hostname=t.join(":")):(n.hostname=t,n.port="");break;case"protocol":n.protocol=t.toLowerCase(),n.slashes=!r;break;case"pathname":case"hash":if(t){var o="pathname"===e?"/":"#";n[e]=t.charAt(0)!==o?o+t:t}else n[e]=t;break;case"username":case"password":n[e]=encodeURIComponent(t);break;case"auth":var i=t.indexOf(":");~i?(n.username=t.slice(0,i),n.username=encodeURIComponent(decodeURIComponent(n.username)),n.password=t.slice(i+1),n.password=encodeURIComponent(decodeURIComponent(n.password))):n.username=encodeURIComponent(decodeURIComponent(t))}for(var s=0;s<K.length;s++){var a=K[s];a[4]&&(n[a[1]]=n[a[1]].toLowerCase())}return n.auth=n.password?n.username+":"+n.password:n.username,n.origin="file:"!==n.protocol&&W(n.protocol)&&n.host?n.protocol+"//"+n.host:"null",n.href=n.toString(),n},toString:function(e){e&&"function"==typeof e||(e=P.stringify);var t,r=this,n=r.host,o=r.protocol;o&&":"!==o.charAt(o.length-1)&&(o+=":");var i=o+(r.protocol&&r.slashes||W(r.protocol)?"//":"");return r.username?(i+=r.username,r.password&&(i+=":"+r.password),i+="@"):r.password?(i+=":"+r.password,i+="@"):"file:"!==r.protocol&&W(r.protocol)&&!n&&"/"!==r.pathname&&(i+="@"),(":"===n[n.length-1]||$.test(r.hostname)&&!r.port)&&(n+=":"),i+=n+r.pathname,(t="object"==typeof r.query?e(r.query):r.query)&&(i+="?"!==t.charAt(0)?"?"+t:t),r.hash&&(i+=r.hash),i}},J.extractProtocol=Y,J.location=Q,J.trimLeft=G,J.qs=P;var X=J,Z={},ee={},te={},re={exports:{}};!function(e){var t=4294967296,r=1/t,n=9007199254740991;function o(e){return e<=n&&e>=-n}function i(e,t,r){if("number"!=typeof(e=+e)||e<t||e>r||Math.floor(e)!==e)throw new TypeError('"value" argument is out of bounds');return e}function s(e,t,r){if(t<0||t+r>e.length)throw new RangeError("Index out of range")}e.exports.isContiguousInt=o,e.exports.assertContiguousInt=function(e){if(!o(e))throw new TypeError("number cannot be represented as a contiguous integer")},["UInt","Int"].forEach((function(t){var r=t+"8";e.exports["read"+r]=Buffer.prototype["read"+r].call,e.exports["write"+r]=Buffer.prototype["write"+r].call,["16","32"].forEach((function(r){["LE","BE"].forEach((function(n){var o=t+r+n,i=Buffer.prototype["read"+o];e.exports["read"+o]=function(e,t){return i.call(e,t)};var s=Buffer.prototype["write"+o];e.exports["write"+o]=function(e,t,r){return s.call(e,t,r)}}))}))})),e.exports.readUInt24BE=function(e,t){return e.readUInt8(t)<<16|e.readUInt16BE(t+1)},e.exports.writeUInt24BE=function(e,t,r){t=i(t,0,16777215),s(e,r,3),e.writeUInt8(t>>>16,r),e.writeUInt16BE(65535&t,r+1)},e.exports.readUInt40BE=function(e,r){return(e.readUInt8(r)||0)*t+e.readUInt32BE(r+1)},e.exports.writeUInt40BE=function(e,t,n){t=i(t,0,0xffffffffff),s(e,n,5),e.writeUInt8(Math.floor(t*r),n),e.writeInt32BE(-1&t,n+1)},e.exports.readUInt48BE=function(e,r){return e.readUInt16BE(r)*t+e.readUInt32BE(r+2)},e.exports.writeUInt48BE=function(e,t,n){t=i(t,0,0xffffffffffff),s(e,n,6),e.writeUInt16BE(Math.floor(t*r),n),e.writeInt32BE(-1&t,n+2)},e.exports.readUInt56BE=function(e,r){return((e.readUInt8(r)||0)<<16|e.readUInt16BE(r+1))*t+e.readUInt32BE(r+3)},e.exports.writeUInt56BE=function(e,t,n){if(t=i(t,0,72057594037927940),s(e,n,7),t<72057594037927940){var o=Math.floor(t*r);e.writeUInt8(o>>>16,n),e.writeUInt16BE(65535&o,n+1),e.writeInt32BE(-1&t,n+3)}else e[n]=255,e[n+1]=255,e[n+2]=255,e[n+3]=255,e[n+4]=255,e[n+5]=255,e[n+6]=255},e.exports.readUInt64BE=function(e,r){return e.readUInt32BE(r)*t+e.readUInt32BE(r+4)},e.exports.writeUInt64BE=function(e,t,n){t=i(t,0,0x10000000000000000),s(e,n,8),t<0x10000000000000000?(e.writeUInt32BE(Math.floor(t*r),n),e.writeInt32BE(-1&t,n+4)):(e[n]=255,e[n+1]=255,e[n+2]=255,e[n+3]=255,e[n+4]=255,e[n+5]=255,e[n+6]=255,e[n+7]=255)},e.exports.readUInt24LE=function(e,t){return e.readUInt8(t+2)<<16|e.readUInt16LE(t)},e.exports.writeUInt24LE=function(e,t,r){t=i(t,0,16777215),s(e,r,3),e.writeUInt16LE(65535&t,r),e.writeUInt8(t>>>16,r+2)},e.exports.readUInt40LE=function(e,r){return(e.readUInt8(r+4)||0)*t+e.readUInt32LE(r)},e.exports.writeUInt40LE=function(e,t,n){t=i(t,0,0xffffffffff),s(e,n,5),e.writeInt32LE(-1&t,n),e.writeUInt8(Math.floor(t*r),n+4)},e.exports.readUInt48LE=function(e,r){return e.readUInt16LE(r+4)*t+e.readUInt32LE(r)},e.exports.writeUInt48LE=function(e,t,n){t=i(t,0,0xffffffffffff),s(e,n,6),e.writeInt32LE(-1&t,n),e.writeUInt16LE(Math.floor(t*r),n+4)},e.exports.readUInt56LE=function(e,r){return((e.readUInt8(r+6)||0)<<16|e.readUInt16LE(r+4))*t+e.readUInt32LE(r)},e.exports.writeUInt56LE=function(e,t,n){if(t=i(t,0,72057594037927940),s(e,n,7),t<72057594037927940){e.writeInt32LE(-1&t,n);var o=Math.floor(t*r);e.writeUInt16LE(65535&o,n+4),e.writeUInt8(o>>>16,n+6)}else e[n]=255,e[n+1]=255,e[n+2]=255,e[n+3]=255,e[n+4]=255,e[n+5]=255,e[n+6]=255},e.exports.readUInt64LE=function(e,r){return e.readUInt32LE(r+4)*t+e.readUInt32LE(r)},e.exports.writeUInt64LE=function(e,t,n){t=i(t,0,0x10000000000000000),s(e,n,8),t<0x10000000000000000?(e.writeInt32LE(-1&t,n),e.writeUInt32LE(Math.floor(t*r),n+4)):(e[n]=255,e[n+1]=255,e[n+2]=255,e[n+3]=255,e[n+4]=255,e[n+5]=255,e[n+6]=255,e[n+7]=255)},e.exports.readInt24BE=function(e,t){return(e.readInt8(t)<<16)+e.readUInt16BE(t+1)},e.exports.writeInt24BE=function(e,t,r){t=i(t,-8388608,8388607),s(e,r,3),e.writeInt8(t>>16,r),e.writeUInt16BE(65535&t,r+1)},e.exports.readInt40BE=function(e,r){return(e.readInt8(r)||0)*t+e.readUInt32BE(r+1)},e.exports.writeInt40BE=function(e,t,n){t=i(t,-549755813888,549755813887),s(e,n,5),e.writeInt8(Math.floor(t*r),n),e.writeInt32BE(-1&t,n+1)},e.exports.readInt48BE=function(e,r){return e.readInt16BE(r)*t+e.readUInt32BE(r+2)},e.exports.writeInt48BE=function(e,t,n){t=i(t,-0x800000000000,0x7fffffffffff),s(e,n,6),e.writeInt16BE(Math.floor(t*r),n),e.writeInt32BE(-1&t,n+2)},e.exports.readInt56BE=function(e,r){return(((e.readInt8(r)||0)<<16)+e.readUInt16BE(r+1))*t+e.readUInt32BE(r+3)},e.exports.writeInt56BE=function(e,t,n){if(t=i(t,-0x800000000000000,0x80000000000000),s(e,n,7),t<0x80000000000000){var o=Math.floor(t*r);e.writeInt8(o>>16,n),e.writeUInt16BE(65535&o,n+1),e.writeInt32BE(-1&t,n+3)}else e[n]=127,e[n+1]=255,e[n+2]=255,e[n+3]=255,e[n+4]=255,e[n+5]=255,e[n+6]=255},e.exports.readInt64BE=function(e,r){return e.readInt32BE(r)*t+e.readUInt32BE(r+4)},e.exports.writeInt64BE=function(e,t,n){t=i(t,-23611832414348226e5,0x8000000000000000),s(e,n,8),t<0x8000000000000000?(e.writeInt32BE(Math.floor(t*r),n),e.writeInt32BE(-1&t,n+4)):(e[n]=127,e[n+1]=255,e[n+2]=255,e[n+3]=255,e[n+4]=255,e[n+5]=255,e[n+6]=255,e[n+7]=255)},e.exports.readInt24LE=function(e,t){return(e.readInt8(t+2)<<16)+e.readUInt16LE(t)},e.exports.writeInt24LE=function(e,t,r){t=i(t,-8388608,8388607),s(e,r,3),e.writeUInt16LE(65535&t,r),e.writeInt8(t>>16,r+2)},e.exports.readInt40LE=function(e,r){return(e.readInt8(r+4)||0)*t+e.readUInt32LE(r)},e.exports.writeInt40LE=function(e,t,n){t=i(t,-549755813888,549755813887),s(e,n,5),e.writeInt32LE(-1&t,n),e.writeInt8(Math.floor(t*r),n+4)},e.exports.readInt48LE=function(e,r){return e.readInt16LE(r+4)*t+e.readUInt32LE(r)},e.exports.writeInt48LE=function(e,t,n){t=i(t,-0x800000000000,0x7fffffffffff),s(e,n,6),e.writeInt32LE(-1&t,n),e.writeInt16LE(Math.floor(t*r),n+4)},e.exports.readInt56LE=function(e,r){return(((e.readInt8(r+6)||0)<<16)+e.readUInt16LE(r+4))*t+e.readUInt32LE(r)},e.exports.writeInt56LE=function(e,t,n){if(t=i(t,-0x80000000000000,0x80000000000000),s(e,n,7),t<0x80000000000000){e.writeInt32LE(-1&t,n);var o=Math.floor(t*r);e.writeUInt16LE(65535&o,n+4),e.writeInt8(o>>16,n+6)}else e[n]=255,e[n+1]=255,e[n+2]=255,e[n+3]=255,e[n+4]=255,e[n+5]=255,e[n+6]=127},e.exports.readInt64LE=function(e,r){return e.readInt32LE(r+4)*t+e.readUInt32LE(r)},e.exports.writeInt64LE=function(e,t,n){t=i(t,-0x8000000000000000,0x8000000000000000),s(e,n,8),t<0x8000000000000000?(e.writeInt32LE(-1&t,n),e.writeInt32LE(Math.floor(t*r),n+4)):(e[n]=255,e[n+1]=255,e[n+2]=255,e[n+3]=255,e[n+4]=255,e[n+5]=255,e[n+6]=255,e[n+7]=127)}}(re);var ne=re.exports;function oe(e,t,r){var n=r;for(var o in r+=4,t)if(void 0!==t[o]){var i=Buffer.byteLength(o);e.writeUInt8(i,r),r++,e.write(o,r,"utf8"),r+=i,r+=ie(e,t[o],r)}var s=r-n;return e.writeUInt32BE(s-4,n),s}function ie(e,t,r){var n=r,o=typeof t,i=t;function s(t){e.write(t,r),r++}switch(t&&"object"===o&&t.hasOwnProperty("!")&&(i=t.value,o=t["!"]),"number"==o&&(o=function(e){return e>=0x8000000000000000||Math.abs(e)<0x4000000000000&&Math.floor(e)!==e}(i)?"double":i<128&&i>=-128?"byte":i>=-32768&&i<32768?"short":i>=-2147483648&&i<2147483648?"int":"long"),o){case"string":var a=Buffer.byteLength(i,"utf8");s("S"),e.writeUInt32BE(a,r),r+=4,e.write(i,r,"utf8"),r+=a;break;case"object":null===i?s("V"):Array.isArray(i)?(s("A"),r+=function(e,t,r){var n=r;r+=4;for(var o=0,i=t.length;o<i;o++)r+=ie(e,t[o],r);var s=r-n;return e.writeUInt32BE(s-4,n),s}(e,i,r)):Buffer.isBuffer(i)?(s("x"),e.writeUInt32BE(i.length,r),r+=4,i.copy(e,r),r+=i.length):(s("F"),r+=oe(e,i,r));break;case"boolean":s("t"),e.writeUInt8(i?1:0,r),r++;break;case"double":case"float64":s("d"),e.writeDoubleBE(i,r),r+=8;break;case"byte":case"int8":s("b"),e.writeInt8(i,r),r++;break;case"short":case"int16":s("s"),e.writeInt16BE(i,r),r+=2;break;case"int":case"int32":s("I"),e.writeInt32BE(i,r),r+=4;break;case"long":case"int64":s("l"),ne.writeInt64BE(e,i,r),r+=8;break;case"timestamp":s("T"),ne.writeUInt64BE(e,i,r),r+=8;break;case"float":s("f"),e.writeFloatBE(i,r),r+=4;break;case"decimal":if(s("D"),!(i.hasOwnProperty("places")&&i.hasOwnProperty("digits")&&i.places>=0&&i.places<256))throw new TypeError("Decimal value must be {'places': 0..255, 'digits': uint32}, got "+JSON.stringify(i));e[r]=i.places,r++,e.writeUInt32BE(i.digits,r),r+=4;break;default:throw new TypeError("Unknown type to encode: "+o)}return r-n}te.encodeTable=oe,te.decodeFields=function e(t){var r,n,o,i={},s=0,a=t.length;function u(){var n=String.fromCharCode(t[s]);switch(s++,n){case"b":o=t.readInt8(s),s++;break;case"S":r=t.readUInt32BE(s),s+=4,o=t.toString("utf8",s,s+r),s+=r;break;case"I":o=t.readInt32BE(s),s+=4;break;case"D":var i=t[s];s++;var a=t.readUInt32BE(s);s+=4,o={"!":"decimal",value:{places:i,digits:a}};break;case"T":o=ne.readUInt64BE(t,s),s+=8,o={"!":"timestamp",value:o};break;case"F":r=t.readUInt32BE(s),s+=4,o=e(t.slice(s,s+r)),s+=r;break;case"A":r=t.readUInt32BE(s),function(e){var t=[];for(;s<e;)u(),t.push(o);o=t}((s+=4)+r);break;case"d":o=t.readDoubleBE(s),s+=8;break;case"f":o=t.readFloatBE(s),s+=4;break;case"l":o=ne.readInt64BE(t,s),s+=8;break;case"s":o=t.readInt16BE(s),s+=2;break;case"t":o=0!=t[s],s++;break;case"V":o=null;break;case"x":r=t.readUInt32BE(s),s+=4,o=t.slice(s,s+r),s+=r;break;default:throw new TypeError('Unexpected type tag "'+n+'"')}}for(;s<a;)r=t.readUInt8(s),s++,n=t.toString("utf8",s,s+r),s+=r,u(),i[n]=o;return i};var se=te,ae=re.exports,ue=se.encodeTable,ce=se.decodeFields,le=Buffer.alloc(65536);Object.freeze({}),ee.constants={FRAME_METHOD:1,FRAME_HEADER:2,FRAME_BODY:3,FRAME_HEARTBEAT:8,FRAME_MIN_SIZE:4096,FRAME_END:206,REPLY_SUCCESS:200,CONTENT_TOO_LARGE:311,NO_ROUTE:312,NO_CONSUMERS:313,ACCESS_REFUSED:403,NOT_FOUND:404,RESOURCE_LOCKED:405,PRECONDITION_FAILED:406,CONNECTION_FORCED:320,INVALID_PATH:402,FRAME_ERROR:501,SYNTAX_ERROR:502,COMMAND_INVALID:503,CHANNEL_ERROR:504,UNEXPECTED_FRAME:505,RESOURCE_ERROR:506,NOT_ALLOWED:530,NOT_IMPLEMENTED:540,INTERNAL_ERROR:541},ee.constant_strs={1:"FRAME-METHOD",2:"FRAME-HEADER",3:"FRAME-BODY",8:"FRAME-HEARTBEAT",200:"REPLY-SUCCESS",206:"FRAME-END",311:"CONTENT-TOO-LARGE",312:"NO-ROUTE",313:"NO-CONSUMERS",320:"CONNECTION-FORCED",402:"INVALID-PATH",403:"ACCESS-REFUSED",404:"NOT-FOUND",405:"RESOURCE-LOCKED",406:"PRECONDITION-FAILED",501:"FRAME-ERROR",502:"SYNTAX-ERROR",503:"COMMAND-INVALID",504:"CHANNEL-ERROR",505:"UNEXPECTED-FRAME",506:"RESOURCE-ERROR",530:"NOT-ALLOWED",540:"NOT-IMPLEMENTED",541:"INTERNAL-ERROR",4096:"FRAME-MIN-SIZE"},ee.FRAME_OVERHEAD=8,ee.decode=function(e,t){switch(e){case 655370:return s={versionMajor:void 0,versionMinor:void 0,serverProperties:void 0,mechanisms:void 0,locales:void 0},n=(r=t)[i=0],i++,s.versionMajor=n,n=r[i],i++,s.versionMinor=n,o=r.readUInt32BE(i),i+=4,n=ce(r.slice(i,i+o)),i+=o,s.serverProperties=n,o=r.readUInt32BE(i),i+=4,n=r.slice(i,i+o),i+=o,s.mechanisms=n,o=r.readUInt32BE(i),i+=4,n=r.slice(i,i+o),i+=o,s.locales=n,s;case 655371:return function(e){var t,r,n=0,o={clientProperties:void 0,mechanism:void 0,response:void 0,locale:void 0};return r=e.readUInt32BE(n),n+=4,t=ce(e.slice(n,n+r)),n+=r,o.clientProperties=t,r=e.readUInt8(n),n++,t=e.toString("utf8",n,n+r),n+=r,o.mechanism=t,r=e.readUInt32BE(n),n+=4,t=e.slice(n,n+r),n+=r,o.response=t,r=e.readUInt8(n),n++,t=e.toString("utf8",n,n+r),n+=r,o.locale=t,o}(t);case 655380:return function(e){var t,r,n=0,o={challenge:void 0};return r=e.readUInt32BE(n),n+=4,t=e.slice(n,n+r),n+=r,o.challenge=t,o}(t);case 655381:return function(e){var t,r,n=0,o={response:void 0};return r=e.readUInt32BE(n),n+=4,t=e.slice(n,n+r),n+=r,o.response=t,o}(t);case 655390:return function(e){var t,r=0,n={channelMax:void 0,frameMax:void 0,heartbeat:void 0};return t=e.readUInt16BE(r),r+=2,n.channelMax=t,t=e.readUInt32BE(r),r+=4,n.frameMax=t,t=e.readUInt16BE(r),r+=2,n.heartbeat=t,n}(t);case 655391:return function(e){var t,r=0,n={channelMax:void 0,frameMax:void 0,heartbeat:void 0};return t=e.readUInt16BE(r),r+=2,n.channelMax=t,t=e.readUInt32BE(r),r+=4,n.frameMax=t,t=e.readUInt16BE(r),r+=2,n.heartbeat=t,n}(t);case 655400:return function(e){var t,r,n=0,o={virtualHost:void 0,capabilities:void 0,insist:void 0};return r=e.readUInt8(n),n++,t=e.toString("utf8",n,n+r),n+=r,o.virtualHost=t,r=e.readUInt8(n),n++,t=e.toString("utf8",n,n+r),n+=r,o.capabilities=t,t=!!(1&e[n]),o.insist=t,o}(t);case 655401:return function(e){var t,r,n=0,o={knownHosts:void 0};return r=e.readUInt8(n),n++,t=e.toString("utf8",n,n+r),n+=r,o.knownHosts=t,o}(t);case 655410:return function(e){var t,r,n=0,o={replyCode:void 0,replyText:void 0,classId:void 0,methodId:void 0};return t=e.readUInt16BE(n),n+=2,o.replyCode=t,r=e.readUInt8(n),n++,t=e.toString("utf8",n,n+r),n+=r,o.replyText=t,t=e.readUInt16BE(n),n+=2,o.classId=t,t=e.readUInt16BE(n),n+=2,o.methodId=t,o}(t);case 655411:case 655421:case 1310761:case 2621451:case 2621461:case 2621471:case 2621491:case 3276821:case 3276851:case 3932171:case 3932271:case 5898250:case 5898251:case 5898260:case 5898261:case 5898270:case 5898271:case 5570571:return{};case 655420:return function(e){var t,r,n=0,o={reason:void 0};return r=e.readUInt8(n),n++,t=e.toString("utf8",n,n+r),n+=r,o.reason=t,o}(t);case 1310730:return function(e){var t,r,n=0,o={outOfBand:void 0};return r=e.readUInt8(n),n++,t=e.toString("utf8",n,n+r),n+=r,o.outOfBand=t,o}(t);case 1310731:return function(e){var t,r,n=0,o={channelId:void 0};return r=e.readUInt32BE(n),n+=4,t=e.slice(n,n+r),n+=r,o.channelId=t,o}(t);case 1310740:return function(e){var t,r={active:void 0};return t=!!(1&e[0]),r.active=t,r}(t);case 1310741:return function(e){var t,r={active:void 0};return t=!!(1&e[0]),r.active=t,r}(t);case 1310760:return function(e){var t,r,n=0,o={replyCode:void 0,replyText:void 0,classId:void 0,methodId:void 0};return t=e.readUInt16BE(n),n+=2,o.replyCode=t,r=e.readUInt8(n),n++,t=e.toString("utf8",n,n+r),n+=r,o.replyText=t,t=e.readUInt16BE(n),n+=2,o.classId=t,t=e.readUInt16BE(n),n+=2,o.methodId=t,o}(t);case 1966090:return function(e){var t,r,n=0,o={realm:void 0,exclusive:void 0,passive:void 0,active:void 0,write:void 0,read:void 0};return r=e.readUInt8(n),n++,t=e.toString("utf8",n,n+r),n+=r,o.realm=t,t=!!(1&e[n]),o.exclusive=t,t=!!(2&e[n]),o.passive=t,t=!!(4&e[n]),o.active=t,t=!!(8&e[n]),o.write=t,t=!!(16&e[n]),o.read=t,o}(t);case 1966091:return function(e){var t,r=0,n={ticket:void 0};return t=e.readUInt16BE(r),r+=2,n.ticket=t,n}(t);case 2621450:return function(e){var t,r,n=0,o={ticket:void 0,exchange:void 0,type:void 0,passive:void 0,durable:void 0,autoDelete:void 0,internal:void 0,nowait:void 0,arguments:void 0};return t=e.readUInt16BE(n),n+=2,o.ticket=t,r=e.readUInt8(n),n++,t=e.toString("utf8",n,n+r),n+=r,o.exchange=t,r=e.readUInt8(n),n++,t=e.toString("utf8",n,n+r),n+=r,o.type=t,t=!!(1&e[n]),o.passive=t,t=!!(2&e[n]),o.durable=t,t=!!(4&e[n]),o.autoDelete=t,t=!!(8&e[n]),o.internal=t,t=!!(16&e[n]),o.nowait=t,n++,r=e.readUInt32BE(n),n+=4,t=ce(e.slice(n,n+r)),n+=r,o.arguments=t,o}(t);case 2621460:return function(e){var t,r,n=0,o={ticket:void 0,exchange:void 0,ifUnused:void 0,nowait:void 0};return t=e.readUInt16BE(n),n+=2,o.ticket=t,r=e.readUInt8(n),n++,t=e.toString("utf8",n,n+r),n+=r,o.exchange=t,t=!!(1&e[n]),o.ifUnused=t,t=!!(2&e[n]),o.nowait=t,o}(t);case 2621470:return function(e){var t,r,n=0,o={ticket:void 0,destination:void 0,source:void 0,routingKey:void 0,nowait:void 0,arguments:void 0};return t=e.readUInt16BE(n),n+=2,o.ticket=t,r=e.readUInt8(n),n++,t=e.toString("utf8",n,n+r),n+=r,o.destination=t,r=e.readUInt8(n),n++,t=e.toString("utf8",n,n+r),n+=r,o.source=t,r=e.readUInt8(n),n++,t=e.toString("utf8",n,n+r),n+=r,o.routingKey=t,t=!!(1&e[n]),o.nowait=t,n++,r=e.readUInt32BE(n),n+=4,t=ce(e.slice(n,n+r)),n+=r,o.arguments=t,o}(t);case 2621480:return function(e){var t,r,n=0,o={ticket:void 0,destination:void 0,source:void 0,routingKey:void 0,nowait:void 0,arguments:void 0};return t=e.readUInt16BE(n),n+=2,o.ticket=t,r=e.readUInt8(n),n++,t=e.toString("utf8",n,n+r),n+=r,o.destination=t,r=e.readUInt8(n),n++,t=e.toString("utf8",n,n+r),n+=r,o.source=t,r=e.readUInt8(n),n++,t=e.toString("utf8",n,n+r),n+=r,o.routingKey=t,t=!!(1&e[n]),o.nowait=t,n++,r=e.readUInt32BE(n),n+=4,t=ce(e.slice(n,n+r)),n+=r,o.arguments=t,o}(t);case 3276810:return function(e){var t,r,n=0,o={ticket:void 0,queue:void 0,passive:void 0,durable:void 0,exclusive:void 0,autoDelete:void 0,nowait:void 0,arguments:void 0};return t=e.readUInt16BE(n),n+=2,o.ticket=t,r=e.readUInt8(n),n++,t=e.toString("utf8",n,n+r),n+=r,o.queue=t,t=!!(1&e[n]),o.passive=t,t=!!(2&e[n]),o.durable=t,t=!!(4&e[n]),o.exclusive=t,t=!!(8&e[n]),o.autoDelete=t,t=!!(16&e[n]),o.nowait=t,n++,r=e.readUInt32BE(n),n+=4,t=ce(e.slice(n,n+r)),n+=r,o.arguments=t,o}(t);case 3276811:return function(e){var t,r,n=0,o={queue:void 0,messageCount:void 0,consumerCount:void 0};return r=e.readUInt8(n),n++,t=e.toString("utf8",n,n+r),n+=r,o.queue=t,t=e.readUInt32BE(n),n+=4,o.messageCount=t,t=e.readUInt32BE(n),n+=4,o.consumerCount=t,o}(t);case 3276820:return function(e){var t,r,n=0,o={ticket:void 0,queue:void 0,exchange:void 0,routingKey:void 0,nowait:void 0,arguments:void 0};return t=e.readUInt16BE(n),n+=2,o.ticket=t,r=e.readUInt8(n),n++,t=e.toString("utf8",n,n+r),n+=r,o.queue=t,r=e.readUInt8(n),n++,t=e.toString("utf8",n,n+r),n+=r,o.exchange=t,r=e.readUInt8(n),n++,t=e.toString("utf8",n,n+r),n+=r,o.routingKey=t,t=!!(1&e[n]),o.nowait=t,n++,r=e.readUInt32BE(n),n+=4,t=ce(e.slice(n,n+r)),n+=r,o.arguments=t,o}(t);case 3276830:return function(e){var t,r,n=0,o={ticket:void 0,queue:void 0,nowait:void 0};return t=e.readUInt16BE(n),n+=2,o.ticket=t,r=e.readUInt8(n),n++,t=e.toString("utf8",n,n+r),n+=r,o.queue=t,t=!!(1&e[n]),o.nowait=t,o}(t);case 3276831:return function(e){var t,r=0,n={messageCount:void 0};return t=e.readUInt32BE(r),r+=4,n.messageCount=t,n}(t);case 3276840:return function(e){var t,r,n=0,o={ticket:void 0,queue:void 0,ifUnused:void 0,ifEmpty:void 0,nowait:void 0};return t=e.readUInt16BE(n),n+=2,o.ticket=t,r=e.readUInt8(n),n++,t=e.toString("utf8",n,n+r),n+=r,o.queue=t,t=!!(1&e[n]),o.ifUnused=t,t=!!(2&e[n]),o.ifEmpty=t,t=!!(4&e[n]),o.nowait=t,o}(t);case 3276841:return function(e){var t,r=0,n={messageCount:void 0};return t=e.readUInt32BE(r),r+=4,n.messageCount=t,n}(t);case 3276850:return function(e){var t,r,n=0,o={ticket:void 0,queue:void 0,exchange:void 0,routingKey:void 0,arguments:void 0};return t=e.readUInt16BE(n),n+=2,o.ticket=t,r=e.readUInt8(n),n++,t=e.toString("utf8",n,n+r),n+=r,o.queue=t,r=e.readUInt8(n),n++,t=e.toString("utf8",n,n+r),n+=r,o.exchange=t,r=e.readUInt8(n),n++,t=e.toString("utf8",n,n+r),n+=r,o.routingKey=t,r=e.readUInt32BE(n),n+=4,t=ce(e.slice(n,n+r)),n+=r,o.arguments=t,o}(t);case 3932170:return function(e){var t,r=0,n={prefetchSize:void 0,prefetchCount:void 0,global:void 0};return t=e.readUInt32BE(r),r+=4,n.prefetchSize=t,t=e.readUInt16BE(r),r+=2,n.prefetchCount=t,t=!!(1&e[r]),n.global=t,n}(t);case 3932180:return function(e){var t,r,n=0,o={ticket:void 0,queue:void 0,consumerTag:void 0,noLocal:void 0,noAck:void 0,exclusive:void 0,nowait:void 0,arguments:void 0};return t=e.readUInt16BE(n),n+=2,o.ticket=t,r=e.readUInt8(n),n++,t=e.toString("utf8",n,n+r),n+=r,o.queue=t,r=e.readUInt8(n),n++,t=e.toString("utf8",n,n+r),n+=r,o.consumerTag=t,t=!!(1&e[n]),o.noLocal=t,t=!!(2&e[n]),o.noAck=t,t=!!(4&e[n]),o.exclusive=t,t=!!(8&e[n]),o.nowait=t,n++,r=e.readUInt32BE(n),n+=4,t=ce(e.slice(n,n+r)),n+=r,o.arguments=t,o}(t);case 3932181:return function(e){var t,r,n=0,o={consumerTag:void 0};return r=e.readUInt8(n),n++,t=e.toString("utf8",n,n+r),n+=r,o.consumerTag=t,o}(t);case 3932190:return function(e){var t,r,n=0,o={consumerTag:void 0,nowait:void 0};return r=e.readUInt8(n),n++,t=e.toString("utf8",n,n+r),n+=r,o.consumerTag=t,t=!!(1&e[n]),o.nowait=t,o}(t);case 3932191:return function(e){var t,r,n=0,o={consumerTag:void 0};return r=e.readUInt8(n),n++,t=e.toString("utf8",n,n+r),n+=r,o.consumerTag=t,o}(t);case 3932200:return function(e){var t,r,n=0,o={ticket:void 0,exchange:void 0,routingKey:void 0,mandatory:void 0,immediate:void 0};return t=e.readUInt16BE(n),n+=2,o.ticket=t,r=e.readUInt8(n),n++,t=e.toString("utf8",n,n+r),n+=r,o.exchange=t,r=e.readUInt8(n),n++,t=e.toString("utf8",n,n+r),n+=r,o.routingKey=t,t=!!(1&e[n]),o.mandatory=t,t=!!(2&e[n]),o.immediate=t,o}(t);case 3932210:return function(e){var t,r,n=0,o={replyCode:void 0,replyText:void 0,exchange:void 0,routingKey:void 0};return t=e.readUInt16BE(n),n+=2,o.replyCode=t,r=e.readUInt8(n),n++,t=e.toString("utf8",n,n+r),n+=r,o.replyText=t,r=e.readUInt8(n),n++,t=e.toString("utf8",n,n+r),n+=r,o.exchange=t,r=e.readUInt8(n),n++,t=e.toString("utf8",n,n+r),n+=r,o.routingKey=t,o}(t);case 3932220:return function(e){var t,r,n=0,o={consumerTag:void 0,deliveryTag:void 0,redelivered:void 0,exchange:void 0,routingKey:void 0};return r=e.readUInt8(n),n++,t=e.toString("utf8",n,n+r),n+=r,o.consumerTag=t,t=ae.readUInt64BE(e,n),n+=8,o.deliveryTag=t,t=!!(1&e[n]),o.redelivered=t,n++,r=e.readUInt8(n),n++,t=e.toString("utf8",n,n+r),n+=r,o.exchange=t,r=e.readUInt8(n),n++,t=e.toString("utf8",n,n+r),n+=r,o.routingKey=t,o}(t);case 3932230:return function(e){var t,r,n=0,o={ticket:void 0,queue:void 0,noAck:void 0};return t=e.readUInt16BE(n),n+=2,o.ticket=t,r=e.readUInt8(n),n++,t=e.toString("utf8",n,n+r),n+=r,o.queue=t,t=!!(1&e[n]),o.noAck=t,o}(t);case 3932231:return function(e){var t,r,n=0,o={deliveryTag:void 0,redelivered:void 0,exchange:void 0,routingKey:void 0,messageCount:void 0};return t=ae.readUInt64BE(e,n),n+=8,o.deliveryTag=t,t=!!(1&e[n]),o.redelivered=t,n++,r=e.readUInt8(n),n++,t=e.toString("utf8",n,n+r),n+=r,o.exchange=t,r=e.readUInt8(n),n++,t=e.toString("utf8",n,n+r),n+=r,o.routingKey=t,t=e.readUInt32BE(n),n+=4,o.messageCount=t,o}(t);case 3932232:return function(e){var t,r,n=0,o={clusterId:void 0};return r=e.readUInt8(n),n++,t=e.toString("utf8",n,n+r),n+=r,o.clusterId=t,o}(t);case 3932240:return function(e){var t,r=0,n={deliveryTag:void 0,multiple:void 0};return t=ae.readUInt64BE(e,r),r+=8,n.deliveryTag=t,t=!!(1&e[r]),n.multiple=t,n}(t);case 3932250:return function(e){var t,r=0,n={deliveryTag:void 0,requeue:void 0};return t=ae.readUInt64BE(e,r),r+=8,n.deliveryTag=t,t=!!(1&e[r]),n.requeue=t,n}(t);case 3932260:return function(e){var t,r={requeue:void 0};return t=!!(1&e[0]),r.requeue=t,r}(t);case 3932270:return function(e){var t,r={requeue:void 0};return t=!!(1&e[0]),r.requeue=t,r}(t);case 3932280:return function(e){var t,r=0,n={deliveryTag:void 0,multiple:void 0,requeue:void 0};return t=ae.readUInt64BE(e,r),r+=8,n.deliveryTag=t,t=!!(1&e[r]),n.multiple=t,t=!!(2&e[r]),n.requeue=t,n}(t);case 5570570:return function(e){var t,r={nowait:void 0};return t=!!(1&e[0]),r.nowait=t,r}(t);case 60:return function(e){var t,r,n,o=2;if(0===(t=e.readUInt16BE(0)))return{};var i={contentType:void 0,contentEncoding:void 0,headers:void 0,deliveryMode:void 0,priority:void 0,correlationId:void 0,replyTo:void 0,expiration:void 0,messageId:void 0,timestamp:void 0,type:void 0,userId:void 0,appId:void 0,clusterId:void 0};return 32768&t&&(n=e.readUInt8(o),o++,r=e.toString("utf8",o,o+n),o+=n,i.contentType=r),16384&t&&(n=e.readUInt8(o),o++,r=e.toString("utf8",o,o+n),o+=n,i.contentEncoding=r),8192&t&&(n=e.readUInt32BE(o),o+=4,r=ce(e.slice(o,o+n)),o+=n,i.headers=r),4096&t&&(r=e[o],o++,i.deliveryMode=r),2048&t&&(r=e[o],o++,i.priority=r),1024&t&&(n=e.readUInt8(o),o++,r=e.toString("utf8",o,o+n),o+=n,i.correlationId=r),512&t&&(n=e.readUInt8(o),o++,r=e.toString("utf8",o,o+n),o+=n,i.replyTo=r),256&t&&(n=e.readUInt8(o),o++,r=e.toString("utf8",o,o+n),o+=n,i.expiration=r),128&t&&(n=e.readUInt8(o),o++,r=e.toString("utf8",o,o+n),o+=n,i.messageId=r),64&t&&(r=ae.readUInt64BE(e,o),o+=8,i.timestamp=r),32&t&&(n=e.readUInt8(o),o++,r=e.toString("utf8",o,o+n),o+=n,i.type=r),16&t&&(n=e.readUInt8(o),o++,r=e.toString("utf8",o,o+n),o+=n,i.userId=r),8&t&&(n=e.readUInt8(o),o++,r=e.toString("utf8",o,o+n),o+=n,i.appId=r),4&t&&(n=e.readUInt8(o),o++,r=e.toString("utf8",o,o+n),o+=n,i.clusterId=r),i}(t);default:throw new Error("Unknown class/method ID")}
2
- /** @preserve This file is generated by the script
3
- * ../bin/generate-defs.js, which is not in general included in a
4
- * distribution, but is available in the source repository e.g. at
5
- * https://github.com/squaremo/amqp.node/
6
- */
7
- var r,n,o,i,s},ee.encodeMethod=function(e,t,r){switch(e){case 655370:return function(e,t){var r,n=0,o=null,i=0,s=0;if(void 0===(o=t.serverProperties))throw new Error("Missing value for mandatory field 'serverProperties'");if("object"!=typeof o)throw new TypeError("Field 'serverProperties' is the wrong type; must be an object");r=ue(le,o,s);var a=le.slice(s,s+r);if(s+=r,i+=a.length,void 0===(o=t.mechanisms))o=Buffer.from("PLAIN");else if(!Buffer.isBuffer(o))throw new TypeError("Field 'mechanisms' is the wrong type; must be a Buffer");if(i+=o.length,void 0===(o=t.locales))o=Buffer.from("en_US");else if(!Buffer.isBuffer(o))throw new TypeError("Field 'locales' is the wrong type; must be a Buffer");i+=o.length;var u=Buffer.alloc(22+i);if(u[0]=1,u.writeUInt16BE(e,1),u.writeUInt32BE(655370,7),n=11,void 0===(o=t.versionMajor))o=0;else if("number"!=typeof o||isNaN(o))throw new TypeError("Field 'versionMajor' is the wrong type; must be a number (but not NaN)");if(u.writeUInt8(o,n),n++,void 0===(o=t.versionMinor))o=9;else if("number"!=typeof o||isNaN(o))throw new TypeError("Field 'versionMinor' is the wrong type; must be a number (but not NaN)");return u.writeUInt8(o,n),n++,n+=a.copy(u,n),void 0===(o=t.mechanisms)&&(o=Buffer.from("PLAIN")),r=o.length,u.writeUInt32BE(r,n),n+=4,o.copy(u,n),n+=r,void 0===(o=t.locales)&&(o=Buffer.from("en_US")),r=o.length,u.writeUInt32BE(r,n),n+=4,o.copy(u,n),u[n+=r]=206,u.writeUInt32BE(n-7,3),u}(t,r);case 655371:return function(e,t){var r,n=0,o=null,i=0,s=0;if(void 0===(o=t.clientProperties))throw new Error("Missing value for mandatory field 'clientProperties'");if("object"!=typeof o)throw new TypeError("Field 'clientProperties' is the wrong type; must be an object");r=ue(le,o,s);var a=le.slice(s,s+r);if(s+=r,i+=a.length,void 0===(o=t.mechanism))o="PLAIN";else if(!("string"==typeof o&&Buffer.byteLength(o)<256))throw new TypeError("Field 'mechanism' is the wrong type; must be a string (up to 255 chars)");var u=Buffer.byteLength(o,"utf8");if(i+=u,void 0===(o=t.response))throw new Error("Missing value for mandatory field 'response'");if(!Buffer.isBuffer(o))throw new TypeError("Field 'response' is the wrong type; must be a Buffer");if(i+=o.length,void 0===(o=t.locale))o="en_US";else if(!("string"==typeof o&&Buffer.byteLength(o)<256))throw new TypeError("Field 'locale' is the wrong type; must be a string (up to 255 chars)");var c=Buffer.byteLength(o,"utf8");i+=c;var l=Buffer.alloc(18+i);return l[0]=1,l.writeUInt16BE(e,1),l.writeUInt32BE(655371,7),n=11,n+=a.copy(l,n),void 0===(o=t.mechanism)&&(o="PLAIN"),l[n]=u,n++,l.write(o,n,"utf8"),n+=u,void 0===(o=t.response)&&(o=Buffer.from(void 0)),r=o.length,l.writeUInt32BE(r,n),n+=4,o.copy(l,n),n+=r,void 0===(o=t.locale)&&(o="en_US"),l[n]=c,n++,l.write(o,n,"utf8"),l[n+=c]=206,l.writeUInt32BE(n-7,3),l}(t,r);case 655380:return function(e,t){var r,n=0,o=null,i=0;if(void 0===(o=t.challenge))throw new Error("Missing value for mandatory field 'challenge'");if(!Buffer.isBuffer(o))throw new TypeError("Field 'challenge' is the wrong type; must be a Buffer");i+=o.length;var s=Buffer.alloc(16+i);return s[0]=1,s.writeUInt16BE(e,1),s.writeUInt32BE(655380,7),n=11,void 0===(o=t.challenge)&&(o=Buffer.from(void 0)),r=o.length,s.writeUInt32BE(r,n),n+=4,o.copy(s,n),s[n+=r]=206,s.writeUInt32BE(n-7,3),s}(t,r);case 655381:return function(e,t){var r,n=0,o=null,i=0;if(void 0===(o=t.response))throw new Error("Missing value for mandatory field 'response'");if(!Buffer.isBuffer(o))throw new TypeError("Field 'response' is the wrong type; must be a Buffer");i+=o.length;var s=Buffer.alloc(16+i);return s[0]=1,s.writeUInt16BE(e,1),s.writeUInt32BE(655381,7),n=11,void 0===(o=t.response)&&(o=Buffer.from(void 0)),r=o.length,s.writeUInt32BE(r,n),n+=4,o.copy(s,n),s[n+=r]=206,s.writeUInt32BE(n-7,3),s}(t,r);case 655390:return function(e,t){var r=0,n=null,o=Buffer.alloc(20);if(o[0]=1,o.writeUInt16BE(e,1),o.writeUInt32BE(655390,7),r=11,void 0===(n=t.channelMax))n=0;else if("number"!=typeof n||isNaN(n))throw new TypeError("Field 'channelMax' is the wrong type; must be a number (but not NaN)");if(o.writeUInt16BE(n,r),r+=2,void 0===(n=t.frameMax))n=0;else if("number"!=typeof n||isNaN(n))throw new TypeError("Field 'frameMax' is the wrong type; must be a number (but not NaN)");if(o.writeUInt32BE(n,r),r+=4,void 0===(n=t.heartbeat))n=0;else if("number"!=typeof n||isNaN(n))throw new TypeError("Field 'heartbeat' is the wrong type; must be a number (but not NaN)");return o.writeUInt16BE(n,r),o[r+=2]=206,o.writeUInt32BE(r-7,3),o}(t,r);case 655391:return function(e,t){var r=0,n=null,o=Buffer.alloc(20);if(o[0]=1,o.writeUInt16BE(e,1),o.writeUInt32BE(655391,7),r=11,void 0===(n=t.channelMax))n=0;else if("number"!=typeof n||isNaN(n))throw new TypeError("Field 'channelMax' is the wrong type; must be a number (but not NaN)");if(o.writeUInt16BE(n,r),r+=2,void 0===(n=t.frameMax))n=0;else if("number"!=typeof n||isNaN(n))throw new TypeError("Field 'frameMax' is the wrong type; must be a number (but not NaN)");if(o.writeUInt32BE(n,r),r+=4,void 0===(n=t.heartbeat))n=0;else if("number"!=typeof n||isNaN(n))throw new TypeError("Field 'heartbeat' is the wrong type; must be a number (but not NaN)");return o.writeUInt16BE(n,r),o[r+=2]=206,o.writeUInt32BE(r-7,3),o}(t,r);case 655400:return function(e,t){var r=0,n=null,o=0,i=0;if(void 0===(n=t.virtualHost))n="/";else if(!("string"==typeof n&&Buffer.byteLength(n)<256))throw new TypeError("Field 'virtualHost' is the wrong type; must be a string (up to 255 chars)");var s=Buffer.byteLength(n,"utf8");if(i+=s,void 0===(n=t.capabilities))n="";else if(!("string"==typeof n&&Buffer.byteLength(n)<256))throw new TypeError("Field 'capabilities' is the wrong type; must be a string (up to 255 chars)");var a=Buffer.byteLength(n,"utf8");i+=a;var u=Buffer.alloc(15+i);return u[0]=1,u.writeUInt16BE(e,1),u.writeUInt32BE(655400,7),r=11,void 0===(n=t.virtualHost)&&(n="/"),u[r]=s,r++,u.write(n,r,"utf8"),r+=s,void 0===(n=t.capabilities)&&(n=""),u[r]=a,r++,u.write(n,r,"utf8"),r+=a,void 0===(n=t.insist)&&(n=!1),n&&(o+=1),u[r]=o,u[++r]=206,u.writeUInt32BE(r-7,3),u}(t,r);case 655401:return function(e,t){var r=0,n=null,o=0;if(void 0===(n=t.knownHosts))n="";else if(!("string"==typeof n&&Buffer.byteLength(n)<256))throw new TypeError("Field 'knownHosts' is the wrong type; must be a string (up to 255 chars)");var i=Buffer.byteLength(n,"utf8");o+=i;var s=Buffer.alloc(13+o);return s[0]=1,s.writeUInt16BE(e,1),s.writeUInt32BE(655401,7),r=11,void 0===(n=t.knownHosts)&&(n=""),s[r]=i,r++,s.write(n,r,"utf8"),s[r+=i]=206,s.writeUInt32BE(r-7,3),s}(t,r);case 655410:return function(e,t){var r=0,n=null,o=0;if(void 0===(n=t.replyText))n="";else if(!("string"==typeof n&&Buffer.byteLength(n)<256))throw new TypeError("Field 'replyText' is the wrong type; must be a string (up to 255 chars)");var i=Buffer.byteLength(n,"utf8");o+=i;var s=Buffer.alloc(19+o);if(s[0]=1,s.writeUInt16BE(e,1),s.writeUInt32BE(655410,7),r=11,void 0===(n=t.replyCode))throw new Error("Missing value for mandatory field 'replyCode'");if("number"!=typeof n||isNaN(n))throw new TypeError("Field 'replyCode' is the wrong type; must be a number (but not NaN)");if(s.writeUInt16BE(n,r),r+=2,void 0===(n=t.replyText)&&(n=""),s[r]=i,r++,s.write(n,r,"utf8"),r+=i,void 0===(n=t.classId))throw new Error("Missing value for mandatory field 'classId'");if("number"!=typeof n||isNaN(n))throw new TypeError("Field 'classId' is the wrong type; must be a number (but not NaN)");if(s.writeUInt16BE(n,r),r+=2,void 0===(n=t.methodId))throw new Error("Missing value for mandatory field 'methodId'");if("number"!=typeof n||isNaN(n))throw new TypeError("Field 'methodId' is the wrong type; must be a number (but not NaN)");return s.writeUInt16BE(n,r),s[r+=2]=206,s.writeUInt32BE(r-7,3),s}(t,r);case 655411:return function(e,t){var r=Buffer.alloc(12);return r[0]=1,r.writeUInt16BE(e,1),r.writeUInt32BE(655411,7),r[11]=206,r.writeUInt32BE(4,3),r}(t);case 655420:return function(e,t){var r=0,n=null,o=0;if(void 0===(n=t.reason))n="";else if(!("string"==typeof n&&Buffer.byteLength(n)<256))throw new TypeError("Field 'reason' is the wrong type; must be a string (up to 255 chars)");var i=Buffer.byteLength(n,"utf8");o+=i;var s=Buffer.alloc(13+o);return s[0]=1,s.writeUInt16BE(e,1),s.writeUInt32BE(655420,7),r=11,void 0===(n=t.reason)&&(n=""),s[r]=i,r++,s.write(n,r,"utf8"),s[r+=i]=206,s.writeUInt32BE(r-7,3),s}(t,r);case 655421:return function(e,t){var r=Buffer.alloc(12);return r[0]=1,r.writeUInt16BE(e,1),r.writeUInt32BE(655421,7),r[11]=206,r.writeUInt32BE(4,3),r}(t);case 1310730:return function(e,t){var r=0,n=null,o=0;if(void 0===(n=t.outOfBand))n="";else if(!("string"==typeof n&&Buffer.byteLength(n)<256))throw new TypeError("Field 'outOfBand' is the wrong type; must be a string (up to 255 chars)");var i=Buffer.byteLength(n,"utf8");o+=i;var s=Buffer.alloc(13+o);return s[0]=1,s.writeUInt16BE(e,1),s.writeUInt32BE(1310730,7),r=11,void 0===(n=t.outOfBand)&&(n=""),s[r]=i,r++,s.write(n,r,"utf8"),s[r+=i]=206,s.writeUInt32BE(r-7,3),s}(t,r);case 1310731:return function(e,t){var r,n=0,o=null,i=0;if(void 0===(o=t.channelId))o=Buffer.from("");else if(!Buffer.isBuffer(o))throw new TypeError("Field 'channelId' is the wrong type; must be a Buffer");i+=o.length;var s=Buffer.alloc(16+i);return s[0]=1,s.writeUInt16BE(e,1),s.writeUInt32BE(1310731,7),n=11,void 0===(o=t.channelId)&&(o=Buffer.from("")),r=o.length,s.writeUInt32BE(r,n),n+=4,o.copy(s,n),s[n+=r]=206,s.writeUInt32BE(n-7,3),s}(t,r);case 1310740:return function(e,t){var r,n=0,o=0,i=Buffer.alloc(13);if(i[0]=1,i.writeUInt16BE(e,1),i.writeUInt32BE(1310740,7),n=11,void 0===(r=t.active))throw new Error("Missing value for mandatory field 'active'");return r&&(o+=1),i[n]=o,i[++n]=206,i.writeUInt32BE(n-7,3),i}(t,r);case 1310741:return function(e,t){var r,n=0,o=0,i=Buffer.alloc(13);if(i[0]=1,i.writeUInt16BE(e,1),i.writeUInt32BE(1310741,7),n=11,void 0===(r=t.active))throw new Error("Missing value for mandatory field 'active'");return r&&(o+=1),i[n]=o,i[++n]=206,i.writeUInt32BE(n-7,3),i}(t,r);case 1310760:return function(e,t){var r=0,n=null,o=0;if(void 0===(n=t.replyText))n="";else if(!("string"==typeof n&&Buffer.byteLength(n)<256))throw new TypeError("Field 'replyText' is the wrong type; must be a string (up to 255 chars)");var i=Buffer.byteLength(n,"utf8");o+=i;var s=Buffer.alloc(19+o);if(s[0]=1,s.writeUInt16BE(e,1),s.writeUInt32BE(1310760,7),r=11,void 0===(n=t.replyCode))throw new Error("Missing value for mandatory field 'replyCode'");if("number"!=typeof n||isNaN(n))throw new TypeError("Field 'replyCode' is the wrong type; must be a number (but not NaN)");if(s.writeUInt16BE(n,r),r+=2,void 0===(n=t.replyText)&&(n=""),s[r]=i,r++,s.write(n,r,"utf8"),r+=i,void 0===(n=t.classId))throw new Error("Missing value for mandatory field 'classId'");if("number"!=typeof n||isNaN(n))throw new TypeError("Field 'classId' is the wrong type; must be a number (but not NaN)");if(s.writeUInt16BE(n,r),r+=2,void 0===(n=t.methodId))throw new Error("Missing value for mandatory field 'methodId'");if("number"!=typeof n||isNaN(n))throw new TypeError("Field 'methodId' is the wrong type; must be a number (but not NaN)");return s.writeUInt16BE(n,r),s[r+=2]=206,s.writeUInt32BE(r-7,3),s}(t,r);case 1310761:return function(e,t){var r=Buffer.alloc(12);return r[0]=1,r.writeUInt16BE(e,1),r.writeUInt32BE(1310761,7),r[11]=206,r.writeUInt32BE(4,3),r}(t);case 1966090:return function(e,t){var r=0,n=null,o=0,i=0;if(void 0===(n=t.realm))n="/data";else if(!("string"==typeof n&&Buffer.byteLength(n)<256))throw new TypeError("Field 'realm' is the wrong type; must be a string (up to 255 chars)");var s=Buffer.byteLength(n,"utf8");i+=s;var a=Buffer.alloc(14+i);return a[0]=1,a.writeUInt16BE(e,1),a.writeUInt32BE(1966090,7),r=11,void 0===(n=t.realm)&&(n="/data"),a[r]=s,r++,a.write(n,r,"utf8"),r+=s,void 0===(n=t.exclusive)&&(n=!1),n&&(o+=1),void 0===(n=t.passive)&&(n=!0),n&&(o+=2),void 0===(n=t.active)&&(n=!0),n&&(o+=4),void 0===(n=t.write)&&(n=!0),n&&(o+=8),void 0===(n=t.read)&&(n=!0),n&&(o+=16),a[r]=o,a[++r]=206,a.writeUInt32BE(r-7,3),a}(t,r);case 1966091:return function(e,t){var r=0,n=null,o=Buffer.alloc(14);if(o[0]=1,o.writeUInt16BE(e,1),o.writeUInt32BE(1966091,7),r=11,void 0===(n=t.ticket))n=1;else if("number"!=typeof n||isNaN(n))throw new TypeError("Field 'ticket' is the wrong type; must be a number (but not NaN)");return o.writeUInt16BE(n,r),o[r+=2]=206,o.writeUInt32BE(r-7,3),o}(t,r);case 2621450:return function(e,t){var r,n=0,o=null,i=0,s=0,a=0;if(void 0===(o=t.exchange))throw new Error("Missing value for mandatory field 'exchange'");if(!("string"==typeof o&&Buffer.byteLength(o)<256))throw new TypeError("Field 'exchange' is the wrong type; must be a string (up to 255 chars)");var u=Buffer.byteLength(o,"utf8");if(s+=u,void 0===(o=t.type))o="direct";else if(!("string"==typeof o&&Buffer.byteLength(o)<256))throw new TypeError("Field 'type' is the wrong type; must be a string (up to 255 chars)");var c=Buffer.byteLength(o,"utf8");if(s+=c,void 0===(o=t.arguments))o={};else if("object"!=typeof o)throw new TypeError("Field 'arguments' is the wrong type; must be an object");r=ue(le,o,a);var l=le.slice(a,a+r);a+=r,s+=l.length;var f=Buffer.alloc(17+s);if(f[0]=1,f.writeUInt16BE(e,1),f.writeUInt32BE(2621450,7),n=11,void 0===(o=t.ticket))o=0;else if("number"!=typeof o||isNaN(o))throw new TypeError("Field 'ticket' is the wrong type; must be a number (but not NaN)");return f.writeUInt16BE(o,n),n+=2,void 0===(o=t.exchange)&&(o=void 0),f[n]=u,n++,f.write(o,n,"utf8"),n+=u,void 0===(o=t.type)&&(o="direct"),f[n]=c,n++,f.write(o,n,"utf8"),n+=c,void 0===(o=t.passive)&&(o=!1),o&&(i+=1),void 0===(o=t.durable)&&(o=!1),o&&(i+=2),void 0===(o=t.autoDelete)&&(o=!1),o&&(i+=4),void 0===(o=t.internal)&&(o=!1),o&&(i+=8),void 0===(o=t.nowait)&&(o=!1),o&&(i+=16),f[n]=i,n++,i=0,f[n+=l.copy(f,n)]=206,f.writeUInt32BE(n-7,3),f}(t,r);case 2621451:return function(e,t){var r=Buffer.alloc(12);return r[0]=1,r.writeUInt16BE(e,1),r.writeUInt32BE(2621451,7),r[11]=206,r.writeUInt32BE(4,3),r}(t);case 2621460:return function(e,t){var r=0,n=null,o=0,i=0;if(void 0===(n=t.exchange))throw new Error("Missing value for mandatory field 'exchange'");if(!("string"==typeof n&&Buffer.byteLength(n)<256))throw new TypeError("Field 'exchange' is the wrong type; must be a string (up to 255 chars)");var s=Buffer.byteLength(n,"utf8");i+=s;var a=Buffer.alloc(16+i);if(a[0]=1,a.writeUInt16BE(e,1),a.writeUInt32BE(2621460,7),r=11,void 0===(n=t.ticket))n=0;else if("number"!=typeof n||isNaN(n))throw new TypeError("Field 'ticket' is the wrong type; must be a number (but not NaN)");return a.writeUInt16BE(n,r),r+=2,void 0===(n=t.exchange)&&(n=void 0),a[r]=s,r++,a.write(n,r,"utf8"),r+=s,void 0===(n=t.ifUnused)&&(n=!1),n&&(o+=1),void 0===(n=t.nowait)&&(n=!1),n&&(o+=2),a[r]=o,a[++r]=206,a.writeUInt32BE(r-7,3),a}(t,r);case 2621461:return function(e,t){var r=Buffer.alloc(12);return r[0]=1,r.writeUInt16BE(e,1),r.writeUInt32BE(2621461,7),r[11]=206,r.writeUInt32BE(4,3),r}(t);case 2621470:return function(e,t){var r,n=0,o=null,i=0,s=0,a=0;if(void 0===(o=t.destination))throw new Error("Missing value for mandatory field 'destination'");if(!("string"==typeof o&&Buffer.byteLength(o)<256))throw new TypeError("Field 'destination' is the wrong type; must be a string (up to 255 chars)");var u=Buffer.byteLength(o,"utf8");if(s+=u,void 0===(o=t.source))throw new Error("Missing value for mandatory field 'source'");if(!("string"==typeof o&&Buffer.byteLength(o)<256))throw new TypeError("Field 'source' is the wrong type; must be a string (up to 255 chars)");var c=Buffer.byteLength(o,"utf8");if(s+=c,void 0===(o=t.routingKey))o="";else if(!("string"==typeof o&&Buffer.byteLength(o)<256))throw new TypeError("Field 'routingKey' is the wrong type; must be a string (up to 255 chars)");var l=Buffer.byteLength(o,"utf8");if(s+=l,void 0===(o=t.arguments))o={};else if("object"!=typeof o)throw new TypeError("Field 'arguments' is the wrong type; must be an object");r=ue(le,o,a);var f=le.slice(a,a+r);a+=r,s+=f.length;var h=Buffer.alloc(18+s);if(h[0]=1,h.writeUInt16BE(e,1),h.writeUInt32BE(2621470,7),n=11,void 0===(o=t.ticket))o=0;else if("number"!=typeof o||isNaN(o))throw new TypeError("Field 'ticket' is the wrong type; must be a number (but not NaN)");return h.writeUInt16BE(o,n),n+=2,void 0===(o=t.destination)&&(o=void 0),h[n]=u,n++,h.write(o,n,"utf8"),n+=u,void 0===(o=t.source)&&(o=void 0),h[n]=c,n++,h.write(o,n,"utf8"),n+=c,void 0===(o=t.routingKey)&&(o=""),h[n]=l,n++,h.write(o,n,"utf8"),n+=l,void 0===(o=t.nowait)&&(o=!1),o&&(i+=1),h[n]=i,n++,i=0,h[n+=f.copy(h,n)]=206,h.writeUInt32BE(n-7,3),h}(t,r);case 2621471:return function(e,t){var r=Buffer.alloc(12);return r[0]=1,r.writeUInt16BE(e,1),r.writeUInt32BE(2621471,7),r[11]=206,r.writeUInt32BE(4,3),r}(t);case 2621480:return function(e,t){var r,n=0,o=null,i=0,s=0,a=0;if(void 0===(o=t.destination))throw new Error("Missing value for mandatory field 'destination'");if(!("string"==typeof o&&Buffer.byteLength(o)<256))throw new TypeError("Field 'destination' is the wrong type; must be a string (up to 255 chars)");var u=Buffer.byteLength(o,"utf8");if(s+=u,void 0===(o=t.source))throw new Error("Missing value for mandatory field 'source'");if(!("string"==typeof o&&Buffer.byteLength(o)<256))throw new TypeError("Field 'source' is the wrong type; must be a string (up to 255 chars)");var c=Buffer.byteLength(o,"utf8");if(s+=c,void 0===(o=t.routingKey))o="";else if(!("string"==typeof o&&Buffer.byteLength(o)<256))throw new TypeError("Field 'routingKey' is the wrong type; must be a string (up to 255 chars)");var l=Buffer.byteLength(o,"utf8");if(s+=l,void 0===(o=t.arguments))o={};else if("object"!=typeof o)throw new TypeError("Field 'arguments' is the wrong type; must be an object");r=ue(le,o,a);var f=le.slice(a,a+r);a+=r,s+=f.length;var h=Buffer.alloc(18+s);if(h[0]=1,h.writeUInt16BE(e,1),h.writeUInt32BE(2621480,7),n=11,void 0===(o=t.ticket))o=0;else if("number"!=typeof o||isNaN(o))throw new TypeError("Field 'ticket' is the wrong type; must be a number (but not NaN)");return h.writeUInt16BE(o,n),n+=2,void 0===(o=t.destination)&&(o=void 0),h[n]=u,n++,h.write(o,n,"utf8"),n+=u,void 0===(o=t.source)&&(o=void 0),h[n]=c,n++,h.write(o,n,"utf8"),n+=c,void 0===(o=t.routingKey)&&(o=""),h[n]=l,n++,h.write(o,n,"utf8"),n+=l,void 0===(o=t.nowait)&&(o=!1),o&&(i+=1),h[n]=i,n++,i=0,h[n+=f.copy(h,n)]=206,h.writeUInt32BE(n-7,3),h}(t,r);case 2621491:return function(e,t){var r=Buffer.alloc(12);return r[0]=1,r.writeUInt16BE(e,1),r.writeUInt32BE(2621491,7),r[11]=206,r.writeUInt32BE(4,3),r}(t);case 3276810:return function(e,t){var r,n=0,o=null,i=0,s=0,a=0;if(void 0===(o=t.queue))o="";else if(!("string"==typeof o&&Buffer.byteLength(o)<256))throw new TypeError("Field 'queue' is the wrong type; must be a string (up to 255 chars)");var u=Buffer.byteLength(o,"utf8");if(s+=u,void 0===(o=t.arguments))o={};else if("object"!=typeof o)throw new TypeError("Field 'arguments' is the wrong type; must be an object");r=ue(le,o,a);var c=le.slice(a,a+r);a+=r,s+=c.length;var l=Buffer.alloc(16+s);if(l[0]=1,l.writeUInt16BE(e,1),l.writeUInt32BE(3276810,7),n=11,void 0===(o=t.ticket))o=0;else if("number"!=typeof o||isNaN(o))throw new TypeError("Field 'ticket' is the wrong type; must be a number (but not NaN)");return l.writeUInt16BE(o,n),n+=2,void 0===(o=t.queue)&&(o=""),l[n]=u,n++,l.write(o,n,"utf8"),n+=u,void 0===(o=t.passive)&&(o=!1),o&&(i+=1),void 0===(o=t.durable)&&(o=!1),o&&(i+=2),void 0===(o=t.exclusive)&&(o=!1),o&&(i+=4),void 0===(o=t.autoDelete)&&(o=!1),o&&(i+=8),void 0===(o=t.nowait)&&(o=!1),o&&(i+=16),l[n]=i,n++,i=0,l[n+=c.copy(l,n)]=206,l.writeUInt32BE(n-7,3),l}(t,r);case 3276811:return function(e,t){var r=0,n=null,o=0;if(void 0===(n=t.queue))throw new Error("Missing value for mandatory field 'queue'");if(!("string"==typeof n&&Buffer.byteLength(n)<256))throw new TypeError("Field 'queue' is the wrong type; must be a string (up to 255 chars)");var i=Buffer.byteLength(n,"utf8");o+=i;var s=Buffer.alloc(21+o);if(s[0]=1,s.writeUInt16BE(e,1),s.writeUInt32BE(3276811,7),r=11,void 0===(n=t.queue)&&(n=void 0),s[r]=i,r++,s.write(n,r,"utf8"),r+=i,void 0===(n=t.messageCount))throw new Error("Missing value for mandatory field 'messageCount'");if("number"!=typeof n||isNaN(n))throw new TypeError("Field 'messageCount' is the wrong type; must be a number (but not NaN)");if(s.writeUInt32BE(n,r),r+=4,void 0===(n=t.consumerCount))throw new Error("Missing value for mandatory field 'consumerCount'");if("number"!=typeof n||isNaN(n))throw new TypeError("Field 'consumerCount' is the wrong type; must be a number (but not NaN)");return s.writeUInt32BE(n,r),s[r+=4]=206,s.writeUInt32BE(r-7,3),s}(t,r);case 3276820:return function(e,t){var r,n=0,o=null,i=0,s=0,a=0;if(void 0===(o=t.queue))o="";else if(!("string"==typeof o&&Buffer.byteLength(o)<256))throw new TypeError("Field 'queue' is the wrong type; must be a string (up to 255 chars)");var u=Buffer.byteLength(o,"utf8");if(s+=u,void 0===(o=t.exchange))throw new Error("Missing value for mandatory field 'exchange'");if(!("string"==typeof o&&Buffer.byteLength(o)<256))throw new TypeError("Field 'exchange' is the wrong type; must be a string (up to 255 chars)");var c=Buffer.byteLength(o,"utf8");if(s+=c,void 0===(o=t.routingKey))o="";else if(!("string"==typeof o&&Buffer.byteLength(o)<256))throw new TypeError("Field 'routingKey' is the wrong type; must be a string (up to 255 chars)");var l=Buffer.byteLength(o,"utf8");if(s+=l,void 0===(o=t.arguments))o={};else if("object"!=typeof o)throw new TypeError("Field 'arguments' is the wrong type; must be an object");r=ue(le,o,a);var f=le.slice(a,a+r);a+=r,s+=f.length;var h=Buffer.alloc(18+s);if(h[0]=1,h.writeUInt16BE(e,1),h.writeUInt32BE(3276820,7),n=11,void 0===(o=t.ticket))o=0;else if("number"!=typeof o||isNaN(o))throw new TypeError("Field 'ticket' is the wrong type; must be a number (but not NaN)");return h.writeUInt16BE(o,n),n+=2,void 0===(o=t.queue)&&(o=""),h[n]=u,n++,h.write(o,n,"utf8"),n+=u,void 0===(o=t.exchange)&&(o=void 0),h[n]=c,n++,h.write(o,n,"utf8"),n+=c,void 0===(o=t.routingKey)&&(o=""),h[n]=l,n++,h.write(o,n,"utf8"),n+=l,void 0===(o=t.nowait)&&(o=!1),o&&(i+=1),h[n]=i,n++,i=0,h[n+=f.copy(h,n)]=206,h.writeUInt32BE(n-7,3),h}(t,r);case 3276821:return function(e,t){var r=Buffer.alloc(12);return r[0]=1,r.writeUInt16BE(e,1),r.writeUInt32BE(3276821,7),r[11]=206,r.writeUInt32BE(4,3),r}(t);case 3276830:return function(e,t){var r=0,n=null,o=0,i=0;if(void 0===(n=t.queue))n="";else if(!("string"==typeof n&&Buffer.byteLength(n)<256))throw new TypeError("Field 'queue' is the wrong type; must be a string (up to 255 chars)");var s=Buffer.byteLength(n,"utf8");i+=s;var a=Buffer.alloc(16+i);if(a[0]=1,a.writeUInt16BE(e,1),a.writeUInt32BE(3276830,7),r=11,void 0===(n=t.ticket))n=0;else if("number"!=typeof n||isNaN(n))throw new TypeError("Field 'ticket' is the wrong type; must be a number (but not NaN)");return a.writeUInt16BE(n,r),r+=2,void 0===(n=t.queue)&&(n=""),a[r]=s,r++,a.write(n,r,"utf8"),r+=s,void 0===(n=t.nowait)&&(n=!1),n&&(o+=1),a[r]=o,a[++r]=206,a.writeUInt32BE(r-7,3),a}(t,r);case 3276831:return function(e,t){var r,n=0,o=Buffer.alloc(16);if(o[0]=1,o.writeUInt16BE(e,1),o.writeUInt32BE(3276831,7),n=11,void 0===(r=t.messageCount))throw new Error("Missing value for mandatory field 'messageCount'");if("number"!=typeof r||isNaN(r))throw new TypeError("Field 'messageCount' is the wrong type; must be a number (but not NaN)");return o.writeUInt32BE(r,n),o[n+=4]=206,o.writeUInt32BE(n-7,3),o}(t,r);case 3276840:return function(e,t){var r=0,n=null,o=0,i=0;if(void 0===(n=t.queue))n="";else if(!("string"==typeof n&&Buffer.byteLength(n)<256))throw new TypeError("Field 'queue' is the wrong type; must be a string (up to 255 chars)");var s=Buffer.byteLength(n,"utf8");i+=s;var a=Buffer.alloc(16+i);if(a[0]=1,a.writeUInt16BE(e,1),a.writeUInt32BE(3276840,7),r=11,void 0===(n=t.ticket))n=0;else if("number"!=typeof n||isNaN(n))throw new TypeError("Field 'ticket' is the wrong type; must be a number (but not NaN)");return a.writeUInt16BE(n,r),r+=2,void 0===(n=t.queue)&&(n=""),a[r]=s,r++,a.write(n,r,"utf8"),r+=s,void 0===(n=t.ifUnused)&&(n=!1),n&&(o+=1),void 0===(n=t.ifEmpty)&&(n=!1),n&&(o+=2),void 0===(n=t.nowait)&&(n=!1),n&&(o+=4),a[r]=o,a[++r]=206,a.writeUInt32BE(r-7,3),a}(t,r);case 3276841:return function(e,t){var r,n=0,o=Buffer.alloc(16);if(o[0]=1,o.writeUInt16BE(e,1),o.writeUInt32BE(3276841,7),n=11,void 0===(r=t.messageCount))throw new Error("Missing value for mandatory field 'messageCount'");if("number"!=typeof r||isNaN(r))throw new TypeError("Field 'messageCount' is the wrong type; must be a number (but not NaN)");return o.writeUInt32BE(r,n),o[n+=4]=206,o.writeUInt32BE(n-7,3),o}(t,r);case 3276850:return function(e,t){var r,n=0,o=null,i=0,s=0;if(void 0===(o=t.queue))o="";else if(!("string"==typeof o&&Buffer.byteLength(o)<256))throw new TypeError("Field 'queue' is the wrong type; must be a string (up to 255 chars)");var a=Buffer.byteLength(o,"utf8");if(i+=a,void 0===(o=t.exchange))throw new Error("Missing value for mandatory field 'exchange'");if(!("string"==typeof o&&Buffer.byteLength(o)<256))throw new TypeError("Field 'exchange' is the wrong type; must be a string (up to 255 chars)");var u=Buffer.byteLength(o,"utf8");if(i+=u,void 0===(o=t.routingKey))o="";else if(!("string"==typeof o&&Buffer.byteLength(o)<256))throw new TypeError("Field 'routingKey' is the wrong type; must be a string (up to 255 chars)");var c=Buffer.byteLength(o,"utf8");if(i+=c,void 0===(o=t.arguments))o={};else if("object"!=typeof o)throw new TypeError("Field 'arguments' is the wrong type; must be an object");r=ue(le,o,s);var l=le.slice(s,s+r);s+=r,i+=l.length;var f=Buffer.alloc(17+i);if(f[0]=1,f.writeUInt16BE(e,1),f.writeUInt32BE(3276850,7),n=11,void 0===(o=t.ticket))o=0;else if("number"!=typeof o||isNaN(o))throw new TypeError("Field 'ticket' is the wrong type; must be a number (but not NaN)");return f.writeUInt16BE(o,n),n+=2,void 0===(o=t.queue)&&(o=""),f[n]=a,n++,f.write(o,n,"utf8"),n+=a,void 0===(o=t.exchange)&&(o=void 0),f[n]=u,n++,f.write(o,n,"utf8"),n+=u,void 0===(o=t.routingKey)&&(o=""),f[n]=c,n++,f.write(o,n,"utf8"),n+=c,f[n+=l.copy(f,n)]=206,f.writeUInt32BE(n-7,3),f}(t,r);case 3276851:return function(e,t){var r=Buffer.alloc(12);return r[0]=1,r.writeUInt16BE(e,1),r.writeUInt32BE(3276851,7),r[11]=206,r.writeUInt32BE(4,3),r}(t);case 3932170:return function(e,t){var r=0,n=null,o=0,i=Buffer.alloc(19);if(i[0]=1,i.writeUInt16BE(e,1),i.writeUInt32BE(3932170,7),r=11,void 0===(n=t.prefetchSize))n=0;else if("number"!=typeof n||isNaN(n))throw new TypeError("Field 'prefetchSize' is the wrong type; must be a number (but not NaN)");if(i.writeUInt32BE(n,r),r+=4,void 0===(n=t.prefetchCount))n=0;else if("number"!=typeof n||isNaN(n))throw new TypeError("Field 'prefetchCount' is the wrong type; must be a number (but not NaN)");return i.writeUInt16BE(n,r),r+=2,void 0===(n=t.global)&&(n=!1),n&&(o+=1),i[r]=o,i[++r]=206,i.writeUInt32BE(r-7,3),i}(t,r);case 3932171:return function(e,t){var r=Buffer.alloc(12);return r[0]=1,r.writeUInt16BE(e,1),r.writeUInt32BE(3932171,7),r[11]=206,r.writeUInt32BE(4,3),r}(t);case 3932180:return function(e,t){var r,n=0,o=null,i=0,s=0,a=0;if(void 0===(o=t.queue))o="";else if(!("string"==typeof o&&Buffer.byteLength(o)<256))throw new TypeError("Field 'queue' is the wrong type; must be a string (up to 255 chars)");var u=Buffer.byteLength(o,"utf8");if(s+=u,void 0===(o=t.consumerTag))o="";else if(!("string"==typeof o&&Buffer.byteLength(o)<256))throw new TypeError("Field 'consumerTag' is the wrong type; must be a string (up to 255 chars)");var c=Buffer.byteLength(o,"utf8");if(s+=c,void 0===(o=t.arguments))o={};else if("object"!=typeof o)throw new TypeError("Field 'arguments' is the wrong type; must be an object");r=ue(le,o,a);var l=le.slice(a,a+r);a+=r,s+=l.length;var f=Buffer.alloc(17+s);if(f[0]=1,f.writeUInt16BE(e,1),f.writeUInt32BE(3932180,7),n=11,void 0===(o=t.ticket))o=0;else if("number"!=typeof o||isNaN(o))throw new TypeError("Field 'ticket' is the wrong type; must be a number (but not NaN)");return f.writeUInt16BE(o,n),n+=2,void 0===(o=t.queue)&&(o=""),f[n]=u,n++,f.write(o,n,"utf8"),n+=u,void 0===(o=t.consumerTag)&&(o=""),f[n]=c,n++,f.write(o,n,"utf8"),n+=c,void 0===(o=t.noLocal)&&(o=!1),o&&(i+=1),void 0===(o=t.noAck)&&(o=!1),o&&(i+=2),void 0===(o=t.exclusive)&&(o=!1),o&&(i+=4),void 0===(o=t.nowait)&&(o=!1),o&&(i+=8),f[n]=i,n++,i=0,f[n+=l.copy(f,n)]=206,f.writeUInt32BE(n-7,3),f}(t,r);case 3932181:return function(e,t){var r=0,n=null,o=0;if(void 0===(n=t.consumerTag))throw new Error("Missing value for mandatory field 'consumerTag'");if(!("string"==typeof n&&Buffer.byteLength(n)<256))throw new TypeError("Field 'consumerTag' is the wrong type; must be a string (up to 255 chars)");var i=Buffer.byteLength(n,"utf8");o+=i;var s=Buffer.alloc(13+o);return s[0]=1,s.writeUInt16BE(e,1),s.writeUInt32BE(3932181,7),r=11,void 0===(n=t.consumerTag)&&(n=void 0),s[r]=i,r++,s.write(n,r,"utf8"),s[r+=i]=206,s.writeUInt32BE(r-7,3),s}(t,r);case 3932190:return function(e,t){var r=0,n=null,o=0,i=0;if(void 0===(n=t.consumerTag))throw new Error("Missing value for mandatory field 'consumerTag'");if(!("string"==typeof n&&Buffer.byteLength(n)<256))throw new TypeError("Field 'consumerTag' is the wrong type; must be a string (up to 255 chars)");var s=Buffer.byteLength(n,"utf8");i+=s;var a=Buffer.alloc(14+i);return a[0]=1,a.writeUInt16BE(e,1),a.writeUInt32BE(3932190,7),r=11,void 0===(n=t.consumerTag)&&(n=void 0),a[r]=s,r++,a.write(n,r,"utf8"),r+=s,void 0===(n=t.nowait)&&(n=!1),n&&(o+=1),a[r]=o,a[++r]=206,a.writeUInt32BE(r-7,3),a}(t,r);case 3932191:return function(e,t){var r=0,n=null,o=0;if(void 0===(n=t.consumerTag))throw new Error("Missing value for mandatory field 'consumerTag'");if(!("string"==typeof n&&Buffer.byteLength(n)<256))throw new TypeError("Field 'consumerTag' is the wrong type; must be a string (up to 255 chars)");var i=Buffer.byteLength(n,"utf8");o+=i;var s=Buffer.alloc(13+o);return s[0]=1,s.writeUInt16BE(e,1),s.writeUInt32BE(3932191,7),r=11,void 0===(n=t.consumerTag)&&(n=void 0),s[r]=i,r++,s.write(n,r,"utf8"),s[r+=i]=206,s.writeUInt32BE(r-7,3),s}(t,r);case 3932200:return function(e,t){var r=0,n=null,o=0,i=0;if(void 0===(n=t.exchange))n="";else if(!("string"==typeof n&&Buffer.byteLength(n)<256))throw new TypeError("Field 'exchange' is the wrong type; must be a string (up to 255 chars)");var s=Buffer.byteLength(n,"utf8");if(i+=s,void 0===(n=t.routingKey))n="";else if(!("string"==typeof n&&Buffer.byteLength(n)<256))throw new TypeError("Field 'routingKey' is the wrong type; must be a string (up to 255 chars)");var a=Buffer.byteLength(n,"utf8");i+=a;var u=Buffer.alloc(17+i);if(u[0]=1,u.writeUInt16BE(e,1),u.writeUInt32BE(3932200,7),r=11,void 0===(n=t.ticket))n=0;else if("number"!=typeof n||isNaN(n))throw new TypeError("Field 'ticket' is the wrong type; must be a number (but not NaN)");return u.writeUInt16BE(n,r),r+=2,void 0===(n=t.exchange)&&(n=""),u[r]=s,r++,u.write(n,r,"utf8"),r+=s,void 0===(n=t.routingKey)&&(n=""),u[r]=a,r++,u.write(n,r,"utf8"),r+=a,void 0===(n=t.mandatory)&&(n=!1),n&&(o+=1),void 0===(n=t.immediate)&&(n=!1),n&&(o+=2),u[r]=o,u[++r]=206,u.writeUInt32BE(r-7,3),u}(t,r);case 3932210:return function(e,t){var r=0,n=null,o=0;if(void 0===(n=t.replyText))n="";else if(!("string"==typeof n&&Buffer.byteLength(n)<256))throw new TypeError("Field 'replyText' is the wrong type; must be a string (up to 255 chars)");var i=Buffer.byteLength(n,"utf8");if(o+=i,void 0===(n=t.exchange))throw new Error("Missing value for mandatory field 'exchange'");if(!("string"==typeof n&&Buffer.byteLength(n)<256))throw new TypeError("Field 'exchange' is the wrong type; must be a string (up to 255 chars)");var s=Buffer.byteLength(n,"utf8");if(o+=s,void 0===(n=t.routingKey))throw new Error("Missing value for mandatory field 'routingKey'");if(!("string"==typeof n&&Buffer.byteLength(n)<256))throw new TypeError("Field 'routingKey' is the wrong type; must be a string (up to 255 chars)");var a=Buffer.byteLength(n,"utf8");o+=a;var u=Buffer.alloc(17+o);if(u[0]=1,u.writeUInt16BE(e,1),u.writeUInt32BE(3932210,7),r=11,void 0===(n=t.replyCode))throw new Error("Missing value for mandatory field 'replyCode'");if("number"!=typeof n||isNaN(n))throw new TypeError("Field 'replyCode' is the wrong type; must be a number (but not NaN)");return u.writeUInt16BE(n,r),r+=2,void 0===(n=t.replyText)&&(n=""),u[r]=i,r++,u.write(n,r,"utf8"),r+=i,void 0===(n=t.exchange)&&(n=void 0),u[r]=s,r++,u.write(n,r,"utf8"),r+=s,void 0===(n=t.routingKey)&&(n=void 0),u[r]=a,r++,u.write(n,r,"utf8"),u[r+=a]=206,u.writeUInt32BE(r-7,3),u}(t,r);case 3932220:return function(e,t){var r=0,n=null,o=0,i=0;if(void 0===(n=t.consumerTag))throw new Error("Missing value for mandatory field 'consumerTag'");if(!("string"==typeof n&&Buffer.byteLength(n)<256))throw new TypeError("Field 'consumerTag' is the wrong type; must be a string (up to 255 chars)");var s=Buffer.byteLength(n,"utf8");if(i+=s,void 0===(n=t.exchange))throw new Error("Missing value for mandatory field 'exchange'");if(!("string"==typeof n&&Buffer.byteLength(n)<256))throw new TypeError("Field 'exchange' is the wrong type; must be a string (up to 255 chars)");var a=Buffer.byteLength(n,"utf8");if(i+=a,void 0===(n=t.routingKey))throw new Error("Missing value for mandatory field 'routingKey'");if(!("string"==typeof n&&Buffer.byteLength(n)<256))throw new TypeError("Field 'routingKey' is the wrong type; must be a string (up to 255 chars)");var u=Buffer.byteLength(n,"utf8");i+=u;var c=Buffer.alloc(24+i);if(c[0]=1,c.writeUInt16BE(e,1),c.writeUInt32BE(3932220,7),r=11,void 0===(n=t.consumerTag)&&(n=void 0),c[r]=s,r++,c.write(n,r,"utf8"),r+=s,void 0===(n=t.deliveryTag))throw new Error("Missing value for mandatory field 'deliveryTag'");if("number"!=typeof n||isNaN(n))throw new TypeError("Field 'deliveryTag' is the wrong type; must be a number (but not NaN)");return ae.writeUInt64BE(c,n,r),r+=8,void 0===(n=t.redelivered)&&(n=!1),n&&(o+=1),c[r]=o,r++,o=0,void 0===(n=t.exchange)&&(n=void 0),c[r]=a,r++,c.write(n,r,"utf8"),r+=a,void 0===(n=t.routingKey)&&(n=void 0),c[r]=u,r++,c.write(n,r,"utf8"),c[r+=u]=206,c.writeUInt32BE(r-7,3),c}(t,r);case 3932230:return function(e,t){var r=0,n=null,o=0,i=0;if(void 0===(n=t.queue))n="";else if(!("string"==typeof n&&Buffer.byteLength(n)<256))throw new TypeError("Field 'queue' is the wrong type; must be a string (up to 255 chars)");var s=Buffer.byteLength(n,"utf8");i+=s;var a=Buffer.alloc(16+i);if(a[0]=1,a.writeUInt16BE(e,1),a.writeUInt32BE(3932230,7),r=11,void 0===(n=t.ticket))n=0;else if("number"!=typeof n||isNaN(n))throw new TypeError("Field 'ticket' is the wrong type; must be a number (but not NaN)");return a.writeUInt16BE(n,r),r+=2,void 0===(n=t.queue)&&(n=""),a[r]=s,r++,a.write(n,r,"utf8"),r+=s,void 0===(n=t.noAck)&&(n=!1),n&&(o+=1),a[r]=o,a[++r]=206,a.writeUInt32BE(r-7,3),a}(t,r);case 3932231:return function(e,t){var r=0,n=null,o=0,i=0;if(void 0===(n=t.exchange))throw new Error("Missing value for mandatory field 'exchange'");if(!("string"==typeof n&&Buffer.byteLength(n)<256))throw new TypeError("Field 'exchange' is the wrong type; must be a string (up to 255 chars)");var s=Buffer.byteLength(n,"utf8");if(i+=s,void 0===(n=t.routingKey))throw new Error("Missing value for mandatory field 'routingKey'");if(!("string"==typeof n&&Buffer.byteLength(n)<256))throw new TypeError("Field 'routingKey' is the wrong type; must be a string (up to 255 chars)");var a=Buffer.byteLength(n,"utf8");i+=a;var u=Buffer.alloc(27+i);if(u[0]=1,u.writeUInt16BE(e,1),u.writeUInt32BE(3932231,7),r=11,void 0===(n=t.deliveryTag))throw new Error("Missing value for mandatory field 'deliveryTag'");if("number"!=typeof n||isNaN(n))throw new TypeError("Field 'deliveryTag' is the wrong type; must be a number (but not NaN)");if(ae.writeUInt64BE(u,n,r),r+=8,void 0===(n=t.redelivered)&&(n=!1),n&&(o+=1),u[r]=o,r++,o=0,void 0===(n=t.exchange)&&(n=void 0),u[r]=s,r++,u.write(n,r,"utf8"),r+=s,void 0===(n=t.routingKey)&&(n=void 0),u[r]=a,r++,u.write(n,r,"utf8"),r+=a,void 0===(n=t.messageCount))throw new Error("Missing value for mandatory field 'messageCount'");if("number"!=typeof n||isNaN(n))throw new TypeError("Field 'messageCount' is the wrong type; must be a number (but not NaN)");return u.writeUInt32BE(n,r),u[r+=4]=206,u.writeUInt32BE(r-7,3),u}(t,r);case 3932232:return function(e,t){var r=0,n=null,o=0;if(void 0===(n=t.clusterId))n="";else if(!("string"==typeof n&&Buffer.byteLength(n)<256))throw new TypeError("Field 'clusterId' is the wrong type; must be a string (up to 255 chars)");var i=Buffer.byteLength(n,"utf8");o+=i;var s=Buffer.alloc(13+o);return s[0]=1,s.writeUInt16BE(e,1),s.writeUInt32BE(3932232,7),r=11,void 0===(n=t.clusterId)&&(n=""),s[r]=i,r++,s.write(n,r,"utf8"),s[r+=i]=206,s.writeUInt32BE(r-7,3),s}(t,r);case 3932240:return function(e,t){var r=0,n=null,o=0,i=Buffer.alloc(21);if(i[0]=1,i.writeUInt16BE(e,1),i.writeUInt32BE(3932240,7),r=11,void 0===(n=t.deliveryTag))n=0;else if("number"!=typeof n||isNaN(n))throw new TypeError("Field 'deliveryTag' is the wrong type; must be a number (but not NaN)");return ae.writeUInt64BE(i,n,r),r+=8,void 0===(n=t.multiple)&&(n=!1),n&&(o+=1),i[r]=o,i[++r]=206,i.writeUInt32BE(r-7,3),i}(t,r);case 3932250:return function(e,t){var r=0,n=null,o=0,i=Buffer.alloc(21);if(i[0]=1,i.writeUInt16BE(e,1),i.writeUInt32BE(3932250,7),r=11,void 0===(n=t.deliveryTag))throw new Error("Missing value for mandatory field 'deliveryTag'");if("number"!=typeof n||isNaN(n))throw new TypeError("Field 'deliveryTag' is the wrong type; must be a number (but not NaN)");return ae.writeUInt64BE(i,n,r),r+=8,void 0===(n=t.requeue)&&(n=!0),n&&(o+=1),i[r]=o,i[++r]=206,i.writeUInt32BE(r-7,3),i}(t,r);case 3932260:return function(e,t){var r=0,n=null,o=0,i=Buffer.alloc(13);return i[0]=1,i.writeUInt16BE(e,1),i.writeUInt32BE(3932260,7),r=11,void 0===(n=t.requeue)&&(n=!1),n&&(o+=1),i[r]=o,i[++r]=206,i.writeUInt32BE(r-7,3),i}(t,r);case 3932270:return function(e,t){var r=0,n=null,o=0,i=Buffer.alloc(13);return i[0]=1,i.writeUInt16BE(e,1),i.writeUInt32BE(3932270,7),r=11,void 0===(n=t.requeue)&&(n=!1),n&&(o+=1),i[r]=o,i[++r]=206,i.writeUInt32BE(r-7,3),i}(t,r);case 3932271:return function(e,t){var r=Buffer.alloc(12);return r[0]=1,r.writeUInt16BE(e,1),r.writeUInt32BE(3932271,7),r[11]=206,r.writeUInt32BE(4,3),r}(t);case 3932280:return function(e,t){var r=0,n=null,o=0,i=Buffer.alloc(21);if(i[0]=1,i.writeUInt16BE(e,1),i.writeUInt32BE(3932280,7),r=11,void 0===(n=t.deliveryTag))n=0;else if("number"!=typeof n||isNaN(n))throw new TypeError("Field 'deliveryTag' is the wrong type; must be a number (but not NaN)");return ae.writeUInt64BE(i,n,r),r+=8,void 0===(n=t.multiple)&&(n=!1),n&&(o+=1),void 0===(n=t.requeue)&&(n=!0),n&&(o+=2),i[r]=o,i[++r]=206,i.writeUInt32BE(r-7,3),i}(t,r);case 5898250:return function(e,t){var r=Buffer.alloc(12);return r[0]=1,r.writeUInt16BE(e,1),r.writeUInt32BE(5898250,7),r[11]=206,r.writeUInt32BE(4,3),r}(t);case 5898251:return function(e,t){var r=Buffer.alloc(12);return r[0]=1,r.writeUInt16BE(e,1),r.writeUInt32BE(5898251,7),r[11]=206,r.writeUInt32BE(4,3),r}(t);case 5898260:return function(e,t){var r=Buffer.alloc(12);return r[0]=1,r.writeUInt16BE(e,1),r.writeUInt32BE(5898260,7),r[11]=206,r.writeUInt32BE(4,3),r}(t);case 5898261:return function(e,t){var r=Buffer.alloc(12);return r[0]=1,r.writeUInt16BE(e,1),r.writeUInt32BE(5898261,7),r[11]=206,r.writeUInt32BE(4,3),r}(t);case 5898270:return function(e,t){var r=Buffer.alloc(12);return r[0]=1,r.writeUInt16BE(e,1),r.writeUInt32BE(5898270,7),r[11]=206,r.writeUInt32BE(4,3),r}(t);case 5898271:return function(e,t){var r=Buffer.alloc(12);return r[0]=1,r.writeUInt16BE(e,1),r.writeUInt32BE(5898271,7),r[11]=206,r.writeUInt32BE(4,3),r}(t);case 5570570:return function(e,t){var r=0,n=null,o=0,i=Buffer.alloc(13);return i[0]=1,i.writeUInt16BE(e,1),i.writeUInt32BE(5570570,7),r=11,void 0===(n=t.nowait)&&(n=!1),n&&(o+=1),i[r]=o,i[++r]=206,i.writeUInt32BE(r-7,3),i}(t,r);case 5570571:return function(e,t){var r=Buffer.alloc(12);return r[0]=1,r.writeUInt16BE(e,1),r.writeUInt32BE(5570571,7),r[11]=206,r.writeUInt32BE(4,3),r}(t);default:throw new Error("Unknown class/method ID")}},ee.encodeProperties=function(e,t,r,n){if(60===e)return function(e,t,r){var n,o,i=0,s=0,a=0,u=0;if(null!=(n=r.contentType)){if(!("string"==typeof n&&Buffer.byteLength(n)<256))throw new TypeError("Field 'contentType' is the wrong type; must be a string (up to 255 chars)");var c=Buffer.byteLength(n,"utf8");u+=1,u+=c}if(null!=(n=r.contentEncoding)){if(!("string"==typeof n&&Buffer.byteLength(n)<256))throw new TypeError("Field 'contentEncoding' is the wrong type; must be a string (up to 255 chars)");var l=Buffer.byteLength(n,"utf8");u+=1,u+=l}if(null!=(n=r.headers)){if("object"!=typeof n)throw new TypeError("Field 'headers' is the wrong type; must be an object");o=ue(le,n,a);var f=le.slice(a,a+o);a+=o,u+=f.length}if(null!=(n=r.deliveryMode)){if("number"!=typeof n||isNaN(n))throw new TypeError("Field 'deliveryMode' is the wrong type; must be a number (but not NaN)");u+=1}if(null!=(n=r.priority)){if("number"!=typeof n||isNaN(n))throw new TypeError("Field 'priority' is the wrong type; must be a number (but not NaN)");u+=1}if(null!=(n=r.correlationId)){if(!("string"==typeof n&&Buffer.byteLength(n)<256))throw new TypeError("Field 'correlationId' is the wrong type; must be a string (up to 255 chars)");var h=Buffer.byteLength(n,"utf8");u+=1,u+=h}if(null!=(n=r.replyTo)){if(!("string"==typeof n&&Buffer.byteLength(n)<256))throw new TypeError("Field 'replyTo' is the wrong type; must be a string (up to 255 chars)");var d=Buffer.byteLength(n,"utf8");u+=1,u+=d}if(null!=(n=r.expiration)){if(!("string"==typeof n&&Buffer.byteLength(n)<256))throw new TypeError("Field 'expiration' is the wrong type; must be a string (up to 255 chars)");var p=Buffer.byteLength(n,"utf8");u+=1,u+=p}if(null!=(n=r.messageId)){if(!("string"==typeof n&&Buffer.byteLength(n)<256))throw new TypeError("Field 'messageId' is the wrong type; must be a string (up to 255 chars)");var g=Buffer.byteLength(n,"utf8");u+=1,u+=g}if(null!=(n=r.timestamp)){if("number"!=typeof n||isNaN(n))throw new TypeError("Field 'timestamp' is the wrong type; must be a number (but not NaN)");u+=8}if(null!=(n=r.type)){if(!("string"==typeof n&&Buffer.byteLength(n)<256))throw new TypeError("Field 'type' is the wrong type; must be a string (up to 255 chars)");var m=Buffer.byteLength(n,"utf8");u+=1,u+=m}if(null!=(n=r.userId)){if(!("string"==typeof n&&Buffer.byteLength(n)<256))throw new TypeError("Field 'userId' is the wrong type; must be a string (up to 255 chars)");var b=Buffer.byteLength(n,"utf8");u+=1,u+=b}if(null!=(n=r.appId)){if(!("string"==typeof n&&Buffer.byteLength(n)<256))throw new TypeError("Field 'appId' is the wrong type; must be a string (up to 255 chars)");var v=Buffer.byteLength(n,"utf8");u+=1,u+=v}if(null!=(n=r.clusterId)){if(!("string"==typeof n&&Buffer.byteLength(n)<256))throw new TypeError("Field 'clusterId' is the wrong type; must be a string (up to 255 chars)");var y=Buffer.byteLength(n,"utf8");u+=1,u+=y}var w=Buffer.alloc(22+u);return w[0]=2,w.writeUInt16BE(e,1),w.writeUInt32BE(3932160,7),ae.writeUInt64BE(w,t,11),s=0,i=21,null!=(n=r.contentType)&&(s+=32768,w[i]=c,i++,w.write(n,i,"utf8"),i+=c),null!=(n=r.contentEncoding)&&(s+=16384,w[i]=l,i++,w.write(n,i,"utf8"),i+=l),null!=(n=r.headers)&&(s+=8192,i+=f.copy(w,i)),null!=(n=r.deliveryMode)&&(s+=4096,w.writeUInt8(n,i),i++),null!=(n=r.priority)&&(s+=2048,w.writeUInt8(n,i),i++),null!=(n=r.correlationId)&&(s+=1024,w[i]=h,i++,w.write(n,i,"utf8"),i+=h),null!=(n=r.replyTo)&&(s+=512,w[i]=d,i++,w.write(n,i,"utf8"),i+=d),null!=(n=r.expiration)&&(s+=256,w[i]=p,i++,w.write(n,i,"utf8"),i+=p),null!=(n=r.messageId)&&(s+=128,w[i]=g,i++,w.write(n,i,"utf8"),i+=g),null!=(n=r.timestamp)&&(s+=64,ae.writeUInt64BE(w,n,i),i+=8),null!=(n=r.type)&&(s+=32,w[i]=m,i++,w.write(n,i,"utf8"),i+=m),null!=(n=r.userId)&&(s+=16,w[i]=b,i++,w.write(n,i,"utf8"),i+=b),null!=(n=r.appId)&&(s+=8,w[i]=v,i++,w.write(n,i,"utf8"),i+=v),null!=(n=r.clusterId)&&(s+=4,w[i]=y,i++,w.write(n,i,"utf8"),i+=y),w[i]=206,w.writeUInt32BE(i-7,3),w.writeUInt16BE(s,19),w.slice(0,i+1)}(t,r,n);throw new Error("Unknown class/properties ID")},ee.info=function(e){switch(e){case 655370:return fe;case 655371:return he;case 655380:return de;case 655381:return pe;case 655390:return ge;case 655391:return me;case 655400:return be;case 655401:return ve;case 655410:return ye;case 655411:return we;case 655420:return Ee;case 655421:return Ie;case 1310730:return Ce;case 1310731:return xe;case 1310740:return Be;case 1310741:return Te;case 1310760:return ke;case 1310761:return Oe;case 1966090:return Se;case 1966091:return Ue;case 2621450:return _e;case 2621451:return Ne;case 2621460:return Ae;case 2621461:return Re;case 2621470:return Me;case 2621471:return Le;case 2621480:return Fe;case 2621491:return Pe;case 3276810:return je;case 3276811:return De;case 3276820:return qe;case 3276821:return $e;case 3276830:return He;case 3276831:return ze;case 3276840:return Ge;case 3276841:return Ke;case 3276850:return Ve;case 3276851:return Qe;case 3932170:return We;case 3932171:return Ye;case 3932180:return Je;case 3932181:return Xe;case 3932190:return Ze;case 3932191:return et;case 3932200:return tt;case 3932210:return rt;case 3932220:return nt;case 3932230:return ot;case 3932231:return it;case 3932232:return st;case 3932240:return at;case 3932250:return ut;case 3932260:return ct;case 3932270:return lt;case 3932271:return ft;case 3932280:return ht;case 5898250:return dt;case 5898251:return pt;case 5898260:return gt;case 5898261:return mt;case 5898270:return bt;case 5898271:return vt;case 5570570:return yt;case 5570571:return wt;case 60:return Et;default:throw new Error("Unknown class/method ID")}},ee.ConnectionStart=655370;var fe=ee.methodInfoConnectionStart={id:655370,classId:10,methodId:10,name:"ConnectionStart",args:[{type:"octet",name:"versionMajor",default:0},{type:"octet",name:"versionMinor",default:9},{type:"table",name:"serverProperties"},{type:"longstr",name:"mechanisms",default:"PLAIN"},{type:"longstr",name:"locales",default:"en_US"}]};ee.ConnectionStartOk=655371;var he=ee.methodInfoConnectionStartOk={id:655371,classId:10,methodId:11,name:"ConnectionStartOk",args:[{type:"table",name:"clientProperties"},{type:"shortstr",name:"mechanism",default:"PLAIN"},{type:"longstr",name:"response"},{type:"shortstr",name:"locale",default:"en_US"}]};ee.ConnectionSecure=655380;var de=ee.methodInfoConnectionSecure={id:655380,classId:10,methodId:20,name:"ConnectionSecure",args:[{type:"longstr",name:"challenge"}]};ee.ConnectionSecureOk=655381;var pe=ee.methodInfoConnectionSecureOk={id:655381,classId:10,methodId:21,name:"ConnectionSecureOk",args:[{type:"longstr",name:"response"}]};ee.ConnectionTune=655390;var ge=ee.methodInfoConnectionTune={id:655390,classId:10,methodId:30,name:"ConnectionTune",args:[{type:"short",name:"channelMax",default:0},{type:"long",name:"frameMax",default:0},{type:"short",name:"heartbeat",default:0}]};ee.ConnectionTuneOk=655391;var me=ee.methodInfoConnectionTuneOk={id:655391,classId:10,methodId:31,name:"ConnectionTuneOk",args:[{type:"short",name:"channelMax",default:0},{type:"long",name:"frameMax",default:0},{type:"short",name:"heartbeat",default:0}]};ee.ConnectionOpen=655400;var be=ee.methodInfoConnectionOpen={id:655400,classId:10,methodId:40,name:"ConnectionOpen",args:[{type:"shortstr",name:"virtualHost",default:"/"},{type:"shortstr",name:"capabilities",default:""},{type:"bit",name:"insist",default:!1}]};ee.ConnectionOpenOk=655401;var ve=ee.methodInfoConnectionOpenOk={id:655401,classId:10,methodId:41,name:"ConnectionOpenOk",args:[{type:"shortstr",name:"knownHosts",default:""}]};ee.ConnectionClose=655410;var ye=ee.methodInfoConnectionClose={id:655410,classId:10,methodId:50,name:"ConnectionClose",args:[{type:"short",name:"replyCode"},{type:"shortstr",name:"replyText",default:""},{type:"short",name:"classId"},{type:"short",name:"methodId"}]};ee.ConnectionCloseOk=655411;var we=ee.methodInfoConnectionCloseOk={id:655411,classId:10,methodId:51,name:"ConnectionCloseOk",args:[]};ee.ConnectionBlocked=655420;var Ee=ee.methodInfoConnectionBlocked={id:655420,classId:10,methodId:60,name:"ConnectionBlocked",args:[{type:"shortstr",name:"reason",default:""}]};ee.ConnectionUnblocked=655421;var Ie=ee.methodInfoConnectionUnblocked={id:655421,classId:10,methodId:61,name:"ConnectionUnblocked",args:[]};ee.ChannelOpen=1310730;var Ce=ee.methodInfoChannelOpen={id:1310730,classId:20,methodId:10,name:"ChannelOpen",args:[{type:"shortstr",name:"outOfBand",default:""}]};ee.ChannelOpenOk=1310731;var xe=ee.methodInfoChannelOpenOk={id:1310731,classId:20,methodId:11,name:"ChannelOpenOk",args:[{type:"longstr",name:"channelId",default:""}]};ee.ChannelFlow=1310740;var Be=ee.methodInfoChannelFlow={id:1310740,classId:20,methodId:20,name:"ChannelFlow",args:[{type:"bit",name:"active"}]};ee.ChannelFlowOk=1310741;var Te=ee.methodInfoChannelFlowOk={id:1310741,classId:20,methodId:21,name:"ChannelFlowOk",args:[{type:"bit",name:"active"}]};ee.ChannelClose=1310760;var ke=ee.methodInfoChannelClose={id:1310760,classId:20,methodId:40,name:"ChannelClose",args:[{type:"short",name:"replyCode"},{type:"shortstr",name:"replyText",default:""},{type:"short",name:"classId"},{type:"short",name:"methodId"}]};ee.ChannelCloseOk=1310761;var Oe=ee.methodInfoChannelCloseOk={id:1310761,classId:20,methodId:41,name:"ChannelCloseOk",args:[]};ee.AccessRequest=1966090;var Se=ee.methodInfoAccessRequest={id:1966090,classId:30,methodId:10,name:"AccessRequest",args:[{type:"shortstr",name:"realm",default:"/data"},{type:"bit",name:"exclusive",default:!1},{type:"bit",name:"passive",default:!0},{type:"bit",name:"active",default:!0},{type:"bit",name:"write",default:!0},{type:"bit",name:"read",default:!0}]};ee.AccessRequestOk=1966091;var Ue=ee.methodInfoAccessRequestOk={id:1966091,classId:30,methodId:11,name:"AccessRequestOk",args:[{type:"short",name:"ticket",default:1}]};ee.ExchangeDeclare=2621450;var _e=ee.methodInfoExchangeDeclare={id:2621450,classId:40,methodId:10,name:"ExchangeDeclare",args:[{type:"short",name:"ticket",default:0},{type:"shortstr",name:"exchange"},{type:"shortstr",name:"type",default:"direct"},{type:"bit",name:"passive",default:!1},{type:"bit",name:"durable",default:!1},{type:"bit",name:"autoDelete",default:!1},{type:"bit",name:"internal",default:!1},{type:"bit",name:"nowait",default:!1},{type:"table",name:"arguments",default:{}}]};ee.ExchangeDeclareOk=2621451;var Ne=ee.methodInfoExchangeDeclareOk={id:2621451,classId:40,methodId:11,name:"ExchangeDeclareOk",args:[]};ee.ExchangeDelete=2621460;var Ae=ee.methodInfoExchangeDelete={id:2621460,classId:40,methodId:20,name:"ExchangeDelete",args:[{type:"short",name:"ticket",default:0},{type:"shortstr",name:"exchange"},{type:"bit",name:"ifUnused",default:!1},{type:"bit",name:"nowait",default:!1}]};ee.ExchangeDeleteOk=2621461;var Re=ee.methodInfoExchangeDeleteOk={id:2621461,classId:40,methodId:21,name:"ExchangeDeleteOk",args:[]};ee.ExchangeBind=2621470;var Me=ee.methodInfoExchangeBind={id:2621470,classId:40,methodId:30,name:"ExchangeBind",args:[{type:"short",name:"ticket",default:0},{type:"shortstr",name:"destination"},{type:"shortstr",name:"source"},{type:"shortstr",name:"routingKey",default:""},{type:"bit",name:"nowait",default:!1},{type:"table",name:"arguments",default:{}}]};ee.ExchangeBindOk=2621471;var Le=ee.methodInfoExchangeBindOk={id:2621471,classId:40,methodId:31,name:"ExchangeBindOk",args:[]};ee.ExchangeUnbind=2621480;var Fe=ee.methodInfoExchangeUnbind={id:2621480,classId:40,methodId:40,name:"ExchangeUnbind",args:[{type:"short",name:"ticket",default:0},{type:"shortstr",name:"destination"},{type:"shortstr",name:"source"},{type:"shortstr",name:"routingKey",default:""},{type:"bit",name:"nowait",default:!1},{type:"table",name:"arguments",default:{}}]};ee.ExchangeUnbindOk=2621491;var Pe=ee.methodInfoExchangeUnbindOk={id:2621491,classId:40,methodId:51,name:"ExchangeUnbindOk",args:[]};ee.QueueDeclare=3276810;var je=ee.methodInfoQueueDeclare={id:3276810,classId:50,methodId:10,name:"QueueDeclare",args:[{type:"short",name:"ticket",default:0},{type:"shortstr",name:"queue",default:""},{type:"bit",name:"passive",default:!1},{type:"bit",name:"durable",default:!1},{type:"bit",name:"exclusive",default:!1},{type:"bit",name:"autoDelete",default:!1},{type:"bit",name:"nowait",default:!1},{type:"table",name:"arguments",default:{}}]};ee.QueueDeclareOk=3276811;var De=ee.methodInfoQueueDeclareOk={id:3276811,classId:50,methodId:11,name:"QueueDeclareOk",args:[{type:"shortstr",name:"queue"},{type:"long",name:"messageCount"},{type:"long",name:"consumerCount"}]};ee.QueueBind=3276820;var qe=ee.methodInfoQueueBind={id:3276820,classId:50,methodId:20,name:"QueueBind",args:[{type:"short",name:"ticket",default:0},{type:"shortstr",name:"queue",default:""},{type:"shortstr",name:"exchange"},{type:"shortstr",name:"routingKey",default:""},{type:"bit",name:"nowait",default:!1},{type:"table",name:"arguments",default:{}}]};ee.QueueBindOk=3276821;var $e=ee.methodInfoQueueBindOk={id:3276821,classId:50,methodId:21,name:"QueueBindOk",args:[]};ee.QueuePurge=3276830;var He=ee.methodInfoQueuePurge={id:3276830,classId:50,methodId:30,name:"QueuePurge",args:[{type:"short",name:"ticket",default:0},{type:"shortstr",name:"queue",default:""},{type:"bit",name:"nowait",default:!1}]};ee.QueuePurgeOk=3276831;var ze=ee.methodInfoQueuePurgeOk={id:3276831,classId:50,methodId:31,name:"QueuePurgeOk",args:[{type:"long",name:"messageCount"}]};ee.QueueDelete=3276840;var Ge=ee.methodInfoQueueDelete={id:3276840,classId:50,methodId:40,name:"QueueDelete",args:[{type:"short",name:"ticket",default:0},{type:"shortstr",name:"queue",default:""},{type:"bit",name:"ifUnused",default:!1},{type:"bit",name:"ifEmpty",default:!1},{type:"bit",name:"nowait",default:!1}]};ee.QueueDeleteOk=3276841;var Ke=ee.methodInfoQueueDeleteOk={id:3276841,classId:50,methodId:41,name:"QueueDeleteOk",args:[{type:"long",name:"messageCount"}]};ee.QueueUnbind=3276850;var Ve=ee.methodInfoQueueUnbind={id:3276850,classId:50,methodId:50,name:"QueueUnbind",args:[{type:"short",name:"ticket",default:0},{type:"shortstr",name:"queue",default:""},{type:"shortstr",name:"exchange"},{type:"shortstr",name:"routingKey",default:""},{type:"table",name:"arguments",default:{}}]};ee.QueueUnbindOk=3276851;var Qe=ee.methodInfoQueueUnbindOk={id:3276851,classId:50,methodId:51,name:"QueueUnbindOk",args:[]};ee.BasicQos=3932170;var We=ee.methodInfoBasicQos={id:3932170,classId:60,methodId:10,name:"BasicQos",args:[{type:"long",name:"prefetchSize",default:0},{type:"short",name:"prefetchCount",default:0},{type:"bit",name:"global",default:!1}]};ee.BasicQosOk=3932171;var Ye=ee.methodInfoBasicQosOk={id:3932171,classId:60,methodId:11,name:"BasicQosOk",args:[]};ee.BasicConsume=3932180;var Je=ee.methodInfoBasicConsume={id:3932180,classId:60,methodId:20,name:"BasicConsume",args:[{type:"short",name:"ticket",default:0},{type:"shortstr",name:"queue",default:""},{type:"shortstr",name:"consumerTag",default:""},{type:"bit",name:"noLocal",default:!1},{type:"bit",name:"noAck",default:!1},{type:"bit",name:"exclusive",default:!1},{type:"bit",name:"nowait",default:!1},{type:"table",name:"arguments",default:{}}]};ee.BasicConsumeOk=3932181;var Xe=ee.methodInfoBasicConsumeOk={id:3932181,classId:60,methodId:21,name:"BasicConsumeOk",args:[{type:"shortstr",name:"consumerTag"}]};ee.BasicCancel=3932190;var Ze=ee.methodInfoBasicCancel={id:3932190,classId:60,methodId:30,name:"BasicCancel",args:[{type:"shortstr",name:"consumerTag"},{type:"bit",name:"nowait",default:!1}]};ee.BasicCancelOk=3932191;var et=ee.methodInfoBasicCancelOk={id:3932191,classId:60,methodId:31,name:"BasicCancelOk",args:[{type:"shortstr",name:"consumerTag"}]};ee.BasicPublish=3932200;var tt=ee.methodInfoBasicPublish={id:3932200,classId:60,methodId:40,name:"BasicPublish",args:[{type:"short",name:"ticket",default:0},{type:"shortstr",name:"exchange",default:""},{type:"shortstr",name:"routingKey",default:""},{type:"bit",name:"mandatory",default:!1},{type:"bit",name:"immediate",default:!1}]};ee.BasicReturn=3932210;var rt=ee.methodInfoBasicReturn={id:3932210,classId:60,methodId:50,name:"BasicReturn",args:[{type:"short",name:"replyCode"},{type:"shortstr",name:"replyText",default:""},{type:"shortstr",name:"exchange"},{type:"shortstr",name:"routingKey"}]};ee.BasicDeliver=3932220;var nt=ee.methodInfoBasicDeliver={id:3932220,classId:60,methodId:60,name:"BasicDeliver",args:[{type:"shortstr",name:"consumerTag"},{type:"longlong",name:"deliveryTag"},{type:"bit",name:"redelivered",default:!1},{type:"shortstr",name:"exchange"},{type:"shortstr",name:"routingKey"}]};ee.BasicGet=3932230;var ot=ee.methodInfoBasicGet={id:3932230,classId:60,methodId:70,name:"BasicGet",args:[{type:"short",name:"ticket",default:0},{type:"shortstr",name:"queue",default:""},{type:"bit",name:"noAck",default:!1}]};ee.BasicGetOk=3932231;var it=ee.methodInfoBasicGetOk={id:3932231,classId:60,methodId:71,name:"BasicGetOk",args:[{type:"longlong",name:"deliveryTag"},{type:"bit",name:"redelivered",default:!1},{type:"shortstr",name:"exchange"},{type:"shortstr",name:"routingKey"},{type:"long",name:"messageCount"}]};ee.BasicGetEmpty=3932232;var st=ee.methodInfoBasicGetEmpty={id:3932232,classId:60,methodId:72,name:"BasicGetEmpty",args:[{type:"shortstr",name:"clusterId",default:""}]};ee.BasicAck=3932240;var at=ee.methodInfoBasicAck={id:3932240,classId:60,methodId:80,name:"BasicAck",args:[{type:"longlong",name:"deliveryTag",default:0},{type:"bit",name:"multiple",default:!1}]};ee.BasicReject=3932250;var ut=ee.methodInfoBasicReject={id:3932250,classId:60,methodId:90,name:"BasicReject",args:[{type:"longlong",name:"deliveryTag"},{type:"bit",name:"requeue",default:!0}]};ee.BasicRecoverAsync=3932260;var ct=ee.methodInfoBasicRecoverAsync={id:3932260,classId:60,methodId:100,name:"BasicRecoverAsync",args:[{type:"bit",name:"requeue",default:!1}]};ee.BasicRecover=3932270;var lt=ee.methodInfoBasicRecover={id:3932270,classId:60,methodId:110,name:"BasicRecover",args:[{type:"bit",name:"requeue",default:!1}]};ee.BasicRecoverOk=3932271;var ft=ee.methodInfoBasicRecoverOk={id:3932271,classId:60,methodId:111,name:"BasicRecoverOk",args:[]};ee.BasicNack=3932280;var ht=ee.methodInfoBasicNack={id:3932280,classId:60,methodId:120,name:"BasicNack",args:[{type:"longlong",name:"deliveryTag",default:0},{type:"bit",name:"multiple",default:!1},{type:"bit",name:"requeue",default:!0}]};ee.TxSelect=5898250;var dt=ee.methodInfoTxSelect={id:5898250,classId:90,methodId:10,name:"TxSelect",args:[]};ee.TxSelectOk=5898251;var pt=ee.methodInfoTxSelectOk={id:5898251,classId:90,methodId:11,name:"TxSelectOk",args:[]};ee.TxCommit=5898260;var gt=ee.methodInfoTxCommit={id:5898260,classId:90,methodId:20,name:"TxCommit",args:[]};ee.TxCommitOk=5898261;var mt=ee.methodInfoTxCommitOk={id:5898261,classId:90,methodId:21,name:"TxCommitOk",args:[]};ee.TxRollback=5898270;var bt=ee.methodInfoTxRollback={id:5898270,classId:90,methodId:30,name:"TxRollback",args:[]};ee.TxRollbackOk=5898271;var vt=ee.methodInfoTxRollbackOk={id:5898271,classId:90,methodId:31,name:"TxRollbackOk",args:[]};ee.ConfirmSelect=5570570;var yt=ee.methodInfoConfirmSelect={id:5570570,classId:85,methodId:10,name:"ConfirmSelect",args:[{type:"bit",name:"nowait",default:!1}]};ee.ConfirmSelectOk=5570571;var wt=ee.methodInfoConfirmSelectOk={id:5570571,classId:85,methodId:11,name:"ConfirmSelectOk",args:[]};ee.BasicProperties=60;var Et=ee.propertiesInfoBasicProperties={id:60,name:"BasicProperties",args:[{type:"shortstr",name:"contentType"},{type:"shortstr",name:"contentEncoding"},{type:"table",name:"headers"},{type:"octet",name:"deliveryMode"},{type:"octet",name:"priority"},{type:"shortstr",name:"correlationId"},{type:"shortstr",name:"replyTo"},{type:"shortstr",name:"expiration"},{type:"shortstr",name:"messageId"},{type:"timestamp",name:"timestamp"},{type:"shortstr",name:"type"},{type:"shortstr",name:"userId"},{type:"shortstr",name:"appId"},{type:"shortstr",name:"clusterId"}]},It={},Ct={},xt={},Bt={};function Tt(e){var t={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[e[r]]=1);return t}function kt(e,t,r){var n=Tt(r),o={name:e};return o.type=St(n),Ut(o,o.type,n),o.size=_t(o,o.type,t,o.unit),o}Bt.variable=kt,Bt.rest=function(){return kt("_",!0,["binary"])},Bt.value=function(e,t,r){var n=Tt(r),o={value:e};return o.type=St(n),Ut(o,o.type,n),o.size=_t(o,o.type,t,o.unit),o},Bt.string=function(e){return{value:e,type:"string"}};var Ot={integer:1,binary:1,float:1};function St(e){for(var t in e)if(Object.prototype.hasOwnProperty.call(e,t)&&Ot[t])return t;return"integer"}function Ut(e,t,r){switch(t){case"integer":e.signed=function(e){return e.signed}(r);case"float":e.bigendian=function(e){return!e.little}(r);default:e.unit=function(e,t){for(var r in e){if(Object.prototype.hasOwnProperty.call(e,r))if("unit:"==r.substr(0,5))return parseInt(r.substr(5))}switch(t){case"binary":return 8;case"integer":case"float":return 1}}(r,e.type)}return e}function _t(e,t,r,n){if(void 0!==r&&""!==r)return r;switch(t){case"integer":return 8;case"float":return 64;case"binary":return!0}}var Nt=function(){function e(e){return'"'+e.replace(/\\/g,"\\\\").replace(/"/g,'\\"').replace(/\x08/g,"\\b").replace(/\t/g,"\\t").replace(/\n/g,"\\n").replace(/\f/g,"\\f").replace(/\r/g,"\\r").replace(/[\x00-\x07\x0B\x0E-\x1F\x80-\uFFFF]/g,escape)+'"'}var t={parse:function(t,r){var n={start:function(){var e,t,r,n,i,s;if(i=o,s=o,null!==(e=E()))if(null!==(t=c())){for(r=[],n=u();null!==n;)r.push(n),n=u();null!==r?e=[e,t,r]:(e=null,o=s)}else e=null,o=s;else e=null,o=s;null!==e&&(a=e[1],(l=e[2]).unshift(a),e=l);var a,l;null===e&&(o=i);return e},segmentTail:u,segment:c,string:l,chars:f,char:h,hexDigit:d,identifier:p,number:g,size:m,specifierList:b,specifierTail:v,specifier:y,unit:w,ws:E};if(void 0!==r){if(void 0===n[r])throw new Error("Invalid rule name: "+e(r)+".")}else r="start";var o=0,i=0,s=[];function a(e){o<i||(o>i&&(i=o,s=[]),s.push(e))}function u(){var e,r,n,i,s,u;return s=o,u=o,null!==(e=E())?(44===t.charCodeAt(o)?(r=",",o++):(r=null,a('","')),null!==r&&null!==(n=E())&&null!==(i=c())?e=[e,r,n,i]:(e=null,o=u)):(e=null,o=u),null!==e&&(e=e[3]),null===e&&(o=s),e}function c(){var e,t,r,n,i;return n=o,null!==(e=l())&&(e={string:e}),null===e&&(o=n),null===e&&(n=o,i=o,null!==(e=p())&&null!==(t=null!==(t=m())?t:"")&&null!==(r=null!==(r=b())?r:"")?e=[e,t,r]:(e=null,o=i),null!==e&&(e=function(e,t,r,n){return{name:t,size:r,specifiers:n}}(0,e[0],e[1],e[2])),null===e&&(o=n),null===e&&(n=o,i=o,null!==(e=g())&&null!==(t=null!==(t=m())?t:"")&&null!==(r=null!==(r=b())?r:"")?e=[e,t,r]:(e=null,o=i),null!==e&&(e=function(e,t,r,n){return{value:t,size:r,specifiers:n}}(0,e[0],e[1],e[2])),null===e&&(o=n))),e}function l(){var e,r,n,i,s;return i=o,s=o,34===t.charCodeAt(o)?(e='"',o++):(e=null,a('"\\""')),null!==e?(34===t.charCodeAt(o)?(r='"',o++):(r=null,a('"\\""')),null!==r?e=[e,r]:(e=null,o=s)):(e=null,o=s),null!==e&&(e=""),null===e&&(o=i),null===e&&(i=o,s=o,34===t.charCodeAt(o)?(e='"',o++):(e=null,a('"\\""')),null!==e&&null!==(r=f())?(34===t.charCodeAt(o)?(n='"',o++):(n=null,a('"\\""')),null!==n?e=[e,r,n]:(e=null,o=s)):(e=null,o=s),null!==e&&(e=e[1]),null===e&&(o=i)),e}function f(){var e,t,r;if(r=o,null!==(t=h()))for(e=[];null!==t;)e.push(t),t=h();else e=null;return null!==e&&(e=e.join("")),null===e&&(o=r),e}function h(){var e,r,n,i,s,u,c,l,f,h,p;return/^[^"\\\0-\x1F]/.test(t.charAt(o))?(e=t.charAt(o),o++):(e=null,a('[^"\\\\\\0-\\x1F]')),null===e&&(u=o,'\\"'===t.substr(o,2)?(e='\\"',o+=2):(e=null,a('"\\\\\\""')),null!==e&&(e='"'),null===e&&(o=u),null===e&&(u=o,"\\\\"===t.substr(o,2)?(e="\\\\",o+=2):(e=null,a('"\\\\\\\\"')),null!==e&&(e="\\"),null===e&&(o=u),null===e&&(u=o,"\\/"===t.substr(o,2)?(e="\\/",o+=2):(e=null,a('"\\\\/"')),null!==e&&(e="/"),null===e&&(o=u),null===e&&(u=o,"\\b"===t.substr(o,2)?(e="\\b",o+=2):(e=null,a('"\\\\b"')),null!==e&&(e="\b"),null===e&&(o=u),null===e&&(u=o,"\\f"===t.substr(o,2)?(e="\\f",o+=2):(e=null,a('"\\\\f"')),null!==e&&(e="\f"),null===e&&(o=u),null===e&&(u=o,"\\n"===t.substr(o,2)?(e="\\n",o+=2):(e=null,a('"\\\\n"')),null!==e&&(e="\n"),null===e&&(o=u),null===e&&(u=o,"\\r"===t.substr(o,2)?(e="\\r",o+=2):(e=null,a('"\\\\r"')),null!==e&&(e="\r"),null===e&&(o=u),null===e&&(u=o,"\\t"===t.substr(o,2)?(e="\\t",o+=2):(e=null,a('"\\\\t"')),null!==e&&(e="\t"),null===e&&(o=u),null===e&&(u=o,c=o,"\\u"===t.substr(o,2)?(e="\\u",o+=2):(e=null,a('"\\\\u"')),null!==e&&null!==(r=d())&&null!==(n=d())&&null!==(i=d())&&null!==(s=d())?e=[e,r,n,i,s]:(e=null,o=c),null!==e&&(l=e[1],f=e[2],h=e[3],p=e[4],e=String.fromCharCode(parseInt("0x"+l+f+h+p))),null===e&&(o=u)))))))))),e}function d(){var e;return/^[0-9a-fA-F]/.test(t.charAt(o))?(e=t.charAt(o),o++):(e=null,a("[0-9a-fA-F]")),e}function p(){var e,r,n,i,s,u,c;if(i=o,s=o,/^[_a-zA-Z]/.test(t.charAt(o))?(e=t.charAt(o),o++):(e=null,a("[_a-zA-Z]")),null!==e){for(r=[],/^[_a-zA-Z0-9]/.test(t.charAt(o))?(n=t.charAt(o),o++):(n=null,a("[_a-zA-Z0-9]"));null!==n;)r.push(n),/^[_a-zA-Z0-9]/.test(t.charAt(o))?(n=t.charAt(o),o++):(n=null,a("[_a-zA-Z0-9]"));null!==r?e=[e,r]:(e=null,o=s)}else e=null,o=s;return null!==e&&(u=e[0],c=e[1],e=u+c.join("")),null===e&&(o=i),e}function g(){var e,r,n,i,s,u,c;if(i=o,48===t.charCodeAt(o)?(e="0",o++):(e=null,a('"0"')),null!==e&&(e=0),null===e&&(o=i),null===e){if(i=o,s=o,/^[1-9]/.test(t.charAt(o))?(e=t.charAt(o),o++):(e=null,a("[1-9]")),null!==e){for(r=[],/^[0-9]/.test(t.charAt(o))?(n=t.charAt(o),o++):(n=null,a("[0-9]"));null!==n;)r.push(n),/^[0-9]/.test(t.charAt(o))?(n=t.charAt(o),o++):(n=null,a("[0-9]"));null!==r?e=[e,r]:(e=null,o=s)}else e=null,o=s;null!==e&&(u=e[0],c=e[1],e=parseInt(u+c.join(""))),null===e&&(o=i)}return e}function m(){var e,r,n,i;return n=o,i=o,58===t.charCodeAt(o)?(e=":",o++):(e=null,a('":"')),null!==e&&null!==(r=g())?e=[e,r]:(e=null,o=i),null!==e&&(e=e[1]),null===e&&(o=n),null===e&&(n=o,i=o,58===t.charCodeAt(o)?(e=":",o++):(e=null,a('":"')),null!==e&&null!==(r=p())?e=[e,r]:(e=null,o=i),null!==e&&(e=e[1]),null===e&&(o=n)),e}function b(){var e,r,n,i,s,u,c,l;if(s=o,u=o,47===t.charCodeAt(o)?(e="/",o++):(e=null,a('"/"')),null!==e)if(null!==(r=y())){for(n=[],i=v();null!==i;)n.push(i),i=v();null!==n?e=[e,r,n]:(e=null,o=u)}else e=null,o=u;else e=null,o=u;return null!==e&&(c=e[1],(l=e[2]).unshift(c),e=l),null===e&&(o=s),e}function v(){var e,r,n,i;return n=o,i=o,45===t.charCodeAt(o)?(e="-",o++):(e=null,a('"-"')),null!==e&&null!==(r=y())?e=[e,r]:(e=null,o=i),null!==e&&(e=e[1]),null===e&&(o=n),e}function y(){var e;return"little"===t.substr(o,6)?(e="little",o+=6):(e=null,a('"little"')),null===e&&("big"===t.substr(o,3)?(e="big",o+=3):(e=null,a('"big"')),null===e&&("signed"===t.substr(o,6)?(e="signed",o+=6):(e=null,a('"signed"')),null===e&&("unsigned"===t.substr(o,8)?(e="unsigned",o+=8):(e=null,a('"unsigned"')),null===e&&("integer"===t.substr(o,7)?(e="integer",o+=7):(e=null,a('"integer"')),null===e&&("binary"===t.substr(o,6)?(e="binary",o+=6):(e=null,a('"binary"')),null===e&&("float"===t.substr(o,5)?(e="float",o+=5):(e=null,a('"float"')),null===e&&(e=w()))))))),e}function w(){var e,r,n,i;return n=o,i=o,"unit:"===t.substr(o,5)?(e="unit:",o+=5):(e=null,a('"unit:"')),null!==e&&null!==(r=g())?e=[e,r]:(e=null,o=i),null!==e&&(e="unit:"+e[1]),null===e&&(o=n),e}function E(){var e,r;for(e=[],/^[ \t\n]/.test(t.charAt(o))?(r=t.charAt(o),o++):(r=null,a("[ \\t\\n]"));null!==r;)e.push(r),/^[ \t\n]/.test(t.charAt(o))?(r=t.charAt(o),o++):(r=null,a("[ \\t\\n]"));return e}var I=n[r]();if(null===I||o!==t.length){var C=Math.max(o,i),x=C<t.length?t.charAt(C):null,B=function(){for(var e=1,r=1,n=!1,s=0;s<Math.max(o,i);s++){var a=t.charAt(s);"\n"===a?(n||e++,r=1,n=!1):"\r"===a||"\u2028"===a||"\u2029"===a?(e++,r=1,n=!0):(r++,n=!1)}return{line:e,column:r}}();throw new this.SyntaxError(function(e){e.sort();for(var t=null,r=[],n=0;n<e.length;n++)e[n]!==t&&(r.push(e[n]),t=e[n]);return r}(s),x,C,B.line,B.column)}return I},toSource:function(){return this._source},SyntaxError:function(t,r,n,o,i){this.name="SyntaxError",this.expected=t,this.found=r,this.message=function(t,r){var n;switch(t.length){case 0:n="end of input";break;case 1:n=t[0];break;default:n=t.slice(0,t.length-1).join(", ")+" or "+t[t.length-1]}return"Expected "+n+" but "+(r?e(r):"end of input")+" found."}(t,r),this.offset=n,this.line=o,this.column=i}};return t.SyntaxError.prototype=Error.prototype,t}(),At=Bt,Rt=Nt;function Mt(e){for(var t=Rt.parse(e),r=0,n=t.length;r<n;r++){var o=t[r];if(null!=o.string)t[r]=At.string(o.string);else if(null!=o.value)t[r]=At.value(o.value,o.size,o.specifiers);else{if(null==o.name)throw"Unknown segment "+o;t[r]=At.variable(o.name,o.size,o.specifiers)}}return t}xt.parse=function(){var e=[].join.call(arguments,",");return Mt(e)};var Lt,Ft,Pt,jt,Dt,qt={},$t={exports:{}},Ht={exports:{}};function zt(){if(Ft)return Lt;Ft=1;var e=1e3,t=60*e,r=60*t,n=24*r,o=7*n,i=365.25*n;function s(e,t,r,n){var o=t>=1.5*r;return Math.round(e/r)+" "+n+(o?"s":"")}return Lt=function(a,u){u=u||{};var c=typeof a;if("string"===c&&a.length>0)return function(s){if((s=String(s)).length>100)return;var a=/^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(s);if(!a)return;var u=parseFloat(a[1]);switch((a[2]||"ms").toLowerCase()){case"years":case"year":case"yrs":case"yr":case"y":return u*i;case"weeks":case"week":case"w":return u*o;case"days":case"day":case"d":return u*n;case"hours":case"hour":case"hrs":case"hr":case"h":return u*r;case"minutes":case"minute":case"mins":case"min":case"m":return u*t;case"seconds":case"second":case"secs":case"sec":case"s":return u*e;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return u;default:return}}(a);if("number"===c&&isFinite(a))return u.long?function(o){var i=Math.abs(o);if(i>=n)return s(o,i,n,"day");if(i>=r)return s(o,i,r,"hour");if(i>=t)return s(o,i,t,"minute");if(i>=e)return s(o,i,e,"second");return o+" ms"}(a):function(o){var i=Math.abs(o);if(i>=n)return Math.round(o/n)+"d";if(i>=r)return Math.round(o/r)+"h";if(i>=t)return Math.round(o/t)+"m";if(i>=e)return Math.round(o/e)+"s";return o+"ms"}(a);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(a))},Lt}function Gt(){if(jt)return Pt;return jt=1,Pt=function(e){function t(e){let n,o,i,s=null;function a(...e){if(!a.enabled)return;const r=a,o=Number(new Date),i=o-(n||o);r.diff=i,r.prev=n,r.curr=o,n=o,e[0]=t.coerce(e[0]),"string"!=typeof e[0]&&e.unshift("%O");let s=0;e[0]=e[0].replace(/%([a-zA-Z%])/g,((n,o)=>{if("%%"===n)return"%";s++;const i=t.formatters[o];if("function"==typeof i){const t=e[s];n=i.call(r,t),e.splice(s,1),s--}return n})),t.formatArgs.call(r,e);(r.log||t.log).apply(r,e)}return a.namespace=e,a.useColors=t.useColors(),a.color=t.selectColor(e),a.extend=r,a.destroy=t.destroy,Object.defineProperty(a,"enabled",{enumerable:!0,configurable:!1,get:()=>null!==s?s:(o!==t.namespaces&&(o=t.namespaces,i=t.enabled(e)),i),set:e=>{s=e}}),"function"==typeof t.init&&t.init(a),a}function r(e,r){const n=t(this.namespace+(void 0===r?":":r)+e);return n.log=this.log,n}function n(e){return e.toString().substring(2,e.toString().length-2).replace(/\.\*\?$/,"*")}return t.debug=t,t.default=t,t.coerce=function(e){if(e instanceof Error)return e.stack||e.message;return e},t.disable=function(){const e=[...t.names.map(n),...t.skips.map(n).map((e=>"-"+e))].join(",");return t.enable(""),e},t.enable=function(e){let r;t.save(e),t.namespaces=e,t.names=[],t.skips=[];const n=("string"==typeof e?e:"").split(/[\s,]+/),o=n.length;for(r=0;r<o;r++)n[r]&&("-"===(e=n[r].replace(/\*/g,".*?"))[0]?t.skips.push(new RegExp("^"+e.slice(1)+"$")):t.names.push(new RegExp("^"+e+"$")))},t.enabled=function(e){if("*"===e[e.length-1])return!0;let r,n;for(r=0,n=t.skips.length;r<n;r++)if(t.skips[r].test(e))return!1;for(r=0,n=t.names.length;r<n;r++)if(t.names[r].test(e))return!0;return!1},t.humanize=zt(),t.destroy=function(){console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.")},Object.keys(e).forEach((r=>{t[r]=e[r]})),t.names=[],t.skips=[],t.formatters={},t.selectColor=function(e){let r=0;for(let t=0;t<e.length;t++)r=(r<<5)-r+e.charCodeAt(t),r|=0;return t.colors[Math.abs(r)%t.colors.length]},t.enable(t.load()),t},Pt}var Kt,Vt,Qt,Wt,Yt,Jt,Xt={exports:{}};function Zt(){if(Wt)return Qt;Wt=1;const e=y.default,t=b.default,r=Vt?Kt:(Vt=1,Kt=(e,t=process.argv)=>{const r=e.startsWith("-")?"":1===e.length?"-":"--",n=t.indexOf(r+e),o=t.indexOf("--");return-1!==n&&(-1===o||n<o)}),{env:n}=process;let o;function i(e){return 0!==e&&{level:e,hasBasic:!0,has256:e>=2,has16m:e>=3}}function s(t,i){if(0===o)return 0;if(r("color=16m")||r("color=full")||r("color=truecolor"))return 3;if(r("color=256"))return 2;if(t&&!i&&void 0===o)return 0;const s=o||0;if("dumb"===n.TERM)return s;if("win32"===process.platform){const t=e.release().split(".");return Number(t[0])>=10&&Number(t[2])>=10586?Number(t[2])>=14931?3:2:1}if("CI"in n)return["TRAVIS","CIRCLECI","APPVEYOR","GITLAB_CI","GITHUB_ACTIONS","BUILDKITE"].some((e=>e in n))||"codeship"===n.CI_NAME?1:s;if("TEAMCITY_VERSION"in n)return/^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.test(n.TEAMCITY_VERSION)?1:0;if("truecolor"===n.COLORTERM)return 3;if("TERM_PROGRAM"in n){const e=parseInt((n.TERM_PROGRAM_VERSION||"").split(".")[0],10);switch(n.TERM_PROGRAM){case"iTerm.app":return e>=3?3:2;case"Apple_Terminal":return 2}}return/-256(color)?$/i.test(n.TERM)?2:/^screen|^xterm|^vt100|^vt220|^rxvt|color|ansi|cygwin|linux/i.test(n.TERM)||"COLORTERM"in n?1:s}return r("no-color")||r("no-colors")||r("color=false")||r("color=never")?o=0:(r("color")||r("colors")||r("color=true")||r("color=always"))&&(o=1),"FORCE_COLOR"in n&&(o="true"===n.FORCE_COLOR?1:"false"===n.FORCE_COLOR?0:0===n.FORCE_COLOR.length?1:Math.min(parseInt(n.FORCE_COLOR,10),3)),Qt={supportsColor:function(e){return i(s(e,e&&e.isTTY))},stdout:i(s(!0,t.isatty(1))),stderr:i(s(!0,t.isatty(2)))}}function er(){return Yt||(Yt=1,function(e,t){const r=b.default,n=v.default;t.init=function(e){e.inspectOpts={};const r=Object.keys(t.inspectOpts);for(let n=0;n<r.length;n++)e.inspectOpts[r[n]]=t.inspectOpts[r[n]]},t.log=function(...e){return process.stderr.write(n.format(...e)+"\n")},t.formatArgs=function(r){const{namespace:n,useColors:o}=this;if(o){const t=this.color,o="[3"+(t<8?t:"8;5;"+t),i=` ${o};1m${n} `;r[0]=i+r[0].split("\n").join("\n"+i),r.push(o+"m+"+e.exports.humanize(this.diff)+"")}else r[0]=function(){if(t.inspectOpts.hideDate)return"";return(new Date).toISOString()+" "}()+n+" "+r[0]},t.save=function(e){e?process.env.DEBUG=e:delete process.env.DEBUG},t.load=function(){return process.env.DEBUG},t.useColors=function(){return"colors"in t.inspectOpts?Boolean(t.inspectOpts.colors):r.isatty(process.stderr.fd)},t.destroy=n.deprecate((()=>{}),"Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`."),t.colors=[6,2,3,4,5,1];try{const e=Zt();e&&(e.stderr||e).level>=2&&(t.colors=[20,21,26,27,32,33,38,39,40,41,42,43,44,45,56,57,62,63,68,69,74,75,76,77,78,79,80,81,92,93,98,99,112,113,128,129,134,135,148,149,160,161,162,163,164,165,166,167,168,169,170,171,172,173,178,179,184,185,196,197,198,199,200,201,202,203,204,205,206,207,208,209,214,215,220,221])}catch(e){}t.inspectOpts=Object.keys(process.env).filter((e=>/^debug_/i.test(e))).reduce(((e,t)=>{const r=t.substring(6).toLowerCase().replace(/_([a-z])/g,((e,t)=>t.toUpperCase()));let n=process.env[t];return n=!!/^(yes|on|true|enabled)$/i.test(n)||!/^(no|off|false|disabled)$/i.test(n)&&("null"===n?null:Number(n)),e[r]=n,e}),{}),e.exports=Gt()(t);const{formatters:o}=e.exports;o.o=function(e){return this.inspectOpts.colors=this.useColors,n.inspect(e,this.inspectOpts).split("\n").map((e=>e.trim())).join(" ")},o.O=function(e){return this.inspectOpts.colors=this.useColors,n.inspect(e,this.inspectOpts)}}(Xt,Xt.exports)),Xt.exports}Jt=$t,"undefined"==typeof process||"renderer"===process.type||!0===process.browser||process.__nwjs?Jt.exports=(Dt||(Dt=1,function(e,t){t.formatArgs=function(t){if(t[0]=(this.useColors?"%c":"")+this.namespace+(this.useColors?" %c":" ")+t[0]+(this.useColors?"%c ":" ")+"+"+e.exports.humanize(this.diff),!this.useColors)return;const r="color: "+this.color;t.splice(1,0,r,"color: inherit");let n=0,o=0;t[0].replace(/%[a-zA-Z%]/g,(e=>{"%%"!==e&&(n++,"%c"===e&&(o=n))})),t.splice(o,0,r)},t.save=function(e){try{e?t.storage.setItem("debug",e):t.storage.removeItem("debug")}catch(e){}},t.load=function(){let e;try{e=t.storage.getItem("debug")}catch(e){}return!e&&"undefined"!=typeof process&&"env"in process&&(e=process.env.DEBUG),e},t.useColors=function(){return!("undefined"==typeof window||!window.process||"renderer"!==window.process.type&&!window.process.__nwjs)||("undefined"==typeof navigator||!navigator.userAgent||!navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/))&&("undefined"!=typeof document&&document.documentElement&&document.documentElement.style&&document.documentElement.style.WebkitAppearance||"undefined"!=typeof window&&window.console&&(window.console.firebug||window.console.exception&&window.console.table)||"undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/)&&parseInt(RegExp.$1,10)>=31||"undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/))},t.storage=function(){try{return localStorage}catch(e){}}(),t.destroy=(()=>{let e=!1;return()=>{e||(e=!0,console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`."))}})(),t.colors=["#0000CC","#0000FF","#0033CC","#0033FF","#0066CC","#0066FF","#0099CC","#0099FF","#00CC00","#00CC33","#00CC66","#00CC99","#00CCCC","#00CCFF","#3300CC","#3300FF","#3333CC","#3333FF","#3366CC","#3366FF","#3399CC","#3399FF","#33CC00","#33CC33","#33CC66","#33CC99","#33CCCC","#33CCFF","#6600CC","#6600FF","#6633CC","#6633FF","#66CC00","#66CC33","#9900CC","#9900FF","#9933CC","#9933FF","#99CC00","#99CC33","#CC0000","#CC0033","#CC0066","#CC0099","#CC00CC","#CC00FF","#CC3300","#CC3333","#CC3366","#CC3399","#CC33CC","#CC33FF","#CC6600","#CC6633","#CC9900","#CC9933","#CCCC00","#CCCC33","#FF0000","#FF0033","#FF0066","#FF0099","#FF00CC","#FF00FF","#FF3300","#FF3333","#FF3366","#FF3399","#FF33CC","#FF33FF","#FF6600","#FF6633","#FF9900","#FF9933","#FFCC00","#FFCC33"],t.log=console.debug||console.log||(()=>{}),e.exports=Gt()(t);const{formatters:r}=e.exports;r.j=function(e){try{return JSON.stringify(e)}catch(e){return"[UnexpectedJSONParseError]: "+e.message}}}(Ht,Ht.exports)),Ht.exports):Jt.exports=er();var tr=re.exports,rr=$t.exports("bitsyntax-Interpreter");function nr(e,t,r,n,o){switch(r){case 1:return o?e.readInt8(t):e.readUInt8(t);case 2:return n?o?e.readInt16BE(t):e.readUInt16BE(t):o?e.readInt16LE(t):e.readUInt16LE(t);case 4:return n?o?e.readInt32BE(t):e.readUInt32BE(t):o?e.readInt32LE(t):e.readUInt32LE(t);case 8:return n?(o?tr.readInt64BE:tr.readUInt64BE)(e,t):(o?tr.readInt64LE:tr.readUInt64LE)(e,t);default:throw"Integers must be 8-, 16-, 32- or 64-bit"}}function or(e,t,r,n){switch(r){case 4:return n?e.readFloatBE(t):e.readFloatLE(t);case 8:return n?e.readDoubleBE(t):e.readDoubleLE(t);default:throw"Floats must be 32- or 64-bit"}}function ir(e,t){var r=e.size;return"string"==typeof r?t[r]:r}qt.match=function(e,t,r){var n=0,o=function(e){function t(){}return t.prototype=e,new t}(r),i=8*t.length;function s(e){rr("skip bits"),rr(e);var t=ir(e,o);if(!0===t)return n%8==0&&(n=i,!0);var r=e.unit*t;if(n+r>i)return!1;n+=r}function a(e){rr("get_integer"),rr(e);var r=e.unit,s=ir(e,o)*r,a=n/8;return n+=s,!(s%8>0||n>i)&&nr(t,a,s/8,e.bigendian,e.signed)}function u(e){rr("get_float"),rr(e);var r=e.unit,s=ir(e,o)*r,a=n/8;return!((n+=s)>i)&&or(t,a,s/8,e.bigendian)}function c(e){rr("get_binary"),rr(e);var r=e.unit,s=ir(e,o),a=n/8;if(!0===s)return n=i,t.slice(a);var u=s*r;return!(u%8>0||n+u>i)&&(n+=u,t.slice(a,a+u/8))}function l(e){rr("get_string"),rr(e);var r=e.value.length,o=n/8;return!((n+=8*r)>i)&&t.slice(o,o+r).toString("utf8")}for(var f=e.length,h=0;h<f;h++){var d=e[h],p=!1;if("_"===d.name)p=s(d);else{switch(d.type){case"string":p=l(d);break;case"integer":p=a(d);break;case"float":p=u(d);break;case"binary":p=c(d)}if(!1===p)return!1;if(d.name)o[d.name]=p;else if(d.value!=p)return!1}}return n==i&&function(e){var t={};for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r]);return t}(o)},qt.parse_int=nr,qt.parse_float=or;var sr={},ar={exports:{}};!function(e,t){var r=w.default,n=r.Buffer;function o(e,t){for(var r in e)t[r]=e[r]}function i(e,t,r){return n(e,t,r)}n.from&&n.alloc&&n.allocUnsafe&&n.allocUnsafeSlow?e.exports=r:(o(r,t),t.Buffer=i),o(n,i),i.from=function(e,t,r){if("number"==typeof e)throw new TypeError("Argument must not be a number");return n(e,t,r)},i.alloc=function(e,t,r){if("number"!=typeof e)throw new TypeError("Argument must be a number");var o=n(e);return void 0!==t?"string"==typeof r?o.fill(t,r):o.fill(t):o.fill(0),o},i.allocUnsafe=function(e){if("number"!=typeof e)throw new TypeError("Argument must be a number");return n(e)},i.allocUnsafeSlow=function(e){if("number"!=typeof e)throw new TypeError("Argument must be a number");return r.SlowBuffer(e)}}(ar,ar.exports);var ur=re.exports,cr=ar.exports.Buffer;function lr(e,t,r,n){for(var o=0,i=r.length;o<i;o++){var s=r[o];switch(s.type){case"string":t+=e.write(s.value,t,"utf8");break;case"binary":t+=dr(s,e,t,n);break;case"integer":t+=pr(s,e,t,n);break;case"float":t+=mr(s,e,t,n)}}return t}function fr(e,t){var r=function(e,t){for(var r=0,n=0,o=e.length;n<o;n++)r+=hr(e[n],t);return r}(e,t),n=cr.alloc(r);return lr(n,0,e,t),n}function hr(e,t){return"string"==typeof e.size?t[e.size]*e.unit/8:"string"===e.type?cr.byteLength(e.value,"utf8"):"binary"===e.type&&!0===e.size?t[e.name].length:e.size*e.unit/8}function dr(e,t,r,n){var o=n[e.name],i=hr(e,n);return o.copy(t,r,0,i),i}function pr(e,t,r,n){return gr(t,e.name?n[e.name]:e.value,r,hr(e,n),e.bigendian)}function gr(e,t,r,n,o){switch(n){case 1:e.writeUInt8(t,r);break;case 2:o?e.writeUInt16BE(t,r):e.writeUInt16LE(t,r);break;case 4:o?e.writeUInt32BE(t,r):e.writeUInt32LE(t,r);break;case 8:o?ur.writeUInt64BE(e,t,r):ur.writeUInt64LE(e,t,r);break;default:throw new Error("integer size * unit must be 8, 16, 32 or 64")}return n}function mr(e,t,r,n){return br(t,e.name?n[e.name]:e.value,r,hr(e,n),e.bigendian)}function br(e,t,r,n,o){if(4===n)o?e.writeFloatBE(t,r):e.writeFloatLE(t,r);else{if(8!==n)throw new Error("float size * unit must be 32 or 64");o?e.writeDoubleBE(t,r):e.writeDoubleLE(t,r)}return n}var vr=xt.parse;sr.write=lr,sr.build=fr,sr.write_int=gr,sr.write_float=br,sr.builder=function(e){e=arguments.length>1?[].join.call(arguments,","):e;var t=vr(e);return function(e){return fr(t,e)}};var yr={},wr=v.default.format,Er=xt.parse,Ir=qt,Cr=Ir.parse_int,xr=Ir.parse_float,Br=sr,Tr=Br.write_int,kr=Br.write_float,Or=ar.exports.Buffer,Sr=[];function Ur(){Sr=[]}function _r(){Sr.push(wr.apply(null,arguments))}function Nr(){return Sr.join("\n")}function Ar(e){return"string"==typeof e.size?wr("%s * %d",Mr(e.size),e.unit):(e.size*e.unit).toString()}function Rr(e){if("_"===e.name)!function(e){if("string"==typeof e.size)_r("var skipbits = %s * %d;",Mr(e.size),e.unit),_r("if (offset + skipbits > binsize) { return false; }"),_r("else { offset += skipbits; }");else if(!0===e.size)_r("if (offset % 8 === 0) { offset = binsize; }"),_r("else { return false; }");else{var t=e.unit*e.size;_r("if (offset + %d > binsize) { return false; }",t),_r("else { offset += %d; }",t)}}(e);else{switch(e.type){case"integer":case"float":!function(e){_r("bits = %s;\n",Ar(e));var t="integer"===e.type?"parse_int":"parse_float",r=e.bigendian,n=e.signed;_r("byteoffset = offset / 8; offset += bits"),_r("if (offset > binsize) { return false; }"),_r("else { result = %s(bin, byteoffset, bits / 8, %s, %s); }",t,r,n)}(e);break;case"binary":!function(e){_r("byteoffset = offset / 8;"),!0===e.size?(_r("offset = binsize;"),_r("result = bin.slice(byteoffset);")):(_r("bits = %s;",Ar(e)),_r("offset += bits;"),_r("if (offset > binsize) { return false; }"),_r("else { result = bin.slice(byteoffset,","byteoffset + bits / 8); }"))}(e);break;case"string":!function(e){_r("byteoffset = offset / 8;");var t=e.value.length;_r("offset += %d;",8*t),_r("if (offset > binsize) { return false; }"),_r("else { result = bin.toString(byteoffset,",wr("byteoffset + %d); }",t))}(e)}if(_r("if (result === false) return false;"),e.name)_r("else if (%s !== undefined) {",Mr(e.name)),_r("if (%s != result) return false;",Mr(e.name)),_r("}"),_r("else %s = result;",Mr(e.name));else _r("else if (result != %s) return false;",JSON.stringify(e.value))}}function Mr(e){return"var_"+e}function Lr(e){Ur(),_r("return function(binary, env) {"),_r("'use strict';"),_r("var bin = binary, env = env || {};"),_r("var offset = 0, binsize = bin.length * 8;"),_r("var bits, result, byteoffset;");for(var t=function(e){for(var t={},r=0;r<e.length;r++){var n=e[r].name;n&&"_"!==n&&(t[n]=!0),"string"==typeof(n=e[r].size)&&(t[n]=!0)}return Object.keys(t)}(e),r=0;r<t.length;r++){_r("var %s = env['%s'];",Mr(s=t[r]),s)}for(var n=e.length,o=0;o<n;o++){var i=e[o];_r("// "+JSON.stringify(i)),Rr(i)}_r("if (offset == binsize) {"),_r("return {");for(r=0;r<t.length;r++){var s;_r("%s: %s,",s=t[r],Mr(s))}return _r("};"),_r("}"),_r("else return false;"),_r("}"),new Function("parse_int","parse_float",Nr())(Cr,xr)}function Fr(e){switch(e.type){case"string":_r("offset += buf.write(%s, offset, 'utf8');",JSON.stringify(e.value));break;case"binary":_r("val = bindings['%s'];",e.name),!0===e.size?_r("size = val.length;"):"string"==typeof e.size?_r("size = (bindings['%s'] * %d) / 8;",e.size,e.unit):_r("size = %d;",e.size*e.unit/8),_r("val.copy(buf, offset, 0, size);"),_r("offset += size;");break;case"integer":case"float":!function(e){e.name?_r("val = bindings['%s'];",e.name):_r("val = %d",e.value);var t="integer"===e.type?"write_int":"write_float";"string"==typeof e.size?_r("size = (bindings['%s'] * %d) / 8;",e.size,e.unit):_r("size = %d;",e.size*e.unit/8);_r("%s(buf, val, offset, size, %s);",t,e.bigendian),_r("offset += size;")}(e)}}function Pr(e){return Ur(),_r("return function(bindings) {"),_r("'use strict';"),function(e){for(var t=[],r=0,n=0;n<e.length;n++)"string"==typeof(i=e[n]).size||!0===i.size?t.push(i):"string"===i.type?r+=Or.byteLength(i.value):r+=i.size*i.unit/8;if(_r("var buffersize = %d;",r),t.length>0)for(var o=0;o<t.length;o++){var i;!0===(i=t[o]).size?_r("buffersize += bindings['%s'].length;",i.name):_r("buffersize += (bindings['%s'] * %d) / 8;",i.size,i.unit)}}(e),_r("var buf = Buffer.alloc(buffersize);"),_r("var offset = 0;"),function(e){_r("var val, size;");for(var t=e.length,r=0;r<t;r++){var n=e[r];_r("// %s",JSON.stringify(n)),Fr(n)}}(e),_r("return buf;"),_r("}"),new Function("write_int","write_float","Buffer",Nr())(Tr,kr,Or)}yr.compile_pattern=Lr,yr.compile=function(){var e=[].join.call(arguments,","),t=Er(e);return Lr(t)},yr.compile_builder=function(){var e=[].join.call(arguments,","),t=Er(e);return Pr(t)},Ct.parse=xt.parse,Ct.match=qt.match,Ct.build=sr.build,Ct.write=sr.write,Ct.matcher=Ct.compile=yr.compile,Ct.builder=yr.compile_builder;var jr=ee,Dr=jr.constants,qr=jr.decode,$r=Ct;It.PROTOCOL_HEADER="AMQP"+String.fromCharCode(0,0,9,1);var Hr=Dr.FRAME_METHOD,zr=Dr.FRAME_HEARTBEAT,Gr=Dr.FRAME_HEADER,Kr=Dr.FRAME_BODY,Vr=Dr.FRAME_END,Qr=$r.builder(Kr,"channel:16, size:32, payload:size/binary",Vr);It.makeBodyFrame=function(e,t){return Qr({channel:e,size:t.length,payload:t})};var Wr=$r.matcher("type:8","channel:16","size:32","rest/binary");It.parseFrame=function(e,t){var r=Wr(e);if(r){var n=r.size,o=r.rest;if(n>t)throw new Error("Frame size exceeds frame max");if(o.length>n){if(o[n]!==Vr)throw new Error("Invalid frame");return{type:r.type,channel:r.channel,size:n,payload:o.slice(0,n),rest:o.slice(n+1)}}}return!1};var Yr=$r.matcher("class:16","_weight:16","size:64","flagsAndfields/binary"),Jr=$r.matcher("id:32, args/binary"),Xr={channel:0};It.decodeFrame=function(e){var t=e.payload;switch(e.type){case Hr:var r=Jr(t),n=r.id,o=qr(n,r.args);return{id:n,channel:e.channel,fields:o};case Gr:var i=Yr(t);n=i.class,o=qr(n,i.flagsAndfields);return{id:n,channel:e.channel,size:i.size,fields:o};case Kr:return{channel:e.channel,content:e.payload};case zr:return Xr;default:throw new Error("Unknown frame type "+e.type)}},It.HEARTBEAT_BUF=Buffer.from([Dr.FRAME_HEARTBEAT,0,0,0,0,0,0,Dr.FRAME_END]),It.HEARTBEAT=Xr;var Zr={},en=E.default,tn="function"==typeof setImmediate?setImmediate:process.nextTick;function rn(e){this.newStreams=[],this.oldStreams=[],this.blocked=!1,this.scheduledRead=!1,this.out=e;var t=this;e.on("drain",(function(){t.blocked=!1,t._readIncoming()}))}rn.prototype._readIncoming=function(){if(!this.blocked){var e=!0,t=this.out;r(this.newStreams),e?(en.equal(0,this.newStreams.length),r(this.oldStreams)):(en(this.newStreams.length>0,"Expect some new streams to remain"),Array.prototype.push.apply(this.oldStreams,this.newStreams),this.newStreams=[]),this.blocked=!e}function r(r){for(var n;e&&(n=r.shift());){var o=n.read();null!==o&&(e=t.write(o),r.push(n))}}},rn.prototype._scheduleRead=function(){var e=this;e.scheduledRead||(tn((function(){e.scheduledRead=!1,e._readIncoming()})),e.scheduledRead=!0)},rn.prototype.pipeFrom=function(e){var t=this;function r(){t.newStreams.push(e),t._scheduleRead()}function n(){e.removeListener("readable",r),e.removeListener("error",n),e.removeListener("end",n),e.removeListener("unpipeFrom",o)}function o(e){e===t&&n()}e.on("unpipeFrom",o),e.on("end",n),e.on("error",n),e.on("readable",r)},rn.prototype.unpipeFrom=function(e){e.emit("unpipeFrom",this)},Zr.Mux=rn;var nn,on={exports:{}},sn={};function an(){if(nn)return sn;function e(e){return Object.prototype.toString.call(e)}return nn=1,sn.isArray=function(t){return Array.isArray?Array.isArray(t):"[object Array]"===e(t)},sn.isBoolean=function(e){return"boolean"==typeof e},sn.isNull=function(e){return null===e},sn.isNullOrUndefined=function(e){return null==e},sn.isNumber=function(e){return"number"==typeof e},sn.isString=function(e){return"string"==typeof e},sn.isSymbol=function(e){return"symbol"==typeof e},sn.isUndefined=function(e){return void 0===e},sn.isRegExp=function(t){return"[object RegExp]"===e(t)},sn.isObject=function(e){return"object"==typeof e&&null!==e},sn.isDate=function(t){return"[object Date]"===e(t)},sn.isError=function(t){return"[object Error]"===e(t)||t instanceof Error},sn.isFunction=function(e){return"function"==typeof e},sn.isPrimitive=function(e){return null===e||"boolean"==typeof e||"number"==typeof e||"string"==typeof e||"symbol"==typeof e||void 0===e},sn.isBuffer=w.default.Buffer.isBuffer,sn}var un,cn,ln,fn,hn,dn,pn,gn,mn,bn,vn,yn={exports:{}},wn={exports:{}};function En(){return cn||(cn=1,function(e){try{var t=require("util");if("function"!=typeof t.inherits)throw"";e.exports=t.inherits}catch(t){e.exports=(un||(un=1,"function"==typeof Object.create?wn.exports=function(e,t){e.super_=t,e.prototype=Object.create(t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}})}:wn.exports=function(e,t){e.super_=t;var r=function(){};r.prototype=t.prototype,e.prototype=new r,e.prototype.constructor=e}),wn.exports)}}(yn)),yn.exports}function In(){if(dn)return hn;dn=1,hn=u;var e=fn?ln:(fn=1,ln=Array.isArray||function(e){return"[object Array]"==Object.prototype.toString.call(e)}),t=w.default.Buffer;u.ReadableState=a;var r=C.default.EventEmitter;r.listenerCount||(r.listenerCount=function(e,t){return e.listeners(t).length});var n,o=I.default,i=an();i.inherits=En();var s=v.default;function a(e,t){var r=xn(),o=(e=e||{}).highWaterMark,i=e.objectMode?16:16384;this.highWaterMark=o||0===o?o:i,this.highWaterMark=~~this.highWaterMark,this.buffer=[],this.length=0,this.pipes=null,this.pipesCount=0,this.flowing=null,this.ended=!1,this.endEmitted=!1,this.reading=!1,this.sync=!0,this.needReadable=!1,this.emittedReadable=!1,this.readableListening=!1,this.objectMode=!!e.objectMode,t instanceof r&&(this.objectMode=this.objectMode||!!e.readableObjectMode),this.defaultEncoding=e.defaultEncoding||"utf8",this.ranOut=!1,this.awaitDrain=0,this.readingMore=!1,this.decoder=null,this.encoding=null,e.encoding&&(n||(n=x.default.StringDecoder),this.decoder=new n(e.encoding),this.encoding=e.encoding)}function u(e){if(xn(),!(this instanceof u))return new u(e);this._readableState=new a(e,this),this.readable=!0,o.call(this)}function c(e,t,r,n,o){var a=function(e,t){var r=null;i.isBuffer(t)||i.isString(t)||i.isNullOrUndefined(t)||e.objectMode||(r=new TypeError("Invalid non-string/buffer chunk"));return r}(t,r);if(a)e.emit("error",a);else if(i.isNullOrUndefined(r))t.reading=!1,t.ended||function(e,t){if(t.decoder&&!t.ended){var r=t.decoder.end();r&&r.length&&(t.buffer.push(r),t.length+=t.objectMode?1:r.length)}t.ended=!0,h(e)}(e,t);else if(t.objectMode||r&&r.length>0)if(t.ended&&!o){var u=new Error("stream.push() after EOF");e.emit("error",u)}else if(t.endEmitted&&o){u=new Error("stream.unshift() after end event");e.emit("error",u)}else!t.decoder||o||n||(r=t.decoder.write(r)),o||(t.reading=!1),t.flowing&&0===t.length&&!t.sync?(e.emit("data",r),e.read(0)):(t.length+=t.objectMode?1:r.length,o?t.buffer.unshift(r):t.buffer.push(r),t.needReadable&&h(e)),function(e,t){t.readingMore||(t.readingMore=!0,process.nextTick((function(){!function(e,t){var r=t.length;for(;!t.reading&&!t.flowing&&!t.ended&&t.length<t.highWaterMark&&(s("maybeReadMore read 0"),e.read(0),r!==t.length);)r=t.length;t.readingMore=!1}(e,t)})))}(e,t);else o||(t.reading=!1);return function(e){return!e.ended&&(e.needReadable||e.length<e.highWaterMark||0===e.length)}(t)}s=s&&s.debuglog?s.debuglog("stream"):function(){},i.inherits(u,o),u.prototype.push=function(e,r){var n=this._readableState;return i.isString(e)&&!n.objectMode&&(r=r||n.defaultEncoding)!==n.encoding&&(e=new t(e,r),r=""),c(this,n,e,r,!1)},u.prototype.unshift=function(e){return c(this,this._readableState,e,"",!0)},u.prototype.setEncoding=function(e){return n||(n=x.default.StringDecoder),this._readableState.decoder=new n(e),this._readableState.encoding=e,this};var l=8388608;function f(e,t){return 0===t.length&&t.ended?0:t.objectMode?0===e?0:1:isNaN(e)||i.isNull(e)?t.flowing&&t.buffer.length?t.buffer[0].length:t.length:e<=0?0:(e>t.highWaterMark&&(t.highWaterMark=function(e){if(e>=l)e=l;else{e--;for(var t=1;t<32;t<<=1)e|=e>>t;e++}return e}(e)),e>t.length?t.ended?t.length:(t.needReadable=!0,0):e)}function h(e){var t=e._readableState;t.needReadable=!1,t.emittedReadable||(s("emitReadable",t.flowing),t.emittedReadable=!0,t.sync?process.nextTick((function(){d(e)})):d(e))}function d(e){s("emit readable"),e.emit("readable"),p(e)}function p(e){var t=e._readableState;if(s("flow",t.flowing),t.flowing)do{var r=e.read()}while(null!==r&&t.flowing)}function g(e,r){var n,o=r.buffer,i=r.length,s=!!r.decoder,a=!!r.objectMode;if(0===o.length)return null;if(0===i)n=null;else if(a)n=o.shift();else if(!e||e>=i)n=s?o.join(""):t.concat(o,i),o.length=0;else{if(e<o[0].length)n=(f=o[0]).slice(0,e),o[0]=f.slice(e);else if(e===o[0].length)n=o.shift();else{n=s?"":new t(e);for(var u=0,c=0,l=o.length;c<l&&u<e;c++){var f=o[0],h=Math.min(e-u,f.length);s?n+=f.slice(0,h):f.copy(n,u,0,h),h<f.length?o[0]=f.slice(h):o.shift(),u+=h}}}return n}function m(e){var t=e._readableState;if(t.length>0)throw new Error("endReadable called on non-empty stream");t.endEmitted||(t.ended=!0,process.nextTick((function(){t.endEmitted||0!==t.length||(t.endEmitted=!0,e.readable=!1,e.emit("end"))})))}return u.prototype.read=function(e){s("read",e);var t=this._readableState,r=e;if((!i.isNumber(e)||e>0)&&(t.emittedReadable=!1),0===e&&t.needReadable&&(t.length>=t.highWaterMark||t.ended))return s("read: emitReadable",t.length,t.ended),0===t.length&&t.ended?m(this):h(this),null;if(0===(e=f(e,t))&&t.ended)return 0===t.length&&m(this),null;var n,o=t.needReadable;return s("need readable",o),(0===t.length||t.length-e<t.highWaterMark)&&s("length less than watermark",o=!0),(t.ended||t.reading)&&s("reading or ended",o=!1),o&&(s("do read"),t.reading=!0,t.sync=!0,0===t.length&&(t.needReadable=!0),this._read(t.highWaterMark),t.sync=!1),o&&!t.reading&&(e=f(r,t)),n=e>0?g(e,t):null,i.isNull(n)&&(t.needReadable=!0,e=0),t.length-=e,0!==t.length||t.ended||(t.needReadable=!0),r!==e&&t.ended&&0===t.length&&m(this),i.isNull(n)||this.emit("data",n),n},u.prototype._read=function(e){this.emit("error",new Error("not implemented"))},u.prototype.pipe=function(t,n){var o=this,i=this._readableState;switch(i.pipesCount){case 0:i.pipes=t;break;case 1:i.pipes=[i.pipes,t];break;default:i.pipes.push(t)}i.pipesCount+=1,s("pipe count=%d opts=%j",i.pipesCount,n);var a=(!n||!1!==n.end)&&t!==process.stdout&&t!==process.stderr?c:f;function u(e){s("onunpipe"),e===o&&f()}function c(){s("onend"),t.end()}i.endEmitted?process.nextTick(a):o.once("end",a),t.on("unpipe",u);var l=function(e){return function(){var t=e._readableState;s("pipeOnDrain",t.awaitDrain),t.awaitDrain&&t.awaitDrain--,0===t.awaitDrain&&r.listenerCount(e,"data")&&(t.flowing=!0,p(e))}}(o);function f(){s("cleanup"),t.removeListener("close",g),t.removeListener("finish",m),t.removeListener("drain",l),t.removeListener("error",d),t.removeListener("unpipe",u),o.removeListener("end",c),o.removeListener("end",f),o.removeListener("data",h),!i.awaitDrain||t._writableState&&!t._writableState.needDrain||l()}function h(e){s("ondata"),!1===t.write(e)&&(s("false write response, pause",o._readableState.awaitDrain),o._readableState.awaitDrain++,o.pause())}function d(e){s("onerror",e),b(),t.removeListener("error",d),0===r.listenerCount(t,"error")&&t.emit("error",e)}function g(){t.removeListener("finish",m),b()}function m(){s("onfinish"),t.removeListener("close",g),b()}function b(){s("unpipe"),o.unpipe(t)}return t.on("drain",l),o.on("data",h),t._events&&t._events.error?e(t._events.error)?t._events.error.unshift(d):t._events.error=[d,t._events.error]:t.on("error",d),t.once("close",g),t.once("finish",m),t.emit("pipe",o),i.flowing||(s("pipe resume"),o.resume()),t},u.prototype.unpipe=function(e){var t=this._readableState;if(0===t.pipesCount)return this;if(1===t.pipesCount)return e&&e!==t.pipes||(e||(e=t.pipes),t.pipes=null,t.pipesCount=0,t.flowing=!1,e&&e.emit("unpipe",this)),this;if(!e){var r=t.pipes,n=t.pipesCount;t.pipes=null,t.pipesCount=0,t.flowing=!1;for(var o=0;o<n;o++)r[o].emit("unpipe",this);return this}o=function(e,t){for(var r=0,n=e.length;r<n;r++)if(e[r]===t)return r;return-1}(t.pipes,e);return-1===o||(t.pipes.splice(o,1),t.pipesCount-=1,1===t.pipesCount&&(t.pipes=t.pipes[0]),e.emit("unpipe",this)),this},u.prototype.on=function(e,t){var r=o.prototype.on.call(this,e,t);if("data"===e&&!1!==this._readableState.flowing&&this.resume(),"readable"===e&&this.readable){var n=this._readableState;if(!n.readableListening)if(n.readableListening=!0,n.emittedReadable=!1,n.needReadable=!0,n.reading)n.length&&h(this);else{var i=this;process.nextTick((function(){s("readable nexttick read 0"),i.read(0)}))}}return r},u.prototype.addListener=u.prototype.on,u.prototype.resume=function(){var e=this._readableState;return e.flowing||(s("resume"),e.flowing=!0,e.reading||(s("resume read 0"),this.read(0)),function(e,t){t.resumeScheduled||(t.resumeScheduled=!0,process.nextTick((function(){!function(e,t){t.resumeScheduled=!1,e.emit("resume"),p(e),t.flowing&&!t.reading&&e.read(0)}(e,t)})))}(this,e)),this},u.prototype.pause=function(){return s("call pause flowing=%j",this._readableState.flowing),!1!==this._readableState.flowing&&(s("pause"),this._readableState.flowing=!1,this.emit("pause")),this},u.prototype.wrap=function(e){var t=this._readableState,r=!1,n=this;for(var o in e.on("end",(function(){if(s("wrapped end"),t.decoder&&!t.ended){var e=t.decoder.end();e&&e.length&&n.push(e)}n.push(null)})),e.on("data",(function(o){(s("wrapped data"),t.decoder&&(o=t.decoder.write(o)),o&&(t.objectMode||o.length))&&(n.push(o)||(r=!0,e.pause()))})),e)i.isFunction(e[o])&&i.isUndefined(this[o])&&(this[o]=function(t){return function(){return e[t].apply(e,arguments)}}(o));return function(e,t){for(var r=0,n=e.length;r<n;r++)t(e[r],r)}(["error","close","destroy","pause","resume"],(function(t){e.on(t,n.emit.bind(n,t))})),n._read=function(t){s("wrapped _read",t),r&&(r=!1,e.resume())},n},u._fromList=g,hn}function Cn(){if(gn)return pn;gn=1,pn=i;var e=w.default.Buffer;i.WritableState=o;var t=an();t.inherits=En();var r=I.default;function n(e,t,r){this.chunk=e,this.encoding=t,this.callback=r}function o(e,t){var r=xn(),n=(e=e||{}).highWaterMark,o=e.objectMode?16:16384;this.highWaterMark=n||0===n?n:o,this.objectMode=!!e.objectMode,t instanceof r&&(this.objectMode=this.objectMode||!!e.writableObjectMode),this.highWaterMark=~~this.highWaterMark,this.needDrain=!1,this.ending=!1,this.ended=!1,this.finished=!1;var i=!1===e.decodeStrings;this.decodeStrings=!i,this.defaultEncoding=e.defaultEncoding||"utf8",this.length=0,this.writing=!1,this.corked=0,this.sync=!0,this.bufferProcessing=!1,this.onwrite=function(e){!function(e,t){var r=e._writableState,n=r.sync,o=r.writecb;if(function(e){e.writing=!1,e.writecb=null,e.length-=e.writelen,e.writelen=0}(r),t)!function(e,t,r,n,o){r?process.nextTick((function(){t.pendingcb--,o(n)})):(t.pendingcb--,o(n));e._writableState.errorEmitted=!0,e.emit("error",n)}(e,r,n,t,o);else{var i=c(e,r);i||r.corked||r.bufferProcessing||!r.buffer.length||u(e,r),n?process.nextTick((function(){a(e,r,i,o)})):a(e,r,i,o)}}(t,e)},this.writecb=null,this.writelen=0,this.buffer=[],this.pendingcb=0,this.prefinished=!1,this.errorEmitted=!1}function i(e){var t=xn();if(!(this instanceof i||this instanceof t))return new i(e);this._writableState=new o(e,this),this.writable=!0,r.call(this)}function s(e,t,r,n,o,i,s){t.writelen=n,t.writecb=s,t.writing=!0,t.sync=!0,r?e._writev(o,t.onwrite):e._write(o,i,t.onwrite),t.sync=!1}function a(e,t,r,n){r||function(e,t){0===t.length&&t.needDrain&&(t.needDrain=!1,e.emit("drain"))}(e,t),t.pendingcb--,n(),f(e,t)}function u(e,t){if(t.bufferProcessing=!0,e._writev&&t.buffer.length>1){for(var r=[],n=0;n<t.buffer.length;n++)r.push(t.buffer[n].callback);t.pendingcb++,s(e,t,!0,t.length,t.buffer,"",(function(e){for(var n=0;n<r.length;n++)t.pendingcb--,r[n](e)})),t.buffer=[]}else{for(n=0;n<t.buffer.length;n++){var o=t.buffer[n],i=o.chunk,a=o.encoding,u=o.callback,c=t.objectMode?1:i.length;if(s(e,t,!1,c,i,a,u),t.writing){n++;break}}n<t.buffer.length?t.buffer=t.buffer.slice(n):t.buffer.length=0}t.bufferProcessing=!1}function c(e,t){return t.ending&&0===t.length&&!t.finished&&!t.writing}function l(e,t){t.prefinished||(t.prefinished=!0,e.emit("prefinish"))}function f(e,t){var r=c(0,t);return r&&(0===t.pendingcb?(l(e,t),t.finished=!0,e.emit("finish")):l(e,t)),r}return t.inherits(i,r),i.prototype.pipe=function(){this.emit("error",new Error("Cannot pipe. Not readable."))},i.prototype.write=function(r,o,i){var a=this._writableState,u=!1;return t.isFunction(o)&&(i=o,o=null),t.isBuffer(r)?o="buffer":o||(o=a.defaultEncoding),t.isFunction(i)||(i=function(){}),a.ended?function(e,t,r){var n=new Error("write after end");e.emit("error",n),process.nextTick((function(){r(n)}))}(this,0,i):function(e,r,n,o){var i=!0;if(!(t.isBuffer(n)||t.isString(n)||t.isNullOrUndefined(n)||r.objectMode)){var s=new TypeError("Invalid non-string/buffer chunk");e.emit("error",s),process.nextTick((function(){o(s)})),i=!1}return i}(this,a,r,i)&&(a.pendingcb++,u=function(r,o,i,a,u){i=function(r,n,o){!r.objectMode&&!1!==r.decodeStrings&&t.isString(n)&&(n=new e(n,o));return n}(o,i,a),t.isBuffer(i)&&(a="buffer");var c=o.objectMode?1:i.length;o.length+=c;var l=o.length<o.highWaterMark;l||(o.needDrain=!0);o.writing||o.corked?o.buffer.push(new n(i,a,u)):s(r,o,!1,c,i,a,u);return l}(this,a,r,o,i)),u},i.prototype.cork=function(){this._writableState.corked++},i.prototype.uncork=function(){var e=this._writableState;e.corked&&(e.corked--,e.writing||e.corked||e.finished||e.bufferProcessing||!e.buffer.length||u(this,e))},i.prototype._write=function(e,t,r){r(new Error("not implemented"))},i.prototype._writev=null,i.prototype.end=function(e,r,n){var o=this._writableState;t.isFunction(e)?(n=e,e=null,r=null):t.isFunction(r)&&(n=r,r=null),t.isNullOrUndefined(e)||this.write(e,r),o.corked&&(o.corked=1,this.uncork()),o.ending||o.finished||function(e,t,r){t.ending=!0,f(e,t),r&&(t.finished?process.nextTick(r):e.once("finish",r));t.ended=!0}(this,o,n)},pn}function xn(){if(bn)return mn;bn=1,mn=o;var e=Object.keys||function(e){var t=[];for(var r in e)t.push(r);return t},t=an();t.inherits=En();var r=In(),n=Cn();function o(e){if(!(this instanceof o))return new o(e);r.call(this,e),n.call(this,e),e&&!1===e.readable&&(this.readable=!1),e&&!1===e.writable&&(this.writable=!1),this.allowHalfOpen=!0,e&&!1===e.allowHalfOpen&&(this.allowHalfOpen=!1),this.once("end",i)}function i(){this.allowHalfOpen||this._writableState.ended||process.nextTick(this.end.bind(this))}return t.inherits(o,r),function(e,t){for(var r=0,n=e.length;r<n;r++)t(e[r],r)}(e(n.prototype),(function(e){o.prototype[e]||(o.prototype[e]=n.prototype[e])})),mn}var Bn={exports:{}};!function(e){var t=v.default.inherits,r=C.default.EventEmitter;function n(t,n,o){r.call(this),this.interval=t;var i=t*e.exports.UNITS_TO_MS,s=this.emit.bind(this,"beat"),a=this.emit.bind(this,"timeout");this.sendTimer=setInterval(this.runHeartbeat.bind(this,n,s),i/2);var u=0;this.recvTimer=setInterval(this.runHeartbeat.bind(this,(function(){return o()?(u=0,!0):++u<2}),a),i)}e.exports.UNITS_TO_MS=1e3,t(n,r),e.exports.Heart=n,n.prototype.clear=function(){clearInterval(this.sendTimer),clearInterval(this.recvTimer)},n.prototype.runHeartbeat=function(e,t){e()||t()}}(Bn);var Tn={},kn=ee,On=v.default.format;v.default.inherits;var Sn=It.HEARTBEAT;Tn.closeMessage=function(e){var t=e.fields.replyCode;return On('%d (%s) with message "%s"',t,kn.constant_strs[t],e.fields.replyText)},Tn.methodName=function(e){return kn.info(e).name},Tn.inspect=function(e,t){if(e===Sn)return"<Heartbeat>";if(e.id){var r=kn.info(e.id);return On("<%s channel:%d%s>",r.name,e.channel,t?" "+JSON.stringify(e.fields,void 0,2):"")}return On("<Content channel:%d size:%d>",e.channel,e.size)};var Un={};function _n(e){return Math.floor(e/32)}function Nn(e){if(0===e)return 32;let t,r=31;return t=e<<16,0!=t&&(r-=16,e=t),t=e<<8,0!=t&&(r-=8,e=t),t=e<<4,0!=t&&(r-=4,e=t),t=e<<2,0!=t&&(r-=2,e=t),r-(e<<1>>>31)}Un.BitSet=class{constructor(e){if(e){const t=Math.ceil(e/32);this.words=new Array(t)}else this.words=[];this.wordsInUse=0}ensureSize(e){const t=this.words.length;t<e&&(this.words=this.words.concat(new Array(e-t)))}set(e){const t=_n(e);t>=this.wordsInUse&&(this.ensureSize(t+1),this.wordsInUse=t+1);const r=1<<e;this.words[t]|=r}clear(e){const t=_n(e);if(t>=this.wordsInUse)return;const r=~(1<<e);this.words[t]&=r}get(e){const t=_n(e);if(t>=this.wordsInUse)return!1;const r=1<<e;return!!(this.words[t]&r)}nextSetBit(e){let t=_n(e);if(t>=this.wordsInUse)return-1;let r=this.words[t]&4294967295<<e;for(;;){if(r)return 32*t+Nn(r);if(t++,t===this.wordsInUse)return-1;r=this.words[t]}}nextClearBit(e){let t=_n(e);if(t>=this.wordsInUse)return e;let r=~this.words[t]&4294967295<<e;for(;;){if(r)return 32*t+Nn(r);if(t++,t==this.wordsInUse)return 32*t;r=~this.words[t]}}};var An,Rn,Mn,Ln,Fn,Pn={exports:{}};function jn(){if(Rn)return An;Rn=1,An=n;var e=xn(),t=an();function r(e,r){this.afterTransform=function(e,n){return function(e,r,n){var o=e._transformState;o.transforming=!1;var i=o.writecb;if(!i)return e.emit("error",new Error("no writecb in Transform class"));o.writechunk=null,o.writecb=null,t.isNullOrUndefined(n)||e.push(n);i&&i(r);var s=e._readableState;s.reading=!1,(s.needReadable||s.length<s.highWaterMark)&&e._read(s.highWaterMark)}(r,e,n)},this.needTransform=!1,this.transforming=!1,this.writecb=null,this.writechunk=null}function n(i){if(!(this instanceof n))return new n(i);e.call(this,i),this._transformState=new r(i,this);var s=this;this._readableState.needReadable=!0,this._readableState.sync=!1,this.once("prefinish",(function(){t.isFunction(this._flush)?this._flush((function(e){o(s,e)})):o(s)}))}function o(e,t){if(t)return e.emit("error",t);var r=e._writableState,n=e._transformState;if(r.length)throw new Error("calling transform done when ws.length != 0");if(n.transforming)throw new Error("calling transform done when still transforming");return e.push(null)}return t.inherits=En(),t.inherits(n,e),n.prototype.push=function(t,r){return this._transformState.needTransform=!1,e.prototype.push.call(this,t,r)},n.prototype._transform=function(e,t,r){throw new Error("not implemented")},n.prototype._write=function(e,t,r){var n=this._transformState;if(n.writecb=r,n.writechunk=e,n.writeencoding=t,!n.transforming){var o=this._readableState;(n.needTransform||o.needReadable||o.length<o.highWaterMark)&&this._read(o.highWaterMark)}},n.prototype._read=function(e){var r=this._transformState;t.isNull(r.writechunk)||!r.writecb||r.transforming?r.needTransform=!0:(r.transforming=!0,this._transform(r.writechunk,r.writeencoding,r.afterTransform))},An}var Dn={};function qn(e,t){return e&&e.split("\n").slice(t).join("\n")}function $n(e,t){var r=new Error;this.message=e,this.stack=this.toString()+"\n"+qn(r.stack,2),this.stackAtStateChange=t}(0,v.default.inherits)($n,Error),$n.prototype.name="IllegalOperationError",Dn.IllegalOperationError=$n,Dn.stackCapture=function(e){return"Stack capture: "+e+"\n"+qn((new Error).stack,2)};var Hn=ee,zn=Hn.constants,Gn=It,Kn=Gn.HEARTBEAT,Vn=Zr.Mux,Qn=I.default.Duplex||(vn?on.exports:(vn=1,on.exports=xn())),Wn=C.default.EventEmitter,Yn=Bn.exports.Heart,Jn=Tn.methodName,Xn=Tn.closeMessage,Zn=Tn.inspect,eo=Un.BitSet,to=v.default.inherits,ro=v.default.format,no=I.default.PassThrough||(Fn?Pn.exports:(Fn=1,Pn.exports=function(){if(Ln)return Mn;Ln=1,Mn=r;var e=jn(),t=an();function r(t){if(!(this instanceof r))return new r(t);e.call(this,t)}return t.inherits=En(),t.inherits(r,e),r.prototype._transform=function(e,t,r){r(null,e)},Mn}())),oo=Dn.IllegalOperationError,io=Dn.stackCapture;function so(e){Wn.call(this);var t=this.stream=function(e){if(e instanceof Qn)return e;var t=new Qn;return t.wrap(e),t._write=function(t,r,n){return e.write(t,r,n)},t}(e);this.muxer=new Vn(t),this.rest=Buffer.alloc(0),this.frameMax=zn.FRAME_MIN_SIZE,this.sentSinceLastCheck=!1,this.recvSinceLastCheck=!1,this.expectSocketClose=!1,this.freeChannels=new eo,this.channels=[{channel:{accept:co(this)},buffer:e}]}to(so,Wn);var ao=so.prototype;function uo(e){var t=this.channels[e.channel];if(t)return t.channel.accept(e);this.closeWithError(ro("Frame on unknown channel %d",e.channel),zn.CHANNEL_ERROR,new Error(ro("Frame on unknown channel: %s",Zn(e,!1))))}function co(e){return function(t){if(t===Kn);else if(t.id===Hn.ConnectionClose){e.sendMethod(0,Hn.ConnectionCloseOk,{});var r=ro("Connection closed: %s",Xn(t)),n=io(r),o=new Error(r);o.code=t.fields.replyCode,yo(o)&&e.emit("error",o),e.toClosed(n,o)}else t.id===Hn.ConnectionBlocked?e.emit("blocked",t.fields.reason):t.id===Hn.ConnectionUnblocked?e.emit("unblocked"):e.closeWithError(ro("Unexpected frame on channel 0"),zn.UNEXPECTED_FRAME,new Error(ro("Unexpected frame on channel 0: %s",Zn(t,!1))))}}function lo(e,t){return function(){throw new oo(e,t)}}function fo(e,t,r){e.sendMethod=e.sendContent=e.sendMessage=lo(t,r)}ao.sendProtocolHeader=function(){this.sendBytes(Gn.PROTOCOL_HEADER)},ao.open=function(e,t){var r=this,n=t||function(){},o=Object.create(e);function i(e){r.step((function(t,r){null!==t?a(t):0!==r.channel?a(new Error(ro("Frame on channel != 0 during handshake: %s",Zn(r,!1)))):e(r)}))}function s(e,t){i((function(r){r.id===e?t(r):a(new Error(ro("Expected %s; got %s",Jn(e),Zn(r,!1))))}))}function a(e){n(e)}function u(e){r.sendMethod(0,e,o)}function c(e,t){return 0===e||0===t?Math.max(e,t):Math.min(e,t)}function l(t){switch(t.id){case Hn.ConnectionSecure:a(new Error("Wasn't expecting to have to go through secure"));break;case Hn.ConnectionClose:a(new Error(ro("Handshake terminated by server: %s",Xn(t))));break;case Hn.ConnectionTune:var r=t.fields;o.frameMax=c(r.frameMax,e.frameMax),o.channelMax=c(r.channelMax,e.channelMax),o.heartbeat=c(r.heartbeat,e.heartbeat);try{u(Hn.ConnectionTuneOk),u(Hn.ConnectionOpen)}catch(e){return void a(e)}s(Hn.ConnectionOpenOk,f);break;default:a(new Error(ro("Expected connection.secure, connection.close, or connection.tune during handshake; got %s",Zn(t,!1))))}}function f(e){var t;r.channelMax=o.channelMax||65535,r.frameMax=o.frameMax||4294967295,r.heartbeat=o.heartbeat,r.heartbeater=r.startHeartbeater(),r.accept=uo,t=e,r.stream.removeListener("end",h),r.stream.removeListener("error",h),r.stream.on("error",r.onSocketError.bind(r)),r.stream.on("end",r.onSocketError.bind(r,new Error("Unexpected close"))),r.on("frameError",r.onSocketError.bind(r)),r.acceptLoop(),n(null,t)}function h(e){a(e||new Error("Socket closed abruptly during opening handshake"))}this.stream.on("end",h),this.stream.on("error",h),this.sendProtocolHeader(),s(Hn.ConnectionStart,(function(t){if(t.fields.mechanisms.toString().split(" ").indexOf(e.mechanism)<0)a(new Error(ro("SASL mechanism %s is not provided by the server",e.mechanism)));else{r.serverProperties=t.fields.serverProperties;try{u(Hn.ConnectionStartOk)}catch(e){return void a(e)}i(l)}}))},ao.close=function(e){var t=e&&function(){e(null)};this.closeBecause("Cheers, thanks",zn.REPLY_SUCCESS,t)},ao.closeBecause=function(e,t,r){this.sendMethod(0,Hn.ConnectionClose,{replyText:e,replyCode:t,methodId:0,classId:0});var n=io("closeBecause called: "+e);this.toClosing(n,r)},ao.closeWithError=function(e,t,r){this.emit("error",r),this.closeBecause(e,t)},ao.onSocketError=function(e){if(!this.expectSocketClose){this.expectSocketClose=!0,this.emit("error",e);var t=io("Socket error");this.toClosed(t,e)}},ao.toClosing=function(e,t){var r=this.sendMethod.bind(this);this.accept=function(e){if(e.id===Hn.ConnectionCloseOk){t&&t();var n=io("ConnectionCloseOk received");this.toClosed(n,void 0)}else e.id===Hn.ConnectionClose&&r(0,Hn.ConnectionCloseOk,{})},fo(this,"Connection closing",e)},ao._closeChannels=function(e){for(var t=1;t<this.channels.length;t++){var r=this.channels[t];null!==r&&r.channel.toClosed(e)}},ao.toClosed=function(e,t){this._closeChannels(e);var r=ro("Connection closed (%s)",t?t.toString():"by client");fo(this,r,e),this.accept=lo(r,e),this.close=function(t){t&&t(new oo(r,e))},this.heartbeater&&this.heartbeater.clear(),this.expectSocketClose=!0,this.stream.end(),this.emit("close",t)},ao.startHeartbeater=function(){if(0===this.heartbeat)return null;var e=this,t=new Yn(this.heartbeat,this.checkSend.bind(this),this.checkRecv.bind(this));return t.on("timeout",(function(){var t=new Error("Heartbeat timeout");e.emit("error",t);var r=io("Heartbeat timeout");e.toClosed(r,t)})),t.on("beat",(function(){e.sendHeartbeat()})),t},ao.freshChannel=function(e,t){var r=this.freeChannels.nextClearBit(1);if(r<0||r>this.channelMax)throw new Error("No channels left to allocate");this.freeChannels.set(r);var n=t&&t.highWaterMark||1024,o=new no({objectMode:!0,highWaterMark:n});return this.channels[r]={channel:e,buffer:o},o.on("drain",(function(){e.onBufferDrain()})),this.muxer.pipeFrom(o),r},ao.releaseChannel=function(e){this.freeChannels.clear(e),this.channels[e].buffer.end(),this.channels[e]=null},ao.acceptLoop=function(){var e=this;function t(){try{for(var t;t=e.recvFrame();)e.accept(t)}catch(t){e.emit("frameError",t)}}e.stream.on("readable",t),t()},ao.step=function(e){var t=this;!function r(){var n;try{n=t.recvFrame()}catch(t){return void e(t,null)}n?e(null,n):t.stream.once("readable",r)}()},ao.checkSend=function(){var e=this.sentSinceLastCheck;return this.sentSinceLastCheck=!1,e},ao.checkRecv=function(){var e=this.recvSinceLastCheck;return this.recvSinceLastCheck=!1,e},ao.sendBytes=function(e){this.sentSinceLastCheck=!0,this.stream.write(e)},ao.sendHeartbeat=function(){return this.sendBytes(Gn.HEARTBEAT_BUF)};var ho=Hn.encodeMethod,po=Hn.encodeProperties;ao.sendMethod=function(e,t,r){var n=ho(t,e,r);return this.sentSinceLastCheck=!0,this.channels[e].buffer.write(n)},ao.sendMessage=function(e,t,r,n,o,i){if(!Buffer.isBuffer(i))throw new TypeError("content is not a buffer");var s=ho(t,e,r),a=po(n,e,i.length,o),u=this.channels[e].buffer;this.sentSinceLastCheck=!0;var c=s.length+a.length,l=i.length>0?i.length+go:0,f=c+l;if(f<2048){var h=Buffer.allocUnsafe(f),d=s.copy(h,0);return d+=a.copy(h,d),l>0&&mo(e,i).copy(h,d),u.write(h)}if(c<2048){var p=Buffer.allocUnsafe(c);d=s.copy(p,0);a.copy(p,d),u.write(p)}else u.write(s),u.write(a);return this.sendContent(e,i)};var go=Hn.FRAME_OVERHEAD,mo=Gn.makeBodyFrame;ao.sendContent=function(e,t){if(!Buffer.isBuffer(t))throw new TypeError(ro("Expected buffer; got %s",t));for(var r=!0,n=this.channels[e].buffer,o=this.frameMax-go,i=0;i<t.length;i+=o){var s=i+o,a=s>t.length?t.slice(i):t.slice(i,s),u=mo(e,a);r=n.write(u)}return this.sentSinceLastCheck=!0,r};var bo=Gn.parseFrame,vo=Gn.decodeFrame;function yo(e){switch(e&&e.code){case Hn.constants.CONNECTION_FORCED:case Hn.constants.REPLY_SUCCESS:return!1;default:return!0}}ao.recvFrame=function(){var e=bo(this.rest,this.frameMax);if(e)return this.rest=e.rest,vo(e);var t=this.stream.read();return null!==t&&(this.recvSinceLastCheck=!0,this.rest=Buffer.concat([this.rest,t]),this.recvFrame())},Z.Connection=so,Z.isFatalError=yo;var wo={},Eo=te;wo.plain=function(e,t){return{mechanism:"PLAIN",response:function(){return Buffer.from(["",e,t].join(String.fromCharCode(0)))},username:e,password:t}},wo.amqplain=function(e,t){return{mechanism:"AMQPLAIN",response:function(){const r=Buffer.alloc(16384),n=Eo.encodeTable(r,{LOGIN:e,PASSWORD:t},0);return r.slice(4,n)},username:e,password:t}},wo.external=function(){return{mechanism:"EXTERNAL",response:function(){return Buffer.from("")}}};var Io="0.10.3",Co=X,xo=m.default,Bo=Z.Connection,To=v.default.format,ko=wo;function Oo(e,t){for(var r=Object.keys(e),n=r.length;n--;){var o=r[n];t[o]=e[o]}return t}var So={product:"amqplib",version:Io,platform:To("Node.JS %s",process.version),information:"http://squaremo.github.io/amqp.node",capabilities:{publisher_confirms:!0,exchange_exchange_bindings:!0,"basic.nack":!0,consumer_cancel_notify:!0,"connection.blocked":!0,authentication_failure_close:!0}};function Uo(e,t,r,n){e=e?xo.unescape(e):"/";t=t||{};function o(e,t){return void 0===e?t:parseInt(e)}return{clientProperties:Oo(n,Object.create(So)),mechanism:r.mechanism,response:r.response(),locale:t.locale||"en_US",channelMax:o(t.channelMax,0),frameMax:o(t.frameMax,4096),heartbeat:o(t.heartbeat,0),virtualHost:e,capabilities:"",insist:0}}function _o(e){var t="guest",r="guest";return""==e.username&&""==e.password||(t=e.username?unescape(e.username):"",r=e.password?unescape(e.password):""),ko.plain(t,r)}N.connect=function(e,t,r){var n=Oo(t||{},{});e=e||"amqp://localhost";var o,i,s=!!n.noDelay,a=n.timeout,u=!!n.keepAlive,c=n.keepAliveDelay||0,l=n.clientProperties||{};if("object"==typeof e){var f,h;o=(e.protocol||"amqp")+":",n.host=e.hostname,n.servername=n.servername||e.hostname,n.port=e.port||("amqp:"===o?5672:5671),null==e.username&&null==e.password?(f="guest",h="guest"):(f=e.username||"",h=e.password||"");var d={locale:e.locale,channelMax:e.channelMax,frameMax:e.frameMax,heartbeat:e.heartbeat};i=Uo(e.vhost,d,n.credentials||ko.plain(f,h),l)}else{var p=Co(e,!0);o=p.protocol,n.host=p.hostname,n.servername=n.servername||p.hostname,n.port=parseInt(p.port)||("amqp:"===o?5672:5671);var g=p.pathname?p.pathname.substr(1):null;i=Uo(g,p.query,n.credentials||_o(p),l)}var m,b=!1;function v(){b=!0,m.setNoDelay(s),u&&m.setKeepAlive(u,c);var e=new Bo(m);e.open(i,(function(t,n){a&&m.setTimeout(0),null===t?r(null,e):(m.end(),m.destroy(),r(t))}))}if("amqp:"===o)m=B.default.connect(n,v);else{if("amqps:"!==o)throw new Error("Expected amqp: or amqps: as the protocol; got "+o);m=T.default.connect(n,v)}a&&m.setTimeout(a,(function(){m.end(),m.destroy(),r(new Error("connect ETIMEDOUT"))})),m.once("error",(function(e){b||r(e)}))},N.credentialsFromUrl=_o;var No={},Ao={},Ro=ee,Mo=Tn.closeMessage,Lo=Tn.inspect,Fo=Tn.methodName,Po=E.default,jo=v.default.inherits,Do=C.default.EventEmitter,qo=v.default.format,$o=Dn.IllegalOperationError,Ho=Dn.stackCapture;function zo(e){Do.call(this),this.connection=e,this.reply=null,this.pending=[],this.lwm=1,this.unconfirmed=[],this.on("ack",this.handleConfirm.bind(this,(function(e){e&&e(null)}))),this.on("nack",this.handleConfirm.bind(this,(function(e){e&&e(new Error("message nacked"))}))),this.on("close",(function(){for(var e;e=this.unconfirmed.shift();)e&&e(new Error("channel closed"))})),this.handleMessage=Qo}jo(zo,Do),Ao.Channel=zo,Ao.acceptMessage=Wo;var Go=zo.prototype;function Ko(e,t){return function(){throw new $o(e,t)}}function Vo(e,t,r){e.sendImmediately=e.sendOrEnqueue=e.sendMessage=Ko(t,r)}function Qo(e){var t;if(e.id===Ro.BasicDeliver)t="delivery";else{if(e.id!==Ro.BasicReturn)throw qo("Expected BasicDeliver or BasicReturn; got %s",Lo(e));t="return"}var r=this,n=e.fields;return Wo((function(e){e.fields=n,r.emit(t,e)}))}function Wo(e){var t=0,r=0,n=null,o={fields:null,properties:null,content:null};return function(n){if(n.id===Ro.BasicProperties)return o.properties=n.fields,0===(t=r=n.size)?(o.content=Buffer.alloc(0),e(o),Qo):i;throw"Expected headers frame after delivery"};function i(s){if(s.content){var a=s.content.length;if(0===(r-=a))return null!==n?(n.push(s.content),o.content=Buffer.concat(n)):o.content=s.content,e(o),Qo;if(r<0)throw qo("Too much content sent! Expected %d bytes",t);return null!==n?n.push(s.content):n=[s.content],i}throw"Expected content frame after headers"}}function Yo(e){zo.call(this,e),this.consumers=new Map}function Jo(e,t,r){null!=r&&(e[t]=r)}Go.allocate=function(){return this.ch=this.connection.freshChannel(this),this},Go.sendImmediately=function(e,t){return this.connection.sendMethod(this.ch,e,t)},Go.sendOrEnqueue=function(e,t,r){this.reply?this.pending.push({method:e,fields:t,reply:r}):(Po(0===this.pending.length),this.reply=r,this.sendImmediately(e,t))},Go.sendMessage=function(e,t,r){return this.connection.sendMessage(this.ch,Ro.BasicPublish,e,Ro.BasicProperties,t,r)},Go._rpc=function(e,t,r,n){var o=this;this.sendOrEnqueue(e,t,(function(t,i){if(null===t){if(i.id===r)return n(null,i);var s=Fo(r),a=new Error(qo("Expected %s; got %s",s,Lo(i,!1)));return o.closeWithError(i.id,qo("Expected %s; got %s",s,Fo(i.id)),Ro.constants.UNEXPECTED_FRAME,a),n(a)}if(t instanceof Error)return n(t);var u=(t.fields.classId<<16)+t.fields.methodId,c=(a=e===u?qo("Operation failed: %s; %s",Fo(e),Mo(t)):qo("Channel closed by server: %s",Mo(t)),new Error(a));return c.code=t.fields.replyCode,c.classId=t.fields.classId,c.methodId=t.fields.methodId,n(c)}))},Go.toClosed=function(e){this._rejectPending(),Vo(this,"Channel closed",e),this.accept=Ko("Channel closed",e),this.connection.releaseChannel(this.ch),this.emit("close")},Go.toClosing=function(e,t){var r=this.sendImmediately.bind(this);Vo(this,"Channel closing",e),this.accept=function(e){if(e.id===Ro.ChannelCloseOk){t&&t();var n=Ho("ChannelCloseOk frame received");this.toClosed(n)}else e.id===Ro.ChannelClose&&r(Ro.ChannelCloseOk,{})}},Go._rejectPending=function(){function e(e){e(new Error("Channel ended, no reply will be forthcoming"))}var t;for(null!==this.reply&&e(this.reply),this.reply=null;t=this.pending.shift();)e(t.reply);this.pending=null},Go.closeBecause=function(e,t,r){this.sendImmediately(Ro.ChannelClose,{replyText:e,replyCode:t,methodId:0,classId:0});var n=Ho("closeBecause called: "+e);this.toClosing(n,r)},Go.closeWithError=function(e,t,r,n){var o=this;this.closeBecause(t,r,(function(){n.code=r,e&&(n.classId=Ro.info(e).classId,n.methodId=Ro.info(e).methodId),o.emit("error",n)}))},Go.acceptMessageFrame=function(e){try{this.handleMessage=this.handleMessage(e)}catch(t){"string"==typeof t?this.closeWithError(e.id,t,Ro.constants.UNEXPECTED_FRAME,new Error(t)):t instanceof Error?this.closeWithError(e.id,"Error while processing message",Ro.constants.INTERNAL_ERROR,t):this.closeWithError(e.id,"Internal error while processing message",Ro.constants.INTERNAL_ERROR,new Error(t.toString()))}},Go.handleConfirm=function(e,t){var r=t.deliveryTag;if(t.multiple){var n=this.unconfirmed.splice(0,r-this.lwm+1);this.lwm=r+1,n.forEach(e)}else{var o;if(r===this.lwm)for(o=this.unconfirmed.shift(),this.lwm++;null===this.unconfirmed[0];)this.unconfirmed.shift(),this.lwm++;else o=this.unconfirmed[r-this.lwm],this.unconfirmed[r-this.lwm]=null;e(o)}},Go.pushConfirmCallback=function(e){this.unconfirmed.push(e||!1)},Go.accept=function(e){switch(e.id){case void 0:case Ro.BasicDeliver:case Ro.BasicReturn:case Ro.BasicProperties:return this.acceptMessageFrame(e);case Ro.BasicAck:return this.emit("ack",e.fields);case Ro.BasicNack:return this.emit("nack",e.fields);case Ro.BasicCancel:return this.emit("cancel",e.fields);case Ro.ChannelClose:if(this.reply){var t=this.reply;this.reply=null,t(e)}var r="Channel closed by server: "+Mo(e);this.sendImmediately(Ro.ChannelCloseOk,{});var n=new Error(r);n.code=e.fields.replyCode,n.classId=e.fields.classId,n.methodId=e.fields.methodId,this.emit("error",n);var o=Ho(r);return void this.toClosed(o);case Ro.BasicFlow:return this.closeWithError(e.id,"Flow not implemented",Ro.constants.NOT_IMPLEMENTED,new Error("Flow not implemented"));default:t=this.reply;if(this.reply=null,this.pending.length>0){var i=this.pending.shift();this.reply=i.reply,this.sendImmediately(i.method,i.fields)}return t(null,e)}},Go.onBufferDrain=function(){this.emit("drain")},jo(Yo,zo),Ao.BaseChannel=Yo,Yo.prototype.registerConsumer=function(e,t){this.consumers.set(e,t)},Yo.prototype.unregisterConsumer=function(e){this.consumers.delete(e)},Yo.prototype.dispatchMessage=function(e,t){var r=e.consumerTag,n=this.consumers.get(r);if(n)return n(t);throw new Error("Unknown consumer: "+r)},Yo.prototype.handleDelivery=function(e){return this.dispatchMessage(e.fields,e)},Yo.prototype.handleCancel=function(e){var t=this.dispatchMessage(e,null);return this.unregisterConsumer(e.consumerTag),t};var Xo=Object.freeze({}),Zo={assertQueue:function(e,t){e=e||"",t=t||Xo;var r=Object.create(t.arguments||null);return Jo(r,"x-expires",t.expires),Jo(r,"x-message-ttl",t.messageTtl),Jo(r,"x-dead-letter-exchange",t.deadLetterExchange),Jo(r,"x-dead-letter-routing-key",t.deadLetterRoutingKey),Jo(r,"x-max-length",t.maxLength),Jo(r,"x-max-priority",t.maxPriority),Jo(r,"x-overflow",t.overflow),Jo(r,"x-queue-mode",t.queueMode),{queue:e,exclusive:!!t.exclusive,durable:void 0===t.durable||t.durable,autoDelete:!!t.autoDelete,arguments:r,passive:!1,ticket:0,nowait:!1}},checkQueue:function(e){return{queue:e,passive:!0,nowait:!1,durable:!0,autoDelete:!1,exclusive:!1,ticket:0}},deleteQueue:function(e,t){return{queue:e,ifUnused:!!(t=t||Xo).ifUnused,ifEmpty:!!t.ifEmpty,ticket:0,nowait:!1}},purgeQueue:function(e){return{queue:e,ticket:0,nowait:!1}},bindQueue:function(e,t,r,n){return{queue:e,exchange:t,routingKey:r,arguments:n,ticket:0,nowait:!1}},unbindQueue:function(e,t,r,n){return{queue:e,exchange:t,routingKey:r,arguments:n,ticket:0,nowait:!1}},assertExchange:function(e,t,r){r=r||Xo;var n=Object.create(r.arguments||null);return Jo(n,"alternate-exchange",r.alternateExchange),{exchange:e,ticket:0,type:t,passive:!1,durable:void 0===r.durable||r.durable,autoDelete:!!r.autoDelete,internal:!!r.internal,nowait:!1,arguments:n}},checkExchange:function(e){return{exchange:e,passive:!0,nowait:!1,durable:!0,internal:!1,type:"",autoDelete:!1,ticket:0}},deleteExchange:function(e,t){return{exchange:e,ifUnused:!!(t=t||Xo).ifUnused,ticket:0,nowait:!1}},bindExchange:function(e,t,r,n){return{source:t,destination:e,routingKey:r,arguments:n,ticket:0,nowait:!1}},unbindExchange:function(e,t,r,n){return{source:t,destination:e,routingKey:r,arguments:n,ticket:0,nowait:!1}},publish:function(e,t,r){function n(e){return void 0===e?void 0:Array.isArray(e)?e.map(String):[String(e)]}r=r||Xo;var o,i=Object.create(r.headers||null);Jo(i,"CC",n(r.CC)),Jo(i,"BCC",n(r.BCC)),void 0!==r.persistent?o=r.persistent?2:1:"number"==typeof r.deliveryMode?o=r.deliveryMode:r.deliveryMode&&(o=2);var s=r.expiration;return void 0!==s&&(s=s.toString()),{exchange:e,routingKey:t,mandatory:!!r.mandatory,immediate:!1,ticket:void 0,contentType:r.contentType,contentEncoding:r.contentEncoding,headers:i,deliveryMode:o,priority:r.priority,correlationId:r.correlationId,replyTo:r.replyTo,expiration:s,messageId:r.messageId,timestamp:r.timestamp,type:r.type,userId:r.userId,appId:r.appId,clusterId:void 0}},consume:function(e,t){t=t||Xo;var r=Object.create(t.arguments||null);return Jo(r,"x-priority",t.priority),{ticket:0,queue:e,consumerTag:t.consumerTag||"",noLocal:!!t.noLocal,noAck:!!t.noAck,exclusive:!!t.exclusive,nowait:!1,arguments:r}},cancel:function(e){return{consumerTag:e,nowait:!1}},get:function(e,t){return{ticket:0,queue:e,noAck:!!(t=t||Xo).noAck}},ack:function(e,t){return{deliveryTag:e,multiple:!!t}},nack:function(e,t,r){return{deliveryTag:e,multiple:!!t,requeue:void 0===r||r}},reject:function(e,t){return{deliveryTag:e,requeue:void 0===t||t}},prefetch:function(e,t){return{prefetchCount:e||0,prefetchSize:0,global:!!t}},recover:function(){return{requeue:!0}}},ei=Object.freeze(Zo);const ti=C.default,ri=v.default.promisify,ni=ee,{BaseChannel:oi}=Ao,{acceptMessage:ii}=Ao,si=ei,{inspect:ai}=Tn;class ui extends oi{constructor(e){super(e),this.on("delivery",this.handleDelivery.bind(this)),this.on("cancel",this.handleCancel.bind(this))}async rpc(e,t,r){return(await ri((n=>this._rpc(e,t,r,n)))()).fields}async open(){return(await this.allocate.bind(this)()).rpc(ni.ChannelOpen,{outOfBand:""},ni.ChannelOpenOk)}close(){return ri((e=>this.closeBecause("Goodbye",ni.constants.REPLY_SUCCESS,e)))()}assertQueue(e,t){return this.rpc(ni.QueueDeclare,si.assertQueue(e,t),ni.QueueDeclareOk)}checkQueue(e){return this.rpc(ni.QueueDeclare,si.checkQueue(e),ni.QueueDeclareOk)}deleteQueue(e,t){return this.rpc(ni.QueueDelete,si.deleteQueue(e,t),ni.QueueDeleteOk)}purgeQueue(e){return this.rpc(ni.QueuePurge,si.purgeQueue(e),ni.QueuePurgeOk)}bindQueue(e,t,r,n){return this.rpc(ni.QueueBind,si.bindQueue(e,t,r,n),ni.QueueBindOk)}unbindQueue(e,t,r,n){return this.rpc(ni.QueueUnbind,si.unbindQueue(e,t,r,n),ni.QueueUnbindOk)}assertExchange(e,t,r){return this.rpc(ni.ExchangeDeclare,si.assertExchange(e,t,r),ni.ExchangeDeclareOk).then((t=>({exchange:e})))}checkExchange(e){return this.rpc(ni.ExchangeDeclare,si.checkExchange(e),ni.ExchangeDeclareOk)}deleteExchange(e,t){return this.rpc(ni.ExchangeDelete,si.deleteExchange(e,t),ni.ExchangeDeleteOk)}bindExchange(e,t,r,n){return this.rpc(ni.ExchangeBind,si.bindExchange(e,t,r,n),ni.ExchangeBindOk)}unbindExchange(e,t,r,n){return this.rpc(ni.ExchangeUnbind,si.unbindExchange(e,t,r,n),ni.ExchangeUnbindOk)}publish(e,t,r,n){const o=si.publish(e,t,n);return this.sendMessage(o,o,r)}sendToQueue(e,t,r){return this.publish("",e,t,r)}consume(e,t,r){const n=si.consume(e,r);return new Promise(((e,r)=>{this._rpc(ni.BasicConsume,n,ni.BasicConsumeOk,((n,o)=>{if(n)return r(n);this.registerConsumer(o.fields.consumerTag,t),e(o.fields)}))}))}async cancel(e){await ri((t=>{this._rpc(ni.BasicCancel,si.cancel(e),ni.BasicCancelOk,t)}))().then((t=>(this.unregisterConsumer(e),t.fields)))}get(e,t){const r=si.get(e,t);return new Promise(((e,t)=>{this.sendOrEnqueue(ni.BasicGet,r,((r,n)=>{if(r)return t(r);if(n.id===ni.BasicGetEmpty)return e(!1);if(n.id===ni.BasicGetOk){const t=n.fields;this.handleMessage=ii((r=>{r.fields=t,e(r)}))}else t(new Error(`Unexpected response to BasicGet: ${ai(n)}`))}))}))}ack(e,t){this.sendImmediately(ni.BasicAck,si.ack(e.fields.deliveryTag,t))}ackAll(){this.sendImmediately(ni.BasicAck,si.ack(0,!0))}nack(e,t,r){this.sendImmediately(ni.BasicNack,si.nack(e.fields.deliveryTag,t,r))}nackAll(e){this.sendImmediately(ni.BasicNack,si.nack(0,!0,e))}reject(e,t){this.sendImmediately(ni.BasicReject,si.reject(e.fields.deliveryTag,t))}recover(){return this.rpc(ni.BasicRecover,si.recover(),ni.BasicRecoverOk)}qos(e,t){return this.rpc(ni.BasicQos,si.prefetch(e,t),ni.BasicQosOk)}}ui.prototype.prefetch=ui.prototype.qos;class ci extends ui{publish(e,t,r,n,o){return this.pushConfirmCallback(o),ui.prototype.publish.call(this,e,t,r,n)}sendToQueue(e,t,r,n){return this.publish("",e,t,r,n)}waitForConfirms(){const e=[],t=this.unconfirmed;if(t.forEach(((r,n)=>{if(null!==r){const o=new Promise(((e,o)=>{t[n]=t=>{r&&r(t),null===t?e():o(t)}}));e.push(o)}})),!this.pending)for(var r;r=this.unconfirmed.shift();)r&&r(new Error("channel closed"));return Promise.all(e)}}No.ConfirmChannel=ci,No.Channel=ui,No.ChannelModel=class extends ti{constructor(e){super(),this.connection=e,["error","close","blocked","unblocked"].forEach((t=>{e.on(t,this.emit.bind(this,t))}))}close(){return ri(this.connection.close.bind(this.connection))()}async createChannel(){const e=new ui(this.connection);return await e.open(),e}async createConfirmChannel(){const e=new ci(this.connection);return await e.open(),await e.rpc(ni.ConfirmSelect,{nowait:!1},ni.ConfirmSelectOk),e}};var li=N.connect,fi=No.ChannelModel,hi=v.default.promisify;var di=function(e,t){return hi((function(r){return li(e,t,r)}))().then((function(e){return new fi(e)}))},pi={exports:{}},gi=/[|\\{}()[\]^$+*?.]/g,mi=function(e){if("string"!=typeof e)throw new TypeError("Expected a string");return e.replace(gi,"\\$&")},bi={exports:{}},vi={exports:{}},yi={aliceblue:[240,248,255],antiquewhite:[250,235,215],aqua:[0,255,255],aquamarine:[127,255,212],azure:[240,255,255],beige:[245,245,220],bisque:[255,228,196],black:[0,0,0],blanchedalmond:[255,235,205],blue:[0,0,255],blueviolet:[138,43,226],brown:[165,42,42],burlywood:[222,184,135],cadetblue:[95,158,160],chartreuse:[127,255,0],chocolate:[210,105,30],coral:[255,127,80],cornflowerblue:[100,149,237],cornsilk:[255,248,220],crimson:[220,20,60],cyan:[0,255,255],darkblue:[0,0,139],darkcyan:[0,139,139],darkgoldenrod:[184,134,11],darkgray:[169,169,169],darkgreen:[0,100,0],darkgrey:[169,169,169],darkkhaki:[189,183,107],darkmagenta:[139,0,139],darkolivegreen:[85,107,47],darkorange:[255,140,0],darkorchid:[153,50,204],darkred:[139,0,0],darksalmon:[233,150,122],darkseagreen:[143,188,143],darkslateblue:[72,61,139],darkslategray:[47,79,79],darkslategrey:[47,79,79],darkturquoise:[0,206,209],darkviolet:[148,0,211],deeppink:[255,20,147],deepskyblue:[0,191,255],dimgray:[105,105,105],dimgrey:[105,105,105],dodgerblue:[30,144,255],firebrick:[178,34,34],floralwhite:[255,250,240],forestgreen:[34,139,34],fuchsia:[255,0,255],gainsboro:[220,220,220],ghostwhite:[248,248,255],gold:[255,215,0],goldenrod:[218,165,32],gray:[128,128,128],green:[0,128,0],greenyellow:[173,255,47],grey:[128,128,128],honeydew:[240,255,240],hotpink:[255,105,180],indianred:[205,92,92],indigo:[75,0,130],ivory:[255,255,240],khaki:[240,230,140],lavender:[230,230,250],lavenderblush:[255,240,245],lawngreen:[124,252,0],lemonchiffon:[255,250,205],lightblue:[173,216,230],lightcoral:[240,128,128],lightcyan:[224,255,255],lightgoldenrodyellow:[250,250,210],lightgray:[211,211,211],lightgreen:[144,238,144],lightgrey:[211,211,211],lightpink:[255,182,193],lightsalmon:[255,160,122],lightseagreen:[32,178,170],lightskyblue:[135,206,250],lightslategray:[119,136,153],lightslategrey:[119,136,153],lightsteelblue:[176,196,222],lightyellow:[255,255,224],lime:[0,255,0],limegreen:[50,205,50],linen:[250,240,230],magenta:[255,0,255],maroon:[128,0,0],mediumaquamarine:[102,205,170],mediumblue:[0,0,205],mediumorchid:[186,85,211],mediumpurple:[147,112,219],mediumseagreen:[60,179,113],mediumslateblue:[123,104,238],mediumspringgreen:[0,250,154],mediumturquoise:[72,209,204],mediumvioletred:[199,21,133],midnightblue:[25,25,112],mintcream:[245,255,250],mistyrose:[255,228,225],moccasin:[255,228,181],navajowhite:[255,222,173],navy:[0,0,128],oldlace:[253,245,230],olive:[128,128,0],olivedrab:[107,142,35],orange:[255,165,0],orangered:[255,69,0],orchid:[218,112,214],palegoldenrod:[238,232,170],palegreen:[152,251,152],paleturquoise:[175,238,238],palevioletred:[219,112,147],papayawhip:[255,239,213],peachpuff:[255,218,185],peru:[205,133,63],pink:[255,192,203],plum:[221,160,221],powderblue:[176,224,230],purple:[128,0,128],rebeccapurple:[102,51,153],red:[255,0,0],rosybrown:[188,143,143],royalblue:[65,105,225],saddlebrown:[139,69,19],salmon:[250,128,114],sandybrown:[244,164,96],seagreen:[46,139,87],seashell:[255,245,238],sienna:[160,82,45],silver:[192,192,192],skyblue:[135,206,235],slateblue:[106,90,205],slategray:[112,128,144],slategrey:[112,128,144],snow:[255,250,250],springgreen:[0,255,127],steelblue:[70,130,180],tan:[210,180,140],teal:[0,128,128],thistle:[216,191,216],tomato:[255,99,71],turquoise:[64,224,208],violet:[238,130,238],wheat:[245,222,179],white:[255,255,255],whitesmoke:[245,245,245],yellow:[255,255,0],yellowgreen:[154,205,50]},wi={};for(var Ei in yi)yi.hasOwnProperty(Ei)&&(wi[yi[Ei]]=Ei);var Ii=vi.exports={rgb:{channels:3,labels:"rgb"},hsl:{channels:3,labels:"hsl"},hsv:{channels:3,labels:"hsv"},hwb:{channels:3,labels:"hwb"},cmyk:{channels:4,labels:"cmyk"},xyz:{channels:3,labels:"xyz"},lab:{channels:3,labels:"lab"},lch:{channels:3,labels:"lch"},hex:{channels:1,labels:["hex"]},keyword:{channels:1,labels:["keyword"]},ansi16:{channels:1,labels:["ansi16"]},ansi256:{channels:1,labels:["ansi256"]},hcg:{channels:3,labels:["h","c","g"]},apple:{channels:3,labels:["r16","g16","b16"]},gray:{channels:1,labels:["gray"]}};for(var Ci in Ii)if(Ii.hasOwnProperty(Ci)){if(!("channels"in Ii[Ci]))throw new Error("missing channels property: "+Ci);if(!("labels"in Ii[Ci]))throw new Error("missing channel labels property: "+Ci);if(Ii[Ci].labels.length!==Ii[Ci].channels)throw new Error("channel and label counts mismatch: "+Ci);var xi=Ii[Ci].channels,Bi=Ii[Ci].labels;delete Ii[Ci].channels,delete Ii[Ci].labels,Object.defineProperty(Ii[Ci],"channels",{value:xi}),Object.defineProperty(Ii[Ci],"labels",{value:Bi})}function Ti(e,t){return Math.pow(e[0]-t[0],2)+Math.pow(e[1]-t[1],2)+Math.pow(e[2]-t[2],2)}Ii.rgb.hsl=function(e){var t,r,n=e[0]/255,o=e[1]/255,i=e[2]/255,s=Math.min(n,o,i),a=Math.max(n,o,i),u=a-s;return a===s?t=0:n===a?t=(o-i)/u:o===a?t=2+(i-n)/u:i===a&&(t=4+(n-o)/u),(t=Math.min(60*t,360))<0&&(t+=360),r=(s+a)/2,[t,100*(a===s?0:r<=.5?u/(a+s):u/(2-a-s)),100*r]},Ii.rgb.hsv=function(e){var t,r,n,o,i,s=e[0]/255,a=e[1]/255,u=e[2]/255,c=Math.max(s,a,u),l=c-Math.min(s,a,u),f=function(e){return(c-e)/6/l+.5};return 0===l?o=i=0:(i=l/c,t=f(s),r=f(a),n=f(u),s===c?o=n-r:a===c?o=1/3+t-n:u===c&&(o=2/3+r-t),o<0?o+=1:o>1&&(o-=1)),[360*o,100*i,100*c]},Ii.rgb.hwb=function(e){var t=e[0],r=e[1],n=e[2];return[Ii.rgb.hsl(e)[0],100*(1/255*Math.min(t,Math.min(r,n))),100*(n=1-1/255*Math.max(t,Math.max(r,n)))]},Ii.rgb.cmyk=function(e){var t,r=e[0]/255,n=e[1]/255,o=e[2]/255;return[100*((1-r-(t=Math.min(1-r,1-n,1-o)))/(1-t)||0),100*((1-n-t)/(1-t)||0),100*((1-o-t)/(1-t)||0),100*t]},Ii.rgb.keyword=function(e){var t=wi[e];if(t)return t;var r,n=1/0;for(var o in yi)if(yi.hasOwnProperty(o)){var i=Ti(e,yi[o]);i<n&&(n=i,r=o)}return r},Ii.keyword.rgb=function(e){return yi[e]},Ii.rgb.xyz=function(e){var t=e[0]/255,r=e[1]/255,n=e[2]/255;return[100*(.4124*(t=t>.04045?Math.pow((t+.055)/1.055,2.4):t/12.92)+.3576*(r=r>.04045?Math.pow((r+.055)/1.055,2.4):r/12.92)+.1805*(n=n>.04045?Math.pow((n+.055)/1.055,2.4):n/12.92)),100*(.2126*t+.7152*r+.0722*n),100*(.0193*t+.1192*r+.9505*n)]},Ii.rgb.lab=function(e){var t=Ii.rgb.xyz(e),r=t[0],n=t[1],o=t[2];return n/=100,o/=108.883,r=(r/=95.047)>.008856?Math.pow(r,1/3):7.787*r+16/116,[116*(n=n>.008856?Math.pow(n,1/3):7.787*n+16/116)-16,500*(r-n),200*(n-(o=o>.008856?Math.pow(o,1/3):7.787*o+16/116))]},Ii.hsl.rgb=function(e){var t,r,n,o,i,s=e[0]/360,a=e[1]/100,u=e[2]/100;if(0===a)return[i=255*u,i,i];t=2*u-(r=u<.5?u*(1+a):u+a-u*a),o=[0,0,0];for(var c=0;c<3;c++)(n=s+1/3*-(c-1))<0&&n++,n>1&&n--,i=6*n<1?t+6*(r-t)*n:2*n<1?r:3*n<2?t+(r-t)*(2/3-n)*6:t,o[c]=255*i;return o},Ii.hsl.hsv=function(e){var t=e[0],r=e[1]/100,n=e[2]/100,o=r,i=Math.max(n,.01);return r*=(n*=2)<=1?n:2-n,o*=i<=1?i:2-i,[t,100*(0===n?2*o/(i+o):2*r/(n+r)),100*((n+r)/2)]},Ii.hsv.rgb=function(e){var t=e[0]/60,r=e[1]/100,n=e[2]/100,o=Math.floor(t)%6,i=t-Math.floor(t),s=255*n*(1-r),a=255*n*(1-r*i),u=255*n*(1-r*(1-i));switch(n*=255,o){case 0:return[n,u,s];case 1:return[a,n,s];case 2:return[s,n,u];case 3:return[s,a,n];case 4:return[u,s,n];case 5:return[n,s,a]}},Ii.hsv.hsl=function(e){var t,r,n,o=e[0],i=e[1]/100,s=e[2]/100,a=Math.max(s,.01);return n=(2-i)*s,r=i*a,[o,100*(r=(r/=(t=(2-i)*a)<=1?t:2-t)||0),100*(n/=2)]},Ii.hwb.rgb=function(e){var t,r,n,o,i,s,a,u=e[0]/360,c=e[1]/100,l=e[2]/100,f=c+l;switch(f>1&&(c/=f,l/=f),n=6*u-(t=Math.floor(6*u)),0!=(1&t)&&(n=1-n),o=c+n*((r=1-l)-c),t){default:case 6:case 0:i=r,s=o,a=c;break;case 1:i=o,s=r,a=c;break;case 2:i=c,s=r,a=o;break;case 3:i=c,s=o,a=r;break;case 4:i=o,s=c,a=r;break;case 5:i=r,s=c,a=o}return[255*i,255*s,255*a]},Ii.cmyk.rgb=function(e){var t=e[0]/100,r=e[1]/100,n=e[2]/100,o=e[3]/100;return[255*(1-Math.min(1,t*(1-o)+o)),255*(1-Math.min(1,r*(1-o)+o)),255*(1-Math.min(1,n*(1-o)+o))]},Ii.xyz.rgb=function(e){var t,r,n,o=e[0]/100,i=e[1]/100,s=e[2]/100;return r=-.9689*o+1.8758*i+.0415*s,n=.0557*o+-.204*i+1.057*s,t=(t=3.2406*o+-1.5372*i+-.4986*s)>.0031308?1.055*Math.pow(t,1/2.4)-.055:12.92*t,r=r>.0031308?1.055*Math.pow(r,1/2.4)-.055:12.92*r,n=n>.0031308?1.055*Math.pow(n,1/2.4)-.055:12.92*n,[255*(t=Math.min(Math.max(0,t),1)),255*(r=Math.min(Math.max(0,r),1)),255*(n=Math.min(Math.max(0,n),1))]},Ii.xyz.lab=function(e){var t=e[0],r=e[1],n=e[2];return r/=100,n/=108.883,t=(t/=95.047)>.008856?Math.pow(t,1/3):7.787*t+16/116,[116*(r=r>.008856?Math.pow(r,1/3):7.787*r+16/116)-16,500*(t-r),200*(r-(n=n>.008856?Math.pow(n,1/3):7.787*n+16/116))]},Ii.lab.xyz=function(e){var t,r,n,o=e[0];t=e[1]/500+(r=(o+16)/116),n=r-e[2]/200;var i=Math.pow(r,3),s=Math.pow(t,3),a=Math.pow(n,3);return r=i>.008856?i:(r-16/116)/7.787,t=s>.008856?s:(t-16/116)/7.787,n=a>.008856?a:(n-16/116)/7.787,[t*=95.047,r*=100,n*=108.883]},Ii.lab.lch=function(e){var t,r=e[0],n=e[1],o=e[2];return(t=360*Math.atan2(o,n)/2/Math.PI)<0&&(t+=360),[r,Math.sqrt(n*n+o*o),t]},Ii.lch.lab=function(e){var t,r=e[0],n=e[1];return t=e[2]/360*2*Math.PI,[r,n*Math.cos(t),n*Math.sin(t)]},Ii.rgb.ansi16=function(e){var t=e[0],r=e[1],n=e[2],o=1 in arguments?arguments[1]:Ii.rgb.hsv(e)[2];if(0===(o=Math.round(o/50)))return 30;var i=30+(Math.round(n/255)<<2|Math.round(r/255)<<1|Math.round(t/255));return 2===o&&(i+=60),i},Ii.hsv.ansi16=function(e){return Ii.rgb.ansi16(Ii.hsv.rgb(e),e[2])},Ii.rgb.ansi256=function(e){var t=e[0],r=e[1],n=e[2];return t===r&&r===n?t<8?16:t>248?231:Math.round((t-8)/247*24)+232:16+36*Math.round(t/255*5)+6*Math.round(r/255*5)+Math.round(n/255*5)},Ii.ansi16.rgb=function(e){var t=e%10;if(0===t||7===t)return e>50&&(t+=3.5),[t=t/10.5*255,t,t];var r=.5*(1+~~(e>50));return[(1&t)*r*255,(t>>1&1)*r*255,(t>>2&1)*r*255]},Ii.ansi256.rgb=function(e){if(e>=232){var t=10*(e-232)+8;return[t,t,t]}var r;return e-=16,[Math.floor(e/36)/5*255,Math.floor((r=e%36)/6)/5*255,r%6/5*255]},Ii.rgb.hex=function(e){var t=(((255&Math.round(e[0]))<<16)+((255&Math.round(e[1]))<<8)+(255&Math.round(e[2]))).toString(16).toUpperCase();return"000000".substring(t.length)+t},Ii.hex.rgb=function(e){var t=e.toString(16).match(/[a-f0-9]{6}|[a-f0-9]{3}/i);if(!t)return[0,0,0];var r=t[0];3===t[0].length&&(r=r.split("").map((function(e){return e+e})).join(""));var n=parseInt(r,16);return[n>>16&255,n>>8&255,255&n]},Ii.rgb.hcg=function(e){var t,r=e[0]/255,n=e[1]/255,o=e[2]/255,i=Math.max(Math.max(r,n),o),s=Math.min(Math.min(r,n),o),a=i-s;return t=a<=0?0:i===r?(n-o)/a%6:i===n?2+(o-r)/a:4+(r-n)/a+4,t/=6,[360*(t%=1),100*a,100*(a<1?s/(1-a):0)]},Ii.hsl.hcg=function(e){var t=e[1]/100,r=e[2]/100,n=1,o=0;return(n=r<.5?2*t*r:2*t*(1-r))<1&&(o=(r-.5*n)/(1-n)),[e[0],100*n,100*o]},Ii.hsv.hcg=function(e){var t=e[1]/100,r=e[2]/100,n=t*r,o=0;return n<1&&(o=(r-n)/(1-n)),[e[0],100*n,100*o]},Ii.hcg.rgb=function(e){var t=e[0]/360,r=e[1]/100,n=e[2]/100;if(0===r)return[255*n,255*n,255*n];var o,i=[0,0,0],s=t%1*6,a=s%1,u=1-a;switch(Math.floor(s)){case 0:i[0]=1,i[1]=a,i[2]=0;break;case 1:i[0]=u,i[1]=1,i[2]=0;break;case 2:i[0]=0,i[1]=1,i[2]=a;break;case 3:i[0]=0,i[1]=u,i[2]=1;break;case 4:i[0]=a,i[1]=0,i[2]=1;break;default:i[0]=1,i[1]=0,i[2]=u}return o=(1-r)*n,[255*(r*i[0]+o),255*(r*i[1]+o),255*(r*i[2]+o)]},Ii.hcg.hsv=function(e){var t=e[1]/100,r=t+e[2]/100*(1-t),n=0;return r>0&&(n=t/r),[e[0],100*n,100*r]},Ii.hcg.hsl=function(e){var t=e[1]/100,r=e[2]/100*(1-t)+.5*t,n=0;return r>0&&r<.5?n=t/(2*r):r>=.5&&r<1&&(n=t/(2*(1-r))),[e[0],100*n,100*r]},Ii.hcg.hwb=function(e){var t=e[1]/100,r=t+e[2]/100*(1-t);return[e[0],100*(r-t),100*(1-r)]},Ii.hwb.hcg=function(e){var t=e[1]/100,r=1-e[2]/100,n=r-t,o=0;return n<1&&(o=(r-n)/(1-n)),[e[0],100*n,100*o]},Ii.apple.rgb=function(e){return[e[0]/65535*255,e[1]/65535*255,e[2]/65535*255]},Ii.rgb.apple=function(e){return[e[0]/255*65535,e[1]/255*65535,e[2]/255*65535]},Ii.gray.rgb=function(e){return[e[0]/100*255,e[0]/100*255,e[0]/100*255]},Ii.gray.hsl=Ii.gray.hsv=function(e){return[0,0,e[0]]},Ii.gray.hwb=function(e){return[0,100,e[0]]},Ii.gray.cmyk=function(e){return[0,0,0,e[0]]},Ii.gray.lab=function(e){return[e[0],0,0]},Ii.gray.hex=function(e){var t=255&Math.round(e[0]/100*255),r=((t<<16)+(t<<8)+t).toString(16).toUpperCase();return"000000".substring(r.length)+r},Ii.rgb.gray=function(e){return[(e[0]+e[1]+e[2])/3/255*100]};var ki=vi.exports;function Oi(e){var t=function(){for(var e={},t=Object.keys(ki),r=t.length,n=0;n<r;n++)e[t[n]]={distance:-1,parent:null};return e}(),r=[e];for(t[e].distance=0;r.length;)for(var n=r.pop(),o=Object.keys(ki[n]),i=o.length,s=0;s<i;s++){var a=o[s],u=t[a];-1===u.distance&&(u.distance=t[n].distance+1,u.parent=n,r.unshift(a))}return t}function Si(e,t){return function(r){return t(e(r))}}function Ui(e,t){for(var r=[t[e].parent,e],n=ki[t[e].parent][e],o=t[e].parent;t[o].parent;)r.unshift(t[o].parent),n=Si(ki[t[o].parent][o],n),o=t[o].parent;return n.conversion=r,n}var _i=vi.exports,Ni=function(e){for(var t=Oi(e),r={},n=Object.keys(t),o=n.length,i=0;i<o;i++){var s=n[i];null!==t[s].parent&&(r[s]=Ui(s,t))}return r},Ai={};Object.keys(_i).forEach((function(e){Ai[e]={},Object.defineProperty(Ai[e],"channels",{value:_i[e].channels}),Object.defineProperty(Ai[e],"labels",{value:_i[e].labels});var t=Ni(e);Object.keys(t).forEach((function(r){var n=t[r];Ai[e][r]=function(e){var t=function(t){if(null==t)return t;arguments.length>1&&(t=Array.prototype.slice.call(arguments));var r=e(t);if("object"==typeof r)for(var n=r.length,o=0;o<n;o++)r[o]=Math.round(r[o]);return r};return"conversion"in e&&(t.conversion=e.conversion),t}(n),Ai[e][r].raw=function(e){var t=function(t){return null==t?t:(arguments.length>1&&(t=Array.prototype.slice.call(arguments)),e(t))};return"conversion"in e&&(t.conversion=e.conversion),t}(n)}))}));var Ri=Ai;!function(e){const t=Ri,r=(e,r)=>function(){const n=e.apply(t,arguments);return`[${n+r}m`},n=(e,r)=>function(){const n=e.apply(t,arguments);return`[${38+r};5;${n}m`},o=(e,r)=>function(){const n=e.apply(t,arguments);return`[${38+r};2;${n[0]};${n[1]};${n[2]}m`};Object.defineProperty(e,"exports",{enumerable:!0,get:function(){const e=new Map,i={modifier:{reset:[0,0],bold:[1,22],dim:[2,22],italic:[3,23],underline:[4,24],inverse:[7,27],hidden:[8,28],strikethrough:[9,29]},color:{black:[30,39],red:[31,39],green:[32,39],yellow:[33,39],blue:[34,39],magenta:[35,39],cyan:[36,39],white:[37,39],gray:[90,39],redBright:[91,39],greenBright:[92,39],yellowBright:[93,39],blueBright:[94,39],magentaBright:[95,39],cyanBright:[96,39],whiteBright:[97,39]},bgColor:{bgBlack:[40,49],bgRed:[41,49],bgGreen:[42,49],bgYellow:[43,49],bgBlue:[44,49],bgMagenta:[45,49],bgCyan:[46,49],bgWhite:[47,49],bgBlackBright:[100,49],bgRedBright:[101,49],bgGreenBright:[102,49],bgYellowBright:[103,49],bgBlueBright:[104,49],bgMagentaBright:[105,49],bgCyanBright:[106,49],bgWhiteBright:[107,49]}};i.color.grey=i.color.gray;for(const t of Object.keys(i)){const r=i[t];for(const t of Object.keys(r)){const n=r[t];i[t]={open:`[${n[0]}m`,close:`[${n[1]}m`},r[t]=i[t],e.set(n[0],n[1])}Object.defineProperty(i,t,{value:r,enumerable:!1}),Object.defineProperty(i,"codes",{value:e,enumerable:!1})}const s=e=>e,a=(e,t,r)=>[e,t,r];i.color.close="",i.bgColor.close="",i.color.ansi={ansi:r(s,0)},i.color.ansi256={ansi256:n(s,0)},i.color.ansi16m={rgb:o(a,0)},i.bgColor.ansi={ansi:r(s,10)},i.bgColor.ansi256={ansi256:n(s,10)},i.bgColor.ansi16m={rgb:o(a,10)};for(let e of Object.keys(t)){if("object"!=typeof t[e])continue;const s=t[e];"ansi16"===e&&(e="ansi"),"ansi16"in s&&(i.color.ansi[e]=r(s.ansi16,0),i.bgColor.ansi[e]=r(s.ansi16,10)),"ansi256"in s&&(i.color.ansi256[e]=n(s.ansi256,0),i.bgColor.ansi256[e]=n(s.ansi256,10)),"rgb"in s&&(i.color.ansi16m[e]=o(s.rgb,0),i.bgColor.ansi16m[e]=o(s.rgb,10))}return i}})}(bi);const Mi=y.default,Li=(e,t)=>{t=t||process.argv;const r=e.startsWith("-")?"":1===e.length?"-":"--",n=t.indexOf(r+e),o=t.indexOf("--");return-1!==n&&(-1===o||n<o)},Fi=process.env;let Pi;function ji(e){const t=function(e){if(!1===Pi)return 0;if(Li("color=16m")||Li("color=full")||Li("color=truecolor"))return 3;if(Li("color=256"))return 2;if(e&&!e.isTTY&&!0!==Pi)return 0;const t=Pi?1:0;if("win32"===process.platform){const e=Mi.release().split(".");return Number(process.versions.node.split(".")[0])>=8&&Number(e[0])>=10&&Number(e[2])>=10586?Number(e[2])>=14931?3:2:1}if("CI"in Fi)return["TRAVIS","CIRCLECI","APPVEYOR","GITLAB_CI"].some((e=>e in Fi))||"codeship"===Fi.CI_NAME?1:t;if("TEAMCITY_VERSION"in Fi)return/^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.test(Fi.TEAMCITY_VERSION)?1:0;if("truecolor"===Fi.COLORTERM)return 3;if("TERM_PROGRAM"in Fi){const e=parseInt((Fi.TERM_PROGRAM_VERSION||"").split(".")[0],10);switch(Fi.TERM_PROGRAM){case"iTerm.app":return e>=3?3:2;case"Apple_Terminal":return 2}}return/-256(color)?$/i.test(Fi.TERM)?2:/^screen|^xterm|^vt100|^vt220|^rxvt|color|ansi|cygwin|linux/i.test(Fi.TERM)||"COLORTERM"in Fi?1:(Fi.TERM,t)}(e);return function(e){return 0!==e&&{level:e,hasBasic:!0,has256:e>=2,has16m:e>=3}}(t)}Li("no-color")||Li("no-colors")||Li("color=false")?Pi=!1:(Li("color")||Li("colors")||Li("color=true")||Li("color=always"))&&(Pi=!0),"FORCE_COLOR"in Fi&&(Pi=0===Fi.FORCE_COLOR.length||0!==parseInt(Fi.FORCE_COLOR,10));var Di={supportsColor:ji,stdout:ji(process.stdout),stderr:ji(process.stderr)};const qi=/(?:\\(u[a-f\d]{4}|x[a-f\d]{2}|.))|(?:\{(~)?(\w+(?:\([^)]*\))?(?:\.\w+(?:\([^)]*\))?)*)(?:[ \t]|(?=\r?\n)))|(\})|((?:.|[\r\n\f])+?)/gi,$i=/(?:^|\.)(\w+)(?:\(([^)]*)\))?/g,Hi=/^(['"])((?:\\.|(?!\1)[^\\])*)\1$/,zi=/\\(u[a-f\d]{4}|x[a-f\d]{2}|.)|([^\\])/gi,Gi=new Map([["n","\n"],["r","\r"],["t","\t"],["b","\b"],["f","\f"],["v","\v"],["0","\0"],["\\","\\"],["e",""],["a",""]]);function Ki(e){return"u"===e[0]&&5===e.length||"x"===e[0]&&3===e.length?String.fromCharCode(parseInt(e.slice(1),16)):Gi.get(e)||e}function Vi(e,t){const r=[],n=t.trim().split(/\s*,\s*/g);let o;for(const t of n)if(isNaN(t)){if(!(o=t.match(Hi)))throw new Error(`Invalid Chalk template style argument: ${t} (in style '${e}')`);r.push(o[2].replace(zi,((e,t,r)=>t?Ki(t):r)))}else r.push(Number(t));return r}function Qi(e){$i.lastIndex=0;const t=[];let r;for(;null!==(r=$i.exec(e));){const e=r[1];if(r[2]){const n=Vi(e,r[2]);t.push([e].concat(n))}else t.push([e])}return t}function Wi(e,t){const r={};for(const e of t)for(const t of e.styles)r[t[0]]=e.inverse?null:t.slice(1);let n=e;for(const e of Object.keys(r))if(Array.isArray(r[e])){if(!(e in n))throw new Error(`Unknown Chalk style: ${e}`);n=r[e].length>0?n[e].apply(n,r[e]):n[e]}return n}var Yi=(e,t)=>{const r=[],n=[];let o=[];if(t.replace(qi,((t,i,s,a,u,c)=>{if(i)o.push(Ki(i));else if(a){const t=o.join("");o=[],n.push(0===r.length?t:Wi(e,r)(t)),r.push({inverse:s,styles:Qi(a)})}else if(u){if(0===r.length)throw new Error("Found extraneous } in Chalk template literal");n.push(Wi(e,r)(o.join(""))),o=[],r.pop()}else o.push(c)})),n.push(o.join("")),r.length>0){const e=`Chalk template literal is missing ${r.length} closing bracket${1===r.length?"":"s"} (\`}\`)`;throw new Error(e)}return n.join("")};!function(e){const t=mi,r=bi.exports,n=Di.stdout,o=Yi,i="win32"===process.platform&&!(process.env.TERM||"").toLowerCase().startsWith("xterm"),s=["ansi","ansi","ansi256","ansi16m"],a=new Set(["gray"]),u=Object.create(null);function c(e,t){t=t||{};const r=n?n.level:0;e.level=void 0===t.level?r:t.level,e.enabled="enabled"in t?t.enabled:e.level>0}function l(e){if(!this||!(this instanceof l)||this.template){const t={};return c(t,e),t.template=function(){const e=[].slice.call(arguments);return p.apply(null,[t.template].concat(e))},Object.setPrototypeOf(t,l.prototype),Object.setPrototypeOf(t.template,t),t.template.constructor=l,t.template}c(this,e)}i&&(r.blue.open="");for(const e of Object.keys(r))r[e].closeRe=new RegExp(t(r[e].close),"g"),u[e]={get(){const t=r[e];return h.call(this,this._styles?this._styles.concat(t):[t],this._empty,e)}};u.visible={get(){return h.call(this,this._styles||[],!0,"visible")}},r.color.closeRe=new RegExp(t(r.color.close),"g");for(const e of Object.keys(r.color.ansi))a.has(e)||(u[e]={get(){const t=this.level;return function(){const n=r.color[s[t]][e].apply(null,arguments),o={open:n,close:r.color.close,closeRe:r.color.closeRe};return h.call(this,this._styles?this._styles.concat(o):[o],this._empty,e)}}});r.bgColor.closeRe=new RegExp(t(r.bgColor.close),"g");for(const e of Object.keys(r.bgColor.ansi)){if(a.has(e))continue;u["bg"+e[0].toUpperCase()+e.slice(1)]={get(){const t=this.level;return function(){const n=r.bgColor[s[t]][e].apply(null,arguments),o={open:n,close:r.bgColor.close,closeRe:r.bgColor.closeRe};return h.call(this,this._styles?this._styles.concat(o):[o],this._empty,e)}}}}const f=Object.defineProperties((()=>{}),u);function h(e,t,r){const n=function(){return d.apply(n,arguments)};n._styles=e,n._empty=t;const o=this;return Object.defineProperty(n,"level",{enumerable:!0,get:()=>o.level,set(e){o.level=e}}),Object.defineProperty(n,"enabled",{enumerable:!0,get:()=>o.enabled,set(e){o.enabled=e}}),n.hasGrey=this.hasGrey||"gray"===r||"grey"===r,n.__proto__=f,n}function d(){const e=arguments,t=e.length;let n=String(arguments[0]);if(0===t)return"";if(t>1)for(let r=1;r<t;r++)n+=" "+e[r];if(!this.enabled||this.level<=0||!n)return this._empty?"":n;const o=r.dim.open;i&&this.hasGrey&&(r.dim.open="");for(const e of this._styles.slice().reverse())n=e.open+n.replace(e.closeRe,e.open)+e.close,n=n.replace(/\r?\n/g,`${e.close}$&${e.open}`);return r.dim.open=o,n}function p(e,t){if(!Array.isArray(t))return[].slice.call(arguments,1).join(" ");const r=[].slice.call(arguments,2),n=[t.raw[0]];for(let e=1;e<t.length;e++)n.push(String(r[e-1]).replace(/[{}\\]/g,"\\$&")),n.push(String(t.raw[e]));return o(e,n.join(""))}Object.defineProperties(l.prototype,u),e.exports=l(),e.exports.supportsColor=n,e.exports.default=e.exports}(pi);var Ji=pi.exports;class Xi extends Error{}class Zi extends Error{}let es,ts=!1;"object"!=typeof global.crypto&&(global.crypto={}),"function"!=typeof global.crypto.getRandomValues&&(global.crypto.getRandomValues=function(e){if(!(e instanceof Int8Array||e instanceof Uint8Array||e instanceof Int16Array||e instanceof Uint16Array||e instanceof Int32Array||e instanceof Uint32Array||e instanceof Uint8ClampedArray))throw new Xi("Expected an integer array");if(e.byteLength>65536)throw new Zi("Can only request a maximum of 65536 bytes");return void 0===global.nativeCallSyncHook?function(e){ts||(console.warn("WARNING: Using an insecure random number generator, as there is no support for crypto.getRandomValues in node native and we do not need it anyway for unique IDs in ColaboFlow messaging identification"),ts=!0);for(let t,r=0;r<e.length;r++)0==(3&r)&&(t=4294967296*Math.random()),e[r]=t>>>((3&r)<<3)&255;return e}(e):e});const rs=new Uint8Array(16);function ns(){if(!es&&(es="undefined"!=typeof crypto&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto),!es))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return es(rs)}const os=[];for(let e=0;e<256;++e)os.push((e+256).toString(16).slice(1));let is,ss,as=0,us=0;function cs(e,t,r){let n=t&&r||0;const o=t||new Array(16);let i=(e=e||{}).node||is,s=void 0!==e.clockseq?e.clockseq:ss;if(null==i||null==s){const t=e.random||(e.rng||ns)();null==i&&(i=is=[1|t[0],t[1],t[2],t[3],t[4],t[5]]),null==s&&(s=ss=16383&(t[6]<<8|t[7]))}let a=void 0!==e.msecs?e.msecs:Date.now(),u=void 0!==e.nsecs?e.nsecs:us+1;const c=a-as+(u-us)/1e4;if(c<0&&void 0===e.clockseq&&(s=s+1&16383),(c<0||a>as)&&void 0===e.nsecs&&(u=0),u>=1e4)throw new Error("uuid.v1(): Can't create more than 10M uuids/sec");as=a,us=u,ss=s,a+=122192928e5;const l=(1e4*(268435455&a)+u)%4294967296;o[n++]=l>>>24&255,o[n++]=l>>>16&255,o[n++]=l>>>8&255,o[n++]=255&l;const f=a/4294967296*1e4&268435455;o[n++]=f>>>8&255,o[n++]=255&f,o[n++]=f>>>24&15|16,o[n++]=f>>>16&255,o[n++]=s>>>8|128,o[n++]=255&s;for(let e=0;e<6;++e)o[n+e]=i[e];return t||function(e,t=0){return(os[e[t+0]]+os[e[t+1]]+os[e[t+2]]+os[e[t+3]]+"-"+os[e[t+4]]+os[e[t+5]]+"-"+os[e[t+6]]+os[e[t+7]]+"-"+os[e[t+8]]+os[e[t+9]]+"-"+os[e[t+10]]+os[e[t+11]]+os[e[t+12]]+os[e[t+13]]+os[e[t+14]]+os[e[t+15]]).toLowerCase()}(o)}const ls=(e,t)=>({id:`ColaboFlow-msg:${cs()}`,requestId:`ColaboFlow-request:${cs()}`,sender:e,proxies:[],msgReplyChainIds:[],type:t});var fs;exports.EColaboFlowGoMsgType=void 0,(fs=exports.EColaboFlowGoMsgType||(exports.EColaboFlowGoMsgType={})).TASK_EXECUTE_REQUEST="TASK_EXECUTE_REQUEST",fs.TASK_EXECUTE_PROGRESS="TASK_EXECUTE_PROGRESS",fs.TASK_EXECUTE_RESPONSE="TASK_EXECUTE_RESPONSE",fs.TASK_INSTANCES_REPORT__REQUEST="TASK_INSTANCES_REPORT__REQUEST",fs.TASK_INSTANCES_REPORT__RESPONSE="TASK_INSTANCES_REPORT__RESPONSE",fs.HEARTBEAT="HEARTBEAT";var hs;exports.EProgrammingLanguageSupported=void 0,(hs=exports.EProgrammingLanguageSupported||(exports.EProgrammingLanguageSupported={})).JAVASCRIPT="JAVASCRIPT",hs.PYTHON="PYTHON",hs.NATIVE="NATIVE",exports.ETaskExecute_Progress_Status=void 0,(exports.ETaskExecute_Progress_Status||(exports.ETaskExecute_Progress_Status={})).INITIALIZED="INITIALIZED";process.title="ColaboFlow.Go.Orchestrator";const ds=`[${Ji.red.bold("Colabo")}${Ji.blue.bold("Flow")}${Ji.green.bold(".Go")}${Ji.green.yellow(".Orchestrator")}]`,ps=async e=>{console.log(`${ds} Listening on the orchestrator queue: "${Ji.blueBright(e.queueOrchestrator)}"`),console.log(`${ds} [*] Waiting for orchestrator messages. To exit press "${Ji.blueBright("CTRL+C")}"`),e.clientsChannel.consume(e.queueOrchestrator,(t=>{if(null!==t){let r;try{if(r=JSON.parse(t.content.toString()),console.log(`${ds} msgObj.sender: "${Ji.blueBright(r.sender)}", msgObj.msg: "${Ji.blueBright(r.msg)}"`),r.type===exports.EColaboFlowGoMsgType.TASK_EXECUTE_REQUEST)(async(e,t)=>{const r=t.extension,n=r.taskId;console.log(`${ds} Executing task taskId: "${Ji.blueBright(n)}"`);const o=`orchestrator-task_execute_response-${cs()}`,i=e.hostsForTaskIds[n];if(!i||i.length<=0)return void console.error(`${ds} Error, there is no host implementing the task: "${n}"`);let s;if(r?.options?.hosts?.hostNames){console.info(`${ds} Client requested for the task "${n}" to be executed across one of the following hostNames: ${r?.options?.hosts?.hostNames}.`);for(const e of r.options.hosts.hostNames)if(i.indexOf(e)>=0){s=e;break}if(s)console.info(`${ds} We found the host implementing the task: "${n}" that matches the requested hosts hostNames: ${s}.`);else{if(r.options.hosts.runOnlyOnEnlistedHosts)return void console.error(`${ds} Error, there is no host implementing the task: "${n}" that matches the requested hosts hostNames: ${r.options.hosts.hostNames}`);s=i[0],console.info(`${ds} There is no host implementing the task: "${n}" that matches the requested hosts hostNames: ${r.options.hosts.hostNames}. Instead using the first availabile host: ${s}`)}}else s=i[0],console.info(`${ds} There are no preferences for a host implementing the task: "${n}" Using the first available host: ${s}.`);const a=e.hosts[s];console.log(`${ds} Delivering the task "${Ji.blueBright(n)}" to host "${Ji.blueBright(s)}" via queue "${Ji.blueBright(a.queueHost)}" and listening for the response on the queue: "${Ji.blueBright(o)}"`);const u={...ls(e.orchestratorName,exports.EColaboFlowGoMsgType.TASK_EXECUTE_REQUEST),replyTo:o,extension:r,msg:"run a ffmepg test task"};console.log(`${ds} Creating the task execution response queue: "${Ji.blueBright(o)}" ...`),await e.hostsChannel.assertQueue(o,{exclusive:!0}),e.hostsChannel.consume(o,(function(r){let i;console.log(`${ds} Task Execution reply on the queue: "${Ji.blueBright(o)}" for the taskId: "${Ji.blueBright(n)}"`);try{i=JSON.parse(r.content.toString())}catch(e){return void console.error(`Error parsing the message: ${r.content}`)}switch(i.type){case exports.EColaboFlowGoMsgType.TASK_EXECUTE_PROGRESS:const r=i.extension;console.log(`${ds} Task Execution PROGRESS: ${JSON.stringify(r)}`);break;case exports.EColaboFlowGoMsgType.TASK_EXECUTE_RESPONSE:const n=i.extension;if(console.log(`${ds} Task Execution RESPONSE: ${JSON.stringify(n.taskOutput)}`),!t.replyTo)return void console.error(`${ds} replyTo is missing in the msgClientReqObj [msgClientReqObj.id: "${Ji.blueBright(t.id)}"]`);const o=t.replyTo,s={...ls(e.orchestratorName,exports.EColaboFlowGoMsgType.TASK_EXECUTE_RESPONSE),requestId:t.requestId,msgReplyChainIds:[t.id],extension:n,msg:"Host with tasks"};console.log(`${ds} Sending the task Execution response back to the client "${Ji.blueBright(t.sender)}" through queue: "${Ji.blueBright(o)}"`),e.clientsChannel.sendToQueue(o,Buffer.from(JSON.stringify(s)))}}),{noAck:!0}),console.log(`${ds} Listening on the queue: "${Ji.blueBright(o)}" for the execution response for the task "${Ji.blueBright(n)}"`),e.hostsChannel.sendToQueue(a.queueHost,Buffer.from(JSON.stringify(u)))})(e,r)}catch(e){console.error(`Error parsing the message: ${t.content}`)}e.clientsChannel.ack(t)}else console.log("${appNameText} Consumer cancelled by server")}))},gs=async e=>{console.log(`${ds} Listening on the heartbeat queue: "${Ji.blueBright(e.queueHostHeartbeat)}"`),console.log(`${ds} [*] Waiting for heartbeat messages. To exit press "${Ji.blueBright("CTRL+C")}"`),e.clientsChannel.consume(e.queueHostHeartbeat,(t=>{if(null!==t){let r;try{if(r=JSON.parse(t.content.toString()),r.type===exports.EColaboFlowGoMsgType.HEARTBEAT)(async(e,t)=>{const r=t.extension,n=t.sender;n in e.hosts||(console.log(`${ds} Discovered a new host: "${Ji.blueBright(n)}" with the tasks available: ${Ji.blueBright(JSON.stringify(r.taskIds))}`),e.hosts[n]={hostName:n,queueHost:r.queueHost,taskIdsAvailable:[],taskInstanceIds:[]});const o=e.hosts[n],i=o.taskIdsAvailable.filter((e=>r.taskIds.indexOf(e)<0));i.length&&console.log(`${ds} The host: "${Ji.blueBright(n)}" doesn't offers anymore the following tasks: ${Ji.blueBright(JSON.stringify(i))}`);for(const t of i){const r=e.hostsForTaskIds[t];if(!Array.isArray(r))return;var s=r.indexOf(n);-1!==s&&r.splice(s,1)}const a=r.taskIds.filter((e=>o.taskIdsAvailable.indexOf(e)<0));a.length&&console.log(`${ds} The host: "${Ji.blueBright(n)}" offers now the additional tasks: ${Ji.blueBright(JSON.stringify(a))}`),o.taskIdsAvailable=r.taskIds;for(const t of a)e.hostsForTaskIds[t]||(e.hostsForTaskIds[t]=[]),e.hostsForTaskIds[t].indexOf(n)<0&&e.hostsForTaskIds[t].push(n);e.reportsConfig.showHeartbeatMsgs&&r.id%e.reportsConfig.showHeartbeatMsgs==0&&console.log(`${ds} Received heartbeat: hostName: "${Ji.blueBright(n)}", id: ${r.id}`)})(e,r)}catch(e){console.error(`Error parsing the message: ${t.content}`)}e.clientsChannel.ack(t)}else console.log("${appNameText} Consumer cancelled by server")}))};var ms,bs=new Uint8Array(16);function vs(){if(!ms&&!(ms="undefined"!=typeof crypto&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto)||"undefined"!=typeof msCrypto&&"function"==typeof msCrypto.getRandomValues&&msCrypto.getRandomValues.bind(msCrypto)))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return ms(bs)}var ys=/^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000)$/i;function ws(e){return"string"==typeof e&&ys.test(e)}for(var Es,Is,Cs=[],xs=0;xs<256;++xs)Cs.push((xs+256).toString(16).substr(1));var Bs,Ts,ks,Os,Ss,Us,_s,Ns,As,Rs,Ms,Ls,Fs,Ps,js,Ds,qs,$s,Hs,zs=0,Gs=0;function Ks(e,t,r){var n=t&&r||0,o=t||new Array(16),i=(e=e||{}).node||Es,s=void 0!==e.clockseq?e.clockseq:Is;if(null==i||null==s){var a=e.random||(e.rng||vs)();null==i&&(i=Es=[1|a[0],a[1],a[2],a[3],a[4],a[5]]),null==s&&(s=Is=16383&(a[6]<<8|a[7]))}var u=void 0!==e.msecs?e.msecs:Date.now(),c=void 0!==e.nsecs?e.nsecs:Gs+1,l=u-zs+(c-Gs)/1e4;if(l<0&&void 0===e.clockseq&&(s=s+1&16383),(l<0||u>zs)&&void 0===e.nsecs&&(c=0),c>=1e4)throw new Error("uuid.v1(): Can't create more than 10M uuids/sec");zs=u,Gs=c,Is=s;var f=(1e4*(268435455&(u+=122192928e5))+c)%4294967296;o[n++]=f>>>24&255,o[n++]=f>>>16&255,o[n++]=f>>>8&255,o[n++]=255&f;var h=u/4294967296*1e4&268435455;o[n++]=h>>>8&255,o[n++]=255&h,o[n++]=h>>>24&15|16,o[n++]=h>>>16&255,o[n++]=s>>>8|128,o[n++]=255&s;for(var d=0;d<6;++d)o[n+d]=i[d];return t||function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,r=(Cs[e[t+0]]+Cs[e[t+1]]+Cs[e[t+2]]+Cs[e[t+3]]+"-"+Cs[e[t+4]]+Cs[e[t+5]]+"-"+Cs[e[t+6]]+Cs[e[t+7]]+"-"+Cs[e[t+8]]+Cs[e[t+9]]+"-"+Cs[e[t+10]]+Cs[e[t+11]]+Cs[e[t+12]]+Cs[e[t+13]]+Cs[e[t+14]]+Cs[e[t+15]]).toLowerCase();if(!ws(r))throw TypeError("Stringified UUID is invalid");return r}(o)}!function(e){e.UNKNOWN="UNKNOWN",e.LOCAL="LOCAL",e.STORE="STORE",e.LOCAL_TIER="LOCAL_TIER",e.REMOTE_TIER="REMOTE_TIER",e.INTERACTIVE="INTERACTIVE"}(Bs||(Bs={})),function(e){e.ISOMORPHIC="ISOMORPHIC",e.FRONTEND="FRONTEND",e.BACKEND="BACKEND"}(Ts||(Ts={})),function(e){e.WAITING="WAITING",e.RUNNING="RUNNING",e.FINISHED="FINISHED",e.FAILED_SYSTEM="FAILED.SYSTEM",e.FAILED_ENGINE="FAILED.ENGINE",e.FAILED_FLOW="FAILED.FLOW",e.FAILED_TASK="FAILED.TASK",e.FAILED_USER="FAILED.USER"}(ks||(ks={})),function(e){e.WAITING="WAITING",e.PASSED_THROUGH="PASSED_THROUGH",e.CONDITION_NOT_FULFILLED="CONDITION_NOT_FULFILLED"}(Os||(Os={})),function(e){e.WAITING="WAITING",e.PASSED_THROUGH="PASSED_THROUGH",e.CONDITION_NOT_FULFILLED="CONDITION_NOT_FULFILLED"}(Ss||(Ss={})),function(e){e.WAITING="WAITING",e.PASSED_THROUGH="PASSED_THROUGH",e.CONDITION_NOT_FULFILLED="CONDITION_NOT_FULFILLED"}(Us||(Us={})),function(e){e.JUST_ENTERED="JUST_ENTERED",e.INITIATED="INITIATED",e.RUNNING="RUNNING",e.FINISHED="FINISHED",e.RESULTS_STORING="RESULTS_STORING",e.RESULTS_STORED="RESULTS_STORED",e.LEAVING="LEAVING",e.LEFT="LEFT"}(_s||(_s={})),function(e){e.TICK="tick",e.MICRO_TICK="microTick",e.BREAKPOINT="breakpoint"}(Ns||(Ns={})),function(e){e.FULL="FULL",e.CONDENSED="CONDENSED",e.NO="NO"}(As||(As={})),function(e){e.TASK="TASK",e.EVENT="EVENT",e.GATEWAY="GATEWAY"}(Rs||(Rs={})),function(e){e.EVENT_START="event.start",e.EVENT_END="event.end"}(Ms||(Ms={})),function(e){e.IN="IN",e.OUT="OUT",e.INOUT="INOUT"}(Ls||(Ls={})),function(e){e.DEFAULT="colabo.flow:default",e.EVENT_START="colabo.flow:event.start",e.EVENT_END="colabo.flow:event.end"}(Fs||(Fs={})),function(e){e.REGULAR="TASK.REGULAR",e.LOOP="TASK.LOOP",e.MULTIPLE_PARALLEL="TASK.MULTIPLE_PARALLEL",e.MULTIPLE_SEQUENTIAL="TASK.MULTIPLE_SEQUENTIAL",e.COMPENSATION="TASK.COMPENSATION",e.COMPENSATION_LOOP="TASK.COMPENSATION_LOOP",e.SUBPROCESS="TASK.SUBPROCESS",e.SUBPROCESS_LOOP="TASK.SUBPROCESS_LOOP",e.SUBPROCESS_MULTIPLE_PARALLEL="TASK.SUBPROCESS_MULTIPLE_PARALLEL",e.SUBPROCESS_MULTIPLE_SEQUENTIAL="TASK.SUBPROCESS_MULTIPLE_SEQUENTIAL",e.SUBPROCESS_COMPENSATION="TASK.SUBPROCESS_COMPENSATION",e.SUBPROCESS_ADHOC="TASK.SUBPROCESS_ADHOC",e.SUBPROCESS_EVENT="TASK.SUBPROCESS_EVENT",e.TRANSACTION="TASK.TRANSACTION",e.CALL_ACTIVITY="TASK.CALL_ACTIVITY",e.BUSINESS_RULE="TASK.BUSINESS_RULE",e.MANUAL="TASK.MANUAL",e.RECEIVE="TASK.RECEIVE",e.SCRIPT="TASK.SCRIPT",e.SEND="TASK.SEND",e.SERVICE="TASK.SERVICE",e.USER="TASK.USER"}(Ps||(Ps={})),function(e){e.START="EVENT.START",e.INTERMEDIATE="EVENT.INTERMEDIATE",e.END="EVENT.END"}(js||(js={})),function(e){e.EXCLUSIVE="GATEWAY.EXCLUSIVE",e.EVENT_BASED="GATEWAY.EVENT_BASED",e.PARALLEL="GATEWAY.PARALLEL",e.PARALLEL_EVENT_BASED="GATEWAY.PARALLEL_EVENT_BASED ",e.INCLUSIVE="GATEWAY.INCLUSIVE",e.COMPLEX="GATEWAY.COMPLEX"}(Ds||(Ds={})),function(e){e.NOT_EXECUTED="NOT_EXECUTED",e.EXECUTED="EXECUTED",e.PAUSED="PAUSED",e.INTERRUPTED="INTERRUPTED",e.FAILED="FAILED",e.EXECUTOR_NOT_FOUND="EXECUTOR_NOT_FOUND"}(qs||(qs={})),function(e){e.UNKNOWN="UNKNOWN",e.RUNNING="RUNNING",e.EXECUTED="EXECUTED",e.PAUSED="PAUSED",e.INTERRUPTED="INTERRUPTED",e.FAILED="FAILED",e.EXECUTOR_NOT_FOUND="EXECUTOR_NOT_FOUND"}($s||($s={})),function(e){e.BACKEND="backend",e.FRONTEND_VANILLA="frontend_vanilla",e.FRONTEND_ANGULAR="frontend_angular"}(Hs||(Hs={})),Hs.BACKEND;var Vs=function(e,t){return Vs=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r])},Vs(e,t)};function Qs(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function r(){this.constructor=e}Vs(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)}function Ws(e){return"function"==typeof e}console.log("[NgLess::Injectable] declaring ... "),console.log("[NgLess::Injectable] declared ");var Ys=!1,Js={Promise:void 0,set useDeprecatedSynchronousErrorHandling(e){e&&(new Error).stack,Ys=e},get useDeprecatedSynchronousErrorHandling(){return Ys}};function Xs(e){setTimeout((function(){throw e}),0)}var Zs={closed:!0,next:function(e){},error:function(e){if(Js.useDeprecatedSynchronousErrorHandling)throw e;Xs(e)},complete:function(){}},ea=Array.isArray||function(e){return e&&"number"==typeof e.length};function ta(e){return null!==e&&"object"==typeof e}var ra=function(){function e(e){return Error.call(this),this.message=e?e.length+" errors occurred during unsubscription:\n"+e.map((function(e,t){return t+1+") "+e.toString()})).join("\n "):"",this.name="UnsubscriptionError",this.errors=e,this}return e.prototype=Object.create(Error.prototype),e}(),na=function(){function e(e){this.closed=!1,this._parentOrParents=null,this._subscriptions=null,e&&(this._ctorUnsubscribe=!0,this._unsubscribe=e)}return e.prototype.unsubscribe=function(){var t;if(!this.closed){var r=this,n=r._parentOrParents,o=r._ctorUnsubscribe,i=r._unsubscribe,s=r._subscriptions;if(this.closed=!0,this._parentOrParents=null,this._subscriptions=null,n instanceof e)n.remove(this);else if(null!==n)for(var a=0;a<n.length;++a)n[a].remove(this);if(Ws(i)){o&&(this._unsubscribe=void 0);try{i.call(this)}catch(e){t=e instanceof ra?oa(e.errors):[e]}}if(ea(s)){a=-1;for(var u=s.length;++a<u;){var c=s[a];if(ta(c))try{c.unsubscribe()}catch(e){t=t||[],e instanceof ra?t=t.concat(oa(e.errors)):t.push(e)}}}if(t)throw new ra(t)}},e.prototype.add=function(t){var r=t;if(!t)return e.EMPTY;switch(typeof t){case"function":r=new e(t);case"object":if(r===this||r.closed||"function"!=typeof r.unsubscribe)return r;if(this.closed)return r.unsubscribe(),r;if(!(r instanceof e)){var n=r;(r=new e)._subscriptions=[n]}break;default:throw new Error("unrecognized teardown "+t+" added to Subscription.")}var o=r._parentOrParents;if(null===o)r._parentOrParents=this;else if(o instanceof e){if(o===this)return r;r._parentOrParents=[o,this]}else{if(-1!==o.indexOf(this))return r;o.push(this)}var i=this._subscriptions;return null===i?this._subscriptions=[r]:i.push(r),r},e.prototype.remove=function(e){var t=this._subscriptions;if(t){var r=t.indexOf(e);-1!==r&&t.splice(r,1)}},e.EMPTY=function(e){return e.closed=!0,e}(new e),e}();function oa(e){return e.reduce((function(e,t){return e.concat(t instanceof ra?t.errors:t)}),[])}var ia="function"==typeof Symbol?Symbol("rxSubscriber"):"@@rxSubscriber_"+Math.random(),sa=function(e){function t(r,n,o){var i=e.call(this)||this;switch(i.syncErrorValue=null,i.syncErrorThrown=!1,i.syncErrorThrowable=!1,i.isStopped=!1,arguments.length){case 0:i.destination=Zs;break;case 1:if(!r){i.destination=Zs;break}if("object"==typeof r){r instanceof t?(i.syncErrorThrowable=r.syncErrorThrowable,i.destination=r,r.add(i)):(i.syncErrorThrowable=!0,i.destination=new aa(i,r));break}default:i.syncErrorThrowable=!0,i.destination=new aa(i,r,n,o)}return i}return Qs(t,e),t.prototype[ia]=function(){return this},t.create=function(e,r,n){var o=new t(e,r,n);return o.syncErrorThrowable=!1,o},t.prototype.next=function(e){this.isStopped||this._next(e)},t.prototype.error=function(e){this.isStopped||(this.isStopped=!0,this._error(e))},t.prototype.complete=function(){this.isStopped||(this.isStopped=!0,this._complete())},t.prototype.unsubscribe=function(){this.closed||(this.isStopped=!0,e.prototype.unsubscribe.call(this))},t.prototype._next=function(e){this.destination.next(e)},t.prototype._error=function(e){this.destination.error(e),this.unsubscribe()},t.prototype._complete=function(){this.destination.complete(),this.unsubscribe()},t.prototype._unsubscribeAndRecycle=function(){var e=this._parentOrParents;return this._parentOrParents=null,this.unsubscribe(),this.closed=!1,this.isStopped=!1,this._parentOrParents=e,this},t}(na),aa=function(e){function t(t,r,n,o){var i,s=e.call(this)||this;s._parentSubscriber=t;var a=s;return Ws(r)?i=r:r&&(i=r.next,n=r.error,o=r.complete,r!==Zs&&(Ws((a=Object.create(r)).unsubscribe)&&s.add(a.unsubscribe.bind(a)),a.unsubscribe=s.unsubscribe.bind(s))),s._context=a,s._next=i,s._error=n,s._complete=o,s}return Qs(t,e),t.prototype.next=function(e){if(!this.isStopped&&this._next){var t=this._parentSubscriber;Js.useDeprecatedSynchronousErrorHandling&&t.syncErrorThrowable?this.__tryOrSetError(t,this._next,e)&&this.unsubscribe():this.__tryOrUnsub(this._next,e)}},t.prototype.error=function(e){if(!this.isStopped){var t=this._parentSubscriber,r=Js.useDeprecatedSynchronousErrorHandling;if(this._error)r&&t.syncErrorThrowable?(this.__tryOrSetError(t,this._error,e),this.unsubscribe()):(this.__tryOrUnsub(this._error,e),this.unsubscribe());else if(t.syncErrorThrowable)r?(t.syncErrorValue=e,t.syncErrorThrown=!0):Xs(e),this.unsubscribe();else{if(this.unsubscribe(),r)throw e;Xs(e)}}},t.prototype.complete=function(){var e=this;if(!this.isStopped){var t=this._parentSubscriber;if(this._complete){var r=function(){return e._complete.call(e._context)};Js.useDeprecatedSynchronousErrorHandling&&t.syncErrorThrowable?(this.__tryOrSetError(t,r),this.unsubscribe()):(this.__tryOrUnsub(r),this.unsubscribe())}else this.unsubscribe()}},t.prototype.__tryOrUnsub=function(e,t){try{e.call(this._context,t)}catch(e){if(this.unsubscribe(),Js.useDeprecatedSynchronousErrorHandling)throw e;Xs(e)}},t.prototype.__tryOrSetError=function(e,t,r){if(!Js.useDeprecatedSynchronousErrorHandling)throw new Error("bad call");try{t.call(this._context,r)}catch(t){return Js.useDeprecatedSynchronousErrorHandling?(e.syncErrorValue=t,e.syncErrorThrown=!0,!0):(Xs(t),!0)}return!1},t.prototype._unsubscribe=function(){var e=this._parentSubscriber;this._context=null,this._parentSubscriber=null,e.unsubscribe()},t}(sa);function ua(e){for(;e;){var t=e,r=t.closed,n=t.destination,o=t.isStopped;if(r||o)return!1;e=n&&n instanceof sa?n:null}return!0}var ca="function"==typeof Symbol&&Symbol.observable||"@@observable";function la(e){return e}function fa(e){return 0===e.length?la:1===e.length?e[0]:function(t){return e.reduce((function(e,t){return t(e)}),t)}}var ha=function(){function e(e){this._isScalar=!1,e&&(this._subscribe=e)}return e.prototype.lift=function(t){var r=new e;return r.source=this,r.operator=t,r},e.prototype.subscribe=function(e,t,r){var n=this.operator,o=function(e,t,r){if(e){if(e instanceof sa)return e;if(e[ia])return e[ia]()}return e||t||r?new sa(e,t,r):new sa(Zs)}(e,t,r);if(n?o.add(n.call(o,this.source)):o.add(this.source||Js.useDeprecatedSynchronousErrorHandling&&!o.syncErrorThrowable?this._subscribe(o):this._trySubscribe(o)),Js.useDeprecatedSynchronousErrorHandling&&o.syncErrorThrowable&&(o.syncErrorThrowable=!1,o.syncErrorThrown))throw o.syncErrorValue;return o},e.prototype._trySubscribe=function(e){try{return this._subscribe(e)}catch(t){Js.useDeprecatedSynchronousErrorHandling&&(e.syncErrorThrown=!0,e.syncErrorValue=t),ua(e)?e.error(t):console.warn(t)}},e.prototype.forEach=function(e,t){var r=this;return new(t=da(t))((function(t,n){var o;o=r.subscribe((function(t){try{e(t)}catch(e){n(e),o&&o.unsubscribe()}}),n,t)}))},e.prototype._subscribe=function(e){var t=this.source;return t&&t.subscribe(e)},e.prototype[ca]=function(){return this},e.prototype.pipe=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return 0===e.length?this:fa(e)(this)},e.prototype.toPromise=function(e){var t=this;return new(e=da(e))((function(e,r){var n;t.subscribe((function(e){return n=e}),(function(e){return r(e)}),(function(){return e(n)}))}))},e.create=function(t){return new e(t)},e}();function da(e){if(e||(e=Js.Promise||Promise),!e)throw new Error("no Promise impl found");return e}var pa=function(){function e(){return Error.call(this),this.message="object unsubscribed",this.name="ObjectUnsubscribedError",this}return e.prototype=Object.create(Error.prototype),e}(),ga=function(e){function t(t,r){var n=e.call(this)||this;return n.subject=t,n.subscriber=r,n.closed=!1,n}return Qs(t,e),t.prototype.unsubscribe=function(){if(!this.closed){this.closed=!0;var e=this.subject,t=e.observers;if(this.subject=null,t&&0!==t.length&&!e.isStopped&&!e.closed){var r=t.indexOf(this.subscriber);-1!==r&&t.splice(r,1)}}},t}(na),ma=function(e){function t(t){var r=e.call(this,t)||this;return r.destination=t,r}return Qs(t,e),t}(sa),ba=function(e){function t(){var t=e.call(this)||this;return t.observers=[],t.closed=!1,t.isStopped=!1,t.hasError=!1,t.thrownError=null,t}return Qs(t,e),t.prototype[ia]=function(){return new ma(this)},t.prototype.lift=function(e){var t=new va(this,this);return t.operator=e,t},t.prototype.next=function(e){if(this.closed)throw new pa;if(!this.isStopped)for(var t=this.observers,r=t.length,n=t.slice(),o=0;o<r;o++)n[o].next(e)},t.prototype.error=function(e){if(this.closed)throw new pa;this.hasError=!0,this.thrownError=e,this.isStopped=!0;for(var t=this.observers,r=t.length,n=t.slice(),o=0;o<r;o++)n[o].error(e);this.observers.length=0},t.prototype.complete=function(){if(this.closed)throw new pa;this.isStopped=!0;for(var e=this.observers,t=e.length,r=e.slice(),n=0;n<t;n++)r[n].complete();this.observers.length=0},t.prototype.unsubscribe=function(){this.isStopped=!0,this.closed=!0,this.observers=null},t.prototype._trySubscribe=function(t){if(this.closed)throw new pa;return e.prototype._trySubscribe.call(this,t)},t.prototype._subscribe=function(e){if(this.closed)throw new pa;return this.hasError?(e.error(this.thrownError),na.EMPTY):this.isStopped?(e.complete(),na.EMPTY):(this.observers.push(e),new ga(this,e))},t.prototype.asObservable=function(){var e=new ha;return e.source=this,e},t.create=function(e,t){return new va(e,t)},t}(ha),va=function(e){function t(t,r){var n=e.call(this)||this;return n.destination=t,n.source=r,n}return Qs(t,e),t.prototype.next=function(e){var t=this.destination;t&&t.next&&t.next(e)},t.prototype.error=function(e){var t=this.destination;t&&t.error&&this.destination.error(e)},t.prototype.complete=function(){var e=this.destination;e&&e.complete&&this.destination.complete()},t.prototype._subscribe=function(e){return this.source?this.source.subscribe(e):na.EMPTY},t}(ba),ya=function(){function e(e){this.connectable=e}return e.prototype.call=function(e,t){var r=this.connectable;r._refCount++;var n=new wa(e,r),o=t.subscribe(n);return n.closed||(n.connection=r.connect()),o},e}(),wa=function(e){function t(t,r){var n=e.call(this,t)||this;return n.connectable=r,n}return Qs(t,e),t.prototype._unsubscribe=function(){var e=this.connectable;if(e){this.connectable=null;var t=e._refCount;if(t<=0)this.connection=null;else if(e._refCount=t-1,t>1)this.connection=null;else{var r=this.connection,n=e._connection;this.connection=null,!n||r&&n!==r||n.unsubscribe()}}else this.connection=null},t}(sa),Ea=function(e){function t(t,r){var n=e.call(this)||this;return n.source=t,n.subjectFactory=r,n._refCount=0,n._isComplete=!1,n}return Qs(t,e),t.prototype._subscribe=function(e){return this.getSubject().subscribe(e)},t.prototype.getSubject=function(){var e=this._subject;return e&&!e.isStopped||(this._subject=this.subjectFactory()),this._subject},t.prototype.connect=function(){var e=this._connection;return e||(this._isComplete=!1,(e=this._connection=new na).add(this.source.subscribe(new Ia(this.getSubject(),this))),e.closed&&(this._connection=null,e=na.EMPTY)),e},t.prototype.refCount=function(){return(e=this).lift(new ya(e));var e},t}(ha),Ia=function(e){function t(t,r){var n=e.call(this,t)||this;return n.connectable=r,n}return Qs(t,e),t.prototype._error=function(t){this._unsubscribe(),e.prototype._error.call(this,t)},t.prototype._complete=function(){this.connectable._isComplete=!0,this._unsubscribe(),e.prototype._complete.call(this)},t.prototype._unsubscribe=function(){var e=this.connectable;if(e){this.connectable=null;var t=e._connection;e._refCount=0,e._subject=null,e._connection=null,t&&t.unsubscribe()}},t}(ma),Ca=function(e){function t(t,r,n){var o=e.call(this)||this;return o.key=t,o.groupSubject=r,o.refCountSubscription=n,o}return Qs(t,e),t.prototype._subscribe=function(e){var t=new na,r=this.refCountSubscription,n=this.groupSubject;return r&&!r.closed&&t.add(new xa(r)),t.add(n.subscribe(e)),t},t}(ha),xa=function(e){function t(t){var r=e.call(this)||this;return r.parent=t,t.count++,r}return Qs(t,e),t.prototype.unsubscribe=function(){var t=this.parent;t.closed||this.closed||(e.prototype.unsubscribe.call(this),t.count-=1,0===t.count&&t.attemptedToUnsubscribe&&t.unsubscribe())},t}(na),Ba=function(e){function t(t){var r=e.call(this)||this;return r._value=t,r}return Qs(t,e),Object.defineProperty(t.prototype,"value",{get:function(){return this.getValue()},enumerable:!0,configurable:!0}),t.prototype._subscribe=function(t){var r=e.prototype._subscribe.call(this,t);return r&&!r.closed&&t.next(this._value),r},t.prototype.getValue=function(){if(this.hasError)throw this.thrownError;if(this.closed)throw new pa;return this._value},t.prototype.next=function(t){e.prototype.next.call(this,this._value=t)},t}(ba),Ta=function(e){function t(t,r){var n=e.call(this,t,r)||this;return n.scheduler=t,n.work=r,n.pending=!1,n}return Qs(t,e),t.prototype.schedule=function(e,t){if(void 0===t&&(t=0),this.closed)return this;this.state=e;var r=this.id,n=this.scheduler;return null!=r&&(this.id=this.recycleAsyncId(n,r,t)),this.pending=!0,this.delay=t,this.id=this.id||this.requestAsyncId(n,this.id,t),this},t.prototype.requestAsyncId=function(e,t,r){return void 0===r&&(r=0),setInterval(e.flush.bind(e,this),r)},t.prototype.recycleAsyncId=function(e,t,r){if(void 0===r&&(r=0),null!==r&&this.delay===r&&!1===this.pending)return t;clearInterval(t)},t.prototype.execute=function(e,t){if(this.closed)return new Error("executing a cancelled action");this.pending=!1;var r=this._execute(e,t);if(r)return r;!1===this.pending&&null!=this.id&&(this.id=this.recycleAsyncId(this.scheduler,this.id,null))},t.prototype._execute=function(e,t){var r=!1,n=void 0;try{this.work(e)}catch(e){r=!0,n=!!e&&e||new Error(e)}if(r)return this.unsubscribe(),n},t.prototype._unsubscribe=function(){var e=this.id,t=this.scheduler,r=t.actions,n=r.indexOf(this);this.work=null,this.state=null,this.pending=!1,this.scheduler=null,-1!==n&&r.splice(n,1),null!=e&&(this.id=this.recycleAsyncId(t,e,null)),this.delay=null},t}(function(e){function t(t,r){return e.call(this)||this}return Qs(t,e),t.prototype.schedule=function(e,t){return this},t}(na)),ka=function(e){function t(t,r){var n=e.call(this,t,r)||this;return n.scheduler=t,n.work=r,n}return Qs(t,e),t.prototype.schedule=function(t,r){return void 0===r&&(r=0),r>0?e.prototype.schedule.call(this,t,r):(this.delay=r,this.state=t,this.scheduler.flush(this),this)},t.prototype.execute=function(t,r){return r>0||this.closed?e.prototype.execute.call(this,t,r):this._execute(t,r)},t.prototype.requestAsyncId=function(t,r,n){return void 0===n&&(n=0),null!==n&&n>0||null===n&&this.delay>0?e.prototype.requestAsyncId.call(this,t,r,n):t.flush(this)},t}(Ta),Oa=function(){function e(t,r){void 0===r&&(r=e.now),this.SchedulerAction=t,this.now=r}return e.prototype.schedule=function(e,t,r){return void 0===t&&(t=0),new this.SchedulerAction(this,e).schedule(r,t)},e.now=function(){return Date.now()},e}(),Sa=function(e){function t(r,n){void 0===n&&(n=Oa.now);var o=e.call(this,r,(function(){return t.delegate&&t.delegate!==o?t.delegate.now():n()}))||this;return o.actions=[],o.active=!1,o.scheduled=void 0,o}return Qs(t,e),t.prototype.schedule=function(r,n,o){return void 0===n&&(n=0),t.delegate&&t.delegate!==this?t.delegate.schedule(r,n,o):e.prototype.schedule.call(this,r,n,o)},t.prototype.flush=function(e){var t=this.actions;if(this.active)t.push(e);else{var r;this.active=!0;do{if(r=e.execute(e.state,e.delay))break}while(e=t.shift());if(this.active=!1,r){for(;e=t.shift();)e.unsubscribe();throw r}}},t}(Oa),Ua=new(function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return Qs(t,e),t}(Sa))(ka),_a=Ua,Na=new ha((function(e){return e.complete()}));function Aa(e){return e?function(e){return new ha((function(t){return e.schedule((function(){return t.complete()}))}))}(e):Na}function Ra(e){return e&&"function"==typeof e.schedule}var Ma,La=function(e){return function(t){for(var r=0,n=e.length;r<n&&!t.closed;r++)t.next(e[r]);t.complete()}};function Fa(e,t){return new ha((function(r){var n=new na,o=0;return n.add(t.schedule((function(){o!==e.length?(r.next(e[o++]),r.closed||n.add(this.schedule())):r.complete()}))),n}))}function Pa(e,t){return t?Fa(e,t):new ha(La(e))}function ja(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var r=e[e.length-1];return Ra(r)?(e.pop(),Fa(e,r)):Pa(e)}function Da(e,t){return new ha(t?function(r){return t.schedule(qa,0,{error:e,subscriber:r})}:function(t){return t.error(e)})}function qa(e){var t=e.error;e.subscriber.error(t)}Ma||(Ma={});var $a=function(){function e(e,t,r){this.kind=e,this.value=t,this.error=r,this.hasValue="N"===e}return e.prototype.observe=function(e){switch(this.kind){case"N":return e.next&&e.next(this.value);case"E":return e.error&&e.error(this.error);case"C":return e.complete&&e.complete()}},e.prototype.do=function(e,t,r){switch(this.kind){case"N":return e&&e(this.value);case"E":return t&&t(this.error);case"C":return r&&r()}},e.prototype.accept=function(e,t,r){return e&&"function"==typeof e.next?this.observe(e):this.do(e,t,r)},e.prototype.toObservable=function(){switch(this.kind){case"N":return ja(this.value);case"E":return Da(this.error);case"C":return Aa()}throw new Error("unexpected notification kind value")},e.createNext=function(t){return void 0!==t?new e("N",t):e.undefinedValueNotification},e.createError=function(t){return new e("E",void 0,t)},e.createComplete=function(){return e.completeNotification},e.completeNotification=new e("C"),e.undefinedValueNotification=new e("N",void 0),e}(),Ha=function(e){function t(t,r,n){void 0===n&&(n=0);var o=e.call(this,t)||this;return o.scheduler=r,o.delay=n,o}return Qs(t,e),t.dispatch=function(e){var t=e.notification,r=e.destination;t.observe(r),this.unsubscribe()},t.prototype.scheduleMessage=function(e){this.destination.add(this.scheduler.schedule(t.dispatch,this.delay,new za(e,this.destination)))},t.prototype._next=function(e){this.scheduleMessage($a.createNext(e))},t.prototype._error=function(e){this.scheduleMessage($a.createError(e)),this.unsubscribe()},t.prototype._complete=function(){this.scheduleMessage($a.createComplete()),this.unsubscribe()},t}(sa),za=function(e,t){this.notification=e,this.destination=t},Ga=function(e){function t(t,r,n){void 0===t&&(t=Number.POSITIVE_INFINITY),void 0===r&&(r=Number.POSITIVE_INFINITY);var o=e.call(this)||this;return o.scheduler=n,o._events=[],o._infiniteTimeWindow=!1,o._bufferSize=t<1?1:t,o._windowTime=r<1?1:r,r===Number.POSITIVE_INFINITY?(o._infiniteTimeWindow=!0,o.next=o.nextInfiniteTimeWindow):o.next=o.nextTimeWindow,o}return Qs(t,e),t.prototype.nextInfiniteTimeWindow=function(t){if(!this.isStopped){var r=this._events;r.push(t),r.length>this._bufferSize&&r.shift()}e.prototype.next.call(this,t)},t.prototype.nextTimeWindow=function(t){this.isStopped||(this._events.push(new Ka(this._getNow(),t)),this._trimBufferThenGetEvents()),e.prototype.next.call(this,t)},t.prototype._subscribe=function(e){var t,r=this._infiniteTimeWindow,n=r?this._events:this._trimBufferThenGetEvents(),o=this.scheduler,i=n.length;if(this.closed)throw new pa;if(this.isStopped||this.hasError?t=na.EMPTY:(this.observers.push(e),t=new ga(this,e)),o&&e.add(e=new Ha(e,o)),r)for(var s=0;s<i&&!e.closed;s++)e.next(n[s]);else for(s=0;s<i&&!e.closed;s++)e.next(n[s].value);return this.hasError?e.error(this.thrownError):this.isStopped&&e.complete(),t},t.prototype._getNow=function(){return(this.scheduler||_a).now()},t.prototype._trimBufferThenGetEvents=function(){for(var e=this._getNow(),t=this._bufferSize,r=this._windowTime,n=this._events,o=n.length,i=0;i<o&&!(e-n[i].time<r);)i++;return o>t&&(i=Math.max(i,o-t)),i>0&&n.splice(0,i),n},t}(ba),Ka=function(e,t){this.time=e,this.value=t},Va=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.value=null,t.hasNext=!1,t.hasCompleted=!1,t}return Qs(t,e),t.prototype._subscribe=function(t){return this.hasError?(t.error(this.thrownError),na.EMPTY):this.hasCompleted&&this.hasNext?(t.next(this.value),t.complete(),na.EMPTY):e.prototype._subscribe.call(this,t)},t.prototype.next=function(e){this.hasCompleted||(this.value=e,this.hasNext=!0)},t.prototype.error=function(t){this.hasCompleted||e.prototype.error.call(this,t)},t.prototype.complete=function(){this.hasCompleted=!0,this.hasNext&&e.prototype.next.call(this,this.value),e.prototype.complete.call(this)},t}(ba),Qa=1,Wa=Promise.resolve(),Ya={};function Ja(e){return e in Ya&&(delete Ya[e],!0)}var Xa=function(e){function t(t,r){var n=e.call(this,t,r)||this;return n.scheduler=t,n.work=r,n}return Qs(t,e),t.prototype.requestAsyncId=function(t,r,n){return void 0===n&&(n=0),null!==n&&n>0?e.prototype.requestAsyncId.call(this,t,r,n):(t.actions.push(this),t.scheduled||(t.scheduled=function(e){var t=Qa++;return Ya[t]=!0,Wa.then((function(){return Ja(t)&&e()})),t}(t.flush.bind(t,null))))},t.prototype.recycleAsyncId=function(t,r,n){if(void 0===n&&(n=0),null!==n&&n>0||null===n&&this.delay>0)return e.prototype.recycleAsyncId.call(this,t,r,n);0===t.actions.length&&(function(e){Ja(e)}(r),t.scheduled=void 0)},t}(Ta),Za=new(function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return Qs(t,e),t.prototype.flush=function(e){this.active=!0,this.scheduled=void 0;var t,r=this.actions,n=-1,o=r.length;e=e||r.shift();do{if(t=e.execute(e.state,e.delay))break}while(++n<o&&(e=r.shift()));if(this.active=!1,t){for(;++n<o&&(e=r.shift());)e.unsubscribe();throw t}},t}(Sa))(Xa),eu=Za,tu=new Sa(Ta),ru=tu,nu=function(e){function t(t,r){var n=e.call(this,t,r)||this;return n.scheduler=t,n.work=r,n}return Qs(t,e),t.prototype.requestAsyncId=function(t,r,n){return void 0===n&&(n=0),null!==n&&n>0?e.prototype.requestAsyncId.call(this,t,r,n):(t.actions.push(this),t.scheduled||(t.scheduled=requestAnimationFrame((function(){return t.flush(null)}))))},t.prototype.recycleAsyncId=function(t,r,n){if(void 0===n&&(n=0),null!==n&&n>0||null===n&&this.delay>0)return e.prototype.recycleAsyncId.call(this,t,r,n);0===t.actions.length&&(cancelAnimationFrame(r),t.scheduled=void 0)},t}(Ta),ou=new(function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return Qs(t,e),t.prototype.flush=function(e){this.active=!0,this.scheduled=void 0;var t,r=this.actions,n=-1,o=r.length;e=e||r.shift();do{if(t=e.execute(e.state,e.delay))break}while(++n<o&&(e=r.shift()));if(this.active=!1,t){for(;++n<o&&(e=r.shift());)e.unsubscribe();throw t}},t}(Sa))(nu),iu=ou,su=function(e){function t(t,r){void 0===t&&(t=au),void 0===r&&(r=Number.POSITIVE_INFINITY);var n=e.call(this,t,(function(){return n.frame}))||this;return n.maxFrames=r,n.frame=0,n.index=-1,n}return Qs(t,e),t.prototype.flush=function(){for(var e,t,r=this.actions,n=this.maxFrames;(t=r[0])&&t.delay<=n&&(r.shift(),this.frame=t.delay,!(e=t.execute(t.state,t.delay))););if(e){for(;t=r.shift();)t.unsubscribe();throw e}},t.frameTimeFactor=10,t}(Sa),au=function(e){function t(t,r,n){void 0===n&&(n=t.index+=1);var o=e.call(this,t,r)||this;return o.scheduler=t,o.work=r,o.index=n,o.active=!0,o.index=t.index=n,o}return Qs(t,e),t.prototype.schedule=function(r,n){if(void 0===n&&(n=0),!this.id)return e.prototype.schedule.call(this,r,n);this.active=!1;var o=new t(this.scheduler,this.work);return this.add(o),o.schedule(r,n)},t.prototype.requestAsyncId=function(e,r,n){void 0===n&&(n=0),this.delay=e.frame+n;var o=e.actions;return o.push(this),o.sort(t.sortActions),!0},t.prototype.recycleAsyncId=function(e,t,r){},t.prototype._execute=function(t,r){if(!0===this.active)return e.prototype._execute.call(this,t,r)},t.sortActions=function(e,t){return e.delay===t.delay?e.index===t.index?0:e.index>t.index?1:-1:e.delay>t.delay?1:-1},t}(Ta);function uu(){}var cu=function(){function e(){return Error.call(this),this.message="argument out of range",this.name="ArgumentOutOfRangeError",this}return e.prototype=Object.create(Error.prototype),e}(),lu=function(){function e(){return Error.call(this),this.message="no elements in sequence",this.name="EmptyError",this}return e.prototype=Object.create(Error.prototype),e}(),fu=function(){function e(){return Error.call(this),this.message="Timeout has occurred",this.name="TimeoutError",this}return e.prototype=Object.create(Error.prototype),e}();function hu(e,t){return function(r){if("function"!=typeof e)throw new TypeError("argument is not a function. Are you looking for `mapTo()`?");return r.lift(new du(e,t))}}var du=function(){function e(e,t){this.project=e,this.thisArg=t}return e.prototype.call=function(e,t){return t.subscribe(new pu(e,this.project,this.thisArg))},e}(),pu=function(e){function t(t,r,n){var o=e.call(this,t)||this;return o.project=r,o.count=0,o.thisArg=n||o,o}return Qs(t,e),t.prototype._next=function(e){var t;try{t=this.project.call(this.thisArg,e,this.count++)}catch(e){return void this.destination.error(e)}this.destination.next(t)},t}(sa);function gu(e){var t=this,r=e.args,n=e.subscriber,o=e.params,i=o.callbackFunc,s=o.context,a=o.scheduler,u=o.subject;if(!u){u=o.subject=new Va;try{i.apply(s,r.concat([function(){for(var e=[],r=0;r<arguments.length;r++)e[r]=arguments[r];var n=e.length<=1?e[0]:e;t.add(a.schedule(mu,0,{value:n,subject:u}))}]))}catch(e){u.error(e)}}this.add(u.subscribe(n))}function mu(e){var t=e.value,r=e.subject;r.next(t),r.complete()}function bu(e){var t=this,r=e.params,n=e.subscriber,o=e.context,i=r.callbackFunc,s=r.args,a=r.scheduler,u=r.subject;if(!u){u=r.subject=new Va;try{i.apply(o,s.concat([function(){for(var e=[],r=0;r<arguments.length;r++)e[r]=arguments[r];var n=e.shift();if(n)t.add(a.schedule(yu,0,{err:n,subject:u}));else{var o=e.length<=1?e[0]:e;t.add(a.schedule(vu,0,{value:o,subject:u}))}}]))}catch(e){this.add(a.schedule(yu,0,{err:e,subject:u}))}}this.add(u.subscribe(n))}function vu(e){var t=e.value,r=e.subject;r.next(t),r.complete()}function yu(e){var t=e.err;e.subject.error(t)}var wu=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return Qs(t,e),t.prototype.notifyNext=function(e,t,r,n,o){this.destination.next(t)},t.prototype.notifyError=function(e,t){this.destination.error(e)},t.prototype.notifyComplete=function(e){this.destination.complete()},t}(sa),Eu=function(e){function t(t,r,n){var o=e.call(this)||this;return o.parent=t,o.outerValue=r,o.outerIndex=n,o.index=0,o}return Qs(t,e),t.prototype._next=function(e){this.parent.notifyNext(this.outerValue,e,this.outerIndex,this.index++,this)},t.prototype._error=function(e){this.parent.notifyError(e,this),this.unsubscribe()},t.prototype._complete=function(){this.parent.notifyComplete(this),this.unsubscribe()},t}(sa),Iu="function"==typeof Symbol&&Symbol.iterator?Symbol.iterator:"@@iterator",Cu=function(e){return e&&"number"==typeof e.length&&"function"!=typeof e};function xu(e){return!!e&&"function"!=typeof e.subscribe&&"function"==typeof e.then}var Bu=function(e){if(e&&"function"==typeof e[ca])return n=e,function(e){var t=n[ca]();if("function"!=typeof t.subscribe)throw new TypeError("Provided object does not correctly implement Symbol.observable");return t.subscribe(e)};if(Cu(e))return La(e);if(xu(e))return r=e,function(e){return r.then((function(t){e.closed||(e.next(t),e.complete())}),(function(t){return e.error(t)})).then(null,Xs),e};if(e&&"function"==typeof e[Iu])return t=e,function(e){for(var r=t[Iu]();;){var n=void 0;try{n=r.next()}catch(t){return e.error(t),e}if(n.done){e.complete();break}if(e.next(n.value),e.closed)break}return"function"==typeof r.return&&e.add((function(){r.return&&r.return()})),e};var t,r,n,o=ta(e)?"an invalid object":"'"+e+"'";throw new TypeError("You provided "+o+" where a stream was expected. You can provide an Observable, Promise, Array, or Iterable.")};function Tu(e,t,r,n,o){if(void 0===o&&(o=new Eu(e,r,n)),!o.closed)return t instanceof ha?t.subscribe(o):Bu(t)(o)}var ku={},Ou=function(){function e(e){this.resultSelector=e}return e.prototype.call=function(e,t){return t.subscribe(new Su(e,this.resultSelector))},e}(),Su=function(e){function t(t,r){var n=e.call(this,t)||this;return n.resultSelector=r,n.active=0,n.values=[],n.observables=[],n}return Qs(t,e),t.prototype._next=function(e){this.values.push(ku),this.observables.push(e)},t.prototype._complete=function(){var e=this.observables,t=e.length;if(0===t)this.destination.complete();else{this.active=t,this.toRespond=t;for(var r=0;r<t;r++){var n=e[r];this.add(Tu(this,n,void 0,r))}}},t.prototype.notifyComplete=function(e){0==(this.active-=1)&&this.destination.complete()},t.prototype.notifyNext=function(e,t,r){var n=this.values,o=n[r],i=this.toRespond?o===ku?--this.toRespond:this.toRespond:0;n[r]=t,0===i&&(this.resultSelector?this._tryResultSelector(n):this.destination.next(n.slice()))},t.prototype._tryResultSelector=function(e){var t;try{t=this.resultSelector.apply(this,e)}catch(e){return void this.destination.error(e)}this.destination.next(t)},t}(wu);function Uu(e,t){if(null!=e){if(function(e){return e&&"function"==typeof e[ca]}(e))return function(e,t){return new ha((function(r){var n=new na;return n.add(t.schedule((function(){var o=e[ca]();n.add(o.subscribe({next:function(e){n.add(t.schedule((function(){return r.next(e)})))},error:function(e){n.add(t.schedule((function(){return r.error(e)})))},complete:function(){n.add(t.schedule((function(){return r.complete()})))}}))}))),n}))}(e,t);if(xu(e))return function(e,t){return new ha((function(r){var n=new na;return n.add(t.schedule((function(){return e.then((function(e){n.add(t.schedule((function(){r.next(e),n.add(t.schedule((function(){return r.complete()})))})))}),(function(e){n.add(t.schedule((function(){return r.error(e)})))}))}))),n}))}(e,t);if(Cu(e))return Fa(e,t);if(function(e){return e&&"function"==typeof e[Iu]}(e)||"string"==typeof e)return function(e,t){if(!e)throw new Error("Iterable cannot be null");return new ha((function(r){var n,o=new na;return o.add((function(){n&&"function"==typeof n.return&&n.return()})),o.add(t.schedule((function(){n=e[Iu](),o.add(t.schedule((function(){if(!r.closed){var e,t;try{var o=n.next();e=o.value,t=o.done}catch(e){return void r.error(e)}t?r.complete():(r.next(e),this.schedule())}})))}))),o}))}(e,t)}throw new TypeError((null!==e&&typeof e||e)+" is not observable")}function _u(e,t){return t?Uu(e,t):e instanceof ha?e:new ha(Bu(e))}var Nu=function(e){function t(t){var r=e.call(this)||this;return r.parent=t,r}return Qs(t,e),t.prototype._next=function(e){this.parent.notifyNext(e)},t.prototype._error=function(e){this.parent.notifyError(e),this.unsubscribe()},t.prototype._complete=function(){this.parent.notifyComplete(),this.unsubscribe()},t}(sa),Au=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return Qs(t,e),t.prototype.notifyNext=function(e){this.destination.next(e)},t.prototype.notifyError=function(e){this.destination.error(e)},t.prototype.notifyComplete=function(){this.destination.complete()},t}(sa);function Ru(e,t){if(!t.closed){if(e instanceof ha)return e.subscribe(t);var r;try{r=Bu(e)(t)}catch(e){t.error(e)}return r}}function Mu(e,t,r){return void 0===r&&(r=Number.POSITIVE_INFINITY),"function"==typeof t?function(n){return n.pipe(Mu((function(r,n){return _u(e(r,n)).pipe(hu((function(e,o){return t(r,e,n,o)})))}),r))}:("number"==typeof t&&(r=t),function(t){return t.lift(new Lu(e,r))})}var Lu=function(){function e(e,t){void 0===t&&(t=Number.POSITIVE_INFINITY),this.project=e,this.concurrent=t}return e.prototype.call=function(e,t){return t.subscribe(new Fu(e,this.project,this.concurrent))},e}(),Fu=function(e){function t(t,r,n){void 0===n&&(n=Number.POSITIVE_INFINITY);var o=e.call(this,t)||this;return o.project=r,o.concurrent=n,o.hasCompleted=!1,o.buffer=[],o.active=0,o.index=0,o}return Qs(t,e),t.prototype._next=function(e){this.active<this.concurrent?this._tryNext(e):this.buffer.push(e)},t.prototype._tryNext=function(e){var t,r=this.index++;try{t=this.project(e,r)}catch(e){return void this.destination.error(e)}this.active++,this._innerSub(t)},t.prototype._innerSub=function(e){var t=new Nu(this),r=this.destination;r.add(t);var n=Ru(e,t);n!==t&&r.add(n)},t.prototype._complete=function(){this.hasCompleted=!0,0===this.active&&0===this.buffer.length&&this.destination.complete(),this.unsubscribe()},t.prototype.notifyNext=function(e){this.destination.next(e)},t.prototype.notifyComplete=function(){var e=this.buffer;this.active--,e.length>0?this._next(e.shift()):0===this.active&&this.hasCompleted&&this.destination.complete()},t}(Au);function Pu(e){return void 0===e&&(e=Number.POSITIVE_INFINITY),Mu(la,e)}function ju(){return Pu(1)}function Du(e){return new ha((function(t){var r;try{r=e()}catch(e){return void t.error(e)}return(r?_u(r):Aa()).subscribe(t)}))}function qu(e,t){return new ha((function(r){var n=e.length;if(0!==n)for(var o=new Array(n),i=0,s=0,a=function(a){var u=_u(e[a]),c=!1;r.add(u.subscribe({next:function(e){c||(c=!0,s++),o[a]=e},error:function(e){return r.error(e)},complete:function(){++i!==n&&c||(s===n&&r.next(t?t.reduce((function(e,t,r){return e[t]=o[r],e}),{}):o),r.complete())}}))},u=0;u<n;u++)a(u);else r.complete()}))}function $u(e,t,r,n,o){var i;if(function(e){return e&&"function"==typeof e.addEventListener&&"function"==typeof e.removeEventListener}(e)){var s=e;e.addEventListener(t,r,o),i=function(){return s.removeEventListener(t,r,o)}}else if(function(e){return e&&"function"==typeof e.on&&"function"==typeof e.off}(e)){var a=e;e.on(t,r),i=function(){return a.off(t,r)}}else if(function(e){return e&&"function"==typeof e.addListener&&"function"==typeof e.removeListener}(e)){var u=e;e.addListener(t,r),i=function(){return u.removeListener(t,r)}}else{if(!e||!e.length)throw new TypeError("Invalid event target");for(var c=0,l=e.length;c<l;c++)$u(e[c],t,r,n,o)}n.add(i)}function Hu(e){var t=e.subscriber,r=e.condition;if(!t.closed){if(e.needIterate)try{e.state=e.iterate(e.state)}catch(e){return void t.error(e)}else e.needIterate=!0;if(r){var n=void 0;try{n=r(e.state)}catch(e){return void t.error(e)}if(!n)return void t.complete();if(t.closed)return}var o;try{o=e.resultSelector(e.state)}catch(e){return void t.error(e)}if(!t.closed&&(t.next(o),!t.closed))return this.schedule(e)}}function zu(e){return!ea(e)&&e-parseFloat(e)+1>=0}function Gu(e){var t=e.subscriber,r=e.counter,n=e.period;t.next(r),this.schedule({subscriber:t,counter:r+1,period:n},n)}var Ku=new ha(uu);function Vu(e){var t=e.keys,r=e.index,n=e.subscriber,o=e.subscription,i=e.obj;if(!n.closed)if(r<t.length){var s=t[r];n.next([s,i[s]]),o.add(this.schedule({keys:t,index:r+1,subscriber:n,subscription:o,obj:i}))}else n.complete()}function Qu(e,t){function r(){return!r.pred.apply(r.thisArg,arguments)}return r.pred=e,r.thisArg=t,r}function Wu(e,t){return function(r){return r.lift(new Yu(e,t))}}var Yu=function(){function e(e,t){this.predicate=e,this.thisArg=t}return e.prototype.call=function(e,t){return t.subscribe(new Ju(e,this.predicate,this.thisArg))},e}(),Ju=function(e){function t(t,r,n){var o=e.call(this,t)||this;return o.predicate=r,o.thisArg=n,o.count=0,o}return Qs(t,e),t.prototype._next=function(e){var t;try{t=this.predicate.call(this.thisArg,e,this.count++)}catch(e){return void this.destination.error(e)}t&&this.destination.next(e)},t}(sa),Xu=function(){function e(){}return e.prototype.call=function(e,t){return t.subscribe(new Zu(e))},e}(),Zu=function(e){function t(t){var r=e.call(this,t)||this;return r.hasFirst=!1,r.observables=[],r.subscriptions=[],r}return Qs(t,e),t.prototype._next=function(e){this.observables.push(e)},t.prototype._complete=function(){var e=this.observables,t=e.length;if(0===t)this.destination.complete();else{for(var r=0;r<t&&!this.hasFirst;r++){var n=Tu(this,e[r],void 0,r);this.subscriptions&&this.subscriptions.push(n),this.add(n)}this.observables=null}},t.prototype.notifyNext=function(e,t,r){if(!this.hasFirst){this.hasFirst=!0;for(var n=0;n<this.subscriptions.length;n++)if(n!==r){var o=this.subscriptions[n];o.unsubscribe(),this.remove(o)}this.subscriptions=null}this.destination.next(t)},t}(wu);function ec(e){var t=e.start,r=e.index,n=e.count,o=e.subscriber;r>=n?o.complete():(o.next(t),o.closed||(e.index=r+1,e.start=t+1,this.schedule(e)))}function tc(e){var t=e.index,r=e.period,n=e.subscriber;if(n.next(t),!n.closed){if(-1===r)return n.complete();e.index=t+1,this.schedule(e,r)}}var rc=function(){function e(e){this.resultSelector=e}return e.prototype.call=function(e,t){return t.subscribe(new nc(e,this.resultSelector))},e}(),nc=function(e){function t(t,r,n){var o=e.call(this,t)||this;return o.resultSelector=r,o.iterators=[],o.active=0,o.resultSelector="function"==typeof r?r:void 0,o}return Qs(t,e),t.prototype._next=function(e){var t=this.iterators;ea(e)?t.push(new ic(e)):"function"==typeof e[Iu]?t.push(new oc(e[Iu]())):t.push(new sc(this.destination,this,e))},t.prototype._complete=function(){var e=this.iterators,t=e.length;if(this.unsubscribe(),0!==t){this.active=t;for(var r=0;r<t;r++){var n=e[r];n.stillUnsubscribed?this.destination.add(n.subscribe()):this.active--}}else this.destination.complete()},t.prototype.notifyInactive=function(){this.active--,0===this.active&&this.destination.complete()},t.prototype.checkIterators=function(){for(var e=this.iterators,t=e.length,r=this.destination,n=0;n<t;n++)if("function"==typeof(s=e[n]).hasValue&&!s.hasValue())return;var o=!1,i=[];for(n=0;n<t;n++){var s,a=(s=e[n]).next();if(s.hasCompleted()&&(o=!0),a.done)return void r.complete();i.push(a.value)}this.resultSelector?this._tryresultSelector(i):r.next(i),o&&r.complete()},t.prototype._tryresultSelector=function(e){var t;try{t=this.resultSelector.apply(this,e)}catch(e){return void this.destination.error(e)}this.destination.next(t)},t}(sa),oc=function(){function e(e){this.iterator=e,this.nextResult=e.next()}return e.prototype.hasValue=function(){return!0},e.prototype.next=function(){var e=this.nextResult;return this.nextResult=this.iterator.next(),e},e.prototype.hasCompleted=function(){var e=this.nextResult;return Boolean(e&&e.done)},e}(),ic=function(){function e(e){this.array=e,this.index=0,this.length=0,this.length=e.length}return e.prototype[Iu]=function(){return this},e.prototype.next=function(e){var t=this.index++,r=this.array;return t<this.length?{value:r[t],done:!1}:{value:null,done:!0}},e.prototype.hasValue=function(){return this.array.length>this.index},e.prototype.hasCompleted=function(){return this.array.length===this.index},e}(),sc=function(e){function t(t,r,n){var o=e.call(this,t)||this;return o.parent=r,o.observable=n,o.stillUnsubscribed=!0,o.buffer=[],o.isComplete=!1,o}return Qs(t,e),t.prototype[Iu]=function(){return this},t.prototype.next=function(){var e=this.buffer;return 0===e.length&&this.isComplete?{value:null,done:!0}:{value:e.shift(),done:!1}},t.prototype.hasValue=function(){return this.buffer.length>0},t.prototype.hasCompleted=function(){return 0===this.buffer.length&&this.isComplete},t.prototype.notifyComplete=function(){this.buffer.length>0?(this.isComplete=!0,this.parent.notifyInactive()):this.destination.complete()},t.prototype.notifyNext=function(e){this.buffer.push(e),this.parent.checkIterators()},t.prototype.subscribe=function(){return Ru(this.observable,new Nu(this))},t}(Au),ac=Object.freeze({__proto__:null,Observable:ha,ConnectableObservable:Ea,GroupedObservable:Ca,observable:ca,Subject:ba,BehaviorSubject:Ba,ReplaySubject:Ga,AsyncSubject:Va,asap:eu,asapScheduler:Za,async:ru,asyncScheduler:tu,queue:_a,queueScheduler:Ua,animationFrame:iu,animationFrameScheduler:ou,VirtualTimeScheduler:su,VirtualAction:au,Scheduler:Oa,Subscription:na,Subscriber:sa,Notification:$a,get NotificationKind(){return Ma},pipe:function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return fa(e)},noop:uu,identity:la,isObservable:function(e){return!!e&&(e instanceof ha||"function"==typeof e.lift&&"function"==typeof e.subscribe)},ArgumentOutOfRangeError:cu,EmptyError:lu,ObjectUnsubscribedError:pa,UnsubscriptionError:ra,TimeoutError:fu,bindCallback:function e(t,r,n){if(r){if(!Ra(r))return function(){for(var o=[],i=0;i<arguments.length;i++)o[i]=arguments[i];return e(t,n).apply(void 0,o).pipe(hu((function(e){return ea(e)?r.apply(void 0,e):r(e)})))};n=r}return function(){for(var e=[],r=0;r<arguments.length;r++)e[r]=arguments[r];var o,i=this,s={context:i,subject:o,callbackFunc:t,scheduler:n};return new ha((function(r){if(n){var a={args:e,subscriber:r,params:s};return n.schedule(gu,0,a)}if(!o){o=new Va;try{t.apply(i,e.concat([function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];o.next(e.length<=1?e[0]:e),o.complete()}]))}catch(e){ua(o)?o.error(e):console.warn(e)}}return o.subscribe(r)}))}},bindNodeCallback:function e(t,r,n){if(r){if(!Ra(r))return function(){for(var o=[],i=0;i<arguments.length;i++)o[i]=arguments[i];return e(t,n).apply(void 0,o).pipe(hu((function(e){return ea(e)?r.apply(void 0,e):r(e)})))};n=r}return function(){for(var e=[],r=0;r<arguments.length;r++)e[r]=arguments[r];var o={subject:void 0,args:e,callbackFunc:t,scheduler:n,context:this};return new ha((function(r){var i=o.context,s=o.subject;if(n)return n.schedule(bu,0,{params:o,subscriber:r,context:i});if(!s){s=o.subject=new Va;try{t.apply(i,e.concat([function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var r=e.shift();r?s.error(r):(s.next(e.length<=1?e[0]:e),s.complete())}]))}catch(e){ua(s)?s.error(e):console.warn(e)}}return s.subscribe(r)}))}},combineLatest:function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var r=void 0,n=void 0;return Ra(e[e.length-1])&&(n=e.pop()),"function"==typeof e[e.length-1]&&(r=e.pop()),1===e.length&&ea(e[0])&&(e=e[0]),Pa(e,n).lift(new Ou(r))},concat:function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return ju()(ja.apply(void 0,e))},defer:Du,empty:Aa,forkJoin:function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];if(1===e.length){var r=e[0];if(ea(r))return qu(r,null);if(ta(r)&&Object.getPrototypeOf(r)===Object.prototype){var n=Object.keys(r);return qu(n.map((function(e){return r[e]})),n)}}if("function"==typeof e[e.length-1]){var o=e.pop();return qu(e=1===e.length&&ea(e[0])?e[0]:e,null).pipe(hu((function(e){return o.apply(void 0,e)})))}return qu(e,null)},from:_u,fromEvent:function e(t,r,n,o){return Ws(n)&&(o=n,n=void 0),o?e(t,r,n).pipe(hu((function(e){return ea(e)?o.apply(void 0,e):o(e)}))):new ha((function(e){$u(t,r,(function(t){arguments.length>1?e.next(Array.prototype.slice.call(arguments)):e.next(t)}),e,n)}))},fromEventPattern:function e(t,r,n){return n?e(t,r).pipe(hu((function(e){return ea(e)?n.apply(void 0,e):n(e)}))):new ha((function(e){var n,o=function(){for(var t=[],r=0;r<arguments.length;r++)t[r]=arguments[r];return e.next(1===t.length?t[0]:t)};try{n=t(o)}catch(t){return void e.error(t)}if(Ws(r))return function(){return r(o,n)}}))},generate:function(e,t,r,n,o){var i,s;if(1==arguments.length){var a=e;s=a.initialState,t=a.condition,r=a.iterate,i=a.resultSelector||la,o=a.scheduler}else void 0===n||Ra(n)?(s=e,i=la,o=n):(s=e,i=n);return new ha((function(e){var n=s;if(o)return o.schedule(Hu,0,{subscriber:e,iterate:r,condition:t,resultSelector:i,state:n});for(;;){if(t){var a=void 0;try{a=t(n)}catch(t){return void e.error(t)}if(!a){e.complete();break}}var u=void 0;try{u=i(n)}catch(t){return void e.error(t)}if(e.next(u),e.closed)break;try{n=r(n)}catch(t){return void e.error(t)}}}))},iif:function(e,t,r){return void 0===t&&(t=Na),void 0===r&&(r=Na),Du((function(){return e()?t:r}))},interval:function(e,t){return void 0===e&&(e=0),void 0===t&&(t=ru),(!zu(e)||e<0)&&(e=0),t&&"function"==typeof t.schedule||(t=ru),new ha((function(r){return r.add(t.schedule(Gu,e,{subscriber:r,counter:0,period:e})),r}))},merge:function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var r=Number.POSITIVE_INFINITY,n=null,o=e[e.length-1];return Ra(o)?(n=e.pop(),e.length>1&&"number"==typeof e[e.length-1]&&(r=e.pop())):"number"==typeof o&&(r=e.pop()),null===n&&1===e.length&&e[0]instanceof ha?e[0]:Pu(r)(Pa(e,n))},never:function(){return Ku},of:ja,onErrorResumeNext:function e(){for(var t=[],r=0;r<arguments.length;r++)t[r]=arguments[r];if(0===t.length)return Na;var n=t[0],o=t.slice(1);return 1===t.length&&ea(n)?e.apply(void 0,n):new ha((function(t){var r=function(){return t.add(e.apply(void 0,o).subscribe(t))};return _u(n).subscribe({next:function(e){t.next(e)},error:r,complete:r})}))},pairs:function(e,t){return new ha(t?function(r){var n=Object.keys(e),o=new na;return o.add(t.schedule(Vu,0,{keys:n,index:0,subscriber:r,subscription:o,obj:e})),o}:function(t){for(var r=Object.keys(e),n=0;n<r.length&&!t.closed;n++){var o=r[n];e.hasOwnProperty(o)&&t.next([o,e[o]])}t.complete()})},partition:function(e,t,r){return[Wu(t,r)(new ha(Bu(e))),Wu(Qu(t,r))(new ha(Bu(e)))]},race:function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];if(1===e.length){if(!ea(e[0]))return e[0];e=e[0]}return Pa(e,void 0).lift(new Xu)},range:function(e,t,r){return void 0===e&&(e=0),new ha((function(n){void 0===t&&(t=e,e=0);var o=0,i=e;if(r)return r.schedule(ec,0,{index:o,count:t,start:e,subscriber:n});for(;;){if(o++>=t){n.complete();break}if(n.next(i++),n.closed)break}}))},throwError:Da,timer:function(e,t,r){void 0===e&&(e=0);var n=-1;return zu(t)?n=Number(t)<1?1:Number(t):Ra(t)&&(r=t),Ra(r)||(r=ru),new ha((function(t){var o=zu(e)?e:+e-r.now();return r.schedule(tc,o,{index:0,period:n,subscriber:t})}))},using:function(e,t){return new ha((function(r){var n,o;try{n=e()}catch(e){return void r.error(e)}try{o=t(n)}catch(e){return void r.error(e)}var i=(o?_u(o):Na).subscribe(r);return function(){i.unsubscribe(),n&&n.unsubscribe()}}))},zip:function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var r=e[e.length-1];return"function"==typeof r&&e.pop(),Pa(e,void 0).lift(new rc(r))},scheduled:Uu,EMPTY:Na,NEVER:Ku,config:Js});let uc=class{addNotification(e){}};uc=function(e,t,r,n){var o,i=arguments.length,s=i<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,r):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(e,t,r,n);else for(var a=e.length-1;a>=0;a--)(o=e[a])&&(s=(i<3?o(s):i>3?o(t,r,s):o(t,r))||s);return i>3&&s&&Object.defineProperty(t,r,s),s}([(console.log("[NgLess::Injectable] factory created"),function(e){console.log("[NgLess::Injectable::factory] class decorated: ",e.name)})],uc),function(e){function t(t,r,n,o){var i=e.call(this,t)||this;return i._tapNext=uu,i._tapError=uu,i._tapComplete=uu,i._tapError=n||uu,i._tapComplete=o||uu,Ws(r)?(i._context=i,i._tapNext=r):r&&(i._context=r,i._tapNext=r.next||uu,i._tapError=r.error||uu,i._tapComplete=r.complete||uu),i}Qs(t,e),t.prototype._next=function(e){try{this._tapNext.call(this._context,e)}catch(e){return void this.destination.error(e)}this.destination.next(e)},t.prototype._error=function(e){try{this._tapError.call(this._context,e)}catch(e){return void this.destination.error(e)}this.destination.error(e)},t.prototype._complete=function(){try{this._tapComplete.call(this._context)}catch(e){return void this.destination.error(e)}return this.destination.complete()}}(sa);var cc="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},lc={},fc={exports:{}},hc={exports:{}},dc=function(e,t){return function(){for(var r=new Array(arguments.length),n=0;n<r.length;n++)r[n]=arguments[n];return e.apply(t,r)}},pc=dc,gc=Object.prototype.toString;function mc(e){return"[object Array]"===gc.call(e)}function bc(e){return void 0===e}function vc(e){return null!==e&&"object"==typeof e}function yc(e){return"[object Function]"===gc.call(e)}function wc(e,t){if(null!=e)if("object"!=typeof e&&(e=[e]),mc(e))for(var r=0,n=e.length;r<n;r++)t.call(null,e[r],r,e);else for(var o in e)Object.prototype.hasOwnProperty.call(e,o)&&t.call(null,e[o],o,e)}var Ec={isArray:mc,isArrayBuffer:function(e){return"[object ArrayBuffer]"===gc.call(e)},isBuffer:function(e){return null!==e&&!bc(e)&&null!==e.constructor&&!bc(e.constructor)&&"function"==typeof e.constructor.isBuffer&&e.constructor.isBuffer(e)},isFormData:function(e){return"undefined"!=typeof FormData&&e instanceof FormData},isArrayBufferView:function(e){return"undefined"!=typeof ArrayBuffer&&ArrayBuffer.isView?ArrayBuffer.isView(e):e&&e.buffer&&e.buffer instanceof ArrayBuffer},isString:function(e){return"string"==typeof e},isNumber:function(e){return"number"==typeof e},isObject:vc,isUndefined:bc,isDate:function(e){return"[object Date]"===gc.call(e)},isFile:function(e){return"[object File]"===gc.call(e)},isBlob:function(e){return"[object Blob]"===gc.call(e)},isFunction:yc,isStream:function(e){return vc(e)&&yc(e.pipe)},isURLSearchParams:function(e){return"undefined"!=typeof URLSearchParams&&e instanceof URLSearchParams},isStandardBrowserEnv:function(){return("undefined"==typeof navigator||"ReactNative"!==navigator.product&&"NativeScript"!==navigator.product&&"NS"!==navigator.product)&&"undefined"!=typeof window&&"undefined"!=typeof document},forEach:wc,merge:function e(){var t={};function r(r,n){"object"==typeof t[n]&&"object"==typeof r?t[n]=e(t[n],r):t[n]=r}for(var n=0,o=arguments.length;n<o;n++)wc(arguments[n],r);return t},deepMerge:function e(){var t={};function r(r,n){"object"==typeof t[n]&&"object"==typeof r?t[n]=e(t[n],r):t[n]="object"==typeof r?e({},r):r}for(var n=0,o=arguments.length;n<o;n++)wc(arguments[n],r);return t},extend:function(e,t,r){return wc(t,(function(t,n){e[n]=r&&"function"==typeof t?pc(t,r):t})),e},trim:function(e){return e.replace(/^\s*/,"").replace(/\s*$/,"")}},Ic=Ec;function Cc(e){return encodeURIComponent(e).replace(/%40/gi,"@").replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}var xc=function(e,t,r){if(!t)return e;var n;if(r)n=r(t);else if(Ic.isURLSearchParams(t))n=t.toString();else{var o=[];Ic.forEach(t,(function(e,t){null!=e&&(Ic.isArray(e)?t+="[]":e=[e],Ic.forEach(e,(function(e){Ic.isDate(e)?e=e.toISOString():Ic.isObject(e)&&(e=JSON.stringify(e)),o.push(Cc(t)+"="+Cc(e))})))})),n=o.join("&")}if(n){var i=e.indexOf("#");-1!==i&&(e=e.slice(0,i)),e+=(-1===e.indexOf("?")?"?":"&")+n}return e},Bc=Ec;function Tc(){this.handlers=[]}Tc.prototype.use=function(e,t){return this.handlers.push({fulfilled:e,rejected:t}),this.handlers.length-1},Tc.prototype.eject=function(e){this.handlers[e]&&(this.handlers[e]=null)},Tc.prototype.forEach=function(e){Bc.forEach(this.handlers,(function(t){null!==t&&e(t)}))};var kc,Oc,Sc=Tc,Uc=Ec;function _c(){return Oc?kc:(Oc=1,kc=function(e){return!(!e||!e.__CANCEL__)})}var Nc,Ac,Rc,Mc,Lc,Fc,Pc,jc,Dc,qc,$c,Hc,zc,Gc,Kc,Vc,Qc,Wc,Yc,Jc,Xc=Ec;function Zc(){return Ac||(Ac=1,Nc=function(e,t,r,n,o){return e.config=t,r&&(e.code=r),e.request=n,e.response=o,e.isAxiosError=!0,e.toJSON=function(){return{message:this.message,name:this.name,description:this.description,number:this.number,fileName:this.fileName,lineNumber:this.lineNumber,columnNumber:this.columnNumber,stack:this.stack,config:this.config,code:this.code}},e}),Nc}function el(){if(Mc)return Rc;Mc=1;var e=Zc();return Rc=function(t,r,n,o,i){var s=new Error(t);return e(s,r,n,o,i)},Rc}function tl(){if(Fc)return Lc;Fc=1;var e=el();return Lc=function(t,r,n){var o=n.config.validateStatus;!o||o(n.status)?t(n):r(e("Request failed with status code "+n.status,n.config,null,n.request,n))}}function rl(){if(Hc)return $c;Hc=1;var e=jc?Pc:(jc=1,Pc=function(e){return/^([a-z][a-z\d\+\-\.]*:)?\/\//i.test(e)}),t=qc?Dc:(qc=1,Dc=function(e,t){return t?e.replace(/\/+$/,"")+"/"+t.replace(/^\/+/,""):e});return $c=function(r,n){return r&&!e(n)?t(r,n):n}}var nl,ol,il,sl,al={exports:{}},ul={exports:{}},cl={exports:{}},ll={exports:{}};function fl(){return il||(il=1,function(e,t){function r(e){var r;function o(){if(o.enabled){var e=o,n=+new Date,i=n-(r||n);e.diff=i,e.prev=r,e.curr=n,r=n;for(var s=new Array(arguments.length),a=0;a<s.length;a++)s[a]=arguments[a];s[0]=t.coerce(s[0]),"string"!=typeof s[0]&&s.unshift("%O");var u=0;s[0]=s[0].replace(/%([a-zA-Z%])/g,(function(r,n){if("%%"===r)return r;u++;var o=t.formatters[n];if("function"==typeof o){var i=s[u];r=o.call(e,i),s.splice(u,1),u--}return r})),t.formatArgs.call(e,s);var c=o.log||t.log||console.log.bind(console);c.apply(e,s)}}return o.namespace=e,o.enabled=t.enabled(e),o.useColors=t.useColors(),o.color=function(e){var r,n=0;for(r in e)n=(n<<5)-n+e.charCodeAt(r),n|=0;return t.colors[Math.abs(n)%t.colors.length]}(e),o.destroy=n,"function"==typeof t.init&&t.init(o),t.instances.push(o),o}function n(){var e=t.instances.indexOf(this);return-1!==e&&(t.instances.splice(e,1),!0)}(t=ll.exports=r.debug=r.default=r).coerce=function(e){return e instanceof Error?e.stack||e.message:e},t.disable=function(){t.enable("")},t.enable=function(e){var r;t.save(e),t.names=[],t.skips=[];var n=("string"==typeof e?e:"").split(/[\s,]+/),o=n.length;for(r=0;r<o;r++)n[r]&&("-"===(e=n[r].replace(/\*/g,".*?"))[0]?t.skips.push(new RegExp("^"+e.substr(1)+"$")):t.names.push(new RegExp("^"+e+"$")));for(r=0;r<t.instances.length;r++){var i=t.instances[r];i.enabled=t.enabled(i.namespace)}},t.enabled=function(e){if("*"===e[e.length-1])return!0;var r,n;for(r=0,n=t.skips.length;r<n;r++)if(t.skips[r].test(e))return!1;for(r=0,n=t.names.length;r<n;r++)if(t.names[r].test(e))return!0;return!1},t.humanize=function(){if(ol)return nl;ol=1;var e=1e3,t=60*e,r=60*t,n=24*r;function o(e,t,r){if(!(e<t))return e<1.5*t?Math.floor(e/t)+" "+r:Math.ceil(e/t)+" "+r+"s"}return nl=function(i,s){s=s||{};var a=typeof i;if("string"===a&&i.length>0)return function(o){if(!((o=String(o)).length>100)){var i=/^((?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|years?|yrs?|y)?$/i.exec(o);if(i){var s=parseFloat(i[1]);switch((i[2]||"ms").toLowerCase()){case"years":case"year":case"yrs":case"yr":case"y":return 315576e5*s;case"days":case"day":case"d":return s*n;case"hours":case"hour":case"hrs":case"hr":case"h":return s*r;case"minutes":case"minute":case"mins":case"min":case"m":return s*t;case"seconds":case"second":case"secs":case"sec":case"s":return s*e;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return s;default:return}}}}(i);if("number"===a&&!1===isNaN(i))return s.long?function(i){return o(i,n,"day")||o(i,r,"hour")||o(i,t,"minute")||o(i,e,"second")||i+" ms"}(i):function(o){return o>=n?Math.round(o/n)+"d":o>=r?Math.round(o/r)+"h":o>=t?Math.round(o/t)+"m":o>=e?Math.round(o/e)+"s":o+"ms"}(i);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(i))}}(),t.instances=[],t.names=[],t.skips=[],t.formatters={}}(0,ll.exports)),ll.exports}var hl={exports:{}};const dl=y.default,pl=(e,t)=>{t=t||process.argv;const r=e.startsWith("-")?"":1===e.length?"-":"--",n=t.indexOf(r+e),o=t.indexOf("--");return-1!==n&&(-1===o||n<o)},gl=process.env;let ml;function bl(e){const t=function(e){if(!1===ml)return 0;if(pl("color=16m")||pl("color=full")||pl("color=truecolor"))return 3;if(pl("color=256"))return 2;if(e&&!e.isTTY&&!0!==ml)return 0;const t=ml?1:0;if("win32"===process.platform){const e=dl.release().split(".");return Number(process.versions.node.split(".")[0])>=8&&Number(e[0])>=10&&Number(e[2])>=10586?Number(e[2])>=14931?3:2:1}if("CI"in gl)return["TRAVIS","CIRCLECI","APPVEYOR","GITLAB_CI"].some((e=>e in gl))||"codeship"===gl.CI_NAME?1:t;if("TEAMCITY_VERSION"in gl)return/^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.test(gl.TEAMCITY_VERSION)?1:0;if("truecolor"===gl.COLORTERM)return 3;if("TERM_PROGRAM"in gl){const e=parseInt((gl.TERM_PROGRAM_VERSION||"").split(".")[0],10);switch(gl.TERM_PROGRAM){case"iTerm.app":return e>=3?3:2;case"Apple_Terminal":return 2}}return/-256(color)?$/i.test(gl.TERM)?2:/^screen|^xterm|^vt100|^vt220|^rxvt|color|ansi|cygwin|linux/i.test(gl.TERM)||"COLORTERM"in gl?1:(gl.TERM,t)}(e);return function(e){return 0!==e&&{level:e,hasBasic:!0,has256:e>=2,has16m:e>=3}}(t)}pl("no-color")||pl("no-colors")||pl("color=false")?ml=!1:(pl("color")||pl("colors")||pl("color=true")||pl("color=always"))&&(ml=!0),"FORCE_COLOR"in gl&&(ml=0===gl.FORCE_COLOR.length||0!==parseInt(gl.FORCE_COLOR,10));var vl,yl,wl,El={supportsColor:bl,stdout:bl(process.stdout),stderr:bl(process.stderr)};function Il(){if(wl)return al.exports;wl=1;var e=S.default,t=k.default,r=O.default,n=E.default,o=I.default.Writable,i=function(){return yl||(yl=1,e=ul,"undefined"==typeof process||"renderer"===process.type?e.exports=(sl||(sl=1,function(e,t){function r(){var e;try{e=t.storage.debug}catch(e){}return!e&&"undefined"!=typeof process&&"env"in process&&(e=process.env.DEBUG),e}(t=cl.exports=fl()).log=function(){return"object"==typeof console&&console.log&&Function.prototype.apply.call(console.log,console,arguments)},t.formatArgs=function(e){var r=this.useColors;if(e[0]=(r?"%c":"")+this.namespace+(r?" %c":" ")+e[0]+(r?"%c ":" ")+"+"+t.humanize(this.diff),r){var n="color: "+this.color;e.splice(1,0,n,"color: inherit");var o=0,i=0;e[0].replace(/%[a-zA-Z%]/g,(function(e){"%%"!==e&&(o++,"%c"===e&&(i=o))})),e.splice(i,0,n)}},t.save=function(e){try{null==e?t.storage.removeItem("debug"):t.storage.debug=e}catch(e){}},t.load=r,t.useColors=function(){return!("undefined"==typeof window||!window.process||"renderer"!==window.process.type)||("undefined"==typeof navigator||!navigator.userAgent||!navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/))&&("undefined"!=typeof document&&document.documentElement&&document.documentElement.style&&document.documentElement.style.WebkitAppearance||"undefined"!=typeof window&&window.console&&(window.console.firebug||window.console.exception&&window.console.table)||"undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/)&&parseInt(RegExp.$1,10)>=31||"undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/))},t.storage="undefined"!=typeof chrome&&void 0!==chrome.storage?chrome.storage.local:function(){try{return window.localStorage}catch(e){}}(),t.colors=["#0000CC","#0000FF","#0033CC","#0033FF","#0066CC","#0066FF","#0099CC","#0099FF","#00CC00","#00CC33","#00CC66","#00CC99","#00CCCC","#00CCFF","#3300CC","#3300FF","#3333CC","#3333FF","#3366CC","#3366FF","#3399CC","#3399FF","#33CC00","#33CC33","#33CC66","#33CC99","#33CCCC","#33CCFF","#6600CC","#6600FF","#6633CC","#6633FF","#66CC00","#66CC33","#9900CC","#9900FF","#9933CC","#9933FF","#99CC00","#99CC33","#CC0000","#CC0033","#CC0066","#CC0099","#CC00CC","#CC00FF","#CC3300","#CC3333","#CC3366","#CC3399","#CC33CC","#CC33FF","#CC6600","#CC6633","#CC9900","#CC9933","#CCCC00","#CCCC33","#FF0000","#FF0033","#FF0066","#FF0099","#FF00CC","#FF00FF","#FF3300","#FF3333","#FF3366","#FF3399","#FF33CC","#FF33FF","#FF6600","#FF6633","#FF9900","#FF9933","#FFCC00","#FFCC33"],t.formatters.j=function(e){try{return JSON.stringify(e)}catch(e){return"[UnexpectedJSONParseError]: "+e.message}},t.enable(r())}(0,cl.exports)),cl.exports):e.exports=(vl||(vl=1,function(e,t){var r=b.default,n=v.default;(t=hl.exports=fl()).init=function(e){e.inspectOpts={};for(var r=Object.keys(t.inspectOpts),n=0;n<r.length;n++)e.inspectOpts[r[n]]=t.inspectOpts[r[n]]},t.log=function(){return process.stderr.write(n.format.apply(n,arguments)+"\n")},t.formatArgs=function(e){var r=this.namespace;if(this.useColors){var n=this.color,o="[3"+(n<8?n:"8;5;"+n),i=" "+o+";1m"+r+" ";e[0]=i+e[0].split("\n").join("\n"+i),e.push(o+"m+"+t.humanize(this.diff)+"")}else e[0]=(t.inspectOpts.hideDate?"":(new Date).toISOString()+" ")+r+" "+e[0]},t.save=function(e){null==e?delete process.env.DEBUG:process.env.DEBUG=e},t.load=o,t.useColors=function(){return"colors"in t.inspectOpts?Boolean(t.inspectOpts.colors):r.isatty(process.stderr.fd)},t.colors=[6,2,3,4,5,1];try{El&&El.level>=2&&(t.colors=[20,21,26,27,32,33,38,39,40,41,42,43,44,45,56,57,62,63,68,69,74,75,76,77,78,79,80,81,92,93,98,99,112,113,128,129,134,135,148,149,160,161,162,163,164,165,166,167,168,169,170,171,172,173,178,179,184,185,196,197,198,199,200,201,202,203,204,205,206,207,208,209,214,215,220,221])}catch(e){}function o(){return process.env.DEBUG}t.inspectOpts=Object.keys(process.env).filter((function(e){return/^debug_/i.test(e)})).reduce((function(e,t){var r=t.substring(6).toLowerCase().replace(/_([a-z])/g,(function(e,t){return t.toUpperCase()})),n=process.env[t];return n=!!/^(yes|on|true|enabled)$/i.test(n)||!/^(no|off|false|disabled)$/i.test(n)&&("null"===n?null:Number(n)),e[r]=n,e}),{}),t.formatters.o=function(e){return this.inspectOpts.colors=this.useColors,n.inspect(e,this.inspectOpts).split("\n").map((function(e){return e.trim()})).join(" ")},t.formatters.O=function(e){return this.inspectOpts.colors=this.useColors,n.inspect(e,this.inspectOpts)},t.enable(o())}(0,hl.exports)),hl.exports)),ul.exports;var e}()("follow-redirects"),s={GET:!0,HEAD:!0,OPTIONS:!0,TRACE:!0},a=Object.create(null);function u(e,t){o.call(this),e.headers=e.headers||{},this._options=e,this._redirectCount=0,this._redirects=[],this._requestBodyLength=0,this._requestBodyBuffers=[],e.host&&(e.hostname||(e.hostname=e.host),delete e.host),t&&this.on("response",t);var r=this;if(this._onNativeResponse=function(e){r._processResponse(e)},!e.pathname&&e.path){var n=e.path.indexOf("?");n<0?e.pathname=e.path:(e.pathname=e.path.substring(0,n),e.search=e.path.substring(n))}this._performRequest()}function c(t){var r={maxRedirects:21,maxBodyLength:10485760},o={};return Object.keys(t).forEach((function(s){var a=s+":",c=o[a]=t[s],l=r[s]=Object.create(c);l.request=function(t,s){return"string"==typeof t?(t=e.parse(t)).maxRedirects=r.maxRedirects:t=Object.assign({protocol:a,maxRedirects:r.maxRedirects,maxBodyLength:r.maxBodyLength},t),t.nativeProtocols=o,n.equal(t.protocol,a,"protocol mismatch"),i("options",t),new u(t,s)},l.get=function(e,t){var r=l.request(e,t);return r.end(),r}})),r}return["abort","aborted","error","socket","timeout"].forEach((function(e){a[e]=function(t){this._redirectable.emit(e,t)}})),u.prototype=Object.create(o.prototype),u.prototype.write=function(e,t,r){if(!("string"==typeof e||"object"==typeof e&&"length"in e))throw new Error("data should be a string, Buffer or Uint8Array");"function"==typeof t&&(r=t,t=null),0!==e.length?this._requestBodyLength+e.length<=this._options.maxBodyLength?(this._requestBodyLength+=e.length,this._requestBodyBuffers.push({data:e,encoding:t}),this._currentRequest.write(e,t,r)):(this.emit("error",new Error("Request body larger than maxBodyLength limit")),this.abort()):r&&r()},u.prototype.end=function(e,t,r){"function"==typeof e?(r=e,e=t=null):"function"==typeof t&&(r=t,t=null);var n=this._currentRequest;this.write(e||"",t,(function(){n.end(null,null,r)}))},u.prototype.setHeader=function(e,t){this._options.headers[e]=t,this._currentRequest.setHeader(e,t)},u.prototype.removeHeader=function(e){delete this._options.headers[e],this._currentRequest.removeHeader(e)},["abort","flushHeaders","getHeader","setNoDelay","setSocketKeepAlive","setTimeout"].forEach((function(e){u.prototype[e]=function(t,r){return this._currentRequest[e](t,r)}})),["aborted","connection","socket"].forEach((function(e){Object.defineProperty(u.prototype,e,{get:function(){return this._currentRequest[e]}})})),u.prototype._performRequest=function(){var t=this._options.protocol,r=this._options.nativeProtocols[t];if(r){if(this._options.agents){var n=t.substr(0,t.length-1);this._options.agent=this._options.agents[n]}var o=this._currentRequest=r.request(this._options,this._onNativeResponse);for(var i in this._currentUrl=e.format(this._options),o._redirectable=this,a)i&&o.on(i,a[i]);if(this._isRedirect){var s=0,u=this._requestBodyBuffers;!function e(){if(s<u.length){var t=u[s++];o.write(t.data,t.encoding,e)}else o.end()}()}}else this.emit("error",new Error("Unsupported protocol "+t))},u.prototype._processResponse=function(t){this._options.trackRedirects&&this._redirects.push({url:this._currentUrl,headers:t.headers,statusCode:t.statusCode});var r=t.headers.location;if(r&&!1!==this._options.followRedirects&&t.statusCode>=300&&t.statusCode<400){if(++this._redirectCount>this._options.maxRedirects)return void this.emit("error",new Error("Max redirects exceeded."));var n,o=this._options.headers;if(307!==t.statusCode&&!(this._options.method in s))for(n in this._options.method="GET",this._requestBodyBuffers=[],o)/^content-/i.test(n)&&delete o[n];if(!this._isRedirect)for(n in o)/^host$/i.test(n)&&delete o[n];var a=e.resolve(this._currentUrl,r);i("redirecting to",a),Object.assign(this._options,e.parse(a)),this._isRedirect=!0,this._performRequest(),t.destroy()}else t.responseUrl=this._currentUrl,t.redirects=this._redirects,this.emit("response",t),this._requestBodyBuffers=[]},al.exports=c({http:t,https:r}),al.exports.wrap=c,al.exports}var Cl,xl,Bl={name:"axios",version:"0.19.2",description:"Promise based HTTP client for the browser and node.js",main:"index.js",scripts:{test:"grunt test && bundlesize",start:"node ./sandbox/server.js",build:"NODE_ENV=production grunt build",preversion:"npm test",version:"npm run build && grunt version && git add -A dist && git add CHANGELOG.md bower.json package.json",postversion:"git push && git push --tags",examples:"node ./examples/server.js",coveralls:"cat coverage/lcov.info | ./node_modules/coveralls/bin/coveralls.js",fix:"eslint --fix lib/**/*.js"},repository:{type:"git",url:"https://github.com/axios/axios.git"},keywords:["xhr","http","ajax","promise","node"],author:"Matt Zabriskie",license:"MIT",bugs:{url:"https://github.com/axios/axios/issues"},homepage:"https://github.com/axios/axios",devDependencies:{bundlesize:"^0.17.0",coveralls:"^3.0.0","es6-promise":"^4.2.4",grunt:"^1.0.2","grunt-banner":"^0.6.0","grunt-cli":"^1.2.0","grunt-contrib-clean":"^1.1.0","grunt-contrib-watch":"^1.0.0","grunt-eslint":"^20.1.0","grunt-karma":"^2.0.0","grunt-mocha-test":"^0.13.3","grunt-ts":"^6.0.0-beta.19","grunt-webpack":"^1.0.18","istanbul-instrumenter-loader":"^1.0.0","jasmine-core":"^2.4.1",karma:"^1.3.0","karma-chrome-launcher":"^2.2.0","karma-coverage":"^1.1.1","karma-firefox-launcher":"^1.1.0","karma-jasmine":"^1.1.1","karma-jasmine-ajax":"^0.1.13","karma-opera-launcher":"^1.0.0","karma-safari-launcher":"^1.0.0","karma-sauce-launcher":"^1.2.0","karma-sinon":"^1.0.5","karma-sourcemap-loader":"^0.3.7","karma-webpack":"^1.7.0","load-grunt-tasks":"^3.5.2",minimist:"^1.2.0",mocha:"^5.2.0",sinon:"^4.5.0",typescript:"^2.8.1","url-search-params":"^0.10.0",webpack:"^1.13.1","webpack-dev-server":"^1.14.1"},browser:{"./lib/adapters/http.js":"./lib/adapters/xhr.js"},typings:"./index.d.ts",dependencies:{"follow-redirects":"1.5.10"},bundlesize:[{path:"./dist/axios.min.js",threshold:"5kB"}]},Tl=Ec,kl=function(e,t){Xc.forEach(e,(function(r,n){n!==t&&n.toUpperCase()===t.toUpperCase()&&(e[t]=r,delete e[n])}))},Ol={"Content-Type":"application/x-www-form-urlencoded"};function Sl(e,t){!Tl.isUndefined(e)&&Tl.isUndefined(e["Content-Type"])&&(e["Content-Type"]=t)}var Ul,_l={adapter:("undefined"!=typeof XMLHttpRequest?Ul=function(){if(Jc)return Yc;Jc=1;var e=Ec,t=tl(),r=xc,n=rl(),o=function(){if(Gc)return zc;Gc=1;var e=Ec,t=["age","authorization","content-length","content-type","etag","expires","from","host","if-modified-since","if-unmodified-since","last-modified","location","max-forwards","proxy-authorization","referer","retry-after","user-agent"];return zc=function(r){var n,o,i,s={};return r?(e.forEach(r.split("\n"),(function(r){if(i=r.indexOf(":"),n=e.trim(r.substr(0,i)).toLowerCase(),o=e.trim(r.substr(i+1)),n){if(s[n]&&t.indexOf(n)>=0)return;s[n]="set-cookie"===n?(s[n]?s[n]:[]).concat([o]):s[n]?s[n]+", "+o:o}})),s):s},zc}(),i=function(){if(Vc)return Kc;Vc=1;var e=Ec;return Kc=e.isStandardBrowserEnv()?function(){var t,r=/(msie|trident)/i.test(navigator.userAgent),n=document.createElement("a");function o(e){var t=e;return r&&(n.setAttribute("href",t),t=n.href),n.setAttribute("href",t),{href:n.href,protocol:n.protocol?n.protocol.replace(/:$/,""):"",host:n.host,search:n.search?n.search.replace(/^\?/,""):"",hash:n.hash?n.hash.replace(/^#/,""):"",hostname:n.hostname,port:n.port,pathname:"/"===n.pathname.charAt(0)?n.pathname:"/"+n.pathname}}return t=o(window.location.href),function(r){var n=e.isString(r)?o(r):r;return n.protocol===t.protocol&&n.host===t.host}}():function(){return!0}}(),s=el();return Yc=function(a){return new Promise((function(u,c){var l=a.data,f=a.headers;e.isFormData(l)&&delete f["Content-Type"];var h=new XMLHttpRequest;if(a.auth){var d=a.auth.username||"",p=a.auth.password||"";f.Authorization="Basic "+btoa(d+":"+p)}var g=n(a.baseURL,a.url);if(h.open(a.method.toUpperCase(),r(g,a.params,a.paramsSerializer),!0),h.timeout=a.timeout,h.onreadystatechange=function(){if(h&&4===h.readyState&&(0!==h.status||h.responseURL&&0===h.responseURL.indexOf("file:"))){var e="getAllResponseHeaders"in h?o(h.getAllResponseHeaders()):null,r={data:a.responseType&&"text"!==a.responseType?h.response:h.responseText,status:h.status,statusText:h.statusText,headers:e,config:a,request:h};t(u,c,r),h=null}},h.onabort=function(){h&&(c(s("Request aborted",a,"ECONNABORTED",h)),h=null)},h.onerror=function(){c(s("Network Error",a,null,h)),h=null},h.ontimeout=function(){var e="timeout of "+a.timeout+"ms exceeded";a.timeoutErrorMessage&&(e=a.timeoutErrorMessage),c(s(e,a,"ECONNABORTED",h)),h=null},e.isStandardBrowserEnv()){var m=function(){if(Wc)return Qc;Wc=1;var e=Ec;return Qc=e.isStandardBrowserEnv()?{write:function(t,r,n,o,i,s){var a=[];a.push(t+"="+encodeURIComponent(r)),e.isNumber(n)&&a.push("expires="+new Date(n).toGMTString()),e.isString(o)&&a.push("path="+o),e.isString(i)&&a.push("domain="+i),!0===s&&a.push("secure"),document.cookie=a.join("; ")},read:function(e){var t=document.cookie.match(new RegExp("(^|;\\s*)("+e+")=([^;]*)"));return t?decodeURIComponent(t[3]):null},remove:function(e){this.write(e,"",Date.now()-864e5)}}:{write:function(){},read:function(){return null},remove:function(){}},Qc}(),b=(a.withCredentials||i(g))&&a.xsrfCookieName?m.read(a.xsrfCookieName):void 0;b&&(f[a.xsrfHeaderName]=b)}if("setRequestHeader"in h&&e.forEach(f,(function(e,t){void 0===l&&"content-type"===t.toLowerCase()?delete f[t]:h.setRequestHeader(t,e)})),e.isUndefined(a.withCredentials)||(h.withCredentials=!!a.withCredentials),a.responseType)try{h.responseType=a.responseType}catch(e){if("json"!==a.responseType)throw e}"function"==typeof a.onDownloadProgress&&h.addEventListener("progress",a.onDownloadProgress),"function"==typeof a.onUploadProgress&&h.upload&&h.upload.addEventListener("progress",a.onUploadProgress),a.cancelToken&&a.cancelToken.promise.then((function(e){h&&(h.abort(),c(e),h=null)})),void 0===l&&(l=null),h.send(l)}))},Yc}():"undefined"!=typeof process&&"[object process]"===Object.prototype.toString.call(process)&&(Ul=function(){if(xl)return Cl;xl=1;var e=Ec,t=tl(),r=rl(),n=xc,o=k.default,i=O.default,s=Il().http,a=Il().https,u=S.default,c=U.default,l=Bl,f=el(),h=Zc(),d=/https:?/;return Cl=function(p){return new Promise((function(g,m){var b=function(e){g(e)},v=function(e){m(e)},y=p.data,w=p.headers;if(w["User-Agent"]||w["user-agent"]||(w["User-Agent"]="axios/"+l.version),y&&!e.isStream(y)){if(Buffer.isBuffer(y));else if(e.isArrayBuffer(y))y=Buffer.from(new Uint8Array(y));else{if(!e.isString(y))return v(f("Data after transformation must be a string, an ArrayBuffer, a Buffer, or a Stream",p));y=Buffer.from(y,"utf-8")}w["Content-Length"]=y.length}var E=void 0;p.auth&&(E=(p.auth.username||"")+":"+(p.auth.password||""));var I=r(p.baseURL,p.url),C=u.parse(I),x=C.protocol||"http:";if(!E&&C.auth){var B=C.auth.split(":");E=(B[0]||"")+":"+(B[1]||"")}E&&delete w.Authorization;var T=d.test(x),k=T?p.httpsAgent:p.httpAgent,O={path:n(C.path,p.params,p.paramsSerializer).replace(/^\?/,""),method:p.method.toUpperCase(),headers:w,agent:k,agents:{http:p.httpAgent,https:p.httpsAgent},auth:E};p.socketPath?O.socketPath=p.socketPath:(O.hostname=C.hostname,O.port=C.port);var S,U=p.proxy;if(!U&&!1!==U){var _=x.slice(0,-1)+"_proxy",N=process.env[_]||process.env[_.toUpperCase()];if(N){var A=u.parse(N),R=process.env.no_proxy||process.env.NO_PROXY,M=!0;if(R&&(M=!R.split(",").map((function(e){return e.trim()})).some((function(e){return!!e&&("*"===e||"."===e[0]&&C.hostname.substr(C.hostname.length-e.length)===e||C.hostname===e)}))),M&&(U={host:A.hostname,port:A.port},A.auth)){var L=A.auth.split(":");U.auth={username:L[0],password:L[1]}}}}if(U&&(O.hostname=U.host,O.host=U.host,O.headers.host=C.hostname+(C.port?":"+C.port:""),O.port=U.port,O.path=x+"//"+C.hostname+(C.port?":"+C.port:"")+O.path,U.auth)){var F=Buffer.from(U.auth.username+":"+U.auth.password,"utf8").toString("base64");O.headers["Proxy-Authorization"]="Basic "+F}var P=T&&(!U||d.test(U.protocol));p.transport?S=p.transport:0===p.maxRedirects?S=P?i:o:(p.maxRedirects&&(O.maxRedirects=p.maxRedirects),S=P?a:s),p.maxContentLength&&p.maxContentLength>-1&&(O.maxBodyLength=p.maxContentLength);var j=S.request(O,(function(e){if(!j.aborted){var r=e;switch(e.headers["content-encoding"]){case"gzip":case"compress":case"deflate":r=204===e.statusCode?r:r.pipe(c.createUnzip()),delete e.headers["content-encoding"]}var n=e.req||j,o={status:e.statusCode,statusText:e.statusMessage,headers:e.headers,config:p,request:n};if("stream"===p.responseType)o.data=r,t(b,v,o);else{var i=[];r.on("data",(function(e){i.push(e),p.maxContentLength>-1&&Buffer.concat(i).length>p.maxContentLength&&(r.destroy(),v(f("maxContentLength size of "+p.maxContentLength+" exceeded",p,null,n)))})),r.on("error",(function(e){j.aborted||v(h(e,p,null,n))})),r.on("end",(function(){var e=Buffer.concat(i);"arraybuffer"!==p.responseType&&(e=e.toString(p.responseEncoding)),o.data=e,t(b,v,o)}))}}}));j.on("error",(function(e){j.aborted||v(h(e,p,null,j))})),p.timeout&&j.setTimeout(p.timeout,(function(){j.abort(),v(f("timeout of "+p.timeout+"ms exceeded",p,"ECONNABORTED",j))})),p.cancelToken&&p.cancelToken.promise.then((function(e){j.aborted||(j.abort(),v(e))})),e.isStream(y)?y.on("error",(function(e){v(h(e,p,null,j))})).pipe(j):j.end(y)}))},Cl}()),Ul),transformRequest:[function(e,t){return kl(t,"Accept"),kl(t,"Content-Type"),Tl.isFormData(e)||Tl.isArrayBuffer(e)||Tl.isBuffer(e)||Tl.isStream(e)||Tl.isFile(e)||Tl.isBlob(e)?e:Tl.isArrayBufferView(e)?e.buffer:Tl.isURLSearchParams(e)?(Sl(t,"application/x-www-form-urlencoded;charset=utf-8"),e.toString()):Tl.isObject(e)?(Sl(t,"application/json;charset=utf-8"),JSON.stringify(e)):e}],transformResponse:[function(e){if("string"==typeof e)try{e=JSON.parse(e)}catch(e){}return e}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,validateStatus:function(e){return e>=200&&e<300},headers:{common:{Accept:"application/json, text/plain, */*"}}};Tl.forEach(["delete","get","head"],(function(e){_l.headers[e]={}})),Tl.forEach(["post","put","patch"],(function(e){_l.headers[e]=Tl.merge(Ol)}));var Nl=_l,Al=Ec,Rl=function(e,t,r){return Uc.forEach(r,(function(r){e=r(e,t)})),e},Ml=_c(),Ll=Nl;function Fl(e){e.cancelToken&&e.cancelToken.throwIfRequested()}var Pl,jl,Dl,ql,$l,Hl,zl=Ec,Gl=function(e,t){t=t||{};var r={},n=["url","method","params","data"],o=["headers","auth","proxy"],i=["baseURL","url","transformRequest","transformResponse","paramsSerializer","timeout","withCredentials","adapter","responseType","xsrfCookieName","xsrfHeaderName","onUploadProgress","onDownloadProgress","maxContentLength","validateStatus","maxRedirects","httpAgent","httpsAgent","cancelToken","socketPath"];zl.forEach(n,(function(e){void 0!==t[e]&&(r[e]=t[e])})),zl.forEach(o,(function(n){zl.isObject(t[n])?r[n]=zl.deepMerge(e[n],t[n]):void 0!==t[n]?r[n]=t[n]:zl.isObject(e[n])?r[n]=zl.deepMerge(e[n]):void 0!==e[n]&&(r[n]=e[n])})),zl.forEach(i,(function(n){void 0!==t[n]?r[n]=t[n]:void 0!==e[n]&&(r[n]=e[n])}));var s=n.concat(o).concat(i),a=Object.keys(t).filter((function(e){return-1===s.indexOf(e)}));return zl.forEach(a,(function(n){void 0!==t[n]?r[n]=t[n]:void 0!==e[n]&&(r[n]=e[n])})),r},Kl=Ec,Vl=xc,Ql=Sc,Wl=function(e){return Fl(e),e.headers=e.headers||{},e.data=Rl(e.data,e.headers,e.transformRequest),e.headers=Al.merge(e.headers.common||{},e.headers[e.method]||{},e.headers),Al.forEach(["delete","get","head","post","put","patch","common"],(function(t){delete e.headers[t]})),(e.adapter||Ll.adapter)(e).then((function(t){return Fl(e),t.data=Rl(t.data,t.headers,e.transformResponse),t}),(function(t){return Ml(t)||(Fl(e),t&&t.response&&(t.response.data=Rl(t.response.data,t.response.headers,e.transformResponse))),Promise.reject(t)}))},Yl=Gl;function Jl(e){this.defaults=e,this.interceptors={request:new Ql,response:new Ql}}function Xl(){if(jl)return Pl;function e(e){this.message=e}return jl=1,e.prototype.toString=function(){return"Cancel"+(this.message?": "+this.message:"")},e.prototype.__CANCEL__=!0,Pl=e}Jl.prototype.request=function(e){"string"==typeof e?(e=arguments[1]||{}).url=arguments[0]:e=e||{},(e=Yl(this.defaults,e)).method?e.method=e.method.toLowerCase():this.defaults.method?e.method=this.defaults.method.toLowerCase():e.method="get";var t=[Wl,void 0],r=Promise.resolve(e);for(this.interceptors.request.forEach((function(e){t.unshift(e.fulfilled,e.rejected)})),this.interceptors.response.forEach((function(e){t.push(e.fulfilled,e.rejected)}));t.length;)r=r.then(t.shift(),t.shift());return r},Jl.prototype.getUri=function(e){return e=Yl(this.defaults,e),Vl(e.url,e.params,e.paramsSerializer).replace(/^\?/,"")},Kl.forEach(["delete","get","head","options"],(function(e){Jl.prototype[e]=function(t,r){return this.request(Kl.merge(r||{},{method:e,url:t}))}})),Kl.forEach(["post","put","patch"],(function(e){Jl.prototype[e]=function(t,r,n){return this.request(Kl.merge(n||{},{method:e,url:t,data:r}))}}));var Zl=Ec,ef=dc,tf=Jl,rf=Gl;function nf(e){var t=new tf(e),r=ef(tf.prototype.request,t);return Zl.extend(r,tf.prototype,t),Zl.extend(r,t),r}var of=nf(Nl);of.Axios=tf,of.create=function(e){return nf(rf(of.defaults,e))},of.Cancel=Xl(),of.CancelToken=function(){if(ql)return Dl;ql=1;var e=Xl();function t(t){if("function"!=typeof t)throw new TypeError("executor must be a function.");var r;this.promise=new Promise((function(e){r=e}));var n=this;t((function(t){n.reason||(n.reason=new e(t),r(n.reason))}))}return t.prototype.throwIfRequested=function(){if(this.reason)throw this.reason},t.source=function(){var e;return{token:new t((function(t){e=t})),cancel:e}},Dl=t}(),of.isCancel=_c(),of.all=function(e){return Promise.all(e)},of.spread=Hl?$l:(Hl=1,$l=function(e){return function(t){return e.apply(null,t)}}),hc.exports=of,hc.exports.default=of,fc.exports=hc.exports;var sf={},af=function(e){var t=e.default;if("function"==typeof t){var r=function(){return t.apply(this,arguments)};r.prototype=t.prototype}else r={};return Object.defineProperty(r,"__esModule",{value:!0}),Object.keys(e).forEach((function(t){var n=Object.getOwnPropertyDescriptor(e,t);Object.defineProperty(r,t,n.get?n:{enumerable:!0,get:function(){return e[t]}})})),r}(ac),uf=cc&&cc.__assign||Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++)for(var o in t=arguments[r])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e};Object.defineProperty(sf,"__esModule",{value:!0});var cf=af,lf=fc.exports;sf.createObservable=function(e){for(var t=[],r=1;r<arguments.length;r++)t[r-1]=arguments[r];var n,o=t[t.length-1];o=o?uf({},o):{},t[t.length-1]=o;var i=!!o.cancelToken;i&&console.warn("No need to use cancel token, just unsubscribe the subscription would cancel the http request automatically");var s=new cf.Observable((function(r){i||(n=lf.default.CancelToken.source(),o.cancelToken=n.token),e.apply(void 0,t).then((function(e){r.next(e),r.complete()})).catch((function(e){return r.error(e)}))})),a=s.subscribe.bind(s);return s.subscribe=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var r=a.apply(void 0,e),o=r.unsubscribe.bind(r);return r.unsubscribe=function(){n&&n.cancel(),o()},r},s},Object.defineProperty(lc,"__esModule",{value:!0});var ff=fc.exports,hf=sf,df=function(){function e(e){this.axiosInstance=e}return Object.defineProperty(e.prototype,"defaults",{get:function(){return this.axiosInstance.defaults},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"interceptors",{get:function(){return this.axiosInstance.interceptors},enumerable:!0,configurable:!0}),e.request=function(e){return hf.createObservable(ff.default.request,e)},e.get=function(e,t){return hf.createObservable(ff.default.get,e,t)},e.post=function(e,t,r){return hf.createObservable(ff.default.post,e,t,r)},e.put=function(e,t,r){return hf.createObservable(ff.default.put,e,t,r)},e.patch=function(e,t,r){return hf.createObservable(ff.default.patch,e,t,r)},e.delete=function(e,t){return hf.createObservable(ff.default.delete,e,t)},e.head=function(e,t){return hf.createObservable(ff.default.head,e,t)},e.create=function(t){return new e(ff.default.create(t))},e.prototype.request=function(e){return hf.createObservable(this.axiosInstance.request,e)},e.prototype.get=function(e,t){return hf.createObservable(this.axiosInstance.get,e,t)},e.prototype.head=function(e,t){return hf.createObservable(this.axiosInstance.head,e,t)},e.prototype.post=function(e,t,r){return hf.createObservable(this.axiosInstance.post,e,t,r)},e.prototype.put=function(e,t,r){return hf.createObservable(this.axiosInstance.put,e,t,r)},e.prototype.patch=function(e,t,r){return hf.createObservable(this.axiosInstance.patch,e,t,r)},e.prototype.delete=function(e,t){return hf.createObservable(this.axiosInstance.delete,e,t)},e.defaults=ff.default.defaults,e.interceptors=ff.default.interceptors,e}();lc.Axios=df,(lc.default=df).interceptors.response.use((function(e){let t=e.data,r=t.indexOf("\r");const n=t.indexOf("\n");return(r<0||r+1==n)&&(r=n),t=t.substring(r+1),e.data=JSON.parse(t),e}),(function(e){return Promise.reject(e)}));var pf={exports:{}},gf=/[|\\{}()[\]^$+*?.]/g,mf=function(e){if("string"!=typeof e)throw new TypeError("Expected a string");return e.replace(gf,"\\$&")},bf={exports:{}},vf={exports:{}},yf={aliceblue:[240,248,255],antiquewhite:[250,235,215],aqua:[0,255,255],aquamarine:[127,255,212],azure:[240,255,255],beige:[245,245,220],bisque:[255,228,196],black:[0,0,0],blanchedalmond:[255,235,205],blue:[0,0,255],blueviolet:[138,43,226],brown:[165,42,42],burlywood:[222,184,135],cadetblue:[95,158,160],chartreuse:[127,255,0],chocolate:[210,105,30],coral:[255,127,80],cornflowerblue:[100,149,237],cornsilk:[255,248,220],crimson:[220,20,60],cyan:[0,255,255],darkblue:[0,0,139],darkcyan:[0,139,139],darkgoldenrod:[184,134,11],darkgray:[169,169,169],darkgreen:[0,100,0],darkgrey:[169,169,169],darkkhaki:[189,183,107],darkmagenta:[139,0,139],darkolivegreen:[85,107,47],darkorange:[255,140,0],darkorchid:[153,50,204],darkred:[139,0,0],darksalmon:[233,150,122],darkseagreen:[143,188,143],darkslateblue:[72,61,139],darkslategray:[47,79,79],darkslategrey:[47,79,79],darkturquoise:[0,206,209],darkviolet:[148,0,211],deeppink:[255,20,147],deepskyblue:[0,191,255],dimgray:[105,105,105],dimgrey:[105,105,105],dodgerblue:[30,144,255],firebrick:[178,34,34],floralwhite:[255,250,240],forestgreen:[34,139,34],fuchsia:[255,0,255],gainsboro:[220,220,220],ghostwhite:[248,248,255],gold:[255,215,0],goldenrod:[218,165,32],gray:[128,128,128],green:[0,128,0],greenyellow:[173,255,47],grey:[128,128,128],honeydew:[240,255,240],hotpink:[255,105,180],indianred:[205,92,92],indigo:[75,0,130],ivory:[255,255,240],khaki:[240,230,140],lavender:[230,230,250],lavenderblush:[255,240,245],lawngreen:[124,252,0],lemonchiffon:[255,250,205],lightblue:[173,216,230],lightcoral:[240,128,128],lightcyan:[224,255,255],lightgoldenrodyellow:[250,250,210],lightgray:[211,211,211],lightgreen:[144,238,144],lightgrey:[211,211,211],lightpink:[255,182,193],lightsalmon:[255,160,122],lightseagreen:[32,178,170],lightskyblue:[135,206,250],lightslategray:[119,136,153],lightslategrey:[119,136,153],lightsteelblue:[176,196,222],lightyellow:[255,255,224],lime:[0,255,0],limegreen:[50,205,50],linen:[250,240,230],magenta:[255,0,255],maroon:[128,0,0],mediumaquamarine:[102,205,170],mediumblue:[0,0,205],mediumorchid:[186,85,211],mediumpurple:[147,112,219],mediumseagreen:[60,179,113],mediumslateblue:[123,104,238],mediumspringgreen:[0,250,154],mediumturquoise:[72,209,204],mediumvioletred:[199,21,133],midnightblue:[25,25,112],mintcream:[245,255,250],mistyrose:[255,228,225],moccasin:[255,228,181],navajowhite:[255,222,173],navy:[0,0,128],oldlace:[253,245,230],olive:[128,128,0],olivedrab:[107,142,35],orange:[255,165,0],orangered:[255,69,0],orchid:[218,112,214],palegoldenrod:[238,232,170],palegreen:[152,251,152],paleturquoise:[175,238,238],palevioletred:[219,112,147],papayawhip:[255,239,213],peachpuff:[255,218,185],peru:[205,133,63],pink:[255,192,203],plum:[221,160,221],powderblue:[176,224,230],purple:[128,0,128],rebeccapurple:[102,51,153],red:[255,0,0],rosybrown:[188,143,143],royalblue:[65,105,225],saddlebrown:[139,69,19],salmon:[250,128,114],sandybrown:[244,164,96],seagreen:[46,139,87],seashell:[255,245,238],sienna:[160,82,45],silver:[192,192,192],skyblue:[135,206,235],slateblue:[106,90,205],slategray:[112,128,144],slategrey:[112,128,144],snow:[255,250,250],springgreen:[0,255,127],steelblue:[70,130,180],tan:[210,180,140],teal:[0,128,128],thistle:[216,191,216],tomato:[255,99,71],turquoise:[64,224,208],violet:[238,130,238],wheat:[245,222,179],white:[255,255,255],whitesmoke:[245,245,245],yellow:[255,255,0],yellowgreen:[154,205,50]},wf={};for(var Ef in yf)yf.hasOwnProperty(Ef)&&(wf[yf[Ef]]=Ef);var If=vf.exports={rgb:{channels:3,labels:"rgb"},hsl:{channels:3,labels:"hsl"},hsv:{channels:3,labels:"hsv"},hwb:{channels:3,labels:"hwb"},cmyk:{channels:4,labels:"cmyk"},xyz:{channels:3,labels:"xyz"},lab:{channels:3,labels:"lab"},lch:{channels:3,labels:"lch"},hex:{channels:1,labels:["hex"]},keyword:{channels:1,labels:["keyword"]},ansi16:{channels:1,labels:["ansi16"]},ansi256:{channels:1,labels:["ansi256"]},hcg:{channels:3,labels:["h","c","g"]},apple:{channels:3,labels:["r16","g16","b16"]},gray:{channels:1,labels:["gray"]}};for(var Cf in If)if(If.hasOwnProperty(Cf)){if(!("channels"in If[Cf]))throw new Error("missing channels property: "+Cf);if(!("labels"in If[Cf]))throw new Error("missing channel labels property: "+Cf);if(If[Cf].labels.length!==If[Cf].channels)throw new Error("channel and label counts mismatch: "+Cf);var xf=If[Cf].channels,Bf=If[Cf].labels;delete If[Cf].channels,delete If[Cf].labels,Object.defineProperty(If[Cf],"channels",{value:xf}),Object.defineProperty(If[Cf],"labels",{value:Bf})}If.rgb.hsl=function(e){var t,r,n=e[0]/255,o=e[1]/255,i=e[2]/255,s=Math.min(n,o,i),a=Math.max(n,o,i),u=a-s;return a===s?t=0:n===a?t=(o-i)/u:o===a?t=2+(i-n)/u:i===a&&(t=4+(n-o)/u),(t=Math.min(60*t,360))<0&&(t+=360),r=(s+a)/2,[t,100*(a===s?0:r<=.5?u/(a+s):u/(2-a-s)),100*r]},If.rgb.hsv=function(e){var t,r,n,o,i,s=e[0]/255,a=e[1]/255,u=e[2]/255,c=Math.max(s,a,u),l=c-Math.min(s,a,u),f=function(e){return(c-e)/6/l+.5};return 0===l?o=i=0:(i=l/c,t=f(s),r=f(a),n=f(u),s===c?o=n-r:a===c?o=1/3+t-n:u===c&&(o=2/3+r-t),o<0?o+=1:o>1&&(o-=1)),[360*o,100*i,100*c]},If.rgb.hwb=function(e){var t=e[0],r=e[1],n=e[2];return[If.rgb.hsl(e)[0],1/255*Math.min(t,Math.min(r,n))*100,100*(n=1-1/255*Math.max(t,Math.max(r,n)))]},If.rgb.cmyk=function(e){var t,r=e[0]/255,n=e[1]/255,o=e[2]/255;return[100*((1-r-(t=Math.min(1-r,1-n,1-o)))/(1-t)||0),100*((1-n-t)/(1-t)||0),100*((1-o-t)/(1-t)||0),100*t]},If.rgb.keyword=function(e){var t=wf[e];if(t)return t;var r,n,o,i=1/0;for(var s in yf)if(yf.hasOwnProperty(s)){var a=(n=e,o=yf[s],Math.pow(n[0]-o[0],2)+Math.pow(n[1]-o[1],2)+Math.pow(n[2]-o[2],2));a<i&&(i=a,r=s)}return r},If.keyword.rgb=function(e){return yf[e]},If.rgb.xyz=function(e){var t=e[0]/255,r=e[1]/255,n=e[2]/255;return[100*(.4124*(t=t>.04045?Math.pow((t+.055)/1.055,2.4):t/12.92)+.3576*(r=r>.04045?Math.pow((r+.055)/1.055,2.4):r/12.92)+.1805*(n=n>.04045?Math.pow((n+.055)/1.055,2.4):n/12.92)),100*(.2126*t+.7152*r+.0722*n),100*(.0193*t+.1192*r+.9505*n)]},If.rgb.lab=function(e){var t=If.rgb.xyz(e),r=t[0],n=t[1],o=t[2];return n/=100,o/=108.883,r=(r/=95.047)>.008856?Math.pow(r,1/3):7.787*r+16/116,[116*(n=n>.008856?Math.pow(n,1/3):7.787*n+16/116)-16,500*(r-n),200*(n-(o=o>.008856?Math.pow(o,1/3):7.787*o+16/116))]},If.hsl.rgb=function(e){var t,r,n,o,i,s=e[0]/360,a=e[1]/100,u=e[2]/100;if(0===a)return[i=255*u,i,i];t=2*u-(r=u<.5?u*(1+a):u+a-u*a),o=[0,0,0];for(var c=0;c<3;c++)(n=s+1/3*-(c-1))<0&&n++,n>1&&n--,i=6*n<1?t+6*(r-t)*n:2*n<1?r:3*n<2?t+(r-t)*(2/3-n)*6:t,o[c]=255*i;return o},If.hsl.hsv=function(e){var t=e[0],r=e[1]/100,n=e[2]/100,o=r,i=Math.max(n,.01);return r*=(n*=2)<=1?n:2-n,o*=i<=1?i:2-i,[t,100*(0===n?2*o/(i+o):2*r/(n+r)),(n+r)/2*100]},If.hsv.rgb=function(e){var t=e[0]/60,r=e[1]/100,n=e[2]/100,o=Math.floor(t)%6,i=t-Math.floor(t),s=255*n*(1-r),a=255*n*(1-r*i),u=255*n*(1-r*(1-i));switch(n*=255,o){case 0:return[n,u,s];case 1:return[a,n,s];case 2:return[s,n,u];case 3:return[s,a,n];case 4:return[u,s,n];case 5:return[n,s,a]}},If.hsv.hsl=function(e){var t,r,n,o=e[0],i=e[1]/100,s=e[2]/100,a=Math.max(s,.01);return n=(2-i)*s,r=i*a,[o,100*(r=(r/=(t=(2-i)*a)<=1?t:2-t)||0),100*(n/=2)]},If.hwb.rgb=function(e){var t,r,n,o,i,s,a,u=e[0]/360,c=e[1]/100,l=e[2]/100,f=c+l;switch(f>1&&(c/=f,l/=f),n=6*u-(t=Math.floor(6*u)),0!=(1&t)&&(n=1-n),o=c+n*((r=1-l)-c),t){default:case 6:case 0:i=r,s=o,a=c;break;case 1:i=o,s=r,a=c;break;case 2:i=c,s=r,a=o;break;case 3:i=c,s=o,a=r;break;case 4:i=o,s=c,a=r;break;case 5:i=r,s=c,a=o}return[255*i,255*s,255*a]},If.cmyk.rgb=function(e){var t=e[0]/100,r=e[1]/100,n=e[2]/100,o=e[3]/100;return[255*(1-Math.min(1,t*(1-o)+o)),255*(1-Math.min(1,r*(1-o)+o)),255*(1-Math.min(1,n*(1-o)+o))]},If.xyz.rgb=function(e){var t,r,n,o=e[0]/100,i=e[1]/100,s=e[2]/100;return r=-.9689*o+1.8758*i+.0415*s,n=.0557*o+-.204*i+1.057*s,t=(t=3.2406*o+-1.5372*i+-.4986*s)>.0031308?1.055*Math.pow(t,1/2.4)-.055:12.92*t,r=r>.0031308?1.055*Math.pow(r,1/2.4)-.055:12.92*r,n=n>.0031308?1.055*Math.pow(n,1/2.4)-.055:12.92*n,[255*(t=Math.min(Math.max(0,t),1)),255*(r=Math.min(Math.max(0,r),1)),255*(n=Math.min(Math.max(0,n),1))]},If.xyz.lab=function(e){var t=e[0],r=e[1],n=e[2];return r/=100,n/=108.883,t=(t/=95.047)>.008856?Math.pow(t,1/3):7.787*t+16/116,[116*(r=r>.008856?Math.pow(r,1/3):7.787*r+16/116)-16,500*(t-r),200*(r-(n=n>.008856?Math.pow(n,1/3):7.787*n+16/116))]},If.lab.xyz=function(e){var t,r,n,o=e[0];t=e[1]/500+(r=(o+16)/116),n=r-e[2]/200;var i=Math.pow(r,3),s=Math.pow(t,3),a=Math.pow(n,3);return r=i>.008856?i:(r-16/116)/7.787,t=s>.008856?s:(t-16/116)/7.787,n=a>.008856?a:(n-16/116)/7.787,[t*=95.047,r*=100,n*=108.883]},If.lab.lch=function(e){var t,r=e[0],n=e[1],o=e[2];return(t=360*Math.atan2(o,n)/2/Math.PI)<0&&(t+=360),[r,Math.sqrt(n*n+o*o),t]},If.lch.lab=function(e){var t,r=e[0],n=e[1];return t=e[2]/360*2*Math.PI,[r,n*Math.cos(t),n*Math.sin(t)]},If.rgb.ansi16=function(e){var t=e[0],r=e[1],n=e[2],o=1 in arguments?arguments[1]:If.rgb.hsv(e)[2];if(0===(o=Math.round(o/50)))return 30;var i=30+(Math.round(n/255)<<2|Math.round(r/255)<<1|Math.round(t/255));return 2===o&&(i+=60),i},If.hsv.ansi16=function(e){return If.rgb.ansi16(If.hsv.rgb(e),e[2])},If.rgb.ansi256=function(e){var t=e[0],r=e[1],n=e[2];return t===r&&r===n?t<8?16:t>248?231:Math.round((t-8)/247*24)+232:16+36*Math.round(t/255*5)+6*Math.round(r/255*5)+Math.round(n/255*5)},If.ansi16.rgb=function(e){var t=e%10;if(0===t||7===t)return e>50&&(t+=3.5),[t=t/10.5*255,t,t];var r=.5*(1+~~(e>50));return[(1&t)*r*255,(t>>1&1)*r*255,(t>>2&1)*r*255]},If.ansi256.rgb=function(e){if(e>=232){var t=10*(e-232)+8;return[t,t,t]}var r;return e-=16,[Math.floor(e/36)/5*255,Math.floor((r=e%36)/6)/5*255,r%6/5*255]},If.rgb.hex=function(e){var t=(((255&Math.round(e[0]))<<16)+((255&Math.round(e[1]))<<8)+(255&Math.round(e[2]))).toString(16).toUpperCase();return"000000".substring(t.length)+t},If.hex.rgb=function(e){var t=e.toString(16).match(/[a-f0-9]{6}|[a-f0-9]{3}/i);if(!t)return[0,0,0];var r=t[0];3===t[0].length&&(r=r.split("").map((function(e){return e+e})).join(""));var n=parseInt(r,16);return[n>>16&255,n>>8&255,255&n]},If.rgb.hcg=function(e){var t,r=e[0]/255,n=e[1]/255,o=e[2]/255,i=Math.max(Math.max(r,n),o),s=Math.min(Math.min(r,n),o),a=i-s;return t=a<=0?0:i===r?(n-o)/a%6:i===n?2+(o-r)/a:4+(r-n)/a+4,t/=6,[360*(t%=1),100*a,100*(a<1?s/(1-a):0)]},If.hsl.hcg=function(e){var t,r=e[1]/100,n=e[2]/100,o=0;return(t=n<.5?2*r*n:2*r*(1-n))<1&&(o=(n-.5*t)/(1-t)),[e[0],100*t,100*o]},If.hsv.hcg=function(e){var t=e[1]/100,r=e[2]/100,n=t*r,o=0;return n<1&&(o=(r-n)/(1-n)),[e[0],100*n,100*o]},If.hcg.rgb=function(e){var t=e[0]/360,r=e[1]/100,n=e[2]/100;if(0===r)return[255*n,255*n,255*n];var o,i=[0,0,0],s=t%1*6,a=s%1,u=1-a;switch(Math.floor(s)){case 0:i[0]=1,i[1]=a,i[2]=0;break;case 1:i[0]=u,i[1]=1,i[2]=0;break;case 2:i[0]=0,i[1]=1,i[2]=a;break;case 3:i[0]=0,i[1]=u,i[2]=1;break;case 4:i[0]=a,i[1]=0,i[2]=1;break;default:i[0]=1,i[1]=0,i[2]=u}return o=(1-r)*n,[255*(r*i[0]+o),255*(r*i[1]+o),255*(r*i[2]+o)]},If.hcg.hsv=function(e){var t=e[1]/100,r=t+e[2]/100*(1-t),n=0;return r>0&&(n=t/r),[e[0],100*n,100*r]},If.hcg.hsl=function(e){var t=e[1]/100,r=e[2]/100*(1-t)+.5*t,n=0;return r>0&&r<.5?n=t/(2*r):r>=.5&&r<1&&(n=t/(2*(1-r))),[e[0],100*n,100*r]},If.hcg.hwb=function(e){var t=e[1]/100,r=t+e[2]/100*(1-t);return[e[0],100*(r-t),100*(1-r)]},If.hwb.hcg=function(e){var t=e[1]/100,r=1-e[2]/100,n=r-t,o=0;return n<1&&(o=(r-n)/(1-n)),[e[0],100*n,100*o]},If.apple.rgb=function(e){return[e[0]/65535*255,e[1]/65535*255,e[2]/65535*255]},If.rgb.apple=function(e){return[e[0]/255*65535,e[1]/255*65535,e[2]/255*65535]},If.gray.rgb=function(e){return[e[0]/100*255,e[0]/100*255,e[0]/100*255]},If.gray.hsl=If.gray.hsv=function(e){return[0,0,e[0]]},If.gray.hwb=function(e){return[0,100,e[0]]},If.gray.cmyk=function(e){return[0,0,0,e[0]]},If.gray.lab=function(e){return[e[0],0,0]},If.gray.hex=function(e){var t=255&Math.round(e[0]/100*255),r=((t<<16)+(t<<8)+t).toString(16).toUpperCase();return"000000".substring(r.length)+r},If.rgb.gray=function(e){return[(e[0]+e[1]+e[2])/3/255*100]};var Tf=vf.exports;function kf(e,t){return function(r){return t(e(r))}}function Of(e,t){for(var r=[t[e].parent,e],n=Tf[t[e].parent][e],o=t[e].parent;t[o].parent;)r.unshift(t[o].parent),n=kf(Tf[t[o].parent][o],n),o=t[o].parent;return n.conversion=r,n}var Sf=vf.exports,Uf={};Object.keys(Sf).forEach((function(e){Uf[e]={},Object.defineProperty(Uf[e],"channels",{value:Sf[e].channels}),Object.defineProperty(Uf[e],"labels",{value:Sf[e].labels});var t=function(e){for(var t=function(e){var t=function(){for(var e={},t=Object.keys(Tf),r=t.length,n=0;n<r;n++)e[t[n]]={distance:-1,parent:null};return e}(),r=[e];for(t[e].distance=0;r.length;)for(var n=r.pop(),o=Object.keys(Tf[n]),i=o.length,s=0;s<i;s++){var a=o[s],u=t[a];-1===u.distance&&(u.distance=t[n].distance+1,u.parent=n,r.unshift(a))}return t}(e),r={},n=Object.keys(t),o=n.length,i=0;i<o;i++){var s=n[i];null!==t[s].parent&&(r[s]=Of(s,t))}return r}(e);Object.keys(t).forEach((function(r){var n=t[r];Uf[e][r]=function(e){var t=function(t){if(null==t)return t;arguments.length>1&&(t=Array.prototype.slice.call(arguments));var r=e(t);if("object"==typeof r)for(var n=r.length,o=0;o<n;o++)r[o]=Math.round(r[o]);return r};return"conversion"in e&&(t.conversion=e.conversion),t}(n),Uf[e][r].raw=function(e){var t=function(t){return null==t?t:(arguments.length>1&&(t=Array.prototype.slice.call(arguments)),e(t))};return"conversion"in e&&(t.conversion=e.conversion),t}(n)}))}));var _f=Uf;!function(e){const t=_f,r=(e,r)=>function(){const n=e.apply(t,arguments);return`[${n+r}m`},n=(e,r)=>function(){const n=e.apply(t,arguments);return`[${38+r};5;${n}m`},o=(e,r)=>function(){const n=e.apply(t,arguments);return`[${38+r};2;${n[0]};${n[1]};${n[2]}m`};Object.defineProperty(e,"exports",{enumerable:!0,get:function(){const e=new Map,i={modifier:{reset:[0,0],bold:[1,22],dim:[2,22],italic:[3,23],underline:[4,24],inverse:[7,27],hidden:[8,28],strikethrough:[9,29]},color:{black:[30,39],red:[31,39],green:[32,39],yellow:[33,39],blue:[34,39],magenta:[35,39],cyan:[36,39],white:[37,39],gray:[90,39],redBright:[91,39],greenBright:[92,39],yellowBright:[93,39],blueBright:[94,39],magentaBright:[95,39],cyanBright:[96,39],whiteBright:[97,39]},bgColor:{bgBlack:[40,49],bgRed:[41,49],bgGreen:[42,49],bgYellow:[43,49],bgBlue:[44,49],bgMagenta:[45,49],bgCyan:[46,49],bgWhite:[47,49],bgBlackBright:[100,49],bgRedBright:[101,49],bgGreenBright:[102,49],bgYellowBright:[103,49],bgBlueBright:[104,49],bgMagentaBright:[105,49],bgCyanBright:[106,49],bgWhiteBright:[107,49]}};i.color.grey=i.color.gray;for(const t of Object.keys(i)){const r=i[t];for(const t of Object.keys(r)){const n=r[t];i[t]={open:`[${n[0]}m`,close:`[${n[1]}m`},r[t]=i[t],e.set(n[0],n[1])}Object.defineProperty(i,t,{value:r,enumerable:!1}),Object.defineProperty(i,"codes",{value:e,enumerable:!1})}const s=e=>e,a=(e,t,r)=>[e,t,r];i.color.close="",i.bgColor.close="",i.color.ansi={ansi:r(s,0)},i.color.ansi256={ansi256:n(s,0)},i.color.ansi16m={rgb:o(a,0)},i.bgColor.ansi={ansi:r(s,10)},i.bgColor.ansi256={ansi256:n(s,10)},i.bgColor.ansi16m={rgb:o(a,10)};for(let e of Object.keys(t)){if("object"!=typeof t[e])continue;const s=t[e];"ansi16"===e&&(e="ansi"),"ansi16"in s&&(i.color.ansi[e]=r(s.ansi16,0),i.bgColor.ansi[e]=r(s.ansi16,10)),"ansi256"in s&&(i.color.ansi256[e]=n(s.ansi256,0),i.bgColor.ansi256[e]=n(s.ansi256,10)),"rgb"in s&&(i.color.ansi16m[e]=o(s.rgb,0),i.bgColor.ansi16m[e]=o(s.rgb,10))}return i}})}(bf);const Nf=/(?:\\(u[a-f\d]{4}|x[a-f\d]{2}|.))|(?:\{(~)?(\w+(?:\([^)]*\))?(?:\.\w+(?:\([^)]*\))?)*)(?:[ \t]|(?=\r?\n)))|(\})|((?:.|[\r\n\f])+?)/gi,Af=/(?:^|\.)(\w+)(?:\(([^)]*)\))?/g,Rf=/^(['"])((?:\\.|(?!\1)[^\\])*)\1$/,Mf=/\\(u[a-f\d]{4}|x[a-f\d]{2}|.)|([^\\])/gi,Lf=new Map([["n","\n"],["r","\r"],["t","\t"],["b","\b"],["f","\f"],["v","\v"],["0","\0"],["\\","\\"],["e",""],["a",""]]);function Ff(e){return"u"===e[0]&&5===e.length||"x"===e[0]&&3===e.length?String.fromCharCode(parseInt(e.slice(1),16)):Lf.get(e)||e}function Pf(e,t){const r=[],n=t.trim().split(/\s*,\s*/g);let o;for(const t of n)if(isNaN(t)){if(!(o=t.match(Rf)))throw new Error(`Invalid Chalk template style argument: ${t} (in style '${e}')`);r.push(o[2].replace(Mf,((e,t,r)=>t?Ff(t):r)))}else r.push(Number(t));return r}function jf(e){Af.lastIndex=0;const t=[];let r;for(;null!==(r=Af.exec(e));){const e=r[1];if(r[2]){const n=Pf(e,r[2]);t.push([e].concat(n))}else t.push([e])}return t}function Df(e,t){const r={};for(const e of t)for(const t of e.styles)r[t[0]]=e.inverse?null:t.slice(1);let n=e;for(const e of Object.keys(r))if(Array.isArray(r[e])){if(!(e in n))throw new Error(`Unknown Chalk style: ${e}`);n=r[e].length>0?n[e].apply(n,r[e]):n[e]}return n}var qf,$f,Hf,zf=(e,t)=>{const r=[],n=[];let o=[];if(t.replace(Nf,((t,i,s,a,u,c)=>{if(i)o.push(Ff(i));else if(a){const t=o.join("");o=[],n.push(0===r.length?t:Df(e,r)(t)),r.push({inverse:s,styles:jf(a)})}else if(u){if(0===r.length)throw new Error("Found extraneous } in Chalk template literal");n.push(Df(e,r)(o.join(""))),o=[],r.pop()}else o.push(c)})),n.push(o.join("")),r.length>0){const e=`Chalk template literal is missing ${r.length} closing bracket${1===r.length?"":"s"} (\`}\`)`;throw new Error(e)}return n.join("")};!function(e){const t=mf,r=bf.exports,n=El.stdout,o=zf,i="win32"===process.platform&&!(process.env.TERM||"").toLowerCase().startsWith("xterm"),s=["ansi","ansi","ansi256","ansi16m"],a=new Set(["gray"]),u=Object.create(null);function c(e,t){t=t||{};const r=n?n.level:0;e.level=void 0===t.level?r:t.level,e.enabled="enabled"in t?t.enabled:e.level>0}function l(e){if(!this||!(this instanceof l)||this.template){const t={};return c(t,e),t.template=function(){const e=[].slice.call(arguments);return p.apply(null,[t.template].concat(e))},Object.setPrototypeOf(t,l.prototype),Object.setPrototypeOf(t.template,t),t.template.constructor=l,t.template}c(this,e)}i&&(r.blue.open="");for(const e of Object.keys(r))r[e].closeRe=new RegExp(t(r[e].close),"g"),u[e]={get(){const t=r[e];return h.call(this,this._styles?this._styles.concat(t):[t],this._empty,e)}};u.visible={get(){return h.call(this,this._styles||[],!0,"visible")}},r.color.closeRe=new RegExp(t(r.color.close),"g");for(const e of Object.keys(r.color.ansi))a.has(e)||(u[e]={get(){const t=this.level;return function(){const n=r.color[s[t]][e].apply(null,arguments),o={open:n,close:r.color.close,closeRe:r.color.closeRe};return h.call(this,this._styles?this._styles.concat(o):[o],this._empty,e)}}});r.bgColor.closeRe=new RegExp(t(r.bgColor.close),"g");for(const e of Object.keys(r.bgColor.ansi))a.has(e)||(u["bg"+e[0].toUpperCase()+e.slice(1)]={get(){const t=this.level;return function(){const n=r.bgColor[s[t]][e].apply(null,arguments),o={open:n,close:r.bgColor.close,closeRe:r.bgColor.closeRe};return h.call(this,this._styles?this._styles.concat(o):[o],this._empty,e)}}});const f=Object.defineProperties((()=>{}),u);function h(e,t,r){const n=function(){return d.apply(n,arguments)};n._styles=e,n._empty=t;const o=this;return Object.defineProperty(n,"level",{enumerable:!0,get:()=>o.level,set(e){o.level=e}}),Object.defineProperty(n,"enabled",{enumerable:!0,get:()=>o.enabled,set(e){o.enabled=e}}),n.hasGrey=this.hasGrey||"gray"===r||"grey"===r,n.__proto__=f,n}function d(){const e=arguments,t=e.length;let n=String(arguments[0]);if(0===t)return"";if(t>1)for(let r=1;r<t;r++)n+=" "+e[r];if(!this.enabled||this.level<=0||!n)return this._empty?"":n;const o=r.dim.open;i&&this.hasGrey&&(r.dim.open="");for(const e of this._styles.slice().reverse())n=e.open+n.replace(e.closeRe,e.open)+e.close,n=n.replace(/\r?\n/g,`${e.close}$&${e.open}`);return r.dim.open=o,n}function p(e,t){if(!Array.isArray(t))return[].slice.call(arguments,1).join(" ");const r=[].slice.call(arguments,2),n=[t.raw[0]];for(let e=1;e<t.length;e++)n.push(String(r[e-1]).replace(/[{}\\]/g,"\\$&")),n.push(String(t.raw[e]));return o(e,n.join(""))}Object.defineProperties(l.prototype,u),e.exports=l(),e.exports.supportsColor=n,e.exports.default=e.exports}(pf),function(e){e.MOVE="MOVE",e.DELETE="DELETE",e.ADD="ADD",e.CODE="CODE",e.DUPLICATE="DUPLICATE"}(qf||(qf={})),function(e){e.SOURCE="SOURCE",e.DESTINATION="DESTINATION"}($f||($f={})),function(e){e.ALL_PATHS_AT_ITERABLE_PART="ALL_PATHS_AT_ITERABLE_PART",e.ALL_PATHS_AT_NON_ITERABLE_PART="ALL_PATHS_AT_NON_ITERABLE_PART",e.NOT_ALL_PATHS_AT_ITERABLE_PART="NOT_ALL_PATHS_AT_ITERABLE_PART"}(Hf||(Hf={}));var Gf,Kf,Vf,Qf;_s.JUST_ENTERED,_s.INITIATED,_s.RUNNING,function(e){e.WAITING_TO_START="POSSIBLE_TO_STOP",e.POSSIBLE_TO_STOP="POSSIBLE_TO_STOP",e.UNFINISHED="UNFINISHED",e.FINISHED="FINISHED"}(Gf||(Gf={})),function(e){e.SEQUENTIAL="SEQUENTIAL",e.PARALLEL="PARALLEL"}(Kf||(Kf={})),function(e){e.NATIVE="NATIVE",e.USER="USER",e.DATATALKS="DATATALKS"}(Vf||(Vf={})),function(e){e.ADD="ADD",e.REMOVE="REMOVE"}(Qf||(Qf={})),console.log("Loading the `@colabo-flow/i-core` barrel");const Wf=exports.EProgrammingLanguageSupported.JAVASCRIPT,Yf=(e,t)=>{console.log(`${e.appNameText} Registering task executor, executor.id "${Ji.greenBright(t.id)}"`),e.taskExecutorsAvailable[t.id]=t},Jf=(e,t)=>{e.tasksAvailable[t.id]=t,console.log(`${e.appNameText} Registered task with task.id "${Ji.greenBright(t.id)}"`)};let Xf=0;const Zf=async(e,t)=>{if(!e.chHostHeartbeat)return void console.error(`${e.appNameText} [sendHeartbeatToHost] Error: channel host.chHostHeartbeat is not existing`);const r=t.extension,n=r.taskId,o=r.taskInput,i=t.replyTo??e.queueHostHeartbeat;e.reportsConfig.showExecutionMsgs&&console.log(`${e.appNameText} [asyncProcessColaboFlowMsg_TaskExecute] Got a task to execute [and return over the RPC-reply queue: "${Ji.blueBright(i)}"]: taskId: ${n}`);const s=e.tasksAvailable[n];s||console.error(`${e.appNameText} [asyncProcessColaboFlowMsg_TaskExecute] task is missing for the id: ${n}`),console.log(`${e.appNameText} [asyncProcessColaboFlowMsg_TaskExecute] Executing id: ${Ji.blueBright(n)}, task.description: ${s.description}`);const a=`taskId:lang-${Wf}:host-${e.hostname}:${cs()}`,u=(e=>({id:`${e.id}:${Ks()}`,originId:e.id,placeType:Rs.TASK,status:ks.WAITING,tokenStatus:_s.JUST_ENTERED,initiatedTokenIdsPerPorts:{},executionInputReferences:{},executionOutputReferences:{},currentTokenIds:[]}))(s);if(u.id=a,e.taskInstances[n]=u,e.runningTaskInstancesInfos[n]={id:a,taskInstance:u},void 0===s.executorRef?.id)return void console.error(`Executor ID is not provided for the task: ${n}`);const c=((e,t)=>e.taskExecutorsAvailable[t])(e,s.executorRef?.id),l={...ls(e.hostname,exports.EColaboFlowGoMsgType.TASK_EXECUTE_PROGRESS),requestId:t.requestId,msgReplyChainIds:[t.id],extension:{taskInstanceId:a,status:exports.ETaskExecute_Progress_Status.INITIALIZED,progress:0},msg:`Returning task execution for the taskId: '${n}' over queue: '${i}'}`};e.reportsConfig.showExecutionMsgs&&console.log(`${e.appNameText} Sending PROGRESS to the task execution requester (orchestrator) [queue: "${Ji.blueBright(i)}"]: ${JSON.stringify(l)}`);try{e.chHostHeartbeat.sendToQueue(i,Buffer.from(JSON.stringify(l)))}catch(e){console.error()}const f=await(c.reference?.method(o));console.log(`${e.appNameText} [asyncProcessColaboFlowMsg_TaskExecute] task executed. Result is: ${Ji.blueBright(JSON.stringify(f,null,4))}`);const h={...ls(e.hostname,exports.EColaboFlowGoMsgType.TASK_EXECUTE_RESPONSE),requestId:t.requestId,msgReplyChainIds:[t.id],extension:{taskOutput:f},msg:`Returning task execution for the taskId: '${n}' over queue: '${i}'}`};e.reportsConfig.showExecutionMsgs&&console.log(`${e.appNameText} Sending RESPONSE to the task execution requester (orchestrator) [queue: "${Ji.blueBright(i)}"]: ${JSON.stringify(h)}`),e.chHostHeartbeat.sendToQueue(i,Buffer.from(JSON.stringify(h)))};exports.HEARTBEAT_TIME=3e3,exports.clientClose=async e=>{const t=new Promise(((t,r)=>{setTimeout((async()=>{console.log(`${e.appNameText} Closing the ${Ji.bold.italic("channel")} to the ColaboFlow orchestrator...`),await e.channel.close(),console.log(`${e.appNameText} Closing the ${Ji.bold.italic("connection")} to the ColaboFlow orchestrator...`),await e.connection.close(),t(!0)}),500)}));return t},exports.clientExecuteTask=async(e,t,r,n)=>{const o=new Promise((async(o,i)=>{const s=`client-task_execute_response-${cs()}`,a={...ls(e.clientName,exports.EColaboFlowGoMsgType.TASK_EXECUTE_REQUEST),replyTo:s,extension:{taskId:t,taskInput:r,options:n},msg:"run a ffmepg test task"};console.log(`${e.appNameText} Sending task request [queue: "${Ji.blueBright(e.queueOrchestrator)}"]: ${JSON.stringify(a)}`),await e.channel.sendToQueue(e.queueOrchestrator,Buffer.from(JSON.stringify(a))),await e.channel.assertQueue(s,{exclusive:!0}),e.channel.consume(s,(function(e){let t;try{t=JSON.parse(e.content)}catch(t){return void console.error(`Error parsing the message: ${e.content}`)}const r=t.extension;o(r.taskOutput)}),{noAck:!0})}));return o},exports.clientRun=async e=>{process.title=`ColaboFlow.Go.Client-${e.clientName}`,e.appNameText=`[${Ji.red.bold("Colabo")}${Ji.blue.bold("Flow")}${Ji.green.bold(".Go")}-${Ji.green.yellow(e.clientName)}]`,console.log(`${e.appNameText} Connecting to the ColaboFlow orchestrator: ${Ji.greenBright(e.amqpUrl)}`);try{e.connection=await di(e.amqpUrl)}catch(t){return void console.error(`${e.appNameText} Error connecting to the "${Ji.greenBright(e.amqpUrl)}" ColaboFlow orchestrator: ${t}`)}try{e.channel=await e.connection.createChannel()}catch(t){return void console.error(`${e.appNameText} Error creating the channel`)}},exports.hostRegisterTask=Jf,exports.hostRegisterTaskExecutor=Yf,exports.hostRun=async e=>{process.title=`ColaboFlow.Go-${e.hostname}`,(async(e,t,r)=>{const n={id:"colabo.flow.echoPing",description:"(Node.js) Used for testing worker availability. Returns the sender message in addition with the local metadata",environment:"ISOMORPHIC",reference:{method:t=>(console.log(`${e.appNameText} [echoPing] Pinged with the input: ${JSON.stringify(t)}`),{input:t,timeDateNow:Date.now(),timePerformance:performance.now(),timeHuman:(new Date).toISOString(),hostname:e.hostname,queueHost:e.queueHost})}},o={id:"colabo.flow.echoPing",type:Ps.SCRIPT,executorRef:{environment:"ISOMORPHIC",id:n.id},placeType:Rs.TASK,inputs:[],outputs:[],inoutputs:[]};console.log(`${e.appNameText} Adding echoPing task executor and task`),t(e,n),r(e,o)})(e,Yf,Jf);const t=await(async e=>{let t;console.log(`${e.appNameText} Connecting to the server: ${Ji.greenBright(e.amqpUrl)}`);try{return t=await di(e.amqpUrl),e.connection=t,t}catch(t){throw console.error(`Error connecting to the "${Ji.greenBright(e.amqpUrl)}" server: ${t}`),t}})(e),r=await(async(e,t)=>{let r;console.log(`${e.appNameText} Opening the ${Ji.bold.italic("node host")} channel as a listener (consumer): ${Ji.greenBright(e.queueHost)}`);try{return r=await t.createChannel(),r}catch(t){throw console.error(`${e.appNameText} Error creating the "${Ji.greenBright(e.queueHost)}" queue: ${t}`),t}})(e,t);await(async(e,t)=>{console.log(`${e.appNameText} Opening the ${Ji.bold.italic("orchestrator heartbeat")} channel as a produced (emitter): ${Ji.greenBright(e.queueHostHeartbeat)}`);try{return e.chHostHeartbeat=await t.createChannel(),e.chHostHeartbeat}catch(t){throw console.error(`${e.appNameText} Error creating the "${Ji.greenBright(e.queueHostHeartbeat)}" queue: ${t}`),t}})(e,t),console.log(`${e.appNameText} Hosting tasks: "${Ji.greenBright(Object.keys(e.tasksAvailable).toString())}"`),setInterval((()=>{(async e=>{if(!e.chHostHeartbeat)return void console.error(`${e.appNameText} [sendHeartbeatToHost] Error: channel host.chHostHeartbeat is not existing`);const t={...ls(e.hostname,exports.EColaboFlowGoMsgType.HEARTBEAT),extension:{id:Xf++,queueHost:e.queueHost,language:exports.EProgrammingLanguageSupported.JAVASCRIPT,taskIds:Object.keys(e.taskExecutorsAvailable)},msg:`node host with tasks: ${JSON.stringify(Object.keys(e.taskExecutorsAvailable))}`};e.reportsConfig.showHeartbeatMsgs&&t.extension.id%e.reportsConfig.showHeartbeatMsgs==0&&console.log(`${e.appNameText} Sending heartbeat [${t.extension.id}] [from "${Ji.blueBright(e.hostname)}" queue: "${Ji.blueBright(e.queueHostHeartbeat)}"]`),e.chHostHeartbeat.sendToQueue(e.queueHostHeartbeat,Buffer.from(JSON.stringify(t)))})(e)}),3e3),console.log(`${e.appNameText} Listening on the queue: "${Ji.blueBright(e.queueHost)}"`),await r.assertQueue(e.queueHost,{exclusive:!0}),console.log(`${e.appNameText} [*] Waiting for messages in %s. To exit press "${Ji.blueBright("CTRL+C")}"`),r.consume(e.queueHost,(async t=>{if(null!==t){let n;try{n=JSON.parse(t.content.toString()),console.log(`${e.appNameText} Received: "${Ji.blueBright(JSON.stringify(n))}"`),console.log(`${e.appNameText} msgObj.sender: "${Ji.blueBright(n.sender)}", msgObj.type: "${Ji.blueBright(n.type)}, msgObj.msg: "${Ji.blueBright(n.msg)}"`)}catch(e){return void console.error(`Error parsing the message: ${t.content}`)}switch(n.type){case exports.EColaboFlowGoMsgType.TASK_EXECUTE_REQUEST:await Zf(e,n);break;case exports.EColaboFlowGoMsgType.TASK_INSTANCES_REPORT__REQUEST:((e,t)=>{if(!e.chHostHeartbeat)return void console.error(`${e.appNameText} [sendHeartbeatToHost] Error: channel host.chHostHeartbeat is not existing`);const r=t.extension,n=r.reportFinalizedTaskInstances,o=r.reportRunningTaskInstances;console.log(`${e.appNameText} [processColaboFlowMsg_TaskInstancesReport] Sending task instances report to the requester: ${Ji.blueBright(t.sender)}`);const i={};o&&Object.assign(i,e.runningTaskInstancesInfos),n&&Object.assign(i,e.finalizedTaskInstancesInfos);const s={...ls(e.hostname,exports.EColaboFlowGoMsgType.TASK_INSTANCES_REPORT__RESPONSE),requestId:t.requestId,msgReplyChainIds:[t.id],extension:{tasksInstanceInfos:i},msg:`node host with tasks: ${JSON.stringify(Object.keys(e.taskExecutorsAvailable))}`},a=t.replyTo??e.queueHostHeartbeat;e.reportsConfig.showReportsMsgs&&console.log(`${e.appNameText} Sending response to the task instances report [queue: "${Ji.blueBright(a)}"]: ${JSON.stringify(s)}`),e.chHostHeartbeat.sendToQueue(a,Buffer.from(JSON.stringify(s)))})(e,n)}r.ack(t)}else console.log("${host.appNameText} Consumer cancelled by server")}))},exports.hostSetTitles=e=>{process.title=`ColaboFlow.Go-${e.hostname}`,e.appNameText=`[${Ji.red.bold("Colabo")}${Ji.blue.bold("Flow")}${Ji.green.bold(".Go")}-${Ji.green.yellow(e.hostname)}]`},exports.orchestratorRun=async e=>{let t;console.log(`${ds} Connecting to the server: ${Ji.greenBright(e.amqpUrl)}`);try{t=await di(e.amqpUrl)}catch(t){return void console.error(`Error connecting to the "${Ji.greenBright(e.amqpUrl)}" server: ${t}`)}console.log(`${ds} Opening the ${Ji.bold.italic("clients")} channel`);try{e.clientsChannel=await t.createChannel()}catch(e){return void console.error(`Error creating the ${Ji.greenBright("clients")} queue: ${e}`)}console.log(`${ds} Opening the ${Ji.bold.italic("hosts")} channel`);try{e.hostsChannel=await t.createChannel()}catch(e){return void console.error(`Error creating the ${Ji.greenBright("hosts")} queue: ${e}`)}console.log(`${ds} Opening the ${Ji.bold.italic("orchestrator")} queue as a listener: ${Ji.greenBright(e.queueOrchestrator)}`),await e.clientsChannel.assertQueue(e.queueOrchestrator,{durable:!0,exclusive:!1,autoDelete:!1}),console.log(`${ds} Opening the ${Ji.bold.italic("heartbeat")} queue as a listener: ${Ji.greenBright(e.queueHostHeartbeat)}`),await e.hostsChannel.assertQueue(e.queueHostHeartbeat,{durable:!0,exclusive:!1,autoDelete:!1}),console.log(`${ds} ${Ji.blueBright("Delaying")} listening on clients to give time for hosts to register (to avoid task execution request errors due to no hosts that implement tasks (executors)) )`),setTimeout((()=>ps(e)),6e3),gs(e)};
1
+ "use strict";
2
+ var __create = Object.create;
3
+ var __defProp = Object.defineProperty;
4
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
+ var __getOwnPropNames = Object.getOwnPropertyNames;
6
+ var __getProtoOf = Object.getPrototypeOf;
7
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
8
+ var __export = (target, all) => {
9
+ for (var name in all)
10
+ __defProp(target, name, { get: all[name], enumerable: true });
11
+ };
12
+ var __copyProps = (to, from, except, desc) => {
13
+ if (from && typeof from === "object" || typeof from === "function") {
14
+ for (let key of __getOwnPropNames(from))
15
+ if (!__hasOwnProp.call(to, key) && key !== except)
16
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
17
+ }
18
+ return to;
19
+ };
20
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
21
+ // If the importer is in node compatibility mode or this is not an ESM
22
+ // file that has been converted to a CommonJS file using a Babel-
23
+ // compatible transform (i.e. "__esModule" has not been set), then set
24
+ // "default" to the CommonJS "module.exports" for node compatibility.
25
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
26
+ mod
27
+ ));
28
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
29
+
30
+ // index.ts
31
+ var index_exports = {};
32
+ __export(index_exports, {
33
+ EColaboFlowGoMsgType: () => EColaboFlowGoMsgType,
34
+ EProgrammingLanguageSupported: () => EProgrammingLanguageSupported,
35
+ ETaskExecute_Progress_Status: () => ETaskExecute_Progress_Status,
36
+ HEARTBEAT_TIME: () => HEARTBEAT_TIME,
37
+ __getPackagePath: () => __getPackagePath,
38
+ clientClose: () => clientClose,
39
+ clientExecuteTask: () => clientExecuteTask,
40
+ clientRun: () => clientRun,
41
+ hostRegisterTask: () => hostRegisterTask,
42
+ hostRegisterTaskExecutor: () => hostRegisterTaskExecutor,
43
+ hostRun: () => hostRun,
44
+ hostSetTitles: () => hostSetTitles,
45
+ orchestratorRun: () => orchestratorRun,
46
+ useFlowFlowchestratorStore: () => useFlowFlowchestratorStore,
47
+ useGlobalStore: () => useGlobalStore
48
+ });
49
+ module.exports = __toCommonJS(index_exports);
50
+
51
+ // lib/client/index.ts
52
+ var import_amqplib = require("amqplib");
53
+ var import_chalk = __toESM(require("chalk"), 1);
54
+
55
+ // lib/uuid_fix.ts
56
+ var TypeMismatchError = class extends Error {
57
+ };
58
+ var QuotaExceededError = class extends Error {
59
+ };
60
+ var __DEV__ = true;
61
+ var warned = false;
62
+ function insecureRandomValues(array) {
63
+ if (!warned) {
64
+ console.warn("WARNING: Using an insecure random number generator, as there is no support for crypto.getRandomValues in node native and we do not need it anyway for unique IDs in ColaboFlow messaging identification");
65
+ warned = true;
66
+ }
67
+ for (let i = 0, r; i < array.length; i++) {
68
+ if ((i & 3) === 0) r = Math.random() * 4294967296;
69
+ array[i] = r >>> ((i & 3) << 3) & 255;
70
+ }
71
+ return array;
72
+ }
73
+ function getRandomValues(array) {
74
+ if (!(array instanceof Int8Array || array instanceof Uint8Array || array instanceof Int16Array || array instanceof Uint16Array || array instanceof Int32Array || array instanceof Uint32Array || array instanceof Uint8ClampedArray)) {
75
+ throw new TypeMismatchError("Expected an integer array");
76
+ }
77
+ if (array.byteLength > 65536) {
78
+ throw new QuotaExceededError("Can only request a maximum of 65536 bytes");
79
+ }
80
+ if (__DEV__) {
81
+ if (typeof global["nativeCallSyncHook"] === "undefined") {
82
+ return insecureRandomValues(array);
83
+ }
84
+ }
85
+ return array;
86
+ }
87
+ if (typeof global.crypto !== "object") {
88
+ global.crypto = {};
89
+ }
90
+ if (typeof global.crypto.getRandomValues !== "function") {
91
+ global.crypto.getRandomValues = getRandomValues;
92
+ }
93
+
94
+ // lib/operators.ts
95
+ var import_uuid = require("uuid");
96
+ var createGoMsg = (sender, type) => {
97
+ const msg = {
98
+ id: `ColaboFlow-msg:${(0, import_uuid.v1)()}`,
99
+ requestId: `ColaboFlow-request:${(0, import_uuid.v1)()}`,
100
+ sender,
101
+ proxies: [],
102
+ msgReplyChainIds: [],
103
+ type
104
+ };
105
+ return msg;
106
+ };
107
+
108
+ // lib/vos.ts
109
+ var EColaboFlowGoMsgType = /* @__PURE__ */ ((EColaboFlowGoMsgType2) => {
110
+ EColaboFlowGoMsgType2["TASK_EXECUTE_REQUEST"] = "TASK_EXECUTE_REQUEST";
111
+ EColaboFlowGoMsgType2["TASK_EXECUTE_PROGRESS"] = "TASK_EXECUTE_PROGRESS";
112
+ EColaboFlowGoMsgType2["TASK_EXECUTE_RESPONSE"] = "TASK_EXECUTE_RESPONSE";
113
+ EColaboFlowGoMsgType2["TASK_INSTANCES_REPORT__REQUEST"] = "TASK_INSTANCES_REPORT__REQUEST";
114
+ EColaboFlowGoMsgType2["TASK_INSTANCES_REPORT__RESPONSE"] = "TASK_INSTANCES_REPORT__RESPONSE";
115
+ EColaboFlowGoMsgType2["HEARTBEAT"] = "HEARTBEAT";
116
+ return EColaboFlowGoMsgType2;
117
+ })(EColaboFlowGoMsgType || {});
118
+ var HEARTBEAT_TIME = 3e3;
119
+ var EProgrammingLanguageSupported = /* @__PURE__ */ ((EProgrammingLanguageSupported2) => {
120
+ EProgrammingLanguageSupported2["JAVASCRIPT"] = "JAVASCRIPT";
121
+ EProgrammingLanguageSupported2["PYTHON"] = "PYTHON";
122
+ EProgrammingLanguageSupported2["NATIVE"] = "NATIVE";
123
+ return EProgrammingLanguageSupported2;
124
+ })(EProgrammingLanguageSupported || {});
125
+ var ETaskExecute_Progress_Status = /* @__PURE__ */ ((ETaskExecute_Progress_Status2) => {
126
+ ETaskExecute_Progress_Status2["INITIALIZED"] = "INITIALIZED";
127
+ return ETaskExecute_Progress_Status2;
128
+ })(ETaskExecute_Progress_Status || {});
129
+
130
+ // lib/client/index.ts
131
+ var MINIMUM_FRAME_MAX = 8192;
132
+ var isAmqpDebugEnabled = () => {
133
+ const debugRaw = process.env.COLABO_FLOW_AMQP_DEBUG || "";
134
+ return debugRaw === "1" || debugRaw.toLowerCase() === "true";
135
+ };
136
+ var parsePositiveInt = (rawValue, fallback) => {
137
+ if (!rawValue) return fallback;
138
+ const parsed = Number.parseInt(rawValue, 10);
139
+ return Number.isFinite(parsed) && parsed > 0 ? parsed : fallback;
140
+ };
141
+ var formatError = (err) => {
142
+ if (!(err instanceof Error)) return String(err);
143
+ const errorExtended = err;
144
+ const meta = [
145
+ errorExtended.code ? `code=${errorExtended.code}` : "",
146
+ errorExtended.errno !== void 0 ? `errno=${errorExtended.errno}` : "",
147
+ errorExtended.syscall ? `syscall=${errorExtended.syscall}` : "",
148
+ errorExtended.address ? `address=${errorExtended.address}` : "",
149
+ errorExtended.port !== void 0 ? `port=${errorExtended.port}` : ""
150
+ ].filter(Boolean).join(", ");
151
+ return meta ? `${err.message} (${meta})` : err.message;
152
+ };
153
+ var logAmqpUrlDetails = (client, urlRaw) => {
154
+ try {
155
+ const parsed = new URL(urlRaw);
156
+ const vhostRaw = parsed.pathname || "/";
157
+ const vhostDecoded = decodeURIComponent(vhostRaw);
158
+ const heartbeatQuery = parsed.searchParams.get("heartbeat") || "(broker default)";
159
+ const frameMaxQuery = parsed.searchParams.get("frameMax") || "(amqplib default)";
160
+ console.log(`${client.appNameText} AMQP URL details: protocol=${parsed.protocol}, host=${parsed.hostname}, port=${parsed.port || "5672"}, vhostRaw="${vhostRaw}", vhostDecoded="${vhostDecoded}", heartbeat=${heartbeatQuery}, frameMax=${frameMaxQuery}`);
161
+ } catch (err) {
162
+ console.warn(`${client.appNameText} Could not parse AMQP URL "${urlRaw}": ${formatError(err)}`);
163
+ }
164
+ };
165
+ var getEffectiveAmqpUrl = (client, urlRaw) => {
166
+ try {
167
+ const parsed = new URL(urlRaw);
168
+ const defaultFrameMax = parsePositiveInt(process.env.COLABO_FLOW_AMQP_FRAME_MAX, 131072);
169
+ const frameMaxConfiguredRaw = parsed.searchParams.get("frameMax") || void 0;
170
+ let frameMax = parsePositiveInt(frameMaxConfiguredRaw, defaultFrameMax);
171
+ if (frameMax < MINIMUM_FRAME_MAX) {
172
+ console.warn(`${client.appNameText} frameMax=${frameMax} is too low; forcing frameMax=${MINIMUM_FRAME_MAX}`);
173
+ frameMax = MINIMUM_FRAME_MAX;
174
+ }
175
+ parsed.searchParams.set("frameMax", String(frameMax));
176
+ return parsed.toString();
177
+ } catch {
178
+ return urlRaw;
179
+ }
180
+ };
181
+ var getConnectSocketOptions = (connectionName) => {
182
+ return {
183
+ noDelay: true,
184
+ keepAlive: true,
185
+ keepAliveDelay: parsePositiveInt(process.env.COLABO_FLOW_AMQP_KEEPALIVE_DELAY_MS, 1e3),
186
+ timeout: parsePositiveInt(process.env.COLABO_FLOW_AMQP_CONNECT_TIMEOUT_MS, 1e4),
187
+ clientProperties: {
188
+ connection_name: connectionName
189
+ }
190
+ };
191
+ };
192
+ var attachConnectionDebugHandlers = (client) => {
193
+ if (!client.connection) return;
194
+ client.connection.on("error", (err) => {
195
+ console.error(`${client.appNameText} AMQP connection error: ${formatError(err)}`);
196
+ });
197
+ client.connection.on("close", () => {
198
+ console.warn(`${client.appNameText} AMQP connection closed`);
199
+ });
200
+ client.connection.on("blocked", (reason) => {
201
+ console.warn(`${client.appNameText} AMQP connection blocked: ${String(reason)}`);
202
+ });
203
+ client.connection.on("unblocked", () => {
204
+ console.warn(`${client.appNameText} AMQP connection unblocked`);
205
+ });
206
+ client.connection.on("frameError", (err) => {
207
+ console.error(`${client.appNameText} AMQP frameError: ${formatError(err)}`);
208
+ });
209
+ const maybeSocket = client.connection?.connection?.stream;
210
+ if (maybeSocket && isAmqpDebugEnabled()) {
211
+ maybeSocket.on("error", (err) => {
212
+ console.error(`${client.appNameText} AMQP socket error: ${formatError(err)}`);
213
+ });
214
+ maybeSocket.on("close", (hadError) => {
215
+ console.warn(`${client.appNameText} AMQP socket close (hadError=${hadError})`);
216
+ });
217
+ maybeSocket.on("end", () => {
218
+ console.warn(`${client.appNameText} AMQP socket end`);
219
+ });
220
+ maybeSocket.on("timeout", () => {
221
+ console.warn(`${client.appNameText} AMQP socket timeout`);
222
+ });
223
+ }
224
+ };
225
+ var attachChannelDebugHandlers = (client) => {
226
+ if (!client.channel) return;
227
+ client.channel.on("error", (err) => {
228
+ console.error(`${client.appNameText} AMQP channel error: ${formatError(err)}`);
229
+ });
230
+ client.channel.on("close", () => {
231
+ console.warn(`${client.appNameText} AMQP channel closed`);
232
+ });
233
+ client.channel.on("return", (msg) => {
234
+ if (isAmqpDebugEnabled()) {
235
+ console.warn(`${client.appNameText} AMQP channel returned a message: ${JSON.stringify(msg)}`);
236
+ }
237
+ });
238
+ client.channel.on("drain", () => {
239
+ if (isAmqpDebugEnabled()) {
240
+ console.log(`${client.appNameText} AMQP channel drain`);
241
+ }
242
+ });
243
+ };
244
+ var clientRun = async (client) => {
245
+ process.title = `ColaboFlow.Go.Client-${client.clientName}`;
246
+ client.appNameText = `[${import_chalk.default.red.bold("Colabo")}${import_chalk.default.blue.bold("Flow")}${import_chalk.default.green.bold(".Go")}-${import_chalk.default.green.yellow(client.clientName)}]`;
247
+ console.log(`${client.appNameText} Connecting to the ColaboFlow orchestrator: ${import_chalk.default.greenBright(client.amqpUrl)}`);
248
+ const effectiveAmqpUrl = getEffectiveAmqpUrl(client, client.amqpUrl);
249
+ if (effectiveAmqpUrl !== client.amqpUrl) {
250
+ console.log(`${client.appNameText} Effective AMQP URL: ${import_chalk.default.greenBright(effectiveAmqpUrl)}`);
251
+ }
252
+ logAmqpUrlDetails(client, effectiveAmqpUrl);
253
+ const connectionName = `${client.clientName}-pid-${process.pid}`;
254
+ const socketOptions = getConnectSocketOptions(connectionName);
255
+ if (isAmqpDebugEnabled()) {
256
+ console.log(`${client.appNameText} AMQP socket options: ${JSON.stringify(socketOptions)}`);
257
+ }
258
+ try {
259
+ client.connection = await (0, import_amqplib.connect)(effectiveAmqpUrl, socketOptions);
260
+ } catch (err) {
261
+ console.error(`${client.appNameText} Error connecting to the "${import_chalk.default.greenBright(effectiveAmqpUrl)}" ColaboFlow orchestrator: ${formatError(err)}`);
262
+ if (isAmqpDebugEnabled() && err instanceof Error && err.stack) {
263
+ console.error(`${client.appNameText} connect stack: ${err.stack}`);
264
+ }
265
+ return;
266
+ }
267
+ attachConnectionDebugHandlers(client);
268
+ try {
269
+ client.channel = await client.connection.createChannel();
270
+ } catch (err) {
271
+ console.error(`${client.appNameText} Error creating the channel: ${formatError(err)}`);
272
+ return;
273
+ }
274
+ attachChannelDebugHandlers(client);
275
+ };
276
+ var clientExecuteTask = async (client, taskId, taskInput, options) => {
277
+ const promise = new Promise(async (resolve, reject) => {
278
+ if (!client.channel) {
279
+ reject(new Error(`${client.appNameText} Client channel is not initialized. Call clientRun(...) first.`));
280
+ return;
281
+ }
282
+ const taskExecuteResponseQueue = `client-task_execute_response-${(0, import_uuid.v1)()}`;
283
+ const msgTaskRequest = {
284
+ ...createGoMsg(client.clientName, "TASK_EXECUTE_REQUEST" /* TASK_EXECUTE_REQUEST */),
285
+ replyTo: taskExecuteResponseQueue,
286
+ extension: {
287
+ taskId,
288
+ taskInput,
289
+ options
290
+ },
291
+ msg: `run a "${taskId}" task`
292
+ };
293
+ const msgTaskRequestStr = JSON.stringify(msgTaskRequest);
294
+ const responseMaxChars = 200;
295
+ const msgTaskRequestStrShort = msgTaskRequestStr.length > responseMaxChars ? msgTaskRequestStr.substring(0, responseMaxChars / 2) + " [...] " + msgTaskRequestStr.substring(msgTaskRequestStr.length - responseMaxChars / 2) : msgTaskRequestStr;
296
+ console.log(`${client.appNameText} Sending task request [queue: "${import_chalk.default.blueBright(client.queueOrchestrator)}"] (reduced to ${responseMaxChars} chars): ${msgTaskRequestStrShort}`);
297
+ try {
298
+ client.channel.sendToQueue(client.queueOrchestrator, Buffer.from(JSON.stringify(msgTaskRequest)));
299
+ } catch (err) {
300
+ reject(new Error(`${client.appNameText} Failed sending TASK_EXECUTE_REQUEST to "${client.queueOrchestrator}": ${formatError(err)}`));
301
+ return;
302
+ }
303
+ try {
304
+ await client.channel.assertQueue(taskExecuteResponseQueue, {
305
+ exclusive: true
306
+ });
307
+ } catch (err) {
308
+ reject(new Error(`${client.appNameText} Failed creating reply queue "${taskExecuteResponseQueue}": ${formatError(err)}`));
309
+ return;
310
+ }
311
+ client.channel.consume(
312
+ taskExecuteResponseQueue,
313
+ function(msgOrchestratorRes) {
314
+ if (!msgOrchestratorRes) {
315
+ reject(new Error(`${client.appNameText} Consumer for "${taskExecuteResponseQueue}" cancelled by broker`));
316
+ return;
317
+ }
318
+ let msgOrchestratorResObj;
319
+ try {
320
+ msgOrchestratorResObj = JSON.parse(msgOrchestratorRes.content.toString());
321
+ } catch (err) {
322
+ reject(new Error(`${client.appNameText} Error parsing response message: ${formatError(err)}`));
323
+ return;
324
+ }
325
+ const msgOrchestratorResObjExtension = msgOrchestratorResObj.extension;
326
+ resolve(msgOrchestratorResObjExtension.taskOutput);
327
+ },
328
+ {
329
+ noAck: true
330
+ }
331
+ ).catch((err) => {
332
+ reject(new Error(`${client.appNameText} Failed starting consumer on "${taskExecuteResponseQueue}": ${formatError(err)}`));
333
+ });
334
+ });
335
+ return promise;
336
+ };
337
+ var clientClose = async (client) => {
338
+ const promise = new Promise((resolve, reject) => {
339
+ setTimeout(async () => {
340
+ console.log(`${client.appNameText} Closing the ${import_chalk.default.bold.italic("channel")} to the ColaboFlow orchestrator...`);
341
+ try {
342
+ if (client.channel) {
343
+ await client.channel.close();
344
+ }
345
+ console.log(`${client.appNameText} Closing the ${import_chalk.default.bold.italic("connection")} to the ColaboFlow orchestrator...`);
346
+ if (client.connection) {
347
+ await client.connection.close();
348
+ }
349
+ resolve(true);
350
+ } catch (err) {
351
+ reject(new Error(`${client.appNameText} Error while closing client resources: ${formatError(err)}`));
352
+ }
353
+ }, 500);
354
+ });
355
+ return promise;
356
+ };
357
+
358
+ // lib/orchestrator/index.ts
359
+ var import_amqplib2 = require("amqplib");
360
+ var import_chalk2 = __toESM(require("chalk"), 1);
361
+ var import_i_verify = require("@colabo-utils/i-verify");
362
+ process.title = "ColaboFlow.Go.Orchestrator";
363
+ var appNameText = `[${import_chalk2.default.red.bold("Colabo")}${import_chalk2.default.blue.bold("Flow")}${import_chalk2.default.green.bold(".Go")}${import_chalk2.default.green.yellow(".Orchestrator")}]`;
364
+ var isAmqpDebugEnabled2 = () => {
365
+ const debugRaw = process.env.COLABO_FLOW_AMQP_DEBUG || "";
366
+ return debugRaw === "1" || debugRaw.toLowerCase() === "true";
367
+ };
368
+ var parsePositiveInt2 = (rawValue, fallback) => {
369
+ if (!rawValue) return fallback;
370
+ const parsed = Number.parseInt(rawValue, 10);
371
+ return Number.isFinite(parsed) && parsed > 0 ? parsed : fallback;
372
+ };
373
+ var MINIMUM_FRAME_MAX2 = 8192;
374
+ var formatError2 = (err) => {
375
+ if (!(err instanceof Error)) return String(err);
376
+ const errorExtended = err;
377
+ const meta = [
378
+ errorExtended.code ? `code=${errorExtended.code}` : "",
379
+ errorExtended.errno !== void 0 ? `errno=${errorExtended.errno}` : "",
380
+ errorExtended.syscall ? `syscall=${errorExtended.syscall}` : "",
381
+ errorExtended.address ? `address=${errorExtended.address}` : "",
382
+ errorExtended.port !== void 0 ? `port=${errorExtended.port}` : ""
383
+ ].filter(Boolean).join(", ");
384
+ return meta ? `${err.message} (${meta})` : err.message;
385
+ };
386
+ var logAmqpUrlDetails2 = (urlRaw) => {
387
+ try {
388
+ const parsed = new URL(urlRaw);
389
+ const vhostRaw = parsed.pathname || "/";
390
+ const vhostDecoded = decodeURIComponent(vhostRaw);
391
+ const heartbeatQuery = parsed.searchParams.get("heartbeat") || "(broker default)";
392
+ const frameMaxQuery = parsed.searchParams.get("frameMax") || "(amqplib default)";
393
+ console.log(`${appNameText} AMQP URL details: protocol=${parsed.protocol}, host=${parsed.hostname}, port=${parsed.port || "5672"}, vhostRaw="${vhostRaw}", vhostDecoded="${vhostDecoded}", heartbeat=${heartbeatQuery}, frameMax=${frameMaxQuery}`);
394
+ } catch (err) {
395
+ console.warn(`${appNameText} Could not parse AMQP URL "${urlRaw}": ${formatError2(err)}`);
396
+ }
397
+ };
398
+ var getEffectiveAmqpUrl2 = (urlRaw) => {
399
+ try {
400
+ const parsed = new URL(urlRaw);
401
+ const defaultFrameMax = parsePositiveInt2(process.env.COLABO_FLOW_AMQP_FRAME_MAX, 131072);
402
+ const frameMaxConfiguredRaw = parsed.searchParams.get("frameMax") || void 0;
403
+ let frameMax = parsePositiveInt2(frameMaxConfiguredRaw, defaultFrameMax);
404
+ if (frameMax < MINIMUM_FRAME_MAX2) {
405
+ console.warn(`${appNameText} frameMax=${frameMax} is too low; forcing frameMax=${MINIMUM_FRAME_MAX2}`);
406
+ frameMax = MINIMUM_FRAME_MAX2;
407
+ }
408
+ parsed.searchParams.set("frameMax", String(frameMax));
409
+ return parsed.toString();
410
+ } catch {
411
+ return urlRaw;
412
+ }
413
+ };
414
+ var attachConnectionDebugHandlers2 = (connection) => {
415
+ connection.on("error", (err) => {
416
+ console.error(`${appNameText} AMQP connection error: ${formatError2(err)}`);
417
+ });
418
+ connection.on("close", () => {
419
+ console.warn(`${appNameText} AMQP connection closed`);
420
+ });
421
+ connection.on("blocked", (reason) => {
422
+ console.warn(`${appNameText} AMQP connection blocked: ${String(reason)}`);
423
+ });
424
+ connection.on("unblocked", () => {
425
+ console.warn(`${appNameText} AMQP connection unblocked`);
426
+ });
427
+ connection.on("frameError", (err) => {
428
+ console.error(`${appNameText} AMQP frameError: ${formatError2(err)}`);
429
+ });
430
+ const maybeSocket = connection?.connection?.stream;
431
+ if (maybeSocket && isAmqpDebugEnabled2()) {
432
+ maybeSocket.on("error", (err) => {
433
+ console.error(`${appNameText} AMQP socket error: ${formatError2(err)}`);
434
+ });
435
+ maybeSocket.on("close", (hadError) => {
436
+ console.warn(`${appNameText} AMQP socket close (hadError=${hadError})`);
437
+ });
438
+ maybeSocket.on("end", () => {
439
+ console.warn(`${appNameText} AMQP socket end`);
440
+ });
441
+ maybeSocket.on("timeout", () => {
442
+ console.warn(`${appNameText} AMQP socket timeout`);
443
+ });
444
+ }
445
+ };
446
+ var attachChannelDebugHandlers2 = (channelName, channel) => {
447
+ channel.on("error", (err) => {
448
+ console.error(`${appNameText} AMQP channel "${channelName}" error: ${formatError2(err)}`);
449
+ });
450
+ channel.on("close", () => {
451
+ console.warn(`${appNameText} AMQP channel "${channelName}" closed`);
452
+ });
453
+ channel.on("return", (msg) => {
454
+ if (isAmqpDebugEnabled2()) {
455
+ console.warn(`${appNameText} AMQP channel "${channelName}" returned a message: ${JSON.stringify(msg)}`);
456
+ }
457
+ });
458
+ channel.on("drain", () => {
459
+ if (isAmqpDebugEnabled2()) {
460
+ console.log(`${appNameText} AMQP channel "${channelName}" drain`);
461
+ }
462
+ });
463
+ };
464
+ var getConnectSocketOptions2 = (connectionName) => {
465
+ return {
466
+ noDelay: true,
467
+ keepAlive: true,
468
+ keepAliveDelay: parsePositiveInt2(process.env.COLABO_FLOW_AMQP_KEEPALIVE_DELAY_MS, 1e3),
469
+ timeout: parsePositiveInt2(process.env.COLABO_FLOW_AMQP_CONNECT_TIMEOUT_MS, 1e4),
470
+ clientProperties: {
471
+ connection_name: connectionName
472
+ }
473
+ };
474
+ };
475
+ var asyncProcessColaboFlowMsg_TaskExecute = async (orchestrator, msgClientReqObj) => {
476
+ (0, import_i_verify.assert)(orchestrator.hostsChannel, `orchestrator.hostsChannel is not defined`);
477
+ (0, import_i_verify.assert)(orchestrator.clientsChannel, `orchestrator.clientsChannel is not defined`);
478
+ const msgClientReqExtension = msgClientReqObj.extension;
479
+ const taskId = msgClientReqExtension.taskId;
480
+ console.log(`${appNameText} Executing task taskId: "${import_chalk2.default.blueBright(taskId)}"`);
481
+ const taskExecuteResponseQueue = `orchestrator-task_execute_response-${(0, import_uuid.v1)()}`;
482
+ const hostsForTaskId = orchestrator.hostsForTaskIds[taskId];
483
+ if (!hostsForTaskId || hostsForTaskId.length <= 0) {
484
+ console.error(`${appNameText} Error, there is no host implementing the task: "${taskId}"`);
485
+ return;
486
+ }
487
+ let hostName = void 0;
488
+ if (msgClientReqExtension?.options?.hosts?.hostNames) {
489
+ console.info(`${appNameText} Client requested for the task "${taskId}" to be executed across one of the following hostNames: ${msgClientReqExtension?.options?.hosts?.hostNames}.`);
490
+ for (const hostNameTemp of msgClientReqExtension.options.hosts.hostNames) {
491
+ if (hostsForTaskId.indexOf(hostNameTemp) >= 0) {
492
+ hostName = hostNameTemp;
493
+ break;
494
+ }
495
+ }
496
+ if (!hostName) {
497
+ if (msgClientReqExtension.options.hosts.runOnlyOnEnlistedHosts) {
498
+ console.error(`${appNameText} Error, there is no host implementing the task: "${taskId}" that matches the requested hosts hostNames: ${msgClientReqExtension.options.hosts.hostNames}`);
499
+ return;
500
+ } else {
501
+ hostName = hostsForTaskId[0];
502
+ console.info(`${appNameText} There is no host implementing the task: "${taskId}" that matches the requested hosts hostNames: ${msgClientReqExtension.options.hosts.hostNames}. Instead using the first availabile host: ${hostName}`);
503
+ }
504
+ } else {
505
+ console.info(`${appNameText} We found the host implementing the task: "${taskId}" that matches the requested hosts hostNames: ${hostName}.`);
506
+ }
507
+ } else {
508
+ hostName = hostsForTaskId[0];
509
+ console.info(`${appNameText} There are no preferences for a host implementing the task: "${taskId}" Using the first available host: ${hostName}.`);
510
+ }
511
+ const hostData = orchestrator.hosts[hostName];
512
+ console.log(`${appNameText} Delivering the task "${import_chalk2.default.blueBright(taskId)}" to host "${import_chalk2.default.blueBright(hostName)}" via queue "${import_chalk2.default.blueBright(hostData.queueHost)}" and listening for the response on the queue: "${import_chalk2.default.blueBright(taskExecuteResponseQueue)}"`);
513
+ const msgHostObjRequest = {
514
+ ...createGoMsg(orchestrator.orchestratorName, "TASK_EXECUTE_REQUEST" /* TASK_EXECUTE_REQUEST */),
515
+ replyTo: taskExecuteResponseQueue,
516
+ extension: msgClientReqExtension,
517
+ msg: msgClientReqObj.msg
518
+ };
519
+ console.log(`${appNameText} Creating the task execution response queue: "${import_chalk2.default.blueBright(taskExecuteResponseQueue)}" ...`);
520
+ await orchestrator.hostsChannel.assertQueue(taskExecuteResponseQueue, {
521
+ exclusive: true
522
+ });
523
+ orchestrator.hostsChannel.consume(
524
+ taskExecuteResponseQueue,
525
+ function(msgHostRes) {
526
+ (0, import_i_verify.assert)(orchestrator.hostsChannel, `orchestrator.hostsChannel is not defined`);
527
+ (0, import_i_verify.assert)(orchestrator.clientsChannel, `orchestrator.clientsChannel is not defined`);
528
+ console.log(`${appNameText} Task Execution reply on the queue: "${import_chalk2.default.blueBright(taskExecuteResponseQueue)}" for the taskId: "${import_chalk2.default.blueBright(taskId)}"`);
529
+ (0, import_i_verify.assert)(msgHostRes, `msgHostRes is not defined`);
530
+ let msgHostResObj;
531
+ try {
532
+ msgHostResObj = JSON.parse(msgHostRes.content.toString());
533
+ } catch (err) {
534
+ console.error(`${appNameText} Error parsing host response message: ${formatError2(err)} | raw=${msgHostRes.content.toString()}`);
535
+ return;
536
+ }
537
+ switch (msgHostResObj.type) {
538
+ case "TASK_EXECUTE_PROGRESS" /* TASK_EXECUTE_PROGRESS */:
539
+ const msgHostProgressObjExtension = msgHostResObj.extension;
540
+ console.log(`${appNameText} Task Execution PROGRESS: ${JSON.stringify(msgHostProgressObjExtension)}`);
541
+ break;
542
+ case "TASK_EXECUTE_RESPONSE" /* TASK_EXECUTE_RESPONSE */:
543
+ const msgHostResObjExtension = msgHostResObj.extension;
544
+ const executionResponse = JSON.stringify(msgHostResObjExtension.taskOutput);
545
+ const responseMaxChars = 200;
546
+ const executionResponseShort = executionResponse.length > responseMaxChars ? executionResponse.substring(0, responseMaxChars / 2) + " [...] " + executionResponse.substring(executionResponse.length - responseMaxChars / 2) : executionResponse;
547
+ console.log(`${appNameText} Task Execution RESPONSE (reduced to ${responseMaxChars} chars): ${executionResponseShort}`);
548
+ if (!msgClientReqObj.replyTo) {
549
+ console.error(`${appNameText} replyTo is missing in the msgClientReqObj [msgClientReqObj.id: "${import_chalk2.default.blueBright(msgClientReqObj.id)}"]`);
550
+ return;
551
+ }
552
+ const queueReplyTo = msgClientReqObj.replyTo;
553
+ const msgClientRes = {
554
+ ...createGoMsg(orchestrator.orchestratorName, "TASK_EXECUTE_RESPONSE" /* TASK_EXECUTE_RESPONSE */),
555
+ requestId: msgClientReqObj.requestId,
556
+ msgReplyChainIds: [msgClientReqObj.id],
557
+ extension: msgHostResObjExtension,
558
+ msg: `Host with tasks`
559
+ };
560
+ console.log(`${appNameText} Sending the task Execution response back to the client "${import_chalk2.default.blueBright(msgClientReqObj.sender)}" through queue: "${import_chalk2.default.blueBright(queueReplyTo)}"`);
561
+ try {
562
+ orchestrator.clientsChannel.sendToQueue(queueReplyTo, Buffer.from(JSON.stringify(msgClientRes)));
563
+ } catch (err) {
564
+ console.error(`${appNameText} Failed to send TASK_EXECUTE_RESPONSE to client queue "${queueReplyTo}": ${formatError2(err)}`);
565
+ }
566
+ break;
567
+ }
568
+ },
569
+ {
570
+ // check if it is good to have it
571
+ noAck: true
572
+ }
573
+ );
574
+ console.log(`${appNameText} Listening on the queue: "${import_chalk2.default.blueBright(taskExecuteResponseQueue)}" for the execution response for the task "${import_chalk2.default.blueBright(taskId)}"`);
575
+ try {
576
+ orchestrator.hostsChannel.sendToQueue(hostData.queueHost, Buffer.from(JSON.stringify(msgHostObjRequest)));
577
+ } catch (err) {
578
+ console.error(`${appNameText} Failed to send TASK_EXECUTE_REQUEST to host queue "${hostData.queueHost}": ${formatError2(err)}`);
579
+ }
580
+ };
581
+ var asyncProcessColaboFlowMsg_Heartbeat = async (orchestrator, msgObj) => {
582
+ (0, import_i_verify.assert)(orchestrator.hostsChannel, `orchestrator.hostsChannel is not defined`);
583
+ (0, import_i_verify.assert)(orchestrator.clientsChannel, `orchestrator.clientsChannel is not defined`);
584
+ const msgExtension = msgObj.extension;
585
+ const hostName = msgObj.sender;
586
+ if (!(hostName in orchestrator.hosts)) {
587
+ console.log(`${appNameText} Discovered a new host: "${import_chalk2.default.blueBright(hostName)}" with the tasks available: ${import_chalk2.default.blueBright(JSON.stringify(msgExtension.taskIds))}`);
588
+ orchestrator.hosts[hostName] = {
589
+ hostName,
590
+ queueHost: msgExtension.queueHost,
591
+ // we make it empty as we want to populate it properly in the next section
592
+ taskIdsAvailable: [],
593
+ taskInstanceIds: []
594
+ };
595
+ }
596
+ const hostData = orchestrator.hosts[hostName];
597
+ const tasksRemoved = hostData.taskIdsAvailable.filter((newTaskId) => msgExtension.taskIds.indexOf(newTaskId) < 0);
598
+ if (tasksRemoved.length) console.log(`${appNameText} The host: "${import_chalk2.default.blueBright(hostName)}" doesn't offers anymore the following tasks: ${import_chalk2.default.blueBright(JSON.stringify(tasksRemoved))}`);
599
+ for (const taskId of tasksRemoved) {
600
+ const hostsForTheTaskId = orchestrator.hostsForTaskIds[taskId];
601
+ if (!Array.isArray(hostsForTheTaskId)) return;
602
+ var hostIndex = hostsForTheTaskId.indexOf(hostName);
603
+ if (hostIndex !== -1) {
604
+ hostsForTheTaskId.splice(hostIndex, 1);
605
+ }
606
+ }
607
+ const tasksAdded = msgExtension.taskIds.filter((newTaskId) => hostData.taskIdsAvailable.indexOf(newTaskId) < 0);
608
+ if (tasksAdded.length) console.log(`${appNameText} The host: "${import_chalk2.default.blueBright(hostName)}" offers now the additional tasks: ${import_chalk2.default.blueBright(JSON.stringify(tasksAdded))}`);
609
+ hostData.taskIdsAvailable = msgExtension.taskIds;
610
+ for (const taskId of tasksAdded) {
611
+ if (!orchestrator.hostsForTaskIds[taskId]) orchestrator.hostsForTaskIds[taskId] = [];
612
+ if (orchestrator.hostsForTaskIds[taskId].indexOf(hostName) < 0) {
613
+ orchestrator.hostsForTaskIds[taskId].push(hostName);
614
+ }
615
+ }
616
+ if (orchestrator.reportsConfig.showHeartbeatMsgs && msgExtension.id % orchestrator.reportsConfig.showHeartbeatMsgs == 0) {
617
+ console.log(`${appNameText} Received heartbeat: hostName: "${import_chalk2.default.blueBright(hostName)}", id: ${msgExtension.id}`);
618
+ }
619
+ };
620
+ var listenOnClientRequests = async (orchestrator) => {
621
+ (0, import_i_verify.assert)(orchestrator.hostsChannel, `orchestrator.hostsChannel is not defined`);
622
+ (0, import_i_verify.assert)(orchestrator.clientsChannel, `orchestrator.clientsChannel is not defined`);
623
+ console.log(`${appNameText} Listening on the orchestrator queue: "${import_chalk2.default.blueBright(orchestrator.queueOrchestrator)}"`);
624
+ console.log(`${appNameText} [*] Waiting for orchestrator messages. To exit press "${import_chalk2.default.blueBright("CTRL+C")}"`);
625
+ orchestrator.clientsChannel.consume(orchestrator.queueOrchestrator, (msg) => {
626
+ (0, import_i_verify.assert)(orchestrator.hostsChannel, `orchestrator.hostsChannel is not defined`);
627
+ (0, import_i_verify.assert)(orchestrator.clientsChannel, `orchestrator.clientsChannel is not defined`);
628
+ if (msg !== null) {
629
+ let msgObj;
630
+ try {
631
+ msgObj = JSON.parse(msg.content.toString());
632
+ console.log(`${appNameText} msgObj.sender: "${import_chalk2.default.blueBright(msgObj.sender)}", msgObj.msg: "${import_chalk2.default.blueBright(msgObj.msg)}"`);
633
+ switch (msgObj.type) {
634
+ case "TASK_EXECUTE_REQUEST" /* TASK_EXECUTE_REQUEST */:
635
+ void asyncProcessColaboFlowMsg_TaskExecute(orchestrator, msgObj).catch((err) => {
636
+ console.error(`${appNameText} Error while processing TASK_EXECUTE_REQUEST: ${formatError2(err)}`);
637
+ });
638
+ break;
639
+ }
640
+ } catch (err) {
641
+ console.error(`${appNameText} Error parsing client message: ${formatError2(err)} | raw=${msg.content.toString()}`);
642
+ }
643
+ orchestrator.clientsChannel.ack(msg);
644
+ } else {
645
+ console.log("${appNameText} Consumer cancelled by server");
646
+ }
647
+ });
648
+ };
649
+ var listenOnHeartbeatMessages = async (orchestrator) => {
650
+ (0, import_i_verify.assert)(orchestrator.hostsChannel, `orchestrator.hostsChannel is not defined`);
651
+ (0, import_i_verify.assert)(orchestrator.clientsChannel, `orchestrator.clientsChannel is not defined`);
652
+ orchestrator.clientsChannel.ackAll();
653
+ console.log(`${appNameText} Listening on the heartbeat queue: "${import_chalk2.default.blueBright(orchestrator.queueHostHeartbeat)}"`);
654
+ console.log(`${appNameText} [*] Waiting for heartbeat messages. To exit press "${import_chalk2.default.blueBright("CTRL+C")}"`);
655
+ orchestrator.clientsChannel.consume(orchestrator.queueHostHeartbeat, (msg) => {
656
+ (0, import_i_verify.assert)(orchestrator.hostsChannel, `orchestrator.hostsChannel is not defined`);
657
+ (0, import_i_verify.assert)(orchestrator.clientsChannel, `orchestrator.clientsChannel is not defined`);
658
+ if (msg !== null) {
659
+ let msgObj;
660
+ try {
661
+ msgObj = JSON.parse(msg.content.toString());
662
+ switch (msgObj.type) {
663
+ case "HEARTBEAT" /* HEARTBEAT */:
664
+ void asyncProcessColaboFlowMsg_Heartbeat(orchestrator, msgObj).catch((err) => {
665
+ console.error(`${appNameText} Error while processing HEARTBEAT: ${formatError2(err)}`);
666
+ });
667
+ break;
668
+ }
669
+ } catch (err) {
670
+ console.error(`${appNameText} Error parsing heartbeat message: ${formatError2(err)} | raw=${msg.content.toString()}`);
671
+ }
672
+ orchestrator.clientsChannel.ack(msg);
673
+ } else {
674
+ console.log("${appNameText} Consumer cancelled by server");
675
+ }
676
+ });
677
+ };
678
+ var orchestratorRun = async (orchestrator) => {
679
+ console.log(`${appNameText} Connecting to the server: ${import_chalk2.default.greenBright(orchestrator.amqpUrl)}`);
680
+ const effectiveAmqpUrl = getEffectiveAmqpUrl2(orchestrator.amqpUrl);
681
+ if (effectiveAmqpUrl !== orchestrator.amqpUrl) {
682
+ console.log(`${appNameText} Effective AMQP URL: ${import_chalk2.default.greenBright(effectiveAmqpUrl)}`);
683
+ }
684
+ logAmqpUrlDetails2(effectiveAmqpUrl);
685
+ let colaboFlowOrchestratorConnection;
686
+ const connectionName = `${orchestrator.orchestratorName}-pid-${process.pid}`;
687
+ const socketOptions = getConnectSocketOptions2(connectionName);
688
+ if (isAmqpDebugEnabled2()) {
689
+ console.log(`${appNameText} AMQP socket options: ${JSON.stringify(socketOptions)}`);
690
+ }
691
+ try {
692
+ colaboFlowOrchestratorConnection = await (0, import_amqplib2.connect)(effectiveAmqpUrl, socketOptions);
693
+ } catch (err) {
694
+ console.error(`Error connecting to the "${import_chalk2.default.greenBright(effectiveAmqpUrl)}" server: ${formatError2(err)}`);
695
+ if (isAmqpDebugEnabled2() && err instanceof Error && err.stack) {
696
+ console.error(`${appNameText} connect stack: ${err.stack}`);
697
+ }
698
+ return;
699
+ }
700
+ attachConnectionDebugHandlers2(colaboFlowOrchestratorConnection);
701
+ console.log(`${appNameText} Opening the ${import_chalk2.default.bold.italic("clients")} channel`);
702
+ try {
703
+ orchestrator.clientsChannel = await colaboFlowOrchestratorConnection.createChannel();
704
+ } catch (err) {
705
+ console.error(`Error creating the ${import_chalk2.default.greenBright("clients")} queue: ${formatError2(err)}`);
706
+ return;
707
+ }
708
+ attachChannelDebugHandlers2("clients", orchestrator.clientsChannel);
709
+ console.log(`${appNameText} Opening the ${import_chalk2.default.bold.italic("hosts")} channel`);
710
+ try {
711
+ orchestrator.hostsChannel = await colaboFlowOrchestratorConnection.createChannel();
712
+ } catch (err) {
713
+ console.error(`Error creating the ${import_chalk2.default.greenBright("hosts")} queue: ${formatError2(err)}`);
714
+ return;
715
+ }
716
+ attachChannelDebugHandlers2("hosts", orchestrator.hostsChannel);
717
+ (0, import_i_verify.assert)(orchestrator.hostsChannel, `orchestrator.hostsChannel is not defined`);
718
+ (0, import_i_verify.assert)(orchestrator.clientsChannel, `orchestrator.clientsChannel is not defined`);
719
+ console.log(`${appNameText} Opening the ${import_chalk2.default.bold.italic("orchestrator")} queue as a listener: ${import_chalk2.default.greenBright(orchestrator.queueOrchestrator)}`);
720
+ await orchestrator.clientsChannel.assertQueue(orchestrator.queueOrchestrator, {
721
+ durable: true,
722
+ exclusive: false,
723
+ autoDelete: false
724
+ });
725
+ console.log(`${appNameText} Opening the ${import_chalk2.default.bold.italic("heartbeat")} queue as a listener: ${import_chalk2.default.greenBright(orchestrator.queueHostHeartbeat)}`);
726
+ await orchestrator.hostsChannel.assertQueue(orchestrator.queueHostHeartbeat, {
727
+ durable: true,
728
+ exclusive: false,
729
+ autoDelete: false
730
+ });
731
+ console.log(`${appNameText} ${import_chalk2.default.blueBright("Delaying")} listening on clients to give time for hosts to register (to avoid task execution request errors due to no hosts that implement tasks (executors)) )`);
732
+ setTimeout(() => listenOnClientRequests(orchestrator), 2 * HEARTBEAT_TIME);
733
+ listenOnHeartbeatMessages(orchestrator);
734
+ };
735
+
736
+ // lib/host/index.ts
737
+ var import_amqplib3 = require("amqplib");
738
+ var import_chalk3 = __toESM(require("chalk"), 1);
739
+ var import_i_core2 = require("@colabo-flow/i-core");
740
+
741
+ // lib/host/omnipresentTasks.ts
742
+ var import_i_core = require("@colabo-flow/i-core");
743
+ var addOmnipresentTasks = async (host, hostRegisterTaskExecutor2, hostRegisterTask2) => {
744
+ const echoPing = (input) => {
745
+ console.log(`${host.appNameText} [echoPing] Pinged with the input: ${JSON.stringify(input)}`);
746
+ const output = {
747
+ input,
748
+ timeDateNow: Date.now(),
749
+ // https://nodejs.org/api/perf_hooks.html#performancenow
750
+ timePerformance: performance.now(),
751
+ // https://timestamp.online/article/how-to-get-current-date-and-time-in-javascript
752
+ timeHuman: (/* @__PURE__ */ new Date()).toISOString(),
753
+ hostname: host.hostname,
754
+ queueHost: host.queueHost
755
+ };
756
+ return output;
757
+ };
758
+ const executorEchoPing = {
759
+ id: "colabo.flow.echoPing",
760
+ description: "(Node.js) Used for testing worker availability. Returns the sender message in addition with the local metadata",
761
+ environment: import_i_core.EExecutingEnvironment.ISOMORPHIC,
762
+ reference: {
763
+ method: echoPing
764
+ }
765
+ };
766
+ const taskEchoPing = {
767
+ id: "colabo.flow.echoPing",
768
+ type: import_i_core.EFlowTaskType.SCRIPT,
769
+ executorRef: {
770
+ environment: import_i_core.EExecutingEnvironment.ISOMORPHIC,
771
+ id: executorEchoPing.id
772
+ },
773
+ placeType: import_i_core.EFlowPlaceType.TASK,
774
+ inputs: [],
775
+ outputs: [],
776
+ inoutputs: []
777
+ };
778
+ console.log(`${host.appNameText} Adding echoPing task executor and task`);
779
+ hostRegisterTaskExecutor2(host, executorEchoPing);
780
+ hostRegisterTask2(host, taskEchoPing);
781
+ };
782
+
783
+ // lib/host/index.ts
784
+ var LANGUAGE = "JAVASCRIPT" /* JAVASCRIPT */;
785
+ var MINIMUM_FRAME_MAX3 = 8192;
786
+ var isAmqpDebugEnabled3 = () => {
787
+ const debugRaw = process.env.COLABO_FLOW_AMQP_DEBUG || "";
788
+ return debugRaw === "1" || debugRaw.toLowerCase() === "true";
789
+ };
790
+ var parsePositiveInt3 = (rawValue, fallback) => {
791
+ if (!rawValue) return fallback;
792
+ const parsed = Number.parseInt(rawValue, 10);
793
+ return Number.isFinite(parsed) && parsed > 0 ? parsed : fallback;
794
+ };
795
+ var formatError3 = (err) => {
796
+ if (!(err instanceof Error)) return String(err);
797
+ const errorExtended = err;
798
+ const meta = [
799
+ errorExtended.code ? `code=${errorExtended.code}` : "",
800
+ errorExtended.errno !== void 0 ? `errno=${errorExtended.errno}` : "",
801
+ errorExtended.syscall ? `syscall=${errorExtended.syscall}` : "",
802
+ errorExtended.address ? `address=${errorExtended.address}` : "",
803
+ errorExtended.port !== void 0 ? `port=${errorExtended.port}` : ""
804
+ ].filter(Boolean).join(", ");
805
+ const msg = meta ? `${err.message} (${meta})` : err.message;
806
+ return err.stack ? `${msg}
807
+ ${err.stack}` : msg;
808
+ };
809
+ var logAmqpUrlDetails3 = (host, urlRaw) => {
810
+ try {
811
+ const parsed = new URL(urlRaw);
812
+ const vhostRaw = parsed.pathname || "/";
813
+ const vhostDecoded = decodeURIComponent(vhostRaw);
814
+ const heartbeatQuery = parsed.searchParams.get("heartbeat") || "(broker default)";
815
+ const frameMaxQuery = parsed.searchParams.get("frameMax") || "(amqplib default)";
816
+ console.log(`${host.appNameText} AMQP URL details: protocol=${parsed.protocol}, host=${parsed.hostname}, port=${parsed.port || "5672"}, vhostRaw="${vhostRaw}", vhostDecoded="${vhostDecoded}", heartbeat=${heartbeatQuery}, frameMax=${frameMaxQuery}`);
817
+ } catch (err) {
818
+ console.warn(`${host.appNameText} Could not parse AMQP URL "${urlRaw}": ${formatError3(err)}`);
819
+ }
820
+ };
821
+ var getEffectiveAmqpUrl3 = (host, urlRaw) => {
822
+ try {
823
+ const parsed = new URL(urlRaw);
824
+ const defaultFrameMax = parsePositiveInt3(process.env.COLABO_FLOW_AMQP_FRAME_MAX, 131072);
825
+ const frameMaxConfiguredRaw = parsed.searchParams.get("frameMax") || void 0;
826
+ let frameMax = parsePositiveInt3(frameMaxConfiguredRaw, defaultFrameMax);
827
+ if (frameMax < MINIMUM_FRAME_MAX3) {
828
+ console.warn(`${host.appNameText} frameMax=${frameMax} is too low; forcing frameMax=${MINIMUM_FRAME_MAX3}`);
829
+ frameMax = MINIMUM_FRAME_MAX3;
830
+ }
831
+ parsed.searchParams.set("frameMax", String(frameMax));
832
+ return parsed.toString();
833
+ } catch {
834
+ return urlRaw;
835
+ }
836
+ };
837
+ var getConnectSocketOptions3 = (connectionName) => {
838
+ return {
839
+ noDelay: true,
840
+ keepAlive: true,
841
+ keepAliveDelay: parsePositiveInt3(process.env.COLABO_FLOW_AMQP_KEEPALIVE_DELAY_MS, 1e3),
842
+ timeout: parsePositiveInt3(process.env.COLABO_FLOW_AMQP_CONNECT_TIMEOUT_MS, 1e4),
843
+ clientProperties: {
844
+ connection_name: connectionName
845
+ }
846
+ };
847
+ };
848
+ var attachConnectionDebugHandlers3 = (host, connection) => {
849
+ connection.on("error", (err) => {
850
+ console.error(`${host.appNameText} AMQP connection error: ${formatError3(err)}`);
851
+ });
852
+ connection.on("close", () => {
853
+ console.warn(`${host.appNameText} AMQP connection closed`);
854
+ });
855
+ connection.on("blocked", (reason) => {
856
+ console.warn(`${host.appNameText} AMQP connection blocked: ${String(reason)}`);
857
+ });
858
+ connection.on("unblocked", () => {
859
+ console.warn(`${host.appNameText} AMQP connection unblocked`);
860
+ });
861
+ connection.on("frameError", (err) => {
862
+ console.error(`${host.appNameText} AMQP frameError: ${formatError3(err)}`);
863
+ });
864
+ const maybeSocket = connection?.connection?.stream;
865
+ if (maybeSocket && isAmqpDebugEnabled3()) {
866
+ maybeSocket.on("error", (err) => {
867
+ console.error(`${host.appNameText} AMQP socket error: ${formatError3(err)}`);
868
+ });
869
+ maybeSocket.on("close", (hadError) => {
870
+ console.warn(`${host.appNameText} AMQP socket close (hadError=${hadError})`);
871
+ });
872
+ maybeSocket.on("end", () => {
873
+ console.warn(`${host.appNameText} AMQP socket end`);
874
+ });
875
+ maybeSocket.on("timeout", () => {
876
+ console.warn(`${host.appNameText} AMQP socket timeout`);
877
+ });
878
+ }
879
+ };
880
+ var attachChannelDebugHandlers3 = (host, channelName, channel) => {
881
+ channel.on("error", (err) => {
882
+ console.error(`${host.appNameText} AMQP channel "${channelName}" error: ${formatError3(err)}`);
883
+ });
884
+ channel.on("close", () => {
885
+ console.warn(`${host.appNameText} AMQP channel "${channelName}" closed`);
886
+ });
887
+ channel.on("return", (msg) => {
888
+ if (isAmqpDebugEnabled3()) {
889
+ console.warn(`${host.appNameText} AMQP channel "${channelName}" returned a message: ${JSON.stringify(msg)}`);
890
+ }
891
+ });
892
+ channel.on("drain", () => {
893
+ if (isAmqpDebugEnabled3()) {
894
+ console.log(`${host.appNameText} AMQP channel "${channelName}" drain`);
895
+ }
896
+ });
897
+ };
898
+ var hostSetTitles = (host) => {
899
+ process.title = `ColaboFlow.Go-${host.hostname}`;
900
+ host.appNameText = `[${import_chalk3.default.red.bold("Colabo")}${import_chalk3.default.blue.bold("Flow")}${import_chalk3.default.green.bold(".Go")}-${import_chalk3.default.green.yellow(host.hostname)}]`;
901
+ };
902
+ var hostRegisterTaskExecutor = (host, executor) => {
903
+ console.log(`${host.appNameText} Registering task executor, executor.id "${import_chalk3.default.greenBright(executor.id)}"`);
904
+ host.taskExecutorsAvailable[executor.id] = executor;
905
+ };
906
+ var getTaskExecutor = (host, executorId) => {
907
+ return host.taskExecutorsAvailable[executorId];
908
+ };
909
+ var hostRegisterTask = (host, task) => {
910
+ host.tasksAvailable[task.id] = task;
911
+ console.log(`${host.appNameText} Registered task with task.id "${import_chalk3.default.greenBright(task.id)}"`);
912
+ };
913
+ var connectToServer = async (host) => {
914
+ console.log(`${host.appNameText} Connecting to the server: ${import_chalk3.default.greenBright(host.amqpUrl)}`);
915
+ const effectiveAmqpUrl = getEffectiveAmqpUrl3(host, host.amqpUrl);
916
+ if (effectiveAmqpUrl !== host.amqpUrl) {
917
+ console.log(`${host.appNameText} Effective AMQP URL: ${import_chalk3.default.greenBright(effectiveAmqpUrl)}`);
918
+ }
919
+ logAmqpUrlDetails3(host, effectiveAmqpUrl);
920
+ let colaboFlowOrchestratorConnection;
921
+ const connectionName = `${host.hostname}-pid-${process.pid}`;
922
+ const socketOptions = getConnectSocketOptions3(connectionName);
923
+ if (isAmqpDebugEnabled3()) {
924
+ console.log(`${host.appNameText} AMQP socket options: ${JSON.stringify(socketOptions)}`);
925
+ }
926
+ try {
927
+ colaboFlowOrchestratorConnection = await (0, import_amqplib3.connect)(effectiveAmqpUrl, socketOptions);
928
+ host.connection = colaboFlowOrchestratorConnection;
929
+ attachConnectionDebugHandlers3(host, colaboFlowOrchestratorConnection);
930
+ return colaboFlowOrchestratorConnection;
931
+ } catch (err) {
932
+ console.error(`Error connecting to the "${import_chalk3.default.greenBright(effectiveAmqpUrl)}" server: ${formatError3(err)}`);
933
+ if (isAmqpDebugEnabled3() && err instanceof Error && err.stack) {
934
+ console.error(`${host.appNameText} connect stack: ${err.stack}`);
935
+ }
936
+ throw err;
937
+ }
938
+ };
939
+ var connectToHost = async (host, colaboFlowOrchestratorConnection) => {
940
+ console.log(`${host.appNameText} Opening the ${import_chalk3.default.bold.italic("node host")} channel as a listener (consumer): ${import_chalk3.default.greenBright(host.queueHost)}`);
941
+ let chHost;
942
+ try {
943
+ chHost = await colaboFlowOrchestratorConnection.createChannel();
944
+ attachChannelDebugHandlers3(host, "host-listener", chHost);
945
+ return chHost;
946
+ } catch (err) {
947
+ console.error(`${host.appNameText} Error creating the "${import_chalk3.default.greenBright(host.queueHost)}" queue: ${formatError3(err)}`);
948
+ throw err;
949
+ }
950
+ };
951
+ var connectToOrchestratorHeartbeat = async (host, colaboFlowOrchestratorConnection) => {
952
+ console.log(`${host.appNameText} Opening the ${import_chalk3.default.bold.italic("orchestrator heartbeat")} channel as a produced (emitter): ${import_chalk3.default.greenBright(host.queueHostHeartbeat)}`);
953
+ try {
954
+ const chHostHeartbeat = await colaboFlowOrchestratorConnection.createChannel();
955
+ host.chHostHeartbeat = chHostHeartbeat;
956
+ attachChannelDebugHandlers3(host, "host-heartbeat", chHostHeartbeat);
957
+ return chHostHeartbeat;
958
+ } catch (err) {
959
+ console.error(`${host.appNameText} Error creating the "${import_chalk3.default.greenBright(host.queueHostHeartbeat)}" queue: ${formatError3(err)}`);
960
+ throw err;
961
+ }
962
+ };
963
+ var heartbeatId = 0;
964
+ var sendHeartbeatToHost = async (host) => {
965
+ if (!host.chHostHeartbeat) {
966
+ console.error(`${host.appNameText} [sendHeartbeatToHost] Error: channel host.chHostHeartbeat is not existing`);
967
+ return;
968
+ }
969
+ const heartbeat = {
970
+ ...createGoMsg(host.hostname, "HEARTBEAT" /* HEARTBEAT */),
971
+ extension: {
972
+ id: heartbeatId++,
973
+ queueHost: host.queueHost,
974
+ language: "JAVASCRIPT" /* JAVASCRIPT */,
975
+ taskIds: Object.keys(host.taskExecutorsAvailable)
976
+ },
977
+ msg: `node host with tasks: ${JSON.stringify(Object.keys(host.taskExecutorsAvailable))}`
978
+ };
979
+ if (host.reportsConfig.showHeartbeatMsgs && heartbeat.extension.id % host.reportsConfig.showHeartbeatMsgs == 0) {
980
+ console.log(`${host.appNameText} Sending heartbeat [${heartbeat.extension.id}] [from "${import_chalk3.default.blueBright(host.hostname)}" queue: "${import_chalk3.default.blueBright(host.queueHostHeartbeat)}"]`);
981
+ }
982
+ try {
983
+ host.chHostHeartbeat.sendToQueue(host.queueHostHeartbeat, Buffer.from(JSON.stringify(heartbeat)));
984
+ } catch (err) {
985
+ console.error(`${host.appNameText} [sendHeartbeatToHost] Failed to send heartbeat: ${formatError3(err)}`);
986
+ }
987
+ };
988
+ var asyncProcessColaboFlowMsg_TaskExecute2 = async (host, msgOrchestratorReqObj) => {
989
+ if (!host.chHostHeartbeat) {
990
+ console.error(`${host.appNameText} [sendHeartbeatToHost] Error: channel host.chHostHeartbeat is not existing`);
991
+ return;
992
+ }
993
+ const msgOrchestratorTaskExecuteReqObjExtension = msgOrchestratorReqObj.extension;
994
+ const taskId = msgOrchestratorTaskExecuteReqObjExtension.taskId;
995
+ const taskInput = msgOrchestratorTaskExecuteReqObjExtension.taskInput;
996
+ const queueReplyTo = msgOrchestratorReqObj.replyTo ?? host.queueHostHeartbeat;
997
+ if (host.reportsConfig.showExecutionMsgs) {
998
+ console.log(`${host.appNameText} [asyncProcessColaboFlowMsg_TaskExecute] Got a task to execute [and return over the RPC-reply queue: "${import_chalk3.default.blueBright(queueReplyTo)}"]: taskId: ${taskId}`);
999
+ }
1000
+ const task = host.tasksAvailable[taskId];
1001
+ if (!task) {
1002
+ console.error(`${host.appNameText} [asyncProcessColaboFlowMsg_TaskExecute] task is missing for the id: ${taskId}`);
1003
+ }
1004
+ console.log(`${host.appNameText} [asyncProcessColaboFlowMsg_TaskExecute] Executing id: ${import_chalk3.default.blueBright(taskId)}, task.description: ${task.description}`);
1005
+ const taskInstanceId = `taskId:lang-${LANGUAGE}:host-${host.hostname}:${(0, import_uuid.v1)()}`;
1006
+ const taskInstance = (0, import_i_core2.createTaskInstanceForTaskWithoutFlow)(task);
1007
+ taskInstance.id = taskInstanceId;
1008
+ host.taskInstances[taskId] = taskInstance;
1009
+ host.runningTaskInstancesInfos[taskId] = {
1010
+ id: taskInstanceId,
1011
+ taskInstance
1012
+ };
1013
+ if (typeof task.executorRef?.id === "undefined") {
1014
+ console.error(`Executor ID is not provided for the task: ${taskId}`);
1015
+ return;
1016
+ }
1017
+ const taskExecutor = getTaskExecutor(host, task.executorRef?.id);
1018
+ const msgTaskExecutionProgress = {
1019
+ ...createGoMsg(host.hostname, "TASK_EXECUTE_PROGRESS" /* TASK_EXECUTE_PROGRESS */),
1020
+ requestId: msgOrchestratorReqObj.requestId,
1021
+ msgReplyChainIds: [msgOrchestratorReqObj.id],
1022
+ extension: {
1023
+ taskInstanceId,
1024
+ status: "INITIALIZED" /* INITIALIZED */,
1025
+ progress: 0
1026
+ },
1027
+ msg: `Returning task execution for the taskId: '${taskId}' over queue: '${queueReplyTo}'}`
1028
+ };
1029
+ if (host.reportsConfig.showExecutionMsgs) {
1030
+ console.log(`${host.appNameText} Sending PROGRESS to the task execution requester (orchestrator) [queue: "${import_chalk3.default.blueBright(queueReplyTo)}"]: ${JSON.stringify(msgTaskExecutionProgress)}`);
1031
+ }
1032
+ try {
1033
+ host.chHostHeartbeat.sendToQueue(queueReplyTo, Buffer.from(JSON.stringify(msgTaskExecutionProgress)));
1034
+ } catch (err) {
1035
+ console.error(`${host.appNameText} Failed sending TASK_EXECUTE_PROGRESS to queue "${queueReplyTo}": ${formatError3(err)}`);
1036
+ }
1037
+ const taskOutput = await taskExecutor.reference?.method(taskInput);
1038
+ const taskOutputStr = JSON.stringify(taskOutput);
1039
+ const responseMaxChars = 200;
1040
+ const taskOutputStrShort = taskOutputStr.length > responseMaxChars ? taskOutputStr.substring(0, responseMaxChars / 2) + " [...] " + taskOutputStr.substring(taskOutputStr.length - responseMaxChars / 2) : taskOutputStr;
1041
+ console.log(`${host.appNameText} [asyncProcessColaboFlowMsg_TaskExecute] task executed. Result is (reduced to ${responseMaxChars} chars): ${import_chalk3.default.blueBright(taskOutputStrShort)}`);
1042
+ const msgTaskExecutionReply = {
1043
+ ...createGoMsg(host.hostname, "TASK_EXECUTE_RESPONSE" /* TASK_EXECUTE_RESPONSE */),
1044
+ requestId: msgOrchestratorReqObj.requestId,
1045
+ msgReplyChainIds: [msgOrchestratorReqObj.id],
1046
+ extension: {
1047
+ taskOutput
1048
+ },
1049
+ msg: `Returning task execution for the taskId: '${taskId}' over queue: '${queueReplyTo}'}`
1050
+ };
1051
+ const msgTaskExecutionReplyStr = JSON.stringify(msgTaskExecutionReply);
1052
+ const msgTaskExecutionReplyStrShort = msgTaskExecutionReplyStr.length > responseMaxChars ? msgTaskExecutionReplyStr.substring(0, responseMaxChars / 2) + " [...] " + msgTaskExecutionReplyStr.substring(msgTaskExecutionReplyStr.length - responseMaxChars / 2) : msgTaskExecutionReplyStr;
1053
+ if (host.reportsConfig.showExecutionMsgs) {
1054
+ console.log(`${host.appNameText} Sending RESPONSE to the task execution requester (orchestrator) [queue: "${import_chalk3.default.blueBright(queueReplyTo)}"]: (reduced to ${responseMaxChars} chars) ${msgTaskExecutionReplyStrShort}`);
1055
+ }
1056
+ try {
1057
+ host.chHostHeartbeat.sendToQueue(queueReplyTo, Buffer.from(msgTaskExecutionReplyStr));
1058
+ } catch (err) {
1059
+ console.error(`${host.appNameText} Failed sending TASK_EXECUTE_RESPONSE to queue "${queueReplyTo}": ${formatError3(err)}`);
1060
+ }
1061
+ };
1062
+ var processColaboFlowMsg_TaskInstancesReport = (host, msgObj) => {
1063
+ if (!host.chHostHeartbeat) {
1064
+ console.error(`${host.appNameText} [sendHeartbeatToHost] Error: channel host.chHostHeartbeat is not existing`);
1065
+ return;
1066
+ }
1067
+ const msgExtension = msgObj.extension;
1068
+ const reportFinalizedTaskInstances = msgExtension.reportFinalizedTaskInstances;
1069
+ const reportRunningTaskInstances = msgExtension.reportRunningTaskInstances;
1070
+ console.log(`${host.appNameText} [processColaboFlowMsg_TaskInstancesReport] Sending task instances report to the requester: ${import_chalk3.default.blueBright(msgObj.sender)}`);
1071
+ const tasksInstanceInfos = {};
1072
+ if (reportRunningTaskInstances) {
1073
+ Object.assign(tasksInstanceInfos, host.runningTaskInstancesInfos);
1074
+ }
1075
+ if (reportFinalizedTaskInstances) {
1076
+ Object.assign(tasksInstanceInfos, host.finalizedTaskInstancesInfos);
1077
+ }
1078
+ const msgReply = {
1079
+ ...createGoMsg(host.hostname, "TASK_INSTANCES_REPORT__RESPONSE" /* TASK_INSTANCES_REPORT__RESPONSE */),
1080
+ requestId: msgObj.requestId,
1081
+ msgReplyChainIds: [msgObj.id],
1082
+ extension: {
1083
+ tasksInstanceInfos
1084
+ },
1085
+ msg: `node host with tasks: ${JSON.stringify(Object.keys(host.taskExecutorsAvailable))}`
1086
+ };
1087
+ const queueReplyTo = msgObj.replyTo ?? host.queueHostHeartbeat;
1088
+ if (host.reportsConfig.showReportsMsgs) {
1089
+ console.log(`${host.appNameText} Sending response to the task instances report [queue: "${import_chalk3.default.blueBright(queueReplyTo)}"]: ${JSON.stringify(msgReply)}`);
1090
+ }
1091
+ try {
1092
+ host.chHostHeartbeat.sendToQueue(queueReplyTo, Buffer.from(JSON.stringify(msgReply)));
1093
+ } catch (err) {
1094
+ console.error(`${host.appNameText} Failed sending TASK_INSTANCES_REPORT__RESPONSE to queue "${queueReplyTo}": ${formatError3(err)}`);
1095
+ }
1096
+ };
1097
+ var hostRun = async (host) => {
1098
+ process.title = `ColaboFlow.Go-${host.hostname}`;
1099
+ addOmnipresentTasks(host, hostRegisterTaskExecutor, hostRegisterTask);
1100
+ const colaboFlowOrchestratorConnection = await connectToServer(host);
1101
+ const chHost = await connectToHost(host, colaboFlowOrchestratorConnection);
1102
+ await connectToOrchestratorHeartbeat(host, colaboFlowOrchestratorConnection);
1103
+ console.log(`${host.appNameText} Hosting tasks: "${import_chalk3.default.greenBright(Object.keys(host.tasksAvailable).toString())}"`);
1104
+ setInterval(() => {
1105
+ sendHeartbeatToHost(host);
1106
+ }, HEARTBEAT_TIME);
1107
+ console.log(`${host.appNameText} Listening on the queue: "${import_chalk3.default.blueBright(host.queueHost)}"`);
1108
+ await chHost.assertQueue(host.queueHost, {
1109
+ exclusive: true
1110
+ });
1111
+ console.log(`${host.appNameText} [*] Waiting for messages in %s. To exit press "${import_chalk3.default.blueBright("CTRL+C")}"`);
1112
+ chHost.consume(host.queueHost, async (msg) => {
1113
+ if (msg !== null) {
1114
+ chHost.ack(msg);
1115
+ let msgObj;
1116
+ try {
1117
+ msgObj = JSON.parse(msg.content.toString());
1118
+ const msgObjStr = JSON.stringify(msgObj);
1119
+ const responseMaxChars = 200;
1120
+ const msgObjStrShort = msgObjStr.length > responseMaxChars ? msgObjStr.substring(0, responseMaxChars / 2) + " [...] " + msgObjStr.substring(msgObjStr.length - responseMaxChars / 2) : msgObjStr;
1121
+ console.log(`${host.appNameText} Received (reduced to ${responseMaxChars} chars): "${import_chalk3.default.blueBright(msgObjStrShort)}"`);
1122
+ console.log(`${host.appNameText} msgObj.sender: "${import_chalk3.default.blueBright(msgObj.sender)}", msgObj.type: "${import_chalk3.default.blueBright(msgObj.type)}, msgObj.msg: "${import_chalk3.default.blueBright(msgObj.msg)}"`);
1123
+ } catch (err) {
1124
+ console.error(`${host.appNameText} Error parsing the message: ${formatError3(err)} | raw=${msg.content.toString()}`);
1125
+ return;
1126
+ }
1127
+ try {
1128
+ switch (msgObj.type) {
1129
+ case "TASK_EXECUTE_REQUEST" /* TASK_EXECUTE_REQUEST */:
1130
+ await asyncProcessColaboFlowMsg_TaskExecute2(host, msgObj);
1131
+ break;
1132
+ case "TASK_INSTANCES_REPORT__REQUEST" /* TASK_INSTANCES_REPORT__REQUEST */:
1133
+ processColaboFlowMsg_TaskInstancesReport(host, msgObj);
1134
+ break;
1135
+ }
1136
+ } catch (err) {
1137
+ console.error(`${host.appNameText} Error while processing message type "${msgObj.type}": ${formatError3(err)}`);
1138
+ }
1139
+ } else {
1140
+ console.log("${host.appNameText} Consumer cancelled by server");
1141
+ }
1142
+ });
1143
+ };
1144
+
1145
+ // index.ts
1146
+ var import_i_register = require("@colabo-utils/i-register");
1147
+
1148
+ // lib/flowchestrator/store/flowchestrator.store.ts
1149
+ var import_chalk4 = __toESM(require("chalk"), 1);
1150
+ var import_i_core3 = require("@colabo-flow/i-core");
1151
+ var import_i_store = require("@colabo-utils/i-store");
1152
+ var import_i_core4 = require("@colabo-knalledge/i-core");
1153
+ var import_i_verify2 = require("@colabo-utils/i-verify");
1154
+ var import_i_core5 = require("@colabo-flow/i-core");
1155
+ var DEBUG = true;
1156
+ var DEBUG_VERBOSE = true;
1157
+ var appNameText2 = "ColaboFlow.Go.FlowCheStrator.Store";
1158
+ var _store;
1159
+ var useFlowFlowchestratorStore = (flowStoreProtected) => {
1160
+ const _appNameText = flowStoreProtected.appNameText;
1161
+ appNameText2 = `${_appNameText}:[${import_chalk4.default.bold.yellow("STORE")}]`;
1162
+ if (!_store) {
1163
+ _store = (0, import_i_store.createBaseStore)((set, _get) => {
1164
+ const get = () => {
1165
+ return _get();
1166
+ };
1167
+ const storeObj = {
1168
+ // state
1169
+ // ========================
1170
+ flowInstanceObservers: [],
1171
+ flowInstanceContexts: {},
1172
+ flowInstancesContainer: {},
1173
+ // mutations
1174
+ // ========================
1175
+ addFlowInstance: (payload) => {
1176
+ const { flowInstanceContexts, flowInstancesContainer } = get();
1177
+ flowInstanceContexts[payload.flowInstance.id] = {
1178
+ visualTaskContainers: {}
1179
+ };
1180
+ const flowInstanceContainer = {
1181
+ flowInstance: payload.flowInstance,
1182
+ flowInstanceEngine: payload.flowEngine,
1183
+ isFlowStarted: false,
1184
+ flowInput: payload.flowInput
1185
+ };
1186
+ flowInstancesContainer[payload.flowInstance.id] = flowInstanceContainer;
1187
+ },
1188
+ removeFlowInstance: (payload) => {
1189
+ const { flowInstancesContainer, flowInstanceContexts } = get();
1190
+ if (DEBUG) console.log(`${appNameText2}:[removeFlowInstance] removing flow instance with ID: ${payload.flowInstanceId}`);
1191
+ delete flowInstancesContainer[payload.flowInstanceId];
1192
+ delete flowInstanceContexts[payload.flowInstanceId];
1193
+ },
1194
+ updateFlowInstanceId: (payload) => {
1195
+ const { flowInstancesContainer, flowInstanceContexts } = get();
1196
+ flowInstancesContainer[payload.flowInstanceIdNew] = flowInstancesContainer[payload.flowInstanceIdCurrent];
1197
+ delete flowInstancesContainer[payload.flowInstanceIdCurrent];
1198
+ flowInstancesContainer[payload.flowInstanceIdNew].flowInstance.id = payload.flowInstanceIdNew;
1199
+ flowInstanceContexts[payload.flowInstanceIdNew] = flowInstanceContexts[payload.flowInstanceIdCurrent];
1200
+ delete flowInstanceContexts[payload.flowInstanceIdCurrent];
1201
+ },
1202
+ // actions
1203
+ // ========================
1204
+ loadFlowInstances: async (flowId, flowInstanceNodeId, statuses) => {
1205
+ if (DEBUG) console.log(`${appNameText2}:[loadFlowInstances] loading flow instances...`);
1206
+ const request = {
1207
+ type: import_i_core4.KEDGE_API_TYPE.INDEX_COLABO_API,
1208
+ paramsDetailed: {
1209
+ type: {
1210
+ path: "type",
1211
+ value: import_i_core3.KFlowTypes.FLOW_INSTANCE
1212
+ }
1213
+ }
1214
+ };
1215
+ if (flowId) {
1216
+ request.paramsDetailed ??= {};
1217
+ request.paramsDetailed["flowId"] = {
1218
+ path: "dataContent.flowId",
1219
+ value: flowId
1220
+ };
1221
+ }
1222
+ if (flowInstanceNodeId) {
1223
+ request.paramsDetailed ??= {};
1224
+ request.paramsDetailed["flowInstanceNodeId"] = {
1225
+ path: "_id",
1226
+ value: flowInstanceNodeId
1227
+ };
1228
+ }
1229
+ if (statuses) {
1230
+ const statusesStrArray = statuses.map((status) => status.toString());
1231
+ request.paramsDetailed ??= {};
1232
+ request.paramsDetailed["statuses"] = {
1233
+ path: "dataContent.executionStatus.status",
1234
+ value: statusesStrArray,
1235
+ props: {
1236
+ type: import_i_core4.EApiRequestParamType.IN
1237
+ }
1238
+ };
1239
+ }
1240
+ const flowInstanceKNodes = await flowStoreProtected.kNodeService.getVosWithColaboApi(request);
1241
+ if (!flowInstanceKNodes) {
1242
+ throw new Error("persisted Flow instances not retrieved from store");
1243
+ }
1244
+ if (DEBUG) console.log(`${appNameText2}:[loadFlowInstances] flow instances retrieved (packed) from store with IDs ${flowInstanceKNodes.map((kNode) => kNode._id)}`);
1245
+ const flowInstances = await Promise.all(flowInstanceKNodes.map(async (flowInstanceKNode) => {
1246
+ const flowInstance = (0, import_i_core3.flowInstanceUnpack)(flowInstanceKNode);
1247
+ if (DEBUG) console.log(`${appNameText2}:[loadFlowInstances] flow instance unpacked: ${JSON.stringify(flowInstance, null, 4)}`);
1248
+ for (const tokenKnodeId of flowInstanceKNode?.dataContent?.tokenKnodeIds ?? []) {
1249
+ const tokenKNode = await flowStoreProtected.kNodeService.getById(tokenKnodeId);
1250
+ if (!tokenKNode) {
1251
+ throw new Error(`Token not found, tokenKnodeId: ${tokenKnodeId}`);
1252
+ }
1253
+ const token = (0, import_i_core5.tokenUnpack)(tokenKNode);
1254
+ if (DEBUG_VERBOSE) console.log(`${appNameText2}:[loadFlowInstances] token unpacked: ID ${token.id}`);
1255
+ flowInstance.tokens.push(token);
1256
+ }
1257
+ return flowInstance;
1258
+ }));
1259
+ if (DEBUG) console.log(`${appNameText2}:[loadFlowInstances] flow instances unpacked`);
1260
+ for (const flowInstance of flowInstances) {
1261
+ if (DEBUG) console.log(`${appNameText2}:[loadFlowInstances] adding flow instance with ID ${flowInstance.id} to the in-memory store`);
1262
+ const flow = await flowStoreProtected.getDomainStore().loadFlow(flowInstance.flowId);
1263
+ if (DEBUG_VERBOSE) console.log(`${appNameText2}:[loadFlowInstances] flow with ID ${flow.id} loaded from the store: ${JSON.stringify(flow, null, 4)}`);
1264
+ const flowEngine = new import_i_core3.FlowInstanceEngine(flow, flowInstance);
1265
+ const payloadFlowInstanceAdd = {
1266
+ flowInstance,
1267
+ flowEngine,
1268
+ // TODO: we should understand what to do with flowInput, where it is persisted and how to depersist it
1269
+ flowInput: void 0
1270
+ };
1271
+ get().addFlowInstance(payloadFlowInstanceAdd);
1272
+ }
1273
+ if (DEBUG_VERBOSE) console.log(`${appNameText2}:[loadInstances] flow instances loaded: ${JSON.stringify(flowInstances, null, 4)}`);
1274
+ return flowInstances;
1275
+ },
1276
+ createFlowInstance: async (payload) => {
1277
+ if (DEBUG) console.log(`${appNameText2}:[createFlowInstance] starting...`);
1278
+ const flow = payload.flow;
1279
+ const flowEngine = new import_i_core3.FlowInstanceEngine(flow, void 0, { createEntitiesIds: true, flowInstancePartial: payload.flowInstancePartial });
1280
+ const flowInstance = await flowEngine.asyncGetFlowInstance();
1281
+ if (DEBUG) console.log(`${appNameText2}:[createFlowInstance] flow instance created: ${JSON.stringify(flowInstance, null, 4)}`);
1282
+ const processNewFlowInstance_payload = {
1283
+ flow,
1284
+ flowInstance
1285
+ };
1286
+ const { flowInstanceObservers } = get();
1287
+ for (const observer of flowInstanceObservers) {
1288
+ if (DEBUG) console.log(`[FlowActions.FLOW_INSTANCE_CREATE] running flow instance observer, observer.name = ${observer.name}`);
1289
+ if (observer.asyncNewFlowInstanceProcessor) {
1290
+ await observer.asyncNewFlowInstanceProcessor(processNewFlowInstance_payload);
1291
+ }
1292
+ }
1293
+ const payloadFlowInstanceAdd = { flowInstance, flowEngine, flowInput: payload.flowInput };
1294
+ get().addFlowInstance(payloadFlowInstanceAdd);
1295
+ return flowInstance;
1296
+ },
1297
+ deleteFlowInstance: async (payload) => {
1298
+ if (DEBUG) console.log(`${appNameText2}:[deleteFlowInstance] deleting flow instance with ID: ${payload.flowInstanceId}`);
1299
+ const { flowInstancesContainer, removeFlowInstance } = get();
1300
+ removeFlowInstance({ flowInstanceId: payload.flowInstanceId });
1301
+ flowStoreProtected.kNodeService.destroy(payload.flowInstanceId);
1302
+ if (DEBUG) console.log(`${appNameText2}:[deleteFlowInstance] flow instance with ID ${payload.flowInstanceId} deleted from the in-memory and persistent store`);
1303
+ },
1304
+ persistFlowInstance: async (payload) => {
1305
+ const flowInstanceId = payload.flowInstanceId;
1306
+ if (DEBUG) console.log(`${appNameText2}:[persistFlowInstance] persisting flow instance with ID: ${flowInstanceId}`);
1307
+ const { flowInstanceContexts, flowInstancesContainer } = get();
1308
+ const flowInstanceContainer = flowInstancesContainer[flowInstanceId];
1309
+ const flowInstance = flowInstanceContainer.flowInstance;
1310
+ if (DEBUG) console.log(`${appNameText2}:[persistFlowInstance] persisting flow instance with ID: ${flowInstance.id}: ${JSON.stringify(flowInstance, null, 4)}`);
1311
+ const flowInstanceKNode = (0, import_i_core3.flowInstancePack)(flowInstance);
1312
+ if (flowInstanceKNode._id?.startsWith(import_i_core4.KnAllEdge_EntityEphemeralIdPrefix)) flowInstanceKNode._id = void 0;
1313
+ if (flowInstanceKNode._id) {
1314
+ if (DEBUG) console.log(`${appNameText2}:[persistFlowInstance] flow instance with ID ${flowInstance.id} already exists, updating it...`);
1315
+ const updateRequest = {
1316
+ type: import_i_core4.KNODE_API_TYPE.UPDATE_COLABO_API,
1317
+ paramsDetailed: {
1318
+ id: {
1319
+ path: "_id",
1320
+ value: flowInstance.id
1321
+ }
1322
+ },
1323
+ data: flowInstanceKNode
1324
+ };
1325
+ const kNodeFromServer = await flowStoreProtected.kNodeService.updateSingleWithColaboApi(updateRequest);
1326
+ if (!kNodeFromServer) {
1327
+ throw new Error("Flow instance not updated");
1328
+ }
1329
+ if (DEBUG) console.log(`${appNameText2}:[persistFlowInstance] flow instance updated with flow knode ID: ${kNodeFromServer._id}: ${JSON.stringify(kNodeFromServer, null, 4)}`);
1330
+ } else {
1331
+ if (DEBUG) console.log(`${appNameText2}:[persistFlowInstance] flow instance with ID ${flowInstance.id} does not exist, creating it...`);
1332
+ const createResult = await flowStoreProtected.kNodeService.create(flowInstanceKNode);
1333
+ if (!createResult || createResult.length !== 1) {
1334
+ throw new Error("Flow instance not created");
1335
+ }
1336
+ const kNodeFromServer = createResult[0];
1337
+ if (DEBUG) console.log(`${appNameText2}:[persistFlowInstance] flow instance persisted with flow knode ID: ${kNodeFromServer._id}: ${JSON.stringify(kNodeFromServer, null, 4)}`);
1338
+ get().updateFlowInstanceId({
1339
+ flowInstanceIdCurrent: flowInstance.id,
1340
+ flowInstanceIdNew: kNodeFromServer._id
1341
+ });
1342
+ }
1343
+ return flowInstance;
1344
+ },
1345
+ depersistFlowInstance: async (payload) => {
1346
+ const flowInstanceKnodeId = payload.flowInstanceId;
1347
+ if (DEBUG) console.log(`${appNameText2}:[persistFlowInstance] depersisting flow instance from kNode with ID: ${flowInstanceKnodeId}`);
1348
+ const flowInstanceKNode = await flowStoreProtected.kNodeService.getById(flowInstanceKnodeId);
1349
+ if (!flowInstanceKNode) {
1350
+ throw new Error("persisted Flow instance not retrieved from store");
1351
+ }
1352
+ if (DEBUG) console.log(`${appNameText2}:[persistFlowInstance] flow instance retrieved (packed) from store with ID ${flowInstanceKNode._id}: ${JSON.stringify(flowInstanceKNode, null, 4)}`);
1353
+ const flowInstance = (0, import_i_core3.flowInstanceUnpack)(flowInstanceKNode);
1354
+ for (const tokenKnodeId of flowInstanceKNode?.dataContent?.tokenKnodeIds ?? []) {
1355
+ const tokenKNode = await flowStoreProtected.kNodeService.getById(tokenKnodeId);
1356
+ if (!tokenKNode) {
1357
+ throw new Error(`Token not found, tokenKnodeId: ${tokenKnodeId}`);
1358
+ }
1359
+ const token = (0, import_i_core5.tokenUnpack)(tokenKNode);
1360
+ flowInstance.tokens.push(token);
1361
+ }
1362
+ if (DEBUG) console.log(`${appNameText2}:[persistFlowInstance] flow instance unpacked from kNode with ID ${flowInstanceKNode._id}: ${JSON.stringify(flowInstance, null, 4)}`);
1363
+ const flow = await flowStoreProtected.getDomainStore().loadFlow(flowInstance.flowId);
1364
+ const flowInstanceEngine = new import_i_core3.FlowInstanceEngine(flow);
1365
+ const processNewFlowInstance_payload = {
1366
+ flow,
1367
+ flowInstance
1368
+ };
1369
+ const { flowInstanceObservers } = get();
1370
+ for (const observer of flowInstanceObservers) {
1371
+ if (DEBUG) console.log(`[FlowActions.FLOW_INSTANCE_CREATE] running flow instance observer, observer.name = ${observer.name}`);
1372
+ if (observer.asyncNewFlowInstanceProcessor) {
1373
+ await observer.asyncNewFlowInstanceProcessor(processNewFlowInstance_payload);
1374
+ }
1375
+ }
1376
+ const flowInput = void 0;
1377
+ const payloadFlowInstanceAdd = { flowInstance, flowEngine: flowInstanceEngine, flowInput };
1378
+ get().addFlowInstance(payloadFlowInstanceAdd);
1379
+ return flowInstance;
1380
+ },
1381
+ executeFlowInstance: async (payload) => {
1382
+ },
1383
+ setFlowInstanceStatus: async (payload) => {
1384
+ const flowInstanceKnodeId = payload.flowInstanceKnodeId;
1385
+ if (DEBUG) console.log(`${appNameText2}:[setFlowInstanceStatus] setting flow instance status to ${payload.status} for flow instance with ID: ${flowInstanceKnodeId}`);
1386
+ const { flowInstancesContainer, depersistFlowInstance } = get();
1387
+ if (!(payload.flowInstanceKnodeId in flowInstancesContainer)) {
1388
+ console.info(`${appNameText2}:[getAgentTokenForFlowInstance] flow instance with ID ${payload.flowInstanceKnodeId} not found in the in-memory store. Retrieving it from the persistent store...`);
1389
+ await depersistFlowInstance({ flowInstanceId: payload.flowInstanceKnodeId });
1390
+ }
1391
+ const flowInstanceContainer = flowInstancesContainer[payload.flowInstanceKnodeId];
1392
+ if (!flowInstanceContainer) {
1393
+ const errorMsg = `Flow instance with ID ${payload.flowInstanceKnodeId} not found in the in-memory store after trying to depersist it.`;
1394
+ console.error(`${appNameText2}:[getAgentTokenForFlowInstance] ${errorMsg}`);
1395
+ return Promise.reject(new Error(errorMsg));
1396
+ }
1397
+ const flowInstance = flowInstanceContainer.flowInstance;
1398
+ console.log(`${appNameText2}:[setFlowInstanceStatus] flow instance with ID ${flowInstance.id} found in the in-memory store: ${JSON.stringify(flowInstance, null, 4)}`);
1399
+ flowInstance.executionStatus.status = payload.status;
1400
+ get().persistFlowInstance({ flowInstanceId: flowInstance.id });
1401
+ return flowInstance.executionStatus.status;
1402
+ },
1403
+ joinAgentToFlowInstance: async (payload) => {
1404
+ const { flowInstanceContexts, flowInstancesContainer, depersistFlowInstance } = get();
1405
+ if (!(payload.flowInstanceKnodeId in flowInstancesContainer)) {
1406
+ console.info(`${appNameText2}:[joinFlowInstance] flow instance with ID ${payload.flowInstanceKnodeId} not found in the in-memory store. Retrieving it from the persistent store...`);
1407
+ await depersistFlowInstance({ flowInstanceId: payload.flowInstanceKnodeId });
1408
+ }
1409
+ const flowInstanceContainer = flowInstancesContainer[payload.flowInstanceKnodeId];
1410
+ if (!flowInstanceContainer) {
1411
+ const errorMsg = `Flow instance with ID ${payload.flowInstanceKnodeId} not found in the in-memory store after trying to depersist it.`;
1412
+ console.error(`${appNameText2}:[joinFlowInstance] ${errorMsg}`);
1413
+ return Promise.reject(new Error(errorMsg));
1414
+ }
1415
+ const flowInstance = flowInstanceContainer.flowInstance;
1416
+ const flowEngine = flowInstanceContainer.flowInstanceEngine;
1417
+ const flow = await flowEngine.asyncGetFlow();
1418
+ let place;
1419
+ if (payload.placeId) {
1420
+ place = (0, import_i_core3.findPlaceByIdInFlow)(flow, payload.placeId);
1421
+ (0, import_i_verify2.assert)(place, `Flow place with ID ${payload.placeId} not found in flow with ID ${flow.id}`);
1422
+ } else {
1423
+ const startEvent = (0, import_i_core3.getStartEventInFlow)(flow);
1424
+ (0, import_i_verify2.assert)(startEvent, `Flow start event not found in flow with ID ${flow.id}`);
1425
+ place = startEvent;
1426
+ }
1427
+ const token = flowEngine.createTokenInPlace(place, payload.whoAmI, payload.agentType, void 0, payload.flowInstanceKnodeId);
1428
+ if (DEBUG) console.log(`${appNameText2}:[joinFlowInstance] created token: ${token.id} in place: ${place.id}`);
1429
+ const tokenKNode = (0, import_i_core5.tokenPack)(token);
1430
+ console.log(`${appNameText2}:[joinFlowInstance] tokenKNode: ${JSON.stringify(tokenKNode, null, 4)}`);
1431
+ const createResult = await flowStoreProtected.kNodeService.create(tokenKNode);
1432
+ if (!createResult || createResult.length !== 1) {
1433
+ throw new Error("Token not created");
1434
+ }
1435
+ const kNodeFromServer = createResult[0];
1436
+ if (DEBUG) console.log(`${appNameText2}:[joinFlowInstance] token persisted with flow knode ID: ${kNodeFromServer._id}: ${JSON.stringify(kNodeFromServer, null, 4)}`);
1437
+ token.id = kNodeFromServer._id;
1438
+ flowInstance.tokens.push(token);
1439
+ const flowInstanceKnodeId = get().persistFlowInstance({ flowInstanceId: flowInstance.id });
1440
+ if (DEBUG) console.log(`${appNameText2}:[joinFlowInstance] flow instance persisted with flow knode ID: ${flowInstanceKnodeId}: ${JSON.stringify(flowInstance, null, 4)}`);
1441
+ return kNodeFromServer._id;
1442
+ },
1443
+ getAgentTokenForFlowInstance: async (payload) => {
1444
+ const { flowInstanceContexts, flowInstancesContainer, depersistFlowInstance } = get();
1445
+ if (DEBUG) console.log(`${appNameText2}:[getAgentTokenForFlowInstance] starting...`);
1446
+ if (DEBUG) console.log(`${appNameText2}:[getAgentTokenForFlowInstance] flowInstanceKnodeId: ${payload.flowInstanceId}, whoAmI: ${payload.whoAmI}`);
1447
+ if (!(payload.flowInstanceId in flowInstancesContainer)) {
1448
+ console.info(`${appNameText2}:[getAgentTokenForFlowInstance] flow instance with ID ${payload.flowInstanceId} not found in the in-memory store. Retrieving it from the persistent store...`);
1449
+ await depersistFlowInstance({ flowInstanceId: payload.flowInstanceId });
1450
+ }
1451
+ const flowInstanceContainer = flowInstancesContainer[payload.flowInstanceId];
1452
+ if (!flowInstanceContainer) {
1453
+ const errorMsg = `Flow instance with ID ${payload.flowInstanceId} not found in the in-memory store after trying to depersist it.`;
1454
+ console.error(`${appNameText2}:[getAgentTokenForFlowInstance] ${errorMsg}`);
1455
+ return Promise.reject(new Error(errorMsg));
1456
+ }
1457
+ const flowInstance = flowInstanceContainer.flowInstance;
1458
+ const token = flowInstance.tokens.find((token2) => token2.whoAmI === payload.whoAmI);
1459
+ if (token) {
1460
+ if (DEBUG) console.log(`${appNameText2}:[getAgentTokenForFlowInstance] token found in flow instance with ID ${flowInstance.id}: ${JSON.stringify(token, null, 4)}`);
1461
+ return token;
1462
+ } else {
1463
+ if (DEBUG) console.log(`${appNameText2}:[getAgentTokenForFlowInstance] token not found in flow instance with ID ${flowInstance.id}`);
1464
+ return void 0;
1465
+ }
1466
+ },
1467
+ loadToken: async (tokenKnodeId) => {
1468
+ if (DEBUG) console.log(`${appNameText2}:[loadToken] loading token with ID: ${tokenKnodeId}`);
1469
+ const tokenKNode = await flowStoreProtected.kNodeService.getById(tokenKnodeId);
1470
+ if (!tokenKNode) {
1471
+ throw new Error("Token not found");
1472
+ }
1473
+ if (DEBUG) console.log(`${appNameText2}:[loadToken] token retrieved from store with ID: ${tokenKNode._id}: ${JSON.stringify(tokenKNode, null, 4)}`);
1474
+ const token = (0, import_i_core5.tokenUnpack)(tokenKNode);
1475
+ if (DEBUG) console.log(`${appNameText2}:[loadToken] token unpacked from kNode with ID: ${tokenKNode._id}: ${JSON.stringify(token, null, 4)}`);
1476
+ return token;
1477
+ },
1478
+ loadTokens: async (payload) => {
1479
+ const { flowInstanceContexts, flowInstancesContainer, depersistFlowInstance } = get();
1480
+ if (!(payload.flowInstanceKnodeId in flowInstancesContainer)) {
1481
+ console.info(`${appNameText2}:[joinFlowInstance] flow instance with ID ${payload.flowInstanceKnodeId} not found in the in-memory store. Retrieving it from the persistent store...`);
1482
+ await depersistFlowInstance({ flowInstanceId: payload.flowInstanceKnodeId });
1483
+ }
1484
+ const flowInstanceContainer = flowInstancesContainer[payload.flowInstanceKnodeId];
1485
+ if (!flowInstanceContainer) {
1486
+ const errorMsg = `Flow instance with ID ${payload.flowInstanceKnodeId} not found in the in-memory store after trying to depersist it.`;
1487
+ console.error(`${appNameText2}:[joinFlowInstance] ${errorMsg}`);
1488
+ return Promise.reject(new Error(errorMsg));
1489
+ }
1490
+ const flowInstance = flowInstanceContainer.flowInstance;
1491
+ const tokens = flowInstance.tokens;
1492
+ const tokensReduced = tokens.map((token) => {
1493
+ const tokenReduced = {
1494
+ id: token.id,
1495
+ whoAmI: token.whoAmI,
1496
+ agentType: token.agentType,
1497
+ placeId: token.placeId,
1498
+ dataEntryReferencesNo: token.dataEntryReferences.length
1499
+ };
1500
+ return tokenReduced;
1501
+ });
1502
+ if (DEBUG) console.log(`${appNameText2}:[loadTokens] tokens loaded from flow instance with ID ${flowInstance.id}: ${JSON.stringify(tokensReduced, null, 4)}`);
1503
+ return tokens;
1504
+ },
1505
+ moveToken: async (payload) => {
1506
+ const tokenId = payload.tokenId;
1507
+ const tokenTemp = await get().loadToken(tokenId);
1508
+ const flowInstanceId = tokenTemp.flowInstanceId;
1509
+ const { flowInstanceContexts, flowInstancesContainer, depersistFlowInstance } = get();
1510
+ if (!(flowInstanceId in flowInstancesContainer)) {
1511
+ console.info(`${appNameText2}:[joinFlowInstance] flow instance with ID ${flowInstanceId} not found in the in-memory store. Retrieving it from the persistent store...`);
1512
+ await depersistFlowInstance({ flowInstanceId });
1513
+ }
1514
+ const flowInstanceContainer = flowInstancesContainer[flowInstanceId];
1515
+ if (!flowInstanceContainer) {
1516
+ const errorMsg = `Flow instance with ID ${flowInstanceId} not found in the in-memory store after trying to depersist it.`;
1517
+ console.error(`${appNameText2}:[joinFlowInstance] ${errorMsg}`);
1518
+ return Promise.reject(new Error(errorMsg));
1519
+ }
1520
+ const flowInstance = flowInstanceContainer.flowInstance;
1521
+ const flowEngine = flowInstanceContainer.flowInstanceEngine;
1522
+ const flow = await flowEngine.asyncGetFlow();
1523
+ const tokens = flowInstance.tokens;
1524
+ const token = tokens.find((token2) => token2.id === payload.tokenId);
1525
+ if (!token) {
1526
+ const errorMsg = `Token with ID ${payload.tokenId} not found in flow instance with ID ${flowInstance.id}.`;
1527
+ console.error(`${appNameText2}:[moveToken] ${errorMsg}`);
1528
+ return Promise.reject(new Error(errorMsg));
1529
+ }
1530
+ const newPlaceId = payload.placeId;
1531
+ const place = (0, import_i_core3.findPlaceByIdInFlow)(flow, newPlaceId);
1532
+ if (!place) {
1533
+ const errorMsg = `Place with ID ${newPlaceId} not found in flow with ID ${flow.id}.`;
1534
+ console.error(`${appNameText2}:[moveToken] ${errorMsg}`);
1535
+ return Promise.reject(new Error(errorMsg));
1536
+ }
1537
+ token.placeId = newPlaceId;
1538
+ const tokenKNode = (0, import_i_core5.tokenPack)(token);
1539
+ const updateRequest = {
1540
+ type: import_i_core4.KNODE_API_TYPE.UPDATE_COLABO_API,
1541
+ paramsDetailed: {
1542
+ id: {
1543
+ path: "_id",
1544
+ value: token.id
1545
+ }
1546
+ },
1547
+ data: tokenKNode
1548
+ };
1549
+ const kNodeFromServer = await flowStoreProtected.kNodeService.updateSingleWithColaboApi(updateRequest);
1550
+ if (!kNodeFromServer) {
1551
+ throw new Error("Token not updated");
1552
+ }
1553
+ if (DEBUG) console.log(`${appNameText2}:[moveToken] token moved in flow instance with ID ${flowInstance.id} to placeId: ${newPlaceId}`);
1554
+ return token;
1555
+ },
1556
+ moveAllTokens: async (payload) => {
1557
+ const { flowInstanceContexts, flowInstancesContainer, depersistFlowInstance } = get();
1558
+ if (DEBUG) console.log(`${appNameText2}:[moveAllTokens] starting...`);
1559
+ if (DEBUG) console.log(`${appNameText2}:[moveAllTokens] flowInstanceId: ${payload.flowInstanceId}, placeId: ${payload.placeId}`);
1560
+ if (!(payload.flowInstanceId in flowInstancesContainer)) {
1561
+ console.info(`${appNameText2}:[moveAllTokens] flow instance with ID ${payload.flowInstanceId} not found in the in-memory store. Retrieving it from the persistent store...`);
1562
+ await depersistFlowInstance({ flowInstanceId: payload.flowInstanceId });
1563
+ }
1564
+ const flowInstanceContainer = flowInstancesContainer[payload.flowInstanceId];
1565
+ if (!flowInstanceContainer) {
1566
+ const errorMsg = `Flow instance with ID ${payload.flowInstanceId} not found in the in-memory store after trying to depersist it.`;
1567
+ console.error(`${appNameText2}:[moveAllTokens] ${errorMsg}`);
1568
+ return Promise.reject(new Error(errorMsg));
1569
+ }
1570
+ const flowInstance = flowInstanceContainer.flowInstance;
1571
+ const flowEngine = flowInstanceContainer.flowInstanceEngine;
1572
+ const flow = await flowEngine.asyncGetFlow();
1573
+ const tokens = flowInstance.tokens;
1574
+ for (const token of tokens) {
1575
+ const newPlaceId = payload.placeId;
1576
+ const place = (0, import_i_core3.findPlaceByIdInFlow)(flow, newPlaceId);
1577
+ if (!place) {
1578
+ const errorMsg = `Place with ID ${newPlaceId} not found in flow with ID ${flow.id}.`;
1579
+ console.error(`${appNameText2}:[moveAllTokens] ${errorMsg}`);
1580
+ return Promise.reject(new Error(errorMsg));
1581
+ }
1582
+ token.placeId = newPlaceId;
1583
+ const tokenKNode = (0, import_i_core5.tokenPack)(token);
1584
+ const updateRequest = {
1585
+ type: import_i_core4.KNODE_API_TYPE.UPDATE_COLABO_API,
1586
+ paramsDetailed: {
1587
+ id: {
1588
+ path: "_id",
1589
+ value: token.id
1590
+ }
1591
+ },
1592
+ data: tokenKNode
1593
+ };
1594
+ const kNodeFromServer = await flowStoreProtected.kNodeService.updateSingleWithColaboApi(updateRequest);
1595
+ if (!kNodeFromServer) {
1596
+ throw new Error("Token not updated");
1597
+ }
1598
+ }
1599
+ return tokens;
1600
+ }
1601
+ };
1602
+ return storeObj;
1603
+ });
1604
+ }
1605
+ const storeState = _store.getState();
1606
+ return storeState;
1607
+ };
1608
+
1609
+ // lib/flowchestrator/store/flow.store.ts
1610
+ var import_chalk5 = __toESM(require("chalk"), 1);
1611
+ var import_i_core_services = require("@colabo-knalledge/i-core-services");
1612
+ var import_i_core6 = require("@colabo-knalledge/i-core");
1613
+ var import_i_core7 = require("@colabo-flow/i-core");
1614
+ var import_i_store2 = require("@colabo-utils/i-store");
1615
+ var import_i_verify3 = require("@colabo-utils/i-verify");
1616
+ var DEBUG2 = true;
1617
+ var DEBUG_VERBOSE2 = false;
1618
+ var appNameText3 = "ColaboFlow.Go.Store";
1619
+ var _store2;
1620
+ var defaultKNodeServiceSingleton;
1621
+ function getDefaultKNodeService() {
1622
+ if (!defaultKNodeServiceSingleton) {
1623
+ defaultKNodeServiceSingleton = new import_i_core_services.ColaboKnAllEdgeNodeServiceExtended(
1624
+ null,
1625
+ null
1626
+ );
1627
+ }
1628
+ return defaultKNodeServiceSingleton;
1629
+ }
1630
+ var useFlowStore = (options) => {
1631
+ const { appNameText: _appNameText, kNodeService: injectedKNodeService } = options;
1632
+ appNameText3 = `${_appNameText}:[${import_chalk5.default.bold.yellow("STORE")}]`;
1633
+ if (!_store2) {
1634
+ if (!options.kNodeService && !options.useDefaultKNodeService) {
1635
+ throw new Error(
1636
+ `${appNameText3} useFlowStore: Missing kNodeService and useDefaultKNodeService not set`
1637
+ );
1638
+ }
1639
+ const kNodeService = options.useDefaultKNodeService ? getDefaultKNodeService() : options.kNodeService;
1640
+ (0, import_i_verify3.assert)(kNodeService, "[] KNode service is not initialized");
1641
+ const _getDomainStore = () => {
1642
+ (0, import_i_verify3.assert)(_store2, `${appNameText3} Flow Store is not initialized`);
1643
+ return _store2?.getState();
1644
+ };
1645
+ const flowStoreProtected = {
1646
+ appNameText: _appNameText,
1647
+ kNodeService,
1648
+ getDomainStore: _getDomainStore
1649
+ };
1650
+ _store2 = (0, import_i_store2.createBaseStore)((set, _get) => {
1651
+ const get = () => {
1652
+ return _get();
1653
+ };
1654
+ const storeObj = {
1655
+ // state
1656
+ // ========================
1657
+ flows: {},
1658
+ // modules
1659
+ // ========================
1660
+ modules: {
1661
+ flowchestrator: useFlowFlowchestratorStore(flowStoreProtected)
1662
+ },
1663
+ // mutations
1664
+ // ========================
1665
+ getFlow: (flowId) => {
1666
+ if (DEBUG2) console.log(`${appNameText3}:[getFlow] Getting flow: ${flowId}`);
1667
+ const { flows } = get();
1668
+ if (DEBUG2) console.log(`${appNameText3}:[getFlow] store.flows: ${Object.keys(flows)}`);
1669
+ const flow = flows[flowId];
1670
+ if (DEBUG2) console.log(`${appNameText3}:[getFlow] Flow found: ${flow ? flow.id : "undefined"}`);
1671
+ return flow;
1672
+ },
1673
+ addFlow: (flow) => {
1674
+ if (DEBUG2) console.log(`${appNameText3}:[addFlow] Adding flow: ${flow.id}`);
1675
+ set((state) => ({
1676
+ flows: {
1677
+ ...state.flows,
1678
+ [flow.id]: flow
1679
+ }
1680
+ }));
1681
+ const { flows } = get();
1682
+ if (DEBUG2) console.log(`${appNameText3}:[addFlow] store.flows: ${Object.keys(flows)}`);
1683
+ if (DEBUG2) console.log(`${appNameText3}:[addFlow] Flow added: ${flow.id}`);
1684
+ },
1685
+ // actions
1686
+ // ========================
1687
+ loadFlow: async (flowId) => {
1688
+ if (DEBUG2) console.log(`${appNameText3}:[loadFlow] Loading flow: ${flowId}`);
1689
+ const flowKNode = await kNodeService.getById(flowId);
1690
+ if (DEBUG_VERBOSE2) console.log(`${appNameText3} flowKNode: ${JSON.stringify(flowKNode, null, 4)}`);
1691
+ const flow = (0, import_i_core7.flowUnpack)(flowKNode);
1692
+ if (DEBUG_VERBOSE2) console.log(`${appNameText3} flow: ${JSON.stringify(flow, null, 4)}`);
1693
+ if (DEBUG2) console.log(`${appNameText3}:[loadFlow] Flow loaded: ${flow.id}`);
1694
+ get().addFlow(flow);
1695
+ return flow;
1696
+ },
1697
+ loadFlows: async () => {
1698
+ if (DEBUG2) console.log(`${appNameText3}:[loadFlows] Loading flows`);
1699
+ const request = {
1700
+ type: import_i_core6.KEDGE_API_TYPE.INDEX_COLABO_API,
1701
+ paramsDetailed: {
1702
+ type: {
1703
+ path: "type",
1704
+ value: import_i_core7.KFlowTypes.FLOW
1705
+ }
1706
+ }
1707
+ };
1708
+ const flowsKNode = await kNodeService.getVosWithColaboApi(request);
1709
+ const flows = flowsKNode.map((flowKNode) => {
1710
+ const flow = (0, import_i_core7.flowUnpack)(flowKNode);
1711
+ return flow;
1712
+ });
1713
+ const flowNames = flows.map((flow) => flow.name ?? flow.id);
1714
+ if (DEBUG2) console.log(`${appNameText3}:[loadFlows] Flows loaded: ${JSON.stringify(flowNames, null, 4)}`);
1715
+ flows.forEach(
1716
+ (flow) => {
1717
+ get().addFlow(flow);
1718
+ }
1719
+ );
1720
+ if (DEBUG2) console.log(`${appNameText3}:[loadFlows] Flows added to the in-memory store`);
1721
+ return flows;
1722
+ }
1723
+ };
1724
+ return storeObj;
1725
+ });
1726
+ }
1727
+ const storeState = _store2.getState();
1728
+ return storeState;
1729
+ };
1730
+
1731
+ // lib/flowchestrator/store/index.ts
1732
+ var import_i_store3 = require("@colabo-utils/i-store");
1733
+ var import_i_core_services2 = require("@colabo-knalledge/i-core-services");
1734
+ var _store3;
1735
+ var defaultKNodeServiceSingleton2;
1736
+ function getDefaultKNodeService2() {
1737
+ if (!defaultKNodeServiceSingleton2) {
1738
+ defaultKNodeServiceSingleton2 = new import_i_core_services2.ColaboKnAllEdgeNodeServiceExtended(
1739
+ null,
1740
+ null
1741
+ );
1742
+ }
1743
+ return defaultKNodeServiceSingleton2;
1744
+ }
1745
+ var useGlobalStore = (options) => {
1746
+ if (!_store3) {
1747
+ const useFlowStoreOptions = {
1748
+ appNameText: options.appNameText,
1749
+ kNodeService: options.kNodeService ? options.kNodeService : getDefaultKNodeService2(),
1750
+ useDefaultKNodeService: options.useDefaultKNodeService
1751
+ };
1752
+ _store3 = (0, import_i_store3.createBaseStore)((set, _get) => {
1753
+ const get = () => {
1754
+ return _get();
1755
+ };
1756
+ const storeObj = {
1757
+ // state
1758
+ // ========================
1759
+ appVersion: "1.0.0",
1760
+ // modules
1761
+ // ========================
1762
+ modules: {
1763
+ flow: useFlowStore(useFlowStoreOptions)
1764
+ // documents: useDocumentStore(),
1765
+ }
1766
+ // mutations
1767
+ // ========================
1768
+ // actions
1769
+ // ========================
1770
+ };
1771
+ return storeObj;
1772
+ });
1773
+ }
1774
+ const storeState = _store3.getState();
1775
+ return storeState;
1776
+ };
1777
+
1778
+ // index.ts
1779
+ var __getPackagePath = () => {
1780
+ return (0, import_i_register.getPackagePath_ToBeInvited)();
1781
+ };
1782
+ // Annotate the CommonJS export names for ESM import in node:
1783
+ 0 && (module.exports = {
1784
+ EColaboFlowGoMsgType,
1785
+ EProgrammingLanguageSupported,
1786
+ ETaskExecute_Progress_Status,
1787
+ HEARTBEAT_TIME,
1788
+ __getPackagePath,
1789
+ clientClose,
1790
+ clientExecuteTask,
1791
+ clientRun,
1792
+ hostRegisterTask,
1793
+ hostRegisterTaskExecutor,
1794
+ hostRun,
1795
+ hostSetTitles,
1796
+ orchestratorRun,
1797
+ useFlowFlowchestratorStore,
1798
+ useGlobalStore
1799
+ });
8
1800
  //# sourceMappingURL=index.js.map