filecat 5.22.13 → 5.22.14

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 (21) hide show
  1. package/README.md +7 -4
  2. package/build/dist/{523.663998ba467a7af5fdf9.js → 523.9be09b05e431d3a91fe0.js} +2 -2
  3. package/build/dist/{943.1ede2fa609a1c1720d1b.js → 943.54289eeb5f180aaa2701.js} +2 -2
  4. package/build/dist/index.html +1 -1
  5. package/build/dist/{main.188b5fb2b62547c6f227.js → main.12b34fbb15992dd7f4f1.js} +2 -2
  6. package/build/main.js +1 -1
  7. package/build/threads.work.filecat.js +1 -1
  8. package/package.json +1 -1
  9. package/shell/build.js +1 -2
  10. package/shell/config/webpack.worker.get.js +2 -2
  11. package/build/node_modules/@xiaobaidadada/node-pty-prebuilt/build/Release/conpty.node +0 -0
  12. package/build/node_modules/@xiaobaidadada/node-pty-prebuilt/build/Release/conpty_console_list.node +0 -0
  13. package/build/node_modules/@xiaobaidadada/node-pty-prebuilt/build/Release/pty.node +0 -0
  14. package/build/node_modules/@xiaobaidadada/node-tuntap2-wintun/build/Release/tuntap2Addon.node +0 -0
  15. package/build/node_modules/@xiaobaidadada/ssh2-prebuilt/build/Release/sshcrypto.node +0 -0
  16. package/build/node_modules/cpu-features/build/Release/cpufeatures.node +0 -0
  17. package/build/node_modules/node-process-watcher/build/Release/node-process-watcher.node +0 -0
  18. package/build/node_modules/sqlite3/build/Release/node_sqlite3.node +0 -0
  19. /package/build/dist/{523.663998ba467a7af5fdf9.js.LICENSE.txt → 523.9be09b05e431d3a91fe0.js.LICENSE.txt} +0 -0
  20. /package/build/dist/{943.1ede2fa609a1c1720d1b.js.LICENSE.txt → 943.54289eeb5f180aaa2701.js.LICENSE.txt} +0 -0
  21. /package/build/dist/{main.188b5fb2b62547c6f227.js.LICENSE.txt → main.12b34fbb15992dd7f4f1.js.LICENSE.txt} +0 -0
@@ -1,2 +1,2 @@
1
1
  /*! For license information please see threads.work.filecat.js.LICENSE.txt */
2
- (()=>{var __webpack_modules__={3054(e,t,n){"use strict";var r=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.start_ai_agent_agent=function(){(0,i.register_threads_worker_handler)(s.threads_msg_type.docs_init,async e=>{const{index_storage_type:t,a:n,b:r}=e.data;if(_=t,!g&&(g=new o.default.Index({tokenize:"strict"}),m=new o.default.Index({tokenize:"strict"}),"sqlite"===t&&p.Database)){const e=(0,a.default)({db:new p.Database(n)}),t=(0,a.default)({db:new p.Database(r)});await g.mount(e),await m.mount(t)}}),(0,i.register_threads_worker_handler)(s.threads_msg_type.docs_add,async e=>{if(!g)return;let{use_zh_segmentation:t,content:n,file_path:r}=e.data;if(t){n=l(n,!0).join(" ").toLowerCase();const e=l(r,!0).join(" ").toLowerCase();m.add(r,e)}else m.add(r,r.toLowerCase());g.add(r,n),"sqlite"===_&&p.Database&&(await g.commit(),await m.commit())}),(0,i.register_threads_worker_handler)(s.threads_msg_type.docs_del,async e=>{if(!g)return;let{file_path:t}=e.data;g.remove(t),m.remove(t),"sqlite"===_&&p.Database&&(await g.commit(),await m.commit())}),(0,i.register_threads_worker_handler)(s.threads_msg_type.docs_close,async e=>{g&&(g.clear(),m.clear(),"sqlite"===_&&p.Database&&(await g.commit(),await m.commit()),g=null,m=null)}),(0,i.register_threads_worker_handler)(s.threads_msg_type.docs_search,async e=>{const{key:t}=e.data,n={suggest:!0,resolution:9,context:!0,limit:50},r=g.search(t,n),i=m.search(t,n);return"sqlite"===_&&p.Database?{ids:await r,names_ids:await i}:{ids:r,names_ids:i}})};const i=n(324),s=n(7525),o=r(n(5474)),a=r(n(6890)),c=n(3917),{cut:l,cut_all:h,cut_for_search:u,tokenize:d,add_word:f}=n(2880),p=(0,c.get_bin_dependency)("sqlite3");let g,m,_},3917(__unused_webpack_module,exports,__webpack_require__){"use strict";function get_bin_dependency(module,auto_throw=!1){try{if("sqlite3"===module)return __webpack_require__(948);if("exe"===process.env.run_env)switch(module){case"@xiaobaidadada/dockerode":return __webpack_require__(8608);case"@xiaobaidadada/node-pty-prebuilt":return __webpack_require__(6194);case"@xiaobaidadada/ssh2-prebuilt":return __webpack_require__(9472);case"node-process-watcher":return __webpack_require__(5273);case"@xiaobaidadada/node-tuntap2-wintun":return __webpack_require__(3032);default:throw{message:"不存在的包"}}return eval("require")(module)}catch(e){if(console.log(`${process.env.run_env} 模块没有加载失败,请手动安装 npm 依赖( -g 安装的就尝试全局安装,本地仓库安装的就在仓库内安装):${module} error ${e.message}`),auto_throw)throw e}return{}}Object.defineProperty(exports,"__esModule",{value:!0}),exports.get_bin_dependency=get_bin_dependency},6890(e,t,n){"use strict";var r=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.concat=o,t.toArray=a,t.default=p;const i=r(n(6928)),s=(0,n(3917).get_bin_dependency)("sqlite3");function o(e){return[].concat.apply([],e)}function a(e,t){const n=[];for(const r of e.keys())n.push(t?""+r:r);return n}const c=16e3,l=["map","ctx","reg","tag","cfg"],h={text:"text",char:"text",varchar:"text",string:"text",number:"int",numeric:"int",integer:"int",smallint:"int",tinyint:"int",mediumint:"int",int:"int",int8:"int",uint8:"int",int16:"int",uint16:"int",int32:"int",uint32:"bigint",int64:"bigint",bigint:"bigint"};function u(e){return e.toLowerCase().replace(/[^a-z0-9_]/g,"")}const d=Object.create(null),f=Object.create(null);function p(e,t={}){if(!this||this.constructor!==p)return new p(e,t);if("object"==typeof e&&(t=e,e=e.name),e||console.info("Default storage space was used, because a name was not passed."),this.id=t.path||(":memory:"===e?e:"flexsearch"+(e?"-"+u(e):"")+".sqlite"),this.field=t.field?"_"+u(t.field):"",this.support_tag_search=!0,this.db=t.db||f[this.id]||null,this.type=t.type?h[t.type.toLowerCase()]:"string",!this.type)throw new Error("Unknown type of ID '"+t.type+"'")}function g(e,t,n){if(t){for(let t=0;t<e.length;t++)n?e[t].doc&&(e[t].doc=JSON.parse(e[t].doc)):e[t]=e[t].id;return e}{const t=[];for(let r,i=0;i<e.length;i++)r=e[i],t[r.res]||(t[r.res]=[]),t[r.res].push(n?r:r.id);return t}}function m(e,t){let n=t?",(?)":",?";for(let r=1;r<e;){if(!(r<=e-r)){n+=n.substring(0,(e-r)*(t?4:2));break}n+=n,r*=2}return n.substring(1)}p.prototype.mount=function(e){return e.index?e.mount(this):(e.db=this,this.open())},p.prototype.open=async function(){if(!this.db&&!(this.db=f[this.id])){let e=this.id;if(":memory:"!==e&&"/"!==e[0]&&"\\"!==e[0]){const t=process.cwd();e=i.default.join(t,this.id)}this.db=f[this.id]=new s.Database(e)}const e=this.db;for(let t=0;t<l.length;t++){const n=await this.promisfy({method:"get",stmt:"SELECT EXISTS(SELECT 1 FROM sqlite_master WHERE type = 'table' AND name = ?) as exist",params:[l[t]+("reg"===l[t]?"":this.field)]});if(!n||!n.exist){let n,r;switch(l[t]){case"map":n=`\n CREATE TABLE IF NOT EXISTS main.map${this.field}(\n key TEXT NOT NULL,\n res INTEGER NOT NULL,\n id ${this.type} NOT NULL\n );\n `,r=`\n CREATE INDEX IF NOT EXISTS map_key_index${this.field} \n ON map${this.field} (key);\n CREATE INDEX IF NOT EXISTS map_id_index${this.field}\n ON map${this.field} (id);\n `;break;case"ctx":n=`\n CREATE TABLE IF NOT EXISTS main.ctx${this.field}(\n ctx TEXT NOT NULL,\n key TEXT NOT NULL,\n res INTEGER NOT NULL,\n id ${this.type} NOT NULL\n );\n \n `,r=`\n CREATE INDEX IF NOT EXISTS ctx_key_index${this.field} \n ON ctx${this.field} (ctx, key);\n CREATE INDEX IF NOT EXISTS ctx_id_index${this.field}\n ON ctx${this.field} (id);\n `;break;case"tag":n=`\n CREATE TABLE IF NOT EXISTS main.tag${this.field}(\n tag TEXT NOT NULL,\n id ${this.type} NOT NULL\n );\n `,r=`\n CREATE INDEX IF NOT EXISTS tag_index${this.field} \n ON tag${this.field} (tag);\n CREATE INDEX IF NOT EXISTS tag_id_index${this.field}\n ON tag${this.field} (id);\n `;break;case"reg":n=`\n CREATE TABLE IF NOT EXISTS main.reg(\n id ${this.type} NOT NULL\n CONSTRAINT reg_pk${this.field}\n PRIMARY KEY,\n doc TEXT DEFAULT NULL \n );\n `,r="\n CREATE INDEX IF NOT EXISTS reg_index\n ON reg (id);\n ";break;case"cfg":n=`\n CREATE TABLE IF NOT EXISTS main.cfg${this.field} (\n cfg TEXT NOT NULL\n );\n `}await new Promise(function(t,i){e.exec(n,function(n,s){if(n)return i(n);r?e.exec(r,function(e,n){if(e)return i(e);t(n)}):t(s)})})}}return e.exec("PRAGMA optimize = 0x10002"),e},p.prototype.close=function(){return this.db&&this.db.close(),this.db=null,f[this.id]=null,d[this.id]=null,this},p.prototype.destroy=function(){return this.transaction(function(){this.db.run("DROP TABLE IF EXISTS main.map"+this.field+";"),this.db.run("DROP TABLE IF EXISTS main.ctx"+this.field+";"),this.db.run("DROP TABLE IF EXISTS main.tag"+this.field+";"),this.db.run("DROP TABLE IF EXISTS main.cfg"+this.field+";"),this.db.run("DROP TABLE IF EXISTS main.reg;")})},p.prototype.clear=function(){return this.transaction(function(){this.db.run("DELETE FROM main.map"+this.field+" WHERE 1;"),this.db.run("DELETE FROM main.ctx"+this.field+" WHERE 1;"),this.db.run("DELETE FROM main.tag"+this.field+" WHERE 1;"),this.db.run("DELETE FROM main.cfg"+this.field+" WHERE 1;"),this.db.run("DELETE FROM main.reg WHERE 1;")})},p.prototype.get=function(e,t,n=0,r=0,i=!0,s=!1,o){let a,c="",l=t?[t,e]:[e],h="main."+(t?"ctx":"map")+this.field;if(o)for(let e=0;e<o.length;e+=2)c+=` AND ${h}.id IN (SELECT id FROM main.tag_${u(o[e])} WHERE tag = ?)`,l.push(o[e+1]);return a=t?this.promisfy({method:"all",stmt:`\n SELECT ${h}.id \n ${i?"":", res"}\n ${s?", doc":""}\n FROM ${h}\n ${s?`\n LEFT JOIN main.reg ON main.reg.id = ${h}.id\n `:""}\n WHERE ctx = ? AND key = ? ${c}\n ORDER BY res \n ${n?"LIMIT "+n:""}\n ${r?"OFFSET "+r:""}\n `,params:l}):this.promisfy({method:"all",stmt:`\n SELECT ${h}.id\n ${i?"":", res"} \n ${s?", doc":""}\n FROM ${h}\n ${s?`\n LEFT JOIN main.reg ON main.reg.id = ${h}.id\n `:""}\n WHERE key = ? ${c}\n ORDER BY res\n ${n?"LIMIT "+n:""}\n ${r?"OFFSET "+r:""}\n `,params:l}),a.then(function(e){return g(e,i,s)})},p.prototype.tag=function(e,t=0,n=0,r=!1){const i="main.tag"+this.field,s=this.promisfy({method:"all",stmt:`\n SELECT ${i}.id \n ${r?", doc":""}\n FROM ${i}\n ${r?`\n LEFT JOIN main.reg ON main.reg.id = ${i}.id\n `:""}\n WHERE tag = ? \n ${t?"LIMIT "+t:""}\n ${n?"OFFSET "+n:""}\n `,params:[e]});return r||s.then(function(e){return g(e,!0,!1)}),s},p.prototype.enrich=function(e){const t=[],n=[];"object"!=typeof e&&(e=[e]);for(let t=0;t<e.length;){const r=e.length-t>c?e.slice(t,t+c):t?e.slice(t):e,i=m(r.length);t+=r.length,n.push(this.promisfy({method:"all",stmt:`SELECT id, doc FROM main.reg WHERE id IN (${i})`,params:r}))}return Promise.all(n).then(function(e){for(let n,r=0;r<e.length;r++)if(n=e[r],n&&n.length){for(let e,t=0;t<n.length;t++)(e=n[t].doc)&&(n[t].doc=JSON.parse(e));t.push(n)}return 1===t.length?t[0]:t.length>1?o(t):t})},p.prototype.has=function(e){return this.promisfy({method:"get",stmt:"SELECT EXISTS(SELECT 1 FROM main.reg WHERE id = ?) as exist",params:[e]}).then(function(e){return!(!e||!e.exist)})},p.prototype.search=function(e,t,n=100,r=0,i=!1,s=!0,o=!1,a){let c;if(t.length>1&&e.depth){let l,h="",d=[],f=t[0];for(let n=1;n<t.length;n++){l=t[n];const r=e.bidirectional&&l>f;h+=(h?" OR ":"")+"(ctx = ? AND key = ?)",d.push(r?l:f,r?f:l),f=l}if(a){h="("+h+")";for(let e=0;e<a.length;e+=2)h+=` AND id IN (SELECT id FROM main.tag_${u(a[e])} WHERE tag = ?)`,d.push(a[e+1])}c=this.promisfy({method:"all",stmt:`\n SELECT r.id \n ${s?"":", res"}\n ${o?", doc":""}\n FROM (\n SELECT id, count(*) as count,\n SUM(res) as res\n FROM main.ctx${this.field}\n WHERE ${h}\n GROUP BY id\n ) as r\n ${o?"\n LEFT JOIN main.reg ON main.reg.id = r.id\n ":""} \n ${i?"":"WHERE count = "+(t.length-1)}\n ORDER BY ${i?"count DESC, res":"res"}\n ${n?"LIMIT "+n:""}\n ${r?"OFFSET "+r:""}\n `,params:d})}else{let e="",l=t.length;for(let t=0;t<l;t++)e+=(e?" OR ":"")+"key = ?";if(a){e="("+e+")";for(let n=0;n<a.length;n+=2)e+=` AND id IN (SELECT id FROM main.tag_${u(a[n])} WHERE tag = ?)`,t.push(a[n+1])}c=this.promisfy({method:"all",stmt:`\n SELECT r.id \n ${s?"":", res"} \n ${o?", doc":""}\n FROM (\n SELECT id, count(*) as count,\n SUM(res) as res\n FROM main.map${this.field}\n WHERE ${e}\n GROUP BY id\n ) as r\n ${o?"\n LEFT JOIN main.reg ON main.reg.id = r.id\n ":""} \n ${i?"":"WHERE count = "+l}\n ORDER BY ${i?"count DESC, res":"res"}\n ${n?"LIMIT "+n:""}\n ${r?"OFFSET "+r:""}\n `,params:t})}return c.then(function(e){return g(e,s,o)})},p.prototype.info=function(){},p.prototype.transaction=async function(e,t){if(d[this.id])return await e.call(this);const n=this.db,r=this;return d[this.id]=new Promise(function(i,s){n.exec("PRAGMA optimize"),n.exec("PRAGMA busy_timeout = 5000"),n.exec("BEGIN"),n.parallelize(function(){e.call(r)}),n.exec("COMMIT",function(e,o){if(d[r.id]=null,e)return s(e);t&&t(o),i(o),n.exec("PRAGMA shrink_memory")})})},p.prototype.commit=async function(e){let t=e.commit_task,n=[],r=[];e.commit_task=[];for(let e,i=0;i<t.length;i++)e=t[i],void 0!==e.del?n.push(e.del):void 0!==e.ins&&r.push(e.ins);n.length&&await this.remove(n),e.reg.size&&(await this.transaction(function(){for(const t of e.map){const e=t[0],n=t[1];for(let t,r=0;r<n.length;r++)if((t=n[r])&&t.length){let n="",i=[];for(let s=0;s<t.length;s++)n+=(n?",":"")+"(?,?,?)",i.push(e,r,t[s]),(s===t.length-1||i.length+3>c)&&(this.db.run("INSERT INTO main.map"+this.field+" (key, res, id) VALUES "+n,i),n="",i=[])}}for(const t of e.ctx){const e=t[0],n=t[1];for(const t of n){const n=t[0],r=t[1];for(let t,i=0;i<r.length;i++)if((t=r[i])&&t.length){let r="",s=[];for(let o=0;o<t.length;o++)r+=(r?",":"")+"(?,?,?,?)",s.push(e,n,i,t[o]),(o===t.length-1||s.length+4>c)&&(this.db.run("INSERT INTO main.ctx"+this.field+" (ctx, key, res, id) VALUES "+r,s),r="",s=[])}}}if(e.store){let t="",n=[];for(const r of e.store.entries()){const e=r[0],i=r[1];t+=(t?",":"")+"(?,?)",n.push(e,"object"==typeof i?JSON.stringify(i):i||null),n.length+2>c&&(this.db.run("INSERT INTO main.reg (id, doc) VALUES "+t+" ON CONFLICT DO NOTHING",n),t="",n=[])}n.length&&this.db.run("INSERT INTO main.reg (id, doc) VALUES "+t+" ON CONFLICT DO NOTHING",n)}else if(!e.bypass){let t=a(e.reg);for(let e=0;e<t.length;){const n=t.length-e>c?t.slice(e,e+c):e?t.slice(e):t;e+=n.length;const r=m(n.length,!0);this.db.run("INSERT INTO main.reg (id) VALUES "+r+" ON CONFLICT DO NOTHING",n)}}if(e.tag){let t="",n=[];for(const r of e.tag){const e=r[0],i=r[1];if(i.length){for(let r=0;r<i.length;r++)t+=(t?",":"")+"(?,?)",n.push(e,i[r]);n.length+2>c&&(this.db.run("INSERT INTO main.tag"+this.field+" (tag, id) VALUES "+t,n),t="",n=[])}}n.length&&this.db.run("INSERT INTO main.tag"+this.field+" (tag, id) VALUES "+t,n)}}),r.length&&await this.cleanup(),e.map.clear(),e.ctx.clear(),e.tag&&e.tag.clear(),e.store&&e.store.clear(),e.document||e.reg.clear())},p.prototype.remove=function(e){let t;"object"!=typeof e&&(e=[e]),e.length>c&&(t=e.slice(c),e=e.slice(0,c));const n=this;return this.transaction(function(){const t=m(e.length);this.db.run("DELETE FROM main.map"+n.field+" WHERE id IN ("+t+")",e),this.db.run("DELETE FROM main.ctx"+n.field+" WHERE id IN ("+t+")",e),this.db.run("DELETE FROM main.tag"+n.field+" WHERE id IN ("+t+")",e),this.db.run("DELETE FROM main.reg WHERE id IN ("+t+")",e)}).then(function(e){return t?n.remove(t):e})},p.prototype.cleanup=function(){return this.transaction(function(){this.db.run("DELETE FROM main.map"+this.field+" WHERE ROWID IN (SELECT ROWID FROM (SELECT ROWID, row_number() OVER dupes AS count FROM main.map"+this.field+" _t WINDOW dupes AS (PARTITION BY id, key ORDER BY res) ) WHERE count > 1)"),this.db.run("DELETE FROM main.ctx"+this.field+" WHERE ROWID IN (SELECT ROWID FROM (SELECT ROWID, row_number() OVER dupes AS count FROM main.ctx"+this.field+" _t WINDOW dupes AS (PARTITION BY id, ctx, key ORDER BY res) ) WHERE count > 1)")})},p.prototype.promisfy=function(e){const t=this.db;return new Promise(function(n,r){t[e.method](e.stmt,e.params||[],function(t,i){e.callback&&e.callback(i),t?r(t):n(i)})})}},948(e,t,n){const r=n(6928),i=n(6744),s=n(4434).EventEmitter;function o(e){return function(t,...n){let r;if("function"==typeof n[n.length-1]){const e=n[n.length-1];r=function(t){t&&e(t)}}const s=new i.Statement(this,t,r);return e.call(this,s,n)}}e.exports=i;const a=i.Database;i.cached={objects:{},Database:function(e,t,n){if(""===e||":memory:"===e)return new a(e,t,n);if(e=r.resolve(e),i.cached.objects[e]){const o=i.cached.objects[e],c="number"==typeof t?n:t;if("function"==typeof c){function s(){c.call(o,null)}o.open?process.nextTick(s):o.once("open",s)}}else i.cached.objects[e]=new a(e,t,n);return i.cached.objects[e]}},function(e,t){for(const n in t.prototype)e.prototype[n]=t.prototype[n]}(a,s),a.prototype.prepare=o(function(e,t){return t.length?e.bind.apply(e,t):e}),a.prototype.run=o(function(e,t){return e.run.apply(e,t).finalize(),this}),a.prototype.get=o(function(e,t){return e.get.apply(e,t).finalize(),this}),a.prototype.all=o(function(e,t){return e.all.apply(e,t).finalize(),this}),a.prototype.each=o(function(e,t){return e.each.apply(e,t).finalize(),this}),a.prototype.map=o(function(e,t){return e.map.apply(e,t).finalize(),this});const c=["trace","profile","change"];a.prototype.addListener=a.prototype.on=function(e,t){const n=s.prototype.addListener.apply(this,arguments);return c.indexOf(e)>=0&&this.configure(e,!0),n},a.prototype.removeListener=function(e){const t=s.prototype.removeListener.apply(this,arguments);return c.indexOf(e)>=0&&!this._events[e]&&this.configure(e,!1),t},a.prototype.removeAllListeners=function(e){const t=s.prototype.removeAllListeners.apply(this,arguments);return c.indexOf(e)>=0&&this.configure(e,!1),t}},3285(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.file_search_start=function(){(0,r.register_threads_worker_handler)(i.threads_msg_type.file_search,async e=>{const{start:t,end:n,file_path:l,query_text_buffer:h,ram_id:u}=e.data;let d=0,f=Buffer.alloc(0);const p=s.openSync(l,"r");let g=0;for(;d<n&&!c[u];){const e=Buffer.alloc(2097152);let t=s.readSync(p,e,0,e.length,d);if(0===t)break;d+=t,f=Buffer.concat([f,e.subarray(0,t)]),(0,r.threads_send)({type:i.threads_msg_type.search_file_progress,data:{progress:(100*d/n).toFixed(0),ram_id:u}});const c=[];if(a(f,h,c),c.length>0){for(let e=0;e<c.length;e++)c[e]+=g;(0,r.threads_send)({type:i.threads_msg_type.search_file_index,data:{find_index:c,ram_id:u}})}g+=f.length-h.length,f=o(f,f.length-h.length,f.length)}return(0,r.threads_send)({type:i.threads_msg_type.search_file_end,data:{ram_id:u}}),s.closeSync(p),"ok"}),(0,r.register_threads_worker_handler)(i.threads_msg_type.file_search_close,async e=>{const{ram_id:t}=e.data;return c[t]=!0,"ok"}),(0,r.register_threads_worker_handler)(i.threads_msg_type.file_search_start,async e=>{const{ram_id:t}=e.data;return delete c[t],"ok"})};const r=n(324),i=n(7525),s=n(9896);function o(e,t,n){const r=n-t,i=Buffer.alloc(r);return e.copy(i,0,t,n),i}function a(e,t,n){const r=function(e){const t={},n=e.length;for(let r=0;r<n;r++)t[e[r]]=r;return t}(t),i=e.length,s=t.length,o=i-s;let a=0;for(;a<=o;){let o=s-1;for(;o>=0&&e[a+o]===t[o];)o--;if(o<0)n.push(a),a+=a+s<i?s-r[e[a+s]]||s:1;else{const t=r[e[a+o]],n=void 0!==t?o-t:o+1;a+=Math.max(n,1)}}}const c={}},8551(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.start_sys_worker=function(){(0,r.register_threads_worker_handler)(i.threads_msg_type.sys_info,async e=>{(0,r.threads_send)({type:i.threads_msg_type.sys_info_send,data:{node_memory_usage:process.memoryUsage()}})})};const r=n(324),i=n(7525)},7525(e,t){"use strict";var n;Object.defineProperty(t,"__esModule",{value:!0}),t.threads_msg_type=void 0,function(e){e[e.hello=1]="hello",e[e.file_search_start=2]="file_search_start",e[e.file_search=3]="file_search",e[e.file_search_close=4]="file_search_close",e[e.search_file_index=5]="search_file_index",e[e.search_file_progress=6]="search_file_progress",e[e.search_file_end=7]="search_file_end",e[e.docs_init=8]="docs_init",e[e.docs_add=9]="docs_add",e[e.docs_del=10]="docs_del",e[e.docs_close=11]="docs_close",e[e.docs_search=12]="docs_search",e[e.sys_info=13]="sys_info",e[e.sys_info_send=14]="sys_info_send"}(n||(t.threads_msg_type=n={}))},324(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.register_threads_worker_handler=o,t.threads_send=a;const r=n(8167),i=n(7525);console.log("[worker] 子线程启动, workerData=",r.workerData);const s=new Map;function o(e,t){s.set(e,t)}function a(e){try{r.parentPort?.postMessage(e)}catch(e){console.error("[worker] send failed:",e)}}r.parentPort?.on("message",e=>{!async function(e){try{const t=s.get(e.type);if(!t)return void a({id:e.id,type:e.type,data:`unknown type ${e.type}`});const n=await t(e);a({id:e.id,type:e.type,data:n})}catch(t){a({id:e.id,type:e.type,data:null,error:t?.message||String(t)}),console.error("[worker] task error:",t)}}(e)}),o(i.threads_msg_type.hello,async e=>new Promise((t,n)=>setTimeout(()=>{if(Math.random()<.05)return n(new Error("模拟错误"));t(`done:${e.data}`)},500))),console.log("[worker] ready and waiting for messages..."),process.on("uncaughtException",e=>{console.error("子线程全局未捕获异常:",e)}),process.on("unhandledRejection",e=>{console.error("子线程未处理的 Promise 拒绝:",e)})},3065(e,t,n){"use strict";const r=n(6928),i=e=>new l(e);function s(e){return Array.isArray(e)?e:[e]}i.default=i,e.exports=i;const o="\\"===r.sep?/(?<=.)\\$/:/(?<=.)\/$/,a="undefined"!=typeof Symbol?Symbol.for("dockerignore"):"dockerignore";function c(e){return r.normalize(e).replace(o,"")}class l{constructor({ignorecase:e=!0}={}){this._rules=[],this._ignorecase=e,this[a]=!0,this._initCache()}_initCache(){this._cache={}}add(e){return this._added=!1,"string"==typeof e&&(e=e.split(/\r?\n/g)),s(e).forEach(this._addPattern,this),this._added&&this._initCache(),this}addPattern(e){return this.add(e)}_addPattern(e){if(e&&e[a])return this._rules=this._rules.concat(e._rules),void(this._added=!0);if(this._checkPattern(e)){const t=this._createRule(e.trim());null!==t&&(this._added=!0,this._rules.push(t))}}_checkPattern(e){return e&&"string"==typeof e&&0!==e.indexOf("#")&&""!==e.trim()}filter(e){return s(e).filter(e=>this._filter(e))}createFilter(){return e=>this._filter(e)}ignores(e){return!this._filter(e)}_createRule(e){const t=e;let n=!1;var i;if("!"===e[0]&&(n=!0,e=e.substring(1).trim()),e.length>0&&(e=c(e),i=e,(e="/"===r.sep?i:i.replace(/\\/g,"/")).length>1&&"/"===e[0]&&(e=e.slice(1))),n&&(e="!"+e),""===(e=e.trim()))return null;if("!"===(e=c(e))[0]){if(1===e.length)return null;n=!0,e=e.substring(1)}else n=!1;return{origin:t,pattern:e,dirs:e.split(r.sep),negative:n}}_filter(e){return!!e&&(e in this._cache?this._cache[e]:this._cache[e]=this._test(e))}_test(e){e=function(e){return"/"===r.sep?e:e.replace(/\//g,r.sep)}(e);const t=c(r.dirname(e)),n=t.split(r.sep);let i=!1;return this._rules.forEach(s=>{let o=this._match(e,s);if(!o&&"."!==t)if(s.dirs.includes("**"))for(let e=s.dirs.filter(e=>"**"!==e).length;e<=n.length;e++)o=o||this._match(n.slice(0,e).join(r.sep),s);else s.dirs.length<=n.length&&(o=this._match(n.slice(0,s.dirs.length).join(r.sep),s));o&&(i=!s.negative)}),!i}_match(e,t){return this._compile(t).regexp.test(e)}_compile(e){if(e.regexp)return e;let t="^",n="\\"===r.sep?"\\\\":r.sep;for(let i=0;i<e.pattern.length;i++){const s=e.pattern[i];if("*"===s)"*"===e.pattern[i+1]?(i++,e.pattern[i+1]===r.sep&&i++,void 0===e.pattern[i+1]?t+=".*":t+=`(.*${n})?`):t+=`[^${n}]*`;else if("?"===s)t+=`[^${n}]`;else if("."===s||"$"===s)t+=`\\${s}`;else if("\\"===s){if("\\"===r.sep){t+=n;continue}void 0!==e.pattern[i+1]?(t+="\\"+e.pattern[i+1],i++):t+="\\"}else t+=s}return t+="$",e.regexp=new RegExp(t,this._ignorecase?"i":""),e}}},2661(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.registerAdminService=function(e,t){n.push({getServiceDefinition:e,getHandlers:t})},t.addAdminServicesToServer=function(e){for(const{getServiceDefinition:t,getHandlers:r}of n)e.addService(t(),r())};const n=[]},3956(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.BackoffTimeout=void 0;const r=n(131),i=n(267);class s{constructor(e,t){this.callback=e,this.initialDelay=1e3,this.multiplier=1.6,this.maxDelay=12e4,this.jitter=.2,this.running=!1,this.hasRef=!0,this.startTime=new Date,this.endTime=new Date,this.id=s.getNextId(),t&&(t.initialDelay&&(this.initialDelay=t.initialDelay),t.multiplier&&(this.multiplier=t.multiplier),t.jitter&&(this.jitter=t.jitter),t.maxDelay&&(this.maxDelay=t.maxDelay)),this.trace("constructed initialDelay="+this.initialDelay+" multiplier="+this.multiplier+" jitter="+this.jitter+" maxDelay="+this.maxDelay),this.nextDelay=this.initialDelay,this.timerId=setTimeout(()=>{},0),clearTimeout(this.timerId)}static getNextId(){return this.nextId++}trace(e){i.trace(r.LogVerbosity.DEBUG,"backoff","{"+this.id+"} "+e)}runTimer(e){var t,n;this.trace("runTimer(delay="+e+")"),this.endTime=this.startTime,this.endTime.setMilliseconds(this.endTime.getMilliseconds()+e),clearTimeout(this.timerId),this.timerId=setTimeout(()=>{this.trace("timer fired"),this.running=!1,this.callback()},e),this.hasRef||null===(n=(t=this.timerId).unref)||void 0===n||n.call(t)}runOnce(){this.trace("runOnce()"),this.running=!0,this.startTime=new Date,this.runTimer(this.nextDelay);const e=Math.min(this.nextDelay*this.multiplier,this.maxDelay),t=e*this.jitter;var n,r;this.nextDelay=e+(n=-t,r=t,Math.random()*(r-n)+n)}stop(){this.trace("stop()"),clearTimeout(this.timerId),this.running=!1}reset(){if(this.trace("reset() running="+this.running),this.nextDelay=this.initialDelay,this.running){const e=new Date,t=this.startTime;t.setMilliseconds(t.getMilliseconds()+this.nextDelay),clearTimeout(this.timerId),e<t?this.runTimer(t.getTime()-e.getTime()):this.running=!1}}isRunning(){return this.running}ref(){var e,t;this.hasRef=!0,null===(t=(e=this.timerId).ref)||void 0===t||t.call(e)}unref(){var e,t;this.hasRef=!1,null===(t=(e=this.timerId).unref)||void 0===t||t.call(e)}getEndTime(){return this.endTime}}t.BackoffTimeout=s,s.nextId=0},2267(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.CallCredentials=void 0;const r=n(4097);class i{static createFromMetadataGenerator(e){return new o(e)}static createFromGoogleCredential(e){return i.createFromMetadataGenerator((t,n)=>{let i;var s;i="getRequestHeaders"in(s=e)&&"function"==typeof s.getRequestHeaders?e.getRequestHeaders(t.service_url):new Promise((n,r)=>{e.getRequestMetadata(t.service_url,(e,t)=>{e?r(e):t?n(t):r(new Error("Headers not set by metadata plugin"))})}),i.then(e=>{const t=new r.Metadata;for(const n of Object.keys(e))t.add(n,e[n]);n(null,t)},e=>{n(e)})})}static createEmpty(){return new a}}t.CallCredentials=i;class s extends i{constructor(e){super(),this.creds=e}async generateMetadata(e){const t=new r.Metadata,n=await Promise.all(this.creds.map(t=>t.generateMetadata(e)));for(const e of n)t.merge(e);return t}compose(e){return new s(this.creds.concat([e]))}_equals(e){return this===e||e instanceof s&&this.creds.every((t,n)=>t._equals(e.creds[n]))}}class o extends i{constructor(e){super(),this.metadataGenerator=e}generateMetadata(e){return new Promise((t,n)=>{this.metadataGenerator(e,(e,r)=>{void 0!==r?t(r):n(e)})})}compose(e){return new s([this,e])}_equals(e){return this===e||e instanceof o&&this.metadataGenerator===e.metadataGenerator}}class a extends i{generateMetadata(e){return Promise.resolve(new r.Metadata)}compose(e){return e}_equals(e){return e instanceof a}}},5034(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.InterceptingListenerImpl=void 0,t.statusOrFromValue=function(e){return{ok:!0,value:e}},t.statusOrFromError=function(e){var t;return{ok:!1,error:Object.assign(Object.assign({},e),{metadata:null!==(t=e.metadata)&&void 0!==t?t:new r.Metadata})}},t.isInterceptingListener=function(e){return void 0!==e.onReceiveMetadata&&1===e.onReceiveMetadata.length};const r=n(4097);t.InterceptingListenerImpl=class{constructor(e,t){this.listener=e,this.nextListener=t,this.processingMetadata=!1,this.hasPendingMessage=!1,this.processingMessage=!1,this.pendingStatus=null}processPendingMessage(){this.hasPendingMessage&&(this.nextListener.onReceiveMessage(this.pendingMessage),this.pendingMessage=null,this.hasPendingMessage=!1)}processPendingStatus(){this.pendingStatus&&this.nextListener.onReceiveStatus(this.pendingStatus)}onReceiveMetadata(e){this.processingMetadata=!0,this.listener.onReceiveMetadata(e,e=>{this.processingMetadata=!1,this.nextListener.onReceiveMetadata(e),this.processPendingMessage(),this.processPendingStatus()})}onReceiveMessage(e){this.processingMessage=!0,this.listener.onReceiveMessage(e,e=>{this.processingMessage=!1,this.processingMetadata?(this.pendingMessage=e,this.hasPendingMessage=!0):(this.nextListener.onReceiveMessage(e),this.processPendingStatus())})}onReceiveStatus(e){this.listener.onReceiveStatus(e,e=>{this.processingMetadata||this.processingMessage?this.pendingStatus=e:this.nextListener.onReceiveStatus(e)})}}},5572(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.getNextCallNumber=function(){return n++};let n=0},1544(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ClientDuplexStreamImpl=t.ClientWritableStreamImpl=t.ClientReadableStreamImpl=t.ClientUnaryCallImpl=void 0,t.callErrorFromStatus=function(e,t){const n=`${e.code} ${s.Status[e.code]}: ${e.details}`,r=`${new Error(n).stack}\nfor call at\n${t}`;return Object.assign(new Error(n),e,{stack:r})};const r=n(4434),i=n(2203),s=n(131);class o extends r.EventEmitter{constructor(){super()}cancel(){var e;null===(e=this.call)||void 0===e||e.cancelWithStatus(s.Status.CANCELLED,"Cancelled on client")}getPeer(){var e,t;return null!==(t=null===(e=this.call)||void 0===e?void 0:e.getPeer())&&void 0!==t?t:"unknown"}getAuthContext(){var e,t;return null!==(t=null===(e=this.call)||void 0===e?void 0:e.getAuthContext())&&void 0!==t?t:null}}t.ClientUnaryCallImpl=o;class a extends i.Readable{constructor(e){super({objectMode:!0}),this.deserialize=e}cancel(){var e;null===(e=this.call)||void 0===e||e.cancelWithStatus(s.Status.CANCELLED,"Cancelled on client")}getPeer(){var e,t;return null!==(t=null===(e=this.call)||void 0===e?void 0:e.getPeer())&&void 0!==t?t:"unknown"}getAuthContext(){var e,t;return null!==(t=null===(e=this.call)||void 0===e?void 0:e.getAuthContext())&&void 0!==t?t:null}_read(e){var t;null===(t=this.call)||void 0===t||t.startRead()}}t.ClientReadableStreamImpl=a;class c extends i.Writable{constructor(e){super({objectMode:!0}),this.serialize=e}cancel(){var e;null===(e=this.call)||void 0===e||e.cancelWithStatus(s.Status.CANCELLED,"Cancelled on client")}getPeer(){var e,t;return null!==(t=null===(e=this.call)||void 0===e?void 0:e.getPeer())&&void 0!==t?t:"unknown"}getAuthContext(){var e,t;return null!==(t=null===(e=this.call)||void 0===e?void 0:e.getAuthContext())&&void 0!==t?t:null}_write(e,t,n){var r;const i={callback:n},s=Number(t);Number.isNaN(s)||(i.flags=s),null===(r=this.call)||void 0===r||r.sendMessageWithContext(i,e)}_final(e){var t;null===(t=this.call)||void 0===t||t.halfClose(),e()}}t.ClientWritableStreamImpl=c;class l extends i.Duplex{constructor(e,t){super({objectMode:!0}),this.serialize=e,this.deserialize=t}cancel(){var e;null===(e=this.call)||void 0===e||e.cancelWithStatus(s.Status.CANCELLED,"Cancelled on client")}getPeer(){var e,t;return null!==(t=null===(e=this.call)||void 0===e?void 0:e.getPeer())&&void 0!==t?t:"unknown"}getAuthContext(){var e,t;return null!==(t=null===(e=this.call)||void 0===e?void 0:e.getAuthContext())&&void 0!==t?t:null}_read(e){var t;null===(t=this.call)||void 0===t||t.startRead()}_write(e,t,n){var r;const i={callback:n},s=Number(t);Number.isNaN(s)||(i.flags=s),null===(r=this.call)||void 0===r||r.sendMessageWithContext(i,e)}_final(e){var t;null===(t=this.call)||void 0===t||t.halfClose(),e()}}t.ClientDuplexStreamImpl=l},5819(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.FileWatcherCertificateProvider=void 0;const r=n(9896),i=n(267),s=n(131),o=n(9023);function a(e){i.trace(s.LogVerbosity.DEBUG,"certificate_provider",e)}const c=(0,o.promisify)(r.readFile);t.FileWatcherCertificateProvider=class{constructor(e){if(this.config=e,this.refreshTimer=null,this.fileResultPromise=null,this.latestCaUpdate=void 0,this.caListeners=new Set,this.latestIdentityUpdate=void 0,this.identityListeners=new Set,this.lastUpdateTime=null,void 0===e.certificateFile!=(void 0===e.privateKeyFile))throw new Error("certificateFile and privateKeyFile must be set or unset together");if(void 0===e.certificateFile&&void 0===e.caCertificateFile)throw new Error("At least one of certificateFile and caCertificateFile must be set");a("File watcher constructed with config "+JSON.stringify(e))}updateCertificates(){this.fileResultPromise||(this.fileResultPromise=Promise.allSettled([this.config.certificateFile?c(this.config.certificateFile):Promise.reject(),this.config.privateKeyFile?c(this.config.privateKeyFile):Promise.reject(),this.config.caCertificateFile?c(this.config.caCertificateFile):Promise.reject()]),this.fileResultPromise.then(([e,t,n])=>{if(this.refreshTimer){a("File watcher read certificates certificate "+e.status+", privateKey "+t.status+", CA certificate "+n.status),this.lastUpdateTime=new Date,this.fileResultPromise=null,"fulfilled"===e.status&&"fulfilled"===t.status?this.latestIdentityUpdate={certificate:e.value,privateKey:t.value}:this.latestIdentityUpdate=null,"fulfilled"===n.status?this.latestCaUpdate={caCertificate:n.value}:this.latestCaUpdate=null;for(const e of this.identityListeners)e(this.latestIdentityUpdate);for(const e of this.caListeners)e(this.latestCaUpdate)}}),a("File watcher initiated certificate update"))}maybeStartWatchingFiles(){if(!this.refreshTimer){const e=this.lastUpdateTime?(new Date).getTime()-this.lastUpdateTime.getTime():1/0;e>this.config.refreshIntervalMs&&this.updateCertificates(),e>2*this.config.refreshIntervalMs&&(this.latestCaUpdate=void 0,this.latestIdentityUpdate=void 0),this.refreshTimer=setInterval(()=>this.updateCertificates(),this.config.refreshIntervalMs),a("File watcher started watching")}}maybeStopWatchingFiles(){0===this.caListeners.size&&0===this.identityListeners.size&&(this.fileResultPromise=null,this.refreshTimer&&(clearInterval(this.refreshTimer),this.refreshTimer=null))}addCaCertificateListener(e){this.caListeners.add(e),this.maybeStartWatchingFiles(),void 0!==this.latestCaUpdate&&process.nextTick(e,this.latestCaUpdate)}removeCaCertificateListener(e){this.caListeners.delete(e),this.maybeStopWatchingFiles()}addIdentityCertificateListener(e){this.identityListeners.add(e),this.maybeStartWatchingFiles(),void 0!==this.latestIdentityUpdate&&process.nextTick(e,this.latestIdentityUpdate)}removeIdentityCertificateListener(e){this.identityListeners.delete(e),this.maybeStopWatchingFiles()}}},7434(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ChannelCredentials=void 0,t.createCertificateProviderChannelCredentials=function(e,t,n){return new m(e,t,null!=n?n:{})};const r=n(4756),i=n(2267),s=n(9167),o=n(3822),a=n(9302),c=n(267),l=n(131);function h(e,t){if(e&&!(e instanceof Buffer))throw new TypeError(`${t}, if provided, must be a Buffer.`)}class u{compose(e){return new _(this,e)}static createSsl(e,t,n,i){var o;if(h(e,"Root certificate"),h(t,"Private key"),h(n,"Certificate chain"),t&&!n)throw new Error("Private key must be given with accompanying certificate chain");if(!t&&n)throw new Error("Certificate chain must be given with accompanying private key");const a=(0,r.createSecureContext)({ca:null!==(o=null!=e?e:(0,s.getDefaultRootsData)())&&void 0!==o?o:void 0,key:null!=t?t:void 0,cert:null!=n?n:void 0,ciphers:s.CIPHER_SUITES});return new g(a,null!=i?i:{})}static createFromSecureContext(e,t){return new g(e,null!=t?t:{})}static createInsecure(){return new d}}t.ChannelCredentials=u;class d extends u{constructor(){super()}compose(e){throw new Error("Cannot compose insecure credentials")}_isSecure(){return!1}_equals(e){return e instanceof d}_createSecureConnector(e,t,n){return{connect:e=>Promise.resolve({socket:e,secure:!1}),waitForReady:()=>Promise.resolve(),getCallCredentials:()=>null!=n?n:i.CallCredentials.createEmpty(),destroy(){}}}}function f(e,t,n,i){var s,c;const l={secureContext:e};let h=n;if("grpc.http_connect_target"in i){const e=(0,o.parseUri)(i["grpc.http_connect_target"]);e&&(h=e)}const u=(0,a.getDefaultAuthority)(h),d=(0,o.splitHostPort)(u),f=null!==(s=null==d?void 0:d.host)&&void 0!==s?s:u;if(l.host=f,t.checkServerIdentity&&(l.checkServerIdentity=t.checkServerIdentity),void 0!==t.rejectUnauthorized&&(l.rejectUnauthorized=t.rejectUnauthorized),l.ALPNProtocols=["h2"],i["grpc.ssl_target_name_override"]){const e=i["grpc.ssl_target_name_override"],t=null!==(c=l.checkServerIdentity)&&void 0!==c?c:r.checkServerIdentity;l.checkServerIdentity=(n,r)=>t(e,r),l.servername=e}else l.servername=f;return i["grpc-node.tls_enable_trace"]&&(l.enableTrace=!0),l}class p{constructor(e,t){this.connectionOptions=e,this.callCredentials=t}connect(e){const t=Object.assign({socket:e},this.connectionOptions);return new Promise((e,n)=>{const i=(0,r.connect)(t,()=>{var t;null!==(t=this.connectionOptions.rejectUnauthorized)&&void 0!==t&&!t||i.authorized?e({socket:i,secure:!0}):n(i.authorizationError)});i.on("error",e=>{n(e)})})}waitForReady(){return Promise.resolve()}getCallCredentials(){return this.callCredentials}destroy(){}}class g extends u{constructor(e,t){super(),this.secureContext=e,this.verifyOptions=t}_isSecure(){return!0}_equals(e){return this===e||e instanceof g&&(this.secureContext===e.secureContext&&this.verifyOptions.checkServerIdentity===e.verifyOptions.checkServerIdentity)}_createSecureConnector(e,t,n){const r=f(this.secureContext,this.verifyOptions,e,t);return new p(r,null!=n?n:i.CallCredentials.createEmpty())}}class m extends u{constructor(e,t,n){super(),this.caCertificateProvider=e,this.identityCertificateProvider=t,this.verifyOptions=n,this.refcount=0,this.latestCaUpdate=void 0,this.latestIdentityUpdate=void 0,this.caCertificateUpdateListener=this.handleCaCertificateUpdate.bind(this),this.identityCertificateUpdateListener=this.handleIdentityCertitificateUpdate.bind(this),this.secureContextWatchers=[]}_isSecure(){return!0}_equals(e){var t,n;return this===e||e instanceof m&&(this.caCertificateProvider===e.caCertificateProvider&&this.identityCertificateProvider===e.identityCertificateProvider&&(null===(t=this.verifyOptions)||void 0===t?void 0:t.checkServerIdentity)===(null===(n=e.verifyOptions)||void 0===n?void 0:n.checkServerIdentity))}ref(){var e;0===this.refcount&&(this.caCertificateProvider.addCaCertificateListener(this.caCertificateUpdateListener),null===(e=this.identityCertificateProvider)||void 0===e||e.addIdentityCertificateListener(this.identityCertificateUpdateListener)),this.refcount+=1}unref(){var e;this.refcount-=1,0===this.refcount&&(this.caCertificateProvider.removeCaCertificateListener(this.caCertificateUpdateListener),null===(e=this.identityCertificateProvider)||void 0===e||e.removeIdentityCertificateListener(this.identityCertificateUpdateListener))}_createSecureConnector(e,t,n){return this.ref(),new m.SecureConnectorImpl(this,e,t,null!=n?n:i.CallCredentials.createEmpty())}maybeUpdateWatchers(){if(this.hasReceivedUpdates()){for(const e of this.secureContextWatchers)e(this.getLatestSecureContext());this.secureContextWatchers=[]}}handleCaCertificateUpdate(e){this.latestCaUpdate=e,this.maybeUpdateWatchers()}handleIdentityCertitificateUpdate(e){this.latestIdentityUpdate=e,this.maybeUpdateWatchers()}hasReceivedUpdates(){return void 0!==this.latestCaUpdate&&(!this.identityCertificateProvider||void 0!==this.latestIdentityUpdate)}getSecureContext(){return this.hasReceivedUpdates()?Promise.resolve(this.getLatestSecureContext()):new Promise(e=>{this.secureContextWatchers.push(e)})}getLatestSecureContext(){var e,t;if(!this.latestCaUpdate)return null;if(null!==this.identityCertificateProvider&&!this.latestIdentityUpdate)return null;try{return(0,r.createSecureContext)({ca:this.latestCaUpdate.caCertificate,key:null===(e=this.latestIdentityUpdate)||void 0===e?void 0:e.privateKey,cert:null===(t=this.latestIdentityUpdate)||void 0===t?void 0:t.certificate,ciphers:s.CIPHER_SUITES})}catch(e){return(0,c.log)(l.LogVerbosity.ERROR,"Failed to createSecureContext with error "+e.message),null}}}m.SecureConnectorImpl=class{constructor(e,t,n,r){this.parent=e,this.channelTarget=t,this.options=n,this.callCredentials=r}connect(e){return new Promise((t,n)=>{const i=this.parent.getLatestSecureContext();if(!i)return void n(new Error("Failed to load credentials"));e.closed&&n(new Error("Socket closed while loading credentials"));const s=f(i,this.parent.verifyOptions,this.channelTarget,this.options),o=Object.assign({socket:e},s),a=()=>{n(new Error("Socket closed"))},c=e=>{n(e)},l=(0,r.connect)(o,()=>{var e;l.removeListener("close",a),l.removeListener("error",c),null!==(e=this.parent.verifyOptions.rejectUnauthorized)&&void 0!==e&&!e||l.authorized?t({socket:l,secure:!0}):n(l.authorizationError)});l.once("close",a),l.once("error",c)})}async waitForReady(){await this.parent.getSecureContext()}getCallCredentials(){return this.callCredentials}destroy(){this.parent.unref()}};class _ extends u{constructor(e,t){if(super(),this.channelCredentials=e,this.callCredentials=t,!e._isSecure())throw new Error("Cannot compose insecure credentials")}compose(e){const t=this.callCredentials.compose(e);return new _(this.channelCredentials,t)}_isSecure(){return!0}_equals(e){return this===e||e instanceof _&&(this.channelCredentials._equals(e.channelCredentials)&&this.callCredentials._equals(e.callCredentials))}_createSecureConnector(e,t,n){const r=this.callCredentials.compose(null!=n?n:i.CallCredentials.createEmpty());return this.channelCredentials._createSecureConnector(e,t,r)}}},6998(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.recognizedOptions=void 0,t.channelOptionsEqual=function(e,t){const n=Object.keys(e).sort(),r=Object.keys(t).sort();if(n.length!==r.length)return!1;for(let i=0;i<n.length;i+=1){if(n[i]!==r[i])return!1;if(e[n[i]]!==t[r[i]])return!1}return!0},t.recognizedOptions={"grpc.ssl_target_name_override":!0,"grpc.primary_user_agent":!0,"grpc.secondary_user_agent":!0,"grpc.default_authority":!0,"grpc.keepalive_time_ms":!0,"grpc.keepalive_timeout_ms":!0,"grpc.keepalive_permit_without_calls":!0,"grpc.service_config":!0,"grpc.max_concurrent_streams":!0,"grpc.initial_reconnect_backoff_ms":!0,"grpc.max_reconnect_backoff_ms":!0,"grpc.use_local_subchannel_pool":!0,"grpc.max_send_message_length":!0,"grpc.max_receive_message_length":!0,"grpc.enable_http_proxy":!0,"grpc.enable_channelz":!0,"grpc.dns_min_time_between_resolutions_ms":!0,"grpc.enable_retries":!0,"grpc.per_rpc_retry_buffer_size":!0,"grpc.retry_buffer_size":!0,"grpc.max_connection_age_ms":!0,"grpc.max_connection_age_grace_ms":!0,"grpc-node.max_session_memory":!0,"grpc.service_config_disable_resolution":!0,"grpc.client_idle_timeout_ms":!0,"grpc-node.tls_enable_trace":!0,"grpc.lb.ring_hash.ring_size_cap":!0,"grpc-node.retry_max_attempts_limit":!0,"grpc-node.flow_control_window":!0,"grpc.server_call_metric_recording":!0}},3653(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ChannelImplementation=void 0;const r=n(7434),i=n(8899);t.ChannelImplementation=class{constructor(e,t,n){if("string"!=typeof e)throw new TypeError("Channel target must be a string");if(!(t instanceof r.ChannelCredentials))throw new TypeError("Channel credentials must be a ChannelCredentials object");if(n&&"object"!=typeof n)throw new TypeError("Channel options must be an object");this.internalChannel=new i.InternalChannel(e,t,n)}close(){this.internalChannel.close()}getTarget(){return this.internalChannel.getTarget()}getConnectivityState(e){return this.internalChannel.getConnectivityState(e)}watchConnectivityState(e,t,n){this.internalChannel.watchConnectivityState(e,t,n)}getChannelzRef(){return this.internalChannel.getChannelzRef()}createCall(e,t,n,r,i){if("string"!=typeof e)throw new TypeError("Channel#createCall: method must be a string");if(!("number"==typeof t||t instanceof Date))throw new TypeError("Channel#createCall: deadline must be a number or Date");return this.internalChannel.createCall(e,t,n,r,i)}}},9503(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.registerChannelzSocket=t.registerChannelzServer=t.registerChannelzSubchannel=t.registerChannelzChannel=t.ChannelzCallTrackerStub=t.ChannelzCallTracker=t.ChannelzChildrenTrackerStub=t.ChannelzChildrenTracker=t.ChannelzTrace=t.ChannelzTraceStub=void 0,t.unregisterChannelzRef=function(e){g[e.kind].eraseElementByKey(e.id)},t.getChannelzHandlers=P,t.getChannelzServiceDefinition=L,t.setup=function(){(0,c.registerAdminService)(L,P)};const r=n(9278),i=n(6787),s=n(463),o=n(131),a=n(8996),c=n(2661),l=n(4056);function h(e){return{channel_id:e.id,name:e.name}}function u(e){return{subchannel_id:e.id,name:e.name}}function d(e){return{socket_id:e.id,name:e.name}}t.ChannelzTraceStub=class{constructor(){this.events=[],this.creationTimestamp=new Date,this.eventsLogged=0}addTrace(){}getTraceMessage(){return{creation_timestamp:E(this.creationTimestamp),num_events_logged:this.eventsLogged,events:[]}}};t.ChannelzTrace=class{constructor(){this.events=[],this.eventsLogged=0,this.creationTimestamp=new Date}addTrace(e,t,n){const r=new Date;this.events.push({description:t,severity:e,timestamp:r,childChannel:"channel"===(null==n?void 0:n.kind)?n:void 0,childSubchannel:"subchannel"===(null==n?void 0:n.kind)?n:void 0}),this.events.length>=64&&(this.events=this.events.slice(32)),this.eventsLogged+=1}getTraceMessage(){return{creation_timestamp:E(this.creationTimestamp),num_events_logged:this.eventsLogged,events:this.events.map(e=>({description:e.description,severity:e.severity,timestamp:E(e.timestamp),channel_ref:e.childChannel?h(e.childChannel):null,subchannel_ref:e.childSubchannel?u(e.childSubchannel):null}))}}};class f{constructor(){this.channelChildren=new i.OrderedMap,this.subchannelChildren=new i.OrderedMap,this.socketChildren=new i.OrderedMap,this.trackerMap={channel:this.channelChildren,subchannel:this.subchannelChildren,socket:this.socketChildren}}refChild(e){const t=this.trackerMap[e.kind],n=t.find(e.id);n.equals(t.end())?t.setElement(e.id,{ref:e,count:1},n):n.pointer[1].count+=1}unrefChild(e){const t=this.trackerMap[e.kind],n=t.getElementByKey(e.id);void 0!==n&&(n.count-=1,0===n.count&&t.eraseElementByKey(e.id))}getChildLists(){return{channels:this.channelChildren,subchannels:this.subchannelChildren,sockets:this.socketChildren}}}t.ChannelzChildrenTracker=f;t.ChannelzChildrenTrackerStub=class extends f{refChild(){}unrefChild(){}};class p{constructor(){this.callsStarted=0,this.callsSucceeded=0,this.callsFailed=0,this.lastCallStartedTimestamp=null}addCallStarted(){this.callsStarted+=1,this.lastCallStartedTimestamp=new Date}addCallSucceeded(){this.callsSucceeded+=1}addCallFailed(){this.callsFailed+=1}}t.ChannelzCallTracker=p;t.ChannelzCallTrackerStub=class extends p{addCallStarted(){}addCallSucceeded(){}addCallFailed(){}};const g={channel:new i.OrderedMap,subchannel:new i.OrderedMap,server:new i.OrderedMap,socket:new i.OrderedMap},m=e=>{let t=1;const n=g[e];return(r,i,s)=>{const o=t++,a={id:o,name:r,kind:e};return s&&n.setElement(o,{ref:a,getInfo:i}),a}};function _(e){if(""===e)return[];const t=e.split(":").map(e=>function(e){const t=Number.parseInt(e,16);return[t/256|0,t%256]}(e));return[].concat(...t)}function y(e){return Buffer.from(Uint8Array.from(e.split(".").map(e=>Number.parseInt(e))))}function v(e){if((0,r.isIPv4)(e))return y(e);if(function(e){return(0,r.isIPv6)(e)&&e.toLowerCase().startsWith("::ffff:")&&(0,r.isIPv4)(e.substring(7))}(e))return y(e.substring(7));if((0,r.isIPv6)(e)){let t,n;const r=e.indexOf("::");-1===r?(t=e,n=""):(t=e.substring(0,r),n=e.substring(r+2));const i=Buffer.from(_(t)),s=Buffer.from(_(n)),o=Buffer.alloc(16-i.length-s.length,0);return Buffer.concat([i,o,s])}return null}function b(e){switch(e){case s.ConnectivityState.CONNECTING:return{state:"CONNECTING"};case s.ConnectivityState.IDLE:return{state:"IDLE"};case s.ConnectivityState.READY:return{state:"READY"};case s.ConnectivityState.SHUTDOWN:return{state:"SHUTDOWN"};case s.ConnectivityState.TRANSIENT_FAILURE:return{state:"TRANSIENT_FAILURE"};default:return{state:"UNKNOWN"}}}function E(e){if(!e)return null;const t=e.getTime();return{seconds:t/1e3|0,nanos:t%1e3*1e6}}function A(e){const t=e.getInfo(),n=[],r=[];return t.children.channels.forEach(e=>{n.push(h(e[1].ref))}),t.children.subchannels.forEach(e=>{r.push(u(e[1].ref))}),{ref:h(e.ref),data:{target:t.target,state:b(t.state),calls_started:t.callTracker.callsStarted,calls_succeeded:t.callTracker.callsSucceeded,calls_failed:t.callTracker.callsFailed,last_call_started_timestamp:E(t.callTracker.lastCallStartedTimestamp),trace:t.trace.getTraceMessage()},channel_ref:n,subchannel_ref:r}}function S(e,t){const n=parseInt(e.request.channel_id,10),r=g.channel.getElementByKey(n);void 0!==r?t(null,{channel:A(r)}):t({code:o.Status.NOT_FOUND,details:"No channel data found for id "+n})}function w(e,t){const n=parseInt(e.request.max_results,10)||100,r=[],i=parseInt(e.request.start_channel_id,10),s=g.channel;let o;for(o=s.lowerBound(i);!o.equals(s.end())&&r.length<n;o=o.next())r.push(A(o.pointer[1]));t(null,{channel:r,end:o.equals(s.end())})}function C(e){const t=e.getInfo(),n=[];return t.listenerChildren.sockets.forEach(e=>{n.push(d(e[1].ref))}),{ref:(r=e.ref,{server_id:r.id}),data:{calls_started:t.callTracker.callsStarted,calls_succeeded:t.callTracker.callsSucceeded,calls_failed:t.callTracker.callsFailed,last_call_started_timestamp:E(t.callTracker.lastCallStartedTimestamp),trace:t.trace.getTraceMessage()},listen_socket:n};var r}function I(e,t){const n=parseInt(e.request.server_id,10),r=g.server.getElementByKey(n);void 0!==r?t(null,{server:C(r)}):t({code:o.Status.NOT_FOUND,details:"No server data found for id "+n})}function k(e,t){const n=parseInt(e.request.max_results,10)||100,r=parseInt(e.request.start_server_id,10),i=g.server,s=[];let o;for(o=i.lowerBound(r);!o.equals(i.end())&&s.length<n;o=o.next())s.push(C(o.pointer[1]));t(null,{server:s,end:o.equals(i.end())})}function T(e,t){const n=parseInt(e.request.subchannel_id,10),r=g.subchannel.getElementByKey(n);if(void 0===r)return void t({code:o.Status.NOT_FOUND,details:"No subchannel data found for id "+n});const i=r.getInfo(),s=[];i.children.sockets.forEach(e=>{s.push(d(e[1].ref))});t(null,{subchannel:{ref:u(r.ref),data:{target:i.target,state:b(i.state),calls_started:i.callTracker.callsStarted,calls_succeeded:i.callTracker.callsSucceeded,calls_failed:i.callTracker.callsFailed,last_call_started_timestamp:E(i.callTracker.lastCallStartedTimestamp),trace:i.trace.getTraceMessage()},socket_ref:s}})}function R(e){var t;return(0,a.isTcpSubchannelAddress)(e)?{address:"tcpip_address",tcpip_address:{ip_address:null!==(t=v(e.host))&&void 0!==t?t:void 0,port:e.port}}:{address:"uds_address",uds_address:{filename:e.path}}}function O(e,t){var n,r,i,s,a;const c=parseInt(e.request.socket_id,10),l=g.socket.getElementByKey(c);if(void 0===l)return void t({code:o.Status.NOT_FOUND,details:"No socket data found for id "+c});const h=l.getInfo(),u=h.security?{model:"tls",tls:{cipher_suite:h.security.cipherSuiteStandardName?"standard_name":"other_name",standard_name:null!==(n=h.security.cipherSuiteStandardName)&&void 0!==n?n:void 0,other_name:null!==(r=h.security.cipherSuiteOtherName)&&void 0!==r?r:void 0,local_certificate:null!==(i=h.security.localCertificate)&&void 0!==i?i:void 0,remote_certificate:null!==(s=h.security.remoteCertificate)&&void 0!==s?s:void 0}}:null;t(null,{socket:{ref:d(l.ref),local:h.localAddress?R(h.localAddress):null,remote:h.remoteAddress?R(h.remoteAddress):null,remote_name:null!==(a=h.remoteName)&&void 0!==a?a:void 0,security:u,data:{keep_alives_sent:h.keepAlivesSent,streams_started:h.streamsStarted,streams_succeeded:h.streamsSucceeded,streams_failed:h.streamsFailed,last_local_stream_created_timestamp:E(h.lastLocalStreamCreatedTimestamp),last_remote_stream_created_timestamp:E(h.lastRemoteStreamCreatedTimestamp),messages_received:h.messagesReceived,messages_sent:h.messagesSent,last_message_received_timestamp:E(h.lastMessageReceivedTimestamp),last_message_sent_timestamp:E(h.lastMessageSentTimestamp),local_flow_control_window:h.localFlowControlWindow?{value:h.localFlowControlWindow}:null,remote_flow_control_window:h.remoteFlowControlWindow?{value:h.remoteFlowControlWindow}:null}}})}function N(e,t){const n=parseInt(e.request.server_id,10),r=g.server.getElementByKey(n);if(void 0===r)return void t({code:o.Status.NOT_FOUND,details:"No server data found for id "+n});const i=parseInt(e.request.start_socket_id,10),s=parseInt(e.request.max_results,10)||100,a=r.getInfo().sessionChildren.sockets,c=[];let l;for(l=a.lowerBound(i);!l.equals(a.end())&&c.length<s;l=l.next())c.push(d(l.pointer[1].ref));t(null,{socket_ref:c,end:l.equals(a.end())})}function P(){return{GetChannel:S,GetTopChannels:w,GetServer:I,GetServers:k,GetSubchannel:T,GetSocket:O,GetServerSockets:N}}t.registerChannelzChannel=m("channel"),t.registerChannelzSubchannel=m("subchannel"),t.registerChannelzServer=m("server"),t.registerChannelzSocket=m("socket");let B=null;function L(){if(B)return B;const e=(0,n(5085).Yi)("channelz.proto",{keepCase:!0,longs:String,enums:String,defaults:!0,oneofs:!0,includeDirs:[`${__dirname}/../../proto`]}),t=(0,l.loadPackageDefinition)(e);return B=t.grpc.channelz.v1.Channelz.service,B}},3952(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.InterceptingCall=t.RequesterBuilder=t.ListenerBuilder=t.InterceptorConfigurationError=void 0,t.getInterceptingCall=function(e,t,n,r){if(e.clientInterceptors.length>0&&e.clientInterceptorProviders.length>0)throw new a("Both interceptors and interceptor_providers were passed as options to the client constructor. Only one of these is allowed.");if(e.callInterceptors.length>0&&e.callInterceptorProviders.length>0)throw new a("Both interceptors and interceptor_providers were passed as call options. Only one of these is allowed.");let i=[];i=e.callInterceptors.length>0||e.callInterceptorProviders.length>0?[].concat(e.callInterceptors,e.callInterceptorProviders.map(e=>e(t))).filter(e=>e):[].concat(e.clientInterceptors,e.clientInterceptorProviders.map(e=>e(t))).filter(e=>e);const s=Object.assign({},n,{method_definition:t}),o=i.reduceRight((e,t)=>n=>t(n,e),e=>f(r,e,t));return o(s)};const r=n(4097),i=n(5034),s=n(131),o=n(9752);class a extends Error{constructor(e){super(e),this.name="InterceptorConfigurationError",Error.captureStackTrace(this,a)}}t.InterceptorConfigurationError=a;t.ListenerBuilder=class{constructor(){this.metadata=void 0,this.message=void 0,this.status=void 0}withOnReceiveMetadata(e){return this.metadata=e,this}withOnReceiveMessage(e){return this.message=e,this}withOnReceiveStatus(e){return this.status=e,this}build(){return{onReceiveMetadata:this.metadata,onReceiveMessage:this.message,onReceiveStatus:this.status}}};t.RequesterBuilder=class{constructor(){this.start=void 0,this.message=void 0,this.halfClose=void 0,this.cancel=void 0}withStart(e){return this.start=e,this}withSendMessage(e){return this.message=e,this}withHalfClose(e){return this.halfClose=e,this}withCancel(e){return this.cancel=e,this}build(){return{start:this.start,sendMessage:this.message,halfClose:this.halfClose,cancel:this.cancel}}};const c={onReceiveMetadata:(e,t)=>{t(e)},onReceiveMessage:(e,t)=>{t(e)},onReceiveStatus:(e,t)=>{t(e)}},l={start:(e,t,n)=>{n(e,t)},sendMessage:(e,t)=>{t(e)},halfClose:e=>{e()},cancel:e=>{e()}};t.InterceptingCall=class{constructor(e,t){var n,r,i,s;this.nextCall=e,this.processingMetadata=!1,this.pendingMessageContext=null,this.processingMessage=!1,this.pendingHalfClose=!1,this.requester=t?{start:null!==(n=t.start)&&void 0!==n?n:l.start,sendMessage:null!==(r=t.sendMessage)&&void 0!==r?r:l.sendMessage,halfClose:null!==(i=t.halfClose)&&void 0!==i?i:l.halfClose,cancel:null!==(s=t.cancel)&&void 0!==s?s:l.cancel}:l}cancelWithStatus(e,t){this.requester.cancel(()=>{this.nextCall.cancelWithStatus(e,t)})}getPeer(){return this.nextCall.getPeer()}processPendingMessage(){this.pendingMessageContext&&(this.nextCall.sendMessageWithContext(this.pendingMessageContext,this.pendingMessage),this.pendingMessageContext=null,this.pendingMessage=null)}processPendingHalfClose(){this.pendingHalfClose&&this.nextCall.halfClose()}start(e,t){var n,r,s,o,a,l;const h={onReceiveMetadata:null!==(r=null===(n=null==t?void 0:t.onReceiveMetadata)||void 0===n?void 0:n.bind(t))&&void 0!==r?r:e=>{},onReceiveMessage:null!==(o=null===(s=null==t?void 0:t.onReceiveMessage)||void 0===s?void 0:s.bind(t))&&void 0!==o?o:e=>{},onReceiveStatus:null!==(l=null===(a=null==t?void 0:t.onReceiveStatus)||void 0===a?void 0:a.bind(t))&&void 0!==l?l:e=>{}};this.processingMetadata=!0,this.requester.start(e,h,(e,t)=>{var n,r,s;let o;if(this.processingMetadata=!1,(0,i.isInterceptingListener)(t))o=t;else{const e={onReceiveMetadata:null!==(n=t.onReceiveMetadata)&&void 0!==n?n:c.onReceiveMetadata,onReceiveMessage:null!==(r=t.onReceiveMessage)&&void 0!==r?r:c.onReceiveMessage,onReceiveStatus:null!==(s=t.onReceiveStatus)&&void 0!==s?s:c.onReceiveStatus};o=new i.InterceptingListenerImpl(e,h)}this.nextCall.start(e,o),this.processPendingMessage(),this.processPendingHalfClose()})}sendMessageWithContext(e,t){this.processingMessage=!0,this.requester.sendMessage(t,n=>{this.processingMessage=!1,this.processingMetadata?(this.pendingMessageContext=e,this.pendingMessage=t):(this.nextCall.sendMessageWithContext(e,n),this.processPendingHalfClose())})}sendMessage(e){this.sendMessageWithContext({},e)}startRead(){this.nextCall.startRead()}halfClose(){this.requester.halfClose(()=>{this.processingMetadata||this.processingMessage?this.pendingHalfClose=!0:this.nextCall.halfClose()})}getAuthContext(){return this.nextCall.getAuthContext()}};class h{constructor(e,t){this.call=e,this.methodDefinition=t}cancelWithStatus(e,t){this.call.cancelWithStatus(e,t)}getPeer(){return this.call.getPeer()}sendMessageWithContext(e,t){let n;try{n=this.methodDefinition.requestSerialize(t)}catch(e){return void this.call.cancelWithStatus(s.Status.INTERNAL,`Request message serialization failure: ${(0,o.getErrorMessage)(e)}`)}this.call.sendMessageWithContext(e,n)}sendMessage(e){this.sendMessageWithContext({},e)}start(e,t){let n=null;this.call.start(e,{onReceiveMetadata:e=>{var n;null===(n=null==t?void 0:t.onReceiveMetadata)||void 0===n||n.call(t,e)},onReceiveMessage:e=>{var i;let a;try{a=this.methodDefinition.responseDeserialize(e)}catch(e){return n={code:s.Status.INTERNAL,details:`Response message parsing error: ${(0,o.getErrorMessage)(e)}`,metadata:new r.Metadata},void this.call.cancelWithStatus(n.code,n.details)}null===(i=null==t?void 0:t.onReceiveMessage)||void 0===i||i.call(t,a)},onReceiveStatus:e=>{var r,i;n?null===(r=null==t?void 0:t.onReceiveStatus)||void 0===r||r.call(t,n):null===(i=null==t?void 0:t.onReceiveStatus)||void 0===i||i.call(t,e)}})}startRead(){this.call.startRead()}halfClose(){this.call.halfClose()}getAuthContext(){return this.call.getAuthContext()}}class u extends h{constructor(e,t){super(e,t)}start(e,t){var n,r;let i=!1;const s={onReceiveMetadata:null!==(r=null===(n=null==t?void 0:t.onReceiveMetadata)||void 0===n?void 0:n.bind(t))&&void 0!==r?r:e=>{},onReceiveMessage:e=>{var n;i=!0,null===(n=null==t?void 0:t.onReceiveMessage)||void 0===n||n.call(t,e)},onReceiveStatus:e=>{var n,r;i||null===(n=null==t?void 0:t.onReceiveMessage)||void 0===n||n.call(t,null),null===(r=null==t?void 0:t.onReceiveStatus)||void 0===r||r.call(t,e)}};super.start(e,s),this.call.startRead()}}class d extends h{}function f(e,t,n){const r=function(e,t,n){var r,i;const s=null!==(r=n.deadline)&&void 0!==r?r:1/0,o=n.host,a=null!==(i=n.parent)&&void 0!==i?i:null,c=n.propagate_flags,l=n.credentials,h=e.createCall(t,s,o,a,c);return l&&h.setCredentials(l),h}(e,n.path,t);return n.responseStream?new d(r,n):new u(r,n)}},5563(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Client=void 0;const r=n(1544),i=n(3653),s=n(463),o=n(131),a=n(4097),c=n(3952),l=Symbol(),h=Symbol(),u=Symbol(),d=Symbol();function f(e){return"function"==typeof e}function p(e){var t;return(null===(t=e.stack)||void 0===t?void 0:t.split("\n").slice(1).join("\n"))||"no stack trace available"}t.Client=class{constructor(e,t,n={}){var r,s;if(n=Object.assign({},n),this[h]=null!==(r=n.interceptors)&&void 0!==r?r:[],delete n.interceptors,this[u]=null!==(s=n.interceptor_providers)&&void 0!==s?s:[],delete n.interceptor_providers,this[h].length>0&&this[u].length>0)throw new Error("Both interceptors and interceptor_providers were passed as options to the client constructor. Only one of these is allowed.");if(this[d]=n.callInvocationTransformer,delete n.callInvocationTransformer,n.channelOverride)this[l]=n.channelOverride;else if(n.channelFactoryOverride){const r=n.channelFactoryOverride;delete n.channelFactoryOverride,this[l]=r(e,t,n)}else this[l]=new i.ChannelImplementation(e,t,n)}close(){this[l].close()}getChannel(){return this[l]}waitForReady(e,t){const n=r=>{if(r)return void t(new Error("Failed to connect before the deadline"));let i;try{i=this[l].getConnectivityState(!0)}catch(e){return void t(new Error("The channel has been closed"))}if(i===s.ConnectivityState.READY)t();else try{this[l].watchConnectivityState(i,e,n)}catch(e){t(new Error("The channel has been closed"))}};setImmediate(n)}checkOptionalUnaryResponseArguments(e,t,n){if(f(e))return{metadata:new a.Metadata,options:{},callback:e};if(f(t))return e instanceof a.Metadata?{metadata:e,options:{},callback:t}:{metadata:new a.Metadata,options:e,callback:t};if(!(e instanceof a.Metadata&&t instanceof Object&&f(n)))throw new Error("Incorrect arguments passed");return{metadata:e,options:t,callback:n}}makeUnaryRequest(e,t,n,i,s,a,f){var g,m;const _=this.checkOptionalUnaryResponseArguments(s,a,f),y={path:e,requestStream:!1,responseStream:!1,requestSerialize:t,responseDeserialize:n};let v={argument:i,metadata:_.metadata,call:new r.ClientUnaryCallImpl,channel:this[l],methodDefinition:y,callOptions:_.options,callback:_.callback};this[d]&&(v=this[d](v));const b=v.call,E={clientInterceptors:this[h],clientInterceptorProviders:this[u],callInterceptors:null!==(g=v.callOptions.interceptors)&&void 0!==g?g:[],callInterceptorProviders:null!==(m=v.callOptions.interceptor_providers)&&void 0!==m?m:[]},A=(0,c.getInterceptingCall)(E,v.methodDefinition,v.callOptions,v.channel);b.call=A;let S=null,w=!1,C=new Error;return A.start(v.metadata,{onReceiveMetadata:e=>{b.emit("metadata",e)},onReceiveMessage(e){null!==S&&A.cancelWithStatus(o.Status.UNIMPLEMENTED,"Too many responses received"),S=e},onReceiveStatus(e){if(!w){if(w=!0,e.code===o.Status.OK)if(null===S){const t=p(C);v.callback((0,r.callErrorFromStatus)({code:o.Status.UNIMPLEMENTED,details:"No message received",metadata:e.metadata},t))}else v.callback(null,S);else{const t=p(C);v.callback((0,r.callErrorFromStatus)(e,t))}C=null,b.emit("status",e)}}}),A.sendMessage(i),A.halfClose(),b}makeClientStreamRequest(e,t,n,i,s,a){var f,g;const m=this.checkOptionalUnaryResponseArguments(i,s,a),_={path:e,requestStream:!0,responseStream:!1,requestSerialize:t,responseDeserialize:n};let y={metadata:m.metadata,call:new r.ClientWritableStreamImpl(t),channel:this[l],methodDefinition:_,callOptions:m.options,callback:m.callback};this[d]&&(y=this[d](y));const v=y.call,b={clientInterceptors:this[h],clientInterceptorProviders:this[u],callInterceptors:null!==(f=y.callOptions.interceptors)&&void 0!==f?f:[],callInterceptorProviders:null!==(g=y.callOptions.interceptor_providers)&&void 0!==g?g:[]},E=(0,c.getInterceptingCall)(b,y.methodDefinition,y.callOptions,y.channel);v.call=E;let A=null,S=!1,w=new Error;return E.start(y.metadata,{onReceiveMetadata:e=>{v.emit("metadata",e)},onReceiveMessage(e){null!==A&&E.cancelWithStatus(o.Status.UNIMPLEMENTED,"Too many responses received"),A=e,E.startRead()},onReceiveStatus(e){if(!S){if(S=!0,e.code===o.Status.OK)if(null===A){const t=p(w);y.callback((0,r.callErrorFromStatus)({code:o.Status.UNIMPLEMENTED,details:"No message received",metadata:e.metadata},t))}else y.callback(null,A);else{const t=p(w);y.callback((0,r.callErrorFromStatus)(e,t))}w=null,v.emit("status",e)}}}),v}checkMetadataAndOptions(e,t){let n,r;return e instanceof a.Metadata?(n=e,r=t||{}):(r=e||{},n=new a.Metadata),{metadata:n,options:r}}makeServerStreamRequest(e,t,n,i,s,a){var f,g;const m=this.checkMetadataAndOptions(s,a),_={path:e,requestStream:!1,responseStream:!0,requestSerialize:t,responseDeserialize:n};let y={argument:i,metadata:m.metadata,call:new r.ClientReadableStreamImpl(n),channel:this[l],methodDefinition:_,callOptions:m.options};this[d]&&(y=this[d](y));const v=y.call,b={clientInterceptors:this[h],clientInterceptorProviders:this[u],callInterceptors:null!==(f=y.callOptions.interceptors)&&void 0!==f?f:[],callInterceptorProviders:null!==(g=y.callOptions.interceptor_providers)&&void 0!==g?g:[]},E=(0,c.getInterceptingCall)(b,y.methodDefinition,y.callOptions,y.channel);v.call=E;let A=!1,S=new Error;return E.start(y.metadata,{onReceiveMetadata(e){v.emit("metadata",e)},onReceiveMessage(e){v.push(e)},onReceiveStatus(e){if(!A){if(A=!0,v.push(null),e.code!==o.Status.OK){const t=p(S);v.emit("error",(0,r.callErrorFromStatus)(e,t))}S=null,v.emit("status",e)}}}),E.sendMessage(i),E.halfClose(),v}makeBidiStreamRequest(e,t,n,i,s){var a,f;const g=this.checkMetadataAndOptions(i,s),m={path:e,requestStream:!0,responseStream:!0,requestSerialize:t,responseDeserialize:n};let _={metadata:g.metadata,call:new r.ClientDuplexStreamImpl(t,n),channel:this[l],methodDefinition:m,callOptions:g.options};this[d]&&(_=this[d](_));const y=_.call,v={clientInterceptors:this[h],clientInterceptorProviders:this[u],callInterceptors:null!==(a=_.callOptions.interceptors)&&void 0!==a?a:[],callInterceptorProviders:null!==(f=_.callOptions.interceptor_providers)&&void 0!==f?f:[]},b=(0,c.getInterceptingCall)(v,_.methodDefinition,_.callOptions,_.channel);y.call=b;let E=!1,A=new Error;return b.start(_.metadata,{onReceiveMetadata(e){y.emit("metadata",e)},onReceiveMessage(e){y.push(e)},onReceiveStatus(e){if(!E){if(E=!0,y.push(null),e.code!==o.Status.OK){const t=p(A);y.emit("error",(0,r.callErrorFromStatus)(e,t))}A=null,y.emit("status",e)}}}),y}}},5179(e,t){"use strict";var n;Object.defineProperty(t,"__esModule",{value:!0}),t.CompressionAlgorithms=void 0,function(e){e[e.identity=0]="identity",e[e.deflate=1]="deflate",e[e.gzip=2]="gzip"}(n||(t.CompressionAlgorithms=n={}))},4987(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.CompressionFilterFactory=t.CompressionFilter=void 0;const r=n(3106),i=n(5179),s=n(131),o=n(2558),a=n(267);class c{async writeMessage(e,t){let n=e;t&&(n=await this.compressMessage(n));const r=Buffer.allocUnsafe(n.length+5);return r.writeUInt8(t?1:0,0),r.writeUInt32BE(n.length,1),n.copy(r,5),r}async readMessage(e){const t=1===e.readUInt8(0);let n=e.slice(5);return t&&(n=await this.decompressMessage(n)),n}}class l extends c{async compressMessage(e){return e}async writeMessage(e,t){const n=Buffer.allocUnsafe(e.length+5);return n.writeUInt8(0,0),n.writeUInt32BE(e.length,1),e.copy(n,5),n}decompressMessage(e){return Promise.reject(new Error('Received compressed message but "grpc-encoding" header was identity'))}}class h extends c{constructor(e){super(),this.maxRecvMessageLength=e}compressMessage(e){return new Promise((t,n)=>{r.deflate(e,(e,r)=>{e?n(e):t(r)})})}decompressMessage(e){return new Promise((t,n)=>{let i=0;const o=[],a=r.createInflate();a.on("data",e=>{o.push(e),i+=e.byteLength,-1!==this.maxRecvMessageLength&&i>this.maxRecvMessageLength&&(a.destroy(),n({code:s.Status.RESOURCE_EXHAUSTED,details:`Received message that decompresses to a size larger than ${this.maxRecvMessageLength}`}))}),a.on("end",()=>{t(Buffer.concat(o))}),a.write(e),a.end()})}}class u extends c{constructor(e){super(),this.maxRecvMessageLength=e}compressMessage(e){return new Promise((t,n)=>{r.gzip(e,(e,r)=>{e?n(e):t(r)})})}decompressMessage(e){return new Promise((t,n)=>{let i=0;const o=[],a=r.createGunzip();a.on("data",e=>{o.push(e),i+=e.byteLength,-1!==this.maxRecvMessageLength&&i>this.maxRecvMessageLength&&(a.destroy(),n({code:s.Status.RESOURCE_EXHAUSTED,details:`Received message that decompresses to a size larger than ${this.maxRecvMessageLength}`}))}),a.on("end",()=>{t(Buffer.concat(o))}),a.write(e),a.end()})}}class d extends c{constructor(e){super(),this.compressionName=e}compressMessage(e){return Promise.reject(new Error(`Received message compressed with unsupported compression method ${this.compressionName}`))}decompressMessage(e){return Promise.reject(new Error(`Compression method not supported: ${this.compressionName}`))}}function f(e,t){switch(e){case"identity":return new l;case"deflate":return new h(t);case"gzip":return new u(t);default:return new d(e)}}class p extends o.BaseFilter{constructor(e,t){var n,r,o;super(),this.sharedFilterConfig=t,this.sendCompression=new l,this.receiveCompression=new l,this.currentCompressionAlgorithm="identity";const c=e["grpc.default_compression_algorithm"];if(this.maxReceiveMessageLength=null!==(n=e["grpc.max_receive_message_length"])&&void 0!==n?n:s.DEFAULT_MAX_RECEIVE_MESSAGE_LENGTH,this.maxSendMessageLength=null!==(r=e["grpc.max_send_message_length"])&&void 0!==r?r:s.DEFAULT_MAX_SEND_MESSAGE_LENGTH,void 0!==c)if("number"==typeof(h=c)&&"string"==typeof i.CompressionAlgorithms[h]){const e=i.CompressionAlgorithms[c],n=null===(o=t.serverSupportedEncodingHeader)||void 0===o?void 0:o.split(",");n&&!n.includes(e)||(this.currentCompressionAlgorithm=e,this.sendCompression=f(this.currentCompressionAlgorithm,-1))}else a.log(s.LogVerbosity.ERROR,`Invalid value provided for grpc.default_compression_algorithm option: ${c}`);var h}async sendMetadata(e){const t=await e;return t.set("grpc-accept-encoding","identity,deflate,gzip"),t.set("accept-encoding","identity"),"identity"===this.currentCompressionAlgorithm?t.remove("grpc-encoding"):t.set("grpc-encoding",this.currentCompressionAlgorithm),t}receiveMetadata(e){const t=e.get("grpc-encoding");if(t.length>0){const e=t[0];"string"==typeof e&&(this.receiveCompression=f(e,this.maxReceiveMessageLength))}e.remove("grpc-encoding");const n=e.get("grpc-accept-encoding")[0];if(n){this.sharedFilterConfig.serverSupportedEncodingHeader=n;n.split(",").includes(this.currentCompressionAlgorithm)||(this.sendCompression=new l,this.currentCompressionAlgorithm="identity")}return e.remove("grpc-accept-encoding"),e}async sendMessage(e){var t;const n=await e;if(-1!==this.maxSendMessageLength&&n.message.length>this.maxSendMessageLength)throw{code:s.Status.RESOURCE_EXHAUSTED,details:`Attempted to send message with a size larger than ${this.maxSendMessageLength}`};let r;return r=!(this.sendCompression instanceof l)&&!(2&(null!==(t=n.flags)&&void 0!==t?t:0)),{message:await this.sendCompression.writeMessage(n.message,r),flags:n.flags}}async receiveMessage(e){return this.receiveCompression.readMessage(await e)}}t.CompressionFilter=p;t.CompressionFilterFactory=class{constructor(e,t){this.options=t,this.sharedFilterConfig={}}createFilter(){return new p(this.options,this.sharedFilterConfig)}}},463(e,t){"use strict";var n;Object.defineProperty(t,"__esModule",{value:!0}),t.ConnectivityState=void 0,function(e){e[e.IDLE=0]="IDLE",e[e.CONNECTING=1]="CONNECTING",e[e.READY=2]="READY",e[e.TRANSIENT_FAILURE=3]="TRANSIENT_FAILURE",e[e.SHUTDOWN=4]="SHUTDOWN"}(n||(t.ConnectivityState=n={}))},131(e,t){"use strict";var n,r,i;Object.defineProperty(t,"__esModule",{value:!0}),t.DEFAULT_MAX_RECEIVE_MESSAGE_LENGTH=t.DEFAULT_MAX_SEND_MESSAGE_LENGTH=t.Propagate=t.LogVerbosity=t.Status=void 0,function(e){e[e.OK=0]="OK",e[e.CANCELLED=1]="CANCELLED",e[e.UNKNOWN=2]="UNKNOWN",e[e.INVALID_ARGUMENT=3]="INVALID_ARGUMENT",e[e.DEADLINE_EXCEEDED=4]="DEADLINE_EXCEEDED",e[e.NOT_FOUND=5]="NOT_FOUND",e[e.ALREADY_EXISTS=6]="ALREADY_EXISTS",e[e.PERMISSION_DENIED=7]="PERMISSION_DENIED",e[e.RESOURCE_EXHAUSTED=8]="RESOURCE_EXHAUSTED",e[e.FAILED_PRECONDITION=9]="FAILED_PRECONDITION",e[e.ABORTED=10]="ABORTED",e[e.OUT_OF_RANGE=11]="OUT_OF_RANGE",e[e.UNIMPLEMENTED=12]="UNIMPLEMENTED",e[e.INTERNAL=13]="INTERNAL",e[e.UNAVAILABLE=14]="UNAVAILABLE",e[e.DATA_LOSS=15]="DATA_LOSS",e[e.UNAUTHENTICATED=16]="UNAUTHENTICATED"}(n||(t.Status=n={})),function(e){e[e.DEBUG=0]="DEBUG",e[e.INFO=1]="INFO",e[e.ERROR=2]="ERROR",e[e.NONE=3]="NONE"}(r||(t.LogVerbosity=r={})),function(e){e[e.DEADLINE=1]="DEADLINE",e[e.CENSUS_STATS_CONTEXT=2]="CENSUS_STATS_CONTEXT",e[e.CENSUS_TRACING_CONTEXT=4]="CENSUS_TRACING_CONTEXT",e[e.CANCELLATION=8]="CANCELLATION",e[e.DEFAULTS=65535]="DEFAULTS"}(i||(t.Propagate=i={})),t.DEFAULT_MAX_SEND_MESSAGE_LENGTH=-1,t.DEFAULT_MAX_RECEIVE_MESSAGE_LENGTH=4194304},6067(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.restrictControlPlaneStatusCode=function(e,t){return i.includes(e)?{code:r.Status.INTERNAL,details:`Invalid status from control plane: ${e} ${r.Status[e]} ${t}`}:{code:e,details:t}};const r=n(131),i=[r.Status.OK,r.Status.INVALID_ARGUMENT,r.Status.NOT_FOUND,r.Status.ALREADY_EXISTS,r.Status.FAILED_PRECONDITION,r.Status.ABORTED,r.Status.OUT_OF_RANGE,r.Status.DATA_LOSS]},6308(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.minDeadline=function(...e){let t=1/0;for(const n of e){const e=n instanceof Date?n.getTime():n;e<t&&(t=e)}return t},t.getDeadlineTimeoutString=function(e){const t=(new Date).getTime();e instanceof Date&&(e=e.getTime());const r=Math.max(e-t,0);for(const[e,t]of n){const n=r/t;if(n<1e8)return String(Math.ceil(n))+e}throw new Error("Deadline is too far in the future")},t.getRelativeTimeout=function(e){const t=e instanceof Date?e.getTime():e,n=(new Date).getTime(),r=t-n;return r<0?0:r>2147483647?1/0:r},t.deadlineToString=function(e){if(e instanceof Date)return e.toISOString();{const t=new Date(e);return Number.isNaN(t.getTime())?""+e:t.toISOString()}},t.formatDateDifference=function(e,t){return((t.getTime()-e.getTime())/1e3).toFixed(3)+"s"};const n=[["m",1],["S",1e3],["M",6e4],["H",36e5]]},4700(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.durationMessageToDuration=function(e){return{seconds:Number.parseInt(e.seconds),nanos:e.nanos}},t.msToDuration=function(e){return{seconds:e/1e3|0,nanos:e%1e3*1e6|0}},t.durationToMs=function(e){return 1e3*e.seconds+e.nanos/1e6|0},t.isDuration=function(e){return"number"==typeof e.seconds&&"number"==typeof e.nanos},t.isDurationMessage=function(e){return"string"==typeof e.seconds&&"number"==typeof e.nanos},t.parseDuration=function(e){const t=e.match(n);if(!t)return null;return{seconds:Number.parseInt(t[1],10),nanos:t[2]?Number.parseInt(t[2].padEnd(9,"0"),10):0}},t.durationToString=function(e){if(0===e.nanos)return`${e.seconds}s`;let t;t=e.nanos%1e6==0?1e6:e.nanos%1e3==0?1e3:1;return`${e.seconds}.${e.nanos/t}s`};const n=/^(\d+)(?:\.(\d+))?s$/},883(e,t){"use strict";var n;Object.defineProperty(t,"__esModule",{value:!0}),t.GRPC_NODE_USE_ALTERNATIVE_RESOLVER=void 0,t.GRPC_NODE_USE_ALTERNATIVE_RESOLVER="true"===(null!==(n=process.env.GRPC_NODE_USE_ALTERNATIVE_RESOLVER)&&void 0!==n?n:"false")},9752(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.getErrorMessage=function(e){return e instanceof Error?e.message:String(e)},t.getErrorCode=function(e){return"object"==typeof e&&null!==e&&"code"in e&&"number"==typeof e.code?e.code:null}},342(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.SUBCHANNEL_ARGS_EXCLUDE_KEY_PREFIX=t.createCertificateProviderChannelCredentials=t.FileWatcherCertificateProvider=t.createCertificateProviderServerCredentials=t.createServerCredentialsWithInterceptors=t.BaseSubchannelWrapper=t.registerAdminService=t.FilterStackFactory=t.BaseFilter=t.statusOrFromError=t.statusOrFromValue=t.PickResultType=t.QueuePicker=t.UnavailablePicker=t.ChildLoadBalancerHandler=t.EndpointMap=t.endpointHasAddress=t.endpointToString=t.subchannelAddressToString=t.LeafLoadBalancer=t.isLoadBalancerNameRegistered=t.parseLoadBalancingConfig=t.selectLbConfigFromList=t.registerLoadBalancerType=t.createChildChannelControlHelper=t.BackoffTimeout=t.parseDuration=t.durationToMs=t.splitHostPort=t.uriToString=t.CHANNEL_ARGS_CONFIG_SELECTOR_KEY=t.createResolver=t.registerResolver=t.log=t.trace=void 0;var r=n(267);Object.defineProperty(t,"trace",{enumerable:!0,get:function(){return r.trace}}),Object.defineProperty(t,"log",{enumerable:!0,get:function(){return r.log}});var i=n(9302);Object.defineProperty(t,"registerResolver",{enumerable:!0,get:function(){return i.registerResolver}}),Object.defineProperty(t,"createResolver",{enumerable:!0,get:function(){return i.createResolver}}),Object.defineProperty(t,"CHANNEL_ARGS_CONFIG_SELECTOR_KEY",{enumerable:!0,get:function(){return i.CHANNEL_ARGS_CONFIG_SELECTOR_KEY}});var s=n(3822);Object.defineProperty(t,"uriToString",{enumerable:!0,get:function(){return s.uriToString}}),Object.defineProperty(t,"splitHostPort",{enumerable:!0,get:function(){return s.splitHostPort}});var o=n(4700);Object.defineProperty(t,"durationToMs",{enumerable:!0,get:function(){return o.durationToMs}}),Object.defineProperty(t,"parseDuration",{enumerable:!0,get:function(){return o.parseDuration}});var a=n(3956);Object.defineProperty(t,"BackoffTimeout",{enumerable:!0,get:function(){return a.BackoffTimeout}});var c=n(8923);Object.defineProperty(t,"createChildChannelControlHelper",{enumerable:!0,get:function(){return c.createChildChannelControlHelper}}),Object.defineProperty(t,"registerLoadBalancerType",{enumerable:!0,get:function(){return c.registerLoadBalancerType}}),Object.defineProperty(t,"selectLbConfigFromList",{enumerable:!0,get:function(){return c.selectLbConfigFromList}}),Object.defineProperty(t,"parseLoadBalancingConfig",{enumerable:!0,get:function(){return c.parseLoadBalancingConfig}}),Object.defineProperty(t,"isLoadBalancerNameRegistered",{enumerable:!0,get:function(){return c.isLoadBalancerNameRegistered}});var l=n(6486);Object.defineProperty(t,"LeafLoadBalancer",{enumerable:!0,get:function(){return l.LeafLoadBalancer}});var h=n(8996);Object.defineProperty(t,"subchannelAddressToString",{enumerable:!0,get:function(){return h.subchannelAddressToString}}),Object.defineProperty(t,"endpointToString",{enumerable:!0,get:function(){return h.endpointToString}}),Object.defineProperty(t,"endpointHasAddress",{enumerable:!0,get:function(){return h.endpointHasAddress}}),Object.defineProperty(t,"EndpointMap",{enumerable:!0,get:function(){return h.EndpointMap}});var u=n(533);Object.defineProperty(t,"ChildLoadBalancerHandler",{enumerable:!0,get:function(){return u.ChildLoadBalancerHandler}});var d=n(178);Object.defineProperty(t,"UnavailablePicker",{enumerable:!0,get:function(){return d.UnavailablePicker}}),Object.defineProperty(t,"QueuePicker",{enumerable:!0,get:function(){return d.QueuePicker}}),Object.defineProperty(t,"PickResultType",{enumerable:!0,get:function(){return d.PickResultType}});var f=n(5034);Object.defineProperty(t,"statusOrFromValue",{enumerable:!0,get:function(){return f.statusOrFromValue}}),Object.defineProperty(t,"statusOrFromError",{enumerable:!0,get:function(){return f.statusOrFromError}});var p=n(2558);Object.defineProperty(t,"BaseFilter",{enumerable:!0,get:function(){return p.BaseFilter}});var g=n(1703);Object.defineProperty(t,"FilterStackFactory",{enumerable:!0,get:function(){return g.FilterStackFactory}});var m=n(2661);Object.defineProperty(t,"registerAdminService",{enumerable:!0,get:function(){return m.registerAdminService}});var _=n(2379);Object.defineProperty(t,"BaseSubchannelWrapper",{enumerable:!0,get:function(){return _.BaseSubchannelWrapper}});var y=n(6311);Object.defineProperty(t,"createServerCredentialsWithInterceptors",{enumerable:!0,get:function(){return y.createServerCredentialsWithInterceptors}}),Object.defineProperty(t,"createCertificateProviderServerCredentials",{enumerable:!0,get:function(){return y.createCertificateProviderServerCredentials}});var v=n(5819);Object.defineProperty(t,"FileWatcherCertificateProvider",{enumerable:!0,get:function(){return v.FileWatcherCertificateProvider}});var b=n(7434);Object.defineProperty(t,"createCertificateProviderChannelCredentials",{enumerable:!0,get:function(){return b.createCertificateProviderChannelCredentials}});var E=n(8899);Object.defineProperty(t,"SUBCHANNEL_ARGS_EXCLUDE_KEY_PREFIX",{enumerable:!0,get:function(){return E.SUBCHANNEL_ARGS_EXCLUDE_KEY_PREFIX}})},1703(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.FilterStackFactory=t.FilterStack=void 0;class n{constructor(e){this.filters=e}sendMetadata(e){let t=e;for(let e=0;e<this.filters.length;e++)t=this.filters[e].sendMetadata(t);return t}receiveMetadata(e){let t=e;for(let e=this.filters.length-1;e>=0;e--)t=this.filters[e].receiveMetadata(t);return t}sendMessage(e){let t=e;for(let e=0;e<this.filters.length;e++)t=this.filters[e].sendMessage(t);return t}receiveMessage(e){let t=e;for(let e=this.filters.length-1;e>=0;e--)t=this.filters[e].receiveMessage(t);return t}receiveTrailers(e){let t=e;for(let e=this.filters.length-1;e>=0;e--)t=this.filters[e].receiveTrailers(t);return t}push(e){this.filters.unshift(...e)}getFilters(){return this.filters}}t.FilterStack=n;class r{constructor(e){this.factories=e}push(e){this.factories.unshift(...e)}clone(){return new r([...this.factories])}createFilter(){return new n(this.factories.map(e=>e.createFilter()))}}t.FilterStackFactory=r},2558(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.BaseFilter=void 0;t.BaseFilter=class{async sendMetadata(e){return e}receiveMetadata(e){return e}async sendMessage(e){return e}async receiveMessage(e){return e}receiveTrailers(e){return e}}},7803(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.parseCIDR=f,t.mapProxyName=function(e,t){var n;const o={target:e,extraOptions:{}};if(0===(null!==(n=t["grpc.enable_http_proxy"])&&void 0!==n?n:1))return o;if("unix"===e.scheme)return o;const a=function(){let e,t="",n="";if(process.env.grpc_proxy)n="grpc_proxy",t=process.env.grpc_proxy;else if(process.env.https_proxy)n="https_proxy",t=process.env.https_proxy;else{if(!process.env.http_proxy)return{};n="http_proxy",t=process.env.http_proxy}try{e=new h.URL(t)}catch(e){return(0,r.log)(i.LogVerbosity.ERROR,`cannot parse value of "${n}" env var`),{}}if("http:"!==e.protocol)return(0,r.log)(i.LogVerbosity.ERROR,`"${e.protocol}" scheme not supported in proxy URI`),{};let s=null;e.username&&(e.password?((0,r.log)(i.LogVerbosity.INFO,"userinfo found in proxy URI"),s=decodeURIComponent(`${e.username}:${e.password}`)):s=e.username);const o=e.hostname;let a=e.port;""===a&&(a="80");const c={address:`${o}:${a}`};s&&(c.creds=s);return d("Proxy server "+c.address+" set by environment variable "+n),c}();if(!a.address)return o;const c=(0,l.splitHostPort)(e.path);if(!c)return o;if(function(e){for(const t of function(){let e=process.env.no_grpc_proxy,t="no_grpc_proxy";e||(e=process.env.no_proxy,t="no_proxy");return e?(d("No proxy server list set by environment variable "+t),e.split(",")):[]}()){const n=f(t);if((0,s.isIPv4)(e)&&n&&g(n,e))return!0;if(e.endsWith(t))return!0}return!1}(c.host))return d("Not using proxy for target in no_proxy list: "+(0,l.uriToString)(e)),o;const u={"grpc.http_connect_target":(0,l.uriToString)(e)};a.creds&&(u["grpc.http_connect_creds"]=a.creds);return{target:{scheme:"dns",path:a.address},extraOptions:u}},t.getProxiedConnection=function(e,t){var n;if(!("grpc.http_connect_target"in t))return Promise.resolve(null);const s=t["grpc.http_connect_target"],a=(0,l.parseUri)(s);if(null===a)return Promise.resolve(null);const h=(0,l.splitHostPort)(a.path);if(null===h)return Promise.resolve(null);const f=`${h.host}:${null!==(n=h.port)&&void 0!==n?n:u.DEFAULT_PORT}`,p={method:"CONNECT",path:f},g={Host:f};(0,c.isTcpSubchannelAddress)(e)?(p.host=e.host,p.port=e.port):p.socketPath=e.path;"grpc.http_connect_creds"in t&&(g["Proxy-Authorization"]="Basic "+Buffer.from(t["grpc.http_connect_creds"]).toString("base64"));p.headers=g;const m=(0,c.subchannelAddressToString)(e);return d("Using proxy "+m+" to connect to "+p.path),new Promise((e,t)=>{const n=o.request(p);n.once("connect",(s,o,a)=>{n.removeAllListeners(),o.removeAllListeners(),200===s.statusCode?(d("Successfully connected to "+p.path+" through proxy "+m),a.length>0&&o.unshift(a),d("Successfully established a plaintext connection to "+p.path+" through proxy "+m),e(o)):((0,r.log)(i.LogVerbosity.ERROR,"Failed to connect to "+p.path+" through proxy "+m+" with status "+s.statusCode),t())}),n.once("error",e=>{n.removeAllListeners(),(0,r.log)(i.LogVerbosity.ERROR,"Failed to connect to proxy "+m+" with error "+e.message),t()}),n.end()})};const r=n(267),i=n(131),s=n(9278),o=n(8611),a=n(267),c=n(8996),l=n(3822),h=n(7016),u=n(6700);function d(e){a.trace(i.LogVerbosity.DEBUG,"proxy",e)}function f(e){const t=e.split("/");if(2!==t.length)return null;const n=parseInt(t[1],10);return!(0,s.isIPv4)(t[0])||Number.isNaN(n)||n<0||n>32?null:{ip:p(t[0]),prefixLength:n}}function p(e){return e.split(".").reduce((e,t)=>(e<<8)+parseInt(t,10),0)}function g(e,t){const n=e.ip,r=-1<<32-e.prefixLength;return(p(t)&r)===(n&r)}},674(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.experimental=t.ServerMetricRecorder=t.ServerInterceptingCall=t.ResponderBuilder=t.ServerListenerBuilder=t.addAdminServicesToServer=t.getChannelzHandlers=t.getChannelzServiceDefinition=t.InterceptorConfigurationError=t.InterceptingCall=t.RequesterBuilder=t.ListenerBuilder=t.StatusBuilder=t.getClientChannel=t.ServerCredentials=t.Server=t.setLogVerbosity=t.setLogger=t.load=t.loadObject=t.CallCredentials=t.ChannelCredentials=t.waitForClientReady=t.closeClient=t.Channel=t.makeGenericClientConstructor=t.makeClientConstructor=t.loadPackageDefinition=t.Client=t.compressionAlgorithms=t.propagate=t.connectivityState=t.status=t.logVerbosity=t.Metadata=t.credentials=void 0;const r=n(2267);Object.defineProperty(t,"CallCredentials",{enumerable:!0,get:function(){return r.CallCredentials}});const i=n(3653);Object.defineProperty(t,"Channel",{enumerable:!0,get:function(){return i.ChannelImplementation}});const s=n(5179);Object.defineProperty(t,"compressionAlgorithms",{enumerable:!0,get:function(){return s.CompressionAlgorithms}});const o=n(463);Object.defineProperty(t,"connectivityState",{enumerable:!0,get:function(){return o.ConnectivityState}});const a=n(7434);Object.defineProperty(t,"ChannelCredentials",{enumerable:!0,get:function(){return a.ChannelCredentials}});const c=n(5563);Object.defineProperty(t,"Client",{enumerable:!0,get:function(){return c.Client}});const l=n(131);Object.defineProperty(t,"logVerbosity",{enumerable:!0,get:function(){return l.LogVerbosity}}),Object.defineProperty(t,"status",{enumerable:!0,get:function(){return l.Status}}),Object.defineProperty(t,"propagate",{enumerable:!0,get:function(){return l.Propagate}});const h=n(267),u=n(4056);Object.defineProperty(t,"loadPackageDefinition",{enumerable:!0,get:function(){return u.loadPackageDefinition}}),Object.defineProperty(t,"makeClientConstructor",{enumerable:!0,get:function(){return u.makeClientConstructor}}),Object.defineProperty(t,"makeGenericClientConstructor",{enumerable:!0,get:function(){return u.makeClientConstructor}});const d=n(4097);Object.defineProperty(t,"Metadata",{enumerable:!0,get:function(){return d.Metadata}});const f=n(5943);Object.defineProperty(t,"Server",{enumerable:!0,get:function(){return f.Server}});const p=n(6311);Object.defineProperty(t,"ServerCredentials",{enumerable:!0,get:function(){return p.ServerCredentials}});const g=n(2284);Object.defineProperty(t,"StatusBuilder",{enumerable:!0,get:function(){return g.StatusBuilder}}),t.credentials={combineChannelCredentials:(e,...t)=>t.reduce((e,t)=>e.compose(t),e),combineCallCredentials:(e,...t)=>t.reduce((e,t)=>e.compose(t),e),createInsecure:a.ChannelCredentials.createInsecure,createSsl:a.ChannelCredentials.createSsl,createFromSecureContext:a.ChannelCredentials.createFromSecureContext,createFromMetadataGenerator:r.CallCredentials.createFromMetadataGenerator,createFromGoogleCredential:r.CallCredentials.createFromGoogleCredential,createEmpty:r.CallCredentials.createEmpty};t.closeClient=e=>e.close();t.waitForClientReady=(e,t,n)=>e.waitForReady(t,n);t.loadObject=(e,t)=>{throw new Error("Not available in this library. Use @grpc/proto-loader and loadPackageDefinition instead")};t.load=(e,t,n)=>{throw new Error("Not available in this library. Use @grpc/proto-loader and loadPackageDefinition instead")};t.setLogger=e=>{h.setLogger(e)};t.setLogVerbosity=e=>{h.setLoggerVerbosity(e)};t.getClientChannel=e=>c.Client.prototype.getChannel.call(e);var m=n(3952);Object.defineProperty(t,"ListenerBuilder",{enumerable:!0,get:function(){return m.ListenerBuilder}}),Object.defineProperty(t,"RequesterBuilder",{enumerable:!0,get:function(){return m.RequesterBuilder}}),Object.defineProperty(t,"InterceptingCall",{enumerable:!0,get:function(){return m.InterceptingCall}}),Object.defineProperty(t,"InterceptorConfigurationError",{enumerable:!0,get:function(){return m.InterceptorConfigurationError}});var _=n(9503);Object.defineProperty(t,"getChannelzServiceDefinition",{enumerable:!0,get:function(){return _.getChannelzServiceDefinition}}),Object.defineProperty(t,"getChannelzHandlers",{enumerable:!0,get:function(){return _.getChannelzHandlers}});var y=n(2661);Object.defineProperty(t,"addAdminServicesToServer",{enumerable:!0,get:function(){return y.addAdminServicesToServer}});var v=n(4892);Object.defineProperty(t,"ServerListenerBuilder",{enumerable:!0,get:function(){return v.ServerListenerBuilder}}),Object.defineProperty(t,"ResponderBuilder",{enumerable:!0,get:function(){return v.ResponderBuilder}}),Object.defineProperty(t,"ServerInterceptingCall",{enumerable:!0,get:function(){return v.ServerInterceptingCall}});var b=n(2921);Object.defineProperty(t,"ServerMetricRecorder",{enumerable:!0,get:function(){return b.ServerMetricRecorder}});const E=n(342);t.experimental=E;const A=n(6700),S=n(305),w=n(82),C=n(6486),I=n(1563),k=n(9012),T=n(4117),R=n(9503);A.setup(),S.setup(),w.setup(),C.setup(),I.setup(),k.setup(),T.setup(),R.setup()},8899(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.InternalChannel=t.SUBCHANNEL_ARGS_EXCLUDE_KEY_PREFIX=void 0;const r=n(7434),i=n(4973),s=n(5716),o=n(178),a=n(4097),c=n(131),l=n(1703),h=n(4987),u=n(9302),d=n(267),f=n(7803),p=n(3822),g=n(463),m=n(9503),_=n(2611),y=n(6308),v=n(8446),b=n(5572),E=n(6067),A=n(3135),S=n(2379),w=new Map;class C extends S.BaseSubchannelWrapper{constructor(e,t){super(e),this.channel=t,this.refCount=0,this.subchannelStateListener=(e,n,r,i)=>{t.throttleKeepalive(i)}}ref(){0===this.refCount&&(this.child.addConnectivityStateListener(this.subchannelStateListener),this.channel.addWrappedSubchannel(this)),this.child.ref(),this.refCount+=1}unref(){this.child.unref(),this.refCount-=1,this.refCount<=0&&(this.child.removeConnectivityStateListener(this.subchannelStateListener),this.channel.removeWrappedSubchannel(this))}}class I{pick(e){return{pickResultType:o.PickResultType.DROP,status:{code:c.Status.UNAVAILABLE,details:"Channel closed before call started",metadata:new a.Metadata},subchannel:null,onCallStarted:null,onCallEnded:null}}}t.SUBCHANNEL_ARGS_EXCLUDE_KEY_PREFIX="grpc.internal.no_subchannel";class k{constructor(e){this.target=e,this.trace=new m.ChannelzTrace,this.callTracker=new m.ChannelzCallTracker,this.childrenTracker=new m.ChannelzChildrenTracker,this.state=g.ConnectivityState.IDLE}getChannelzInfoCallback(){return()=>({target:this.target,state:this.state,trace:this.trace,callTracker:this.callTracker,children:this.childrenTracker.getChildLists()})}}t.InternalChannel=class{constructor(e,n,a){var _,y,v,b,S,I;if(this.credentials=n,this.options=a,this.connectivityState=g.ConnectivityState.IDLE,this.currentPicker=new o.UnavailablePicker,this.configSelectionQueue=[],this.pickQueue=[],this.connectivityStateWatchers=[],this.callRefTimer=null,this.configSelector=null,this.currentResolutionError=null,this.wrappedSubchannels=new Set,this.callCount=0,this.idleTimer=null,this.channelzEnabled=!0,this.randomChannelId=Math.floor(Math.random()*Number.MAX_SAFE_INTEGER),"string"!=typeof e)throw new TypeError("Channel target must be a string");if(!(n instanceof r.ChannelCredentials))throw new TypeError("Channel credentials must be a ChannelCredentials object");if(a&&"object"!=typeof a)throw new TypeError("Channel options must be an object");this.channelzInfoTracker=new k(e);const T=(0,p.parseUri)(e);if(null===T)throw new Error(`Could not parse target name "${e}"`);const R=(0,u.mapUriDefaultScheme)(T);if(null===R)throw new Error(`Could not find a default scheme for target name "${e}"`);0===this.options["grpc.enable_channelz"]&&(this.channelzEnabled=!1),this.channelzRef=(0,m.registerChannelzChannel)(e,this.channelzInfoTracker.getChannelzInfoCallback(),this.channelzEnabled),this.channelzEnabled&&this.channelzInfoTracker.trace.addTrace("CT_INFO","Channel created"),this.options["grpc.default_authority"]?this.defaultAuthority=this.options["grpc.default_authority"]:this.defaultAuthority=(0,u.getDefaultAuthority)(R);const O=(0,f.mapProxyName)(R,a);this.target=O.target,this.options=Object.assign({},this.options,O.extraOptions),this.subchannelPool=(0,s.getSubchannelPool)(0===(null!==(_=this.options["grpc.use_local_subchannel_pool"])&&void 0!==_?_:0)),this.retryBufferTracker=new A.MessageBufferTracker(null!==(y=this.options["grpc.retry_buffer_size"])&&void 0!==y?y:16777216,null!==(v=this.options["grpc.per_rpc_retry_buffer_size"])&&void 0!==v?v:1048576),this.keepaliveTime=null!==(b=this.options["grpc.keepalive_time_ms"])&&void 0!==b?b:-1,this.idleTimeoutMs=Math.max(null!==(S=this.options["grpc.client_idle_timeout_ms"])&&void 0!==S?S:18e5,1e3);const N={createSubchannel:(e,n)=>{const r={};for(const[e,i]of Object.entries(n))e.startsWith(t.SUBCHANNEL_ARGS_EXCLUDE_KEY_PREFIX)||(r[e]=i);const i=this.subchannelPool.getOrCreateSubchannel(this.target,e,r,this.credentials);i.throttleKeepalive(this.keepaliveTime),this.channelzEnabled&&this.channelzInfoTracker.trace.addTrace("CT_INFO","Created subchannel or used existing subchannel",i.getChannelzRef());return new C(i,this)},updateState:(e,t)=>{this.currentPicker=t;const n=this.pickQueue.slice();this.pickQueue=[],n.length>0&&this.callRefTimerUnref();for(const e of n)e.doPick();this.updateState(e)},requestReresolution:()=>{throw new Error("Resolving load balancer should never call requestReresolution")},addChannelzChild:e=>{this.channelzEnabled&&this.channelzInfoTracker.childrenTracker.refChild(e)},removeChannelzChild:e=>{this.channelzEnabled&&this.channelzInfoTracker.childrenTracker.unrefChild(e)}};this.resolvingLoadBalancer=new i.ResolvingLoadBalancer(this.target,N,this.options,(e,t)=>{var n;e.retryThrottling?w.set(this.getTarget(),new A.RetryThrottler(e.retryThrottling.maxTokens,e.retryThrottling.tokenRatio,w.get(this.getTarget()))):w.delete(this.getTarget()),this.channelzEnabled&&this.channelzInfoTracker.trace.addTrace("CT_INFO","Address resolution succeeded"),null===(n=this.configSelector)||void 0===n||n.unref(),this.configSelector=t,this.currentResolutionError=null,process.nextTick(()=>{const e=this.configSelectionQueue;this.configSelectionQueue=[],e.length>0&&this.callRefTimerUnref();for(const t of e)t.getConfig()})},e=>{this.channelzEnabled&&this.channelzInfoTracker.trace.addTrace("CT_WARNING","Address resolution failed with code "+e.code+' and details "'+e.details+'"'),this.configSelectionQueue.length>0&&this.trace("Name resolution failed with calls queued for config selection"),null===this.configSelector&&(this.currentResolutionError=Object.assign(Object.assign({},(0,E.restrictControlPlaneStatusCode)(e.code,e.details)),{metadata:e.metadata}));const t=this.configSelectionQueue;this.configSelectionQueue=[],t.length>0&&this.callRefTimerUnref();for(const n of t)n.reportResolverError(e)}),this.filterStackFactory=new l.FilterStackFactory([new h.CompressionFilterFactory(this,this.options)]),this.trace("Channel constructed with options "+JSON.stringify(a,void 0,2));const P=new Error;(0,d.isTracerEnabled)("channel_stacktrace")&&(0,d.trace)(c.LogVerbosity.DEBUG,"channel_stacktrace","("+this.channelzRef.id+") Channel constructed \n"+(null===(I=P.stack)||void 0===I?void 0:I.substring(P.stack.indexOf("\n")+1))),this.lastActivityTimestamp=new Date}trace(e,t){(0,d.trace)(null!=t?t:c.LogVerbosity.DEBUG,"channel","("+this.channelzRef.id+") "+(0,p.uriToString)(this.target)+" "+e)}callRefTimerRef(){var e,t,n,r;this.callRefTimer||(this.callRefTimer=setInterval(()=>{},2147483647)),(null===(t=(e=this.callRefTimer).hasRef)||void 0===t?void 0:t.call(e))||(this.trace("callRefTimer.ref | configSelectionQueue.length="+this.configSelectionQueue.length+" pickQueue.length="+this.pickQueue.length),null===(r=(n=this.callRefTimer).ref)||void 0===r||r.call(n))}callRefTimerUnref(){var e,t,n;(null===(e=this.callRefTimer)||void 0===e?void 0:e.hasRef)&&!this.callRefTimer.hasRef()||(this.trace("callRefTimer.unref | configSelectionQueue.length="+this.configSelectionQueue.length+" pickQueue.length="+this.pickQueue.length),null===(n=null===(t=this.callRefTimer)||void 0===t?void 0:t.unref)||void 0===n||n.call(t))}removeConnectivityStateWatcher(e){const t=this.connectivityStateWatchers.findIndex(t=>t===e);t>=0&&this.connectivityStateWatchers.splice(t,1)}updateState(e){(0,d.trace)(c.LogVerbosity.DEBUG,"connectivity_state","("+this.channelzRef.id+") "+(0,p.uriToString)(this.target)+" "+g.ConnectivityState[this.connectivityState]+" -> "+g.ConnectivityState[e]),this.channelzEnabled&&this.channelzInfoTracker.trace.addTrace("CT_INFO","Connectivity state change to "+g.ConnectivityState[e]),this.connectivityState=e,this.channelzInfoTracker.state=e;const t=this.connectivityStateWatchers.slice();for(const n of t)e!==n.currentState&&(n.timer&&clearTimeout(n.timer),this.removeConnectivityStateWatcher(n),n.callback());e!==g.ConnectivityState.TRANSIENT_FAILURE&&(this.currentResolutionError=null)}throttleKeepalive(e){if(e>this.keepaliveTime){this.keepaliveTime=e;for(const t of this.wrappedSubchannels)t.throttleKeepalive(e)}}addWrappedSubchannel(e){this.wrappedSubchannels.add(e)}removeWrappedSubchannel(e){this.wrappedSubchannels.delete(e)}doPick(e,t){return this.currentPicker.pick({metadata:e,extraPickInfo:t})}queueCallForPick(e){this.pickQueue.push(e),this.callRefTimerRef()}getConfig(e,t){return this.connectivityState!==g.ConnectivityState.SHUTDOWN&&this.resolvingLoadBalancer.exitIdle(),this.configSelector?{type:"SUCCESS",config:this.configSelector.invoke(e,t,this.randomChannelId)}:this.currentResolutionError?{type:"ERROR",error:this.currentResolutionError}:{type:"NONE"}}queueCallForConfig(e){this.configSelectionQueue.push(e),this.callRefTimerRef()}enterIdle(){this.resolvingLoadBalancer.destroy(),this.updateState(g.ConnectivityState.IDLE),this.currentPicker=new o.QueuePicker(this.resolvingLoadBalancer),this.idleTimer&&(clearTimeout(this.idleTimer),this.idleTimer=null),this.callRefTimer&&(clearInterval(this.callRefTimer),this.callRefTimer=null)}startIdleTimeout(e){var t,n;this.idleTimer=setTimeout(()=>{if(this.callCount>0)return void this.startIdleTimeout(this.idleTimeoutMs);const e=(new Date).valueOf()-this.lastActivityTimestamp.valueOf();e>=this.idleTimeoutMs?(this.trace("Idle timer triggered after "+this.idleTimeoutMs+"ms of inactivity"),this.enterIdle()):this.startIdleTimeout(this.idleTimeoutMs-e)},e),null===(n=(t=this.idleTimer).unref)||void 0===n||n.call(t)}maybeStartIdleTimer(){this.connectivityState===g.ConnectivityState.SHUTDOWN||this.idleTimer||this.startIdleTimeout(this.idleTimeoutMs)}onCallStart(){this.channelzEnabled&&this.channelzInfoTracker.callTracker.addCallStarted(),this.callCount+=1}onCallEnd(e){this.channelzEnabled&&(e.code===c.Status.OK?this.channelzInfoTracker.callTracker.addCallSucceeded():this.channelzInfoTracker.callTracker.addCallFailed()),this.callCount-=1,this.lastActivityTimestamp=new Date,this.maybeStartIdleTimer()}createLoadBalancingCall(e,t,n,r,i){const s=(0,b.getNextCallNumber)();return this.trace("createLoadBalancingCall ["+s+'] method="'+t+'"'),new _.LoadBalancingCall(this,e,t,n,r,i,s)}createRetryingCall(e,t,n,r,i){const s=(0,b.getNextCallNumber)();return this.trace("createRetryingCall ["+s+'] method="'+t+'"'),new A.RetryingCall(this,e,t,n,r,i,s,this.retryBufferTracker,w.get(this.getTarget()))}createResolvingCall(e,t,n,r,i){const s=(0,b.getNextCallNumber)();this.trace("createResolvingCall ["+s+'] method="'+e+'", deadline='+(0,y.deadlineToString)(t));const o={deadline:t,flags:null!=i?i:c.Propagate.DEFAULTS,host:null!=n?n:this.defaultAuthority,parentCall:r},a=new v.ResolvingCall(this,e,o,this.filterStackFactory.clone(),s);return this.onCallStart(),a.addStatusWatcher(e=>{this.onCallEnd(e)}),a}close(){var e;this.resolvingLoadBalancer.destroy(),this.updateState(g.ConnectivityState.SHUTDOWN),this.currentPicker=new I;for(const e of this.configSelectionQueue)e.cancelWithStatus(c.Status.UNAVAILABLE,"Channel closed before call started");this.configSelectionQueue=[];for(const e of this.pickQueue)e.cancelWithStatus(c.Status.UNAVAILABLE,"Channel closed before call started");this.pickQueue=[],this.callRefTimer&&clearInterval(this.callRefTimer),this.idleTimer&&clearTimeout(this.idleTimer),this.channelzEnabled&&(0,m.unregisterChannelzRef)(this.channelzRef),this.subchannelPool.unrefUnusedSubchannels(),null===(e=this.configSelector)||void 0===e||e.unref(),this.configSelector=null}getTarget(){return(0,p.uriToString)(this.target)}getConnectivityState(e){const t=this.connectivityState;return e&&(this.resolvingLoadBalancer.exitIdle(),this.lastActivityTimestamp=new Date,this.maybeStartIdleTimer()),t}watchConnectivityState(e,t,n){if(this.connectivityState===g.ConnectivityState.SHUTDOWN)throw new Error("Channel has been shut down");let r=null;if(t!==1/0){const e=t instanceof Date?t:new Date(t),s=new Date;if(t===-1/0||e<=s)return void process.nextTick(n,new Error("Deadline passed without connectivity state change"));r=setTimeout(()=>{this.removeConnectivityStateWatcher(i),n(new Error("Deadline passed without connectivity state change"))},e.getTime()-s.getTime())}const i={currentState:e,callback:n,timer:r};this.connectivityStateWatchers.push(i)}getChannelzRef(){return this.channelzRef}createCall(e,t,n,r,i){if("string"!=typeof e)throw new TypeError("Channel#createCall: method must be a string");if(!("number"==typeof t||t instanceof Date))throw new TypeError("Channel#createCall: deadline must be a number or Date");if(this.connectivityState===g.ConnectivityState.SHUTDOWN)throw new Error("Channel has been shut down");return this.createResolvingCall(e,t,n,r,i)}getOptions(){return this.options}}},533(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ChildLoadBalancerHandler=void 0;const r=n(8923),i=n(463);t.ChildLoadBalancerHandler=class{constructor(e){this.channelControlHelper=e,this.currentChild=null,this.pendingChild=null,this.latestConfig=null,this.ChildPolicyHelper=class{constructor(e){this.parent=e,this.child=null}createSubchannel(e,t){return this.parent.channelControlHelper.createSubchannel(e,t)}updateState(e,t,n){var r;if(this.calledByPendingChild()){if(e===i.ConnectivityState.CONNECTING)return;null===(r=this.parent.currentChild)||void 0===r||r.destroy(),this.parent.currentChild=this.parent.pendingChild,this.parent.pendingChild=null}else if(!this.calledByCurrentChild())return;this.parent.channelControlHelper.updateState(e,t,n)}requestReresolution(){var e;const t=null!==(e=this.parent.pendingChild)&&void 0!==e?e:this.parent.currentChild;this.child===t&&this.parent.channelControlHelper.requestReresolution()}setChild(e){this.child=e}addChannelzChild(e){this.parent.channelControlHelper.addChannelzChild(e)}removeChannelzChild(e){this.parent.channelControlHelper.removeChannelzChild(e)}calledByPendingChild(){return this.child===this.parent.pendingChild}calledByCurrentChild(){return this.child===this.parent.currentChild}}}configUpdateRequiresNewPolicyInstance(e,t){return e.getLoadBalancerName()!==t.getLoadBalancerName()}updateAddressList(e,t,n,i){let s;if(null===this.currentChild||null===this.latestConfig||this.configUpdateRequiresNewPolicyInstance(this.latestConfig,t)){const e=new this.ChildPolicyHelper(this),n=(0,r.createLoadBalancer)(t,e);e.setChild(n),null===this.currentChild?(this.currentChild=n,s=this.currentChild):(this.pendingChild&&this.pendingChild.destroy(),this.pendingChild=n,s=this.pendingChild)}else s=null===this.pendingChild?this.currentChild:this.pendingChild;return this.latestConfig=t,s.updateAddressList(e,t,n,i)}exitIdle(){this.currentChild&&(this.currentChild.exitIdle(),this.pendingChild&&this.pendingChild.exitIdle())}resetBackoff(){this.currentChild&&(this.currentChild.resetBackoff(),this.pendingChild&&this.pendingChild.resetBackoff())}destroy(){this.currentChild&&(this.currentChild.destroy(),this.currentChild=null),this.pendingChild&&(this.pendingChild.destroy(),this.pendingChild=null)}getTypeName(){return"child_load_balancer_helper"}}},9012(e,t,n){"use strict";var r;Object.defineProperty(t,"__esModule",{value:!0}),t.OutlierDetectionLoadBalancer=t.OutlierDetectionLoadBalancingConfig=void 0,t.setup=function(){m&&(0,a.registerLoadBalancerType)(g,I,A)};const i=n(463),s=n(131),o=n(4700),a=n(342),c=n(8923),l=n(533),h=n(178),u=n(8996),d=n(2379),f=n(267);function p(e){f.trace(s.LogVerbosity.DEBUG,"outlier_detection",e)}const g="outlier_detection",m="true"===(null!==(r=process.env.GRPC_EXPERIMENTAL_ENABLE_OUTLIER_DETECTION)&&void 0!==r?r:"true"),_={stdev_factor:1900,enforcement_percentage:100,minimum_hosts:5,request_volume:100},y={threshold:85,enforcement_percentage:100,minimum_hosts:5,request_volume:50};function v(e,t,n,r){if(t in e&&void 0!==e[t]&&typeof e[t]!==n){throw new Error(`outlier detection config ${r?`${r}.${t}`:t} parse error: expected ${n}, got ${typeof e[t]}`)}}function b(e,t,n){const r=n?`${n}.${t}`:t;if(t in e&&void 0!==e[t]){if(!(0,o.isDuration)(e[t]))throw new Error(`outlier detection config ${r} parse error: expected Duration, got ${typeof e[t]}`);if(!(e[t].seconds>=0&&e[t].seconds<=315576e6&&e[t].nanos>=0&&e[t].nanos<=999999999))throw new Error(`outlier detection config ${r} parse error: values out of range for non-negative Duaration`)}}function E(e,t,n){const r=n?`${n}.${t}`:t;if(v(e,t,"number",n),t in e&&void 0!==e[t]&&!(e[t]>=0&&e[t]<=100))throw new Error(`outlier detection config ${r} parse error: value out of range for percentage (0-100)`)}class A{constructor(e,t,n,r,i,s,o){if(this.childPolicy=o,"pick_first"===o.getLoadBalancerName())throw new Error("outlier_detection LB policy cannot have a pick_first child policy");this.intervalMs=null!=e?e:1e4,this.baseEjectionTimeMs=null!=t?t:3e4,this.maxEjectionTimeMs=null!=n?n:3e5,this.maxEjectionPercent=null!=r?r:10,this.successRateEjection=i?Object.assign(Object.assign({},_),i):null,this.failurePercentageEjection=s?Object.assign(Object.assign({},y),s):null}getLoadBalancerName(){return g}toJsonObject(){var e,t;return{outlier_detection:{interval:(0,o.msToDuration)(this.intervalMs),base_ejection_time:(0,o.msToDuration)(this.baseEjectionTimeMs),max_ejection_time:(0,o.msToDuration)(this.maxEjectionTimeMs),max_ejection_percent:this.maxEjectionPercent,success_rate_ejection:null!==(e=this.successRateEjection)&&void 0!==e?e:void 0,failure_percentage_ejection:null!==(t=this.failurePercentageEjection)&&void 0!==t?t:void 0,child_policy:[this.childPolicy.toJsonObject()]}}}getIntervalMs(){return this.intervalMs}getBaseEjectionTimeMs(){return this.baseEjectionTimeMs}getMaxEjectionTimeMs(){return this.maxEjectionTimeMs}getMaxEjectionPercent(){return this.maxEjectionPercent}getSuccessRateEjectionConfig(){return this.successRateEjection}getFailurePercentageEjectionConfig(){return this.failurePercentageEjection}getChildPolicy(){return this.childPolicy}static createFromJson(e){var t;if(b(e,"interval"),b(e,"base_ejection_time"),b(e,"max_ejection_time"),E(e,"max_ejection_percent"),"success_rate_ejection"in e&&void 0!==e.success_rate_ejection){if("object"!=typeof e.success_rate_ejection)throw new Error("outlier detection config success_rate_ejection must be an object");v(e.success_rate_ejection,"stdev_factor","number","success_rate_ejection"),E(e.success_rate_ejection,"enforcement_percentage","success_rate_ejection"),v(e.success_rate_ejection,"minimum_hosts","number","success_rate_ejection"),v(e.success_rate_ejection,"request_volume","number","success_rate_ejection")}if("failure_percentage_ejection"in e&&void 0!==e.failure_percentage_ejection){if("object"!=typeof e.failure_percentage_ejection)throw new Error("outlier detection config failure_percentage_ejection must be an object");E(e.failure_percentage_ejection,"threshold","failure_percentage_ejection"),E(e.failure_percentage_ejection,"enforcement_percentage","failure_percentage_ejection"),v(e.failure_percentage_ejection,"minimum_hosts","number","failure_percentage_ejection"),v(e.failure_percentage_ejection,"request_volume","number","failure_percentage_ejection")}if(!("child_policy"in e)||!Array.isArray(e.child_policy))throw new Error("outlier detection config child_policy must be an array");const n=(0,c.selectLbConfigFromList)(e.child_policy);if(!n)throw new Error("outlier detection config child_policy: no valid recognized policy found");return new A(e.interval?(0,o.durationToMs)(e.interval):null,e.base_ejection_time?(0,o.durationToMs)(e.base_ejection_time):null,e.max_ejection_time?(0,o.durationToMs)(e.max_ejection_time):null,null!==(t=e.max_ejection_percent)&&void 0!==t?t:null,e.success_rate_ejection,e.failure_percentage_ejection,n)}}t.OutlierDetectionLoadBalancingConfig=A;class S extends d.BaseSubchannelWrapper{constructor(e,t){super(e),this.mapEntry=t,this.refCount=0}ref(){this.child.ref(),this.refCount+=1}unref(){if(this.child.unref(),this.refCount-=1,this.refCount<=0&&this.mapEntry){const e=this.mapEntry.subchannelWrappers.indexOf(this);e>=0&&this.mapEntry.subchannelWrappers.splice(e,1)}}eject(){this.setHealthy(!1)}uneject(){this.setHealthy(!0)}getMapEntry(){return this.mapEntry}getWrappedSubchannel(){return this.child}}class w{constructor(){this.activeBucket={success:0,failure:0},this.inactiveBucket={success:0,failure:0}}addSuccess(){this.activeBucket.success+=1}addFailure(){this.activeBucket.failure+=1}switchBuckets(){this.inactiveBucket=this.activeBucket,this.activeBucket={success:0,failure:0}}getLastSuccesses(){return this.inactiveBucket.success}getLastFailures(){return this.inactiveBucket.failure}}class C{constructor(e,t){this.wrappedPicker=e,this.countCalls=t}pick(e){const t=this.wrappedPicker.pick(e);if(t.pickResultType===h.PickResultType.COMPLETE){const e=t.subchannel,n=e.getMapEntry();if(n){let r=t.onCallEnded;return this.countCalls&&(r=(e,r,i)=>{var o;e===s.Status.OK?n.counter.addSuccess():n.counter.addFailure(),null===(o=t.onCallEnded)||void 0===o||o.call(t,e,r,i)}),Object.assign(Object.assign({},t),{subchannel:e.getWrappedSubchannel(),onCallEnded:r})}return Object.assign(Object.assign({},t),{subchannel:e.getWrappedSubchannel()})}return t}}class I{constructor(e){this.entryMap=new u.EndpointMap,this.latestConfig=null,this.timerStartTime=null,this.childBalancer=new l.ChildLoadBalancerHandler((0,a.createChildChannelControlHelper)(e,{createSubchannel:(t,n)=>{const r=e.createSubchannel(t,n),i=this.entryMap.getForSubchannelAddress(t),s=new S(r,i);return null!==(null==i?void 0:i.currentEjectionTimestamp)&&s.eject(),null==i||i.subchannelWrappers.push(s),s},updateState:(t,n,r)=>{t===i.ConnectivityState.READY?e.updateState(t,new C(n,this.isCountingEnabled()),r):e.updateState(t,n,r)}})),this.ejectionTimer=setInterval(()=>{},0),clearInterval(this.ejectionTimer)}isCountingEnabled(){return null!==this.latestConfig&&(null!==this.latestConfig.getSuccessRateEjectionConfig()||null!==this.latestConfig.getFailurePercentageEjectionConfig())}getCurrentEjectionPercent(){let e=0;for(const t of this.entryMap.values())null!==t.currentEjectionTimestamp&&(e+=1);return 100*e/this.entryMap.size}runSuccessRateCheck(e){if(!this.latestConfig)return;const t=this.latestConfig.getSuccessRateEjectionConfig();if(!t)return;p("Running success rate check");const n=t.request_volume;let r=0;const i=[];for(const[e,t]of this.entryMap.entries()){const s=t.counter.getLastSuccesses(),o=t.counter.getLastFailures();p("Stats for "+(0,u.endpointToString)(e)+": successes="+s+" failures="+o+" targetRequestVolume="+n),s+o>=n&&(r+=1,i.push(s/(s+o)))}if(p("Found "+r+" success rate candidates; currentEjectionPercent="+this.getCurrentEjectionPercent()+" successRates=["+i+"]"),r<t.minimum_hosts)return;const s=i.reduce((e,t)=>e+t)/i.length;let o=0;for(const e of i){const t=e-s;o+=t*t}const a=o/i.length,c=Math.sqrt(a),l=s-c*(t.stdev_factor/1e3);p("stdev="+c+" ejectionThreshold="+l);for(const[r,i]of this.entryMap.entries()){if(this.getCurrentEjectionPercent()>=this.latestConfig.getMaxEjectionPercent())break;const s=i.counter.getLastSuccesses(),o=i.counter.getLastFailures();if(s+o<n)continue;const a=s/(s+o);if(p("Checking candidate "+r+" successRate="+a),a<l){const n=100*Math.random();p("Candidate "+r+" randomNumber="+n+" enforcement_percentage="+t.enforcement_percentage),n<t.enforcement_percentage&&(p("Ejecting candidate "+r),this.eject(i,e))}}}runFailurePercentageCheck(e){if(!this.latestConfig)return;const t=this.latestConfig.getFailurePercentageEjectionConfig();if(!t)return;p("Running failure percentage check. threshold="+t.threshold+" request volume threshold="+t.request_volume);let n=0;for(const e of this.entryMap.values()){e.counter.getLastSuccesses()+e.counter.getLastFailures()>=t.request_volume&&(n+=1)}if(!(n<t.minimum_hosts))for(const[n,r]of this.entryMap.entries()){if(this.getCurrentEjectionPercent()>=this.latestConfig.getMaxEjectionPercent())break;const i=r.counter.getLastSuccesses(),s=r.counter.getLastFailures();if(p("Candidate successes="+i+" failures="+s),i+s<t.request_volume)continue;if(100*s/(s+i)>t.threshold){const i=100*Math.random();p("Candidate "+n+" randomNumber="+i+" enforcement_percentage="+t.enforcement_percentage),i<t.enforcement_percentage&&(p("Ejecting candidate "+n),this.eject(r,e))}}}eject(e,t){e.currentEjectionTimestamp=new Date,e.ejectionTimeMultiplier+=1;for(const t of e.subchannelWrappers)t.eject()}uneject(e){e.currentEjectionTimestamp=null;for(const t of e.subchannelWrappers)t.uneject()}switchAllBuckets(){for(const e of this.entryMap.values())e.counter.switchBuckets()}startTimer(e){var t,n;this.ejectionTimer=setTimeout(()=>this.runChecks(),e),null===(n=(t=this.ejectionTimer).unref)||void 0===n||n.call(t)}runChecks(){const e=new Date;if(p("Ejection timer running"),this.switchAllBuckets(),this.latestConfig){this.timerStartTime=e,this.startTimer(this.latestConfig.getIntervalMs()),this.runSuccessRateCheck(e),this.runFailurePercentageCheck(e);for(const[e,t]of this.entryMap.entries())if(null===t.currentEjectionTimestamp)t.ejectionTimeMultiplier>0&&(t.ejectionTimeMultiplier-=1);else{const n=this.latestConfig.getBaseEjectionTimeMs(),r=this.latestConfig.getMaxEjectionTimeMs(),i=new Date(t.currentEjectionTimestamp.getTime());i.setMilliseconds(i.getMilliseconds()+Math.min(n*t.ejectionTimeMultiplier,Math.max(n,r))),i<new Date&&(p("Unejecting "+e),this.uneject(t))}}}updateAddressList(e,t,n,r){if(!(t instanceof A))return!1;if(p("Received update with config: "+JSON.stringify(t.toJsonObject(),void 0,2)),e.ok){for(const t of e.value)this.entryMap.has(t)||(p("Adding map entry for "+(0,u.endpointToString)(t)),this.entryMap.set(t,{counter:new w,currentEjectionTimestamp:null,ejectionTimeMultiplier:0,subchannelWrappers:[]}));this.entryMap.deleteMissing(e.value)}const i=t.getChildPolicy();if(this.childBalancer.updateAddressList(e,i,n,r),t.getSuccessRateEjectionConfig()||t.getFailurePercentageEjectionConfig())if(this.timerStartTime){p("Previous timer existed. Replacing timer"),clearTimeout(this.ejectionTimer);const e=t.getIntervalMs()-((new Date).getTime()-this.timerStartTime.getTime());this.startTimer(e)}else p("Starting new timer"),this.timerStartTime=new Date,this.startTimer(t.getIntervalMs()),this.switchAllBuckets();else{p("Counting disabled. Cancelling timer."),this.timerStartTime=null,clearTimeout(this.ejectionTimer);for(const e of this.entryMap.values())this.uneject(e),e.ejectionTimeMultiplier=0}return this.latestConfig=t,!0}exitIdle(){this.childBalancer.exitIdle()}resetBackoff(){this.childBalancer.resetBackoff()}destroy(){clearTimeout(this.ejectionTimer),this.childBalancer.destroy()}getTypeName(){return g}}t.OutlierDetectionLoadBalancer=I},6486(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.LeafLoadBalancer=t.PickFirstLoadBalancer=t.PickFirstLoadBalancingConfig=void 0,t.shuffled=m,t.setup=function(){(0,r.registerLoadBalancerType)(f,y,p),(0,r.registerDefaultLoadBalancerType)(f)};const r=n(8923),i=n(463),s=n(178),o=n(8996),a=n(267),c=n(131),l=n(8996),h=n(9278),u=n(5034);function d(e){a.trace(c.LogVerbosity.DEBUG,"pick_first",e)}const f="pick_first";class p{constructor(e){this.shuffleAddressList=e}getLoadBalancerName(){return f}toJsonObject(){return{[f]:{shuffleAddressList:this.shuffleAddressList}}}getShuffleAddressList(){return this.shuffleAddressList}static createFromJson(e){if("shuffleAddressList"in e&&"boolean"!=typeof e.shuffleAddressList)throw new Error("pick_first config field shuffleAddressList must be a boolean if provided");return new p(!0===e.shuffleAddressList)}}t.PickFirstLoadBalancingConfig=p;class g{constructor(e){this.subchannel=e}pick(e){return{pickResultType:s.PickResultType.COMPLETE,subchannel:this.subchannel,status:null,onCallStarted:null,onCallEnded:null}}}function m(e){const t=e.slice();for(let e=t.length-1;e>1;e--){const n=Math.floor(Math.random()*(e+1)),r=t[e];t[e]=t[n],t[n]=r}return t}const _="grpc-node.internal.pick-first.report_health_status";class y{constructor(e){this.channelControlHelper=e,this.children=[],this.currentState=i.ConnectivityState.IDLE,this.currentSubchannelIndex=0,this.currentPick=null,this.subchannelStateListener=(e,t,n,r,i)=>{this.onSubchannelStateUpdate(e,t,n,i)},this.pickedSubchannelHealthListener=()=>this.calculateAndReportNewState(),this.stickyTransientFailureMode=!1,this.reportHealthStatus=!1,this.lastError=null,this.latestAddressList=null,this.latestOptions={},this.latestResolutionNote="",this.connectionDelayTimeout=setTimeout(()=>{},0),clearTimeout(this.connectionDelayTimeout)}allChildrenHaveReportedTF(){return this.children.every(e=>e.hasReportedTransientFailure)}resetChildrenReportedTF(){this.children.every(e=>e.hasReportedTransientFailure=!1)}calculateAndReportNewState(){var e;if(this.currentPick)if(this.reportHealthStatus&&!this.currentPick.isHealthy()){const e=`Picked subchannel ${this.currentPick.getAddress()} is unhealthy`;this.updateState(i.ConnectivityState.TRANSIENT_FAILURE,new s.UnavailablePicker({details:e}),e)}else this.updateState(i.ConnectivityState.READY,new g(this.currentPick),null);else if(0===(null===(e=this.latestAddressList)||void 0===e?void 0:e.length)){const e=`No connection established. Last error: ${this.lastError}. Resolution note: ${this.latestResolutionNote}`;this.updateState(i.ConnectivityState.TRANSIENT_FAILURE,new s.UnavailablePicker({details:e}),e)}else if(0===this.children.length)this.updateState(i.ConnectivityState.IDLE,new s.QueuePicker(this),null);else if(this.stickyTransientFailureMode){const e=`No connection established. Last error: ${this.lastError}. Resolution note: ${this.latestResolutionNote}`;this.updateState(i.ConnectivityState.TRANSIENT_FAILURE,new s.UnavailablePicker({details:e}),e)}else this.updateState(i.ConnectivityState.CONNECTING,new s.QueuePicker(this),null)}requestReresolution(){this.channelControlHelper.requestReresolution()}maybeEnterStickyTransientFailureMode(){if(this.allChildrenHaveReportedTF())if(this.requestReresolution(),this.resetChildrenReportedTF(),this.stickyTransientFailureMode)this.calculateAndReportNewState();else{this.stickyTransientFailureMode=!0;for(const{subchannel:e}of this.children)e.startConnecting();this.calculateAndReportNewState()}}removeCurrentPick(){null!==this.currentPick&&(this.currentPick.removeConnectivityStateListener(this.subchannelStateListener),this.channelControlHelper.removeChannelzChild(this.currentPick.getChannelzRef()),this.currentPick.removeHealthStateWatcher(this.pickedSubchannelHealthListener),this.currentPick.unref(),this.currentPick=null)}onSubchannelStateUpdate(e,t,n,r){var s;if(null===(s=this.currentPick)||void 0===s?void 0:s.realSubchannelEquals(e))n!==i.ConnectivityState.READY&&(this.removeCurrentPick(),this.calculateAndReportNewState());else for(const[t,s]of this.children.entries())if(e.realSubchannelEquals(s.subchannel))return n===i.ConnectivityState.READY&&this.pickSubchannel(s.subchannel),n===i.ConnectivityState.TRANSIENT_FAILURE&&(s.hasReportedTransientFailure=!0,r&&(this.lastError=r),this.maybeEnterStickyTransientFailureMode(),t===this.currentSubchannelIndex&&this.startNextSubchannelConnecting(t+1)),void s.subchannel.startConnecting()}startNextSubchannelConnecting(e){clearTimeout(this.connectionDelayTimeout);for(const[t,n]of this.children.entries())if(t>=e){const e=n.subchannel.getConnectivityState();if(e===i.ConnectivityState.IDLE||e===i.ConnectivityState.CONNECTING)return void this.startConnecting(t)}this.maybeEnterStickyTransientFailureMode()}startConnecting(e){var t,n;clearTimeout(this.connectionDelayTimeout),this.currentSubchannelIndex=e,this.children[e].subchannel.getConnectivityState()===i.ConnectivityState.IDLE&&(d("Start connecting to subchannel with address "+this.children[e].subchannel.getAddress()),process.nextTick(()=>{var t;null===(t=this.children[e])||void 0===t||t.subchannel.startConnecting()})),this.connectionDelayTimeout=setTimeout(()=>{this.startNextSubchannelConnecting(e+1)},250),null===(n=(t=this.connectionDelayTimeout).unref)||void 0===n||n.call(t)}pickSubchannel(e){d("Pick subchannel with address "+e.getAddress()),this.stickyTransientFailureMode=!1,e.ref(),this.channelControlHelper.addChannelzChild(e.getChannelzRef()),this.removeCurrentPick(),this.resetSubchannelList(),e.addConnectivityStateListener(this.subchannelStateListener),e.addHealthStateWatcher(this.pickedSubchannelHealthListener),this.currentPick=e,clearTimeout(this.connectionDelayTimeout),this.calculateAndReportNewState()}updateState(e,t,n){d(i.ConnectivityState[this.currentState]+" -> "+i.ConnectivityState[e]),this.currentState=e,this.channelControlHelper.updateState(e,t,n)}resetSubchannelList(){for(const e of this.children)e.subchannel.removeConnectivityStateListener(this.subchannelStateListener),e.subchannel.unref(),this.channelControlHelper.removeChannelzChild(e.subchannel.getChannelzRef());this.currentSubchannelIndex=0,this.children=[]}connectToAddressList(e,t){d("connectToAddressList(["+e.map(e=>(0,o.subchannelAddressToString)(e))+"])");const n=e.map(e=>({subchannel:this.channelControlHelper.createSubchannel(e,t),hasReportedTransientFailure:!1}));for(const{subchannel:e}of n)if(e.getConnectivityState()===i.ConnectivityState.READY)return void this.pickSubchannel(e);for(const{subchannel:e}of n)e.ref(),this.channelControlHelper.addChannelzChild(e.getChannelzRef());this.resetSubchannelList(),this.children=n;for(const{subchannel:e}of this.children)e.addConnectivityStateListener(this.subchannelStateListener);for(const e of this.children)e.subchannel.getConnectivityState()===i.ConnectivityState.TRANSIENT_FAILURE&&(e.hasReportedTransientFailure=!0);this.startNextSubchannelConnecting(0),this.calculateAndReportNewState()}updateAddressList(e,t,n,r){if(!(t instanceof p))return!1;if(!e.ok)return 0===this.children.length&&null===this.currentPick&&this.channelControlHelper.updateState(i.ConnectivityState.TRANSIENT_FAILURE,new s.UnavailablePicker(e.error),e.error.details),!0;let a=e.value;this.reportHealthStatus=n[_],t.getShuffleAddressList()&&(a=m(a));const c=[].concat(...a.map(e=>e.addresses));d("updateAddressList(["+c.map(e=>(0,o.subchannelAddressToString)(e))+"])");const u=function(e){if(0===e.length)return[];const t=[],n=[],r=[],i=(0,l.isTcpSubchannelAddress)(e[0])&&(0,h.isIPv6)(e[0].host);for(const t of e)(0,l.isTcpSubchannelAddress)(t)&&(0,h.isIPv6)(t.host)?n.push(t):r.push(t);const s=i?n:r,o=i?r:n;for(let e=0;e<Math.max(s.length,o.length);e++)e<s.length&&t.push(s[e]),e<o.length&&t.push(o[e]);return t}(c);return this.latestAddressList=u,this.latestOptions=n,this.connectToAddressList(u,n),this.latestResolutionNote=r,c.length>0||(this.lastError="No addresses resolved",!1)}exitIdle(){this.currentState===i.ConnectivityState.IDLE&&this.latestAddressList&&this.connectToAddressList(this.latestAddressList,this.latestOptions)}resetBackoff(){}destroy(){this.resetSubchannelList(),this.removeCurrentPick()}getTypeName(){return f}}t.PickFirstLoadBalancer=y;const v=new p(!1);t.LeafLoadBalancer=class{constructor(e,t,n,o){this.endpoint=e,this.options=n,this.resolutionNote=o,this.latestState=i.ConnectivityState.IDLE;const a=(0,r.createChildChannelControlHelper)(t,{updateState:(e,n,r)=>{this.latestState=e,this.latestPicker=n,t.updateState(e,n,r)}});this.pickFirstBalancer=new y(a),this.latestPicker=new s.QueuePicker(this.pickFirstBalancer)}startConnecting(){this.pickFirstBalancer.updateAddressList((0,u.statusOrFromValue)([this.endpoint]),v,Object.assign(Object.assign({},this.options),{[_]:!0}),this.resolutionNote)}updateEndpoint(e,t){this.options=t,this.endpoint=e,this.latestState!==i.ConnectivityState.IDLE&&this.startConnecting()}getConnectivityState(){return this.latestState}getPicker(){return this.latestPicker}getEndpoint(){return this.endpoint}exitIdle(){this.pickFirstBalancer.exitIdle()}destroy(){this.pickFirstBalancer.destroy()}}},1563(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.RoundRobinLoadBalancer=void 0,t.setup=function(){(0,r.registerLoadBalancerType)(u,p,d)};const r=n(8923),i=n(463),s=n(178),o=n(267),a=n(131),c=n(8996),l=n(6486);function h(e){o.trace(a.LogVerbosity.DEBUG,"round_robin",e)}const u="round_robin";class d{getLoadBalancerName(){return u}constructor(){}toJsonObject(){return{[u]:{}}}static createFromJson(e){return new d}}class f{constructor(e,t=0){this.children=e,this.nextIndex=t}pick(e){const t=this.children[this.nextIndex].picker;return this.nextIndex=(this.nextIndex+1)%this.children.length,t.pick(e)}peekNextEndpoint(){return this.children[this.nextIndex].endpoint}}class p{constructor(e){this.channelControlHelper=e,this.children=[],this.currentState=i.ConnectivityState.IDLE,this.currentReadyPicker=null,this.updatesPaused=!1,this.lastError=null,this.childChannelControlHelper=(0,r.createChildChannelControlHelper)(e,{updateState:(e,t,n)=>{this.currentState===i.ConnectivityState.READY&&e!==i.ConnectivityState.READY&&this.channelControlHelper.requestReresolution(),n&&(this.lastError=n),this.calculateAndUpdateState()}})}countChildrenWithState(e){return this.children.filter(t=>t.getConnectivityState()===e).length}calculateAndUpdateState(){if(!this.updatesPaused){if(this.countChildrenWithState(i.ConnectivityState.READY)>0){const e=this.children.filter(e=>e.getConnectivityState()===i.ConnectivityState.READY);let t=0;if(null!==this.currentReadyPicker){const n=this.currentReadyPicker.peekNextEndpoint();t=e.findIndex(e=>(0,c.endpointEqual)(e.getEndpoint(),n)),t<0&&(t=0)}this.updateState(i.ConnectivityState.READY,new f(e.map(e=>({endpoint:e.getEndpoint(),picker:e.getPicker()})),t),null)}else if(this.countChildrenWithState(i.ConnectivityState.CONNECTING)>0)this.updateState(i.ConnectivityState.CONNECTING,new s.QueuePicker(this),null);else if(this.countChildrenWithState(i.ConnectivityState.TRANSIENT_FAILURE)>0){const e=`round_robin: No connection established. Last error: ${this.lastError}`;this.updateState(i.ConnectivityState.TRANSIENT_FAILURE,new s.UnavailablePicker({details:e}),e)}else this.updateState(i.ConnectivityState.IDLE,new s.QueuePicker(this),null);for(const e of this.children)e.getConnectivityState()===i.ConnectivityState.IDLE&&e.exitIdle()}}updateState(e,t,n){h(i.ConnectivityState[this.currentState]+" -> "+i.ConnectivityState[e]),e===i.ConnectivityState.READY?this.currentReadyPicker=t:this.currentReadyPicker=null,this.currentState=e,this.channelControlHelper.updateState(e,t,n)}resetSubchannelList(){for(const e of this.children)e.destroy();this.children=[]}updateAddressList(e,t,n,r){if(!(t instanceof d))return!1;if(!e.ok)return 0===this.children.length&&this.updateState(i.ConnectivityState.TRANSIENT_FAILURE,new s.UnavailablePicker(e.error),e.error.details),!0;const o=Math.random()*e.value.length|0,a=function(e,t){return[...e.slice(t),...e.slice(0,t)]}(e.value,o);if(this.resetSubchannelList(),0===a.length){const e=`No addresses resolved. Resolution note: ${r}`;this.updateState(i.ConnectivityState.TRANSIENT_FAILURE,new s.UnavailablePicker({details:e}),e)}h("Connect to endpoint list "+a.map(c.endpointToString)),this.updatesPaused=!0,this.children=a.map(e=>new l.LeafLoadBalancer(e,this.childChannelControlHelper,n,r));for(const e of this.children)e.startConnecting();return this.updatesPaused=!1,this.calculateAndUpdateState(),!0}exitIdle(){}resetBackoff(){}destroy(){this.resetSubchannelList()}getTypeName(){return u}}t.RoundRobinLoadBalancer=p},4117(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.WeightedRoundRobinLoadBalancingConfig=void 0,t.setup=function(){(0,o.registerLoadBalancerType)(p,v,_)};const r=n(463),i=n(131),s=n(4700),o=n(8923),a=n(6486),c=n(267),l=n(2921),h=n(178),u=n(222),d=n(8996);function f(e){c.trace(i.LogVerbosity.DEBUG,"weighted_round_robin",e)}const p="weighted_round_robin";function g(e,t,n){if(t in e&&void 0!==e[t]&&typeof e[t]!==n)throw new Error(`weighted round robin config ${t} parse error: expected ${n}, got ${typeof e[t]}`)}function m(e,t){if(t in e&&void 0!==e[t]&&null!==e[t]){let n;if((0,s.isDuration)(e[t]))n=e[t];else if((0,s.isDurationMessage)(e[t]))n=(0,s.durationMessageToDuration)(e[t]);else{if("string"!=typeof e[t])throw new Error(`weighted round robin config ${t}: expected duration, got ${typeof e[t]}`);{const r=(0,s.parseDuration)(e[t]);if(!r)throw new Error(`weighted round robin config ${t}: failed to parse duration string ${e[t]}`);n=r}}return(0,s.durationToMs)(n)}return null}class _{constructor(e,t,n,r,i,s){this.enableOobLoadReport=null!=e&&e,this.oobLoadReportingPeriodMs=null!=t?t:1e4,this.blackoutPeriodMs=null!=n?n:1e4,this.weightExpirationPeriodMs=null!=r?r:18e4,this.weightUpdatePeriodMs=Math.max(null!=i?i:1e3,100),this.errorUtilizationPenalty=null!=s?s:1}getLoadBalancerName(){return p}toJsonObject(){return{enable_oob_load_report:this.enableOobLoadReport,oob_load_reporting_period:(0,s.durationToString)((0,s.msToDuration)(this.oobLoadReportingPeriodMs)),blackout_period:(0,s.durationToString)((0,s.msToDuration)(this.blackoutPeriodMs)),weight_expiration_period:(0,s.durationToString)((0,s.msToDuration)(this.weightExpirationPeriodMs)),weight_update_period:(0,s.durationToString)((0,s.msToDuration)(this.weightUpdatePeriodMs)),error_utilization_penalty:this.errorUtilizationPenalty}}static createFromJson(e){if(g(e,"enable_oob_load_report","boolean"),g(e,"error_utilization_penalty","number"),e.error_utilization_penalty<0)throw new Error("weighted round robin config error_utilization_penalty < 0");return new _(e.enable_oob_load_report,m(e,"oob_load_reporting_period"),m(e,"blackout_period"),m(e,"weight_expiration_period"),m(e,"weight_update_period"),e.error_utilization_penalty)}getEnableOobLoadReport(){return this.enableOobLoadReport}getOobLoadReportingPeriodMs(){return this.oobLoadReportingPeriodMs}getBlackoutPeriodMs(){return this.blackoutPeriodMs}getWeightExpirationPeriodMs(){return this.weightExpirationPeriodMs}getWeightUpdatePeriodMs(){return this.weightUpdatePeriodMs}getErrorUtilizationPenalty(){return this.errorUtilizationPenalty}}t.WeightedRoundRobinLoadBalancingConfig=_;class y{constructor(e,t){this.metricsHandler=t,this.queue=new u.PriorityQueue((e,t)=>e.deadline<t.deadline);const n=e.filter(e=>e.weight>0);let r;if(n.length<2)r=1;else{let e=0;for(const{weight:t}of n)e+=t;r=e/n.length}for(const t of e){const e=t.weight>0?1/t.weight:r;this.queue.push({endpointName:t.endpointName,picker:t.picker,period:e,deadline:Math.random()*e})}}pick(e){const t=this.queue.pop();this.queue.push(Object.assign(Object.assign({},t),{deadline:t.deadline+t.period}));const n=t.picker.pick(e);if(n.pickResultType===h.PickResultType.COMPLETE){if(this.metricsHandler)return Object.assign(Object.assign({},n),{onCallEnded:(0,l.createMetricsReader)(e=>this.metricsHandler(e,t.endpointName),n.onCallEnded)});{const e=n.subchannel;return Object.assign(Object.assign({},n),{subchannel:e.getWrappedSubchannel()})}}return n}}class v{constructor(e){this.channelControlHelper=e,this.latestConfig=null,this.children=new Map,this.currentState=r.ConnectivityState.IDLE,this.updatesPaused=!1,this.lastError=null,this.weightUpdateTimer=null}countChildrenWithState(e){let t=0;for(const n of this.children.values())n.child.getConnectivityState()===e&&(t+=1);return t}updateWeight(e,t){var n,r;const i=t.rps_fractional;let s=t.application_utilization;s>0&&i>0&&(s+=t.eps/i*(null!==(r=null===(n=this.latestConfig)||void 0===n?void 0:n.getErrorUtilizationPenalty())&&void 0!==r?r:0));const o=0===s?0:i/s;if(0===o)return;const a=new Date;null===e.nonEmptySince&&(e.nonEmptySince=a),e.lastUpdated=a,e.weight=o}getWeight(e){if(!this.latestConfig)return 0;const t=(new Date).getTime();if(t-e.lastUpdated.getTime()>=this.latestConfig.getWeightExpirationPeriodMs())return e.nonEmptySince=null,0;const n=this.latestConfig.getBlackoutPeriodMs();return n>0&&(null===e.nonEmptySince||t-e.nonEmptySince.getTime()<n)?0:e.weight}calculateAndUpdateState(){if(!this.updatesPaused&&this.latestConfig){if(this.countChildrenWithState(r.ConnectivityState.READY)>0){const e=[];for(const[t,n]of this.children)n.child.getConnectivityState()===r.ConnectivityState.READY&&e.push({endpointName:t,picker:n.child.getPicker(),weight:this.getWeight(n)});let t;f("Created picker with weights: "+e.map(e=>e.endpointName+":"+e.weight).join(",")),t=this.latestConfig.getEnableOobLoadReport()?null:(e,t)=>{const n=this.children.get(t);n&&this.updateWeight(n,e)},this.updateState(r.ConnectivityState.READY,new y(e,t),null)}else if(this.countChildrenWithState(r.ConnectivityState.CONNECTING)>0)this.updateState(r.ConnectivityState.CONNECTING,new h.QueuePicker(this),null);else if(this.countChildrenWithState(r.ConnectivityState.TRANSIENT_FAILURE)>0){const e=`weighted_round_robin: No connection established. Last error: ${this.lastError}`;this.updateState(r.ConnectivityState.TRANSIENT_FAILURE,new h.UnavailablePicker({details:e}),e)}else this.updateState(r.ConnectivityState.IDLE,new h.QueuePicker(this),null);for(const{child:e}of this.children.values())e.getConnectivityState()===r.ConnectivityState.IDLE&&e.exitIdle()}}updateState(e,t,n){f(r.ConnectivityState[this.currentState]+" -> "+r.ConnectivityState[e]),this.currentState=e,this.channelControlHelper.updateState(e,t,n)}updateAddressList(e,t,n,i){var s,c;if(!(t instanceof _))return!1;if(!e.ok)return 0===this.children.size&&this.updateState(r.ConnectivityState.TRANSIENT_FAILURE,new h.UnavailablePicker(e.error),e.error.details),!0;if(0===e.value.length){const e=`No addresses resolved. Resolution note: ${i}`;return this.updateState(r.ConnectivityState.TRANSIENT_FAILURE,new h.UnavailablePicker({details:e}),e),!1}f("Connect to endpoint list "+e.value.map(d.endpointToString));const u=new Date,p=new Set;this.updatesPaused=!0,this.latestConfig=t;for(const s of e.value){const e=(0,d.endpointToString)(s);p.add(e);let c=this.children.get(e);c||(c={child:new a.LeafLoadBalancer(s,(0,o.createChildChannelControlHelper)(this.channelControlHelper,{updateState:(e,t,n)=>{this.currentState===r.ConnectivityState.READY&&e!==r.ConnectivityState.READY&&this.channelControlHelper.requestReresolution(),e===r.ConnectivityState.READY&&(c.nonEmptySince=null),n&&(this.lastError=n),this.calculateAndUpdateState()},createSubchannel:(e,t)=>{const n=this.channelControlHelper.createSubchannel(e,t);return(null==c?void 0:c.oobMetricsListener)?new l.OrcaOobMetricsSubchannelWrapper(n,c.oobMetricsListener,this.latestConfig.getOobLoadReportingPeriodMs()):n}}),n,i),lastUpdated:u,nonEmptySince:null,weight:0,oobMetricsListener:null},this.children.set(e,c)),t.getEnableOobLoadReport()?c.oobMetricsListener=e=>{this.updateWeight(c,e)}:c.oobMetricsListener=null}for(const[e,t]of this.children)p.has(e)?t.child.startConnecting():(t.child.destroy(),this.children.delete(e));return this.updatesPaused=!1,this.calculateAndUpdateState(),this.weightUpdateTimer&&clearInterval(this.weightUpdateTimer),this.weightUpdateTimer=null===(c=(s=setInterval(()=>{this.currentState===r.ConnectivityState.READY&&this.calculateAndUpdateState()},t.getWeightUpdatePeriodMs())).unref)||void 0===c?void 0:c.call(s),!0}exitIdle(){}resetBackoff(){}destroy(){for(const e of this.children.values())e.child.destroy();this.children.clear(),this.weightUpdateTimer&&clearInterval(this.weightUpdateTimer)}getTypeName(){return p}}},8923(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.createChildChannelControlHelper=function(e,t){var n,r,i,s,o,a,c,l,h,u;return{createSubchannel:null!==(r=null===(n=t.createSubchannel)||void 0===n?void 0:n.bind(t))&&void 0!==r?r:e.createSubchannel.bind(e),updateState:null!==(s=null===(i=t.updateState)||void 0===i?void 0:i.bind(t))&&void 0!==s?s:e.updateState.bind(e),requestReresolution:null!==(a=null===(o=t.requestReresolution)||void 0===o?void 0:o.bind(t))&&void 0!==a?a:e.requestReresolution.bind(e),addChannelzChild:null!==(l=null===(c=t.addChannelzChild)||void 0===c?void 0:c.bind(t))&&void 0!==l?l:e.addChannelzChild.bind(e),removeChannelzChild:null!==(u=null===(h=t.removeChannelzChild)||void 0===h?void 0:h.bind(t))&&void 0!==u?u:e.removeChannelzChild.bind(e)}},t.registerLoadBalancerType=function(e,t,n){s[e]={LoadBalancer:t,LoadBalancingConfig:n}},t.registerDefaultLoadBalancerType=function(e){o=e},t.createLoadBalancer=function(e,t){const n=e.getLoadBalancerName();return n in s?new s[n].LoadBalancer(t):null},t.isLoadBalancerNameRegistered=function(e){return e in s},t.parseLoadBalancingConfig=a,t.getDefaultConfig=function(){if(!o)throw new Error("No default load balancer type registered");return new s[o].LoadBalancingConfig},t.selectLbConfigFromList=function(e,t=!1){for(const t of e)try{return a(t)}catch(e){(0,r.log)(i.LogVerbosity.DEBUG,"Config parsing failed with error",e.message);continue}return t&&o?new s[o].LoadBalancingConfig:null};const r=n(267),i=n(131);const s={};let o=null;function a(e){const t=Object.keys(e);if(1!==t.length)throw new Error("Provided load balancing config has multiple conflicting entries");const n=t[0];if(!(n in s))throw new Error(`Unrecognized load balancing config name ${n}`);try{return s[n].LoadBalancingConfig.createFromJson(e[n])}catch(e){throw new Error(`${n}: ${e.message}`)}}},2611(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.LoadBalancingCall=void 0;const r=n(463),i=n(131),s=n(6308),o=n(4097),a=n(178),c=n(3822),l=n(267),h=n(6067),u=n(5675);t.LoadBalancingCall=class{constructor(e,t,n,r,i,s,o){var a,l;this.channel=e,this.callConfig=t,this.methodName=n,this.host=r,this.credentials=i,this.deadline=s,this.callNumber=o,this.child=null,this.readPending=!1,this.pendingMessage=null,this.pendingHalfClose=!1,this.ended=!1,this.metadata=null,this.listener=null,this.onCallEnded=null,this.childStartTime=null;const h=this.methodName.split("/");let u="";h.length>=2&&(u=h[1]);const d=null!==(l=null===(a=(0,c.splitHostPort)(this.host))||void 0===a?void 0:a.host)&&void 0!==l?l:"localhost";this.serviceUrl=`https://${d}/${u}`,this.startTime=new Date}getDeadlineInfo(){var e,t;const n=[];return this.childStartTime?(this.childStartTime>this.startTime&&((null===(e=this.metadata)||void 0===e?void 0:e.getOptions().waitForReady)&&n.push("wait_for_ready"),n.push(`LB pick: ${(0,s.formatDateDifference)(this.startTime,this.childStartTime)}`)),n.push(...this.child.getDeadlineInfo()),n):((null===(t=this.metadata)||void 0===t?void 0:t.getOptions().waitForReady)&&n.push("wait_for_ready"),n.push("Waiting for LB pick"),n)}trace(e){l.trace(i.LogVerbosity.DEBUG,"load_balancing_call","["+this.callNumber+"] "+e)}outputStatus(e,t){var n,r;if(!this.ended){this.ended=!0,this.trace("ended with status: code="+e.code+' details="'+e.details+'" start time='+this.startTime.toISOString());const i=Object.assign(Object.assign({},e),{progress:t});null===(n=this.listener)||void 0===n||n.onReceiveStatus(i),null===(r=this.onCallEnded)||void 0===r||r.call(this,i.code,i.details,i.metadata)}}doPick(){var e,t;if(this.ended)return;if(!this.metadata)throw new Error("doPick called before start");this.trace("Pick called");const n=this.metadata.clone(),c=this.channel.doPick(n,this.callConfig.pickInformation),l=c.subchannel?"("+c.subchannel.getChannelzRef().id+") "+c.subchannel.getAddress():""+c.subchannel;switch(this.trace("Pick result: "+a.PickResultType[c.pickResultType]+" subchannel: "+l+" status: "+(null===(e=c.status)||void 0===e?void 0:e.code)+" "+(null===(t=c.status)||void 0===t?void 0:t.details)),c.pickResultType){case a.PickResultType.COMPLETE:this.credentials.compose(c.subchannel.getCallCredentials()).generateMetadata({method_name:this.methodName,service_url:this.serviceUrl}).then(e=>{var t;if(this.ended)this.trace("Credentials metadata generation finished after call ended");else{if(n.merge(e),n.get("authorization").length>1&&this.outputStatus({code:i.Status.INTERNAL,details:'"authorization" metadata cannot have multiple values',metadata:new o.Metadata},"PROCESSED"),c.subchannel.getConnectivityState()!==r.ConnectivityState.READY)return this.trace("Picked subchannel "+l+" has state "+r.ConnectivityState[c.subchannel.getConnectivityState()]+" after getting credentials metadata. Retrying pick"),void this.doPick();this.deadline!==1/0&&n.set("grpc-timeout",(0,s.getDeadlineTimeoutString)(this.deadline));try{this.child=c.subchannel.getRealSubchannel().createCall(n,this.host,this.methodName,{onReceiveMetadata:e=>{this.trace("Received metadata"),this.listener.onReceiveMetadata(e)},onReceiveMessage:e=>{this.trace("Received message"),this.listener.onReceiveMessage(e)},onReceiveStatus:e=>{this.trace("Received status"),e.rstCode===u.constants.NGHTTP2_REFUSED_STREAM?this.outputStatus(e,"REFUSED"):this.outputStatus(e,"PROCESSED")}}),this.childStartTime=new Date}catch(e){return this.trace("Failed to start call on picked subchannel "+l+" with error "+e.message),void this.outputStatus({code:i.Status.INTERNAL,details:"Failed to start HTTP/2 stream with error "+e.message,metadata:new o.Metadata},"NOT_STARTED")}null===(t=c.onCallStarted)||void 0===t||t.call(c),this.onCallEnded=c.onCallEnded,this.trace("Created child call ["+this.child.getCallNumber()+"]"),this.readPending&&this.child.startRead(),this.pendingMessage&&this.child.sendMessageWithContext(this.pendingMessage.context,this.pendingMessage.message),this.pendingHalfClose&&this.child.halfClose()}},e=>{const{code:t,details:n}=(0,h.restrictControlPlaneStatusCode)("number"==typeof e.code?e.code:i.Status.UNKNOWN,`Getting metadata from plugin failed with error: ${e.message}`);this.outputStatus({code:t,details:n,metadata:new o.Metadata},"PROCESSED")});break;case a.PickResultType.DROP:const{code:e,details:t}=(0,h.restrictControlPlaneStatusCode)(c.status.code,c.status.details);setImmediate(()=>{this.outputStatus({code:e,details:t,metadata:c.status.metadata},"DROP")});break;case a.PickResultType.TRANSIENT_FAILURE:if(this.metadata.getOptions().waitForReady)this.channel.queueCallForPick(this);else{const{code:e,details:t}=(0,h.restrictControlPlaneStatusCode)(c.status.code,c.status.details);setImmediate(()=>{this.outputStatus({code:e,details:t,metadata:c.status.metadata},"PROCESSED")})}break;case a.PickResultType.QUEUE:this.channel.queueCallForPick(this)}}cancelWithStatus(e,t){var n;this.trace("cancelWithStatus code: "+e+' details: "'+t+'"'),null===(n=this.child)||void 0===n||n.cancelWithStatus(e,t),this.outputStatus({code:e,details:t,metadata:new o.Metadata},"PROCESSED")}getPeer(){var e,t;return null!==(t=null===(e=this.child)||void 0===e?void 0:e.getPeer())&&void 0!==t?t:this.channel.getTarget()}start(e,t){this.trace("start called"),this.listener=t,this.metadata=e,this.doPick()}sendMessageWithContext(e,t){this.trace("write() called with message of length "+t.length),this.child?this.child.sendMessageWithContext(e,t):this.pendingMessage={context:e,message:t}}startRead(){this.trace("startRead called"),this.child?this.child.startRead():this.readPending=!0}halfClose(){this.trace("halfClose called"),this.child?this.child.halfClose():this.pendingHalfClose=!0}setCredentials(e){throw new Error("Method not implemented.")}getCallNumber(){return this.callNumber}getAuthContext(){return this.child?this.child.getAuthContext():null}}},267(e,t,n){"use strict";var r,i,s,o;Object.defineProperty(t,"__esModule",{value:!0}),t.log=t.setLoggerVerbosity=t.setLogger=t.getLogger=void 0,t.trace=function(e,n,r){m(n)&&(0,t.log)(e,(new Date).toISOString()+" | v"+l+" "+c.pid+" | "+n+" | "+r)},t.isTracerEnabled=m;const a=n(131),c=n(932),l=n(9943).rE;let h={error:(e,...t)=>{console.error("E "+e,...t)},info:(e,...t)=>{console.error("I "+e,...t)},debug:(e,...t)=>{console.error("D "+e,...t)}},u=a.LogVerbosity.ERROR;switch((null!==(i=null!==(r=process.env.GRPC_NODE_VERBOSITY)&&void 0!==r?r:process.env.GRPC_VERBOSITY)&&void 0!==i?i:"").toUpperCase()){case"DEBUG":u=a.LogVerbosity.DEBUG;break;case"INFO":u=a.LogVerbosity.INFO;break;case"ERROR":u=a.LogVerbosity.ERROR;break;case"NONE":u=a.LogVerbosity.NONE}t.getLogger=()=>h;t.setLogger=e=>{h=e};t.setLoggerVerbosity=e=>{u=e};t.log=(e,...t)=>{let n;if(e>=u){switch(e){case a.LogVerbosity.DEBUG:n=h.debug;break;case a.LogVerbosity.INFO:n=h.info;break;case a.LogVerbosity.ERROR:n=h.error}n||(n=h.error),n&&n.bind(h)(...t)}};const d=null!==(o=null!==(s=process.env.GRPC_NODE_TRACE)&&void 0!==s?s:process.env.GRPC_TRACE)&&void 0!==o?o:"",f=new Set,p=new Set;for(const e of d.split(","))e.startsWith("-")?p.add(e.substring(1)):f.add(e);const g=f.has("all");function m(e){return!p.has(e)&&(g||f.has(e))}},4056(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.makeClientConstructor=o,t.loadPackageDefinition=function(e){const t={};for(const n in e)if(Object.prototype.hasOwnProperty.call(e,n)){const r=e[n],i=n.split(".");if(i.some(e=>s(e)))continue;const c=i[i.length-1];let l=t;for(const e of i.slice(0,-1))l[e]||(l[e]={}),l=l[e];a(r)?l[c]=r:l[c]=o(r,c,{})}return t};const r=n(5563),i={unary:r.Client.prototype.makeUnaryRequest,server_stream:r.Client.prototype.makeServerStreamRequest,client_stream:r.Client.prototype.makeClientStreamRequest,bidi:r.Client.prototype.makeBidiStreamRequest};function s(e){return["__proto__","prototype","constructor"].includes(e)}function o(e,t,n){n||(n={});class o extends r.Client{}return Object.keys(e).forEach(t=>{if(s(t))return;const n=e[t];let r;if("string"==typeof t&&"$"===t.charAt(0))throw new Error("Method names cannot start with $");r=n.requestStream?n.responseStream?"bidi":"client_stream":n.responseStream?"server_stream":"unary";const a=n.requestSerialize,c=n.responseDeserialize,l=function(e,t,n,r){return function(...i){return e.call(this,t,n,r,...i)}}(i[r],n.path,a,c);o.prototype[t]=l,Object.assign(o.prototype[t],n),n.originalName&&!s(n.originalName)&&(o.prototype[n.originalName]=o.prototype[t])}),o.service=e,o.serviceName=t,o}function a(e){return"format"in e}},4097(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Metadata=void 0;const r=n(267),i=n(131),s=n(9752),o=/^[:0-9a-z_.-]+$/,a=/^[ -~]*$/;function c(e){return e.endsWith("-bin")}function l(e){return!e.startsWith("grpc-")}function h(e){return e.toLowerCase()}function u(e,t){if(!function(e){return o.test(e)}(e))throw new Error('Metadata key "'+e+'" contains illegal characters');if(null!=t)if(c(e)){if(!Buffer.isBuffer(t))throw new Error("keys that end with '-bin' must have Buffer values")}else{if(Buffer.isBuffer(t))throw new Error("keys that don't end with '-bin' must have String values");if(!function(e){return a.test(e)}(t))throw new Error('Metadata string value "'+t+'" contains illegal characters')}}class d{constructor(e={}){this.internalRepr=new Map,this.opaqueData=new Map,this.options=e}set(e,t){u(e=h(e),t),this.internalRepr.set(e,[t])}add(e,t){u(e=h(e),t);const n=this.internalRepr.get(e);void 0===n?this.internalRepr.set(e,[t]):n.push(t)}remove(e){e=h(e),this.internalRepr.delete(e)}get(e){return e=h(e),this.internalRepr.get(e)||[]}getMap(){const e={};for(const[t,n]of this.internalRepr)if(n.length>0){const r=n[0];e[t]=Buffer.isBuffer(r)?Buffer.from(r):r}return e}clone(){const e=new d(this.options),t=e.internalRepr;for(const[e,n]of this.internalRepr){const r=n.map(e=>Buffer.isBuffer(e)?Buffer.from(e):e);t.set(e,r)}return e}merge(e){for(const[t,n]of e.internalRepr){const e=(this.internalRepr.get(t)||[]).concat(n);this.internalRepr.set(t,e)}}setOptions(e){this.options=e}getOptions(){return this.options}toHttp2Headers(){const e={};for(const[t,n]of this.internalRepr)t.startsWith(":")||(e[t]=n.map(f));return e}toJSON(){const e={};for(const[t,n]of this.internalRepr)e[t]=n;return e}setOpaque(e,t){this.opaqueData.set(e,t)}getOpaque(e){return this.opaqueData.get(e)}static fromHttp2Headers(e){const t=new d;for(const n of Object.keys(e)){if(":"===n.charAt(0))continue;const o=e[n];try{c(n)?Array.isArray(o)?o.forEach(e=>{t.add(n,Buffer.from(e,"base64"))}):void 0!==o&&(l(n)?o.split(",").forEach(e=>{t.add(n,Buffer.from(e.trim(),"base64"))}):t.add(n,Buffer.from(o,"base64"))):Array.isArray(o)?o.forEach(e=>{t.add(n,e)}):void 0!==o&&t.add(n,o)}catch(e){const t=`Failed to add metadata entry ${n}: ${o}. ${(0,s.getErrorMessage)(e)}. For more information see https://github.com/grpc/grpc-node/issues/1173`;(0,r.log)(i.LogVerbosity.ERROR,t)}}return t}}t.Metadata=d;const f=e=>Buffer.isBuffer(e)?e.toString("base64"):e},2921(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.OrcaOobMetricsSubchannelWrapper=t.GRPC_METRICS_HEADER=t.ServerMetricRecorder=t.PerRequestMetricRecorder=void 0,t.createOrcaClient=u,t.createMetricsReader=function(e,n){return(r,i,s)=>{let o=s.getOpaque(d);if(o)e(o);else{const n=s.get(t.GRPC_METRICS_HEADER);if(n.length>0){o=h().xds.data.orca.v3.OrcaLoadReport.deserialize(n[0]),e(o),s.setOpaque(d,o)}}n&&n(r,i,s)}};const r=n(4056),i=n(4700),s=n(7434),o=n(2379),a=n(131),c=n(3956),l=n(463);function h(){const e=(0,n(5085).Yi)("xds/service/orca/v3/orca.proto",{keepCase:!0,longs:String,enums:String,defaults:!0,oneofs:!0,includeDirs:[`${__dirname}/../../proto/xds`,`${__dirname}/../../proto/protoc-gen-validate`]});return(0,r.loadPackageDefinition)(e)}t.PerRequestMetricRecorder=class{constructor(){this.message={}}recordRequestCostMetric(e,t){this.message.request_cost||(this.message.request_cost={}),this.message.request_cost[e]=t}recordUtilizationMetric(e,t){this.message.utilization||(this.message.utilization={}),this.message.utilization[e]=t}recordNamedMetric(e,t){this.message.named_metrics||(this.message.named_metrics={}),this.message.named_metrics[e]=t}recordCPUUtilizationMetric(e){this.message.cpu_utilization=e}recordMemoryUtilizationMetric(e){this.message.mem_utilization=e}recordApplicationUtilizationMetric(e){this.message.application_utilization=e}recordQpsMetric(e){this.message.rps_fractional=e}recordEpsMetric(e){this.message.eps=e}serialize(){return h().xds.data.orca.v3.OrcaLoadReport.serialize(this.message)}};function u(e){return new(0,h().xds.service.orca.v3.OpenRcaService)("unused",s.ChannelCredentials.createInsecure(),{channelOverride:e})}t.ServerMetricRecorder=class{constructor(){this.message={},this.serviceImplementation={StreamCoreMetrics:e=>{const t=e.request.report_interval?(0,i.durationToMs)((0,i.durationMessageToDuration)(e.request.report_interval)):3e4,n=setInterval(()=>{e.write(this.message)},t);e.on("cancelled",()=>{clearInterval(n)})}}}putUtilizationMetric(e,t){this.message.utilization||(this.message.utilization={}),this.message.utilization[e]=t}setAllUtilizationMetrics(e){this.message.utilization=Object.assign({},e)}deleteUtilizationMetric(e){var t;null===(t=this.message.utilization)||void 0===t||delete t[e]}setCpuUtilizationMetric(e){this.message.cpu_utilization=e}deleteCpuUtilizationMetric(){delete this.message.cpu_utilization}setApplicationUtilizationMetric(e){this.message.application_utilization=e}deleteApplicationUtilizationMetric(){delete this.message.application_utilization}setQpsMetric(e){this.message.rps_fractional=e}deleteQpsMetric(){delete this.message.rps_fractional}setEpsMetric(e){this.message.eps=e}deleteEpsMetric(){delete this.message.eps}addToServer(e){const t=h().xds.service.orca.v3.OpenRcaService.service;e.addService(t,this.serviceImplementation)}},t.GRPC_METRICS_HEADER="endpoint-load-metrics-bin";const d="grpc_orca_load_report";const f="orca_oob_metrics";class p{constructor(e,t){this.metricsListener=e,this.intervalMs=t,this.dataProducer=null}setSubchannel(e){const t=e.getOrCreateDataProducer(f,_);this.dataProducer=t,t.addDataWatcher(this)}destroy(){var e;null===(e=this.dataProducer)||void 0===e||e.removeDataWatcher(this)}getInterval(){return this.intervalMs}onMetricsUpdate(e){this.metricsListener(e)}}class g{constructor(e){this.subchannel=e,this.dataWatchers=new Set,this.orcaSupported=!0,this.metricsCall=null,this.currentInterval=1/0,this.backoffTimer=new c.BackoffTimeout(()=>this.updateMetricsSubscription()),this.subchannelStateListener=()=>this.updateMetricsSubscription();const t=e.getChannel();this.client=u(t),e.addConnectivityStateListener(this.subchannelStateListener)}addDataWatcher(e){this.dataWatchers.add(e),this.updateMetricsSubscription()}removeDataWatcher(e){var t;this.dataWatchers.delete(e),0===this.dataWatchers.size?(this.subchannel.removeDataProducer(f),null===(t=this.metricsCall)||void 0===t||t.cancel(),this.metricsCall=null,this.client.close(),this.subchannel.removeConnectivityStateListener(this.subchannelStateListener)):this.updateMetricsSubscription()}updateMetricsSubscription(){var e;if(0===this.dataWatchers.size||!this.orcaSupported||this.subchannel.getConnectivityState()!==l.ConnectivityState.READY)return;const t=Math.min(...Array.from(this.dataWatchers).map(e=>e.getInterval()));if(!this.metricsCall||t!==this.currentInterval){null===(e=this.metricsCall)||void 0===e||e.cancel(),this.currentInterval=t;const n=this.client.streamCoreMetrics({report_interval:(0,i.msToDuration)(t)});this.metricsCall=n,n.on("data",e=>{this.dataWatchers.forEach(t=>{t.onMetricsUpdate(e)})}),n.on("error",e=>{this.metricsCall=null,e.code!==a.Status.UNIMPLEMENTED?e.code!==a.Status.CANCELLED&&this.backoffTimer.runOnce():this.orcaSupported=!1})}}}class m extends o.BaseSubchannelWrapper{constructor(e,t,n){super(e),this.addDataWatcher(new p(t,n))}getWrappedSubchannel(){return this.child}}function _(e){return new g(e)}t.OrcaOobMetricsSubchannelWrapper=m},178(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.QueuePicker=t.UnavailablePicker=t.PickResultType=void 0;const r=n(4097),i=n(131);var s;!function(e){e[e.COMPLETE=0]="COMPLETE",e[e.QUEUE=1]="QUEUE",e[e.TRANSIENT_FAILURE=2]="TRANSIENT_FAILURE",e[e.DROP=3]="DROP"}(s||(t.PickResultType=s={}));t.UnavailablePicker=class{constructor(e){this.status=Object.assign({code:i.Status.UNAVAILABLE,details:"No connection established",metadata:new r.Metadata},e)}pick(e){return{pickResultType:s.TRANSIENT_FAILURE,subchannel:null,status:this.status,onCallStarted:null,onCallEnded:null}}};t.QueuePicker=class{constructor(e,t){this.loadBalancer=e,this.childPicker=t,this.calledExitIdle=!1}pick(e){return this.calledExitIdle||(process.nextTick(()=>{this.loadBalancer.exitIdle()}),this.calledExitIdle=!0),this.childPicker?this.childPicker.pick(e):{pickResultType:s.QUEUE,subchannel:null,status:null,onCallStarted:null,onCallEnded:null}}}},222(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.PriorityQueue=void 0;const n=e=>Math.floor(e/2),r=e=>2*e+1,i=e=>2*e+2;t.PriorityQueue=class{constructor(e=(e,t)=>e>t){this.comparator=e,this.heap=[]}size(){return this.heap.length}isEmpty(){return 0==this.size()}peek(){return this.heap[0]}push(...e){return e.forEach(e=>{this.heap.push(e),this.siftUp()}),this.size()}pop(){const e=this.peek(),t=this.size()-1;return t>0&&this.swap(0,t),this.heap.pop(),this.siftDown(),e}replace(e){const t=this.peek();return this.heap[0]=e,this.siftDown(),t}greater(e,t){return this.comparator(this.heap[e],this.heap[t])}swap(e,t){[this.heap[e],this.heap[t]]=[this.heap[t],this.heap[e]]}siftUp(){let e=this.size()-1;for(;e>0&&this.greater(e,n(e));)this.swap(e,n(e)),e=n(e)}siftDown(){let e=0;for(;r(e)<this.size()&&this.greater(r(e),e)||i(e)<this.size()&&this.greater(i(e),e);){let t=i(e)<this.size()&&this.greater(i(e),r(e))?i(e):r(e);this.swap(e,t),e=t}}}},6700(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.DEFAULT_PORT=void 0,t.setup=function(){(0,r.registerResolver)("dns",m),(0,r.registerDefaultScheme)("dns")};const r=n(9302),i=n(2250),s=n(5656),o=n(131),a=n(5034),c=n(4097),l=n(267),h=n(131),u=n(3822),d=n(9278),f=n(3956),p=n(883);function g(e){l.trace(h.LogVerbosity.DEBUG,"dns_resolver",e)}t.DEFAULT_PORT=443;class m{constructor(e,n,r){var s,a,l;this.target=e,this.listener=n,this.pendingLookupPromise=null,this.pendingTxtPromise=null,this.latestLookupResult=null,this.latestServiceConfigResult=null,this.continueResolving=!1,this.isNextResolutionTimerRunning=!1,this.isServiceConfigEnabled=!0,this.returnedIpResult=!1,this.alternativeResolver=new i.promises.Resolver,g("Resolver constructed for target "+(0,u.uriToString)(e)),e.authority&&this.alternativeResolver.setServers([e.authority]);const h=(0,u.splitHostPort)(e.path);null===h?(this.ipResult=null,this.dnsHostname=null,this.port=null):(0,d.isIPv4)(h.host)||(0,d.isIPv6)(h.host)?(this.ipResult=[{addresses:[{host:h.host,port:null!==(s=h.port)&&void 0!==s?s:t.DEFAULT_PORT}]}],this.dnsHostname=null,this.port=null):(this.ipResult=null,this.dnsHostname=h.host,this.port=null!==(a=h.port)&&void 0!==a?a:t.DEFAULT_PORT),this.percentage=100*Math.random(),1===r["grpc.service_config_disable_resolution"]&&(this.isServiceConfigEnabled=!1),this.defaultResolutionError={code:o.Status.UNAVAILABLE,details:`Name resolution failed for target ${(0,u.uriToString)(this.target)}`,metadata:new c.Metadata};const p={initialDelay:r["grpc.initial_reconnect_backoff_ms"],maxDelay:r["grpc.max_reconnect_backoff_ms"]};this.backoff=new f.BackoffTimeout(()=>{this.continueResolving&&this.startResolutionWithBackoff()},p),this.backoff.unref(),this.minTimeBetweenResolutionsMs=null!==(l=r["grpc.dns_min_time_between_resolutions_ms"])&&void 0!==l?l:3e4,this.nextResolutionTimer=setTimeout(()=>{},0),clearTimeout(this.nextResolutionTimer)}startResolution(){if(null!==this.ipResult)return this.returnedIpResult||(g("Returning IP address for target "+(0,u.uriToString)(this.target)),setImmediate(()=>{this.listener((0,a.statusOrFromValue)(this.ipResult),{},null,"")}),this.returnedIpResult=!0),this.backoff.stop(),this.backoff.reset(),void this.stopNextResolutionTimer();if(null===this.dnsHostname)g("Failed to parse DNS address "+(0,u.uriToString)(this.target)),setImmediate(()=>{this.listener((0,a.statusOrFromError)({code:o.Status.UNAVAILABLE,details:`Failed to parse DNS address ${(0,u.uriToString)(this.target)}`}),{},null,"")}),this.stopNextResolutionTimer();else{if(null!==this.pendingLookupPromise)return;g("Looking up DNS hostname "+this.dnsHostname),this.latestLookupResult=null;const e=this.dnsHostname;this.pendingLookupPromise=this.lookup(e),this.pendingLookupPromise.then(e=>{if(null===this.pendingLookupPromise)return;this.pendingLookupPromise=null,this.latestLookupResult=(0,a.statusOrFromValue)(e.map(e=>({addresses:[e]})));const t="["+e.map(e=>e.host+":"+e.port).join(",")+"]";g("Resolved addresses for target "+(0,u.uriToString)(this.target)+": "+t);const n=this.listener(this.latestLookupResult,{},this.latestServiceConfigResult,"");this.handleHealthStatus(n)},e=>{null!==this.pendingLookupPromise&&(g("Resolution error for target "+(0,u.uriToString)(this.target)+": "+e.message),this.pendingLookupPromise=null,this.stopNextResolutionTimer(),this.listener((0,a.statusOrFromError)(this.defaultResolutionError),{},this.latestServiceConfigResult,""))}),this.isServiceConfigEnabled&&null===this.pendingTxtPromise&&(this.pendingTxtPromise=this.resolveTxt(e),this.pendingTxtPromise.then(e=>{if(null===this.pendingTxtPromise)return;let t;this.pendingTxtPromise=null;try{t=(0,s.extractAndSelectServiceConfig)(e,this.percentage),this.latestServiceConfigResult=t?(0,a.statusOrFromValue)(t):null}catch(e){this.latestServiceConfigResult=(0,a.statusOrFromError)({code:o.Status.UNAVAILABLE,details:`Parsing service config failed with error ${e.message}`})}null!==this.latestLookupResult&&this.listener(this.latestLookupResult,{},this.latestServiceConfigResult,"")},e=>{}))}}handleHealthStatus(e){e?(this.backoff.stop(),this.backoff.reset()):this.continueResolving=!0}async lookup(e){if(p.GRPC_NODE_USE_ALTERNATIVE_RESOLVER){g("Using alternative DNS resolver.");const t=await Promise.allSettled([this.alternativeResolver.resolve4(e),this.alternativeResolver.resolve6(e)]);if(t.every(e=>"rejected"===e.status))throw new Error(t[0].reason);return t.reduce((e,t)=>"fulfilled"===t.status?[...e,...t.value]:e,[]).map(e=>({host:e,port:+this.port}))}return(await i.promises.lookup(e,{all:!0})).map(e=>({host:e.address,port:+this.port}))}async resolveTxt(e){return p.GRPC_NODE_USE_ALTERNATIVE_RESOLVER?(g("Using alternative DNS resolver."),this.alternativeResolver.resolveTxt(e)):i.promises.resolveTxt(e)}startNextResolutionTimer(){var e,t;clearTimeout(this.nextResolutionTimer),this.nextResolutionTimer=setTimeout(()=>{this.stopNextResolutionTimer(),this.continueResolving&&this.startResolutionWithBackoff()},this.minTimeBetweenResolutionsMs),null===(t=(e=this.nextResolutionTimer).unref)||void 0===t||t.call(e),this.isNextResolutionTimerRunning=!0}stopNextResolutionTimer(){clearTimeout(this.nextResolutionTimer),this.isNextResolutionTimerRunning=!1}startResolutionWithBackoff(){null===this.pendingLookupPromise&&(this.continueResolving=!1,this.backoff.runOnce(),this.startNextResolutionTimer(),this.startResolution())}updateResolution(){null===this.pendingLookupPromise&&(this.isNextResolutionTimerRunning||this.backoff.isRunning()?(this.isNextResolutionTimerRunning?g('resolution update delayed by "min time between resolutions" rate limit'):g("resolution update delayed by backoff timer until "+this.backoff.getEndTime().toISOString()),this.continueResolving=!0):this.startResolutionWithBackoff())}destroy(){this.continueResolving=!1,this.backoff.reset(),this.backoff.stop(),this.stopNextResolutionTimer(),this.pendingLookupPromise=null,this.pendingTxtPromise=null,this.latestLookupResult=null,this.latestServiceConfigResult=null,this.returnedIpResult=!1}static getDefaultAuthority(e){return e.path}}},82(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.setup=function(){(0,a.registerResolver)(d,p),(0,a.registerResolver)(f,p)};const r=n(9278),i=n(5034),s=n(131),o=n(4097),a=n(9302),c=n(8996),l=n(3822),h=n(267);function u(e){h.trace(s.LogVerbosity.DEBUG,"ip_resolver",e)}const d="ipv4",f="ipv6";class p{constructor(e,t,n){var i;this.listener=t,this.endpoints=[],this.error=null,this.hasReturnedResult=!1,u("Resolver constructed for target "+(0,l.uriToString)(e));const a=[];if(e.scheme!==d&&e.scheme!==f)return void(this.error={code:s.Status.UNAVAILABLE,details:`Unrecognized scheme ${e.scheme} in IP resolver`,metadata:new o.Metadata});const h=e.path.split(",");for(const t of h){const n=(0,l.splitHostPort)(t);if(null===n)return void(this.error={code:s.Status.UNAVAILABLE,details:`Failed to parse ${e.scheme} address ${t}`,metadata:new o.Metadata});if(e.scheme===d&&!(0,r.isIPv4)(n.host)||e.scheme===f&&!(0,r.isIPv6)(n.host))return void(this.error={code:s.Status.UNAVAILABLE,details:`Failed to parse ${e.scheme} address ${t}`,metadata:new o.Metadata});a.push({host:n.host,port:null!==(i=n.port)&&void 0!==i?i:443})}this.endpoints=a.map(e=>({addresses:[e]})),u("Parsed "+e.scheme+" address list "+a.map(c.subchannelAddressToString))}updateResolution(){this.hasReturnedResult||(this.hasReturnedResult=!0,process.nextTick(()=>{this.error?this.listener((0,i.statusOrFromError)(this.error),{},null,""):this.listener((0,i.statusOrFromValue)(this.endpoints),{},null,"")}))}destroy(){this.hasReturnedResult=!1}static getDefaultAuthority(e){return e.path.split(",")[0]}}},305(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.setup=function(){(0,r.registerResolver)("unix",s)};const r=n(9302),i=n(5034);class s{constructor(e,t,n){let r;this.listener=t,this.hasReturnedResult=!1,this.endpoints=[],r=""===e.authority?"/"+e.path:e.path,this.endpoints=[{addresses:[{path:r}]}]}updateResolution(){this.hasReturnedResult||(this.hasReturnedResult=!0,process.nextTick(this.listener,(0,i.statusOrFromValue)(this.endpoints),{},null,""))}destroy(){this.hasReturnedResult=!1}static getDefaultAuthority(e){return"localhost"}}},9302(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.CHANNEL_ARGS_CONFIG_SELECTOR_KEY=void 0,t.registerResolver=function(e,t){i[e]=t},t.registerDefaultScheme=function(e){s=e},t.createResolver=function(e,t,n){if(void 0!==e.scheme&&e.scheme in i)return new i[e.scheme](e,t,n);throw new Error(`No resolver could be created for target ${(0,r.uriToString)(e)}`)},t.getDefaultAuthority=function(e){if(void 0!==e.scheme&&e.scheme in i)return i[e.scheme].getDefaultAuthority(e);throw new Error(`Invalid target ${(0,r.uriToString)(e)}`)},t.mapUriDefaultScheme=function(e){if(void 0===e.scheme||!(e.scheme in i))return null!==s?{scheme:s,authority:void 0,path:(0,r.uriToString)(e)}:null;return e};const r=n(3822);t.CHANNEL_ARGS_CONFIG_SELECTOR_KEY="grpc.internal.config_selector";const i={};let s=null},8446(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ResolvingCall=void 0;const r=n(2267),i=n(131),s=n(6308),o=n(4097),a=n(267),c=n(6067);t.ResolvingCall=class{constructor(e,t,n,o,a){this.channel=e,this.method=t,this.filterStackFactory=o,this.callNumber=a,this.child=null,this.readPending=!1,this.pendingMessage=null,this.pendingHalfClose=!1,this.ended=!1,this.readFilterPending=!1,this.writeFilterPending=!1,this.pendingChildStatus=null,this.metadata=null,this.listener=null,this.statusWatchers=[],this.deadlineTimer=setTimeout(()=>{},0),this.filterStack=null,this.deadlineStartTime=null,this.configReceivedTime=null,this.childStartTime=null,this.credentials=r.CallCredentials.createEmpty(),this.deadline=n.deadline,this.host=n.host,n.parentCall&&(n.flags&i.Propagate.CANCELLATION&&n.parentCall.on("cancelled",()=>{this.cancelWithStatus(i.Status.CANCELLED,"Cancelled by parent call")}),n.flags&i.Propagate.DEADLINE&&(this.trace("Propagating deadline from parent: "+n.parentCall.getDeadline()),this.deadline=(0,s.minDeadline)(this.deadline,n.parentCall.getDeadline()))),this.trace("Created"),this.runDeadlineTimer()}trace(e){a.trace(i.LogVerbosity.DEBUG,"resolving_call","["+this.callNumber+"] "+e)}runDeadlineTimer(){clearTimeout(this.deadlineTimer),this.deadlineStartTime=new Date,this.trace("Deadline: "+(0,s.deadlineToString)(this.deadline));const e=(0,s.getRelativeTimeout)(this.deadline);if(e!==1/0){this.trace("Deadline will be reached in "+e+"ms");const t=()=>{if(!this.deadlineStartTime)return void this.cancelWithStatus(i.Status.DEADLINE_EXCEEDED,"Deadline exceeded");const e=[],t=new Date;e.push(`Deadline exceeded after ${(0,s.formatDateDifference)(this.deadlineStartTime,t)}`),this.configReceivedTime?(this.configReceivedTime>this.deadlineStartTime&&e.push(`name resolution: ${(0,s.formatDateDifference)(this.deadlineStartTime,this.configReceivedTime)}`),this.childStartTime?this.childStartTime>this.configReceivedTime&&e.push(`metadata filters: ${(0,s.formatDateDifference)(this.configReceivedTime,this.childStartTime)}`):e.push("waiting for metadata filters")):e.push("waiting for name resolution"),this.child&&e.push(...this.child.getDeadlineInfo()),this.cancelWithStatus(i.Status.DEADLINE_EXCEEDED,e.join(","))};e<=0?process.nextTick(t):this.deadlineTimer=setTimeout(t,e)}}outputStatus(e){if(!this.ended){this.ended=!0,this.filterStack||(this.filterStack=this.filterStackFactory.createFilter()),clearTimeout(this.deadlineTimer);const t=this.filterStack.receiveTrailers(e);this.trace("ended with status: code="+t.code+' details="'+t.details+'"'),this.statusWatchers.forEach(e=>e(t)),process.nextTick(()=>{var e;null===(e=this.listener)||void 0===e||e.onReceiveStatus(t)})}}sendMessageOnChild(e,t){if(!this.child)throw new Error("sendMessageonChild called with child not populated");const n=this.child;this.writeFilterPending=!0,this.filterStack.sendMessage(Promise.resolve({message:t,flags:e.flags})).then(t=>{this.writeFilterPending=!1,n.sendMessageWithContext(e,t.message),this.pendingHalfClose&&n.halfClose()},e=>{this.cancelWithStatus(e.code,e.details)})}getConfig(){if(this.ended)return;if(!this.metadata||!this.listener)throw new Error("getConfig called before start");const e=this.channel.getConfig(this.method,this.metadata);if("NONE"===e.type)return void this.channel.queueCallForConfig(this);if("ERROR"===e.type)return void(this.metadata.getOptions().waitForReady?this.channel.queueCallForConfig(this):this.outputStatus(e.error));this.configReceivedTime=new Date;const t=e.config;if(t.status!==i.Status.OK){const{code:e,details:n}=(0,c.restrictControlPlaneStatusCode)(t.status,"Failed to route call to method "+this.method);return void this.outputStatus({code:e,details:n,metadata:new o.Metadata})}if(t.methodConfig.timeout){const e=new Date;e.setSeconds(e.getSeconds()+t.methodConfig.timeout.seconds),e.setMilliseconds(e.getMilliseconds()+t.methodConfig.timeout.nanos/1e6),this.deadline=(0,s.minDeadline)(this.deadline,e),this.runDeadlineTimer()}this.filterStackFactory.push(t.dynamicFilterFactories),this.filterStack=this.filterStackFactory.createFilter(),this.filterStack.sendMetadata(Promise.resolve(this.metadata)).then(e=>{this.child=this.channel.createRetryingCall(t,this.method,this.host,this.credentials,this.deadline),this.trace("Created child ["+this.child.getCallNumber()+"]"),this.childStartTime=new Date,this.child.start(e,{onReceiveMetadata:e=>{this.trace("Received metadata"),this.listener.onReceiveMetadata(this.filterStack.receiveMetadata(e))},onReceiveMessage:e=>{this.trace("Received message"),this.readFilterPending=!0,this.filterStack.receiveMessage(e).then(e=>{this.trace("Finished filtering received message"),this.readFilterPending=!1,this.listener.onReceiveMessage(e),this.pendingChildStatus&&this.outputStatus(this.pendingChildStatus)},e=>{this.cancelWithStatus(e.code,e.details)})},onReceiveStatus:e=>{this.trace("Received status"),this.readFilterPending?this.pendingChildStatus=e:this.outputStatus(e)}}),this.readPending&&this.child.startRead(),this.pendingMessage?this.sendMessageOnChild(this.pendingMessage.context,this.pendingMessage.message):this.pendingHalfClose&&this.child.halfClose()},e=>{this.outputStatus(e)})}reportResolverError(e){var t;(null===(t=this.metadata)||void 0===t?void 0:t.getOptions().waitForReady)?this.channel.queueCallForConfig(this):this.outputStatus(e)}cancelWithStatus(e,t){var n;this.trace("cancelWithStatus code: "+e+' details: "'+t+'"'),null===(n=this.child)||void 0===n||n.cancelWithStatus(e,t),this.outputStatus({code:e,details:t,metadata:new o.Metadata})}getPeer(){var e,t;return null!==(t=null===(e=this.child)||void 0===e?void 0:e.getPeer())&&void 0!==t?t:this.channel.getTarget()}start(e,t){this.trace("start called"),this.metadata=e.clone(),this.listener=t,this.getConfig()}sendMessageWithContext(e,t){this.trace("write() called with message of length "+t.length),this.child?this.sendMessageOnChild(e,t):this.pendingMessage={context:e,message:t}}startRead(){this.trace("startRead called"),this.child?this.child.startRead():this.readPending=!0}halfClose(){this.trace("halfClose called"),this.child&&!this.writeFilterPending?this.child.halfClose():this.pendingHalfClose=!0}setCredentials(e){this.credentials=e}addStatusWatcher(e){this.statusWatchers.push(e)}getCallNumber(){return this.callNumber}getAuthContext(){return this.child?this.child.getAuthContext():null}}},4973(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ResolvingLoadBalancer=void 0;const r=n(8923),i=n(5656),s=n(463),o=n(9302),a=n(178),c=n(3956),l=n(131),h=n(4097),u=n(267),d=n(131),f=n(3822),p=n(533);function g(e){u.trace(d.LogVerbosity.DEBUG,"resolving_load_balancer",e)}const m=["SERVICE_AND_METHOD","SERVICE","EMPTY"];function _(e,t,n,r){for(const i of n.name)switch(r){case"EMPTY":if(!i.service&&!i.method)return!0;break;case"SERVICE":if(i.service===e&&!i.method)return!0;break;case"SERVICE_AND_METHOD":if(i.service===e&&i.method===t)return!0}return!1}function y(e,t,n,r){for(const i of n)if(_(e,t,i,r))return i;return null}t.ResolvingLoadBalancer=class{constructor(e,t,n,r,l){this.target=e,this.channelControlHelper=t,this.channelOptions=n,this.onSuccessfulResolution=r,this.onFailedResolution=l,this.latestChildState=s.ConnectivityState.IDLE,this.latestChildPicker=new a.QueuePicker(this),this.latestChildErrorMessage=null,this.currentState=s.ConnectivityState.IDLE,this.previousServiceConfig=null,this.continueResolving=!1,n["grpc.service_config"]?this.defaultServiceConfig=(0,i.validateServiceConfig)(JSON.parse(n["grpc.service_config"])):this.defaultServiceConfig={loadBalancingConfig:[],methodConfig:[]},this.updateState(s.ConnectivityState.IDLE,new a.QueuePicker(this),null),this.childLoadBalancer=new p.ChildLoadBalancerHandler({createSubchannel:t.createSubchannel.bind(t),requestReresolution:()=>{this.backoffTimeout.isRunning()?(g("requestReresolution delayed by backoff timer until "+this.backoffTimeout.getEndTime().toISOString()),this.continueResolving=!0):this.updateResolution()},updateState:(e,t,n)=>{this.latestChildState=e,this.latestChildPicker=t,this.latestChildErrorMessage=n,this.updateState(e,t,n)},addChannelzChild:t.addChannelzChild.bind(t),removeChannelzChild:t.removeChannelzChild.bind(t)}),this.innerResolver=(0,o.createResolver)(e,this.handleResolverResult.bind(this),n);const h={initialDelay:n["grpc.initial_reconnect_backoff_ms"],maxDelay:n["grpc.max_reconnect_backoff_ms"]};this.backoffTimeout=new c.BackoffTimeout(()=>{this.continueResolving?(this.updateResolution(),this.continueResolving=!1):this.updateState(this.latestChildState,this.latestChildPicker,this.latestChildErrorMessage)},h),this.backoffTimeout.unref()}handleResolverResult(e,t,n,i){var s,a;this.backoffTimeout.stop(),this.backoffTimeout.reset();let c=!0,u=null;if(null===n?u=this.defaultServiceConfig:n.ok?u=n.value:null!==this.previousServiceConfig?u=this.previousServiceConfig:(c=!1,this.handleResolutionFailure(n.error)),null!==u){const n=null!==(s=null==u?void 0:u.loadBalancingConfig)&&void 0!==s?s:[],o=(0,r.selectLbConfigFromList)(n,!0);null===o?(c=!1,this.handleResolutionFailure({code:l.Status.UNAVAILABLE,details:"All load balancer options in service config are not compatible",metadata:new h.Metadata})):c=this.childLoadBalancer.updateAddressList(e,o,Object.assign(Object.assign({},this.channelOptions),t),i)}return c&&this.onSuccessfulResolution(u,null!==(a=t[o.CHANNEL_ARGS_CONFIG_SELECTOR_KEY])&&void 0!==a?a:function(e){return{invoke(t,n){var r,i;const s=t.split("/").filter(e=>e.length>0),o=null!==(r=s[0])&&void 0!==r?r:"",a=null!==(i=s[1])&&void 0!==i?i:"";if(e&&e.methodConfig)for(const t of m){const n=y(o,a,e.methodConfig,t);if(n)return{methodConfig:n,pickInformation:{},status:l.Status.OK,dynamicFilterFactories:[]}}return{methodConfig:{name:[]},pickInformation:{},status:l.Status.OK,dynamicFilterFactories:[]}},unref(){}}}(u)),c}updateResolution(){this.innerResolver.updateResolution(),this.currentState===s.ConnectivityState.IDLE&&this.updateState(s.ConnectivityState.CONNECTING,this.latestChildPicker,this.latestChildErrorMessage),this.backoffTimeout.runOnce()}updateState(e,t,n){g((0,f.uriToString)(this.target)+" "+s.ConnectivityState[this.currentState]+" -> "+s.ConnectivityState[e]),e===s.ConnectivityState.IDLE&&(t=new a.QueuePicker(this,t)),this.currentState=e,this.channelControlHelper.updateState(e,t,n)}handleResolutionFailure(e){this.latestChildState===s.ConnectivityState.IDLE&&(this.updateState(s.ConnectivityState.TRANSIENT_FAILURE,new a.UnavailablePicker(e),e.details),this.onFailedResolution(e))}exitIdle(){this.currentState!==s.ConnectivityState.IDLE&&this.currentState!==s.ConnectivityState.TRANSIENT_FAILURE||(this.backoffTimeout.isRunning()?this.continueResolving=!0:this.updateResolution()),this.childLoadBalancer.exitIdle()}updateAddressList(e,t){throw new Error("updateAddressList not supported on ResolvingLoadBalancer")}resetBackoff(){this.backoffTimeout.reset(),this.childLoadBalancer.resetBackoff()}destroy(){this.childLoadBalancer.destroy(),this.innerResolver.destroy(),this.backoffTimeout.reset(),this.backoffTimeout.stop(),this.latestChildState=s.ConnectivityState.IDLE,this.latestChildPicker=new a.QueuePicker(this),this.currentState=s.ConnectivityState.IDLE,this.previousServiceConfig=null,this.continueResolving=!1}getTypeName(){return"resolving_load_balancer"}}},3135(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.RetryingCall=t.MessageBufferTracker=t.RetryThrottler=void 0;const r=n(131),i=n(6308),s=n(4097),o=n(267);t.RetryThrottler=class{constructor(e,t,n){this.maxTokens=e,this.tokenRatio=t,this.tokens=n?n.tokens*(e/n.maxTokens):e}addCallSucceeded(){this.tokens=Math.min(this.tokens+this.tokenRatio,this.maxTokens)}addCallFailed(){this.tokens=Math.max(this.tokens-1,0)}canRetryCall(){return this.tokens>this.maxTokens/2}};t.MessageBufferTracker=class{constructor(e,t){this.totalLimit=e,this.limitPerCall=t,this.totalAllocated=0,this.allocatedPerCall=new Map}allocate(e,t){var n;const r=null!==(n=this.allocatedPerCall.get(t))&&void 0!==n?n:0;return!(this.limitPerCall-r<e||this.totalLimit-this.totalAllocated<e)&&(this.allocatedPerCall.set(t,r+e),this.totalAllocated+=e,!0)}free(e,t){var n;if(this.totalAllocated<e)throw new Error(`Invalid buffer allocation state: call ${t} freed ${e} > total allocated ${this.totalAllocated}`);this.totalAllocated-=e;const r=null!==(n=this.allocatedPerCall.get(t))&&void 0!==n?n:0;if(r<e)throw new Error(`Invalid buffer allocation state: call ${t} freed ${e} > allocated for call ${r}`);this.allocatedPerCall.set(t,r-e)}freeAll(e){var t;const n=null!==(t=this.allocatedPerCall.get(e))&&void 0!==t?t:0;if(this.totalAllocated<n)throw new Error(`Invalid buffer allocation state: call ${e} allocated ${n} > total allocated ${this.totalAllocated}`);this.totalAllocated-=n,this.allocatedPerCall.delete(e)}};const a="grpc-previous-rpc-attempts";t.RetryingCall=class{constructor(e,t,n,r,i,s,o,a,c){var l;this.channel=e,this.callConfig=t,this.methodName=n,this.host=r,this.credentials=i,this.deadline=s,this.callNumber=o,this.bufferTracker=a,this.retryThrottler=c,this.listener=null,this.initialMetadata=null,this.underlyingCalls=[],this.writeBuffer=[],this.writeBufferOffset=0,this.readStarted=!1,this.transparentRetryUsed=!1,this.attempts=0,this.hedgingTimer=null,this.committedCallIndex=null,this.initialRetryBackoffSec=0,this.nextRetryBackoffSec=0;const h=null!==(l=e.getOptions()["grpc-node.retry_max_attempts_limit"])&&void 0!==l?l:5;if(0===e.getOptions()["grpc.enable_retries"])this.state="NO_RETRY",this.maxAttempts=1;else if(t.methodConfig.retryPolicy){this.state="RETRY";const e=t.methodConfig.retryPolicy;this.nextRetryBackoffSec=this.initialRetryBackoffSec=Number(e.initialBackoff.substring(0,e.initialBackoff.length-1)),this.maxAttempts=Math.min(e.maxAttempts,h)}else t.methodConfig.hedgingPolicy?(this.state="HEDGING",this.maxAttempts=Math.min(t.methodConfig.hedgingPolicy.maxAttempts,h)):(this.state="TRANSPARENT_ONLY",this.maxAttempts=1);this.startTime=new Date}getDeadlineInfo(){if(0===this.underlyingCalls.length)return[];const e=[],t=this.underlyingCalls[this.underlyingCalls.length-1];return this.underlyingCalls.length>1&&e.push("previous attempts: "+(this.underlyingCalls.length-1)),t.startTime>this.startTime&&e.push(`time to current attempt start: ${(0,i.formatDateDifference)(this.startTime,t.startTime)}`),e.push(...t.call.getDeadlineInfo()),e}getCallNumber(){return this.callNumber}trace(e){o.trace(r.LogVerbosity.DEBUG,"retrying_call","["+this.callNumber+"] "+e)}reportStatus(e){this.trace("ended with status: code="+e.code+' details="'+e.details+'" start time='+this.startTime.toISOString()),this.bufferTracker.freeAll(this.callNumber),this.writeBufferOffset=this.writeBufferOffset+this.writeBuffer.length,this.writeBuffer=[],process.nextTick(()=>{var t;null===(t=this.listener)||void 0===t||t.onReceiveStatus({code:e.code,details:e.details,metadata:e.metadata})})}cancelWithStatus(e,t){this.trace("cancelWithStatus code: "+e+' details: "'+t+'"'),this.reportStatus({code:e,details:t,metadata:new s.Metadata});for(const{call:n}of this.underlyingCalls)n.cancelWithStatus(e,t)}getPeer(){return null!==this.committedCallIndex?this.underlyingCalls[this.committedCallIndex].call.getPeer():"unknown"}getBufferEntry(e){var t;return null!==(t=this.writeBuffer[e-this.writeBufferOffset])&&void 0!==t?t:{entryType:"FREED",allocated:!1}}getNextBufferIndex(){return this.writeBufferOffset+this.writeBuffer.length}clearSentMessages(){if("COMMITTED"!==this.state)return;let e;e="COMPLETED"===this.underlyingCalls[this.committedCallIndex].state?this.getNextBufferIndex():this.underlyingCalls[this.committedCallIndex].nextMessageToSend;for(let t=this.writeBufferOffset;t<e;t++){const e=this.getBufferEntry(t);e.allocated&&this.bufferTracker.free(e.message.message.length,this.callNumber)}this.writeBuffer=this.writeBuffer.slice(e-this.writeBufferOffset),this.writeBufferOffset=e}commitCall(e){var t,n;if("COMMITTED"!==this.state){this.trace("Committing call ["+this.underlyingCalls[e].call.getCallNumber()+"] at index "+e),this.state="COMMITTED",null===(n=(t=this.callConfig).onCommitted)||void 0===n||n.call(t),this.committedCallIndex=e;for(let t=0;t<this.underlyingCalls.length;t++)t!==e&&"COMPLETED"!==this.underlyingCalls[t].state&&(this.underlyingCalls[t].state="COMPLETED",this.underlyingCalls[t].call.cancelWithStatus(r.Status.CANCELLED,"Discarded in favor of other hedged attempt"));this.clearSentMessages()}}commitCallWithMostMessages(){if("COMMITTED"===this.state)return;let e=-1,t=-1;for(const[n,r]of this.underlyingCalls.entries())"ACTIVE"===r.state&&r.nextMessageToSend>e&&(e=r.nextMessageToSend,t=n);-1===t?this.state="TRANSPARENT_ONLY":this.commitCall(t)}isStatusCodeInList(e,t){return e.some(e=>{var n;return e===t||e.toString().toLowerCase()===(null===(n=r.Status[t])||void 0===n?void 0:n.toLowerCase())})}getNextRetryJitter(){return Math.random()*(1.2-.8)+.8}getNextRetryBackoffMs(){var e;const t=null===(e=this.callConfig)||void 0===e?void 0:e.methodConfig.retryPolicy;if(!t)return 0;const n=this.getNextRetryJitter()*this.nextRetryBackoffSec*1e3,r=Number(t.maxBackoff.substring(0,t.maxBackoff.length-1));return this.nextRetryBackoffSec=Math.min(this.nextRetryBackoffSec*t.backoffMultiplier,r),n}maybeRetryCall(e,t){if("RETRY"!==this.state)return void t(!1);if(this.attempts>=this.maxAttempts)return void t(!1);let n;if(null===e)n=this.getNextRetryBackoffMs();else{if(e<0)return this.state="TRANSPARENT_ONLY",void t(!1);n=e,this.nextRetryBackoffSec=this.initialRetryBackoffSec}setTimeout(()=>{var e,n;"RETRY"===this.state?null===(n=null===(e=this.retryThrottler)||void 0===e?void 0:e.canRetryCall())||void 0===n||n?(t(!0),this.attempts+=1,this.startNewAttempt()):(this.trace("Retry attempt denied by throttling policy"),t(!1)):t(!1)},n)}countActiveCalls(){let e=0;for(const t of this.underlyingCalls)"ACTIVE"===(null==t?void 0:t.state)&&(e+=1);return e}handleProcessedStatus(e,t,n){var r,i,s;switch(this.state){case"COMMITTED":case"NO_RETRY":case"TRANSPARENT_ONLY":this.commitCall(t),this.reportStatus(e);break;case"HEDGING":if(this.isStatusCodeInList(null!==(r=this.callConfig.methodConfig.hedgingPolicy.nonFatalStatusCodes)&&void 0!==r?r:[],e.code)){let r;if(null===(i=this.retryThrottler)||void 0===i||i.addCallFailed(),null===n)r=0;else{if(n<0)return this.state="TRANSPARENT_ONLY",this.commitCall(t),void this.reportStatus(e);r=n}setTimeout(()=>{this.maybeStartHedgingAttempt(),0===this.countActiveCalls()&&(this.commitCall(t),this.reportStatus(e))},r)}else this.commitCall(t),this.reportStatus(e);break;case"RETRY":this.isStatusCodeInList(this.callConfig.methodConfig.retryPolicy.retryableStatusCodes,e.code)?(null===(s=this.retryThrottler)||void 0===s||s.addCallFailed(),this.maybeRetryCall(n,n=>{n||(this.commitCall(t),this.reportStatus(e))})):(this.commitCall(t),this.reportStatus(e))}}getPushback(e){const t=e.get("grpc-retry-pushback-ms");if(0===t.length)return null;try{return parseInt(t[0])}catch(e){return-1}}handleChildStatus(e,t){var n;if("COMPLETED"===this.underlyingCalls[t].state)return;if(this.trace("state="+this.state+" handling status with progress "+e.progress+" from child ["+this.underlyingCalls[t].call.getCallNumber()+"] in state "+this.underlyingCalls[t].state),this.underlyingCalls[t].state="COMPLETED",e.code===r.Status.OK)return null===(n=this.retryThrottler)||void 0===n||n.addCallSucceeded(),this.commitCall(t),void this.reportStatus(e);if("NO_RETRY"===this.state)return this.commitCall(t),void this.reportStatus(e);if("COMMITTED"===this.state)return void this.reportStatus(e);const i=this.getPushback(e.metadata);switch(e.progress){case"NOT_STARTED":this.startNewAttempt();break;case"REFUSED":this.transparentRetryUsed?this.handleProcessedStatus(e,t,i):(this.transparentRetryUsed=!0,this.startNewAttempt());break;case"DROP":this.commitCall(t),this.reportStatus(e);break;case"PROCESSED":this.handleProcessedStatus(e,t,i)}}maybeStartHedgingAttempt(){"HEDGING"===this.state&&this.callConfig.methodConfig.hedgingPolicy&&(this.attempts>=this.maxAttempts||(this.attempts+=1,this.startNewAttempt(),this.maybeStartHedgingTimer()))}maybeStartHedgingTimer(){var e,t,n;if(this.hedgingTimer&&clearTimeout(this.hedgingTimer),"HEDGING"!==this.state)return;if(!this.callConfig.methodConfig.hedgingPolicy)return;const r=this.callConfig.methodConfig.hedgingPolicy;if(this.attempts>=this.maxAttempts)return;const i=null!==(e=r.hedgingDelay)&&void 0!==e?e:"0s",s=Number(i.substring(0,i.length-1));this.hedgingTimer=setTimeout(()=>{this.maybeStartHedgingAttempt()},1e3*s),null===(n=(t=this.hedgingTimer).unref)||void 0===n||n.call(t)}startNewAttempt(){const e=this.channel.createLoadBalancingCall(this.callConfig,this.methodName,this.host,this.credentials,this.deadline);this.trace("Created child call ["+e.getCallNumber()+"] for attempt "+this.attempts);const t=this.underlyingCalls.length;this.underlyingCalls.push({state:"ACTIVE",call:e,nextMessageToSend:0,startTime:new Date});const n=this.attempts-1,r=this.initialMetadata.clone();n>0&&r.set(a,`${n}`);let i=!1;e.start(r,{onReceiveMetadata:r=>{this.trace("Received metadata from child ["+e.getCallNumber()+"]"),this.commitCall(t),i=!0,n>0&&r.set(a,`${n}`),"ACTIVE"===this.underlyingCalls[t].state&&this.listener.onReceiveMetadata(r)},onReceiveMessage:n=>{this.trace("Received message from child ["+e.getCallNumber()+"]"),this.commitCall(t),"ACTIVE"===this.underlyingCalls[t].state&&this.listener.onReceiveMessage(n)},onReceiveStatus:r=>{this.trace("Received status from child ["+e.getCallNumber()+"]"),!i&&n>0&&r.metadata.set(a,`${n}`),this.handleChildStatus(r,t)}}),this.sendNextChildMessage(t),this.readStarted&&e.startRead()}start(e,t){this.trace("start called"),this.listener=t,this.initialMetadata=e,this.attempts+=1,this.startNewAttempt(),this.maybeStartHedgingTimer()}handleChildWriteCompleted(e,t){var n,r;null===(r=(n=this.getBufferEntry(t)).callback)||void 0===r||r.call(n),this.clearSentMessages();this.underlyingCalls[e].nextMessageToSend+=1,this.sendNextChildMessage(e)}sendNextChildMessage(e){const t=this.underlyingCalls[e];if("COMPLETED"===t.state)return;const n=t.nextMessageToSend;if(this.getBufferEntry(n)){const r=this.getBufferEntry(n);switch(r.entryType){case"MESSAGE":t.call.sendMessageWithContext({callback:t=>{this.handleChildWriteCompleted(e,n)}},r.message.message);"HALF_CLOSE"===this.getBufferEntry(n+1).entryType&&(this.trace("Sending halfClose immediately after message to child ["+t.call.getCallNumber()+"] - optimizing for unary/final message"),t.nextMessageToSend+=1,t.call.halfClose());break;case"HALF_CLOSE":t.nextMessageToSend+=1,t.call.halfClose()}}}sendMessageWithContext(e,t){this.trace("write() called with message of length "+t.length);const n={message:t,flags:e.flags},r=this.getNextBufferIndex(),i={entryType:"MESSAGE",message:n,allocated:this.bufferTracker.allocate(t.length,this.callNumber)};if(this.writeBuffer.push(i),i.allocated){process.nextTick(()=>{var t;null===(t=e.callback)||void 0===t||t.call(e)});for(const[e,n]of this.underlyingCalls.entries())"ACTIVE"===n.state&&n.nextMessageToSend===r&&n.call.sendMessageWithContext({callback:t=>{this.handleChildWriteCompleted(e,r)}},t)}else{if(this.commitCallWithMostMessages(),null===this.committedCallIndex)return;const n=this.underlyingCalls[this.committedCallIndex];i.callback=e.callback,"ACTIVE"===n.state&&n.nextMessageToSend===r&&n.call.sendMessageWithContext({callback:e=>{this.handleChildWriteCompleted(this.committedCallIndex,r)}},t)}}startRead(){this.trace("startRead called"),this.readStarted=!0;for(const e of this.underlyingCalls)"ACTIVE"===(null==e?void 0:e.state)&&e.call.startRead()}halfClose(){this.trace("halfClose called");const e=this.getNextBufferIndex();this.writeBuffer.push({entryType:"HALF_CLOSE",allocated:!1});for(const t of this.underlyingCalls)"ACTIVE"===(null==t?void 0:t.state)&&(t.nextMessageToSend!==e&&t.nextMessageToSend!==e-1||(this.trace("Sending halfClose immediately to child ["+t.call.getCallNumber()+"] - all messages already sent"),t.nextMessageToSend+=1,t.call.halfClose()))}setCredentials(e){throw new Error("Method not implemented.")}getMethod(){return this.methodName}getHost(){return this.host}getAuthContext(){return null!==this.committedCallIndex?this.underlyingCalls[this.committedCallIndex].call.getAuthContext():null}}},6860(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ServerDuplexStreamImpl=t.ServerWritableStreamImpl=t.ServerReadableStreamImpl=t.ServerUnaryCallImpl=void 0,t.serverErrorToStatus=a;const r=n(4434),i=n(2203),s=n(131),o=n(4097);function a(e,t){var n;const r={code:s.Status.UNKNOWN,details:"message"in e?e.message:"Unknown Error",metadata:null!==(n=null!=t?t:e.metadata)&&void 0!==n?n:null};return"code"in e&&"number"==typeof e.code&&Number.isInteger(e.code)&&(r.code=e.code,"details"in e&&"string"==typeof e.details&&(r.details=e.details)),r}class c extends r.EventEmitter{constructor(e,t,n,r){super(),this.path=e,this.call=t,this.metadata=n,this.request=r,this.cancelled=!1}getPeer(){return this.call.getPeer()}sendMetadata(e){this.call.sendMetadata(e)}getDeadline(){return this.call.getDeadline()}getPath(){return this.path}getHost(){return this.call.getHost()}getAuthContext(){return this.call.getAuthContext()}getMetricsRecorder(){return this.call.getMetricsRecorder()}}t.ServerUnaryCallImpl=c;class l extends i.Readable{constructor(e,t,n){super({objectMode:!0}),this.path=e,this.call=t,this.metadata=n,this.cancelled=!1}_read(e){this.call.startRead()}getPeer(){return this.call.getPeer()}sendMetadata(e){this.call.sendMetadata(e)}getDeadline(){return this.call.getDeadline()}getPath(){return this.path}getHost(){return this.call.getHost()}getAuthContext(){return this.call.getAuthContext()}getMetricsRecorder(){return this.call.getMetricsRecorder()}}t.ServerReadableStreamImpl=l;class h extends i.Writable{constructor(e,t,n,r){super({objectMode:!0}),this.path=e,this.call=t,this.metadata=n,this.request=r,this.pendingStatus={code:s.Status.OK,details:"OK"},this.cancelled=!1,this.trailingMetadata=new o.Metadata,this.on("error",e=>{this.pendingStatus=a(e),this.end()})}getPeer(){return this.call.getPeer()}sendMetadata(e){this.call.sendMetadata(e)}getDeadline(){return this.call.getDeadline()}getPath(){return this.path}getHost(){return this.call.getHost()}getAuthContext(){return this.call.getAuthContext()}getMetricsRecorder(){return this.call.getMetricsRecorder()}_write(e,t,n){this.call.sendMessage(e,n)}_final(e){var t;e(null),this.call.sendStatus(Object.assign(Object.assign({},this.pendingStatus),{metadata:null!==(t=this.pendingStatus.metadata)&&void 0!==t?t:this.trailingMetadata}))}end(e){return e&&(this.trailingMetadata=e),super.end()}}t.ServerWritableStreamImpl=h;class u extends i.Duplex{constructor(e,t,n){super({objectMode:!0}),this.path=e,this.call=t,this.metadata=n,this.pendingStatus={code:s.Status.OK,details:"OK"},this.cancelled=!1,this.trailingMetadata=new o.Metadata,this.on("error",e=>{this.pendingStatus=a(e),this.end()})}getPeer(){return this.call.getPeer()}sendMetadata(e){this.call.sendMetadata(e)}getDeadline(){return this.call.getDeadline()}getPath(){return this.path}getHost(){return this.call.getHost()}getAuthContext(){return this.call.getAuthContext()}getMetricsRecorder(){return this.call.getMetricsRecorder()}_read(e){this.call.startRead()}_write(e,t,n){this.call.sendMessage(e,n)}_final(e){var t;e(null),this.call.sendStatus(Object.assign(Object.assign({},this.pendingStatus),{metadata:null!==(t=this.pendingStatus.metadata)&&void 0!==t?t:this.trailingMetadata}))}end(e){return e&&(this.trailingMetadata=e),super.end()}}t.ServerDuplexStreamImpl=u},6311(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ServerCredentials=void 0,t.createCertificateProviderServerCredentials=function(e,t,n){return new a(e,t,n)},t.createServerCredentialsWithInterceptors=function(e,t){return new c(e,t)};const r=n(9167);class i{constructor(e,t){this.serverConstructorOptions=e,this.watchers=new Set,this.latestContextOptions=null,this.latestContextOptions=null!=t?t:null}_addWatcher(e){this.watchers.add(e)}_removeWatcher(e){this.watchers.delete(e)}getWatcherCount(){return this.watchers.size}updateSecureContextOptions(e){this.latestContextOptions=e;for(const e of this.watchers)e(this.latestContextOptions)}_isSecure(){return null!==this.serverConstructorOptions}_getSecureContextOptions(){return this.latestContextOptions}_getConstructorOptions(){return this.serverConstructorOptions}_getInterceptors(){return[]}static createInsecure(){return new s}static createSsl(e,t,n=!1){var i;if(null!==e&&!Buffer.isBuffer(e))throw new TypeError("rootCerts must be null or a Buffer");if(!Array.isArray(t))throw new TypeError("keyCertPairs must be an array");if("boolean"!=typeof n)throw new TypeError("checkClientCertificate must be a boolean");const s=[],a=[];for(let e=0;e<t.length;e++){const n=t[e];if(null===n||"object"!=typeof n)throw new TypeError(`keyCertPair[${e}] must be an object`);if(!Buffer.isBuffer(n.private_key))throw new TypeError(`keyCertPair[${e}].private_key must be a Buffer`);if(!Buffer.isBuffer(n.cert_chain))throw new TypeError(`keyCertPair[${e}].cert_chain must be a Buffer`);s.push(n.cert_chain),a.push(n.private_key)}return new o({requestCert:n,ciphers:r.CIPHER_SUITES},{ca:null!==(i=null!=e?e:(0,r.getDefaultRootsData)())&&void 0!==i?i:void 0,cert:s,key:a})}}t.ServerCredentials=i;class s extends i{constructor(){super(null)}_getSettings(){return null}_equals(e){return e instanceof s}}class o extends i{constructor(e,t){super(e,t),this.options=Object.assign(Object.assign({},e),t)}_equals(e){if(this===e)return!0;if(!(e instanceof o))return!1;if(Buffer.isBuffer(this.options.ca)&&Buffer.isBuffer(e.options.ca)){if(!this.options.ca.equals(e.options.ca))return!1}else if(this.options.ca!==e.options.ca)return!1;if(Array.isArray(this.options.cert)&&Array.isArray(e.options.cert)){if(this.options.cert.length!==e.options.cert.length)return!1;for(let t=0;t<this.options.cert.length;t++){const n=this.options.cert[t],r=e.options.cert[t];if(Buffer.isBuffer(n)&&Buffer.isBuffer(r)){if(!n.equals(r))return!1}else if(n!==r)return!1}}else if(this.options.cert!==e.options.cert)return!1;if(Array.isArray(this.options.key)&&Array.isArray(e.options.key)){if(this.options.key.length!==e.options.key.length)return!1;for(let t=0;t<this.options.key.length;t++){const n=this.options.key[t],r=e.options.key[t];if(Buffer.isBuffer(n)&&Buffer.isBuffer(r)){if(!n.equals(r))return!1}else if(n!==r)return!1}}else if(this.options.key!==e.options.key)return!1;return this.options.requestCert===e.options.requestCert}}class a extends i{constructor(e,t,n){super({requestCert:null!==t,rejectUnauthorized:n,ciphers:r.CIPHER_SUITES}),this.identityCertificateProvider=e,this.caCertificateProvider=t,this.requireClientCertificate=n,this.latestCaUpdate=null,this.latestIdentityUpdate=null,this.caCertificateUpdateListener=this.handleCaCertificateUpdate.bind(this),this.identityCertificateUpdateListener=this.handleIdentityCertitificateUpdate.bind(this)}_addWatcher(e){var t;0===this.getWatcherCount()&&(null===(t=this.caCertificateProvider)||void 0===t||t.addCaCertificateListener(this.caCertificateUpdateListener),this.identityCertificateProvider.addIdentityCertificateListener(this.identityCertificateUpdateListener)),super._addWatcher(e)}_removeWatcher(e){var t;super._removeWatcher(e),0===this.getWatcherCount()&&(null===(t=this.caCertificateProvider)||void 0===t||t.removeCaCertificateListener(this.caCertificateUpdateListener),this.identityCertificateProvider.removeIdentityCertificateListener(this.identityCertificateUpdateListener))}_equals(e){return this===e||e instanceof a&&(this.caCertificateProvider===e.caCertificateProvider&&this.identityCertificateProvider===e.identityCertificateProvider&&this.requireClientCertificate===e.requireClientCertificate)}calculateSecureContextOptions(){var e;return null===this.latestIdentityUpdate||null!==this.caCertificateProvider&&null===this.latestCaUpdate?null:{ca:null===(e=this.latestCaUpdate)||void 0===e?void 0:e.caCertificate,cert:[this.latestIdentityUpdate.certificate],key:[this.latestIdentityUpdate.privateKey]}}finalizeUpdate(){const e=this.calculateSecureContextOptions();this.updateSecureContextOptions(e)}handleCaCertificateUpdate(e){this.latestCaUpdate=e,this.finalizeUpdate()}handleIdentityCertitificateUpdate(e){this.latestIdentityUpdate=e,this.finalizeUpdate()}}class c extends i{constructor(e,t){super({}),this.childCredentials=e,this.interceptors=t}_isSecure(){return this.childCredentials._isSecure()}_equals(e){if(!(e instanceof c))return!1;if(!this.childCredentials._equals(e.childCredentials))return!1;if(this.interceptors.length!==e.interceptors.length)return!1;for(let t=0;t<this.interceptors.length;t++)if(this.interceptors[t]!==e.interceptors[t])return!1;return!0}_getInterceptors(){return this.interceptors}_addWatcher(e){this.childCredentials._addWatcher(e)}_removeWatcher(e){this.childCredentials._removeWatcher(e)}_getConstructorOptions(){return this.childCredentials._getConstructorOptions()}_getSecureContextOptions(){return this.childCredentials._getSecureContextOptions()}}},4892(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.BaseServerInterceptingCall=t.ServerInterceptingCall=t.ResponderBuilder=t.ServerListenerBuilder=void 0,t.isInterceptingServerListener=function(e){return void 0!==e.onReceiveMetadata&&1===e.onReceiveMetadata.length},t.getServerInterceptingCall=function(e,t,n,r,i,s){const o={path:i.path,requestStream:"clientStream"===i.type||"bidi"===i.type,responseStream:"serverStream"===i.type||"bidi"===i.type,requestDeserialize:i.deserialize,responseSerialize:i.serialize},a=new k(t,n,r,i,s);return e.reduce((e,t)=>t(o,e),a)};const r=n(4097),i=n(131),s=n(5675),o=n(9752),a=n(3106),c=n(9453),l=n(267),h=n(4756),u=n(2921),d="server_call";function f(e){l.trace(i.LogVerbosity.DEBUG,d,e)}t.ServerListenerBuilder=class{constructor(){this.metadata=void 0,this.message=void 0,this.halfClose=void 0,this.cancel=void 0}withOnReceiveMetadata(e){return this.metadata=e,this}withOnReceiveMessage(e){return this.message=e,this}withOnReceiveHalfClose(e){return this.halfClose=e,this}withOnCancel(e){return this.cancel=e,this}build(){return{onReceiveMetadata:this.metadata,onReceiveMessage:this.message,onReceiveHalfClose:this.halfClose,onCancel:this.cancel}}};class p{constructor(e,t){this.listener=e,this.nextListener=t,this.cancelled=!1,this.processingMetadata=!1,this.hasPendingMessage=!1,this.pendingMessage=null,this.processingMessage=!1,this.hasPendingHalfClose=!1}processPendingMessage(){this.hasPendingMessage&&(this.nextListener.onReceiveMessage(this.pendingMessage),this.pendingMessage=null,this.hasPendingMessage=!1)}processPendingHalfClose(){this.hasPendingHalfClose&&(this.nextListener.onReceiveHalfClose(),this.hasPendingHalfClose=!1)}onReceiveMetadata(e){this.cancelled||(this.processingMetadata=!0,this.listener.onReceiveMetadata(e,e=>{this.processingMetadata=!1,this.cancelled||(this.nextListener.onReceiveMetadata(e),this.processPendingMessage(),this.processPendingHalfClose())}))}onReceiveMessage(e){this.cancelled||(this.processingMessage=!0,this.listener.onReceiveMessage(e,e=>{this.processingMessage=!1,this.cancelled||(this.processingMetadata?(this.pendingMessage=e,this.hasPendingMessage=!0):(this.nextListener.onReceiveMessage(e),this.processPendingHalfClose()))}))}onReceiveHalfClose(){this.cancelled||this.listener.onReceiveHalfClose(()=>{this.cancelled||(this.processingMetadata||this.processingMessage?this.hasPendingHalfClose=!0:this.nextListener.onReceiveHalfClose())})}onCancel(){this.cancelled=!0,this.listener.onCancel(),this.nextListener.onCancel()}}t.ResponderBuilder=class{constructor(){this.start=void 0,this.metadata=void 0,this.message=void 0,this.status=void 0}withStart(e){return this.start=e,this}withSendMetadata(e){return this.metadata=e,this}withSendMessage(e){return this.message=e,this}withSendStatus(e){return this.status=e,this}build(){return{start:this.start,sendMetadata:this.metadata,sendMessage:this.message,sendStatus:this.status}}};const g={onReceiveMetadata:(e,t)=>{t(e)},onReceiveMessage:(e,t)=>{t(e)},onReceiveHalfClose:e=>{e()},onCancel:()=>{}},m={start:e=>{e()},sendMetadata:(e,t)=>{t(e)},sendMessage:(e,t)=>{t(e)},sendStatus:(e,t)=>{t(e)}};t.ServerInterceptingCall=class{constructor(e,t){var n,r,i,s;this.nextCall=e,this.processingMetadata=!1,this.sentMetadata=!1,this.processingMessage=!1,this.pendingMessage=null,this.pendingMessageCallback=null,this.pendingStatus=null,this.responder={start:null!==(n=null==t?void 0:t.start)&&void 0!==n?n:m.start,sendMetadata:null!==(r=null==t?void 0:t.sendMetadata)&&void 0!==r?r:m.sendMetadata,sendMessage:null!==(i=null==t?void 0:t.sendMessage)&&void 0!==i?i:m.sendMessage,sendStatus:null!==(s=null==t?void 0:t.sendStatus)&&void 0!==s?s:m.sendStatus}}processPendingMessage(){this.pendingMessageCallback&&(this.nextCall.sendMessage(this.pendingMessage,this.pendingMessageCallback),this.pendingMessage=null,this.pendingMessageCallback=null)}processPendingStatus(){this.pendingStatus&&(this.nextCall.sendStatus(this.pendingStatus),this.pendingStatus=null)}start(e){this.responder.start(t=>{var n,r,i,s;const o={onReceiveMetadata:null!==(n=null==t?void 0:t.onReceiveMetadata)&&void 0!==n?n:g.onReceiveMetadata,onReceiveMessage:null!==(r=null==t?void 0:t.onReceiveMessage)&&void 0!==r?r:g.onReceiveMessage,onReceiveHalfClose:null!==(i=null==t?void 0:t.onReceiveHalfClose)&&void 0!==i?i:g.onReceiveHalfClose,onCancel:null!==(s=null==t?void 0:t.onCancel)&&void 0!==s?s:g.onCancel},a=new p(o,e);this.nextCall.start(a)})}sendMetadata(e){this.processingMetadata=!0,this.sentMetadata=!0,this.responder.sendMetadata(e,e=>{this.processingMetadata=!1,this.nextCall.sendMetadata(e),this.processPendingMessage(),this.processPendingStatus()})}sendMessage(e,t){this.processingMessage=!0,this.sentMetadata||this.sendMetadata(new r.Metadata),this.responder.sendMessage(e,e=>{this.processingMessage=!1,this.processingMetadata?(this.pendingMessage=e,this.pendingMessageCallback=t):this.nextCall.sendMessage(e,t)})}sendStatus(e){this.responder.sendStatus(e,e=>{this.processingMetadata||this.processingMessage?this.pendingStatus=e:this.nextCall.sendStatus(e)})}startRead(){this.nextCall.startRead()}getPeer(){return this.nextCall.getPeer()}getDeadline(){return this.nextCall.getDeadline()}getHost(){return this.nextCall.getHost()}getAuthContext(){return this.nextCall.getAuthContext()}getConnectionInfo(){return this.nextCall.getConnectionInfo()}getMetricsRecorder(){return this.nextCall.getMetricsRecorder()}};const _="grpc-accept-encoding",y="grpc-encoding",v="grpc-message",b="grpc-status",E="grpc-timeout",A=/(\d{1,8})\s*([HMSmun])/,S={H:36e5,M:6e4,S:1e3,m:1,u:.001,n:1e-6},w={[_]:"identity,deflate,gzip",[y]:"identity"},C={[s.constants.HTTP2_HEADER_STATUS]:s.constants.HTTP_STATUS_OK,[s.constants.HTTP2_HEADER_CONTENT_TYPE]:"application/grpc+proto"},I={waitForTrailers:!0};class k{constructor(e,t,n,o,a){var h,p;this.stream=e,this.callEventTracker=n,this.handler=o,this.listener=null,this.deadlineTimer=null,this.deadline=1/0,this.maxSendMessageSize=i.DEFAULT_MAX_SEND_MESSAGE_LENGTH,this.maxReceiveMessageSize=i.DEFAULT_MAX_RECEIVE_MESSAGE_LENGTH,this.cancelled=!1,this.metadataSent=!1,this.wantTrailers=!1,this.cancelNotified=!1,this.incomingEncoding="identity",this.readQueue=[],this.isReadPending=!1,this.receivedHalfClose=!1,this.streamEnded=!1,this.metricsRecorder=new u.PerRequestMetricRecorder,this.stream.once("error",e=>{}),this.stream.once("close",()=>{var e;f("Request to method "+(null===(e=this.handler)||void 0===e?void 0:e.path)+" stream closed with rstCode "+this.stream.rstCode),this.callEventTracker&&!this.streamEnded&&(this.streamEnded=!0,this.callEventTracker.onStreamEnd(!1),this.callEventTracker.onCallEnd({code:i.Status.CANCELLED,details:"Stream closed before sending status",metadata:null})),this.notifyOnCancel()}),this.stream.on("data",e=>{this.handleDataFrame(e)}),this.stream.pause(),this.stream.on("end",()=>{this.handleEndEvent()}),"grpc.max_send_message_length"in a&&(this.maxSendMessageSize=a["grpc.max_send_message_length"]),"grpc.max_receive_message_length"in a&&(this.maxReceiveMessageSize=a["grpc.max_receive_message_length"]),this.host=null!==(h=t[":authority"])&&void 0!==h?h:t.host,this.decoder=new c.StreamDecoder(this.maxReceiveMessageSize);const g=r.Metadata.fromHttp2Headers(t);l.isTracerEnabled(d)&&f("Request to "+this.handler.path+" received headers "+JSON.stringify(g.toJSON()));const m=g.get(E);m.length>0&&this.handleTimeoutHeader(m[0]);const v=g.get(y);v.length>0&&(this.incomingEncoding=v[0]),g.remove(E),g.remove(y),g.remove(_),g.remove(s.constants.HTTP2_HEADER_ACCEPT_ENCODING),g.remove(s.constants.HTTP2_HEADER_TE),g.remove(s.constants.HTTP2_HEADER_CONTENT_TYPE),this.metadata=g;const b=null===(p=e.session)||void 0===p?void 0:p.socket;this.connectionInfo={localAddress:null==b?void 0:b.localAddress,localPort:null==b?void 0:b.localPort,remoteAddress:null==b?void 0:b.remoteAddress,remotePort:null==b?void 0:b.remotePort},this.shouldSendMetrics=!!a["grpc.server_call_metric_recording"]}handleTimeoutHeader(e){const t=e.toString().match(A);if(null===t){const t={code:i.Status.INTERNAL,details:`Invalid ${E} value "${e}"`,metadata:null};return void process.nextTick(()=>{this.sendStatus(t)})}const n=+t[1]*S[t[2]]|0,r=new Date;this.deadline=r.setMilliseconds(r.getMilliseconds()+n),this.deadlineTimer=setTimeout(()=>{const e={code:i.Status.DEADLINE_EXCEEDED,details:"Deadline exceeded",metadata:null};this.sendStatus(e)},n)}checkCancelled(){return this.cancelled||!this.stream.destroyed&&!this.stream.closed||(this.notifyOnCancel(),this.cancelled=!0),this.cancelled}notifyOnCancel(){this.cancelNotified||(this.cancelNotified=!0,this.cancelled=!0,process.nextTick(()=>{var e;null===(e=this.listener)||void 0===e||e.onCancel()}),this.deadlineTimer&&clearTimeout(this.deadlineTimer),this.stream.resume())}maybeSendMetadata(){this.metadataSent||this.sendMetadata(new r.Metadata)}serializeMessage(e){const t=this.handler.serialize(e),n=t.byteLength,r=Buffer.allocUnsafe(n+5);return r.writeUInt8(0,0),r.writeUInt32BE(n,1),t.copy(r,5),r}decompressMessage(e,t){const n=e.subarray(5);if("identity"===t)return n;if("deflate"===t||"gzip"===t){let e;return e="deflate"===t?a.createInflate():a.createGunzip(),new Promise((t,r)=>{let s=0;const o=[];e.on("data",t=>{o.push(t),s+=t.byteLength,-1!==this.maxReceiveMessageSize&&s>this.maxReceiveMessageSize&&(e.destroy(),r({code:i.Status.RESOURCE_EXHAUSTED,details:`Received message that decompresses to a size larger than ${this.maxReceiveMessageSize}`}))}),e.on("end",()=>{t(Buffer.concat(o))}),e.write(n),e.end()})}return Promise.reject({code:i.Status.UNIMPLEMENTED,details:`Received message compressed with unsupported encoding "${t}"`})}async decompressAndMaybePush(e){if("COMPRESSED"!==e.type)throw new Error(`Invalid queue entry type: ${e.type}`);const t=1===e.compressedMessage.readUInt8(0)?this.incomingEncoding:"identity";let n;try{n=await this.decompressMessage(e.compressedMessage,t)}catch(e){return void this.sendStatus(e)}try{e.parsedMessage=this.handler.deserialize(n)}catch(e){return void this.sendStatus({code:i.Status.INTERNAL,details:`Error deserializing request: ${e.message}`})}e.type="READABLE",this.maybePushNextMessage()}maybePushNextMessage(){if(this.listener&&this.isReadPending&&this.readQueue.length>0&&"COMPRESSED"!==this.readQueue[0].type){this.isReadPending=!1;const e=this.readQueue.shift();"READABLE"===e.type?this.listener.onReceiveMessage(e.parsedMessage):this.listener.onReceiveHalfClose()}}handleDataFrame(e){var t;if(this.checkCancelled())return;let n;f("Request to "+this.handler.path+" received data frame of size "+e.length);try{n=this.decoder.write(e)}catch(e){return void this.sendStatus({code:i.Status.RESOURCE_EXHAUSTED,details:e.message})}for(const e of n){this.stream.pause();const n={type:"COMPRESSED",compressedMessage:e,parsedMessage:null};this.readQueue.push(n),this.decompressAndMaybePush(n),null===(t=this.callEventTracker)||void 0===t||t.addMessageReceived()}}handleEndEvent(){this.readQueue.push({type:"HALF_CLOSE",compressedMessage:null,parsedMessage:null}),this.receivedHalfClose=!0,this.maybePushNextMessage()}start(e){f("Request to "+this.handler.path+" start called"),this.checkCancelled()||(this.listener=e,e.onReceiveMetadata(this.metadata))}sendMetadata(e){if(this.checkCancelled())return;if(this.metadataSent)return;this.metadataSent=!0;const t=e?e.toHttp2Headers():null,n=Object.assign(Object.assign(Object.assign({},C),w),t);this.stream.respond(n,I)}sendMessage(e,t){if(this.checkCancelled())return;let n;try{n=this.serializeMessage(e)}catch(e){return void this.sendStatus({code:i.Status.INTERNAL,details:`Error serializing response: ${(0,o.getErrorMessage)(e)}`,metadata:null})}-1!==this.maxSendMessageSize&&n.length-5>this.maxSendMessageSize?this.sendStatus({code:i.Status.RESOURCE_EXHAUSTED,details:`Sent message larger than max (${n.length} vs. ${this.maxSendMessageSize})`,metadata:null}):(this.maybeSendMetadata(),f("Request to "+this.handler.path+" sent data frame of size "+n.length),this.stream.write(n,e=>{var n;e?this.sendStatus({code:i.Status.INTERNAL,details:`Error writing message: ${(0,o.getErrorMessage)(e)}`,metadata:null}):(null===(n=this.callEventTracker)||void 0===n||n.addMessageSent(),t())}))}sendStatus(e){var t,n,s;if(this.checkCancelled())return;f("Request to method "+(null===(t=this.handler)||void 0===t?void 0:t.path)+" ended with status code: "+i.Status[e.code]+" details: "+e.details);const o=null!==(s=null===(n=e.metadata)||void 0===n?void 0:n.clone())&&void 0!==s?s:new r.Metadata;if(this.shouldSendMetrics&&o.set(u.GRPC_METRICS_HEADER,this.metricsRecorder.serialize()),this.metadataSent)this.wantTrailers?this.notifyOnCancel():(this.wantTrailers=!0,this.stream.once("wantTrailers",()=>{this.callEventTracker&&!this.streamEnded&&(this.streamEnded=!0,this.callEventTracker.onStreamEnd(!0),this.callEventTracker.onCallEnd(e));const t=Object.assign({[b]:e.code,[v]:encodeURI(e.details)},o.toHttp2Headers());this.stream.sendTrailers(t),this.notifyOnCancel()}),this.stream.end());else{this.callEventTracker&&!this.streamEnded&&(this.streamEnded=!0,this.callEventTracker.onStreamEnd(!0),this.callEventTracker.onCallEnd(e));const t=Object.assign(Object.assign({[b]:e.code,[v]:encodeURI(e.details)},C),o.toHttp2Headers());this.stream.respond(t,{endStream:!0}),this.notifyOnCancel()}}startRead(){f("Request to "+this.handler.path+" startRead called"),this.checkCancelled()||(this.isReadPending=!0,0===this.readQueue.length?this.receivedHalfClose||this.stream.resume():this.maybePushNextMessage())}getPeer(){var e;const t=null===(e=this.stream.session)||void 0===e?void 0:e.socket;return(null==t?void 0:t.remoteAddress)?t.remotePort?`${t.remoteAddress}:${t.remotePort}`:t.remoteAddress:"unknown"}getDeadline(){return this.deadline}getHost(){return this.host}getAuthContext(){var e;if((null===(e=this.stream.session)||void 0===e?void 0:e.socket)instanceof h.TLSSocket){const e=this.stream.session.socket.getPeerCertificate();return{transportSecurityType:"ssl",sslPeerCertificate:e.raw?e:void 0}}return{}}getConnectionInfo(){return this.connectionInfo}getMetricsRecorder(){return this.metricsRecorder}}t.BaseServerInterceptingCall=k},5943(e,t,n){"use strict";var r=this&&this.__runInitializers||function(e,t,n){for(var r=arguments.length>2,i=0;i<t.length;i++)n=r?t[i].call(e,n):t[i].call(e);return r?n:void 0},i=this&&this.__esDecorate||function(e,t,n,r,i,s){function o(e){if(void 0!==e&&"function"!=typeof e)throw new TypeError("Function expected");return e}for(var a,c=r.kind,l="getter"===c?"get":"setter"===c?"set":"value",h=!t&&e?r.static?e:e.prototype:null,u=t||(h?Object.getOwnPropertyDescriptor(h,r.name):{}),d=!1,f=n.length-1;f>=0;f--){var p={};for(var g in r)p[g]="access"===g?{}:r[g];for(var g in r.access)p.access[g]=r.access[g];p.addInitializer=function(e){if(d)throw new TypeError("Cannot add initializers after decoration has completed");s.push(o(e||null))};var m=(0,n[f])("accessor"===c?{get:u.get,set:u.set}:u[l],p);if("accessor"===c){if(void 0===m)continue;if(null===m||"object"!=typeof m)throw new TypeError("Object expected");(a=o(m.get))&&(u.get=a),(a=o(m.set))&&(u.set=a),(a=o(m.init))&&i.unshift(a)}else(a=o(m))&&("field"===c?i.unshift(a):u[l]=a)}h&&Object.defineProperty(h,r.name,u),d=!0};Object.defineProperty(t,"__esModule",{value:!0}),t.Server=void 0;const s=n(5675),o=n(9023),a=n(131),c=n(6860),l=n(6311),h=n(9302),u=n(267),d=n(8996),f=n(3822),p=n(9503),g=n(4892),m=~(1<<31),_=~(1<<31),y=~(1<<31),{HTTP2_HEADER_PATH:v}=s.constants,b=Buffer.from("max_age");function E(e){u.trace(a.LogVerbosity.DEBUG,"server_call",e)}function A(){}function S(e){return{code:a.Status.UNIMPLEMENTED,details:`The server does not implement the method ${e}`}}let w=(()=>{var e;let t,n=[];return e=class{constructor(e){var t,i,s,o,a,c;this.boundPorts=(r(this,n),new Map),this.http2Servers=new Map,this.sessionIdleTimeouts=new Map,this.handlers=new Map,this.sessions=new Map,this.started=!1,this.shutdown=!1,this.serverAddressString="null",this.channelzEnabled=!0,this.options=null!=e?e:{},0===this.options["grpc.enable_channelz"]?(this.channelzEnabled=!1,this.channelzTrace=new p.ChannelzTraceStub,this.callTracker=new p.ChannelzCallTrackerStub,this.listenerChildrenTracker=new p.ChannelzChildrenTrackerStub,this.sessionChildrenTracker=new p.ChannelzChildrenTrackerStub):(this.channelzTrace=new p.ChannelzTrace,this.callTracker=new p.ChannelzCallTracker,this.listenerChildrenTracker=new p.ChannelzChildrenTracker,this.sessionChildrenTracker=new p.ChannelzChildrenTracker),this.channelzRef=(0,p.registerChannelzServer)("server",()=>this.getChannelzInfo(),this.channelzEnabled),this.channelzTrace.addTrace("CT_INFO","Server created"),this.maxConnectionAgeMs=null!==(t=this.options["grpc.max_connection_age_ms"])&&void 0!==t?t:m,this.maxConnectionAgeGraceMs=null!==(i=this.options["grpc.max_connection_age_grace_ms"])&&void 0!==i?i:m,this.keepaliveTimeMs=null!==(s=this.options["grpc.keepalive_time_ms"])&&void 0!==s?s:_,this.keepaliveTimeoutMs=null!==(o=this.options["grpc.keepalive_timeout_ms"])&&void 0!==o?o:2e4,this.sessionIdleTimeout=null!==(a=this.options["grpc.max_connection_idle_ms"])&&void 0!==a?a:y,this.commonServerOptions={maxSendHeaderBlockLength:Number.MAX_SAFE_INTEGER},"grpc-node.max_session_memory"in this.options?this.commonServerOptions.maxSessionMemory=this.options["grpc-node.max_session_memory"]:this.commonServerOptions.maxSessionMemory=Number.MAX_SAFE_INTEGER,"grpc.max_concurrent_streams"in this.options&&(this.commonServerOptions.settings={maxConcurrentStreams:this.options["grpc.max_concurrent_streams"]}),this.interceptors=null!==(c=this.options.interceptors)&&void 0!==c?c:[],this.trace("Server constructed")}getChannelzInfo(){return{trace:this.channelzTrace,callTracker:this.callTracker,listenerChildren:this.listenerChildrenTracker.getChildLists(),sessionChildren:this.sessionChildrenTracker.getChildLists()}}getChannelzSessionInfo(e){var t,n,r;const i=this.sessions.get(e),s=e.socket,o=s.remoteAddress?(0,d.stringToSubchannelAddress)(s.remoteAddress,s.remotePort):null,a=s.localAddress?(0,d.stringToSubchannelAddress)(s.localAddress,s.localPort):null;let c;if(e.encrypted){const e=s,n=e.getCipher(),r=e.getCertificate(),i=e.getPeerCertificate();c={cipherSuiteStandardName:null!==(t=n.standardName)&&void 0!==t?t:null,cipherSuiteOtherName:n.standardName?null:n.name,localCertificate:r&&"raw"in r?r.raw:null,remoteCertificate:i&&"raw"in i?i.raw:null}}else c=null;return{remoteAddress:o,localAddress:a,security:c,remoteName:null,streamsStarted:i.streamTracker.callsStarted,streamsSucceeded:i.streamTracker.callsSucceeded,streamsFailed:i.streamTracker.callsFailed,messagesSent:i.messagesSent,messagesReceived:i.messagesReceived,keepAlivesSent:i.keepAlivesSent,lastLocalStreamCreatedTimestamp:null,lastRemoteStreamCreatedTimestamp:i.streamTracker.lastCallStartedTimestamp,lastMessageSentTimestamp:i.lastMessageSentTimestamp,lastMessageReceivedTimestamp:i.lastMessageReceivedTimestamp,localFlowControlWindow:null!==(n=e.state.localWindowSize)&&void 0!==n?n:null,remoteFlowControlWindow:null!==(r=e.state.remoteWindowSize)&&void 0!==r?r:null}}trace(e){u.trace(a.LogVerbosity.DEBUG,"server","("+this.channelzRef.id+") "+e)}keepaliveTrace(e){u.trace(a.LogVerbosity.DEBUG,"keepalive","("+this.channelzRef.id+") "+e)}addProtoService(){throw new Error("Not implemented. Use addService() instead")}addService(e,t){if(null===e||"object"!=typeof e||null===t||"object"!=typeof t)throw new Error("addService() requires two objects as arguments");const n=Object.keys(e);if(0===n.length)throw new Error("Cannot add an empty service to a server");n.forEach(n=>{const r=e[n];let i;i=r.requestStream?r.responseStream?"bidi":"clientStream":r.responseStream?"serverStream":"unary";let s,o=t[n];void 0===o&&"string"==typeof r.originalName&&(o=t[r.originalName]),s=void 0!==o?o.bind(t):function(e,t){const n=S(t);switch(e){case"unary":case"clientStream":return(e,t)=>{t(n,null)};case"serverStream":case"bidi":return e=>{e.emit("error",n)};default:throw new Error(`Invalid handlerType ${e}`)}}(i,n);if(!1===this.register(r.path,s,r.responseSerialize,r.requestDeserialize,i))throw new Error(`Method handler for ${r.path} already provided.`)})}removeService(e){if(null===e||"object"!=typeof e)throw new Error("removeService() requires object as argument");Object.keys(e).forEach(t=>{const n=e[t];this.unregister(n.path)})}bind(e,t){throw new Error("Not implemented. Use bindAsync() instead")}experimentalRegisterListenerToChannelz(e){return(0,p.registerChannelzSocket)((0,d.subchannelAddressToString)(e),()=>({localAddress:e,remoteAddress:null,security:null,remoteName:null,streamsStarted:0,streamsSucceeded:0,streamsFailed:0,messagesSent:0,messagesReceived:0,keepAlivesSent:0,lastLocalStreamCreatedTimestamp:null,lastRemoteStreamCreatedTimestamp:null,lastMessageSentTimestamp:null,lastMessageReceivedTimestamp:null,localFlowControlWindow:null,remoteFlowControlWindow:null}),this.channelzEnabled)}experimentalUnregisterListenerFromChannelz(e){(0,p.unregisterChannelzRef)(e)}createHttp2Server(e){let t;if(e._isSecure()){const n=e._getConstructorOptions(),r=e._getSecureContextOptions(),i=Object.assign(Object.assign(Object.assign(Object.assign({},this.commonServerOptions),n),r),{enableTrace:1===this.options["grpc-node.tls_enable_trace"]});let o=null!==r;this.trace("Initial credentials valid: "+o),t=s.createSecureServer(i),t.prependListener("connection",e=>{o||(this.trace("Dropped connection from "+JSON.stringify(e.address())+" due to unloaded credentials"),e.destroy())}),t.on("secureConnection",e=>{e.on("error",e=>{this.trace("An incoming TLS connection closed with error: "+e.message)})});const c=e=>{if(e){const n=t;try{n.setSecureContext(e)}catch(t){u.log(a.LogVerbosity.ERROR,"Failed to set secure context with error "+t.message),e=null}}o=null!==e,this.trace("Post-update credentials valid: "+o)};e._addWatcher(c),t.on("close",()=>{e._removeWatcher(c)})}else t=s.createServer(this.commonServerOptions);return t.setTimeout(0,A),this._setupHandlers(t,e._getInterceptors()),t}bindOneAddress(e,t){this.trace("Attempting to bind "+(0,d.subchannelAddressToString)(e));const n=this.createHttp2Server(t.credentials);return new Promise((r,i)=>{const s=t=>{this.trace("Failed to bind "+(0,d.subchannelAddressToString)(e)+" with error "+t.message),r({port:"port"in e?e.port:1,error:t.message})};n.once("error",s),n.listen(e,()=>{const e=n.address();let i;i="string"==typeof e?{path:e}:{host:e.address,port:e.port};const o=this.experimentalRegisterListenerToChannelz(i);this.listenerChildrenTracker.refChild(o),this.http2Servers.set(n,{channelzRef:o,sessions:new Set,ownsChannelzRef:!0}),t.listeningServers.add(n),this.trace("Successfully bound "+(0,d.subchannelAddressToString)(i)),r({port:"port"in i?i.port:1}),n.removeListener("error",s)})})}async bindManyPorts(e,t){if(0===e.length)return{count:0,port:0,errors:[]};if((0,d.isTcpSubchannelAddress)(e[0])&&0===e[0].port){const n=await this.bindOneAddress(e[0],t);if(n.error){const r=await this.bindManyPorts(e.slice(1),t);return Object.assign(Object.assign({},r),{errors:[n.error,...r.errors]})}{const r=e.slice(1).map(e=>(0,d.isTcpSubchannelAddress)(e)?{host:e.host,port:n.port}:e),i=await Promise.all(r.map(e=>this.bindOneAddress(e,t))),s=[n,...i];return{count:s.filter(e=>void 0===e.error).length,port:n.port,errors:s.filter(e=>e.error).map(e=>e.error)}}}{const n=await Promise.all(e.map(e=>this.bindOneAddress(e,t)));return{count:n.filter(e=>void 0===e.error).length,port:n[0].port,errors:n.filter(e=>e.error).map(e=>e.error)}}}async bindAddressList(e,t){const n=await this.bindManyPorts(e,t);if(n.count>0)return n.count<e.length&&u.log(a.LogVerbosity.INFO,`WARNING Only ${n.count} addresses added out of total ${e.length} resolved`),n.port;{const t=`No address added out of total ${e.length} resolved`;throw u.log(a.LogVerbosity.ERROR,t),new Error(`${t} errors: [${n.errors.join(",")}]`)}}resolvePort(e){return new Promise((t,n)=>{let r=!1;(0,h.createResolver)(e,(i,s,o,a)=>{if(r)return!0;if(r=!0,!i.ok)return n(new Error(i.error.details)),!0;const c=[].concat(...i.value.map(e=>e.addresses));return 0===c.length?(n(new Error(`No addresses resolved for port ${e}`)),!0):(t(c),!0)},this.options).updateResolution()})}async bindPort(e,t){const n=await this.resolvePort(e);if(t.cancelled)throw this.completeUnbind(t),new Error("bindAsync operation cancelled by unbind call");const r=await this.bindAddressList(n,t);if(t.cancelled)throw this.completeUnbind(t),new Error("bindAsync operation cancelled by unbind call");return r}normalizePort(e){const t=(0,f.parseUri)(e);if(null===t)throw new Error(`Could not parse port "${e}"`);const n=(0,h.mapUriDefaultScheme)(t);if(null===n)throw new Error(`Could not get a default scheme for port "${e}"`);return n}bindAsync(e,t,n){if(this.shutdown)throw new Error("bindAsync called after shutdown");if("string"!=typeof e)throw new TypeError("port must be a string");if(null===t||!(t instanceof l.ServerCredentials))throw new TypeError("creds must be a ServerCredentials object");if("function"!=typeof n)throw new TypeError("callback must be a function");this.trace("bindAsync port="+e);const r=this.normalizePort(e),i=(e,t)=>{process.nextTick(()=>n(e,t))};let s=this.boundPorts.get((0,f.uriToString)(r));if(s)return t._equals(s.credentials)?(s.cancelled=!1,void(s.completionPromise?s.completionPromise.then(e=>n(null,e),e=>n(e,0)):i(null,s.portNumber))):void i(new Error(`${e} already bound with incompatible credentials`),0);s={mapKey:(0,f.uriToString)(r),originalUri:r,completionPromise:null,cancelled:!1,portNumber:0,credentials:t,listeningServers:new Set};const o=(0,f.splitHostPort)(r.path),a=this.bindPort(r,s);s.completionPromise=a,0===(null==o?void 0:o.port)?a.then(e=>{const t={scheme:r.scheme,authority:r.authority,path:(0,f.combineHostPort)({host:o.host,port:e})};s.mapKey=(0,f.uriToString)(t),s.completionPromise=null,s.portNumber=e,this.boundPorts.set(s.mapKey,s),n(null,e)},e=>{n(e,0)}):(this.boundPorts.set(s.mapKey,s),a.then(e=>{s.completionPromise=null,s.portNumber=e,n(null,e)},e=>{n(e,0)}))}registerInjectorToChannelz(){return(0,p.registerChannelzSocket)("injector",()=>({localAddress:null,remoteAddress:null,security:null,remoteName:null,streamsStarted:0,streamsSucceeded:0,streamsFailed:0,messagesSent:0,messagesReceived:0,keepAlivesSent:0,lastLocalStreamCreatedTimestamp:null,lastRemoteStreamCreatedTimestamp:null,lastMessageSentTimestamp:null,lastMessageReceivedTimestamp:null,localFlowControlWindow:null,remoteFlowControlWindow:null}),this.channelzEnabled)}experimentalCreateConnectionInjectorWithChannelzRef(e,t,n=!1){if(null===e||!(e instanceof l.ServerCredentials))throw new TypeError("creds must be a ServerCredentials object");this.channelzEnabled&&this.listenerChildrenTracker.refChild(t);const r=this.createHttp2Server(e),i=new Set;return this.http2Servers.set(r,{channelzRef:t,sessions:i,ownsChannelzRef:n}),{injectConnection:e=>{r.emit("connection",e)},drain:e=>{var t,n;for(const e of i)this.closeSession(e);null===(n=(t=setTimeout(()=>{for(const e of i)e.destroy(s.constants.NGHTTP2_CANCEL)},e)).unref)||void 0===n||n.call(t)},destroy:()=>{this.closeServer(r);for(const e of i)this.closeSession(e)}}}createConnectionInjector(e){if(null===e||!(e instanceof l.ServerCredentials))throw new TypeError("creds must be a ServerCredentials object");const t=this.registerInjectorToChannelz();return this.experimentalCreateConnectionInjectorWithChannelzRef(e,t,!0)}closeServer(e,t){this.trace("Closing server with address "+JSON.stringify(e.address()));const n=this.http2Servers.get(e);e.close(()=>{n&&n.ownsChannelzRef&&(this.listenerChildrenTracker.unrefChild(n.channelzRef),(0,p.unregisterChannelzRef)(n.channelzRef)),this.http2Servers.delete(e),null==t||t()})}closeSession(e,t){var n;this.trace("Closing session initiated by "+(null===(n=e.socket)||void 0===n?void 0:n.remoteAddress));const r=this.sessions.get(e),i=()=>{r&&(this.sessionChildrenTracker.unrefChild(r.ref),(0,p.unregisterChannelzRef)(r.ref)),null==t||t()};e.closed?queueMicrotask(i):e.close(i)}completeUnbind(e){for(const t of e.listeningServers){const n=this.http2Servers.get(t);if(this.closeServer(t,()=>{e.listeningServers.delete(t)}),n)for(const e of n.sessions)this.closeSession(e)}this.boundPorts.delete(e.mapKey)}unbind(e){this.trace("unbind port="+e);const t=this.normalizePort(e),n=(0,f.splitHostPort)(t.path);if(0===(null==n?void 0:n.port))throw new Error("Cannot unbind port 0");const r=this.boundPorts.get((0,f.uriToString)(t));r&&(this.trace("unbinding "+r.mapKey+" originally bound as "+(0,f.uriToString)(r.originalUri)),r.completionPromise?r.cancelled=!0:this.completeUnbind(r))}drain(e,t){var n,r;this.trace("drain port="+e+" graceTimeMs="+t);const i=this.normalizePort(e),o=(0,f.splitHostPort)(i.path);if(0===(null==o?void 0:o.port))throw new Error("Cannot drain port 0");const a=this.boundPorts.get((0,f.uriToString)(i));if(!a)return;const c=new Set;for(const e of a.listeningServers){const t=this.http2Servers.get(e);if(t)for(const e of t.sessions)c.add(e),this.closeSession(e,()=>{c.delete(e)})}null===(r=(n=setTimeout(()=>{for(const e of c)e.destroy(s.constants.NGHTTP2_CANCEL)},t)).unref)||void 0===r||r.call(n)}forceShutdown(){for(const e of this.boundPorts.values())e.cancelled=!0;this.boundPorts.clear();for(const e of this.http2Servers.keys())this.closeServer(e);this.sessions.forEach((e,t)=>{this.closeSession(t),t.destroy(s.constants.NGHTTP2_CANCEL)}),this.sessions.clear(),(0,p.unregisterChannelzRef)(this.channelzRef),this.shutdown=!0}register(e,t,n,r,i){return!this.handlers.has(e)&&(this.handlers.set(e,{func:t,serialize:n,deserialize:r,type:i,path:e}),!0)}unregister(e){return this.handlers.delete(e)}start(){if(0===this.http2Servers.size||[...this.http2Servers.keys()].every(e=>!e.listening))throw new Error("server must be bound in order to start");if(!0===this.started)throw new Error("server is already started");this.started=!0}tryShutdown(e){var t;const n=t=>{(0,p.unregisterChannelzRef)(this.channelzRef),e(t)};let r=0;function i(){r--,0===r&&n()}this.shutdown=!0;for(const[e,n]of this.http2Servers.entries()){r++;const s=n.channelzRef.name;this.trace("Waiting for server "+s+" to close"),this.closeServer(e,()=>{this.trace("Server "+s+" finished closing"),i()});for(const e of n.sessions.keys()){r++;const n=null===(t=e.socket)||void 0===t?void 0:t.remoteAddress;this.trace("Waiting for session "+n+" to close"),this.closeSession(e,()=>{this.trace("Session "+n+" finished closing"),i()})}}0===r&&n()}addHttp2Port(){throw new Error("Not yet implemented")}getChannelzRef(){return this.channelzRef}_verifyContentType(e,t){const n=t[s.constants.HTTP2_HEADER_CONTENT_TYPE];return!("string"!=typeof n||!n.startsWith("application/grpc"))||(e.respond({[s.constants.HTTP2_HEADER_STATUS]:s.constants.HTTP_STATUS_UNSUPPORTED_MEDIA_TYPE},{endStream:!0}),!1)}_retrieveHandler(e){E("Received call to method "+e+" at address "+this.serverAddressString);const t=this.handlers.get(e);return void 0===t?(E("No handler registered for method "+e+". Sending UNIMPLEMENTED status."),null):t}_respondWithError(e,t,n=null){var r,i;const o=Object.assign({"grpc-status":null!==(r=e.code)&&void 0!==r?r:a.Status.INTERNAL,"grpc-message":e.details,[s.constants.HTTP2_HEADER_STATUS]:s.constants.HTTP_STATUS_OK,[s.constants.HTTP2_HEADER_CONTENT_TYPE]:"application/grpc+proto"},null===(i=e.metadata)||void 0===i?void 0:i.toHttp2Headers());t.respond(o,{endStream:!0}),this.callTracker.addCallFailed(),null==n||n.streamTracker.addCallFailed()}_channelzHandler(e,t,n){this.onStreamOpened(t);const r=this.sessions.get(t.session);if(this.callTracker.addCallStarted(),null==r||r.streamTracker.addCallStarted(),!this._verifyContentType(t,n))return this.callTracker.addCallFailed(),void(null==r||r.streamTracker.addCallFailed());const i=n[v],s=this._retrieveHandler(i);if(!s)return void this._respondWithError(S(i),t,r);const o={addMessageSent:()=>{r&&(r.messagesSent+=1,r.lastMessageSentTimestamp=new Date)},addMessageReceived:()=>{r&&(r.messagesReceived+=1,r.lastMessageReceivedTimestamp=new Date)},onCallEnd:e=>{e.code===a.Status.OK?this.callTracker.addCallSucceeded():this.callTracker.addCallFailed()},onStreamEnd:e=>{r&&(e?r.streamTracker.addCallSucceeded():r.streamTracker.addCallFailed())}},c=(0,g.getServerInterceptingCall)([...e,...this.interceptors],t,n,o,s,this.options);this._runHandlerForCall(c,s)||(this.callTracker.addCallFailed(),null==r||r.streamTracker.addCallFailed(),c.sendStatus({code:a.Status.INTERNAL,details:`Unknown handler type: ${s.type}`}))}_streamHandler(e,t,n){if(this.onStreamOpened(t),!0!==this._verifyContentType(t,n))return;const r=n[v],i=this._retrieveHandler(r);if(!i)return void this._respondWithError(S(r),t,null);const s=(0,g.getServerInterceptingCall)([...e,...this.interceptors],t,n,null,i,this.options);this._runHandlerForCall(s,i)||s.sendStatus({code:a.Status.INTERNAL,details:`Unknown handler type: ${i.type}`})}_runHandlerForCall(e,t){const{type:n}=t;if("unary"===n)!async function(e,t){let n,r;function i(t,n,r,i){t?e.sendStatus((0,c.serverErrorToStatus)(t,r)):e.sendMessage(n,()=>{e.sendStatus({code:a.Status.OK,details:"OK",metadata:null!=r?r:null})})}let s=null;e.start({onReceiveMetadata(t){r=t,e.startRead()},onReceiveMessage(n){s?e.sendStatus({code:a.Status.UNIMPLEMENTED,details:`Received a second request message for server streaming method ${t.path}`,metadata:null}):(s=n,e.startRead())},onReceiveHalfClose(){if(s){n=new c.ServerWritableStreamImpl(t.path,e,r,s);try{t.func(n,i)}catch(t){e.sendStatus({code:a.Status.UNKNOWN,details:`Server method handler threw error ${t.message}`,metadata:null})}}else e.sendStatus({code:a.Status.UNIMPLEMENTED,details:`Received no request message for server streaming method ${t.path}`,metadata:null})},onCancel(){n&&(n.cancelled=!0,n.emit("cancelled","cancelled"))}})}(e,t);else if("clientStream"===n)!function(e,t){let n;function r(t,n,r,i){t?e.sendStatus((0,c.serverErrorToStatus)(t,r)):e.sendMessage(n,()=>{e.sendStatus({code:a.Status.OK,details:"OK",metadata:null!=r?r:null})})}e.start({onReceiveMetadata(i){n=new c.ServerDuplexStreamImpl(t.path,e,i);try{t.func(n,r)}catch(t){e.sendStatus({code:a.Status.UNKNOWN,details:`Server method handler threw error ${t.message}`,metadata:null})}},onReceiveMessage(e){n.push(e)},onReceiveHalfClose(){n.push(null)},onCancel(){n&&(n.cancelled=!0,n.emit("cancelled","cancelled"),n.destroy())}})}(e,t);else if("serverStream"===n)!function(e,t){let n,r,i=null;e.start({onReceiveMetadata(t){r=t,e.startRead()},onReceiveMessage(n){i?e.sendStatus({code:a.Status.UNIMPLEMENTED,details:`Received a second request message for server streaming method ${t.path}`,metadata:null}):(i=n,e.startRead())},onReceiveHalfClose(){if(i){n=new c.ServerWritableStreamImpl(t.path,e,r,i);try{t.func(n)}catch(t){e.sendStatus({code:a.Status.UNKNOWN,details:`Server method handler threw error ${t.message}`,metadata:null})}}else e.sendStatus({code:a.Status.UNIMPLEMENTED,details:`Received no request message for server streaming method ${t.path}`,metadata:null})},onCancel(){n&&(n.cancelled=!0,n.emit("cancelled","cancelled"),n.destroy())}})}(e,t);else{if("bidi"!==n)return!1;!function(e,t){let n;e.start({onReceiveMetadata(r){n=new c.ServerDuplexStreamImpl(t.path,e,r);try{t.func(n)}catch(t){e.sendStatus({code:a.Status.UNKNOWN,details:`Server method handler threw error ${t.message}`,metadata:null})}},onReceiveMessage(e){n.push(e)},onReceiveHalfClose(){n.push(null)},onCancel(){n&&(n.cancelled=!0,n.emit("cancelled","cancelled"),n.destroy())}})}(e,t)}return!0}_setupHandlers(e,t){if(null===e)return;const n=e.address();let r="null";n&&(r="string"==typeof n?n:n.address+":"+n.port),this.serverAddressString=r;const i=this.channelzEnabled?this._channelzHandler:this._streamHandler,s=this.channelzEnabled?this._channelzSessionHandler(e):this._sessionHandler(e);e.on("stream",i.bind(this,t)),e.on("session",s)}_sessionHandler(e){return t=>{var n,r;null===(n=this.http2Servers.get(e))||void 0===n||n.sessions.add(t);let i=null,o=null,a=null,c=!1;const l=this.enableIdleTimeout(t);if(this.maxConnectionAgeMs!==m){const e=this.maxConnectionAgeMs/10,n=Math.random()*e*2-e;i=setTimeout(()=>{var e,n;c=!0,this.trace("Connection dropped by max connection age: "+(null===(e=t.socket)||void 0===e?void 0:e.remoteAddress));try{t.goaway(s.constants.NGHTTP2_NO_ERROR,~(1<<31),b)}catch(e){return void t.destroy()}t.close(),this.maxConnectionAgeGraceMs!==m&&(o=setTimeout(()=>{t.destroy()},this.maxConnectionAgeGraceMs),null===(n=o.unref)||void 0===n||n.call(o))},this.maxConnectionAgeMs+n),null===(r=i.unref)||void 0===r||r.call(i)}const h=()=>{a&&(clearTimeout(a),a=null)},u=()=>!t.destroyed&&this.keepaliveTimeMs<_&&this.keepaliveTimeMs>0;let d;const f=()=>{var e;u()&&(this.keepaliveTrace("Starting keepalive timer for "+this.keepaliveTimeMs+"ms"),a=setTimeout(()=>{h(),d()},this.keepaliveTimeMs),null===(e=a.unref)||void 0===e||e.call(a))};d=()=>{var e;if(!u())return;this.keepaliveTrace("Sending ping with timeout "+this.keepaliveTimeoutMs+"ms");let n="";try{t.ping((e,n,r)=>{h(),e?(this.keepaliveTrace("Ping failed with error: "+e.message),c=!0,t.destroy()):(this.keepaliveTrace("Received ping response"),f())})||(n="Ping returned false")}catch(e){n=(e instanceof Error?e.message:"")||"Unknown error"}if(n)return this.keepaliveTrace("Ping send failed: "+n),this.trace("Connection dropped due to ping send error: "+n),c=!0,void t.destroy();a=setTimeout(()=>{h(),this.keepaliveTrace("Ping timeout passed without response"),this.trace("Connection dropped by keepalive timeout"),c=!0,t.destroy()},this.keepaliveTimeoutMs),null===(e=a.unref)||void 0===e||e.call(a)},f(),t.on("close",()=>{var n,r;c||this.trace(`Connection dropped by client ${null===(n=t.socket)||void 0===n?void 0:n.remoteAddress}`),i&&clearTimeout(i),o&&clearTimeout(o),h(),null!==l&&(clearTimeout(l.timeout),this.sessionIdleTimeouts.delete(t)),null===(r=this.http2Servers.get(e))||void 0===r||r.sessions.delete(t)})}}_channelzSessionHandler(e){return t=>{var n,r,i,o;const a=(0,p.registerChannelzSocket)(null!==(r=null===(n=t.socket)||void 0===n?void 0:n.remoteAddress)&&void 0!==r?r:"unknown",this.getChannelzSessionInfo.bind(this,t),this.channelzEnabled),c={ref:a,streamTracker:new p.ChannelzCallTracker,messagesSent:0,messagesReceived:0,keepAlivesSent:0,lastMessageSentTimestamp:null,lastMessageReceivedTimestamp:null};null===(i=this.http2Servers.get(e))||void 0===i||i.sessions.add(t),this.sessions.set(t,c);const l=`${t.socket.remoteAddress}:${t.socket.remotePort}`;this.channelzTrace.addTrace("CT_INFO","Connection established by client "+l),this.trace("Connection established by client "+l),this.sessionChildrenTracker.refChild(a);let h=null,u=null,d=null,f=!1;const g=this.enableIdleTimeout(t);if(this.maxConnectionAgeMs!==m){const e=this.maxConnectionAgeMs/10,n=Math.random()*e*2-e;h=setTimeout(()=>{var e;f=!0,this.channelzTrace.addTrace("CT_INFO","Connection dropped by max connection age from "+l);try{t.goaway(s.constants.NGHTTP2_NO_ERROR,~(1<<31),b)}catch(e){return void t.destroy()}t.close(),this.maxConnectionAgeGraceMs!==m&&(u=setTimeout(()=>{t.destroy()},this.maxConnectionAgeGraceMs),null===(e=u.unref)||void 0===e||e.call(u))},this.maxConnectionAgeMs+n),null===(o=h.unref)||void 0===o||o.call(h)}const y=()=>{d&&(clearTimeout(d),d=null)},v=()=>!t.destroyed&&this.keepaliveTimeMs<_&&this.keepaliveTimeMs>0;let E;const A=()=>{var e;v()&&(this.keepaliveTrace("Starting keepalive timer for "+this.keepaliveTimeMs+"ms"),d=setTimeout(()=>{y(),E()},this.keepaliveTimeMs),null===(e=d.unref)||void 0===e||e.call(d))};E=()=>{var e;if(!v())return;this.keepaliveTrace("Sending ping with timeout "+this.keepaliveTimeoutMs+"ms");let n="";try{t.ping((e,n,r)=>{y(),e?(this.keepaliveTrace("Ping failed with error: "+e.message),this.channelzTrace.addTrace("CT_INFO","Connection dropped due to error of a ping frame "+e.message+" return in "+n),f=!0,t.destroy()):(this.keepaliveTrace("Received ping response"),A())})||(n="Ping returned false")}catch(e){n=(e instanceof Error?e.message:"")||"Unknown error"}if(n)return this.keepaliveTrace("Ping send failed: "+n),this.channelzTrace.addTrace("CT_INFO","Connection dropped due to ping send error: "+n),f=!0,void t.destroy();c.keepAlivesSent+=1,d=setTimeout(()=>{y(),this.keepaliveTrace("Ping timeout passed without response"),this.channelzTrace.addTrace("CT_INFO","Connection dropped by keepalive timeout from "+l),f=!0,t.destroy()},this.keepaliveTimeoutMs),null===(e=d.unref)||void 0===e||e.call(d)},A(),t.on("close",()=>{var n;f||this.channelzTrace.addTrace("CT_INFO","Connection dropped by client "+l),this.sessionChildrenTracker.unrefChild(a),(0,p.unregisterChannelzRef)(a),h&&clearTimeout(h),u&&clearTimeout(u),y(),null!==g&&(clearTimeout(g.timeout),this.sessionIdleTimeouts.delete(t)),null===(n=this.http2Servers.get(e))||void 0===n||n.sessions.delete(t),this.sessions.delete(t)})}}enableIdleTimeout(e){var t,n;if(this.sessionIdleTimeout>=y)return null;const r={activeStreams:0,lastIdle:Date.now(),onClose:this.onStreamClose.bind(this,e),timeout:setTimeout(this.onIdleTimeout,this.sessionIdleTimeout,this,e)};null===(n=(t=r.timeout).unref)||void 0===n||n.call(t),this.sessionIdleTimeouts.set(e,r);const{socket:i}=e;return this.trace("Enable idle timeout for "+i.remoteAddress+":"+i.remotePort),r}onIdleTimeout(e,t){const{socket:n}=t,r=e.sessionIdleTimeouts.get(t);void 0!==r&&0===r.activeStreams&&(Date.now()-r.lastIdle>=e.sessionIdleTimeout?(e.trace("Session idle timeout triggered for "+(null==n?void 0:n.remoteAddress)+":"+(null==n?void 0:n.remotePort)+" last idle at "+r.lastIdle),e.closeSession(t)):r.timeout.refresh())}onStreamOpened(e){const t=e.session,n=this.sessionIdleTimeouts.get(t);n&&(n.activeStreams+=1,e.once("close",n.onClose))}onStreamClose(e){var t,n;const r=this.sessionIdleTimeouts.get(e);r&&(r.activeStreams-=1,0===r.activeStreams&&(r.lastIdle=Date.now(),r.timeout.refresh(),this.trace("Session onStreamClose"+(null===(t=e.socket)||void 0===t?void 0:t.remoteAddress)+":"+(null===(n=e.socket)||void 0===n?void 0:n.remotePort)+" at "+r.lastIdle)))}},(()=>{const r="function"==typeof Symbol&&Symbol.metadata?Object.create(null):void 0;var s;t=[(s="Calling start() is no longer necessary. It can be safely omitted.",function(e,t){return o.deprecate(e,s)})],i(e,null,t,{kind:"method",name:"start",static:!1,private:!1,access:{has:e=>"start"in e,get:e=>e.start},metadata:r},null,n),r&&Object.defineProperty(e,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:r})})(),e})();t.Server=w},5656(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.validateRetryThrottling=c,t.validateServiceConfig=h,t.extractAndSelectServiceConfig=function(e,t){for(const n of e)if(n.length>0&&n[0].startsWith("grpc_config=")){const e=n.join("").substring(12);return d(JSON.parse(e),t)}return null};const r=n(857),i=n(131),s=/^\d+(\.\d{1,9})?s$/;function o(e){if("service"in e&&""!==e.service){if("string"!=typeof e.service)throw new Error("Invalid method config name: invalid service: expected type string, got "+typeof e.service);if("method"in e&&""!==e.method){if("string"!=typeof e.method)throw new Error("Invalid method config name: invalid method: expected type string, got "+typeof e.service);return{service:e.service,method:e.method}}return{service:e.service}}if("method"in e&&void 0!==e.method)throw new Error("Invalid method config name: method set with empty or unset service");return{}}function a(e){var t;const n={name:[]};if(!("name"in e)||!Array.isArray(e.name))throw new Error("Invalid method config: invalid name array");for(const t of e.name)n.name.push(o(t));if("waitForReady"in e){if("boolean"!=typeof e.waitForReady)throw new Error("Invalid method config: invalid waitForReady");n.waitForReady=e.waitForReady}if("timeout"in e)if("object"==typeof e.timeout){if(!("seconds"in e.timeout)||"number"!=typeof e.timeout.seconds)throw new Error("Invalid method config: invalid timeout.seconds");if(!("nanos"in e.timeout)||"number"!=typeof e.timeout.nanos)throw new Error("Invalid method config: invalid timeout.nanos");n.timeout=e.timeout}else{if("string"!=typeof e.timeout||!s.test(e.timeout))throw new Error("Invalid method config: invalid timeout");{const r=e.timeout.substring(0,e.timeout.length-1).split(".");n.timeout={seconds:0|r[0],nanos:0|(null!==(t=r[1])&&void 0!==t?t:0)}}}if("maxRequestBytes"in e){if("number"!=typeof e.maxRequestBytes)throw new Error("Invalid method config: invalid maxRequestBytes");n.maxRequestBytes=e.maxRequestBytes}if("maxResponseBytes"in e){if("number"!=typeof e.maxResponseBytes)throw new Error("Invalid method config: invalid maxRequestBytes");n.maxResponseBytes=e.maxResponseBytes}if("retryPolicy"in e){if("hedgingPolicy"in e)throw new Error("Invalid method config: retryPolicy and hedgingPolicy cannot both be specified");n.retryPolicy=function(e){if(!("maxAttempts"in e)||!Number.isInteger(e.maxAttempts)||e.maxAttempts<2)throw new Error("Invalid method config retry policy: maxAttempts must be an integer at least 2");if(!("initialBackoff"in e)||"string"!=typeof e.initialBackoff||!s.test(e.initialBackoff))throw new Error("Invalid method config retry policy: initialBackoff must be a string consisting of a positive integer or decimal followed by s");if(!("maxBackoff"in e)||"string"!=typeof e.maxBackoff||!s.test(e.maxBackoff))throw new Error("Invalid method config retry policy: maxBackoff must be a string consisting of a positive integer or decimal followed by s");if(!("backoffMultiplier"in e)||"number"!=typeof e.backoffMultiplier||e.backoffMultiplier<=0)throw new Error("Invalid method config retry policy: backoffMultiplier must be a number greater than 0");if(!("retryableStatusCodes"in e)||!Array.isArray(e.retryableStatusCodes))throw new Error("Invalid method config retry policy: retryableStatusCodes is required");if(0===e.retryableStatusCodes.length)throw new Error("Invalid method config retry policy: retryableStatusCodes must be non-empty");for(const t of e.retryableStatusCodes)if("number"==typeof t){if(!Object.values(i.Status).includes(t))throw new Error("Invalid method config retry policy: retryableStatusCodes value not in status code range")}else{if("string"!=typeof t)throw new Error("Invalid method config retry policy: retryableStatusCodes value must be a string or number");if(!Object.values(i.Status).includes(t.toUpperCase()))throw new Error("Invalid method config retry policy: retryableStatusCodes value not a status code name")}return{maxAttempts:e.maxAttempts,initialBackoff:e.initialBackoff,maxBackoff:e.maxBackoff,backoffMultiplier:e.backoffMultiplier,retryableStatusCodes:e.retryableStatusCodes}}(e.retryPolicy)}else"hedgingPolicy"in e&&(n.hedgingPolicy=function(e){if(!("maxAttempts"in e)||!Number.isInteger(e.maxAttempts)||e.maxAttempts<2)throw new Error("Invalid method config hedging policy: maxAttempts must be an integer at least 2");if("hedgingDelay"in e&&("string"!=typeof e.hedgingDelay||!s.test(e.hedgingDelay)))throw new Error("Invalid method config hedging policy: hedgingDelay must be a string consisting of a positive integer followed by s");if("nonFatalStatusCodes"in e&&Array.isArray(e.nonFatalStatusCodes))for(const t of e.nonFatalStatusCodes)if("number"==typeof t){if(!Object.values(i.Status).includes(t))throw new Error("Invalid method config hedging policy: nonFatalStatusCodes value not in status code range")}else{if("string"!=typeof t)throw new Error("Invalid method config hedging policy: nonFatalStatusCodes value must be a string or number");if(!Object.values(i.Status).includes(t.toUpperCase()))throw new Error("Invalid method config hedging policy: nonFatalStatusCodes value not a status code name")}const t={maxAttempts:e.maxAttempts};return e.hedgingDelay&&(t.hedgingDelay=e.hedgingDelay),e.nonFatalStatusCodes&&(t.nonFatalStatusCodes=e.nonFatalStatusCodes),t}(e.hedgingPolicy));return n}function c(e){if(!("maxTokens"in e)||"number"!=typeof e.maxTokens||e.maxTokens<=0||e.maxTokens>1e3)throw new Error("Invalid retryThrottling: maxTokens must be a number in (0, 1000]");if(!("tokenRatio"in e)||"number"!=typeof e.tokenRatio||e.tokenRatio<=0)throw new Error("Invalid retryThrottling: tokenRatio must be a number greater than 0");return{maxTokens:+e.maxTokens.toFixed(3),tokenRatio:+e.tokenRatio.toFixed(3)}}function l(e){if("object"!=typeof e||null===e)throw new Error("Invalid loadBalancingConfig: unexpected type "+typeof e);const t=Object.keys(e);if(t.length>1)throw new Error(`Invalid loadBalancingConfig: unexpected multiple keys ${t}`);if(0===t.length)throw new Error("Invalid loadBalancingConfig: load balancing policy name required");return{[t[0]]:e[t[0]]}}function h(e){const t={loadBalancingConfig:[],methodConfig:[]};if("loadBalancingPolicy"in e){if("string"!=typeof e.loadBalancingPolicy)throw new Error("Invalid service config: invalid loadBalancingPolicy");t.loadBalancingPolicy=e.loadBalancingPolicy}if("loadBalancingConfig"in e){if(!Array.isArray(e.loadBalancingConfig))throw new Error("Invalid service config: invalid loadBalancingConfig");for(const n of e.loadBalancingConfig)t.loadBalancingConfig.push(l(n))}if("methodConfig"in e&&Array.isArray(e.methodConfig))for(const n of e.methodConfig)t.methodConfig.push(a(n));"retryThrottling"in e&&(t.retryThrottling=c(e.retryThrottling));const n=[];for(const e of t.methodConfig)for(const t of e.name){for(const e of n)if(t.service===e.service&&t.method===e.method)throw new Error(`Invalid service config: duplicate name ${t.service}/${t.method}`);n.push(t)}return t}function u(e){if(!("serviceConfig"in e))throw new Error("Invalid service config choice: missing service config");const t={serviceConfig:h(e.serviceConfig)};if("clientLanguage"in e){if(!Array.isArray(e.clientLanguage))throw new Error("Invalid service config choice: invalid clientLanguage");t.clientLanguage=[];for(const n of e.clientLanguage){if("string"!=typeof n)throw new Error("Invalid service config choice: invalid clientLanguage");t.clientLanguage.push(n)}}if("clientHostname"in e){if(!Array.isArray(e.clientHostname))throw new Error("Invalid service config choice: invalid clientHostname");t.clientHostname=[];for(const n of e.clientHostname){if("string"!=typeof n)throw new Error("Invalid service config choice: invalid clientHostname");t.clientHostname.push(n)}}if("percentage"in e){if(!("number"==typeof e.percentage&&0<=e.percentage&&e.percentage<=100))throw new Error("Invalid service config choice: invalid percentage");t.percentage=e.percentage}const n=["clientLanguage","percentage","clientHostname","serviceConfig"];for(const t in e)if(!n.includes(t))throw new Error(`Invalid service config choice: unexpected field ${t}`);return t}function d(e,t){if(!Array.isArray(e))throw new Error("Invalid service config list");for(const n of e){const e=u(n);if(!("number"==typeof e.percentage&&t>e.percentage)){if(Array.isArray(e.clientHostname)){let t=!1;for(const n of e.clientHostname)n===r.hostname()&&(t=!0);if(!t)continue}if(Array.isArray(e.clientLanguage)){let t=!1;for(const n of e.clientLanguage)"node"===n&&(t=!0);if(!t)continue}return e.serviceConfig}}throw new Error("No matching service config found")}},246(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.SingleSubchannelChannel=void 0;const r=n(5572),i=n(9503),s=n(4987),o=n(463),a=n(131),c=n(6067),l=n(6308),h=n(1703),u=n(4097),d=n(9302),f=n(3822);class p{constructor(e,t,n,r,i){var s,o;this.subchannel=e,this.method=t,this.options=r,this.callNumber=i,this.childCall=null,this.pendingMessage=null,this.readPending=!1,this.halfClosePending=!1,this.pendingStatus=null,this.readFilterPending=!1,this.writeFilterPending=!1;const c=this.method.split("/");let h="";c.length>=2&&(h=c[1]);const u=null!==(o=null===(s=(0,f.splitHostPort)(this.options.host))||void 0===s?void 0:s.host)&&void 0!==o?o:"localhost";this.serviceUrl=`https://${u}/${h}`;const d=(0,l.getRelativeTimeout)(r.deadline);d!==1/0&&(d<=0?this.cancelWithStatus(a.Status.DEADLINE_EXCEEDED,"Deadline exceeded"):setTimeout(()=>{this.cancelWithStatus(a.Status.DEADLINE_EXCEEDED,"Deadline exceeded")},d)),this.filterStack=n.createFilter()}cancelWithStatus(e,t){this.childCall?this.childCall.cancelWithStatus(e,t):this.pendingStatus={code:e,details:t,metadata:new u.Metadata}}getPeer(){var e,t;return null!==(t=null===(e=this.childCall)||void 0===e?void 0:e.getPeer())&&void 0!==t?t:this.subchannel.getAddress()}async start(e,t){if(this.pendingStatus)return void t.onReceiveStatus(this.pendingStatus);if(this.subchannel.getConnectivityState()!==o.ConnectivityState.READY)return void t.onReceiveStatus({code:a.Status.UNAVAILABLE,details:"Subchannel not ready",metadata:new u.Metadata});const n=await this.filterStack.sendMetadata(Promise.resolve(e));let r;try{r=await this.subchannel.getCallCredentials().generateMetadata({method_name:this.method,service_url:this.serviceUrl})}catch(e){const n=e,{code:r,details:i}=(0,c.restrictControlPlaneStatusCode)("number"==typeof n.code?n.code:a.Status.UNKNOWN,`Getting metadata from plugin failed with error: ${n.message}`);return void t.onReceiveStatus({code:r,details:i,metadata:new u.Metadata})}r.merge(n);const i={onReceiveMetadata:async e=>{t.onReceiveMetadata(await this.filterStack.receiveMetadata(e))},onReceiveMessage:async e=>{this.readFilterPending=!0;const n=await this.filterStack.receiveMessage(e);this.readFilterPending=!1,t.onReceiveMessage(n),this.pendingStatus&&t.onReceiveStatus(this.pendingStatus)},onReceiveStatus:async e=>{const n=await this.filterStack.receiveTrailers(e);this.readFilterPending?this.pendingStatus=n:t.onReceiveStatus(n)}};this.childCall=this.subchannel.createCall(r,this.options.host,this.method,i),this.readPending&&this.childCall.startRead(),this.pendingMessage&&this.childCall.sendMessageWithContext(this.pendingMessage.context,this.pendingMessage.message),this.halfClosePending&&!this.writeFilterPending&&this.childCall.halfClose()}async sendMessageWithContext(e,t){this.writeFilterPending=!0;const n=await this.filterStack.sendMessage(Promise.resolve({message:t,flags:e.flags}));this.writeFilterPending=!1,this.childCall?(this.childCall.sendMessageWithContext(e,n.message),this.halfClosePending&&this.childCall.halfClose()):this.pendingMessage={context:e,message:n.message}}startRead(){this.childCall?this.childCall.startRead():this.readPending=!0}halfClose(){this.childCall&&!this.writeFilterPending?this.childCall.halfClose():this.halfClosePending=!0}getCallNumber(){return this.callNumber}setCredentials(e){throw new Error("Method not implemented.")}getAuthContext(){return this.childCall?this.childCall.getAuthContext():null}}t.SingleSubchannelChannel=class{constructor(e,t,n){this.subchannel=e,this.target=t,this.channelzEnabled=!1,this.channelzTrace=new i.ChannelzTrace,this.callTracker=new i.ChannelzCallTracker,this.childrenTracker=new i.ChannelzChildrenTracker,this.channelzEnabled=0!==n["grpc.enable_channelz"],this.channelzRef=(0,i.registerChannelzChannel)((0,f.uriToString)(t),()=>({target:`${(0,f.uriToString)(t)} (${e.getAddress()})`,state:this.subchannel.getConnectivityState(),trace:this.channelzTrace,callTracker:this.callTracker,children:this.childrenTracker.getChildLists()}),this.channelzEnabled),this.channelzEnabled&&this.childrenTracker.refChild(e.getChannelzRef()),this.filterStackFactory=new h.FilterStackFactory([new s.CompressionFilterFactory(this,n)])}close(){this.channelzEnabled&&this.childrenTracker.unrefChild(this.subchannel.getChannelzRef()),(0,i.unregisterChannelzRef)(this.channelzRef)}getTarget(){return(0,f.uriToString)(this.target)}getConnectivityState(e){throw new Error("Method not implemented.")}watchConnectivityState(e,t,n){throw new Error("Method not implemented.")}getChannelzRef(){return this.channelzRef}createCall(e,t){const n={deadline:t,host:(0,d.getDefaultAuthority)(this.target),flags:a.Propagate.DEFAULTS,parentCall:null};return new p(this.subchannel,e,this.filterStackFactory,n,(0,r.getNextCallNumber)())}}},2284(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.StatusBuilder=void 0;t.StatusBuilder=class{constructor(){this.code=null,this.details=null,this.metadata=null}withCode(e){return this.code=e,this}withDetails(e){return this.details=e,this}withMetadata(e){return this.metadata=e,this}build(){const e={};return null!==this.code&&(e.code=this.code),null!==this.details&&(e.details=this.details),null!==this.metadata&&(e.metadata=this.metadata),e}}},9453(e,t){"use strict";var n;Object.defineProperty(t,"__esModule",{value:!0}),t.StreamDecoder=void 0,function(e){e[e.NO_DATA=0]="NO_DATA",e[e.READING_SIZE=1]="READING_SIZE",e[e.READING_MESSAGE=2]="READING_MESSAGE"}(n||(n={}));t.StreamDecoder=class{constructor(e){this.maxReadMessageLength=e,this.readState=n.NO_DATA,this.readCompressFlag=Buffer.alloc(1),this.readPartialSize=Buffer.alloc(4),this.readSizeRemaining=4,this.readMessageSize=0,this.readPartialMessage=[],this.readMessageRemaining=0}write(e){let t,r=0;const i=[];for(;r<e.length;)switch(this.readState){case n.NO_DATA:this.readCompressFlag=e.slice(r,r+1),r+=1,this.readState=n.READING_SIZE,this.readPartialSize.fill(0),this.readSizeRemaining=4,this.readMessageSize=0,this.readMessageRemaining=0,this.readPartialMessage=[];break;case n.READING_SIZE:if(t=Math.min(e.length-r,this.readSizeRemaining),e.copy(this.readPartialSize,4-this.readSizeRemaining,r,r+t),this.readSizeRemaining-=t,r+=t,0===this.readSizeRemaining){if(this.readMessageSize=this.readPartialSize.readUInt32BE(0),-1!==this.maxReadMessageLength&&this.readMessageSize>this.maxReadMessageLength)throw new Error(`Received message larger than max (${this.readMessageSize} vs ${this.maxReadMessageLength})`);if(this.readMessageRemaining=this.readMessageSize,this.readMessageRemaining>0)this.readState=n.READING_MESSAGE;else{const e=Buffer.concat([this.readCompressFlag,this.readPartialSize],5);this.readState=n.NO_DATA,i.push(e)}}break;case n.READING_MESSAGE:if(t=Math.min(e.length-r,this.readMessageRemaining),this.readPartialMessage.push(e.slice(r,r+t)),this.readMessageRemaining-=t,r+=t,0===this.readMessageRemaining){const e=[this.readCompressFlag,this.readPartialSize].concat(this.readPartialMessage),t=Buffer.concat(e,this.readMessageSize+5);this.readState=n.NO_DATA,i.push(t)}break;default:throw new Error("Unexpected read state")}return i}}},8996(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.EndpointMap=void 0,t.isTcpSubchannelAddress=i,t.subchannelAddressEqual=s,t.subchannelAddressToString=o,t.stringToSubchannelAddress=function(e,t){return(0,r.isIP)(e)?{host:e,port:null!=t?t:443}:{path:e}},t.endpointEqual=function(e,t){if(e.addresses.length!==t.addresses.length)return!1;for(let n=0;n<e.addresses.length;n++)if(!s(e.addresses[n],t.addresses[n]))return!1;return!0},t.endpointToString=function(e){return"["+e.addresses.map(o).join(", ")+"]"},t.endpointHasAddress=a;const r=n(9278);function i(e){return"port"in e}function s(e,t){return!e&&!t||!(!e||!t)&&(i(e)?i(t)&&e.host===t.host&&e.port===t.port:!i(t)&&e.path===t.path)}function o(e){return i(e)?(0,r.isIPv6)(e.host)?"["+e.host+"]:"+e.port:e.host+":"+e.port:e.path}function a(e,t){for(const n of e.addresses)if(s(n,t))return!0;return!1}function c(e,t){if(e.addresses.length!==t.addresses.length)return!1;for(const n of e.addresses){let e=!1;for(const r of t.addresses)if(s(n,r)){e=!0;break}if(!e)return!1}return!0}t.EndpointMap=class{constructor(){this.map=new Set}get size(){return this.map.size}getForSubchannelAddress(e){for(const t of this.map)if(a(t.key,e))return t.value}deleteMissing(e){const t=[];for(const n of this.map){let r=!1;for(const t of e)c(t,n.key)&&(r=!0);r||(t.push(n.value),this.map.delete(n))}return t}get(e){for(const t of this.map)if(c(e,t.key))return t.value}set(e,t){for(const n of this.map)if(c(e,n.key))return void(n.value=t);this.map.add({key:e,value:t})}delete(e){for(const t of this.map)if(c(e,t.key))return void this.map.delete(t)}has(e){for(const t of this.map)if(c(e,t.key))return!0;return!1}clear(){this.map.clear()}*keys(){for(const e of this.map)yield e.key}*values(){for(const e of this.map)yield e.value}*entries(){for(const e of this.map)yield[e.key,e.value]}}},5486(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Http2SubchannelCall=void 0;const r=n(5675),i=n(857),s=n(131),o=n(4097),a=n(9453),c=n(267),l=n(131);function h(e){const t=`Received HTTP status code ${e}`;let n;switch(e){case 400:n=s.Status.INTERNAL;break;case 401:n=s.Status.UNAUTHENTICATED;break;case 403:n=s.Status.PERMISSION_DENIED;break;case 404:n=s.Status.UNIMPLEMENTED;break;case 429:case 502:case 503:case 504:n=s.Status.UNAVAILABLE;break;default:n=s.Status.UNKNOWN}return{code:n,details:t,metadata:new o.Metadata}}t.Http2SubchannelCall=class{constructor(e,t,n,c,l){var u;this.http2Stream=e,this.callEventTracker=t,this.listener=n,this.transport=c,this.callId=l,this.isReadFilterPending=!1,this.isPushPending=!1,this.canPush=!1,this.readsClosed=!1,this.statusOutput=!1,this.unpushedReadMessages=[],this.finalStatus=null,this.internalError=null,this.serverEndedCall=!1,this.connectionDropped=!1;const d=null!==(u=c.getOptions()["grpc.max_receive_message_length"])&&void 0!==u?u:s.DEFAULT_MAX_RECEIVE_MESSAGE_LENGTH;this.decoder=new a.StreamDecoder(d),e.on("response",(e,t)=>{let n="";for(const t of Object.keys(e))n+="\t\t"+t+": "+e[t]+"\n";if(this.trace("Received server headers:\n"+n),this.httpStatusCode=e[":status"],t&r.constants.NGHTTP2_FLAG_END_STREAM)this.handleTrailers(e);else{let t;try{t=o.Metadata.fromHttp2Headers(e)}catch(e){return void this.endCall({code:s.Status.UNKNOWN,details:e.message,metadata:new o.Metadata})}this.listener.onReceiveMetadata(t)}}),e.on("trailers",e=>{this.handleTrailers(e)}),e.on("data",e=>{if(this.statusOutput)return;let t;this.trace("receive HTTP/2 data frame of length "+e.length);try{t=this.decoder.write(e)}catch(e){if(void 0!==this.httpStatusCode&&200!==this.httpStatusCode){const e=h(this.httpStatusCode);this.cancelWithStatus(e.code,e.details)}else this.cancelWithStatus(s.Status.RESOURCE_EXHAUSTED,e.message);return}for(const e of t)this.trace("parsed message of length "+e.length),this.callEventTracker.addMessageReceived(),this.tryPush(e)}),e.on("end",()=>{this.readsClosed=!0,this.maybeOutputStatus()}),e.on("close",()=>{this.serverEndedCall=!0,process.nextTick(()=>{var t;if(this.trace("HTTP/2 stream closed with code "+e.rstCode),(null===(t=this.finalStatus)||void 0===t?void 0:t.code)===s.Status.OK)return;let n,i="";switch(e.rstCode){case r.constants.NGHTTP2_NO_ERROR:if(null!==this.finalStatus)return;if(this.httpStatusCode&&200!==this.httpStatusCode){const e=h(this.httpStatusCode);n=e.code,i=e.details}else n=s.Status.INTERNAL,i=`Received RST_STREAM with code ${e.rstCode} (Call ended without gRPC status)`;break;case r.constants.NGHTTP2_REFUSED_STREAM:n=s.Status.UNAVAILABLE,i="Stream refused by server";break;case r.constants.NGHTTP2_CANCEL:this.connectionDropped?(n=s.Status.UNAVAILABLE,i="Connection dropped"):(n=s.Status.CANCELLED,i="Call cancelled");break;case r.constants.NGHTTP2_ENHANCE_YOUR_CALM:n=s.Status.RESOURCE_EXHAUSTED,i="Bandwidth exhausted or memory limit exceeded";break;case r.constants.NGHTTP2_INADEQUATE_SECURITY:n=s.Status.PERMISSION_DENIED,i="Protocol not secure enough";break;case r.constants.NGHTTP2_INTERNAL_ERROR:n=s.Status.INTERNAL,null===this.internalError?i=`Received RST_STREAM with code ${e.rstCode} (Internal server error)`:"ECONNRESET"===this.internalError.code||"ETIMEDOUT"===this.internalError.code?(n=s.Status.UNAVAILABLE,i=this.internalError.message):i=`Received RST_STREAM with code ${e.rstCode} triggered by internal client error: ${this.internalError.message}`;break;default:n=s.Status.INTERNAL,i=`Received RST_STREAM with code ${e.rstCode}`}this.endCall({code:n,details:i,metadata:new o.Metadata,rstCode:e.rstCode})})}),e.on("error",e=>{"ERR_HTTP2_STREAM_ERROR"!==e.code&&(this.trace("Node error event: message="+e.message+" code="+e.code+" errno="+function(e){for(const[t,n]of Object.entries(i.constants.errno))if(n===e)return t;return"Unknown system error "+e}(e.errno)+" syscall="+e.syscall),this.internalError=e),this.callEventTracker.onStreamEnd(!1)})}getDeadlineInfo(){return[`remote_addr=${this.getPeer()}`]}onDisconnect(){this.connectionDropped=!0,setImmediate(()=>{this.endCall({code:s.Status.UNAVAILABLE,details:"Connection dropped",metadata:new o.Metadata})})}outputStatus(){this.statusOutput||(this.statusOutput=!0,this.trace("ended with status: code="+this.finalStatus.code+' details="'+this.finalStatus.details+'"'),this.callEventTracker.onCallEnd(this.finalStatus),process.nextTick(()=>{this.listener.onReceiveStatus(this.finalStatus)}),this.http2Stream.resume())}trace(e){c.trace(l.LogVerbosity.DEBUG,"subchannel_call","["+this.callId+"] "+e)}endCall(e){null!==this.finalStatus&&this.finalStatus.code!==s.Status.OK||(this.finalStatus=e,this.maybeOutputStatus()),this.destroyHttp2Stream()}maybeOutputStatus(){null!==this.finalStatus&&(this.finalStatus.code!==s.Status.OK||this.readsClosed&&0===this.unpushedReadMessages.length&&!this.isReadFilterPending&&!this.isPushPending)&&this.outputStatus()}push(e){this.trace("pushing to reader message of length "+(e instanceof Buffer?e.length:null)),this.canPush=!1,this.isPushPending=!0,process.nextTick(()=>{this.isPushPending=!1,this.statusOutput||(this.listener.onReceiveMessage(e),this.maybeOutputStatus())})}tryPush(e){this.canPush?(this.http2Stream.pause(),this.push(e)):(this.trace("unpushedReadMessages.push message of length "+e.length),this.unpushedReadMessages.push(e))}handleTrailers(e){this.serverEndedCall=!0,this.callEventTracker.onStreamEnd(!0);let t,n="";for(const t of Object.keys(e))n+="\t\t"+t+": "+e[t]+"\n";this.trace("Received server trailers:\n"+n);try{t=o.Metadata.fromHttp2Headers(e)}catch(e){t=new o.Metadata}const r=t.getMap();let i;if("string"==typeof r["grpc-status"]){const e=Number(r["grpc-status"]);this.trace("received status code "+e+" from server"),t.remove("grpc-status");let n="";if("string"==typeof r["grpc-message"]){try{n=decodeURI(r["grpc-message"])}catch(e){n=r["grpc-message"]}t.remove("grpc-message"),this.trace('received status details string "'+n+'" from server')}i={code:e,details:n,metadata:t}}else this.httpStatusCode?(i=h(this.httpStatusCode),i.metadata=t):i={code:s.Status.UNKNOWN,details:"No status information received",metadata:t};this.endCall(i)}destroyHttp2Stream(){var e;if(!this.http2Stream.destroyed)if(this.serverEndedCall)this.http2Stream.end();else{let t;t=(null===(e=this.finalStatus)||void 0===e?void 0:e.code)===s.Status.OK?r.constants.NGHTTP2_NO_ERROR:r.constants.NGHTTP2_CANCEL,this.trace("close http2 stream with code "+t),this.http2Stream.close(t)}}cancelWithStatus(e,t){this.trace("cancelWithStatus code: "+e+' details: "'+t+'"'),this.endCall({code:e,details:t,metadata:new o.Metadata})}getStatus(){return this.finalStatus}getPeer(){return this.transport.getPeerName()}getCallNumber(){return this.callId}getAuthContext(){return this.transport.getAuthContext()}startRead(){if(null!==this.finalStatus&&this.finalStatus.code!==s.Status.OK)return this.readsClosed=!0,void this.maybeOutputStatus();if(this.canPush=!0,this.unpushedReadMessages.length>0){const e=this.unpushedReadMessages.shift();return void this.push(e)}this.http2Stream.resume()}sendMessageWithContext(e,t){this.trace("write() called with message of length "+t.length);const n=t=>{process.nextTick(()=>{var n;let r=s.Status.UNAVAILABLE;"ERR_STREAM_WRITE_AFTER_END"===(null==t?void 0:t.code)&&(r=s.Status.INTERNAL),t&&this.cancelWithStatus(r,`Write error: ${t.message}`),null===(n=e.callback)||void 0===n||n.call(e)})};this.trace("sending data chunk of length "+t.length),this.callEventTracker.addMessageSent();try{this.http2Stream.write(t,n)}catch(e){this.endCall({code:s.Status.UNAVAILABLE,details:`Write failed with error ${e.message}`,metadata:new o.Metadata})}}halfClose(){this.trace("end() called"),this.trace("calling end() on HTTP/2 stream"),this.http2Stream.end()}}},2379(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.BaseSubchannelWrapper=void 0;t.BaseSubchannelWrapper=class{constructor(e){this.child=e,this.healthy=!0,this.healthListeners=new Set,this.refcount=0,this.dataWatchers=new Set,e.addHealthStateWatcher(e=>{this.healthy&&this.updateHealthListeners()})}updateHealthListeners(){for(const e of this.healthListeners)e(this.isHealthy())}getConnectivityState(){return this.child.getConnectivityState()}addConnectivityStateListener(e){this.child.addConnectivityStateListener(e)}removeConnectivityStateListener(e){this.child.removeConnectivityStateListener(e)}startConnecting(){this.child.startConnecting()}getAddress(){return this.child.getAddress()}throttleKeepalive(e){this.child.throttleKeepalive(e)}ref(){this.child.ref(),this.refcount+=1}unref(){this.child.unref(),this.refcount-=1,0===this.refcount&&this.destroy()}destroy(){for(const e of this.dataWatchers)e.destroy()}getChannelzRef(){return this.child.getChannelzRef()}isHealthy(){return this.healthy&&this.child.isHealthy()}addHealthStateWatcher(e){this.healthListeners.add(e)}removeHealthStateWatcher(e){this.healthListeners.delete(e)}addDataWatcher(e){e.setSubchannel(this.getRealSubchannel()),this.dataWatchers.add(e)}setHealthy(e){e!==this.healthy&&(this.healthy=e,this.child.isHealthy()&&this.updateHealthListeners())}getRealSubchannel(){return this.child.getRealSubchannel()}realSubchannelEquals(e){return this.getRealSubchannel()===e.getRealSubchannel()}getCallCredentials(){return this.child.getCallCredentials()}getChannel(){return this.child.getChannel()}}},5716(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.SubchannelPool=void 0,t.getSubchannelPool=function(e){return e?l:new c};const r=n(6998),i=n(1385),s=n(8996),o=n(3822),a=n(2095);class c{constructor(){this.pool=Object.create(null),this.cleanupTimer=null}unrefUnusedSubchannels(){let e=!0;for(const t in this.pool){const n=this.pool[t].filter(e=>!e.subchannel.unrefIfOneRef());n.length>0&&(e=!1),this.pool[t]=n}e&&null!==this.cleanupTimer&&(clearInterval(this.cleanupTimer),this.cleanupTimer=null)}ensureCleanupTask(){var e,t;null===this.cleanupTimer&&(this.cleanupTimer=setInterval(()=>{this.unrefUnusedSubchannels()},1e4),null===(t=(e=this.cleanupTimer).unref)||void 0===t||t.call(e))}getOrCreateSubchannel(e,t,n,c){this.ensureCleanupTask();const l=(0,o.uriToString)(e);if(l in this.pool){const e=this.pool[l];for(const i of e)if((0,s.subchannelAddressEqual)(t,i.subchannelAddress)&&(0,r.channelOptionsEqual)(n,i.channelArguments)&&c._equals(i.channelCredentials))return i.subchannel}const h=new i.Subchannel(e,t,n,c,new a.Http2SubchannelConnector(e));return l in this.pool||(this.pool[l]=[]),this.pool[l].push({subchannelAddress:t,channelArguments:n,channelCredentials:c,subchannel:h}),h.ref(),h}}t.SubchannelPool=c;const l=new c},1385(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Subchannel=void 0;const r=n(463),i=n(3956),s=n(267),o=n(131),a=n(3822),c=n(8996),l=n(9503),h=n(246);t.Subchannel=class{constructor(e,t,n,s,o){var a;this.channelTarget=e,this.subchannelAddress=t,this.options=n,this.connector=o,this.connectivityState=r.ConnectivityState.IDLE,this.transport=null,this.continueConnecting=!1,this.stateListeners=new Set,this.refcount=0,this.channelzEnabled=!0,this.dataProducers=new Map,this.subchannelChannel=null;const h={initialDelay:n["grpc.initial_reconnect_backoff_ms"],maxDelay:n["grpc.max_reconnect_backoff_ms"]};this.backoffTimeout=new i.BackoffTimeout(()=>{this.handleBackoffTimer()},h),this.backoffTimeout.unref(),this.subchannelAddressString=(0,c.subchannelAddressToString)(t),this.keepaliveTime=null!==(a=n["grpc.keepalive_time_ms"])&&void 0!==a?a:-1,0===n["grpc.enable_channelz"]?(this.channelzEnabled=!1,this.channelzTrace=new l.ChannelzTraceStub,this.callTracker=new l.ChannelzCallTrackerStub,this.childrenTracker=new l.ChannelzChildrenTrackerStub,this.streamTracker=new l.ChannelzCallTrackerStub):(this.channelzTrace=new l.ChannelzTrace,this.callTracker=new l.ChannelzCallTracker,this.childrenTracker=new l.ChannelzChildrenTracker,this.streamTracker=new l.ChannelzCallTracker),this.channelzRef=(0,l.registerChannelzSubchannel)(this.subchannelAddressString,()=>this.getChannelzInfo(),this.channelzEnabled),this.channelzTrace.addTrace("CT_INFO","Subchannel created"),this.trace("Subchannel constructed with options "+JSON.stringify(n,void 0,2)),this.secureConnector=s._createSecureConnector(e,n)}getChannelzInfo(){return{state:this.connectivityState,trace:this.channelzTrace,callTracker:this.callTracker,children:this.childrenTracker.getChildLists(),target:this.subchannelAddressString}}trace(e){s.trace(o.LogVerbosity.DEBUG,"subchannel","("+this.channelzRef.id+") "+this.subchannelAddressString+" "+e)}refTrace(e){s.trace(o.LogVerbosity.DEBUG,"subchannel_refcount","("+this.channelzRef.id+") "+this.subchannelAddressString+" "+e)}handleBackoffTimer(){this.continueConnecting?this.transitionToState([r.ConnectivityState.TRANSIENT_FAILURE],r.ConnectivityState.CONNECTING):this.transitionToState([r.ConnectivityState.TRANSIENT_FAILURE],r.ConnectivityState.IDLE)}startBackoff(){this.backoffTimeout.runOnce()}stopBackoff(){this.backoffTimeout.stop(),this.backoffTimeout.reset()}startConnectingInternal(){let e=this.options;if(e["grpc.keepalive_time_ms"]){const t=Math.min(this.keepaliveTime,2147483647);e=Object.assign(Object.assign({},e),{"grpc.keepalive_time_ms":t})}this.connector.connect(this.subchannelAddress,this.secureConnector,e).then(e=>{this.transitionToState([r.ConnectivityState.CONNECTING],r.ConnectivityState.READY)?(this.transport=e,this.channelzEnabled&&this.childrenTracker.refChild(e.getChannelzRef()),e.addDisconnectListener(e=>{this.transitionToState([r.ConnectivityState.READY],r.ConnectivityState.IDLE),e&&this.keepaliveTime>0&&(this.keepaliveTime*=2,s.log(o.LogVerbosity.ERROR,`Connection to ${(0,a.uriToString)(this.channelTarget)} at ${this.subchannelAddressString} rejected by server because of excess pings. Increasing ping interval to ${this.keepaliveTime} ms`))})):e.shutdown()},e=>{this.transitionToState([r.ConnectivityState.CONNECTING],r.ConnectivityState.TRANSIENT_FAILURE,`${e}`)})}transitionToState(e,t,n){var i,s;if(-1===e.indexOf(this.connectivityState))return!1;n?this.trace(r.ConnectivityState[this.connectivityState]+" -> "+r.ConnectivityState[t]+' with error "'+n+'"'):this.trace(r.ConnectivityState[this.connectivityState]+" -> "+r.ConnectivityState[t]),this.channelzEnabled&&this.channelzTrace.addTrace("CT_INFO","Connectivity state change to "+r.ConnectivityState[t]);const o=this.connectivityState;switch(this.connectivityState=t,t){case r.ConnectivityState.READY:this.stopBackoff();break;case r.ConnectivityState.CONNECTING:this.startBackoff(),this.startConnectingInternal(),this.continueConnecting=!1;break;case r.ConnectivityState.TRANSIENT_FAILURE:this.channelzEnabled&&this.transport&&this.childrenTracker.unrefChild(this.transport.getChannelzRef()),null===(i=this.transport)||void 0===i||i.shutdown(),this.transport=null,this.backoffTimeout.isRunning()||process.nextTick(()=>{this.handleBackoffTimer()});break;case r.ConnectivityState.IDLE:this.channelzEnabled&&this.transport&&this.childrenTracker.unrefChild(this.transport.getChannelzRef()),null===(s=this.transport)||void 0===s||s.shutdown(),this.transport=null;break;default:throw new Error(`Invalid state: unknown ConnectivityState ${t}`)}for(const e of this.stateListeners)e(this,o,t,this.keepaliveTime,n);return!0}ref(){this.refTrace("refcount "+this.refcount+" -> "+(this.refcount+1)),this.refcount+=1}unref(){this.refTrace("refcount "+this.refcount+" -> "+(this.refcount-1)),this.refcount-=1,0===this.refcount&&(this.channelzTrace.addTrace("CT_INFO","Shutting down"),(0,l.unregisterChannelzRef)(this.channelzRef),this.secureConnector.destroy(),process.nextTick(()=>{this.transitionToState([r.ConnectivityState.CONNECTING,r.ConnectivityState.READY],r.ConnectivityState.IDLE)}))}unrefIfOneRef(){return 1===this.refcount&&(this.unref(),!0)}createCall(e,t,n,r){if(!this.transport)throw new Error("Cannot create call, subchannel not READY");let i;return this.channelzEnabled?(this.callTracker.addCallStarted(),this.streamTracker.addCallStarted(),i={onCallEnd:e=>{e.code===o.Status.OK?this.callTracker.addCallSucceeded():this.callTracker.addCallFailed()}}):i={},this.transport.createCall(e,t,n,r,i)}startConnecting(){process.nextTick(()=>{this.transitionToState([r.ConnectivityState.IDLE],r.ConnectivityState.CONNECTING)||this.connectivityState===r.ConnectivityState.TRANSIENT_FAILURE&&(this.continueConnecting=!0)})}getConnectivityState(){return this.connectivityState}addConnectivityStateListener(e){this.stateListeners.add(e)}removeConnectivityStateListener(e){this.stateListeners.delete(e)}resetBackoff(){process.nextTick(()=>{this.backoffTimeout.reset(),this.transitionToState([r.ConnectivityState.TRANSIENT_FAILURE],r.ConnectivityState.CONNECTING)})}getAddress(){return this.subchannelAddressString}getChannelzRef(){return this.channelzRef}isHealthy(){return!0}addHealthStateWatcher(e){}removeHealthStateWatcher(e){}getRealSubchannel(){return this}realSubchannelEquals(e){return e.getRealSubchannel()===this}throttleKeepalive(e){e>this.keepaliveTime&&(this.keepaliveTime=e)}getCallCredentials(){return this.secureConnector.getCallCredentials()}getChannel(){return this.subchannelChannel||(this.subchannelChannel=new h.SingleSubchannelChannel(this,this.channelTarget,this.options)),this.subchannelChannel}addDataWatcher(e){throw new Error("Not implemented")}getOrCreateDataProducer(e,t){const n=this.dataProducers.get(e);if(n)return n;const r=t(this);return this.dataProducers.set(e,r),r}removeDataProducer(e){this.dataProducers.delete(e)}}},9167(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.CIPHER_SUITES=void 0,t.getDefaultRootsData=function(){if(i)return null===s&&(s=r.readFileSync(i)),s;return null};const r=n(9896);t.CIPHER_SUITES=process.env.GRPC_SSL_CIPHER_SUITES;const i=process.env.GRPC_DEFAULT_SSL_ROOTS_FILE_PATH;let s=null},2095(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Http2SubchannelConnector=void 0;const r=n(5675),i=n(4756),s=n(9503),o=n(131),a=n(7803),c=n(267),l=n(9302),h=n(8996),u=n(3822),d=n(9278),f=n(5486),p=n(5572),g="transport",m=n(9943).rE,{HTTP2_HEADER_AUTHORITY:_,HTTP2_HEADER_CONTENT_TYPE:y,HTTP2_HEADER_METHOD:v,HTTP2_HEADER_PATH:b,HTTP2_HEADER_TE:E,HTTP2_HEADER_USER_AGENT:A}=r.constants,S=Buffer.from("too_many_pings","ascii");class w{constructor(e,t,n,o){this.session=e,this.options=n,this.remoteName=o,this.keepaliveTimer=null,this.pendingSendKeepalivePing=!1,this.activeCalls=new Set,this.disconnectListeners=[],this.disconnectHandled=!1,this.channelzEnabled=!0,this.keepalivesSent=0,this.messagesSent=0,this.messagesReceived=0,this.lastMessageSentTimestamp=null,this.lastMessageReceivedTimestamp=null,this.subchannelAddressString=(0,h.subchannelAddressToString)(t),0===n["grpc.enable_channelz"]?(this.channelzEnabled=!1,this.streamTracker=new s.ChannelzCallTrackerStub):this.streamTracker=new s.ChannelzCallTracker,this.channelzRef=(0,s.registerChannelzSocket)(this.subchannelAddressString,()=>this.getChannelzInfo(),this.channelzEnabled),this.userAgent=[n["grpc.primary_user_agent"],`grpc-node-js/${m}`,n["grpc.secondary_user_agent"]].filter(e=>e).join(" "),this.keepaliveTimeMs="grpc.keepalive_time_ms"in n?n["grpc.keepalive_time_ms"]:-1,this.keepaliveTimeoutMs="grpc.keepalive_timeout_ms"in n?n["grpc.keepalive_timeout_ms"]:2e4,this.keepaliveWithoutCalls="grpc.keepalive_permit_without_calls"in n&&1===n["grpc.keepalive_permit_without_calls"],e.once("close",()=>{this.trace("session closed"),this.handleDisconnect()}),e.once("goaway",(e,t,n)=>{let i=!1;e===r.constants.NGHTTP2_ENHANCE_YOUR_CALM&&n&&n.equals(S)&&(i=!0),this.trace("connection closed by GOAWAY with code "+e+" and data "+(null==n?void 0:n.toString())),this.reportDisconnectToOwner(i)}),e.once("error",e=>{this.trace("connection closed with error "+e.message),this.handleDisconnect()}),e.socket.once("close",e=>{this.trace("connection closed. hadError="+e),this.handleDisconnect()}),c.isTracerEnabled(g)&&(e.on("remoteSettings",t=>{this.trace("new settings received"+(this.session!==e?" on the old connection":"")+": "+JSON.stringify(t))}),e.on("localSettings",t=>{this.trace("local settings acknowledged by remote"+(this.session!==e?" on the old connection":"")+": "+JSON.stringify(t))})),this.keepaliveWithoutCalls&&this.maybeStartKeepalivePingTimer(),e.socket instanceof i.TLSSocket?this.authContext={transportSecurityType:"ssl",sslPeerCertificate:e.socket.getPeerCertificate()}:this.authContext={}}getChannelzInfo(){var e,t,n;const r=this.session.socket,i=r.remoteAddress?(0,h.stringToSubchannelAddress)(r.remoteAddress,r.remotePort):null,s=r.localAddress?(0,h.stringToSubchannelAddress)(r.localAddress,r.localPort):null;let o;if(this.session.encrypted){const t=r,n=t.getCipher(),i=t.getCertificate(),s=t.getPeerCertificate();o={cipherSuiteStandardName:null!==(e=n.standardName)&&void 0!==e?e:null,cipherSuiteOtherName:n.standardName?null:n.name,localCertificate:i&&"raw"in i?i.raw:null,remoteCertificate:s&&"raw"in s?s.raw:null}}else o=null;return{remoteAddress:i,localAddress:s,security:o,remoteName:this.remoteName,streamsStarted:this.streamTracker.callsStarted,streamsSucceeded:this.streamTracker.callsSucceeded,streamsFailed:this.streamTracker.callsFailed,messagesSent:this.messagesSent,messagesReceived:this.messagesReceived,keepAlivesSent:this.keepalivesSent,lastLocalStreamCreatedTimestamp:this.streamTracker.lastCallStartedTimestamp,lastRemoteStreamCreatedTimestamp:null,lastMessageSentTimestamp:this.lastMessageSentTimestamp,lastMessageReceivedTimestamp:this.lastMessageReceivedTimestamp,localFlowControlWindow:null!==(t=this.session.state.localWindowSize)&&void 0!==t?t:null,remoteFlowControlWindow:null!==(n=this.session.state.remoteWindowSize)&&void 0!==n?n:null}}trace(e){c.trace(o.LogVerbosity.DEBUG,g,"("+this.channelzRef.id+") "+this.subchannelAddressString+" "+e)}keepaliveTrace(e){c.trace(o.LogVerbosity.DEBUG,"keepalive","("+this.channelzRef.id+") "+this.subchannelAddressString+" "+e)}flowControlTrace(e){c.trace(o.LogVerbosity.DEBUG,"transport_flowctrl","("+this.channelzRef.id+") "+this.subchannelAddressString+" "+e)}internalsTrace(e){c.trace(o.LogVerbosity.DEBUG,"transport_internals","("+this.channelzRef.id+") "+this.subchannelAddressString+" "+e)}reportDisconnectToOwner(e){this.disconnectHandled||(this.disconnectHandled=!0,this.disconnectListeners.forEach(t=>t(e)))}handleDisconnect(){this.clearKeepaliveTimeout(),this.reportDisconnectToOwner(!1);for(const e of this.activeCalls)e.onDisconnect();setImmediate(()=>{this.session.destroy()})}addDisconnectListener(e){this.disconnectListeners.push(e)}canSendPing(){return!this.session.destroyed&&this.keepaliveTimeMs>0&&(this.keepaliveWithoutCalls||this.activeCalls.size>0)}maybeSendPing(){var e,t;if(!this.canSendPing())return void(this.pendingSendKeepalivePing=!0);if(this.keepaliveTimer)return void console.error("keepaliveTimeout is not null");this.channelzEnabled&&(this.keepalivesSent+=1),this.keepaliveTrace("Sending ping with timeout "+this.keepaliveTimeoutMs+"ms"),this.keepaliveTimer=setTimeout(()=>{this.keepaliveTimer=null,this.keepaliveTrace("Ping timeout passed without response"),this.handleDisconnect()},this.keepaliveTimeoutMs),null===(t=(e=this.keepaliveTimer).unref)||void 0===t||t.call(e);let n="";try{this.session.ping((e,t,n)=>{this.clearKeepaliveTimeout(),e?(this.keepaliveTrace("Ping failed with error "+e.message),this.handleDisconnect()):(this.keepaliveTrace("Received ping response"),this.maybeStartKeepalivePingTimer())})||(n="Ping returned false")}catch(e){n=(e instanceof Error?e.message:"")||"Unknown error"}n&&(this.keepaliveTrace("Ping send failed: "+n),this.handleDisconnect())}maybeStartKeepalivePingTimer(){var e,t;this.canSendPing()&&(this.pendingSendKeepalivePing?(this.pendingSendKeepalivePing=!1,this.maybeSendPing()):this.keepaliveTimer||(this.keepaliveTrace("Starting keepalive timer for "+this.keepaliveTimeMs+"ms"),this.keepaliveTimer=setTimeout(()=>{this.keepaliveTimer=null,this.maybeSendPing()},this.keepaliveTimeMs),null===(t=(e=this.keepaliveTimer).unref)||void 0===t||t.call(e)))}clearKeepaliveTimeout(){this.keepaliveTimer&&(clearTimeout(this.keepaliveTimer),this.keepaliveTimer=null)}removeActiveCall(e){this.activeCalls.delete(e),0===this.activeCalls.size&&this.session.unref()}addActiveCall(e){this.activeCalls.add(e),1===this.activeCalls.size&&(this.session.ref(),this.keepaliveWithoutCalls||this.maybeStartKeepalivePingTimer())}createCall(e,t,n,r,i){const s=e.toHttp2Headers();let o,a,c;s[_]=t,s[A]=this.userAgent,s[y]="application/grpc",s[v]="POST",s[b]=n,s[E]="trailers";try{o=this.session.request(s)}catch(e){throw this.handleDisconnect(),e}return this.flowControlTrace("local window size: "+this.session.state.localWindowSize+" remote window size: "+this.session.state.remoteWindowSize),this.internalsTrace("session.closed="+this.session.closed+" session.destroyed="+this.session.destroyed+" session.socket.destroyed="+this.session.socket.destroyed),this.channelzEnabled?(this.streamTracker.addCallStarted(),a={addMessageSent:()=>{var e;this.messagesSent+=1,this.lastMessageSentTimestamp=new Date,null===(e=i.addMessageSent)||void 0===e||e.call(i)},addMessageReceived:()=>{var e;this.messagesReceived+=1,this.lastMessageReceivedTimestamp=new Date,null===(e=i.addMessageReceived)||void 0===e||e.call(i)},onCallEnd:e=>{var t;null===(t=i.onCallEnd)||void 0===t||t.call(i,e),this.removeActiveCall(c)},onStreamEnd:e=>{var t;e?this.streamTracker.addCallSucceeded():this.streamTracker.addCallFailed(),null===(t=i.onStreamEnd)||void 0===t||t.call(i,e)}}):a={addMessageSent:()=>{var e;null===(e=i.addMessageSent)||void 0===e||e.call(i)},addMessageReceived:()=>{var e;null===(e=i.addMessageReceived)||void 0===e||e.call(i)},onCallEnd:e=>{var t;null===(t=i.onCallEnd)||void 0===t||t.call(i,e),this.removeActiveCall(c)},onStreamEnd:e=>{var t;null===(t=i.onStreamEnd)||void 0===t||t.call(i,e)}},c=new f.Http2SubchannelCall(o,a,r,this,(0,p.getNextCallNumber)()),this.addActiveCall(c),c}getChannelzRef(){return this.channelzRef}getPeerName(){return this.subchannelAddressString}getOptions(){return this.options}getAuthContext(){return this.authContext}shutdown(){this.session.close(),(0,s.unregisterChannelzRef)(this.channelzRef)}}t.Http2SubchannelConnector=class{constructor(e){this.channelTarget=e,this.session=null,this.isShutdown=!1}trace(e){c.trace(o.LogVerbosity.DEBUG,g,(0,u.uriToString)(this.channelTarget)+" "+e)}createSession(e,t,n){return this.isShutdown?Promise.reject():e.socket.closed?Promise.reject("Connection closed before starting HTTP/2 handshake"):new Promise((i,s)=>{var o,a,c,h,d,f,p,g;let m=null,_=this.channelTarget;if("grpc.http_connect_target"in n){const e=(0,u.parseUri)(n["grpc.http_connect_target"]);e&&(_=e,m=(0,u.uriToString)(e))}const y=e.secure?"https":"http",v=(0,l.getDefaultAuthority)(_),b=()=>{var e;null===(e=this.session)||void 0===e||e.destroy(),this.session=null,setImmediate(()=>{T||(T=!0,s(`${k.trim()} (${(new Date).toISOString()})`))})},E=e=>{var t;null===(t=this.session)||void 0===t||t.destroy(),k=e.message,this.trace("connection failed with error "+k),T||(T=!0,s(`${k} (${(new Date).toISOString()})`))},A={createConnection:(t,n)=>e.socket,settings:{initialWindowSize:null!==(h=null!==(o=n["grpc-node.flow_control_window"])&&void 0!==o?o:null===(c=null===(a=r.getDefaultSettings)||void 0===a?void 0:a.call(r))||void 0===c?void 0:c.initialWindowSize)&&void 0!==h?h:65535},maxSendHeaderBlockLength:Number.MAX_SAFE_INTEGER,maxSessionMemory:null!==(d=n["grpc-node.max_session_memory"])&&void 0!==d?d:Number.MAX_SAFE_INTEGER},S=r.connect(`${y}://${v}`,A),C=null!==(g=null===(p=null===(f=r.getDefaultSettings)||void 0===f?void 0:f.call(r))||void 0===p?void 0:p.initialWindowSize)&&void 0!==g?g:65535,I=n["grpc-node.flow_control_window"];this.session=S;let k="Failed to connect",T=!1;S.unref(),S.once("remoteSettings",()=>{var r;if(I&&I>C)try{S.setLocalWindowSize(I)}catch(e){const t=I-(null!==(r=S.state.localWindowSize)&&void 0!==r?r:C);t>0&&S.incrementWindowSize(t)}S.removeAllListeners(),e.socket.removeListener("close",b),e.socket.removeListener("error",E),i(new w(S,t,n,m)),this.session=null}),S.once("close",b),S.once("error",E),e.socket.once("close",b),e.socket.once("error",E)})}tcpConnect(e,t){return(0,a.getProxiedConnection)(e,t).then(t=>t||new Promise((t,n)=>{const r=()=>{n(new Error("Socket closed"))},i=e=>{n(e)},s=d.connect(e,()=>{s.removeListener("close",r),s.removeListener("error",i),t(s)});s.once("close",r),s.once("error",i)}))}async connect(e,t,n){if(this.isShutdown)return Promise.reject();let r=null,i=null;const s=(0,h.subchannelAddressToString)(e);try{return this.trace(s+" Waiting for secureConnector to be ready"),await t.waitForReady(),this.trace(s+" secureConnector is ready"),r=await this.tcpConnect(e,n),r.setNoDelay(),this.trace(s+" Established TCP connection"),i=await t.connect(r),this.trace(s+" Established secure connection"),this.createSession(i,e,n)}catch(e){throw null==r||r.destroy(),null==i||i.socket.destroy(),e}}shutdown(){var e;this.isShutdown=!0,null===(e=this.session)||void 0===e||e.close(),this.session=null}}},3822(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.parseUri=function(e){const t=n.exec(e);if(null===t)return null;return{scheme:t[1],authority:t[2],path:t[3]}},t.splitHostPort=function(e){if(e.startsWith("[")){const t=e.indexOf("]");if(-1===t)return null;const n=e.substring(1,t);if(-1===n.indexOf(":"))return null;if(e.length>t+1){if(":"===e[t+1]){const i=e.substring(t+2);return r.test(i)?{host:n,port:+i}:null}return null}return{host:n}}{const t=e.split(":");return 2===t.length?r.test(t[1])?{host:t[0],port:+t[1]}:null:{host:e}}},t.combineHostPort=function(e){return void 0===e.port?e.host:e.host.includes(":")?`[${e.host}]:${e.port}`:`${e.host}:${e.port}`},t.uriToString=function(e){let t="";void 0!==e.scheme&&(t+=e.scheme+":");void 0!==e.authority&&(t+="//"+e.authority+"/");return t+=e.path,t};const n=/^(?:([A-Za-z0-9+.-]+):)?(?:\/\/([^/]*)\/)?(.+)$/;const r=/^\d+$/},5085(e,t,n){"use strict";t.Yi=t.Ib=void 0;const r=n(2028),i=n(2549),s=n(5407),o=n(3197);var a;n(5017),function(e){e.IDEMPOTENCY_UNKNOWN="IDEMPOTENCY_UNKNOWN",e.NO_SIDE_EFFECTS="NO_SIDE_EFFECTS",e.IDEMPOTENT="IDEMPOTENT"}(a=t.Ib||(t.Ib={}));const c={longs:String,enums:String,bytes:String,defaults:!0,oneofs:!0,json:!0};function l(e,t){const n=(r=t,s=e.name,""===r?s:r+"."+s);var r,s;return function(e){return e instanceof i.Service||e instanceof i.Type||e instanceof i.Enum}(e)?[[n,e]]:function(e){return e instanceof i.Namespace||e instanceof i.Root}(e)&&void 0!==e.nested?Object.keys(e.nested).map(t=>l(e.nested[t],n)).reduce((e,t)=>e.concat(t),[]):[]}function h(e,t){return function(n){return e.toObject(e.decode(n),t)}}function u(e){return function(t){if(Array.isArray(t))throw new Error(`Failed to serialize message: expected object with ${e.name} structure, got array instead`);const n=e.fromObject(t);return e.encode(n).finish()}}function d(e){return(e||[]).reduce((e,t)=>{for(const[n,r]of Object.entries(t))if("uninterpreted_option"===n)e.uninterpreted_option.push(t.uninterpreted_option);else e[n]=r;return e},{deprecated:!1,idempotency_level:a.IDEMPOTENCY_UNKNOWN,uninterpreted_option:[]})}function f(e,t,n,i){const s=e.resolvedRequestType,o=e.resolvedResponseType;return{path:"/"+t+"/"+e.name,requestStream:!!e.requestStream,responseStream:!!e.responseStream,requestSerialize:u(s),requestDeserialize:h(s,n),responseSerialize:u(o),responseDeserialize:h(o,n),originalName:r(e.name),requestType:p(s,n,i),responseType:p(o,n,i),options:d(e.parsedOptions)}}function p(e,t,n){const r=e.toDescriptor("proto3");return{format:"Protocol Buffer 3 DescriptorProto",type:r.$type.toObject(r,c),fileDescriptorProtos:n,serialize:u(e),deserialize:h(e,t)}}function g(e,t,n,r){if(e instanceof i.Service)return function(e,t,n,r){const i={};for(const s of e.methodsArray)i[s.name]=f(s,t,n,r);return i}(e,t,n,r);if(e instanceof i.Type)return p(e,n,r);if(e instanceof i.Enum)return function(e,t){const n=e.toDescriptor("proto3");return{format:"Protocol Buffer 3 EnumDescriptorProto",type:n.$type.toObject(n,c),fileDescriptorProtos:t}}(e,r);throw new Error("Type mismatch in reflection object handling")}function m(e,t){const n={};e.resolveAll();const r=e.toDescriptor("proto3").file.map(e=>Buffer.from(s.FileDescriptorProto.encode(e).finish()));for(const[i,s]of l(e,""))n[i]=g(s,i,t,r);return n}function _(e,t){t=t||{};const n=i.Root.fromDescriptor(e);return n.resolveAll(),m(n,t)}t.Yi=function(e,t){return m((0,o.loadProtosWithOptionsSync)(e,t),t)},(0,o.addCommonProtos)()},3197(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.addCommonProtos=t.loadProtosWithOptionsSync=t.loadProtosWithOptions=void 0;const r=n(9896),i=n(6928),s=n(2549);function o(e,t){const n=e.resolvePath;e.resolvePath=(e,s)=>{if(i.isAbsolute(s))return s;for(const e of t){const t=i.join(e,s);try{return r.accessSync(t,r.constants.R_OK),t}catch(e){continue}}return process.emitWarning(`${s} not found in any of the include paths ${t}`),n(e,s)}}t.loadProtosWithOptions=async function(e,t){const n=new s.Root;if((t=t||{}).includeDirs){if(!Array.isArray(t.includeDirs))return Promise.reject(new Error("The includeDirs option must be an array"));o(n,t.includeDirs)}const r=await n.load(e,t);return r.resolveAll(),r},t.loadProtosWithOptionsSync=function(e,t){const n=new s.Root;if((t=t||{}).includeDirs){if(!Array.isArray(t.includeDirs))throw new Error("The includeDirs option must be an array");o(n,t.includeDirs)}const r=n.loadSync(e,t);return r.resolveAll(),r},t.addCommonProtos=function(){const e=n(5434),t=n(3951),r=n(2939),i=n(6710);s.common("api",e.nested.google.nested.protobuf.nested),s.common("descriptor",t.nested.google.nested.protobuf.nested),s.common("source_context",r.nested.google.nested.protobuf.nested),s.common("type",i.nested.google.nested.protobuf.nested)}},6340(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.loadFileDescriptorSetFromObject=t.loadFileDescriptorSetFromBuffer=t.fromJSON=t.loadSync=t.load=t.IdempotencyLevel=t.isAnyExtension=t.Long=void 0;const r=n(2028),i=n(2549),s=n(5407),o=n(1238),a=n(5017);var c;t.Long=a,t.isAnyExtension=function(e){return"@type"in e&&"string"==typeof e["@type"]},function(e){e.IDEMPOTENCY_UNKNOWN="IDEMPOTENCY_UNKNOWN",e.NO_SIDE_EFFECTS="NO_SIDE_EFFECTS",e.IDEMPOTENT="IDEMPOTENT"}(c=t.IdempotencyLevel||(t.IdempotencyLevel={}));const l={longs:String,enums:String,bytes:String,defaults:!0,oneofs:!0,json:!0};function h(e,t){const n=(r=t,s=e.name,""===r?s:r+"."+s);var r,s;return function(e){return e instanceof i.Service||e instanceof i.Type||e instanceof i.Enum}(e)?[[n,e]]:function(e){return e instanceof i.Namespace||e instanceof i.Root}(e)&&void 0!==e.nested?Object.keys(e.nested).map(t=>h(e.nested[t],n)).reduce((e,t)=>e.concat(t),[]):[]}function u(e,t){return function(n){return e.toObject(e.decode(n),t)}}function d(e){return function(t){if(Array.isArray(t))throw new Error(`Failed to serialize message: expected object with ${e.name} structure, got array instead`);const n=e.fromObject(t);return e.encode(n).finish()}}function f(e){return(e||[]).reduce((e,t)=>{for(const[n,r]of Object.entries(t))if("uninterpreted_option"===n)e.uninterpreted_option.push(t.uninterpreted_option);else e[n]=r;return e},{deprecated:!1,idempotency_level:c.IDEMPOTENCY_UNKNOWN,uninterpreted_option:[]})}function p(e,t,n,i){const s=e.resolvedRequestType,o=e.resolvedResponseType;return{path:"/"+t+"/"+e.name,requestStream:!!e.requestStream,responseStream:!!e.responseStream,requestSerialize:d(s),requestDeserialize:u(s,n),responseSerialize:d(o),responseDeserialize:u(o,n),originalName:r(e.name),requestType:g(s,i),responseType:g(o,i),options:f(e.parsedOptions)}}function g(e,t){const n=e.toDescriptor("proto3");return{format:"Protocol Buffer 3 DescriptorProto",type:n.$type.toObject(n,l),fileDescriptorProtos:t}}function m(e,t,n,r){if(e instanceof i.Service)return function(e,t,n,r){const i={};for(const s of e.methodsArray)i[s.name]=p(s,t,n,r);return i}(e,t,n,r);if(e instanceof i.Type)return g(e,r);if(e instanceof i.Enum)return function(e,t){const n=e.toDescriptor("proto3");return{format:"Protocol Buffer 3 EnumDescriptorProto",type:n.$type.toObject(n,l),fileDescriptorProtos:t}}(e,r);throw new Error("Type mismatch in reflection object handling")}function _(e,t){const n={};e.resolveAll();const r=e.toDescriptor("proto3").file.map(e=>Buffer.from(s.FileDescriptorProto.encode(e).finish()));for(const[i,s]of h(e,""))n[i]=m(s,i,t,r);return n}function y(e,t){t=t||{};const n=i.Root.fromDescriptor(e);return n.resolveAll(),_(n,t)}t.load=function(e,t){return(0,o.loadProtosWithOptions)(e,t).then(e=>_(e,t))},t.loadSync=function(e,t){return _((0,o.loadProtosWithOptionsSync)(e,t),t)},t.fromJSON=function(e,t){t=t||{};const n=i.Root.fromJSON(e);return n.resolveAll(),_(n,t)},t.loadFileDescriptorSetFromBuffer=function(e,t){return y(s.FileDescriptorSet.decode(e),t)},t.loadFileDescriptorSetFromObject=function(e,t){return y(s.FileDescriptorSet.fromObject(e),t)},(0,o.addCommonProtos)()},1238(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.addCommonProtos=t.loadProtosWithOptionsSync=t.loadProtosWithOptions=void 0;const r=n(9896),i=n(6928),s=n(2549);function o(e,t){const n=e.resolvePath;e.resolvePath=(e,s)=>{if(i.isAbsolute(s))return s;for(const e of t){const t=i.join(e,s);try{return r.accessSync(t,r.constants.R_OK),t}catch(e){continue}}return process.emitWarning(`${s} not found in any of the include paths ${t}`),n(e,s)}}t.loadProtosWithOptions=async function(e,t){const n=new s.Root;if((t=t||{}).includeDirs){if(!Array.isArray(t.includeDirs))return Promise.reject(new Error("The includeDirs option must be an array"));o(n,t.includeDirs)}const r=await n.load(e,t);return r.resolveAll(),r},t.loadProtosWithOptionsSync=function(e,t){const n=new s.Root;if((t=t||{}).includeDirs){if(!Array.isArray(t.includeDirs))throw new Error("The includeDirs option must be an array");o(n,t.includeDirs)}const r=n.loadSync(e,t);return r.resolveAll(),r},t.addCommonProtos=function(){const e=n(5434),t=n(3951),r=n(2939),i=n(6710);s.common("api",e.nested.google.nested.protobuf.nested),s.common("descriptor",t.nested.google.nested.protobuf.nested),s.common("source_context",r.nested.google.nested.protobuf.nested),s.common("type",i.nested.google.nested.protobuf.nested)}},6787(e,t,n){"use strict";n.r(t),n.d(t,{OrderedMap:()=>d});var r=function(e,t){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])},r(e,t)};function i(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function n(){this.constructor=e}r(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}"function"==typeof SuppressedError&&SuppressedError;var s=function(){function e(e,t,n){void 0===n&&(n=1),this.t=void 0,this.i=void 0,this.h=void 0,this.u=e,this.o=t,this.l=n}return e.prototype.v=function(){var e=this,t=e.h.h===e;if(t&&1===e.l)e=e.i;else if(e.t)for(e=e.t;e.i;)e=e.i;else{if(t)return e.h;for(var n=e.h;n.t===e;)n=(e=n).h;e=n}return e},e.prototype.p=function(){var e=this;if(e.i){for(e=e.i;e.t;)e=e.t;return e}for(var t=e.h;t.i===e;)t=(e=t).h;return e.i!==t?t:e},e.prototype.T=function(){var e=this.h,t=this.i,n=t.t;return e.h===this?e.h=t:e.t===this?e.t=t:e.i=t,t.h=e,t.t=this,this.h=t,this.i=n,n&&(n.h=this),t},e.prototype.I=function(){var e=this.h,t=this.t,n=t.i;return e.h===this?e.h=t:e.t===this?e.t=t:e.i=t,t.h=e,t.i=this,this.h=t,this.t=n,n&&(n.h=this),t},e}(),o=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.O=1,t}return i(t,e),t.prototype.T=function(){var t=e.prototype.T.call(this);return this.M(),t.M(),t},t.prototype.I=function(){var t=e.prototype.I.call(this);return this.M(),t.M(),t},t.prototype.M=function(){this.O=1,this.t&&(this.O+=this.t.O),this.i&&(this.O+=this.i.O)},t}(s),a=function(){function e(e){void 0===e&&(e=0),this.iteratorType=e}return e.prototype.equals=function(e){return this.C===e.C},e}(),c=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return i(t,e),t}(function(){function e(){this._=0}return Object.defineProperty(e.prototype,"length",{get:function(){return this._},enumerable:!1,configurable:!0}),e.prototype.size=function(){return this._},e.prototype.empty=function(){return 0===this._},e}());function l(){throw new RangeError("Iterator access denied!")}var h=function(e){function t(t,n){void 0===t&&(t=function(e,t){return e<t?-1:e>t?1:0}),void 0===n&&(n=!1);var r=e.call(this)||this;return r.N=void 0,r.g=t,r.enableIndex=n,r.S=n?o:s,r.A=new r.S,r}return i(t,e),t.prototype.m=function(e,t){for(var n=this.A;e;){var r=this.g(e.u,t);if(r<0)e=e.i;else{if(!(r>0))return e;n=e,e=e.t}}return n},t.prototype.B=function(e,t){for(var n=this.A;e;){this.g(e.u,t)<=0?e=e.i:(n=e,e=e.t)}return n},t.prototype.j=function(e,t){for(var n=this.A;e;){var r=this.g(e.u,t);if(r<0)n=e,e=e.i;else{if(!(r>0))return e;e=e.t}}return n},t.prototype.k=function(e,t){for(var n=this.A;e;){this.g(e.u,t)<0?(n=e,e=e.i):e=e.t}return n},t.prototype.R=function(e){for(;;){var t,n=e.h;if(n===this.A)return;if(1===e.l)return void(e.l=0);if(e===n.t)if(1===(t=n.i).l)t.l=0,n.l=1,n===this.N?this.N=n.T():n.T();else{if(t.i&&1===t.i.l)return t.l=n.l,n.l=0,t.i.l=0,void(n===this.N?this.N=n.T():n.T());t.t&&1===t.t.l?(t.l=1,t.t.l=0,t.I()):(t.l=1,e=n)}else if(1===(t=n.t).l)t.l=0,n.l=1,n===this.N?this.N=n.I():n.I();else{if(t.t&&1===t.t.l)return t.l=n.l,n.l=0,t.t.l=0,void(n===this.N?this.N=n.I():n.I());t.i&&1===t.i.l?(t.l=1,t.i.l=0,t.T()):(t.l=1,e=n)}}},t.prototype.G=function(e){if(1!==this._){for(var t=e;t.t||t.i;){if(t.i)for(t=t.i;t.t;)t=t.t;else t=t.t;var n=e.u;e.u=t.u,t.u=n;var r=e.o;e.o=t.o,t.o=r,e=t}this.A.t===t?this.A.t=t.h:this.A.i===t&&(this.A.i=t.h),this.R(t);var i=t.h;if(t===i.t?i.t=void 0:i.i=void 0,this._-=1,this.N.l=0,this.enableIndex)for(;i!==this.A;)i.O-=1,i=i.h}else this.clear()},t.prototype.P=function(e){for(var t="number"==typeof e?e:void 0,n="function"==typeof e?e:void 0,r=void 0===e?[]:void 0,i=0,s=this.N,o=[];o.length||s;)if(s)o.push(s),s=s.t;else{if(s=o.pop(),i===t)return s;r&&r.push(s),n&&n(s,i,this),i+=1,s=s.i}return r},t.prototype.q=function(e){for(;;){var t=e.h;if(0===t.l)return;var n=t.h;if(t===n.t){if((r=n.i)&&1===r.l){if(r.l=t.l=0,n===this.N)return;n.l=1,e=n;continue}if(e!==t.i)return t.l=0,n===this.N?this.N=n.I():n.I(),void(n.l=1);e.l=0,e.t&&(e.t.h=t),e.i&&(e.i.h=n),t.i=e.t,n.t=e.i,e.t=t,e.i=n,n===this.N?(this.N=e,this.A.h=e):(i=n.h).t===n?i.t=e:i.i=e,e.h=n.h,t.h=e,n.h=e,n.l=1}else{var r,i;if((r=n.t)&&1===r.l){if(r.l=t.l=0,n===this.N)return;n.l=1,e=n;continue}if(e!==t.t)return t.l=0,n===this.N?this.N=n.T():n.T(),void(n.l=1);e.l=0,e.t&&(e.t.h=n),e.i&&(e.i.h=t),n.i=e.t,t.t=e.i,e.t=n,e.i=t,n===this.N?(this.N=e,this.A.h=e):(i=n.h).t===n?i.t=e:i.i=e,e.h=n.h,t.h=e,n.h=e,n.l=1}return void(this.enableIndex&&(t.M(),n.M(),e.M()))}},t.prototype.D=function(e,t,n){if(void 0===this.N)return this._+=1,this.N=new this.S(e,t,0),this.N.h=this.A,this.A.h=this.A.t=this.A.i=this.N,this._;var r,i=this.A.t,s=this.g(i.u,e);if(0===s)return i.o=t,this._;if(s>0)i.t=new this.S(e,t),i.t.h=i,r=i.t,this.A.t=r;else{var o=this.A.i,a=this.g(o.u,e);if(0===a)return o.o=t,this._;if(a<0)o.i=new this.S(e,t),o.i.h=o,r=o.i,this.A.i=r;else{if(void 0!==n){var c=n.C;if(c!==this.A){var l=this.g(c.u,e);if(0===l)return c.o=t,this._;if(l>0){var h=c.v(),u=this.g(h.u,e);if(0===u)return h.o=t,this._;u<0&&(r=new this.S(e,t),void 0===h.i?(h.i=r,r.h=h):(c.t=r,r.h=c))}}}if(void 0===r)for(r=this.N;;){var d=this.g(r.u,e);if(d>0){if(void 0===r.t){r.t=new this.S(e,t),r.t.h=r,r=r.t;break}r=r.t}else{if(!(d<0))return r.o=t,this._;if(void 0===r.i){r.i=new this.S(e,t),r.i.h=r,r=r.i;break}r=r.i}}}}if(this.enableIndex)for(var f=r.h;f!==this.A;)f.O+=1,f=f.h;return this.q(r),this._+=1,this._},t.prototype.F=function(e,t){for(;e;){var n=this.g(e.u,t);if(n<0)e=e.i;else{if(!(n>0))return e;e=e.t}}return e||this.A},t.prototype.clear=function(){this._=0,this.N=void 0,this.A.h=void 0,this.A.t=this.A.i=void 0},t.prototype.updateKeyByIterator=function(e,t){var n=e.C;if(n===this.A&&l(),1===this._)return n.u=t,!0;var r=n.p().u;if(n===this.A.t)return this.g(r,t)>0&&(n.u=t,!0);var i=n.v().u;return n===this.A.i?this.g(i,t)<0&&(n.u=t,!0):!(this.g(i,t)>=0||this.g(r,t)<=0)&&(n.u=t,!0)},t.prototype.eraseElementByPos=function(e){if(e<0||e>this._-1)throw new RangeError;var t=this.P(e);return this.G(t),this._},t.prototype.eraseElementByKey=function(e){if(0===this._)return!1;var t=this.F(this.N,e);return t!==this.A&&(this.G(t),!0)},t.prototype.eraseElementByIterator=function(e){var t=e.C;t===this.A&&l();var n=void 0===t.i;return 0===e.iteratorType?n&&e.next():n&&void 0!==t.t||e.next(),this.G(t),e},t.prototype.getHeight=function(){if(0===this._)return 0;return function e(t){return t?Math.max(e(t.t),e(t.i))+1:0}(this.N)},t}(c),u=function(e){function t(t,n,r,i){var s=e.call(this,t,n,i)||this;return s.container=r,s}return i(t,e),Object.defineProperty(t.prototype,"pointer",{get:function(){this.C===this.A&&l();var e=this;return new Proxy([],{get:function(t,n){return"0"===n?e.C.u:"1"===n?e.C.o:(t[0]=e.C.u,t[1]=e.C.o,t[n])},set:function(t,n,r){if("1"!==n)throw new TypeError("prop must be 1");return e.C.o=r,!0}})},enumerable:!1,configurable:!0}),t.prototype.copy=function(){return new t(this.C,this.A,this.container,this.iteratorType)},t}(function(e){function t(t,n,r){var i=e.call(this,r)||this;return i.C=t,i.A=n,0===i.iteratorType?(i.pre=function(){return this.C===this.A.t&&l(),this.C=this.C.v(),this},i.next=function(){return this.C===this.A&&l(),this.C=this.C.p(),this}):(i.pre=function(){return this.C===this.A.i&&l(),this.C=this.C.p(),this},i.next=function(){return this.C===this.A&&l(),this.C=this.C.v(),this}),i}return i(t,e),Object.defineProperty(t.prototype,"index",{get:function(){var e=this.C,t=this.A.h;if(e===this.A)return t?t.O-1:0;var n=0;for(e.t&&(n+=e.t.O);e!==t;){var r=e.h;e===r.i&&(n+=1,r.t&&(n+=r.t.O)),e=r}return n},enumerable:!1,configurable:!0}),t.prototype.isAccessible=function(){return this.C!==this.A},t}(a)),d=function(e){function t(t,n,r){void 0===t&&(t=[]);var i=e.call(this,n,r)||this,s=i;return t.forEach(function(e){s.setElement(e[0],e[1])}),i}return i(t,e),t.prototype.begin=function(){return new u(this.A.t||this.A,this.A,this)},t.prototype.end=function(){return new u(this.A,this.A,this)},t.prototype.rBegin=function(){return new u(this.A.i||this.A,this.A,this,1)},t.prototype.rEnd=function(){return new u(this.A,this.A,this,1)},t.prototype.front=function(){if(0!==this._){var e=this.A.t;return[e.u,e.o]}},t.prototype.back=function(){if(0!==this._){var e=this.A.i;return[e.u,e.o]}},t.prototype.lowerBound=function(e){var t=this.m(this.N,e);return new u(t,this.A,this)},t.prototype.upperBound=function(e){var t=this.B(this.N,e);return new u(t,this.A,this)},t.prototype.reverseLowerBound=function(e){var t=this.j(this.N,e);return new u(t,this.A,this)},t.prototype.reverseUpperBound=function(e){var t=this.k(this.N,e);return new u(t,this.A,this)},t.prototype.forEach=function(e){this.P(function(t,n,r){e([t.u,t.o],n,r)})},t.prototype.setElement=function(e,t,n){return this.D(e,t,n)},t.prototype.getElementByPos=function(e){if(e<0||e>this._-1)throw new RangeError;var t=this.P(e);return[t.u,t.o]},t.prototype.find=function(e){var t=this.F(this.N,e);return new u(t,this.A,this)},t.prototype.getElementByKey=function(e){return this.F(this.N,e).o},t.prototype.union=function(e){var t=this;return e.forEach(function(e){t.setElement(e[0],e[1])}),this._},t.prototype[Symbol.iterator]=function(){var e,t,n,r;return function(e,t){var n,r,i,s,o={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return s={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(s[Symbol.iterator]=function(){return this}),s;function a(e){return function(t){return c([e,t])}}function c(a){if(n)throw new TypeError("Generator is already executing.");for(;s&&(s=0,a[0]&&(o=0)),o;)try{if(n=1,r&&(i=2&a[0]?r.return:a[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,a[1])).done)return i;switch(r=0,i&&(a=[2&a[0],i.value]),a[0]){case 0:case 1:i=a;break;case 4:return o.label++,{value:a[1],done:!1};case 5:o.label++,r=a[1],a=[0];continue;case 7:a=o.ops.pop(),o.trys.pop();continue;default:if(!((i=(i=o.trys).length>0&&i[i.length-1])||6!==a[0]&&2!==a[0])){o=0;continue}if(3===a[0]&&(!i||a[1]>i[0]&&a[1]<i[3])){o.label=a[1];break}if(6===a[0]&&o.label<i[1]){o.label=i[1],i=a;break}if(i&&o.label<i[2]){o.label=i[2],o.ops.push(a);break}i[2]&&o.ops.pop(),o.trys.pop();continue}a=t.call(e,o)}catch(e){a=[6,e],r=0}finally{n=i=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}}(this,function(i){switch(i.label){case 0:e=this._,t=this.P(),n=0,i.label=1;case 1:return n<e?[4,[(r=t[n]).u,r.o]]:[3,4];case 2:i.sent(),i.label=3;case 3:return++n,[3,1];case 4:return[2]}})},t}(h)},8045(e){"use strict";e.exports=function(e,t){var n=new Array(arguments.length-1),r=0,i=2,s=!0;for(;i<arguments.length;)n[r++]=arguments[i++];return new Promise(function(i,o){n[r]=function(e){if(s)if(s=!1,e)o(e);else{for(var t=new Array(arguments.length-1),n=0;n<t.length;)t[n++]=arguments[n];i.apply(null,t)}};try{e.apply(t||null,n)}catch(e){s&&(s=!1,o(e))}})}},8839(e,t){"use strict";var n=t;n.length=function(e){var t=e.length;if(!t)return 0;for(var n=0;--t%4>1&&"="===e.charAt(t);)++n;return Math.ceil(3*e.length)/4-n};for(var r=new Array(64),i=new Array(123),s=0;s<64;)i[r[s]=s<26?s+65:s<52?s+71:s<62?s-4:s-59|43]=s++;n.encode=function(e,t,n){for(var i,s=null,o=[],a=0,c=0;t<n;){var l=e[t++];switch(c){case 0:o[a++]=r[l>>2],i=(3&l)<<4,c=1;break;case 1:o[a++]=r[i|l>>4],i=(15&l)<<2,c=2;break;case 2:o[a++]=r[i|l>>6],o[a++]=r[63&l],c=0}a>8191&&((s||(s=[])).push(String.fromCharCode.apply(String,o)),a=0)}return c&&(o[a++]=r[i],o[a++]=61,1===c&&(o[a++]=61)),s?(a&&s.push(String.fromCharCode.apply(String,o.slice(0,a))),s.join("")):String.fromCharCode.apply(String,o.slice(0,a))};var o="invalid encoding";n.decode=function(e,t,n){for(var r,s=n,a=0,c=0;c<e.length;){var l=e.charCodeAt(c++);if(61===l&&a>1)break;if(void 0===(l=i[l]))throw Error(o);switch(a){case 0:r=l,a=1;break;case 1:t[n++]=r<<2|(48&l)>>4,r=l,a=2;break;case 2:t[n++]=(15&r)<<4|(60&l)>>2,r=l,a=3;break;case 3:t[n++]=(3&r)<<6|l,a=0}}if(1===a)throw Error(o);return n-s},n.test=function(e){return/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/.test(e)}},8561(e){"use strict";function t(e,n){"string"==typeof e&&(n=e,e=void 0);var r=[];function i(e){if("string"!=typeof e){var n=s();if(t.verbose&&console.log("codegen: "+n),n="return "+n,e){for(var o=Object.keys(e),a=new Array(o.length+1),c=new Array(o.length),l=0;l<o.length;)a[l]=o[l],c[l]=e[o[l++]];return a[l]=n,Function.apply(null,a).apply(null,c)}return Function(n)()}for(var h=new Array(arguments.length-1),u=0;u<h.length;)h[u]=arguments[++u];if(u=0,e=e.replace(/%([%dfijs])/g,function(e,t){var n=h[u++];switch(t){case"d":case"f":return String(Number(n));case"i":return String(Math.floor(n));case"j":return JSON.stringify(n);case"s":return String(n)}return"%"}),u!==h.length)throw Error("parameter count mismatch");return r.push(e),i}function s(t){return"function "+(t||n||"")+"("+(e&&e.join(",")||"")+"){\n "+r.join("\n ")+"\n}"}return i.toString=s,i}e.exports=t,t.verbose=!1},4358(e){"use strict";function t(){this._listeners={}}e.exports=t,t.prototype.on=function(e,t,n){return(this._listeners[e]||(this._listeners[e]=[])).push({fn:t,ctx:n||this}),this},t.prototype.off=function(e,t){if(void 0===e)this._listeners={};else if(void 0===t)this._listeners[e]=[];else for(var n=this._listeners[e],r=0;r<n.length;)n[r].fn===t?n.splice(r,1):++r;return this},t.prototype.emit=function(e){var t=this._listeners[e];if(t){for(var n=[],r=1;r<arguments.length;)n.push(arguments[r++]);for(r=0;r<t.length;)t[r].fn.apply(t[r++].ctx,n)}return this}},5212(e,t,n){"use strict";e.exports=s;var r=n(8045),i=n(4153)("fs");function s(e,t,n){return"function"==typeof t?(n=t,t={}):t||(t={}),n?!t.xhr&&i&&i.readFile?i.readFile(e,function(r,i){return r&&"undefined"!=typeof XMLHttpRequest?s.xhr(e,t,n):r?n(r):n(null,t.binary?i:i.toString("utf8"))}):s.xhr(e,t,n):r(s,this,e,t)}s.xhr=function(e,t,n){var r=new XMLHttpRequest;r.onreadystatechange=function(){if(4===r.readyState){if(0!==r.status&&200!==r.status)return n(Error("status "+r.status));if(t.binary){var e=r.response;if(!e){e=[];for(var i=0;i<r.responseText.length;++i)e.push(255&r.responseText.charCodeAt(i))}return n(null,"undefined"!=typeof Uint8Array?new Uint8Array(e):e)}return n(null,r.responseText)}},t.binary&&("overrideMimeType"in r&&r.overrideMimeType("text/plain; charset=x-user-defined"),r.responseType="arraybuffer"),r.open("GET",e),r.send()}},9410(e){"use strict";function t(e){return"undefined"!=typeof Float32Array?function(){var t=new Float32Array([-0]),n=new Uint8Array(t.buffer),r=128===n[3];function i(e,r,i){t[0]=e,r[i]=n[0],r[i+1]=n[1],r[i+2]=n[2],r[i+3]=n[3]}function s(e,r,i){t[0]=e,r[i]=n[3],r[i+1]=n[2],r[i+2]=n[1],r[i+3]=n[0]}function o(e,r){return n[0]=e[r],n[1]=e[r+1],n[2]=e[r+2],n[3]=e[r+3],t[0]}function a(e,r){return n[3]=e[r],n[2]=e[r+1],n[1]=e[r+2],n[0]=e[r+3],t[0]}e.writeFloatLE=r?i:s,e.writeFloatBE=r?s:i,e.readFloatLE=r?o:a,e.readFloatBE=r?a:o}():function(){function t(e,t,n,r){var i=t<0?1:0;if(i&&(t=-t),0===t)e(1/t>0?0:2147483648,n,r);else if(isNaN(t))e(2143289344,n,r);else if(t>34028234663852886e22)e((i<<31|2139095040)>>>0,n,r);else if(t<11754943508222875e-54)e((i<<31|Math.round(t/1401298464324817e-60))>>>0,n,r);else{var s=Math.floor(Math.log(t)/Math.LN2);e((i<<31|s+127<<23|8388607&Math.round(t*Math.pow(2,-s)*8388608))>>>0,n,r)}}function o(e,t,n){var r=e(t,n),i=2*(r>>31)+1,s=r>>>23&255,o=8388607&r;return 255===s?o?NaN:i*(1/0):0===s?1401298464324817e-60*i*o:i*Math.pow(2,s-150)*(o+8388608)}e.writeFloatLE=t.bind(null,n),e.writeFloatBE=t.bind(null,r),e.readFloatLE=o.bind(null,i),e.readFloatBE=o.bind(null,s)}(),"undefined"!=typeof Float64Array?function(){var t=new Float64Array([-0]),n=new Uint8Array(t.buffer),r=128===n[7];function i(e,r,i){t[0]=e,r[i]=n[0],r[i+1]=n[1],r[i+2]=n[2],r[i+3]=n[3],r[i+4]=n[4],r[i+5]=n[5],r[i+6]=n[6],r[i+7]=n[7]}function s(e,r,i){t[0]=e,r[i]=n[7],r[i+1]=n[6],r[i+2]=n[5],r[i+3]=n[4],r[i+4]=n[3],r[i+5]=n[2],r[i+6]=n[1],r[i+7]=n[0]}function o(e,r){return n[0]=e[r],n[1]=e[r+1],n[2]=e[r+2],n[3]=e[r+3],n[4]=e[r+4],n[5]=e[r+5],n[6]=e[r+6],n[7]=e[r+7],t[0]}function a(e,r){return n[7]=e[r],n[6]=e[r+1],n[5]=e[r+2],n[4]=e[r+3],n[3]=e[r+4],n[2]=e[r+5],n[1]=e[r+6],n[0]=e[r+7],t[0]}e.writeDoubleLE=r?i:s,e.writeDoubleBE=r?s:i,e.readDoubleLE=r?o:a,e.readDoubleBE=r?a:o}():function(){function t(e,t,n,r,i,s){var o=r<0?1:0;if(o&&(r=-r),0===r)e(0,i,s+t),e(1/r>0?0:2147483648,i,s+n);else if(isNaN(r))e(0,i,s+t),e(2146959360,i,s+n);else if(r>17976931348623157e292)e(0,i,s+t),e((o<<31|2146435072)>>>0,i,s+n);else{var a;if(r<22250738585072014e-324)e((a=r/5e-324)>>>0,i,s+t),e((o<<31|a/4294967296)>>>0,i,s+n);else{var c=Math.floor(Math.log(r)/Math.LN2);1024===c&&(c=1023),e(4503599627370496*(a=r*Math.pow(2,-c))>>>0,i,s+t),e((o<<31|c+1023<<20|1048576*a&1048575)>>>0,i,s+n)}}}function o(e,t,n,r,i){var s=e(r,i+t),o=e(r,i+n),a=2*(o>>31)+1,c=o>>>20&2047,l=4294967296*(1048575&o)+s;return 2047===c?l?NaN:a*(1/0):0===c?5e-324*a*l:a*Math.pow(2,c-1075)*(l+4503599627370496)}e.writeDoubleLE=t.bind(null,n,0,4),e.writeDoubleBE=t.bind(null,r,4,0),e.readDoubleLE=o.bind(null,i,0,4),e.readDoubleBE=o.bind(null,s,4,0)}(),e}function n(e,t,n){t[n]=255&e,t[n+1]=e>>>8&255,t[n+2]=e>>>16&255,t[n+3]=e>>>24}function r(e,t,n){t[n]=e>>>24,t[n+1]=e>>>16&255,t[n+2]=e>>>8&255,t[n+3]=255&e}function i(e,t){return(e[t]|e[t+1]<<8|e[t+2]<<16|e[t+3]<<24)>>>0}function s(e,t){return(e[t]<<24|e[t+1]<<16|e[t+2]<<8|e[t+3])>>>0}e.exports=t(t)},4153(module){"use strict";function inquire(moduleName){try{var mod=eval("quire".replace(/^/,"re"))(moduleName);if(mod&&(mod.length||Object.keys(mod).length))return mod}catch(e){}return null}module.exports=inquire},9207(e,t){"use strict";var n=t,r=n.isAbsolute=function(e){return/^(?:\/|\w+:)/.test(e)},i=n.normalize=function(e){var t=(e=e.replace(/\\/g,"/").replace(/\/{2,}/g,"/")).split("/"),n=r(e),i="";n&&(i=t.shift()+"/");for(var s=0;s<t.length;)".."===t[s]?s>0&&".."!==t[s-1]?t.splice(--s,2):n?t.splice(s,1):++s:"."===t[s]?t.splice(s,1):++s;return i+t.join("/")};n.resolve=function(e,t,n){return n||(t=i(t)),r(t)?t:(n||(e=i(e)),(e=e.replace(/(?:\/|^)[^/]+$/,"")).length?i(e+"/"+t):t)}},9390(e){"use strict";e.exports=function(e,t,n){var r=n||8192,i=r>>>1,s=null,o=r;return function(n){if(n<1||n>i)return e(n);o+n>r&&(s=e(r),o=0);var a=t.call(s,o,o+=n);return 7&o&&(o=1+(7|o)),a}}},1447(e,t){"use strict";var n=t;n.length=function(e){for(var t=0,n=0,r=0;r<e.length;++r)(n=e.charCodeAt(r))<128?t+=1:n<2048?t+=2:55296==(64512&n)&&56320==(64512&e.charCodeAt(r+1))?(++r,t+=4):t+=3;return t},n.read=function(e,t,n){if(n-t<1)return"";for(var r,i=null,s=[],o=0;t<n;)(r=e[t++])<128?s[o++]=r:r>191&&r<224?s[o++]=(31&r)<<6|63&e[t++]:r>239&&r<365?(r=((7&r)<<18|(63&e[t++])<<12|(63&e[t++])<<6|63&e[t++])-65536,s[o++]=55296+(r>>10),s[o++]=56320+(1023&r)):s[o++]=(15&r)<<12|(63&e[t++])<<6|63&e[t++],o>8191&&((i||(i=[])).push(String.fromCharCode.apply(String,s)),o=0);return i?(o&&i.push(String.fromCharCode.apply(String,s.slice(0,o))),i.join("")):String.fromCharCode.apply(String,s.slice(0,o))},n.write=function(e,t,n){for(var r,i,s=n,o=0;o<e.length;++o)(r=e.charCodeAt(o))<128?t[n++]=r:r<2048?(t[n++]=r>>6|192,t[n++]=63&r|128):55296==(64512&r)&&56320==(64512&(i=e.charCodeAt(o+1)))?(r=65536+((1023&r)<<10)+(1023&i),++o,t[n++]=r>>18|240,t[n++]=r>>12&63|128,t[n++]=r>>6&63|128,t[n++]=63&r|128):(t[n++]=r>>12|224,t[n++]=r>>6&63|128,t[n++]=63&r|128);return n-s}},8591(e,t,n){var r=n(5692),i=n(8611),s=n(7016),o=n(3294),a=(e.exports.maxRedirects=5,{https:r,http:i});for(var c in a){var l=function(){};l.prototype=a[c],(l=new l).request=function(n){return function(r,i,a){a=a||{};var l,h="object"==typeof r&&"maxRedirects"in r?r.maxRedirects:t.maxRedirects,u=o.extend({count:0,max:h,clientRequest:null,userCallback:i},a);if(u.count>u.max){var d=new Error("Max redirects exceeded. To allow more redirects, pass options.maxRedirects property.");return u.clientRequest.emit("error",d),u.clientRequest}u.count++,l="string"==typeof r?r:s.format(o.extend({protocol:c},r));var f=Object.getPrototypeOf(n).request(r,function t(n,r){return function(i){if(i.statusCode<300||i.statusCode>399)return r.userCallback(i);if(!("location"in i.headers))return r.userCallback(i);var o=s.resolve(n,i.headers.location),a=s.parse(o).protocol;return a=a.substr(0,a.length-1),e.exports[a].get(o,t(n,r),r)}}(l,u));return u.clientRequest||(u.clientRequest=f),f}}(l),l.get=function(e){return function(t,n,r){var i=e.request(t,n,r);return i.end(),i}}(l),e.exports[c]=l}},8280(e,t,n){e.exports=s;var r=n(9023),i=n(4198);function s(e,t,n){var r=this;if(!(r instanceof s))return new s(e,t,n);i.Duplex.call(r,n),r._output=null,r.connect(e,t)}r.inherits(s,i.Duplex),s.prototype.connect=function(e,t){var n=this;n.req=e,n._output=t,n.emit("response",t),t.on("data",function(e){n.push(e)||n._output.pause()}),t.on("end",function(){n.push(null)})},s.prototype._read=function(e){this._output&&this._output.resume()},s.prototype._write=function(e,t,n){this.req.write(e,t),n()},s.prototype.end=function(e,t,n){return this._output.socket.destroySoon(),this.req.end(e,t,n)},s.prototype.destroy=function(){this.req.destroy(),this._output.socket.destroy()},s.prototype.destroySoon=function(){this.req.destroy(),this._output.socket.destroy()}},7469(e,t,n){var r=n(3480),i=n(8591),s=n(9896),o=n(6928),a=n(7016),c=n(8397),l=n(8280),h=n(3294),u=(n(9023),n(4546)),d=n(857),f="Windows_NT"===d.type(),p=n(2203),g=function(){return new Promise(function(e){var t=o.join(d.homedir(),".docker","run","docker.sock");s.access(t,function(n){e(n?"/var/run/docker.sock":t)})})},m=function(e){var t=function(){var e,t={};if(process.env.DOCKER_HOST)if(0===process.env.DOCKER_HOST.indexOf("unix://"))t.socketPath=process.env.DOCKER_HOST.substring(7)||g;else if(0===process.env.DOCKER_HOST.indexOf("npipe://"))t.socketPath=process.env.DOCKER_HOST.substring(8)||"//./pipe/docker_engine";else{var n=process.env.DOCKER_HOST;n.indexOf("//")<0&&(n="tcp://"+n);try{e=new a.URL(n)}catch(e){throw new Error("DOCKER_HOST env variable should be something like tcp://localhost:1234")}t.port=e.port,"1"===process.env.DOCKER_TLS_VERIFY||"2376"===t.port?t.protocol="https":"ssh:"===e.protocol?(t.protocol="ssh",t.username=e.username,t.sshOptions={agent:process.env.SSH_AUTH_SOCK}):t.protocol="http",process.env.DOCKER_PATH_PREFIX?t.pathPrefix=process.env.DOCKER_PATH_PREFIX:t.pathPrefix="/",t.host=e.hostname,process.env.DOCKER_CERT_PATH&&(t.ca=u(o.join(process.env.DOCKER_CERT_PATH,"ca.pem")),t.cert=s.readFileSync(o.join(process.env.DOCKER_CERT_PATH,"cert.pem")),t.key=s.readFileSync(o.join(process.env.DOCKER_CERT_PATH,"key.pem"))),process.env.DOCKER_CLIENT_TIMEOUT&&(t.timeout=parseInt(process.env.DOCKER_CLIENT_TIMEOUT,10))}else t.socketPath=f?"//./pipe/docker_engine":g;return t}(),n=Object.assign({},t,e);this.host=n.host,this.host||(this.socketPath=n.socketPath),this.port=n.port,this.pathPrefix=n.pathPrefix,this.username=n.username,this.password=n.password,this.version=n.version,this.key=n.key,this.cert=n.cert,this.ca=n.ca,this.timeout=n.timeout,this.connectionTimeout=n.connectionTimeout,this.checkServerIdentity=n.checkServerIdentity,this.agent=n.agent,this.headers=n.headers||{},this.sshOptions=Object.assign({},e?e.sshOptions:{},t.sshOptions),void 0===this.sshOptions.agentForward&&(this.sshOptions.agentForward=n.agentForward),this.key&&this.cert&&this.ca&&(this.protocol="https"),this.protocol=n.protocol||this.protocol||"http"};m.prototype.dial=function(e,t){var n,r,i;if(e.options&&(n=e.options),n&&n.authconfig&&delete n.authconfig,n&&n.abortSignal&&delete n.abortSignal,this.version&&(e.path="/"+this.version+e.path),this.host){var c=a.parse(this.host);r=a.format({protocol:c.protocol||this.protocol,hostname:c.hostname||this.host,port:this.port,pathname:c.pathname||this.pathPrefix}),r=a.resolve(r,e.path)}else r=e.path;-1!==e.path.indexOf("?")&&(n&&Object.keys(n).length>0?r+=this.buildQuerystring(n._query||n):r=r.substring(0,r.length-1));var l={path:r,method:e.method,headers:e.headers||Object.assign({},this.headers),key:this.key,cert:this.cert,ca:this.ca};if(this.checkServerIdentity&&(l.checkServerIdentity=this.checkServerIdentity),this.agent&&(l.agent=this.agent),e.authconfig&&(l.headers["X-Registry-Auth"]=e.authconfig.key||e.authconfig.base64||Buffer.from(JSON.stringify(e.authconfig)).toString("base64").replace(/\+/g,"-").replace(/\//g,"_")),e.registryconfig&&(l.headers["X-Registry-Config"]=e.registryconfig.base64||Buffer.from(JSON.stringify(e.registryconfig)).toString("base64")),e.abortSignal&&(l.signal=e.abortSignal),e.file?(i="string"==typeof e.file?s.createReadStream(o.resolve(e.file)):e.file,l.headers["Content-Type"]="application/tar"):n&&"POST"===e.method&&(i=JSON.stringify(n._body||n),e.allowEmpty||"{}"!==i&&'""'!==i?l.headers["Content-Type"]="application/json":i=void 0),"string"==typeof i?l.headers["Content-Length"]=Buffer.byteLength(i):!0===Buffer.isBuffer(i)?l.headers["Content-Length"]=i.length:("PUT"===l.method||e.hijack||e.openStdin)&&(l.headers["Transfer-Encoding"]="chunked"),e.hijack&&(l.headers.Connection="Upgrade",l.headers.Upgrade=l.headers.Upgrade??"tcp"),this.socketPath)this.getSocketPath().then(n=>{l.socketPath=n,this.buildRequest(l,e,i,t)});else{var h=a.parse(r);l.hostname=h.hostname,l.port=h.port,l.path=h.path,this.buildRequest(l,e,i,t)}},m.prototype.getSocketPath=function(){if(this.socketPath){if(this.socketPathCache)return Promise.resolve(this.socketPathCache);var e="function"==typeof this.socketPath?this.socketPath():this.socketPath;return this.socketPathCache=e,Promise.resolve(e)}},m.prototype.buildRequest=function(e,t,n,r){var s,o=this,a=!1,l="ssh"===o.protocol?Object.assign(e,{agent:c(Object.assign({},o.sshOptions,{host:o.host,port:o.port,username:o.username,password:o.password})),protocol:"http:"}):e,u=null;try{u=i["ssh"===o.protocol?"http":o.protocol].request(l,function(){})}catch(e){return void r(e)}o.connectionTimeout&&(s=setTimeout(function(){u.destroy()},o.connectionTimeout)),o.timeout&&(u.setTimeout(o.timeout),u.on("timeout",function(){u.destroy()})),!0===t.hijack&&(clearTimeout(s),u.on("upgrade",function(e,t,n){if(!1===a)return a=!0,n.length>0&&t.unshift(n),r(null,t)})),u.on("connect",function(){clearTimeout(s)}),u.on("disconnect",function(){clearTimeout(s)}),u.on("response",function(n){if(clearTimeout(s),!0===t.isStream)!1===a&&(a=!0,o.buildPayload(null,t.isStream,t.statusCodes,t.openStdin,u,n,null,r));else{null!=e.signal&&p.addAbortSignal(e.signal,n);var i=[];n.on("data",function(e){i.push(e)}),n.on("end",function(){var e=Buffer.concat(i),s=e.toString(),c=h.parseJSON(s)||e;!1===a&&(a=!0,o.buildPayload(null,t.isStream,t.statusCodes,!1,u,n,c,r))})}}),u.on("error",function(e){clearTimeout(s),!1===a&&(a=!0,o.buildPayload(e,t.isStream,t.statusCodes,!1,{},{},null,r))}),"string"==typeof n||Buffer.isBuffer(n)?u.write(n):n&&(n.on("error",function(e){u.destroy(e)}),n.pipe(u)),t.openStdin||"string"!=typeof n&&void 0!==n&&!Buffer.isBuffer(n)||u.end()},m.prototype.buildPayload=function(e,t,n,r,i,s,o,a){if(e)return a(e,null);!0!==n[s.statusCode]?function(e,t,n,r){var i="",s=!1;e?(t.on("data",function(e){i+=e}),t.on("error",function(e){o(e,null)}),t.on("end",function(){o(null,h.parseJSON(i)||i)})):r(null,n);function o(e,t){!1===s&&(e?r(e):r(null,t)),s=!0}}(t,s,o,function(e,t){if(e)return a(e,null);var r=new Error("(HTTP code "+s.statusCode+") "+(n[s.statusCode]||"unexpected")+" - "+(t.message||t.error||t)+" ");r.reason=n[s.statusCode],r.statusCode=s.statusCode,r.json=o,a(r,null)}):a(null,r?new l(i,s):t?s:o)},m.prototype.demuxStream=function(e,t,n){var r=null,i=null,s=Buffer.from("");function o(e){var t=s.subarray(0,e);return s=Buffer.from(s.subarray(e,s.length)),t}e.on("data",function e(a){if(a&&(s=Buffer.concat([s,a])),r){if(s.length>=i){var c=o(i);1===r?t.write(c):n.write(c),r=null,e()}}else if(s.length>=8){var l=o(8);r=l.readUInt8(0),i=l.readUInt32BE(4),e()}})},m.prototype.followProgress=function(e,t,n){var r="",i=[],s=!1;function o(e){function t(e){if("\r"==e[e.length-1]&&(e=e.substr(0,e.length-1)),e.length>0){var t=JSON.parse(e);i.push(t),n&&n(t)}}r+=e.toString(),function(){var e;for(;(e=r.indexOf("\n"))>=0;)0!=e?(t(r.slice(0,e)),r=r.slice(e+1)):r=r.slice(1)}()}function a(){s||t(null,i),s=!0}e.on("data",o),e.on("error",function n(r){s=!0,e.removeListener("data",o),e.removeListener("error",n),e.removeListener("end",a),e.removeListener("close",a),t(r,i)}),e.on("end",a),e.on("close",a)},m.prototype.buildQuerystring=function(e){var t={};return Object.keys(e).map(function(n,r){e[n]&&"object"==typeof e[n]&&!Array.isArray(e[n])?t[n]=JSON.stringify(e[n]):t[n]=e[n]}),r.stringify(t)},e.exports=m},8397(e,t,n){var r=n(9472).Client,i=n(8611);e.exports=function(e){var t=new r,n=new i.Agent;function s(e,r){if(t.end(),n.destroy(),!r)throw e;r(e)}return n.createConnection=function(r,i){try{t.once("ready",function(){t.exec("docker system dial-stdio",function(e,r){e&&s(e,i),i(null,r),r.addListener("error",e=>{s(e,i)}),r.once("close",()=>{t.end(),n.destroy()})})}).on("error",e=>{s(e,i)}).connect(e),t.once("end",()=>n.destroy())}catch(e){s(e)}},n}},3294(e){var t=[],n=t.forEach,r=t.slice;e.exports.extend=function(e){return n.call(r.call(arguments,1),function(t){if(t)for(var n in t)e[n]=t[n]}),e},e.exports.parseJSON=function(e){try{return JSON.parse(e)}catch(e){return null}}},6474(e,t,n){var r=n(7052),i=function(e,t){this.modem=e,this.id=t};i.prototype[n(9023).inspect.custom]=function(){return this},i.prototype.inspect=function(e,t){var n=this,i=r.processArgs(e,t),s={path:"/configs/"+this.id,method:"GET",abortSignal:i.opts.abortSignal,statusCodes:{200:!0,404:"config not found",500:"server error",503:"node is not part of a swarm"}};if(void 0===i.callback)return new this.modem.Promise(function(e,t){n.modem.dial(s,function(n,r){if(n)return t(n);e(r)})});this.modem.dial(s,function(e,t){i.callback(e,t)})},i.prototype.update=function(e,t){var n=this,i=r.processArgs(e,t),s={path:"/configs/"+this.id+"/update?",method:"POST",abortSignal:i.opts.abortSignal,statusCodes:{200:!0,404:"config not found",500:"server error",503:"node is not part of a swarm"},options:i.opts};if(void 0===i.callback)return new this.modem.Promise(function(e,t){n.modem.dial(s,function(n,r){if(n)return t(n);e(r)})});this.modem.dial(s,function(e,t){i.callback(e,t)})},i.prototype.remove=function(e,t){var n=this,i=r.processArgs(e,t),s={path:"/configs/"+this.id,method:"DELETE",abortSignal:i.opts.abortSignal,statusCodes:{200:!0,204:!0,404:"config not found",500:"server error",503:"node is not part of a swarm"},options:i.opts};if(void 0===i.callback)return new this.modem.Promise(function(e,t){n.modem.dial(s,function(n,r){if(n)return t(n);e(r)})});this.modem.dial(s,function(e,t){i.callback(e,t)})},e.exports=i},4985(e,t,n){n(7052).extend;var r=n(6033),i=n(7052),s=function(e,t){this.modem=e,this.id=t,this.defaultOptions={top:{},start:{},commit:{},stop:{},pause:{},unpause:{},restart:{},resize:{},attach:{},remove:{},copy:{},kill:{},exec:{},rename:{},log:{},stats:{},getArchive:{},infoArchive:{},putArchive:{},update:{},wait:{}}};s.prototype[n(9023).inspect.custom]=function(){return this},s.prototype.inspect=function(e,t){var n=this,r=i.processArgs(e,t),s={path:"/containers/"+this.id+"/json?",method:"GET",options:r.opts,abortSignal:r.opts.abortSignal,statusCodes:{200:!0,404:"no such container",500:"server error"}};if(void 0===r.callback)return new this.modem.Promise(function(e,t){n.modem.dial(s,function(n,r){if(n)return t(n);e(r)})});this.modem.dial(s,function(e,t){r.callback(e,t)})},s.prototype.rename=function(e,t){var n=this,r=i.processArgs(e,t,this.defaultOptions.rename),s={path:"/containers/"+this.id+"/rename?",method:"POST",abortSignal:r.opts.abortSignal,statusCodes:{200:!0,204:!0,404:"no such container",500:"server error"},options:r.opts};if(void 0===r.callback)return new this.modem.Promise(function(e,t){n.modem.dial(s,function(n,r){if(n)return t(n);e(r)})});this.modem.dial(s,function(e,t){r.callback(e,t)})},s.prototype.update=function(e,t){var n=this,r=i.processArgs(e,t,this.defaultOptions.update),s={path:"/containers/"+this.id+"/update",method:"POST",abortSignal:r.opts.abortSignal,statusCodes:{200:!0,204:!0,400:"bad parameter",404:"no such container",500:"server error"},options:r.opts};if(void 0===r.callback)return new this.modem.Promise(function(e,t){n.modem.dial(s,function(n,r){if(n)return t(n);e(r)})});this.modem.dial(s,function(e,t){r.callback(e,t)})},s.prototype.top=function(e,t){var n=this,r=i.processArgs(e,t,this.defaultOptions.top),s={path:"/containers/"+this.id+"/top?",method:"GET",abortSignal:r.opts.abortSignal,statusCodes:{200:!0,404:"no such container",500:"server error"},options:r.opts};if(void 0===r.callback)return new this.modem.Promise(function(e,t){n.modem.dial(s,function(n,r){if(n)return t(n);e(r)})});this.modem.dial(s,function(e,t){r.callback(e,t)})},s.prototype.changes=function(e,t){var n=this,r=i.processArgs(e,t),s={path:"/containers/"+this.id+"/changes",method:"GET",abortSignal:r.opts.abortSignal,statusCodes:{200:!0,404:"no such container",500:"server error"}};if(void 0===r.callback)return new this.modem.Promise(function(e,t){n.modem.dial(s,function(n,r){if(n)return t(n);e(r)})});this.modem.dial(s,function(e,t){r.callback(e,t)})},s.prototype.listCheckpoint=function(e,t){var n=this,r=i.processArgs(e,t),s={path:"/containers/"+this.id+"/checkpoints?",method:"GET",abortSignal:r.opts.abortSignal,statusCodes:{200:!0,404:"no such container",500:"server error"},options:r.opts};if(void 0===r.callback)return new this.modem.Promise(function(e,t){n.modem.dial(s,function(n,r){if(n)return t(n);e(r)})});this.modem.dial(s,function(e,t){r.callback(e,t)})},s.prototype.deleteCheckpoint=function(e,t,n){var r=this,s=i.processArgs(t,n),o={path:"/containers/"+this.id+"/checkpoints/"+e+"?",method:"DELETE",abortSignal:s.opts.abortSignal,statusCodes:{200:!0,204:!0,404:"no such container",500:"server error"},options:s.opts};if(void 0===s.callback)return new this.modem.Promise(function(e,t){r.modem.dial(o,function(n,r){if(n)return t(n);e(r)})});this.modem.dial(o,function(e,t){s.callback(e,t)})},s.prototype.createCheckpoint=function(e,t){var n=this,r=i.processArgs(e,t),s={path:"/containers/"+this.id+"/checkpoints",method:"POST",abortSignal:r.opts.abortSignal,allowEmpty:!0,statusCodes:{200:!0,201:!0,204:!0,404:"no such container",500:"server error"},options:r.opts};if(void 0===r.callback)return new this.modem.Promise(function(e,t){n.modem.dial(s,function(n,r){if(n)return t(n);e(r)})});this.modem.dial(s,function(e,t){r.callback(e,t)})},s.prototype.export=function(e,t){var n=this,r=i.processArgs(e,t),s={path:"/containers/"+this.id+"/export",method:"GET",abortSignal:r.opts.abortSignal,isStream:!0,statusCodes:{200:!0,404:"no such container",500:"server error"}};if(void 0===r.callback)return new this.modem.Promise(function(e,t){n.modem.dial(s,function(n,r){if(n)return t(n);e(r)})});this.modem.dial(s,function(e,t){r.callback(e,t)})},s.prototype.start=function(e,t){var n=this,r=i.processArgs(e,t,this.defaultOptions.start),s={path:"/containers/"+this.id+"/start?",method:"POST",abortSignal:r.opts.abortSignal,statusCodes:{200:!0,204:!0,304:"container already started",404:"no such container",500:"server error"},options:r.opts};if(void 0===r.callback)return new this.modem.Promise(function(e,t){n.modem.dial(s,function(n,r){if(n)return t(n);e(r)})});this.modem.dial(s,function(e,t){r.callback(e,t)})},s.prototype.pause=function(e,t){var n=this,r=i.processArgs(e,t,this.defaultOptions.pause),s={path:"/containers/"+this.id+"/pause",method:"POST",abortSignal:r.opts.abortSignal,statusCodes:{200:!0,204:!0,500:"server error"},options:r.opts};if(void 0===r.callback)return new this.modem.Promise(function(e,t){n.modem.dial(s,function(n,r){if(n)return t(n);e(r)})});this.modem.dial(s,function(e,t){r.callback(e,t)})},s.prototype.unpause=function(e,t){var n=this,r=i.processArgs(e,t,this.defaultOptions.unpause),s={path:"/containers/"+this.id+"/unpause",method:"POST",abortSignal:r.opts.abortSignal,statusCodes:{200:!0,204:!0,404:"no such container",500:"server error"},options:r.opts};if(void 0===r.callback)return new this.modem.Promise(function(e,t){n.modem.dial(s,function(n,r){if(n)return t(n);e(r)})});this.modem.dial(s,function(e,t){r.callback(e,t)})},s.prototype.exec=function(e,t){var n=this,s=i.processArgs(e,t,this.defaultOptions.exec),o={path:"/containers/"+this.id+"/exec",method:"POST",abortSignal:s.opts.abortSignal,statusCodes:{200:!0,201:!0,404:"no such container",409:"container stopped/paused",500:"server error"},options:s.opts};if(void 0===s.callback)return new this.modem.Promise(function(e,t){n.modem.dial(o,function(i,s){if(i)return t(i);e(new r(n.modem,s.Id))})});this.modem.dial(o,function(e,t){if(e)return s.callback(e,t);s.callback(e,new r(n.modem,t.Id))})},s.prototype.commit=function(e,t){var n=this,r=i.processArgs(e,t,this.defaultOptions.commit);r.opts.container=this.id;var s={path:"/commit?",method:"POST",abortSignal:r.opts.abortSignal,statusCodes:{200:!0,201:!0,404:"no such container",500:"server error"},options:r.opts};if(void 0===r.callback)return new this.modem.Promise(function(e,t){n.modem.dial(s,function(n,r){if(n)return t(n);e(r)})});this.modem.dial(s,function(e,t){r.callback(e,t)})},s.prototype.stop=function(e,t){var n=this,r=i.processArgs(e,t,this.defaultOptions.stop),s={path:"/containers/"+this.id+"/stop?",method:"POST",abortSignal:r.opts.abortSignal,statusCodes:{200:!0,204:!0,304:"container already stopped",404:"no such container",500:"server error"},options:r.opts};if(void 0===r.callback)return new this.modem.Promise(function(e,t){n.modem.dial(s,function(n,r){if(n)return t(n);e(r)})});this.modem.dial(s,function(e,t){r.callback(e,t)})},s.prototype.restart=function(e,t){var n=this,r=i.processArgs(e,t,this.defaultOptions.restart),s={path:"/containers/"+this.id+"/restart?",method:"POST",abortSignal:r.opts.abortSignal,statusCodes:{200:!0,204:!0,404:"no such container",500:"server error"},options:r.opts};if(void 0===r.callback)return new this.modem.Promise(function(e,t){n.modem.dial(s,function(n,r){if(n)return t(n);e(r)})});this.modem.dial(s,function(e,t){r.callback(e,t)})},s.prototype.kill=function(e,t){var n=this,r=i.processArgs(e,t,this.defaultOptions.kill),s={path:"/containers/"+this.id+"/kill?",method:"POST",abortSignal:r.opts.abortSignal,statusCodes:{200:!0,204:!0,404:"no such container",500:"server error"},options:r.opts};if(void 0===r.callback)return new this.modem.Promise(function(e,t){n.modem.dial(s,function(n,r){if(n)return t(n);e(r)})});this.modem.dial(s,function(e,t){r.callback(e,t)})},s.prototype.resize=function(e,t){var n=this,r=i.processArgs(e,t,this.defaultOptions.resize),s={path:"/containers/"+this.id+"/resize?",method:"POST",abortSignal:r.opts.abortSignal,statusCodes:{200:!0,400:"bad parameter",404:"no such container",500:"server error"},options:r.opts};if(void 0===r.callback)return new this.modem.Promise(function(e,t){n.modem.dial(s,function(n,r){if(n)return t(n);e(r)})});this.modem.dial(s,function(e,t){r.callback(e,t)})},s.prototype.attach=function(e,t){var n=this,r=i.processArgs(e,t,this.defaultOptions.attach),s={path:"/containers/"+this.id+"/attach?",method:"POST",abortSignal:r.opts.abortSignal,isStream:!0,hijack:r.opts.hijack,openStdin:r.opts.stdin,statusCodes:{200:!0,404:"no such container",500:"server error"},options:r.opts};if(void 0===r.callback)return new this.modem.Promise(function(e,t){n.modem.dial(s,function(n,r){if(n)return t(n);e(r)})});this.modem.dial(s,function(e,t){r.callback(e,t)})},s.prototype.wait=function(e,t){var n=this,r=i.processArgs(e,t,this.defaultOptions.wait),s={path:"/containers/"+this.id+"/wait?",method:"POST",abortSignal:r.opts.abortSignal,statusCodes:{200:!0,400:"bad parameter",404:"no such container",500:"server error"},options:r.opts};if(void 0===r.callback)return new this.modem.Promise(function(e,t){n.modem.dial(s,function(n,r){if(n)return t(n);e(r)})});this.modem.dial(s,function(e,t){r.callback(e,t)})},s.prototype.remove=function(e,t){var n=this,r=i.processArgs(e,t,this.defaultOptions.remove),s={path:"/containers/"+this.id+"?",method:"DELETE",abortSignal:r.opts.abortSignal,statusCodes:{200:!0,204:!0,400:"bad parameter",404:"no such container",500:"server error"},options:r.opts};if(void 0===r.callback)return new this.modem.Promise(function(e,t){n.modem.dial(s,function(n,r){if(n)return t(n);e(r)})});this.modem.dial(s,function(e,t){r.callback(e,t)})},s.prototype.copy=function(e,t){var n=this;console.log("container.copy is deprecated since Docker v1.8.x");var r=i.processArgs(e,t,this.defaultOptions.copy),s={path:"/containers/"+this.id+"/copy",method:"POST",abortSignal:r.opts.abortSignal,isStream:!0,statusCodes:{200:!0,404:"no such container",500:"server error"},options:r.opts};if(void 0===r.callback)return new this.modem.Promise(function(e,t){n.modem.dial(s,function(n,r){if(n)return t(n);e(r)})});this.modem.dial(s,function(e,t){r.callback(e,t)})},s.prototype.getArchive=function(e,t){var n=this,r=i.processArgs(e,t,this.defaultOptions.getArchive),s={path:"/containers/"+this.id+"/archive?",method:"GET",abortSignal:r.opts.abortSignal,isStream:!0,statusCodes:{200:!0,400:"client error, bad parameters",404:"no such container",500:"server error"},options:r.opts};if(void 0===r.callback)return new this.modem.Promise(function(e,t){n.modem.dial(s,function(n,r){if(n)return t(n);e(r)})});this.modem.dial(s,function(e,t){r.callback(e,t)})},s.prototype.infoArchive=function(e,t){var n=this,r=i.processArgs(e,t,this.defaultOptions.infoArchive),s={path:"/containers/"+this.id+"/archive?",method:"HEAD",abortSignal:r.opts.abortSignal,isStream:!0,statusCodes:{200:!0,400:"client error, bad parameters",404:"no such container",500:"server error"},options:r.opts};if(void 0===r.callback)return new this.modem.Promise(function(e,t){n.modem.dial(s,function(n,r){if(n)return t(n);e(r)})});this.modem.dial(s,function(e,t){r.callback(e,t)})},s.prototype.putArchive=function(e,t,n){var r=this,s=i.processArgs(t,n,this.defaultOptions.putArchive),o={path:"/containers/"+this.id+"/archive?",method:"PUT",file:e,abortSignal:s.opts.abortSignal,statusCodes:{200:!0,400:"client error, bad parameters",403:"client error, permission denied",404:"no such container",500:"server error"},options:s.opts};if(void 0===s.callback)return new this.modem.Promise(function(e,t){r.modem.dial(o,function(n,r){if(n)return t(n);e(r)})});this.modem.dial(o,function(e,t){s.callback(e,t)})},s.prototype.logs=function(e,t){var n=this,r=i.processArgs(e,t,this.defaultOptions.log),s={path:"/containers/"+this.id+"/logs?",method:"GET",abortSignal:r.opts.abortSignal,isStream:r.opts.follow||!1,statusCodes:{200:!0,404:"no such container",500:"server error"},options:r.opts};if(void 0===r.callback)return new this.modem.Promise(function(e,t){n.modem.dial(s,function(n,r){if(n)return t(n);e(r)})});this.modem.dial(s,function(e,t){r.callback(e,t)})},s.prototype.stats=function(e,t){var n=this,r=i.processArgs(e,t,this.defaultOptions.stats),s=!0;!1===r.opts.stream&&(s=!1);var o={path:"/containers/"+this.id+"/stats?",method:"GET",abortSignal:r.opts.abortSignal,isStream:s,statusCodes:{200:!0,404:"no such container",500:"server error"},options:r.opts};if(void 0===r.callback)return new this.modem.Promise(function(e,t){n.modem.dial(o,function(n,r){if(n)return t(n);e(r)})});this.modem.dial(o,function(e,t){r.callback(e,t)})},e.exports=s},8608(e,t,n){var r=n(4434).EventEmitter,i=n(7469),s=n(4985),o=n(1991),a=n(4974),c=n(384),l=n(3569),h=n(3303),u=n(9360),d=n(6474),f=n(5517),p=n(4024),g=n(6033),m=n(7052),_=n(7054),y=m.extend,v=function(e){if(!(this instanceof v))return new v(e);var t=global.Promise;e&&e.Promise&&(t=e.Promise,1===Object.keys(e).length&&(e=void 0)),e&&e.modem?this.modem=e.modem:this.modem=new i(e),this.modem.Promise=t};v.prototype.createContainer=function(e,t){var n=this,r={path:"/containers/create?",method:"POST",options:e,authconfig:e.authconfig,abortSignal:e.abortSignal,statusCodes:{200:!0,201:!0,400:"bad parameter",404:"no such container",406:"impossible to attach",500:"server error"}};if(delete e.authconfig,void 0===t)return new this.modem.Promise(function(e,t){n.modem.dial(r,function(r,i){if(r)return t(r);e(n.getContainer(i.Id))})});this.modem.dial(r,function(e,r){if(e)return t(e,r);t(e,n.getContainer(r.Id))})},v.prototype.createImage=function(e,t,n){var r=this;n||"function"!=typeof t?n||t||(e=(t=e).authconfig):(n=t,e=(t=e).authconfig||void 0);var i={path:"/images/create?",method:"POST",options:t,authconfig:e,abortSignal:t.abortSignal,isStream:!0,statusCodes:{200:!0,500:"server error"}};if(void 0===n)return new this.modem.Promise(function(e,t){r.modem.dial(i,function(n,r){if(n)return t(n);e(r)})});this.modem.dial(i,function(e,t){n(e,t)})},v.prototype.loadImage=function(e,t,n){var r=this;n||"function"!=typeof t||(n=t,t=null);var i={path:"/images/load?",method:"POST",options:t,file:e,abortSignal:t&&t.abortSignal,isStream:!0,statusCodes:{200:!0,500:"server error"}};if(void 0===n)return new this.modem.Promise(function(e,t){r.modem.dial(i,function(n,r){if(n)return t(n);e(r)})});this.modem.dial(i,function(e,t){n(e,t)})},v.prototype.importImage=function(e,t,n){var r=this;n||"function"!=typeof t||(n=t,t=void 0),t||(t={}),t.fromSrc="-";var i={path:"/images/create?",method:"POST",options:t,file:e,abortSignal:t.abortSignal,isStream:!0,statusCodes:{200:!0,500:"server error"}};if(void 0===n)return new this.modem.Promise(function(e,t){r.modem.dial(i,function(n,r){if(n)return t(n);e(r)})});this.modem.dial(i,function(e,t){n(e,t)})},v.prototype.checkAuth=function(e,t){var n=this,r={path:"/auth",method:"POST",options:e,abortSignal:e.abortSignal,statusCodes:{200:!0,204:!0,500:"server error"}};if(void 0===t)return new this.modem.Promise(function(e,t){n.modem.dial(r,function(n,r){if(n)return t(n);e(r)})});this.modem.dial(r,function(e,n){t(e,n)})},v.prototype.buildImage=function(e,t,n){var r=this;n||"function"!=typeof t||(n=t,t=null);var i={path:"/build?",method:"POST",file:void 0,options:t,abortSignal:t&&t.abortSignal,isStream:!0,statusCodes:{200:!0,500:"server error"}};function s(t){m.prepareBuildContext(e,e=>{i.file=e,r.modem.dial(i,t)})}function o(e){"2"===t?.version?_(r,i.authconfig,(t,n,r)=>{if(t)return e(t);i.options.session=n,s((t,n)=>{e(t,n),n&&n.on("end",r)})}):s(e)}if(t&&(t.registryconfig&&(i.registryconfig=i.options.registryconfig,delete i.options.registryconfig),t.authconfig&&(i.authconfig=i.options.authconfig,delete i.options.authconfig),t.cachefrom&&Array.isArray(t.cachefrom)&&(i.options.cachefrom=JSON.stringify(t.cachefrom))),void 0===n)return new r.modem.Promise(function(e,t){o(function(n,r){if(n)return t(n);e(r)})});o(n)},v.prototype.getContainer=function(e){return new s(this.modem,e)},v.prototype.getImage=function(e){return new o(this.modem,e)},v.prototype.getVolume=function(e){return new a(this.modem,e)},v.prototype.getPlugin=function(e,t){return new h(this.modem,e,t)},v.prototype.getService=function(e){return new l(this.modem,e)},v.prototype.getTask=function(e){return new f(this.modem,e)},v.prototype.getNode=function(e){return new p(this.modem,e)},v.prototype.getNetwork=function(e){return new c(this.modem,e)},v.prototype.getSecret=function(e){return new u(this.modem,e)},v.prototype.getConfig=function(e){return new d(this.modem,e)},v.prototype.getExec=function(e){return new g(this.modem,e)},v.prototype.listContainers=function(e,t){var n=this,r=m.processArgs(e,t),i={path:"/containers/json?",method:"GET",options:r.opts,abortSignal:r.opts.abortSignal,statusCodes:{200:!0,400:"bad parameter",500:"server error"}};if(void 0===r.callback)return new this.modem.Promise(function(e,t){n.modem.dial(i,function(n,r){if(n)return t(n);e(r)})});this.modem.dial(i,function(e,t){r.callback(e,t)})},v.prototype.listImages=function(e,t){var n=this,r=m.processArgs(e,t),i={path:"/images/json?",method:"GET",options:r.opts,abortSignal:r.opts.abortSignal,statusCodes:{200:!0,400:"bad parameter",500:"server error"}};if(void 0===r.callback)return new this.modem.Promise(function(e,t){n.modem.dial(i,function(n,r){if(n)return t(n);e(r)})});this.modem.dial(i,function(e,t){r.callback(e,t)})},v.prototype.getImages=function(e,t){var n=this,r=m.processArgs(e,t),i={path:"/images/get?",method:"GET",options:r.opts,abortSignal:r.opts.abortSignal,isStream:!0,statusCodes:{200:!0,400:"bad parameter",500:"server error"}};if(void 0===r.callback)return new this.modem.Promise(function(e,t){n.modem.dial(i,function(n,r){if(n)return t(n);e(r)})});this.modem.dial(i,function(e,t){r.callback(e,t)})},v.prototype.listServices=function(e,t){var n=this,r=m.processArgs(e,t),i={path:"/services?",method:"GET",options:r.opts,abortSignal:r.opts.abortSignal,statusCodes:{200:!0,500:"server error"}};if(void 0===r.callback)return new this.modem.Promise(function(e,t){n.modem.dial(i,function(n,r){if(n)return t(n);e(r)})});this.modem.dial(i,function(e,t){r.callback(e,t)})},v.prototype.listNodes=function(e,t){var n=this,r=m.processArgs(e,t),i={path:"/nodes?",method:"GET",options:r.opts,abortSignal:r.opts.abortSignal,statusCodes:{200:!0,400:"bad parameter",404:"no such node",500:"server error",503:"node is not part of a swarm"}};if(void 0===r.callback)return new this.modem.Promise(function(e,t){n.modem.dial(i,function(n,r){if(n)return t(n);e(r)})});this.modem.dial(i,function(e,t){r.callback(e,t)})},v.prototype.listTasks=function(e,t){var n=this,r=m.processArgs(e,t),i={path:"/tasks?",method:"GET",options:r.opts,abortSignal:r.opts.abortSignal,statusCodes:{200:!0,500:"server error"}};if(void 0===r.callback)return new this.modem.Promise(function(e,t){n.modem.dial(i,function(n,r){if(n)return t(n);e(r)})});this.modem.dial(i,function(e,t){r.callback(e,t)})},v.prototype.createSecret=function(e,t){var n=m.processArgs(e,t),r=this,i={path:"/secrets/create?",method:"POST",options:n.opts,abortSignal:n.opts.abortSignal,statusCodes:{200:!0,201:!0,406:"server error or node is not part of a swarm",409:"name conflicts with an existing object",500:"server error"}};if(void 0===n.callback)return new this.modem.Promise(function(e,t){r.modem.dial(i,function(n,i){if(n)return t(n);e(r.getSecret(i.ID))})});this.modem.dial(i,function(e,t){if(e)return n.callback(e,t);n.callback(e,r.getSecret(t.ID))})},v.prototype.createConfig=function(e,t){var n=m.processArgs(e,t),r=this,i={path:"/configs/create?",method:"POST",options:n.opts,abortSignal:n.opts.abortSignal,statusCodes:{200:!0,201:!0,406:"server error or node is not part of a swarm",409:"name conflicts with an existing object",500:"server error"}};if(void 0===n.callback)return new this.modem.Promise(function(e,t){r.modem.dial(i,function(n,i){if(n)return t(n);e(r.getConfig(i.ID))})});this.modem.dial(i,function(e,t){if(e)return n.callback(e,t);n.callback(e,r.getConfig(t.ID))})},v.prototype.listSecrets=function(e,t){var n=this,r=m.processArgs(e,t),i={path:"/secrets?",method:"GET",options:r.opts,abortSignal:r.opts.abortSignal,statusCodes:{200:!0,500:"server error"}};if(void 0===r.callback)return new this.modem.Promise(function(e,t){n.modem.dial(i,function(n,r){if(n)return t(n);e(r)})});this.modem.dial(i,function(e,t){r.callback(e,t)})},v.prototype.listConfigs=function(e,t){var n=this,r=m.processArgs(e,t),i={path:"/configs?",method:"GET",options:r.opts,abortSignal:r.opts.abortSignal,statusCodes:{200:!0,500:"server error"}};if(void 0===r.callback)return new this.modem.Promise(function(e,t){n.modem.dial(i,function(n,r){if(n)return t(n);e(r)})});this.modem.dial(i,function(e,t){r.callback(e,t)})},v.prototype.createPlugin=function(e,t){var n=this,r=m.processArgs(e,t),i={path:"/plugins/create?",method:"POST",options:r.opts,abortSignal:r.opts.abortSignal,statusCodes:{200:!0,204:!0,500:"server error"}};if(void 0===r.callback)return new this.modem.Promise(function(e,t){n.modem.dial(i,function(i,s){if(i)return t(i);e(n.getPlugin(r.opts.name))})});this.modem.dial(i,function(e,t){if(e)return r.callback(e,t);r.callback(e,n.getPlugin(r.opts.name))})},v.prototype.listPlugins=function(e,t){var n=this,r=m.processArgs(e,t),i={path:"/plugins?",method:"GET",options:r.opts,abortSignal:r.opts.abortSignal,statusCodes:{200:!0,500:"server error"}};if(void 0===r.callback)return new this.modem.Promise(function(e,t){n.modem.dial(i,function(n,r){if(n)return t(n);e(r)})});this.modem.dial(i,function(e,t){r.callback(e,t)})},v.prototype.pruneImages=function(e,t){var n=this,r=m.processArgs(e,t),i={path:"/images/prune?",method:"POST",options:r.opts,abortSignal:r.opts.abortSignal,statusCodes:{200:!0,500:"server error"}};if(void 0===r.callback)return new this.modem.Promise(function(e,t){n.modem.dial(i,function(n,r){if(n)return t(n);e(r)})});this.modem.dial(i,function(e,t){r.callback(e,t)})},v.prototype.pruneBuilder=function(e,t){var n=this,r=m.processArgs(e,t),i={path:"/build/prune",method:"POST",abortSignal:r.opts.abortSignal,statusCodes:{200:!0,500:"server error"}};if(void 0===r.callback)return new this.modem.Promise(function(e,t){n.modem.dial(i,function(n,r){if(n)return t(n);e(r)})});this.modem.dial(i,function(e,t){r.callback(e,t)})},v.prototype.pruneContainers=function(e,t){var n=this,r=m.processArgs(e,t),i={path:"/containers/prune?",method:"POST",options:r.opts,abortSignal:r.opts.abortSignal,statusCodes:{200:!0,500:"server error"}};if(void 0===r.callback)return new this.modem.Promise(function(e,t){n.modem.dial(i,function(n,r){if(n)return t(n);e(r)})});this.modem.dial(i,function(e,t){r.callback(e,t)})},v.prototype.pruneVolumes=function(e,t){var n=this,r=m.processArgs(e,t),i={path:"/volumes/prune?",method:"POST",options:r.opts,abortSignal:r.opts.abortSignal,statusCodes:{200:!0,500:"server error"}};if(void 0===r.callback)return new this.modem.Promise(function(e,t){n.modem.dial(i,function(n,r){if(n)return t(n);e(r)})});this.modem.dial(i,function(e,t){r.callback(e,t)})},v.prototype.pruneNetworks=function(e,t){var n=this,r=m.processArgs(e,t),i={path:"/networks/prune?",method:"POST",options:r.opts,abortSignal:r.opts.abortSignal,statusCodes:{200:!0,500:"server error"}};if(void 0===r.callback)return new this.modem.Promise(function(e,t){n.modem.dial(i,function(n,r){if(n)return t(n);e(r)})});this.modem.dial(i,function(e,t){r.callback(e,t)})},v.prototype.createVolume=function(e,t){var n=this,r=m.processArgs(e,t),i={path:"/volumes/create?",method:"POST",allowEmpty:!0,options:r.opts,abortSignal:r.opts.abortSignal,statusCodes:{200:!0,201:!0,500:"server error"}};if(void 0===r.callback)return new this.modem.Promise(function(e,t){n.modem.dial(i,function(r,i){if(r)return t(r);e(n.getVolume(i.Name))})});this.modem.dial(i,function(e,t){if(e)return r.callback(e,t);r.callback(e,n.getVolume(t.Name))})},v.prototype.createService=function(e,t,n){n||"function"!=typeof t?t||n||(t=e):(n=t,e=(t=e).authconfig||void 0);var r=this,i={path:"/services/create",method:"POST",options:t,authconfig:e,abortSignal:t&&t.abortSignal,statusCodes:{200:!0,201:!0,500:"server error"}};if(void 0===n)return new this.modem.Promise(function(e,t){r.modem.dial(i,function(n,i){if(n)return t(n);e(r.getService(i.ID||i.Id))})});this.modem.dial(i,function(e,t){if(e)return n(e,t);n(e,r.getService(t.ID||t.Id))})},v.prototype.listVolumes=function(e,t){var n=this,r=m.processArgs(e,t),i={path:"/volumes?",method:"GET",options:r.opts,abortSignal:r.opts.abortSignal,statusCodes:{200:!0,400:"bad parameter",500:"server error"}};if(void 0===r.callback)return new this.modem.Promise(function(e,t){n.modem.dial(i,function(n,r){if(n)return t(n);e(r)})});this.modem.dial(i,function(e,t){r.callback(e,t)})},v.prototype.createNetwork=function(e,t){var n=this,r=m.processArgs(e,t),i={path:"/networks/create?",method:"POST",options:r.opts,abortSignal:r.opts.abortSignal,statusCodes:{200:!0,201:!0,404:"driver not found",500:"server error"}};if(void 0===r.callback)return new this.modem.Promise(function(e,t){n.modem.dial(i,function(r,i){if(r)return t(r);e(n.getNetwork(i.Id))})});this.modem.dial(i,function(e,t){if(e)return r.callback(e,t);r.callback(e,n.getNetwork(t.Id))})},v.prototype.listNetworks=function(e,t){var n=this,r=m.processArgs(e,t),i={path:"/networks?",method:"GET",options:r.opts,abortSignal:r.opts.abortSignal,statusCodes:{200:!0,400:"bad parameter",500:"server error"}};if(void 0===r.callback)return new this.modem.Promise(function(e,t){n.modem.dial(i,function(n,r){if(n)return t(n);e(r)})});this.modem.dial(i,function(e,t){r.callback(e,t)})},v.prototype.searchImages=function(e,t){var n=this,r={path:"/images/search?",method:"GET",options:e,authconfig:e.authconfig,abortSignal:e.abortSignal,statusCodes:{200:!0,500:"server error"}};if(void 0===t)return new this.modem.Promise(function(e,t){n.modem.dial(r,function(n,r){if(n)return t(n);e(r)})});this.modem.dial(r,function(e,n){t(e,n)})},v.prototype.info=function(e,t){var n=this,r=m.processArgs(e,t);e={path:"/info",method:"GET",abortSignal:r.opts.abortSignal,statusCodes:{200:!0,500:"server error"}};if(void 0===r.callback)return new this.modem.Promise(function(t,r){n.modem.dial(e,function(e,n){if(e)return r(e);t(n)})});this.modem.dial(e,function(e,t){r.callback(e,t)})},v.prototype.version=function(e,t){var n=this,r=m.processArgs(e,t);e={path:"/version",method:"GET",abortSignal:r.opts.abortSignal,statusCodes:{200:!0,500:"server error"}};if(void 0===r.callback)return new this.modem.Promise(function(t,r){n.modem.dial(e,function(e,n){if(e)return r(e);t(n)})});this.modem.dial(e,function(e,t){r.callback(e,t)})},v.prototype.ping=function(e,t){var n=this,r=m.processArgs(e,t),i={path:"/_ping",method:"GET",abortSignal:r.opts.abortSignal,statusCodes:{200:!0,500:"server error"}};if(void 0===r.callback)return new this.modem.Promise(function(e,t){n.modem.dial(i,function(n,r){if(n)return t(n);e(r)})});this.modem.dial(i,function(e,t){r.callback(e,t)})},v.prototype.df=function(e,t){var n=this,r=m.processArgs(e,t),i={path:"/system/df",method:"GET",abortSignal:r.opts.abortSignal,statusCodes:{200:!0,500:"server error"}};if(void 0===r.callback)return new this.modem.Promise(function(e,t){n.modem.dial(i,function(n,r){if(n)return t(n);e(r)})});this.modem.dial(i,function(e,t){r.callback(e,t)})},v.prototype.getEvents=function(e,t){var n=this,r=m.processArgs(e,t),i={path:"/events?",method:"GET",options:r.opts,abortSignal:r.opts.abortSignal,isStream:!0,statusCodes:{200:!0,500:"server error"}};if(void 0===r.callback)return new this.modem.Promise(function(e,t){n.modem.dial(i,function(n,r){if(n)return t(n);e(r)})});this.modem.dial(i,function(e,t){r.callback(e,t)})},v.prototype.pull=function(e,t,n,r){var i=m.processArgs(t,n),s=m.parseRepositoryTag(e);i.opts.fromImage=s.repository,i.opts.tag=s.tag||"latest";var o=[i.opts,i.callback];return r&&(o=[r,i.opts,i.callback]),this.createImage.apply(this,o)},v.prototype.pullAll=function(e,t,n,r){var i=m.processArgs(t,n),s=m.parseRepositoryTag(e);i.opts.fromImage=s.repository;var o=[i.opts,i.callback];return r&&(o=[r,i.opts,i.callback]),this.createImage.apply(this,o)},v.prototype.run=function(e,t,n,r,i,s){return"function"==typeof arguments[arguments.length-1]?this.runCallback(e,t,n,r,i,s):this.runPromise(e,t,n,r,i)},v.prototype.runCallback=function(e,t,n,i,s,o){o||"function"!=typeof i?o||"function"!=typeof s||(o=s,s={}):(o=i,i={},s={});var a=new r;var c={Hostname:"",User:"",AttachStdin:!1,AttachStdout:!0,AttachStderr:!0,Tty:!0,OpenStdin:!1,StdinOnce:!1,Env:null,Cmd:t,Image:e,Volumes:{},VolumesFrom:[]};return y(c,i),this.createContainer(c,function(e,t){if(e)return o(e,null,t);a.emit("container",t),t.attach({stream:!0,stdout:!0,stderr:!0},function(e,r){if(e)return o(e,null,t);a.emit("stream",r),n&&(n instanceof Array?(r.on("end",function(){try{n[0].end()}catch(e){}try{n[1].end()}catch(e){}}),t.modem.demuxStream(r,n[0],n[1])):(r.setEncoding("utf8"),r.pipe(n,{end:!0}))),t.start(s,function(e,n){if(e)return o(e,n,t);a.emit("start",t),t.wait(function(e,n){a.emit("data",n),o(e,n,t)})})})}),a},v.prototype.runPromise=function(e,t,n,r,i){var s=this;i=i||{};var o,a={Hostname:"",User:"",AttachStdin:!1,AttachStdout:!0,AttachStderr:!0,Tty:!0,OpenStdin:!1,StdinOnce:!1,Env:null,Cmd:t,Image:e,Volumes:{},VolumesFrom:[]};return y(a,r=r||{}),new this.modem.Promise(function(e,t){s.createContainer(a).then(function(e){return o=e,e.attach({stream:!0,stdout:!0,stderr:!0})}).then(function(e){return n&&(n instanceof Array?(e.on("end",function(){try{n[0].end()}catch(e){}try{n[1].end()}catch(e){}}),o.modem.demuxStream(e,n[0],n[1])):(e.setEncoding("utf8"),e.pipe(n,{end:!0}))),o.start(i)}).then(function(e){return o.wait()}).then(function(t){e([t,o])}).catch(function(e){t(e)})})},v.prototype.swarmInit=function(e,t){var n=this,r=m.processArgs(e,t),i={path:"/swarm/init",method:"POST",abortSignal:r.opts.abortSignal,statusCodes:{200:!0,400:"bad parameter",406:"node is already part of a Swarm"},options:r.opts};if(void 0===r.callback)return new this.modem.Promise(function(e,t){n.modem.dial(i,function(n,r){if(n)return t(n);e(r)})});this.modem.dial(i,function(e,t){r.callback(e,t)})},v.prototype.swarmJoin=function(e,t){var n=this,r=m.processArgs(e,t),i={path:"/swarm/join",method:"POST",abortSignal:r.opts.abortSignal,statusCodes:{200:!0,400:"bad parameter",406:"node is already part of a Swarm"},options:r.opts};if(void 0===r.callback)return new this.modem.Promise(function(e,t){n.modem.dial(i,function(n,r){if(n)return t(n);e(r)})});this.modem.dial(i,function(e,t){r.callback(e,t)})},v.prototype.swarmLeave=function(e,t){var n=this,r=m.processArgs(e,t),i={path:"/swarm/leave?",method:"POST",abortSignal:r.opts.abortSignal,statusCodes:{200:!0,406:"node is not part of a Swarm"},options:r.opts};if(void 0===r.callback)return new this.modem.Promise(function(e,t){n.modem.dial(i,function(n,r){if(n)return t(n);e(r)})});this.modem.dial(i,function(e,t){r.callback(e,t)})},v.prototype.swarmUpdate=function(e,t){var n=this,r=m.processArgs(e,t),i={path:"/swarm/update?",method:"POST",abortSignal:r.opts.abortSignal,statusCodes:{200:!0,400:"bad parameter",406:"node is already part of a Swarm"},options:r.opts};if(void 0===r.callback)return new this.modem.Promise(function(e,t){n.modem.dial(i,function(n,r){if(n)return t(n);e(r)})});this.modem.dial(i,function(e,t){r.callback(e,t)})},v.prototype.swarmInspect=function(e,t){var n=this,r=m.processArgs(e,t),i={path:"/swarm",method:"GET",abortSignal:r.opts.abortSignal,statusCodes:{200:!0,406:"This node is not a swarm manager",500:"server error"}};if(void 0===r.callback)return new this.modem.Promise(function(e,t){n.modem.dial(i,function(n,r){if(n)return t(n);e(r)})});this.modem.dial(i,function(e,t){r.callback(e,t)})},v.Container=s,v.Image=o,v.Volume=a,v.Network=c,v.Service=l,v.Plugin=h,v.Secret=u,v.Task=f,v.Node=p,v.Exec=g,e.exports=v},6033(e,t,n){var r=n(7052),i=function(e,t){this.modem=e,this.id=t};i.prototype[n(9023).inspect.custom]=function(){return this},i.prototype.start=function(e,t){var n=this,i=r.processArgs(e,t),s={path:"/exec/"+this.id+"/start",method:"POST",abortSignal:i.opts.abortSignal,isStream:!0,allowEmpty:!0,hijack:i.opts.hijack,openStdin:i.opts.stdin,statusCodes:{200:!0,204:!0,404:"no such exec",409:"container stopped/paused",500:"container not running"},options:i.opts};if(void 0===i.callback)return new this.modem.Promise(function(e,t){n.modem.dial(s,function(n,r){if(n)return t(n);e(r)})});this.modem.dial(s,function(e,t){if(e)return i.callback(e,t);i.callback(e,t)})},i.prototype.resize=function(e,t){var n=this,i=r.processArgs(e,t),s={path:"/exec/"+this.id+"/resize?",method:"POST",abortSignal:i.opts.abortSignal,statusCodes:{200:!0,404:"no such exec",500:"container not running"},options:i.opts};if(void 0===i.callback)return new this.modem.Promise(function(e,t){n.modem.dial(s,function(n,r){if(n)return t(n);e(r)})});this.modem.dial(s,function(e,t){if(e)return i.callback(e,t);i.callback(e,t)})},i.prototype.inspect=function(e,t){var n=this,i=r.processArgs(e,t),s={path:"/exec/"+this.id+"/json",method:"GET",abortSignal:i.opts.abortSignal,statusCodes:{200:!0,404:"no such exec",500:"server error"}};if(void 0===i.callback)return new this.modem.Promise(function(e,t){n.modem.dial(s,function(n,r){if(n)return t(n);e(r)})});this.modem.dial(s,function(e,t){if(e)return i.callback(e,t);i.callback(e,t)})},e.exports=i},1991(e,t,n){var r=n(7052),i=function(e,t){this.modem=e,this.name=t};i.prototype[n(9023).inspect.custom]=function(){return this},i.prototype.inspect=function(e,t){var n=r.processArgs(e,t),i=this;e={path:"/images/"+this.name+"/json",method:"GET",options:n.opts,statusCodes:{200:!0,404:"no such image",500:"server error"}};if(void 0===n.callback)return new this.modem.Promise(function(t,n){i.modem.dial(e,function(e,r){if(e)return n(e);t(r)})});this.modem.dial(e,function(e,t){if(e)return n.callback(e,t);n.callback(e,t)})},i.prototype.distribution=function(e,t){var n=r.processArgs(e,t),i=this,s={path:"/distribution/"+this.name+"/json",method:"GET",statusCodes:{200:!0,401:"no such image",500:"server error"},authconfig:n.opts?n.opts.authconfig:void 0};if(void 0===n.callback)return new this.modem.Promise(function(e,t){i.modem.dial(s,function(n,r){if(n)return t(n);e(r)})});this.modem.dial(s,function(e,t){if(e)return n.callback(e,t);n.callback(e,t)})},i.prototype.history=function(e){var t=this,n={path:"/images/"+this.name+"/history",method:"GET",statusCodes:{200:!0,404:"no such image",500:"server error"}};if(void 0===e)return new this.modem.Promise(function(e,r){t.modem.dial(n,function(t,n){if(t)return r(t);e(n)})});this.modem.dial(n,function(t,n){if(t)return e(t,n);e(t,n)})},i.prototype.get=function(e){var t=this,n={path:"/images/"+this.name+"/get",method:"GET",isStream:!0,statusCodes:{200:!0,500:"server error"}};if(void 0===e)return new this.modem.Promise(function(e,r){t.modem.dial(n,function(t,n){if(t)return r(t);e(n)})});this.modem.dial(n,function(t,n){if(t)return e(t,n);e(t,n)})},i.prototype.push=function(e,t,n){var i=this,s=r.processArgs(e,t),o=!0;!1===s.opts.stream&&(o=!1);var a={path:"/images/"+this.name+"/push?",method:"POST",options:s.opts,authconfig:s.opts.authconfig||n,abortSignal:s.opts.abortSignal,isStream:o,statusCodes:{200:!0,404:"no such image",500:"server error"}};if(delete a.options.authconfig,void 0===t)return new this.modem.Promise(function(e,t){i.modem.dial(a,function(n,r){if(n)return t(n);e(r)})});this.modem.dial(a,function(e,n){t(e,n)})},i.prototype.tag=function(e,t){var n=this,r={path:"/images/"+this.name+"/tag?",method:"POST",options:e,abortSignal:e&&e.abortSignal,statusCodes:{200:!0,201:!0,400:"bad parameter",404:"no such image",409:"conflict",500:"server error"}};if(void 0===t)return new this.modem.Promise(function(e,t){n.modem.dial(r,function(n,r){if(n)return t(n);e(r)})});this.modem.dial(r,function(e,n){t(e,n)})},i.prototype.remove=function(e,t){var n=this,i=r.processArgs(e,t),s={path:"/images/"+this.name+"?",method:"DELETE",abortSignal:i.opts.abortSignal,statusCodes:{200:!0,404:"no such image",409:"conflict",500:"server error"},options:i.opts};if(void 0===i.callback)return new this.modem.Promise(function(e,t){n.modem.dial(s,function(n,r){if(n)return t(n);e(r)})});this.modem.dial(s,function(e,t){i.callback(e,t)})},e.exports=i},384(e,t,n){var r=n(7052),i=function(e,t){this.modem=e,this.id=t};i.prototype[n(9023).inspect.custom]=function(){return this},i.prototype.inspect=function(e,t){var n=this,i=r.processArgs(e,t);e={path:"/networks/"+this.id+"?",method:"GET",statusCodes:{200:!0,404:"no such network",500:"server error"},options:i.opts};if(void 0===i.callback)return new this.modem.Promise(function(t,r){n.modem.dial(e,function(e,n){if(e)return r(e);t(n)})});this.modem.dial(e,function(e,t){i.callback(e,t)})},i.prototype.remove=function(e,t){var n=this,i=r.processArgs(e,t),s={path:"/networks/"+this.id,method:"DELETE",abortSignal:i.opts.abortSignal,statusCodes:{200:!0,204:!0,404:"no such network",409:"conflict",500:"server error"},options:i.opts};if(void 0===i.callback)return new this.modem.Promise(function(e,t){n.modem.dial(s,function(n,r){if(n)return t(n);e(r)})});this.modem.dial(s,function(e,t){i.callback(e,t)})},i.prototype.connect=function(e,t){var n=this,i=r.processArgs(e,t),s={path:"/networks/"+this.id+"/connect",method:"POST",abortSignal:i.opts.abortSignal,statusCodes:{200:!0,201:!0,404:"network or container is not found",500:"server error"},options:i.opts};if(void 0===i.callback)return new this.modem.Promise(function(e,t){n.modem.dial(s,function(n,r){if(n)return t(n);e(r)})});this.modem.dial(s,function(e,t){i.callback(e,t)})},i.prototype.disconnect=function(e,t){var n=this,i=r.processArgs(e,t),s={path:"/networks/"+this.id+"/disconnect",method:"POST",abortSignal:i.opts.abortSignal,statusCodes:{200:!0,201:!0,404:"network or container is not found",500:"server error"},options:i.opts};if(void 0===i.callback)return new this.modem.Promise(function(e,t){n.modem.dial(s,function(n,r){if(n)return t(n);e(r)})});this.modem.dial(s,function(e,t){i.callback(e,t)})},e.exports=i},4024(e,t,n){var r=n(7052),i=function(e,t){this.modem=e,this.id=t};i.prototype[n(9023).inspect.custom]=function(){return this},i.prototype.inspect=function(e,t){var n=this,i=r.processArgs(e,t),s={path:"/nodes/"+this.id,method:"GET",abortSignal:i.opts.abortSignal,statusCodes:{200:!0,404:"no such node",500:"server error"}};if(void 0===i.callback)return new this.modem.Promise(function(e,t){n.modem.dial(s,function(n,r){if(n)return t(n);e(r)})});this.modem.dial(s,function(e,t){i.callback(e,t)})},i.prototype.update=function(e,t){var n=this;t||"function"!=typeof e||(t=e);var r={path:"/nodes/"+this.id+"/update?",method:"POST",abortSignal:e&&e.abortSignal,statusCodes:{200:!0,404:"no such node",406:"node is not part of a swarm",500:"server error"},options:e};if(void 0===t)return new this.modem.Promise(function(e,t){n.modem.dial(r,function(n,r){if(n)return t(n);e(r)})});this.modem.dial(r,function(e,n){t(e,n)})},i.prototype.remove=function(e,t){var n=this,i=r.processArgs(e,t),s={path:"/nodes/"+this.id+"?",method:"DELETE",abortSignal:i.opts.abortSignal,statusCodes:{200:!0,404:"no such node",500:"server error"},options:i.opts};if(void 0===i.callback)return new this.modem.Promise(function(e,t){n.modem.dial(s,function(n,r){if(n)return t(n);e(r)})});this.modem.dial(s,function(e,t){i.callback(e,t)})},e.exports=i},3303(e,t,n){var r=n(7052),i=function(e,t,n){this.modem=e,this.name=t,this.remote=n||t};i.prototype[n(9023).inspect.custom]=function(){return this},i.prototype.inspect=function(e,t){var n=this,i=r.processArgs(e,t),s={path:"/plugins/"+this.name+"/json",method:"GET",abortSignal:i.opts.abortSignal,statusCodes:{200:!0,404:"plugin is not installed",500:"server error"}};if(void 0===i.callback)return new this.modem.Promise(function(e,t){n.modem.dial(s,function(n,r){if(n)return t(n);e(r)})});this.modem.dial(s,function(e,t){i.callback(e,t)})},i.prototype.remove=function(e,t){var n=this,i=r.processArgs(e,t),s={path:"/plugins/"+this.name+"?",method:"DELETE",abortSignal:i.opts.abortSignal,statusCodes:{200:!0,404:"plugin is not installed",500:"server error"},options:i.opts};if(void 0===i.callback)return new this.modem.Promise(function(e,t){n.modem.dial(s,function(n,r){if(n)return t(n);e(r)})});this.modem.dial(s,function(e,t){if(e)return i.callback(e,t);i.callback(e,t)})},i.prototype.privileges=function(e,t){var n=this,i=r.processArgs(e,t),s={path:"/plugins/privileges?",method:"GET",options:{remote:this.remote},abortSignal:i.opts.abortSignal,statusCodes:{200:!0,500:"server error"}};if(void 0===i.callback)return new this.modem.Promise(function(e,t){n.modem.dial(s,function(n,r){if(n)return t(n);e(r)})});this.modem.dial(s,function(e,t){i.callback(e,t)})},i.prototype.pull=function(e,t){var n=this,i=r.processArgs(e,t);i.opts._query&&!i.opts._query.name&&(i.opts._query.name=this.name),i.opts._query&&!i.opts._query.remote&&(i.opts._query.remote=this.remote);var s={path:"/plugins/pull?",method:"POST",abortSignal:i.opts.abortSignal,isStream:!0,options:i.opts,statusCodes:{200:!0,204:!0,500:"server error"}};if(void 0===i.callback)return new this.modem.Promise(function(e,t){n.modem.dial(s,function(n,r){if(n)return t(n);e(r)})});this.modem.dial(s,function(e,t){i.callback(e,t)})},i.prototype.enable=function(e,t){var n=this,i=r.processArgs(e,t),s={path:"/plugins/"+this.name+"/enable?",method:"POST",abortSignal:i.opts.abortSignal,statusCodes:{200:!0,500:"server error"},options:i.opts};if(void 0===i.callback)return new this.modem.Promise(function(e,t){n.modem.dial(s,function(n,r){if(n)return t(n);e(r)})});this.modem.dial(s,function(e,t){i.callback(e,t)})},i.prototype.disable=function(e,t){var n=this,i=r.processArgs(e,t),s={path:"/plugins/"+this.name+"/disable",method:"POST",abortSignal:i.opts.abortSignal,statusCodes:{200:!0,500:"server error"},options:i.opts};if(void 0===i.callback)return new this.modem.Promise(function(e,t){n.modem.dial(s,function(n,r){if(n)return t(n);e(r)})});this.modem.dial(s,function(e,t){i.callback(e,t)})},i.prototype.push=function(e,t){var n=this,i=r.processArgs(e,t),s={path:"/plugins/"+this.name+"/push",method:"POST",abortSignal:i.opts.abortSignal,statusCodes:{200:!0,404:"plugin not installed",500:"server error"},options:i.opts};if(void 0===i.callback)return new this.modem.Promise(function(e,t){n.modem.dial(s,function(n,r){if(n)return t(n);e(r)})});this.modem.dial(s,function(e,t){i.callback(e,t)})},i.prototype.configure=function(e,t){var n=this,i=r.processArgs(e,t),s={path:"/plugins/"+this.name+"/set",method:"POST",abortSignal:i.opts.abortSignal,statusCodes:{200:!0,204:!0,404:"plugin not installed",500:"server error"},options:i.opts};if(void 0===i.callback)return new this.modem.Promise(function(e,t){n.modem.dial(s,function(n,r){if(n)return t(n);e(r)})});this.modem.dial(s,function(e,t){i.callback(e,t)})},i.prototype.upgrade=function(e,t,n){var r=this;n||"function"!=typeof t||(n=t,e=(t=e).authconfig||void 0);var i={path:"/plugins/"+this.name+"/upgrade?",method:"POST",abortSignal:t&&t.abortSignal,statusCodes:{200:!0,204:!0,404:"plugin not installed",500:"server error"},authconfig:e,options:t};if(void 0===n)return new this.modem.Promise(function(e,t){r.modem.dial(i,function(n,r){if(n)return t(n);e(r)})});this.modem.dial(i,function(e,t){n(e,t)})},e.exports=i},9360(e,t,n){var r=n(7052),i=function(e,t){this.modem=e,this.id=t};i.prototype[n(9023).inspect.custom]=function(){return this},i.prototype.inspect=function(e,t){var n=this,i=r.processArgs(e,t),s={path:"/secrets/"+this.id,method:"GET",abortSignal:i.opts.abortSignal,statusCodes:{200:!0,404:"secret not found",406:"node is not part of a swarm",500:"server error"}};if(void 0===i.callback)return new this.modem.Promise(function(e,t){n.modem.dial(s,function(n,r){if(n)return t(n);e(r)})});this.modem.dial(s,function(e,t){i.callback(e,t)})},i.prototype.update=function(e,t){var n=this;t||"function"!=typeof e||(t=e);var r={path:"/secrets/"+this.id+"/update?",method:"POST",abortSignal:e&&e.abortSignal,statusCodes:{200:!0,404:"secret not found",500:"server error"},options:e};if(void 0===t)return new this.modem.Promise(function(e,t){n.modem.dial(r,function(n,r){if(n)return t(n);e(r)})});this.modem.dial(r,function(e,n){t(e,n)})},i.prototype.remove=function(e,t){var n=this,i=r.processArgs(e,t),s={path:"/secrets/"+this.id,method:"DELETE",abortSignal:i.opts.abortSignal,statusCodes:{200:!0,204:!0,404:"secret not found",500:"server error"},options:i.opts};if(void 0===i.callback)return new this.modem.Promise(function(e,t){n.modem.dial(s,function(n,r){if(n)return t(n);e(r)})});this.modem.dial(s,function(e,t){i.callback(e,t)})},e.exports=i},3569(e,t,n){var r=n(7052),i=function(e,t){this.modem=e,this.id=t};i.prototype[n(9023).inspect.custom]=function(){return this},i.prototype.inspect=function(e,t){var n=this,i=r.processArgs(e,t),s={path:"/services/"+this.id,method:"GET",abortSignal:i.opts.abortSignal,statusCodes:{200:!0,404:"no such service",500:"server error"}};if(void 0===i.callback)return new this.modem.Promise(function(e,t){n.modem.dial(s,function(n,r){if(n)return t(n);e(r)})});this.modem.dial(s,function(e,t){i.callback(e,t)})},i.prototype.remove=function(e,t){var n=this,i=r.processArgs(e,t),s={path:"/services/"+this.id,method:"DELETE",abortSignal:i.opts.abortSignal,statusCodes:{200:!0,204:!0,404:"no such service",500:"server error"}};if(void 0===i.callback)return new this.modem.Promise(function(e,t){n.modem.dial(s,function(n,r){if(n)return t(n);e(r)})});this.modem.dial(s,function(e,t){i.callback(e,t)})},i.prototype.update=function(e,t,n){var r=this;if(!n){var i=typeof t;"function"===i?(n=t,e=(t=e).authconfig||void 0):"undefined"===i&&(e=(t=e).authconfig||void 0)}var s={path:"/services/"+this.id+"/update?",method:"POST",abortSignal:t&&t.abortSignal,statusCodes:{200:!0,404:"no such service",500:"server error"},authconfig:e,options:t};if(void 0===n)return new this.modem.Promise(function(e,t){r.modem.dial(s,function(n,r){if(n)return t(n);e(r)})});this.modem.dial(s,function(e,t){n(e,t)})},i.prototype.logs=function(e,t){var n=this,i=r.processArgs(e,t,{}),s={path:"/services/"+this.id+"/logs?",method:"GET",abortSignal:i.opts.abortSignal,isStream:i.opts.follow||!1,statusCodes:{200:!0,404:"no such service",500:"server error",503:"node is not part of a swarm"},options:i.opts};if(void 0===i.callback)return new this.modem.Promise(function(e,t){n.modem.dial(s,function(n,r){if(n)return t(n);e(r)})});this.modem.dial(s,function(e,t){i.callback(e,t)})},e.exports=i},7054(e,t,n){var r=n(674),i=n(6340),s=n(6928),o=n(4679).v4;e.exports=function(e,t,n){const a=o(),c={method:"POST",path:"/session",hijack:!0,headers:{Upgrade:"h2c","X-Docker-Expose-Session-Uuid":a,"X-Docker-Expose-Session-Name":"testcontainers"},statusCodes:{200:!0,500:"server error"}};e.modem.dial(c,function(e,o){if(e)return n(e,null,()=>{});const c=new r.Server,l=r.ServerCredentials.createInsecure();c.createConnectionInjector(l).injectConnection(o);const h=i.loadSync(s.resolve(__dirname,"proto","auth.proto")),u=r.loadPackageDefinition(h);c.addService(u.moby.filesync.v1.Auth.service,{Credentials({request:e},n){n(null,t?{Username:t.username,Secret:t.password}:{})}}),n(null,a,function(){c.forceShutdown(),o.end()})})}},5517(e,t,n){var r=n(7052),i=function(e,t){this.modem=e,this.id=t,this.defaultOptions={log:{}}};i.prototype[n(9023).inspect.custom]=function(){return this},i.prototype.inspect=function(e,t){var n=this,i=r.processArgs(e,t),s={path:"/tasks/"+this.id,method:"GET",abortSignal:i.opts.abortSignal,statusCodes:{200:!0,404:"unknown task",500:"server error"}};if(void 0===i.callback)return new this.modem.Promise(function(e,t){n.modem.dial(s,function(n,r){if(n)return t(n);e(r)})});this.modem.dial(s,function(e,t){i.callback(e,t)})},i.prototype.logs=function(e,t){var n=this,i=r.processArgs(e,t,this.defaultOptions.log),s={path:"/tasks/"+this.id+"/logs?",method:"GET",abortSignal:i.opts.abortSignal,isStream:i.opts.follow||!1,statusCodes:{101:!0,200:!0,404:"no such container",500:"server error",503:"node is not part of a swarm"},options:i.opts};if(void 0===i.callback)return new this.modem.Promise(function(e,t){n.modem.dial(s,function(n,r){if(n)return t(n);e(r)})});this.modem.dial(s,function(e,t){i.callback(e,t)})},e.exports=i},7052(e,t,n){var r=n(3065),i=n(9896),s=n(6928),o=n(6868),a=n(3106),c=[],l=c.forEach,h=c.slice;e.exports.extend=function(e){return l.call(h.call(arguments,1),function(t){if(t)for(var n in t)e[n]=t[n]}),e},e.exports.processArgs=function(t,n,r){return n||"function"!=typeof t||(n=t,t=null),{callback:n,opts:e.exports.extend({},r,t)}},e.exports.parseRepositoryTag=function(e){var t,n=e.indexOf("@"),r=e.lastIndexOf(":");if(n>=0)t=n;else{if(!(r>=0))return{repository:e};t=r}var i=e.slice(t+1);return-1===i.indexOf("/")?{repository:e.slice(0,t),tag:i}:{repository:e}},e.exports.prepareBuildContext=function(e,t){e&&e.context?i.readFile(s.join(e.context,".dockerignore"),(n,i)=>{let s,c;if(!n){const e=r({ignorecase:!1}).add(i.toString());c=e.createFilter(),s=e=>!c(e)}const l=e.src.slice()||[],h=o.pack(e.context,{entries:c?l.filter(c):l,ignore:s});t(h.pipe(a.createGzip()))}):t(e)}},4974(e,t,n){var r=n(7052),i=function(e,t){this.modem=e,this.name=t};i.prototype[n(9023).inspect.custom]=function(){return this},i.prototype.inspect=function(e,t){var n=this,i=r.processArgs(e,t),s={path:"/volumes/"+this.name,method:"GET",abortSignal:i.opts.abortSignal,statusCodes:{200:!0,404:"no such volume",500:"server error"}};if(void 0===i.callback)return new this.modem.Promise(function(e,t){n.modem.dial(s,function(n,r){if(n)return t(n);e(r)})});this.modem.dial(s,function(e,t){i.callback(e,t)})},i.prototype.remove=function(e,t){var n=this,i=r.processArgs(e,t),s={path:"/volumes/"+this.name,method:"DELETE",abortSignal:i.opts.abortSignal,statusCodes:{204:!0,404:"no such volume",409:"conflict",500:"server error"},options:i.opts};if(void 0===i.callback)return new this.modem.Promise(function(e,t){n.modem.dial(s,function(n,r){if(n)return t(n);e(r)})});this.modem.dial(s,function(e,t){i.callback(e,t)})},e.exports=i},3810(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.EventEmitter2=void 0;var n=function(){function e(){this._listeners=[]}return Object.defineProperty(e.prototype,"event",{get:function(){var e=this;return this._event||(this._event=function(t){return e._listeners.push(t),{dispose:function(){for(var n=0;n<e._listeners.length;n++)if(e._listeners[n]===t)return void e._listeners.splice(n,1)}}}),this._event},enumerable:!1,configurable:!0}),e.prototype.fire=function(e){for(var t=[],n=0;n<this._listeners.length;n++)t.push(this._listeners[n]);for(n=0;n<t.length;n++)t[n].call(void 0,e)},e}();t.EventEmitter2=n},6194(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.native=t.open=t.createTerminal=t.fork=t.spawn=void 0;var r;r="win32"===process.platform?n(1239).WindowsTerminal:n(3546).UnixTerminal,t.spawn=function(e,t,n){return new r(e,t,n)},t.fork=function(e,t,n){return new r(e,t,n)},t.createTerminal=function(e,t,n){return new r(e,t,n)},t.open=function(e){return r.open(e)},t.native="win32"!==process.platform?n(5053):null},9964(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.getWorkerPipeName=void 0,t.getWorkerPipeName=function(e){return e+"-worker"}},3220(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Terminal=t.DEFAULT_ROWS=t.DEFAULT_COLS=void 0;var r=n(4434),i=n(3810);t.DEFAULT_COLS=80,t.DEFAULT_ROWS=24;var s=function(){function e(e){this._pid=0,this._fd=0,this._cols=0,this._rows=0,this._readable=!1,this._writable=!1,this._onData=new i.EventEmitter2,this._onExit=new i.EventEmitter2,this._internalee=new r.EventEmitter,this.handleFlowControl=!!(null==e?void 0:e.handleFlowControl),this._flowControlPause=(null==e?void 0:e.flowControlPause)||"",this._flowControlResume=(null==e?void 0:e.flowControlResume)||"",e&&(this._checkType("name",e.name?e.name:void 0,"string"),this._checkType("cols",e.cols?e.cols:void 0,"number"),this._checkType("rows",e.rows?e.rows:void 0,"number"),this._checkType("cwd",e.cwd?e.cwd:void 0,"string"),this._checkType("env",e.env?e.env:void 0,"object"),this._checkType("uid",e.uid?e.uid:void 0,"number"),this._checkType("gid",e.gid?e.gid:void 0,"number"),this._checkType("encoding",e.encoding?e.encoding:void 0,"string"))}return Object.defineProperty(e.prototype,"onData",{get:function(){return this._onData.event},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"onExit",{get:function(){return this._onExit.event},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"pid",{get:function(){return this._pid},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"cols",{get:function(){return this._cols},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"rows",{get:function(){return this._rows},enumerable:!1,configurable:!0}),e.prototype.write=function(e){if(this.handleFlowControl){if(e===this._flowControlPause)return void this.pause();if(e===this._flowControlResume)return void this.resume()}this._write(e)},e.prototype._forwardEvents=function(){var e=this;this.on("data",function(t){return e._onData.fire(t)}),this.on("exit",function(t,n){return e._onExit.fire({exitCode:t,signal:n})})},e.prototype._checkType=function(e,t,n,r){if(void 0===r&&(r=!1),void 0!==t)if(r&&Array.isArray(t))t.forEach(function(t,r){if(typeof t!==n)throw new Error(e+"["+r+"] must be a "+n+" (not a "+typeof t[r]+")")});else if(typeof t!==n)throw new Error(e+" must be a "+n+" (not a "+typeof t+")")},e.prototype.end=function(e){this._socket.end(e)},e.prototype.pipe=function(e,t){return this._socket.pipe(e,t)},e.prototype.pause=function(){return this._socket.pause()},e.prototype.resume=function(){return this._socket.resume()},e.prototype.setEncoding=function(e){this._socket._decoder&&delete this._socket._decoder,e&&this._socket.setEncoding(e)},e.prototype.addListener=function(e,t){this.on(e,t)},e.prototype.on=function(e,t){"close"!==e?this._socket.on(e,t):this._internalee.on("close",t)},e.prototype.emit=function(e){for(var t=[],n=1;n<arguments.length;n++)t[n-1]=arguments[n];return"close"===e?this._internalee.emit.apply(this._internalee,arguments):this._socket.emit.apply(this._socket,arguments)},e.prototype.listeners=function(e){return this._socket.listeners(e)},e.prototype.removeListener=function(e,t){this._socket.removeListener(e,t)},e.prototype.removeAllListeners=function(e){this._socket.removeAllListeners(e)},e.prototype.once=function(e,t){this._socket.once(e,t)},e.prototype._close=function(){this._socket.readable=!1,this.write=function(){},this.end=function(){},this._writable=!1,this._readable=!1},e.prototype._parseEnv=function(e){for(var t=Object.keys(e||{}),n=[],r=0;r<t.length;r++)void 0!==t[r]&&n.push(t[r]+"="+e[t[r]]);return n},e}();t.Terminal=s},3546(e,t,n){"use strict";var r,i=this&&this.__extends||(r=function(e,t){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])},r(e,t)},function(e,t){function n(){this.constructor=e}r(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)});Object.defineProperty(t,"__esModule",{value:!0}),t.UnixTerminal=void 0;var s,o,a=n(6928),c=n(2018),l=n(3220),h=n(9779);try{s=n(5053),o="../build/Release/spawn-helper"}catch(e){try{s=n(Object(function(){var e=new Error("Cannot find module '../build/Debug/pty.node'");throw e.code="MODULE_NOT_FOUND",e}())),o="../build/Debug/spawn-helper"}catch(t){throw console.error("innerError",t),e}}o=(o=(o=a.resolve(__dirname,o)).replace("app.asar","app.asar.unpacked")).replace("node_modules.asar","node_modules.asar.unpacked");var u=function(e){function t(t,n,r){var i,a,u=e.call(this,r)||this;if(u._boundClose=!1,u._emittedClose=!1,"string"==typeof n)throw new Error("args as a string is not supported on unix.");n=n||[],t=t||"sh",(r=r||{}).env=r.env||process.env,u._cols=r.cols||l.DEFAULT_COLS,u._rows=r.rows||l.DEFAULT_ROWS;var d=null!==(i=r.uid)&&void 0!==i?i:-1,f=null!==(a=r.gid)&&void 0!==a?a:-1,p=h.assign({},r.env);r.env===process.env&&u._sanitizeEnv(p);var g=r.cwd||process.cwd();p.PWD=g;var m=r.name||p.TERM||"xterm";p.TERM=m;var _=u._parseEnv(p),y=void 0===r.encoding?"utf8":r.encoding,v=s.fork(t,n,_,g,u._cols,u._rows,d,f,"utf8"===y,o,function(e,t){if(u._emittedClose)u.emit("exit",e,t);else{if(u._boundClose)return;u._boundClose=!0;var n=setTimeout(function(){n=null,u._socket.destroy()},200);u.once("close",function(){null!==n&&clearTimeout(n),u.emit("exit",e,t)})}});return u._socket=new c.ReadStream(v.fd),null!==y&&u._socket.setEncoding(y),u._socket.on("error",function(e){if(!(e.code&&~e.code.indexOf("EAGAIN")||(u._close(),u._emittedClose||(u._emittedClose=!0,u.emit("close")),e.code&&(~e.code.indexOf("errno 5")||~e.code.indexOf("EIO"))||!(u.listeners("error").length<2))))throw e}),u._pid=v.pid,u._fd=v.fd,u._pty=v.pty,u._file=t,u._name=m,u._readable=!0,u._writable=!0,u._socket.on("close",function(){u._emittedClose||(u._emittedClose=!0,u._close(),u.emit("close"))}),u._forwardEvents(),u}return i(t,e),Object.defineProperty(t.prototype,"master",{get:function(){return this._master},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"slave",{get:function(){return this._slave},enumerable:!1,configurable:!0}),t.prototype._write=function(e){this._socket.write(e)},Object.defineProperty(t.prototype,"fd",{get:function(){return this._fd},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"ptsName",{get:function(){return this._pty},enumerable:!1,configurable:!0}),t.open=function(e){var n=Object.create(t.prototype);e=e||{},arguments.length>1&&(e={cols:arguments[1],rows:arguments[2]});var r=e.cols||l.DEFAULT_COLS,i=e.rows||l.DEFAULT_ROWS,o=void 0===e.encoding?"utf8":e.encoding,a=s.open(r,i);return n._master=new c.ReadStream(a.master),null!==o&&n._master.setEncoding(o),n._master.resume(),n._slave=new c.ReadStream(a.slave),null!==o&&n._slave.setEncoding(o),n._slave.resume(),n._socket=n._master,n._pid=-1,n._fd=a.master,n._pty=a.pty,n._file=process.argv[0]||"node",n._name=process.env.TERM||"",n._readable=!0,n._writable=!0,n._socket.on("error",function(e){if(n._close(),n.listeners("error").length<2)throw e}),n._socket.on("close",function(){n._close()}),n},t.prototype.destroy=function(){var e=this;this._close(),this._socket.once("close",function(){e.kill("SIGHUP")}),this._socket.destroy()},t.prototype.kill=function(e){try{process.kill(this.pid,e||"SIGHUP")}catch(e){}},Object.defineProperty(t.prototype,"process",{get:function(){if("darwin"===process.platform){var e=s.process(this._fd);return"kernel_task"!==e?e:this._file}return s.process(this._fd,this._pty)||this._file},enumerable:!1,configurable:!0}),t.prototype.resize=function(e,t){if(e<=0||t<=0||isNaN(e)||isNaN(t)||e===1/0||t===1/0)throw new Error("resizing must be done using positive cols and rows");s.resize(this._fd,e,t),this._cols=e,this._rows=t},t.prototype.clear=function(){},t.prototype._sanitizeEnv=function(e){delete e.TMUX,delete e.TMUX_PANE,delete e.STY,delete e.WINDOW,delete e.WINDOWID,delete e.TERMCAP,delete e.COLUMNS,delete e.LINES},t}(l.Terminal);t.UnixTerminal=u},9779(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.assign=void 0,t.assign=function(e){for(var t=[],n=1;n<arguments.length;n++)t[n-1]=arguments[n];return t.forEach(function(t){return Object.keys(t).forEach(function(n){return e[n]=t[n]})}),e}},8535(e,t,n){"use strict";var r=this&&this.__awaiter||function(e,t,n,r){return new(n||(n=Promise))(function(i,s){function o(e){try{c(r.next(e))}catch(e){s(e)}}function a(e){try{c(r.throw(e))}catch(e){s(e)}}function c(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n(function(e){e(t)})).then(o,a)}c((r=r.apply(e,t||[])).next())})},i=this&&this.__generator||function(e,t){var n,r,i,s,o={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return s={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(s[Symbol.iterator]=function(){return this}),s;function a(s){return function(a){return function(s){if(n)throw new TypeError("Generator is already executing.");for(;o;)try{if(n=1,r&&(i=2&s[0]?r.return:s[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,s[1])).done)return i;switch(r=0,i&&(s=[2&s[0],i.value]),s[0]){case 0:case 1:i=s;break;case 4:return o.label++,{value:s[1],done:!1};case 5:o.label++,r=s[1],s=[0];continue;case 7:s=o.ops.pop(),o.trys.pop();continue;default:if(!(i=o.trys,(i=i.length>0&&i[i.length-1])||6!==s[0]&&2!==s[0])){o=0;continue}if(3===s[0]&&(!i||s[1]>i[0]&&s[1]<i[3])){o.label=s[1];break}if(6===s[0]&&o.label<i[1]){o.label=i[1],i=s;break}if(i&&o.label<i[2]){o.label=i[2],o.ops.push(s);break}i[2]&&o.ops.pop(),o.trys.pop();continue}s=t.call(e,o)}catch(e){s=[6,e],r=0}finally{n=i=0}if(5&s[0])throw s[1];return{value:s[0]?s[1]:void 0,done:!0}}([s,a])}}};Object.defineProperty(t,"__esModule",{value:!0}),t.ConoutConnection=void 0;var s=n(8167),o=n(9964),a=n(3810),c=function(){function e(e){var t=this;this._conoutPipeName=e,this._isDisposed=!1,this._onReady=new a.EventEmitter2;var n={conoutPipeName:e};this._worker=new s.Worker('\n"use strict";\n/**\n * Copyright (c) 2020, Microsoft Corporation (MIT License).\n */\nObject.defineProperty(exports, "__esModule", { value: true });\nvar worker_threads_1 = require("worker_threads");\nvar net_1 = require("net");\nvar conoutPipeName = worker_threads_1.workerData.conoutPipeName;\nvar conoutSocket = new net_1.Socket();\nconoutSocket.setEncoding(\'utf8\');\nconoutSocket.connect(conoutPipeName, function () {\n var server = net_1.createServer(function (workerSocket) {\n conoutSocket.pipe(workerSocket);\n });\n server.listen(conoutPipeName + "-worker");\n if (!worker_threads_1.parentPort) {\n throw new Error(\'worker_threads parentPort is null\');\n }\n worker_threads_1.parentPort.postMessage(1);\n});\n//# sourceMappingURL=conoutSocketWorker.js.map\n',{workerData:n,eval:!0}),this._worker.on("message",function(e){1!==e?console.warn("Unexpected ConoutWorkerMessage",e):t._onReady.fire()})}return Object.defineProperty(e.prototype,"onReady",{get:function(){return this._onReady.event},enumerable:!1,configurable:!0}),e.prototype.dispose=function(){this._isDisposed||(this._isDisposed=!0,this._drainDataAndClose())},e.prototype.connectSocket=function(e){e.connect(o.getWorkerPipeName(this._conoutPipeName))},e.prototype._drainDataAndClose=function(){var e=this;this._drainTimeout&&clearTimeout(this._drainTimeout),this._drainTimeout=setTimeout(function(){return e._destroySocket()},1e3)},e.prototype._destroySocket=function(){return r(this,void 0,void 0,function(){return i(this,function(e){switch(e.label){case 0:return[4,this._worker.terminate()];case 1:return e.sent(),[2]}})})},e}();t.ConoutConnection=c},2683(e,t,n){"use strict";var r=this&&this.__spreadArrays||function(){for(var e=0,t=0,n=arguments.length;t<n;t++)e+=arguments[t].length;var r=Array(e),i=0;for(t=0;t<n;t++)for(var s=arguments[t],o=0,a=s.length;o<a;o++,i++)r[i]=s[o];return r};Object.defineProperty(t,"__esModule",{value:!0}),t.argsToCommandLine=t.WindowsPtyAgent=void 0;var i,s,o=n(9896),a=n(857),c=n(6928),l=n(9278),h=n(8535),u=function(){function e(e,t,r,a,u,f,p,g,m,_,y){var v=this;if(void 0===m&&(m=!1),void 0===_&&(_=!1),void 0===y&&(y=""),this._useConpty=g,this._useConptyDll=m,this._pid=0,this._innerPid=0,void 0!==this._useConpty&&!0!==this._useConpty||(this._useConpty=this._getWindowsBuildNumber()>=18309),this._useConpty){if(!i)try{i=n(2545)}catch(e){try{i=n(Object(function(){var e=new Error("Cannot find module '../build/Debug/conpty.node'");throw e.code="MODULE_NOT_FOUND",e}()))}catch(t){throw console.error("innerError",t),e}}}else if(!s)try{s=n(5053)}catch(e){try{s=n(Object(function(){var e=new Error("Cannot find module '../build/Debug/pty.node'");throw e.code="MODULE_NOT_FOUND",e}()))}catch(t){throw console.error("innerError",t),e}}this._ptyNative=this._useConpty?i:s,a=c.resolve(a);var b,E=d(e,t);this._useConpty?b=this._ptyNative.startProcess(e,u,f,p,this._generatePipeName(),_,this._useConptyDll,y):(b=this._ptyNative.startProcess(e,E,r,a,u,f,p,y),this._pid=b.pid,this._innerPid=b.innerPid),this._fd=b.fd,this._pty=b.pty,this._outSocket=new l.Socket,this._outSocket.setEncoding("utf8"),this._conoutSocketWorker=new h.ConoutConnection(b.conout),this._conoutSocketWorker.onReady(function(){v._conoutSocketWorker.connectSocket(v._outSocket)}),this._outSocket.on("connect",function(){v._outSocket.emit("ready_datapipe")});var A=o.openSync(b.conin,"w");if(this._inSocket=new l.Socket({fd:A,readable:!1,writable:!0}),this._inSocket.setEncoding("utf8"),this._useConpty){var S=this._ptyNative.connect(this._pty,E,a,r,function(e){return v._$onProcessExit(e)});this._innerPid=S.pid}}return Object.defineProperty(e.prototype,"inSocket",{get:function(){return this._inSocket},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"outSocket",{get:function(){return this._outSocket},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"fd",{get:function(){return this._fd},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"innerPid",{get:function(){return this._innerPid},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"pty",{get:function(){return this._pty},enumerable:!1,configurable:!0}),e.prototype.resize=function(e,t,n){if(void 0===n&&(n=""),this._useConpty){if(void 0!==this._exitCode)throw new Error("Cannot resize a pty that has already exited");this._ptyNative.resize(this._pty,e,t,this._useConptyDll,n)}else this._ptyNative.resize(this._pid,e,t)},e.prototype.clear=function(e){void 0===e&&(e=""),this._useConpty&&this._ptyNative.clear(this._pty,this._useConptyDll,e)},e.prototype.kill=function(e){var t=this;if(void 0===e&&(e=""),this._inSocket.readable=!1,this._outSocket.readable=!1,this._useConpty)this._getConsoleProcessList().then(function(n){n.forEach(function(e){try{process.kill(e)}catch(e){}}),t._ptyNative.kill(t._pty,t._useConptyDll,e)});else{var n=this._ptyNative.getProcessList(this._pid);this._ptyNative.kill(this._pid,this._innerPid),n.forEach(function(e){try{process.kill(e)}catch(e){}})}this._conoutSocketWorker.dispose()},e.prototype._getConsoleProcessList=function(){var e=this;try{this.getConsoleProcessList||(this.getConsoleProcessList=n(8636).getConsoleProcessList)}catch(e){this.getConsoleProcessList=n(8955)("../build/Debug/conpty_console_list.node").getConsoleProcessList}return new Promise(function(t){e.getConsoleProcessList(e._innerPid).then(function(i){clearTimeout(n),t(r([e.innerPid],null!=i?i:[]))}).catch(function(n){console.error("Error:",n),t([e._innerPid])});var n=setTimeout(function(){t([e._innerPid])},5e3)})},Object.defineProperty(e.prototype,"exitCode",{get:function(){if(this._useConpty)return this._exitCode;var e=this._ptyNative.getExitCode(this._innerPid);return-1===e?void 0:e},enumerable:!1,configurable:!0}),e.prototype._getWindowsBuildNumber=function(){var e=/(\d+)\.(\d+)\.(\d+)/g.exec(a.release()),t=0;return e&&4===e.length&&(t=parseInt(e[3])),t},e.prototype._generatePipeName=function(){return"conpty-"+1e7*Math.random()},e.prototype._$onProcessExit=function(e){var t=this;this._exitCode=e,this._flushDataAndCleanUp(),this._outSocket.on("data",function(){return t._flushDataAndCleanUp()})},e.prototype._flushDataAndCleanUp=function(){var e=this;this._closeTimeout&&clearTimeout(this._closeTimeout),this._closeTimeout=setTimeout(function(){return e._cleanUpProcess()},1e3)},e.prototype._cleanUpProcess=function(){this._inSocket.readable=!1,this._outSocket.readable=!1,this._outSocket.destroy()},e}();function d(e,t){if(function(e){return"string"==typeof e}(t))return 0===t.length?e:d(e,[])+" "+t;var n=[e];Array.prototype.push.apply(n,t);for(var r="",i=0;i<n.length;i++){i>0&&(r+=" ");var s=n[i],o=p('"'!==s[0],'"'!==s[s.length-1]),a='"'!==s[0]&&'"'!==s[s.length-1],c=""===s||(-1!==s.indexOf(" ")||-1!==s.indexOf("\t"))&&s.length>1&&(o||a);c&&(r+='"');for(var l=0,h=0;h<s.length;h++){var u=s[h];"\\"===u?l++:'"'===u?(r+=f("\\",2*l+1),r+='"',l=0):(r+=f("\\",l),l=0,r+=u)}c?(r+=f("\\",2*l),r+='"'):r+=f("\\",l)}return r}function f(e,t){for(var n="",r=0;r<t;r++)n+=e;return n}function p(e,t){return e&&!t||!e&&t}t.WindowsPtyAgent=u,t.argsToCommandLine=d},1239(e,t,n){"use strict";var r,i=this&&this.__extends||(r=function(e,t){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])},r(e,t)},function(e,t){function n(){this.constructor=e}r(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)});Object.defineProperty(t,"__esModule",{value:!0}),t.WindowsTerminal=void 0;var s=n(3220),o=n(2683),a=n(9779),c=function(e){function t(t,n,r){var i,c=e.call(this,r)||this;c._checkType("args",n,"string",!0),n=n||[],t=t||"cmd.exe",(r=r||{}).env=r.env||process.env,r.encoding&&console.warn("Setting encoding on Windows is not supported");var l=a.assign({},r.env);c._cols=r.cols||s.DEFAULT_COLS,c._rows=r.rows||s.DEFAULT_ROWS;var h=r.cwd||process.cwd(),u=r.name||l.TERM||"Windows Shell",d=c._parseEnv(l);return c._isReady=!1,c._deferreds=[],c._agent=new o.WindowsPtyAgent(t,n,d,h,c._cols,c._rows,!1,r.useConpty,r.useConptyDll,r.conptyInheritCursor,null!==(i=r.exePath)&&void 0!==i?i:""),c._socket=c._agent.outSocket,c._pid=c._agent.innerPid,c._fd=c._agent.fd,c._pty=c._agent.pty,c._socket.on("ready_datapipe",function(){["connect","data","end","timeout","drain"].forEach(function(e){c._socket.on(e,function(){c._isReady||"data"!==e||(c._isReady=!0,c._deferreds.forEach(function(e){e.run()}),c._deferreds=[])})}),c._socket.on("error",function(e){if(c._close(),(!e.code||!~e.code.indexOf("errno 5")&&!~e.code.indexOf("EIO"))&&c.listeners("error").length<2)throw e}),c._socket.on("close",function(){c.emit("exit",c._agent.exitCode),c._close()})}),c._file=t,c._name=u,c._readable=!0,c._writable=!0,c._forwardEvents(),c}return i(t,e),t.prototype._write=function(e){this._defer(this._doWrite,e)},t.prototype._doWrite=function(e){this._agent.inSocket.write(e)},t.open=function(e){throw new Error("open() not supported on windows, use Fork() instead.")},t.prototype.resize=function(e,t,n){var r=this;if(void 0===n&&(n=""),e<=0||t<=0||isNaN(e)||isNaN(t)||e===1/0||t===1/0)throw new Error("resizing must be done using positive cols and rows");this._deferNoArgs(function(){r._agent.resize(e,t,null!=n?n:""),r._cols=e,r._rows=t})},t.prototype.clear=function(e){var t=this;void 0===e&&(e=""),this._deferNoArgs(function(){t._agent.clear(e)})},t.prototype.destroy=function(e){var t=this;void 0===e&&(e=""),this._deferNoArgs(function(){t.kill(e)})},t.prototype.kill=function(e,t){var n=this;void 0===t&&(t=""),this._deferNoArgs(function(){if(e)throw new Error("Signals not supported on windows.");n._close(),n._agent.kill(t)})},t.prototype._deferNoArgs=function(e){var t=this;this._isReady?e.call(this):this._deferreds.push({run:function(){return e.call(t)}})},t.prototype._defer=function(e,t){var n=this;this._isReady?e.call(this,t):this._deferreds.push({run:function(){return e.call(n,t)}})},Object.defineProperty(t.prototype,"process",{get:function(){return this._name},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"master",{get:function(){throw new Error("master is not supported on Windows")},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"slave",{get:function(){throw new Error("slave is not supported on Windows")},enumerable:!1,configurable:!0}),t}(s.Terminal);t.WindowsTerminal=c},8955(e){function t(e){var t=new Error("Cannot find module '"+e+"'");throw t.code="MODULE_NOT_FOUND",t}t.keys=()=>[],t.resolve=t,t.id=8955,e.exports=t},3032(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.MacTun=t.Wintun=t.LinuxTunTap=t.LinuxTun=t.LinuxTap=void 0;const r=n(1060),i=n(5031),s=n(8861);class o extends r.Tuntap{constructor(){super("tun")}set mac(e){throw new Error("method not support by a tun device.")}}t.LinuxTun=o;class a extends r.Tuntap{constructor(){super("tap")}}t.LinuxTap=a;t.LinuxTunTap=function(e){if(e.name)throw"setting a name of a tuntap device is not supported";if("tun"!=e.type&&"tap"!=e.type)throw`illegal type ${e.type}`;const t=new r.Tuntap(e.type);e.mtu&&(t.mtu=e.mtu);let n=32;if(e.mask){const t=e.mask.split(".");if(4!=t.length)throw"illegal net mask!";n=0,t.forEach(e=>{let t=255&parseInt(e),r=!1;for(let e=0;e<8;e++){if(1&t)r=!0,n++;else if(1==r)throw"illegal netmask";t>>=1}})}if(e.addr){let r=[e.addr,n].join("/");t.ipv4=r}return e.up&&(t.isUp=!0),t};const c=i.default;t.Wintun=c;const l=s.default;t.MacTun=l},1060(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Tuntap=void 0;const r=n(6629);class i extends r.TuntapBase{get writableHighWaterMark(){return this.writeStream.writableHighWaterMark}get writableLength(){return this.writeStream.writableLength}get writableObjectMode(){return this.writeStream.writableObjectMode}get writableCorked(){return this.writeStream.writableCorked}get allowHalfOpen(){return!1}_write(e,t,n){return this.writeStream._write(e,t,n)}_writev(e,t){throw new Error("Method not implemented.")}_destroy(e,t){this.readStream.once("close",t),this.release()}_final(e){this.writeStream._final(e)}write(e,t,n){return this.writeStream.write(e,n)}setDefaultEncoding(e){throw new Error("Method is not allowed.")}end(e,t,n){return this.writeStream.end(e,n),this}cork(){this.writeStream.cork()}uncork(){this.writeStream.uncork()}get readableAborted(){return this.readStream.readableAborted}get readable(){return this.readStream.readable}get readableDidRead(){return this.readStream.readableDidRead}get readableEncoding(){return this.readStream.readableEncoding}get readableEnded(){return this.readStream.readableEnded}get readableFlowing(){return this.readStream.readableFlowing}get readableHighWaterMark(){return this.readStream.readableHighWaterMark}get readableLength(){return this.readStream.readableLength}get readableObjectMode(){return this.readStream.readableObjectMode}get destroyed(){return this.readStream.destroyed}_read(e){return this.readStream._read(e)}read(...e){return this.readStream.read(...e)}setEncoding(e){throw new Error("Method is not allowed.")}pause(){return this.readStream.pause(),this}resume(){return this.readStream.resume(),this}isPaused(){return this.readStream.isPaused()}unpipe(e){return this.readStream.unpipe(e),this}unshift(e,t){this.readStream.unshift(e)}wrap(e){return this.readStream.wrap(e),this}push(e,t){return this.readStream.push(e)}destroy(e){return this.release(),this}addListener(e,t){return this.readStream.addListener(e,t),this}emit(e,t,...n){return this.readStream.emit(e,t,...n)}on(e,t){return this.readStream.on(e,t),this}once(e,t){return this.readStream.once(e,t),this}prependListener(e,t){return this.readStream.prependListener(e,t),this}prependOnceListener(e,t){return this.readStream.prependOnceListener(e,t),this}removeListener(e,t){return this.readStream.removeListener(e,t),this}[Symbol.asyncIterator](){throw new Error("Method not implemented.")}pipe(e,t){return this.readStream.pipe(e,t)}off(e,t){return this.writeStream.off(e,t),this.readStream.off(e,t),this}removeAllListeners(e){return this.readStream.removeAllListeners(e),this}setMaxListeners(e){return this.readStream.setMaxListeners(e),this}getMaxListeners(){return this.readStream.getMaxListeners()}listeners(e){return[...this.readStream.listeners(e)]}rawListeners(e){return[...this.readStream.rawListeners(e)]}listenerCount(e){return this.readStream.listenerCount(e)}eventNames(){return this.readStream.eventNames()}get writable(){return this.writeStream.writable}get writableEnded(){return this.writeStream.writableEnded}get writableFinished(){return this.writeStream.writableFinished}}t.Tuntap=i},3016(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const r="win32"!==n(857).platform()?n(6789):void 0;t.default=r},6629(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.TuntapBase=void 0;const r=n(3016),i=n(9896),s=n(857),o=n(7533);t.TuntapBase=class{constructor(e){this._isUp=!1,this._deviceMode=e;const t=i.openSync("/dev/net/tun","r+");this._fd=t,this._ifName=r.default.tuntapInit(this._fd,"tap"==e),this.readStream=i.createReadStream("",{fd:this._fd,autoClose:!0,emitClose:!0}),this.writeStream=i.createWriteStream("",{fd:this._fd,autoClose:!0,emitClose:!0,fs:{write:i.write,open:()=>t,close:(e,t)=>{t()}}});["drain","error","finish","pipe","ready","unpipe","close","open"].forEach(e=>{this.writeStream.addListener(e,(...t)=>{this.readStream.emit(e,...t)})})}release(e){this.writeStream.close(()=>{this.readStream.close(t=>{e&&e()})})}makeSureIsUp(){if(!this.isUp)throw"you must set isUp = true in order to access this method"}get name(){return this._ifName}get isTap(){return"tap"==this._deviceMode}get isTun(){return!this.isTap}get isUp(){return this._isUp}set isUp(e){e?r.default.tuntapSetUp(this._ifName):r.default.tuntapSetDown(this._ifName),this._isUp=e}get mac(){this.makeSureIsUp();const e=s.networkInterfaces();return o.search(e,`${this._ifName}[*].[mac]|[0]`)}set mac(e){r.default.tuntapSetMac(this._ifName,e)}get mtu(){return r.default.tuntapGetMtu(this._ifName)}set mtu(e){r.default.tuntapSetMtu(this._ifName,e)}get ipv4(){this.makeSureIsUp();const e=s.networkInterfaces();return o.search(e,`${this._ifName}[?family=='IPv4'].cidr|[0]`)}set ipv4(e){const t=e.split("/");if(2!=t.length)throw`incorrect ip address: ${e}`;const n=t[0],i=Number.parseInt(t[1]);r.default.tuntapSetIpv4(this._ifName,n,i)}get ipv6(){this.makeSureIsUp();const e=s.networkInterfaces();return o.search(e,`${this._ifName}[?family=='IPv6'].cidr|[0]`)}set ipv6(e){const t=e.split("/");if(2!=t.length)throw`incorrect ipv6 address: ${e}`;const n=t[0],i=Number.parseInt(t[1]),s=r.default.tuntapGetIfIndex(this._ifName);r.default.tuntapSetIpv6(s,n,i)}onReceive(){}writePacket(){}}},8861(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const r=n(857),i=n(1421),s="darwin"===r.platform()?n(6789):void 0;s&&(s.applyGlobalMask=function(e,t){if(!(null==e?void 0:e.subnet))throw new Error("subnet is required");if(!t)throw new Error("tunName is required");try{(0,i.execSync)(`sudo route delete -net ${e.subnet} -interface ${t}`)}catch(e){}(0,i.execSync)(`sudo route add -net ${e.subnet} -interface ${t}`)},s.removeGlobalMask=function(e,t){if((null==e?void 0:e.subnet)&&t)try{(0,i.execSync)(`sudo route delete -net ${e.subnet} -interface ${t}`)}catch(e){}}),t.default=s},5031(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const r=n(6760),i=n(857);const s="win32"===i.platform()?n(6789):void 0;s&&(s.get_wintun_dll_path=function(){let e=i.arch();switch(e){case"arm":case"arm64":default:break;case"ia32":e="x86";break;case"x64":e="amd64"}const t=`wintun${e?`-${e}`:""}.dll`;return r.join(__dirname,"../../../../wintun_dll",t)}),t.default=s},1811(e,t,n){"use strict";const{Duplex:r,Readable:i,Writable:s}=n(2203),{CHANNEL_EXTENDED_DATATYPE:{STDERR:o}}=n(8692),{bufferSlice:a}=n(9576),c=2097152,l=1048576;class h extends i{constructor(e,t){super(t),this._channel=e}_read(e){this._channel._waitChanDrain&&(this._channel._waitChanDrain=!1,this._channel.incoming.window<=l&&p(this._channel))}}class u extends s{constructor(e){super({highWaterMark:c}),this._channel=e}_write(e,t,n){const r=this._channel,i=r._client._protocol,s=r.outgoing,c=s.packetSize,l=s.id;let h=s.window;const u=e.length;let d=0;if("open"===s.state){for(;u-d>0&&h>0;){let t=u-d;t>h&&(t=h),t>c&&(t=c),0===d&&t===u?i.channelExtData(l,e,o):i.channelExtData(l,a(e,d,d+t),o),d+=t,h-=t}if(s.window=h,u-d>0)return 0===h&&(r._waitWindow=!0),r._chunkErr=d>0?a(e,d,u):e,void(r._chunkcbErr=n);n()}}}function d(){this.eof(),!this.server&&this.allowHalfOpen||this.close(),this.writable=!1}function f(){this.readable=!1}function p(e){if("closed"===e.outgoing.state)return;const t=c-e.incoming.window;t<=0||(e.incoming.window+=t,e._client._protocol.channelWindowAdjust(e.outgoing.id,t))}e.exports={Channel:class extends r{constructor(e,t,n){const r={highWaterMark:c,allowHalfOpen:!n||n&&!1!==n.allowHalfOpen,emitClose:!1};super(r),this.allowHalfOpen=r.allowHalfOpen;const i=!(!n||!n.server);this.server=i,this.type=t.type,this.subtype=void 0,this.incoming=t.incoming,this.outgoing=t.outgoing,this._callbacks=[],this._client=e,this._hasX11=!1,this._exit={code:void 0,signal:void 0,dump:void 0,desc:void 0},this.stdin=this.stdout=this,this.stderr=i?new u(this):new h(this,r),this._waitWindow=!1,this._waitChanDrain=!1,this._chunk=void 0,this._chunkcb=void 0,this._chunkErr=void 0,this._chunkcbErr=void 0,this.on("finish",d).on("prefinish",d),this.on("end",f).on("close",f)}_read(e){this._waitChanDrain&&(this._waitChanDrain=!1,this.incoming.window<=l&&p(this))}_write(e,t,n){const r=this._client._protocol,i=this.outgoing,s=i.packetSize,o=i.id;let c=i.window;const l=e.length;let h=0;if("open"===i.state){for(;l-h>0&&c>0;){let t=l-h;t>c&&(t=c),t>s&&(t=s),0===h&&t===l?r.channelData(o,e):r.channelData(o,a(e,h,h+t)),h+=t,c-=t}if(i.window=c,l-h>0)return 0===c&&(this._waitWindow=!0),this._chunk=h>0?a(e,h,l):e,void(this._chunkcb=n);n()}}eof(){"open"===this.outgoing.state&&(this.outgoing.state="eof",this._client._protocol.channelEOF(this.outgoing.id))}close(){"open"!==this.outgoing.state&&"eof"!==this.outgoing.state||(this.outgoing.state="closing",this._client._protocol.channelClose(this.outgoing.id))}destroy(){return this.end(),this.close(),this}setWindow(e,t,n,r){if(this.server)throw new Error("Client-only method called in server mode");"session"!==this.type||"shell"!==this.subtype&&"exec"!==this.subtype||!this.writable||"open"!==this.outgoing.state||this._client._protocol.windowChange(this.outgoing.id,e,t,n,r)}signal(e){if(this.server)throw new Error("Client-only method called in server mode");"session"===this.type&&this.writable&&"open"===this.outgoing.state&&this._client._protocol.signal(this.outgoing.id,e)}exit(e,t,n){if(!this.server)throw new Error("Server-only method called in client mode");"session"===this.type&&this.writable&&"open"===this.outgoing.state&&("number"==typeof e?this._client._protocol.exitStatus(this.outgoing.id,e):this._client._protocol.exitSignal(this.outgoing.id,e,t,n))}},MAX_WINDOW:c,PACKET_SIZE:32768,windowAdjust:p,WINDOW_THRESHOLD:l}},3513(e,t,n){"use strict";const{Socket:r}=n(9278),{Duplex:i}=n(2203),{resolve:s}=n(6928),{readFile:o}=n(9896),{execFile:a,spawn:c}=n(5317),{isParsedKey:l,parseKey:h}=n(541),{makeBufferParser:u,readUInt32BE:d,writeUInt32BE:f,writeUInt32LE:p}=n(9576);function g(e){let t=!1;return(...n)=>{t||(t=!0,e(...n))}}function m(){}const _=Buffer.alloc(0),y=u();class v{getIdentities(e){e(new Error("Missing getIdentities() implementation"))}sign(e,t,n,r){"function"==typeof n&&(r=n),r(new Error("Missing sign() implementation"))}}class b extends v{constructor(e){super(),this.socketPath=e}getStream(e){e=g(e);const t=new r;function n(){try{t.destroy()}catch{}e(new Error("Failed to connect to agent"))}t.on("connect",()=>{e(null,t)}),t.on("close",n).on("end",n).on("error",n),t.connect(this.socketPath)}getIdentities(e){e=g(e),this.getStream((t,n)=>{function r(t){if(n)try{n.destroy()}catch{}t||(t=new Error("Failed to retrieve identities from agent")),e(t)}if(t)return r(t);const i=new C(!0);i.on("error",r),i.pipe(n).pipe(i),n.on("close",r).on("end",r).on("error",r),i.getIdentities((t,i)=>{if(t)return r(t);try{n.destroy()}catch{}e(null,i)})})}sign(e,t,n,r){"function"==typeof n?(r=n,n=void 0):"object"==typeof n&&null!==n||(n=void 0),r=g(r),this.getStream((i,s)=>{function o(e){if(s)try{s.destroy()}catch{}e||(e=new Error("Failed to sign data with agent")),r(e)}if(i)return o(i);const a=new C(!0);a.on("error",o),a.pipe(s).pipe(a),s.on("close",o).on("end",o).on("error",o),a.sign(e,t,n,(e,t)=>{if(e)return o(e);try{s.destroy()}catch{}r(null,t)})})}}const E=(()=>{const e=10,t=11,n=12,r=13,o=14,a=15,l=s(__dirname,"..","util/pagent.exe"),h={[e]:new Error("Invalid pagent.exe arguments"),[t]:new Error("Pageant is not running"),[n]:new Error("pagent.exe could not create an mmap"),[r]:new Error("pagent.exe could not set mode for stdin"),[o]:new Error("pagent.exe could not set mode for stdout"),[a]:new Error("pagent.exe did not get expected input payload")};function u(e){e.buffer=null,e.proc&&(e.proc.kill(),e.proc=void 0)}class f extends i{constructor(){super(),this.proc=void 0,this.buffer=null}_read(e){}_write(e,t,n){if(null===this.buffer)this.buffer=e;else{const t=Buffer.allocUnsafe(this.buffer.length+e.length);this.buffer.copy(t,0),e.copy(t,this.buffer.length),this.buffer=t}if(this.buffer.length<4)return n();const r=d(this.buffer,0);if(this.buffer.length-4<r)return n();if(e=this.buffer.slice(0,4+r),this.buffer.length>4+r)return n(new Error("Unexpected multiple agent requests"));let i;this.buffer=null;const s=this.proc=c(l,[e.length]);s.stdout.on("data",e=>{this.push(e)}),s.on("error",e=>{i=e,n(i)}),s.on("close",e=>{if(this.proc=void 0,!i){if(i=h[e])return n(i);n()}}),s.stdin.end(e)}_final(e){u(this),e()}_destroy(e,t){u(this),t()}}return class extends b{getStream(e){e(null,new f)}}})(),A=(()=>{const e=/^!<socket >(\d+) s ([A-Z0-9]{8}-[A-Z0-9]{8}-[A-Z0-9]{8}-[A-Z0-9]{8})/;return class extends b{getStream(t){t=g(t);let n=this.socketPath,i=!1;o(n,function s(c,l){if(c)return i?t(new Error("Invalid cygwin unix socket path")):void a("cygpath",["-w",n],(e,r,a)=>{if(e||0===r.length)return t(new Error("Invalid cygwin unix socket path"));i=!0,n=r.toString().replace(/[\r\n]/g,""),o(n,s)});const h=e.exec(l.toString("ascii"));if(!h)return t(new Error("Malformed cygwin unix socket file"));let u,f=0,g=!1;const m=[];let _,y=Buffer.alloc(12);const v=parseInt(h[1],10),b=h[2].replace(/-/g,""),E=Buffer.allocUnsafe(16);for(let e=0,t=0;t<32;++e,t+=2)E[e]=parseInt(b.substring(t,t+2),16);for(let e=0;e<16;e+=4)p(E,d(E,e),e);function A(){f=0,u="secret",_.write(E)}function S(e){if(f+=e.length,"secret"!==u){if("creds"===u&&(g||m.push(e),12===f)){if(_.removeListener("connect",A),_.removeListener("data",S),_.removeListener("error",w),_.removeListener("end",w),_.removeListener("close",w),g)return t(null,_);g=!0,y=Buffer.concat(m),p(y,process.pid,0),_.on("error",()=>{}),_.destroy(),C()}}else 16===f&&(f=0,u="creds",_.write(y))}function w(){t(new Error("Problem negotiating cygwin unix socket security"))}function C(){_=new r,_.on("connect",A),_.on("data",S),_.on("error",w),_.on("end",w),_.on("close",w),_.connect(v)}C()})}}})(),S=/^[/\\][/\\]\.[/\\]pipe[/\\].+/;function w(e){return"win32"!==process.platform||S.test(e)?new b(e):"pageant"===e?new E:new A(e)}const C=(()=>{const e=Symbol("Inbound Request Type"),t=Symbol("Inbound Request Response"),n=Symbol("Inbound Request Context");class r{constructor(r,i){this[e]=r,this[t]=void 0,this[n]=i}hasResponded(){return void 0!==this[t]}getType(){return this[e]}getContext(){return this[n]}}function s(e,n,r){return n[t]=r,function(e){let n;for(;e[u].length;){const r=e[u][0][t];if(void 0===r)break;e[u].shift(),n=e.push(r)}return n}(e)}function o(e){if(e[g]=null,0===e[p]){const t=e[u];if(t&&t.length){e[u]=[];for(const e of t)e.cb(new Error("No reply from server"))}}try{e.end()}catch{}setImmediate(()=>{e[E]||e.emit("end"),e[b]||e.emit("close")})}function a(){this[b]=!0}function c(){this[E]=!0}const u=Symbol("Requests"),p=Symbol("Agent Protocol Role"),g=Symbol("Agent Protocol Buffer"),v=Symbol("Agent Protocol Current Message Length"),b=Symbol("Agent Protocol Closed"),E=Symbol("Agent Protocol Ended");return class extends i{constructor(e){super({autoDestroy:!0,emitClose:!1}),this[p]=e?0:1,this[u]=[],this[g]=null,this[v]=-1,this.once("end",c),this.once("close",a)}_read(e){}_write(e,t,n){null===this[g]?this[g]=e:this[g]=function(e,t){const n=Buffer.allocUnsafe(e.length+t.length);return e.copy(n,0),t.copy(n,e.length),n}(this[g],e);let i=this[g],s=i.length,o=0;for(;o<s&&!(s<5)&&(-1===this[v]&&(this[v]=d(i,o)),!(s<4+this[v]));){const e=i[o+=4];if(++o,0===this[p]){if(0===this[u].length)return n(new Error("Received unexpected message from server"));const t=this[u].shift();switch(e){case 5:t.cb(new Error("Agent responded with failure"));break;case 12:{if(11!==t.type)return n(new Error("Agent responded with wrong message type"));y.init(i,o);const e=y.readUInt32BE();if(void 0===e)return y.clear(),n(new Error("Malformed agent response"));const r=[];for(let t=0;t<e;++t){let e=y.readString();if(void 0===e)return y.clear(),n(new Error("Malformed agent response"));const t=y.readString(!0);if(void 0===t)return y.clear(),n(new Error("Malformed agent response"));e=h(e),e instanceof Error||(e.comment=e.comment||t,r.push(e))}o=y.pos(),y.clear(),t.cb(null,r);break}case 14:{if(13!==t.type)return n(new Error("Agent responded with wrong message type"));y.init(i,o);let e=y.readString();if(o=y.pos(),y.clear(),void 0===e)return n(new Error("Malformed agent response"));if(y.init(e,0),y.readString(!0),e=y.readString(),y.clear(),void 0===e)return n(new Error("Malformed OpenSSH signature format"));t.cb(null,e);break}default:return n(new Error("Agent responded with unsupported message type"))}}else switch(e){case 11:{const t=new r(e);this[u].push(t),this.emit("identities",t);break}case 13:{y.init(i,o);let t=y.readString();const n=y.readString(),s=y.readUInt32BE();if(o=y.pos(),y.clear(),void 0===s){const t=new r(e);return this[u].push(t),this.failureReply(t)}if(t=h(t),t instanceof Error){const t=new r(e);return this[u].push(t),this.failureReply(t)}const a={hash:void 0};let c;"ssh-rsa"===t.type&&(2&s?(c="rsa-sha2-256",a.hash="sha256"):4&s&&(c="rsa-sha2-512",a.hash="sha512")),void 0===c&&(c=t.type);const l=new r(e,c);this[u].push(l),this.emit("sign",l,t,n,a);break}default:{const t=new r(e);this[u].push(t),this.failureReply(t)}}if(this[v]=-1,o===s){this[g]=null;break}this[g]=i=i.slice(o),s=i.length,o=0}n()}_destroy(e,t){o(this),t()}_final(e){o(this),e()}sign(e,t,n,r){if(0!==this[p])throw new Error("Client-only method called with server role");"function"==typeof n?(r=n,n=void 0):"object"==typeof n&&null!==n||(n=void 0);let i=0;if((e=h(e))instanceof Error)throw new Error("Invalid public key argument");if("ssh-rsa"===e.type&&n)switch(n.hash){case"sha256":i=2;break;case"sha512":i=4}const s=(e=e.getPublicSSH()).length,o=t.length;let a=0;const c=Buffer.allocUnsafe(9+s+4+o+4);return f(c,c.length-4,a),c[a+=4]=13,f(c,s,++a),e.copy(c,a+=4),f(c,o,a+=s),t.copy(c,a+=4),f(c,i,a+=o),"function"!=typeof r&&(r=m),this[u].push({type:13,cb:r}),this.push(c)}getIdentities(e){if(0!==this[p])throw new Error("Client-only method called with server role");let t=0;const n=Buffer.allocUnsafe(5);return f(n,n.length-4,t),n[t+=4]=11,"function"!=typeof e&&(e=m),this[u].push({type:11,cb:e}),this.push(n)}failureReply(e){if(1!==this[p])throw new Error("Server-only method called with client role");if(!(e instanceof r))throw new Error("Wrong request argument");if(e.hasResponded())return!0;let t=0;const n=Buffer.allocUnsafe(5);return f(n,n.length-4,t),n[t+=4]=5,s(this,e,n)}getIdentitiesReply(e,t){if(1!==this[p])throw new Error("Server-only method called with client role");if(!(e instanceof r))throw new Error("Wrong request argument");if(e.hasResponded())return!0;if(11!==e.getType())throw new Error("Invalid response to request");if(!Array.isArray(t))throw new Error("Keys argument must be an array");let n=4;const i=[];for(let e=0;e<t.length;++e){const r=t[e];if("object"!=typeof r||null===r)throw new Error(`Invalid key entry: ${r}`);let s,o;if(l(r))s=r;else if(l(r.pubKey))s=r.pubKey;else{if("object"!=typeof r.pubKey||null===r.pubKey)continue;if(({pubKey:s,comment:o}=r.pubKey),s=h(s),s instanceof Error)continue}o=s.comment||o,s=s.getPublicSSH(),n+=4+s.length,o&&"string"==typeof o?o=Buffer.from(o):Buffer.isBuffer(o)||(o=_),n+=4+o.length,i.push({pubKey:s,comment:o})}let o=0;const a=Buffer.allocUnsafe(5+n);f(a,a.length-4,o),a[o+=4]=12,f(a,i.length,++o),o+=4;for(let e=0;e<i.length;++e){const{pubKey:t,comment:n}=i[e];f(a,t.length,o),t.copy(a,o+=4),f(a,n.length,o+=t.length),o+=4,n.length&&(n.copy(a,o),o+=n.length)}return s(this,e,a)}signReply(e,t){if(1!==this[p])throw new Error("Server-only method called with client role");if(!(e instanceof r))throw new Error("Wrong request argument");if(e.hasResponded())return!0;if(13!==e.getType())throw new Error("Invalid response to request");if(!Buffer.isBuffer(t))throw new Error("Signature argument must be a Buffer");if(0===t.length)throw new Error("Signature argument must be non-empty");let n=0;const i=e.getContext(),o=Buffer.byteLength(i),a=Buffer.allocUnsafe(13+o+4+t.length);return f(a,a.length-4,n),a[n+=4]=14,f(a,4+o+4+t.length,++n),f(a,o,n+=4),a.utf8Write(i,n+=4,o),f(a,t.length,n+=o),t.copy(a,n+=4),s(this,e,a)}}})(),I=Symbol("Agent"),k=Symbol("Agent Keys"),T=Symbol("Agent Keys Index"),R=Symbol("Agent Init Callbacks");function O(e){return e instanceof v}e.exports={AgentContext:class{constructor(e){if("string"==typeof e)e=w(e);else if(!O(e))throw new Error("Invalid agent argument");this[I]=e,this[k]=null,this[T]=-1,this[R]=null}init(e){if("function"!=typeof e&&(e=m),null===this[k])if(null===this[R]){this[R]=[e];const t=(...e)=>{process.nextTick(()=>{const t=this[R];this[R]=null;for(const n of t)n(...e)})};this[I].getIdentities(g((e,n)=>{if(e)return t(e);if(!Array.isArray(n))return t(new Error("Agent implementation failed to provide keys"));const r=[];for(let e of n)e=h(e),e instanceof Error||r.push(e);this[k]=r,this[T]=-1,t()}))}else this[R].push(e);else process.nextTick(e)}nextKey(){return!(null===this[k]||++this[T]>=this[k].length)&&this[k][this[T]]}currentKey(){return null===this[k]||this[T]>=this[k].length?null:this[k][this[T]]}pos(){return null===this[k]||this[T]>=this[k].length?-1:this[T]}reset(){this[T]=-1}sign(...e){this[I].sign(...e)}},AgentProtocol:C,BaseAgent:v,createAgent:w,CygwinAgent:A,isAgent:O,OpenSSHAgent:b,PageantAgent:E}},2217(e,t,n){"use strict";const{createHash:r,getHashes:i,randomFillSync:s}=n(6982),{Socket:o}=n(9278),{lookup:a}=n(2250),c=n(4434),l=i(),{COMPAT:h,CHANNEL_EXTENDED_DATATYPE:{STDERR:u},CHANNEL_OPEN_FAILURE:d,DEFAULT_CIPHER:f,DEFAULT_COMPRESSION:p,DEFAULT_KEX:g,DEFAULT_MAC:m,DEFAULT_SERVER_HOST_KEY:_,DISCONNECT_REASON:y,DISCONNECT_REASON_BY_VALUE:v,SUPPORTED_CIPHER:b,SUPPORTED_COMPRESSION:E,SUPPORTED_KEX:A,SUPPORTED_MAC:S,SUPPORTED_SERVER_HOST_KEY:w}=n(8692),{init:C}=n(7064),I=n(7265),{parseKey:k}=n(541),{SFTP:T}=n(7764),{bufferCopy:R,makeBufferParser:O,makeError:N,readUInt32BE:P,sigSSHToASN1:B,writeUInt32BE:L}=n(9576),{AgentContext:x,createAgent:D,isAgent:M}=n(3513),{Channel:U,MAX_WINDOW:F,PACKET_SIZE:H,windowAdjust:j,WINDOW_THRESHOLD:W}=n(1811),{ChannelManager:Q,generateAlgorithmList:q,isWritable:z,onChannelOpenFailure:$,onCHANNEL_CLOSE:G}=n(4457),K=O(),Y=O(),V=/^OpenSSH_(?:(?![0-4])\d)|(?:\d{2,})/,X=e=>{};function J(e,t,n,r){const i=F,s=H;"function"==typeof n&&(r=n,n={});const o=(e,t)=>{r(e,t)};o.type=t;const a=e._chanMgr.add(o);if(-1!==a)switch(t){case"session":case"sftp":e._protocol.session(a,i,s);break;case"direct-tcpip":e._protocol.directTcpip(a,i,s,n);break;case"direct-streamlocal@openssh.com":e._protocol.openssh_directStreamLocal(a,i,s,n);break;default:throw new Error(`Unsupported channel type: ${t}`)}else r(new Error("No free channels available"))}function Z(e,t,n){const r={single:!1,protocol:"MIT-MAGIC-COOKIE-1",cookie:void 0,screen:0};"function"==typeof t?n=t:"object"==typeof t&&null!==t&&("boolean"==typeof t.single&&(r.single=t.single),"number"==typeof t.screen&&(r.screen=t.screen),"string"==typeof t.protocol&&(r.protocol=t.protocol),"string"==typeof t.cookie?r.cookie=t.cookie:Buffer.isBuffer(t.cookie)&&(r.cookie=t.cookie.hexSlice(0,t.cookie.length))),void 0===r.cookie&&(r.cookie=ie());const i="function"==typeof n;"open"===e.outgoing.state?(i&&e._callbacks.push(t=>{t?n(!0!==t?t:new Error("Unable to request X11")):(e._hasX11=!0,++e._client._acceptX11,e.once("close",()=>{e._client._acceptX11&&--e._client._acceptX11}),n())}),e._client._protocol.x11Forward(e.outgoing.id,r,i)):i&&n(new Error("Channel is not open"))}function ee(e,t,n){let r=24,i=80,s=640,o=480,a="vt100",c=null;"function"==typeof t?n=t:"object"==typeof t&&null!==t&&("number"==typeof t.rows&&(r=t.rows),"number"==typeof t.cols&&(i=t.cols),"number"==typeof t.width&&(s=t.width),"number"==typeof t.height&&(o=t.height),"string"==typeof t.term&&(a=t.term),"object"==typeof t.modes&&(c=t.modes));const l="function"==typeof n;"open"===e.outgoing.state?(l&&e._callbacks.push(e=>{e?n(!0!==e?e:new Error("Unable to request a pseudo-terminal")):n()}),e._client._protocol.pty(e.outgoing.id,r,i,o,s,a,c,l)):l&&n(new Error("Channel is not open"))}function te(e,t){const n="function"==typeof t;"open"===e.outgoing.state?e._client._agentFwdEnabled?n&&t(!1):(e._client._agentFwdEnabled=!0,e._callbacks.push(r=>{if(r)return e._client._agentFwdEnabled=!1,void(n&&t(!0!==r?r:new Error("Unable to request agent forwarding")));n&&t()}),e._client._protocol.openssh_agentForward(e.outgoing.id,!0)):n&&t(new Error("Channel is not open"))}function ne(e,t){if("open"!==e.outgoing.state)return;const n=Object.keys(t||{});for(let r=0;r<n.length;++r){const i=n[r],s=t[i];e._client._protocol.env(e.outgoing.id,i,s,!1)}}function re(e,t,n){"open"===e.outgoing.state?(e._callbacks.push(r=>{r?n(!0!==r?r:new Error(`Unable to start subsystem: ${t}`)):(e.subtype="subsystem",n(void 0,e))}),e._client._protocol.subsystem(e.outgoing.id,t,!0)):n(new Error("Channel is not open"))}const ie=(()=>{const e=Buffer.allocUnsafe(16);return()=>(s(e,0,16),e.hexSlice(0,16))})();function se(e){if(!Array.isArray(e))throw new Error("authList must be an array");let t=0;return(n,r,i)=>t!==e.length&&e[t++]}function oe(e,t,n){if("ssh-rsa"===t.type){if(e._protocol._compatFlags&h.IMPLY_RSA_SHA2_SIGALGS&&(n=Array.isArray(n)?["rsa-sha2-256","rsa-sha2-512",...n]:["rsa-sha2-256","rsa-sha2-512"]),Array.isArray(n)){if(-1!==n.indexOf("rsa-sha2-256"))return[["rsa-sha2-256","sha256"]];if(-1!==n.indexOf("rsa-sha2-512"))return[["rsa-sha2-512","sha512"]];if(-1===n.indexOf("ssh-rsa"))return[]}return[["ssh-rsa","sha1"]]}}e.exports=class extends c{constructor(){super(),this.config={host:void 0,port:void 0,localAddress:void 0,localPort:void 0,forceIPv4:void 0,forceIPv6:void 0,keepaliveCountMax:void 0,keepaliveInterval:void 0,readyTimeout:void 0,ident:void 0,username:void 0,password:void 0,privateKey:void 0,tryKeyboard:void 0,agent:void 0,allowAgentFwd:void 0,authHandler:void 0,hostHashAlgo:void 0,hostHashCb:void 0,strictVendor:void 0,debug:void 0},this._agent=void 0,this._readyTimeout=void 0,this._chanMgr=void 0,this._callbacks=void 0,this._forwarding=void 0,this._forwardingUnix=void 0,this._acceptX11=void 0,this._agentFwdEnabled=void 0,this._remoteVer=void 0,this._protocol=void 0,this._sock=void 0,this._resetKA=void 0}connect(e){if(this._sock&&z(this._sock))return this.once("close",()=>{this.connect(e)}),this.end(),this;this.config.host=e.hostname||e.host||"localhost",this.config.port=e.port||22,this.config.localAddress="string"==typeof e.localAddress?e.localAddress:void 0,this.config.localPort="string"==typeof e.localPort||"number"==typeof e.localPort?e.localPort:void 0,this.config.forceIPv4=e.forceIPv4||!1,this.config.forceIPv6=e.forceIPv6||!1,this.config.keepaliveCountMax="number"==typeof e.keepaliveCountMax&&e.keepaliveCountMax>=0?e.keepaliveCountMax:3,this.config.keepaliveInterval="number"==typeof e.keepaliveInterval&&e.keepaliveInterval>0?e.keepaliveInterval:0,this.config.readyTimeout="number"==typeof e.readyTimeout&&e.readyTimeout>=0?e.readyTimeout:2e4,this.config.ident="string"==typeof e.ident||Buffer.isBuffer(e.ident)?e.ident:void 0;const t={kex:void 0,serverHostKey:void 0,cs:{cipher:void 0,mac:void 0,compress:void 0,lang:[]},sc:void 0};let n=!0;if("object"==typeof e.algorithms&&null!==e.algorithms&&(t.kex=q(e.algorithms.kex,g,A),t.kex!==g&&(n=!1),t.serverHostKey=q(e.algorithms.serverHostKey,_,w),t.serverHostKey!==_&&(n=!1),t.cs.cipher=q(e.algorithms.cipher,f,b),t.cs.cipher!==f&&(n=!1),t.cs.mac=q(e.algorithms.hmac,m,S),t.cs.mac!==m&&(n=!1),t.cs.compress=q(e.algorithms.compress,p,E),t.cs.compress!==p&&(n=!1),n||(t.sc=t.cs)),"string"==typeof e.username)this.config.username=e.username;else{if("string"!=typeof e.user)throw new Error("Invalid username");this.config.username=e.user}this.config.password="string"==typeof e.password?e.password:void 0,this.config.privateKey="string"==typeof e.privateKey||Buffer.isBuffer(e.privateKey)?e.privateKey:void 0,this.config.localHostname="string"==typeof e.localHostname?e.localHostname:void 0,this.config.localUsername="string"==typeof e.localUsername?e.localUsername:void 0,this.config.tryKeyboard=!0===e.tryKeyboard,"string"==typeof e.agent&&e.agent.length?this.config.agent=D(e.agent):M(e.agent)?this.config.agent=e.agent:this.config.agent=void 0,this.config.allowAgentFwd=!0===e.agentForward&&void 0!==this.config.agent;let i=this.config.authHandler="function"==typeof e.authHandler||Array.isArray(e.authHandler)?e.authHandler:void 0;this.config.strictVendor="boolean"!=typeof e.strictVendor||e.strictVendor;const s=this.config.debug="function"==typeof e.debug?e.debug:void 0;if(!0===e.agentForward&&!this.config.allowAgentFwd)throw new Error("You must set a valid agent path to allow agent forwarding");let c,h,O=this._callbacks=[];if(this._chanMgr=new Q(this),this._forwarding={},this._forwardingUnix={},this._acceptX11=0,this._agentFwdEnabled=!1,this._agent=this.config.agent?this.config.agent:void 0,this._remoteVer=void 0,this.config.privateKey){if(c=k(this.config.privateKey,e.passphrase),c instanceof Error)throw new Error(`Cannot parse privateKey: ${c.message}`);if(Array.isArray(c)&&(c=c[0]),null===c.getPrivatePEM())throw new Error("privateKey value does not contain a (valid) private key")}if("function"==typeof e.hostVerifier){const t=e.hostVerifier;let n;-1!==l.indexOf(e.hostHash)&&(n=e.hostHash),h=(e,i)=>{n&&(e=r(n).update(e).digest("hex"));const s=t(e,i);void 0!==s&&i(s)}}const P=this._sock=e.sock||new o;let J=!1,Z=!1;this._protocol&&this._protocol.cleanup();const ee=s?(e,t,n)=>{s(`Debug output from server: ${JSON.stringify(n)}`)}:void 0;let te;const ne=this._protocol=new I({ident:this.config.ident,offer:n?void 0:t,onWrite:e=>{z(P)&&P.write(e)},onError:e=>{"handshake"===e.level&&clearTimeout(this._readyTimeout),ne._destruct||P.removeAllListeners("data"),this.emit("error",e);try{P.end()}catch{}},onHeader:e=>{Z=!0,this._remoteVer=e.versions.software,e.greeting&&this.emit("greeting",e.greeting)},onHandshakeComplete:e=>{this.emit("handshake",e),J||(J=!0,ne.service("ssh-userauth"))},debug:s,hostVerifier:h,messageHandlers:{DEBUG:ee,DISCONNECT:(e,t,n)=>{if(t!==y.BY_APPLICATION){n||void 0===(n=v[t])&&(n=`Unexpected disconnection reason: ${t}`);const e=new Error(n);e.code=t,this.emit("error",e)}P.end()},SERVICE_ACCEPT:(e,t)=>{"ssh-userauth"===t&&Ee()},EXT_INFO:(e,t)=>{if(void 0===te){for(const e of t)if("server-sig-algs"===e.name)return void(te=e.algs);te=null}},USERAUTH_BANNER:(e,t)=>{this.emit("banner",t)},USERAUTH_SUCCESS:e=>{he(),clearTimeout(this._readyTimeout),this.emit("ready")},USERAUTH_FAILURE:(e,t,n)=>{if(fe.keyAlgos){const e=fe.keyAlgos[0][0];if(s&&s(`Client: ${fe.type} (${e}) auth failed`),fe.keyAlgos.shift(),fe.keyAlgos.length){const[e,t]=fe.keyAlgos[0];switch(fe.type){case"agent":return void ne.authPK(fe.username,fe.agentCtx.currentKey(),e);case"publickey":return void ne.authPK(fe.username,fe.key,e);case"hostbased":return void ne.authHostbased(fe.username,fe.key,fe.localHostname,fe.localUsername,e,(e,n)=>{const r=fe.key.sign(e,t);if(r instanceof Error)return r.message=`Error while signing with key: ${r.message}`,r.level="client-authentication",this.emit("error",r),Ee();n(r)})}}else fe.keyAlgos=void 0}if("agent"===fe.type){const e=fe.agentCtx.pos();return s&&s(`Client: Agent key #${e+1} failed`),Ae()}s&&s(`Client: ${fe.type} auth failed`),ge=n,me=t,Ee()},USERAUTH_PASSWD_CHANGEREQ:(e,t)=>{"password"===fe.type&&this.emit("change password",t,e=>{ne.authPassword(this.config.username,this.config.password,e)})},USERAUTH_PK_OK:e=>{let t,n;if(fe.keyAlgos&&([t,n]=fe.keyAlgos[0]),"agent"===fe.type){const e=fe.agentCtx.currentKey();ne.authPK(fe.username,e,t,(t,r)=>{const i={hash:n};fe.agentCtx.sign(e,t,i,(e,t)=>{if(!e)return r(t);e.level="agent",this.emit("error",e),Ae()})})}else"publickey"===fe.type&&ne.authPK(fe.username,fe.key,t,(e,t)=>{const r=fe.key.sign(e,n);if(r instanceof Error)return r.message=`Error signing data with key: ${r.message}`,r.level="client-authentication",this.emit("error",r),Ee();t(r)})},USERAUTH_INFO_REQUEST:(e,t,n,r)=>{if("keyboard-interactive"===fe.type){if(0===(Array.isArray(r)?r.length:0))return s&&s("Client: Sending automatic USERAUTH_INFO_RESPONSE"),void ne.authInfoRes();fe.prompt(t,n,"",r,e=>{ne.authInfoRes(e)})}},REQUEST_SUCCESS:(e,t)=>{O.length&&O.shift()(!1,t)},REQUEST_FAILURE:e=>{O.length&&O.shift()(!0)},GLOBAL_REQUEST:(e,t,n,r)=>{if("hostkeys-00@openssh.com"===t)!function(e,t,n){if(!e._sock||!z(e._sock))return;"function"!=typeof n&&(n=X);if(!Array.isArray(t))throw new TypeError("Invalid keys argument type");const r=[];for(const e of t){const t=k(e);if(t instanceof Error)throw t;r.push(t)}if(!e.config.strictVendor||e.config.strictVendor&&V.test(e._remoteVer))return e._callbacks.push((t,i)=>{if(t)return void n(!0!==t?t:new Error("Server failed to prove supplied keys"));const s=[];let o=0;for(K.init(i,0);K.avail()&&o!==r.length;){const t=r[o++],n=t.getPublicSSH(),i=K.readString();Y.init(i,0);const a=Y.readString(!0);let c,l=Y.readString();if(a!==t.type){if("ssh-rsa"!==t.type)continue;switch(a){case"rsa-sha2-256":c="sha256";break;case"rsa-sha2-512":c="sha512";break;default:continue}}const h=e._protocol._kex.sessionID,u=Buffer.allocUnsafe(37+h.length+4+n.length);let d=0;L(u,29,d),u.utf8Write("hostkeys-prove-00@openssh.com",d+=4,29),L(u,h.length,d+=29),R(h,u,0,h.length,d+=4),L(u,n.length,d+=h.length),R(n,u,0,n.length,d+=4),(l=B(l,a))&&!0===t.verify(u,l,c)&&s.push(t)}Y.clear(),K.clear(),n(null,s)}),void e._protocol.openssh_hostKeysProve(r);process.nextTick(n,new Error("strictVendor enabled and server is not OpenSSH or compatible version"))}(this,r,(e,t)=>{e||this.emit("hostkeys",t)}),n&&ne.requestSuccess();else n&&ne.requestFailure()},CHANNEL_OPEN:(e,t)=>{!function(e,t){let n,r=-1;const i=()=>{const n={type:t.type,incoming:{id:r,window:F,packetSize:H,state:"open"},outgoing:{id:t.sender,window:t.window,packetSize:t.packetSize,state:"open"}},i=new U(e,n);return e._chanMgr.update(r,i),e._protocol.channelOpenConfirm(t.sender,r,F,H),i},s=()=>{void 0===n&&(n=-1===r?d.RESOURCE_SHORTAGE:d.CONNECT_FAILED),-1!==r&&e._chanMgr.remove(r),e._protocol.channelOpenFail(t.sender,n,"")},o=()=>(r=e._chanMgr.add(),-1===r&&(n=d.RESOURCE_SHORTAGE,e.config.debug&&e.config.debug("Client: Automatic rejection of incoming channel open: no channels available")),-1!==r),a=t.data;switch(t.type){case"forwarded-tcpip":{const t=e._forwarding[`${a.destIP}:${a.destPort}`];if(void 0!==t&&o())return 0===a.destPort&&(a.destPort=t),void e.emit("tcp connection",a,i,s);break}case"forwarded-streamlocal@openssh.com":if(void 0!==e._forwardingUnix[a.socketPath]&&o())return void e.emit("unix connection",a,i,s);break;case"auth-agent@openssh.com":if(e._agentFwdEnabled&&"function"==typeof e._agent.getStream&&o())return void e._agent.getStream((e,t)=>{if(e)return s();const n=i();n.pipe(t).pipe(n)});break;case"x11":if(0!==e._acceptX11&&o())return void e.emit("x11",a,i,s);break;default:n=d.UNKNOWN_CHANNEL_TYPE,e.config.debug&&e.config.debug(`Client: Automatic rejection of unsupported incoming channel open type: ${t.type}`)}void 0===n&&(n=d.ADMINISTRATIVELY_PROHIBITED,e.config.debug&&e.config.debug("Client: Automatic rejection of unexpected incoming channel open for: "+t.type));s()}(this,t)},CHANNEL_OPEN_CONFIRMATION:(e,t)=>{const n=this._chanMgr.get(t.recipient);if("function"!=typeof n)return;const r="sftp"===n.type,i={type:r?"session":n.type,incoming:{id:t.recipient,window:F,packetSize:H,state:"open"},outgoing:{id:t.sender,window:t.window,packetSize:t.packetSize,state:"open"}},o=r?new T(this,i,{debug:s}):new U(this,i);this._chanMgr.update(t.recipient,o),n(void 0,o)},CHANNEL_OPEN_FAILURE:(e,t,n,r)=>{const i=this._chanMgr.get(t);if("function"!=typeof i)return;$(this,t,{reason:n,description:r},i)},CHANNEL_DATA:(e,t,n)=>{const r=this._chanMgr.get(t);"object"==typeof r&&null!==r&&0!==r.incoming.window&&(r.incoming.window-=n.length,!1!==r.push(n)?r.incoming.window<=W&&j(r):r._waitChanDrain=!0)},CHANNEL_EXTENDED_DATA:(e,t,n,r)=>{if(r!==u)return;const i=this._chanMgr.get(t);"object"==typeof i&&null!==i&&0!==i.incoming.window&&(i.incoming.window-=n.length,i.stderr.push(n)?i.incoming.window<=W&&j(i):i._waitChanDrain=!0)},CHANNEL_WINDOW_ADJUST:(e,t,n)=>{const r=this._chanMgr.get(t);"object"==typeof r&&null!==r&&(r.outgoing.window+=n,r._waitWindow&&(r._waitWindow=!1,r._chunk?r._write(r._chunk,null,r._chunkcb):r._chunkcb?r._chunkcb():r._chunkErr?r.stderr._write(r._chunkErr,null,r._chunkcbErr):r._chunkcbErr&&r._chunkcbErr()))},CHANNEL_SUCCESS:(e,t)=>{const n=this._chanMgr.get(t);"object"==typeof n&&null!==n&&(this._resetKA(),n._callbacks.length&&n._callbacks.shift()(!1))},CHANNEL_FAILURE:(e,t)=>{const n=this._chanMgr.get(t);"object"==typeof n&&null!==n&&(this._resetKA(),n._callbacks.length&&n._callbacks.shift()(!0))},CHANNEL_REQUEST:(e,t,n,r,i)=>{const s=this._chanMgr.get(t);if("object"!=typeof s||null===s)return;const o=s._exit;if(void 0===o.code){switch(n){case"exit-status":return void s.emit("exit",o.code=i);case"exit-signal":return void s.emit("exit",o.code=null,o.signal=`SIG${i.signal}`,o.dump=i.coreDumped,o.desc=i.errorMessage)}r&&e.channelFailure(s.outgoing.id)}},CHANNEL_EOF:(e,t)=>{const n=this._chanMgr.get(t);"object"==typeof n&&null!==n&&"open"===n.incoming.state&&(n.incoming.state="eof",n.readable&&n.push(null),n.stderr.readable&&n.stderr.push(null))},CHANNEL_CLOSE:(e,t)=>{G(this,t,this._chanMgr.get(t))}}});P.pause();const re=this.config.keepaliveInterval,ie=this.config.keepaliveCountMax;let ae,ce=0;const le=()=>{if(++ce>ie){if(clearInterval(ae),P.readable){const e=new Error("Keepalive timeout");e.level="client-timeout",this.emit("error",e),P.destroy()}}else z(P)?(O.push(he),ne.ping()):clearInterval(ae)};function he(){re>0&&(ce=0,clearInterval(ae),z(P)&&(ae=setInterval(le,re)))}this._resetKA=he;const ue=(()=>{let e=!1;return()=>{if(!e&&(e=!0,pe&&!Z)){const e=N("Connection lost before handshake","protocol",!0);this.emit("error",e)}}})(),de=(()=>{let e=!1;return()=>{e||(e=!0,pe=!0,s&&s("Socket connected"),this.emit("connect"),C.then(()=>{ne.start(),P.on("data",e=>{try{ne.parse(e,0,e.length)}catch(e){this.emit("error",e);try{z(P)&&P.end()}catch{}}}),P.stderr&&"function"==typeof P.stderr.resume&&P.stderr.resume(),P.resume()}).catch(e=>{this.emit("error",e);try{z(P)&&P.end()}catch{}}))}})();let fe,pe=!1;P.on("connect",de).on("timeout",()=>{this.emit("timeout")}).on("error",e=>{s&&s(`Socket error: ${e.message}`),clearTimeout(this._readyTimeout),e.level="client-socket",this.emit("error",e)}).on("end",()=>{s&&s("Socket ended"),ue(),ne.cleanup(),clearTimeout(this._readyTimeout),clearInterval(ae),this.emit("end")}).on("close",()=>{s&&s("Socket closed"),ue(),ne.cleanup(),clearTimeout(this._readyTimeout),clearInterval(ae),this.emit("close");const e=O;O=this._callbacks=[];const t=new Error("No response from server");for(let n=0;n<e.length;++n)e[n](t);this._chanMgr.cleanup(t)});let ge=null,me=null;const _e=["none"];void 0!==this.config.password&&_e.push("password"),void 0!==c&&_e.push("publickey"),void 0!==this._agent&&_e.push("agent"),this.config.tryKeyboard&&_e.push("keyboard-interactive"),void 0!==c&&void 0!==this.config.localHostname&&void 0!==this.config.localUsername&&_e.push("hostbased"),Array.isArray(i)?i=se(i):"function"!=typeof i&&(i=se(_e));let ye=!1;const ve=e=>{if(!ye){if(ye=!0,!1===e){const e=new Error("All configured authentication methods failed");return e.level="client-authentication",this.emit("error",e),void this.end()}if("string"==typeof e){const t=e;if(-1===_e.indexOf(t))return be(`Authentication method not allowed: ${t}`);const n=this.config.username;switch(t){case"password":e={type:t,username:n,password:this.config.password};break;case"publickey":e={type:t,username:n,key:c};break;case"hostbased":e={type:t,username:n,key:c,localHostname:this.config.localHostname,localUsername:this.config.localUsername};break;case"agent":e={type:t,username:n,agentCtx:new x(this._agent)};break;case"keyboard-interactive":e={type:t,username:n,prompt:(...e)=>this.emit("keyboard-interactive",...e)};break;case"none":e={type:t,username:n};break;default:return be(`Skipping unsupported authentication method: ${e}`)}}else{if("object"!=typeof e||null===e)return be(`Skipping invalid authentication attempt: ${e}`);{const t=e.username;if("string"!=typeof t)return be(`Skipping invalid authentication attempt: ${e}`);const n=e.type;switch(n){case"password":{const{password:r}=e;if("string"!=typeof r&&!Buffer.isBuffer(r))return be("Skipping invalid password auth attempt");e={type:n,username:t,password:r};break}case"publickey":{const r=k(e.key,e.passphrase);if(r instanceof Error)return be("Skipping invalid key auth attempt");if(!r.isPrivateKey())return be("Skipping non-private key");e={type:n,username:t,key:r};break}case"hostbased":{const{localHostname:r,localUsername:i}=e,s=k(e.key,e.passphrase);if(s instanceof Error||"string"!=typeof r||"string"!=typeof i)return be("Skipping invalid hostbased auth attempt");if(!s.isPrivateKey())return be("Skipping non-private key");e={type:n,username:t,key:s,localHostname:r,localUsername:i};break}case"agent":{let r=e.agent;if("string"==typeof r&&r.length)r=D(r);else if(!M(r))return be(`Skipping invalid agent: ${e.agent}`);e={type:n,username:t,agentCtx:new x(r)};break}case"keyboard-interactive":{const{prompt:r}=e;if("function"!=typeof r)return be("Skipping invalid keyboard-interactive auth attempt");e={type:n,username:t,prompt:r};break}case"none":e={type:n,username:t};break;default:return be(`Skipping unsupported authentication method: ${e}`)}}}fe=e;try{const e=fe.username;switch(fe.type){case"password":ne.authPassword(e,fe.password);break;case"publickey":{let t;if(fe.keyAlgos=oe(this,fe.key,te),fe.keyAlgos){if(!fe.keyAlgos.length)return be("Skipping key authentication (no mutual hash algorithm)");t=fe.keyAlgos[0][0]}ne.authPK(e,fe.key,t);break}case"hostbased":{let t,n;if(fe.keyAlgos=oe(this,fe.key,te),fe.keyAlgos){if(!fe.keyAlgos.length)return be("Skipping hostbased authentication (no mutual hash algorithm)");[t,n]=fe.keyAlgos[0]}ne.authHostbased(e,fe.key,fe.localHostname,fe.localUsername,t,(e,t)=>{const r=fe.key.sign(e,n);if(r instanceof Error)return r.message=`Error while signing with key: ${r.message}`,r.level="client-authentication",this.emit("error",r),Ee();t(r)});break}case"agent":fe.agentCtx.init(e=>{if(e)return e.level="agent",this.emit("error",e),Ee();Ae()});break;case"keyboard-interactive":ne.authKeyboard(e);break;case"none":ne.authNone(e)}}finally{ye=!1}}};function be(e){s&&s(e),process.nextTick(Ee)}function Ee(){ye=!1;const e=i(me,ge,ve);ye||void 0===e||ve(e)}const Ae=()=>{if("agent"===fe.type){const e=fe.agentCtx.nextKey();if(!1===e)s&&s("Agent: No more keys left to try"),s&&s("Client: agent auth failed"),Ee();else{const t=fe.agentCtx.pos();let n;if(fe.keyAlgos=oe(this,e,te),fe.keyAlgos){if(!fe.keyAlgos.length)return s&&s(`Agent: Skipping key #${t+1} (no mutual hash algorithm)`),void Ae();n=fe.keyAlgos[0][0]}s&&s(`Agent: Trying key #${t+1}`),ne.authPK(fe.username,e,n)}}},Se=()=>{this.config.readyTimeout>0&&(this._readyTimeout=setTimeout(()=>{const e=new Error("Timed out while waiting for handshake");e.level="client-timeout",this.emit("error",e),P.destroy()},this.config.readyTimeout))};if(e.sock)Se(),"boolean"==typeof P.connecting&&P.connecting||de();else{let t=this.config.host;const n=this.config.forceIPv4,r=this.config.forceIPv6;s&&s(`Client: Trying ${t} on port ${this.config.port} ...`);const i=()=>{Se(),P.connect({host:t,port:this.config.port,localAddress:this.config.localAddress,localPort:this.config.localPort}),P.setMaxListeners(0),P.setTimeout("number"==typeof e.timeout?e.timeout:0)};!n&&!r||n&&r?i():a(t,n?4:6,(e,r,s)=>{if(e){const r=new Error(`Error while looking up ${n?"IPv4":"IPv6"} address for '${t}': ${e}`);return clearTimeout(this._readyTimeout),r.level="client-dns",this.emit("error",r),void this.emit("close")}t=r,i()})}return this}end(){return this._sock&&z(this._sock)&&(this._protocol.disconnect(y.BY_APPLICATION),this._sock.end()),this}destroy(){return this._sock&&z(this._sock)&&this._sock.destroy(),this}exec(e,t,n){if(!this._sock||!z(this._sock))throw new Error("Not connected");"function"==typeof t&&(n=t,t={});return J(this,"session",{allowHalfOpen:!1!==t.allowHalfOpen},(r,i)=>{if(r)return void n(r);const s=[];function o(e){if(e)return i.close(),void n(e);s.length&&s.shift()()}(!0===this.config.allowAgentFwd||t&&!0===t.agentForward&&void 0!==this._agent)&&s.push(()=>te(i,o)),"object"==typeof t&&null!==t&&("object"==typeof t.env&&null!==t.env&&ne(i,t.env),("object"==typeof t.pty&&null!==t.pty||!0===t.pty)&&s.push(()=>ee(i,t.pty,o)),("object"==typeof t.x11&&null!==t.x11||"number"===t.x11||!0===t.x11)&&s.push(()=>Z(i,t.x11,o))),s.push(()=>function(e,t,n,r){if("open"!==e.outgoing.state)return void r(new Error("Channel is not open"));e._callbacks.push(t=>{t?r(!0!==t?t:new Error("Unable to exec")):(e.subtype="exec",e.allowHalfOpen=!1!==n.allowHalfOpen,r(void 0,e))}),e._client._protocol.exec(e.outgoing.id,t,!0)}(i,e,t,n)),s.shift()()}),this}shell(e,t,n){if(!this._sock||!z(this._sock))throw new Error("Not connected");return"function"==typeof e?(n=e,e=t=void 0):"function"==typeof t&&(n=t,t=void 0),!e||void 0===e.x11&&void 0===e.env||(t=e,e=void 0),J(this,"session",(r,i)=>{if(r)return void n(r);const s=[];function o(e){if(e)return i.close(),void n(e);s.length&&s.shift()()}(!0===this.config.allowAgentFwd||t&&!0===t.agentForward&&void 0!==this._agent)&&s.push(()=>te(i,o)),!1!==e&&s.push(()=>ee(i,e,o)),"object"==typeof t&&null!==t&&("object"==typeof t.env&&null!==t.env&&ne(i,t.env),("object"==typeof t.x11&&null!==t.x11||"number"===t.x11||!0===t.x11)&&s.push(()=>Z(i,t.x11,o))),s.push(()=>function(e,t){if("open"!==e.outgoing.state)return void t(new Error("Channel is not open"));e._callbacks.push(n=>{n?t(!0!==n?n:new Error("Unable to open shell")):(e.subtype="shell",t(void 0,e))}),e._client._protocol.shell(e.outgoing.id,!0)}(i,n)),s.shift()()}),this}subsys(e,t){if(!this._sock||!z(this._sock))throw new Error("Not connected");return J(this,"session",(n,r)=>{n?t(n):re(r,e,(e,n)=>{e?t(e):t(void 0,n)})}),this}forwardIn(e,t,n){if(!this._sock||!z(this._sock))throw new Error("Not connected");const r="function"==typeof n;return r&&this._callbacks.push((r,i)=>{if(r)return void n(!0!==r?r:new Error(`Unable to bind to ${e}:${t}`));let s=t;0===t&&i&&i.length>=4&&(s=P(i,0),this._protocol._compatFlags&h.DYN_RPORT_BUG||(t=s)),this._forwarding[`${e}:${t}`]=s,n(void 0,s)}),this._protocol.tcpipForward(e,t,r),this}unforwardIn(e,t,n){if(!this._sock||!z(this._sock))throw new Error("Not connected");const r="function"==typeof n;return r&&this._callbacks.push(r=>{r?n(!0!==r?r:new Error(`Unable to unbind from ${e}:${t}`)):(delete this._forwarding[`${e}:${t}`],n())}),this._protocol.cancelTcpipForward(e,t,r),this}forwardOut(e,t,n,r,i){if(!this._sock||!z(this._sock))throw new Error("Not connected");return"function"!=typeof i&&(i=X),J(this,"direct-tcpip",{srcIP:e,srcPort:t,dstIP:n,dstPort:r},i),this}openssh_noMoreSessions(e){if(!this._sock||!z(this._sock))throw new Error("Not connected");const t="function"==typeof e;return!this.config.strictVendor||this.config.strictVendor&&V.test(this._remoteVer)?(t&&this._callbacks.push(t=>{t?e(!0!==t?t:new Error("Unable to disable future sessions")):e()}),this._protocol.openssh_noMoreSessions(t),this):t?(process.nextTick(e,new Error("strictVendor enabled and server is not OpenSSH or compatible version")),this):this}openssh_forwardInStreamLocal(e,t){if(!this._sock||!z(this._sock))throw new Error("Not connected");const n="function"==typeof t;return!this.config.strictVendor||this.config.strictVendor&&V.test(this._remoteVer)?(n&&this._callbacks.push(n=>{n?t(!0!==n?n:new Error(`Unable to bind to ${e}`)):(this._forwardingUnix[e]=!0,t())}),this._protocol.openssh_streamLocalForward(e,n),this):n?(process.nextTick(t,new Error("strictVendor enabled and server is not OpenSSH or compatible version")),this):this}openssh_unforwardInStreamLocal(e,t){if(!this._sock||!z(this._sock))throw new Error("Not connected");const n="function"==typeof t;return!this.config.strictVendor||this.config.strictVendor&&V.test(this._remoteVer)?(n&&this._callbacks.push(n=>{n?t(!0!==n?n:new Error(`Unable to unbind from ${e}`)):(delete this._forwardingUnix[e],t())}),this._protocol.openssh_cancelStreamLocalForward(e,n),this):n?(process.nextTick(t,new Error("strictVendor enabled and server is not OpenSSH or compatible version")),this):this}openssh_forwardOutStreamLocal(e,t){if(!this._sock||!z(this._sock))throw new Error("Not connected");return"function"!=typeof t&&(t=X),!this.config.strictVendor||this.config.strictVendor&&V.test(this._remoteVer)?(J(this,"direct-streamlocal@openssh.com",{socketPath:e},t),this):(process.nextTick(t,new Error("strictVendor enabled and server is not OpenSSH or compatible version")),this)}sftp(e){if(!this._sock||!z(this._sock))throw new Error("Not connected");return J(this,"sftp",(t,n)=>{t?e(t):re(n,"sftp",(t,r)=>{function i(){n.removeListener("ready",s),n.removeListener("error",o),n.removeListener("exit",a),n.removeListener("close",a)}function s(){i(),e(void 0,n)}function o(t){i(),e(t)}function a(t,n){let r;i(),r="number"==typeof t?`Received exit code ${t} while establishing SFTP session`:void 0!==n?`Received signal ${n} while establishing SFTP session`:"Received unexpected SFTP session termination";const s=new Error(r);s.code=t,s.signal=n,e(s)}t?e(t):(n.on("ready",s).on("error",o).on("exit",a).on("close",a),n._init())})}),this}setNoDelay(e){return this._sock&&"function"==typeof this._sock.setNoDelay&&this._sock.setNoDelay(e),this}}},6825(e,t,n){"use strict";const{Agent:r}=n(8611),{Agent:i}=n(5692),{connect:s}=n(4756);let o;for(const e of[r,i]){class i extends e{constructor(e,t){super(t),this._connectCfg=e,this._defaultSrcIP=t&&t.srcIP||"localhost"}createConnection(t,r){const i=t&&t.localAddress||this._defaultSrcIP,s=t&&t.localPort||0,a=t.host,l=t.port;void 0===o&&(o=n(2217));const h=new o;let u=!1;h.on("ready",()=>{h.forwardOut(i,s,a,l,(n,i)=>{if(u=!0,n)return h.end(),r(n);i.once("close",()=>h.end()),r(null,c(i,e,t))})}).on("error",r).on("close",()=>{u||r(new Error("Unexpected connection close"))}).connect(this._connectCfg)}}t[e===r?"SSHTTPAgent":"SSHTTPSAgent"]=i}function a(){}function c(e,t,n){if(t===r)return e.setKeepAlive=a,e.setNoDelay=a,e.setTimeout=a,e.ref=a,e.unref=a,e.destroySoon=e.destroy,e;n.socket=e;const i=s(n),o=(()=>{let t=!1;return()=>{t||(t=!0,e.isPaused()&&e.resume())}})();return i.on("end",o).on("close",o),i}},9472(e,t,n){"use strict";const{AgentProtocol:r,BaseAgent:i,createAgent:s,CygwinAgent:o,OpenSSHAgent:a,PageantAgent:c}=n(3513),{SSHTTPAgent:l,SSHTTPSAgent:h}=n(6825),{parseKey:u}=n(541),{flagsToString:d,OPEN_MODE:f,STATUS_CODE:p,stringToFlags:g}=n(7764);e.exports={AgentProtocol:r,BaseAgent:i,createAgent:s,Client:n(2217),CygwinAgent:o,HTTPAgent:l,HTTPSAgent:h,OpenSSHAgent:a,PageantAgent:c,Server:n(8637),utils:{parseKey:u,...n(7873),sftp:{flagsToString:d,OPEN_MODE:f,STATUS_CODE:p,stringToFlags:g}}}},7873(e,t,n){"use strict";const{createCipheriv:r,generateKeyPair:i,generateKeyPairSync:s,getCurves:o,randomBytes:a}=n(6982),{Ber:c}=n(3100),l=n(4015).pbkdf,{CIPHER_INFO:h}=n(7064),u=o(),d=new Map(Object.entries(h));function f(e,t){if("string"!=typeof e)throw new TypeError("Key type must be a string");const n={type:"spki",format:"der"},r={type:"pkcs8",format:"der"};switch(e.toLowerCase()){case"rsa":{if("object"!=typeof t||null===t)throw new TypeError("Missing options object for RSA key");const e=t.bits;if(!Number.isInteger(e))throw new TypeError("RSA bits must be an integer");if(e<=0||e>16384)throw new RangeError("RSA bits must be non-zero and <= 16384");return["rsa",{modulusLength:e,publicKeyEncoding:n,privateKeyEncoding:r}]}case"ecdsa":{if("object"!=typeof t||null===t)throw new TypeError("Missing options object for ECDSA key");if(!Number.isInteger(t.bits))throw new TypeError("ECDSA bits must be an integer");let e;switch(t.bits){case 256:e="prime256v1";break;case 384:e="secp384r1";break;case 521:e="secp521r1";break;default:throw new Error("ECDSA bits must be 256, 384, or 521")}if(!u.includes(e))throw new Error("Unsupported ECDSA bits value");return["ec",{namedCurve:e,publicKeyEncoding:n,privateKeyEncoding:r}]}case"ed25519":return["ed25519",{publicKeyEncoding:n,privateKeyEncoding:r}];default:throw new Error(`Unsupported key type: ${e}`)}}function p(e,t,n,i){let s,o="new",h="";if("object"==typeof i&&null!==i&&("string"==typeof i.comment&&i.comment&&(h=i.comment),"string"==typeof i.format&&i.format&&(o=i.format),i.passphrase)){let e;if("string"==typeof i.passphrase)e=Buffer.from(i.passphrase);else{if(!Buffer.isBuffer(i.passphrase))throw new Error("Invalid passphrase");e=i.passphrase}if(void 0===i.cipher)throw new Error("Missing cipher name");const t=d.get(i.cipher);if(void 0===t)throw new Error("Invalid cipher name");if("new"===o){let n=16;if(void 0!==i.rounds){if(!Number.isInteger(i.rounds))throw new TypeError("rounds must be an integer");i.rounds>0&&(n=i.rounds)}const r=Buffer.allocUnsafe(t.keyLen+t.ivLen),o=a(16);if(0!==l(e,e.length,o,o.length,r,r.length,n))return new Error("Failed to generate information to encrypt key");const c=Buffer.allocUnsafe(4+o.length+4);{let e=0;c.writeUInt32BE(o.length,e+=0),c.set(o,e+=4),c.writeUInt32BE(n,e+=o.length)}s={cipher:t,cipherName:i.cipher,kdfName:"bcrypt",kdfOptions:c,key:r.slice(0,t.keyLen),iv:r.slice(t.keyLen)}}}if("new"===o){let i,o="-----BEGIN OPENSSH PRIVATE KEY-----\n";const l=Buffer.from(s?s.cipherName:"none"),u=Buffer.from(s?s.kdfName:"none"),d=s?s.kdfOptions:Buffer.alloc(0),f=s?s.cipher.blockLen:8,p=function(e,t,n){switch(e){case"rsa":{let e=new c.Reader(n);if(e.readSequence(),0!==e.readInt())throw new Error("Unsupported version in RSA private key");if(e.readSequence(),"1.2.840.113549.1.1.1"!==e.readOID())throw new Error("Bad RSA private OID");if(e.readByte()!==c.Null)throw new Error("Malformed RSA private key (expected null)");if(0!==e.readByte())throw new Error("Malformed RSA private key (expected zero-length null)");if(e=new c.Reader(e.readString(c.OctetString,!0)),e.readSequence(),0!==e.readInt())throw new Error("Unsupported version in RSA private key");const t=e.readString(c.Integer,!0),r=e.readString(c.Integer,!0),i=e.readString(c.Integer,!0),s=e.readString(c.Integer,!0),o=e.readString(c.Integer,!0);e.readString(c.Integer,!0),e.readString(c.Integer,!0);const a=e.readString(c.Integer,!0),l=Buffer.from("ssh-rsa"),h=Buffer.allocUnsafe(4+l.length+4+t.length+4+r.length+4+i.length+4+a.length+4+s.length+4+o.length);let u=0;h.writeUInt32BE(l.length,u+=0),h.set(l,u+=4),h.writeUInt32BE(t.length,u+=l.length),h.set(t,u+=4),h.writeUInt32BE(r.length,u+=t.length),h.set(r,u+=4),h.writeUInt32BE(i.length,u+=r.length),h.set(i,u+=4),h.writeUInt32BE(a.length,u+=i.length),h.set(a,u+=4),h.writeUInt32BE(s.length,u+=a.length),h.set(s,u+=4),h.writeUInt32BE(o.length,u+=s.length),h.set(o,u+=4);const d=Buffer.allocUnsafe(4+l.length+4+r.length+4+t.length);return u=0,d.writeUInt32BE(l.length,u+=0),d.set(l,u+=4),d.writeUInt32BE(r.length,u+=l.length),d.set(r,u+=4),d.writeUInt32BE(t.length,u+=r.length),d.set(t,u+=4),{sshName:l.toString(),priv:h,pub:d}}case"ec":{let e=new c.Reader(t);if(e.readSequence(),e.readSequence(),"1.2.840.10045.2.1"!==e.readOID())throw new Error("Bad ECDSA public OID");e.readOID();let r,i=e.readString(c.BitString,!0);{let e=0;for(;e<i.length&&0===i[e];++e);e>0&&(i=i.slice(e))}if(e=new c.Reader(n),e.readSequence(),0!==e.readInt())throw new Error("Unsupported version in ECDSA private key");if(e.readSequence(),"1.2.840.10045.2.1"!==e.readOID())throw new Error("Bad ECDSA private OID");switch(e.readOID()){case"1.2.840.10045.3.1.7":r="nistp256";break;case"1.3.132.0.34":r="nistp384";break;case"1.3.132.0.35":r="nistp521";break;default:throw new Error("Unsupported curve in ECDSA private key")}if(e=new c.Reader(e.readString(c.OctetString,!0)),e.readSequence(),1!==e.readInt())throw new Error("Unsupported version in ECDSA private key");const s=Buffer.concat([Buffer.from([0]),e.readString(c.OctetString,!0)]),o=Buffer.from(`ecdsa-sha2-${r}`);r=Buffer.from(r);const a=Buffer.allocUnsafe(4+o.length+4+r.length+4+i.length+4+s.length);let l=0;a.writeUInt32BE(o.length,l+=0),a.set(o,l+=4),a.writeUInt32BE(r.length,l+=o.length),a.set(r,l+=4),a.writeUInt32BE(i.length,l+=r.length),a.set(i,l+=4),a.writeUInt32BE(s.length,l+=i.length),a.set(s,l+=4);const h=Buffer.allocUnsafe(4+o.length+4+r.length+4+i.length);return l=0,h.writeUInt32BE(o.length,l+=0),h.set(o,l+=4),h.writeUInt32BE(r.length,l+=o.length),h.set(r,l+=4),h.writeUInt32BE(i.length,l+=r.length),h.set(i,l+=4),{sshName:o.toString(),priv:a,pub:h}}case"ed25519":{let e=new c.Reader(t);if(e.readSequence(),e.readSequence(),"1.3.101.112"!==e.readOID())throw new Error("Bad ED25519 public OID");let r=e.readString(c.BitString,!0);{let e=0;for(;e<r.length&&0===r[e];++e);e>0&&(r=r.slice(e))}if(e=new c.Reader(n),e.readSequence(),0!==e.readInt())throw new Error("Unsupported version in ED25519 private key");if(e.readSequence(),"1.3.101.112"!==e.readOID())throw new Error("Bad ED25519 private OID");e=new c.Reader(e.readString(c.OctetString,!0));const i=e.readString(c.OctetString,!0),s=Buffer.from("ssh-ed25519"),o=Buffer.allocUnsafe(4+s.length+4+r.length+4+(i.length+r.length));let a=0;o.writeUInt32BE(s.length,a+=0),o.set(s,a+=4),o.writeUInt32BE(r.length,a+=s.length),o.set(r,a+=4),o.writeUInt32BE(i.length+r.length,a+=r.length),o.set(i,a+=4),o.set(r,a+=i.length);const l=Buffer.allocUnsafe(4+s.length+4+r.length);return a=0,l.writeUInt32BE(s.length,a+=0),l.set(s,a+=4),l.writeUInt32BE(r.length,a+=s.length),l.set(r,a+=4),{sshName:s.toString(),priv:o,pub:l}}}}(e,t,n),g=a(4),m=Buffer.from(h),_=8+p.priv.length+4+m.length;let y=[];for(let e=1;(_+y.length)%f;++e)y.push(255&e);y=Buffer.from(y);let v,b=Buffer.allocUnsafe(_+y.length);{let e=0;b.set(g,e+=0),b.set(g,e+=4),b.set(p.priv,e+=4),b.writeUInt32BE(m.length,e+=p.priv.length),b.set(m,e+=4),b.set(y,e+=m.length)}if(s){const e={authTagLength:s.cipher.authLen},t=r(s.cipher.sslName,s.key,s.iv,e);t.setAutoPadding(!1),b=Buffer.concat([t.update(b),t.final()]),v=s.cipher.authLen>0?t.getAuthTag():Buffer.alloc(0),s.key.fill(0),s.iv.fill(0)}else v=Buffer.alloc(0);const E=Buffer.from("openssh-key-v1\0"),A=Buffer.allocUnsafe(E.length+4+l.length+4+u.length+4+d.length+4+4+p.pub.length+4+b.length+v.length);{let e=0;A.set(E,e+=0),A.writeUInt32BE(l.length,e+=E.length),A.set(l,e+=4),A.writeUInt32BE(u.length,e+=l.length),A.set(u,e+=4),A.writeUInt32BE(d.length,e+=u.length),A.set(d,e+=4),A.writeUInt32BE(1,e+=d.length),A.writeUInt32BE(p.pub.length,e+=4),A.set(p.pub,e+=4),A.writeUInt32BE(b.length,e+=p.pub.length),A.set(b,e+=4),A.set(v,e+=b.length)}{const e=A.base64Slice(0,A.length);let t=e.replace(/.{64}/g,"$&\n");63&e.length&&(t+="\n"),o+=t}{const e=p.pub.base64Slice(0,p.pub.length);i=`${p.sshName} ${e}${h?` ${h}`:""}`}return o+="-----END OPENSSH PRIVATE KEY-----\n",{private:o,public:i}}throw new Error("Invalid output key format")}function g(){}e.exports={generateKeyPair:(e,t,n)=>{"function"==typeof t&&(n=t,t=void 0),"function"!=typeof n&&(n=g);const r=f(e,t);i(...r,(e,i,s)=>{if(e)return n(e);let o;try{o=p(r[0],i,s,t)}catch(e){return n(e)}n(null,o)})},generateKeyPairSync:(e,t)=>{const n=f(e,t),{publicKey:r,privateKey:i}=s(...n);return p(n[0],r,i,t)}}},7265(e,t,n){"use strict";const{inspect:r}=n(9023),{bindingAvailable:i,NullCipher:s,NullDecipher:o}=n(7064),{COMPAT_CHECKS:a,DISCONNECT_REASON:c,eddsaSupported:l,MESSAGE:h,SIGNALS:u,TERMINAL_MODE:d}=n(8692),{DEFAULT_KEXINIT_CLIENT:f,DEFAULT_KEXINIT_SERVER:p,KexInit:g,kexinit:m,onKEXPayload:_}=n(3645),{parseKey:y}=n(541),v=n(588),{bufferCopy:b,bufferFill:E,bufferSlice:A,convertSignature:S,sendPacket:w,writeUInt32BE:C}=n(9576),{PacketReader:I,PacketWriter:k,ZlibPacketReader:T,ZlibPacketWriter:R}=n(5696),O=n(7191).rE,N=new Map(Object.values(c).map(e=>[e,1])),P=Buffer.from(`SSH-2.0-ssh2js${O}`),B=Buffer.from(`${P}\r\n`),L=Buffer.from([h.GLOBAL_REQUEST,0,0,0,21,107,101,101,112,97,108,105,118,101,64,111,112,101,110,115,115,104,46,99,111,109,1]),x=Buffer.from([d.TTY_OP_END]);function D(){}const M=/^SSH-(2\.0|1\.99)-([^ ]+)(?: (.*))?$/;function U(e,t,n){let i,s;this._buffer?(i=Buffer.allocUnsafe(this._buffer.length+(n-t)),i.set(this._buffer,0),0===t?i.set(e,this._buffer.length):i.set(new Uint8Array(e.buffer,e.byteOffset+t,n-t),this._buffer.length),s=this._buffer.length,t=0):(i=e,s=0);const a=t;let c=t,l=t,h=!1,u=0,d=0;for(;t<i.length;++t){const e=i[t];if(13!==e){if(10===e){if(l>c&&l-c>4&&83===i[c]&&83===i[c+1]&&72===i[c+2]&&45===i[c+3]){const e=i.latin1Slice(a,l+1),h=c===a?e:e.slice(c-a),u=M.exec(h);if(!u)throw new Error("Invalid identification string");const d={greeting:c===a?"":e.slice(0,c-a),identRaw:h,versions:{protocol:u[1],software:u[2]},comments:u[3]};return this._remoteIdentRaw=Buffer.from(h),this._debug&&this._debug(`Remote ident: ${r(h)}`),this._compatFlags=j(d),this._buffer=void 0,this._decipher=new o(0,_.bind(this,{firstPacket:!0})),this._parse=F,this._onHeader(d),this._destruct?(m(this),t+1-s):n}if(this._server)throw new Error("Greetings from clients not permitted");if(++d>1024)throw new Error("Max greeting lines exceeded");h=!1,c=t+1,u=0}else{if(h)throw new Error("Invalid header: expected newline");if(++u>=8192)throw new Error("Header line too long")}l=t}else h=!0}return this._buffer||(this._buffer=A(i,a)),t-s}function F(e,t,n){return this._decipher.decrypt(e,t,n)}function H(e){if(this._onPacket(),0===e.length)return void(this._debug&&this._debug("Inbound: Skipping empty packet payload"));const t=(e=this._packetRW.read.read(e))[0];t!==h.USERAUTH_SUCCESS||this._server||this._authenticated||(this._authenticated=!0,"zlib@openssh.com"===this._kex.negotiated.cs.compress&&(this._packetRW.write=new R(this)),"zlib@openssh.com"===this._kex.negotiated.sc.compress&&(this._packetRW.read=new T));const n=v[t];if(void 0!==n)return n(this,e);this._debug&&this._debug(`Inbound: Unsupported message type: ${t}`)}function j(e){const t=e.versions.software;let n=0;for(const e of a)"string"==typeof e[0]?t===e[0]&&(n|=e[1]):e[0].test(t)&&(n|=e[1]);return n}e.exports=class{constructor(e){const t=e.onWrite;if("function"!=typeof t)throw new Error("Missing onWrite function");this._onWrite=e=>{t(e)};const n=e.onError;if("function"!=typeof n)throw new Error("Missing onError function");this._onError=e=>{n(e)};const o=e.debug;this._debug="function"==typeof o?e=>{o(e)}:void 0;const a=e.onHeader;this._onHeader="function"==typeof a?(...e)=>{a(...e)}:D;const c=e.onPacket;this._onPacket="function"==typeof c?()=>{c()}:D;let u,d=e.onHandshakeComplete;"function"!=typeof d&&(d=D),this._onHandshakeComplete=(...e)=>{this._debug&&this._debug("Handshake completed"),u=void 0===u;const t=this._queue;if(t){this._queue=void 0,this._debug&&this._debug(`Draining outbound queue (${t.length}) ...`);for(let e=0;e<t.length;++e){const n=t[e];let r=this._packetRW.write.finalize(n);if(r===n){const e=this._cipher.allocPacket(n.length);e.set(n,5),r=e}w(this,r)}this._debug&&this._debug("... finished draining outbound queue")}u&&this._server&&this._kex.remoteExtInfoEnabled&&function(e){let t="ecdsa-sha2-nistp256,ecdsa-sha2-nistp384,ecdsa-sha2-nistp521rsa-sha2-512,rsa-sha2-256,ssh-rsa,ssh-dss";l&&(t=`ssh-ed25519,${t}`);const n=Buffer.byteLength(t);let r=e._packetRW.write.allocStart;const i=e._packetRW.write.alloc(28+n);i[r]=h.EXT_INFO,C(i,1,++r),C(i,15,r+=4),i.utf8Write("server-sig-algs",r+=4,15),C(i,n,r+=15),i.utf8Write(t,r+=4,n),e._debug&&e._debug("Outbound: Sending EXT_INFO"),w(e,e._packetRW.write.finalize(i))}(this),d(...e)},this._queue=void 0;const m=e.messageHandlers;let _;if(this._handlers="object"==typeof m&&null!==m?m:{},this._onPayload=H.bind(this),this._server=!!e.server,this._banner=void 0,this._server){if("object"!=typeof e.hostKeys||null===e.hostKeys)throw new Error("Missing server host key(s)");this._hostKeys=e.hostKeys,"string"==typeof e.greeting&&e.greeting.length&&(_="\r\n"===e.greeting.slice(-2)?e.greeting:`${e.greeting}\r\n`),"string"==typeof e.banner&&e.banner.length&&(this._banner="\r\n"===e.banner.slice(-2)?e.banner:`${e.banner}\r\n`)}else this._hostKeys=void 0;let y,v=e.offer;if("object"!=typeof v||null===v?v=this._server?p:f:v.constructor!==g&&(this._server?v.kex=v.kex.concat(["kex-strict-s-v00@openssh.com"]):v.kex=v.kex.concat(["ext-info-c","kex-strict-c-v00@openssh.com"]),v=new g(v)),this._kex=void 0,this._strictMode=void 0,this._kexinit=void 0,this._offer=v,this._cipher=new s(0,this._onWrite),this._decipher=void 0,this._skipNextInboundPacket=!1,this._packetRW={read:new I,write:new k(this)},this._hostVerifier=this._server||"function"!=typeof e.hostVerifier?void 0:e.hostVerifier,this._parse=U,this._buffer=void 0,this._authsQueue=[],this._authenticated=!1,this._remoteIdentRaw=void 0,"string"==typeof e.ident)this._identRaw=Buffer.from(`SSH-2.0-${e.ident}`),y=Buffer.allocUnsafe(this._identRaw.length+2),y.set(this._identRaw,0),y[y.length-2]=13,y[y.length-1]=10;else if(Buffer.isBuffer(e.ident)){const t=Buffer.allocUnsafe(8+e.ident.length);t.latin1Write("SSH-2.0-",0,8),t.set(e.ident,8),this._identRaw=t,y=Buffer.allocUnsafe(t.length+2),y.set(t,0),y[y.length-2]=13,y[y.length-1]=10}else this._identRaw=P,y=B;this._compatFlags=0,this._debug&&(i?this._debug("Custom crypto binding available"):this._debug("Custom crypto binding not available")),this._debug&&this._debug(`Local ident: ${r(this._identRaw.toString())}`),this.start=()=>{this.start=void 0,_&&this._onWrite(_),this._onWrite(y)}}_destruct(e){this._packetRW.read.cleanup(),this._packetRW.write.cleanup(),this._cipher&&this._cipher.free(),this._decipher&&this._decipher.free(),"string"==typeof e&&0!==e.length||(e="fatal error"),this.parse=()=>{throw new Error(`Instance unusable after ${e}`)},this._onWrite=()=>{throw new Error(`Instance unusable after ${e}`)},this._destruct=void 0}cleanup(){this._destruct&&this._destruct()}parse(e,t,n){for(;t<n;)t=this._parse(e,t,n)}disconnect(e){let t=this._packetRW.write.allocStartKEX;const n=this._packetRW.write.alloc(13,!0),r=t+13;N.has(e)||(e=c.PROTOCOL_ERROR),n[t]=h.DISCONNECT,C(n,e,++t),n.fill(0,t+=4,r),this._debug&&this._debug(`Outbound: Sending DISCONNECT (${e})`),w(this,this._packetRW.write.finalize(n,!0),!0)}ping(){const e=this._packetRW.write.allocStart,t=this._packetRW.write.alloc(L.length);t.set(L,e),this._debug&&this._debug("Outbound: Sending ping (GLOBAL_REQUEST: keepalive@openssh.com)"),w(this,this._packetRW.write.finalize(t))}rekey(){void 0===this._kexinit?(this._debug&&this._debug("Outbound: Initiated explicit rekey"),this._queue=[],m(this)):this._debug&&this._debug("Outbound: Ignoring rekey during handshake")}requestSuccess(e){let t,n=this._packetRW.write.allocStart;Buffer.isBuffer(e)?(t=this._packetRW.write.alloc(1+e.length),t[n]=h.REQUEST_SUCCESS,t.set(e,++n)):(t=this._packetRW.write.alloc(1),t[n]=h.REQUEST_SUCCESS),this._debug&&this._debug("Outbound: Sending REQUEST_SUCCESS"),w(this,this._packetRW.write.finalize(t))}requestFailure(){const e=this._packetRW.write.allocStart,t=this._packetRW.write.alloc(1);t[e]=h.REQUEST_FAILURE,this._debug&&this._debug("Outbound: Sending REQUEST_FAILURE"),w(this,this._packetRW.write.finalize(t))}channelSuccess(e){let t=this._packetRW.write.allocStart;const n=this._packetRW.write.alloc(5);n[t]=h.CHANNEL_SUCCESS,C(n,e,++t),this._debug&&this._debug(`Outbound: Sending CHANNEL_SUCCESS (r:${e})`),w(this,this._packetRW.write.finalize(n))}channelFailure(e){let t=this._packetRW.write.allocStart;const n=this._packetRW.write.alloc(5);n[t]=h.CHANNEL_FAILURE,C(n,e,++t),this._debug&&this._debug(`Outbound: Sending CHANNEL_FAILURE (r:${e})`),w(this,this._packetRW.write.finalize(n))}channelEOF(e){let t=this._packetRW.write.allocStart;const n=this._packetRW.write.alloc(5);n[t]=h.CHANNEL_EOF,C(n,e,++t),this._debug&&this._debug(`Outbound: Sending CHANNEL_EOF (r:${e})`),w(this,this._packetRW.write.finalize(n))}channelClose(e){let t=this._packetRW.write.allocStart;const n=this._packetRW.write.alloc(5);n[t]=h.CHANNEL_CLOSE,C(n,e,++t),this._debug&&this._debug(`Outbound: Sending CHANNEL_CLOSE (r:${e})`),w(this,this._packetRW.write.finalize(n))}channelWindowAdjust(e,t){let n=this._packetRW.write.allocStart;const r=this._packetRW.write.alloc(9);r[n]=h.CHANNEL_WINDOW_ADJUST,C(r,e,++n),C(r,t,n+=4),this._debug&&this._debug(`Outbound: Sending CHANNEL_WINDOW_ADJUST (r:${e}, ${t})`),w(this,this._packetRW.write.finalize(r))}channelData(e,t){const n=Buffer.isBuffer(t),r=n?t.length:Buffer.byteLength(t);let i=this._packetRW.write.allocStart;const s=this._packetRW.write.alloc(9+r);s[i]=h.CHANNEL_DATA,C(s,e,++i),C(s,r,i+=4),n?s.set(t,i+=4):s.utf8Write(t,i+=4,r),this._debug&&this._debug(`Outbound: Sending CHANNEL_DATA (r:${e}, ${r})`),w(this,this._packetRW.write.finalize(s))}channelExtData(e,t,n){const r=Buffer.isBuffer(t),i=r?t.length:Buffer.byteLength(t);let s=this._packetRW.write.allocStart;const o=this._packetRW.write.alloc(13+i);o[s]=h.CHANNEL_EXTENDED_DATA,C(o,e,++s),C(o,n,s+=4),C(o,i,s+=4),r?o.set(t,s+=4):o.utf8Write(t,s+=4,i),this._debug&&this._debug(`Outbound: Sending CHANNEL_EXTENDED_DATA (r:${e})`),w(this,this._packetRW.write.finalize(o))}channelOpenConfirm(e,t,n,r){let i=this._packetRW.write.allocStart;const s=this._packetRW.write.alloc(17);s[i]=h.CHANNEL_OPEN_CONFIRMATION,C(s,e,++i),C(s,t,i+=4),C(s,n,i+=4),C(s,r,i+=4),this._debug&&this._debug(`Outbound: Sending CHANNEL_OPEN_CONFIRMATION (r:${e}, l:${t})`),w(this,this._packetRW.write.finalize(s))}channelOpenFail(e,t,n){"string"!=typeof n&&(n="");const r=Buffer.byteLength(n);let i=this._packetRW.write.allocStart;const s=this._packetRW.write.alloc(13+r+4);s[i]=h.CHANNEL_OPEN_FAILURE,C(s,e,++i),C(s,t,i+=4),C(s,r,i+=4),i+=4,r&&(s.utf8Write(n,i,r),i+=r),C(s,0,i),this._debug&&this._debug(`Outbound: Sending CHANNEL_OPEN_FAILURE (r:${e})`),w(this,this._packetRW.write.finalize(s))}service(e){if(this._server)throw new Error("Client-only method called in server mode");const t=Buffer.byteLength(e);let n=this._packetRW.write.allocStart;const r=this._packetRW.write.alloc(5+t);r[n]=h.SERVICE_REQUEST,C(r,t,++n),r.utf8Write(e,n+=4,t),this._debug&&this._debug(`Outbound: Sending SERVICE_REQUEST (${e})`),w(this,this._packetRW.write.finalize(r))}authPassword(e,t,n){if(this._server)throw new Error("Client-only method called in server mode");const r=Buffer.byteLength(e),i=Buffer.byteLength(t),s=n?Buffer.byteLength(n):0;let o=this._packetRW.write.allocStart;const a=this._packetRW.write.alloc(5+r+4+14+4+8+1+4+i+(n?4+s:0));a[o]=h.USERAUTH_REQUEST,C(a,r,++o),a.utf8Write(e,o+=4,r),C(a,14,o+=r),a.utf8Write("ssh-connection",o+=4,14),C(a,8,o+=14),a.utf8Write("password",o+=4,8),a[o+=8]=n?1:0,C(a,i,++o),Buffer.isBuffer(t)?b(t,a,0,i,o+=4):a.utf8Write(t,o+=4,i),n?(C(a,s,o+=i),Buffer.isBuffer(n)?b(n,a,0,s,o+=4):a.utf8Write(n,o+=4,s),this._debug&&this._debug("Outbound: Sending USERAUTH_REQUEST (changed password)")):this._debug&&this._debug("Outbound: Sending USERAUTH_REQUEST (password)"),this._authsQueue.push("password"),w(this,this._packetRW.write.finalize(a))}authPK(e,t,n,r){if(this._server)throw new Error("Client-only method called in server mode");if((t=y(t))instanceof Error)throw new Error("Invalid key");const i=t.type;t=t.getPublicSSH(),"function"==typeof n&&(r=n,n=void 0),n||(n=i);const s=Buffer.byteLength(e),o=Buffer.byteLength(n),a=t.length,c=this._kex.sessionID,l=c.length,u=(r?4+l:0)+1+4+s+4+14+4+9+1+4+o+4+a;let d,f;if(r?(d=Buffer.allocUnsafe(u),f=0,C(d,l,f),d.set(c,f+=4),f+=l):(d=this._packetRW.write.alloc(u),f=this._packetRW.write.allocStart),d[f]=h.USERAUTH_REQUEST,C(d,s,++f),d.utf8Write(e,f+=4,s),C(d,14,f+=s),d.utf8Write("ssh-connection",f+=4,14),C(d,9,f+=14),d.utf8Write("publickey",f+=4,9),d[f+=9]=r?1:0,C(d,o,++f),d.utf8Write(n,f+=4,o),C(d,a,f+=o),d.set(t,f+=4),!r)return this._authsQueue.push("publickey"),this._debug&&this._debug("Outbound: Sending USERAUTH_REQUEST (publickey -- check)"),void w(this,this._packetRW.write.finalize(d));r(d,r=>{if(!1===(r=S(r,i)))throw new Error("Error while converting handshake signature");const c=r.length;f=this._packetRW.write.allocStart,d=this._packetRW.write.alloc(5+s+4+14+4+9+1+4+o+4+a+4+4+o+4+c),d[f]=h.USERAUTH_REQUEST,C(d,s,++f),d.utf8Write(e,f+=4,s),C(d,14,f+=s),d.utf8Write("ssh-connection",f+=4,14),C(d,9,f+=14),d.utf8Write("publickey",f+=4,9),d[f+=9]=1,C(d,o,++f),d.utf8Write(n,f+=4,o),C(d,a,f+=o),d.set(t,f+=4),C(d,4+o+4+c,f+=a),C(d,o,f+=4),d.utf8Write(n,f+=4,o),C(d,c,f+=o),d.set(r,f+=4),this._authsQueue.push("publickey"),this._debug&&this._debug("Outbound: Sending USERAUTH_REQUEST (publickey)"),w(this,this._packetRW.write.finalize(d))})}authHostbased(e,t,n,r,i,s){if(this._server)throw new Error("Client-only method called in server mode");if((t=y(t))instanceof Error)throw new Error("Invalid key");const o=t.type;t=t.getPublicSSH(),"function"==typeof i&&(s=i,i=void 0),i||(i=o);const a=Buffer.byteLength(e),c=Buffer.byteLength(i),l=t.length,u=this._kex.sessionID,d=u.length,f=Buffer.byteLength(n),p=Buffer.byteLength(r),g=Buffer.allocUnsafe(4+d+1+4+a+4+14+4+9+4+c+4+l+4+f+4+p);let m=0;C(g,d,m),g.set(u,m+=4),g[m+=d]=h.USERAUTH_REQUEST,C(g,a,++m),g.utf8Write(e,m+=4,a),C(g,14,m+=a),g.utf8Write("ssh-connection",m+=4,14),C(g,9,m+=14),g.utf8Write("hostbased",m+=4,9),C(g,c,m+=9),g.utf8Write(i,m+=4,c),C(g,l,m+=c),g.set(t,m+=4),C(g,f,m+=l),g.utf8Write(n,m+=4,f),C(g,p,m+=f),g.utf8Write(r,m+=4,p),s(g,e=>{if(!(e=S(e,o)))throw new Error("Error while converting handshake signature");const t=e.length,n=g.length-d-4;m=this._packetRW.write.allocStart;const r=this._packetRW.write.alloc(n+4+4+c+4+t);b(g,r,4+d,g.length,m),C(r,4+c+4+t,m+=n),C(r,c,m+=4),r.utf8Write(i,m+=4,c),C(r,t,m+=c),r.set(e,m+=4),this._authsQueue.push("hostbased"),this._debug&&this._debug("Outbound: Sending USERAUTH_REQUEST (hostbased)"),w(this,this._packetRW.write.finalize(r))})}authKeyboard(e){if(this._server)throw new Error("Client-only method called in server mode");const t=Buffer.byteLength(e);let n=this._packetRW.write.allocStart;const r=this._packetRW.write.alloc(5+t+4+14+4+20+4+4);r[n]=h.USERAUTH_REQUEST,C(r,t,++n),r.utf8Write(e,n+=4,t),C(r,14,n+=t),r.utf8Write("ssh-connection",n+=4,14),C(r,20,n+=14),r.utf8Write("keyboard-interactive",n+=4,20),C(r,0,n+=20),C(r,0,n+=4),this._authsQueue.push("keyboard-interactive"),this._debug&&this._debug("Outbound: Sending USERAUTH_REQUEST (keyboard-interactive)"),w(this,this._packetRW.write.finalize(r))}authNone(e){if(this._server)throw new Error("Client-only method called in server mode");const t=Buffer.byteLength(e);let n=this._packetRW.write.allocStart;const r=this._packetRW.write.alloc(5+t+4+14+4+4);r[n]=h.USERAUTH_REQUEST,C(r,t,++n),r.utf8Write(e,n+=4,t),C(r,14,n+=t),r.utf8Write("ssh-connection",n+=4,14),C(r,4,n+=14),r.utf8Write("none",n+=4,4),this._authsQueue.push("none"),this._debug&&this._debug("Outbound: Sending USERAUTH_REQUEST (none)"),w(this,this._packetRW.write.finalize(r))}authInfoRes(e){if(this._server)throw new Error("Client-only method called in server mode");let t,n=0;if(e){t=new Array(e.length);for(let r=0;r<e.length;++r){const i=Buffer.byteLength(e[r]);t[r]=i,n+=4+i}}let r=this._packetRW.write.allocStart;const i=this._packetRW.write.alloc(5+n);if(i[r]=h.USERAUTH_INFO_RESPONSE,e){C(i,e.length,++r),r+=4;for(let n=0;n<e.length;++n){const s=t[n];C(i,s,r),r+=4,s&&(i.utf8Write(e[n],r,s),r+=s)}}else C(i,0,++r);this._debug&&this._debug("Outbound: Sending USERAUTH_INFO_RESPONSE"),w(this,this._packetRW.write.finalize(i))}tcpipForward(e,t,n){if(this._server)throw new Error("Client-only method called in server mode");const r=Buffer.byteLength(e);let i=this._packetRW.write.allocStart;const s=this._packetRW.write.alloc(23+r+4);s[i]=h.GLOBAL_REQUEST,C(s,13,++i),s.utf8Write("tcpip-forward",i+=4,13),s[i+=13]=void 0===n||!0===n?1:0,C(s,r,++i),s.utf8Write(e,i+=4,r),C(s,t,i+=r),this._debug&&this._debug("Outbound: Sending GLOBAL_REQUEST (tcpip-forward)"),w(this,this._packetRW.write.finalize(s))}cancelTcpipForward(e,t,n){if(this._server)throw new Error("Client-only method called in server mode");const r=Buffer.byteLength(e);let i=this._packetRW.write.allocStart;const s=this._packetRW.write.alloc(30+r+4);s[i]=h.GLOBAL_REQUEST,C(s,20,++i),s.utf8Write("cancel-tcpip-forward",i+=4,20),s[i+=20]=void 0===n||!0===n?1:0,C(s,r,++i),s.utf8Write(e,i+=4,r),C(s,t,i+=r),this._debug&&this._debug("Outbound: Sending GLOBAL_REQUEST (cancel-tcpip-forward)"),w(this,this._packetRW.write.finalize(s))}openssh_streamLocalForward(e,t){if(this._server)throw new Error("Client-only method called in server mode");const n=Buffer.byteLength(e);let r=this._packetRW.write.allocStart;const i=this._packetRW.write.alloc(41+n);i[r]=h.GLOBAL_REQUEST,C(i,31,++r),i.utf8Write("streamlocal-forward@openssh.com",r+=4,31),i[r+=31]=void 0===t||!0===t?1:0,C(i,n,++r),i.utf8Write(e,r+=4,n),this._debug&&this._debug("Outbound: Sending GLOBAL_REQUEST (streamlocal-forward@openssh.com)"),w(this,this._packetRW.write.finalize(i))}openssh_cancelStreamLocalForward(e,t){if(this._server)throw new Error("Client-only method called in server mode");const n=Buffer.byteLength(e);let r=this._packetRW.write.allocStart;const i=this._packetRW.write.alloc(48+n);i[r]=h.GLOBAL_REQUEST,C(i,38,++r),i.utf8Write("cancel-streamlocal-forward@openssh.com",r+=4,38),i[r+=38]=void 0===t||!0===t?1:0,C(i,n,++r),i.utf8Write(e,r+=4,n),this._debug&&this._debug("Outbound: Sending GLOBAL_REQUEST (cancel-streamlocal-forward@openssh.com)"),w(this,this._packetRW.write.finalize(i))}directTcpip(e,t,n,r){if(this._server)throw new Error("Client-only method called in server mode");const i=Buffer.byteLength(r.srcIP),s=Buffer.byteLength(r.dstIP);let o=this._packetRW.write.allocStart;const a=this._packetRW.write.alloc(33+i+4+4+s+4);a[o]=h.CHANNEL_OPEN,C(a,12,++o),a.utf8Write("direct-tcpip",o+=4,12),C(a,e,o+=12),C(a,t,o+=4),C(a,n,o+=4),C(a,s,o+=4),a.utf8Write(r.dstIP,o+=4,s),C(a,r.dstPort,o+=s),C(a,i,o+=4),a.utf8Write(r.srcIP,o+=4,i),C(a,r.srcPort,o+=i),this._debug&&this._debug(`Outbound: Sending CHANNEL_OPEN (r:${e}, direct-tcpip)`),w(this,this._packetRW.write.finalize(a))}openssh_directStreamLocal(e,t,n,r){if(this._server)throw new Error("Client-only method called in server mode");const i=Buffer.byteLength(r.socketPath);let s=this._packetRW.write.allocStart;const o=this._packetRW.write.alloc(51+i+4+4);o[s]=h.CHANNEL_OPEN,C(o,30,++s),o.utf8Write("direct-streamlocal@openssh.com",s+=4,30),C(o,e,s+=30),C(o,t,s+=4),C(o,n,s+=4),C(o,i,s+=4),o.utf8Write(r.socketPath,s+=4,i),E(o,0,s+=i,s+8),this._debug&&this._debug(`Outbound: Sending CHANNEL_OPEN (r:${e}, direct-streamlocal@openssh.com)`),w(this,this._packetRW.write.finalize(o))}openssh_noMoreSessions(e){if(this._server)throw new Error("Client-only method called in server mode");let t=this._packetRW.write.allocStart;const n=this._packetRW.write.alloc(34);n[t]=h.GLOBAL_REQUEST,C(n,28,++t),n.utf8Write("no-more-sessions@openssh.com",t+=4,28),n[t+=28]=void 0===e||!0===e?1:0,this._debug&&this._debug("Outbound: Sending GLOBAL_REQUEST (no-more-sessions@openssh.com)"),w(this,this._packetRW.write.finalize(n))}session(e,t,n){if(this._server)throw new Error("Client-only method called in server mode");let r=this._packetRW.write.allocStart;const i=this._packetRW.write.alloc(24);i[r]=h.CHANNEL_OPEN,C(i,7,++r),i.utf8Write("session",r+=4,7),C(i,e,r+=7),C(i,t,r+=4),C(i,n,r+=4),this._debug&&this._debug(`Outbound: Sending CHANNEL_OPEN (r:${e}, session)`),w(this,this._packetRW.write.finalize(i))}windowChange(e,t,n,r,i){if(this._server)throw new Error("Client-only method called in server mode");let s=this._packetRW.write.allocStart;const o=this._packetRW.write.alloc(39);o[s]=h.CHANNEL_REQUEST,C(o,e,++s),C(o,13,s+=4),o.utf8Write("window-change",s+=4,13),o[s+=13]=0,C(o,n,++s),C(o,t,s+=4),C(o,i,s+=4),C(o,r,s+=4),this._debug&&this._debug(`Outbound: Sending CHANNEL_REQUEST (r:${e}, window-change)`),w(this,this._packetRW.write.finalize(o))}pty(e,t,n,r,i,s,o,a){if(this._server)throw new Error("Client-only method called in server mode");s&&s.length||(s="vt100"),!o||Buffer.isBuffer(o)||Array.isArray(o)||"object"!=typeof o||null===o||(o=function(e){const t=Object.keys(e),n=Buffer.allocUnsafe(5*t.length+1);let r=0;for(let i=0;i<t.length;++i){const s=t[i];if("TTY_OP_END"===s)continue;const o=d[s];if(void 0===o)continue;const a=e[s];"number"==typeof a&&isFinite(a)&&(n[r++]=o,n[r++]=a>>>24,n[r++]=a>>>16,n[r++]=a>>>8,n[r++]=a)}return n[r++]=d.TTY_OP_END,r<n.length?A(n,0,r):n}(o)),o&&o.length||(o=x);const c=s.length,l=o.length;let u=this._packetRW.write.allocStart;const f=this._packetRW.write.alloc(21+c+4+4+4+4+4+l);if(f[u]=h.CHANNEL_REQUEST,C(f,e,++u),C(f,7,u+=4),f.utf8Write("pty-req",u+=4,7),f[u+=7]=void 0===a||!0===a?1:0,C(f,c,++u),f.utf8Write(s,u+=4,c),C(f,n,u+=c),C(f,t,u+=4),C(f,i,u+=4),C(f,r,u+=4),C(f,l,u+=4),u+=4,Array.isArray(o))for(let e=0;e<l;++e)f[u++]=o[e];else Buffer.isBuffer(o)&&f.set(o,u);this._debug&&this._debug(`Outbound: Sending CHANNEL_REQUEST (r:${e}, pty-req)`),w(this,this._packetRW.write.finalize(f))}shell(e,t){if(this._server)throw new Error("Client-only method called in server mode");let n=this._packetRW.write.allocStart;const r=this._packetRW.write.alloc(15);r[n]=h.CHANNEL_REQUEST,C(r,e,++n),C(r,5,n+=4),r.utf8Write("shell",n+=4,5),r[n+=5]=void 0===t||!0===t?1:0,this._debug&&this._debug(`Outbound: Sending CHANNEL_REQUEST (r:${e}, shell)`),w(this,this._packetRW.write.finalize(r))}exec(e,t,n){if(this._server)throw new Error("Client-only method called in server mode");const r=Buffer.isBuffer(t),i=r?t.length:Buffer.byteLength(t);let s=this._packetRW.write.allocStart;const o=this._packetRW.write.alloc(18+i);o[s]=h.CHANNEL_REQUEST,C(o,e,++s),C(o,4,s+=4),o.utf8Write("exec",s+=4,4),o[s+=4]=void 0===n||!0===n?1:0,C(o,i,++s),r?o.set(t,s+=4):o.utf8Write(t,s+=4,i),this._debug&&this._debug(`Outbound: Sending CHANNEL_REQUEST (r:${e}, exec: ${t})`),w(this,this._packetRW.write.finalize(o))}signal(e,t){if(this._server)throw new Error("Client-only method called in server mode");const n=t;if("SIG"===(t=t.toUpperCase()).slice(0,3)&&(t=t.slice(3)),1!==u[t])throw new Error(`Invalid signal: ${n}`);const r=t.length;let i=this._packetRW.write.allocStart;const s=this._packetRW.write.alloc(20+r);s[i]=h.CHANNEL_REQUEST,C(s,e,++i),C(s,6,i+=4),s.utf8Write("signal",i+=4,6),s[i+=6]=0,C(s,r,++i),s.utf8Write(t,i+=4,r),this._debug&&this._debug(`Outbound: Sending CHANNEL_REQUEST (r:${e}, signal: ${t})`),w(this,this._packetRW.write.finalize(s))}env(e,t,n,r){if(this._server)throw new Error("Client-only method called in server mode");const i=Buffer.byteLength(t),s=Buffer.isBuffer(n),o=s?n.length:Buffer.byteLength(n);let a=this._packetRW.write.allocStart;const c=this._packetRW.write.alloc(17+i+4+o);c[a]=h.CHANNEL_REQUEST,C(c,e,++a),C(c,3,a+=4),c.utf8Write("env",a+=4,3),c[a+=3]=void 0===r||!0===r?1:0,C(c,i,++a),c.utf8Write(t,a+=4,i),C(c,o,a+=i),s?c.set(n,a+=4):c.utf8Write(n,a+=4,o),this._debug&&this._debug(`Outbound: Sending CHANNEL_REQUEST (r:${e}, env: ${t}=${n})`),w(this,this._packetRW.write.finalize(c))}x11Forward(e,t,n){if(this._server)throw new Error("Client-only method called in server mode");const r=t.protocol,i=t.cookie,s=Buffer.isBuffer(r),o=s?r.length:Buffer.byteLength(r),a=Buffer.isBuffer(i),c=a?i.length:Buffer.byteLength(i);let l=this._packetRW.write.allocStart;const u=this._packetRW.write.alloc(22+o+4+c+4);u[l]=h.CHANNEL_REQUEST,C(u,e,++l),C(u,7,l+=4),u.utf8Write("x11-req",l+=4,7),u[l+=7]=void 0===n||!0===n?1:0,u[++l]=t.single?1:0,C(u,o,++l),s?u.set(r,l+=4):u.utf8Write(r,l+=4,o),C(u,c,l+=o),a?u.set(i,l+=4):u.latin1Write(i,l+=4,c),C(u,t.screen||0,l+=c),this._debug&&this._debug(`Outbound: Sending CHANNEL_REQUEST (r:${e}, x11-req)`),w(this,this._packetRW.write.finalize(u))}subsystem(e,t,n){if(this._server)throw new Error("Client-only method called in server mode");const r=Buffer.byteLength(t);let i=this._packetRW.write.allocStart;const s=this._packetRW.write.alloc(23+r);s[i]=h.CHANNEL_REQUEST,C(s,e,++i),C(s,9,i+=4),s.utf8Write("subsystem",i+=4,9),s[i+=9]=void 0===n||!0===n?1:0,C(s,r,++i),s.utf8Write(t,i+=4,r),this._debug&&this._debug(`Outbound: Sending CHANNEL_REQUEST (r:${e}, subsystem: ${t})`),w(this,this._packetRW.write.finalize(s))}openssh_agentForward(e,t){if(this._server)throw new Error("Client-only method called in server mode");let n=this._packetRW.write.allocStart;const r=this._packetRW.write.alloc(36);r[n]=h.CHANNEL_REQUEST,C(r,e,++n),C(r,26,n+=4),r.utf8Write("auth-agent-req@openssh.com",n+=4,26),r[n+=26]=void 0===t||!0===t?1:0,this._debug&&this._debug(`Outbound: Sending CHANNEL_REQUEST (r:${e}, auth-agent-req@openssh.com)`),w(this,this._packetRW.write.finalize(r))}openssh_hostKeysProve(e){if(this._server)throw new Error("Client-only method called in server mode");let t=0;const n=[];for(const r of e){const e=r.getPublicSSH();t+=4+e.length,n.push(e)}let r=this._packetRW.write.allocStart;const i=this._packetRW.write.alloc(35+t);i[r]=h.GLOBAL_REQUEST,C(i,29,++r),i.utf8Write("hostkeys-prove-00@openssh.com",r+=4,29),i[r+=29]=1,++r;for(const e of n)C(i,e.length,r),b(e,i,0,e.length,r+=4),r+=e.length;this._debug&&this._debug("Outbound: Sending GLOBAL_REQUEST (hostkeys-prove-00@openssh.com)"),w(this,this._packetRW.write.finalize(i))}serviceAccept(e){if(!this._server)throw new Error("Server-only method called in client mode");const t=Buffer.byteLength(e);let n=this._packetRW.write.allocStart;const r=this._packetRW.write.alloc(5+t);if(r[n]=h.SERVICE_ACCEPT,C(r,t,++n),r.utf8Write(e,n+=4,t),this._debug&&this._debug(`Outbound: Sending SERVICE_ACCEPT (${e})`),w(this,this._packetRW.write.finalize(r)),this._server&&this._banner&&"ssh-userauth"===e){const e=this._banner;this._banner=void 0;const t=Buffer.byteLength(e);n=this._packetRW.write.allocStart;const r=this._packetRW.write.alloc(5+t+4);r[n]=h.USERAUTH_BANNER,C(r,t,++n),r.utf8Write(e,n+=4,t),C(r,0,n+=t),this._debug&&this._debug("Outbound: Sending USERAUTH_BANNER"),w(this,this._packetRW.write.finalize(r))}}forwardedTcpip(e,t,n,r){if(!this._server)throw new Error("Server-only method called in client mode");const i=Buffer.byteLength(r.boundAddr),s=Buffer.byteLength(r.remoteAddr);let o=this._packetRW.write.allocStart;const a=this._packetRW.write.alloc(36+i+4+4+s+4);a[o]=h.CHANNEL_OPEN,C(a,15,++o),a.utf8Write("forwarded-tcpip",o+=4,15),C(a,e,o+=15),C(a,t,o+=4),C(a,n,o+=4),C(a,i,o+=4),a.utf8Write(r.boundAddr,o+=4,i),C(a,r.boundPort,o+=i),C(a,s,o+=4),a.utf8Write(r.remoteAddr,o+=4,s),C(a,r.remotePort,o+=s),this._debug&&this._debug(`Outbound: Sending CHANNEL_OPEN (r:${e}, forwarded-tcpip)`),w(this,this._packetRW.write.finalize(a))}x11(e,t,n,r){if(!this._server)throw new Error("Server-only method called in client mode");const i=Buffer.byteLength(r.originAddr);let s=this._packetRW.write.allocStart;const o=this._packetRW.write.alloc(24+i+4);o[s]=h.CHANNEL_OPEN,C(o,3,++s),o.utf8Write("x11",s+=4,3),C(o,e,s+=3),C(o,t,s+=4),C(o,n,s+=4),C(o,i,s+=4),o.utf8Write(r.originAddr,s+=4,i),C(o,r.originPort,s+=i),this._debug&&this._debug(`Outbound: Sending CHANNEL_OPEN (r:${e}, x11)`),w(this,this._packetRW.write.finalize(o))}openssh_authAgent(e,t,n){if(!this._server)throw new Error("Server-only method called in client mode");let r=this._packetRW.write.allocStart;const i=this._packetRW.write.alloc(39);i[r]=h.CHANNEL_OPEN,C(i,22,++r),i.utf8Write("auth-agent@openssh.com",r+=4,22),C(i,e,r+=22),C(i,t,r+=4),C(i,n,r+=4),this._debug&&this._debug(`Outbound: Sending CHANNEL_OPEN (r:${e}, auth-agent@openssh.com)`),w(this,this._packetRW.write.finalize(i))}openssh_forwardedStreamLocal(e,t,n,r){if(!this._server)throw new Error("Server-only method called in client mode");const i=Buffer.byteLength(r.socketPath);let s=this._packetRW.write.allocStart;const o=this._packetRW.write.alloc(54+i+4);o[s]=h.CHANNEL_OPEN,C(o,33,++s),o.utf8Write("forwarded-streamlocal@openssh.com",s+=4,33),C(o,e,s+=33),C(o,t,s+=4),C(o,n,s+=4),C(o,i,s+=4),o.utf8Write(r.socketPath,s+=4,i),C(o,0,s+=i),this._debug&&this._debug(`Outbound: Sending CHANNEL_OPEN (r:${e}, forwarded-streamlocal@openssh.com)`),w(this,this._packetRW.write.finalize(o))}exitStatus(e,t){if(!this._server)throw new Error("Server-only method called in client mode");let n=this._packetRW.write.allocStart;const r=this._packetRW.write.alloc(25);r[n]=h.CHANNEL_REQUEST,C(r,e,++n),C(r,11,n+=4),r.utf8Write("exit-status",n+=4,11),r[n+=11]=0,C(r,t,++n),this._debug&&this._debug(`Outbound: Sending CHANNEL_REQUEST (r:${e}, exit-status: ${t})`),w(this,this._packetRW.write.finalize(r))}exitSignal(e,t,n,r){if(!this._server)throw new Error("Server-only method called in client mode");const i=t;if("string"!=typeof i||!i)throw new Error(`Invalid signal: ${i}`);let s=t.toUpperCase();if("SIG"===s.slice(0,3)&&(s=s.slice(3)),1!==u[s])throw new Error(`Invalid signal: ${i}`);const o=Buffer.byteLength(s),a=r?Buffer.byteLength(r):0;let c=this._packetRW.write.allocStart;const l=this._packetRW.write.alloc(25+o+1+4+a+4);l[c]=h.CHANNEL_REQUEST,C(l,e,++c),C(l,11,c+=4),l.utf8Write("exit-signal",c+=4,11),l[c+=11]=0,C(l,o,++c),l.utf8Write(s,c+=4,o),l[c+=o]=n?1:0,C(l,a,++c),c+=4,a&&(l.utf8Write(r,c,a),c+=a),C(l,0,c),this._debug&&this._debug(`Outbound: Sending CHANNEL_REQUEST (r:${e}, exit-signal: ${t})`),w(this,this._packetRW.write.finalize(l))}authFailure(e,t){if(!this._server)throw new Error("Server-only method called in client mode");if(0===this._authsQueue.length)throw new Error("No auth in progress");let n;if("boolean"==typeof e&&(t=e,e=void 0),e){n=[];for(let t=0;t<e.length;++t)"none"!==e[t].toLowerCase()&&n.push(e[t]);n=n.join(",")}else n="";const r=n.length;let i=this._packetRW.write.allocStart;const s=this._packetRW.write.alloc(5+r+1);s[i]=h.USERAUTH_FAILURE,C(s,r,++i),s.utf8Write(n,i+=4,r),s[i+=r]=!0===t?1:0,this._authsQueue.shift(),this._debug&&this._debug("Outbound: Sending USERAUTH_FAILURE"),w(this,this._packetRW.write.finalize(s))}authSuccess(){if(!this._server)throw new Error("Server-only method called in client mode");if(0===this._authsQueue.length)throw new Error("No auth in progress");const e=this._packetRW.write.allocStart,t=this._packetRW.write.alloc(1);t[e]=h.USERAUTH_SUCCESS,this._authsQueue.shift(),this._authenticated=!0,this._debug&&this._debug("Outbound: Sending USERAUTH_SUCCESS"),w(this,this._packetRW.write.finalize(t)),"zlib@openssh.com"===this._kex.negotiated.cs.compress&&(this._packetRW.read=new T),"zlib@openssh.com"===this._kex.negotiated.sc.compress&&(this._packetRW.write=new R(this))}authPKOK(e,t){if(!this._server)throw new Error("Server-only method called in client mode");if(0===this._authsQueue.length||"publickey"!==this._authsQueue[0])throw new Error('"publickey" auth not in progress');const n=Buffer.byteLength(e),r=t.length;let i=this._packetRW.write.allocStart;const s=this._packetRW.write.alloc(5+n+4+r);s[i]=h.USERAUTH_PK_OK,C(s,n,++i),s.utf8Write(e,i+=4,n),C(s,r,i+=n),s.set(t,i+=4),this._authsQueue.shift(),this._debug&&this._debug("Outbound: Sending USERAUTH_PK_OK"),w(this,this._packetRW.write.finalize(s))}authPasswdChg(e){if(!this._server)throw new Error("Server-only method called in client mode");const t=Buffer.byteLength(e);let n=this._packetRW.write.allocStart;const r=this._packetRW.write.alloc(5+t+4);r[n]=h.USERAUTH_PASSWD_CHANGEREQ,C(r,t,++n),r.utf8Write(e,n+=4,t),C(r,0,n+=t),this._debug&&this._debug("Outbound: Sending USERAUTH_PASSWD_CHANGEREQ"),w(this,this._packetRW.write.finalize(r))}authInfoReq(e,t,n){if(!this._server)throw new Error("Server-only method called in client mode");let r=0;const i=e?Buffer.byteLength(e):0,s=t?Buffer.byteLength(t):0;for(let e=0;e<n.length;++e)r+=4+Buffer.byteLength(n[e].prompt)+1;let o=this._packetRW.write.allocStart;const a=this._packetRW.write.alloc(5+i+4+s+4+4+r);a[o]=h.USERAUTH_INFO_REQUEST,C(a,i,++o),o+=4,e&&(a.utf8Write(e,o,i),o+=i),C(a,s,o),o+=4,t&&(a.utf8Write(t,o,s),o+=s),C(a,0,o),C(a,n.length,o+=4),o+=4;for(let e=0;e<n.length;++e){const t=n[e],r=Buffer.byteLength(t.prompt);C(a,r,o),o+=4,r&&(a.utf8Write(t.prompt,o,r),o+=r),a[o++]=t.echo?1:0}this._debug&&this._debug("Outbound: Sending USERAUTH_INFO_REQUEST"),w(this,this._packetRW.write.finalize(a))}}},7764(e,t,n){"use strict";const r=n(4434),i=n(9896),{constants:s}=i,{Readable:o,Writable:a}=n(2203),{inherits:c,types:{isDate:l}}=n(9023),h=Buffer[Symbol.species],{bufferCopy:u,bufferSlice:d,makeBufferParser:f,writeUInt32BE:p}=n(9576),g=1,m=2,_=4,y=8,v=2147483648,b=Buffer.alloc(28),E={OK:0,EOF:1,NO_SUCH_FILE:2,PERMISSION_DENIED:3,FAILURE:4,BAD_MESSAGE:5,NO_CONNECTION:6,CONNECTION_LOST:7,OP_UNSUPPORTED:8},A=new Map(Object.values(E).map(e=>[e,1])),S={[E.OK]:"No error",[E.EOF]:"End of file",[E.NO_SUCH_FILE]:"No such file or directory",[E.PERMISSION_DENIED]:"Permission denied",[E.FAILURE]:"Failure",[E.BAD_MESSAGE]:"Bad message",[E.NO_CONNECTION]:"No connection",[E.CONNECTION_LOST]:"Connection lost",[E.OP_UNSUPPORTED]:"Operation unsupported"},w=1,C=3,I=4,k=5,T=6,R=7,O=8,N=9,P=10,B=11,L=12,x=13,D=14,M=15,U=16,F=17,H=18,j=19,W=20,Q=200,q=2,z=101,$=102,G=103,K=104,Y=105,V=201,X={READ:1,WRITE:2,APPEND:4,CREAT:8,TRUNC:16,EXCL:32},J=2**32-1,Z=Buffer.from([0,0,0,5,w,0,0,0,3]),ee=Buffer.from([0,0,0,5,q,0,0,0,3]),te=/^SSH-2.0-(?:OpenSSH|dropbear)/,ne=262144,re=f(),ie={readable:!1,writable:!1,push:e=>{},once:()=>{},on:()=>{},emit:()=>{},end:()=>{}};function se(){}function oe(e,t,n,r,i,s,o,a){const c=e._maxReadLen,l=Math.max(i-c,0);l&&(i=c);const h=t.length;let u=9,f=s;const g=Buffer.allocUnsafe(13+h+8+4);p(g,g.length-4,0),g[4]=k;const m=e._writeReqid=e._writeReqid+1&J;p(g,m,5),p(g,h,u),g.set(t,u+=4),u+=h;for(let e=7;e>=0;--e)g[u+e]=255&f,f/=256;p(g,i,u+=8),"function"!=typeof o&&(o=se);const _=a||{nb:0,position:s,off:r,origOff:r,len:void 0,overflow:void 0,cb:(r,i,s)=>{const a=_.len,c=_.overflow;if(r){if(o._wantEOFError||r.code!==E.EOF)return o(r)}else{if(s>a)return o(new Error("Received more data than requested"));if(s===a&&c)return _.nb+=s,_.position+=s,_.off+=s,void oe(e,t,n,_.off,c,_.position,o,_)}s=s||0,i=0===_.origOff&&n.length===_.nb?n:d(n,_.origOff,_.origOff+_.nb+s),o(void 0,_.nb+s,i,_.position)},buffer:void 0};_.len=i,_.overflow=l,_.buffer=d(n,r,r+i),e._requests[m]=_;const y=_e(e,g);e._debug&&e._debug(`SFTP: Outbound: ${y?"Buffered":"Sending"} READ`)}function ae(e,t,n,r,s,o){let a,c,l,h,u=64,d=32768;"function"==typeof s?o=s:"object"==typeof s&&null!==s&&("number"==typeof s.concurrency&&s.concurrency>0&&!isNaN(s.concurrency)&&(u=s.concurrency),"number"==typeof s.chunkSize&&s.chunkSize>0&&!isNaN(s.chunkSize)&&(d=s.chunkSize),"number"==typeof s.fileSize&&s.fileSize>0&&!isNaN(s.fileSize)&&(l=s.fileSize),"function"==typeof s.step&&(a=s.step),"string"!=typeof s.mode&&"number"!=typeof s.mode||(c=de(s.mode)));let f,p,g,m=0,_=0,y=!1,v=d*u;function b(n){if(y)return;y=!0;let r,s=0;f||p?(r=()=>{0===--s&&o(n)},!f||e!==i&&"open"!==e.outgoing.state||++s,!p||t!==i&&"open"!==t.outgoing.state||++s,!f||e!==i&&"open"!==e.outgoing.state||e.close(f,r),!p||t!==i&&"open"!==t.outgoing.state||t.close(p,r)):o(n)}e.open(n,"r",(s,y)=>{if(s)return b(s);function E(s,l){if(s)return e!==i?void e.stat(n,(e,t)=>{if(e)return b(s);E(null,t)}):b(s);h=l.size,t.open(r,"w",(n,i)=>{if(n)return b(n);if(p=i,h<=0)return b();for(;v>h;){if(1===u){v=h;break}v-=d,--u}if(g=function(e){try{return Buffer.allocUnsafe(e)}catch(e){return e}}(v),g instanceof Error)return b(g);function s(n,r,i,s,c,u){if(n)return b(n);c=c||0,t.write(p,g,c,r,s,function(n){if(n)return b(n);if(_+=r,a&&a(_,r,h),r<u)return l(c,s+r,u-r);if(_===h)return void t.close(p,t=>{if(p=void 0,t)return b(t);e.close(f,e=>{if(f=void 0,e)return b(e);o()})});if(m>=h)return;const i=m+d>h?h-m:d;l(c,m,i),m+=i})}function l(t,n,r){e.read(f,g,t,r,n,function(e,t,n){return(r,i,o)=>{s(r,i,0,t,e,n)}}(t,n,r))}function y(){let e=0,t=0;for(;m<h&&e<u;){const n=m+d>h?h-m:d;l(t,m,n),t+=n,m+=n,++e}}void 0!==c?t.fchmod(p,c,function e(n){n?t.chmod(r,c,t=>e()):y()}):y()})}f=y,void 0===l?e.fstat(f,E):E(null,{size:l})})}function ce(e,t,n,r,i,s,o){const a="function"==typeof o?o:void 0;e.write(t,n,r,i,s,(o,c)=>{if(o)return e.close(t,()=>{a&&a(o)});c===i?e.close(t,a):ce(e,t,n,r+=c,i-=c,s+=c,a)})}class le{constructor(e){this.mode=e&&e.mode,this.uid=e&&e.uid,this.gid=e&&e.gid,this.size=e&&e.size,this.atime=e&&e.atime,this.mtime=e&&e.mtime,this.extended=e&&e.extended}isDirectory(){return(this.mode&s.S_IFMT)===s.S_IFDIR}isFile(){return(this.mode&s.S_IFMT)===s.S_IFREG}isBlockDevice(){return(this.mode&s.S_IFMT)===s.S_IFBLK}isCharacterDevice(){return(this.mode&s.S_IFMT)===s.S_IFCHR}isSymbolicLink(){return(this.mode&s.S_IFMT)===s.S_IFLNK}isFIFO(){return(this.mode&s.S_IFMT)===s.S_IFIFO}isSocket(){return(this.mode&s.S_IFMT)===s.S_IFSOCK}}function he(e){let t=0,n=0;if("object"==typeof e&&null!==e){if("number"==typeof e.size){t|=g;const r=e.size;b[n++]=r/72057594037927940,b[n++]=r/281474976710656,b[n++]=r/1099511627776,b[n++]=r/4294967296,b[n++]=r/16777216,b[n++]=r/65536,b[n++]=r/256,b[n++]=r}if("number"==typeof e.uid&&"number"==typeof e.gid){t|=m;const r=e.uid,i=e.gid;b[n++]=r>>>24,b[n++]=r>>>16,b[n++]=r>>>8,b[n++]=r,b[n++]=i>>>24,b[n++]=i>>>16,b[n++]=i>>>8,b[n++]=i}if("number"==typeof e.mode||"string"==typeof e.mode){const r=de(e.mode);t|=_,b[n++]=r>>>24,b[n++]=r>>>16,b[n++]=r>>>8,b[n++]=r}if(("number"==typeof e.atime||l(e.atime))&&("number"==typeof e.mtime||l(e.mtime))){const r=ue(e.atime),i=ue(e.mtime);t|=y,b[n++]=r>>>24,b[n++]=r>>>16,b[n++]=r>>>8,b[n++]=r,b[n++]=i>>>24,b[n++]=i>>>16,b[n++]=i>>>8,b[n++]=i}}return{flags:t,nb:n}}function ue(e){if("number"==typeof e&&e==e)return e;if(l(e))return parseInt(e.getTime()/1e3,10);throw new Error(`Cannot parse time: ${e}`)}function de(e){if("number"==typeof e&&e==e)return e;if("string"==typeof e)return de(parseInt(e,8));throw new Error(`Cannot parse mode: ${e}`)}const fe={r:X.READ,"r+":X.READ|X.WRITE,w:X.TRUNC|X.CREAT|X.WRITE,wx:X.TRUNC|X.CREAT|X.WRITE|X.EXCL,xw:X.TRUNC|X.CREAT|X.WRITE|X.EXCL,"w+":X.TRUNC|X.CREAT|X.READ|X.WRITE,"wx+":X.TRUNC|X.CREAT|X.READ|X.WRITE|X.EXCL,"xw+":X.TRUNC|X.CREAT|X.READ|X.WRITE|X.EXCL,a:X.APPEND|X.CREAT|X.WRITE,ax:X.APPEND|X.CREAT|X.WRITE|X.EXCL,xa:X.APPEND|X.CREAT|X.WRITE|X.EXCL,"a+":X.APPEND|X.CREAT|X.READ|X.WRITE,"ax+":X.APPEND|X.CREAT|X.READ|X.WRITE|X.EXCL,"xa+":X.APPEND|X.CREAT|X.READ|X.WRITE|X.EXCL};function pe(e){const t=fe[e];return void 0!==t?t:null}const ge=(()=>{const e=Object.keys(fe);return t=>{for(let n=0;n<e.length;++n){const r=e[n];if(fe[r]===t)return r}return null}})();function me(e){const t=re.readUInt32BE();if(void 0===t)return;const n=new le;if(t&g){const t=re.readUInt64BE(e);if(void 0===t)return;n.size=t}if(t&m){const e=re.readUInt32BE(),t=re.readUInt32BE();if(void 0===t)return;n.uid=e,n.gid=t}if(t&_){const e=re.readUInt32BE();if(void 0===e)return;n.mode=e}if(t&y){const e=re.readUInt32BE(),t=re.readUInt32BE();if(void 0===t)return;n.atime=e,n.mtime=t}if(t&v){const e=re.readUInt32BE();if(void 0===e)return;const t={};for(let n=0;n<e;++n){const e=re.readString(!0),n=re.readString();if(void 0===n)return;t[e]=n}n.extended=t}return n}function _e(e,t){const n=ye(e,t);return void 0===n||(e._buffer.push(n),!1)}function ye(e,t){const n=e.outgoing;if("open"!==n.state)return;if(0===n.window)return e._waitWindow=!0,e._chunkcb=ve,t;let r;const i=t.length;let s=0;for(;i-s>0&&n.window>0;){const r=Math.min(i-s,n.window,n.packetSize);n.window-=r,0===n.window&&(e._waitWindow=!0,e._chunkcb=ve),0===s&&r===i?e._protocol.channelData(e.outgoing.id,t):e._protocol.channelData(e.outgoing.id,d(t,s,s+r)),s+=r}return i-s>0&&(r=s>0?d(t,s,i):t),r}function ve(){this._chunkcb=void 0;const e=this._buffer;let t=0;for(;t<e.length;){const n=e[t],r=ye(this,n);if(void 0!==r)return r!==n&&(e[t]=r),void(t>0&&(this._buffer=e.slice(t)));++t}t>0&&(this._buffer=[])}function be(e,t,n){const r=new Error(t);return r.level="sftp-protocol",!n&&e._debug&&e._debug(`SFTP: Inbound: ${t}`),e.emit("error",r),e.destroy(),Ee(e),!1}function Ee(e){const t=Object.keys(e._requests);if(0===t.length)return;const n=e._requests;e._requests={};const r=new Error("No response from server");for(let e=0;e<t.length;++e){const i=n[t[e]];"function"==typeof i.cb&&i.cb(r)}}const Ae={[q]:(e,t)=>{if(-1!==e._version)return be(e,"Duplicate VERSION packet");const n={};re.init(t,1);let r=re.readUInt32BE();for(;re.avail();){const e=re.readString(!0),t=re.readString(!0);if(void 0===t){r=void 0;break}n[e]=t}if(re.clear(),void 0===r)return be(e,"Malformed VERSION packet");if(e._debug){const t=Object.keys(n);t.length?e._debug(`SFTP: Inbound: Received VERSION (v${r}, exts:${t})`):e._debug(`SFTP: Inbound: Received VERSION (v${r})`)}if(e._version=r,e._extensions=n,"1"===n["limits@openssh.com"])return function(e,t){let n=9;const r=Buffer.allocUnsafe(31);p(r,r.length-4,0),r[4]=Q;const i=e._writeReqid=e._writeReqid+1&J;p(r,i,5),p(r,18,n),r.utf8Write("limits@openssh.com",n+=4,18),e._requests[i]={extended:"limits@openssh.com",cb:t};const s=_e(e,r);if(e._debug){const t=s?"Buffered":"Sending";e._debug(`SFTP: Outbound: ${t} limits@openssh.com`)}}(e,(t,n)=>{t||(n.maxPktLen>0&&(e._maxOutPktLen=n.maxPktLen),n.maxReadLen>0&&(e._maxReadLen=n.maxReadLen),n.maxWriteLen>0&&(e._maxWriteLen=n.maxWriteLen),e.maxOpenHandles=n.maxOpenHandles>0?n.maxOpenHandles:1/0),e.emit("ready")});e.emit("ready")},[z]:(e,t)=>{re.init(t,1);const n=re.readUInt32BE(),r=re.readUInt32BE(),i=re.readString(!0);if(re.clear(),e._debug){const t=JSON.stringify(i);e._debug(`SFTP: Inbound: Received STATUS (id:${n}, ${r}, ${t})`)}const s=e._requests[n];if(delete e._requests[n],s&&"function"==typeof s.cb){if(r===E.OK)return void s.cb();const e=new Error(i||S[r]||"Unknown status");e.code=r,s.cb(e)}},[$]:(e,t)=>{re.init(t,1);const n=re.readUInt32BE(),r=re.readString();if(re.clear(),void 0===r)return void 0!==n&&delete e._requests[n],be(e,"Malformed HANDLE packet");e._debug&&e._debug(`SFTP: Inbound: Received HANDLE (id:${n})`);const i=e._requests[n];delete e._requests[n],i&&"function"==typeof i.cb&&i.cb(void 0,r)},[G]:(e,t)=>{re.init(t,1);const n=re.readUInt32BE();let r;if(void 0!==n&&(r=e._requests[n],delete e._requests[n]),r&&"function"==typeof r.cb)if(r.buffer){const t=re.readString(r.buffer);if(re.clear(),void 0!==t)return e._debug&&e._debug(`SFTP: Inbound: Received DATA (id:${n}, ${t})`),void r.cb(void 0,r.buffer,t)}else{const t=re.readString();if(re.clear(),void 0!==t)return e._debug&&e._debug(`SFTP: Inbound: Received DATA (id:${n}, ${t.length})`),void r.cb(void 0,t)}else{const t=re.skipString();if(re.clear(),void 0!==t)return void(e._debug&&e._debug(`SFTP: Inbound: Received DATA (id:${n}, ${t})`))}return be(e,"Malformed DATA packet")},[K]:(e,t)=>{re.init(t,1);const n=re.readUInt32BE();let r;void 0!==n&&(r=e._requests[n],delete e._requests[n]);const i=re.readUInt32BE();if(void 0!==i){let t=[];for(let n=0;n<i;++n){const n=re.readString(!0),r=re.readString(!0),i=me(e._biOpt);if(void 0===i){t=void 0;break}t.push({filename:n,longname:r,attrs:i})}if(void 0!==t)return e._debug&&e._debug(`SFTP: Inbound: Received NAME (id:${n}, ${t.length})`),re.clear(),void(r&&"function"==typeof r.cb&&r.cb(void 0,t))}return re.clear(),be(e,"Malformed NAME packet")},[Y]:(e,t)=>{re.init(t,1);const n=re.readUInt32BE();let r;void 0!==n&&(r=e._requests[n],delete e._requests[n]);const i=me(e._biOpt);return re.clear(),void 0!==i?(e._debug&&e._debug(`SFTP: Inbound: Received ATTRS (id:${n})`),void(r&&"function"==typeof r.cb&&r.cb(void 0,i))):be(e,"Malformed ATTRS packet")},[V]:(e,t)=>{re.init(t,1);const n=re.readUInt32BE();if(void 0!==n){const t=e._requests[n];if(!t)return e._debug&&e._debug(`SFTP: Inbound: Received EXTENDED_REPLY (id:${n}, ???)`),void re.clear();switch(delete e._requests[n],t.extended){case"statvfs@openssh.com":case"fstatvfs@openssh.com":{const r=e._biOpt,i={f_bsize:re.readUInt64BE(r),f_frsize:re.readUInt64BE(r),f_blocks:re.readUInt64BE(r),f_bfree:re.readUInt64BE(r),f_bavail:re.readUInt64BE(r),f_files:re.readUInt64BE(r),f_ffree:re.readUInt64BE(r),f_favail:re.readUInt64BE(r),f_sid:re.readUInt64BE(r),f_flag:re.readUInt64BE(r),f_namemax:re.readUInt64BE(r)};if(void 0===i.f_namemax)break;return e._debug&&e._debug(`SFTP: Inbound: Received EXTENDED_REPLY (id:${n}, ${t.extended})`),re.clear(),void("function"==typeof t.cb&&t.cb(void 0,i))}case"limits@openssh.com":{const r={maxPktLen:re.readUInt64BE(),maxReadLen:re.readUInt64BE(),maxWriteLen:re.readUInt64BE(),maxOpenHandles:re.readUInt64BE()};if(void 0===r.maxOpenHandles)break;return e._debug&&e._debug(`SFTP: Inbound: Received EXTENDED_REPLY (id:${n}, ${t.extended})`),re.clear(),void("function"==typeof t.cb&&t.cb(void 0,r))}case"users-groups-by-id@openssh.com":{const r=re.readUInt32BE();if(void 0===r)break;const i=new Array(r);for(let e=0;e<i.length;++e)i[e]=re.readString(!0);const s=re.readUInt32BE();if(void 0===s)break;const o=new Array(s);for(let e=0;e<o.length;++e)o[e]=re.readString(!0);if(o.length>0&&void 0===o[o.length-1])break;return e._debug&&e._debug(`SFTP: Inbound: Received EXTENDED_REPLY (id:${n}, ${t.extended})`),re.clear(),void("function"==typeof t.cb&&t.cb(void 0,i,o))}default:return e._debug&&e._debug(`SFTP: Inbound: Received EXTENDED_REPLY (id:${n}, ???)`),re.clear(),void("function"==typeof t.cb&&t.cb())}}return re.clear(),be(e,"Malformed EXTENDED_REPLY packet")}},Se={[w]:(e,t)=>{if(-1!==e._version)return be(e,"Duplicate INIT packet");const n={};re.init(t,1);let r=re.readUInt32BE();for(;re.avail();){const e=re.readString(!0),t=re.readString(!0);if(void 0===t){r=void 0;break}n[e]=t}if(re.clear(),void 0===r)return be(e,"Malformed INIT packet");if(e._debug){const t=Object.keys(n);t.length?e._debug(`SFTP: Inbound: Received INIT (v${r}, exts:${t})`):e._debug(`SFTP: Inbound: Received INIT (v${r})`)}_e(e,ee),e._version=r,e._extensions=n,e.emit("ready")},[C]:(e,t)=>{re.init(t,1);const n=re.readUInt32BE(),r=re.readString(!0),i=re.readUInt32BE(),s=me(e._biOpt);if(re.clear(),void 0===s)return be(e,"Malformed OPEN packet");e._debug&&e._debug(`SFTP: Inbound: Received OPEN (id:${n})`),e.emit("OPEN",n,r,i,s)||e.status(n,E.OP_UNSUPPORTED)},[I]:(e,t)=>{re.init(t,1);const n=re.readUInt32BE(),r=re.readString();if(re.clear(),void 0===r||r.length>256)return be(e,"Malformed CLOSE packet");e._debug&&e._debug(`SFTP: Inbound: Received CLOSE (id:${n})`),e.emit("CLOSE",n,r)||e.status(n,E.OP_UNSUPPORTED)},[k]:(e,t)=>{re.init(t,1);const n=re.readUInt32BE(),r=re.readString(),i=re.readUInt64BE(e._biOpt),s=re.readUInt32BE();if(re.clear(),void 0===s||r.length>256)return be(e,"Malformed READ packet");e._debug&&e._debug(`SFTP: Inbound: Received READ (id:${n})`),e.emit("READ",n,r,i,s)||e.status(n,E.OP_UNSUPPORTED)},[T]:(e,t)=>{re.init(t,1);const n=re.readUInt32BE(),r=re.readString(),i=re.readUInt64BE(e._biOpt),s=re.readString();if(re.clear(),void 0===s||r.length>256)return be(e,"Malformed WRITE packet");e._debug&&e._debug(`SFTP: Inbound: Received WRITE (id:${n})`),e.emit("WRITE",n,r,i,s)||e.status(n,E.OP_UNSUPPORTED)},[R]:(e,t)=>{re.init(t,1);const n=re.readUInt32BE(),r=re.readString(!0);if(re.clear(),void 0===r)return be(e,"Malformed LSTAT packet");e._debug&&e._debug(`SFTP: Inbound: Received LSTAT (id:${n})`),e.emit("LSTAT",n,r)||e.status(n,E.OP_UNSUPPORTED)},[O]:(e,t)=>{re.init(t,1);const n=re.readUInt32BE(),r=re.readString();if(re.clear(),void 0===r||r.length>256)return be(e,"Malformed FSTAT packet");e._debug&&e._debug(`SFTP: Inbound: Received FSTAT (id:${n})`),e.emit("FSTAT",n,r)||e.status(n,E.OP_UNSUPPORTED)},[N]:(e,t)=>{re.init(t,1);const n=re.readUInt32BE(),r=re.readString(!0),i=me(e._biOpt);if(re.clear(),void 0===i)return be(e,"Malformed SETSTAT packet");e._debug&&e._debug(`SFTP: Inbound: Received SETSTAT (id:${n})`),e.emit("SETSTAT",n,r,i)||e.status(n,E.OP_UNSUPPORTED)},[P]:(e,t)=>{re.init(t,1);const n=re.readUInt32BE(),r=re.readString(),i=me(e._biOpt);if(re.clear(),void 0===i||r.length>256)return be(e,"Malformed FSETSTAT packet");e._debug&&e._debug(`SFTP: Inbound: Received FSETSTAT (id:${n})`),e.emit("FSETSTAT",n,r,i)||e.status(n,E.OP_UNSUPPORTED)},[B]:(e,t)=>{re.init(t,1);const n=re.readUInt32BE(),r=re.readString(!0);if(re.clear(),void 0===r)return be(e,"Malformed OPENDIR packet");e._debug&&e._debug(`SFTP: Inbound: Received OPENDIR (id:${n})`),e.emit("OPENDIR",n,r)||e.status(n,E.OP_UNSUPPORTED)},[L]:(e,t)=>{re.init(t,1);const n=re.readUInt32BE(),r=re.readString();if(re.clear(),void 0===r||r.length>256)return be(e,"Malformed READDIR packet");e._debug&&e._debug(`SFTP: Inbound: Received READDIR (id:${n})`),e.emit("READDIR",n,r)||e.status(n,E.OP_UNSUPPORTED)},[x]:(e,t)=>{re.init(t,1);const n=re.readUInt32BE(),r=re.readString(!0);if(re.clear(),void 0===r)return be(e,"Malformed REMOVE packet");e._debug&&e._debug(`SFTP: Inbound: Received REMOVE (id:${n})`),e.emit("REMOVE",n,r)||e.status(n,E.OP_UNSUPPORTED)},[D]:(e,t)=>{re.init(t,1);const n=re.readUInt32BE(),r=re.readString(!0),i=me(e._biOpt);if(re.clear(),void 0===i)return be(e,"Malformed MKDIR packet");e._debug&&e._debug(`SFTP: Inbound: Received MKDIR (id:${n})`),e.emit("MKDIR",n,r,i)||e.status(n,E.OP_UNSUPPORTED)},[M]:(e,t)=>{re.init(t,1);const n=re.readUInt32BE(),r=re.readString(!0);if(re.clear(),void 0===r)return be(e,"Malformed RMDIR packet");e._debug&&e._debug(`SFTP: Inbound: Received RMDIR (id:${n})`),e.emit("RMDIR",n,r)||e.status(n,E.OP_UNSUPPORTED)},[U]:(e,t)=>{re.init(t,1);const n=re.readUInt32BE(),r=re.readString(!0);if(re.clear(),void 0===r)return be(e,"Malformed REALPATH packet");e._debug&&e._debug(`SFTP: Inbound: Received REALPATH (id:${n})`),e.emit("REALPATH",n,r)||e.status(n,E.OP_UNSUPPORTED)},[F]:(e,t)=>{re.init(t,1);const n=re.readUInt32BE(),r=re.readString(!0);if(re.clear(),void 0===r)return be(e,"Malformed STAT packet");e._debug&&e._debug(`SFTP: Inbound: Received STAT (id:${n})`),e.emit("STAT",n,r)||e.status(n,E.OP_UNSUPPORTED)},[H]:(e,t)=>{re.init(t,1);const n=re.readUInt32BE(),r=re.readString(!0),i=re.readString(!0);if(re.clear(),void 0===i)return be(e,"Malformed RENAME packet");e._debug&&e._debug(`SFTP: Inbound: Received RENAME (id:${n})`),e.emit("RENAME",n,r,i)||e.status(n,E.OP_UNSUPPORTED)},[j]:(e,t)=>{re.init(t,1);const n=re.readUInt32BE(),r=re.readString(!0);if(re.clear(),void 0===r)return be(e,"Malformed READLINK packet");e._debug&&e._debug(`SFTP: Inbound: Received READLINK (id:${n})`),e.emit("READLINK",n,r)||e.status(n,E.OP_UNSUPPORTED)},[W]:(e,t)=>{re.init(t,1);const n=re.readUInt32BE(),r=re.readString(!0),i=re.readString(!0);if(re.clear(),void 0===i)return be(e,"Malformed SYMLINK packet");let s;e._debug&&e._debug(`SFTP: Inbound: Received SYMLINK (id:${n})`),s=e._isOpenSSH?e.emit("SYMLINK",n,i,r):e.emit("SYMLINK",n,r,i),s||e.status(n,E.OP_UNSUPPORTED)},[Q]:(e,t)=>{re.init(t,1);const n=re.readUInt32BE(),r=re.readString(!0);if(void 0===r)return re.clear(),be(e,"Malformed EXTENDED packet");let i;re.avail()&&(i=re.readRaw()),re.clear(),e._debug&&e._debug(`SFTP: Inbound: Received EXTENDED (id:${n})`),e.emit("EXTENDED",n,r,i)||e.status(n,E.OP_UNSUPPORTED)}},{ERR_INVALID_ARG_TYPE:we,ERR_OUT_OF_RANGE:Ce,validateNumber:Ie}=n(6728);let ke;const Te=[];function Re(e,t){if(!Number.isSafeInteger(e)){if(Ie(e,t),!Number.isInteger(e))throw new Ce(t,"an integer",e);throw new Ce(t,">= 0 and <= 2 ** 53 - 1",e)}if(e<0)throw new Ce(t,">= 0 and <= 2 ** 53 - 1",e)}function Oe(e){return e+7&-8}function Ne(e,t,n){if(void 0===n)n={};else if("string"==typeof n)n={encoding:n};else{if(null===n||"object"!=typeof n)throw new TypeError('"options" argument must be a string or an object');n=Object.create(n)}if(void 0===n.highWaterMark&&(n.highWaterMark=65536),n.emitClose=!1,n.autoDestroy=!1,o.call(this,n),this.path=t,this.flags=void 0===n.flags?"r":n.flags,this.mode=void 0===n.mode?438:n.mode,this.start=n.start,this.end=n.end,this.autoClose=void 0===n.autoClose||n.autoClose,this.pos=0,this.bytesRead=0,this.isClosed=!1,this.handle=void 0===n.handle?null:n.handle,this.sftp=e,this._opening=!1,void 0!==this.start&&(Re(this.start,"start"),this.pos=this.start),void 0===this.end)this.end=1/0;else if(this.end!==1/0&&(Re(this.end,"end"),void 0!==this.start&&this.start>this.end))throw new Ce("start",`<= "end" (here: ${this.end})`,this.start);this.on("end",function(){this.autoClose&&this.destroy()}),Buffer.isBuffer(this.handle)||this.open()}function Pe(e,t,n){if(!e.handle)return r();function r(r){t(r=r||n),e.isClosed=!0,r||e.emit("close")}e.sftp.close(e.handle,r)}function Be(e,t,n){if(void 0===n)n={};else if("string"==typeof n)n={encoding:n};else{if(null===n||"object"!=typeof n)throw new TypeError('"options" argument must be a string or an object');n=Object.create(n)}n.emitClose=!1,n.autoDestroy=!1,a.call(this,n),this.path=t,this.flags=void 0===n.flags?"w":n.flags,this.mode=void 0===n.mode?438:n.mode,this.start=n.start,this.autoClose=void 0===n.autoClose||n.autoClose,this.pos=0,this.bytesWritten=0,this.isClosed=!1,this.handle=void 0===n.handle?null:n.handle,this.sftp=e,this._opening=!1,void 0!==this.start&&(Re(this.start,"start"),this.pos=this.start),n.encoding&&this.setDefaultEncoding(n.encoding),this.on("finish",function(){this._writableState.finalCalled||this.autoClose&&this.destroy()}),Buffer.isBuffer(this.handle)||this.open()}c(Ne,o),Ne.prototype.open=function(){this._opening||(this._opening=!0,this.sftp.open(this.path,this.flags,this.mode,(e,t)=>{if(this._opening=!1,e)return this.emit("error",e),void(this.autoClose&&this.destroy());this.handle=t,this.emit("open",t),this.emit("ready"),this.read()}))},Ne.prototype._read=function(e){if(!Buffer.isBuffer(this.handle))return this.once("open",()=>this._read(e));if(this.destroyed)return;var t;(!ke||ke.length-ke.used<128)&&(t=this.readableHighWaterMark||this._readableState.highWaterMark,ke=Te.length>0?Te.pop():Buffer.allocUnsafe(t),ke.used=0);const n=ke;let r=Math.min(ke.length-ke.used,e);const i=ke.used;if(void 0!==this.end&&(r=Math.min(this.end-this.pos+1,r)),r<=0)return this.push(null);this.sftp.read(this.handle,ke,ke.used,r,this.pos,(e,t)=>{if(e)return this.emit("error",e),void(this.autoClose&&this.destroy());let s=null;if(i+r===n.used&&n===ke)n.used=Oe(n.used+t-r);else{const e=i+r&-8,s=Oe(i+t);e-s>=128&&Te.push(n.slice(s,e))}t>0&&(this.bytesRead+=t,s=n.slice(i,i+t)),this.pos+=t,this.push(s)}),ke.used=Oe(ke.used+r)},Ne.prototype._destroy=function(e,t){!this._opening||Buffer.isBuffer(this.handle)?(Pe(this,t,e),this.handle=null,this._opening=!1):this.once("open",Pe.bind(null,this,t,e))},Ne.prototype.close=function(e){this.destroy(null,e)},Object.defineProperty(Ne.prototype,"pending",{get(){return null===this.handle},configurable:!0}),c(Be,a),Be.prototype._final=function(e){this.autoClose&&this.destroy(),e()},Be.prototype.open=function(){this._opening||(this._opening=!0,this.sftp.open(this.path,this.flags,this.mode,(e,t)=>{if(this._opening=!1,e)return this.emit("error",e),void(this.autoClose&&this.destroy());this.handle=t;const n=e=>{if(e)this.sftp.chmod(this.path,this.mode,e=>n());else{if("a"===this.flags[0]){const e=(n,r)=>{n?this.sftp.stat(this.path,(t,r)=>{if(t)return this.destroy(),void this.emit("error",n);e(null,r)}):(this.pos=r.size,this.emit("open",t),this.emit("ready"))};return void this.sftp.fstat(t,e)}this.emit("open",t),this.emit("ready")}};this.sftp.fchmod(t,this.mode,n)}))},Be.prototype._write=function(e,t,n){if(!Buffer.isBuffer(e)){const t=new we("data","Buffer",e);return this.emit("error",t)}if(!Buffer.isBuffer(this.handle))return this.once("open",function(){this._write(e,t,n)});this.sftp.write(this.handle,e,0,e.length,this.pos,(e,t)=>{if(e)return this.autoClose&&this.destroy(),n(e);this.bytesWritten+=t,n()}),this.pos+=e.length},Be.prototype._writev=function(e,t){if(!Buffer.isBuffer(this.handle))return this.once("open",function(){this._writev(e,t)});const n=this.sftp,r=this.handle;let i=e.length;const s=(e,n)=>{if(e)return this.destroy(),t(e);this.bytesWritten+=n,0===--i&&t()};for(let t=0;t<e.length;++t){const i=e[t].chunk;n.write(r,i,0,i.length,this.pos,s),this.pos+=i.length}},"function"!=typeof a.prototype.destroy&&(Be.prototype.destroy=Ne.prototype.destroy),Be.prototype._destroy=Ne.prototype._destroy,Be.prototype.close=function(e){if(e){if(this.isClosed)return void process.nextTick(e);this.on("close",e)}this.autoClose||this.on("finish",this.destroy.bind(this)),this.end()},Be.prototype.destroySoon=Be.prototype.end,Object.defineProperty(Be.prototype,"pending",{get(){return null===this.handle},configurable:!0}),e.exports={flagsToString:ge,OPEN_MODE:X,SFTP:class extends r{constructor(e,t,n){super(),"object"==typeof n&&n||(n={});const r=e._protocol._remoteIdentRaw;this.server=!!n.server,this._debug="function"==typeof n.debug?n.debug:void 0,this._isOpenSSH=r&&te.test(r),this._version=-1,this._extensions={},this._biOpt=n.biOpt,this._pktLenBytes=0,this._pktLen=0,this._pktPos=0,this._pktType=0,this._pktData=void 0,this._writeReqid=-1,this._requests={},this._maxInPktLen=ne,this._maxOutPktLen=34e3,this._maxReadLen=(this._isOpenSSH?ne:34e3)-2048,this._maxWriteLen=(this._isOpenSSH?ne:34e3)-2048,this.maxOpenHandles=void 0,this._client=e,this._protocol=e._protocol,this._callbacks=[],this._hasX11=!1,this._exit={code:void 0,signal:void 0,dump:void 0,desc:void 0},this._waitWindow=!1,this._chunkcb=void 0,this._buffer=[],this.type=t.type,this.subtype=void 0,this.incoming=t.incoming,this.outgoing=t.outgoing,this.stderr=ie,this.readable=!0}push(e){if(null===e){if(Ee(this),!this.readable)return;return this.readable=!1,void this.emit("end")}let t=0;for(;t<e.length;){if(this._pktLenBytes<4){let n=Math.min(4-this._pktLenBytes,e.length-t);for(this._pktLenBytes+=n;n--;)this._pktLen=(this._pktLen<<8)+e[t++];if(this._pktLenBytes<4)return;if(0===this._pktLen)return be(this,"Invalid packet length");if(this._pktLen>this._maxInPktLen){const e=this._maxInPktLen;return be(this,`Packet length ${this._pktLen} exceeds max length of ${e}`)}if(t>=e.length)return}if(this._pktPos<this._pktLen){const n=Math.min(this._pktLen-this._pktPos,e.length-t);if(0!==t||n!==e.length?n===this._pktLen?this._pkt=new h(e.buffer,e.byteOffset+t,n):(this._pkt||(this._pkt=Buffer.allocUnsafe(this._pktLen)),this._pkt.set(new Uint8Array(e.buffer,e.byteOffset+t,n),this._pktPos)):n===this._pktLen?this._pkt=e:(this._pkt||(this._pkt=Buffer.allocUnsafe(this._pktLen)),this._pkt.set(e,this._pktPos)),t+=n,this._pktPos+=n,this._pktPos<this._pktLen)return}const n=this._pkt[0],r=this._pkt;this._pktLen=0,this._pktLenBytes=0,this._pkt=void 0,this._pktPos=0;const i=this.server?Se[n]:Ae[n];if(!i)return be(this,`Unknown packet type ${n}`);if(-1===this._version)if(this.server){if(n!==w)return be(this,`Expected INIT packet, got ${n}`)}else if(n!==q)return be(this,`Expected VERSION packet, got ${n}`);if(!1===i(this,r))return}}end(){this.destroy()}destroy(){"open"!==this.outgoing.state&&"eof"!==this.outgoing.state||(this.outgoing.state="closing",this._protocol.channelClose(this.outgoing.id))}_init(){this._init=se,this.server||_e(this,Z)}createReadStream(e,t){if(this.server)throw new Error("Client-only method called in server mode");return new Ne(this,e,t)}createWriteStream(e,t){if(this.server)throw new Error("Client-only method called in server mode");return new Be(this,e,t)}open(e,t,n,r){if(this.server)throw new Error("Client-only method called in server mode");"function"==typeof n&&(r=n,n=void 0);const i="number"==typeof t?t:pe(t);if(null===i)throw new Error(`Unknown flags string: ${t}`);let s=0,o=0;"string"!=typeof n&&"number"!=typeof n||(n={mode:n}),"object"==typeof n&&null!==n&&(s=(n=he(n)).flags,o=n.nb);const a=Buffer.byteLength(e);let c=9;const l=Buffer.allocUnsafe(13+a+4+4+o);p(l,l.length-4,0),l[4]=C;const h=this._writeReqid=this._writeReqid+1&J;p(l,h,5),p(l,a,c),l.utf8Write(e,c+=4,a),p(l,i,c+=a),p(l,s,c+=4),o&&(c+=4,o===b.length?l.set(b,c):u(b,l,0,o,c),c+=o),this._requests[h]={cb:r};const d=_e(this,l);this._debug&&this._debug(`SFTP: Outbound: ${d?"Buffered":"Sending"} OPEN`)}close(e,t){if(this.server)throw new Error("Client-only method called in server mode");if(!Buffer.isBuffer(e))throw new Error("handle is not a Buffer");const n=e.length;let r=9;const i=Buffer.allocUnsafe(13+n);p(i,i.length-4,0),i[4]=I;const s=this._writeReqid=this._writeReqid+1&J;p(i,s,5),p(i,n,r),i.set(e,r+=4),this._requests[s]={cb:t};const o=_e(this,i);this._debug&&this._debug(`SFTP: Outbound: ${o?"Buffered":"Sending"} CLOSE`)}read(e,t,n,r,i,s){if(this.server)throw new Error("Client-only method called in server mode");if(!Buffer.isBuffer(e))throw new Error("handle is not a Buffer");if(!Buffer.isBuffer(t))throw new Error("buffer is not a Buffer");if(n>=t.length)throw new Error("offset is out of bounds");if(n+r>t.length)throw new Error("length extends beyond buffer");if(null===i)throw new Error("null position currently unsupported");oe(this,e,t,n,r,i,s)}readData(e,t,n,r,i,s){this.read(e,t,n,r,i,s)}write(e,t,n,r,i,s){if(this.server)throw new Error("Client-only method called in server mode");if(!Buffer.isBuffer(e))throw new Error("handle is not a Buffer");if(!Buffer.isBuffer(t))throw new Error("buffer is not a Buffer");if(n>t.length)throw new Error("offset is out of bounds");if(n+r>t.length)throw new Error("length extends beyond buffer");if(null===i)throw new Error("null position currently unsupported");if(!r)return void(s&&process.nextTick(s,void 0,0));const o=this._maxWriteLen,a=Math.max(r-o,0),c=i;a&&(r=o);const l=e.length;let h=9;const d=Buffer.allocUnsafe(13+l+8+4+r);p(d,d.length-4,0),d[4]=T;const f=this._writeReqid=this._writeReqid+1&J;p(d,f,5),p(d,l,h),d.set(e,h+=4),h+=l;for(let e=7;e>=0;--e)d[h+e]=255&i,i/=256;p(d,r,h+=8),u(t,d,n,n+r,h+=4),this._requests[f]={cb:i=>{i?"function"==typeof s&&s(i):a?this.write(e,t,n+r,a,c+r,s):"function"==typeof s&&s(void 0,n+r)}};const g=_e(this,d);if(this._debug){const e=g?"Sent":"Buffered";this._debug(`SFTP: Outbound: ${e} WRITE (id:${f})`)}}writeData(e,t,n,r,i,s){this.write(e,t,n,r,i,s)}fastGet(e,t,n,r){if(this.server)throw new Error("Client-only method called in server mode");ae(this,i,e,t,n,r)}fastPut(e,t,n,r){if(this.server)throw new Error("Client-only method called in server mode");ae(i,this,e,t,n,r)}readFile(e,t,n){if(this.server)throw new Error("Client-only method called in server mode");let r;if("function"==typeof n?r=n:"function"==typeof t&&(r=t,t=void 0),"string"==typeof t)t={encoding:t,flag:"r"};else if(t){if("object"!=typeof t)throw new TypeError("Bad arguments")}else t={encoding:null,flag:"r"};const i=t.encoding;if(i&&!Buffer.isEncoding(i))throw new Error(`Unknown encoding: ${i}`);let s,o,a,c,l=0,h=0;const u=t.flag||"r",f=()=>{0===s?(o=Buffer.allocUnsafe(8192),this.read(c,o,0,8192,h,p)):this.read(c,o,l,s-l,h,p)},p=(e,t)=>{let n;if(e){if(n=e.code===E.EOF,!n)return this.close(c,()=>r&&r(e))}else n=!1;if(n||0===s&&0===t)return g();h+=t,l+=t,0!==s?l===s?g():f():(a.push(d(o,0,t)),f())};p._wantEOFError=!0;const g=()=>{this.close(c,e=>(0===s?o=Buffer.concat(a,l):l<s&&(o=d(o,0,l)),i&&(o=o.toString(i)),r&&r(e,o)))};this.open(e,u,438,(t,n)=>{if(t)return r&&r(t);c=n;const i=(t,n)=>{if(t)this.stat(e,(e,n)=>{if(e)return this.close(c,()=>{r&&r(t)});i(null,n)});else{if(s=n.size||0,0===s)return a=[],f();o=Buffer.allocUnsafe(s),f()}};this.fstat(c,i)})}writeFile(e,t,n,r){if(this.server)throw new Error("Client-only method called in server mode");let i;if("function"==typeof r?i=r:"function"==typeof n&&(i=n,n=void 0),"string"==typeof n)n={encoding:n,mode:438,flag:"w"};else if(n){if("object"!=typeof n)throw new TypeError("Bad arguments")}else n={encoding:"utf8",mode:438,flag:"w"};if(n.encoding&&!Buffer.isEncoding(n.encoding))throw new Error(`Unknown encoding: ${n.encoding}`);const s=n.flag||"w";this.open(e,s,n.mode,(r,o)=>{if(r)i&&i(r);else{const r=Buffer.isBuffer(t)?t:Buffer.from(""+t,n.encoding||"utf8"),a=/a/.test(s)?null:0;if(null===a){const t=(n,s)=>{n?this.stat(e,(e,r)=>{if(e)return this.close(o,()=>{i&&i(n)});t(null,r)}):ce(this,o,r,0,r.length,s.size,i)};return void this.fstat(o,t)}ce(this,o,r,0,r.length,a,i)}})}appendFile(e,t,n,r){if(this.server)throw new Error("Client-only method called in server mode");let i;if("function"==typeof r?i=r:"function"==typeof n&&(i=n,n=void 0),"string"==typeof n)n={encoding:n,mode:438,flag:"a"};else if(n){if("object"!=typeof n)throw new TypeError("Bad arguments")}else n={encoding:"utf8",mode:438,flag:"a"};n.flag||(n=Object.assign({flag:"a"},n)),this.writeFile(e,t,n,i)}exists(e,t){if(this.server)throw new Error("Client-only method called in server mode");this.stat(e,e=>{t&&t(!e)})}unlink(e,t){if(this.server)throw new Error("Client-only method called in server mode");const n=Buffer.byteLength(e);let r=9;const i=Buffer.allocUnsafe(13+n);p(i,i.length-4,0),i[4]=x;const s=this._writeReqid=this._writeReqid+1&J;p(i,s,5),p(i,n,r),i.utf8Write(e,r+=4,n),this._requests[s]={cb:t};const o=_e(this,i);this._debug&&this._debug(`SFTP: Outbound: ${o?"Buffered":"Sending"} REMOVE`)}rename(e,t,n){if(this.server)throw new Error("Client-only method called in server mode");const r=Buffer.byteLength(e),i=Buffer.byteLength(t);let s=9;const o=Buffer.allocUnsafe(13+r+4+i);p(o,o.length-4,0),o[4]=H;const a=this._writeReqid=this._writeReqid+1&J;p(o,a,5),p(o,r,s),o.utf8Write(e,s+=4,r),p(o,i,s+=r),o.utf8Write(t,s+=4,i),this._requests[a]={cb:n};const c=_e(this,o);this._debug&&this._debug(`SFTP: Outbound: ${c?"Buffered":"Sending"} RENAME`)}mkdir(e,t,n){if(this.server)throw new Error("Client-only method called in server mode");let r=0,i=0;"function"==typeof t&&(n=t,t=void 0),"object"==typeof t&&null!==t&&(r=(t=he(t)).flags,i=t.nb);const s=Buffer.byteLength(e);let o=9;const a=Buffer.allocUnsafe(13+s+4+i);p(a,a.length-4,0),a[4]=D;const c=this._writeReqid=this._writeReqid+1&J;p(a,c,5),p(a,s,o),a.utf8Write(e,o+=4,s),p(a,r,o+=s),i&&(o+=4,i===b.length?a.set(b,o):u(b,a,0,i,o),o+=i),this._requests[c]={cb:n};const l=_e(this,a);this._debug&&this._debug(`SFTP: Outbound: ${l?"Buffered":"Sending"} MKDIR`)}rmdir(e,t){if(this.server)throw new Error("Client-only method called in server mode");const n=Buffer.byteLength(e);let r=9;const i=Buffer.allocUnsafe(13+n);p(i,i.length-4,0),i[4]=M;const s=this._writeReqid=this._writeReqid+1&J;p(i,s,5),p(i,n,r),i.utf8Write(e,r+=4,n),this._requests[s]={cb:t};const o=_e(this,i);this._debug&&this._debug(`SFTP: Outbound: ${o?"Buffered":"Sending"} RMDIR`)}readdir(e,t,n){if(this.server)throw new Error("Client-only method called in server mode");"function"==typeof t&&(n=t,t={}),"object"==typeof t&&null!==t||(t={});const r=!t||!t.full;if(!Buffer.isBuffer(e)&&"string"!=typeof e)throw new Error("missing directory handle or path");if("string"==typeof e){const r=[];let i=0;const s=(e,o)=>{if(e)return n(e);this.readdir(o,t,(e,t)=>{const a=e&&e.code===E.EOF;if(e&&!a)return this.close(o,()=>n(e));if(a)return this.close(o,e=>{if(e)return n(e);n(void 0,r)});for(let e=0;e<t.length;++e,++i)r[i]=t[e];s(void 0,o)})};return this.opendir(e,s)}const i=e.length;let s=9;const o=Buffer.allocUnsafe(13+i);p(o,o.length-4,0),o[4]=L;const a=this._writeReqid=this._writeReqid+1&J;p(o,a,5),p(o,i,s),o.set(e,s+=4),this._requests[a]={cb:r?(e,t)=>{if("function"==typeof n){if(e)return n(e);for(let e=t.length-1;e>=0;--e)"."!==t[e].filename&&".."!==t[e].filename||t.splice(e,1);n(void 0,t)}}:n};const c=_e(this,o);this._debug&&this._debug(`SFTP: Outbound: ${c?"Buffered":"Sending"} READDIR`)}fstat(e,t){if(this.server)throw new Error("Client-only method called in server mode");if(!Buffer.isBuffer(e))throw new Error("handle is not a Buffer");const n=e.length;let r=9;const i=Buffer.allocUnsafe(13+n);p(i,i.length-4,0),i[4]=O;const s=this._writeReqid=this._writeReqid+1&J;p(i,s,5),p(i,n,r),i.set(e,r+=4),this._requests[s]={cb:t};const o=_e(this,i);this._debug&&this._debug(`SFTP: Outbound: ${o?"Buffered":"Sending"} FSTAT`)}stat(e,t){if(this.server)throw new Error("Client-only method called in server mode");const n=Buffer.byteLength(e);let r=9;const i=Buffer.allocUnsafe(13+n);p(i,i.length-4,0),i[4]=F;const s=this._writeReqid=this._writeReqid+1&J;p(i,s,5),p(i,n,r),i.utf8Write(e,r+=4,n),this._requests[s]={cb:t};const o=_e(this,i);this._debug&&this._debug(`SFTP: Outbound: ${o?"Buffered":"Sending"} STAT`)}lstat(e,t){if(this.server)throw new Error("Client-only method called in server mode");const n=Buffer.byteLength(e);let r=9;const i=Buffer.allocUnsafe(13+n);p(i,i.length-4,0),i[4]=R;const s=this._writeReqid=this._writeReqid+1&J;p(i,s,5),p(i,n,r),i.utf8Write(e,r+=4,n),this._requests[s]={cb:t};const o=_e(this,i);this._debug&&this._debug(`SFTP: Outbound: ${o?"Buffered":"Sending"} LSTAT`)}opendir(e,t){if(this.server)throw new Error("Client-only method called in server mode");const n=Buffer.byteLength(e);let r=9;const i=Buffer.allocUnsafe(13+n);p(i,i.length-4,0),i[4]=B;const s=this._writeReqid=this._writeReqid+1&J;p(i,s,5),p(i,n,r),i.utf8Write(e,r+=4,n),this._requests[s]={cb:t};const o=_e(this,i);this._debug&&this._debug(`SFTP: Outbound: ${o?"Buffered":"Sending"} OPENDIR`)}setstat(e,t,n){if(this.server)throw new Error("Client-only method called in server mode");let r=0,i=0;"object"==typeof t&&null!==t?(r=(t=he(t)).flags,i=t.nb):"function"==typeof t&&(n=t);const s=Buffer.byteLength(e);let o=9;const a=Buffer.allocUnsafe(13+s+4+i);p(a,a.length-4,0),a[4]=N;const c=this._writeReqid=this._writeReqid+1&J;p(a,c,5),p(a,s,o),a.utf8Write(e,o+=4,s),p(a,r,o+=s),i&&(o+=4,i===b.length?a.set(b,o):u(b,a,0,i,o),o+=i),this._requests[c]={cb:n};const l=_e(this,a);this._debug&&this._debug(`SFTP: Outbound: ${l?"Buffered":"Sending"} SETSTAT`)}fsetstat(e,t,n){if(this.server)throw new Error("Client-only method called in server mode");if(!Buffer.isBuffer(e))throw new Error("handle is not a Buffer");let r=0,i=0;"object"==typeof t&&null!==t?(r=(t=he(t)).flags,i=t.nb):"function"==typeof t&&(n=t);const s=e.length;let o=9;const a=Buffer.allocUnsafe(13+s+4+i);p(a,a.length-4,0),a[4]=P;const c=this._writeReqid=this._writeReqid+1&J;p(a,c,5),p(a,s,o),a.set(e,o+=4),p(a,r,o+=s),i&&(o+=4,i===b.length?a.set(b,o):u(b,a,0,i,o),o+=i),this._requests[c]={cb:n};const l=_e(this,a);this._debug&&this._debug(`SFTP: Outbound: ${l?"Buffered":"Sending"} FSETSTAT`)}futimes(e,t,n,r){return this.fsetstat(e,{atime:ue(t),mtime:ue(n)},r)}utimes(e,t,n,r){return this.setstat(e,{atime:ue(t),mtime:ue(n)},r)}fchown(e,t,n,r){return this.fsetstat(e,{uid:t,gid:n},r)}chown(e,t,n,r){return this.setstat(e,{uid:t,gid:n},r)}fchmod(e,t,n){return this.fsetstat(e,{mode:t},n)}chmod(e,t,n){return this.setstat(e,{mode:t},n)}readlink(e,t){if(this.server)throw new Error("Client-only method called in server mode");const n=Buffer.byteLength(e);let r=9;const i=Buffer.allocUnsafe(13+n);p(i,i.length-4,0),i[4]=j;const s=this._writeReqid=this._writeReqid+1&J;p(i,s,5),p(i,n,r),i.utf8Write(e,r+=4,n),this._requests[s]={cb:(e,n)=>{if("function"==typeof t)return e?t(e):n&&n.length?void t(void 0,n[0].filename):t(new Error("Response missing link info"))}};const o=_e(this,i);this._debug&&this._debug(`SFTP: Outbound: ${o?"Buffered":"Sending"} READLINK`)}symlink(e,t,n){if(this.server)throw new Error("Client-only method called in server mode");const r=Buffer.byteLength(t),i=Buffer.byteLength(e);let s=9;const o=Buffer.allocUnsafe(13+r+4+i);p(o,o.length-4,0),o[4]=W;const a=this._writeReqid=this._writeReqid+1&J;p(o,a,5),this._isOpenSSH?(p(o,i,s),o.utf8Write(e,s+=4,i),p(o,r,s+=i),o.utf8Write(t,s+=4,r)):(p(o,r,s),o.utf8Write(t,s+=4,r),p(o,i,s+=r),o.utf8Write(e,s+=4,i)),this._requests[a]={cb:n};const c=_e(this,o);this._debug&&this._debug(`SFTP: Outbound: ${c?"Buffered":"Sending"} SYMLINK`)}realpath(e,t){if(this.server)throw new Error("Client-only method called in server mode");const n=Buffer.byteLength(e);let r=9;const i=Buffer.allocUnsafe(13+n);p(i,i.length-4,0),i[4]=U;const s=this._writeReqid=this._writeReqid+1&J;p(i,s,5),p(i,n,r),i.utf8Write(e,r+=4,n),this._requests[s]={cb:(e,n)=>{if("function"==typeof t)return e?t(e):n&&n.length?void t(void 0,n[0].filename):t(new Error("Response missing path info"))}};const o=_e(this,i);this._debug&&this._debug(`SFTP: Outbound: ${o?"Buffered":"Sending"} REALPATH`)}ext_openssh_rename(e,t,n){if(this.server)throw new Error("Client-only method called in server mode");const r=this._extensions["posix-rename@openssh.com"];if(!r||"1"!==r)throw new Error("Server does not support this extended request");const i=Buffer.byteLength(e),s=Buffer.byteLength(t);let o=9;const a=Buffer.allocUnsafe(41+i+4+s);p(a,a.length-4,0),a[4]=Q;const c=this._writeReqid=this._writeReqid+1&J;p(a,c,5),p(a,24,o),a.utf8Write("posix-rename@openssh.com",o+=4,24),p(a,i,o+=24),a.utf8Write(e,o+=4,i),p(a,s,o+=i),a.utf8Write(t,o+=4,s),this._requests[c]={cb:n};const l=_e(this,a);if(this._debug){const e=l?"Buffered":"Sending";this._debug(`SFTP: Outbound: ${e} posix-rename@openssh.com`)}}ext_openssh_statvfs(e,t){if(this.server)throw new Error("Client-only method called in server mode");const n=this._extensions["statvfs@openssh.com"];if(!n||"2"!==n)throw new Error("Server does not support this extended request");const r=Buffer.byteLength(e);let i=9;const s=Buffer.allocUnsafe(36+r);p(s,s.length-4,0),s[4]=Q;const o=this._writeReqid=this._writeReqid+1&J;p(s,o,5),p(s,19,i),s.utf8Write("statvfs@openssh.com",i+=4,19),p(s,r,i+=19),s.utf8Write(e,i+=4,r),this._requests[o]={extended:"statvfs@openssh.com",cb:t};const a=_e(this,s);if(this._debug){const e=a?"Buffered":"Sending";this._debug(`SFTP: Outbound: ${e} statvfs@openssh.com`)}}ext_openssh_fstatvfs(e,t){if(this.server)throw new Error("Client-only method called in server mode");const n=this._extensions["fstatvfs@openssh.com"];if(!n||"2"!==n)throw new Error("Server does not support this extended request");if(!Buffer.isBuffer(e))throw new Error("handle is not a Buffer");const r=e.length;let i=9;const s=Buffer.allocUnsafe(37+r);p(s,s.length-4,0),s[4]=Q;const o=this._writeReqid=this._writeReqid+1&J;p(s,o,5),p(s,20,i),s.utf8Write("fstatvfs@openssh.com",i+=4,20),p(s,r,i+=20),s.set(e,i+=4),this._requests[o]={extended:"fstatvfs@openssh.com",cb:t};const a=_e(this,s);if(this._debug){const e=a?"Buffered":"Sending";this._debug(`SFTP: Outbound: ${e} fstatvfs@openssh.com`)}}ext_openssh_hardlink(e,t,n){if(this.server)throw new Error("Client-only method called in server mode");if("1"!==this._extensions["hardlink@openssh.com"])throw new Error("Server does not support this extended request");const r=Buffer.byteLength(e),i=Buffer.byteLength(t);let s=9;const o=Buffer.allocUnsafe(37+r+4+i);p(o,o.length-4,0),o[4]=Q;const a=this._writeReqid=this._writeReqid+1&J;p(o,a,5),p(o,20,s),o.utf8Write("hardlink@openssh.com",s+=4,20),p(o,r,s+=20),o.utf8Write(e,s+=4,r),p(o,i,s+=r),o.utf8Write(t,s+=4,i),this._requests[a]={cb:n};const c=_e(this,o);if(this._debug){const e=c?"Buffered":"Sending";this._debug(`SFTP: Outbound: ${e} hardlink@openssh.com`)}}ext_openssh_fsync(e,t){if(this.server)throw new Error("Client-only method called in server mode");if("1"!==this._extensions["fsync@openssh.com"])throw new Error("Server does not support this extended request");if(!Buffer.isBuffer(e))throw new Error("handle is not a Buffer");const n=e.length;let r=9;const i=Buffer.allocUnsafe(34+n);p(i,i.length-4,0),i[4]=Q;const s=this._writeReqid=this._writeReqid+1&J;p(i,s,5),p(i,17,r),i.utf8Write("fsync@openssh.com",r+=4,17),p(i,n,r+=17),i.set(e,r+=4),this._requests[s]={cb:t};const o=_e(this,i);this._debug&&this._debug(`SFTP: Outbound: ${o?"Buffered":"Sending"} fsync@openssh.com`)}ext_openssh_lsetstat(e,t,n){if(this.server)throw new Error("Client-only method called in server mode");if("1"!==this._extensions["lsetstat@openssh.com"])throw new Error("Server does not support this extended request");let r=0,i=0;"object"==typeof t&&null!==t?(r=(t=he(t)).flags,i=t.nb):"function"==typeof t&&(n=t);const s=Buffer.byteLength(e);let o=9;const a=Buffer.allocUnsafe(37+s+4+i);p(a,a.length-4,0),a[4]=Q;const c=this._writeReqid=this._writeReqid+1&J;p(a,c,5),p(a,20,o),a.utf8Write("lsetstat@openssh.com",o+=4,20),p(a,s,o+=20),a.utf8Write(e,o+=4,s),p(a,r,o+=s),i&&(o+=4,i===b.length?a.set(b,o):u(b,a,0,i,o),o+=i),this._requests[c]={cb:n};const l=_e(this,a);if(this._debug){const e=l?"Buffered":"Sending";this._debug(`SFTP: Outbound: ${e} lsetstat@openssh.com`)}}ext_openssh_expandPath(e,t){if(this.server)throw new Error("Client-only method called in server mode");if("1"!==this._extensions["expand-path@openssh.com"])throw new Error("Server does not support this extended request");const n=Buffer.byteLength(e);let r=9;const i=Buffer.allocUnsafe(40+n);p(i,i.length-4,0),i[4]=Q;const s=this._writeReqid=this._writeReqid+1&J;p(i,s,5),p(i,23,r),i.utf8Write("expand-path@openssh.com",r+=4,23),p(i,n,r+=20),i.utf8Write(e,r+=4,n),this._requests[s]={cb:(e,n)=>{if("function"==typeof t)return e?t(e):n&&n.length?void t(void 0,n[0].filename):t(new Error("Response missing expanded path"))}};const o=_e(this,i);if(this._debug){const e=o?"Buffered":"Sending";this._debug(`SFTP: Outbound: ${e} expand-path@openssh.com`)}}ext_copy_data(e,t,n,r,i,s){if(this.server)throw new Error("Client-only method called in server mode");if("1"!==this._extensions["copy-data"])throw new Error("Server does not support this extended request");if(!Buffer.isBuffer(e))throw new Error("Source handle is not a Buffer");if(!Buffer.isBuffer(r))throw new Error("Destination handle is not a Buffer");let o=0;const a=Buffer.allocUnsafe(26+e.length+8+8+4+r.length+8);p(a,a.length-4,o),o+=4,a[o]=Q,++o;const c=this._writeReqid=this._writeReqid+1&J;p(a,c,o),o+=4,p(a,9,o),o+=4,a.utf8Write("copy-data",o,9),o+=9,p(a,e.length,o),o+=4,a.set(e,o),o+=e.length;for(let e=7;e>=0;--e)a[o+e]=255&t,t/=256;o+=8;for(let e=7;e>=0;--e)a[o+e]=255&n,n/=256;o+=8,p(a,r.length,o),o+=4,a.set(r,o),o+=r.length;for(let e=7;e>=0;--e)a[o+e]=255&i,i/=256;this._requests[c]={cb:s};const l=_e(this,a);if(this._debug){const e=l?"Buffered":"Sending";this._debug(`SFTP: Outbound: ${e} copy-data`)}}ext_home_dir(e,t){if(this.server)throw new Error("Client-only method called in server mode");if("1"!==this._extensions["home-directory"])throw new Error("Server does not support this extended request");if("string"!=typeof e)throw new TypeError("username is not a string");let n=0;const r=Buffer.byteLength(e),i=Buffer.allocUnsafe(31+r);p(i,i.length-4,n),n+=4,i[n]=Q,++n;const s=this._writeReqid=this._writeReqid+1&J;p(i,s,n),n+=4,p(i,14,n),n+=4,i.utf8Write("home-directory",n,14),n+=14,p(i,r,n),n+=4,i.utf8Write(e,n,r),n+=r,this._requests[s]={cb:(e,n)=>{if("function"==typeof t)return e?t(e):n&&n.length?void t(void 0,n[0].filename):t(new Error("Response missing home directory"))}};const o=_e(this,i);if(this._debug){const e=o?"Buffered":"Sending";this._debug(`SFTP: Outbound: ${e} home-directory`)}}ext_users_groups(e,t,n){if(this.server)throw new Error("Client-only method called in server mode");if("1"!==this._extensions["users-groups-by-id@openssh.com"])throw new Error("Server does not support this extended request");if(!Array.isArray(e))throw new TypeError("uids is not an array");for(const t of e)if(!Number.isInteger(t)||t<0||t>2**32-1)throw new Error("uid values must all be 32-bit unsigned integers");if(!Array.isArray(t))throw new TypeError("gids is not an array");for(const e of t)if(!Number.isInteger(e)||e<0||e>2**32-1)throw new Error("gid values must all be 32-bit unsigned integers");let r=0;const i=Buffer.allocUnsafe(47+4*e.length+4+4*t.length);p(i,i.length-4,r),r+=4,i[r]=Q,++r;const s=this._writeReqid=this._writeReqid+1&J;p(i,s,r),r+=4,p(i,30,r),r+=4,i.utf8Write("users-groups-by-id@openssh.com",r,30),r+=30,p(i,4*e.length,r),r+=4;for(const t of e)p(i,t,r),r+=4;p(i,4*t.length,r),r+=4;for(const e of t)p(i,e,r),r+=4;this._requests[s]={extended:"users-groups-by-id@openssh.com",cb:n};const o=_e(this,i);if(this._debug){const e=o?"Buffered":"Sending";this._debug(`SFTP: Outbound: ${e} users-groups-by-id@openssh.com`)}}handle(e,t){if(!this.server)throw new Error("Server-only method called in client mode");if(!Buffer.isBuffer(t))throw new Error("handle is not a Buffer");const n=t.length;if(n>256)throw new Error("handle too large (> 256 bytes)");let r=9;const i=Buffer.allocUnsafe(13+n);p(i,i.length-4,0),i[4]=$,p(i,e,5),p(i,n,r),n&&i.set(t,r+=4);const s=_e(this,i);this._debug&&this._debug(`SFTP: Outbound: ${s?"Buffered":"Sending"} HANDLE`)}status(e,t,n){if(!this.server)throw new Error("Server-only method called in client mode");if(!A.has(t))throw new Error(`Bad status code: ${t}`);n||(n="");const r=Buffer.byteLength(n);let i=9;const s=Buffer.allocUnsafe(17+r+4);p(s,s.length-4,0),s[4]=z,p(s,e,5),p(s,t,i),p(s,r,i+=4),i+=4,r&&(s.utf8Write(n,i,r),i+=r),p(s,0,i);const o=_e(this,s);this._debug&&this._debug(`SFTP: Outbound: ${o?"Buffered":"Sending"} STATUS`)}data(e,t,n){if(!this.server)throw new Error("Server-only method called in client mode");const r=Buffer.isBuffer(t);if(!r&&"string"!=typeof t)throw new Error("data is not a Buffer or string");let i;r||n||(n=void 0,i=!0);const s=r?t.length:Buffer.byteLength(t,n);let o=9;const a=Buffer.allocUnsafe(13+s);p(a,a.length-4,0),a[4]=G,p(a,e,5),p(a,s,o),s&&(r?a.set(t,o+=4):i?a.utf8Write(t,o+=4,s):a.write(t,o+=4,s,n));const c=_e(this,a);this._debug&&this._debug(`SFTP: Outbound: ${c?"Buffered":"Sending"} DATA`)}name(e,t){if(!this.server)throw new Error("Server-only method called in client mode");if(!Array.isArray(t)){if("object"!=typeof t||null===t)throw new Error("names is not an object or array");t=[t]}const n=t.length;let r,i=0;const s=[];for(let e=0;e<n;++e){const n=t[e],o=n&&n.filename&&"string"==typeof n.filename?n.filename:"";i+=4+Buffer.byteLength(o);const a=n&&n.longname&&"string"==typeof n.longname?n.longname:"";if(i+=4+Buffer.byteLength(a),"object"==typeof n.attrs&&null!==n.attrs){if(r=he(n.attrs),i+=4+r.nb,r.nb){let e;r.nb===b.length?e=new Uint8Array(b):(e=new Uint8Array(r.nb),u(b,e,0,r.nb,0)),r.bytes=e}s.push(r)}else i+=4,s.push(null)}let o=9;const a=Buffer.allocUnsafe(13+i);p(a,a.length-4,0),a[4]=K,p(a,e,5),p(a,n,o),o+=4;for(let e=0;e<n;++e){const n=t[e];{const e=n&&n.filename&&"string"==typeof n.filename?n.filename:"",t=Buffer.byteLength(e);p(a,t,o),o+=4,t&&(a.utf8Write(e,o,t),o+=t)}{const e=n&&n.longname&&"string"==typeof n.longname?n.longname:"",t=Buffer.byteLength(e);p(a,t,o),o+=4,t&&(a.utf8Write(e,o,t),o+=t)}const r=s[e];r?(p(a,r.flags,o),o+=4,r.flags&&r.bytes&&(a.set(r.bytes,o),o+=r.nb)):(p(a,0,o),o+=4)}const c=_e(this,a);this._debug&&this._debug(`SFTP: Outbound: ${c?"Buffered":"Sending"} NAME`)}attrs(e,t){if(!this.server)throw new Error("Server-only method called in client mode");if("object"!=typeof t||null===t)throw new Error("attrs is not an object");const n=(t=he(t)).flags,r=t.nb;let i=9;const s=Buffer.allocUnsafe(13+r);p(s,s.length-4,0),s[4]=Y,p(s,e,5),p(s,n,i),r&&(i+=4,r===b.length?s.set(b,i):u(b,s,0,r,i),i+=r);const o=_e(this,s);this._debug&&this._debug(`SFTP: Outbound: ${o?"Buffered":"Sending"} ATTRS`)}},Stats:le,STATUS_CODE:E,stringToFlags:pe}},8692(e,t,n){"use strict";const r=n(6982);let i;try{i=n(6295)()}catch{}const{bindingAvailable:s,CIPHER_INFO:o,MAC_INFO:a}=n(7064),c=(()=>{if("function"==typeof r.sign&&"function"==typeof r.verify){const e="-----BEGIN PRIVATE KEY-----\r\nMC4CAQAwBQYDK2VwBCIEIHKj+sVa9WcD/q2DJUJaf43Kptc8xYuUQA4bOFj9vC8T\r\n-----END PRIVATE KEY-----",t=Buffer.from("a");let n,i;try{n=r.sign(null,t,e),i=r.verify(null,t,e,n)}catch{}return Buffer.isBuffer(n)&&64===n.length&&!0===i}return!1})(),l="function"==typeof r.diffieHellman&&"function"==typeof r.generateKeyPairSync&&"function"==typeof r.createPublicKey,h=["ecdh-sha2-nistp256","ecdh-sha2-nistp384","ecdh-sha2-nistp521","diffie-hellman-group-exchange-sha256","diffie-hellman-group14-sha256","diffie-hellman-group15-sha512","diffie-hellman-group16-sha512","diffie-hellman-group17-sha512","diffie-hellman-group18-sha512"];l&&(h.unshift("curve25519-sha256"),h.unshift("curve25519-sha256@libssh.org"));const u=h.concat(["diffie-hellman-group-exchange-sha1","diffie-hellman-group14-sha1","diffie-hellman-group1-sha1"]),d=["ecdsa-sha2-nistp256","ecdsa-sha2-nistp384","ecdsa-sha2-nistp521","rsa-sha2-512","rsa-sha2-256","ssh-rsa"];c&&d.unshift("ssh-ed25519");const f=d.concat(["ssh-dss"]),p=(()=>{const e=r.getCiphers();return t=>e.includes(o[t].sslName)})();let g=["aes128-gcm@openssh.com","aes256-gcm@openssh.com","aes128-ctr","aes192-ctr","aes256-ctr"];i&&i.flags&&!i.flags.aes?s?g.unshift("chacha20-poly1305@openssh.com"):g.push("chacha20-poly1305@openssh.com"):s&&i&&"x86"===i.arch?g.splice(4,0,"chacha20-poly1305@openssh.com"):g.push("chacha20-poly1305@openssh.com"),g=g.filter(p);const m=g.concat(["aes256-cbc","aes192-cbc","aes128-cbc","blowfish-cbc","3des-cbc","aes128-gcm","aes256-gcm","arcfour256","arcfour128","cast128-cbc","arcfour"].filter(p)),_=(()=>{const e=r.getHashes();return t=>e.includes(a[t].sslName)})(),y=["hmac-sha2-256-etm@openssh.com","hmac-sha2-512-etm@openssh.com","hmac-sha1-etm@openssh.com","hmac-sha2-256","hmac-sha2-512","hmac-sha1"].filter(_),v=y.concat(["hmac-md5","hmac-sha2-256-96","hmac-sha2-512-96","hmac-ripemd160","hmac-sha1-96","hmac-md5-96"].filter(_)),b=["none","zlib@openssh.com","zlib"],E=b.concat([]),A={BAD_DHGEX:1,OLD_EXIT:2,DYN_RPORT_BUG:4,BUG_DHGEX_LARGE:8,IMPLY_RSA_SHA2_SIGALGS:16};e.exports={MESSAGE:{DISCONNECT:1,IGNORE:2,UNIMPLEMENTED:3,DEBUG:4,SERVICE_REQUEST:5,SERVICE_ACCEPT:6,EXT_INFO:7,KEXINIT:20,NEWKEYS:21,KEXDH_INIT:30,KEXDH_REPLY:31,KEXDH_GEX_GROUP:31,KEXDH_GEX_INIT:32,KEXDH_GEX_REPLY:33,KEXDH_GEX_REQUEST:34,KEXECDH_INIT:30,KEXECDH_REPLY:31,USERAUTH_REQUEST:50,USERAUTH_FAILURE:51,USERAUTH_SUCCESS:52,USERAUTH_BANNER:53,USERAUTH_PASSWD_CHANGEREQ:60,USERAUTH_PK_OK:60,USERAUTH_INFO_REQUEST:60,USERAUTH_INFO_RESPONSE:61,GLOBAL_REQUEST:80,REQUEST_SUCCESS:81,REQUEST_FAILURE:82,CHANNEL_OPEN:90,CHANNEL_OPEN_CONFIRMATION:91,CHANNEL_OPEN_FAILURE:92,CHANNEL_WINDOW_ADJUST:93,CHANNEL_DATA:94,CHANNEL_EXTENDED_DATA:95,CHANNEL_EOF:96,CHANNEL_CLOSE:97,CHANNEL_REQUEST:98,CHANNEL_SUCCESS:99,CHANNEL_FAILURE:100},DISCONNECT_REASON:{HOST_NOT_ALLOWED_TO_CONNECT:1,PROTOCOL_ERROR:2,KEY_EXCHANGE_FAILED:3,RESERVED:4,MAC_ERROR:5,COMPRESSION_ERROR:6,SERVICE_NOT_AVAILABLE:7,PROTOCOL_VERSION_NOT_SUPPORTED:8,HOST_KEY_NOT_VERIFIABLE:9,CONNECTION_LOST:10,BY_APPLICATION:11,TOO_MANY_CONNECTIONS:12,AUTH_CANCELED_BY_USER:13,NO_MORE_AUTH_METHODS_AVAILABLE:14,ILLEGAL_USER_NAME:15},DISCONNECT_REASON_STR:void 0,CHANNEL_OPEN_FAILURE:{ADMINISTRATIVELY_PROHIBITED:1,CONNECT_FAILED:2,UNKNOWN_CHANNEL_TYPE:3,RESOURCE_SHORTAGE:4},TERMINAL_MODE:{TTY_OP_END:0,VINTR:1,VQUIT:2,VERASE:3,VKILL:4,VEOF:5,VEOL:6,VEOL2:7,VSTART:8,VSTOP:9,VSUSP:10,VDSUSP:11,VREPRINT:12,VWERASE:13,VLNEXT:14,VFLUSH:15,VSWTCH:16,VSTATUS:17,VDISCARD:18,IGNPAR:30,PARMRK:31,INPCK:32,ISTRIP:33,INLCR:34,IGNCR:35,ICRNL:36,IUCLC:37,IXON:38,IXANY:39,IXOFF:40,IMAXBEL:41,ISIG:50,ICANON:51,XCASE:52,ECHO:53,ECHOE:54,ECHOK:55,ECHONL:56,NOFLSH:57,TOSTOP:58,IEXTEN:59,ECHOCTL:60,ECHOKE:61,PENDIN:62,OPOST:70,OLCUC:71,ONLCR:72,OCRNL:73,ONOCR:74,ONLRET:75,CS7:90,CS8:91,PARENB:92,PARODD:93,TTY_OP_ISPEED:128,TTY_OP_OSPEED:129},CHANNEL_EXTENDED_DATATYPE:{STDERR:1},SIGNALS:["ABRT","ALRM","FPE","HUP","ILL","INT","QUIT","SEGV","TERM","USR1","USR2","KILL","PIPE"].reduce((e,t)=>({...e,[t]:1}),{}),COMPAT:A,COMPAT_CHECKS:[["Cisco-1.25",A.BAD_DHGEX],[/^Cisco-1[.]/,A.BUG_DHGEX_LARGE],[/^[0-9.]+$/,A.OLD_EXIT],[/^OpenSSH_5[.][0-9]+/,A.DYN_RPORT_BUG],[/^OpenSSH_7[.]4/,A.IMPLY_RSA_SHA2_SIGALGS]],DEFAULT_KEX:h,SUPPORTED_KEX:u,DEFAULT_SERVER_HOST_KEY:d,SUPPORTED_SERVER_HOST_KEY:f,DEFAULT_CIPHER:g,SUPPORTED_CIPHER:m,DEFAULT_MAC:y,SUPPORTED_MAC:v,DEFAULT_COMPRESSION:b,SUPPORTED_COMPRESSION:E,curve25519Supported:l,eddsaSupported:c},e.exports.DISCONNECT_REASON_BY_VALUE=Array.from(Object.entries(e.exports.DISCONNECT_REASON)).reduce((e,[t,n])=>({...e,[n]:t}),{})},7064(e,t,n){"use strict";const{createCipheriv:r,createDecipheriv:i,createHmac:s,randomFillSync:o,timingSafeEqual:a}=n(6982),{readUInt32BE:c,writeUInt32BE:l}=n(9576),h=Buffer[Symbol.species],u=2**32-1,d=Buffer.alloc(0),f=Buffer.alloc(4),p=new Map,g=35e3;let m,_,y,v,b,E,A;try{m=n(4215),({AESGCMCipher:_,ChaChaPolyCipher:y,GenericCipher:v,AESGCMDecipher:b,ChaChaPolyDecipher:E,GenericDecipher:A}=m)}catch{}const S=(()=>{function e(e,t,n,r,i,s,o){return{sslName:e,blockLen:t,keyLen:n,ivLen:0!==r||1&o?r:t,authLen:i,discardLen:s,stream:!!(1&o)}}return{"chacha20-poly1305@openssh.com":e("chacha20",8,64,0,16,0,1),"aes128-gcm":e("aes-128-gcm",16,16,12,16,0,1),"aes256-gcm":e("aes-256-gcm",16,32,12,16,0,1),"aes128-gcm@openssh.com":e("aes-128-gcm",16,16,12,16,0,1),"aes256-gcm@openssh.com":e("aes-256-gcm",16,32,12,16,0,1),"aes128-cbc":e("aes-128-cbc",16,16,0,0,0,0),"aes192-cbc":e("aes-192-cbc",16,24,0,0,0,0),"aes256-cbc":e("aes-256-cbc",16,32,0,0,0,0),"rijndael-cbc@lysator.liu.se":e("aes-256-cbc",16,32,0,0,0,0),"3des-cbc":e("des-ede3-cbc",8,24,0,0,0,0),"blowfish-cbc":e("bf-cbc",8,16,0,0,0,0),"idea-cbc":e("idea-cbc",8,16,0,0,0,0),"cast128-cbc":e("cast-cbc",8,16,0,0,0,0),"aes128-ctr":e("aes-128-ctr",16,16,16,0,0,1),"aes192-ctr":e("aes-192-ctr",16,24,16,0,0,1),"aes256-ctr":e("aes-256-ctr",16,32,16,0,0,1),"3des-ctr":e("des-ede3",8,24,8,0,0,1),"blowfish-ctr":e("bf-ecb",8,16,8,0,0,1),"cast128-ctr":e("cast5-ecb",8,16,8,0,0,1),arcfour:e("rc4",8,16,0,0,1536,1),arcfour128:e("rc4",8,16,0,0,1536,1),arcfour256:e("rc4",8,32,0,0,1536,1),arcfour512:e("rc4",8,64,0,0,1536,1)}})(),w=(()=>{function e(e,t,n,r){return{sslName:e,len:t,actualLen:n,isETM:r}}return{"hmac-md5":e("md5",16,16,!1),"hmac-md5-96":e("md5",16,12,!1),"hmac-ripemd160":e("ripemd160",20,20,!1),"hmac-sha1":e("sha1",20,20,!1),"hmac-sha1-etm@openssh.com":e("sha1",20,20,!0),"hmac-sha1-96":e("sha1",20,12,!1),"hmac-sha2-256":e("sha256",32,32,!1),"hmac-sha2-256-etm@openssh.com":e("sha256",32,32,!0),"hmac-sha2-256-96":e("sha256",32,12,!1),"hmac-sha2-512":e("sha512",64,64,!1),"hmac-sha2-512-etm@openssh.com":e("sha512",64,64,!0),"hmac-sha2-512-96":e("sha512",64,12,!1)}})();const C=Buffer.alloc(32),I=Buffer.alloc(16);let k,T,R;class O{constructor(e){const t=e.outbound;this.outSeqno=t.seqno,this._onWrite=t.onWrite,this._encKeyMain=t.cipherKey.slice(0,32),this._encKeyPktLen=t.cipherKey.slice(32),this._dead=!1}free(){this._dead=!0}allocPacket(e){let t=5+e,n=8-(t-4&7);n<4&&(n+=8),t+=n;const r=Buffer.allocUnsafe(t);return l(r,t-4,0),r[4]=n,o(r,5+e,n),r}encrypt(e){if(this._dead)return;I[0]=0,l(I,this.outSeqno,12);const t=r("chacha20",this._encKeyMain,I).update(C),n=r("chacha20",this._encKeyPktLen,I).update(e.slice(0,4));this._onWrite(n),I[0]=1;const i=r("chacha20",this._encKeyMain,I).update(e.slice(4));this._onWrite(i),R(T,n,n.length,i,i.length,t);const s=Buffer.allocUnsafe(16);s.set(new Uint8Array(k.HEAPU8.buffer,T,16),0),this._onWrite(s),this.outSeqno=this.outSeqno+1>>>0}}class N{constructor(e){const t=e.outbound;this.outSeqno=t.seqno,this._onWrite=t.onWrite,this._instance=new y(t.cipherKey),this._dead=!1}free(){this._dead=!0,this._instance.free()}allocPacket(e){let t=5+e,n=8-(t-4&7);n<4&&(n+=8),t+=n;const r=Buffer.allocUnsafe(t+16);return l(r,t-4,0),r[4]=n,o(r,5+e,n),r}encrypt(e){this._dead||(this._instance.encrypt(e,this.outSeqno),this._onWrite(e),this.outSeqno=this.outSeqno+1>>>0)}}class P{constructor(e){const t=e.outbound;this.outSeqno=t.seqno,this._onWrite=t.onWrite,this._encSSLName=t.cipherInfo.sslName,this._encKey=t.cipherKey,this._encIV=t.cipherIV,this._dead=!1}free(){this._dead=!0}allocPacket(e){let t=5+e,n=16-(t-4&15);n<4&&(n+=16),t+=n;const r=Buffer.allocUnsafe(t);return l(r,t-4,0),r[4]=n,o(r,5+e,n),r}encrypt(e){if(this._dead)return;const t=r(this._encSSLName,this._encKey,this._encIV);t.setAutoPadding(!1);const n=e.slice(0,4);t.setAAD(n),this._onWrite(n);const i=t.update(e.slice(4));this._onWrite(i);const s=t.final();s.length&&this._onWrite(s);const o=t.getAuthTag();this._onWrite(o),W(this._encIV),this.outSeqno=this.outSeqno+1>>>0}}class B{constructor(e){const t=e.outbound;this.outSeqno=t.seqno,this._onWrite=t.onWrite,this._instance=new _(t.cipherInfo.sslName,t.cipherKey,t.cipherIV),this._dead=!1}free(){this._dead=!0,this._instance.free()}allocPacket(e){let t=5+e,n=16-(t-4&15);n<4&&(n+=16),t+=n;const r=Buffer.allocUnsafe(t+16);return l(r,t-4,0),r[4]=n,o(r,5+e,n),r}encrypt(e){this._dead||(this._instance.encrypt(e),this._onWrite(e),this.outSeqno=this.outSeqno+1>>>0)}}class L{constructor(e){const t=e.outbound;this.outSeqno=t.seqno,this._onWrite=t.onWrite,this._encBlockLen=t.cipherInfo.blockLen,this._cipherInstance=r(t.cipherInfo.sslName,t.cipherKey,t.cipherIV),this._macSSLName=t.macInfo.sslName,this._macKey=t.macKey,this._macActualLen=t.macInfo.actualLen,this._macETM=t.macInfo.isETM,this._aadLen=this._macETM?4:0,this._dead=!1;const n=t.cipherInfo.discardLen;if(n){let e=p.get(n);void 0===e&&(e=Buffer.alloc(n),p.set(n,e)),this._cipherInstance.update(e)}}free(){this._dead=!0}allocPacket(e){const t=this._encBlockLen;let n=5+e,r=t-(n-this._aadLen&t-1);r<4&&(r+=t),n+=r;const i=Buffer.allocUnsafe(n);return l(i,n-4,0),i[4]=r,o(i,5+e,r),i}encrypt(e){if(this._dead)return;let t;if(this._macETM){const n=new Uint8Array(e.buffer,e.byteOffset,4),r=this._cipherInstance.update(new Uint8Array(e.buffer,e.byteOffset+4,e.length-4));this._onWrite(n),this._onWrite(r),t=s(this._macSSLName,this._macKey),l(f,this.outSeqno,0),t.update(f),t.update(n),t.update(r)}else{const n=this._cipherInstance.update(e);this._onWrite(n),t=s(this._macSSLName,this._macKey),l(f,this.outSeqno,0),t.update(f),t.update(e)}let n=t.digest();n.length>this._macActualLen&&(n=n.slice(0,this._macActualLen)),this._onWrite(n),this.outSeqno=this.outSeqno+1>>>0}}class x{constructor(e){const t=e.outbound;this.outSeqno=t.seqno,this._onWrite=t.onWrite,this._encBlockLen=t.cipherInfo.blockLen,this._macLen=t.macInfo.len,this._macActualLen=t.macInfo.actualLen,this._aadLen=t.macInfo.isETM?4:0,this._instance=new v(t.cipherInfo.sslName,t.cipherKey,t.cipherIV,t.macInfo.sslName,t.macKey,t.macInfo.isETM),this._dead=!1}free(){this._dead=!0,this._instance.free()}allocPacket(e){const t=this._encBlockLen;let n=5+e,r=t-(n-this._aadLen&t-1);r<4&&(r+=t),n+=r;const i=Buffer.allocUnsafe(n+this._macLen);return l(i,n-4,0),i[4]=r,o(i,5+e,r),i}encrypt(e){this._dead||(this._instance.encrypt(e,this.outSeqno),this._macActualLen<this._macLen&&(e=new h(e.buffer,e.byteOffset,e.length-(this._macLen-this._macActualLen))),this._onWrite(e),this.outSeqno=this.outSeqno+1>>>0)}}class D{constructor(e){const t=e.inbound;this.inSeqno=t.seqno,this._onPayload=t.onPayload,this._decKeyMain=t.decipherKey.slice(0,32),this._decKeyPktLen=t.decipherKey.slice(32),this._len=0,this._lenBuf=Buffer.alloc(4),this._lenPos=0,this._packet=null,this._pktLen=0,this._mac=Buffer.allocUnsafe(16),this._calcMac=Buffer.allocUnsafe(16),this._macPos=0}free(){}decrypt(e,t,n){for(;t<n;){if(this._lenPos<4){let r=Math.min(4-this._lenPos,n-t);for(;r--;)this._lenBuf[this._lenPos++]=e[t++];if(this._lenPos<4)return;I[0]=0,l(I,this.inSeqno,12);const s=i("chacha20",this._decKeyPktLen,I).update(this._lenBuf);if(this._len=c(s,0),this._len>g||this._len<8||7&this._len)throw new Error("Bad packet length")}if(this._pktLen<this._len){if(t>=n)return;const r=Math.min(this._len-this._pktLen,n-t);let i;if(i=0!==t||r!==n?new Uint8Array(e.buffer,e.byteOffset+t,r):e,r===this._len?this._packet=i:(this._packet||(this._packet=Buffer.allocUnsafe(this._len)),this._packet.set(i,this._pktLen)),t+=r,this._pktLen+=r,this._pktLen<this._len||t>=n)return}{const r=Math.min(16-this._macPos,n-t);if(0!==t||r!==n?this._mac.set(new Uint8Array(e.buffer,e.byteOffset+t,r),this._macPos):this._mac.set(e,this._macPos),t+=r,this._macPos+=r,this._macPos<16)return}I[0]=0,l(I,this.inSeqno,12);const s=r("chacha20",this._decKeyMain,I).update(C);if(R(T,this._lenBuf,4,this._packet,this._packet.length,s),this._calcMac.set(new Uint8Array(k.HEAPU8.buffer,T,16),0),!a(this._calcMac,this._mac))throw new Error("Invalid MAC");I[0]=1;const o=i("chacha20",this._decKeyMain,I).update(this._packet),u=new h(o.buffer,o.byteOffset+1,o.length-o[0]-1);this.inSeqno=this.inSeqno+1>>>0,this._len=0,this._lenPos=0,this._packet=null,this._pktLen=0,this._macPos=0;{const e=this._onPayload(u);if(void 0!==e)return!1===e?t:e}}}}class M{constructor(e){const t=e.inbound;this.inSeqno=t.seqno,this._onPayload=t.onPayload,this._instance=new E(t.decipherKey),this._len=0,this._lenBuf=Buffer.alloc(4),this._lenPos=0,this._packet=null,this._pktLen=0,this._mac=Buffer.allocUnsafe(16),this._macPos=0}free(){this._instance.free()}decrypt(e,t,n){for(;t<n;){if(this._lenPos<4){let r=Math.min(4-this._lenPos,n-t);for(;r--;)this._lenBuf[this._lenPos++]=e[t++];if(this._lenPos<4)return;if(this._len=this._instance.decryptLen(this._lenBuf,this.inSeqno),this._len>g||this._len<8||7&this._len)throw new Error("Bad packet length");if(t>=n)return}if(this._pktLen<this._len){const r=Math.min(this._len-this._pktLen,n-t);let i;if(i=0!==t||r!==n?new Uint8Array(e.buffer,e.byteOffset+t,r):e,r===this._len?this._packet=i:(this._packet||(this._packet=Buffer.allocUnsafe(this._len)),this._packet.set(i,this._pktLen)),t+=r,this._pktLen+=r,this._pktLen<this._len||t>=n)return}{const r=Math.min(16-this._macPos,n-t);if(0!==t||r!==n?this._mac.set(new Uint8Array(e.buffer,e.byteOffset+t,r),this._macPos):this._mac.set(e,this._macPos),t+=r,this._macPos+=r,this._macPos<16)return}this._instance.decrypt(this._packet,this._mac,this.inSeqno);const r=new h(this._packet.buffer,this._packet.byteOffset+1,this._packet.length-this._packet[0]-1);this.inSeqno=this.inSeqno+1>>>0,this._len=0,this._lenPos=0,this._packet=null,this._pktLen=0,this._macPos=0;{const e=this._onPayload(r);if(void 0!==e)return!1===e?t:e}}}}class U{constructor(e){const t=e.inbound;this.inSeqno=t.seqno,this._onPayload=t.onPayload,this._decipherInstance=null,this._decipherSSLName=t.decipherInfo.sslName,this._decipherKey=t.decipherKey,this._decipherIV=t.decipherIV,this._len=0,this._lenBytes=0,this._packet=null,this._packetPos=0,this._pktLen=0,this._tag=Buffer.allocUnsafe(16),this._tagPos=0}free(){}decrypt(e,t,n){for(;t<n;){if(this._lenBytes<4){let r=Math.min(4-this._lenBytes,n-t);for(this._lenBytes+=r;r--;)this._len=(this._len<<8)+e[t++];if(this._lenBytes<4)return;if(this._len+20>g||this._len<16||15&this._len)throw new Error("Bad packet length");this._decipherInstance=i(this._decipherSSLName,this._decipherKey,this._decipherIV),this._decipherInstance.setAutoPadding(!1),this._decipherInstance.setAAD(Q(this._len))}if(this._pktLen<this._len){if(t>=n)return;const r=Math.min(this._len-this._pktLen,n-t);let i;if(i=0!==t||r!==n?this._decipherInstance.update(new Uint8Array(e.buffer,e.byteOffset+t,r)):this._decipherInstance.update(e),i.length&&(r===this._len?this._packet=i:(this._packet||(this._packet=Buffer.allocUnsafe(this._len)),this._packet.set(i,this._packetPos)),this._packetPos+=i.length),t+=r,this._pktLen+=r,this._pktLen<this._len||t>=n)return}{const r=Math.min(16-this._tagPos,n-t);if(0!==t||r!==n?this._tag.set(new Uint8Array(e.buffer,e.byteOffset+t,r),this._tagPos):this._tag.set(e,this._tagPos),t+=r,this._tagPos+=r,this._tagPos<16)return}{this._decipherInstance.setAuthTag(this._tag);const e=this._decipherInstance.final();e.length&&(this._packet?this._packet.set(e,this._packetPos):this._packet=e)}const r=this._packet?new h(this._packet.buffer,this._packet.byteOffset+1,this._packet.length-this._packet[0]-1):d;this.inSeqno=this.inSeqno+1>>>0,W(this._decipherIV),this._len=0,this._lenBytes=0,this._packet=null,this._packetPos=0,this._pktLen=0,this._tagPos=0;{const e=this._onPayload(r);if(void 0!==e)return!1===e?t:e}}}}class F{constructor(e){const t=e.inbound;this.inSeqno=t.seqno,this._onPayload=t.onPayload,this._instance=new b(t.decipherInfo.sslName,t.decipherKey,t.decipherIV),this._len=0,this._lenBytes=0,this._packet=null,this._pktLen=0,this._tag=Buffer.allocUnsafe(16),this._tagPos=0}free(){}decrypt(e,t,n){for(;t<n;){if(this._lenBytes<4){let r=Math.min(4-this._lenBytes,n-t);for(this._lenBytes+=r;r--;)this._len=(this._len<<8)+e[t++];if(this._lenBytes<4)return;if(this._len+20>g||this._len<16||15&this._len)throw new Error(`Bad packet length: ${this._len}`)}if(this._pktLen<this._len){if(t>=n)return;const r=Math.min(this._len-this._pktLen,n-t);let i;if(i=0!==t||r!==n?new Uint8Array(e.buffer,e.byteOffset+t,r):e,r===this._len?this._packet=i:(this._packet||(this._packet=Buffer.allocUnsafe(this._len)),this._packet.set(i,this._pktLen)),t+=r,this._pktLen+=r,this._pktLen<this._len||t>=n)return}{const r=Math.min(16-this._tagPos,n-t);if(0!==t||r!==n?this._tag.set(new Uint8Array(e.buffer,e.byteOffset+t,r),this._tagPos):this._tag.set(e,this._tagPos),t+=r,this._tagPos+=r,this._tagPos<16)return}this._instance.decrypt(this._packet,this._len,this._tag);const r=new h(this._packet.buffer,this._packet.byteOffset+1,this._packet.length-this._packet[0]-1);this.inSeqno=this.inSeqno+1>>>0,this._len=0,this._lenBytes=0,this._packet=null,this._pktLen=0,this._tagPos=0;{const e=this._onPayload(r);if(void 0!==e)return!1===e?t:e}}}}class H{constructor(e){const t=e.inbound;this.inSeqno=t.seqno,this._onPayload=t.onPayload,this._decipherInstance=i(t.decipherInfo.sslName,t.decipherKey,t.decipherIV),this._decipherInstance.setAutoPadding(!1),this._block=Buffer.allocUnsafe(t.macInfo.isETM?4:t.decipherInfo.blockLen),this._blockSize=t.decipherInfo.blockLen,this._blockPos=0,this._len=0,this._packet=null,this._packetPos=0,this._pktLen=0,this._mac=Buffer.allocUnsafe(t.macInfo.actualLen),this._macPos=0,this._macSSLName=t.macInfo.sslName,this._macKey=t.macKey,this._macActualLen=t.macInfo.actualLen,this._macETM=t.macInfo.isETM,this._macInstance=null;const n=t.decipherInfo.discardLen;if(n){let e=p.get(n);void 0===e&&(e=Buffer.alloc(n),p.set(n,e)),this._decipherInstance.update(e)}}free(){}decrypt(e,t,n){for(;t<n;){if(this._blockPos<this._block.length){const r=Math.min(this._block.length-this._blockPos,n-t);if(0!==t||r!==n||r<e.length?this._block.set(new Uint8Array(e.buffer,e.byteOffset+t,r),this._blockPos):this._block.set(e,this._blockPos),t+=r,this._blockPos+=r,this._blockPos<this._block.length)return;let i,o;if(this._macETM?this._len=o=c(this._block,0):(i=this._decipherInstance.update(this._block),this._len=c(i,0),o=4+this._len-this._blockSize),this._len>g||this._len<5||o&this._blockSize-1)throw new Error("Bad packet length");if(this._macInstance=s(this._macSSLName,this._macKey),l(f,this.inSeqno,0),this._macInstance.update(f),this._macETM?this._macInstance.update(this._block):(this._macInstance.update(new Uint8Array(i.buffer,i.byteOffset,4)),this._pktLen=i.length-4,this._packetPos=this._pktLen,this._packet=Buffer.allocUnsafe(this._len),this._packet.set(new Uint8Array(i.buffer,i.byteOffset+4,this._packetPos),0)),t>=n)return}if(this._pktLen<this._len){const r=Math.min(this._len-this._pktLen,n-t);let i;i=0!==t||r!==n?new Uint8Array(e.buffer,e.byteOffset+t,r):e,this._macETM&&this._macInstance.update(i);const s=this._decipherInstance.update(i);if(s.length&&(r===this._len?this._packet=s:(this._packet||(this._packet=Buffer.allocUnsafe(this._len)),this._packet.set(s,this._packetPos)),this._packetPos+=s.length),t+=r,this._pktLen+=r,this._pktLen<this._len||t>=n)return}{const r=Math.min(this._macActualLen-this._macPos,n-t);if(0!==t||r!==n?this._mac.set(new Uint8Array(e.buffer,e.byteOffset+t,r),this._macPos):this._mac.set(e,this._macPos),t+=r,this._macPos+=r,this._macPos<this._macActualLen)return}this._macETM||this._macInstance.update(this._packet);let r=this._macInstance.digest();if(this._macActualLen<r.length&&(r=new Uint8Array(r.buffer,r.byteOffset,this._macActualLen)),!q(r,this._mac))throw new Error("Invalid MAC");const i=new h(this._packet.buffer,this._packet.byteOffset+1,this._packet.length-this._packet[0]-1);this.inSeqno=this.inSeqno+1>>>0,this._blockPos=0,this._len=0,this._packet=null,this._packetPos=0,this._pktLen=0,this._macPos=0,this._macInstance=null;{const e=this._onPayload(i);if(void 0!==e)return!1===e?t:e}}}}class j{constructor(e){const t=e.inbound;this.inSeqno=t.seqno,this._onPayload=t.onPayload,this._instance=new A(t.decipherInfo.sslName,t.decipherKey,t.decipherIV,t.macInfo.sslName,t.macKey,t.macInfo.isETM,t.macInfo.actualLen),this._block=Buffer.allocUnsafe(t.macInfo.isETM||t.decipherInfo.stream?4:t.decipherInfo.blockLen),this._blockPos=0,this._len=0,this._packet=null,this._pktLen=0,this._mac=Buffer.allocUnsafe(t.macInfo.actualLen),this._macPos=0,this._macActualLen=t.macInfo.actualLen,this._macETM=t.macInfo.isETM}free(){this._instance.free()}decrypt(e,t,n){for(;t<n;){if(this._blockPos<this._block.length){const r=Math.min(this._block.length-this._blockPos,n-t);if(0!==t||r!==n||r<e.length?this._block.set(new Uint8Array(e.buffer,e.byteOffset+t,r),this._blockPos):this._block.set(e,this._blockPos),t+=r,this._blockPos+=r,this._blockPos<this._block.length)return;let i;if(this._macETM?this._len=i=c(this._block,0):(this._instance.decryptBlock(this._block),this._len=c(this._block,0),i=4+this._len-this._block.length),this._len>g||this._len<5||i&this._block.length-1)throw new Error("Bad packet length");if(this._macETM||(this._pktLen=this._block.length-4,this._pktLen&&(this._packet=Buffer.allocUnsafe(this._len),this._packet.set(new Uint8Array(this._block.buffer,this._block.byteOffset+4,this._pktLen),0))),t>=n)return}if(this._pktLen<this._len){const r=Math.min(this._len-this._pktLen,n-t);let i;if(i=0!==t||r!==n?new Uint8Array(e.buffer,e.byteOffset+t,r):e,r===this._len?this._packet=i:(this._packet||(this._packet=Buffer.allocUnsafe(this._len)),this._packet.set(i,this._pktLen)),t+=r,this._pktLen+=r,this._pktLen<this._len||t>=n)return}{const r=Math.min(this._macActualLen-this._macPos,n-t);if(0!==t||r!==n?this._mac.set(new Uint8Array(e.buffer,e.byteOffset+t,r),this._macPos):this._mac.set(e,this._macPos),t+=r,this._macPos+=r,this._macPos<this._macActualLen)return}this._instance.decrypt(this._packet,this.inSeqno,this._block,this._mac);const r=new h(this._packet.buffer,this._packet.byteOffset+1,this._packet.length-this._packet[0]-1);this.inSeqno=this.inSeqno+1>>>0,this._blockPos=0,this._len=0,this._packet=null,this._pktLen=0,this._macPos=0,this._macInstance=null;{const e=this._onPayload(r);if(void 0!==e)return!1===e?t:e}}}}function W(e){++e[11]>>>8&&++e[10]>>>8&&++e[9]>>>8&&++e[8]>>>8&&++e[7]>>>8&&++e[6]>>>8&&++e[5]>>>8&&++e[4]}const Q=(()=>{const e=Buffer.alloc(4);return t=>(e[0]=t>>>24,e[1]=t>>>16,e[2]=t>>>8,e[3]=t,e)})();function q(e,t){return e.length!==t.length?(a(e,e),!1):a(e,t)}e.exports={CIPHER_INFO:S,MAC_INFO:w,bindingAvailable:!!m,init:new Promise(async(e,t)=>{try{k=await n(6566)(),T=k._malloc(16),R=k.cwrap("poly1305_auth",null,["number","array","number","array","number","array"])}catch(e){return t(e)}e()}),NullCipher:class{constructor(e,t){this.outSeqno=e,this._onWrite=t,this._dead=!1}free(){this._dead=!0}allocPacket(e){let t=5+e,n=8-(7&t);n<4&&(n+=8),t+=n;const r=Buffer.allocUnsafe(t);return l(r,t-4,0),r[4]=n,o(r,5+e,n),r}encrypt(e){this._dead||(this._onWrite(e),this.outSeqno=this.outSeqno+1>>>0)}},createCipher:function(e){if("object"!=typeof e||null===e)throw new Error("Invalid config");if("object"!=typeof e.outbound||null===e.outbound)throw new Error("Invalid outbound");const t=e.outbound;if("function"!=typeof t.onWrite)throw new Error("Invalid outbound.onWrite");if("object"!=typeof t.cipherInfo||null===t.cipherInfo)throw new Error("Invalid outbound.cipherInfo");if(!Buffer.isBuffer(t.cipherKey)||t.cipherKey.length!==t.cipherInfo.keyLen)throw new Error("Invalid outbound.cipherKey");if(t.cipherInfo.ivLen&&(!Buffer.isBuffer(t.cipherIV)||t.cipherIV.length!==t.cipherInfo.ivLen))throw new Error("Invalid outbound.cipherIV");if("number"!=typeof t.seqno||t.seqno<0||t.seqno>u)throw new Error("Invalid outbound.seqno");const n=!!t.forceNative;switch(t.cipherInfo.sslName){case"aes-128-gcm":case"aes-256-gcm":return _&&!n?new B(e):new P(e);case"chacha20":return y&&!n?new N(e):new O(e);default:if("object"!=typeof t.macInfo||null===t.macInfo)throw new Error("Invalid outbound.macInfo");if(!Buffer.isBuffer(t.macKey)||t.macKey.length!==t.macInfo.len)throw new Error("Invalid outbound.macKey");return v&&!n?new x(e):new L(e)}},NullDecipher:class{constructor(e,t){this.inSeqno=e,this._onPayload=t,this._len=0,this._lenBytes=0,this._packet=null,this._packetPos=0}free(){}decrypt(e,t,n){for(;t<n;){if(this._lenBytes<4){let r=Math.min(4-this._lenBytes,n-t);for(this._lenBytes+=r;r--;)this._len=(this._len<<8)+e[t++];if(this._lenBytes<4)return;if(this._len>g||this._len<8||4+this._len&7)throw new Error("Bad packet length");if(t>=n)return}if(this._packetPos<this._len){const r=Math.min(this._len-this._packetPos,n-t);let i;if(i=0!==t||r!==n?new Uint8Array(e.buffer,e.byteOffset+t,r):e,r===this._len?this._packet=i:(this._packet||(this._packet=Buffer.allocUnsafe(this._len)),this._packet.set(i,this._packetPos)),t+=r,this._packetPos+=r,this._packetPos<this._len)return}const r=this._packet?new h(this._packet.buffer,this._packet.byteOffset+1,this._packet.length-this._packet[0]-1):d;this.inSeqno=this.inSeqno+1>>>0,this._len=0,this._lenBytes=0,this._packet=null,this._packetPos=0;{const e=this._onPayload(r);if(void 0!==e)return!1===e?t:e}}}},createDecipher:function(e){if("object"!=typeof e||null===e)throw new Error("Invalid config");if("object"!=typeof e.inbound||null===e.inbound)throw new Error("Invalid inbound");const t=e.inbound;if("function"!=typeof t.onPayload)throw new Error("Invalid inbound.onPayload");if("object"!=typeof t.decipherInfo||null===t.decipherInfo)throw new Error("Invalid inbound.decipherInfo");if(!Buffer.isBuffer(t.decipherKey)||t.decipherKey.length!==t.decipherInfo.keyLen)throw new Error("Invalid inbound.decipherKey");if(t.decipherInfo.ivLen&&(!Buffer.isBuffer(t.decipherIV)||t.decipherIV.length!==t.decipherInfo.ivLen))throw new Error("Invalid inbound.decipherIV");if("number"!=typeof t.seqno||t.seqno<0||t.seqno>u)throw new Error("Invalid inbound.seqno");const n=!!t.forceNative;switch(t.decipherInfo.sslName){case"aes-128-gcm":case"aes-256-gcm":return b&&!n?new F(e):new U(e);case"chacha20":return E&&!n?new M(e):new D(e);default:if("object"!=typeof t.macInfo||null===t.macInfo)throw new Error("Invalid inbound.macInfo");if(!Buffer.isBuffer(t.macKey)||t.macKey.length!==t.macInfo.len)throw new Error("Invalid inbound.macKey");return A&&!n?new j(e):new H(e)}}}},6566(e,t,n){var r,i=(r=(r="undefined"!=typeof document&&document.currentScript?document.currentScript.src:void 0)||__filename,function(e){var t,i,s;e=e||{},t||(t=void 0!==e?e:{}),t.ready=new Promise(function(e,t){i=e,s=t});var o,a={};for(o in t)t.hasOwnProperty(o)&&(a[o]=t[o]);var c,l,h,u,d,f="object"==typeof window,p="function"==typeof importScripts,g="object"==typeof process&&"object"==typeof process.versions&&"string"==typeof process.versions.node,m="";g?(m=p?n(6928).dirname(m)+"/":__dirname+"/",c=function(e,t){var r=q(e);return r?t?r:r.toString():(u||(u=n(9896)),d||(d=n(6928)),e=d.normalize(e),u.readFileSync(e,t?null:"utf8"))},h=function(e){return(e=c(e,!0)).buffer||(e=new Uint8Array(e)),E(e.buffer),e},l=function(e,t,r){var i=q(e);i&&t(i),u||(u=n(9896)),d||(d=n(6928)),e=d.normalize(e),u.readFile(e,function(e,n){e?r(e):t(n.buffer)})},1<process.argv.length&&process.argv[1].replace(/\\/g,"/"),process.argv.slice(2),t.inspect=function(){return"[Emscripten Module object]"}):(f||p)&&(p?m=self.location.href:"undefined"!=typeof document&&document.currentScript&&(m=document.currentScript.src),r&&(m=r),m=0!==m.indexOf("blob:")?m.substr(0,m.lastIndexOf("/")+1):"",c=function(e){try{var t=new XMLHttpRequest;return t.open("GET",e,!1),t.send(null),t.responseText}catch(i){if(e=q(e)){t=[];for(var n=0;n<e.length;n++){var r=e[n];255<r&&(W&&E(!1,"Character code "+r+" ("+String.fromCharCode(r)+") at offset "+n+" not in 0x00-0xFF."),r&=255),t.push(String.fromCharCode(r))}return t.join("")}throw i}},p&&(h=function(e){try{var t=new XMLHttpRequest;return t.open("GET",e,!1),t.responseType="arraybuffer",t.send(null),new Uint8Array(t.response)}catch(t){if(e=q(e))return e;throw t}}),l=function(e,t,n){var r=new XMLHttpRequest;r.open("GET",e,!0),r.responseType="arraybuffer",r.onload=function(){if(200==r.status||0==r.status&&r.response)t(r.response);else{var i=q(e);i?t(i.buffer):n()}},r.onerror=n,r.send(null)}),t.print||console.log.bind(console);var _,y=t.printErr||console.warn.bind(console);for(o in a)a.hasOwnProperty(o)&&(t[o]=a[o]);a=null,t.wasmBinary&&(_=t.wasmBinary),t.noExitRuntime,"object"!=typeof WebAssembly&&D("no native wasm support detected");var v,b=!1;function E(e,t){e||D("Assertion failed: "+t)}function A(e){var n=t["_"+e];return E(n,"Cannot call unknown function "+e+", make sure it is exported"),n}var S,w,C,I="undefined"!=typeof TextDecoder?new TextDecoder("utf8"):void 0;function k(){var e=v.buffer;S=e,t.HEAP8=w=new Int8Array(e),t.HEAP16=new Int16Array(e),t.HEAP32=new Int32Array(e),t.HEAPU8=C=new Uint8Array(e),t.HEAPU16=new Uint16Array(e),t.HEAPU32=new Uint32Array(e),t.HEAPF32=new Float32Array(e),t.HEAPF64=new Float64Array(e)}var T,R=[],O=[],N=[];function P(){var e=t.preRun.shift();R.unshift(e)}var B=0,L=null,x=null;function D(e){throw t.onAbort&&t.onAbort(e),y(e),b=!0,e=new WebAssembly.RuntimeError("abort("+e+"). Build with -s ASSERTIONS=1 for more info."),s(e),e}t.preloadedImages={},t.preloadedAudios={};var M,U="data:application/octet-stream;base64,";if(!(M="data:application/octet-stream;base64,AGFzbQEAAAABIAZgAX8Bf2ADf39/AGABfwBgAABgAAF/YAZ/f39/f38AAgcBAWEBYQAAAwsKAAEDAQAAAgQFAgQFAXABAQEFBwEBgAKAgAIGCQF/AUGAjMACCwclCQFiAgABYwADAWQACQFlAAgBZgAHAWcABgFoAAUBaQAKAWoBAAqGTQpPAQJ/QYAIKAIAIgEgAEEDakF8cSICaiEAAkAgAkEAIAAgAU0bDQAgAD8AQRB0SwRAIAAQAEUNAQtBgAggADYCACABDwtBhAhBMDYCAEF/C4wFAg5+Cn8gACgCJCEUIAAoAiAhFSAAKAIcIREgACgCGCESIAAoAhQhEyACQRBPBEAgAC0ATEVBGHQhFyAAKAIEIhZBBWytIQ8gACgCCCIYQQVsrSENIAAoAgwiGUEFbK0hCyAAKAIQIhpBBWytIQkgADUCACEIIBqtIRAgGa0hDiAYrSEMIBatIQoDQCASIAEtAAMiEiABLQAEQQh0ciABLQAFQRB0ciABLQAGIhZBGHRyQQJ2Qf///x9xaq0iAyAOfiABLwAAIAEtAAJBEHRyIBNqIBJBGHRBgICAGHFqrSIEIBB+fCARIAEtAAdBCHQgFnIgAS0ACEEQdHIgAS0ACSIRQRh0ckEEdkH///8fcWqtIgUgDH58IAEtAApBCHQgEXIgAS0AC0EQdHIgAS0ADEEYdHJBBnYgFWqtIgYgCn58IBQgF2ogAS8ADSABLQAPQRB0cmqtIgcgCH58IAMgDH4gBCAOfnwgBSAKfnwgBiAIfnwgByAJfnwgAyAKfiAEIAx+fCAFIAh+fCAGIAl+fCAHIAt+fCADIAh+IAQgCn58IAUgCX58IAYgC358IAcgDX58IAMgCX4gBCAIfnwgBSALfnwgBiANfnwgByAPfnwiA0IaiEL/////D4N8IgRCGohC/////w+DfCIFQhqIQv////8Pg3wiBkIaiEL/////D4N8IgdCGoinQQVsIAOnQf///x9xaiITQRp2IASnQf///x9xaiESIAWnQf///x9xIREgBqdB////H3EhFSAHp0H///8fcSEUIBNB////H3EhEyABQRBqIQEgAkEQayICQQ9LDQALCyAAIBQ2AiQgACAVNgIgIAAgETYCHCAAIBI2AhggACATNgIUCwMAAQu2BAEGfwJAIAAoAjgiBARAIABBPGohBQJAIAJBECAEayIDIAIgA0kbIgZFDQAgBkEDcSEHAkAgBkEBa0EDSQRAQQAhAwwBCyAGQXxxIQhBACEDA0AgBSADIARqaiABIANqLQAAOgAAIAUgA0EBciIEIAAoAjhqaiABIARqLQAAOgAAIAUgA0ECciIEIAAoAjhqaiABIARqLQAAOgAAIAUgA0EDciIEIAAoAjhqaiABIARqLQAAOgAAIANBBGohAyAAKAI4IQQgCEEEayIIDQALCyAHRQ0AA0AgBSADIARqaiABIANqLQAAOgAAIANBAWohAyAAKAI4IQQgB0EBayIHDQALCyAAIAQgBmoiAzYCOCADQRBJDQEgACAFQRAQAiAAQQA2AjggAiAGayECIAEgBmohAQsgAkEQTwRAIAAgASACQXBxIgMQAiACQQ9xIQIgASADaiEBCyACRQ0AIAJBA3EhBCAAQTxqIQVBACEDIAJBAWtBA08EQCACQXxxIQcDQCAFIAAoAjggA2pqIAEgA2otAAA6AAAgBSADQQFyIgYgACgCOGpqIAEgBmotAAA6AAAgBSADQQJyIgYgACgCOGpqIAEgBmotAAA6AAAgBSADQQNyIgYgACgCOGpqIAEgBmotAAA6AAAgA0EEaiEDIAdBBGsiBw0ACwsgBARAA0AgBSAAKAI4IANqaiABIANqLQAAOgAAIANBAWohAyAEQQFrIgQNAAsLIAAgACgCOCACajYCOAsLoS0BDH8jAEEQayIMJAACQAJAAkACQAJAAkACQAJAAkACQAJAAkAgAEH0AU0EQEGICCgCACIFQRAgAEELakF4cSAAQQtJGyIIQQN2IgJ2IgFBA3EEQCABQX9zQQFxIAJqIgNBA3QiAUG4CGooAgAiBEEIaiEAAkAgBCgCCCICIAFBsAhqIgFGBEBBiAggBUF+IAN3cTYCAAwBCyACIAE2AgwgASACNgIICyAEIANBA3QiAUEDcjYCBCABIARqIgEgASgCBEEBcjYCBAwNCyAIQZAIKAIAIgpNDQEgAQRAAkBBAiACdCIAQQAgAGtyIAEgAnRxIgBBACAAa3FBAWsiACAAQQx2QRBxIgJ2IgFBBXZBCHEiACACciABIAB2IgFBAnZBBHEiAHIgASAAdiIBQQF2QQJxIgByIAEgAHYiAUEBdkEBcSIAciABIAB2aiIDQQN0IgBBuAhqKAIAIgQoAggiASAAQbAIaiIARgRAQYgIIAVBfiADd3EiBTYCAAwBCyABIAA2AgwgACABNgIICyAEQQhqIQAgBCAIQQNyNgIEIAQgCGoiAiADQQN0IgEgCGsiA0EBcjYCBCABIARqIAM2AgAgCgRAIApBA3YiAUEDdEGwCGohB0GcCCgCACEEAn8gBUEBIAF0IgFxRQRAQYgIIAEgBXI2AgAgBwwBCyAHKAIICyEBIAcgBDYCCCABIAQ2AgwgBCAHNgIMIAQgATYCCAtBnAggAjYCAEGQCCADNgIADA0LQYwIKAIAIgZFDQEgBkEAIAZrcUEBayIAIABBDHZBEHEiAnYiAUEFdkEIcSIAIAJyIAEgAHYiAUECdkEEcSIAciABIAB2IgFBAXZBAnEiAHIgASAAdiIBQQF2QQFxIgByIAEgAHZqQQJ0QbgKaigCACIBKAIEQXhxIAhrIQMgASECA0ACQCACKAIQIgBFBEAgAigCFCIARQ0BCyAAKAIEQXhxIAhrIgIgAyACIANJIgIbIQMgACABIAIbIQEgACECDAELCyABIAhqIgkgAU0NAiABKAIYIQsgASABKAIMIgRHBEAgASgCCCIAQZgIKAIASRogACAENgIMIAQgADYCCAwMCyABQRRqIgIoAgAiAEUEQCABKAIQIgBFDQQgAUEQaiECCwNAIAIhByAAIgRBFGoiAigCACIADQAgBEEQaiECIAQoAhAiAA0ACyAHQQA2AgAMCwtBfyEIIABBv39LDQAgAEELaiIAQXhxIQhBjAgoAgAiCUUNAEEAIAhrIQMCQAJAAkACf0EAIAhBgAJJDQAaQR8gCEH///8HSw0AGiAAQQh2IgAgAEGA/j9qQRB2QQhxIgJ0IgAgAEGA4B9qQRB2QQRxIgF0IgAgAEGAgA9qQRB2QQJxIgB0QQ92IAEgAnIgAHJrIgBBAXQgCCAAQRVqdkEBcXJBHGoLIgVBAnRBuApqKAIAIgJFBEBBACEADAELQQAhACAIQQBBGSAFQQF2ayAFQR9GG3QhAQNAAkAgAigCBEF4cSAIayIHIANPDQAgAiEEIAciAw0AQQAhAyACIQAMAwsgACACKAIUIgcgByACIAFBHXZBBHFqKAIQIgJGGyAAIAcbIQAgAUEBdCEBIAINAAsLIAAgBHJFBEBBACEEQQIgBXQiAEEAIABrciAJcSIARQ0DIABBACAAa3FBAWsiACAAQQx2QRBxIgJ2IgFBBXZBCHEiACACciABIAB2IgFBAnZBBHEiAHIgASAAdiIBQQF2QQJxIgByIAEgAHYiAUEBdkEBcSIAciABIAB2akECdEG4CmooAgAhAAsgAEUNAQsDQCAAKAIEQXhxIAhrIgEgA0khAiABIAMgAhshAyAAIAQgAhshBCAAKAIQIgEEfyABBSAAKAIUCyIADQALCyAERQ0AIANBkAgoAgAgCGtPDQAgBCAIaiIGIARNDQEgBCgCGCEFIAQgBCgCDCIBRwRAIAQoAggiAEGYCCgCAEkaIAAgATYCDCABIAA2AggMCgsgBEEUaiICKAIAIgBFBEAgBCgCECIARQ0EIARBEGohAgsDQCACIQcgACIBQRRqIgIoAgAiAA0AIAFBEGohAiABKAIQIgANAAsgB0EANgIADAkLIAhBkAgoAgAiAk0EQEGcCCgCACEDAkAgAiAIayIBQRBPBEBBkAggATYCAEGcCCADIAhqIgA2AgAgACABQQFyNgIEIAIgA2ogATYCACADIAhBA3I2AgQMAQtBnAhBADYCAEGQCEEANgIAIAMgAkEDcjYCBCACIANqIgAgACgCBEEBcjYCBAsgA0EIaiEADAsLIAhBlAgoAgAiBkkEQEGUCCAGIAhrIgE2AgBBoAhBoAgoAgAiAiAIaiIANgIAIAAgAUEBcjYCBCACIAhBA3I2AgQgAkEIaiEADAsLQQAhACAIQS9qIgkCf0HgCygCAARAQegLKAIADAELQewLQn83AgBB5AtCgKCAgICABDcCAEHgCyAMQQxqQXBxQdiq1aoFczYCAEH0C0EANgIAQcQLQQA2AgBBgCALIgFqIgVBACABayIHcSICIAhNDQpBwAsoAgAiBARAQbgLKAIAIgMgAmoiASADTQ0LIAEgBEsNCwtBxAstAABBBHENBQJAAkBBoAgoAgAiAwRAQcgLIQADQCADIAAoAgAiAU8EQCABIAAoAgRqIANLDQMLIAAoAggiAA0ACwtBABABIgFBf0YNBiACIQVB5AsoAgAiA0EBayIAIAFxBEAgAiABayAAIAFqQQAgA2txaiEFCyAFIAhNDQYgBUH+////B0sNBkHACygCACIEBEBBuAsoAgAiAyAFaiIAIANNDQcgACAESw0HCyAFEAEiACABRw0BDAgLIAUgBmsgB3EiBUH+////B0sNBSAFEAEiASAAKAIAIAAoAgRqRg0EIAEhAAsCQCAAQX9GDQAgCEEwaiAFTQ0AQegLKAIAIgEgCSAFa2pBACABa3EiAUH+////B0sEQCAAIQEMCAsgARABQX9HBEAgASAFaiEFIAAhAQwIC0EAIAVrEAEaDAULIAAiAUF/Rw0GDAQLAAtBACEEDAcLQQAhAQwFCyABQX9HDQILQcQLQcQLKAIAQQRyNgIACyACQf7///8HSw0BIAIQASEBQQAQASEAIAFBf0YNASAAQX9GDQEgACABTQ0BIAAgAWsiBSAIQShqTQ0BC0G4C0G4CygCACAFaiIANgIAQbwLKAIAIABJBEBBvAsgADYCAAsCQAJAAkBBoAgoAgAiBwRAQcgLIQADQCABIAAoAgAiAyAAKAIEIgJqRg0CIAAoAggiAA0ACwwCC0GYCCgCACIAQQAgACABTRtFBEBBmAggATYCAAtBACEAQcwLIAU2AgBByAsgATYCAEGoCEF/NgIAQawIQeALKAIANgIAQdQLQQA2AgADQCAAQQN0IgNBuAhqIANBsAhqIgI2AgAgA0G8CGogAjYCACAAQQFqIgBBIEcNAAtBlAggBUEoayIDQXggAWtBB3FBACABQQhqQQdxGyIAayICNgIAQaAIIAAgAWoiADYCACAAIAJBAXI2AgQgASADakEoNgIEQaQIQfALKAIANgIADAILIAAtAAxBCHENACADIAdLDQAgASAHTQ0AIAAgAiAFajYCBEGgCCAHQXggB2tBB3FBACAHQQhqQQdxGyIAaiICNgIAQZQIQZQIKAIAIAVqIgEgAGsiADYCACACIABBAXI2AgQgASAHakEoNgIEQaQIQfALKAIANgIADAELQZgIKAIAIAFLBEBBmAggATYCAAsgASAFaiECQcgLIQACQAJAAkACQAJAAkADQCACIAAoAgBHBEAgACgCCCIADQEMAgsLIAAtAAxBCHFFDQELQcgLIQADQCAHIAAoAgAiAk8EQCACIAAoAgRqIgQgB0sNAwsgACgCCCEADAALAAsgACABNgIAIAAgACgCBCAFajYCBCABQXggAWtBB3FBACABQQhqQQdxG2oiCSAIQQNyNgIEIAJBeCACa0EHcUEAIAJBCGpBB3EbaiIFIAggCWoiBmshAiAFIAdGBEBBoAggBjYCAEGUCEGUCCgCACACaiIANgIAIAYgAEEBcjYCBAwDCyAFQZwIKAIARgRAQZwIIAY2AgBBkAhBkAgoAgAgAmoiADYCACAGIABBAXI2AgQgACAGaiAANgIADAMLIAUoAgQiAEEDcUEBRgRAIABBeHEhBwJAIABB/wFNBEAgBSgCCCIDIABBA3YiAEEDdEGwCGpGGiADIAUoAgwiAUYEQEGICEGICCgCAEF+IAB3cTYCAAwCCyADIAE2AgwgASADNgIIDAELIAUoAhghCAJAIAUgBSgCDCIBRwRAIAUoAggiACABNgIMIAEgADYCCAwBCwJAIAVBFGoiACgCACIDDQAgBUEQaiIAKAIAIgMNAEEAIQEMAQsDQCAAIQQgAyIBQRRqIgAoAgAiAw0AIAFBEGohACABKAIQIgMNAAsgBEEANgIACyAIRQ0AAkAgBSAFKAIcIgNBAnRBuApqIgAoAgBGBEAgACABNgIAIAENAUGMCEGMCCgCAEF+IAN3cTYCAAwCCyAIQRBBFCAIKAIQIAVGG2ogATYCACABRQ0BCyABIAg2AhggBSgCECIABEAgASAANgIQIAAgATYCGAsgBSgCFCIARQ0AIAEgADYCFCAAIAE2AhgLIAUgB2ohBSACIAdqIQILIAUgBSgCBEF+cTYCBCAGIAJBAXI2AgQgAiAGaiACNgIAIAJB/wFNBEAgAkEDdiIAQQN0QbAIaiECAn9BiAgoAgAiAUEBIAB0IgBxRQRAQYgIIAAgAXI2AgAgAgwBCyACKAIICyEAIAIgBjYCCCAAIAY2AgwgBiACNgIMIAYgADYCCAwDC0EfIQAgAkH///8HTQRAIAJBCHYiACAAQYD+P2pBEHZBCHEiA3QiACAAQYDgH2pBEHZBBHEiAXQiACAAQYCAD2pBEHZBAnEiAHRBD3YgASADciAAcmsiAEEBdCACIABBFWp2QQFxckEcaiEACyAGIAA2AhwgBkIANwIQIABBAnRBuApqIQQCQEGMCCgCACIDQQEgAHQiAXFFBEBBjAggASADcjYCACAEIAY2AgAgBiAENgIYDAELIAJBAEEZIABBAXZrIABBH0YbdCEAIAQoAgAhAQNAIAEiAygCBEF4cSACRg0DIABBHXYhASAAQQF0IQAgAyABQQRxaiIEKAIQIgENAAsgBCAGNgIQIAYgAzYCGAsgBiAGNgIMIAYgBjYCCAwCC0GUCCAFQShrIgNBeCABa0EHcUEAIAFBCGpBB3EbIgBrIgI2AgBBoAggACABaiIANgIAIAAgAkEBcjYCBCABIANqQSg2AgRBpAhB8AsoAgA2AgAgByAEQScgBGtBB3FBACAEQSdrQQdxG2pBL2siACAAIAdBEGpJGyICQRs2AgQgAkHQCykCADcCECACQcgLKQIANwIIQdALIAJBCGo2AgBBzAsgBTYCAEHICyABNgIAQdQLQQA2AgAgAkEYaiEAA0AgAEEHNgIEIABBCGohASAAQQRqIQAgASAESQ0ACyACIAdGDQMgAiACKAIEQX5xNgIEIAcgAiAHayIEQQFyNgIEIAIgBDYCACAEQf8BTQRAIARBA3YiAEEDdEGwCGohAgJ/QYgIKAIAIgFBASAAdCIAcUUEQEGICCAAIAFyNgIAIAIMAQsgAigCCAshACACIAc2AgggACAHNgIMIAcgAjYCDCAHIAA2AggMBAtBHyEAIAdCADcCECAEQf///wdNBEAgBEEIdiIAIABBgP4/akEQdkEIcSICdCIAIABBgOAfakEQdkEEcSIBdCIAIABBgIAPakEQdkECcSIAdEEPdiABIAJyIAByayIAQQF0IAQgAEEVanZBAXFyQRxqIQALIAcgADYCHCAAQQJ0QbgKaiEDAkBBjAgoAgAiAkEBIAB0IgFxRQRAQYwIIAEgAnI2AgAgAyAHNgIAIAcgAzYCGAwBCyAEQQBBGSAAQQF2ayAAQR9GG3QhACADKAIAIQEDQCABIgIoAgRBeHEgBEYNBCAAQR12IQEgAEEBdCEAIAIgAUEEcWoiAygCECIBDQALIAMgBzYCECAHIAI2AhgLIAcgBzYCDCAHIAc2AggMAwsgAygCCCIAIAY2AgwgAyAGNgIIIAZBADYCGCAGIAM2AgwgBiAANgIICyAJQQhqIQAMBQsgAigCCCIAIAc2AgwgAiAHNgIIIAdBADYCGCAHIAI2AgwgByAANgIIC0GUCCgCACIAIAhNDQBBlAggACAIayIBNgIAQaAIQaAIKAIAIgIgCGoiADYCACAAIAFBAXI2AgQgAiAIQQNyNgIEIAJBCGohAAwDC0GECEEwNgIAQQAhAAwCCwJAIAVFDQACQCAEKAIcIgJBAnRBuApqIgAoAgAgBEYEQCAAIAE2AgAgAQ0BQYwIIAlBfiACd3EiCTYCAAwCCyAFQRBBFCAFKAIQIARGG2ogATYCACABRQ0BCyABIAU2AhggBCgCECIABEAgASAANgIQIAAgATYCGAsgBCgCFCIARQ0AIAEgADYCFCAAIAE2AhgLAkAgA0EPTQRAIAQgAyAIaiIAQQNyNgIEIAAgBGoiACAAKAIEQQFyNgIEDAELIAQgCEEDcjYCBCAGIANBAXI2AgQgAyAGaiADNgIAIANB/wFNBEAgA0EDdiIAQQN0QbAIaiECAn9BiAgoAgAiAUEBIAB0IgBxRQRAQYgIIAAgAXI2AgAgAgwBCyACKAIICyEAIAIgBjYCCCAAIAY2AgwgBiACNgIMIAYgADYCCAwBC0EfIQAgA0H///8HTQRAIANBCHYiACAAQYD+P2pBEHZBCHEiAnQiACAAQYDgH2pBEHZBBHEiAXQiACAAQYCAD2pBEHZBAnEiAHRBD3YgASACciAAcmsiAEEBdCADIABBFWp2QQFxckEcaiEACyAGIAA2AhwgBkIANwIQIABBAnRBuApqIQICQAJAIAlBASAAdCIBcUUEQEGMCCABIAlyNgIAIAIgBjYCACAGIAI2AhgMAQsgA0EAQRkgAEEBdmsgAEEfRht0IQAgAigCACEIA0AgCCIBKAIEQXhxIANGDQIgAEEddiECIABBAXQhACABIAJBBHFqIgIoAhAiCA0ACyACIAY2AhAgBiABNgIYCyAGIAY2AgwgBiAGNgIIDAELIAEoAggiACAGNgIMIAEgBjYCCCAGQQA2AhggBiABNgIMIAYgADYCCAsgBEEIaiEADAELAkAgC0UNAAJAIAEoAhwiAkECdEG4CmoiACgCACABRgRAIAAgBDYCACAEDQFBjAggBkF+IAJ3cTYCAAwCCyALQRBBFCALKAIQIAFGG2ogBDYCACAERQ0BCyAEIAs2AhggASgCECIABEAgBCAANgIQIAAgBDYCGAsgASgCFCIARQ0AIAQgADYCFCAAIAQ2AhgLAkAgA0EPTQRAIAEgAyAIaiIAQQNyNgIEIAAgAWoiACAAKAIEQQFyNgIEDAELIAEgCEEDcjYCBCAJIANBAXI2AgQgAyAJaiADNgIAIAoEQCAKQQN2IgBBA3RBsAhqIQRBnAgoAgAhAgJ/QQEgAHQiACAFcUUEQEGICCAAIAVyNgIAIAQMAQsgBCgCCAshACAEIAI2AgggACACNgIMIAIgBDYCDCACIAA2AggLQZwIIAk2AgBBkAggAzYCAAsgAUEIaiEACyAMQRBqJAAgAAsQACMAIABrQXBxIgAkACAACwYAIAAkAAsEACMAC4AJAgh/BH4jAEGQAWsiBiQAIAYgBS0AA0EYdEGAgIAYcSAFLwAAIAUtAAJBEHRycjYCACAGIAUoAANBAnZBg/7/H3E2AgQgBiAFKAAGQQR2Qf+B/x9xNgIIIAYgBSgACUEGdkH//8AfcTYCDCAFLwANIQggBS0ADyEJIAZCADcCFCAGQgA3AhwgBkEANgIkIAYgCCAJQRB0QYCAPHFyNgIQIAYgBSgAEDYCKCAGIAUoABQ2AiwgBiAFKAAYNgIwIAUoABwhBSAGQQA6AEwgBkEANgI4IAYgBTYCNCAGIAEgAhAEIAQEQCAGIAMgBBAECyAGKAI4IgEEQCAGQTxqIgIgAWpBAToAACABQQFqQQ9NBEAgASAGakE9aiEEAkBBDyABayIDRQ0AIAMgBGoiAUEBa0EAOgAAIARBADoAACADQQNJDQAgAUECa0EAOgAAIARBADoAASABQQNrQQA6AAAgBEEAOgACIANBB0kNACABQQRrQQA6AAAgBEEAOgADIANBCUkNACAEQQAgBGtBA3EiAWoiBEEANgIAIAQgAyABa0F8cSIBaiIDQQRrQQA2AgAgAUEJSQ0AIARBADYCCCAEQQA2AgQgA0EIa0EANgIAIANBDGtBADYCACABQRlJDQAgBEEANgIYIARBADYCFCAEQQA2AhAgBEEANgIMIANBEGtBADYCACADQRRrQQA2AgAgA0EYa0EANgIAIANBHGtBADYCACABIARBBHFBGHIiAWsiA0EgSQ0AIAEgBGohAQNAIAFCADcDGCABQgA3AxAgAUIANwMIIAFCADcDACABQSBqIQEgA0EgayIDQR9LDQALCwsgBkEBOgBMIAYgAkEQEAILIAY1AjQhECAGNQIwIREgBjUCLCEOIAAgBjUCKCAGKAIkIAYoAiAgBigCHCAGKAIYIgNBGnZqIgJBGnZqIgFBGnZqIgtBgICAYHIgAUH///8fcSINIAJB////H3EiCCAGKAIUIAtBGnZBBWxqIgFB////H3EiCUEFaiIFQRp2IANB////H3EgAUEadmoiA2oiAUEadmoiAkEadmoiBEEadmoiDEEfdSIHIANxIAEgDEEfdkEBayIDQf///x9xIgpxciIBQRp0IAUgCnEgByAJcXJyrXwiDzwAACAAIA9CGIg8AAMgACAPQhCIPAACIAAgD0IIiDwAASAAIA4gByAIcSACIApxciICQRR0IAFBBnZyrXwgD0IgiHwiDjwABCAAIA5CGIg8AAcgACAOQhCIPAAGIAAgDkIIiDwABSAAIBEgByANcSAEIApxciIBQQ50IAJBDHZyrXwgDkIgiHwiDjwACCAAIA5CGIg8AAsgACAOQhCIPAAKIAAgDkIIiDwACSAAIBAgAyAMcSAHIAtxckEIdCABQRJ2cq18IA5CIIh8Ig48AAwgACAOQhiIPAAPIAAgDkIQiDwADiAAIA5CCIg8AA0gBkIANwIwIAZCADcCKCAGQgA3AiAgBkIANwIYIAZCADcCECAGQgA3AgggBkIANwIAIAZBkAFqJAALpwwBB38CQCAARQ0AIABBCGsiAyAAQQRrKAIAIgFBeHEiAGohBQJAIAFBAXENACABQQNxRQ0BIAMgAygCACIBayIDQZgIKAIASQ0BIAAgAWohACADQZwIKAIARwRAIAFB/wFNBEAgAygCCCICIAFBA3YiBEEDdEGwCGpGGiACIAMoAgwiAUYEQEGICEGICCgCAEF+IAR3cTYCAAwDCyACIAE2AgwgASACNgIIDAILIAMoAhghBgJAIAMgAygCDCIBRwRAIAMoAggiAiABNgIMIAEgAjYCCAwBCwJAIANBFGoiAigCACIEDQAgA0EQaiICKAIAIgQNAEEAIQEMAQsDQCACIQcgBCIBQRRqIgIoAgAiBA0AIAFBEGohAiABKAIQIgQNAAsgB0EANgIACyAGRQ0BAkAgAyADKAIcIgJBAnRBuApqIgQoAgBGBEAgBCABNgIAIAENAUGMCEGMCCgCAEF+IAJ3cTYCAAwDCyAGQRBBFCAGKAIQIANGG2ogATYCACABRQ0CCyABIAY2AhggAygCECICBEAgASACNgIQIAIgATYCGAsgAygCFCICRQ0BIAEgAjYCFCACIAE2AhgMAQsgBSgCBCIBQQNxQQNHDQBBkAggADYCACAFIAFBfnE2AgQgAyAAQQFyNgIEIAAgA2ogADYCAA8LIAMgBU8NACAFKAIEIgFBAXFFDQACQCABQQJxRQRAIAVBoAgoAgBGBEBBoAggAzYCAEGUCEGUCCgCACAAaiIANgIAIAMgAEEBcjYCBCADQZwIKAIARw0DQZAIQQA2AgBBnAhBADYCAA8LIAVBnAgoAgBGBEBBnAggAzYCAEGQCEGQCCgCACAAaiIANgIAIAMgAEEBcjYCBCAAIANqIAA2AgAPCyABQXhxIABqIQACQCABQf8BTQRAIAUoAggiAiABQQN2IgRBA3RBsAhqRhogAiAFKAIMIgFGBEBBiAhBiAgoAgBBfiAEd3E2AgAMAgsgAiABNgIMIAEgAjYCCAwBCyAFKAIYIQYCQCAFIAUoAgwiAUcEQCAFKAIIIgJBmAgoAgBJGiACIAE2AgwgASACNgIIDAELAkAgBUEUaiICKAIAIgQNACAFQRBqIgIoAgAiBA0AQQAhAQwBCwNAIAIhByAEIgFBFGoiAigCACIEDQAgAUEQaiECIAEoAhAiBA0ACyAHQQA2AgALIAZFDQACQCAFIAUoAhwiAkECdEG4CmoiBCgCAEYEQCAEIAE2AgAgAQ0BQYwIQYwIKAIAQX4gAndxNgIADAILIAZBEEEUIAYoAhAgBUYbaiABNgIAIAFFDQELIAEgBjYCGCAFKAIQIgIEQCABIAI2AhAgAiABNgIYCyAFKAIUIgJFDQAgASACNgIUIAIgATYCGAsgAyAAQQFyNgIEIAAgA2ogADYCACADQZwIKAIARw0BQZAIIAA2AgAPCyAFIAFBfnE2AgQgAyAAQQFyNgIEIAAgA2ogADYCAAsgAEH/AU0EQCAAQQN2IgFBA3RBsAhqIQACf0GICCgCACICQQEgAXQiAXFFBEBBiAggASACcjYCACAADAELIAAoAggLIQIgACADNgIIIAIgAzYCDCADIAA2AgwgAyACNgIIDwtBHyECIANCADcCECAAQf///wdNBEAgAEEIdiIBIAFBgP4/akEQdkEIcSIBdCICIAJBgOAfakEQdkEEcSICdCIEIARBgIAPakEQdkECcSIEdEEPdiABIAJyIARyayIBQQF0IAAgAUEVanZBAXFyQRxqIQILIAMgAjYCHCACQQJ0QbgKaiEBAkACQAJAQYwIKAIAIgRBASACdCIHcUUEQEGMCCAEIAdyNgIAIAEgAzYCACADIAE2AhgMAQsgAEEAQRkgAkEBdmsgAkEfRht0IQIgASgCACEBA0AgASIEKAIEQXhxIABGDQIgAkEddiEBIAJBAXQhAiAEIAFBBHFqIgdBEGooAgAiAQ0ACyAHIAM2AhAgAyAENgIYCyADIAM2AgwgAyADNgIIDAELIAQoAggiACADNgIMIAQgAzYCCCADQQA2AhggAyAENgIMIAMgADYCCAtBqAhBqAgoAgBBAWsiAEF/IAAbNgIACwsLCQEAQYEICwIGUA==").startsWith(U)){var F=M;M=t.locateFile?t.locateFile(F,m):m+F}function H(){var e=M;try{if(e==M&&_)return new Uint8Array(_);var t=q(e);if(t)return t;if(h)return h(e);throw"both async and sync fetching of the wasm failed"}catch(e){D(e)}}function j(e){for(;0<e.length;){var n=e.shift();if("function"==typeof n)n(t);else{var r=n.m;"number"==typeof r?void 0===n.l?T.get(r)():T.get(r)(n.l):r(void 0===n.l?null:n.l)}}}var W=!1,Q="function"==typeof atob?atob:function(e){var t="",n=0;e=e.replace(/[^A-Za-z0-9\+\/=]/g,"");do{var r="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".indexOf(e.charAt(n++)),i="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".indexOf(e.charAt(n++)),s="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".indexOf(e.charAt(n++)),o="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".indexOf(e.charAt(n++));r=r<<2|i>>4,i=(15&i)<<4|s>>2;var a=(3&s)<<6|o;t+=String.fromCharCode(r),64!==s&&(t+=String.fromCharCode(i)),64!==o&&(t+=String.fromCharCode(a))}while(n<e.length);return t};function q(e){if(e.startsWith(U)){if(e=e.slice(U.length),"boolean"==typeof g&&g){var t=Buffer.from(e,"base64");t=new Uint8Array(t.buffer,t.byteOffset,t.byteLength)}else try{var n=Q(e),r=new Uint8Array(n.length);for(e=0;e<n.length;++e)r[e]=n.charCodeAt(e);t=r}catch(e){throw Error("Converting base64 string to bytes failed.")}return t}}var z={a:function(e){var t=C.length;if(2147483648<(e>>>=0))return!1;for(var n=1;4>=n;n*=2){var r=t*(1+.2/n);r=Math.min(r,e+100663296),0<(r=Math.max(e,r))%65536&&(r+=65536-r%65536);e:{try{v.grow(Math.min(2147483648,r)-S.byteLength+65535>>>16),k();var i=1;break e}catch(e){}i=void 0}if(i)return!0}return!1}};!function(){function e(e){t.asm=e.exports,v=t.asm.b,k(),T=t.asm.j,O.unshift(t.asm.c),B--,t.monitorRunDependencies&&t.monitorRunDependencies(B),0==B&&(null!==L&&(clearInterval(L),L=null),x&&(e=x,x=null,e()))}function n(t){e(t.instance)}function r(e){return function(){if(!_&&(f||p)){if("function"==typeof fetch&&!M.startsWith("file://"))return fetch(M,{credentials:"same-origin"}).then(function(e){if(!e.ok)throw"failed to load wasm binary file at '"+M+"'";return e.arrayBuffer()}).catch(function(){return H()});if(l)return new Promise(function(e,t){l(M,function(t){e(new Uint8Array(t))},t)})}return Promise.resolve().then(function(){return H()})}().then(function(e){return WebAssembly.instantiate(e,i)}).then(e,function(e){y("failed to asynchronously prepare wasm: "+e),D(e)})}var i={a:z};if(B++,t.monitorRunDependencies&&t.monitorRunDependencies(B),t.instantiateWasm)try{return t.instantiateWasm(i,e)}catch(e){return y("Module.instantiateWasm callback failed with error: "+e),!1}(_||"function"!=typeof WebAssembly.instantiateStreaming||M.startsWith(U)||M.startsWith("file://")||"function"!=typeof fetch?r(n):fetch(M,{credentials:"same-origin"}).then(function(e){return WebAssembly.instantiateStreaming(e,i).then(n,function(e){return y("wasm streaming compile failed: "+e),y("falling back to ArrayBuffer instantiation"),r(n)})})).catch(s)}(),t.___wasm_call_ctors=function(){return(t.___wasm_call_ctors=t.asm.c).apply(null,arguments)},t._poly1305_auth=function(){return(t._poly1305_auth=t.asm.d).apply(null,arguments)};var $,G=t.stackSave=function(){return(G=t.stackSave=t.asm.e).apply(null,arguments)},K=t.stackRestore=function(){return(K=t.stackRestore=t.asm.f).apply(null,arguments)},Y=t.stackAlloc=function(){return(Y=t.stackAlloc=t.asm.g).apply(null,arguments)};function V(){function e(){if(!$&&($=!0,t.calledRun=!0,!b)){if(j(O),i(t),t.onRuntimeInitialized&&t.onRuntimeInitialized(),t.postRun)for("function"==typeof t.postRun&&(t.postRun=[t.postRun]);t.postRun.length;){var e=t.postRun.shift();N.unshift(e)}j(N)}}if(!(0<B)){if(t.preRun)for("function"==typeof t.preRun&&(t.preRun=[t.preRun]);t.preRun.length;)P();j(R),0<B||(t.setStatus?(t.setStatus("Running..."),setTimeout(function(){setTimeout(function(){t.setStatus("")},1),e()},1)):e())}}if(t._malloc=function(){return(t._malloc=t.asm.h).apply(null,arguments)},t._free=function(){return(t._free=t.asm.i).apply(null,arguments)},t.cwrap=function(e,t,n,r){var i=(n=n||[]).every(function(e){return"number"===e});return"string"!==t&&i&&!r?A(e):function(){return function(e,t,n,r){var i={string:function(e){var t=0;if(null!=e&&0!==e){var n=1+(e.length<<2),r=t=Y(n),i=C;if(0<n){n=r+n-1;for(var s=0;s<e.length;++s){var o=e.charCodeAt(s);if(55296<=o&&57343>=o&&(o=65536+((1023&o)<<10)|1023&e.charCodeAt(++s)),127>=o){if(r>=n)break;i[r++]=o}else{if(2047>=o){if(r+1>=n)break;i[r++]=192|o>>6}else{if(65535>=o){if(r+2>=n)break;i[r++]=224|o>>12}else{if(r+3>=n)break;i[r++]=240|o>>18,i[r++]=128|o>>12&63}i[r++]=128|o>>6&63}i[r++]=128|63&o}}i[r]=0}}return t},array:function(e){var t=Y(e.length);return w.set(e,t),t}},s=A(e),o=[];if(e=0,r)for(var a=0;a<r.length;a++){var c=i[n[a]];c?(0===e&&(e=G()),o[a]=c(r[a])):o[a]=r[a]}return n=function(e){if("string"===t)if(e){for(var n=C,r=e+NaN,i=e;n[i]&&!(i>=r);)++i;if(16<i-e&&n.subarray&&I)e=I.decode(n.subarray(e,i));else{for(r="";e<i;){var s=n[e++];if(128&s){var o=63&n[e++];if(192==(224&s))r+=String.fromCharCode((31&s)<<6|o);else{var a=63&n[e++];65536>(s=224==(240&s)?(15&s)<<12|o<<6|a:(7&s)<<18|o<<12|a<<6|63&n[e++])?r+=String.fromCharCode(s):(s-=65536,r+=String.fromCharCode(55296|s>>10,56320|1023&s))}}else r+=String.fromCharCode(s)}e=r}}else e="";else e="boolean"===t?!!e:e;return e}(n=s.apply(null,o)),0!==e&&K(e),n}(e,t,n,arguments)}},x=function e(){$||V(),$||(x=e)},t.run=V,t.preInit)for("function"==typeof t.preInit&&(t.preInit=[t.preInit]);0<t.preInit.length;)t.preInit.pop()();return V(),e.ready});e.exports=i},588(e,t,n){"use strict";const r=new Array(256);[n(3645).HANDLERS,n(60)].forEach(e=>{for(let[t,n]of Object.entries(e))t=+t,isFinite(t)&&t>=0&&t<r.length&&(r[t]=n)}),e.exports=r},60(e,t,n){"use strict";const{bufferSlice:r,bufferParser:i,doFatalError:s,sigSSHToASN1:o,writeUInt32BE:a}=n(9576),{CHANNEL_OPEN_FAILURE:c,COMPAT:l,MESSAGE:h,TERMINAL_MODE:u}=n(8692),{parseKey:d}=n(541),f=Array.from(Object.entries(u)).reduce((e,[t,n])=>({...e,[t]:n}),{});e.exports={[h.DISCONNECT]:(e,t)=>{i.init(t,1);const n=i.readUInt32BE(),r=i.readString(!0),o=i.readString();if(i.clear(),void 0===o)return s(e,"Inbound: Malformed DISCONNECT packet");e._debug&&e._debug(`Inbound: Received DISCONNECT (${n}, "${r}")`);const a=e._handlers.DISCONNECT;a&&a(e,n,r)},[h.IGNORE]:(e,t)=>{e._debug&&e._debug("Inbound: Received IGNORE")},[h.UNIMPLEMENTED]:(e,t)=>{i.init(t,1);const n=i.readUInt32BE();if(i.clear(),void 0===n)return s(e,"Inbound: Malformed UNIMPLEMENTED packet");e._debug&&e._debug(`Inbound: Received UNIMPLEMENTED (seqno ${n})`)},[h.DEBUG]:(e,t)=>{i.init(t,1);const n=i.readBool(),r=i.readString(!0),o=i.readString();if(i.clear(),void 0===o)return s(e,"Inbound: Malformed DEBUG packet");e._debug&&e._debug("Inbound: Received DEBUG");const a=e._handlers.DEBUG;a&&a(e,n,r)},[h.SERVICE_REQUEST]:(e,t)=>{i.init(t,1);const n=i.readString(!0);if(i.clear(),void 0===n)return s(e,"Inbound: Malformed SERVICE_REQUEST packet");e._debug&&e._debug(`Inbound: Received SERVICE_REQUEST (${n})`);const r=e._handlers.SERVICE_REQUEST;r&&r(e,n)},[h.SERVICE_ACCEPT]:(e,t)=>{i.init(t,1);const n=i.readString(!0);if(i.clear(),void 0===n)return s(e,"Inbound: Malformed SERVICE_ACCEPT packet");e._debug&&e._debug(`Inbound: Received SERVICE_ACCEPT (${n})`);const r=e._handlers.SERVICE_ACCEPT;r&&r(e,n)},[h.EXT_INFO]:(e,t)=>{i.init(t,1);const n=i.readUInt32BE();let r;if(void 0!==n){r=[];for(let e=0;e<n;++e){const e=i.readString(!0),t=i.readString();if(void 0===t){r=void 0;break}if("server-sig-algs"===e){const n=t.latin1Slice(0,t.length).split(",");r.push({name:e,algs:n});continue}}}if(i.clear(),void 0===r)return s(e,"Inbound: Malformed EXT_INFO packet");e._debug&&e._debug("Inbound: Received EXT_INFO");const o=e._handlers.EXT_INFO;o&&o(e,r)},[h.USERAUTH_REQUEST]:(e,t)=>{i.init(t,1);const n=i.readString(!0),c=i.readString(!0),l=i.readString(!0);let h,u;switch(l){case"none":h=null;break;case"password":{const e=i.readBool();if(void 0!==e&&(h=i.readString(!0),void 0!==h&&e)){const e=i.readString(!0);h=void 0!==e?{oldPassword:h,newPassword:e}:void 0}break}case"publickey":{const n=i.readBool();if(void 0!==n){const s=i.readString(!0);let c=s;const l=i.readString();let d;switch(s){case"rsa-sha2-256":c="ssh-rsa",d="sha256";break;case"rsa-sha2-512":c="ssh-rsa",d="sha512"}if(n){const n=i.pos();let u=i.readString();if(void 0!==u&&(u.length>4+s.length+4&&u.utf8Slice(4,4+s.length)===s&&(u=r(u,4+s.length+4)),u=o(u,c),u)){const r=e._kex.sessionID,i=Buffer.allocUnsafe(4+r.length+n);a(i,r.length,0),i.set(r,4),i.set(new Uint8Array(t.buffer,t.byteOffset,n),4+r.length),h={keyAlgo:c,key:l,signature:u,blob:i,hashAlgo:d}}}else h={keyAlgo:c,key:l,hashAlgo:d},u="publickey -- check"}break}case"hostbased":{const n=i.readString(!0);let s=n;const c=i.readString(),l=i.readString(!0),u=i.readString(!0);let d;switch(n){case"rsa-sha2-256":s="ssh-rsa",d="sha256";break;case"rsa-sha2-512":s="ssh-rsa",d="sha512"}const f=i.pos();let p=i.readString();if(void 0!==p&&(p.length>4+n.length+4&&p.utf8Slice(4,4+n.length)===n&&(p=r(p,4+n.length+4)),p=o(p,s),void 0!==p)){const n=e._kex.sessionID,r=Buffer.allocUnsafe(4+n.length+f);a(r,n.length,0),r.set(n,4),r.set(new Uint8Array(t.buffer,t.byteOffset,f),4+n.length),h={keyAlgo:s,key:c,signature:p,blob:r,localHostname:l,localUsername:u,hashAlgo:d}}break}case"keyboard-interactive":i.skipString(),h=i.readList();break;default:void 0!==l&&(h=i.readRaw())}if(i.clear(),void 0===h)return s(e,"Inbound: Malformed USERAUTH_REQUEST packet");void 0===u&&(u=l),e._authsQueue.push(l),e._debug&&e._debug(`Inbound: Received USERAUTH_REQUEST (${u})`);const d=e._handlers.USERAUTH_REQUEST;d&&d(e,n,c,l,h)},[h.USERAUTH_FAILURE]:(e,t)=>{i.init(t,1);const n=i.readList(),r=i.readBool();if(i.clear(),void 0===r)return s(e,"Inbound: Malformed USERAUTH_FAILURE packet");e._debug&&e._debug(`Inbound: Received USERAUTH_FAILURE (${n})`),e._authsQueue.shift();const o=e._handlers.USERAUTH_FAILURE;o&&o(e,n,r)},[h.USERAUTH_SUCCESS]:(e,t)=>{e._debug&&e._debug("Inbound: Received USERAUTH_SUCCESS"),e._authsQueue.shift();const n=e._handlers.USERAUTH_SUCCESS;n&&n(e)},[h.USERAUTH_BANNER]:(e,t)=>{i.init(t,1);const n=i.readString(!0),r=i.readString();if(i.clear(),void 0===r)return s(e,"Inbound: Malformed USERAUTH_BANNER packet");e._debug&&e._debug("Inbound: Received USERAUTH_BANNER");const o=e._handlers.USERAUTH_BANNER;o&&o(e,n)},60:(e,t)=>{if(e._authsQueue.length)switch(e._authsQueue[0]){case"password":{i.init(t,1);const n=i.readString(!0),r=i.readString();if(i.clear(),void 0===r)return s(e,"Inbound: Malformed USERAUTH_PASSWD_CHANGEREQ packet");e._debug&&e._debug("Inbound: Received USERAUTH_PASSWD_CHANGEREQ");const o=e._handlers.USERAUTH_PASSWD_CHANGEREQ;o&&o(e,n);break}case"publickey":{i.init(t,1);const n=i.readString(!0),r=i.readString();if(i.clear(),void 0===r)return s(e,"Inbound: Malformed USERAUTH_PK_OK packet");e._debug&&e._debug("Inbound: Received USERAUTH_PK_OK"),e._authsQueue.shift();const o=e._handlers.USERAUTH_PK_OK;o&&o(e,n,r);break}case"keyboard-interactive":{i.init(t,1);const n=i.readString(!0),r=i.readString(!0);i.readString();const o=i.readUInt32BE();let a;if(void 0!==o){let e;for(a=new Array(o),e=0;e<o;++e){const t=i.readString(!0),n=i.readBool();if(void 0===n)break;a[e]={prompt:t,echo:n}}e!==o&&(a=void 0)}if(i.clear(),void 0===a)return s(e,"Inbound: Malformed USERAUTH_INFO_REQUEST packet");e._debug&&e._debug("Inbound: Received USERAUTH_INFO_REQUEST");const c=e._handlers.USERAUTH_INFO_REQUEST;c&&c(e,n,r,a);break}default:e._debug&&e._debug("Inbound: Received unexpected payload type 60")}else e._debug&&e._debug("Inbound: Received payload type 60 without auth")},61:(e,t)=>{if(!e._authsQueue.length)return void(e._debug&&e._debug("Inbound: Received payload type 61 without auth"));if("keyboard-interactive"!==e._authsQueue[0])return s(e,"Inbound: Received unexpected payload type 61");i.init(t,1);const n=i.readUInt32BE();let r;if(void 0!==n){let e;for(r=new Array(n),e=0;e<n;++e){const t=i.readString(!0);if(void 0===t)break;r[e]=t}e!==n&&(r=void 0)}if(i.clear(),void 0===r)return s(e,"Inbound: Malformed USERAUTH_INFO_RESPONSE packet");e._debug&&e._debug("Inbound: Received USERAUTH_INFO_RESPONSE");const o=e._handlers.USERAUTH_INFO_RESPONSE;o&&o(e,r)},[h.GLOBAL_REQUEST]:(e,t)=>{i.init(t,1);const n=i.readString(!0),r=i.readBool();let o;if(void 0!==r)switch(n){case"tcpip-forward":case"cancel-tcpip-forward":{const e=i.readString(!0),t=i.readUInt32BE();void 0!==t&&(o={bindAddr:e,bindPort:t});break}case"streamlocal-forward@openssh.com":case"cancel-streamlocal-forward@openssh.com":{const e=i.readString(!0);void 0!==e&&(o={socketPath:e});break}case"no-more-sessions@openssh.com":o=null;break;case"hostkeys-00@openssh.com":for(o=[];i.avail()>0;){const e=i.readString();if(void 0===e){o=void 0;break}const t=d(e);t instanceof Error||o.push(t)}break;default:o=i.readRaw()}if(i.clear(),void 0===o)return s(e,"Inbound: Malformed GLOBAL_REQUEST packet");e._debug&&e._debug(`Inbound: GLOBAL_REQUEST (${n})`);const a=e._handlers.GLOBAL_REQUEST;a?a(e,n,r,o):e.requestFailure()},[h.REQUEST_SUCCESS]:(e,t)=>{const n=t.length>1?r(t,1):null;e._debug&&e._debug("Inbound: REQUEST_SUCCESS");const i=e._handlers.REQUEST_SUCCESS;i&&i(e,n)},[h.REQUEST_FAILURE]:(e,t)=>{e._debug&&e._debug("Inbound: Received REQUEST_FAILURE");const n=e._handlers.REQUEST_FAILURE;n&&n(e)},[h.CHANNEL_OPEN]:(e,t)=>{i.init(t,1);const n=i.readString(!0),r=i.readUInt32BE(),o=i.readUInt32BE(),a=i.readUInt32BE();let l;switch(n){case"forwarded-tcpip":case"direct-tcpip":{const e=i.readString(!0),t=i.readUInt32BE(),s=i.readString(!0),c=i.readUInt32BE();void 0!==c&&(l={type:n,sender:r,window:o,packetSize:a,data:{destIP:e,destPort:t,srcIP:s,srcPort:c}});break}case"forwarded-streamlocal@openssh.com":case"direct-streamlocal@openssh.com":{const e=i.readString(!0);void 0!==e&&(l={type:n,sender:r,window:o,packetSize:a,data:{socketPath:e}});break}case"x11":{const e=i.readString(!0),t=i.readUInt32BE();void 0!==t&&(l={type:n,sender:r,window:o,packetSize:a,data:{srcIP:e,srcPort:t}});break}default:l={type:n,sender:r,window:o,packetSize:a,data:{}}}if(i.clear(),void 0===l)return s(e,"Inbound: Malformed CHANNEL_OPEN packet");e._debug&&e._debug(`Inbound: CHANNEL_OPEN (s:${r}, ${n})`);const h=e._handlers.CHANNEL_OPEN;h?h(e,l):e.channelOpenFail(l.sender,c.ADMINISTRATIVELY_PROHIBITED,"","")},[h.CHANNEL_OPEN_CONFIRMATION]:(e,t)=>{i.init(t,1);const n=i.readUInt32BE(),r=i.readUInt32BE(),o=i.readUInt32BE(),a=i.readUInt32BE(),c=i.avail()?i.readRaw():void 0;if(i.clear(),void 0===a)return s(e,"Inbound: Malformed CHANNEL_OPEN_CONFIRMATION packet");e._debug&&e._debug(`Inbound: CHANNEL_OPEN_CONFIRMATION (r:${n}, s:${r})`);const l=e._handlers.CHANNEL_OPEN_CONFIRMATION;l&&l(e,{recipient:n,sender:r,window:o,packetSize:a,data:c})},[h.CHANNEL_OPEN_FAILURE]:(e,t)=>{i.init(t,1);const n=i.readUInt32BE(),r=i.readUInt32BE(),o=i.readString(!0),a=i.readString();if(i.clear(),void 0===a)return s(e,"Inbound: Malformed CHANNEL_OPEN_FAILURE packet");e._debug&&e._debug(`Inbound: CHANNEL_OPEN_FAILURE (r:${n})`);const c=e._handlers.CHANNEL_OPEN_FAILURE;c&&c(e,n,r,o)},[h.CHANNEL_WINDOW_ADJUST]:(e,t)=>{i.init(t,1);const n=i.readUInt32BE(),r=i.readUInt32BE();if(i.clear(),void 0===r)return s(e,"Inbound: Malformed CHANNEL_WINDOW_ADJUST packet");e._debug&&e._debug(`Inbound: CHANNEL_WINDOW_ADJUST (r:${n}, ${r})`);const o=e._handlers.CHANNEL_WINDOW_ADJUST;o&&o(e,n,r)},[h.CHANNEL_DATA]:(e,t)=>{i.init(t,1);const n=i.readUInt32BE(),r=i.readString();if(i.clear(),void 0===r)return s(e,"Inbound: Malformed CHANNEL_DATA packet");e._debug&&e._debug(`Inbound: CHANNEL_DATA (r:${n}, ${r.length})`);const o=e._handlers.CHANNEL_DATA;o&&o(e,n,r)},[h.CHANNEL_EXTENDED_DATA]:(e,t)=>{i.init(t,1);const n=i.readUInt32BE(),r=i.readUInt32BE(),o=i.readString();if(i.clear(),void 0===o)return s(e,"Inbound: Malformed CHANNEL_EXTENDED_DATA packet");e._debug&&e._debug(`Inbound: CHANNEL_EXTENDED_DATA (r:${n}, ${o.length})`);const a=e._handlers.CHANNEL_EXTENDED_DATA;a&&a(e,n,o,r)},[h.CHANNEL_EOF]:(e,t)=>{i.init(t,1);const n=i.readUInt32BE();if(i.clear(),void 0===n)return s(e,"Inbound: Malformed CHANNEL_EOF packet");e._debug&&e._debug(`Inbound: CHANNEL_EOF (r:${n})`);const r=e._handlers.CHANNEL_EOF;r&&r(e,n)},[h.CHANNEL_CLOSE]:(e,t)=>{i.init(t,1);const n=i.readUInt32BE();if(i.clear(),void 0===n)return s(e,"Inbound: Malformed CHANNEL_CLOSE packet");e._debug&&e._debug(`Inbound: CHANNEL_CLOSE (r:${n})`);const r=e._handlers.CHANNEL_CLOSE;r&&r(e,n)},[h.CHANNEL_REQUEST]:(e,t)=>{i.init(t,1);const n=i.readUInt32BE(),r=i.readString(!0),o=i.readBool();let a;if(void 0!==o)switch(r){case"exit-status":a=i.readUInt32BE(),e._debug&&e._debug(`Inbound: CHANNEL_REQUEST (r:${n}, ${r}: ${a})`);break;case"exit-signal":{let t,s;if(e._compatFlags&l.OLD_EXIT){const e=i.readUInt32BE();switch(e){case 1:t="HUP";break;case 2:t="INT";break;case 3:t="QUIT";break;case 6:t="ABRT";break;case 9:t="KILL";break;case 14:t="ALRM";break;case 15:t="TERM";break;default:void 0!==e&&(t=`UNKNOWN (${e})`)}s=!1}else t=i.readString(!0),s=i.readBool(),void 0===s&&(t=void 0);const o=i.readString(!0);void 0!==i.skipString()&&(a={signal:t,coreDumped:s,errorMessage:o}),e._debug&&e._debug(`Inbound: CHANNEL_REQUEST (r:${n}, ${r}: ${t})`);break}case"pty-req":{const t=i.readString(!0),s=i.readUInt32BE(),o=i.readUInt32BE(),c=i.readUInt32BE(),l=i.readUInt32BE(),h=i.readString();if(void 0!==h){i.init(h,1);let e={};for(;i.avail();){const t=i.readByte();if(t===u.TTY_OP_END)break;const n=f[t],r=i.readUInt32BE();if(void 0===t||void 0===n||void 0===r){e=void 0;break}e[n]=r}void 0!==e&&(a={term:t,cols:s,rows:o,width:c,height:l,modes:e})}e._debug&&e._debug(`Inbound: CHANNEL_REQUEST (r:${n}, ${r})`);break}case"window-change":{const t=i.readUInt32BE(),s=i.readUInt32BE(),o=i.readUInt32BE(),c=i.readUInt32BE();void 0!==c&&(a={cols:t,rows:s,width:o,height:c}),e._debug&&e._debug(`Inbound: CHANNEL_REQUEST (r:${n}, ${r})`);break}case"x11-req":{const t=i.readBool(),s=i.readString(!0),o=i.readString(),c=i.readUInt32BE();void 0!==c&&(a={single:t,protocol:s,cookie:o,screen:c}),e._debug&&e._debug(`Inbound: CHANNEL_REQUEST (r:${n}, ${r})`);break}case"env":{const t=i.readString(!0),s=i.readString(!0);void 0!==s&&(a={name:t,value:s}),e._debug&&e._debug(`Inbound: CHANNEL_REQUEST (r:${n}, ${r}: ${t}=${s})`);break}case"shell":case"auth-agent-req@openssh.com":a=null,e._debug&&e._debug(`Inbound: CHANNEL_REQUEST (r:${n}, ${r})`);break;case"exec":case"subsystem":case"signal":a=i.readString(!0),e._debug&&e._debug(`Inbound: CHANNEL_REQUEST (r:${n}, ${r}: ${a})`);break;case"xon-xoff":a=i.readBool(),e._debug&&e._debug(`Inbound: CHANNEL_REQUEST (r:${n}, ${r}: ${a})`);break;default:a=i.avail()?i.readRaw():null,e._debug&&e._debug(`Inbound: CHANNEL_REQUEST (r:${n}, ${r})`)}if(i.clear(),void 0===a)return s(e,"Inbound: Malformed CHANNEL_REQUEST packet");const c=e._handlers.CHANNEL_REQUEST;c&&c(e,n,r,o,a)},[h.CHANNEL_SUCCESS]:(e,t)=>{i.init(t,1);const n=i.readUInt32BE();if(i.clear(),void 0===n)return s(e,"Inbound: Malformed CHANNEL_SUCCESS packet");e._debug&&e._debug(`Inbound: CHANNEL_SUCCESS (r:${n})`);const r=e._handlers.CHANNEL_SUCCESS;r&&r(e,n)},[h.CHANNEL_FAILURE]:(e,t)=>{i.init(t,1);const n=i.readUInt32BE();if(i.clear(),void 0===n)return s(e,"Inbound: Malformed CHANNEL_FAILURE packet");e._debug&&e._debug(`Inbound: CHANNEL_FAILURE (r:${n})`);const r=e._handlers.CHANNEL_FAILURE;r&&r(e,n)}}},3645(e,t,n){"use strict";const{createDiffieHellman:r,createDiffieHellmanGroup:i,createECDH:s,createHash:o,createPublicKey:a,diffieHellman:c,generateKeyPairSync:l,randomFillSync:h}=n(6982),{Ber:u}=n(3100),{COMPAT:d,curve25519Supported:f,DEFAULT_KEX:p,DEFAULT_SERVER_HOST_KEY:g,DEFAULT_CIPHER:m,DEFAULT_MAC:_,DEFAULT_COMPRESSION:y,DISCONNECT_REASON:v,MESSAGE:b}=n(8692),{CIPHER_INFO:E,createCipher:A,createDecipher:S,MAC_INFO:w}=n(7064),{parseDERKey:C}=n(541),{bufferFill:I,bufferParser:k,convertSignature:T,doFatalError:R,FastBuffer:O,sigSSHToASN1:N,writeUInt32BE:P}=n(9576),{PacketReader:B,PacketWriter:L,ZlibPacketReader:x,ZlibPacketWriter:D}=n(5696);let M;const U=Buffer.alloc(0);function F(e){let t;if(e._compatFlags&d.BAD_DHGEX){const n=e._offer.lists.kex;let r=n.array,i=!1;for(let e=0;e<r.length;++e)r[e].includes("group-exchange")&&(i||(i=!0,r=r.slice()),r.splice(e--,1));if(i){let i=17+e._offer.totalSize+1+4;const s=Buffer.from(r.join(","));i-=n.buffer.length-s.length;const o=e._offer.lists.all,a=new Uint8Array(o.buffer,o.byteOffset+4+n.buffer.length,o.length-(4+n.buffer.length));t=Buffer.allocUnsafe(i),P(t,s.length,17),t.set(s,21),t.set(a,21+s.length)}}void 0===t&&(t=Buffer.allocUnsafe(17+e._offer.totalSize+1+4),e._offer.copyAllTo(t,17)),e._debug&&e._debug("Outbound: Sending KEXINIT"),t[0]=b.KEXINIT,h(t,1,16),I(t,0,t.length-5),e._kexinit=t,e._packetRW.write.allocStart=0;{const n=e._packetRW.write.allocStartKEX,r=e._packetRW.write.alloc(t.length,!0);r.set(t,n),e._cipher.encrypt(e._packetRW.write.finalize(r,!0))}}function H(e,t){const n={kex:void 0,serverHostKey:void 0,cs:{cipher:void 0,mac:void 0,compress:void 0,lang:void 0},sc:{cipher:void 0,mac:void 0,compress:void 0,lang:void 0}};if(k.init(t,17),void 0===(n.kex=k.readList())||void 0===(n.serverHostKey=k.readList())||void 0===(n.cs.cipher=k.readList())||void 0===(n.sc.cipher=k.readList())||void 0===(n.cs.mac=k.readList())||void 0===(n.sc.mac=k.readList())||void 0===(n.cs.compress=k.readList())||void 0===(n.sc.compress=k.readList())||void 0===(n.cs.lang=k.readList())||void 0===(n.sc.lang=k.readList()))return k.clear(),R(e,"Received malformed KEXINIT","handshake",v.KEY_EXCHANGE_FAILED);const r=k.pos(),i=r<t.length&&1===t[r];k.clear();const s=e._offer,o=n;let a,c,l,h=s.lists.kex.array;if(e._compatFlags&d.BAD_DHGEX){let e=!1;for(let t=0;t<h.length;++t)-1!==h[t].indexOf("group-exchange")&&(e||(e=!0,h=h.slice()),h.splice(t--,1))}const u=e._debug;let f;if(u&&u("Inbound: Handshake in progress"),u&&u(`Handshake: (local) KEX method: ${h}`),u&&u(`Handshake: (remote) KEX method: ${o.kex}`),e._server?(c=h,a=o.kex,f=-1!==a.indexOf("ext-info-c")):(c=o.kex,a=h,f=-1!==c.indexOf("ext-info-s")),void 0===e._strictMode&&(e._server?e._strictMode=-1!==a.indexOf("kex-strict-c-v00@openssh.com"):e._strictMode=-1!==c.indexOf("kex-strict-s-v00@openssh.com"),e._strictMode&&(u&&u("Handshake: strict KEX mode enabled"),1!==e._decipher.inSeqno)))return u&&u("Handshake: KEXINIT not first packet in strict KEX mode"),R(e,"Handshake failed: KEXINIT not first packet in strict KEX mode","handshake",v.KEY_EXCHANGE_FAILED);for(l=0;l<a.length&&-1===c.indexOf(a[l]);++l);if(l===a.length)return u&&u("Handshake: no matching key exchange algorithm"),R(e,"Handshake failed: no matching key exchange algorithm","handshake",v.KEY_EXCHANGE_FAILED);n.kex=a[l],u&&u(`Handshake: KEX algorithm: ${a[l]}`),!i||o.kex.length&&a[l]===o.kex[0]||(e._skipNextInboundPacket=!0);const p=s.lists.serverHostKey.array;for(u&&u(`Handshake: (local) Host key format: ${p}`),u&&u(`Handshake: (remote) Host key format: ${o.serverHostKey}`),e._server?(c=p,a=o.serverHostKey):(c=o.serverHostKey,a=p),l=0;l<a.length&&-1===c.indexOf(a[l]);++l);if(l===a.length)return u&&u("Handshake: No matching host key format"),R(e,"Handshake failed: no matching host key format","handshake",v.KEY_EXCHANGE_FAILED);n.serverHostKey=a[l],u&&u(`Handshake: Host key format: ${a[l]}`);const g=s.lists.cs.cipher.array;for(u&&u(`Handshake: (local) C->S cipher: ${g}`),u&&u(`Handshake: (remote) C->S cipher: ${o.cs.cipher}`),e._server?(c=g,a=o.cs.cipher):(c=o.cs.cipher,a=g),l=0;l<a.length&&-1===c.indexOf(a[l]);++l);if(l===a.length)return u&&u("Handshake: No matching C->S cipher"),R(e,"Handshake failed: no matching C->S cipher","handshake",v.KEY_EXCHANGE_FAILED);n.cs.cipher=a[l],u&&u(`Handshake: C->S Cipher: ${a[l]}`);const m=s.lists.sc.cipher.array;for(u&&u(`Handshake: (local) S->C cipher: ${m}`),u&&u(`Handshake: (remote) S->C cipher: ${o.sc.cipher}`),e._server?(c=m,a=o.sc.cipher):(c=o.sc.cipher,a=m),l=0;l<a.length&&-1===c.indexOf(a[l]);++l);if(l===a.length)return u&&u("Handshake: No matching S->C cipher"),R(e,"Handshake failed: no matching S->C cipher","handshake",v.KEY_EXCHANGE_FAILED);n.sc.cipher=a[l],u&&u(`Handshake: S->C cipher: ${a[l]}`);const _=s.lists.cs.mac.array;if(u&&u(`Handshake: (local) C->S MAC: ${_}`),u&&u(`Handshake: (remote) C->S MAC: ${o.cs.mac}`),E[n.cs.cipher].authLen>0)n.cs.mac="",u&&u("Handshake: C->S MAC: <implicit>");else{for(e._server?(c=_,a=o.cs.mac):(c=o.cs.mac,a=_),l=0;l<a.length&&-1===c.indexOf(a[l]);++l);if(l===a.length)return u&&u("Handshake: No matching C->S MAC"),R(e,"Handshake failed: no matching C->S MAC","handshake",v.KEY_EXCHANGE_FAILED);n.cs.mac=a[l],u&&u(`Handshake: C->S MAC: ${a[l]}`)}const y=s.lists.sc.mac.array;if(u&&u(`Handshake: (local) S->C MAC: ${y}`),u&&u(`Handshake: (remote) S->C MAC: ${o.sc.mac}`),E[n.sc.cipher].authLen>0)n.sc.mac="",u&&u("Handshake: S->C MAC: <implicit>");else{for(e._server?(c=y,a=o.sc.mac):(c=o.sc.mac,a=y),l=0;l<a.length&&-1===c.indexOf(a[l]);++l);if(l===a.length)return u&&u("Handshake: No matching S->C MAC"),R(e,"Handshake failed: no matching S->C MAC","handshake",v.KEY_EXCHANGE_FAILED);n.sc.mac=a[l],u&&u(`Handshake: S->C MAC: ${a[l]}`)}const b=s.lists.cs.compress.array;for(u&&u(`Handshake: (local) C->S compression: ${b}`),u&&u(`Handshake: (remote) C->S compression: ${o.cs.compress}`),e._server?(c=b,a=o.cs.compress):(c=o.cs.compress,a=b),l=0;l<a.length&&-1===c.indexOf(a[l]);++l);if(l===a.length)return u&&u("Handshake: No matching C->S compression"),R(e,"Handshake failed: no matching C->S compression","handshake",v.KEY_EXCHANGE_FAILED);n.cs.compress=a[l],u&&u(`Handshake: C->S compression: ${a[l]}`);const A=s.lists.sc.compress.array;for(u&&u(`Handshake: (local) S->C compression: ${A}`),u&&u(`Handshake: (remote) S->C compression: ${o.sc.compress}`),e._server?(c=A,a=o.sc.compress):(c=o.sc.compress,a=A),l=0;l<a.length&&-1===c.indexOf(a[l]);++l);if(l===a.length)return u&&u("Handshake: No matching S->C compression"),R(e,"Handshake failed: no matching S->C compression","handshake",v.KEY_EXCHANGE_FAILED);n.sc.compress=a[l],u&&u(`Handshake: S->C compression: ${a[l]}`),n.cs.lang="",n.sc.lang="",e._kex&&(e._kexinit||F(e),e._decipher._onPayload=z.bind(e,{firstPacket:!1})),e._kex=j(n,e,t),e._kex.remoteExtInfoEnabled=f,e._kex.start()}const j=(()=>{function e(e){let t,n=0,r=e.length;for(;0===e[n];)++n,--r;return 128&e[n]?(t=Buffer.allocUnsafe(1+r),t[0]=0,e.copy(t,1,n),e=t):r!==e.length&&(t=Buffer.allocUnsafe(r),e.copy(t,0,n),e=t),e}class t{constructor(e,t,n){this._protocol=t,this.sessionID=t._kex?t._kex.sessionID:void 0,this.negotiated=e,this.remoteExtInfoEnabled=!1,this._step=1,this._public=null,this._dh=null,this._sentNEWKEYS=!1,this._receivedNEWKEYS=!1,this._finished=!1,this._hostVerified=!1,this._kexinit=t._kexinit,this._remoteKexinit=n,this._identRaw=t._identRaw,this._remoteIdentRaw=t._remoteIdentRaw,this._hostKey=void 0,this._dhData=void 0,this._sig=void 0}finish(e){if(this._finished)return!1;this._finished=!0;const t=this._protocol._server,n=this.negotiated,r=this.convertPublicKey(this._dhData);let i=this.computeSecret(this._dhData);if(i instanceof Error)return i.message=`Error while computing DH secret (${this.type}): ${i.message}`,i.level="handshake",R(this._protocol,i,v.KEY_EXCHANGE_FAILED);const s=o(this.hashName);Q(s,t?this._remoteIdentRaw:this._identRaw),Q(s,t?this._identRaw:this._remoteIdentRaw),Q(s,t?this._remoteKexinit:this._kexinit),Q(s,t?this._kexinit:this._remoteKexinit);const a=t?this._hostKey.getPublicSSH():this._hostKey;if(Q(s,a),"groupex"===this.type){const e=this.getDHParams(),t=Buffer.allocUnsafe(4);P(t,this._minBits,0),s.update(t),P(t,this._prefBits,0),s.update(t),P(t,this._maxBits,0),s.update(t),Q(s,e.prime),Q(s,e.generator)}Q(s,t?r:this.getPublicKey());const c=t?this.getPublicKey():r;Q(s,c),Q(s,i);const l=s.digest();if(t){let e;switch(this.negotiated.serverHostKey){case"rsa-sha2-256":e="sha256";break;case"rsa-sha2-512":e="sha512"}this._protocol._debug&&this._protocol._debug("Generating signature ...");let t=this._hostKey.sign(l,e);if(t instanceof Error)return R(this._protocol,`Handshake failed: signature generation failed for ${this._hostKey.type} host key: ${t.message}`,"handshake",v.KEY_EXCHANGE_FAILED);if(t=T(t,this._hostKey.type),!1===t)return R(this._protocol,`Handshake failed: signature conversion failed for ${this._hostKey.type} host key`,"handshake",v.KEY_EXCHANGE_FAILED);const n=this.negotiated.serverHostKey,r=Buffer.byteLength(n),i=4+r+4+t.length;let s=this._protocol._packetRW.write.allocStartKEX;const o=this._protocol._packetRW.write.alloc(5+a.length+4+c.length+4+i,!0);if(o[s]=b.KEXDH_REPLY,P(o,a.length,++s),o.set(a,s+=4),P(o,c.length,s+=a.length),o.set(c,s+=4),P(o,i,s+=c.length),P(o,r,s+=4),o.utf8Write(n,s+=4,r),P(o,t.length,s+=r),o.set(t,s+=4),this._protocol._debug){let e;switch(this.type){case"group":e="KEXDH_REPLY";break;case"groupex":e="KEXDH_GEX_REPLY";break;default:e="KEXECDH_REPLY"}this._protocol._debug(`Outbound: Sending ${e}`)}this._protocol._cipher.encrypt(this._protocol._packetRW.write.finalize(o,!0))}else{k.init(this._sig,0);const e=k.readString(!0);if(!e)return R(this._protocol,"Malformed packet while reading signature","handshake",v.KEY_EXCHANGE_FAILED);if(e!==n.serverHostKey)return R(this._protocol,`Wrong signature type: ${e}, expected: ${n.serverHostKey}`,"handshake",v.KEY_EXCHANGE_FAILED);let t,r,i=k.readString();if(k.clear(),void 0===i)return R(this._protocol,"Malformed packet while reading signature","handshake",v.KEY_EXCHANGE_FAILED);if(!(i=N(i,e)))return R(this._protocol,"Malformed signature","handshake",v.KEY_EXCHANGE_FAILED);{k.init(this._hostKey,0);const e=k.readString(!0),n=this._hostKey.slice(k.pos());if(k.clear(),t=C(n,e),t instanceof Error)return t.level="handshake",R(this._protocol,t,v.KEY_EXCHANGE_FAILED)}switch(this.negotiated.serverHostKey){case"rsa-sha2-256":r="sha256";break;case"rsa-sha2-512":r="sha512"}this._protocol._debug&&this._protocol._debug("Verifying signature ...");const s=t.verify(l,i,r);if(!0!==s)return s instanceof Error?this._protocol._debug&&this._protocol._debug(`Signature verification failed: ${s.stack}`):this._protocol._debug&&this._protocol._debug("Signature verification failed"),R(this._protocol,"Handshake failed: signature verification failed","handshake",v.KEY_EXCHANGE_FAILED);this._protocol._debug&&this._protocol._debug("Verified signature")}let h,u;!t&&e||$(this);const d=e=>{if(h)return $(this),h.outbound.seqno=this._protocol._cipher.outSeqno,this._protocol._cipher.free(),this._protocol._cipher=A(h),this._protocol._packetRW.write=u,h=void 0,u=void 0,this._protocol._onHandshakeComplete(n),!1;this.sessionID||(this.sessionID=l);{const e=Buffer.allocUnsafe(4+i.length);P(e,i.length,0),e.set(i,4),i=e}const r=E[n.cs.cipher],s=E[n.sc.cipher],o=q(r.ivLen,this.hashName,i,l,this.sessionID,"A"),a=q(s.ivLen,this.hashName,i,l,this.sessionID,"B"),c=q(r.keyLen,this.hashName,i,l,this.sessionID,"C"),f=q(s.keyLen,this.hashName,i,l,this.sessionID,"D");let p,g,m,_;r.authLen||(p=w[n.cs.mac],g=q(p.len,this.hashName,i,l,this.sessionID,"E")),s.authLen||(m=w[n.sc.mac],_=q(m.len,this.hashName,i,l,this.sessionID,"F"));const y={inbound:{onPayload:this._protocol._onPayload,seqno:this._protocol._decipher.inSeqno,decipherInfo:t?r:s,decipherIV:t?o:a,decipherKey:t?c:f,macInfo:t?p:m,macKey:t?g:_},outbound:{onWrite:this._protocol._onWrite,seqno:this._protocol._cipher.outSeqno,cipherInfo:t?s:r,cipherIV:t?a:o,cipherKey:t?f:c,macInfo:t?m:p,macKey:t?_:g}};this._protocol._decipher.free(),h=y,this._protocol._decipher=S(y);const v={read:void 0,write:void 0};switch(n.cs.compress){case"zlib":t?v.read=new x:v.write=new D(this._protocol);break;case"zlib@openssh.com":if(this._protocol._authenticated){t?v.read=new x:v.write=new D(this._protocol);break}default:t?v.read=new B:v.write=new L(this._protocol)}switch(n.sc.compress){case"zlib":t?v.write=new D(this._protocol):v.read=new x;break;case"zlib@openssh.com":if(this._protocol._authenticated){t?v.write=new D(this._protocol):v.read=new x;break}default:t?v.write=new L(this._protocol):v.read=new B}return this._protocol._packetRW.read.cleanup(),this._protocol._packetRW.write.cleanup(),this._protocol._packetRW.read=v.read,u=v.write,this._public=null,this._dh=null,this._kexinit=this._protocol._kexinit=void 0,this._remoteKexinit=void 0,this._identRaw=void 0,this._remoteIdentRaw=void 0,this._hostKey=void 0,this._dhData=void 0,this._sig=void 0,!e&&d()};return(t||e)&&(this.finish=d),t?void 0:d(e)}start(){if(!this._protocol._server){if(this._protocol._debug){let e;if("group"===this.type)e="KEXDH_INIT";else e="KEXECDH_INIT";this._protocol._debug(`Outbound: Sending ${e}`)}const e=this.getPublicKey();let t=this._protocol._packetRW.write.allocStartKEX;const n=this._protocol._packetRW.write.alloc(5+e.length,!0);n[t]=b.KEXDH_INIT,P(n,e.length,++t),n.set(e,t+=4),this._protocol._cipher.encrypt(this._protocol._packetRW.write.finalize(n,!0))}}getPublicKey(){this.generateKeys();const e=this._public;if(e)return this.convertPublicKey(e)}convertPublicKey(e){let t,n=0,r=e.length;for(;0===e[n];)++n,--r;return 128&e[n]?(t=Buffer.allocUnsafe(1+r),t[0]=0,e.copy(t,1,n),t):(r!==e.length&&(t=Buffer.allocUnsafe(r),e.copy(t,0,n),e=t),e)}computeSecret(t){this.generateKeys();try{return e(this._dh.computeSecret(t))}catch(e){return e}}parse(e){const t=e[0];switch(this._step){case 1:if(this._protocol._server){if(t!==b.KEXDH_INIT)return R(this._protocol,`Received packet ${t} instead of ${b.KEXDH_INIT}`,"handshake",v.KEY_EXCHANGE_FAILED);this._protocol._debug&&this._protocol._debug("Received DH Init"),k.init(e,1);const n=k.readString();if(k.clear(),void 0===n)return R(this._protocol,"Received malformed KEX*_INIT","handshake",v.KEY_EXCHANGE_FAILED);this._dhData=n;let r=this._protocol._hostKeys[this.negotiated.serverHostKey];Array.isArray(r)&&(r=r[0]),this._hostKey=r,this.finish()}else{if(t!==b.KEXDH_REPLY)return R(this._protocol,`Received packet ${t} instead of ${b.KEXDH_REPLY}`,"handshake",v.KEY_EXCHANGE_FAILED);let n,r,i;if(this._protocol._debug&&this._protocol._debug("Received DH Reply"),k.init(e,1),void 0===(n=k.readString())||void 0===(r=k.readString())||void 0===(i=k.readString()))return k.clear(),R(this._protocol,"Received malformed KEX*_REPLY","handshake",v.KEY_EXCHANGE_FAILED);k.clear(),k.init(n,0);const s=k.readString(!0);if(k.clear(),void 0===s)return R(this._protocol,"Received malformed host public key","handshake",v.KEY_EXCHANGE_FAILED);if(s!==this.negotiated.serverHostKey)switch(this.negotiated.serverHostKey){case"rsa-sha2-256":case"rsa-sha2-512":if("ssh-rsa"===s)break;default:return R(this._protocol,"Host key does not match negotiated type","handshake",v.KEY_EXCHANGE_FAILED)}this._hostKey=n,this._dhData=r,this._sig=i;let o,a=!1;if(void 0===this._protocol._hostVerifier?(o=!0,this._protocol._debug&&this._protocol._debug("Host accepted by default (no verification)")):o=this._protocol._hostVerifier(n,e=>{if(!a){if(a=!0,!1===e)return this._protocol._debug&&this._protocol._debug("Host denied (verification failed)"),R(this._protocol,"Host denied (verification failed)","handshake",v.KEY_EXCHANGE_FAILED);this._protocol._debug&&this._protocol._debug("Host accepted (verified)"),this._hostVerified=!0,this._receivedNEWKEYS?this.finish():$(this)}}),void 0===o)return void++this._step;if(a=!0,!1===o)return this._protocol._debug&&this._protocol._debug("Host denied (verification failed)"),R(this._protocol,"Host denied (verification failed)","handshake",v.KEY_EXCHANGE_FAILED);this._protocol._debug&&this._protocol._debug("Host accepted (verified)"),this._hostVerified=!0,$(this)}++this._step;break;case 2:return t!==b.NEWKEYS?R(this._protocol,`Received packet ${t} instead of ${b.NEWKEYS}`,"handshake",v.KEY_EXCHANGE_FAILED):(this._protocol._debug&&this._protocol._debug("Inbound: NEWKEYS"),this._receivedNEWKEYS=!0,this._protocol._strictMode&&(this._protocol._decipher.inSeqno=0),++this._step,this.finish(!this._protocol._server&&!this._hostVerified));default:return R(this._protocol,`Received unexpected packet ${t} after NEWKEYS`,"handshake",v.KEY_EXCHANGE_FAILED)}}}class n extends t{constructor(e,...t){super(...t),this.type="25519",this.hashName=e,this._keys=null}generateKeys(){this._keys||(this._keys=l("x25519"))}getPublicKey(){this.generateKeys();return this._keys.publicKey.export({type:"spki",format:"der"}).slice(-32)}convertPublicKey(e){let t,n=0,r=e.length;for(;0===e[n];)++n,--r;return 32===e.length||r!==e.length&&(t=Buffer.allocUnsafe(r),e.copy(t,0,n),e=t),e}computeSecret(t){this.generateKeys();try{const n=new u.Writer;return n.startSequence(),n.startSequence(),n.writeOID("1.3.101.110"),n.endSequence(),n.startSequence(u.BitString),n.writeByte(0),n._ensure(t.length),t.copy(n._buf,n._offset,0,t.length),n._offset+=t.length,n.endSequence(),n.endSequence(),e(c({privateKey:this._keys.privateKey,publicKey:a({key:n.buffer,type:"spki",format:"der"})}))}catch(e){return e}}}class h extends t{constructor(e,t,...n){super(...n),this.type="ecdh",this.curveName=e,this.hashName=t}generateKeys(){this._dh||(this._dh=s(this.curveName),this._public=this._dh.generateKeys())}}class p extends t{constructor(e,...t){super(...t),this.type="groupex",this.hashName=e,this._prime=null,this._generator=null,this._minBits=2048,this._prefBits=function(e){const t=E[e.cs.cipher],n=E[e.sc.cipher],r=8*Math.max(0,"des-ede3-cbc"===t.sslName?14:t.keyLen,t.blockLen,t.ivLen,"des-ede3-cbc"===n.sslName?14:n.keyLen,n.blockLen,n.ivLen);return r<=112?2048:r<=128?3072:r<=192?7680:8192}(this.negotiated),this._protocol._compatFlags&d.BUG_DHGEX_LARGE&&(this._prefBits=Math.min(this._prefBits,4096)),this._maxBits=8192}start(){if(this._protocol._server)return;this._protocol._debug&&this._protocol._debug("Outbound: Sending KEXDH_GEX_REQUEST");let e=this._protocol._packetRW.write.allocStartKEX;const t=this._protocol._packetRW.write.alloc(13,!0);t[e]=b.KEXDH_GEX_REQUEST,P(t,this._minBits,++e),P(t,this._prefBits,e+=4),P(t,this._maxBits,e+=4),this._protocol._cipher.encrypt(this._protocol._packetRW.write.finalize(t,!0))}generateKeys(){!this._dh&&this._prime&&this._generator&&(this._dh=r(this._prime,this._generator),this._public=this._dh.generateKeys())}setDHParams(e,t){if(!Buffer.isBuffer(e))throw new Error("Invalid prime value");if(!Buffer.isBuffer(t))throw new Error("Invalid generator value");this._prime=e,this._generator=t}getDHParams(){if(this._dh)return{prime:e(this._dh.getPrime()),generator:e(this._dh.getGenerator())}}parse(e){const n=e[0];switch(this._step){case 1:{if(this._protocol._server)return n!==b.KEXDH_GEX_REQUEST?R(this._protocol,`Received packet ${n} instead of `+b.KEXDH_GEX_REQUEST,"handshake",v.KEY_EXCHANGE_FAILED):R(this._protocol,"Group exchange not implemented for server","handshake",v.KEY_EXCHANGE_FAILED);if(n!==b.KEXDH_GEX_GROUP)return R(this._protocol,`Received packet ${n} instead of ${b.KEXDH_GEX_GROUP}`,"handshake",v.KEY_EXCHANGE_FAILED);let t,r;if(this._protocol._debug&&this._protocol._debug("Received DH GEX Group"),k.init(e,1),void 0===(t=k.readString())||void 0===(r=k.readString()))return k.clear(),R(this._protocol,"Received malformed KEXDH_GEX_GROUP","handshake",v.KEY_EXCHANGE_FAILED);k.clear(),this.setDHParams(t,r),this.generateKeys();const i=this.getPublicKey();this._protocol._debug&&this._protocol._debug("Outbound: Sending KEXDH_GEX_INIT");let s=this._protocol._packetRW.write.allocStartKEX;const o=this._protocol._packetRW.write.alloc(5+i.length,!0);o[s]=b.KEXDH_GEX_INIT,P(o,i.length,++s),o.set(i,s+=4),this._protocol._cipher.encrypt(this._protocol._packetRW.write.finalize(o,!0)),++this._step;break}case 2:if(this._protocol._server)return n!==b.KEXDH_GEX_INIT?R(this._protocol,`Received packet ${n} instead of ${b.KEXDH_GEX_INIT}`,"handshake",v.KEY_EXCHANGE_FAILED):(this._protocol._debug&&this._protocol._debug("Received DH GEX Init"),R(this._protocol,"Group exchange not implemented for server","handshake",v.KEY_EXCHANGE_FAILED));if(n!==b.KEXDH_GEX_REPLY)return R(this._protocol,`Received packet ${n} instead of ${b.KEXDH_GEX_REPLY}`,"handshake",v.KEY_EXCHANGE_FAILED);this._protocol._debug&&this._protocol._debug("Received DH GEX Reply"),this._step=1,e[0]=b.KEXDH_REPLY,this.parse=t.prototype.parse,this.parse(e)}}}class g extends t{constructor(e,t,...n){super(...n),this.type="group",this.groupName=e,this.hashName=t}start(){if(!this._protocol._server){this._protocol._debug&&this._protocol._debug("Outbound: Sending KEXDH_INIT");const e=this.getPublicKey();let t=this._protocol._packetRW.write.allocStartKEX;const n=this._protocol._packetRW.write.alloc(5+e.length,!0);n[t]=b.KEXDH_INIT,P(n,e.length,++t),n.set(e,t+=4),this._protocol._cipher.encrypt(this._protocol._packetRW.write.finalize(n,!0))}}generateKeys(){this._dh||(this._dh=i(this.groupName),this._public=this._dh.generateKeys())}getDHParams(){if(this._dh)return{prime:e(this._dh.getPrime()),generator:e(this._dh.getGenerator())}}}return(e,...t)=>{if("object"!=typeof e||null===e)throw new Error("Invalid negotiated argument");const r=e.kex;if("string"==typeof r){switch(t=[e,...t],r){case"curve25519-sha256":case"curve25519-sha256@libssh.org":if(!f)break;return new n("sha256",...t);case"ecdh-sha2-nistp256":return new h("prime256v1","sha256",...t);case"ecdh-sha2-nistp384":return new h("secp384r1","sha384",...t);case"ecdh-sha2-nistp521":return new h("secp521r1","sha512",...t);case"diffie-hellman-group1-sha1":return new g("modp2","sha1",...t);case"diffie-hellman-group14-sha1":return new g("modp14","sha1",...t);case"diffie-hellman-group14-sha256":return new g("modp14","sha256",...t);case"diffie-hellman-group15-sha512":return new g("modp15","sha512",...t);case"diffie-hellman-group16-sha512":return new g("modp16","sha512",...t);case"diffie-hellman-group17-sha512":return new g("modp17","sha512",...t);case"diffie-hellman-group18-sha512":return new g("modp18","sha512",...t);case"diffie-hellman-group-exchange-sha1":return new p("sha1",...t);case"diffie-hellman-group-exchange-sha256":return new p("sha256",...t)}throw new Error(`Unsupported key exchange algorithm: ${r}`)}throw new Error(`Invalid key exchange type: ${r}`)}})(),W=(()=>{const e=["kex","serverHostKey",["cs","cipher"],["sc","cipher"],["cs","mac"],["sc","mac"],["cs","compress"],["sc","compress"],["cs","lang"],["sc","lang"]];return class{constructor(t){if("object"!=typeof t||null===t)throw new TypeError("Argument must be an object");const n={kex:void 0,serverHostKey:void 0,cs:{cipher:void 0,mac:void 0,compress:void 0,lang:void 0},sc:{cipher:void 0,mac:void 0,compress:void 0,lang:void 0},all:void 0};let r=0;for(const i of e){let e,s,o,a;if("string"==typeof i)e=n,s=t[i],o=a=i;else{const r=i[0];e=n[r],a=i[1],s=t[r][a],o=`${r}.${a}`}const c={array:void 0,buffer:void 0};if(Buffer.isBuffer(s))c.array=(""+s).split(","),c.buffer=s,r+=4+s.length;else{if("string"==typeof s&&(s=s.split(",")),!Array.isArray(s))throw new TypeError(`Invalid \`${o}\` type: ${typeof s}`);c.array=s,c.buffer=Buffer.from(s.join(",")),r+=4+c.buffer.length}e[a]=c}const i=Buffer.allocUnsafe(r);n.all=i;let s=0;for(const t of e){let e;e="string"==typeof t?n[t].buffer:n[t[0]][t[1]].buffer,s=P(i,e.length,s),i.set(e,s),s+=e.length}this.totalSize=r,this.lists=n}copyAllTo(e,t){const n=this.lists.all;if("number"!=typeof t)throw new TypeError("Invalid offset value: "+typeof t);if(e.length-t<n.length)throw new Error("Insufficient space to copy list");return e.set(n,t),n.length}}})(),Q=(()=>{const e=Buffer.allocUnsafe(4);return(t,n)=>{P(e,n.length,0),t.update(e),t.update(n)}})();function q(e,t,n,r,i,s){let a;if(e){let c=o(t).update(n).update(r).update(s).update(i).digest();for(;c.length<e;){const e=o(t).update(n).update(r).update(c).digest(),i=Buffer.allocUnsafe(c.length+e.length);i.set(c,0),i.set(e,c.length),c=i}a=c.length===e?c:new O(c.buffer,c.byteOffset,e)}else a=U;return a}function z(e,t){if(0===t.length)return void(this._debug&&this._debug("Inbound: Skipping empty packet payload"));if(this._skipNextInboundPacket)return void(this._skipNextInboundPacket=!1);const r=(t=this._packetRW.read.read(t))[0];if(!this._strictMode)switch(r){case b.IGNORE:case b.UNIMPLEMENTED:case b.DEBUG:return M||(M=n(588)),M[r](this,t)}switch(r){case b.DISCONNECT:return M||(M=n(588)),M[r](this,t);case b.KEXINIT:return e.firstPacket?(e.firstPacket=!1,H(this,t)):R(this,"Received extra KEXINIT during handshake","handshake",v.KEY_EXCHANGE_FAILED);default:if(r<20||r>49)return R(this,`Received unexpected packet type ${r}`,"handshake",v.KEY_EXCHANGE_FAILED)}return this._kex.parse(t)}function $(e){if(!e._sentNEWKEYS){e._protocol._debug&&e._protocol._debug("Outbound: Sending NEWKEYS");const t=e._protocol._packetRW.write.allocStartKEX,n=e._protocol._packetRW.write.alloc(1,!0);n[t]=b.NEWKEYS,e._protocol._cipher.encrypt(e._protocol._packetRW.write.finalize(n,!0)),e._sentNEWKEYS=!0,e._protocol._strictMode&&(e._protocol._cipher.outSeqno=0)}}e.exports={KexInit:W,kexinit:F,onKEXPayload:z,DEFAULT_KEXINIT_CLIENT:new W({kex:p.concat(["ext-info-c","kex-strict-c-v00@openssh.com"]),serverHostKey:g,cs:{cipher:m,mac:_,compress:y,lang:[]},sc:{cipher:m,mac:_,compress:y,lang:[]}}),DEFAULT_KEXINIT_SERVER:new W({kex:p.concat(["kex-strict-s-v00@openssh.com"]),serverHostKey:g,cs:{cipher:m,mac:_,compress:y,lang:[]},sc:{cipher:m,mac:_,compress:y,lang:[]}}),HANDLERS:{[b.KEXINIT]:H}}},541(e,t,n){"use strict";const{createDecipheriv:r,createECDH:i,createHash:s,createHmac:o,createSign:a,createVerify:c,getCiphers:l,sign:h,verify:u}=n(6982),d=l(),{Ber:f}=n(3100),p=n(4015).pbkdf,{CIPHER_INFO:g}=n(7064),{eddsaSupported:m,SUPPORTED_CIPHER:_}=n(8692),{bufferSlice:y,makeBufferParser:v,readString:b,readUInt32BE:E,writeUInt32BE:A}=n(9576),S=Symbol("Hash Algorithm"),w=Symbol("Private key PEM"),C=Symbol("Public key PEM"),I=Symbol("Public key SSH"),k=Symbol("Decrypted Key"),T=Object.create(null);{const te=Object.keys(g);for(let ne=0;ne<te.length;++ne){const re=g[te[ne]].sslName;re&&!T[re]&&(T[re]=g[te[ne]])}}const R=v();function O(e,t){let n=(t=t.base64Slice(0,t.length)).replace(/.{64}/g,"$&\n");return 63&t.length&&(n+="\n"),`-----BEGIN ${e} KEY-----\n${n}-----END ${e} KEY-----`}function N(e,t){const n=Buffer.allocUnsafe(e.length+t.length);return n.set(e,0),n.set(t,e.length),n}function P(e,t){const n=e.length;let r=e._pos||0;for(let i=0;i<t;++i){const t=n-r;if(r>=n||t<4)return!1;const i=E(e,r);if(t<4+i)return!1;r+=4+i}return e._pos=r,!0}function B(e,t){const n=new f.Writer;return n.startSequence(),n.startSequence(),n.writeOID("1.2.840.113549.1.1.1"),n.writeNull(),n.endSequence(),n.startSequence(f.BitString),n.writeByte(0),n.startSequence(),n.writeBuffer(e,f.Integer),n.writeBuffer(t,f.Integer),n.endSequence(),n.endSequence(),n.endSequence(),O("PUBLIC",n.buffer)}function L(e,t){const n=Buffer.allocUnsafe(15+t.length+4+e.length);A(n,7,0),n.utf8Write("ssh-rsa",4,7);let r=11;return A(n,t.length,r),n.set(t,r+=4),A(n,e.length,r+=t.length),n.set(e,r+4),n}const x=(()=>{function e(e){return BigInt(`0x${e.hexSlice(0,e.length)}`)}function t(e){let t=e.toString(16);if(1&t.length)t=`0${t}`;else{const e=t.charCodeAt(0);(56===e||57===e||e>=97&&e<=102)&&(t=`00${t}`)}return Buffer.from(t,"hex")}return function(n,r,i,s,o,a){const c=e(i);return O("RSA PRIVATE",function(e,t,n,r,i,s,o,a){const c=new f.Writer;return c.startSequence(),c.writeInt(0,f.Integer),c.writeBuffer(e,f.Integer),c.writeBuffer(t,f.Integer),c.writeBuffer(n,f.Integer),c.writeBuffer(r,f.Integer),c.writeBuffer(i,f.Integer),c.writeBuffer(s,f.Integer),c.writeBuffer(o,f.Integer),c.writeBuffer(a,f.Integer),c.endSequence(),c.buffer}(n,r,i,o,a,t(c%(e(o)-1n)),t(c%(e(a)-1n)),s))}})();function D(e,t,n,r){const i=new f.Writer;return i.startSequence(),i.startSequence(),i.writeOID("1.2.840.10040.4.1"),i.startSequence(),i.writeBuffer(e,f.Integer),i.writeBuffer(t,f.Integer),i.writeBuffer(n,f.Integer),i.endSequence(),i.endSequence(),i.startSequence(f.BitString),i.writeByte(0),i.writeBuffer(r,f.Integer),i.endSequence(),i.endSequence(),O("PUBLIC",i.buffer)}function M(e,t,n,r){const i=Buffer.allocUnsafe(15+e.length+4+t.length+4+n.length+4+r.length);A(i,7,0),i.utf8Write("ssh-dss",4,7);let s=11;return A(i,e.length,s),i.set(e,s+=4),A(i,t.length,s+=e.length),i.set(t,s+=4),A(i,n.length,s+=t.length),i.set(n,s+=4),A(i,r.length,s+=n.length),i.set(r,s+4),i}function U(e,t,n,r,i){const s=new f.Writer;return s.startSequence(),s.writeInt(0,f.Integer),s.writeBuffer(e,f.Integer),s.writeBuffer(t,f.Integer),s.writeBuffer(n,f.Integer),s.writeBuffer(r,f.Integer),s.writeBuffer(i,f.Integer),s.endSequence(),O("DSA PRIVATE",s.buffer)}function F(e){const t=new f.Writer;return t.startSequence(),t.startSequence(),t.writeOID("1.3.101.112"),t.endSequence(),t.startSequence(f.BitString),t.writeByte(0),t._ensure(e.length),t._buf.set(e,t._offset),t._offset+=e.length,t.endSequence(),t.endSequence(),O("PUBLIC",t.buffer)}function H(e){const t=Buffer.allocUnsafe(19+e.length);return A(t,11,0),t.utf8Write("ssh-ed25519",4,11),A(t,e.length,15),t.set(e,19),t}function j(e){const t=new f.Writer;return t.startSequence(),t.writeInt(0,f.Integer),t.startSequence(),t.writeOID("1.3.101.112"),t.endSequence(),t.startSequence(f.OctetString),t.writeBuffer(e,f.OctetString),t.endSequence(),t.endSequence(),O("PRIVATE",t.buffer)}function W(e,t){const n=new f.Writer;return n.startSequence(),n.startSequence(),n.writeOID("1.2.840.10045.2.1"),n.writeOID(e),n.endSequence(),n.startSequence(f.BitString),n.writeByte(0),n._ensure(t.length),n._buf.set(t,n._offset),n._offset+=t.length,n.endSequence(),n.endSequence(),O("PUBLIC",n.buffer)}function Q(e,t){let n;switch(e){case"1.2.840.10045.3.1.7":n="nistp256";break;case"1.3.132.0.34":n="nistp384";break;case"1.3.132.0.35":n="nistp521";break;default:return}const r=Buffer.allocUnsafe(39+t.length);return A(r,19,0),r.utf8Write(`ecdsa-sha2-${n}`,4,19),A(r,8,23),r.utf8Write(n,27,8),A(r,t.length,35),r.set(t,39),r}function q(e,t,n){const r=new f.Writer;return r.startSequence(),r.writeInt(1,f.Integer),r.writeBuffer(n,f.OctetString),r.startSequence(160),r.writeOID(e),r.endSequence(),r.startSequence(161),r.startSequence(f.BitString),r.writeByte(0),r._ensure(t.length),r._buf.set(t,r._offset),r._offset+=t.length,r.endSequence(),r.endSequence(),r.endSequence(),O("EC PRIVATE",r.buffer)}const z={sign:"function"==typeof h?function(e,t){const n=this[w];if(null===n)return new Error("No private key available");t&&"string"==typeof t||(t=this[S]);try{return h(t,e,n)}catch(e){return e}}:function(e,t){const n=this[w];if(null===n)return new Error("No private key available");t&&"string"==typeof t||(t=this[S]);const r=a(t);r.update(e);try{return r.sign(n)}catch(e){return e}},verify:"function"==typeof u?function(e,t,n){const r=this[C];if(null===r)return new Error("No public key available");n&&"string"==typeof n||(n=this[S]);try{return u(n,e,r,t)}catch(e){return e}}:function(e,t,n){const r=this[C];if(null===r)return new Error("No public key available");n&&"string"==typeof n||(n=this[S]);const i=c(n);i.update(e);try{return i.verify(r,t)}catch(e){return e}},isPrivateKey:function(){return null!==this[w]},getPrivatePEM:function(){return this[w]},getPublicPEM:function(){return this[C]},getPublicSSH:function(){return this[I]},equals:function(e){const t=ee(e);return!(t instanceof Error)&&(this.type===t.type&&this[w]===t[w]&&this[C]===t[C]&&this[I].equals(t[I]))}};function $(e,t,n,r,i,s,o){this.type=e,this.comment=t,this[w]=n,this[C]=r,this[I]=i,this[S]=s,this[k]=o}$.prototype=z;{const ie=/^-----BEGIN OPENSSH PRIVATE KEY-----(?:\r\n|\n)([\s\S]+)(?:\r\n|\n)-----END OPENSSH PRIVATE KEY-----$/;function se(e,t,n){const r=[];if(e.length<8)return new Error("Malformed OpenSSH private key");if(E(e,0)!==E(e,4))return n?new Error("OpenSSH key integrity check failed -- bad passphrase?"):new Error("OpenSSH key integrity check failed");let i,s;for(e._pos=8,i=0;i<t;++i){let t,i,o,a;const c=b(e,e._pos,!0);if(void 0===c)return new Error("Malformed OpenSSH private key");switch(c){case"ssh-rsa":{const n=b(e,e._pos);if(void 0===n)return new Error("Malformed OpenSSH private key");const r=b(e,e._pos);if(void 0===r)return new Error("Malformed OpenSSH private key");const s=b(e,e._pos);if(void 0===s)return new Error("Malformed OpenSSH private key");const c=b(e,e._pos);if(void 0===c)return new Error("Malformed OpenSSH private key");const l=b(e,e._pos);if(void 0===l)return new Error("Malformed OpenSSH private key");const h=b(e,e._pos);if(void 0===h)return new Error("Malformed OpenSSH private key");o=B(n,r),a=L(n,r),i=x(n,r,s,c,l,h),t="sha1";break}case"ssh-dss":{const n=b(e,e._pos);if(void 0===n)return new Error("Malformed OpenSSH private key");const r=b(e,e._pos);if(void 0===r)return new Error("Malformed OpenSSH private key");const s=b(e,e._pos);if(void 0===s)return new Error("Malformed OpenSSH private key");const c=b(e,e._pos);if(void 0===c)return new Error("Malformed OpenSSH private key");const l=b(e,e._pos);if(void 0===l)return new Error("Malformed OpenSSH private key");o=D(n,r,s,c),a=M(n,r,s,c),i=U(n,r,s,c,l),t="sha1";break}case"ssh-ed25519":{if(!m)return new Error(`Unsupported OpenSSH private key type: ${c}`);const n=b(e,e._pos);if(void 0===n||32!==n.length)return new Error("Malformed OpenSSH private key");const r=b(e,e._pos);if(void 0===r||64!==r.length)return new Error("Malformed OpenSSH private key");o=F(n),a=H(n),i=j(y(r,0,32)),t=null;break}case"ecdsa-sha2-nistp256":t="sha256",s="1.2.840.10045.3.1.7";case"ecdsa-sha2-nistp384":void 0===t&&(t="sha384",s="1.3.132.0.34");case"ecdsa-sha2-nistp521":{if(void 0===t&&(t="sha512",s="1.3.132.0.35"),!P(e,1))return new Error("Malformed OpenSSH private key");const n=b(e,e._pos);if(void 0===n)return new Error("Malformed OpenSSH private key");const r=b(e,e._pos);if(void 0===r)return new Error("Malformed OpenSSH private key");o=W(s,n),a=Q(s,n),i=q(s,n,r);break}default:return new Error(`Unsupported OpenSSH private key type: ${c}`)}const l=b(e,e._pos,!0);if(void 0===l)return new Error("Malformed OpenSSH private key");r.push(new $(c,l,i,o,a,t,n))}let o=0;for(i=e._pos;i<e.length;++i)if(e[i]!==++o%255)return new Error("Malformed OpenSSH private key");return r}$.parse=(e,t)=>{const n=ie.exec(e);if(null===n)return null;let i;const s=Buffer.from(n[1],"base64");if(s.length<31)return new Error("Malformed OpenSSH private key");const o=s.utf8Slice(0,15);if("openssh-key-v1\0"!==o)return new Error(`Unsupported OpenSSH key magic: ${o}`);const a=b(s,15,!0);if(void 0===a)return new Error("Malformed OpenSSH private key");if("none"!==a&&-1===_.indexOf(a))return new Error(`Unsupported cipher for OpenSSH key: ${a}`);const c=b(s,s._pos,!0);if(void 0===c)return new Error("Malformed OpenSSH private key");if("none"!==c){if("none"===a)return new Error("Malformed OpenSSH private key");if("bcrypt"!==c)return new Error(`Unsupported kdf name for OpenSSH key: ${c}`);if(!t)return new Error("Encrypted private OpenSSH key detected, but no passphrase given")}else if("none"!==a)return new Error("Malformed OpenSSH private key");let l,h,u;"none"!==a&&(l=g[a]);const d=b(s,s._pos);if(void 0===d)return new Error("Malformed OpenSSH private key");if(d.length)switch(c){case"none":return new Error("Malformed OpenSSH private key");case"bcrypt":{const e=b(d,0);if(void 0===e||d._pos+4>d.length)return new Error("Malformed OpenSSH private key");const n=E(d,d._pos),r=Buffer.allocUnsafe(l.keyLen+l.ivLen);if(0!==p(t,t.length,e,e.length,r,r.length,n))return new Error("Failed to generate information to decrypt key");h=y(r,0,l.keyLen),u=y(r,l.keyLen,r.length);break}}else if("none"!==c)return new Error("Malformed OpenSSH private key");if(s._pos+3>=s.length)return new Error("Malformed OpenSSH private key");const f=E(s,s._pos);if(s._pos+=4,f>0){for(let e=0;e<f;++e){const e=b(s,s._pos);if(void 0===e)return new Error("Malformed OpenSSH private key");if(void 0===b(e,0,!0))return new Error("Malformed OpenSSH private key")}let e=b(s,s._pos);if(void 0===e)return new Error("Malformed OpenSSH private key");if(void 0!==h){if(e.length<l.blockLen||e.length%l.blockLen!==0)return new Error("Malformed OpenSSH private key");try{const t={authTagLength:l.authLen},n=r(l.sslName,h,u,t);if(n.setAutoPadding(!1),l.authLen>0){if(s.length-s._pos<l.authLen)return new Error("Malformed OpenSSH private key");n.setAuthTag(y(s,s._pos,s._pos+=l.authLen))}e=N(n.update(e),n.final())}catch(e){return e}}if(s._pos!==s.length)return new Error("Malformed OpenSSH private key");i=se(e,f,void 0!==h)}else i=[];return i instanceof Error?i:i[0]}}function G(e,t,n,r,i,s,o){this.type=e,this.comment=t,this[w]=n,this[C]=r,this[I]=i,this[S]=s,this[k]=o}G.prototype=z;{const oe=/^-----BEGIN (RSA|DSA|EC) PRIVATE KEY-----(?:\r\n|\n)((?:[^:]+:\s*[\S].*(?:\r\n|\n))*)([\s\S]+)(?:\r\n|\n)-----END (RSA|DSA|EC) PRIVATE KEY-----$/;G.parse=(e,t)=>{const n=oe.exec(e);if(null===n)return null;let o,a,c,l,h,u,p=Buffer.from(n[3],"base64"),g=n[2],m=!1;if(void 0!==g){g=g.split(/\r\n|\n/g);for(let e=0;e<g.length;++e){const n=g[e];let i=n.indexOf(":");if("DEK-Info"===n.slice(0,i)){const e=n.slice(i+2);if(i=e.indexOf(","),-1===i)continue;const o=e.slice(0,i).toLowerCase();if(-1===d.indexOf(o))return new Error(`Cipher (${o}) not supported for encrypted OpenSSH private key`);const a=T[o];if(!a)return new Error(`Cipher (${o}) not supported for encrypted OpenSSH private key`);const c=Buffer.from(e.slice(i+1),"hex");if(c.length!==a.ivLen)return new Error("Malformed encrypted OpenSSH private key");if(!t)return new Error("Encrypted OpenSSH private key detected, but no passphrase given");const l=y(c,0,8);let h=s("md5").update(t).update(l).digest();for(;h.length<a.keyLen;)h=N(h,s("md5").update(h).update(t).update(l).digest());h.length>a.keyLen&&(h=y(h,0,a.keyLen));try{const e=r(o,h,c);e.setAutoPadding(!1),p=N(e.update(p),e.final()),m=!0}catch(e){return e}}}}let _="Malformed OpenSSH private key";switch(m&&(_+=". Bad passphrase?"),n[1]){case"RSA":o="ssh-rsa",a=O("RSA PRIVATE",p);try{u=new f.Reader(p),u.readSequence(),u.readInt();const e=u.readString(f.Integer,!0);if(null===e)return new Error(_);const t=u.readString(f.Integer,!0);if(null===t)return new Error(_);c=B(e,t),l=L(e,t)}catch{return new Error(_)}h="sha1";break;case"DSA":o="ssh-dss",a=O("DSA PRIVATE",p);try{u=new f.Reader(p),u.readSequence(),u.readInt();const e=u.readString(f.Integer,!0);if(null===e)return new Error(_);const t=u.readString(f.Integer,!0);if(null===t)return new Error(_);const n=u.readString(f.Integer,!0);if(null===n)return new Error(_);const r=u.readString(f.Integer,!0);if(null===r)return new Error(_);c=D(e,t,n,r),l=M(e,t,n,r)}catch{return new Error(_)}h="sha1";break;case"EC":{let e,t,n;try{u=new f.Reader(p),u.readSequence(),u.readInt(),t=u.readString(f.OctetString,!0),u.readByte();const r=u.readLength();if(null===r)return new Error(_);if(u._offset=r,n=u.readOID(),null===n)return new Error(_);switch(n){case"1.2.840.10045.3.1.7":e="prime256v1",o="ecdsa-sha2-nistp256",h="sha256";break;case"1.3.132.0.34":e="secp384r1",o="ecdsa-sha2-nistp384",h="sha384";break;case"1.3.132.0.35":e="secp521r1",o="ecdsa-sha2-nistp521",h="sha512";break;default:return new Error(`Unsupported private key EC OID: ${n}`)}}catch{return new Error(_)}a=O("EC PRIVATE",p);const r=function(e,t){const n=i(e);return n.setPrivateKey(t),n.getPublicKey()}(e,t);c=W(n,r),l=Q(n,r);break}}return new G(o,"",a,c,l,h,m)}}function K(e,t,n,r,i,s,o){this.type=e,this.comment=t,this[w]=n,this[C]=r,this[I]=i,this[S]=s,this[k]=o}K.prototype=z;{const ae=Buffer.alloc(0),ce=Buffer.from([0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]),le=Buffer.from([0,0,0,0]),he=Buffer.from([0,0,0,1]),ue=/^PuTTY-User-Key-File-2: (ssh-(?:rsa|dss))\r?\nEncryption: (aes256-cbc|none)\r?\nComment: ([^\r\n]*)\r?\nPublic-Lines: \d+\r?\n([\s\S]+?)\r?\nPrivate-Lines: \d+\r?\n([\s\S]+?)\r?\nPrivate-MAC: ([^\r\n]+)/;K.parse=(e,t)=>{const n=ue.exec(e);if(null===n)return null;const i=n[2],a="none"!==i;if(a&&!t)return new Error("Encrypted PPK private key detected, but no passphrase given");let c=Buffer.from(n[5],"base64");if(a){const e=g[i];let n=N(s("sha1").update(le).update(t).digest(),s("sha1").update(he).update(t).digest());n.length>e.keyLen&&(n=y(n,0,e.keyLen));try{const t=r(e.sslName,n,ce);t.setAutoPadding(!1),c=N(t.update(c),t.final())}catch(e){return e}}const l=n[1],h=n[3],u=Buffer.from(n[4],"base64"),d=n[6],f=l.length,p=i.length,m=Buffer.byteLength(h),_=u.length,v=c.length,E=Buffer.allocUnsafe(4+f+4+p+4+m+4+_+4+v);let S=0;A(E,f,S),E.utf8Write(l,S+=4,f),A(E,p,S+=f),E.utf8Write(i,S+=4,p),A(E,m,S+=p),E.utf8Write(h,S+=4,m),A(E,_,S+=m),E.set(u,S+=4),A(E,v,S+=_),E.set(c,S+4),t||(t=ae);if(o("sha1",s("sha1").update("putty-private-key-file-mac-key").update(t).digest()).update(E).digest("hex")!==d)return a?new Error("PPK private key integrity check failed -- bad passphrase?"):new Error("PPK private key integrity check failed");let w,C,I;switch(u._pos=0,P(u,1),l){case"ssh-rsa":{const e=b(u,u._pos);if(void 0===e)return new Error("Malformed PPK public key");const t=b(u,u._pos);if(void 0===t)return new Error("Malformed PPK public key");const n=b(c,0);if(void 0===n)return new Error("Malformed PPK private key");const r=b(c,c._pos);if(void 0===r)return new Error("Malformed PPK private key");const i=b(c,c._pos);if(void 0===i)return new Error("Malformed PPK private key");const s=b(c,c._pos);if(void 0===s)return new Error("Malformed PPK private key");w=B(t,e),C=L(t,e),I=x(t,e,n,s,r,i);break}case"ssh-dss":{const e=b(u,u._pos);if(void 0===e)return new Error("Malformed PPK public key");const t=b(u,u._pos);if(void 0===t)return new Error("Malformed PPK public key");const n=b(u,u._pos);if(void 0===n)return new Error("Malformed PPK public key");const r=b(u,u._pos);if(void 0===r)return new Error("Malformed PPK public key");const i=b(c,0);if(void 0===i)return new Error("Malformed PPK private key");w=D(e,t,n,r),C=M(e,t,n,r),I=U(e,t,n,r,i);break}}return new K(l,h,I,w,C,"sha1",a)}}function Y(e,t,n,r,i){this.type=e,this.comment=t,this[w]=null,this[C]=n,this[I]=r,this[S]=i,this[k]=!1}Y.prototype=z;{let de;de=m?/^(((?:ssh-(?:rsa|dss|ed25519))|ecdsa-sha2-nistp(?:256|384|521))(?:-cert-v0[01]@openssh.com)?) ([A-Z0-9a-z/+=]+)(?:$|\s+([\S].*)?)$/:/^(((?:ssh-(?:rsa|dss))|ecdsa-sha2-nistp(?:256|384|521))(?:-cert-v0[01]@openssh.com)?) ([A-Z0-9a-z/+=]+)(?:$|\s+([\S].*)?)$/,Y.parse=e=>{const t=de.exec(e);if(null===t)return null;const n=t[1],r=t[2],i=Buffer.from(t[3],"base64"),s=t[4]||"",o=b(i,i._pos,!0);return void 0===o||0!==o.indexOf(r)?new Error("Malformed OpenSSH public key"):X(i,r,s,n)}}function V(e,t,n,r,i){this.type=e,this.comment=t,this[w]=null,this[C]=n,this[I]=r,this[S]=i,this[k]=!1}V.prototype=z;{const fe=/^---- BEGIN SSH2 PUBLIC KEY ----(?:\r?\n)((?:.{0,72}\r?\n)+)---- END SSH2 PUBLIC KEY ----$/,pe=/^[A-Z0-9a-z/+=\r\n]+$/,ge=/^([\x21-\x39\x3B-\x7E]{1,64}): ((?:[^\\]*\\\r?\n)*[^\r\n]+)\r?\n/gm,me=/\\\r?\n/g;V.parse=e=>{let t=fe.exec(e);if(null===t)return null;const n=t[1];let r=0,i="";for(;t=ge.exec(n);){const e=t[1],n=t[2].replace(me,"");if(n.length>1024)return ge.lastIndex=0,new Error("Malformed RFC4716 public key");r=ge.lastIndex,"comment"===e.toLowerCase()&&(i=n,i.length>1&&34===i.charCodeAt(0)&&34===i.charCodeAt(i.length-1)&&(i=i.slice(1,-1)))}let s=n.slice(r);if(!pe.test(s))return new Error("Malformed RFC4716 public key");s=Buffer.from(s,"base64");const o=b(s,0,!0);if(void 0===o)return new Error("Malformed RFC4716 public key");let a=null,c=null;switch(o){case"ssh-rsa":{const e=b(s,s._pos);if(void 0===e)return new Error("Malformed RFC4716 public key");const t=b(s,s._pos);if(void 0===t)return new Error("Malformed RFC4716 public key");a=B(t,e),c=L(t,e);break}case"ssh-dss":{const e=b(s,s._pos);if(void 0===e)return new Error("Malformed RFC4716 public key");const t=b(s,s._pos);if(void 0===t)return new Error("Malformed RFC4716 public key");const n=b(s,s._pos);if(void 0===n)return new Error("Malformed RFC4716 public key");const r=b(s,s._pos);if(void 0===r)return new Error("Malformed RFC4716 public key");a=D(e,t,n,r),c=M(e,t,n,r);break}default:return new Error("Malformed RFC4716 public key")}return new V(o,i,a,c,"sha1")}}function X(e,t,n,r){if(!J(t))return new Error(`Unsupported OpenSSH public key type: ${t}`);let i,s,o=null,a=null;switch(t){case"ssh-rsa":{const t=b(e,e._pos||0);if(void 0===t)return new Error("Malformed OpenSSH public key");const n=b(e,e._pos);if(void 0===n)return new Error("Malformed OpenSSH public key");o=B(n,t),a=L(n,t),i="sha1";break}case"ssh-dss":{const t=b(e,e._pos||0);if(void 0===t)return new Error("Malformed OpenSSH public key");const n=b(e,e._pos);if(void 0===n)return new Error("Malformed OpenSSH public key");const r=b(e,e._pos);if(void 0===r)return new Error("Malformed OpenSSH public key");const s=b(e,e._pos);if(void 0===s)return new Error("Malformed OpenSSH public key");o=D(t,n,r,s),a=M(t,n,r,s),i="sha1";break}case"ssh-ed25519":{const t=b(e,e._pos||0);if(void 0===t||32!==t.length)return new Error("Malformed OpenSSH public key");o=F(t),a=H(t),i=null;break}case"ecdsa-sha2-nistp256":i="sha256",s="1.2.840.10045.3.1.7";case"ecdsa-sha2-nistp384":void 0===i&&(i="sha384",s="1.3.132.0.34");case"ecdsa-sha2-nistp521":{if(void 0===i&&(i="sha512",s="1.3.132.0.35"),!P(e,1))return new Error("Malformed OpenSSH public key");const t=b(e,e._pos||0);if(void 0===t)return new Error("Malformed OpenSSH public key");o=W(s,t),a=Q(s,t);break}default:return new Error(`Unsupported OpenSSH public key type: ${t}`)}return new Y(r,n,o,a,i)}function J(e){switch(e){case"ssh-rsa":case"ssh-dss":case"ecdsa-sha2-nistp256":case"ecdsa-sha2-nistp384":case"ecdsa-sha2-nistp521":return!0;case"ssh-ed25519":if(m)return!0;default:return!1}}function Z(e){return!!e&&"boolean"==typeof e[k]}function ee(e,t){if(Z(e))return e;let n,r;if(Buffer.isBuffer(e))n=e,e=e.utf8Slice(0,e.length).trim();else{if("string"!=typeof e)return new Error("Key data must be a Buffer or string");e=e.trim()}if(null!=t)if("string"==typeof t)t=Buffer.from(t);else if(!Buffer.isBuffer(t))return new Error("Passphrase must be a string or Buffer when supplied");if(null!==(r=$.parse(e,t)))return r;if(null!==(r=G.parse(e,t)))return r;if(null!==(r=K.parse(e,t)))return r;if(null!==(r=Y.parse(e)))return r;if(null!==(r=V.parse(e)))return r;if(n){R.init(n,0);const t=R.readString(!0);void 0!==t&&void 0!==(e=R.readRaw())&&(r=X(e,t,"",t),r instanceof Error&&(r=null)),R.clear()}return r||new Error("Unsupported key format")}e.exports={isParsedKey:Z,isSupportedKeyType:J,parseDERKey:(e,t)=>X(e,t,"",t),parseKey:ee}},6728(e,t,n){"use strict";const r=n(2613),{inspect:i}=n(9023);function s(e){let t="",n=e.length;const r="-"===e[0]?1:0;for(;n>=r+4;n-=3)t=`_${e.slice(n-3,n)}${t}`;return`${e.slice(0,n)}${t}`}function o(e,t){if(r("string"==typeof t,"`thing` has to be of type string"),Array.isArray(e)){const n=e.length;return r(n>0,"At least one expected value needs to be specified"),e=e.map(e=>String(e)),n>2?`one of ${t} ${e.slice(0,n-1).join(", ")}, or `+e[n-1]:2===n?`one of ${t} ${e[0]} or ${e[1]}`:`of ${t} ${e[0]}`}return`of ${t} ${String(e)}`}t.ERR_INTERNAL_ASSERTION=class e extends Error{constructor(t){super(),Error.captureStackTrace(this,e);const n="This is caused by either a bug in ssh2 or incorrect usage of ssh2 internals.\nPlease open an issue with this stack trace at https://github.com/mscdex/ssh2/issues\n";this.message=void 0===t?n:`${t}\n${n}`}};const a=2**32,c=(()=>{try{return new Function("return 2n ** 32n")()}catch{}})();t.ERR_OUT_OF_RANGE=class e extends RangeError{constructor(t,n,o,l){super(),Error.captureStackTrace(this,e),r(n,'Missing "range" argument');let h,u=l?t:`The value of "${t}" is out of range.`;Number.isInteger(o)&&Math.abs(o)>a?h=s(String(o)):"bigint"==typeof o?(h=String(o),(o>c||o<-c)&&(h=s(h)),h+="n"):h=i(o),u+=` It must be ${n}. Received ${h}`,this.message=u}};class l extends TypeError{constructor(e,t,n){let i,s;if(super(),Error.captureStackTrace(this,l),r("string"==typeof e,"'name' must be a string"),"string"==typeof t&&t.startsWith("not ")?(i="must not be",t=t.replace(/^not /,"")):i="must be",e.endsWith(" argument"))s=`The ${e} ${i} ${o(t,"type")}`;else{const n=e.includes(".")?"property":"argument";s=`The "${e}" ${n} ${i} ${o(t,"type")}`}s+=". Received type "+typeof n,this.message=s}}t.ERR_INVALID_ARG_TYPE=l,t.validateNumber=function(e,t){if("number"!=typeof e)throw new l(t,"number",e)}},9576(e,t,n){"use strict";const r=n(3100).Ber;let i;const s=Buffer[Symbol.species],o=Object.getPrototypeOf(Uint8Array.prototype).fill;function a(e,t){return 16777216*e[t++]+65536*e[t++]+256*e[t++]+e[t]}function c(e,t,n,r,i){i||(i=0),r>e.length&&(r=e.length);let s=r-n;const o=t.length-i;return s>o&&(s=o),t.set(new Uint8Array(e.buffer,e.byteOffset+n,s),i),s}function l(e,t,n){return void 0===n&&(n=e.length),new s(e.buffer,e.byteOffset+t,n-t)}function h(){let e,t=0;const n={init:(n,r)=>{e=n,t="number"==typeof r?r:0},pos:()=>t,length:()=>e?e.length:0,avail:()=>e&&t<e.length?e.length-t:0,clear:()=>{e=void 0},readUInt32BE:()=>{if(e&&!(t+3>=e.length))return 16777216*e[t++]+65536*e[t++]+256*e[t++]+e[t++]},readUInt64BE:n=>{if(e&&!(t+7>=e.length))switch(n){case"always":return BigInt(`0x${e.hexSlice(t,t+=8)}`);case"maybe":if(e[t]>31)return BigInt(`0x${e.hexSlice(t,t+=8)}`);default:return 72057594037927940*e[t++]+281474976710656*e[t++]+1099511627776*e[t++]+4294967296*e[t++]+16777216*e[t++]+65536*e[t++]+256*e[t++]+e[t++]}},skip:n=>{e&&n>0&&(t+=n)},skipString:()=>{const r=n.readUInt32BE();if(void 0!==r)return t+=r,t<=e.length?r:void 0},readByte:()=>{if(e&&t<e.length)return e[t++]},readBool:()=>{if(e&&t<e.length)return!!e[t++]},readList:()=>{const e=n.readString(!0);if(void 0!==e)return e?e.split(","):[]},readString:(r,i)=>{"number"==typeof r&&(i=r,r=void 0);const s=n.readUInt32BE();if(void 0!==s&&!(e.length-t<s||"number"==typeof i&&s>i))return r?Buffer.isBuffer(r)?c(e,r,t,t+=s):e.utf8Slice(t,t+=s):l(e,t,t+=s)},readRaw:n=>{if(e)return"number"!=typeof n?l(e,t,t+=e.length-t):e.length-t>=n?l(e,t,t+=n):void 0}};return n}function u(e,t,n){const r=new Error(e);return"boolean"==typeof t?(n=t,r.level="protocol"):r.level=t||"protocol",r.fatal=!!n,r}function d(e,t,n){return e[n++]=t>>>24,e[n++]=t>>>16,e[n++]=t>>>8,e[n++]=t,n}const f=h();e.exports={bufferCopy:c,bufferSlice:l,FastBuffer:s,bufferFill:(e,t,n,r)=>o.call(e,t,n,r),makeError:u,doFatalError:(e,t,r,s)=>{let o;return void 0===i&&({DISCONNECT_REASON:i}=n(8692)),t instanceof Error?(o=t,s="number"!=typeof r?i.PROTOCOL_ERROR:r):o=u(t,r,!0),"number"!=typeof s&&(s=i.PROTOCOL_ERROR),e.disconnect(s),e._destruct(),e._onError(o),1/0},readUInt32BE:a,writeUInt32BE:d,writeUInt32LE:(e,t,n)=>(e[n++]=t,e[n++]=t>>>8,e[n++]=t>>>16,e[n++]=t>>>24,n),makeBufferParser:h,bufferParser:h(),readString:(e,t,n,r)=>{"number"==typeof n&&(r=n,n=void 0),void 0===t&&(t=0);const i=e.length-t;if(t<0||t>=e.length||i<4)return;const s=a(e,t);if(i<4+s||"number"==typeof r&&s>r)return;const o=(t+=4)+s;return e._pos=o,n?Buffer.isBuffer(n)?c(e,n,t,o):e.utf8Slice(t,o):l(e,t,o)},sigSSHToASN1:(e,t)=>{switch(t){case"ssh-dss":{if(e.length>40)return e;const t=new r.Writer;t.startSequence();let n=e.slice(0,20),i=e.slice(20);if(128&n[0]){const e=Buffer.allocUnsafe(21);e[0]=0,n.copy(e,1),n=e}else 0!==n[0]||128&n[1]||(n=n.slice(1));if(128&i[0]){const e=Buffer.allocUnsafe(21);e[0]=0,i.copy(e,1),i=e}else 0!==i[0]||128&i[1]||(i=i.slice(1));return t.writeBuffer(n,r.Integer),t.writeBuffer(i,r.Integer),t.endSequence(),t.buffer}case"ecdsa-sha2-nistp256":case"ecdsa-sha2-nistp384":case"ecdsa-sha2-nistp521":{f.init(e,0);const t=f.readString(),n=f.readString();if(f.clear(),void 0===t||void 0===n)return;const i=new r.Writer;return i.startSequence(),i.writeBuffer(t,r.Integer),i.writeBuffer(n,r.Integer),i.endSequence(),i.buffer}default:return e}},convertSignature:(e,t)=>{switch(t){case"ssh-dss":{if(e.length<=40)return e;const t=new r.Reader(e);t.readSequence();let n=t.readString(r.Integer,!0),i=t.readString(r.Integer,!0),s=0,o=0;if(n.length<20){const e=Buffer.allocUnsafe(20);e.set(n,1),n=e,n[0]=0}if(i.length<20){const e=Buffer.allocUnsafe(20);e.set(i,1),i=e,i[0]=0}n.length>20&&0===n[0]&&(s=1),i.length>20&&0===i[0]&&(o=1);const a=Buffer.allocUnsafe(n.length-s+(i.length-o));return c(n,a,s,n.length,0),c(i,a,o,i.length,n.length-s),a}case"ecdsa-sha2-nistp256":case"ecdsa-sha2-nistp384":case"ecdsa-sha2-nistp521":{if(0===e[0])return e;const t=new r.Reader(e);t.readSequence();const n=t.readString(r.Integer,!0),i=t.readString(r.Integer,!0);if(null===n||null===i)return;const s=Buffer.allocUnsafe(4+n.length+4+i.length);return d(s,n.length,0),s.set(n,4),d(s,i.length,4+n.length),s.set(i,8+n.length),s}}return e},sendPacket:(e,t,n)=>n||void 0===e._kexinit?(e._cipher.encrypt(t),!0):(void 0===e._queue&&(e._queue=[]),e._queue.push(t),e._debug&&e._debug("Outbound: ... packet queued"),!1)}},5696(e,t,n){"use strict";const{kMaxLength:r}=n(181),{createInflate:i,constants:{DEFLATE:s,INFLATE:o,Z_DEFAULT_CHUNK:a,Z_DEFAULT_COMPRESSION:c,Z_DEFAULT_MEMLEVEL:l,Z_DEFAULT_STRATEGY:h,Z_DEFAULT_WINDOWBITS:u,Z_PARTIAL_FLUSH:d}}=n(3106),f=i()._handle.constructor;function p(){throw new Error("Should not get here")}function g(e,t,n){const r=this._owner,i=new Error(e);i.errno=t,i.code=n,r._err=i}function m(e){e._handle&&(e._handle.close(),e._handle=null)}class _{constructor(e){const t=u,n=c,i=l,s=h;this._err=void 0,this._writeState=new Uint32Array(2),this._chunkSize=a,this._maxOutputLength=r,this._outBuffer=Buffer.allocUnsafe(this._chunkSize),this._outOffset=0,this._handle=new f(e),this._handle._owner=this,this._handle.onerror=g,this._handle.init(t,n,i,s,this._writeState,p,void 0)}writeSync(e,t){const n=this._handle;if(!n)throw new Error("Invalid Zlib instance");let r,i,s,o=e.length,a=this._chunkSize-this._outOffset,c=0,l=0;const h=this._writeState;let u=this._outBuffer,f=this._outOffset;const p=this._chunkSize;for(;;){if(n.writeSync(d,e,c,o,u,f,a),this._err)throw this._err;r=h[0],i=h[1];const t=o-i,g=a-r;if(g>0){const e=0===f&&g===u.length?u:u.slice(f,f+g);if(f+=g,s?void 0===s.push?s=[s,e]:s.push(e):s=e,l+=e.byteLength,l>this._maxOutputLength)throw m(this),new Error(`Output length exceeded maximum of ${this._maxOutputLength}`)}else if(0!==g)throw new Error("have should not go down");if((0===r||f>=p)&&(a=p,f=0,u=Buffer.allocUnsafe(p)),0!==r)break;c+=t,o=i}if(this._outBuffer=u,this._outOffset=f,0===l&&(s=Buffer.alloc(0)),t)return s.totalLen=l,s;if(void 0===s.push)return s;const g=Buffer.allocUnsafe(l);for(let e=0,t=0;e<s.length;++e){const n=s[e];g.set(n,t),t+=n.length}return g}}e.exports={PacketReader:class{cleanup(){}read(e){return e}},PacketWriter:class{constructor(e){this.allocStart=5,this.allocStartKEX=5,this._protocol=e}cleanup(){}alloc(e,t){return void 0===this._protocol._kexinit||t?this._protocol._cipher.allocPacket(e):Buffer.allocUnsafe(e)}finalize(e,t){return e}},ZlibPacketReader:class{constructor(){this._zlib=new _(o)}cleanup(){this._zlib&&m(this._zlib)}read(e){return this._zlib.writeSync(e,!1)}},ZlibPacketWriter:class{constructor(e){this.allocStart=0,this.allocStartKEX=0,this._protocol=e,this._zlib=new _(s)}cleanup(){this._zlib&&m(this._zlib)}alloc(e,t){return Buffer.allocUnsafe(e)}finalize(e,t){if(void 0===this._protocol._kexinit||t){const t=this._zlib.writeSync(e,!0),n=this._protocol._cipher.allocPacket(t.totalLen);if(void 0===t.push)n.set(t,5);else for(let e=0,r=5;e<t.length;++e){const i=t[e];n.set(i,r),r+=i.length}return n}return e}}}},8637(e,t,n){"use strict";const{Server:r}=n(9278),i=n(4434),{listenerCount:s}=i,{CHANNEL_OPEN_FAILURE:o,DEFAULT_CIPHER:a,DEFAULT_COMPRESSION:c,DEFAULT_KEX:l,DEFAULT_MAC:h,DEFAULT_SERVER_HOST_KEY:u,DISCONNECT_REASON:d,DISCONNECT_REASON_BY_VALUE:f,SUPPORTED_CIPHER:p,SUPPORTED_COMPRESSION:g,SUPPORTED_KEX:m,SUPPORTED_MAC:_,SUPPORTED_SERVER_HOST_KEY:y}=n(8692),{init:v}=n(7064),{KexInit:b}=n(3645),{parseKey:E}=n(541),A=n(7265),{SFTP:S}=n(7764),{writeUInt32BE:w}=n(9576),{Channel:C,MAX_WINDOW:I,PACKET_SIZE:k,windowAdjust:T,WINDOW_THRESHOLD:R}=n(1811),{ChannelManager:O,generateAlgorithmList:N,isWritable:P,onChannelOpenFailure:B,onCHANNEL_CLOSE:L}=n(4457);class x extends i{constructor(e,t,n,r,i){super(),this.username=this.user=t,this.service=n,this.method=r,this._initialResponse=!1,this._finalResponse=!1,this._multistep=!1,this._cbfinal=(e,t,n)=>{this._finalResponse||(this._finalResponse=!0,i(this,e,t,n))},this._protocol=e}accept(){this._cleanup&&this._cleanup(),this._initialResponse=!0,this._cbfinal(!0)}reject(e,t){this._cleanup&&this._cleanup(),this._initialResponse=!0,this._cbfinal(!1,e,t)}}class D extends x{constructor(e,t,n,r,i,s){super(e,t,n,r,s),this._multistep=!0,this._cb=void 0,this._onInfoResponse=e=>{const t=this._cb;t&&(this._cb=void 0,t(e))},this.submethods=i,this.on("abort",()=>{this._cb&&this._cb(new Error("Authentication request aborted"))})}prompt(e,t,n,r){Array.isArray(e)||(e=[e]),"function"==typeof t?(r=t,t=n=void 0):"function"==typeof n?(r=n,n=void 0):"function"!=typeof r&&(r=void 0);for(let t=0;t<e.length;++t)"string"==typeof e[t]&&(e[t]={prompt:e[t],echo:!0});this._cb=r,this._initialResponse=!0,this._protocol.authInfoReq(t,n,e)}}class M extends x{constructor(e,t,n,r,i,s){super(e,t,n,r,s),this.key={algo:i.keyAlgo,data:i.key},this.hashAlgo=i.hashAlgo,this.signature=i.signature,this.blob=i.blob}accept(){this.signature?x.prototype.accept.call(this):(this._initialResponse=!0,this._protocol.authPKOK(this.key.algo,this.key.data))}}class U extends x{constructor(e,t,n,r,i,s){super(e,t,n,r,s),this.key={algo:i.keyAlgo,data:i.key},this.hashAlgo=i.hashAlgo,this.signature=i.signature,this.blob=i.blob,this.localHostname=i.localHostname,this.localUsername=i.localUsername}}class F extends x{constructor(e,t,n,r,i,s){super(e,t,n,r,s),this.password=i,this._changeCb=void 0}requestChange(e,t){if(this._changeCb)throw new Error("Change request already in progress");if("string"!=typeof e)throw new Error("prompt argument must be a string");if("function"!=typeof t)throw new Error("Callback argument must be a function");this._changeCb=t,this._protocol.authPasswdChg(e)}}class H extends i{constructor(e,t,n){super(),this.type="session",this.subtype=void 0,this.server=!0,this._ending=!1,this._channel=void 0,this._chanInfo={type:"session",incoming:{id:n,window:I,packetSize:k,state:"open"},outgoing:{id:t.sender,window:t.window,packetSize:t.packetSize,state:"open"}}}}class j extends i{constructor(e,t){if(super(),"object"!=typeof e||null===e)throw new Error("Missing configuration object");const n=Object.create(null),i=[],s=e.hostKeys;if(!Array.isArray(s))throw new Error("hostKeys must be an array");const o="object"==typeof e.algorithms&&null!==e.algorithms?e.algorithms:{},d=N(o.serverHostKey,u,y);for(let e=0;e<s.length;++e){let t;if(t=Buffer.isBuffer(s[e])||"string"==typeof s[e]?E(s[e]):E(s[e].key,s[e].passphrase),t instanceof Error)throw new Error(`Cannot parse privateKey: ${t.message}`);if(Array.isArray(t)&&(t=t[0]),null===t.getPrivatePEM())throw new Error("privateKey value contains an invalid private key");if(!i.includes(t.type))if("ssh-rsa"===t.type){let e=d.indexOf("ssh-rsa");const r=d.indexOf("rsa-sha2-256"),s=d.indexOf("rsa-sha2-512");-1===e&&(e=1/0),[e,r,s].sort(q).forEach(o=>{if(-1===o)return;let a;switch(o){case e:a="ssh-rsa";break;case r:a="rsa-sha2-256";break;case s:a="rsa-sha2-512";break;default:return}n[a]=t,i.push(a)})}else n[t.type]=t,i.push(t.type)}const f={kex:N(o.kex,l,m).concat(["kex-strict-s-v00@openssh.com"]),serverHostKey:i,cs:{cipher:N(o.cipher,a,p),mac:N(o.hmac,h,_),compress:N(o.compress,c,g),lang:[]},sc:void 0};f.sc=f.cs,"function"==typeof t&&this.on("connection",t);const v="function"==typeof e.debug?e.debug:void 0,A=e.ident?Buffer.from(e.ident):void 0,S=new b(f);this._srv=new r(t=>{if(this._connections>=this.maxConnections)return void t.destroy();let r;if(++this._connections,t.once("close",()=>{--this._connections}),v){const e=`[${process.hrtime().join(".")}] `;r=t=>{v(`${e}${t}`)}}new W(t,n,A,S,r,this,e)}).on("error",e=>{this.emit("error",e)}).on("listening",()=>{this.emit("listening")}).on("close",()=>{this.emit("close")}),this._connections=0,this.maxConnections=1/0}injectSocket(e){this._srv.emit("connection",e)}listen(...e){return this._srv.listen(...e),this}address(){return this._srv.address()}getConnections(e){return this._srv.getConnections(e),this}close(e){return this._srv.close(e),this}ref(){return this._srv.ref(),this}unref(){return this._srv.unref(),this}}j.KEEPALIVE_CLIENT_INTERVAL=15e3,j.KEEPALIVE_CLIENT_COUNT_MAX=3;class W extends i{constructor(e,t,n,r,i,a,c){super();let l,h,u,p=0,g=!1,m=[];const _=[];function y(e){}this._sock=e,this._chanMgr=new O(this),this._debug=i,this.noMoreSessions=!1,this.authenticated=!1,this.on("error",y);const b=i?(e,t,n)=>{i(`Debug output from client: ${JSON.stringify(n)}`)}:void 0,E="number"==typeof c.keepaliveInterval&&isFinite(c.keepaliveInterval)&&c.keepaliveInterval>0?c.keepaliveInterval:"number"==typeof j.KEEPALIVE_CLIENT_INTERVAL&&isFinite(j.KEEPALIVE_CLIENT_INTERVAL)&&j.KEEPALIVE_CLIENT_INTERVAL>0?j.KEEPALIVE_CLIENT_INTERVAL:-1,N="number"==typeof c.keepaliveCountMax&&isFinite(c.keepaliveCountMax)&&c.keepaliveCountMax>=0?c.keepaliveCountMax:"number"==typeof j.KEEPALIVE_CLIENT_COUNT_MAX&&isFinite(j.KEEPALIVE_CLIENT_COUNT_MAX)&&j.KEEPALIVE_CLIENT_COUNT_MAX>=0?j.KEEPALIVE_CLIENT_COUNT_MAX:-1;let W=0;-1!==E&&-1!==N&&(this.once("ready",()=>{const e=()=>{clearInterval(h)};this.on("close",e).on("end",e),h=setInterval(()=>{if(++W>N){clearInterval(h);const e=new Error("Keepalive timeout");e.level="client-timeout",this.emit("error",e),this.end()}else Q.ping()},E)}),u=()=>{h&&h.refresh(),W=0});const Q=this._protocol=new A({server:!0,hostKeys:t,ident:n,offer:r,onPacket:u,greeting:c.greeting,banner:c.banner,onWrite:t=>{P(e)&&e.write(t)},onError:t=>{Q._destruct||e.removeAllListeners("data"),this.emit("error",t);try{e.end()}catch{}},onHeader:t=>{this.removeListener("error",y);const n={ip:e.remoteAddress,family:e.remoteFamily,port:e.remotePort,header:t};if(!a.emit("connection",this,n))return Q.disconnect(d.BY_APPLICATION),void e.end();t.greeting&&this.emit("greeting",t.greeting)},onHandshakeComplete:e=>{++p>1&&this.emit("rekey"),this.emit("handshake",e)},debug:i,messageHandlers:{DEBUG:b,DISCONNECT:(t,n,r)=>{if(n!==d.BY_APPLICATION){r||void 0===(r=f[n])&&(r=`Unexpected disconnection reason: ${n}`);const e=new Error(r);e.code=n,this.emit("error",e)}e.end()},CHANNEL_OPEN:(e,t)=>{if("session"===t.type&&this.noMoreSessions||!this.authenticated){const e=o.ADMINISTRATIVELY_PROHIBITED;return Q.channelOpenFail(t.sender,e)}let n,r,a=-1,c=!1;const l=()=>{c||(c=!0,void 0===n&&(n=-1===a?o.RESOURCE_SHORTAGE:o.CONNECT_FAILED),-1!==a&&this._chanMgr.remove(a),Q.channelOpenFail(t.sender,n,""))},h=()=>(a=this._chanMgr.add(),-1===a&&(n=o.RESOURCE_SHORTAGE,i&&i("Automatic rejection of incoming channel open: no channels available")),-1!==a),u=t.data;switch(t.type){case"session":if(s(this,"session")&&h())return r=()=>{if(c)return;c=!0;const e=new H(this,t,a);return this._chanMgr.update(a,e),Q.channelOpenConfirm(t.sender,a,I,k),e},void this.emit("session",r,l);break;case"direct-tcpip":if(s(this,"tcpip")&&h())return r=()=>{if(c)return;c=!0;const e={type:void 0,incoming:{id:a,window:I,packetSize:k,state:"open"},outgoing:{id:t.sender,window:t.window,packetSize:t.packetSize,state:"open"}},n=new C(this,e,{server:!0});return this._chanMgr.update(a,n),Q.channelOpenConfirm(t.sender,a,I,k),n},void this.emit("tcpip",r,l,u);break;case"direct-streamlocal@openssh.com":if(s(this,"openssh.streamlocal")&&h())return r=()=>{if(c)return;c=!0;const e={type:void 0,incoming:{id:a,window:I,packetSize:k,state:"open"},outgoing:{id:t.sender,window:t.window,packetSize:t.packetSize,state:"open"}},n=new C(this,e,{server:!0});return this._chanMgr.update(a,n),Q.channelOpenConfirm(t.sender,a,I,k),n},void this.emit("openssh.streamlocal",r,l,u);break;default:n=o.UNKNOWN_CHANNEL_TYPE,i&&i(`Automatic rejection of unsupported incoming channel open type: ${t.type}`)}void 0===n&&(n=o.ADMINISTRATIVELY_PROHIBITED,i&&i(`Automatic rejection of unexpected incoming channel open for: ${t.type}`)),l()},CHANNEL_OPEN_CONFIRMATION:(e,t)=>{const n=this._chanMgr.get(t.recipient);if("function"!=typeof n)return;const r={type:n.type,incoming:{id:t.recipient,window:I,packetSize:k,state:"open"},outgoing:{id:t.sender,window:t.window,packetSize:t.packetSize,state:"open"}},i=new C(this,r,{server:!0});this._chanMgr.update(t.recipient,i),n(void 0,i)},CHANNEL_OPEN_FAILURE:(e,t,n,r)=>{const i=this._chanMgr.get(t);if("function"!=typeof i)return;B(this,t,{reason:n,description:r},i)},CHANNEL_DATA:(e,t,n)=>{let r=this._chanMgr.get(t);"object"==typeof r&&null!==r&&(r.constructor!==H||(r=r._channel,r))&&0!==r.incoming.window&&(r.incoming.window-=n.length,!1!==r.push(n)?r.incoming.window<=R&&T(r):r._waitChanDrain=!0)},CHANNEL_EXTENDED_DATA:(e,t,n,r)=>{},CHANNEL_WINDOW_ADJUST:(e,t,n)=>{let r=this._chanMgr.get(t);"object"==typeof r&&null!==r&&(r.constructor!==H||(r=r._channel,r))&&(r.outgoing.window+=n,r._waitWindow&&(r._waitWindow=!1,r._chunk?r._write(r._chunk,null,r._chunkcb):r._chunkcb?r._chunkcb():r._chunkErr?r.stderr._write(r._chunkErr,null,r._chunkcbErr):r._chunkcbErr&&r._chunkcbErr()))},CHANNEL_SUCCESS:(e,t)=>{let n=this._chanMgr.get(t);"object"==typeof n&&null!==n&&(n.constructor!==H||(n=n._channel,n))&&n._callbacks.length&&n._callbacks.shift()(!1)},CHANNEL_FAILURE:(e,t)=>{let n=this._chanMgr.get(t);"object"==typeof n&&null!==n&&(n.constructor!==H||(n=n._channel,n))&&n._callbacks.length&&n._callbacks.shift()(!0)},CHANNEL_REQUEST:(e,t,n,r,o)=>{const a=this._chanMgr.get(t);if("object"!=typeof a||null===a)return;let c,l,h=!1;if(a.constructor===H)if(r&&("shell"!==n&&"exec"!==n&&"subsystem"!==n&&(c=()=>{h||a._ending||a._channel||(h=!0,Q.channelSuccess(a._chanInfo.outgoing.id))}),l=()=>{h||a._ending||a._channel||(h=!0,Q.channelFailure(a._chanInfo.outgoing.id))}),a._ending)l&&l();else{switch(n){case"env":if(s(a,"env"))return void a.emit("env",c,l,{key:o.name,val:o.value});break;case"pty-req":if(s(a,"pty"))return void a.emit("pty",c,l,o);break;case"window-change":s(a,"window-change")?a.emit("window-change",c,l,o):l&&l();break;case"x11-req":if(s(a,"x11"))return void a.emit("x11",c,l,o);break;case"signal":if(s(a,"signal"))return void a.emit("signal",c,l,{name:o});break;case"auth-agent-req@openssh.com":if(s(a,"auth-agent"))return void a.emit("auth-agent",c,l);break;case"shell":if(s(a,"shell"))return c=()=>{if(h||a._ending||a._channel)return;h=!0,r&&Q.channelSuccess(a._chanInfo.outgoing.id);const e=new C(this,a._chanInfo,{server:!0});return e.subtype=a.subtype=n,a._channel=e,e},void a.emit("shell",c,l);break;case"exec":if(s(a,"exec"))return c=()=>{if(h||a._ending||a._channel)return;h=!0,r&&Q.channelSuccess(a._chanInfo.outgoing.id);const e=new C(this,a._chanInfo,{server:!0});return e.subtype=a.subtype=n,a._channel=e,e},void a.emit("exec",c,l,{command:o});break;case"subsystem":{let e="sftp"===o;if(c=()=>{if(h||a._ending||a._channel)return;let t;return h=!0,r&&Q.channelSuccess(a._chanInfo.outgoing.id),e?t=new S(this,a._chanInfo,{server:!0,debug:i}):(t=new C(this,a._chanInfo,{server:!0}),t.subtype=a.subtype=`${n}:${o}`),a._channel=t,t},"sftp"===o){if(s(a,"sftp"))return void a.emit("sftp",c,l);e=!1}if(s(a,"subsystem"))return void a.emit("subsystem",c,l,{name:o});break}}i&&i(`Automatic rejection of incoming channel request: ${n}`),l&&l()}else r&&Q.channelFailure(a.outgoing.id)},CHANNEL_EOF:(e,t)=>{let n=this._chanMgr.get(t);"object"==typeof n&&null!==n&&(n.constructor!==H||(n._ending||(n._ending=!0,n.emit("eof"),n.emit("end")),n=n._channel,n))&&"open"===n.incoming.state&&(n.incoming.state="eof",n.readable&&n.push(null))},CHANNEL_CLOSE:(e,t)=>{let n=this._chanMgr.get(t);"object"==typeof n&&null!==n&&(n.constructor!==H||(n._ending=!0,n.emit("close"),n=n._channel,n))&&L(this,t,n)},SERVICE_REQUEST:(t,n)=>{if(0===p||g||this.authenticated||"ssh-userauth"!==n)return Q.disconnect(d.SERVICE_NOT_AVAILABLE),void e.end();g=!0,Q.serviceAccept(n)},USERAUTH_REQUEST:(t,n,r,i,o)=>{if(0===p||this.authenticated||l&&(l.username!==n||l.service!==r)||"password"!==i&&"publickey"!==i&&"hostbased"!==i&&"keyboard-interactive"!==i&&"none"!==i||10===m.length)return Q.disconnect(d.PROTOCOL_ERROR),void e.end();if("ssh-connection"!==r)return Q.disconnect(d.SERVICE_NOT_AVAILABLE),void e.end();let a;switch(i){case"keyboard-interactive":a=new D(Q,n,r,i,o,q);break;case"publickey":a=new M(Q,n,r,i,o,q);break;case"hostbased":a=new U(Q,n,r,i,o,q);break;case"password":if(l&&l instanceof F&&l._changeCb){const e=l._changeCb;return l._changeCb=void 0,void e(o.newPassword)}a=new F(Q,n,r,i,o,q);break;case"none":a=new x(Q,n,r,i,q)}if(l){if(!l._initialResponse)return m.push(a);l._multistep&&!l._finalResponse&&(l._cleanup&&l._cleanup(),l.emit("abort"))}l=a,s(this,"authentication")?this.emit("authentication",l):l.reject()},USERAUTH_INFO_RESPONSE:(e,t)=>{l&&l instanceof D&&l._onInfoResponse(t)},GLOBAL_REQUEST:(e,t,n,r)=>{const i={type:null,buf:null};function o(e,t){i.type=e,i.buf=t,function(){for(;_.length>0&&_[0].type;){const e=_.shift();"SUCCESS"===e.type&&Q.requestSuccess(e.buf),"FAILURE"===e.type&&Q.requestFailure()}}()}if(n&&_.push(i),("tcpip-forward"===t||"cancel-tcpip-forward"===t||"no-more-sessions@openssh.com"===t||"streamlocal-forward@openssh.com"===t||"cancel-streamlocal-forward@openssh.com"===t)&&s(this,"request")&&this.authenticated){let e,i;if(n){let n=!1;e=e=>{if(n)return;let i;n=!0,"tcpip-forward"===t&&0===r.bindPort&&"number"==typeof e&&(i=Buffer.allocUnsafe(4),w(i,e,0)),o("SUCCESS",i)},i=()=>{n||(n=!0,o("FAILURE"))}}if("no-more-sessions@openssh.com"===t)return this.noMoreSessions=!0,void(e&&e());this.emit("request",e,i,t,r)}else n&&o("FAILURE")}}});e.pause(),v.then(()=>{Q.start(),e.on("data",t=>{try{Q.parse(t,0,t.length)}catch(t){this.emit("error",t);try{P(e)&&e.end()}catch{}}}),e.resume()}).catch(t=>{this.emit("error",t);try{P(e)&&e.end()}catch{}}),e.on("error",e=>{e.level="socket",this.emit("error",e)}).once("end",()=>{i&&i("Socket ended"),Q.cleanup(),this.emit("end")}).once("close",()=>{i&&i("Socket closed"),Q.cleanup(),this.emit("close");const e=new Error("No response from server");this._chanMgr.cleanup(e)});const q=(e,t,n,r)=>{l!==e||this.authenticated||(t?(l=void 0,this.authenticated=!0,Q.authSuccess(),m=[],this.emit("ready")):(Q.authFailure(n,r),m.length&&(l=m.pop(),s(this,"authentication")?this.emit("authentication",l):l.reject())))}}end(){return this._sock&&P(this._sock)&&(this._protocol.disconnect(d.BY_APPLICATION),this._sock.end()),this}x11(e,t,n){return Q(this,"x11",{originAddr:e,originPort:t},n),this}forwardOut(e,t,n,r,i){return Q(this,"forwarded-tcpip",{boundAddr:e,boundPort:t,remoteAddr:n,remotePort:r},i),this}openssh_forwardOutStreamLocal(e,t){return Q(this,"forwarded-streamlocal@openssh.com",{socketPath:e},t),this}rekey(e){let t;try{this._protocol.rekey()}catch(e){t=e}"function"==typeof e&&(t?process.nextTick(e,t):this.once("rekey",e))}setNoDelay(e){return this._sock&&"function"==typeof this._sock.setNoDelay&&this._sock.setNoDelay(e),this}}function Q(e,t,n,r){const i=I,s=k;"function"==typeof n&&(r=n,n={});const o=(e,t)=>{r(e,t)};o.type=t;const a=e._chanMgr.add(o);if(-1!==a)switch(t){case"forwarded-tcpip":e._protocol.forwardedTcpip(a,i,s,n);break;case"x11":e._protocol.x11(a,i,s,n);break;case"forwarded-streamlocal@openssh.com":e._protocol.openssh_forwardedStreamLocal(a,i,s,n);break;default:throw new Error(`Unsupported channel type: ${t}`)}else r(new Error("No free channels available"))}function q(e,t){return e-t}e.exports=j,e.exports.IncomingClient=W},4457(e,t,n){"use strict";const{SFTP:r}=n(7764),i=2**32-1;function s(e,t,n,r){if(e._chanMgr.remove(t),"function"!=typeof r)return;let i;n instanceof Error?i=n:"object"==typeof n&&null!==n?(i=new Error(`(SSH) Channel open failure: ${n.description}`),i.reason=n.reason):(i=new Error("(SSH) Channel open failure: server closed channel unexpectedly"),i.reason=""),r(i)}function o(e,t,n,i,o){if("function"==typeof n)return void s(e,t,i,n);if("object"!=typeof n||null===n)return;if(n.incoming&&"closed"===n.incoming.state)return;if(e._chanMgr.remove(t),n.server&&"Session"===n.constructor.name)return;n.incoming.state="closed",n.readable&&n.push(null),n.server?n.stderr.writable&&n.stderr.end():n.stderr.readable&&n.stderr.push(null),n.constructor===r||"open"!==n.outgoing.state&&"eof"!==n.outgoing.state||o||n.close(),"closing"===n.outgoing.state&&(n.outgoing.state="closed");const a=n._readableState,c=n._writableState;!c||c.ending||c.finished||o||n.end();const l=n._callbacks;n._callbacks=[];for(let e=0;e<l.length;++e)l[e](!0);if(n.server)!n.readable||n.destroyed||a&&a.endEmitted?n.emit("close"):n.once("end",()=>n.emit("close"));else{let e;switch(n.type){case"direct-streamlocal@openssh.com":case"direct-tcpip":e=()=>n.emit("close");break;default:{const t=n._exit;e=()=>{null===t.code?n.emit("close",t.code,t.signal,t.dump,t.desc):n.emit("close",t.code)}}}!n.readable||n.destroyed||a&&a.endEmitted?e():n.once("end",e);const t=n.stderr._readableState;!n.stderr.readable||n.stderr.destroyed||t&&t.endEmitted?n.stderr.emit("close"):n.stderr.once("end",()=>n.stderr.emit("close"))}}const a=(()=>{const e=Object.prototype.toString;return t=>"[object RegExp]"===e.call(t)})();e.exports={ChannelManager:class{constructor(e){this._client=e,this._channels={},this._cur=-1,this._count=0}add(e){let t;if(this._cur<i)t=++this._cur;else if(0===this._count)this._cur=0,t=0;else{const e=this._channels;for(let n=0;n<i;++n)if(void 0===e[n]){t=n;break}}return void 0===t?-1:(this._channels[t]=e||!0,++this._count,t)}update(e,t){if("number"!=typeof e||e<0||e>=i||!isFinite(e))throw new Error(`Invalid channel id: ${e}`);t&&this._channels[e]&&(this._channels[e]=t)}get(e){if("number"!=typeof e||e<0||e>=i||!isFinite(e))throw new Error(`Invalid channel id: ${e}`);return this._channels[e]}remove(e){if("number"!=typeof e||e<0||e>=i||!isFinite(e))throw new Error(`Invalid channel id: ${e}`);this._channels[e]&&(delete this._channels[e],this._count&&--this._count)}cleanup(e){const t=this._channels;this._channels={},this._cur=-1,this._count=0;const n=Object.keys(t),r=this._client;for(let i=0;i<n.length;++i){const s=+n[i],a=t[s];o(r,s,a._channel||a,e,!0)}}},generateAlgorithmList:function(e,t,n){if(Array.isArray(e)&&e.length>0){for(let t=0;t<e.length;++t)if(-1===n.indexOf(e[t]))throw new Error(`Unsupported algorithm: ${e[t]}`);return e}if("object"==typeof e&&null!==e){const r=Object.keys(e);let i=t;for(let s=0;s<r.length;++s){const o=r[s];let c=e[o];switch(o){case"append":if(Array.isArray(c)||(c=[c]),Array.isArray(c))for(let e=0;e<c.length;++e){const r=c[e];if("string"==typeof r){if(!r||-1!==i.indexOf(r))continue;if(-1===n.indexOf(r))throw new Error(`Unsupported algorithm: ${r}`);i===t&&(i=i.slice()),i.push(r)}else if(a(r))for(let e=0;e<n.length;++e){const s=n[e];if(r.test(s)){if(-1!==i.indexOf(s))continue;i===t&&(i=i.slice()),i.push(s)}}}break;case"prepend":if(Array.isArray(c)||(c=[c]),Array.isArray(c))for(let e=c.length;e>=0;--e){const r=c[e];if("string"==typeof r){if(!r||-1!==i.indexOf(r))continue;if(-1===n.indexOf(r))throw new Error(`Unsupported algorithm: ${r}`);i===t&&(i=i.slice()),i.unshift(r)}else if(a(r))for(let e=n.length;e>=0;--e){const s=n[e];if(r.test(s)){if(-1!==i.indexOf(s))continue;i===t&&(i=i.slice()),i.unshift(s)}}}break;case"remove":if(Array.isArray(c)||(c=[c]),Array.isArray(c))for(let e=0;e<c.length;++e){const n=c[e];if("string"==typeof n){if(!n)continue;const e=i.indexOf(n);if(-1===e)continue;i===t&&(i=i.slice()),i.splice(e,1)}else if(a(n))for(let e=0;e<i.length;++e)n.test(i[e])&&(i===t&&(i=i.slice()),i.splice(e,1),--e)}}}return i}return t},onChannelOpenFailure:s,onCHANNEL_CLOSE:o,isWritable:e=>e&&e.writable&&e._readableState&&!1===e._readableState.ended}},6395(e){e.exports={newInvalidAsn1Error:function(e){var t=new Error;return t.name="InvalidAsn1Error",t.message=e||"",t}}},5670(e,t,n){var r=n(6395),i=n(6299),s=n(3319),o=n(1431);for(var a in e.exports={Reader:s,Writer:o},i)i.hasOwnProperty(a)&&(e.exports[a]=i[a]);for(var c in r)r.hasOwnProperty(c)&&(e.exports[c]=r[c])},3319(e,t,n){var r=n(2613),i=n(4774).Buffer,s=n(6299),o=n(6395).newInvalidAsn1Error;function a(e){if(!e||!i.isBuffer(e))throw new TypeError("data must be a node Buffer");this._buf=e,this._size=e.length,this._len=0,this._offset=0}Object.defineProperty(a.prototype,"length",{enumerable:!0,get:function(){return this._len}}),Object.defineProperty(a.prototype,"offset",{enumerable:!0,get:function(){return this._offset}}),Object.defineProperty(a.prototype,"remain",{get:function(){return this._size-this._offset}}),Object.defineProperty(a.prototype,"buffer",{get:function(){return this._buf.slice(this._offset)}}),a.prototype.readByte=function(e){if(this._size-this._offset<1)return null;var t=255&this._buf[this._offset];return e||(this._offset+=1),t},a.prototype.peek=function(){return this.readByte(!0)},a.prototype.readLength=function(e){if(void 0===e&&(e=this._offset),e>=this._size)return null;var t=255&this._buf[e++];if(null===t)return null;if(128&~t)this._len=t;else{if(0===(t&=127))throw o("Indefinite length not supported");if(t>4)throw o("encoding too long");if(this._size-e<t)return null;this._len=0;for(var n=0;n<t;n++)this._len=(this._len<<8)+(255&this._buf[e++])}return e},a.prototype.readSequence=function(e){var t=this.peek();if(null===t)return null;if(void 0!==e&&e!==t)throw o("Expected 0x"+e.toString(16)+": got 0x"+t.toString(16));var n=this.readLength(this._offset+1);return null===n?null:(this._offset=n,t)},a.prototype.readInt=function(){return this._readTag(s.Integer)},a.prototype.readBoolean=function(){return 0!==this._readTag(s.Boolean)},a.prototype.readEnumeration=function(){return this._readTag(s.Enumeration)},a.prototype.readString=function(e,t){e||(e=s.OctetString);var n=this.peek();if(null===n)return null;if(n!==e)throw o("Expected 0x"+e.toString(16)+": got 0x"+n.toString(16));var r=this.readLength(this._offset+1);if(null===r)return null;if(this.length>this._size-r)return null;if(this._offset=r,0===this.length)return t?i.alloc(0):"";var a=this._buf.slice(this._offset,this._offset+this.length);return this._offset+=this.length,t?a:a.toString("utf8")},a.prototype.readOID=function(e){e||(e=s.OID);var t=this.readString(e,!0);if(null===t)return null;for(var n=[],r=0,i=0;i<t.length;i++){var o=255&t[i];r<<=7,r+=127&o,128&o||(n.push(r),r=0)}return r=n.shift(),n.unshift(r%40),n.unshift(r/40|0),n.join(".")},a.prototype._readTag=function(e){r.ok(void 0!==e);var t=this.peek();if(null===t)return null;if(t!==e)throw o("Expected 0x"+e.toString(16)+": got 0x"+t.toString(16));var n=this.readLength(this._offset+1);if(null===n)return null;if(this.length>4)throw o("Integer too long: "+this.length);if(this.length>this._size-n)return null;this._offset=n;for(var i=this._buf[this._offset],s=0,a=0;a<this.length;a++)s<<=8,s|=255&this._buf[this._offset++];return 128&~i||4===a||(s-=1<<8*a),s|0},e.exports=a},6299(e){e.exports={EOC:0,Boolean:1,Integer:2,BitString:3,OctetString:4,Null:5,OID:6,ObjectDescriptor:7,External:8,Real:9,Enumeration:10,PDV:11,Utf8String:12,RelativeOID:13,Sequence:16,Set:17,NumericString:18,PrintableString:19,T61String:20,VideotexString:21,IA5String:22,UTCTime:23,GeneralizedTime:24,GraphicString:25,VisibleString:26,GeneralString:28,UniversalString:29,CharacterString:30,BMPString:31,Constructor:32,Context:128}},1431(e,t,n){var r=n(2613),i=n(4774).Buffer,s=n(6299),o=n(6395).newInvalidAsn1Error,a={size:1024,growthFactor:8};function c(e){var t,n;t=a,n=e||{},r.ok(t),r.equal(typeof t,"object"),r.ok(n),r.equal(typeof n,"object"),Object.getOwnPropertyNames(t).forEach(function(e){if(!n[e]){var r=Object.getOwnPropertyDescriptor(t,e);Object.defineProperty(n,e,r)}}),e=n,this._buf=i.alloc(e.size||1024),this._size=this._buf.length,this._offset=0,this._options=e,this._seq=[]}Object.defineProperty(c.prototype,"buffer",{get:function(){if(this._seq.length)throw o(this._seq.length+" unended sequence(s)");return this._buf.slice(0,this._offset)}}),c.prototype.writeByte=function(e){if("number"!=typeof e)throw new TypeError("argument must be a Number");this._ensure(1),this._buf[this._offset++]=e},c.prototype.writeInt=function(e,t){if("number"!=typeof e)throw new TypeError("argument must be a Number");"number"!=typeof t&&(t=s.Integer);for(var n=4;(!(4286578688&e)||-8388608==(4286578688&e))&&n>1;)n--,e<<=8;if(n>4)throw o("BER ints cannot be > 0xffffffff");for(this._ensure(2+n),this._buf[this._offset++]=t,this._buf[this._offset++]=n;n-- >0;)this._buf[this._offset++]=(4278190080&e)>>>24,e<<=8},c.prototype.writeNull=function(){this.writeByte(s.Null),this.writeByte(0)},c.prototype.writeEnumeration=function(e,t){if("number"!=typeof e)throw new TypeError("argument must be a Number");return"number"!=typeof t&&(t=s.Enumeration),this.writeInt(e,t)},c.prototype.writeBoolean=function(e,t){if("boolean"!=typeof e)throw new TypeError("argument must be a Boolean");"number"!=typeof t&&(t=s.Boolean),this._ensure(3),this._buf[this._offset++]=t,this._buf[this._offset++]=1,this._buf[this._offset++]=e?255:0},c.prototype.writeString=function(e,t){if("string"!=typeof e)throw new TypeError("argument must be a string (was: "+typeof e+")");"number"!=typeof t&&(t=s.OctetString);var n=i.byteLength(e);this.writeByte(t),this.writeLength(n),n&&(this._ensure(n),this._buf.write(e,this._offset),this._offset+=n)},c.prototype.writeBuffer=function(e,t){if("number"!=typeof t)throw new TypeError("tag must be a number");if(!i.isBuffer(e))throw new TypeError("argument must be a buffer");this.writeByte(t),this.writeLength(e.length),this._ensure(e.length),e.copy(this._buf,this._offset,0,e.length),this._offset+=e.length},c.prototype.writeStringArray=function(e){if(!e instanceof Array)throw new TypeError("argument must be an Array[String]");var t=this;e.forEach(function(e){t.writeString(e)})},c.prototype.writeOID=function(e,t){if("string"!=typeof e)throw new TypeError("argument must be a string");if("number"!=typeof t&&(t=s.OID),!/^([0-9]+\.){3,}[0-9]+$/.test(e))throw new Error("argument is not a valid OID string");var n=e.split("."),r=[];r.push(40*parseInt(n[0],10)+parseInt(n[1],10)),n.slice(2).forEach(function(e){!function(e,t){t<128?e.push(t):t<16384?(e.push(t>>>7|128),e.push(127&t)):t<2097152?(e.push(t>>>14|128),e.push(t>>>7&255|128),e.push(127&t)):t<268435456?(e.push(t>>>21|128),e.push(t>>>14&255|128),e.push(t>>>7&255|128),e.push(127&t)):(e.push(t>>>28&255|128),e.push(t>>>21&255|128),e.push(t>>>14&255|128),e.push(t>>>7&255|128),e.push(127&t))}(r,parseInt(e,10))});var i=this;this._ensure(2+r.length),this.writeByte(t),this.writeLength(r.length),r.forEach(function(e){i.writeByte(e)})},c.prototype.writeLength=function(e){if("number"!=typeof e)throw new TypeError("argument must be a Number");if(this._ensure(4),e<=127)this._buf[this._offset++]=e;else if(e<=255)this._buf[this._offset++]=129,this._buf[this._offset++]=e;else if(e<=65535)this._buf[this._offset++]=130,this._buf[this._offset++]=e>>8,this._buf[this._offset++]=e;else{if(!(e<=16777215))throw o("Length too long (> 4 bytes)");this._buf[this._offset++]=131,this._buf[this._offset++]=e>>16,this._buf[this._offset++]=e>>8,this._buf[this._offset++]=e}},c.prototype.startSequence=function(e){"number"!=typeof e&&(e=s.Sequence|s.Constructor),this.writeByte(e),this._seq.push(this._offset),this._ensure(3),this._offset+=3},c.prototype.endSequence=function(){var e=this._seq.pop(),t=e+3,n=this._offset-t;if(n<=127)this._shift(t,n,-2),this._buf[e]=n;else if(n<=255)this._shift(t,n,-1),this._buf[e]=129,this._buf[e+1]=n;else if(n<=65535)this._buf[e]=130,this._buf[e+1]=n>>8,this._buf[e+2]=n;else{if(!(n<=16777215))throw o("Sequence too long");this._shift(t,n,1),this._buf[e]=131,this._buf[e+1]=n>>16,this._buf[e+2]=n>>8,this._buf[e+3]=n}},c.prototype._shift=function(e,t,n){r.ok(void 0!==e),r.ok(void 0!==t),r.ok(n),this._buf.copy(this._buf,e+n,e,e+t),this._offset+=n},c.prototype._ensure=function(e){if(r.ok(e),this._size-this._offset<e){var t=this._size*this._options.growthFactor;t-this._offset<e&&(t+=e);var n=i.alloc(t);this._buf.copy(n,0,0,this._offset),this._buf=n,this._size=t}},e.exports=c},3100(e,t,n){var r=n(5670);e.exports={Ber:r,BerReader:r.Reader,BerWriter:r.Writer}},4015(e,t,n){"use strict";var r=n(8947).lowlevel.crypto_hash,i=0,s=function(){this.S=[new Uint32Array([3509652390,2564797868,805139163,3491422135,3101798381,1780907670,3128725573,4046225305,614570311,3012652279,134345442,2240740374,1667834072,1901547113,2757295779,4103290238,227898511,1921955416,1904987480,2182433518,2069144605,3260701109,2620446009,720527379,3318853667,677414384,3393288472,3101374703,2390351024,1614419982,1822297739,2954791486,3608508353,3174124327,2024746970,1432378464,3864339955,2857741204,1464375394,1676153920,1439316330,715854006,3033291828,289532110,2706671279,2087905683,3018724369,1668267050,732546397,1947742710,3462151702,2609353502,2950085171,1814351708,2050118529,680887927,999245976,1800124847,3300911131,1713906067,1641548236,4213287313,1216130144,1575780402,4018429277,3917837745,3693486850,3949271944,596196993,3549867205,258830323,2213823033,772490370,2760122372,1774776394,2652871518,566650946,4142492826,1728879713,2882767088,1783734482,3629395816,2517608232,2874225571,1861159788,326777828,3124490320,2130389656,2716951837,967770486,1724537150,2185432712,2364442137,1164943284,2105845187,998989502,3765401048,2244026483,1075463327,1455516326,1322494562,910128902,469688178,1117454909,936433444,3490320968,3675253459,1240580251,122909385,2157517691,634681816,4142456567,3825094682,3061402683,2540495037,79693498,3249098678,1084186820,1583128258,426386531,1761308591,1047286709,322548459,995290223,1845252383,2603652396,3431023940,2942221577,3202600964,3727903485,1712269319,422464435,3234572375,1170764815,3523960633,3117677531,1434042557,442511882,3600875718,1076654713,1738483198,4213154764,2393238008,3677496056,1014306527,4251020053,793779912,2902807211,842905082,4246964064,1395751752,1040244610,2656851899,3396308128,445077038,3742853595,3577915638,679411651,2892444358,2354009459,1767581616,3150600392,3791627101,3102740896,284835224,4246832056,1258075500,768725851,2589189241,3069724005,3532540348,1274779536,3789419226,2764799539,1660621633,3471099624,4011903706,913787905,3497959166,737222580,2514213453,2928710040,3937242737,1804850592,3499020752,2949064160,2386320175,2390070455,2415321851,4061277028,2290661394,2416832540,1336762016,1754252060,3520065937,3014181293,791618072,3188594551,3933548030,2332172193,3852520463,3043980520,413987798,3465142937,3030929376,4245938359,2093235073,3534596313,375366246,2157278981,2479649556,555357303,3870105701,2008414854,3344188149,4221384143,3956125452,2067696032,3594591187,2921233993,2428461,544322398,577241275,1471733935,610547355,4027169054,1432588573,1507829418,2025931657,3646575487,545086370,48609733,2200306550,1653985193,298326376,1316178497,3007786442,2064951626,458293330,2589141269,3591329599,3164325604,727753846,2179363840,146436021,1461446943,4069977195,705550613,3059967265,3887724982,4281599278,3313849956,1404054877,2845806497,146425753,1854211946]),new Uint32Array([1266315497,3048417604,3681880366,3289982499,290971e4,1235738493,2632868024,2414719590,3970600049,1771706367,1449415276,3266420449,422970021,1963543593,2690192192,3826793022,1062508698,1531092325,1804592342,2583117782,2714934279,4024971509,1294809318,4028980673,1289560198,2221992742,1669523910,35572830,157838143,1052438473,1016535060,1802137761,1753167236,1386275462,3080475397,2857371447,1040679964,2145300060,2390574316,1461121720,2956646967,4031777805,4028374788,33600511,2920084762,1018524850,629373528,3691585981,3515945977,2091462646,2486323059,586499841,988145025,935516892,3367335476,2599673255,2839830854,265290510,3972581182,2759138881,3795373465,1005194799,847297441,406762289,1314163512,1332590856,1866599683,4127851711,750260880,613907577,1450815602,3165620655,3734664991,3650291728,3012275730,3704569646,1427272223,778793252,1343938022,2676280711,2052605720,1946737175,3164576444,3914038668,3967478842,3682934266,1661551462,3294938066,4011595847,840292616,3712170807,616741398,312560963,711312465,1351876610,322626781,1910503582,271666773,2175563734,1594956187,70604529,3617834859,1007753275,1495573769,4069517037,2549218298,2663038764,504708206,2263041392,3941167025,2249088522,1514023603,1998579484,1312622330,694541497,2582060303,2151582166,1382467621,776784248,2618340202,3323268794,2497899128,2784771155,503983604,4076293799,907881277,423175695,432175456,1378068232,4145222326,3954048622,3938656102,3820766613,2793130115,2977904593,26017576,3274890735,3194772133,1700274565,1756076034,4006520079,3677328699,720338349,1533947780,354530856,688349552,3973924725,1637815568,332179504,3949051286,53804574,2852348879,3044236432,1282449977,3583942155,3416972820,4006381244,1617046695,2628476075,3002303598,1686838959,431878346,2686675385,1700445008,1080580658,1009431731,832498133,3223435511,2605976345,2271191193,2516031870,1648197032,4164389018,2548247927,300782431,375919233,238389289,3353747414,2531188641,2019080857,1475708069,455242339,2609103871,448939670,3451063019,1395535956,2413381860,1841049896,1491858159,885456874,4264095073,4001119347,1565136089,3898914787,1108368660,540939232,1173283510,2745871338,3681308437,4207628240,3343053890,4016749493,1699691293,1103962373,3625875870,2256883143,3830138730,1031889488,3479347698,1535977030,4236805024,3251091107,2132092099,1774941330,1199868427,1452454533,157007616,2904115357,342012276,595725824,1480756522,206960106,497939518,591360097,863170706,2375253569,3596610801,1814182875,2094937945,3421402208,1082520231,3463918190,2785509508,435703966,3908032597,1641649973,2842273706,3305899714,1510255612,2148256476,2655287854,3276092548,4258621189,236887753,3681803219,274041037,1734335097,3815195456,3317970021,1899903192,1026095262,4050517792,356393447,2410691914,3873677099,3682840055]),new Uint32Array([3913112168,2491498743,4132185628,2489919796,1091903735,1979897079,3170134830,3567386728,3557303409,857797738,1136121015,1342202287,507115054,2535736646,337727348,3213592640,1301675037,2528481711,1895095763,1721773893,3216771564,62756741,2142006736,835421444,2531993523,1442658625,3659876326,2882144922,676362277,1392781812,170690266,3921047035,1759253602,3611846912,1745797284,664899054,1329594018,3901205900,3045908486,2062866102,2865634940,3543621612,3464012697,1080764994,553557557,3656615353,3996768171,991055499,499776247,1265440854,648242737,3940784050,980351604,3713745714,1749149687,3396870395,4211799374,3640570775,1161844396,3125318951,1431517754,545492359,4268468663,3499529547,1437099964,2702547544,3433638243,2581715763,2787789398,1060185593,1593081372,2418618748,4260947970,69676912,2159744348,86519011,2512459080,3838209314,1220612927,3339683548,133810670,1090789135,1078426020,1569222167,845107691,3583754449,4072456591,1091646820,628848692,1613405280,3757631651,526609435,236106946,48312990,2942717905,3402727701,1797494240,859738849,992217954,4005476642,2243076622,3870952857,3732016268,765654824,3490871365,2511836413,1685915746,3888969200,1414112111,2273134842,3281911079,4080962846,172450625,2569994100,980381355,4109958455,2819808352,2716589560,2568741196,3681446669,3329971472,1835478071,660984891,3704678404,4045999559,3422617507,3040415634,1762651403,1719377915,3470491036,2693910283,3642056355,3138596744,1364962596,2073328063,1983633131,926494387,3423689081,2150032023,4096667949,1749200295,3328846651,309677260,2016342300,1779581495,3079819751,111262694,1274766160,443224088,298511866,1025883608,3806446537,1145181785,168956806,3641502830,3584813610,1689216846,3666258015,3200248200,1692713982,2646376535,4042768518,1618508792,1610833997,3523052358,4130873264,2001055236,3610705100,2202168115,4028541809,2961195399,1006657119,2006996926,3186142756,1430667929,3210227297,1314452623,4074634658,4101304120,2273951170,1399257539,3367210612,3027628629,1190975929,2062231137,2333990788,2221543033,2438960610,1181637006,548689776,2362791313,3372408396,3104550113,3145860560,296247880,1970579870,3078560182,3769228297,1714227617,3291629107,3898220290,166772364,1251581989,493813264,448347421,195405023,2709975567,677966185,3703036547,1463355134,2715995803,1338867538,1343315457,2802222074,2684532164,233230375,2599980071,2000651841,3277868038,1638401717,4028070440,3237316320,6314154,819756386,300326615,590932579,1405279636,3267499572,3150704214,2428286686,3959192993,3461946742,1862657033,1266418056,963775037,2089974820,2263052895,1917689273,448879540,3550394620,3981727096,150775221,3627908307,1303187396,508620638,2975983352,2726630617,1817252668,1876281319,1457606340,908771278,3720792119,3617206836,2455994898,1729034894,1080033504]),new Uint32Array([976866871,3556439503,2881648439,1522871579,1555064734,1336096578,3548522304,2579274686,3574697629,3205460757,3593280638,3338716283,3079412587,564236357,2993598910,1781952180,1464380207,3163844217,3332601554,1699332808,1393555694,1183702653,3581086237,1288719814,691649499,2847557200,2895455976,3193889540,2717570544,1781354906,1676643554,2592534050,3230253752,1126444790,2770207658,2633158820,2210423226,2615765581,2414155088,3127139286,673620729,2805611233,1269405062,4015350505,3341807571,4149409754,1057255273,2012875353,2162469141,2276492801,2601117357,993977747,3918593370,2654263191,753973209,36408145,2530585658,25011837,3520020182,2088578344,530523599,2918365339,1524020338,1518925132,3760827505,3759777254,1202760957,3985898139,3906192525,674977740,4174734889,2031300136,2019492241,3983892565,4153806404,3822280332,352677332,2297720250,60907813,90501309,3286998549,1016092578,2535922412,2839152426,457141659,509813237,4120667899,652014361,1966332200,2975202805,55981186,2327461051,676427537,3255491064,2882294119,3433927263,1307055953,942726286,933058658,2468411793,3933900994,4215176142,1361170020,2001714738,2830558078,3274259782,1222529897,1679025792,2729314320,3714953764,1770335741,151462246,3013232138,1682292957,1483529935,471910574,1539241949,458788160,3436315007,1807016891,3718408830,978976581,1043663428,3165965781,1927990952,4200891579,2372276910,3208408903,3533431907,1412390302,2931980059,4132332400,1947078029,3881505623,4168226417,2941484381,1077988104,1320477388,886195818,18198404,3786409e3,2509781533,112762804,3463356488,1866414978,891333506,18488651,661792760,1628790961,3885187036,3141171499,876946877,2693282273,1372485963,791857591,2686433993,3759982718,3167212022,3472953795,2716379847,445679433,3561995674,3504004811,3574258232,54117162,3331405415,2381918588,3769707343,4154350007,1140177722,4074052095,668550556,3214352940,367459370,261225585,2610173221,4209349473,3468074219,3265815641,314222801,3066103646,3808782860,282218597,3406013506,3773591054,379116347,1285071038,846784868,2669647154,3771962079,3550491691,2305946142,453669953,1268987020,3317592352,3279303384,3744833421,2610507566,3859509063,266596637,3847019092,517658769,3462560207,3443424879,370717030,4247526661,2224018117,4143653529,4112773975,2788324899,2477274417,1456262402,2901442914,1517677493,1846949527,2295493580,3734397586,2176403920,1280348187,1908823572,3871786941,846861322,1172426758,3287448474,3383383037,1655181056,3139813346,901632758,1897031941,2986607138,3066810236,3447102507,1393639104,373351379,950779232,625454576,3124240540,4148612726,2007998917,544563296,2244738638,2330496472,2058025392,1291430526,424198748,50039436,29584100,3605783033,2429876329,2791104160,1057563949,3255363231,3075367218,3463963227,1469046755,985887462])],this.P=new Uint32Array([608135816,2242054355,320440878,57701188,2752067618,698298832,137296536,3964562569,1160258022,953160567,3193202383,887688300,3232508343,3380367581,1065670069,3041331479,2450970073,2306472731])};function o(e,t,n){return(e[0][t[n+3]]+e[1][t[n+2]]^e[2][t[n+1]])+e[3][t[n]]}function a(e,t){var n,r=0;for(n=0;n<4;n++,i++)i>=t&&(i=0),r=r<<8|e[i];return r}s.prototype.encipher=function(e,t){void 0===t&&(t=new Uint8Array(e.buffer),0!==e.byteOffset&&(t=t.subarray(e.byteOffset))),e[0]^=this.P[0];for(var n=1;n<16;n+=2)e[1]^=o(this.S,t,0)^this.P[n],e[0]^=o(this.S,t,4)^this.P[n+1];var r=e[0];e[0]=e[1]^this.P[17],e[1]=r},s.prototype.decipher=function(e){var t=new Uint8Array(e.buffer);0!==e.byteOffset&&(t=t.subarray(e.byteOffset)),e[0]^=this.P[17];for(var n=16;n>0;n-=2)e[1]^=o(this.S,t,0)^this.P[n],e[0]^=o(this.S,t,4)^this.P[n-1];var r=e[0];e[0]=e[1]^this.P[0],e[1]=r},s.prototype.expand0state=function(e,t){var n,r,s=new Uint32Array(2),o=new Uint8Array(s.buffer);for(n=0,i=0;n<18;n++)this.P[n]^=a(e,t);for(i=0,n=0;n<18;n+=2)this.encipher(s,o),this.P[n]=s[0],this.P[n+1]=s[1];for(n=0;n<4;n++)for(r=0;r<256;r+=2)this.encipher(s,o),this.S[n][r]=s[0],this.S[n][r+1]=s[1]},s.prototype.expandstate=function(e,t,n,r){var s,o,c=new Uint32Array(2);for(s=0,i=0;s<18;s++)this.P[s]^=a(n,r);for(s=0,i=0;s<18;s+=2)c[0]^=a(e,t),c[1]^=a(e,t),this.encipher(c),this.P[s]=c[0],this.P[s+1]=c[1];for(s=0;s<4;s++)for(o=0;o<256;o+=2)c[0]^=a(e,t),c[1]^=a(e,t),this.encipher(c),this.S[s][o]=c[0],this.S[s][o+1]=c[1];i=0},s.prototype.enc=function(e,t){for(var n=0;n<t;n++)this.encipher(e.subarray(2*n))},s.prototype.dec=function(e,t){for(var n=0;n<t;n++)this.decipher(e.subarray(2*n))};function c(e,t,n){var r,i=new s,o=new Uint32Array(8),c=new Uint8Array([79,120,121,99,104,114,111,109,97,116,105,99,66,108,111,119,102,105,115,104,83,119,97,116,68,121,110,97,109,105,116,101]);for(i.expandstate(t,64,e,64),r=0;r<64;r++)i.expand0state(t,64),i.expand0state(e,64);for(r=0;r<8;r++)o[r]=a(c,c.byteLength);for(r=0;r<64;r++)i.enc(o,o.byteLength/8);for(r=0;r<8;r++)n[4*r+3]=o[r]>>>24,n[4*r+2]=o[r]>>>16,n[4*r+1]=o[r]>>>8,n[4*r+0]=o[r]}e.exports={BLOCKS:8,HASHSIZE:32,hash:c,pbkdf:function(e,t,n,i,s,o,a){var l,h,u,d,f,p,g=new Uint8Array(64),m=new Uint8Array(64),_=new Uint8Array(32),y=new Uint8Array(32),v=new Uint8Array(i+4),b=o;if(a<1)return-1;if(0===t||0===i||0===o||o>_.byteLength*_.byteLength||i>1<<20)return-1;for(d=Math.floor((o+_.byteLength-1)/_.byteLength),u=Math.floor((o+d-1)/d),l=0;l<i;l++)v[l]=n[l];for(r(g,e,t),p=1;o>0;p++){for(v[i+0]=p>>>24,v[i+1]=p>>>16,v[i+2]=p>>>8,v[i+3]=p,r(m,v,i+4),c(g,m,y),l=_.byteLength;l--;)_[l]=y[l];for(l=1;l<a;l++)for(r(m,y,y.byteLength),c(g,m,y),h=0;h<_.byteLength;h++)_[h]^=y[h];for(u=Math.min(u,o),l=0;l<u&&!((f=l*d+(p-1))>=b);l++)s[f]=_[l];o-=l}return 0}}},6295(e,t,n){"use strict";const r=n(3962);e.exports=r.getCPUInfo},6611(e,t,n){var r=n(3519),i=function(){},s=global.Bare?queueMicrotask:process.nextTick.bind(process),o=function(e,t,n){if("function"==typeof t)return o(e,null,t);t||(t={}),n=r(n||i);var a=e._writableState,c=e._readableState,l=t.readable||!1!==t.readable&&e.readable,h=t.writable||!1!==t.writable&&e.writable,u=!1,d=function(){e.writable||f()},f=function(){h=!1,l||n.call(e)},p=function(){l=!1,h||n.call(e)},g=function(t){n.call(e,t?new Error("exited with error code: "+t):null)},m=function(t){n.call(e,t)},_=function(){s(y)},y=function(){if(!u)return(!l||c&&c.ended&&!c.destroyed)&&(!h||a&&a.ended&&!a.destroyed)?void 0:n.call(e,new Error("premature close"))},v=function(){e.req.on("finish",f)};return!function(e){return e.setHeader&&"function"==typeof e.abort}(e)?h&&!a&&(e.on("end",d),e.on("close",d)):(e.on("complete",f),e.on("abort",_),e.req?v():e.on("request",v)),function(e){return e.stdio&&Array.isArray(e.stdio)&&3===e.stdio.length}(e)&&e.on("exit",g),e.on("end",p),e.on("finish",f),!1!==t.error&&e.on("error",m),e.on("close",_),function(){u=!0,e.removeListener("complete",f),e.removeListener("abort",_),e.removeListener("request",v),e.req&&e.req.removeListener("finish",f),e.removeListener("end",d),e.removeListener("close",d),e.removeListener("finish",f),e.removeListener("exit",g),e.removeListener("end",p),e.removeListener("error",m),e.removeListener("close",_)}};e.exports=o},5474(e,t,n){e=n.nmd(e),function t(r){"use strict";var i;function s(e,t,n){const r=typeof n,i=typeof e;if("undefined"!==r){if("undefined"!==i){if(n){if("function"===i&&r===i)return function(t){return e(n(t))};if((t=e.constructor)===n.constructor){if(t===Array)return n.concat(e);if(t===Map){var s=new Map(n);for(var o of e)s.set(o[0],o[1]);return s}if(t===Set){for(s of(o=new Set(n),e.values()))o.add(s);return o}}}return e}return n}return"undefined"===i?t:e}function o(e,t){return void 0===e?t:e}function a(){return Object.create(null)}function c(e){return"string"==typeof e}function l(e){return"object"==typeof e}function h(e,t){if(c(t))e=e[t];else for(let n=0;e&&n<t.length;n++)e=e[t[n]];return e}(r=e)._factory=t;const u=/[^\p{L}\p{N}]+/u,d=/(\d{3})/g,f=/(\D)(\d{3})/g,p=/(\d{3})(\D)/g,g=/[\u0300-\u036f]/g;function m(e={}){if(!this||this.constructor!==m)return new m(...arguments);if(arguments.length)for(e=0;e<arguments.length;e++)this.assign(arguments[e]);else this.assign(e)}function _(e){e.F=null,e.B.clear(),e.D.clear()}function y(e,t,n){n||(t||"object"!=typeof e?"object"==typeof t&&(n=t,t=0):n=e),n&&(e=n.query||e,t=n.limit||t);let r=""+(t||0);n&&(r+=(n.offset||0)+!!n.context+!!n.suggest+(!1!==n.resolve)+(n.resolution||this.resolution)+(n.boost||0)),e=(""+e).toLowerCase(),this.cache||(this.cache=new v);let i=this.cache.get(e+r);if(!i){const s=n&&n.cache;s&&(n.cache=!1),i=this.search(e,t,n),s&&(n.cache=s),this.cache.set(e+r,i)}return i}function v(e){this.limit=e&&!0!==e?e:1e3,this.cache=new Map,this.h=""}(i=m.prototype).assign=function(e){this.normalize=s(e.normalize,!0,this.normalize);let t,n=e.include,r=n||e.exclude||e.split;if(r||""===r){if("object"==typeof r&&r.constructor!==RegExp){let e="";t=!n,n||(e+="\\p{Z}"),r.letter&&(e+="\\p{L}"),r.number&&(e+="\\p{N}",t=!!n),r.symbol&&(e+="\\p{S}"),r.punctuation&&(e+="\\p{P}"),r.control&&(e+="\\p{C}"),(r=r.char)&&(e+="object"==typeof r?r.join(""):r);try{this.split=new RegExp("["+(n?"^":"")+e+"]+","u")}catch(e){this.split=/\s+/}}else this.split=r,t=!1===r||"a1a".split(r).length<2;this.numeric=s(e.numeric,t)}else{try{this.split=s(this.split,u)}catch(e){this.split=/\s+/}this.numeric=s(e.numeric,s(this.numeric,!0))}if(this.prepare=s(e.prepare,null,this.prepare),this.finalize=s(e.finalize,null,this.finalize),r=e.filter,this.filter="function"==typeof r?r:s(r&&new Set(r),null,this.filter),this.dedupe=s(e.dedupe,!0,this.dedupe),this.matcher=s((r=e.matcher)&&new Map(r),null,this.matcher),this.mapper=s((r=e.mapper)&&new Map(r),null,this.mapper),this.stemmer=s((r=e.stemmer)&&new Map(r),null,this.stemmer),this.replacer=s(e.replacer,null,this.replacer),this.minlength=s(e.minlength,1,this.minlength),this.maxlength=s(e.maxlength,1024,this.maxlength),this.rtl=s(e.rtl,!1,this.rtl),(this.cache=r=s(e.cache,!0,this.cache))&&(this.F=null,this.L="number"==typeof r?r:2e5,this.B=new Map,this.D=new Map,this.I=this.H=128),this.h="",this.J=null,this.A="",this.K=null,this.matcher)for(const e of this.matcher.keys())this.h+=(this.h?"|":"")+e;if(this.stemmer)for(const e of this.stemmer.keys())this.A+=(this.A?"|":"")+e;return this},i.addStemmer=function(e,t){return this.stemmer||(this.stemmer=new Map),this.stemmer.set(e,t),this.A+=(this.A?"|":"")+e,this.K=null,this.cache&&_(this),this},i.addFilter=function(e){return"function"==typeof e?this.filter=e:(this.filter||(this.filter=new Set),this.filter.add(e)),this.cache&&_(this),this},i.addMapper=function(e,t){return"object"==typeof e?this.addReplacer(e,t):e.length>1?this.addMatcher(e,t):(this.mapper||(this.mapper=new Map),this.mapper.set(e,t),this.cache&&_(this),this)},i.addMatcher=function(e,t){return"object"==typeof e?this.addReplacer(e,t):e.length<2&&(this.dedupe||this.mapper)?this.addMapper(e,t):(this.matcher||(this.matcher=new Map),this.matcher.set(e,t),this.h+=(this.h?"|":"")+e,this.J=null,this.cache&&_(this),this)},i.addReplacer=function(e,t){return"string"==typeof e?this.addMatcher(e,t):(this.replacer||(this.replacer=[]),this.replacer.push(e,t),this.cache&&_(this),this)},i.encode=function(e,t){if(this.cache&&e.length<=this.H)if(this.F){if(this.B.has(e))return this.B.get(e)}else this.F=setTimeout(_,50,this);this.normalize&&(e="function"==typeof this.normalize?this.normalize(e):g?e.normalize("NFKD").replace(g,"").toLowerCase():e.toLowerCase()),this.prepare&&(e=this.prepare(e)),this.numeric&&e.length>3&&(e=e.replace(f,"$1 $2").replace(p,"$1 $2").replace(d,"$1 "));const n=!(this.dedupe||this.mapper||this.filter||this.matcher||this.stemmer||this.replacer);let r,i,s=[],o=a(),c=this.split||""===this.split?e.split(this.split):[e];for(let e,a,h=0;h<c.length;h++)if((e=a=c[h])&&!(e.length<this.minlength||e.length>this.maxlength)){if(t){if(o[e])continue;o[e]=1}else{if(r===e)continue;r=e}if(n)s.push(e);else if(!this.filter||("function"==typeof this.filter?this.filter(e):!this.filter.has(e))){if(this.cache&&e.length<=this.I)if(this.F){var l=this.D.get(e);if(l||""===l){l&&s.push(l);continue}}else this.F=setTimeout(_,50,this);if(this.stemmer){let t;for(this.K||(this.K=new RegExp("(?!^)("+this.A+")$"));t!==e&&e.length>2;)t=e,e=e.replace(this.K,e=>this.stemmer.get(e))}if(e&&(this.mapper||this.dedupe&&e.length>1)){l="";for(let t,n,r=0,i="";r<e.length;r++)t=e.charAt(r),t===i&&this.dedupe||((n=this.mapper&&this.mapper.get(t))||""===n?n===i&&this.dedupe||!(i=n)||(l+=n):l+=i=t);e=l}if(this.matcher&&e.length>1&&(this.J||(this.J=new RegExp("("+this.h+")","g")),e=e.replace(this.J,e=>this.matcher.get(e))),e&&this.replacer)for(l=0;e&&l<this.replacer.length;l+=2)e=e.replace(this.replacer[l],this.replacer[l+1]);if(this.cache&&a.length<=this.I&&(this.D.set(a,e),this.D.size>this.L&&(this.D.clear(),this.I=this.I/1.1|0)),e){if(e!==a)if(t){if(o[e])continue;o[e]=1}else{if(i===e)continue;i=e}s.push(e)}}}return this.finalize&&(s=this.finalize(s)||s),this.cache&&e.length<=this.H&&(this.B.set(e,s),this.B.size>this.L&&(this.B.clear(),this.H=this.H/1.1|0)),s},v.prototype.set=function(e,t){this.cache.set(this.h=e,t),this.cache.size>this.limit&&this.cache.delete(this.cache.keys().next().value)},v.prototype.get=function(e){const t=this.cache.get(e);return t&&this.h!==e&&(this.cache.delete(e),this.cache.set(this.h=e,t)),t},v.prototype.remove=function(e){for(const t of this.cache){const n=t[0];t[1].includes(e)&&this.cache.delete(n)}},v.prototype.clear=function(){this.cache.clear(),this.h=""};const b={normalize:!1,numeric:!1,dedupe:!1},E={},A=new Map([["b","p"],["v","f"],["w","f"],["z","s"],["x","s"],["d","t"],["n","m"],["c","k"],["g","k"],["j","k"],["q","k"],["i","e"],["y","e"],["u","o"]]),S=new Map([["ae","a"],["oe","o"],["sh","s"],["kh","k"],["th","t"],["ph","f"],["pf","f"]]),w=[/([^aeo])h(.)/g,"$1$2",/([aeo])h([^aeo]|$)/g,"$1$2",/(.)\1+/g,"$1"],C={a:"",e:"",i:"",o:"",u:"",y:"",b:1,f:1,p:1,v:1,c:2,g:2,j:2,k:2,q:2,s:2,x:2,z:2,ß:2,d:3,t:3,l:4,m:5,n:5,r:6};var I={Exact:b,Default:E,Normalize:E,LatinBalance:{mapper:A},LatinAdvanced:{mapper:A,matcher:S,replacer:w},LatinExtra:{mapper:A,replacer:w.concat([/(?!^)[aeo]/g,""]),matcher:S},LatinSoundex:{dedupe:!1,include:{letter:!0},finalize:function(e){for(let n=0;n<e.length;n++){var t=e[n];let r=t.charAt(0),i=C[r];for(let e,n=1;n<t.length&&(e=t.charAt(n),"h"===e||"w"===e||!(e=C[e])||e===i||(r+=e,i=e,4!==r.length));n++);e[n]=r}}},CJK:{split:""},LatinExact:b,LatinDefault:E,LatinSimple:E};function k(e,t,n,r){let i=[];for(let s,o=0;o<e.index.length;o++)if(s=e.index[o],t>=s.length)t-=s.length;else{const o=(t=s[r?"splice":"slice"](t,n)).length;if(o&&(i=i.length?i.concat(t):t,n-=o,r&&(e.length-=o),!n))break;t=0}return i}function T(e){if(!this||this.constructor!==T)return new T(e);this.index=e?[e]:[],this.length=e?e.length:0;const t=this;return new Proxy([],{get:(e,n)=>"length"===n?t.length:"push"===n?function(e){t.index[t.index.length-1].push(e),t.length++}:"pop"===n?function(){if(t.length)return t.length--,t.index[t.index.length-1].pop()}:"indexOf"===n?function(e){let n=0;for(let r,i,s=0;s<t.index.length;s++){if(r=t.index[s],i=r.indexOf(e),i>=0)return n+i;n+=r.length}return-1}:"includes"===n?function(e){for(let n=0;n<t.index.length;n++)if(t.index[n].includes(e))return!0;return!1}:"slice"===n?function(e,n){return k(t,e||0,n||t.length,!1)}:"splice"===n?function(e,n){return k(t,e||0,n||t.length,!0)}:"constructor"===n?Array:"symbol"!=typeof n?(e=t.index[n/2**31|0])&&e[n]:void 0,set:(e,n,r)=>(e=n/2**31|0,(t.index[e]||(t.index[e]=[]))[n]=r,t.length++,!0)})}function R(e=8){if(!this||this.constructor!==R)return new R(e);this.index=a(),this.h=[],this.size=0,e>32?(this.B=P,this.A=BigInt(e)):(this.B=N,this.A=e)}function O(e=8){if(!this||this.constructor!==O)return new O(e);this.index=a(),this.h=[],this.size=0,e>32?(this.B=P,this.A=BigInt(e)):(this.B=N,this.A=e)}function N(e){let t=2**this.A-1;if("number"==typeof e)return e&t;let n=0,r=this.A+1;for(let i=0;i<e.length;i++)n=(n*r^e.charCodeAt(i))&t;return 32===this.A?n+2**31:n}function P(e){let t=BigInt(2)**this.A-BigInt(1);var n=typeof e;if("bigint"===n)return e&t;if("number"===n)return BigInt(e)&t;n=BigInt(0);let r=this.A+BigInt(1);for(let i=0;i<e.length;i++)n=(n*r^BigInt(e.charCodeAt(i)))&t;return n}let B,L,x,D,M;async function U(e){var t=(e=e.data).task;const n=e.id;let i=e.args;if("init"===t)L=e.options||{},(t=e.factory)?(Function("return "+t)()(r),B=new r.FlexSearch.Index(L),delete r.FlexSearch):B=new Te(L),postMessage({id:n});else{let r;"export"===t&&(i[1]?(i[0]=L.export,i[2]=0,i[3]=1):i=null),"import"===t?i[0]&&(e=await L.import.call(B,i[0]),B.import(i[0],e)):((r=i&&B[t].apply(B,i))&&r.then&&(r=await r),r&&r.await&&(r=await r.await),"search"===t&&r.result&&(r=r.result)),postMessage("search"===t?{id:n,msg:r}:{id:n})}}function F(e){j.call(e,"add"),j.call(e,"append"),j.call(e,"search"),j.call(e,"update"),j.call(e,"remove"),j.call(e,"searchCache")}function H(){x=M=0}function j(e){this[e+"Async"]=function(){const t=arguments;var n=t[t.length-1];let r;if("function"==typeof n&&(r=n,delete t[t.length-1]),x?M||(M=Date.now()-D>=this.priority*this.priority*3):(x=setTimeout(H,0),D=Date.now()),M){const n=this;return new Promise(r=>{setTimeout(function(){r(n[e+"Async"].apply(n,t))},0)})}const i=this[e].apply(this,t);return n=i.then?i:new Promise(e=>e(i)),r&&n.then(r),n}}T.prototype.clear=function(){this.index.length=0},T.prototype.push=function(){},R.prototype.get=function(e){const t=this.index[this.B(e)];return t&&t.get(e)},R.prototype.set=function(e,t){var n=this.B(e);let r=this.index[n];r?(n=r.size,r.set(e,t),(n-=r.size)&&this.size++):(this.index[n]=r=new Map([[e,t]]),this.h.push(r),this.size++)},O.prototype.add=function(e){var t=this.B(e);let n=this.index[t];n?(t=n.size,n.add(e),(t-=n.size)&&this.size++):(this.index[t]=n=new Set([e]),this.h.push(n),this.size++)},(i=R.prototype).has=O.prototype.has=function(e){const t=this.index[this.B(e)];return t&&t.has(e)},i.delete=O.prototype.delete=function(e){const t=this.index[this.B(e)];t&&t.delete(e)&&this.size--},i.clear=O.prototype.clear=function(){this.index=a(),this.h=[],this.size=0},i.values=O.prototype.values=function*(){for(let e=0;e<this.h.length;e++)for(let t of this.h[e].values())yield t},i.keys=O.prototype.keys=function*(){for(let e=0;e<this.h.length;e++)for(let t of this.h[e].keys())yield t},i.entries=O.prototype.entries=function*(){for(let e=0;e<this.h.length;e++)for(let t of this.h[e].entries())yield t};let W=0;function Q(e={},t){function i(n){function r(e){const t=(e=e.data||e).id,n=t&&c.h[t];n&&(n(e.msg),delete c.h[t])}if(this.worker=n,this.h=a(),this.worker)return o?this.worker.on("message",r):this.worker.onmessage=r,e.config?new Promise(function(t){W>1e9&&(W=0),c.h[++W]=function(){t(c)},c.worker.postMessage({id:W,task:"init",factory:s,options:e})}):(this.priority=e.priority||4,this.encoder=t||null,this.worker.postMessage({task:"init",factory:s,options:e}),this)}if(!this||this.constructor!==Q)return new Q(e);let s=void 0!==r?r._factory:"undefined"!=typeof window?window._factory:null;s&&(s=s.toString());const o="undefined"==typeof window,c=this,l=function(e,t,r){return t?new(n(8167).Worker)(__dirname+"/node/node.js"):e?new window.Worker(URL.createObjectURL(new Blob(["onmessage="+U.toString()],{type:"text/javascript"}))):new window.Worker("string"==typeof r?r:(0,eval)("import.meta.url").replace("/worker.js","/worker/worker.js").replace("flexsearch.bundle.module.min.js","module/worker/worker.js").replace("flexsearch.bundle.module.min.mjs","module/worker/worker.js"),{type:"module"})}(s,o,e.worker);return l.then?l.then(function(e){return i.call(c,e)}):i.call(this,l)}function q(e){Q.prototype[e]=function(){const t=this,n=[].slice.call(arguments);var r=n[n.length-1];let i;return"function"==typeof r&&(i=r,n.pop()),r=new Promise(function(r){"export"===e&&"function"==typeof n[0]&&(n[0]=null),W>1e9&&(W=0),t.h[++W]=r,t.worker.postMessage({task:e,id:W,args:n})}),i?(r.then(i),this):r}}function z(e,t,n,r,i,s){if(e=e[i],r===n.length-1)t[i]=s||e;else if(e)if(e.constructor===Array)for(t=t[i]=Array(e.length),i=0;i<e.length;i++)z(e,t,n,r,i);else t=t[i]||(t[i]=a()),i=n[++r],z(e,t,n,r,i)}function $(e,t,n,r,i,s,o,a){if(e=e[o])if(r===t.length-1){if(e.constructor===Array){if(n[r]){for(t=0;t<e.length;t++)i.add(s,e[t],!0,!0);return}e=e.join(" ")}i.add(s,e,a,!0)}else if(e.constructor===Array)for(o=0;o<e.length;o++)$(e,t,n,r,i,s,o,a);else o=t[++r],$(e,t,n,r,i,s,o,a)}function G(e,t,n,r){if(!e.length)return e;if(1===e.length)return e=e[0],e=n||e.length>t?e.slice(n,n+t):e,r?ce.call(this,e):e;let i=[];for(let s,o,a=0;a<e.length;a++)if((s=e[a])&&(o=s.length)){if(n){if(n>=o){n-=o;continue}s=s.slice(n,n+t),o=s.length,n=0}if(o>t&&(s=s.slice(0,t),o=t),!i.length&&o>=t)return r?ce.call(this,s):s;if(i.push(s),!(t-=o))break}return i=i.length>1?[].concat.apply([],i):i[0],r?ce.call(this,i):i}function K(e,t,n,r){var i=r[0];if(i[0]&&i[0].query)return e[t].apply(e,i);if(!("and"!==t&&"not"!==t||e.result.length||e.await||i.suggest))return r.length>1&&(i=r[r.length-1]),(r=i.resolve)?e.await||e.result:e;let s,o,a,c,l,h=[],u=0,d=0;for(t=0;t<r.length;t++)if(i=r[t]){var f=void 0;if(i.constructor===te)f=i.await||i.result;else if(i.then||i.constructor===Array)f=i;else{u=i.limit||0,d=i.offset||0,a=i.suggest,o=i.resolve,s=((c=i.highlight||e.highlight)||i.enrich)&&o,f=i.queue;let n=i.async||f,r=i.index,p=i.query;if(r?e.index||(e.index=r):r=e.index,p||i.tag){const s=i.field||i.pluck;if(s&&(!p||e.query&&!c||(e.query=p,e.field=s,e.highlight=c),r=r.index.get(s)),f&&(l||e.await)){let s;l=1;const o=e.C.length,a=new Promise(function(e){s=e});(function(t,r){a.h=function(){r.index=null,r.resolve=!1;let i=n?t.searchAsync(r):t.search(r);return i.then?i.then(function(t){return e.C[o]=t=t.result||t,s(t),t}):(i=i.result||i,s(i),i)}})(r,Object.assign({},i)),e.C.push(a),h[t]=a;continue}i.resolve=!1,i.index=null,f=n?r.searchAsync(i):r.search(i),i.resolve=o,i.index=r}else if(i.and)f=Y(i,"and",r);else if(i.or)f=Y(i,"or",r);else if(i.not)f=Y(i,"not",r);else{if(!i.xor)continue;f=Y(i,"xor",r)}}f.await?(l=1,f=f.await):f.then?(l=1,f=f.then(function(e){return e.result||e})):f=f.result||f,h[t]=f}if(l&&!e.await&&(e.await=new Promise(function(t){e.return=t})),l){const t=Promise.all(h).then(function(r){for(let i=0;i<e.C.length;i++)if(e.C[i]===t){e.C[i]=function(){return n.call(e,r,u,d,s,o,a,c)};break}ne(e)});e.C.push(t)}else{if(!e.await)return n.call(e,h,u,d,s,o,a,c);e.C.push(function(){return n.call(e,h,u,d,s,o,a,c)})}return o?e.await||e.result:e}function Y(e,t,n){const r=(e=e[t])[0]||e;return r.index||(r.index=n),n=new te(r),e.length>1&&(n=n[t].apply(n,e.slice(1))),n}function V(e,t,n,r,i,s,o){return e.length&&(this.result.length&&e.push(this.result),e.length<2?this.result=e[0]:(this.result=ie(e,t,n,!1,this.h),n=0)),i&&(this.await=null),i?this.resolve(t,n,r,o):this}function X(e,t,n,r,i,s,o){if(!s&&!this.result.length)return i?this.result:this;let a;if(e.length)if(this.result.length&&e.unshift(this.result),e.length<2)this.result=e[0];else{let r=0;for(let t,n,i=0;i<e.length;i++)if((t=e[i])&&(n=t.length))r<n&&(r=n);else if(!s){r=0;break}r?(this.result=re(e,r,t,n,s,this.h,i),a=!0):this.result=[]}else s||(this.result=e);return i&&(this.await=null),i?this.resolve(t,n,r,o,a):this}function J(e,t,n,r,i,s,o){if(e.length)if(this.result.length&&e.unshift(this.result),e.length<2)this.result=e[0];else{e:{s=n;var c=this.h;const r=[],o=a();let l=0;for(let t,n=0;n<e.length;n++)if(t=e[n]){l<t.length&&(l=t.length);for(let e,n=0;n<t.length;n++)if(e=t[n])for(let t,n=0;n<e.length;n++)t=e[n],o[t]=o[t]?2:1}for(let n,a=0,h=0;a<l;a++)for(let l,u=0;u<e.length;u++)if((l=e[u])&&(n=l[a]))for(let l,d=0;d<n.length;d++)if(l=n[d],1===o[l])if(s)s--;else if(i){if(r.push(l),r.length===t){e=r;break e}}else{const n=a+(u?c:0);if(r[n]||(r[n]=[]),r[n].push(l),++h===t){e=r;break e}}e=r}this.result=e,c=!0}else s||(this.result=e);return i&&(this.await=null),i?this.resolve(t,n,r,o,c):this}function Z(e,t,n,r,i,s,o){if(!s&&!this.result.length)return i?this.result:this;if(e.length&&this.result.length){e:{s=n;var a=[];e=new Set(e.flat().flat());for(let n,r=0,o=0;r<this.result.length;r++)if(n=this.result[r])for(let c,l=0;l<n.length;l++)if(c=n[l],!e.has(c))if(s)s--;else if(i){if(a.push(c),a.length===t){e=a;break e}}else if(a[r]||(a[r]=[]),a[r].push(c),++o===t){e=a;break e}e=a}this.result=e,a=!0}return i&&(this.await=null),i?this.resolve(t,n,r,o,a):this}function ee(e,t,n,r,i){let s,o,a;"string"==typeof i?(s=i,i=""):s=i.template,o=s.indexOf("$1"),a=s.substring(o+2),o=s.substring(0,o);let c=i&&i.boundary,l=!i||!1!==i.clip,u=i&&i.merge&&a&&o&&new RegExp(a+" "+o,"g");var d=0;if("object"==typeof(i=i&&i.ellipsis)){var f=i.template;d=f.length-2,i=i.pattern}let p,g;"string"!=typeof i&&(i=!1===i?"":"..."),d&&(i=f.replace("$1",i)),f=i.length-d,"object"==typeof c&&(p=c.before,0===p&&(p=-1),g=c.after,0===g&&(g=-1),c=c.total||9e5),d=new Map;for(let L,x,D,M=0;M<t.length;M++){let U;if(r)U=t,D=r;else{var m=t[M];if(D=m.field,!D)continue;U=m.result}x=n.get(D),L=x.encoder,"string"!=typeof(m=d.get(L))&&(m=L.encode(e),d.set(L,m));for(let e=0;e<U.length;e++){var _=U[e].doc;if(!_)continue;if(!(_=h(_,D)))continue;var y=_.trim().split(/\s+/);if(!y.length)continue;_="";var v=[];let t=[];for(var b=-1,E=-1,A=0,S=0;S<y.length;S++){var w=y[S],C=L.encode(w);let e;if((C=C.length>1?C.join(" "):C[0])&&w){for(var I=w.length,k=(L.split?w.replace(L.split,""):w).length-C.length,T="",R=0,O=0;O<m.length;O++){var N=m[O];if(N){var P=N.length;P+=k<0?0:k,R&&P<=R||(N=C.indexOf(N))>-1&&(T=(N?w.substring(0,N):"")+o+w.substring(N,N+P)+a+(N+P<I?w.substring(N+P):""),R=P,e=!0)}}T&&(c&&(b<0&&(b=_.length+(_?1:0)),E=_.length+(_?1:0)+T.length,A+=I,t.push(v.length),v.push({match:T})),_+=(_?" ":"")+T)}if(e){if(c&&A>=c)break}else _+=(_?" ":"")+(w=y[S]),c&&v.push({text:w})}if(A=t.length*(s.length-2),p||g||c&&_.length-A>c)if(S=E-b,p>0&&(S+=p),g>0&&(S+=g),S<=(A=c+A-2*f))y=p?b-(p>0?p:0):b-((A-S)/2|0),v=g?E+(g>0?g:0):y+A,l||(y>0&&" "!==_.charAt(y)&&" "!==_.charAt(y-1)&&((y=_.indexOf(" ",y))<0&&(y=0)),v<_.length&&" "!==_.charAt(v-1)&&" "!==_.charAt(v)&&((v=_.lastIndexOf(" ",v))<E?v=E:++v)),_=(y?i:"")+_.substring(y,v)+(v<_.length?i:"");else{for(E=[],b={},A={},S={},w={},C={},T=k=I=0,O=R=1;;){var B=void 0;for(let e,n=0;n<t.length;n++){if(e=t[n],T)if(k!==T){if(S[n+1])continue;if(e+=T,b[e]){I-=f,A[n+1]=1,S[n+1]=1;continue}if(e>=v.length-1){if(e>=v.length){S[n+1]=1,e>=y.length&&(A[n+1]=1);continue}I-=f}if(_=v[e].text,P=g&&C[n]){if(!(P>0)){S[n+1]=1;continue}if(_.length>P){if(S[n+1]=1,!l)continue;_=_.substring(0,P)}(P-=_.length)||(P=-1),C[n]=P}if(I+_.length+1<=c)_=" "+_,E[n]+=_;else{if(!l){S[n+1]=1;continue}(B=c-I-1)>0&&(_=" "+_.substring(0,B),E[n]+=_),S[n+1]=1}}else{if(S[n])continue;if(e-=k,b[e]){I-=f,S[n]=1,A[n]=1;continue}if(e<=0){if(e<0){S[n]=1,A[n]=1;continue}I-=f}if(_=v[e].text,P=p&&w[n]){if(!(P>0)){S[n]=1;continue}if(_.length>P){if(S[n]=1,!l)continue;_=_.substring(_.length-P)}(P-=_.length)||(P=-1),w[n]=P}if(I+_.length+1<=c)_+=" ",E[n]=_+E[n];else{if(!l){S[n]=1;continue}(B=_.length+1-(c-I))>=0&&B<_.length&&(_=_.substring(B)+" ",E[n]=_+E[n]),S[n]=1}}else{let t;if(_=v[e].match,p&&(w[n]=p),g&&(C[n]=g),n&&I++,e?!n&&f&&(I+=f):(A[n]=1,S[n]=1),e>=y.length-1||e<v.length-1&&v[e+1].match?t=1:f&&(I+=f),I-=s.length-2,n&&!(I+_.length<=c)){B=R=O=A[n]=0;break}E[n]=_,t&&(A[n+1]=1,S[n+1]=1)}I+=_.length,B=b[e]=1}if(B)k===T?T++:k++;else{if(k===T?R=0:O=0,!R&&!O)break;R?T=++k:T++}}_="";for(let e,t=0;t<E.length;t++)e=(A[t]?t?" ":"":(t&&!i?" ":"")+i)+E[t],_+=e;i&&!A[E.length]&&(_+=i)}u&&(_=_.replace(u," ")),U[e].highlight=_}if(r)break}return t}function te(e,t){if(!this||this.constructor!==te)return new te(e,t);let n,r,i,s,o,a,c=0;if(e&&e.index){const n=e;if(t=n.index,c=n.boost||0,r=n.query){i=n.field||n.pluck,s=n.highlight;const r=n.resolve;e=n.async||n.queue,n.resolve=!1,n.index=null,e=e?t.searchAsync(n):t.search(n),n.resolve=r,n.index=t,e=e.result||e}else e=[]}if(e&&e.then){const t=this;n=[e=e.then(function(e){t.C[0]=t.result=e.result||e,ne(t)})],e=[],o=new Promise(function(e){a=e})}this.index=t||null,this.result=e||[],this.h=c,this.C=n||[],this.await=o||null,this.return=a||null,this.highlight=s||null,this.query=r||"",this.field=i||""}function ne(e,t){let n=e.result;var r=e.await;e.await=null;for(let t,i=0;i<e.C.length;i++)if(t=e.C[i])if("function"==typeof t)n=t(),e.C[i]=n=n.result||n,i--;else if(t.h)n=t.h(),e.C[i]=n=n.result||n,i--;else if(t.then)return e.await=r;return r=e.return,e.C=[],e.return=null,t||r(n),n}function re(e,t,n,r,i,s,o){const c=e.length;let l,h,u=[];l=a();for(let a,d,f,p,g=0;g<t;g++)for(let t=0;t<c;t++)if(f=e[t],g<f.length&&(a=f[g]))for(let e=0;e<a.length;e++){if(d=a[e],(h=l[d])?l[d]++:(h=0,l[d]=1),p=u[h]||(u[h]=[]),!o){let e=g+(t||!i?0:s||0);p=p[e]||(p[e]=[])}if(p.push(d),o&&n&&h===c-1&&p.length-r===n)return r?p.slice(r):p}if(e=u.length)if(i)u=u.length>1?ie(u,n,r,o,s):(u=u[0])&&n&&u.length>n||r?u.slice(r,n+r):u;else{if(e<c)return[];if(u=u[e-1],n||r)if(o)(u.length>n||r)&&(u=u.slice(r,n+r));else{i=[];for(let e,t=0;t<u.length;t++)if(e=u[t])if(r&&e.length>r)r-=e.length;else if((n&&e.length>n||r)&&(e=e.slice(r,n+r),n-=e.length,r&&(r-=e.length)),i.push(e),!n)break;u=i}}return u}function ie(e,t,n,r,i){const s=[],o=a();let c;var l=e.length;let h;if(r){for(i=l-1;i>=0;i--)if(h=(r=e[i])&&r.length)for(l=0;l<h;l++)if(c=r[l],!o[c])if(o[c]=1,n)n--;else if(s.push(c),s.length===t)return s}else for(let a,u=l-1,d=0;u>=0;u--){a=e[u];for(let e=0;e<a.length;e++)if(h=(r=a[e])&&r.length)for(let a=0;a<h;a++)if(c=r[a],!o[c])if(o[c]=1,n)n--;else{let n=(e+(u<l-1&&i||0))/(u+1)|0;if((s[n]||(s[n]=[])).push(c),++d===t)return s}}return s}function se(e,t,n,r,i){const s=a(),o=[];for(let e,n=0;n<t.length;n++){e=t[n];for(let t=0;t<e.length;t++)s[e[t]]=1}if(i){for(let t,i=0;i<e.length;i++)if(t=e[i],s[t])if(r)r--;else if(o.push(t),s[t]=0,n&&0===--n)break}else for(let n,r,i=0;i<e.result.length;i++)for(n=e.result[i],t=0;t<n.length;t++)r=n[t],s[r]&&((o[i]||(o[i]=[])).push(r),s[r]=0);return o}function oe(e){const t=[],n=a(),r=a();for(let i,s,o,a,c,l,h,u=0;u<e.length;u++){i=e[u],s=i.field,o=i.result;for(let e=0;e<o.length;e++)c=o[e],"object"!=typeof c?c={id:a=c}:a=c.id,(l=n[a])?l.push(s):(c.field=n[a]=[s],t.push(c)),(h=c.highlight)&&(l=r[a],l||(r[a]=l={},c.highlight=l),l[s]=h)}return t}function ae(e,t,n,r,i){return(e=this.tag.get(e))&&(e=e.get(t))?((t=e.length-r)>0&&((n&&t>n||r)&&(e=e.slice(r,r+n)),i&&(e=ce.call(this,e))),e):[]}function ce(e){if(!this||!this.store)return e;if(this.db)return this.index.get(this.field[0]).db.enrich(e);const t=Array(e.length);for(let n,r=0;r<e.length;r++)n=e[r],t[r]={id:n,doc:this.store.get(n)};return t}function le(e){if(!this||this.constructor!==le)return new le(e);const t=e.document||e.doc||e;let n,r;if(this.B=[],this.field=[],this.D=[],this.key=(n=t.key||t.id)&&ue(n,this.D)||"id",(r=e.keystore||0)&&(this.keystore=r),this.fastupdate=!!e.fastupdate,this.reg=!this.fastupdate||e.worker||e.db?r?new O(r):new Set:r?new R(r):new Map,this.h=(n=t.store||null)&&n&&!0!==n&&[],this.store=n?r?new R(r):new Map:null,this.cache=(n=e.cache||null)&&new v(n),e.cache=!1,this.worker=e.worker||!1,this.priority=e.priority||4,this.index=he.call(this,e,t),this.tag=null,(n=t.tag)&&("string"==typeof n&&(n=[n]),n.length)){this.tag=new Map,this.A=[],this.F=[];for(let e,t,r=0;r<n.length;r++){if(e=n[r],t=e.field||e,!t)throw Error("The tag field from the document descriptor is undefined.");e.custom?this.A[r]=e.custom:(this.A[r]=ue(t,this.D),e.filter&&("string"==typeof this.A[r]&&(this.A[r]=new String(this.A[r])),this.A[r].G=e.filter)),this.F[r]=t,this.tag.set(t,new Map)}}if(this.worker){this.fastupdate=!1,e=[];for(const t of this.index.values())t.then&&e.push(t);if(e.length){const t=this;return Promise.all(e).then(function(e){let n=0;for(const r of t.index.entries()){const i=r[0];let s=r[1];s.then&&(s=e[n],t.index.set(i,s),n++)}return t})}}else e.db&&(this.fastupdate=!1,this.mount(e.db))}function he(e,t){const n=new Map;let r=t.index||t.field||t;c(r)&&(r=[r]);for(let t,s,o=0;o<r.length;o++){if(t=r[o],c(t)||(s=t,t=t.field),s=l(s)?Object.assign({},e,s):e,this.worker){var i=void 0;i=new Q(s,i=(i=s.encoder)&&i.encode?i:new m("string"==typeof i?I[i]:i||{})),n.set(t,i)}this.worker||n.set(t,new Te(s,this.reg)),s.custom?this.B[o]=s.custom:(this.B[o]=ue(t,this.D),s.filter&&("string"==typeof this.B[o]&&(this.B[o]=new String(this.B[o])),this.B[o].G=s.filter)),this.field[o]=t}if(this.h){c(e=t.store)&&(e=[e]);for(let t,n,r=0;r<e.length;r++)t=e[r],n=t.field||t,t.custom?(this.h[r]=t.custom,t.custom.O=n):(this.h[r]=ue(n,this.D),t.filter&&("string"==typeof this.h[r]&&(this.h[r]=new String(this.h[r])),this.h[r].G=t.filter))}return n}function ue(e,t){const n=e.split(":");let r=0;for(let i=0;i<n.length;i++)"]"===(e=n[i])[e.length-1]&&(e=e.substring(0,e.length-2))&&(t[r]=!0),e&&(n[r++]=e);return r<n.length&&(n.length=r),r>1?n:n[0]}function de(e,t=0){let n=[],r=[];t&&(t=25e4/t*5e3|0);for(const i of e.entries())r.push(i),r.length===t&&(n.push(r),r=[]);return r.length&&n.push(r),n}function fe(e,t){t||(t=new Map);for(let n,r=0;r<e.length;r++)n=e[r],t.set(n[0],n[1]);return t}function pe(e,t=0){let n=[],r=[];t&&(t=25e4/t*1e3|0);for(const i of e.entries())r.push([i[0],de(i[1])[0]||[]]),r.length===t&&(n.push(r),r=[]);return r.length&&n.push(r),n}function ge(e,t){t||(t=new Map);for(let n,r,i=0;i<e.length;i++)n=e[i],r=t.get(n[0]),t.set(n[0],fe(n[1],r));return t}function me(e){let t=[],n=[];for(const r of e.keys())n.push(r),25e4===n.length&&(t.push(n),n=[]);return n.length&&t.push(n),t}function _e(e,t){t||(t=new Set);for(let n=0;n<e.length;n++)t.add(e[n]);return t}function ye(e,t,n,r,i,s,o=0){const a=r&&r.constructor===Array;var c=a?r.shift():r;if(!c)return this.export(e,t,i,s+1);if((c=e((t?t+".":"")+(o+1)+"."+n,JSON.stringify(c)))&&c.then){const l=this;return c.then(function(){return ye.call(l,e,t,n,a?r:null,i,s,o+1)})}return ye.call(this,e,t,n,a?r:null,i,s,o+1)}function ve(e,t){let n="";for(const r of e.entries()){e=r[0];const i=r[1];let s="";for(let e,n=0;n<i.length;n++){e=i[n]||[""];let r="";for(let n=0;n<e.length;n++)r+=(r?",":"")+("string"===t?'"'+e[n]+'"':e[n]);r="["+r+"]",s+=(s?",":"")+r}s='["'+e+'",['+s+"]]",n+=(n?",":"")+s}return n}function be(e,t){let n=0;var r=void 0===t;if(e.constructor===Array){for(let i,s,o,a=0;a<e.length;a++)if((i=e[a])&&i.length){if(r)return 1;if(s=i.indexOf(t),s>=0){if(i.length>1)return i.splice(s,1),1;if(delete e[a],n)return 1;o=1}else{if(o)return 1;n++}}}else for(let i of e.entries())r=i[0],be(i[1],t)?n++:e.delete(r);return n}q("add"),q("append"),q("search"),q("update"),q("remove"),q("clear"),q("export"),q("import"),Q.prototype.searchCache=y,F(Q.prototype),le.prototype.add=function(e,t,n){if(l(e)&&(e=h(t=e,this.key)),t&&(e||0===e)){if(!n&&this.reg.has(e))return this.update(e,t);for(let s,o=0;o<this.field.length;o++){s=this.B[o];var r=this.index.get(this.field[o]);if("function"==typeof s){var i=s(t);i&&r.add(e,i,n,!0)}else(!(i=s.G)||i(t))&&(s.constructor===String?s=[""+s]:c(s)&&(s=[s]),$(t,s,this.D,0,r,e,s[0],n))}if(this.tag)for(r=0;r<this.A.length;r++){var s=this.A[r];i=this.tag.get(this.F[r]);let l=a();if("function"==typeof s){if(!(s=s(t)))continue}else{var o=s.G;if(o&&!o(t))continue;s.constructor===String&&(s=""+s),s=h(t,s)}if(i&&s){c(s)&&(s=[s]);for(let t,r,a=0;a<s.length;a++)if(t=s[a],!l[t]&&(l[t]=1,(o=i.get(t))?r=o:i.set(t,r=[]),!n||!r.includes(e))){if(r.length===2**31-1){if(o=new T(r),this.fastupdate)for(let e of this.reg.values())e.includes(r)&&(e[e.indexOf(r)]=o);i.set(t,r=o)}r.push(e),this.fastupdate&&((o=this.reg.get(e))?o.push(r):this.reg.set(e,[r]))}}}if(this.store&&(!n||!this.store.has(e))){let r;if(this.h){r=a();for(let e,i=0;i<this.h.length;i++){if(e=this.h[i],(n=e.G)&&!n(t))continue;let s;if("function"==typeof e){if(s=e(t),!s)continue;e=[e.O]}else if(c(e)||e.constructor===String){r[e]=t[e];continue}z(t,r,e,0,e[0],s)}}this.store.set(e,r||t)}this.worker&&(this.fastupdate||this.reg.add(e))}return this},te.prototype.or=function(){return K(this,"or",V,arguments)},te.prototype.and=function(){return K(this,"and",X,arguments)},te.prototype.xor=function(){return K(this,"xor",J,arguments)},te.prototype.not=function(){return K(this,"not",Z,arguments)},(i=te.prototype).limit=function(e){if(this.await){const t=this;this.C.push(function(){return t.limit(e).result})}else if(this.result.length){const t=[];for(let n,r=0;r<this.result.length;r++)if(n=this.result[r]){if(!(n.length<=e)){t[r]=n.slice(0,e);break}if(t[r]=n,!(e-=n.length))break}this.result=t}return this},i.offset=function(e){if(this.await){const t=this;this.C.push(function(){return t.offset(e).result})}else if(this.result.length){const t=[];for(let n,r=0;r<this.result.length;r++)(n=this.result[r])&&(n.length<=e?e-=n.length:(t[r]=n.slice(e),e=0));this.result=t}return this},i.boost=function(e){if(this.await){const t=this;this.C.push(function(){return t.boost(e).result})}else this.h+=e;return this},i.resolve=function(e,t,n,r,i){let s=this.await?ne(this,!0):this.result;if(s.then){const o=this;return s.then(function(){return o.resolve(e,t,n,r,i)})}return s.length&&("object"==typeof e?(r=e.highlight||this.highlight,n=!!r||e.enrich,t=e.offset,e=e.limit):(r=r||this.highlight,n=!!r||n),s=i?n?ce.call(this.index,s):s:G.call(this.index,s,e||100,t,n)),this.finalize(s,r)},i.finalize=function(e,t){if(e.then){const n=this;return e.then(function(e){return n.finalize(e,t)})}t&&e.length&&this.query&&(e=ee(this.query,e,this.index.index,this.field,t));const n=this.return;return this.highlight=this.index=this.result=this.C=this.await=this.return=null,this.query=this.field="",n&&n(e),e},a(),le.prototype.search=function(e,t,n,r){n||(!t&&l(e)?(n=e,e=""):l(t)&&(n=t,t=0));let i=[];var s=[];let a,h,u,d,f,p,g,m,_=0,y=!0;if(n){n.constructor===Array&&(n={index:n}),e=n.query||e,a=n.pluck,h=n.merge,d=n.boost,p=a||n.field||(p=n.index)&&(p.index?null:p);var v=this.tag&&n.tag;u=n.suggest,y=!1!==n.resolve,f=n.cache,g=y&&this.store&&n.highlight;var b=!!g||y&&this.store&&n.enrich;t=n.limit||t;var E=n.offset||0;if(t||(t=y?100:0),v&&(!this.db||!r)){v.constructor!==Array&&(v=[v]);var A=[];for(let e,t=0;t<v.length;t++)if(e=v[t],e.field&&e.tag){var S=e.tag;if(S.constructor===Array)for(var w=0;w<S.length;w++)A.push(e.field,S[w]);else A.push(e.field,S)}else{S=Object.keys(e);for(let t,n,r=0;r<S.length;r++)if(t=S[r],n=e[t],n.constructor===Array)for(w=0;w<n.length;w++)A.push(t,n[w]);else A.push(t,n)}if(v=A,!e){if(s=[],A.length)for(v=0;v<A.length;v+=2){if(this.db){if(!(r=this.index.get(A[v])))continue;s.push(r=r.db.tag(A[v+1],t,E,b))}else r=ae.call(this,A[v],A[v+1],t,E,b);i.push(y?{field:A[v],tag:A[v+1],result:r}:[r])}if(s.length){const e=this;return Promise.all(s).then(function(t){for(let e=0;e<t.length;e++)y?i[e].result=t[e]:i[e]=t[e];return y?i:new te(i.length>1?re(i,1,0,0,u,d):i[0],e)})}return y?i:new te(i.length>1?re(i,1,0,0,u,d):i[0],this)}}y||a||!(p=p||this.field)||(c(p)?a=p:(p.constructor===Array&&1===p.length&&(p=p[0]),a=p.field||p.index)),p&&p.constructor!==Array&&(p=[p])}p||(p=this.field),A=(this.worker||this.db)&&!r&&[];for(let a,l,h,d=0;d<p.length;d++){if(l=p[d],this.db&&this.tag&&!this.B[d])continue;let I;if(c(l)||(I=l,l=I.field,e=I.query||e,t=o(I.limit,t),E=o(I.offset,E),u=o(I.suggest,u),g=y&&this.store&&o(I.highlight,g),b=!!g||y&&this.store&&o(I.enrich,b),f=o(I.cache,f)),r)a=r[d];else{w=(S=I||n||{}).enrich;var C=this.index.get(l);if(v&&(this.db&&(S.tag=v,S.field=p,m=C.db.support_tag_search),!m&&w&&(S.enrich=!1),m||(S.limit=0,S.offset=0)),a=f?C.searchCache(e,v&&!m?0:t,S):C.search(e,v&&!m?0:t,S),v&&!m&&(S.limit=t,S.offset=E),w&&(S.enrich=w),A){A[d]=a;continue}}if(h=(a=a.result||a)&&a.length,v&&h){if(S=[],w=0,this.db&&r){if(!m)for(C=p.length;C<r.length;C++){let e=r[C];if(e&&e.length)w++,S.push(e);else if(!u)return y?i:new te(i,this)}}else for(let e,t,n=0;n<v.length;n+=2){if(e=this.tag.get(v[n]),!e){if(u)continue;return y?i:new te(i,this)}if(t=(e=e&&e.get(v[n+1]))&&e.length)w++,S.push(e);else if(!u)return y?i:new te(i,this)}if(w){if(a=se(a,S,t,E,y),h=a.length,!h&&!u)return y?a:new te(a,this);w--}}if(h)s[_]=l,i.push(a),_++;else if(1===p.length)return y?i:new te(i,this)}if(A){if(this.db&&v&&v.length&&!m)for(b=0;b<v.length;b+=2){if(!(s=this.index.get(v[b]))){if(u)continue;return y?i:new te(i,this)}A.push(s.db.tag(v[b+1],t,E,!1))}const r=this;return Promise.all(A).then(function(i){return n&&(n.resolve=y),i.length&&(i=r.search(e,t,n,i)),i})}if(!_)return y?i:new te(i,this);if(a&&(!b||!this.store))return i=i[0],y?i:new te(i,this);for(A=[],E=0;E<s.length;E++){if(v=i[E],b&&v.length&&void 0===v[0].doc&&(this.db?A.push(v=this.index.get(this.field[0]).db.enrich(v)):v=ce.call(this,v)),a)return y?g?ee(e,v,this.index,a,g):v:new te(v,this);i[E]={field:s[E],result:v}}if(b&&this.db&&A.length){const t=this;return Promise.all(A).then(function(n){for(let e=0;e<n.length;e++)i[e].result=n[e];return g&&(i=ee(e,i,t.index,a,g)),h?oe(i):i})}return g&&(i=ee(e,i,this.index,a,g)),h?oe(i):i},(i=le.prototype).mount=function(e){let t=this.field;if(this.tag)for(let e,r=0;r<this.F.length;r++){e=this.F[r];var n=void 0;this.index.set(e,n=new Te({},this.reg)),t===this.field&&(t=t.slice(0)),t.push(e),n.tag=this.tag.get(e)}n=[];const r={db:e.db,type:e.type,fastupdate:e.fastupdate};for(let i,s,o=0;o<t.length;o++){r.field=s=t[o],i=this.index.get(s);const a=new e.constructor(e.id,r);a.id=e.id,n[o]=a.mount(i),i.document=!0,o?i.bypass=!0:i.store=this.store}const i=this;return this.db=Promise.all(n).then(function(){i.db=!0})},i.commit=async function(){const e=[];for(const t of this.index.values())e.push(t.commit());await Promise.all(e),this.reg.clear()},i.destroy=function(){const e=[];for(const t of this.index.values())e.push(t.destroy());return Promise.all(e)},i.append=function(e,t){return this.add(e,t,!0)},i.update=function(e,t){return this.remove(e).add(e,t)},i.remove=function(e){for(var t of(l(e)&&(e=h(e,this.key)),this.index.values()))t.remove(e,!0);if(this.reg.has(e)){if(this.tag&&!this.fastupdate)for(let n of this.tag.values())for(let r of n){t=r[0];const i=r[1],s=i.indexOf(e);s>-1&&(i.length>1?i.splice(s,1):n.delete(t))}this.store&&this.store.delete(e),this.reg.delete(e)}return this.cache&&this.cache.remove(e),this},i.clear=function(){const e=[];for(const t of this.index.values()){const n=t.clear();n.then&&e.push(n)}if(this.tag)for(const e of this.tag.values())e.clear();return this.store&&this.store.clear(),this.cache&&this.cache.clear(),e.length?Promise.all(e):this},i.contain=function(e){return this.db?this.index.get(this.field[0]).db.has(e):this.reg.has(e)},i.cleanup=function(){for(const e of this.index.values())e.cleanup();return this},i.get=function(e){return this.db?this.index.get(this.field[0]).db.enrich(e).then(function(e){return e[0]&&e[0].doc||null}):this.store.get(e)||null},i.set=function(e,t){return"object"==typeof e&&(e=h(t=e,this.key)),this.store.set(e,t),this},i.searchCache=y,i.export=function(e,t,n=0,r=0){if(n<this.field.length){const i=this.field[n];if((t=this.index.get(i).export(e,i,n,r=1))&&t.then){const r=this;return t.then(function(){return r.export(e,i,n+1)})}return this.export(e,i,n+1)}let i,s;switch(r){case 0:i="reg",s=me(this.reg),t=null;break;case 1:i="tag",s=this.tag&&pe(this.tag,this.reg.size),t=null;break;case 2:i="doc",s=this.store&&de(this.store),t=null;break;default:return}return ye.call(this,e,t,i,s||null,n,r)},i.import=function(e,t){var n=e.split(".");"json"===n[n.length-1]&&n.pop();const r=n.length>2?n[0]:"";if(n=n.length>2?n[2]:n[1],this.worker&&r)return this.index.get(r).import(e);if(t){if("string"==typeof t&&(t=JSON.parse(t)),r)return this.index.get(r).import(n,t);switch(n){case"reg":this.fastupdate=!1,this.reg=_e(t,this.reg);for(let e,t=0;t<this.field.length;t++)e=this.index.get(this.field[t]),e.fastupdate=!1,e.reg=this.reg;if(this.worker){t=[];for(const n of this.index.values())t.push(n.import(e));return Promise.all(t)}break;case"tag":this.tag=ge(t,this.tag);break;case"doc":this.store=fe(t,this.store)}}},F(le.prototype),Te.prototype.remove=function(e,t){const n=this.reg.size&&(this.fastupdate?this.reg.get(e):this.reg.has(e));if(n){if(this.fastupdate){for(let t,r,i=0;i<n.length;i++)if((t=n[i])&&(r=t.length))if(t[r-1]===e)t.pop();else{const n=t.indexOf(e);n>=0&&t.splice(n,1)}}else be(this.map,e),this.depth&&be(this.ctx,e);t||this.reg.delete(e)}return this.db&&(this.commit_task.push({del:e}),this.M&&Re(this)),this.cache&&this.cache.remove(e),this};const Ee={memory:{resolution:1},performance:{resolution:3,fastupdate:!0,context:{depth:1,resolution:1}},match:{tokenize:"forward"},score:{resolution:9,context:{depth:2,resolution:3}}};function Ae(e,t,n,r,i,s,o){let c,l;if(!(c=t[n])||o&&!c[o]){if(o?((t=c||(t[n]=a()))[o]=1,l=e.ctx,(c=l.get(o))?l=c:l.set(o,l=e.keystore?new R(e.keystore):new Map)):(l=e.map,t[n]=1),(c=l.get(n))?l=c:l.set(n,l=c=[]),s)for(let n,s=0;s<c.length;s++)if((n=c[s])&&n.includes(i)){if(s<=r)return;n.splice(n.indexOf(i),1),e.fastupdate&&(t=e.reg.get(i))&&t.splice(t.indexOf(n),1);break}if(l=l[r]||(l[r]=[]),l.push(i),l.length===2**31-1){if(t=new T(l),e.fastupdate)for(let n of e.reg.values())n.includes(l)&&(n[n.indexOf(l)]=t);c[r]=l=t}e.fastupdate&&((r=e.reg.get(i))?r.push(l):e.reg.set(i,[l]))}}function Se(e,t,n,r,i){return n&&e>1?t+(r||0)<=e?n+(i||0):(e-1)/(t+(r||0))*(n+(i||0))+1|0:0}function we(e,t,n,r,i,s,o){let a=e.length,c=e;if(a>1)c=re(e,t,n,r,i,s,o);else if(1===a)return o?G.call(null,e[0],n,r):new te(e[0],this);return o?c:new te(c,this)}function Ce(e,t,n,r,i,s,o){return e=ke(this,e,t,n,r,i,s,o),this.db?e.then(function(e){return i?e||[]:new te(e,this)}):e&&e.length?i?G.call(this,e,n,r):new te(e,this):i?[]:new te([],this)}function Ie(e,t,n,r){let i=[];if(e&&e.length){if(e.length<=r)return void t.push(e);for(let t,n=0;n<r;n++)(t=e[n])&&(i[n]=t);if(i.length)return void t.push(i)}if(!n)return i}function ke(e,t,n,r,i,s,o,a){let c;return n&&(c=e.bidirectional&&t>n)&&(c=n,n=t,t=c),e.db?e.db.get(t,n,r,i,s,o,a):e=n?(e=e.ctx.get(n))&&e.get(t):e.map.get(t)}function Te(e,t){if(!this||this.constructor!==Te)return new Te(e);if(e){var n=c(e)?e:e.preset;n&&(e=Object.assign({},Ee[n],e))}else e={};const r=!0===(n=e.context)?{depth:1}:n||{},i=c(e.encoder)?I[e.encoder]:e.encode||e.encoder||{};this.encoder=i.encode?i:"object"==typeof i?new m(i):{encode:i},this.resolution=e.resolution||9,this.tokenize=n=(n=e.tokenize)&&"default"!==n&&"exact"!==n&&n||"strict",this.depth="strict"===n&&r.depth||0,this.bidirectional=!1!==r.bidirectional,this.fastupdate=!!e.fastupdate,this.score=e.score||null,(n=e.keystore||0)&&(this.keystore=n),this.map=n?new R(n):new Map,this.ctx=n?new R(n):new Map,this.reg=t||(this.fastupdate?n?new R(n):new Map:n?new O(n):new Set),this.N=r.resolution||3,this.rtl=i.rtl||e.rtl||!1,this.cache=(n=e.cache||null)&&new v(n),this.resolve=!1!==e.resolve,(n=e.db)&&(this.db=this.mount(n)),this.M=!1!==e.commit,this.commit_task=[],this.commit_timer=null,this.priority=e.priority||4}function Re(e){e.commit_timer||(e.commit_timer=setTimeout(function(){e.commit_timer=null,e.db.commit(e)},1))}Te.prototype.add=function(e,t,n,r){if(t&&(e||0===e)){if(!r&&!n&&this.reg.has(e))return this.update(e,t);r=this.depth;const h=(t=this.encoder.encode(t,!r)).length;if(h){const u=a(),d=a(),f=this.resolution;for(let a=0;a<h;a++){let p=t[this.rtl?h-1-a:a];var i=p.length;if(i&&(r||!d[p])){var s=this.score?this.score(t,p,a,null,0):Se(f,h,a),o="";switch(this.tokenize){case"tolerant":if(Ae(this,d,p,s,e,n),i>2){for(let t,r,a,c,l=1;l<i-1;l++)t=p.charAt(l),r=p.charAt(l+1),a=p.substring(0,l)+r,c=p.substring(l+2),Ae(this,d,o=a+t+c,s,e,n),Ae(this,d,o=a+c,s,e,n);Ae(this,d,p.substring(0,p.length-1),s,e,n)}break;case"full":if(i>2){for(let r,l=0;l<i;l++)for(s=i;s>l;s--){o=p.substring(l,s),r=this.rtl?i-1-l:l;var c=this.score?this.score(t,p,a,o,r):Se(f,h,a,i,r);Ae(this,d,o,c,e,n)}break}case"bidirectional":case"reverse":if(i>1){for(c=i-1;c>0;c--){o=p[this.rtl?i-1-c:c]+o;var l=this.score?this.score(t,p,a,o,c):Se(f,h,a,i,c);Ae(this,d,o,l,e,n)}o=""}case"forward":if(i>1){for(c=0;c<i;c++)Ae(this,d,o+=p[this.rtl?i-1-c:c],s,e,n);break}default:if(Ae(this,d,p,s,e,n),r&&h>1&&a<h-1)for(i=this.N,o=p,s=Math.min(r+1,this.rtl?a+1:h-a),c=1;c<s;c++){p=t[this.rtl?h-1-a-c:a+c];Ae(this,u,(l=this.bidirectional&&p>o)?o:p,this.score?this.score(t,o,a,p,c-1):Se(i+(h/2>i?0:1),h,a,s-1,c-1),e,n,l?p:o)}}}}this.fastupdate||this.reg.add(e)}}return this.db&&(this.commit_task.push(n?{ins:e}:{del:e}),this.M&&Re(this)),this},Te.prototype.search=function(e,t,n){if(n||(t||"object"!=typeof e?"object"==typeof t&&(n=t,t=0):(n=e,e="")),n&&n.cache)return n.cache=!1,e=this.searchCache(e,t,n),n.cache=!0,e;let r,i,s,o,c,l,h,u,d=[],f=0;n&&(e=n.query||e,t=n.limit||t,f=n.offset||0,i=n.context,s=n.suggest,u=(o=n.resolve)&&n.enrich,l=n.boost,h=n.resolution,c=this.db&&n.tag),void 0===o&&(o=this.resolve),i=this.depth&&!1!==i;let p=this.encoder.encode(e,!i);if(r=p.length,t=t||(o?100:0),1===r)return Ce.call(this,p[0],"",t,f,o,u,c);if(2===r&&i&&!s)return Ce.call(this,p[1],p[0],t,f,o,u,c);let g,m=a(),_=0;if(i&&(g=p[0],_=1),h||0===h||(h=g?this.N:this.resolution),this.db){if(this.db.search&&!1!==(n=this.db.search(this,p,t,f,s,o,u,c)))return n;const e=this;return async function(){for(let t,n;_<r;_++){if((n=p[_])&&!m[n]){if(m[n]=1,t=await ke(e,n,g,0,0,!1,!1),t=Ie(t,d,s,h)){d=t;break}g&&(s&&t&&d.length||(g=n))}s&&g&&_===r-1&&!d.length&&(h=e.resolution,g="",_=-1,m=a())}return we(d,h,t,f,s,l,o)}()}for(let e,t;_<r;_++){if((t=p[_])&&!m[t]){if(m[t]=1,e=ke(this,t,g,0,0,!1,!1),e=Ie(e,d,s,h)){d=e;break}g&&(s&&e&&d.length||(g=t))}s&&g&&_===r-1&&!d.length&&(h=this.resolution,g="",_=-1,m=a())}return we(d,h,t,f,s,l,o)},(i=Te.prototype).mount=function(e){return this.commit_timer&&(clearTimeout(this.commit_timer),this.commit_timer=null),e.mount(this)},i.commit=function(){return this.commit_timer&&(clearTimeout(this.commit_timer),this.commit_timer=null),this.db.commit(this)},i.destroy=function(){return this.commit_timer&&(clearTimeout(this.commit_timer),this.commit_timer=null),this.db.destroy()},i.clear=function(){return this.map.clear(),this.ctx.clear(),this.reg.clear(),this.cache&&this.cache.clear(),this.db?(this.commit_timer&&clearTimeout(this.commit_timer),this.commit_timer=null,this.commit_task=[],this.db.clear()):this},i.append=function(e,t){return this.add(e,t,!0)},i.contain=function(e){return this.db?this.db.has(e):this.reg.has(e)},i.update=function(e,t){const n=this,r=this.remove(e);return r&&r.then?r.then(()=>n.add(e,t)):this.add(e,t)},i.cleanup=function(){return this.fastupdate?(be(this.map),this.depth&&be(this.ctx),this):this},i.searchCache=y,i.export=function(e,t,n=0,r=0){let i,s;switch(r){case 0:i="reg",s=me(this.reg);break;case 1:i="cfg",s=null;break;case 2:i="map",s=de(this.map,this.reg.size);break;case 3:i="ctx",s=pe(this.ctx,this.reg.size);break;default:return}return ye.call(this,e,t,i,s,n,r)},i.import=function(e,t){if(t)switch("string"==typeof t&&(t=JSON.parse(t)),e=e.split("."),"json"===e[e.length-1]&&e.pop(),3===e.length&&e.shift(),e=e.length>1?e[1]:e[0],e){case"reg":this.fastupdate=!1,this.reg=_e(t,this.reg);break;case"map":this.map=fe(t,this.map);break;case"ctx":this.ctx=ge(t,this.ctx)}},i.serialize=function(e=!0){let t="",n="",r="";if(this.reg.size){let e;for(var i of this.reg.keys())e||(e=typeof i),t+=(t?",":"")+("string"===e?'"'+i+'"':i);t="index.reg=new Set(["+t+"]);",n=ve(this.map,e),n="index.map=new Map(["+n+"]);";for(const t of this.ctx.entries()){i=t[0];let n=ve(t[1],e);n="new Map(["+n+"])",n='["'+i+'",'+n+"]",r+=(r?",":"")+n}r="index.ctx=new Map(["+r+"]);"}return e?"function inject(index){"+t+n+r+"}":t+n+r},F(Te.prototype);const Oe="undefined"!=typeof window&&(window.indexedDB||window.mozIndexedDB||window.webkitIndexedDB||window.msIndexedDB),Ne=["map","ctx","tag","reg","cfg"],Pe=a();function Be(e,t={}){if(!this||this.constructor!==Be)return new Be(e,t);"object"==typeof e&&(t=e,e=e.name),e||console.info("Default storage space was used, because a name was not passed."),this.id="flexsearch"+(e?":"+e.toLowerCase().replace(/[^a-z0-9_\-]/g,""):""),this.field=t.field?t.field.toLowerCase().replace(/[^a-z0-9_\-]/g,""):"",this.type=t.type,this.fastupdate=this.support_tag_search=!1,this.db=null,this.h={}}function Le(e,t,n){const r=e.value;let i,s=0;for(let e,o=0;o<r.length;o++){if(e=n?r:r[o]){for(let n,s,a=0;a<t.length;a++)if(s=t[a],n=e.indexOf(s),n>=0){if(i=1,!(e.length>1)){r[o]=[];break}e.splice(n,1)}s+=e.length}if(n)break}s?i&&e.update(r):e.delete(),e.continue()}function xe(e,t){return new Promise((n,r)=>{e.onsuccess=e.oncomplete=function(){t&&t(this.result),t=null,n(this.result)},e.onerror=e.onblocked=r,e=null})}(i=Be.prototype).mount=function(e){return e.index?e.mount(this):(e.db=this,this.open())},i.open=function(){if(this.db)return this.db;let e=this;navigator.storage&&navigator.storage.persist&&navigator.storage.persist(),Pe[e.id]||(Pe[e.id]=[]),Pe[e.id].push(e.field);const t=Oe.open(e.id,1);return t.onupgradeneeded=function(){const t=e.db=this.result;for(let n,r=0;r<Ne.length;r++){n=Ne[r];for(let r,i=0;i<Pe[e.id].length;i++)r=Pe[e.id][i],t.objectStoreNames.contains(n+("reg"!==n&&r?":"+r:""))||t.createObjectStore(n+("reg"!==n&&r?":"+r:""))}},e.db=xe(t,function(t){e.db=t,e.db.onversionchange=function(){e.close()}})},i.close=function(){this.db&&this.db.close(),this.db=null},i.destroy=function(){return xe(Oe.deleteDatabase(this.id))},i.clear=function(){const e=[];for(let t,n=0;n<Ne.length;n++){t=Ne[n];for(let n,r=0;r<Pe[this.id].length;r++)n=Pe[this.id][r],e.push(t+("reg"!==t&&n?":"+n:""))}const t=this.db.transaction(e,"readwrite");for(let n=0;n<e.length;n++)t.objectStore(e[n]).clear();return xe(t)},i.get=function(e,t,n=0,r=0,i=!0,s=!1){e=this.db.transaction((t?"ctx":"map")+(this.field?":"+this.field:""),"readonly").objectStore((t?"ctx":"map")+(this.field?":"+this.field:"")).get(t?t+":"+e:e);const o=this;return xe(e).then(function(e){let t=[];if(!e||!e.length)return t;if(i){if(!n&&!r&&1===e.length)return e[0];for(let i,s=0;s<e.length;s++)if((i=e[s])&&i.length){if(r>=i.length){r-=i.length;continue}const e=n?r+Math.min(i.length-r,n):i.length;for(let n=r;n<e;n++)t.push(i[n]);if(r=0,t.length===n)break}return s?o.enrich(t):t}return e})},i.tag=function(e,t=0,n=0,r=!1){e=this.db.transaction("tag"+(this.field?":"+this.field:""),"readonly").objectStore("tag"+(this.field?":"+this.field:"")).get(e);const i=this;return xe(e).then(function(e){return!e||!e.length||n>=e.length?[]:t||n?(e=e.slice(n,n+t),r?i.enrich(e):e):e})},i.enrich=function(e){"object"!=typeof e&&(e=[e]);const t=this.db.transaction("reg","readonly").objectStore("reg"),n=[];for(let r=0;r<e.length;r++)n[r]=xe(t.get(e[r]));return Promise.all(n).then(function(t){for(let n=0;n<t.length;n++)t[n]={id:e[n],doc:t[n]?JSON.parse(t[n]):null};return t})},i.has=function(e){return xe(e=this.db.transaction("reg","readonly").objectStore("reg").getKey(e)).then(function(e){return!!e})},i.search=null,i.info=function(){},i.transaction=function(e,t,n){e+="reg"!==e&&this.field?":"+this.field:"";let r=this.h[e+":"+t];if(r)return n.call(this,r);let i=this.db.transaction(e,t);this.h[e+":"+t]=r=i.objectStore(e);const s=n.call(this,r);return this.h[e+":"+t]=null,xe(i).finally(function(){return s})},i.commit=async function(e){let t=e.commit_task,n=[];e.commit_task=[];for(let e,r=0;r<t.length;r++)e=t[r],e.del&&n.push(e.del);n.length&&await this.remove(n),e.reg.size&&(await this.transaction("map","readwrite",function(t){for(const n of e.map){const e=n[0],r=n[1];r.length&&(t.get(e).onsuccess=function(){let n=this.result;var i;if(n&&n.length){const e=Math.max(n.length,r.length);for(let t,s,o=0;o<e;o++)if((s=r[o])&&s.length){if((t=n[o])&&t.length)for(i=0;i<s.length;i++)t.push(s[i]);else n[o]=s;i=1}}else n=r,i=1;i&&t.put(n,e)})}}),await this.transaction("ctx","readwrite",function(t){for(const n of e.ctx){const e=n[0],r=n[1];for(const n of r){const r=n[0],i=n[1];i.length&&(t.get(e+":"+r).onsuccess=function(){let n=this.result;var s;if(n&&n.length){const e=Math.max(n.length,i.length);for(let t,r,o=0;o<e;o++)if((r=i[o])&&r.length){if((t=n[o])&&t.length)for(s=0;s<r.length;s++)t.push(r[s]);else n[o]=r;s=1}}else n=i,s=1;s&&t.put(n,e+":"+r)})}}}),e.store?await this.transaction("reg","readwrite",function(t){for(const n of e.store){const e=n[0],r=n[1];t.put("object"==typeof r?JSON.stringify(r):1,e)}}):e.bypass||await this.transaction("reg","readwrite",function(t){for(const n of e.reg.keys())t.put(1,n)}),e.tag&&await this.transaction("tag","readwrite",function(t){for(const n of e.tag){const e=n[0],r=n[1];r.length&&(t.get(e).onsuccess=function(){let n=this.result;n=n&&n.length?n.concat(r):r,t.put(n,e)})}}),e.map.clear(),e.ctx.clear(),e.tag&&e.tag.clear(),e.store&&e.store.clear(),e.document||e.reg.clear())},i.remove=function(e){return"object"!=typeof e&&(e=[e]),Promise.all([this.transaction("map","readwrite",function(t){t.openCursor().onsuccess=function(){const t=this.result;t&&Le(t,e)}}),this.transaction("ctx","readwrite",function(t){t.openCursor().onsuccess=function(){const t=this.result;t&&Le(t,e)}}),this.transaction("tag","readwrite",function(t){t.openCursor().onsuccess=function(){const t=this.result;t&&Le(t,e,!0)}}),this.transaction("reg","readwrite",function(t){for(let n=0;n<e.length;n++)t.delete(e[n])})])};const De={Index:Te,Charset:I,Encoder:m,Document:le,Worker:Q,Resolver:te,IndexedDB:Be,Language:{}},Me=void 0!==r?r:"undefined"!=typeof global?global:r;let Ue;(Ue=Me.define)&&Ue.amd?Ue([],function(){return De}):"object"==typeof Me.exports?Me.exports=De:Me.FlexSearch=De}(this||self)},2170(e,t,n){e.exports=n(9896).constants||n(9140)},2017(e,t,n){try{var r=n(9023);if("function"!=typeof r.inherits)throw"";e.exports=r.inherits}catch(t){e.exports=n(6698)}},6698(e){"function"==typeof Object.create?e.exports=function(e,t){t&&(e.super_=t,e.prototype=Object.create(t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}))}:e.exports=function(e,t){if(t){e.super_=t;var n=function(){};n.prototype=t.prototype,e.prototype=new n,e.prototype.constructor=e}}},2880(e,t,n){let r,i={};i.__wbindgen_placeholder__=e.exports;const{TextDecoder:s,TextEncoder:o}=n(9023);let a=null;function c(){return null!==a&&0!==a.byteLength||(a=new Uint8Array(r.memory.buffer)),a}let l=new s("utf-8",{ignoreBOM:!0,fatal:!0});function h(e,t){return function(e,t){return l.decode(c().subarray(e,e+t))}(e>>>=0,t)}function u(e){const t=typeof e;if("number"==t||"boolean"==t||null==e)return`${e}`;if("string"==t)return`"${e}"`;if("symbol"==t){const t=e.description;return null==t?"Symbol":`Symbol(${t})`}if("function"==t){const t=e.name;return"string"==typeof t&&t.length>0?`Function(${t})`:"Function"}if(Array.isArray(e)){const t=e.length;let n="[";t>0&&(n+=u(e[0]));for(let r=1;r<t;r++)n+=", "+u(e[r]);return n+="]",n}const n=/\[object ([^\]]+)\]/.exec(toString.call(e));let r;if(!(n&&n.length>1))return toString.call(e);if(r=n[1],"Object"==r)try{return"Object("+JSON.stringify(e)+")"}catch(e){return"Object"}return e instanceof Error?`${e.name}: ${e.message}\n${e.stack}`:r}l.decode();let d=0;const f=new o("utf-8"),p="function"==typeof f.encodeInto?function(e,t){return f.encodeInto(e,t)}:function(e,t){const n=f.encode(e);return t.set(n),{read:e.length,written:n.length}};function g(e,t,n){if(void 0===n){const n=f.encode(e),r=t(n.length,1)>>>0;return c().subarray(r,r+n.length).set(n),d=n.length,r}let r=e.length,i=t(r,1)>>>0;const s=c();let o=0;for(;o<r;o++){const t=e.charCodeAt(o);if(t>127)break;s[i+o]=t}if(o!==r){0!==o&&(e=e.slice(o)),i=n(i,r,r=o+3*e.length,1)>>>0;const t=c().subarray(i+o,i+r);o+=p(e,t).written,i=n(i,r,o,1)>>>0}return d=o,i}let m=null;function _(){return(null===m||!0===m.buffer.detached||void 0===m.buffer.detached&&m.buffer!==r.memory.buffer)&&(m=new DataView(r.memory.buffer)),m}function y(e){return null==e}function v(e,t){e>>>=0;const n=_(),i=[];for(let s=e;s<e+4*t;s+=4)i.push(r.__wbindgen_export_2.get(n.getUint32(s,!0)));return r.__externref_drop_slice(e,t),i}function b(e){const t=r.__wbindgen_export_2.get(e);return r.__externref_table_dealloc(e),t}e.exports.cut=function(e,t){const n=g(e,r.__wbindgen_malloc,r.__wbindgen_realloc),i=d,s=r.cut(n,i,y(t)?16777215:t?1:0);var o=v(s[0],s[1]).slice();return r.__wbindgen_free(s[0],4*s[1],4),o},e.exports.cut_all=function(e){const t=g(e,r.__wbindgen_malloc,r.__wbindgen_realloc),n=d,i=r.cut_all(t,n);var s=v(i[0],i[1]).slice();return r.__wbindgen_free(i[0],4*i[1],4),s},e.exports.cut_for_search=function(e,t){const n=g(e,r.__wbindgen_malloc,r.__wbindgen_realloc),i=d,s=r.cut_for_search(n,i,y(t)?16777215:t?1:0);var o=v(s[0],s[1]).slice();return r.__wbindgen_free(s[0],4*s[1],4),o},e.exports.tokenize=function(e,t,n){const i=g(e,r.__wbindgen_malloc,r.__wbindgen_realloc),s=d,o=g(t,r.__wbindgen_malloc,r.__wbindgen_realloc),a=d,c=r.tokenize(i,s,o,a,y(n)?16777215:n?1:0);if(c[3])throw b(c[2]);var l=v(c[0],c[1]).slice();return r.__wbindgen_free(c[0],4*c[1],4),l},e.exports.add_word=function(e,t,n){const i=g(e,r.__wbindgen_malloc,r.__wbindgen_realloc),s=d;var o=y(n)?0:g(n,r.__wbindgen_malloc,r.__wbindgen_realloc),a=d;return r.add_word(i,s,y(t)?4294967297:t>>>0,o,a)>>>0},e.exports.tag=function(e,t){const n=g(e,r.__wbindgen_malloc,r.__wbindgen_realloc),i=d,s=r.tag(n,i,y(t)?16777215:t?1:0);var o=v(s[0],s[1]).slice();return r.__wbindgen_free(s[0],4*s[1],4),o},e.exports.with_dict=function(e){const t=g(e,r.__wbindgen_malloc,r.__wbindgen_realloc),n=d,i=r.with_dict(t,n);if(i[1])throw b(i[0])},e.exports.__wbg_Error_0497d5bdba9362e5=function(e,t){return Error(h(e,t))},e.exports.__wbg_new_07b483f72211fd66=function(){return new Object},e.exports.__wbg_set_3f1d0b984ed272ed=function(e,t,n){e[t]=n},e.exports.__wbindgen_bigint_from_u64=function(e){return BigInt.asUintN(64,e)},e.exports.__wbindgen_debug_string=function(e,t){const n=g(u(t),r.__wbindgen_malloc,r.__wbindgen_realloc),i=d;_().setInt32(e+4,i,!0),_().setInt32(e+0,n,!0)},e.exports.__wbindgen_init_externref_table=function(){const e=r.__wbindgen_export_2,t=e.grow(4);e.set(0,void 0),e.set(t+0,void 0),e.set(t+1,null),e.set(t+2,!0),e.set(t+3,!1)},e.exports.__wbindgen_number_new=function(e){return e},e.exports.__wbindgen_string_new=function(e,t){return h(e,t)},e.exports.__wbindgen_throw=function(e,t){throw new Error(h(e,t))};const E=n(6928).join(__dirname,"jieba_rs_wasm_bg.wasm"),A=n(9896).readFileSync(E),S=new WebAssembly.Module(A),w=new WebAssembly.Instance(S,i);r=w.exports,e.exports.__wasm=r,r.__wbindgen_start()},7533(e,t){!function(e){"use strict";function t(e){return null!==e&&"[object Array]"===Object.prototype.toString.call(e)}function n(e){return null!==e&&"[object Object]"===Object.prototype.toString.call(e)}function r(e,i){if(e===i)return!0;if(Object.prototype.toString.call(e)!==Object.prototype.toString.call(i))return!1;if(!0===t(e)){if(e.length!==i.length)return!1;for(var s=0;s<e.length;s++)if(!1===r(e[s],i[s]))return!1;return!0}if(!0===n(e)){var o={};for(var a in e)if(hasOwnProperty.call(e,a)){if(!1===r(e[a],i[a]))return!1;o[a]=!0}for(var c in i)if(hasOwnProperty.call(i,c)&&!0!==o[c])return!1;return!0}return!1}function i(e){if(""===e||!1===e||null===e)return!0;if(t(e)&&0===e.length)return!0;if(n(e)){for(var r in e)if(e.hasOwnProperty(r))return!1;return!0}return!1}var s;s="function"==typeof String.prototype.trimLeft?function(e){return e.trimLeft()}:function(e){return e.match(/^\s*(.*)/)[1]};var o=0,a=2,c={0:"number",1:"any",2:"string",3:"array",4:"object",5:"boolean",6:"expression",7:"null",8:"Array<number>",9:"Array<string>"},l="EOF",h="UnquotedIdentifier",u="QuotedIdentifier",d="Rbracket",f="Rparen",p="Comma",g="Colon",m="Rbrace",_="Number",y="Current",v="Expref",b="Pipe",E="Or",A="And",S="EQ",w="GT",C="LT",I="GTE",k="LTE",T="NE",R="Flatten",O="Star",N="Filter",P="Dot",B="Not",L="Lbrace",x="Lbracket",D="Lparen",M="Literal",U={".":P,"*":O,",":p,":":g,"{":L,"}":m,"]":d,"(":D,")":f,"@":y},F={"<":!0,">":!0,"=":!0,"!":!0},H={" ":!0,"\t":!0,"\n":!0};function j(e){return e>="a"&&e<="z"||e>="A"&&e<="Z"||"_"===e}function W(e){return e>="0"&&e<="9"||"-"===e}function Q(e){return e>="a"&&e<="z"||e>="A"&&e<="Z"||e>="0"&&e<="9"||"_"===e}function q(){}q.prototype={tokenize:function(e){var t,n,r,i=[];for(this._current=0;this._current<e.length;)if(j(e[this._current]))t=this._current,n=this._consumeUnquotedIdentifier(e),i.push({type:h,value:n,start:t});else if(void 0!==U[e[this._current]])i.push({type:U[e[this._current]],value:e[this._current],start:this._current}),this._current++;else if(W(e[this._current]))r=this._consumeNumber(e),i.push(r);else if("["===e[this._current])r=this._consumeLBracket(e),i.push(r);else if('"'===e[this._current])t=this._current,n=this._consumeQuotedIdentifier(e),i.push({type:u,value:n,start:t});else if("'"===e[this._current])t=this._current,n=this._consumeRawStringLiteral(e),i.push({type:M,value:n,start:t});else if("`"===e[this._current]){t=this._current;var s=this._consumeLiteral(e);i.push({type:M,value:s,start:t})}else if(void 0!==F[e[this._current]])i.push(this._consumeOperator(e));else if(void 0!==H[e[this._current]])this._current++;else if("&"===e[this._current])t=this._current,this._current++,"&"===e[this._current]?(this._current++,i.push({type:A,value:"&&",start:t})):i.push({type:v,value:"&",start:t});else{if("|"!==e[this._current]){var o=new Error("Unknown character:"+e[this._current]);throw o.name="LexerError",o}t=this._current,this._current++,"|"===e[this._current]?(this._current++,i.push({type:E,value:"||",start:t})):i.push({type:b,value:"|",start:t})}return i},_consumeUnquotedIdentifier:function(e){var t=this._current;for(this._current++;this._current<e.length&&Q(e[this._current]);)this._current++;return e.slice(t,this._current)},_consumeQuotedIdentifier:function(e){var t=this._current;this._current++;for(var n=e.length;'"'!==e[this._current]&&this._current<n;){var r=this._current;"\\"!==e[r]||"\\"!==e[r+1]&&'"'!==e[r+1]?r++:r+=2,this._current=r}return this._current++,JSON.parse(e.slice(t,this._current))},_consumeRawStringLiteral:function(e){var t=this._current;this._current++;for(var n=e.length;"'"!==e[this._current]&&this._current<n;){var r=this._current;"\\"!==e[r]||"\\"!==e[r+1]&&"'"!==e[r+1]?r++:r+=2,this._current=r}return this._current++,e.slice(t+1,this._current-1).replace("\\'","'")},_consumeNumber:function(e){var t=this._current;this._current++;for(var n=e.length;W(e[this._current])&&this._current<n;)this._current++;var r=parseInt(e.slice(t,this._current));return{type:_,value:r,start:t}},_consumeLBracket:function(e){var t=this._current;return this._current++,"?"===e[this._current]?(this._current++,{type:N,value:"[?",start:t}):"]"===e[this._current]?(this._current++,{type:R,value:"[]",start:t}):{type:x,value:"[",start:t}},_consumeOperator:function(e){var t=this._current,n=e[t];return this._current++,"!"===n?"="===e[this._current]?(this._current++,{type:T,value:"!=",start:t}):{type:B,value:"!",start:t}:"<"===n?"="===e[this._current]?(this._current++,{type:k,value:"<=",start:t}):{type:C,value:"<",start:t}:">"===n?"="===e[this._current]?(this._current++,{type:I,value:">=",start:t}):{type:w,value:">",start:t}:"="===n&&"="===e[this._current]?(this._current++,{type:S,value:"==",start:t}):void 0},_consumeLiteral:function(e){this._current++;for(var t,n=this._current,r=e.length;"`"!==e[this._current]&&this._current<r;){var i=this._current;"\\"!==e[i]||"\\"!==e[i+1]&&"`"!==e[i+1]?i++:i+=2,this._current=i}var o=s(e.slice(n,this._current));return o=o.replace("\\`","`"),t=this._looksLikeJSON(o)?JSON.parse(o):JSON.parse('"'+o+'"'),this._current++,t},_looksLikeJSON:function(e){if(""===e)return!1;if('[{"'.indexOf(e[0])>=0)return!0;if(["true","false","null"].indexOf(e)>=0)return!0;if(!("-0123456789".indexOf(e[0])>=0))return!1;try{return JSON.parse(e),!0}catch(e){return!1}}};var z={};function $(){}function G(e){this.runtime=e}function K(e){this._interpreter=e,this.functionTable={abs:{_func:this._functionAbs,_signature:[{types:[o]}]},avg:{_func:this._functionAvg,_signature:[{types:[8]}]},ceil:{_func:this._functionCeil,_signature:[{types:[o]}]},contains:{_func:this._functionContains,_signature:[{types:[a,3]},{types:[1]}]},ends_with:{_func:this._functionEndsWith,_signature:[{types:[a]},{types:[a]}]},floor:{_func:this._functionFloor,_signature:[{types:[o]}]},length:{_func:this._functionLength,_signature:[{types:[a,3,4]}]},map:{_func:this._functionMap,_signature:[{types:[6]},{types:[3]}]},max:{_func:this._functionMax,_signature:[{types:[8,9]}]},merge:{_func:this._functionMerge,_signature:[{types:[4],variadic:!0}]},max_by:{_func:this._functionMaxBy,_signature:[{types:[3]},{types:[6]}]},sum:{_func:this._functionSum,_signature:[{types:[8]}]},starts_with:{_func:this._functionStartsWith,_signature:[{types:[a]},{types:[a]}]},min:{_func:this._functionMin,_signature:[{types:[8,9]}]},min_by:{_func:this._functionMinBy,_signature:[{types:[3]},{types:[6]}]},type:{_func:this._functionType,_signature:[{types:[1]}]},keys:{_func:this._functionKeys,_signature:[{types:[4]}]},values:{_func:this._functionValues,_signature:[{types:[4]}]},sort:{_func:this._functionSort,_signature:[{types:[9,8]}]},sort_by:{_func:this._functionSortBy,_signature:[{types:[3]},{types:[6]}]},join:{_func:this._functionJoin,_signature:[{types:[a]},{types:[9]}]},reverse:{_func:this._functionReverse,_signature:[{types:[a,3]}]},to_array:{_func:this._functionToArray,_signature:[{types:[1]}]},to_string:{_func:this._functionToString,_signature:[{types:[1]}]},to_number:{_func:this._functionToNumber,_signature:[{types:[1]}]},not_null:{_func:this._functionNotNull,_signature:[{types:[1],variadic:!0}]}}}z[l]=0,z[h]=0,z[u]=0,z[d]=0,z[f]=0,z[p]=0,z[m]=0,z[_]=0,z[y]=0,z[v]=0,z[b]=1,z[E]=2,z[A]=3,z[S]=5,z[w]=5,z[C]=5,z[I]=5,z[k]=5,z[T]=5,z[R]=9,z[O]=20,z[N]=21,z[P]=40,z[B]=45,z[L]=50,z[x]=55,z[D]=60,$.prototype={parse:function(e){this._loadTokens(e),this.index=0;var t=this.expression(0);if(this._lookahead(0)!==l){var n=this._lookaheadToken(0),r=new Error("Unexpected token type: "+n.type+", value: "+n.value);throw r.name="ParserError",r}return t},_loadTokens:function(e){var t=(new q).tokenize(e);t.push({type:l,value:"",start:e.length}),this.tokens=t},expression:function(e){var t=this._lookaheadToken(0);this._advance();for(var n=this.nud(t),r=this._lookahead(0);e<z[r];)this._advance(),n=this.led(r,n),r=this._lookahead(0);return n},_lookahead:function(e){return this.tokens[this.index+e].type},_lookaheadToken:function(e){return this.tokens[this.index+e]},_advance:function(){this.index++},nud:function(e){var t,n;switch(e.type){case M:return{type:"Literal",value:e.value};case h:return{type:"Field",name:e.value};case u:var r={type:"Field",name:e.value};if(this._lookahead(0)===D)throw new Error("Quoted identifier not allowed for function names.");return r;case B:return{type:"NotExpression",children:[t=this.expression(z.Not)]};case O:return t=null,{type:"ValueProjection",children:[{type:"Identity"},t=this._lookahead(0)===d?{type:"Identity"}:this._parseProjectionRHS(z.Star)]};case N:return this.led(e.type,{type:"Identity"});case L:return this._parseMultiselectHash();case R:return{type:"Projection",children:[{type:R,children:[{type:"Identity"}]},t=this._parseProjectionRHS(z.Flatten)]};case x:return this._lookahead(0)===_||this._lookahead(0)===g?(t=this._parseIndexExpression(),this._projectIfSlice({type:"Identity"},t)):this._lookahead(0)===O&&this._lookahead(1)===d?(this._advance(),this._advance(),{type:"Projection",children:[{type:"Identity"},t=this._parseProjectionRHS(z.Star)]}):this._parseMultiselectList();case y:return{type:y};case v:return{type:"ExpressionReference",children:[n=this.expression(z.Expref)]};case D:for(var i=[];this._lookahead(0)!==f;)this._lookahead(0)===y?(n={type:y},this._advance()):n=this.expression(0),i.push(n);return this._match(f),i[0];default:this._errorToken(e)}},led:function(e,t){var n;switch(e){case P:var r=z.Dot;return this._lookahead(0)!==O?{type:"Subexpression",children:[t,n=this._parseDotRHS(r)]}:(this._advance(),{type:"ValueProjection",children:[t,n=this._parseProjectionRHS(r)]});case b:return n=this.expression(z.Pipe),{type:b,children:[t,n]};case E:return{type:"OrExpression",children:[t,n=this.expression(z.Or)]};case A:return{type:"AndExpression",children:[t,n=this.expression(z.And)]};case D:for(var i,s=t.name,o=[];this._lookahead(0)!==f;)this._lookahead(0)===y?(i={type:y},this._advance()):i=this.expression(0),this._lookahead(0)===p&&this._match(p),o.push(i);return this._match(f),{type:"Function",name:s,children:o};case N:var a=this.expression(0);return this._match(d),{type:"FilterProjection",children:[t,n=this._lookahead(0)===R?{type:"Identity"}:this._parseProjectionRHS(z.Filter),a]};case R:return{type:"Projection",children:[{type:R,children:[t]},this._parseProjectionRHS(z.Flatten)]};case S:case T:case w:case I:case C:case k:return this._parseComparator(t,e);case x:var c=this._lookaheadToken(0);return c.type===_||c.type===g?(n=this._parseIndexExpression(),this._projectIfSlice(t,n)):(this._match(O),this._match(d),{type:"Projection",children:[t,n=this._parseProjectionRHS(z.Star)]});default:this._errorToken(this._lookaheadToken(0))}},_match:function(e){if(this._lookahead(0)!==e){var t=this._lookaheadToken(0),n=new Error("Expected "+e+", got: "+t.type);throw n.name="ParserError",n}this._advance()},_errorToken:function(e){var t=new Error("Invalid token ("+e.type+'): "'+e.value+'"');throw t.name="ParserError",t},_parseIndexExpression:function(){if(this._lookahead(0)===g||this._lookahead(1)===g)return this._parseSliceExpression();var e={type:"Index",value:this._lookaheadToken(0).value};return this._advance(),this._match(d),e},_projectIfSlice:function(e,t){var n={type:"IndexExpression",children:[e,t]};return"Slice"===t.type?{type:"Projection",children:[n,this._parseProjectionRHS(z.Star)]}:n},_parseSliceExpression:function(){for(var e=[null,null,null],t=0,n=this._lookahead(0);n!==d&&t<3;){if(n===g)t++,this._advance();else{if(n!==_){var r=this._lookahead(0),i=new Error("Syntax error, unexpected token: "+r.value+"("+r.type+")");throw i.name="Parsererror",i}e[t]=this._lookaheadToken(0).value,this._advance()}n=this._lookahead(0)}return this._match(d),{type:"Slice",children:e}},_parseComparator:function(e,t){return{type:"Comparator",name:t,children:[e,this.expression(z[t])]}},_parseDotRHS:function(e){var t=this._lookahead(0);return[h,u,O].indexOf(t)>=0?this.expression(e):t===x?(this._match(x),this._parseMultiselectList()):t===L?(this._match(L),this._parseMultiselectHash()):void 0},_parseProjectionRHS:function(e){var t;if(z[this._lookahead(0)]<10)t={type:"Identity"};else if(this._lookahead(0)===x)t=this.expression(e);else if(this._lookahead(0)===N)t=this.expression(e);else{if(this._lookahead(0)!==P){var n=this._lookaheadToken(0),r=new Error("Sytanx error, unexpected token: "+n.value+"("+n.type+")");throw r.name="ParserError",r}this._match(P),t=this._parseDotRHS(e)}return t},_parseMultiselectList:function(){for(var e=[];this._lookahead(0)!==d;){var t=this.expression(0);if(e.push(t),this._lookahead(0)===p&&(this._match(p),this._lookahead(0)===d))throw new Error("Unexpected token Rbracket")}return this._match(d),{type:"MultiSelectList",children:e}},_parseMultiselectHash:function(){for(var e,t,n,r=[],i=[h,u];;){if(e=this._lookaheadToken(0),i.indexOf(e.type)<0)throw new Error("Expecting an identifier token, got: "+e.type);if(t=e.value,this._advance(),this._match(g),n={type:"KeyValuePair",name:t,value:this.expression(0)},r.push(n),this._lookahead(0)===p)this._match(p);else if(this._lookahead(0)===m){this._match(m);break}}return{type:"MultiSelectHash",children:r}}},G.prototype={search:function(e,t){return this.visit(e,t)},visit:function(e,s){var o,a,c,l,h,u,d,f,p;switch(e.type){case"Field":return null!==s&&n(s)?void 0===(u=s[e.name])?null:u:null;case"Subexpression":for(c=this.visit(e.children[0],s),p=1;p<e.children.length;p++)if(null===(c=this.visit(e.children[1],c)))return null;return c;case"IndexExpression":return d=this.visit(e.children[0],s),this.visit(e.children[1],d);case"Index":if(!t(s))return null;var g=e.value;return g<0&&(g=s.length+g),void 0===(c=s[g])&&(c=null),c;case"Slice":if(!t(s))return null;var m=e.children.slice(0),_=this.computeSliceParams(s.length,m),E=_[0],A=_[1],O=_[2];if(c=[],O>0)for(p=E;p<A;p+=O)c.push(s[p]);else for(p=E;p>A;p+=O)c.push(s[p]);return c;case"Projection":var N=this.visit(e.children[0],s);if(!t(N))return null;for(f=[],p=0;p<N.length;p++)null!==(a=this.visit(e.children[1],N[p]))&&f.push(a);return f;case"ValueProjection":if(!n(N=this.visit(e.children[0],s)))return null;f=[];var P=function(e){for(var t=Object.keys(e),n=[],r=0;r<t.length;r++)n.push(e[t[r]]);return n}(N);for(p=0;p<P.length;p++)null!==(a=this.visit(e.children[1],P[p]))&&f.push(a);return f;case"FilterProjection":if(!t(N=this.visit(e.children[0],s)))return null;var B=[],L=[];for(p=0;p<N.length;p++)i(o=this.visit(e.children[2],N[p]))||B.push(N[p]);for(var x=0;x<B.length;x++)null!==(a=this.visit(e.children[1],B[x]))&&L.push(a);return L;case"Comparator":switch(l=this.visit(e.children[0],s),h=this.visit(e.children[1],s),e.name){case S:c=r(l,h);break;case T:c=!r(l,h);break;case w:c=l>h;break;case I:c=l>=h;break;case C:c=l<h;break;case k:c=l<=h;break;default:throw new Error("Unknown comparator: "+e.name)}return c;case R:var D=this.visit(e.children[0],s);if(!t(D))return null;var M=[];for(p=0;p<D.length;p++)t(a=D[p])?M.push.apply(M,a):M.push(a);return M;case"Identity":return s;case"MultiSelectList":if(null===s)return null;for(f=[],p=0;p<e.children.length;p++)f.push(this.visit(e.children[p],s));return f;case"MultiSelectHash":if(null===s)return null;var U;for(f={},p=0;p<e.children.length;p++)f[(U=e.children[p]).name]=this.visit(U.value,s);return f;case"OrExpression":return i(o=this.visit(e.children[0],s))&&(o=this.visit(e.children[1],s)),o;case"AndExpression":return!0===i(l=this.visit(e.children[0],s))?l:this.visit(e.children[1],s);case"NotExpression":return i(l=this.visit(e.children[0],s));case"Literal":return e.value;case b:return d=this.visit(e.children[0],s),this.visit(e.children[1],d);case y:return s;case"Function":var F=[];for(p=0;p<e.children.length;p++)F.push(this.visit(e.children[p],s));return this.runtime.callFunction(e.name,F);case"ExpressionReference":var H=e.children[0];return H.jmespathType=v,H;default:throw new Error("Unknown node type: "+e.type)}},computeSliceParams:function(e,t){var n=t[0],r=t[1],i=t[2],s=[null,null,null];if(null===i)i=1;else if(0===i){var o=new Error("Invalid slice, step cannot be 0");throw o.name="RuntimeError",o}var a=i<0;return n=null===n?a?e-1:0:this.capSliceRange(e,n,i),r=null===r?a?-1:e:this.capSliceRange(e,r,i),s[0]=n,s[1]=r,s[2]=i,s},capSliceRange:function(e,t,n){return t<0?(t+=e)<0&&(t=n<0?-1:0):t>=e&&(t=n<0?e-1:e),t}},K.prototype={callFunction:function(e,t){var n=this.functionTable[e];if(void 0===n)throw new Error("Unknown function: "+e+"()");return this._validateArgs(e,t,n._signature),n._func.call(this,t)},_validateArgs:function(e,t,n){var r,i,s,o;if(n[n.length-1].variadic){if(t.length<n.length)throw r=1===n.length?" argument":" arguments",new Error("ArgumentError: "+e+"() takes at least"+n.length+r+" but received "+t.length)}else if(t.length!==n.length)throw r=1===n.length?" argument":" arguments",new Error("ArgumentError: "+e+"() takes "+n.length+r+" but received "+t.length);for(var a=0;a<n.length;a++){o=!1,i=n[a].types,s=this._getTypeName(t[a]);for(var l=0;l<i.length;l++)if(this._typeMatches(s,i[l],t[a])){o=!0;break}if(!o){var h=i.map(function(e){return c[e]}).join(",");throw new Error("TypeError: "+e+"() expected argument "+(a+1)+" to be type "+h+" but received type "+c[s]+" instead.")}}},_typeMatches:function(e,t,n){if(1===t)return!0;if(9!==t&&8!==t&&3!==t)return e===t;if(3===t)return 3===e;if(3===e){var r;8===t?r=o:9===t&&(r=a);for(var i=0;i<n.length;i++)if(!this._typeMatches(this._getTypeName(n[i]),r,n[i]))return!1;return!0}},_getTypeName:function(e){switch(Object.prototype.toString.call(e)){case"[object String]":return a;case"[object Number]":return o;case"[object Array]":return 3;case"[object Boolean]":return 5;case"[object Null]":return 7;case"[object Object]":return e.jmespathType===v?6:4}},_functionStartsWith:function(e){return 0===e[0].lastIndexOf(e[1])},_functionEndsWith:function(e){var t=e[0],n=e[1];return-1!==t.indexOf(n,t.length-n.length)},_functionReverse:function(e){if(this._getTypeName(e[0])===a){for(var t=e[0],n="",r=t.length-1;r>=0;r--)n+=t[r];return n}var i=e[0].slice(0);return i.reverse(),i},_functionAbs:function(e){return Math.abs(e[0])},_functionCeil:function(e){return Math.ceil(e[0])},_functionAvg:function(e){for(var t=0,n=e[0],r=0;r<n.length;r++)t+=n[r];return t/n.length},_functionContains:function(e){return e[0].indexOf(e[1])>=0},_functionFloor:function(e){return Math.floor(e[0])},_functionLength:function(e){return n(e[0])?Object.keys(e[0]).length:e[0].length},_functionMap:function(e){for(var t=[],n=this._interpreter,r=e[0],i=e[1],s=0;s<i.length;s++)t.push(n.visit(r,i[s]));return t},_functionMerge:function(e){for(var t={},n=0;n<e.length;n++){var r=e[n];for(var i in r)t[i]=r[i]}return t},_functionMax:function(e){if(e[0].length>0){if(this._getTypeName(e[0][0])===o)return Math.max.apply(Math,e[0]);for(var t=e[0],n=t[0],r=1;r<t.length;r++)n.localeCompare(t[r])<0&&(n=t[r]);return n}return null},_functionMin:function(e){if(e[0].length>0){if(this._getTypeName(e[0][0])===o)return Math.min.apply(Math,e[0]);for(var t=e[0],n=t[0],r=1;r<t.length;r++)t[r].localeCompare(n)<0&&(n=t[r]);return n}return null},_functionSum:function(e){for(var t=0,n=e[0],r=0;r<n.length;r++)t+=n[r];return t},_functionType:function(e){switch(this._getTypeName(e[0])){case o:return"number";case a:return"string";case 3:return"array";case 4:return"object";case 5:return"boolean";case 6:return"expref";case 7:return"null"}},_functionKeys:function(e){return Object.keys(e[0])},_functionValues:function(e){for(var t=e[0],n=Object.keys(t),r=[],i=0;i<n.length;i++)r.push(t[n[i]]);return r},_functionJoin:function(e){var t=e[0];return e[1].join(t)},_functionToArray:function(e){return 3===this._getTypeName(e[0])?e[0]:[e[0]]},_functionToString:function(e){return this._getTypeName(e[0])===a?e[0]:JSON.stringify(e[0])},_functionToNumber:function(e){var t,n=this._getTypeName(e[0]);return n===o?e[0]:n!==a||(t=+e[0],isNaN(t))?null:t},_functionNotNull:function(e){for(var t=0;t<e.length;t++)if(7!==this._getTypeName(e[t]))return e[t];return null},_functionSort:function(e){var t=e[0].slice(0);return t.sort(),t},_functionSortBy:function(e){var t=e[0].slice(0);if(0===t.length)return t;var n=this._interpreter,r=e[1],i=this._getTypeName(n.visit(r,t[0]));if([o,a].indexOf(i)<0)throw new Error("TypeError");for(var s=this,c=[],l=0;l<t.length;l++)c.push([l,t[l]]);c.sort(function(e,t){var o=n.visit(r,e[1]),a=n.visit(r,t[1]);if(s._getTypeName(o)!==i)throw new Error("TypeError: expected "+i+", received "+s._getTypeName(o));if(s._getTypeName(a)!==i)throw new Error("TypeError: expected "+i+", received "+s._getTypeName(a));return o>a?1:o<a?-1:e[0]-t[0]});for(var h=0;h<c.length;h++)t[h]=c[h][1];return t},_functionMaxBy:function(e){for(var t,n,r=e[1],i=e[0],s=this.createKeyFunction(r,[o,a]),c=-1/0,l=0;l<i.length;l++)(n=s(i[l]))>c&&(c=n,t=i[l]);return t},_functionMinBy:function(e){for(var t,n,r=e[1],i=e[0],s=this.createKeyFunction(r,[o,a]),c=1/0,l=0;l<i.length;l++)(n=s(i[l]))<c&&(c=n,t=i[l]);return t},createKeyFunction:function(e,t){var n=this,r=this._interpreter;return function(i){var s=r.visit(e,i);if(t.indexOf(n._getTypeName(s))<0){var o="TypeError: expected one of "+t+", received "+n._getTypeName(s);throw new Error(o)}return s}}},e.tokenize=function(e){return(new q).tokenize(e)},e.compile=function(e){return(new $).parse(e)},e.search=function(e,t){var n=new $,r=new K,i=new G(r);r._interpreter=i;var s=n.parse(t);return i.search(s,e)},e.strictDeepEqual=r}(t)},2028(e){var t="[object Symbol]",n=/[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g,r=/[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g,i="\\ud800-\\udfff",s="\\u0300-\\u036f\\ufe20-\\ufe23",o="\\u20d0-\\u20f0",a="\\u2700-\\u27bf",c="a-z\\xdf-\\xf6\\xf8-\\xff",l="A-Z\\xc0-\\xd6\\xd8-\\xde",h="\\ufe0e\\ufe0f",u="\\xac\\xb1\\xd7\\xf7\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf\\u2000-\\u206f \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000",d="['’]",f="["+i+"]",p="["+u+"]",g="["+s+o+"]",m="\\d+",_="["+a+"]",y="["+c+"]",v="[^"+i+u+m+a+c+l+"]",b="\\ud83c[\\udffb-\\udfff]",E="[^"+i+"]",A="(?:\\ud83c[\\udde6-\\uddff]){2}",S="[\\ud800-\\udbff][\\udc00-\\udfff]",w="["+l+"]",C="\\u200d",I="(?:"+y+"|"+v+")",k="(?:"+w+"|"+v+")",T="(?:['’](?:d|ll|m|re|s|t|ve))?",R="(?:['’](?:D|LL|M|RE|S|T|VE))?",O="(?:"+g+"|"+b+")"+"?",N="["+h+"]?",P=N+O+("(?:"+C+"(?:"+[E,A,S].join("|")+")"+N+O+")*"),B="(?:"+[_,A,S].join("|")+")"+P,L="(?:"+[E+g+"?",g,A,S,f].join("|")+")",x=RegExp(d,"g"),D=RegExp(g,"g"),M=RegExp(b+"(?="+b+")|"+L+P,"g"),U=RegExp([w+"?"+y+"+"+T+"(?="+[p,w,"$"].join("|")+")",k+"+"+R+"(?="+[p,w+I,"$"].join("|")+")",w+"?"+I+"+"+T,w+"+"+R,m,B].join("|"),"g"),F=RegExp("["+C+i+s+o+h+"]"),H=/[a-z][A-Z]|[A-Z]{2,}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/,j="object"==typeof global&&global&&global.Object===Object&&global,W="object"==typeof self&&self&&self.Object===Object&&self,Q=j||W||Function("return this")();var q,z=(q={À:"A",Á:"A",Â:"A",Ã:"A",Ä:"A",Å:"A",à:"a",á:"a",â:"a",ã:"a",ä:"a",å:"a",Ç:"C",ç:"c",Ð:"D",ð:"d",È:"E",É:"E",Ê:"E",Ë:"E",è:"e",é:"e",ê:"e",ë:"e",Ì:"I",Í:"I",Î:"I",Ï:"I",ì:"i",í:"i",î:"i",ï:"i",Ñ:"N",ñ:"n",Ò:"O",Ó:"O",Ô:"O",Õ:"O",Ö:"O",Ø:"O",ò:"o",ó:"o",ô:"o",õ:"o",ö:"o",ø:"o",Ù:"U",Ú:"U",Û:"U",Ü:"U",ù:"u",ú:"u",û:"u",ü:"u",Ý:"Y",ý:"y",ÿ:"y",Æ:"Ae",æ:"ae",Þ:"Th",þ:"th",ß:"ss",Ā:"A",Ă:"A",Ą:"A",ā:"a",ă:"a",ą:"a",Ć:"C",Ĉ:"C",Ċ:"C",Č:"C",ć:"c",ĉ:"c",ċ:"c",č:"c",Ď:"D",Đ:"D",ď:"d",đ:"d",Ē:"E",Ĕ:"E",Ė:"E",Ę:"E",Ě:"E",ē:"e",ĕ:"e",ė:"e",ę:"e",ě:"e",Ĝ:"G",Ğ:"G",Ġ:"G",Ģ:"G",ĝ:"g",ğ:"g",ġ:"g",ģ:"g",Ĥ:"H",Ħ:"H",ĥ:"h",ħ:"h",Ĩ:"I",Ī:"I",Ĭ:"I",Į:"I",İ:"I",ĩ:"i",ī:"i",ĭ:"i",į:"i",ı:"i",Ĵ:"J",ĵ:"j",Ķ:"K",ķ:"k",ĸ:"k",Ĺ:"L",Ļ:"L",Ľ:"L",Ŀ:"L",Ł:"L",ĺ:"l",ļ:"l",ľ:"l",ŀ:"l",ł:"l",Ń:"N",Ņ:"N",Ň:"N",Ŋ:"N",ń:"n",ņ:"n",ň:"n",ŋ:"n",Ō:"O",Ŏ:"O",Ő:"O",ō:"o",ŏ:"o",ő:"o",Ŕ:"R",Ŗ:"R",Ř:"R",ŕ:"r",ŗ:"r",ř:"r",Ś:"S",Ŝ:"S",Ş:"S",Š:"S",ś:"s",ŝ:"s",ş:"s",š:"s",Ţ:"T",Ť:"T",Ŧ:"T",ţ:"t",ť:"t",ŧ:"t",Ũ:"U",Ū:"U",Ŭ:"U",Ů:"U",Ű:"U",Ų:"U",ũ:"u",ū:"u",ŭ:"u",ů:"u",ű:"u",ų:"u",Ŵ:"W",ŵ:"w",Ŷ:"Y",ŷ:"y",Ÿ:"Y",Ź:"Z",Ż:"Z",Ž:"Z",ź:"z",ż:"z",ž:"z",IJ:"IJ",ij:"ij",Œ:"Oe",œ:"oe",ʼn:"'n",ſ:"ss"},function(e){return null==q?void 0:q[e]});function $(e){return F.test(e)}function G(e){return $(e)?function(e){return e.match(M)||[]}(e):function(e){return e.split("")}(e)}var K=Object.prototype.toString,Y=Q.Symbol,V=Y?Y.prototype:void 0,X=V?V.toString:void 0;function J(e){if("string"==typeof e)return e;if(function(e){return"symbol"==typeof e||function(e){return!!e&&"object"==typeof e}(e)&&K.call(e)==t}(e))return X?X.call(e):"";var n=e+"";return"0"==n&&1/e==-1/0?"-0":n}function Z(e,t,n){var r=e.length;return n=void 0===n?r:n,!t&&n>=r?e:function(e,t,n){var r=-1,i=e.length;t<0&&(t=-t>i?0:i+t),(n=n>i?i:n)<0&&(n+=i),i=t>n?0:n-t>>>0,t>>>=0;for(var s=Array(i);++r<i;)s[r]=e[r+t];return s}(e,t,n)}function ee(e){return null==e?"":J(e)}var te,ne=(te=function(e,t,n){return t=t.toLowerCase(),e+(n?ie(ee(t).toLowerCase()):t)},function(e){return function(e,t,n,r){var i=-1,s=e?e.length:0;for(r&&s&&(n=e[++i]);++i<s;)n=t(n,e[i],i,e);return n}(function(e,t,r){return e=ee(e),void 0===(t=r?void 0:t)?function(e){return H.test(e)}(e)?function(e){return e.match(U)||[]}(e):function(e){return e.match(n)||[]}(e):e.match(t)||[]}(function(e){return(e=ee(e))&&e.replace(r,z).replace(D,"")}(e).replace(x,"")),te,"")});var re,ie=(re="toUpperCase",function(e){var t=$(e=ee(e))?G(e):void 0,n=t?t[0]:e.charAt(0),r=t?Z(t,1).join(""):e.slice(1);return n[re]()+r});e.exports=ne},9505(e,t,n){var r=n(6928),i=n(9896),s=parseInt("0777",8);function o(e,t,n,a){"function"==typeof t?(n=t,t={}):t&&"object"==typeof t||(t={mode:t});var c=t.mode,l=t.fs||i;void 0===c&&(c=s&~process.umask()),a||(a=null);var h=n||function(){};e=r.resolve(e),l.mkdir(e,c,function(n){if(!n)return h(null,a=a||e);if("ENOENT"===n.code)o(r.dirname(e),t,function(n,r){n?h(n,r):o(e,t,h,r)});else l.stat(e,function(e,t){e||!t.isDirectory()?h(n,a):h(null,a)})})}e.exports=o.mkdirp=o.mkdirP=o,o.sync=function e(t,n,o){n&&"object"==typeof n||(n={mode:n});var a=n.mode,c=n.fs||i;void 0===a&&(a=s&~process.umask()),o||(o=null),t=r.resolve(t);try{c.mkdirSync(t,a),o=o||t}catch(i){if("ENOENT"===i.code)o=e(r.dirname(t),n,o),e(t,n,o);else{var l;try{l=c.statSync(t)}catch(e){throw i}if(!l.isDirectory())throw i}}return o}},2545(e,t,n){e=n.nmd(e);try{process.dlopen(e,n(6928).join(__dirname,n.p,"node_modules/@xiaobaidadada/node-pty-prebuilt/build/Release/conpty.node"))}catch(e){throw new Error("node-loader:\n"+e)}},8636(e,t,n){e=n.nmd(e);try{process.dlopen(e,n(6928).join(__dirname,n.p,"node_modules/@xiaobaidadada/node-pty-prebuilt/build/Release/conpty_console_list.node"))}catch(e){throw new Error("node-loader:\n"+e)}},5053(e,t,n){e=n.nmd(e);try{process.dlopen(e,n(6928).join(__dirname,n.p,"node_modules/@xiaobaidadada/node-pty-prebuilt/build/Release/pty.node"))}catch(e){throw new Error("node-loader:\n"+e)}},6789(e,t,n){e=n.nmd(e);try{process.dlopen(e,n(6928).join(__dirname,n.p,"node_modules/@xiaobaidadada/node-tuntap2-wintun/build/Release/tuntap2Addon.node"))}catch(e){throw new Error("node-loader:\n"+e)}},4215(e,t,n){e=n.nmd(e);try{process.dlopen(e,n(6928).join(__dirname,n.p,"node_modules/@xiaobaidadada/ssh2-prebuilt/build/Release/sshcrypto.node"))}catch(e){throw new Error("node-loader:\n"+e)}},3962(e,t,n){e=n.nmd(e);try{process.dlopen(e,n(6928).join(__dirname,n.p,"node_modules/cpu-features/build/Release/cpufeatures.node"))}catch(e){throw new Error("node-loader:\n"+e)}},8345(e,t,n){e=n.nmd(e);try{process.dlopen(e,n(6928).join(__dirname,n.p,"node_modules/node-process-watcher/build/Release/node-process-watcher.node"))}catch(e){throw new Error("node-loader:\n"+e)}},6744(e,t,n){e=n.nmd(e);try{process.dlopen(e,n(6928).join(__dirname,n.p,"node_modules/sqlite3/build/Release/node_sqlite3.node"))}catch(e){throw new Error("node-loader:\n"+e)}},5273(e,t,n){const r=n(8345);e.exports.node_process_watcher=r},3519(e,t,n){var r=n(6587);function i(e){var t=function(){return t.called?t.value:(t.called=!0,t.value=e.apply(this,arguments))};return t.called=!1,t}function s(e){var t=function(){if(t.called)throw new Error(t.onceError);return t.called=!0,t.value=e.apply(this,arguments)},n=e.name||"Function wrapped with `once`";return t.onceError=n+" shouldn't be called more than once",t.called=!1,t}e.exports=r(i),e.exports.strict=r(s),i.proto=i(function(){Object.defineProperty(Function.prototype,"once",{value:function(){return i(this)},configurable:!0}),Object.defineProperty(Function.prototype,"onceStrict",{value:function(){return s(this)},configurable:!0})})},5407(e,t,n){"use strict";var r=n(2549);e.exports=t=r.descriptor=r.Root.fromJSON(n(3951)).lookup(".google.protobuf");var i=r.Namespace,s=r.Root,o=r.Enum,a=r.Type,c=r.Field,l=r.MapField,h=r.OneOf,u=r.Service,d=r.Method;function f(e,n,r){var l=t.FileDescriptorProto.create({name:e.filename||(e.fullName.substring(1).replace(/\./g,"_")||"root")+".proto"});!function(e,n){if(!e)return;if("proto2"===e||"proto3"===e)n.syntax=e;else{if(n.syntax="editions","2023"!==e)throw new Error("Unsupported edition "+e);n.edition=t.Edition.EDITION_2023}}(r,l),e instanceof s||(l.package=e.fullName.substring(1));for(var h,d=0;d<e.nestedArray.length;++d)(h=e._nestedArray[d])instanceof a?l.messageType.push(h.toDescriptor(r)):h instanceof o?l.enumType.push(h.toDescriptor()):h instanceof c?l.extension.push(h.toDescriptor(r)):h instanceof u?l.service.push(h.toDescriptor()):h instanceof i&&f(h,n,r);l.options=w(e.options,t.FileOptions),l.messageType.length+l.enumType.length+l.extension.length+l.service.length&&n.push(l)}s.fromDescriptor=function(e){"number"==typeof e.length&&(e=t.FileDescriptorSet.decode(e));var n=new s;if(e.file)for(var r,i,l,h=0;h<e.file.length;++h){i=n,(r=e.file[h]).package&&r.package.length&&(i=n.define(r.package));var d=k(r);if(r.name&&r.name.length&&n.files.push(i.filename=r.name),r.messageType)for(l=0;l<r.messageType.length;++l)i.add(a.fromDescriptor(r.messageType[l],d));if(r.enumType)for(l=0;l<r.enumType.length;++l)i.add(o.fromDescriptor(r.enumType[l],d));if(r.extension)for(l=0;l<r.extension.length;++l)i.add(c.fromDescriptor(r.extension[l],d));if(r.service)for(l=0;l<r.service.length;++l)i.add(u.fromDescriptor(r.service[l],d));var f=A(r.options,t.FileOptions);if(f){var p=Object.keys(f);for(l=0;l<p.length;++l)i.setOption(p[l],f[p[l]])}}return n.resolveAll()},s.prototype.toDescriptor=function(e){var n=t.FileDescriptorSet.create();return f(this,n.file,e),n};var p=0;a.fromDescriptor=function(e,n,r){"number"==typeof e.length&&(e=t.DescriptorProto.decode(e));var i,s=new a(e.name.length?e.name:"Type"+p++,A(e.options,t.MessageOptions));if(r||(s._edition=n),e.oneofDecl)for(i=0;i<e.oneofDecl.length;++i)s.add(h.fromDescriptor(e.oneofDecl[i]));if(e.field)for(i=0;i<e.field.length;++i){var l=c.fromDescriptor(e.field[i],n,!0);s.add(l),e.field[i].hasOwnProperty("oneofIndex")&&s.oneofsArray[e.field[i].oneofIndex].add(l)}if(e.extension)for(i=0;i<e.extension.length;++i)s.add(c.fromDescriptor(e.extension[i],n,!0));if(e.nestedType)for(i=0;i<e.nestedType.length;++i)s.add(a.fromDescriptor(e.nestedType[i],n,!0)),e.nestedType[i].options&&e.nestedType[i].options.mapEntry&&s.setOption("map_entry",!0);if(e.enumType)for(i=0;i<e.enumType.length;++i)s.add(o.fromDescriptor(e.enumType[i],n,!0));if(e.extensionRange&&e.extensionRange.length)for(s.extensions=[],i=0;i<e.extensionRange.length;++i)s.extensions.push([e.extensionRange[i].start,e.extensionRange[i].end]);if(e.reservedRange&&e.reservedRange.length||e.reservedName&&e.reservedName.length){if(s.reserved=[],e.reservedRange)for(i=0;i<e.reservedRange.length;++i)s.reserved.push([e.reservedRange[i].start,e.reservedRange[i].end]);if(e.reservedName)for(i=0;i<e.reservedName.length;++i)s.reserved.push(e.reservedName[i])}return s},a.prototype.toDescriptor=function(e){var n,r=t.DescriptorProto.create({name:this.name});for(n=0;n<this.fieldsArray.length;++n){var i;if(r.field.push(i=this._fieldsArray[n].toDescriptor(e)),this._fieldsArray[n]instanceof l){var s=b(this._fieldsArray[n].keyType,this._fieldsArray[n].resolvedKeyType,!1),h=b(this._fieldsArray[n].type,this._fieldsArray[n].resolvedType,!1),u=11===h||14===h?this._fieldsArray[n].resolvedType&&C(this.parent,this._fieldsArray[n].resolvedType)||this._fieldsArray[n].type:void 0;r.nestedType.push(t.DescriptorProto.create({name:i.typeName,field:[t.FieldDescriptorProto.create({name:"key",number:1,label:1,type:s}),t.FieldDescriptorProto.create({name:"value",number:2,label:1,type:h,typeName:u})],options:t.MessageOptions.create({mapEntry:!0})}))}}for(n=0;n<this.oneofsArray.length;++n)r.oneofDecl.push(this._oneofsArray[n].toDescriptor());for(n=0;n<this.nestedArray.length;++n)this._nestedArray[n]instanceof c?r.field.push(this._nestedArray[n].toDescriptor(e)):this._nestedArray[n]instanceof a?r.nestedType.push(this._nestedArray[n].toDescriptor(e)):this._nestedArray[n]instanceof o&&r.enumType.push(this._nestedArray[n].toDescriptor());if(this.extensions)for(n=0;n<this.extensions.length;++n)r.extensionRange.push(t.DescriptorProto.ExtensionRange.create({start:this.extensions[n][0],end:this.extensions[n][1]}));if(this.reserved)for(n=0;n<this.reserved.length;++n)"string"==typeof this.reserved[n]?r.reservedName.push(this.reserved[n]):r.reservedRange.push(t.DescriptorProto.ReservedRange.create({start:this.reserved[n][0],end:this.reserved[n][1]}));return r.options=w(this.options,t.MessageOptions),r};var g=/^(?![eE])[0-9]*(?:\.[0-9]*)?(?:[eE][+-]?[0-9]+)?$/;c.fromDescriptor=function(e,n,r){if("number"==typeof e.length&&(e=t.DescriptorProto.decode(e)),"number"!=typeof e.number)throw Error("missing field id");var i,s;switch(i=e.typeName&&e.typeName.length?e.typeName:function(e){switch(e){case 1:return"double";case 2:return"float";case 3:return"int64";case 4:return"uint64";case 5:return"int32";case 6:return"fixed64";case 7:return"fixed32";case 8:return"bool";case 9:return"string";case 12:return"bytes";case 13:return"uint32";case 15:return"sfixed32";case 16:return"sfixed64";case 17:return"sint32";case 18:return"sint64"}throw Error("illegal type: "+e)}(e.type),e.label){case 1:s=void 0;break;case 2:s="required";break;case 3:s="repeated";break;default:throw Error("illegal label: "+e.label)}var o=e.extendee;void 0!==e.extendee&&(o=o.length?o:void 0);var a=new c(e.name.length?e.name:"field"+e.number,e.number,i,s,o);if(r||(a._edition=n),a.options=A(e.options,t.FieldOptions),e.proto3_optional&&(a.options.proto3_optional=!0),e.defaultValue&&e.defaultValue.length){var l=e.defaultValue;switch(l){case"true":case"TRUE":l=!0;break;case"false":case"FALSE":l=!1;break;default:g.exec(l)&&(l=parseInt(l))}a.setOption("default",l)}return function(e){switch(e){case 1:case 2:case 3:case 4:case 5:case 6:case 7:case 8:case 13:case 14:case 15:case 16:case 17:case 18:return!0}return!1}(e.type)&&("proto3"===n?e.options&&!e.options.packed&&a.setOption("packed",!1):n&&"proto2"!==n||!e.options||!e.options.packed||a.setOption("packed",!0)),a},c.prototype.toDescriptor=function(e){var n=t.FieldDescriptorProto.create({name:this.name,number:this.id});if(this.map)n.type=11,n.typeName=r.util.ucFirst(this.name),n.label=3;else{switch(n.type=b(this.type,this.resolve().resolvedType,this.delimited)){case 10:case 11:case 14:n.typeName=this.resolvedType?C(this.parent,this.resolvedType):this.type}"repeated"===this.rule?n.label=3:this.required&&"proto2"===e?n.label=2:n.label=1}if(n.extendee=this.extensionField?this.extensionField.parent.fullName:this.extend,this.partOf&&(n.oneofIndex=this.parent.oneofsArray.indexOf(this.partOf))<0)throw Error("missing oneof");return this.options&&(n.options=w(this.options,t.FieldOptions),null!=this.options.default&&(n.defaultValue=String(this.options.default)),this.options.proto3_optional&&(n.proto3_optional=!0)),"proto3"===e?this.packed||((n.options||(n.options=t.FieldOptions.create())).packed=!1):e&&"proto2"!==e||!this.packed||((n.options||(n.options=t.FieldOptions.create())).packed=!0),n};var m=0;o.fromDescriptor=function(e,n,r){"number"==typeof e.length&&(e=t.EnumDescriptorProto.decode(e));var i={};if(e.value)for(var s=0;s<e.value.length;++s){var a=e.value[s].name,c=e.value[s].number||0;i[a&&a.length?a:"NAME"+c]=c}var l=new o(e.name&&e.name.length?e.name:"Enum"+m++,i,A(e.options,t.EnumOptions));return r||(l._edition=n),l},o.prototype.toDescriptor=function(){for(var e=[],n=0,r=Object.keys(this.values);n<r.length;++n)e.push(t.EnumValueDescriptorProto.create({name:r[n],number:this.values[r[n]]}));return t.EnumDescriptorProto.create({name:this.name,value:e,options:w(this.options,t.EnumOptions)})};var _=0;h.fromDescriptor=function(e){return"number"==typeof e.length&&(e=t.OneofDescriptorProto.decode(e)),new h(e.name&&e.name.length?e.name:"oneof"+_++)},h.prototype.toDescriptor=function(){return t.OneofDescriptorProto.create({name:this.name})};var y=0;u.fromDescriptor=function(e,n,r){"number"==typeof e.length&&(e=t.ServiceDescriptorProto.decode(e));var i=new u(e.name&&e.name.length?e.name:"Service"+y++,A(e.options,t.ServiceOptions));if(r||(i._edition=n),e.method)for(var s=0;s<e.method.length;++s)i.add(d.fromDescriptor(e.method[s]));return i},u.prototype.toDescriptor=function(){for(var e=[],n=0;n<this.methodsArray.length;++n)e.push(this._methodsArray[n].toDescriptor());return t.ServiceDescriptorProto.create({name:this.name,method:e,options:w(this.options,t.ServiceOptions)})};var v=0;function b(e,t,n){switch(e){case"double":return 1;case"float":return 2;case"int64":return 3;case"uint64":return 4;case"int32":return 5;case"fixed64":return 6;case"fixed32":return 7;case"bool":return 8;case"string":return 9;case"bytes":return 12;case"uint32":return 13;case"sfixed32":return 15;case"sfixed64":return 16;case"sint32":return 17;case"sint64":return 18}if(t instanceof o)return 14;if(t instanceof a)return n?10:11;throw Error("illegal type: "+e)}function E(e,t){for(var n,r,i={},s=0;s<t.fieldsArray.length;++s)if("uninterpretedOption"!==(r=(n=t._fieldsArray[s]).name)&&Object.prototype.hasOwnProperty.call(e,r)){var c=I(r);n.resolvedType instanceof a?i[c]=E(e[r],n.resolvedType):n.resolvedType instanceof o?i[c]=n.resolvedType.valuesById[e[r]]:i[c]=e[r]}return i}function A(e,t){if(e)return E(t.toObject(e),t)}function S(e,t){for(var n={},i=Object.keys(e),s=0;s<i.length;++s){var o=i[s],c=r.util.camelCase(o);if(Object.prototype.hasOwnProperty.call(t.fields,c)){var l=t.fields[c];l.resolvedType instanceof a?n[c]=S(e[o],l.resolvedType):n[c]=e[o],l.repeated&&!Array.isArray(n[c])&&(n[c]=[n[c]])}}return n}function w(e,t){if(e)return t.fromObject(S(e,t))}function C(e,t){var n=e.fullName.split("."),r=t.fullName.split("."),o=0,a=0,c=r.length-1;if(!(e instanceof s)&&t instanceof i)for(;o<n.length&&a<c&&n[o]===r[a];){var l=t.lookup(n[o++],!0);if(null!==l&&l!==t)break;++a}else for(;o<n.length&&a<c&&n[o]===r[a];++o,++a);return r.slice(a).join(".")}function I(e){return e.substring(0,1)+e.substring(1).replace(/([A-Z])(?=[a-z]|$)/g,function(e,t){return"_"+t.toLowerCase()})}function k(e){if("editions"===e.syntax){if(e.edition===t.Edition.EDITION_2023)return"2023";throw new Error("Unsupported edition "+e.edition)}return"proto3"===e.syntax?"proto3":"proto2"}d.fromDescriptor=function(e){return"number"==typeof e.length&&(e=t.MethodDescriptorProto.decode(e)),new d(e.name&&e.name.length?e.name:"Method"+v++,"rpc",e.inputType,e.outputType,Boolean(e.clientStreaming),Boolean(e.serverStreaming),A(e.options,t.MethodOptions))},d.prototype.toDescriptor=function(){return t.MethodDescriptorProto.create({name:this.name,inputType:this.resolvedRequestType?this.resolvedRequestType.fullName:this.requestType,outputType:this.resolvedResponseType?this.resolvedResponseType.fullName:this.responseType,clientStreaming:this.requestStream,serverStreaming:this.responseStream,options:w(this.options,t.MethodOptions)})}},2549(e,t,n){"use strict";e.exports=n(9100)},5095(e){"use strict";e.exports=r;var t,n=/\/|\./;function r(e,t){n.test(e)||(e="google/protobuf/"+e+".proto",t={nested:{google:{nested:{protobuf:{nested:t}}}}}),r[e]=t}r("any",{Any:{fields:{type_url:{type:"string",id:1},value:{type:"bytes",id:2}}}}),r("duration",{Duration:t={fields:{seconds:{type:"int64",id:1},nanos:{type:"int32",id:2}}}}),r("timestamp",{Timestamp:t}),r("empty",{Empty:{fields:{}}}),r("struct",{Struct:{fields:{fields:{keyType:"string",type:"Value",id:1}}},Value:{oneofs:{kind:{oneof:["nullValue","numberValue","stringValue","boolValue","structValue","listValue"]}},fields:{nullValue:{type:"NullValue",id:1},numberValue:{type:"double",id:2},stringValue:{type:"string",id:3},boolValue:{type:"bool",id:4},structValue:{type:"Struct",id:5},listValue:{type:"ListValue",id:6}}},NullValue:{values:{NULL_VALUE:0}},ListValue:{fields:{values:{rule:"repeated",type:"Value",id:1}}}}),r("wrappers",{DoubleValue:{fields:{value:{type:"double",id:1}}},FloatValue:{fields:{value:{type:"float",id:1}}},Int64Value:{fields:{value:{type:"int64",id:1}}},UInt64Value:{fields:{value:{type:"uint64",id:1}}},Int32Value:{fields:{value:{type:"int32",id:1}}},UInt32Value:{fields:{value:{type:"uint32",id:1}}},BoolValue:{fields:{value:{type:"bool",id:1}}},StringValue:{fields:{value:{type:"string",id:1}}},BytesValue:{fields:{value:{type:"bytes",id:1}}}}),r("field_mask",{FieldMask:{fields:{paths:{rule:"repeated",type:"string",id:1}}}}),r.get=function(e){return r[e]||null}},744(e,t,n){"use strict";var r=t,i=n(5643),s=n(3262);function o(e,t,n,r){var s=!1;if(t.resolvedType)if(t.resolvedType instanceof i){e("switch(d%s){",r);for(var o=t.resolvedType.values,a=Object.keys(o),c=0;c<a.length;++c)o[a[c]]!==t.typeDefault||s||(e("default:")('if(typeof(d%s)==="number"){m%s=d%s;break}',r,r,r),t.repeated||e("break"),s=!0),e("case%j:",a[c])("case %i:",o[a[c]])("m%s=%j",r,o[a[c]])("break");e("}")}else e('if(typeof d%s!=="object")',r)("throw TypeError(%j)",t.fullName+": object expected")("m%s=types[%i].fromObject(d%s)",r,n,r);else{var l=!1;switch(t.type){case"double":case"float":e("m%s=Number(d%s)",r,r);break;case"uint32":case"fixed32":e("m%s=d%s>>>0",r,r);break;case"int32":case"sint32":case"sfixed32":e("m%s=d%s|0",r,r);break;case"uint64":l=!0;case"int64":case"sint64":case"fixed64":case"sfixed64":e("if(util.Long)")("(m%s=util.Long.fromValue(d%s)).unsigned=%j",r,r,l)('else if(typeof d%s==="string")',r)("m%s=parseInt(d%s,10)",r,r)('else if(typeof d%s==="number")',r)("m%s=d%s",r,r)('else if(typeof d%s==="object")',r)("m%s=new util.LongBits(d%s.low>>>0,d%s.high>>>0).toNumber(%s)",r,r,r,l?"true":"");break;case"bytes":e('if(typeof d%s==="string")',r)("util.base64.decode(d%s,m%s=util.newBuffer(util.base64.length(d%s)),0)",r,r,r)("else if(d%s.length >= 0)",r)("m%s=d%s",r,r);break;case"string":e("m%s=String(d%s)",r,r);break;case"bool":e("m%s=Boolean(d%s)",r,r)}}return e}function a(e,t,n,r){if(t.resolvedType)t.resolvedType instanceof i?e("d%s=o.enums===String?(types[%i].values[m%s]===undefined?m%s:types[%i].values[m%s]):m%s",r,n,r,r,n,r,r):e("d%s=types[%i].toObject(m%s,o)",r,n,r);else{var s=!1;switch(t.type){case"double":case"float":e("d%s=o.json&&!isFinite(m%s)?String(m%s):m%s",r,r,r,r);break;case"uint64":s=!0;case"int64":case"sint64":case"fixed64":case"sfixed64":e('if(typeof m%s==="number")',r)("d%s=o.longs===String?String(m%s):m%s",r,r,r)("else")("d%s=o.longs===String?util.Long.prototype.toString.call(m%s):o.longs===Number?new util.LongBits(m%s.low>>>0,m%s.high>>>0).toNumber(%s):m%s",r,r,r,r,s?"true":"",r);break;case"bytes":e("d%s=o.bytes===String?util.base64.encode(m%s,0,m%s.length):o.bytes===Array?Array.prototype.slice.call(m%s):m%s",r,r,r,r,r);break;default:e("d%s=m%s",r,r)}}return e}r.fromObject=function(e){var t=e.fieldsArray,n=s.codegen(["d"],e.name+"$fromObject")("if(d instanceof this.ctor)")("return d");if(!t.length)return n("return new this.ctor");n("var m=new this.ctor");for(var r=0;r<t.length;++r){var a=t[r].resolve(),c=s.safeProp(a.name);a.map?(n("if(d%s){",c)('if(typeof d%s!=="object")',c)("throw TypeError(%j)",a.fullName+": object expected")("m%s={}",c)("for(var ks=Object.keys(d%s),i=0;i<ks.length;++i){",c),o(n,a,r,c+"[ks[i]]")("}")("}")):a.repeated?(n("if(d%s){",c)("if(!Array.isArray(d%s))",c)("throw TypeError(%j)",a.fullName+": array expected")("m%s=[]",c)("for(var i=0;i<d%s.length;++i){",c),o(n,a,r,c+"[i]")("}")("}")):(a.resolvedType instanceof i||n("if(d%s!=null){",c),o(n,a,r,c),a.resolvedType instanceof i||n("}"))}return n("return m")},r.toObject=function(e){var t=e.fieldsArray.slice().sort(s.compareFieldsById);if(!t.length)return s.codegen()("return {}");for(var n=s.codegen(["m","o"],e.name+"$toObject")("if(!o)")("o={}")("var d={}"),r=[],o=[],c=[],l=0;l<t.length;++l)t[l].partOf||(t[l].resolve().repeated?r:t[l].map?o:c).push(t[l]);if(r.length){for(n("if(o.arrays||o.defaults){"),l=0;l<r.length;++l)n("d%s=[]",s.safeProp(r[l].name));n("}")}if(o.length){for(n("if(o.objects||o.defaults){"),l=0;l<o.length;++l)n("d%s={}",s.safeProp(o[l].name));n("}")}if(c.length){for(n("if(o.defaults){"),l=0;l<c.length;++l){var h=c[l],u=s.safeProp(h.name);if(h.resolvedType instanceof i)n("d%s=o.enums===String?%j:%j",u,h.resolvedType.valuesById[h.typeDefault],h.typeDefault);else if(h.long)n("if(util.Long){")("var n=new util.Long(%i,%i,%j)",h.typeDefault.low,h.typeDefault.high,h.typeDefault.unsigned)("d%s=o.longs===String?n.toString():o.longs===Number?n.toNumber():n",u)("}else")("d%s=o.longs===String?%j:%i",u,h.typeDefault.toString(),h.typeDefault.toNumber());else if(h.bytes){var d="["+Array.prototype.slice.call(h.typeDefault).join(",")+"]";n("if(o.bytes===String)d%s=%j",u,String.fromCharCode.apply(String,h.typeDefault))("else{")("d%s=%s",u,d)("if(o.bytes!==Array)d%s=util.newBuffer(d%s)",u,u)("}")}else n("d%s=%j",u,h.typeDefault)}n("}")}var f=!1;for(l=0;l<t.length;++l){h=t[l];var p=e._fieldsArray.indexOf(h);u=s.safeProp(h.name);h.map?(f||(f=!0,n("var ks2")),n("if(m%s&&(ks2=Object.keys(m%s)).length){",u,u)("d%s={}",u)("for(var j=0;j<ks2.length;++j){"),a(n,h,p,u+"[ks2[j]]")("}")):h.repeated?(n("if(m%s&&m%s.length){",u,u)("d%s=[]",u)("for(var j=0;j<m%s.length;++j){",u),a(n,h,p,u+"[j]")("}")):(n("if(m%s!=null&&m.hasOwnProperty(%j)){",u,h.name),a(n,h,p,u),h.partOf&&n("if(o.oneofs)")("d%s=%j",s.safeProp(h.partOf.name),h.name)),n("}")}return n("return d")}},7728(e,t,n){"use strict";e.exports=function(e){for(var t=s.codegen(["r","l","e"],e.name+"$decode")("if(!(r instanceof Reader))")("r=Reader.create(r)")("var c=l===undefined?r.len:r.pos+l,m=new this.ctor"+(e.fieldsArray.filter(function(e){return e.map}).length?",k,value":""))("while(r.pos<c){")("var t=r.uint32()")("if(t===e)")("break")("switch(t>>>3){"),n=0;n<e.fieldsArray.length;++n){var a=e._fieldsArray[n].resolve(),c=a.resolvedType instanceof r?"int32":a.type,l="m"+s.safeProp(a.name);t("case %i: {",a.id),a.map?(t("if(%s===util.emptyObject)",l)("%s={}",l)("var c2 = r.uint32()+r.pos"),void 0!==i.defaults[a.keyType]?t("k=%j",i.defaults[a.keyType]):t("k=null"),void 0!==i.defaults[c]?t("value=%j",i.defaults[c]):t("value=null"),t("while(r.pos<c2){")("var tag2=r.uint32()")("switch(tag2>>>3){")("case 1: k=r.%s(); break",a.keyType)("case 2:"),void 0===i.basic[c]?t("value=types[%i].decode(r,r.uint32())",n):t("value=r.%s()",c),t("break")("default:")("r.skipType(tag2&7)")("break")("}")("}"),void 0!==i.long[a.keyType]?t('%s[typeof k==="object"?util.longToHash(k):k]=value',l):t("%s[k]=value",l)):a.repeated?(t("if(!(%s&&%s.length))",l,l)("%s=[]",l),void 0!==i.packed[c]&&t("if((t&7)===2){")("var c2=r.uint32()+r.pos")("while(r.pos<c2)")("%s.push(r.%s())",l,c)("}else"),void 0===i.basic[c]?t(a.delimited?"%s.push(types[%i].decode(r,undefined,((t&~7)|4)))":"%s.push(types[%i].decode(r,r.uint32()))",l,n):t("%s.push(r.%s())",l,c)):void 0===i.basic[c]?t(a.delimited?"%s=types[%i].decode(r,undefined,((t&~7)|4))":"%s=types[%i].decode(r,r.uint32())",l,n):t("%s=r.%s()",l,c),t("break")("}")}for(t("default:")("r.skipType(t&7)")("break")("}")("}"),n=0;n<e._fieldsArray.length;++n){var h=e._fieldsArray[n];h.required&&t("if(!m.hasOwnProperty(%j))",h.name)("throw util.ProtocolError(%j,{instance:m})",o(h))}return t("return m")};var r=n(5643),i=n(361),s=n(3262);function o(e){return"missing required '"+e.name+"'"}},1080(e,t,n){"use strict";e.exports=function(e){for(var t,n=s.codegen(["m","w"],e.name+"$encode")("if(!w)")("w=Writer.create()"),a=e.fieldsArray.slice().sort(s.compareFieldsById),c=0;c<a.length;++c){var l=a[c].resolve(),h=e._fieldsArray.indexOf(l),u=l.resolvedType instanceof r?"int32":l.type,d=i.basic[u];t="m"+s.safeProp(l.name),l.map?(n("if(%s!=null&&Object.hasOwnProperty.call(m,%j)){",t,l.name)("for(var ks=Object.keys(%s),i=0;i<ks.length;++i){",t)("w.uint32(%i).fork().uint32(%i).%s(ks[i])",(l.id<<3|2)>>>0,8|i.mapKey[l.keyType],l.keyType),void 0===d?n("types[%i].encode(%s[ks[i]],w.uint32(18).fork()).ldelim().ldelim()",h,t):n(".uint32(%i).%s(%s[ks[i]]).ldelim()",16|d,u,t),n("}")("}")):l.repeated?(n("if(%s!=null&&%s.length){",t,t),l.packed&&void 0!==i.packed[u]?n("w.uint32(%i).fork()",(l.id<<3|2)>>>0)("for(var i=0;i<%s.length;++i)",t)("w.%s(%s[i])",u,t)("w.ldelim()"):(n("for(var i=0;i<%s.length;++i)",t),void 0===d?o(n,l,h,t+"[i]"):n("w.uint32(%i).%s(%s[i])",(l.id<<3|d)>>>0,u,t)),n("}")):(l.optional&&n("if(%s!=null&&Object.hasOwnProperty.call(m,%j))",t,l.name),void 0===d?o(n,l,h,t):n("w.uint32(%i).%s(%s)",(l.id<<3|d)>>>0,u,t))}return n("return w")};var r=n(5643),i=n(361),s=n(3262);function o(e,t,n,r){return t.delimited?e("types[%i].encode(%s,w.uint32(%i)).uint32(%i)",n,r,(t.id<<3|3)>>>0,(t.id<<3|4)>>>0):e("types[%i].encode(%s,w.uint32(%i).fork()).ldelim()",n,r,(t.id<<3|2)>>>0)}},5643(e,t,n){"use strict";e.exports=o;var r=n(7209);((o.prototype=Object.create(r.prototype)).constructor=o).className="Enum";var i=n(1304),s=n(3262);function o(e,t,n,i,s,o){if(r.call(this,e,n),t&&"object"!=typeof t)throw TypeError("values must be an object");if(this.valuesById={},this.values=Object.create(this.valuesById),this.comment=i,this.comments=s||{},this.valuesOptions=o,this._valuesFeatures={},this.reserved=void 0,t)for(var a=Object.keys(t),c=0;c<a.length;++c)"number"==typeof t[a[c]]&&(this.valuesById[this.values[a[c]]=t[a[c]]]=a[c])}o.prototype._resolveFeatures=function(e){return e=this._edition||e,r.prototype._resolveFeatures.call(this,e),Object.keys(this.values).forEach(e=>{var t=Object.assign({},this._features);this._valuesFeatures[e]=Object.assign(t,this.valuesOptions&&this.valuesOptions[e]&&this.valuesOptions[e].features)}),this},o.fromJSON=function(e,t){var n=new o(e,t.values,t.options,t.comment,t.comments);return n.reserved=t.reserved,t.edition&&(n._edition=t.edition),n._defaultEdition="proto3",n},o.prototype.toJSON=function(e){var t=!!e&&Boolean(e.keepComments);return s.toObject(["edition",this._editionToJSON(),"options",this.options,"valuesOptions",this.valuesOptions,"values",this.values,"reserved",this.reserved&&this.reserved.length?this.reserved:void 0,"comment",t?this.comment:void 0,"comments",t?this.comments:void 0])},o.prototype.add=function(e,t,n,r){if(!s.isString(e))throw TypeError("name must be a string");if(!s.isInteger(t))throw TypeError("id must be an integer");if(void 0!==this.values[e])throw Error("duplicate name '"+e+"' in "+this);if(this.isReservedId(t))throw Error("id "+t+" is reserved in "+this);if(this.isReservedName(e))throw Error("name '"+e+"' is reserved in "+this);if(void 0!==this.valuesById[t]){if(!this.options||!this.options.allow_alias)throw Error("duplicate id "+t+" in "+this);this.values[e]=t}else this.valuesById[this.values[e]=t]=e;return r&&(void 0===this.valuesOptions&&(this.valuesOptions={}),this.valuesOptions[e]=r||null),this.comments[e]=n||null,this},o.prototype.remove=function(e){if(!s.isString(e))throw TypeError("name must be a string");var t=this.values[e];if(null==t)throw Error("name '"+e+"' does not exist in "+this);return delete this.valuesById[t],delete this.values[e],delete this.comments[e],this.valuesOptions&&delete this.valuesOptions[e],this},o.prototype.isReservedId=function(e){return i.isReservedId(this.reserved,e)},o.prototype.isReservedName=function(e){return i.isReservedName(this.reserved,e)}},1344(e,t,n){"use strict";e.exports=l;var r=n(7209);((l.prototype=Object.create(r.prototype)).constructor=l).className="Field";var i,s=n(5643),o=n(361),a=n(3262),c=/^required|optional|repeated$/;function l(e,t,n,i,s,l,h){if(a.isObject(i)?(h=s,l=i,i=s=void 0):a.isObject(s)&&(h=l,l=s,s=void 0),r.call(this,e,l),!a.isInteger(t)||t<0)throw TypeError("id must be a non-negative integer");if(!a.isString(n))throw TypeError("type must be a string");if(void 0!==i&&!c.test(i=i.toString().toLowerCase()))throw TypeError("rule must be a string rule");if(void 0!==s&&!a.isString(s))throw TypeError("extend must be a string");"proto3_optional"===i&&(i="optional"),this.rule=i&&"optional"!==i?i:void 0,this.type=n,this.id=t,this.extend=s||void 0,this.repeated="repeated"===i,this.map=!1,this.message=null,this.partOf=null,this.typeDefault=null,this.defaultValue=null,this.long=!!a.Long&&void 0!==o.long[n],this.bytes="bytes"===n,this.resolvedType=null,this.extensionField=null,this.declaringField=null,this.comment=h}l.fromJSON=function(e,t){var n=new l(e,t.id,t.type,t.rule,t.extend,t.options,t.comment);return t.edition&&(n._edition=t.edition),n._defaultEdition="proto3",n},Object.defineProperty(l.prototype,"required",{get:function(){return"LEGACY_REQUIRED"===this._features.field_presence}}),Object.defineProperty(l.prototype,"optional",{get:function(){return!this.required}}),Object.defineProperty(l.prototype,"delimited",{get:function(){return this.resolvedType instanceof i&&"DELIMITED"===this._features.message_encoding}}),Object.defineProperty(l.prototype,"packed",{get:function(){return"PACKED"===this._features.repeated_field_encoding}}),Object.defineProperty(l.prototype,"hasPresence",{get:function(){return!this.repeated&&!this.map&&(this.partOf||this.declaringField||this.extensionField||"IMPLICIT"!==this._features.field_presence)}}),l.prototype.setOption=function(e,t,n){return r.prototype.setOption.call(this,e,t,n)},l.prototype.toJSON=function(e){var t=!!e&&Boolean(e.keepComments);return a.toObject(["edition",this._editionToJSON(),"rule","optional"!==this.rule&&this.rule||void 0,"type",this.type,"id",this.id,"extend",this.extend,"options",this.options,"comment",t?this.comment:void 0])},l.prototype.resolve=function(){if(this.resolved)return this;if(void 0===(this.typeDefault=o.defaults[this.type])?(this.resolvedType=(this.declaringField?this.declaringField.parent:this.parent).lookupTypeOrEnum(this.type),this.resolvedType instanceof i?this.typeDefault=null:this.typeDefault=this.resolvedType.values[Object.keys(this.resolvedType.values)[0]]):this.options&&this.options.proto3_optional&&(this.typeDefault=null),this.options&&null!=this.options.default&&(this.typeDefault=this.options.default,this.resolvedType instanceof s&&"string"==typeof this.typeDefault&&(this.typeDefault=this.resolvedType.values[this.typeDefault])),this.options&&(void 0===this.options.packed||!this.resolvedType||this.resolvedType instanceof s||delete this.options.packed,Object.keys(this.options).length||(this.options=void 0)),this.long)this.typeDefault=a.Long.fromNumber(this.typeDefault,"u"===this.type.charAt(0)),Object.freeze&&Object.freeze(this.typeDefault);else if(this.bytes&&"string"==typeof this.typeDefault){var e;a.base64.test(this.typeDefault)?a.base64.decode(this.typeDefault,e=a.newBuffer(a.base64.length(this.typeDefault)),0):a.utf8.write(this.typeDefault,e=a.newBuffer(a.utf8.length(this.typeDefault)),0),this.typeDefault=e}return this.map?this.defaultValue=a.emptyObject:this.repeated?this.defaultValue=a.emptyArray:this.defaultValue=this.typeDefault,this.parent instanceof i&&(this.parent.ctor.prototype[this.name]=this.defaultValue),r.prototype.resolve.call(this)},l.prototype._inferLegacyProtoFeatures=function(e){if("proto2"!==e&&"proto3"!==e)return{};var t={};if("required"===this.rule&&(t.field_presence="LEGACY_REQUIRED"),this.parent&&void 0===o.defaults[this.type]){var n=this.parent.get(this.type.split(".").pop());n&&n instanceof i&&n.group&&(t.message_encoding="DELIMITED")}return!0===this.getOption("packed")?t.repeated_field_encoding="PACKED":!1===this.getOption("packed")&&(t.repeated_field_encoding="EXPANDED"),t},l.prototype._resolveFeatures=function(e){return r.prototype._resolveFeatures.call(this,this._edition||e)},l.d=function(e,t,n,r){return"function"==typeof t?t=a.decorateType(t).name:t&&"object"==typeof t&&(t=a.decorateEnum(t).name),function(i,s){a.decorateType(i.constructor).add(new l(s,e,t,n,{default:r}))}},l._configure=function(e){i=e}},5325(e,t,n){"use strict";var r=e.exports=n(4394);r.build="light",r.load=function(e,t,n){return"function"==typeof t?(n=t,t=new r.Root):t||(t=new r.Root),t.load(e,n)},r.loadSync=function(e,t){return t||(t=new r.Root),t.loadSync(e)},r.encoder=n(1080),r.decoder=n(7728),r.verifier=n(420),r.converter=n(744),r.ReflectionObject=n(7209),r.Namespace=n(1304),r.Root=n(5330),r.Enum=n(5643),r.Type=n(7882),r.Field=n(1344),r.OneOf=n(1457),r.MapField=n(8252),r.Service=n(9687),r.Method=n(8811),r.Message=n(2551),r.wrappers=n(6434),r.types=n(361),r.util=n(3262),r.ReflectionObject._configure(r.Root),r.Namespace._configure(r.Type,r.Service,r.Enum),r.Root._configure(r.Type),r.Field._configure(r.Type)},4394(e,t,n){"use strict";var r=t;function i(){r.util._configure(),r.Writer._configure(r.BufferWriter),r.Reader._configure(r.BufferReader)}r.build="minimal",r.Writer=n(3449),r.BufferWriter=n(818),r.Reader=n(6237),r.BufferReader=n(3158),r.util=n(3610),r.rpc=n(5047),r.roots=n(4529),r.configure=i,i()},9100(e,t,n){"use strict";var r=e.exports=n(5325);r.build="full",r.tokenize=n(527),r.parse=n(4863),r.common=n(5095),r.Root._configure(r.Type,r.parse,r.common)},8252(e,t,n){"use strict";e.exports=o;var r=n(1344);((o.prototype=Object.create(r.prototype)).constructor=o).className="MapField";var i=n(361),s=n(3262);function o(e,t,n,i,o,a){if(r.call(this,e,t,i,void 0,void 0,o,a),!s.isString(n))throw TypeError("keyType must be a string");this.keyType=n,this.resolvedKeyType=null,this.map=!0}o.fromJSON=function(e,t){return new o(e,t.id,t.keyType,t.type,t.options,t.comment)},o.prototype.toJSON=function(e){var t=!!e&&Boolean(e.keepComments);return s.toObject(["keyType",this.keyType,"type",this.type,"id",this.id,"extend",this.extend,"options",this.options,"comment",t?this.comment:void 0])},o.prototype.resolve=function(){if(this.resolved)return this;if(void 0===i.mapKey[this.keyType])throw Error("invalid key type: "+this.keyType);return r.prototype.resolve.call(this)},o.d=function(e,t,n){return"function"==typeof n?n=s.decorateType(n).name:n&&"object"==typeof n&&(n=s.decorateEnum(n).name),function(r,i){s.decorateType(r.constructor).add(new o(i,e,t,n))}}},2551(e,t,n){"use strict";e.exports=i;var r=n(3610);function i(e){if(e)for(var t=Object.keys(e),n=0;n<t.length;++n)this[t[n]]=e[t[n]]}i.create=function(e){return this.$type.create(e)},i.encode=function(e,t){return this.$type.encode(e,t)},i.encodeDelimited=function(e,t){return this.$type.encodeDelimited(e,t)},i.decode=function(e){return this.$type.decode(e)},i.decodeDelimited=function(e){return this.$type.decodeDelimited(e)},i.verify=function(e){return this.$type.verify(e)},i.fromObject=function(e){return this.$type.fromObject(e)},i.toObject=function(e,t){return this.$type.toObject(e,t)},i.prototype.toJSON=function(){return this.$type.toObject(this,r.toJSONOptions)}},8811(e,t,n){"use strict";e.exports=s;var r=n(7209);((s.prototype=Object.create(r.prototype)).constructor=s).className="Method";var i=n(3262);function s(e,t,n,s,o,a,c,l,h){if(i.isObject(o)?(c=o,o=a=void 0):i.isObject(a)&&(c=a,a=void 0),void 0!==t&&!i.isString(t))throw TypeError("type must be a string");if(!i.isString(n))throw TypeError("requestType must be a string");if(!i.isString(s))throw TypeError("responseType must be a string");r.call(this,e,c),this.type=t||"rpc",this.requestType=n,this.requestStream=!!o||void 0,this.responseType=s,this.responseStream=!!a||void 0,this.resolvedRequestType=null,this.resolvedResponseType=null,this.comment=l,this.parsedOptions=h}s.fromJSON=function(e,t){return new s(e,t.type,t.requestType,t.responseType,t.requestStream,t.responseStream,t.options,t.comment,t.parsedOptions)},s.prototype.toJSON=function(e){var t=!!e&&Boolean(e.keepComments);return i.toObject(["type","rpc"!==this.type&&this.type||void 0,"requestType",this.requestType,"requestStream",this.requestStream,"responseType",this.responseType,"responseStream",this.responseStream,"options",this.options,"comment",t?this.comment:void 0,"parsedOptions",this.parsedOptions])},s.prototype.resolve=function(){return this.resolved?this:(this.resolvedRequestType=this.parent.lookupType(this.requestType),this.resolvedResponseType=this.parent.lookupType(this.responseType),r.prototype.resolve.call(this))}},1304(e,t,n){"use strict";e.exports=u;var r=n(7209);((u.prototype=Object.create(r.prototype)).constructor=u).className="Namespace";var i,s,o,a=n(1344),c=n(3262),l=n(1457);function h(e,t){if(e&&e.length){for(var n={},r=0;r<e.length;++r)n[e[r].name]=e[r].toJSON(t);return n}}function u(e,t){r.call(this,e,t),this.nested=void 0,this._nestedArray=null,this._lookupCache={},this._needsRecursiveFeatureResolution=!0,this._needsRecursiveResolve=!0}function d(e){e._nestedArray=null,e._lookupCache={};for(var t=e;t=t.parent;)t._lookupCache={};return e}u.fromJSON=function(e,t){return new u(e,t.options).addJSON(t.nested)},u.arrayToJSON=h,u.isReservedId=function(e,t){if(e)for(var n=0;n<e.length;++n)if("string"!=typeof e[n]&&e[n][0]<=t&&e[n][1]>t)return!0;return!1},u.isReservedName=function(e,t){if(e)for(var n=0;n<e.length;++n)if(e[n]===t)return!0;return!1},Object.defineProperty(u.prototype,"nestedArray",{get:function(){return this._nestedArray||(this._nestedArray=c.toArray(this.nested))}}),u.prototype.toJSON=function(e){return c.toObject(["options",this.options,"nested",h(this.nestedArray,e)])},u.prototype.addJSON=function(e){if(e)for(var t,n=Object.keys(e),r=0;r<n.length;++r)t=e[n[r]],this.add((void 0!==t.fields?i.fromJSON:void 0!==t.values?o.fromJSON:void 0!==t.methods?s.fromJSON:void 0!==t.id?a.fromJSON:u.fromJSON)(n[r],t));return this},u.prototype.get=function(e){return this.nested&&this.nested[e]||null},u.prototype.getEnum=function(e){if(this.nested&&this.nested[e]instanceof o)return this.nested[e].values;throw Error("no such enum: "+e)},u.prototype.add=function(e){if(!(e instanceof a&&void 0!==e.extend||e instanceof i||e instanceof l||e instanceof o||e instanceof s||e instanceof u))throw TypeError("object must be a valid nested object");if(this.nested){var t=this.get(e.name);if(t){if(!(t instanceof u&&e instanceof u)||t instanceof i||t instanceof s)throw Error("duplicate name '"+e.name+"' in "+this);for(var n=t.nestedArray,r=0;r<n.length;++r)e.add(n[r]);this.remove(t),this.nested||(this.nested={}),e.setOptions(t.options,!0)}}else this.nested={};this.nested[e.name]=e,this instanceof i||this instanceof s||this instanceof o||this instanceof a||e._edition||(e._edition=e._defaultEdition),this._needsRecursiveFeatureResolution=!0,this._needsRecursiveResolve=!0;for(var c=this;c=c.parent;)c._needsRecursiveFeatureResolution=!0,c._needsRecursiveResolve=!0;return e.onAdd(this),d(this)},u.prototype.remove=function(e){if(!(e instanceof r))throw TypeError("object must be a ReflectionObject");if(e.parent!==this)throw Error(e+" is not a member of "+this);return delete this.nested[e.name],Object.keys(this.nested).length||(this.nested=void 0),e.onRemove(this),d(this)},u.prototype.define=function(e,t){if(c.isString(e))e=e.split(".");else if(!Array.isArray(e))throw TypeError("illegal path");if(e&&e.length&&""===e[0])throw Error("path must be relative");for(var n=this;e.length>0;){var r=e.shift();if(n.nested&&n.nested[r]){if(!((n=n.nested[r])instanceof u))throw Error("path conflicts with non-namespace objects")}else n.add(n=new u(r))}return t&&n.addJSON(t),n},u.prototype.resolveAll=function(){if(!this._needsRecursiveResolve)return this;this._resolveFeaturesRecursive(this._edition);var e=this.nestedArray,t=0;for(this.resolve();t<e.length;)e[t]instanceof u?e[t++].resolveAll():e[t++].resolve();return this._needsRecursiveResolve=!1,this},u.prototype._resolveFeaturesRecursive=function(e){return this._needsRecursiveFeatureResolution?(this._needsRecursiveFeatureResolution=!1,e=this._edition||e,r.prototype._resolveFeaturesRecursive.call(this,e),this.nestedArray.forEach(t=>{t._resolveFeaturesRecursive(e)}),this):this},u.prototype.lookup=function(e,t,n){if("boolean"==typeof t?(n=t,t=void 0):t&&!Array.isArray(t)&&(t=[t]),c.isString(e)&&e.length){if("."===e)return this.root;e=e.split(".")}else if(!e.length)return this;var r=e.join(".");if(""===e[0])return this.root.lookup(e.slice(1),t);var i=this.root._fullyQualifiedObjects&&this.root._fullyQualifiedObjects["."+r];if(i&&(!t||t.indexOf(i.constructor)>-1))return i;if((i=this._lookupImpl(e,r))&&(!t||t.indexOf(i.constructor)>-1))return i;if(n)return null;for(var s=this;s.parent;){if((i=s.parent._lookupImpl(e,r))&&(!t||t.indexOf(i.constructor)>-1))return i;s=s.parent}return null},u.prototype._lookupImpl=function(e,t){if(Object.prototype.hasOwnProperty.call(this._lookupCache,t))return this._lookupCache[t];var n=this.get(e[0]),r=null;if(n)1===e.length?r=n:n instanceof u&&(e=e.slice(1),r=n._lookupImpl(e,e.join(".")));else for(var i=0;i<this.nestedArray.length;++i)this._nestedArray[i]instanceof u&&(n=this._nestedArray[i]._lookupImpl(e,t))&&(r=n);return this._lookupCache[t]=r,r},u.prototype.lookupType=function(e){var t=this.lookup(e,[i]);if(!t)throw Error("no such type: "+e);return t},u.prototype.lookupEnum=function(e){var t=this.lookup(e,[o]);if(!t)throw Error("no such Enum '"+e+"' in "+this);return t},u.prototype.lookupTypeOrEnum=function(e){var t=this.lookup(e,[i,o]);if(!t)throw Error("no such Type or Enum '"+e+"' in "+this);return t},u.prototype.lookupService=function(e){var t=this.lookup(e,[s]);if(!t)throw Error("no such Service '"+e+"' in "+this);return t},u._configure=function(e,t,n){i=e,s=t,o=n}},7209(e,t,n){"use strict";e.exports=l,l.className="ReflectionObject";const r=n(1457);var i,s=n(3262),o={enum_type:"OPEN",field_presence:"EXPLICIT",json_format:"ALLOW",message_encoding:"LENGTH_PREFIXED",repeated_field_encoding:"PACKED",utf8_validation:"VERIFY"},a={enum_type:"CLOSED",field_presence:"EXPLICIT",json_format:"LEGACY_BEST_EFFORT",message_encoding:"LENGTH_PREFIXED",repeated_field_encoding:"EXPANDED",utf8_validation:"NONE"},c={enum_type:"OPEN",field_presence:"IMPLICIT",json_format:"ALLOW",message_encoding:"LENGTH_PREFIXED",repeated_field_encoding:"PACKED",utf8_validation:"VERIFY"};function l(e,t){if(!s.isString(e))throw TypeError("name must be a string");if(t&&!s.isObject(t))throw TypeError("options must be an object");this.options=t,this.parsedOptions=null,this.name=e,this._edition=null,this._defaultEdition="proto2",this._features={},this._featuresResolved=!1,this.parent=null,this.resolved=!1,this.comment=null,this.filename=null}Object.defineProperties(l.prototype,{root:{get:function(){for(var e=this;null!==e.parent;)e=e.parent;return e}},fullName:{get:function(){for(var e=[this.name],t=this.parent;t;)e.unshift(t.name),t=t.parent;return e.join(".")}}}),l.prototype.toJSON=function(){throw Error()},l.prototype.onAdd=function(e){this.parent&&this.parent!==e&&this.parent.remove(this),this.parent=e,this.resolved=!1;var t=e.root;t instanceof i&&t._handleAdd(this)},l.prototype.onRemove=function(e){var t=e.root;t instanceof i&&t._handleRemove(this),this.parent=null,this.resolved=!1},l.prototype.resolve=function(){return this.resolved||this.root instanceof i&&(this.resolved=!0),this},l.prototype._resolveFeaturesRecursive=function(e){return this._resolveFeatures(this._edition||e)},l.prototype._resolveFeatures=function(e){if(!this._featuresResolved){var t={};if(!e)throw new Error("Unknown edition for "+this.fullName);var n=Object.assign(this.options?Object.assign({},this.options.features):{},this._inferLegacyProtoFeatures(e));if(this._edition){if("proto2"===e)t=Object.assign({},a);else if("proto3"===e)t=Object.assign({},c);else{if("2023"!==e)throw new Error("Unknown edition: "+e);t=Object.assign({},o)}return this._features=Object.assign(t,n||{}),void(this._featuresResolved=!0)}if(this.partOf instanceof r){var i=Object.assign({},this.partOf._features);this._features=Object.assign(i,n||{})}else if(this.declaringField);else{if(!this.parent)throw new Error("Unable to find a parent for "+this.fullName);var s=Object.assign({},this.parent._features);this._features=Object.assign(s,n||{})}this.extensionField&&(this.extensionField._features=this._features),this._featuresResolved=!0}},l.prototype._inferLegacyProtoFeatures=function(){return{}},l.prototype.getOption=function(e){if(this.options)return this.options[e]},l.prototype.setOption=function(e,t,n){return this.options||(this.options={}),/^features\./.test(e)?s.setProperty(this.options,e,t,n):n&&void 0!==this.options[e]||(this.getOption(e)!==t&&(this.resolved=!1),this.options[e]=t),this},l.prototype.setParsedOption=function(e,t,n){this.parsedOptions||(this.parsedOptions=[]);var r=this.parsedOptions;if(n){var i=r.find(function(t){return Object.prototype.hasOwnProperty.call(t,e)});if(i){var o=i[e];s.setProperty(o,n,t)}else(i={})[e]=s.setProperty({},n,t),r.push(i)}else{var a={};a[e]=t,r.push(a)}return this},l.prototype.setOptions=function(e,t){if(e)for(var n=Object.keys(e),r=0;r<n.length;++r)this.setOption(n[r],e[n[r]],t);return this},l.prototype.toString=function(){var e=this.constructor.className,t=this.fullName;return t.length?e+" "+t:e},l.prototype._editionToJSON=function(){if(this._edition&&"proto3"!==this._edition)return this._edition},l._configure=function(e){i=e}},1457(e,t,n){"use strict";e.exports=o;var r=n(7209);((o.prototype=Object.create(r.prototype)).constructor=o).className="OneOf";var i=n(1344),s=n(3262);function o(e,t,n,i){if(Array.isArray(t)||(n=t,t=void 0),r.call(this,e,n),void 0!==t&&!Array.isArray(t))throw TypeError("fieldNames must be an Array");this.oneof=t||[],this.fieldsArray=[],this.comment=i}function a(e){if(e.parent)for(var t=0;t<e.fieldsArray.length;++t)e.fieldsArray[t].parent||e.parent.add(e.fieldsArray[t])}o.fromJSON=function(e,t){return new o(e,t.oneof,t.options,t.comment)},o.prototype.toJSON=function(e){var t=!!e&&Boolean(e.keepComments);return s.toObject(["options",this.options,"oneof",this.oneof,"comment",t?this.comment:void 0])},o.prototype.add=function(e){if(!(e instanceof i))throw TypeError("field must be a Field");return e.parent&&e.parent!==this.parent&&e.parent.remove(e),this.oneof.push(e.name),this.fieldsArray.push(e),e.partOf=this,a(this),this},o.prototype.remove=function(e){if(!(e instanceof i))throw TypeError("field must be a Field");var t=this.fieldsArray.indexOf(e);if(t<0)throw Error(e+" is not a member of "+this);return this.fieldsArray.splice(t,1),(t=this.oneof.indexOf(e.name))>-1&&this.oneof.splice(t,1),e.partOf=null,this},o.prototype.onAdd=function(e){r.prototype.onAdd.call(this,e);for(var t=0;t<this.oneof.length;++t){var n=e.get(this.oneof[t]);n&&!n.partOf&&(n.partOf=this,this.fieldsArray.push(n))}a(this)},o.prototype.onRemove=function(e){for(var t,n=0;n<this.fieldsArray.length;++n)(t=this.fieldsArray[n]).parent&&t.parent.remove(t);r.prototype.onRemove.call(this,e)},Object.defineProperty(o.prototype,"isProto3Optional",{get:function(){if(null==this.fieldsArray||1!==this.fieldsArray.length)return!1;var e=this.fieldsArray[0];return null!=e.options&&!0===e.options.proto3_optional}}),o.d=function(){for(var e=new Array(arguments.length),t=0;t<arguments.length;)e[t]=arguments[t++];return function(t,n){s.decorateType(t.constructor).add(new o(n,e)),Object.defineProperty(t,n,{get:s.oneOfGetter(e),set:s.oneOfSetter(e)})}}},4863(e,t,n){"use strict";e.exports=w,w.filename=null,w.defaults={keepCase:!1};var r=n(527),i=n(5330),s=n(7882),o=n(1344),a=n(8252),c=n(1457),l=n(5643),h=n(9687),u=n(8811),d=n(7209),f=n(361),p=n(3262),g=/^[1-9][0-9]*$/,m=/^-?[1-9][0-9]*$/,_=/^0[x][0-9a-fA-F]+$/,y=/^-?0[x][0-9a-fA-F]+$/,v=/^0[0-7]+$/,b=/^-?0[0-7]+$/,E=/^(?![eE])[0-9]*(?:\.[0-9]*)?(?:[eE][+-]?[0-9]+)?$/,A=/^[a-zA-Z_][a-zA-Z_0-9]*$/,S=/^(?:\.?[a-zA-Z_][a-zA-Z_0-9]*)(?:\.[a-zA-Z_][a-zA-Z_0-9]*)*$/;function w(e,t,n){t instanceof i||(n=t,t=new i),n||(n=w.defaults);var C,I,k,T,R=n.preferTrailingComment||!1,O=r(e,n.alternateCommentMode||!1),N=O.next,P=O.push,B=O.peek,L=O.skip,x=O.cmnt,D=!0,M="proto2",U=t,F=[],H={},j=n.keepCase?function(e){return e}:p.camelCase;function W(e,t,n){var r=w.filename;return n||(w.filename=null),Error("illegal "+(t||"token")+" '"+e+"' ("+(r?r+", ":"")+"line "+O.line+")")}function Q(){var e,t=[];do{if('"'!==(e=N())&&"'"!==e)throw W(e);t.push(N()),L(e),e=B()}while('"'===e||"'"===e);return t.join("")}function q(e){var t=N();switch(t){case"'":case'"':return P(t),Q();case"true":case"TRUE":return!0;case"false":case"FALSE":return!1}try{return function(e,t){var n=1;"-"===e.charAt(0)&&(n=-1,e=e.substring(1));switch(e){case"inf":case"INF":case"Inf":return n*(1/0);case"nan":case"NAN":case"Nan":case"NaN":return NaN;case"0":return 0}if(g.test(e))return n*parseInt(e,10);if(_.test(e))return n*parseInt(e,16);if(v.test(e))return n*parseInt(e,8);if(E.test(e))return n*parseFloat(e);throw W(e,"number",t)}(t,!0)}catch(n){if(e&&S.test(t))return t;throw W(t,"value")}}function z(e,t){var n,r;do{if(!t||'"'!==(n=B())&&"'"!==n)try{e.push([r=$(N()),L("to",!0)?$(N()):r])}catch(r){if(!(t&&S.test(n)&&M>=2023))throw r;e.push(n)}else{var i=Q();if(e.push(i),M>=2023)throw W(i,"id")}}while(L(",",!0));var s={options:void 0,setOption:function(e,t){void 0===this.options&&(this.options={}),this.options[e]=t}};J(s,function(e){if("option"!==e)throw W(e);ne(s,e),L(";")},function(){se(s)})}function $(e,t){switch(e){case"max":case"MAX":case"Max":return 536870911;case"0":return 0}if(!t&&"-"===e.charAt(0))throw W(e,"id");if(m.test(e))return parseInt(e,10);if(y.test(e))return parseInt(e,16);if(b.test(e))return parseInt(e,8);throw W(e,"id")}function G(){if(void 0!==C)throw W("package");if(C=N(),!S.test(C))throw W(C,"name");U=U.define(C),L(";")}function K(){var e,t=B();switch(t){case"weak":e=k||(k=[]),N();break;case"public":N();default:e=I||(I=[])}t=Q(),L(";"),e.push(t)}function Y(){if(L("="),(M=Q())<2023)throw W(M,"syntax");L(";")}function V(){L("="),M=Q();if(!["2023"].includes(M))throw W(M,"edition");L(";")}function X(e,t){switch(t){case"option":return ne(e,t),L(";"),!0;case"message":return Z(e,t),!0;case"enum":return te(e,t),!0;case"service":return function(e,t){if(!A.test(t=N()))throw W(t,"service name");var n=new h(t);J(n,function(e){if(!X(n,e)){if("rpc"!==e)throw W(e);!function(e,t){var n=x(),r=t;if(!A.test(t=N()))throw W(t,"name");var i,s,o,a,c=t;L("("),L("stream",!0)&&(s=!0);if(!S.test(t=N()))throw W(t);i=t,L(")"),L("returns"),L("("),L("stream",!0)&&(a=!0);if(!S.test(t=N()))throw W(t);o=t,L(")");var l=new u(c,r,i,o,s,a);l.comment=n,J(l,function(e){if("option"!==e)throw W(e);ne(l,e),L(";")}),e.add(l)}(n,e)}}),e.add(n),e===U&&F.push(n)}(e,t),!0;case"extend":return function(e,t){if(!S.test(t=N()))throw W(t,"reference");var n=t;J(null,function(t){switch(t){case"required":case"repeated":ee(e,t,n);break;case"optional":ee(e,"proto3"===M?"proto3_optional":"optional",n);break;default:if("proto2"===M||!S.test(t))throw W(t);P(t),ee(e,"optional",n)}})}(e,t),!0}return!1}function J(e,t,n){var r=O.line;if(e&&("string"!=typeof e.comment&&(e.comment=x()),e.filename=w.filename),L("{",!0)){for(var i;"}"!==(i=N());)t(i);L(";",!0)}else n&&n(),L(";"),e&&("string"!=typeof e.comment||R)&&(e.comment=x(r)||e.comment)}function Z(e,t){if(!A.test(t=N()))throw W(t,"type name");var n=new s(t);J(n,function(e){if(!X(n,e))switch(e){case"map":!function(e){L("<");var t=N();if(void 0===f.mapKey[t])throw W(t,"type");L(",");var n=N();if(!S.test(n))throw W(n,"type");L(">");var r=N();if(!A.test(r))throw W(r,"name");L("=");var i=new a(j(r),$(N()),t,n);J(i,function(e){if("option"!==e)throw W(e);ne(i,e),L(";")},function(){se(i)}),e.add(i)}(n);break;case"required":if("proto2"!==M)throw W(e);case"repeated":ee(n,e);break;case"optional":if("proto3"===M)ee(n,"proto3_optional");else{if("proto2"!==M)throw W(e);ee(n,"optional")}break;case"oneof":!function(e,t){if(!A.test(t=N()))throw W(t,"name");var n=new c(j(t));J(n,function(e){"option"===e?(ne(n,e),L(";")):(P(e),ee(n,"optional"))}),e.add(n)}(n,e);break;case"extensions":z(n.extensions||(n.extensions=[]));break;case"reserved":z(n.reserved||(n.reserved=[]),!0);break;default:if("proto2"===M||!S.test(e))throw W(e);P(e),ee(n,"optional")}}),e.add(n),e===U&&F.push(n)}function ee(e,t,n){var r=N();if("group"!==r){for(;r.endsWith(".")||B().startsWith(".");)r+=N();if(!S.test(r))throw W(r,"type");var i=N();if(!A.test(i))throw W(i,"name");i=j(i),L("=");var a=new o(i,$(N()),r,t,n);if(J(a,function(e){if("option"!==e)throw W(e);ne(a,e),L(";")},function(){se(a)}),"proto3_optional"===t){var l=new c("_"+i);a.setOption("proto3_optional",!0),l.add(a),e.add(l)}else e.add(a);e===U&&F.push(a)}else!function(e,t){if(M>=2023)throw W("group");var n=N();if(!A.test(n))throw W(n,"name");var r=p.lcFirst(n);n===r&&(n=p.ucFirst(n));L("=");var i=$(N()),a=new s(n);a.group=!0;var c=new o(r,i,n,t);c.filename=w.filename,J(a,function(e){switch(e){case"option":ne(a,e),L(";");break;case"required":case"repeated":ee(a,e);break;case"optional":ee(a,"proto3"===M?"proto3_optional":"optional");break;case"message":Z(a,e);break;case"enum":te(a,e);break;case"reserved":z(a.reserved||(a.reserved=[]),!0);break;default:throw W(e)}}),e.add(a).add(c)}(e,t)}function te(e,t){if(!A.test(t=N()))throw W(t,"name");var n=new l(t);J(n,function(e){switch(e){case"option":ne(n,e),L(";");break;case"reserved":z(n.reserved||(n.reserved=[]),!0),void 0===n.reserved&&(n.reserved=[]);break;default:!function(e,t){if(!A.test(t))throw W(t,"name");L("=");var n=$(N(),!0),r={options:void 0,getOption:function(e){return this.options[e]}};r.setOption=function(e,t){d.prototype.setOption.call(r,e,t)},r.setParsedOption=function(){},J(r,function(e){if("option"!==e)throw W(e);ne(r,e),L(";")},function(){se(r)}),e.add(t,n,r.comment,r.parsedOptions||r.options)}(n,e)}}),e.add(n),e===U&&F.push(n)}function ne(e,t){var n,r,i=!0;for("option"===t&&(t=N());"="!==t;){if("("===t){var s=N();L(")"),t="("+s+")"}if(i){if(i=!1,t.includes(".")&&!t.includes("(")){var o=t.split(".");n=o[0]+".",t=o[1];continue}n=t}else r=r?r+=t:t;t=N()}var a=re(e,r?n.concat(r):n);r=r&&"."===r[0]?r.slice(1):r,function(e,t,n,r){e.setParsedOption&&e.setParsedOption(t,n,r)}(e,n=n&&"."===n[n.length-1]?n.slice(0,-1):n,a,r)}function re(e,t){if(L("{",!0)){for(var n={};!L("}",!0);){if(!A.test(T=N()))throw W(T,"name");if(null===T)throw W(T,"end of input");var r,i=T;if(L(":",!0),"{"===B())r=re(e,t+"."+T);else if("["===B()){var s;if(r=[],L("[",!0)){do{s=q(!0),r.push(s)}while(L(",",!0));L("]"),void 0!==s&&ie(e,t+"."+T,s)}}else r=q(!0),ie(e,t+"."+T,r);var o=n[i];o&&(r=[].concat(o).concat(r)),n[i]=r,L(",",!0),L(";",!0)}return n}var a=q(!0);return ie(e,t,a),a}function ie(e,t,n){U===e&&/^features\./.test(t)?H[t]=n:e.setOption&&e.setOption(t,n)}function se(e){if(L("[",!0)){do{ne(e,"option")}while(L(",",!0));L("]")}return e}for(;null!==(T=N());)switch(T){case"package":if(!D)throw W(T);G();break;case"import":if(!D)throw W(T);K();break;case"syntax":if(!D)throw W(T);Y();break;case"edition":if(!D)throw W(T);V();break;case"option":ne(U,T),L(";",!0);break;default:if(X(U,T)){D=!1;continue}throw W(T)}return F.forEach(e=>{e._edition=M,Object.keys(H).forEach(t=>{void 0===e.getOption(t)&&e.setOption(t,H[t],!0)})}),w.filename=null,{package:C,imports:I,weakImports:k,root:t}}},6237(e,t,n){"use strict";e.exports=c;var r,i=n(3610),s=i.LongBits,o=i.utf8;function a(e,t){return RangeError("index out of range: "+e.pos+" + "+(t||1)+" > "+e.len)}function c(e){this.buf=e,this.pos=0,this.len=e.length}var l,h="undefined"!=typeof Uint8Array?function(e){if(e instanceof Uint8Array||Array.isArray(e))return new c(e);throw Error("illegal buffer")}:function(e){if(Array.isArray(e))return new c(e);throw Error("illegal buffer")},u=function(){return i.Buffer?function(e){return(c.create=function(e){return i.Buffer.isBuffer(e)?new r(e):h(e)})(e)}:h};function d(){var e=new s(0,0),t=0;if(!(this.len-this.pos>4)){for(;t<3;++t){if(this.pos>=this.len)throw a(this);if(e.lo=(e.lo|(127&this.buf[this.pos])<<7*t)>>>0,this.buf[this.pos++]<128)return e}return e.lo=(e.lo|(127&this.buf[this.pos++])<<7*t)>>>0,e}for(;t<4;++t)if(e.lo=(e.lo|(127&this.buf[this.pos])<<7*t)>>>0,this.buf[this.pos++]<128)return e;if(e.lo=(e.lo|(127&this.buf[this.pos])<<28)>>>0,e.hi=(e.hi|(127&this.buf[this.pos])>>4)>>>0,this.buf[this.pos++]<128)return e;if(t=0,this.len-this.pos>4){for(;t<5;++t)if(e.hi=(e.hi|(127&this.buf[this.pos])<<7*t+3)>>>0,this.buf[this.pos++]<128)return e}else for(;t<5;++t){if(this.pos>=this.len)throw a(this);if(e.hi=(e.hi|(127&this.buf[this.pos])<<7*t+3)>>>0,this.buf[this.pos++]<128)return e}throw Error("invalid varint encoding")}function f(e,t){return(e[t-4]|e[t-3]<<8|e[t-2]<<16|e[t-1]<<24)>>>0}function p(){if(this.pos+8>this.len)throw a(this,8);return new s(f(this.buf,this.pos+=4),f(this.buf,this.pos+=4))}c.create=u(),c.prototype._slice=i.Array.prototype.subarray||i.Array.prototype.slice,c.prototype.uint32=(l=4294967295,function(){if(l=(127&this.buf[this.pos])>>>0,this.buf[this.pos++]<128)return l;if(l=(l|(127&this.buf[this.pos])<<7)>>>0,this.buf[this.pos++]<128)return l;if(l=(l|(127&this.buf[this.pos])<<14)>>>0,this.buf[this.pos++]<128)return l;if(l=(l|(127&this.buf[this.pos])<<21)>>>0,this.buf[this.pos++]<128)return l;if(l=(l|(15&this.buf[this.pos])<<28)>>>0,this.buf[this.pos++]<128)return l;if((this.pos+=5)>this.len)throw this.pos=this.len,a(this,10);return l}),c.prototype.int32=function(){return 0|this.uint32()},c.prototype.sint32=function(){var e=this.uint32();return e>>>1^-(1&e)},c.prototype.bool=function(){return 0!==this.uint32()},c.prototype.fixed32=function(){if(this.pos+4>this.len)throw a(this,4);return f(this.buf,this.pos+=4)},c.prototype.sfixed32=function(){if(this.pos+4>this.len)throw a(this,4);return 0|f(this.buf,this.pos+=4)},c.prototype.float=function(){if(this.pos+4>this.len)throw a(this,4);var e=i.float.readFloatLE(this.buf,this.pos);return this.pos+=4,e},c.prototype.double=function(){if(this.pos+8>this.len)throw a(this,4);var e=i.float.readDoubleLE(this.buf,this.pos);return this.pos+=8,e},c.prototype.bytes=function(){var e=this.uint32(),t=this.pos,n=this.pos+e;if(n>this.len)throw a(this,e);if(this.pos+=e,Array.isArray(this.buf))return this.buf.slice(t,n);if(t===n){var r=i.Buffer;return r?r.alloc(0):new this.buf.constructor(0)}return this._slice.call(this.buf,t,n)},c.prototype.string=function(){var e=this.bytes();return o.read(e,0,e.length)},c.prototype.skip=function(e){if("number"==typeof e){if(this.pos+e>this.len)throw a(this,e);this.pos+=e}else do{if(this.pos>=this.len)throw a(this)}while(128&this.buf[this.pos++]);return this},c.prototype.skipType=function(e){switch(e){case 0:this.skip();break;case 1:this.skip(8);break;case 2:this.skip(this.uint32());break;case 3:for(;4!=(e=7&this.uint32());)this.skipType(e);break;case 5:this.skip(4);break;default:throw Error("invalid wire type "+e+" at offset "+this.pos)}return this},c._configure=function(e){r=e,c.create=u(),r._configure();var t=i.Long?"toLong":"toNumber";i.merge(c.prototype,{int64:function(){return d.call(this)[t](!1)},uint64:function(){return d.call(this)[t](!0)},sint64:function(){return d.call(this).zzDecode()[t](!1)},fixed64:function(){return p.call(this)[t](!0)},sfixed64:function(){return p.call(this)[t](!1)}})}},3158(e,t,n){"use strict";e.exports=s;var r=n(6237);(s.prototype=Object.create(r.prototype)).constructor=s;var i=n(3610);function s(e){r.call(this,e)}s._configure=function(){i.Buffer&&(s.prototype._slice=i.Buffer.prototype.slice)},s.prototype.string=function(){var e=this.uint32();return this.buf.utf8Slice?this.buf.utf8Slice(this.pos,this.pos=Math.min(this.pos+e,this.len)):this.buf.toString("utf-8",this.pos,this.pos=Math.min(this.pos+e,this.len))},s._configure()},5330(e,t,n){"use strict";e.exports=u;var r=n(1304);((u.prototype=Object.create(r.prototype)).constructor=u).className="Root";var i,s,o,a=n(1344),c=n(5643),l=n(1457),h=n(3262);function u(e){r.call(this,"",e),this.deferred=[],this.files=[],this._edition="proto2",this._fullyQualifiedObjects={}}function d(){}u.fromJSON=function(e,t){return t||(t=new u),e.options&&t.setOptions(e.options),t.addJSON(e.nested).resolveAll()},u.prototype.resolvePath=h.path.resolve,u.prototype.fetch=h.fetch,u.prototype.load=function e(t,n,r){"function"==typeof n&&(r=n,n=void 0);var i=this;if(!r)return h.asPromise(e,i,t,n);var a=r===d;function c(e,t){if(r){if(a)throw e;t&&t.resolveAll();var n=r;r=null,n(e,t)}}function l(e){var t=e.lastIndexOf("google/protobuf/");if(t>-1){var n=e.substring(t);if(n in o)return n}return null}function u(e,t){try{if(h.isString(t)&&"{"===t.charAt(0)&&(t=JSON.parse(t)),h.isString(t)){s.filename=e;var r,o=s(t,i,n),u=0;if(o.imports)for(;u<o.imports.length;++u)(r=l(o.imports[u])||i.resolvePath(e,o.imports[u]))&&f(r);if(o.weakImports)for(u=0;u<o.weakImports.length;++u)(r=l(o.weakImports[u])||i.resolvePath(e,o.weakImports[u]))&&f(r,!0)}else i.setOptions(t.options).addJSON(t.nested)}catch(e){c(e)}a||p||c(null,i)}function f(e,t){if(e=l(e)||e,!(i.files.indexOf(e)>-1))if(i.files.push(e),e in o)a?u(e,o[e]):(++p,setTimeout(function(){--p,u(e,o[e])}));else if(a){var n;try{n=h.fs.readFileSync(e).toString("utf8")}catch(e){return void(t||c(e))}u(e,n)}else++p,i.fetch(e,function(n,s){--p,r&&(n?t?p||c(null,i):c(n):u(e,s))})}var p=0;h.isString(t)&&(t=[t]);for(var g,m=0;m<t.length;++m)(g=i.resolvePath("",t[m]))&&f(g);return a?(i.resolveAll(),i):(p||c(null,i),i)},u.prototype.loadSync=function(e,t){if(!h.isNode)throw Error("not supported");return this.load(e,t,d)},u.prototype.resolveAll=function(){if(!this._needsRecursiveResolve)return this;if(this.deferred.length)throw Error("unresolvable extensions: "+this.deferred.map(function(e){return"'extend "+e.extend+"' in "+e.parent.fullName}).join(", "));return r.prototype.resolveAll.call(this)};var f=/^[A-Z]/;function p(e,t){var n=t.parent.lookup(t.extend);if(n){var r=new a(t.fullName,t.id,t.type,t.rule,void 0,t.options);return n.get(r.name)||(r.declaringField=t,t.extensionField=r,n.add(r)),!0}return!1}u.prototype._handleAdd=function(e){if(e instanceof a)void 0===e.extend||e.extensionField||p(0,e)||this.deferred.push(e);else if(e instanceof c)f.test(e.name)&&(e.parent[e.name]=e.values);else if(!(e instanceof l)){if(e instanceof i)for(var t=0;t<this.deferred.length;)p(0,this.deferred[t])?this.deferred.splice(t,1):++t;for(var n=0;n<e.nestedArray.length;++n)this._handleAdd(e._nestedArray[n]);f.test(e.name)&&(e.parent[e.name]=e)}(e instanceof i||e instanceof c||e instanceof a)&&(this._fullyQualifiedObjects[e.fullName]=e)},u.prototype._handleRemove=function(e){if(e instanceof a){if(void 0!==e.extend)if(e.extensionField)e.extensionField.parent.remove(e.extensionField),e.extensionField=null;else{var t=this.deferred.indexOf(e);t>-1&&this.deferred.splice(t,1)}}else if(e instanceof c)f.test(e.name)&&delete e.parent[e.name];else if(e instanceof r){for(var n=0;n<e.nestedArray.length;++n)this._handleRemove(e._nestedArray[n]);f.test(e.name)&&delete e.parent[e.name]}delete this._fullyQualifiedObjects[e.fullName]},u._configure=function(e,t,n){i=e,s=t,o=n}},4529(e){"use strict";e.exports={}},5047(e,t,n){"use strict";t.Service=n(7595)},7595(e,t,n){"use strict";e.exports=i;var r=n(3610);function i(e,t,n){if("function"!=typeof e)throw TypeError("rpcImpl must be a function");r.EventEmitter.call(this),this.rpcImpl=e,this.requestDelimited=Boolean(t),this.responseDelimited=Boolean(n)}(i.prototype=Object.create(r.EventEmitter.prototype)).constructor=i,i.prototype.rpcCall=function e(t,n,i,s,o){if(!s)throw TypeError("request must be specified");var a=this;if(!o)return r.asPromise(e,a,t,n,i,s);if(a.rpcImpl)try{return a.rpcImpl(t,n[a.requestDelimited?"encodeDelimited":"encode"](s).finish(),function(e,n){if(e)return a.emit("error",e,t),o(e);if(null!==n){if(!(n instanceof i))try{n=i[a.responseDelimited?"decodeDelimited":"decode"](n)}catch(e){return a.emit("error",e,t),o(e)}return a.emit("data",n,t),o(null,n)}a.end(!0)})}catch(e){return a.emit("error",e,t),void setTimeout(function(){o(e)},0)}else setTimeout(function(){o(Error("already ended"))},0)},i.prototype.end=function(e){return this.rpcImpl&&(e||this.rpcImpl(null,null,null),this.rpcImpl=null,this.emit("end").off()),this}},9687(e,t,n){"use strict";e.exports=a;var r=n(1304);((a.prototype=Object.create(r.prototype)).constructor=a).className="Service";var i=n(8811),s=n(3262),o=n(5047);function a(e,t){r.call(this,e,t),this.methods={},this._methodsArray=null}function c(e){return e._methodsArray=null,e}a.fromJSON=function(e,t){var n=new a(e,t.options);if(t.methods)for(var r=Object.keys(t.methods),s=0;s<r.length;++s)n.add(i.fromJSON(r[s],t.methods[r[s]]));return t.nested&&n.addJSON(t.nested),t.edition&&(n._edition=t.edition),n.comment=t.comment,n._defaultEdition="proto3",n},a.prototype.toJSON=function(e){var t=r.prototype.toJSON.call(this,e),n=!!e&&Boolean(e.keepComments);return s.toObject(["edition",this._editionToJSON(),"options",t&&t.options||void 0,"methods",r.arrayToJSON(this.methodsArray,e)||{},"nested",t&&t.nested||void 0,"comment",n?this.comment:void 0])},Object.defineProperty(a.prototype,"methodsArray",{get:function(){return this._methodsArray||(this._methodsArray=s.toArray(this.methods))}}),a.prototype.get=function(e){return this.methods[e]||r.prototype.get.call(this,e)},a.prototype.resolveAll=function(){if(!this._needsRecursiveResolve)return this;r.prototype.resolve.call(this);for(var e=this.methodsArray,t=0;t<e.length;++t)e[t].resolve();return this},a.prototype._resolveFeaturesRecursive=function(e){return this._needsRecursiveFeatureResolution?(e=this._edition||e,r.prototype._resolveFeaturesRecursive.call(this,e),this.methodsArray.forEach(t=>{t._resolveFeaturesRecursive(e)}),this):this},a.prototype.add=function(e){if(this.get(e.name))throw Error("duplicate name '"+e.name+"' in "+this);return e instanceof i?(this.methods[e.name]=e,e.parent=this,c(this)):r.prototype.add.call(this,e)},a.prototype.remove=function(e){if(e instanceof i){if(this.methods[e.name]!==e)throw Error(e+" is not a member of "+this);return delete this.methods[e.name],e.parent=null,c(this)}return r.prototype.remove.call(this,e)},a.prototype.create=function(e,t,n){for(var r,i=new o.Service(e,t,n),a=0;a<this.methodsArray.length;++a){var c=s.lcFirst((r=this._methodsArray[a]).resolve().name).replace(/[^$\w_]/g,"");i[c]=s.codegen(["r","c"],s.isReserved(c)?c+"_":c)("return this.rpcCall(m,q,s,r,c)")({m:r,q:r.resolvedRequestType.ctor,s:r.resolvedResponseType.ctor})}return i}},527(e){"use strict";e.exports=u;var t=/[\s{}=;:[\],'"()<>]/g,n=/(?:"([^"\\]*(?:\\.[^"\\]*)*)")/g,r=/(?:'([^'\\]*(?:\\.[^'\\]*)*)')/g,i=/^ *[*/]+ */,s=/^\s*\*?\/*/,o=/\n/g,a=/\s/,c=/\\(.?)/g,l={0:"\0",r:"\r",n:"\n",t:"\t"};function h(e){return e.replace(c,function(e,t){switch(t){case"\\":case"":return t;default:return l[t]||""}})}function u(e,c){e=e.toString();var l=0,u=e.length,d=1,f=0,p={},g=[],m=null;function _(e){return Error("illegal "+e+" (line "+d+")")}function y(t){return e.charAt(t)}function v(t,n,r){var a,l={type:e.charAt(t++),lineEmpty:!1,leading:r},h=t-(c?2:3);do{if(--h<0||"\n"===(a=e.charAt(h))){l.lineEmpty=!0;break}}while(" "===a||"\t"===a);for(var u=e.substring(t,n).split(o),g=0;g<u.length;++g)u[g]=u[g].replace(c?s:i,"").trim();l.text=u.join("\n").trim(),p[d]=l,f=d}function b(t){var n=E(t),r=e.substring(t,n);return/^\s*\/\//.test(r)}function E(e){for(var t=e;t<u&&"\n"!==y(t);)t++;return t}function A(){if(g.length>0)return g.shift();if(m)return function(){var t="'"===m?r:n;t.lastIndex=l-1;var i=t.exec(e);if(!i)throw _("string");return l=t.lastIndex,S(m),m=null,h(i[1])}();var i,s,o,f,p,A=0===l;do{if(l===u)return null;for(i=!1;a.test(o=y(l));)if("\n"===o&&(A=!0,++d),++l===u)return null;if("/"===y(l)){if(++l===u)throw _("comment");if("/"===y(l))if(c){if(f=l,p=!1,b(l-1)){p=!0;do{if((l=E(l))===u)break;if(l++,!A)break}while(b(l))}else l=Math.min(u,E(l)+1);p&&(v(f,l,A),A=!0),d++,i=!0}else{for(p="/"===y(f=l+1);"\n"!==y(++l);)if(l===u)return null;++l,p&&(v(f,l-1,A),A=!0),++d,i=!0}else{if("*"!==(o=y(l)))return"/";f=l+1,p=c||"*"===y(f);do{if("\n"===o&&++d,++l===u)throw _("comment");s=o,o=y(l)}while("*"!==s||"/"!==o);++l,p&&(v(f,l-2,A),A=!0),i=!0}}}while(i);var w=l;if(t.lastIndex=0,!t.test(y(w++)))for(;w<u&&!t.test(y(w));)++w;var C=e.substring(l,l=w);return'"'!==C&&"'"!==C||(m=C),C}function S(e){g.push(e)}function w(){if(!g.length){var e=A();if(null===e)return null;S(e)}return g[0]}return Object.defineProperty({next:A,peek:w,push:S,skip:function(e,t){var n=w();if(n===e)return A(),!0;if(!t)throw _("token '"+n+"', '"+e+"' expected");return!1},cmnt:function(e){var t,n=null;return void 0===e?(t=p[d-1],delete p[d-1],t&&(c||"*"===t.type||t.lineEmpty)&&(n=t.leading?t.text:null)):(f<e&&w(),t=p[e],delete p[e],!t||t.lineEmpty||!c&&"/"!==t.type||(n=t.leading?null:t.text)),n}},"line",{get:function(){return d}})}u.unescape=h},7882(e,t,n){"use strict";e.exports=y;var r=n(1304);((y.prototype=Object.create(r.prototype)).constructor=y).className="Type";var i=n(5643),s=n(1457),o=n(1344),a=n(8252),c=n(9687),l=n(2551),h=n(6237),u=n(3449),d=n(3262),f=n(1080),p=n(7728),g=n(420),m=n(744),_=n(6434);function y(e,t){r.call(this,e,t),this.fields={},this.oneofs=void 0,this.extensions=void 0,this.reserved=void 0,this.group=void 0,this._fieldsById=null,this._fieldsArray=null,this._oneofsArray=null,this._ctor=null}function v(e){return e._fieldsById=e._fieldsArray=e._oneofsArray=null,delete e.encode,delete e.decode,delete e.verify,e}Object.defineProperties(y.prototype,{fieldsById:{get:function(){if(this._fieldsById)return this._fieldsById;this._fieldsById={};for(var e=Object.keys(this.fields),t=0;t<e.length;++t){var n=this.fields[e[t]],r=n.id;if(this._fieldsById[r])throw Error("duplicate id "+r+" in "+this);this._fieldsById[r]=n}return this._fieldsById}},fieldsArray:{get:function(){return this._fieldsArray||(this._fieldsArray=d.toArray(this.fields))}},oneofsArray:{get:function(){return this._oneofsArray||(this._oneofsArray=d.toArray(this.oneofs))}},ctor:{get:function(){return this._ctor||(this.ctor=y.generateConstructor(this)())},set:function(e){var t=e.prototype;t instanceof l||((e.prototype=new l).constructor=e,d.merge(e.prototype,t)),e.$type=e.prototype.$type=this,d.merge(e,l,!0),this._ctor=e;for(var n=0;n<this.fieldsArray.length;++n)this._fieldsArray[n].resolve();var r={};for(n=0;n<this.oneofsArray.length;++n)r[this._oneofsArray[n].resolve().name]={get:d.oneOfGetter(this._oneofsArray[n].oneof),set:d.oneOfSetter(this._oneofsArray[n].oneof)};n&&Object.defineProperties(e.prototype,r)}}}),y.generateConstructor=function(e){for(var t,n=d.codegen(["p"],e.name),r=0;r<e.fieldsArray.length;++r)(t=e._fieldsArray[r]).map?n("this%s={}",d.safeProp(t.name)):t.repeated&&n("this%s=[]",d.safeProp(t.name));return n("if(p)for(var ks=Object.keys(p),i=0;i<ks.length;++i)if(p[ks[i]]!=null)")("this[ks[i]]=p[ks[i]]")},y.fromJSON=function(e,t){var n=new y(e,t.options);n.extensions=t.extensions,n.reserved=t.reserved;for(var l=Object.keys(t.fields),h=0;h<l.length;++h)n.add((void 0!==t.fields[l[h]].keyType?a.fromJSON:o.fromJSON)(l[h],t.fields[l[h]]));if(t.oneofs)for(l=Object.keys(t.oneofs),h=0;h<l.length;++h)n.add(s.fromJSON(l[h],t.oneofs[l[h]]));if(t.nested)for(l=Object.keys(t.nested),h=0;h<l.length;++h){var u=t.nested[l[h]];n.add((void 0!==u.id?o.fromJSON:void 0!==u.fields?y.fromJSON:void 0!==u.values?i.fromJSON:void 0!==u.methods?c.fromJSON:r.fromJSON)(l[h],u))}return t.extensions&&t.extensions.length&&(n.extensions=t.extensions),t.reserved&&t.reserved.length&&(n.reserved=t.reserved),t.group&&(n.group=!0),t.comment&&(n.comment=t.comment),t.edition&&(n._edition=t.edition),n._defaultEdition="proto3",n},y.prototype.toJSON=function(e){var t=r.prototype.toJSON.call(this,e),n=!!e&&Boolean(e.keepComments);return d.toObject(["edition",this._editionToJSON(),"options",t&&t.options||void 0,"oneofs",r.arrayToJSON(this.oneofsArray,e),"fields",r.arrayToJSON(this.fieldsArray.filter(function(e){return!e.declaringField}),e)||{},"extensions",this.extensions&&this.extensions.length?this.extensions:void 0,"reserved",this.reserved&&this.reserved.length?this.reserved:void 0,"group",this.group||void 0,"nested",t&&t.nested||void 0,"comment",n?this.comment:void 0])},y.prototype.resolveAll=function(){if(!this._needsRecursiveResolve)return this;r.prototype.resolveAll.call(this);var e=this.oneofsArray;for(n=0;n<e.length;)e[n++].resolve();for(var t=this.fieldsArray,n=0;n<t.length;)t[n++].resolve();return this},y.prototype._resolveFeaturesRecursive=function(e){return this._needsRecursiveFeatureResolution?(e=this._edition||e,r.prototype._resolveFeaturesRecursive.call(this,e),this.oneofsArray.forEach(t=>{t._resolveFeatures(e)}),this.fieldsArray.forEach(t=>{t._resolveFeatures(e)}),this):this},y.prototype.get=function(e){return this.fields[e]||this.oneofs&&this.oneofs[e]||this.nested&&this.nested[e]||null},y.prototype.add=function(e){if(this.get(e.name))throw Error("duplicate name '"+e.name+"' in "+this);if(e instanceof o&&void 0===e.extend){if(this._fieldsById?this._fieldsById[e.id]:this.fieldsById[e.id])throw Error("duplicate id "+e.id+" in "+this);if(this.isReservedId(e.id))throw Error("id "+e.id+" is reserved in "+this);if(this.isReservedName(e.name))throw Error("name '"+e.name+"' is reserved in "+this);return e.parent&&e.parent.remove(e),this.fields[e.name]=e,e.message=this,e.onAdd(this),v(this)}return e instanceof s?(this.oneofs||(this.oneofs={}),this.oneofs[e.name]=e,e.onAdd(this),v(this)):r.prototype.add.call(this,e)},y.prototype.remove=function(e){if(e instanceof o&&void 0===e.extend){if(!this.fields||this.fields[e.name]!==e)throw Error(e+" is not a member of "+this);return delete this.fields[e.name],e.parent=null,e.onRemove(this),v(this)}if(e instanceof s){if(!this.oneofs||this.oneofs[e.name]!==e)throw Error(e+" is not a member of "+this);return delete this.oneofs[e.name],e.parent=null,e.onRemove(this),v(this)}return r.prototype.remove.call(this,e)},y.prototype.isReservedId=function(e){return r.isReservedId(this.reserved,e)},y.prototype.isReservedName=function(e){return r.isReservedName(this.reserved,e)},y.prototype.create=function(e){return new this.ctor(e)},y.prototype.setup=function(){for(var e=this.fullName,t=[],n=0;n<this.fieldsArray.length;++n)t.push(this._fieldsArray[n].resolve().resolvedType);this.encode=f(this)({Writer:u,types:t,util:d}),this.decode=p(this)({Reader:h,types:t,util:d}),this.verify=g(this)({types:t,util:d}),this.fromObject=m.fromObject(this)({types:t,util:d}),this.toObject=m.toObject(this)({types:t,util:d});var r=_[e];if(r){var i=Object.create(this);i.fromObject=this.fromObject,this.fromObject=r.fromObject.bind(i),i.toObject=this.toObject,this.toObject=r.toObject.bind(i)}return this},y.prototype.encode=function(e,t){return this.setup().encode(e,t)},y.prototype.encodeDelimited=function(e,t){return this.encode(e,t&&t.len?t.fork():t).ldelim()},y.prototype.decode=function(e,t){return this.setup().decode(e,t)},y.prototype.decodeDelimited=function(e){return e instanceof h||(e=h.create(e)),this.decode(e,e.uint32())},y.prototype.verify=function(e){return this.setup().verify(e)},y.prototype.fromObject=function(e){return this.setup().fromObject(e)},y.prototype.toObject=function(e,t){return this.setup().toObject(e,t)},y.d=function(e){return function(t){d.decorateType(t,e)}}},361(e,t,n){"use strict";var r=t,i=n(3262),s=["double","float","int32","uint32","sint32","fixed32","sfixed32","int64","uint64","sint64","fixed64","sfixed64","bool","string","bytes"];function o(e,t){var n=0,r={};for(t|=0;n<e.length;)r[s[n+t]]=e[n++];return r}r.basic=o([1,5,0,0,0,5,5,0,0,0,1,1,0,2,2]),r.defaults=o([0,0,0,0,0,0,0,0,0,0,0,0,!1,"",i.emptyArray,null]),r.long=o([0,0,0,1,1],7),r.mapKey=o([0,0,0,5,5,0,0,0,1,1,0,2],2),r.packed=o([1,5,0,0,0,5,5,0,0,0,1,1,0])},3262(e,t,n){"use strict";var r,i,s=e.exports=n(3610),o=n(4529);s.codegen=n(8561),s.fetch=n(5212),s.path=n(9207),s.fs=s.inquire("fs"),s.toArray=function(e){if(e){for(var t=Object.keys(e),n=new Array(t.length),r=0;r<t.length;)n[r]=e[t[r++]];return n}return[]},s.toObject=function(e){for(var t={},n=0;n<e.length;){var r=e[n++],i=e[n++];void 0!==i&&(t[r]=i)}return t};var a=/\\/g,c=/"/g;s.isReserved=function(e){return/^(?:do|if|in|for|let|new|try|var|case|else|enum|eval|false|null|this|true|void|with|break|catch|class|const|super|throw|while|yield|delete|export|import|public|return|static|switch|typeof|default|extends|finally|package|private|continue|debugger|function|arguments|interface|protected|implements|instanceof)$/.test(e)},s.safeProp=function(e){return!/^[$\w_]+$/.test(e)||s.isReserved(e)?'["'+e.replace(a,"\\\\").replace(c,'\\"')+'"]':"."+e},s.ucFirst=function(e){return e.charAt(0).toUpperCase()+e.substring(1)};var l=/_([a-z])/g;s.camelCase=function(e){return e.substring(0,1)+e.substring(1).replace(l,function(e,t){return t.toUpperCase()})},s.compareFieldsById=function(e,t){return e.id-t.id},s.decorateType=function(e,t){if(e.$type)return t&&e.$type.name!==t&&(s.decorateRoot.remove(e.$type),e.$type.name=t,s.decorateRoot.add(e.$type)),e.$type;r||(r=n(7882));var i=new r(t||e.name);return s.decorateRoot.add(i),i.ctor=e,Object.defineProperty(e,"$type",{value:i,enumerable:!1}),Object.defineProperty(e.prototype,"$type",{value:i,enumerable:!1}),i};var h=0;s.decorateEnum=function(e){if(e.$type)return e.$type;i||(i=n(5643));var t=new i("Enum"+h++,e);return s.decorateRoot.add(t),Object.defineProperty(e,"$type",{value:t,enumerable:!1}),t},s.setProperty=function(e,t,n,r){if("object"!=typeof e)throw TypeError("dst must be an object");if(!t)throw TypeError("path must be specified");return function e(t,n,i){var s=n.shift();if("__proto__"===s||"prototype"===s)return t;if(n.length>0)t[s]=e(t[s]||{},n,i);else{var o=t[s];if(o&&r)return t;o&&(i=[].concat(o).concat(i)),t[s]=i}return t}(e,t=t.split("."),n)},Object.defineProperty(s,"decorateRoot",{get:function(){return o.decorated||(o.decorated=new(n(5330)))}})},2239(e,t,n){"use strict";e.exports=i;var r=n(3610);function i(e,t){this.lo=e>>>0,this.hi=t>>>0}var s=i.zero=new i(0,0);s.toNumber=function(){return 0},s.zzEncode=s.zzDecode=function(){return this},s.length=function(){return 1};var o=i.zeroHash="\0\0\0\0\0\0\0\0";i.fromNumber=function(e){if(0===e)return s;var t=e<0;t&&(e=-e);var n=e>>>0,r=(e-n)/4294967296>>>0;return t&&(r=~r>>>0,n=~n>>>0,++n>4294967295&&(n=0,++r>4294967295&&(r=0))),new i(n,r)},i.from=function(e){if("number"==typeof e)return i.fromNumber(e);if(r.isString(e)){if(!r.Long)return i.fromNumber(parseInt(e,10));e=r.Long.fromString(e)}return e.low||e.high?new i(e.low>>>0,e.high>>>0):s},i.prototype.toNumber=function(e){if(!e&&this.hi>>>31){var t=1+~this.lo>>>0,n=~this.hi>>>0;return t||(n=n+1>>>0),-(t+4294967296*n)}return this.lo+4294967296*this.hi},i.prototype.toLong=function(e){return r.Long?new r.Long(0|this.lo,0|this.hi,Boolean(e)):{low:0|this.lo,high:0|this.hi,unsigned:Boolean(e)}};var a=String.prototype.charCodeAt;i.fromHash=function(e){return e===o?s:new i((a.call(e,0)|a.call(e,1)<<8|a.call(e,2)<<16|a.call(e,3)<<24)>>>0,(a.call(e,4)|a.call(e,5)<<8|a.call(e,6)<<16|a.call(e,7)<<24)>>>0)},i.prototype.toHash=function(){return String.fromCharCode(255&this.lo,this.lo>>>8&255,this.lo>>>16&255,this.lo>>>24,255&this.hi,this.hi>>>8&255,this.hi>>>16&255,this.hi>>>24)},i.prototype.zzEncode=function(){var e=this.hi>>31;return this.hi=((this.hi<<1|this.lo>>>31)^e)>>>0,this.lo=(this.lo<<1^e)>>>0,this},i.prototype.zzDecode=function(){var e=-(1&this.lo);return this.lo=((this.lo>>>1|this.hi<<31)^e)>>>0,this.hi=(this.hi>>>1^e)>>>0,this},i.prototype.length=function(){var e=this.lo,t=(this.lo>>>28|this.hi<<4)>>>0,n=this.hi>>>24;return 0===n?0===t?e<16384?e<128?1:2:e<2097152?3:4:t<16384?t<128?5:6:t<2097152?7:8:n<128?9:10}},3610(e,t,n){"use strict";var r=t;function i(e,t,n){for(var r=Object.keys(t),i=0;i<r.length;++i)void 0!==e[r[i]]&&n||(e[r[i]]=t[r[i]]);return e}function s(e){function t(e,n){if(!(this instanceof t))return new t(e,n);Object.defineProperty(this,"message",{get:function(){return e}}),Error.captureStackTrace?Error.captureStackTrace(this,t):Object.defineProperty(this,"stack",{value:(new Error).stack||""}),n&&i(this,n)}return t.prototype=Object.create(Error.prototype,{constructor:{value:t,writable:!0,enumerable:!1,configurable:!0},name:{get:function(){return e},set:void 0,enumerable:!1,configurable:!0},toString:{value:function(){return this.name+": "+this.message},writable:!0,enumerable:!1,configurable:!0}}),t}r.asPromise=n(8045),r.base64=n(8839),r.EventEmitter=n(4358),r.float=n(9410),r.inquire=n(4153),r.utf8=n(1447),r.pool=n(9390),r.LongBits=n(2239),r.isNode=Boolean("undefined"!=typeof global&&global&&global.process&&global.process.versions&&global.process.versions.node),r.global=r.isNode&&global||"undefined"!=typeof window&&window||"undefined"!=typeof self&&self||this,r.emptyArray=Object.freeze?Object.freeze([]):[],r.emptyObject=Object.freeze?Object.freeze({}):{},r.isInteger=Number.isInteger||function(e){return"number"==typeof e&&isFinite(e)&&Math.floor(e)===e},r.isString=function(e){return"string"==typeof e||e instanceof String},r.isObject=function(e){return e&&"object"==typeof e},r.isset=r.isSet=function(e,t){var n=e[t];return!(null==n||!e.hasOwnProperty(t))&&("object"!=typeof n||(Array.isArray(n)?n.length:Object.keys(n).length)>0)},r.Buffer=function(){try{var e=r.inquire("buffer").Buffer;return e.prototype.utf8Write?e:null}catch(e){return null}}(),r._Buffer_from=null,r._Buffer_allocUnsafe=null,r.newBuffer=function(e){return"number"==typeof e?r.Buffer?r._Buffer_allocUnsafe(e):new r.Array(e):r.Buffer?r._Buffer_from(e):"undefined"==typeof Uint8Array?e:new Uint8Array(e)},r.Array="undefined"!=typeof Uint8Array?Uint8Array:Array,r.Long=r.global.dcodeIO&&r.global.dcodeIO.Long||r.global.Long||r.inquire("long"),r.key2Re=/^true|false|0|1$/,r.key32Re=/^-?(?:0|[1-9][0-9]*)$/,r.key64Re=/^(?:[\\x00-\\xff]{8}|-?(?:0|[1-9][0-9]*))$/,r.longToHash=function(e){return e?r.LongBits.from(e).toHash():r.LongBits.zeroHash},r.longFromHash=function(e,t){var n=r.LongBits.fromHash(e);return r.Long?r.Long.fromBits(n.lo,n.hi,t):n.toNumber(Boolean(t))},r.merge=i,r.lcFirst=function(e){return e.charAt(0).toLowerCase()+e.substring(1)},r.newError=s,r.ProtocolError=s("ProtocolError"),r.oneOfGetter=function(e){for(var t={},n=0;n<e.length;++n)t[e[n]]=1;return function(){for(var e=Object.keys(this),n=e.length-1;n>-1;--n)if(1===t[e[n]]&&void 0!==this[e[n]]&&null!==this[e[n]])return e[n]}},r.oneOfSetter=function(e){return function(t){for(var n=0;n<e.length;++n)e[n]!==t&&delete this[e[n]]}},r.toJSONOptions={longs:String,enums:String,bytes:String,json:!0},r._configure=function(){var e=r.Buffer;e?(r._Buffer_from=e.from!==Uint8Array.from&&e.from||function(t,n){return new e(t,n)},r._Buffer_allocUnsafe=e.allocUnsafe||function(t){return new e(t)}):r._Buffer_from=r._Buffer_allocUnsafe=null}},420(e,t,n){"use strict";e.exports=function(e){var t=i.codegen(["m"],e.name+"$verify")('if(typeof m!=="object"||m===null)')("return%j","object expected"),n=e.oneofsArray,r={};n.length&&t("var p={}");for(var c=0;c<e.fieldsArray.length;++c){var l=e._fieldsArray[c].resolve(),h="m"+i.safeProp(l.name);if(l.optional&&t("if(%s!=null&&m.hasOwnProperty(%j)){",h,l.name),l.map)t("if(!util.isObject(%s))",h)("return%j",s(l,"object"))("var k=Object.keys(%s)",h)("for(var i=0;i<k.length;++i){"),a(t,l,"k[i]"),o(t,l,c,h+"[k[i]]")("}");else if(l.repeated)t("if(!Array.isArray(%s))",h)("return%j",s(l,"array"))("for(var i=0;i<%s.length;++i){",h),o(t,l,c,h+"[i]")("}");else{if(l.partOf){var u=i.safeProp(l.partOf.name);1===r[l.partOf.name]&&t("if(p%s===1)",u)("return%j",l.partOf.name+": multiple values"),r[l.partOf.name]=1,t("p%s=1",u)}o(t,l,c,h)}l.optional&&t("}")}return t("return null")};var r=n(5643),i=n(3262);function s(e,t){return e.name+": "+t+(e.repeated&&"array"!==t?"[]":e.map&&"object"!==t?"{k:"+e.keyType+"}":"")+" expected"}function o(e,t,n,i){if(t.resolvedType)if(t.resolvedType instanceof r){e("switch(%s){",i)("default:")("return%j",s(t,"enum value"));for(var o=Object.keys(t.resolvedType.values),a=0;a<o.length;++a)e("case %i:",t.resolvedType.values[o[a]]);e("break")("}")}else e("{")("var e=types[%i].verify(%s);",n,i)("if(e)")("return%j+e",t.name+".")("}");else switch(t.type){case"int32":case"uint32":case"sint32":case"fixed32":case"sfixed32":e("if(!util.isInteger(%s))",i)("return%j",s(t,"integer"));break;case"int64":case"uint64":case"sint64":case"fixed64":case"sfixed64":e("if(!util.isInteger(%s)&&!(%s&&util.isInteger(%s.low)&&util.isInteger(%s.high)))",i,i,i,i)("return%j",s(t,"integer|Long"));break;case"float":case"double":e('if(typeof %s!=="number")',i)("return%j",s(t,"number"));break;case"bool":e('if(typeof %s!=="boolean")',i)("return%j",s(t,"boolean"));break;case"string":e("if(!util.isString(%s))",i)("return%j",s(t,"string"));break;case"bytes":e('if(!(%s&&typeof %s.length==="number"||util.isString(%s)))',i,i,i)("return%j",s(t,"buffer"))}return e}function a(e,t,n){switch(t.keyType){case"int32":case"uint32":case"sint32":case"fixed32":case"sfixed32":e("if(!util.key32Re.test(%s))",n)("return%j",s(t,"integer key"));break;case"int64":case"uint64":case"sint64":case"fixed64":case"sfixed64":e("if(!util.key64Re.test(%s))",n)("return%j",s(t,"integer|Long key"));break;case"bool":e("if(!util.key2Re.test(%s))",n)("return%j",s(t,"boolean key"))}return e}},6434(e,t,n){"use strict";var r=t,i=n(2551);r[".google.protobuf.Any"]={fromObject:function(e){if(e&&e["@type"]){var t=e["@type"].substring(e["@type"].lastIndexOf("/")+1),n=this.lookup(t);if(n){var r="."===e["@type"].charAt(0)?e["@type"].slice(1):e["@type"];return-1===r.indexOf("/")&&(r="/"+r),this.create({type_url:r,value:n.encode(n.fromObject(e)).finish()})}}return this.fromObject(e)},toObject:function(e,t){var n="",r="";if(t&&t.json&&e.type_url&&e.value){r=e.type_url.substring(e.type_url.lastIndexOf("/")+1),n=e.type_url.substring(0,e.type_url.lastIndexOf("/")+1);var s=this.lookup(r);s&&(e=s.decode(e.value))}if(!(e instanceof this.ctor)&&e instanceof i){var o=e.$type.toObject(e,t);return""===n&&(n="type.googleapis.com/"),r=n+("."===e.$type.fullName[0]?e.$type.fullName.slice(1):e.$type.fullName),o["@type"]=r,o}return this.toObject(e,t)}}},3449(e,t,n){"use strict";e.exports=u;var r,i=n(3610),s=i.LongBits,o=i.base64,a=i.utf8;function c(e,t,n){this.fn=e,this.len=t,this.next=void 0,this.val=n}function l(){}function h(e){this.head=e.head,this.tail=e.tail,this.len=e.len,this.next=e.states}function u(){this.len=0,this.head=new c(l,0,0),this.tail=this.head,this.states=null}var d=function(){return i.Buffer?function(){return(u.create=function(){return new r})()}:function(){return new u}};function f(e,t,n){t[n]=255&e}function p(e,t){this.len=e,this.next=void 0,this.val=t}function g(e,t,n){for(;e.hi;)t[n++]=127&e.lo|128,e.lo=(e.lo>>>7|e.hi<<25)>>>0,e.hi>>>=7;for(;e.lo>127;)t[n++]=127&e.lo|128,e.lo=e.lo>>>7;t[n++]=e.lo}function m(e,t,n){t[n]=255&e,t[n+1]=e>>>8&255,t[n+2]=e>>>16&255,t[n+3]=e>>>24}u.create=d(),u.alloc=function(e){return new i.Array(e)},i.Array!==Array&&(u.alloc=i.pool(u.alloc,i.Array.prototype.subarray)),u.prototype._push=function(e,t,n){return this.tail=this.tail.next=new c(e,t,n),this.len+=t,this},p.prototype=Object.create(c.prototype),p.prototype.fn=function(e,t,n){for(;e>127;)t[n++]=127&e|128,e>>>=7;t[n]=e},u.prototype.uint32=function(e){return this.len+=(this.tail=this.tail.next=new p((e>>>=0)<128?1:e<16384?2:e<2097152?3:e<268435456?4:5,e)).len,this},u.prototype.int32=function(e){return e<0?this._push(g,10,s.fromNumber(e)):this.uint32(e)},u.prototype.sint32=function(e){return this.uint32((e<<1^e>>31)>>>0)},u.prototype.uint64=function(e){var t=s.from(e);return this._push(g,t.length(),t)},u.prototype.int64=u.prototype.uint64,u.prototype.sint64=function(e){var t=s.from(e).zzEncode();return this._push(g,t.length(),t)},u.prototype.bool=function(e){return this._push(f,1,e?1:0)},u.prototype.fixed32=function(e){return this._push(m,4,e>>>0)},u.prototype.sfixed32=u.prototype.fixed32,u.prototype.fixed64=function(e){var t=s.from(e);return this._push(m,4,t.lo)._push(m,4,t.hi)},u.prototype.sfixed64=u.prototype.fixed64,u.prototype.float=function(e){return this._push(i.float.writeFloatLE,4,e)},u.prototype.double=function(e){return this._push(i.float.writeDoubleLE,8,e)};var _=i.Array.prototype.set?function(e,t,n){t.set(e,n)}:function(e,t,n){for(var r=0;r<e.length;++r)t[n+r]=e[r]};u.prototype.bytes=function(e){var t=e.length>>>0;if(!t)return this._push(f,1,0);if(i.isString(e)){var n=u.alloc(t=o.length(e));o.decode(e,n,0),e=n}return this.uint32(t)._push(_,t,e)},u.prototype.string=function(e){var t=a.length(e);return t?this.uint32(t)._push(a.write,t,e):this._push(f,1,0)},u.prototype.fork=function(){return this.states=new h(this),this.head=this.tail=new c(l,0,0),this.len=0,this},u.prototype.reset=function(){return this.states?(this.head=this.states.head,this.tail=this.states.tail,this.len=this.states.len,this.states=this.states.next):(this.head=this.tail=new c(l,0,0),this.len=0),this},u.prototype.ldelim=function(){var e=this.head,t=this.tail,n=this.len;return this.reset().uint32(n),n&&(this.tail.next=e.next,this.tail=t,this.len+=n),this},u.prototype.finish=function(){for(var e=this.head.next,t=this.constructor.alloc(this.len),n=0;e;)e.fn(e.val,t,n),n+=e.len,e=e.next;return t},u._configure=function(e){r=e,u.create=d(),r._configure()}},818(e,t,n){"use strict";e.exports=s;var r=n(3449);(s.prototype=Object.create(r.prototype)).constructor=s;var i=n(3610);function s(){r.call(this)}function o(e,t,n){e.length<40?i.utf8.write(e,t,n):t.utf8Write?t.utf8Write(e,n):t.write(e,n)}s._configure=function(){s.alloc=i._Buffer_allocUnsafe,s.writeBytesBuffer=i.Buffer&&i.Buffer.prototype instanceof Uint8Array&&"set"===i.Buffer.prototype.set.name?function(e,t,n){t.set(e,n)}:function(e,t,n){if(e.copy)e.copy(t,n,0,e.length);else for(var r=0;r<e.length;)t[n++]=e[r++]}},s.prototype.bytes=function(e){i.isString(e)&&(e=i._Buffer_from(e,"base64"));var t=e.length>>>0;return this.uint32(t),t&&this._push(s.writeBytesBuffer,t,e),this},s.prototype.string=function(e){var t=i.Buffer.byteLength(e);return this.uint32(t),t&&this._push(o,t,e),this},s._configure()},815(e,t,n){var r,i=n(3519),s=n(6611);try{r=n(9896)}catch(e){}var o=function(){},a="undefined"!=typeof process&&/^v?\.0/.test(process.version),c=function(e){return"function"==typeof e},l=function(e,t,n,l){l=i(l);var h=!1;e.on("close",function(){h=!0}),s(e,{readable:t,writable:n},function(e){if(e)return l(e);h=!0,l()});var u=!1;return function(t){if(!h&&!u)return u=!0,function(e){return!!a&&!!r&&(e instanceof(r.ReadStream||o)||e instanceof(r.WriteStream||o))&&c(e.close)}(e)?e.close(o):function(e){return e.setHeader&&c(e.abort)}(e)?e.abort():c(e.destroy)?e.destroy():void l(t||new Error("stream was destroyed"))}},h=function(e){e()},u=function(e,t){return e.pipe(t)};e.exports=function(){var e,t=Array.prototype.slice.call(arguments),n=c(t[t.length-1]||o)&&t.pop()||o;if(Array.isArray(t[0])&&(t=t[0]),t.length<2)throw new Error("pump requires two streams per minimum");var r=t.map(function(i,s){var o=s<t.length-1;return l(i,o,s>0,function(t){e||(e=t),t&&r.forEach(h),o||(r.forEach(h),n(e))})});return t.reduce(u)}},113(e){"use strict";const t={};function n(e,n,r){r||(r=Error);class i extends r{constructor(e,t,r){super(function(e,t,r){return"string"==typeof n?n:n(e,t,r)}(e,t,r))}}i.prototype.name=r.name,i.prototype.code=e,t[e]=i}function r(e,t){if(Array.isArray(e)){const n=e.length;return e=e.map(e=>String(e)),n>2?`one of ${t} ${e.slice(0,n-1).join(", ")}, or `+e[n-1]:2===n?`one of ${t} ${e[0]} or ${e[1]}`:`of ${t} ${e[0]}`}return`of ${t} ${String(e)}`}n("ERR_INVALID_OPT_VALUE",function(e,t){return'The value "'+t+'" is invalid for option "'+e+'"'},TypeError),n("ERR_INVALID_ARG_TYPE",function(e,t,n){let i;var s,o;let a;if("string"==typeof t&&(s="not ",t.substr(!o||o<0?0:+o,s.length)===s)?(i="must not be",t=t.replace(/^not /,"")):i="must be",function(e,t,n){return(void 0===n||n>e.length)&&(n=e.length),e.substring(n-t.length,n)===t}(e," argument"))a=`The ${e} ${i} ${r(t,"type")}`;else{const n=function(e,t,n){return"number"!=typeof n&&(n=0),!(n+t.length>e.length)&&-1!==e.indexOf(t,n)}(e,".")?"property":"argument";a=`The "${e}" ${n} ${i} ${r(t,"type")}`}return a+=". Received type "+typeof n,a},TypeError),n("ERR_STREAM_PUSH_AFTER_EOF","stream.push() after EOF"),n("ERR_METHOD_NOT_IMPLEMENTED",function(e){return"The "+e+" method is not implemented"}),n("ERR_STREAM_PREMATURE_CLOSE","Premature close"),n("ERR_STREAM_DESTROYED",function(e){return"Cannot call "+e+" after a stream was destroyed"}),n("ERR_MULTIPLE_CALLBACK","Callback called multiple times"),n("ERR_STREAM_CANNOT_PIPE","Cannot pipe, not readable"),n("ERR_STREAM_WRITE_AFTER_END","write after end"),n("ERR_STREAM_NULL_VALUES","May not write null values to stream",TypeError),n("ERR_UNKNOWN_ENCODING",function(e){return"Unknown encoding: "+e},TypeError),n("ERR_STREAM_UNSHIFT_AFTER_END_EVENT","stream.unshift() after end event"),e.exports.F=t},5382(e,t,n){"use strict";var r=Object.keys||function(e){var t=[];for(var n in e)t.push(n);return t};e.exports=l;var i=n(5412),s=n(6708);n(2017)(l,i);for(var o=r(s.prototype),a=0;a<o.length;a++){var c=o[a];l.prototype[c]||(l.prototype[c]=s.prototype[c])}function l(e){if(!(this instanceof l))return new l(e);i.call(this,e),s.call(this,e),this.allowHalfOpen=!0,e&&(!1===e.readable&&(this.readable=!1),!1===e.writable&&(this.writable=!1),!1===e.allowHalfOpen&&(this.allowHalfOpen=!1,this.once("end",h)))}function h(){this._writableState.ended||process.nextTick(u,this)}function u(e){e.end()}Object.defineProperty(l.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}}),Object.defineProperty(l.prototype,"writableBuffer",{enumerable:!1,get:function(){return this._writableState&&this._writableState.getBuffer()}}),Object.defineProperty(l.prototype,"writableLength",{enumerable:!1,get:function(){return this._writableState.length}}),Object.defineProperty(l.prototype,"destroyed",{enumerable:!1,get:function(){return void 0!==this._readableState&&void 0!==this._writableState&&(this._readableState.destroyed&&this._writableState.destroyed)},set:function(e){void 0!==this._readableState&&void 0!==this._writableState&&(this._readableState.destroyed=e,this._writableState.destroyed=e)}})},3600(e,t,n){"use strict";e.exports=i;var r=n(4610);function i(e){if(!(this instanceof i))return new i(e);r.call(this,e)}n(2017)(i,r),i.prototype._transform=function(e,t,n){n(null,e)}},5412(e,t,n){"use strict";var r;e.exports=w,w.ReadableState=S;n(4434).EventEmitter;var i=function(e,t){return e.listeners(t).length},s=n(1416),o=n(181).Buffer,a=("undefined"!=typeof global?global:"undefined"!=typeof window?window:"undefined"!=typeof self?self:{}).Uint8Array||function(){};var c,l=n(9023);c=l&&l.debuglog?l.debuglog("stream"):function(){};var h,u,d,f=n(345),p=n(5896),g=n(5291).getHighWaterMark,m=n(113).F,_=m.ERR_INVALID_ARG_TYPE,y=m.ERR_STREAM_PUSH_AFTER_EOF,v=m.ERR_METHOD_NOT_IMPLEMENTED,b=m.ERR_STREAM_UNSHIFT_AFTER_END_EVENT;n(2017)(w,s);var E=p.errorOrDestroy,A=["error","close","destroy","pause","resume"];function S(e,t,i){r=r||n(5382),e=e||{},"boolean"!=typeof i&&(i=t instanceof r),this.objectMode=!!e.objectMode,i&&(this.objectMode=this.objectMode||!!e.readableObjectMode),this.highWaterMark=g(this,e,"readableHighWaterMark",i),this.buffer=new f,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.resumeScheduled=!1,this.paused=!0,this.emitClose=!1!==e.emitClose,this.autoDestroy=!!e.autoDestroy,this.destroyed=!1,this.defaultEncoding=e.defaultEncoding||"utf8",this.awaitDrain=0,this.readingMore=!1,this.decoder=null,this.encoding=null,e.encoding&&(h||(h=n(3141).I),this.decoder=new h(e.encoding),this.encoding=e.encoding)}function w(e){if(r=r||n(5382),!(this instanceof w))return new w(e);var t=this instanceof r;this._readableState=new S(e,this,t),this.readable=!0,e&&("function"==typeof e.read&&(this._read=e.read),"function"==typeof e.destroy&&(this._destroy=e.destroy)),s.call(this)}function C(e,t,n,r,i){c("readableAddChunk",t);var s,l=e._readableState;if(null===t)l.reading=!1,function(e,t){if(c("onEofChunk"),t.ended)return;if(t.decoder){var n=t.decoder.end();n&&n.length&&(t.buffer.push(n),t.length+=t.objectMode?1:n.length)}t.ended=!0,t.sync?R(e):(t.needReadable=!1,t.emittedReadable||(t.emittedReadable=!0,O(e)))}(e,l);else if(i||(s=function(e,t){var n;r=t,o.isBuffer(r)||r instanceof a||"string"==typeof t||void 0===t||e.objectMode||(n=new _("chunk",["string","Buffer","Uint8Array"],t));var r;return n}(l,t)),s)E(e,s);else if(l.objectMode||t&&t.length>0)if("string"==typeof t||l.objectMode||Object.getPrototypeOf(t)===o.prototype||(t=function(e){return o.from(e)}(t)),r)l.endEmitted?E(e,new b):I(e,l,t,!0);else if(l.ended)E(e,new y);else{if(l.destroyed)return!1;l.reading=!1,l.decoder&&!n?(t=l.decoder.write(t),l.objectMode||0!==t.length?I(e,l,t,!1):N(e,l)):I(e,l,t,!1)}else r||(l.reading=!1,N(e,l));return!l.ended&&(l.length<l.highWaterMark||0===l.length)}function I(e,t,n,r){t.flowing&&0===t.length&&!t.sync?(t.awaitDrain=0,e.emit("data",n)):(t.length+=t.objectMode?1:n.length,r?t.buffer.unshift(n):t.buffer.push(n),t.needReadable&&R(e)),N(e,t)}Object.defineProperty(w.prototype,"destroyed",{enumerable:!1,get:function(){return void 0!==this._readableState&&this._readableState.destroyed},set:function(e){this._readableState&&(this._readableState.destroyed=e)}}),w.prototype.destroy=p.destroy,w.prototype._undestroy=p.undestroy,w.prototype._destroy=function(e,t){t(e)},w.prototype.push=function(e,t){var n,r=this._readableState;return r.objectMode?n=!0:"string"==typeof e&&((t=t||r.defaultEncoding)!==r.encoding&&(e=o.from(e,t),t=""),n=!0),C(this,e,t,!1,n)},w.prototype.unshift=function(e){return C(this,e,null,!0,!1)},w.prototype.isPaused=function(){return!1===this._readableState.flowing},w.prototype.setEncoding=function(e){h||(h=n(3141).I);var t=new h(e);this._readableState.decoder=t,this._readableState.encoding=this._readableState.decoder.encoding;for(var r=this._readableState.buffer.head,i="";null!==r;)i+=t.write(r.data),r=r.next;return this._readableState.buffer.clear(),""!==i&&this._readableState.buffer.push(i),this._readableState.length=i.length,this};var k=1073741824;function T(e,t){return e<=0||0===t.length&&t.ended?0:t.objectMode?1:e!=e?t.flowing&&t.length?t.buffer.head.data.length:t.length:(e>t.highWaterMark&&(t.highWaterMark=function(e){return e>=k?e=k:(e--,e|=e>>>1,e|=e>>>2,e|=e>>>4,e|=e>>>8,e|=e>>>16,e++),e}(e)),e<=t.length?e:t.ended?t.length:(t.needReadable=!0,0))}function R(e){var t=e._readableState;c("emitReadable",t.needReadable,t.emittedReadable),t.needReadable=!1,t.emittedReadable||(c("emitReadable",t.flowing),t.emittedReadable=!0,process.nextTick(O,e))}function O(e){var t=e._readableState;c("emitReadable_",t.destroyed,t.length,t.ended),t.destroyed||!t.length&&!t.ended||(e.emit("readable"),t.emittedReadable=!1),t.needReadable=!t.flowing&&!t.ended&&t.length<=t.highWaterMark,D(e)}function N(e,t){t.readingMore||(t.readingMore=!0,process.nextTick(P,e,t))}function P(e,t){for(;!t.reading&&!t.ended&&(t.length<t.highWaterMark||t.flowing&&0===t.length);){var n=t.length;if(c("maybeReadMore read 0"),e.read(0),n===t.length)break}t.readingMore=!1}function B(e){var t=e._readableState;t.readableListening=e.listenerCount("readable")>0,t.resumeScheduled&&!t.paused?t.flowing=!0:e.listenerCount("data")>0&&e.resume()}function L(e){c("readable nexttick read 0"),e.read(0)}function x(e,t){c("resume",t.reading),t.reading||e.read(0),t.resumeScheduled=!1,e.emit("resume"),D(e),t.flowing&&!t.reading&&e.read(0)}function D(e){var t=e._readableState;for(c("flow",t.flowing);t.flowing&&null!==e.read(););}function M(e,t){return 0===t.length?null:(t.objectMode?n=t.buffer.shift():!e||e>=t.length?(n=t.decoder?t.buffer.join(""):1===t.buffer.length?t.buffer.first():t.buffer.concat(t.length),t.buffer.clear()):n=t.buffer.consume(e,t.decoder),n);var n}function U(e){var t=e._readableState;c("endReadable",t.endEmitted),t.endEmitted||(t.ended=!0,process.nextTick(F,t,e))}function F(e,t){if(c("endReadableNT",e.endEmitted,e.length),!e.endEmitted&&0===e.length&&(e.endEmitted=!0,t.readable=!1,t.emit("end"),e.autoDestroy)){var n=t._writableState;(!n||n.autoDestroy&&n.finished)&&t.destroy()}}function H(e,t){for(var n=0,r=e.length;n<r;n++)if(e[n]===t)return n;return-1}w.prototype.read=function(e){c("read",e),e=parseInt(e,10);var t=this._readableState,n=e;if(0!==e&&(t.emittedReadable=!1),0===e&&t.needReadable&&((0!==t.highWaterMark?t.length>=t.highWaterMark:t.length>0)||t.ended))return c("read: emitReadable",t.length,t.ended),0===t.length&&t.ended?U(this):R(this),null;if(0===(e=T(e,t))&&t.ended)return 0===t.length&&U(this),null;var r,i=t.needReadable;return c("need readable",i),(0===t.length||t.length-e<t.highWaterMark)&&c("length less than watermark",i=!0),t.ended||t.reading?c("reading or ended",i=!1):i&&(c("do read"),t.reading=!0,t.sync=!0,0===t.length&&(t.needReadable=!0),this._read(t.highWaterMark),t.sync=!1,t.reading||(e=T(n,t))),null===(r=e>0?M(e,t):null)?(t.needReadable=t.length<=t.highWaterMark,e=0):(t.length-=e,t.awaitDrain=0),0===t.length&&(t.ended||(t.needReadable=!0),n!==e&&t.ended&&U(this)),null!==r&&this.emit("data",r),r},w.prototype._read=function(e){E(this,new v("_read()"))},w.prototype.pipe=function(e,t){var n=this,r=this._readableState;switch(r.pipesCount){case 0:r.pipes=e;break;case 1:r.pipes=[r.pipes,e];break;default:r.pipes.push(e)}r.pipesCount+=1,c("pipe count=%d opts=%j",r.pipesCount,t);var s=(!t||!1!==t.end)&&e!==process.stdout&&e!==process.stderr?a:g;function o(t,i){c("onunpipe"),t===n&&i&&!1===i.hasUnpiped&&(i.hasUnpiped=!0,c("cleanup"),e.removeListener("close",f),e.removeListener("finish",p),e.removeListener("drain",l),e.removeListener("error",d),e.removeListener("unpipe",o),n.removeListener("end",a),n.removeListener("end",g),n.removeListener("data",u),h=!0,!r.awaitDrain||e._writableState&&!e._writableState.needDrain||l())}function a(){c("onend"),e.end()}r.endEmitted?process.nextTick(s):n.once("end",s),e.on("unpipe",o);var l=function(e){return function(){var t=e._readableState;c("pipeOnDrain",t.awaitDrain),t.awaitDrain&&t.awaitDrain--,0===t.awaitDrain&&i(e,"data")&&(t.flowing=!0,D(e))}}(n);e.on("drain",l);var h=!1;function u(t){c("ondata");var i=e.write(t);c("dest.write",i),!1===i&&((1===r.pipesCount&&r.pipes===e||r.pipesCount>1&&-1!==H(r.pipes,e))&&!h&&(c("false write response, pause",r.awaitDrain),r.awaitDrain++),n.pause())}function d(t){c("onerror",t),g(),e.removeListener("error",d),0===i(e,"error")&&E(e,t)}function f(){e.removeListener("finish",p),g()}function p(){c("onfinish"),e.removeListener("close",f),g()}function g(){c("unpipe"),n.unpipe(e)}return n.on("data",u),function(e,t,n){if("function"==typeof e.prependListener)return e.prependListener(t,n);e._events&&e._events[t]?Array.isArray(e._events[t])?e._events[t].unshift(n):e._events[t]=[n,e._events[t]]:e.on(t,n)}(e,"error",d),e.once("close",f),e.once("finish",p),e.emit("pipe",n),r.flowing||(c("pipe resume"),n.resume()),e},w.prototype.unpipe=function(e){var t=this._readableState,n={hasUnpiped:!1};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,n)),this;if(!e){var r=t.pipes,i=t.pipesCount;t.pipes=null,t.pipesCount=0,t.flowing=!1;for(var s=0;s<i;s++)r[s].emit("unpipe",this,{hasUnpiped:!1});return this}var o=H(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,n)),this},w.prototype.on=function(e,t){var n=s.prototype.on.call(this,e,t),r=this._readableState;return"data"===e?(r.readableListening=this.listenerCount("readable")>0,!1!==r.flowing&&this.resume()):"readable"===e&&(r.endEmitted||r.readableListening||(r.readableListening=r.needReadable=!0,r.flowing=!1,r.emittedReadable=!1,c("on readable",r.length,r.reading),r.length?R(this):r.reading||process.nextTick(L,this))),n},w.prototype.addListener=w.prototype.on,w.prototype.removeListener=function(e,t){var n=s.prototype.removeListener.call(this,e,t);return"readable"===e&&process.nextTick(B,this),n},w.prototype.removeAllListeners=function(e){var t=s.prototype.removeAllListeners.apply(this,arguments);return"readable"!==e&&void 0!==e||process.nextTick(B,this),t},w.prototype.resume=function(){var e=this._readableState;return e.flowing||(c("resume"),e.flowing=!e.readableListening,function(e,t){t.resumeScheduled||(t.resumeScheduled=!0,process.nextTick(x,e,t))}(this,e)),e.paused=!1,this},w.prototype.pause=function(){return c("call pause flowing=%j",this._readableState.flowing),!1!==this._readableState.flowing&&(c("pause"),this._readableState.flowing=!1,this.emit("pause")),this._readableState.paused=!0,this},w.prototype.wrap=function(e){var t=this,n=this._readableState,r=!1;for(var i in e.on("end",function(){if(c("wrapped end"),n.decoder&&!n.ended){var e=n.decoder.end();e&&e.length&&t.push(e)}t.push(null)}),e.on("data",function(i){(c("wrapped data"),n.decoder&&(i=n.decoder.write(i)),n.objectMode&&null==i)||(n.objectMode||i&&i.length)&&(t.push(i)||(r=!0,e.pause()))}),e)void 0===this[i]&&"function"==typeof e[i]&&(this[i]=function(t){return function(){return e[t].apply(e,arguments)}}(i));for(var s=0;s<A.length;s++)e.on(A[s],this.emit.bind(this,A[s]));return this._read=function(t){c("wrapped _read",t),r&&(r=!1,e.resume())},this},"function"==typeof Symbol&&(w.prototype[Symbol.asyncIterator]=function(){return void 0===u&&(u=n(2955)),u(this)}),Object.defineProperty(w.prototype,"readableHighWaterMark",{enumerable:!1,get:function(){return this._readableState.highWaterMark}}),Object.defineProperty(w.prototype,"readableBuffer",{enumerable:!1,get:function(){return this._readableState&&this._readableState.buffer}}),Object.defineProperty(w.prototype,"readableFlowing",{enumerable:!1,get:function(){return this._readableState.flowing},set:function(e){this._readableState&&(this._readableState.flowing=e)}}),w._fromList=M,Object.defineProperty(w.prototype,"readableLength",{enumerable:!1,get:function(){return this._readableState.length}}),"function"==typeof Symbol&&(w.from=function(e,t){return void 0===d&&(d=n(6532)),d(w,e,t)})},4610(e,t,n){"use strict";e.exports=h;var r=n(113).F,i=r.ERR_METHOD_NOT_IMPLEMENTED,s=r.ERR_MULTIPLE_CALLBACK,o=r.ERR_TRANSFORM_ALREADY_TRANSFORMING,a=r.ERR_TRANSFORM_WITH_LENGTH_0,c=n(5382);function l(e,t){var n=this._transformState;n.transforming=!1;var r=n.writecb;if(null===r)return this.emit("error",new s);n.writechunk=null,n.writecb=null,null!=t&&this.push(t),r(e);var i=this._readableState;i.reading=!1,(i.needReadable||i.length<i.highWaterMark)&&this._read(i.highWaterMark)}function h(e){if(!(this instanceof h))return new h(e);c.call(this,e),this._transformState={afterTransform:l.bind(this),needTransform:!1,transforming:!1,writecb:null,writechunk:null,writeencoding:null},this._readableState.needReadable=!0,this._readableState.sync=!1,e&&("function"==typeof e.transform&&(this._transform=e.transform),"function"==typeof e.flush&&(this._flush=e.flush)),this.on("prefinish",u)}function u(){var e=this;"function"!=typeof this._flush||this._readableState.destroyed?d(this,null,null):this._flush(function(t,n){d(e,t,n)})}function d(e,t,n){if(t)return e.emit("error",t);if(null!=n&&e.push(n),e._writableState.length)throw new a;if(e._transformState.transforming)throw new o;return e.push(null)}n(2017)(h,c),h.prototype.push=function(e,t){return this._transformState.needTransform=!1,c.prototype.push.call(this,e,t)},h.prototype._transform=function(e,t,n){n(new i("_transform()"))},h.prototype._write=function(e,t,n){var r=this._transformState;if(r.writecb=n,r.writechunk=e,r.writeencoding=t,!r.transforming){var i=this._readableState;(r.needTransform||i.needReadable||i.length<i.highWaterMark)&&this._read(i.highWaterMark)}},h.prototype._read=function(e){var t=this._transformState;null===t.writechunk||t.transforming?t.needTransform=!0:(t.transforming=!0,this._transform(t.writechunk,t.writeencoding,t.afterTransform))},h.prototype._destroy=function(e,t){c.prototype._destroy.call(this,e,function(e){t(e)})}},6708(e,t,n){"use strict";function r(e){var t=this;this.next=null,this.entry=null,this.finish=function(){!function(e,t,n){var r=e.entry;e.entry=null;for(;r;){var i=r.callback;t.pendingcb--,i(n),r=r.next}t.corkedRequestsFree.next=e}(t,e)}}var i;e.exports=w,w.WritableState=S;var s={deprecate:n(7983)},o=n(1416),a=n(181).Buffer,c=("undefined"!=typeof global?global:"undefined"!=typeof window?window:"undefined"!=typeof self?self:{}).Uint8Array||function(){};var l,h=n(5896),u=n(5291).getHighWaterMark,d=n(113).F,f=d.ERR_INVALID_ARG_TYPE,p=d.ERR_METHOD_NOT_IMPLEMENTED,g=d.ERR_MULTIPLE_CALLBACK,m=d.ERR_STREAM_CANNOT_PIPE,_=d.ERR_STREAM_DESTROYED,y=d.ERR_STREAM_NULL_VALUES,v=d.ERR_STREAM_WRITE_AFTER_END,b=d.ERR_UNKNOWN_ENCODING,E=h.errorOrDestroy;function A(){}function S(e,t,s){i=i||n(5382),e=e||{},"boolean"!=typeof s&&(s=t instanceof i),this.objectMode=!!e.objectMode,s&&(this.objectMode=this.objectMode||!!e.writableObjectMode),this.highWaterMark=u(this,e,"writableHighWaterMark",s),this.finalCalled=!1,this.needDrain=!1,this.ending=!1,this.ended=!1,this.finished=!1,this.destroyed=!1;var o=!1===e.decodeStrings;this.decodeStrings=!o,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 n=e._writableState,r=n.sync,i=n.writecb;if("function"!=typeof i)throw new g;if(function(e){e.writing=!1,e.writecb=null,e.length-=e.writelen,e.writelen=0}(n),t)!function(e,t,n,r,i){--t.pendingcb,n?(process.nextTick(i,r),process.nextTick(O,e,t),e._writableState.errorEmitted=!0,E(e,r)):(i(r),e._writableState.errorEmitted=!0,E(e,r),O(e,t))}(e,n,r,t,i);else{var s=T(n)||e.destroyed;s||n.corked||n.bufferProcessing||!n.bufferedRequest||k(e,n),r?process.nextTick(I,e,n,s,i):I(e,n,s,i)}}(t,e)},this.writecb=null,this.writelen=0,this.bufferedRequest=null,this.lastBufferedRequest=null,this.pendingcb=0,this.prefinished=!1,this.errorEmitted=!1,this.emitClose=!1!==e.emitClose,this.autoDestroy=!!e.autoDestroy,this.bufferedRequestCount=0,this.corkedRequestsFree=new r(this)}function w(e){var t=this instanceof(i=i||n(5382));if(!t&&!l.call(w,this))return new w(e);this._writableState=new S(e,this,t),this.writable=!0,e&&("function"==typeof e.write&&(this._write=e.write),"function"==typeof e.writev&&(this._writev=e.writev),"function"==typeof e.destroy&&(this._destroy=e.destroy),"function"==typeof e.final&&(this._final=e.final)),o.call(this)}function C(e,t,n,r,i,s,o){t.writelen=r,t.writecb=o,t.writing=!0,t.sync=!0,t.destroyed?t.onwrite(new _("write")):n?e._writev(i,t.onwrite):e._write(i,s,t.onwrite),t.sync=!1}function I(e,t,n,r){n||function(e,t){0===t.length&&t.needDrain&&(t.needDrain=!1,e.emit("drain"))}(e,t),t.pendingcb--,r(),O(e,t)}function k(e,t){t.bufferProcessing=!0;var n=t.bufferedRequest;if(e._writev&&n&&n.next){var i=t.bufferedRequestCount,s=new Array(i),o=t.corkedRequestsFree;o.entry=n;for(var a=0,c=!0;n;)s[a]=n,n.isBuf||(c=!1),n=n.next,a+=1;s.allBuffers=c,C(e,t,!0,t.length,s,"",o.finish),t.pendingcb++,t.lastBufferedRequest=null,o.next?(t.corkedRequestsFree=o.next,o.next=null):t.corkedRequestsFree=new r(t),t.bufferedRequestCount=0}else{for(;n;){var l=n.chunk,h=n.encoding,u=n.callback;if(C(e,t,!1,t.objectMode?1:l.length,l,h,u),n=n.next,t.bufferedRequestCount--,t.writing)break}null===n&&(t.lastBufferedRequest=null)}t.bufferedRequest=n,t.bufferProcessing=!1}function T(e){return e.ending&&0===e.length&&null===e.bufferedRequest&&!e.finished&&!e.writing}function R(e,t){e._final(function(n){t.pendingcb--,n&&E(e,n),t.prefinished=!0,e.emit("prefinish"),O(e,t)})}function O(e,t){var n=T(t);if(n&&(function(e,t){t.prefinished||t.finalCalled||("function"!=typeof e._final||t.destroyed?(t.prefinished=!0,e.emit("prefinish")):(t.pendingcb++,t.finalCalled=!0,process.nextTick(R,e,t)))}(e,t),0===t.pendingcb&&(t.finished=!0,e.emit("finish"),t.autoDestroy))){var r=e._readableState;(!r||r.autoDestroy&&r.endEmitted)&&e.destroy()}return n}n(2017)(w,o),S.prototype.getBuffer=function(){for(var e=this.bufferedRequest,t=[];e;)t.push(e),e=e.next;return t},function(){try{Object.defineProperty(S.prototype,"buffer",{get:s.deprecate(function(){return this.getBuffer()},"_writableState.buffer is deprecated. Use _writableState.getBuffer instead.","DEP0003")})}catch(e){}}(),"function"==typeof Symbol&&Symbol.hasInstance&&"function"==typeof Function.prototype[Symbol.hasInstance]?(l=Function.prototype[Symbol.hasInstance],Object.defineProperty(w,Symbol.hasInstance,{value:function(e){return!!l.call(this,e)||this===w&&(e&&e._writableState instanceof S)}})):l=function(e){return e instanceof this},w.prototype.pipe=function(){E(this,new m)},w.prototype.write=function(e,t,n){var r,i=this._writableState,s=!1,o=!i.objectMode&&(r=e,a.isBuffer(r)||r instanceof c);return o&&!a.isBuffer(e)&&(e=function(e){return a.from(e)}(e)),"function"==typeof t&&(n=t,t=null),o?t="buffer":t||(t=i.defaultEncoding),"function"!=typeof n&&(n=A),i.ending?function(e,t){var n=new v;E(e,n),process.nextTick(t,n)}(this,n):(o||function(e,t,n,r){var i;return null===n?i=new y:"string"==typeof n||t.objectMode||(i=new f("chunk",["string","Buffer"],n)),!i||(E(e,i),process.nextTick(r,i),!1)}(this,i,e,n))&&(i.pendingcb++,s=function(e,t,n,r,i,s){if(!n){var o=function(e,t,n){e.objectMode||!1===e.decodeStrings||"string"!=typeof t||(t=a.from(t,n));return t}(t,r,i);r!==o&&(n=!0,i="buffer",r=o)}var c=t.objectMode?1:r.length;t.length+=c;var l=t.length<t.highWaterMark;l||(t.needDrain=!0);if(t.writing||t.corked){var h=t.lastBufferedRequest;t.lastBufferedRequest={chunk:r,encoding:i,isBuf:n,callback:s,next:null},h?h.next=t.lastBufferedRequest:t.bufferedRequest=t.lastBufferedRequest,t.bufferedRequestCount+=1}else C(e,t,!1,c,r,i,s);return l}(this,i,o,e,t,n)),s},w.prototype.cork=function(){this._writableState.corked++},w.prototype.uncork=function(){var e=this._writableState;e.corked&&(e.corked--,e.writing||e.corked||e.bufferProcessing||!e.bufferedRequest||k(this,e))},w.prototype.setDefaultEncoding=function(e){if("string"==typeof e&&(e=e.toLowerCase()),!(["hex","utf8","utf-8","ascii","binary","base64","ucs2","ucs-2","utf16le","utf-16le","raw"].indexOf((e+"").toLowerCase())>-1))throw new b(e);return this._writableState.defaultEncoding=e,this},Object.defineProperty(w.prototype,"writableBuffer",{enumerable:!1,get:function(){return this._writableState&&this._writableState.getBuffer()}}),Object.defineProperty(w.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}}),w.prototype._write=function(e,t,n){n(new p("_write()"))},w.prototype._writev=null,w.prototype.end=function(e,t,n){var r=this._writableState;return"function"==typeof e?(n=e,e=null,t=null):"function"==typeof t&&(n=t,t=null),null!=e&&this.write(e,t),r.corked&&(r.corked=1,this.uncork()),r.ending||function(e,t,n){t.ending=!0,O(e,t),n&&(t.finished?process.nextTick(n):e.once("finish",n));t.ended=!0,e.writable=!1}(this,r,n),this},Object.defineProperty(w.prototype,"writableLength",{enumerable:!1,get:function(){return this._writableState.length}}),Object.defineProperty(w.prototype,"destroyed",{enumerable:!1,get:function(){return void 0!==this._writableState&&this._writableState.destroyed},set:function(e){this._writableState&&(this._writableState.destroyed=e)}}),w.prototype.destroy=h.destroy,w.prototype._undestroy=h.undestroy,w.prototype._destroy=function(e,t){t(e)}},2955(e,t,n){"use strict";var r;function i(e,t,n){return(t=function(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=typeof r)return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var s=n(6238),o=Symbol("lastResolve"),a=Symbol("lastReject"),c=Symbol("error"),l=Symbol("ended"),h=Symbol("lastPromise"),u=Symbol("handlePromise"),d=Symbol("stream");function f(e,t){return{value:e,done:t}}function p(e){var t=e[o];if(null!==t){var n=e[d].read();null!==n&&(e[h]=null,e[o]=null,e[a]=null,t(f(n,!1)))}}function g(e){process.nextTick(p,e)}var m=Object.getPrototypeOf(function(){}),_=Object.setPrototypeOf((i(r={get stream(){return this[d]},next:function(){var e=this,t=this[c];if(null!==t)return Promise.reject(t);if(this[l])return Promise.resolve(f(void 0,!0));if(this[d].destroyed)return new Promise(function(t,n){process.nextTick(function(){e[c]?n(e[c]):t(f(void 0,!0))})});var n,r=this[h];if(r)n=new Promise(function(e,t){return function(n,r){e.then(function(){t[l]?n(f(void 0,!0)):t[u](n,r)},r)}}(r,this));else{var i=this[d].read();if(null!==i)return Promise.resolve(f(i,!1));n=new Promise(this[u])}return this[h]=n,n}},Symbol.asyncIterator,function(){return this}),i(r,"return",function(){var e=this;return new Promise(function(t,n){e[d].destroy(null,function(e){e?n(e):t(f(void 0,!0))})})}),r),m);e.exports=function(e){var t,n=Object.create(_,(i(t={},d,{value:e,writable:!0}),i(t,o,{value:null,writable:!0}),i(t,a,{value:null,writable:!0}),i(t,c,{value:null,writable:!0}),i(t,l,{value:e._readableState.endEmitted,writable:!0}),i(t,u,{value:function(e,t){var r=n[d].read();r?(n[h]=null,n[o]=null,n[a]=null,e(f(r,!1))):(n[o]=e,n[a]=t)},writable:!0}),t));return n[h]=null,s(e,function(e){if(e&&"ERR_STREAM_PREMATURE_CLOSE"!==e.code){var t=n[a];return null!==t&&(n[h]=null,n[o]=null,n[a]=null,t(e)),void(n[c]=e)}var r=n[o];null!==r&&(n[h]=null,n[o]=null,n[a]=null,r(f(void 0,!0))),n[l]=!0}),e.on("readable",g.bind(null,n)),n}},345(e,t,n){"use strict";function r(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function i(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?r(Object(n),!0).forEach(function(t){s(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):r(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function s(e,t,n){return(t=a(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function o(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,a(r.key),r)}}function a(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=typeof r)return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:String(t)}var c=n(181).Buffer,l=n(9023).inspect,h=l&&l.custom||"inspect";function u(e,t,n){c.prototype.copy.call(e,t,n)}e.exports=function(){function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.head=null,this.tail=null,this.length=0}var t,n,r;return t=e,(n=[{key:"push",value:function(e){var t={data:e,next:null};this.length>0?this.tail.next=t:this.head=t,this.tail=t,++this.length}},{key:"unshift",value:function(e){var t={data:e,next:this.head};0===this.length&&(this.tail=t),this.head=t,++this.length}},{key:"shift",value:function(){if(0!==this.length){var e=this.head.data;return 1===this.length?this.head=this.tail=null:this.head=this.head.next,--this.length,e}}},{key:"clear",value:function(){this.head=this.tail=null,this.length=0}},{key:"join",value:function(e){if(0===this.length)return"";for(var t=this.head,n=""+t.data;t=t.next;)n+=e+t.data;return n}},{key:"concat",value:function(e){if(0===this.length)return c.alloc(0);for(var t=c.allocUnsafe(e>>>0),n=this.head,r=0;n;)u(n.data,t,r),r+=n.data.length,n=n.next;return t}},{key:"consume",value:function(e,t){var n;return e<this.head.data.length?(n=this.head.data.slice(0,e),this.head.data=this.head.data.slice(e)):n=e===this.head.data.length?this.shift():t?this._getString(e):this._getBuffer(e),n}},{key:"first",value:function(){return this.head.data}},{key:"_getString",value:function(e){var t=this.head,n=1,r=t.data;for(e-=r.length;t=t.next;){var i=t.data,s=e>i.length?i.length:e;if(s===i.length?r+=i:r+=i.slice(0,e),0===(e-=s)){s===i.length?(++n,t.next?this.head=t.next:this.head=this.tail=null):(this.head=t,t.data=i.slice(s));break}++n}return this.length-=n,r}},{key:"_getBuffer",value:function(e){var t=c.allocUnsafe(e),n=this.head,r=1;for(n.data.copy(t),e-=n.data.length;n=n.next;){var i=n.data,s=e>i.length?i.length:e;if(i.copy(t,t.length-e,0,s),0===(e-=s)){s===i.length?(++r,n.next?this.head=n.next:this.head=this.tail=null):(this.head=n,n.data=i.slice(s));break}++r}return this.length-=r,t}},{key:h,value:function(e,t){return l(this,i(i({},t),{},{depth:0,customInspect:!1}))}}])&&o(t.prototype,n),r&&o(t,r),Object.defineProperty(t,"prototype",{writable:!1}),e}()},5896(e){"use strict";function t(e,t){r(e,t),n(e)}function n(e){e._writableState&&!e._writableState.emitClose||e._readableState&&!e._readableState.emitClose||e.emit("close")}function r(e,t){e.emit("error",t)}e.exports={destroy:function(e,i){var s=this,o=this._readableState&&this._readableState.destroyed,a=this._writableState&&this._writableState.destroyed;return o||a?(i?i(e):e&&(this._writableState?this._writableState.errorEmitted||(this._writableState.errorEmitted=!0,process.nextTick(r,this,e)):process.nextTick(r,this,e)),this):(this._readableState&&(this._readableState.destroyed=!0),this._writableState&&(this._writableState.destroyed=!0),this._destroy(e||null,function(e){!i&&e?s._writableState?s._writableState.errorEmitted?process.nextTick(n,s):(s._writableState.errorEmitted=!0,process.nextTick(t,s,e)):process.nextTick(t,s,e):i?(process.nextTick(n,s),i(e)):process.nextTick(n,s)}),this)},undestroy:function(){this._readableState&&(this._readableState.destroyed=!1,this._readableState.reading=!1,this._readableState.ended=!1,this._readableState.endEmitted=!1),this._writableState&&(this._writableState.destroyed=!1,this._writableState.ended=!1,this._writableState.ending=!1,this._writableState.finalCalled=!1,this._writableState.prefinished=!1,this._writableState.finished=!1,this._writableState.errorEmitted=!1)},errorOrDestroy:function(e,t){var n=e._readableState,r=e._writableState;n&&n.autoDestroy||r&&r.autoDestroy?e.destroy(t):e.emit("error",t)}}},6238(e,t,n){"use strict";var r=n(113).F.ERR_STREAM_PREMATURE_CLOSE;function i(){}e.exports=function e(t,n,s){if("function"==typeof n)return e(t,null,n);n||(n={}),s=function(e){var t=!1;return function(){if(!t){t=!0;for(var n=arguments.length,r=new Array(n),i=0;i<n;i++)r[i]=arguments[i];e.apply(this,r)}}}(s||i);var o=n.readable||!1!==n.readable&&t.readable,a=n.writable||!1!==n.writable&&t.writable,c=function(){t.writable||h()},l=t._writableState&&t._writableState.finished,h=function(){a=!1,l=!0,o||s.call(t)},u=t._readableState&&t._readableState.endEmitted,d=function(){o=!1,u=!0,a||s.call(t)},f=function(e){s.call(t,e)},p=function(){var e;return o&&!u?(t._readableState&&t._readableState.ended||(e=new r),s.call(t,e)):a&&!l?(t._writableState&&t._writableState.ended||(e=new r),s.call(t,e)):void 0},g=function(){t.req.on("finish",h)};return!function(e){return e.setHeader&&"function"==typeof e.abort}(t)?a&&!t._writableState&&(t.on("end",c),t.on("close",c)):(t.on("complete",h),t.on("abort",p),t.req?g():t.on("request",g)),t.on("end",d),t.on("finish",h),!1!==n.error&&t.on("error",f),t.on("close",p),function(){t.removeListener("complete",h),t.removeListener("abort",p),t.removeListener("request",g),t.req&&t.req.removeListener("finish",h),t.removeListener("end",c),t.removeListener("close",c),t.removeListener("finish",h),t.removeListener("end",d),t.removeListener("error",f),t.removeListener("close",p)}}},6532(e,t,n){"use strict";function r(e,t,n,r,i,s,o){try{var a=e[s](o),c=a.value}catch(e){return void n(e)}a.done?t(c):Promise.resolve(c).then(r,i)}function i(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function s(e,t,n){return(t=function(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=typeof r)return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var o=n(113).F.ERR_INVALID_ARG_TYPE;e.exports=function(e,t,n){var a;if(t&&"function"==typeof t.next)a=t;else if(t&&t[Symbol.asyncIterator])a=t[Symbol.asyncIterator]();else{if(!t||!t[Symbol.iterator])throw new o("iterable",["Iterable"],t);a=t[Symbol.iterator]()}var c=new e(function(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?i(Object(n),!0).forEach(function(t){s(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):i(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}({objectMode:!0},n)),l=!1;function h(){return u.apply(this,arguments)}function u(){var e;return e=function*(){try{var e=yield a.next(),t=e.value;e.done?c.push(null):c.push(yield t)?h():l=!1}catch(e){c.destroy(e)}},u=function(){var t=this,n=arguments;return new Promise(function(i,s){var o=e.apply(t,n);function a(e){r(o,i,s,a,c,"next",e)}function c(e){r(o,i,s,a,c,"throw",e)}a(void 0)})},u.apply(this,arguments)}return c._read=function(){l||(l=!0,h())},c}},7758(e,t,n){"use strict";var r;var i=n(113).F,s=i.ERR_MISSING_ARGS,o=i.ERR_STREAM_DESTROYED;function a(e){if(e)throw e}function c(e){e()}function l(e,t){return e.pipe(t)}e.exports=function(){for(var e=arguments.length,t=new Array(e),i=0;i<e;i++)t[i]=arguments[i];var h,u=function(e){return e.length?"function"!=typeof e[e.length-1]?a:e.pop():a}(t);if(Array.isArray(t[0])&&(t=t[0]),t.length<2)throw new s("streams");var d=t.map(function(e,i){var s=i<t.length-1;return function(e,t,i,s){s=function(e){var t=!1;return function(){t||(t=!0,e.apply(void 0,arguments))}}(s);var a=!1;e.on("close",function(){a=!0}),void 0===r&&(r=n(6238)),r(e,{readable:t,writable:i},function(e){if(e)return s(e);a=!0,s()});var c=!1;return function(t){if(!a&&!c)return c=!0,function(e){return e.setHeader&&"function"==typeof e.abort}(e)?e.abort():"function"==typeof e.destroy?e.destroy():void s(t||new o("pipe"))}}(e,s,i>0,function(e){h||(h=e),e&&d.forEach(c),s||(d.forEach(c),u(h))})});return t.reduce(l)}},5291(e,t,n){"use strict";var r=n(113).F.ERR_INVALID_OPT_VALUE;e.exports={getHighWaterMark:function(e,t,n,i){var s=function(e,t,n){return null!=e.highWaterMark?e.highWaterMark:t?e[n]:null}(t,i,n);if(null!=s){if(!isFinite(s)||Math.floor(s)!==s||s<0)throw new r(i?n:"highWaterMark",s);return Math.floor(s)}return e.objectMode?16:16384}}},1416(e,t,n){e.exports=n(2203)},4198(e,t,n){var r=n(2203);"disable"===process.env.READABLE_STREAM&&r?(e.exports=r.Readable,Object.assign(e.exports,r),e.exports.Stream=r):((t=e.exports=n(5412)).Stream=r||t,t.Readable=t,t.Writable=n(6708),t.Duplex=n(5382),t.Transform=n(4610),t.PassThrough=n(3600),t.finished=n(6238),t.pipeline=n(7758))},2861(e,t,n){var r=n(181),i=r.Buffer;function s(e,t){for(var n in e)t[n]=e[n]}function o(e,t,n){return i(e,t,n)}i.from&&i.alloc&&i.allocUnsafe&&i.allocUnsafeSlow?e.exports=r:(s(r,t),t.Buffer=o),o.prototype=Object.create(i.prototype),s(i,o),o.from=function(e,t,n){if("number"==typeof e)throw new TypeError("Argument must not be a number");return i(e,t,n)},o.alloc=function(e,t,n){if("number"!=typeof e)throw new TypeError("Argument must be a number");var r=i(e);return void 0!==t?"string"==typeof n?r.fill(t,n):r.fill(t):r.fill(0),r},o.allocUnsafe=function(e){if("number"!=typeof e)throw new TypeError("Argument must be a number");return i(e)},o.allocUnsafeSlow=function(e){if("number"!=typeof e)throw new TypeError("Argument must be a number");return r.SlowBuffer(e)}},4774(e,t,n){"use strict";var r,i=n(181),s=i.Buffer,o={};for(r in i)i.hasOwnProperty(r)&&"SlowBuffer"!==r&&"Buffer"!==r&&(o[r]=i[r]);var a=o.Buffer={};for(r in s)s.hasOwnProperty(r)&&"allocUnsafe"!==r&&"allocUnsafeSlow"!==r&&(a[r]=s[r]);if(o.Buffer.prototype=s.prototype,a.from&&a.from!==Uint8Array.from||(a.from=function(e,t,n){if("number"==typeof e)throw new TypeError('The "value" argument must not be of type number. Received type '+typeof e);if(e&&void 0===e.length)throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof e);return s(e,t,n)}),a.alloc||(a.alloc=function(e,t,n){if("number"!=typeof e)throw new TypeError('The "size" argument must be of type number. Received type '+typeof e);if(e<0||e>=2*(1<<30))throw new RangeError('The value "'+e+'" is invalid for option "size"');var r=s(e);return t&&0!==t.length?"string"==typeof n?r.fill(t,n):r.fill(t):r.fill(0),r}),!o.kStringMaxLength)try{o.kStringMaxLength=process.binding("buffer").kStringMaxLength}catch(e){}o.constants||(o.constants={MAX_LENGTH:o.kMaxLength},o.kStringMaxLength&&(o.constants.MAX_STRING_LENGTH=o.kStringMaxLength)),e.exports=o},4546(e,t,n){var r=n(9896);e.exports=function(e,t,n){t=void 0!==t?t:"\n",n=void 0!==n?n:"utf8";var i=[],s=r.readFileSync(e,n);if(s.indexOf("-END CERTIFICATE-")<0||s.indexOf("-BEGIN CERTIFICATE-")<0)throw Error("File does not contain 'BEGIN CERTIFICATE' or 'END CERTIFICATE'");var o,a,c=[];for(o=0,a=(s=s.split(t)).length;o<a;o++){var l=s[o];0!==l.length&&(c.push(l),l.match(/-END CERTIFICATE-/)&&(i.push(c.join(t)),c=[]))}return i}},3141(e,t,n){"use strict";var r=n(2861).Buffer,i=r.isEncoding||function(e){switch((e=""+e)&&e.toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":case"raw":return!0;default:return!1}};function s(e){var t;switch(this.encoding=function(e){var t=function(e){if(!e)return"utf8";for(var t;;)switch(e){case"utf8":case"utf-8":return"utf8";case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return"utf16le";case"latin1":case"binary":return"latin1";case"base64":case"ascii":case"hex":return e;default:if(t)return;e=(""+e).toLowerCase(),t=!0}}(e);if("string"!=typeof t&&(r.isEncoding===i||!i(e)))throw new Error("Unknown encoding: "+e);return t||e}(e),this.encoding){case"utf16le":this.text=c,this.end=l,t=4;break;case"utf8":this.fillLast=a,t=4;break;case"base64":this.text=h,this.end=u,t=3;break;default:return this.write=d,void(this.end=f)}this.lastNeed=0,this.lastTotal=0,this.lastChar=r.allocUnsafe(t)}function o(e){return e<=127?0:e>>5==6?2:e>>4==14?3:e>>3==30?4:e>>6==2?-1:-2}function a(e){var t=this.lastTotal-this.lastNeed,n=function(e,t){if(128!=(192&t[0]))return e.lastNeed=0,"�";if(e.lastNeed>1&&t.length>1){if(128!=(192&t[1]))return e.lastNeed=1,"�";if(e.lastNeed>2&&t.length>2&&128!=(192&t[2]))return e.lastNeed=2,"�"}}(this,e);return void 0!==n?n:this.lastNeed<=e.length?(e.copy(this.lastChar,t,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal)):(e.copy(this.lastChar,t,0,e.length),void(this.lastNeed-=e.length))}function c(e,t){if((e.length-t)%2==0){var n=e.toString("utf16le",t);if(n){var r=n.charCodeAt(n.length-1);if(r>=55296&&r<=56319)return this.lastNeed=2,this.lastTotal=4,this.lastChar[0]=e[e.length-2],this.lastChar[1]=e[e.length-1],n.slice(0,-1)}return n}return this.lastNeed=1,this.lastTotal=2,this.lastChar[0]=e[e.length-1],e.toString("utf16le",t,e.length-1)}function l(e){var t=e&&e.length?this.write(e):"";if(this.lastNeed){var n=this.lastTotal-this.lastNeed;return t+this.lastChar.toString("utf16le",0,n)}return t}function h(e,t){var n=(e.length-t)%3;return 0===n?e.toString("base64",t):(this.lastNeed=3-n,this.lastTotal=3,1===n?this.lastChar[0]=e[e.length-1]:(this.lastChar[0]=e[e.length-2],this.lastChar[1]=e[e.length-1]),e.toString("base64",t,e.length-n))}function u(e){var t=e&&e.length?this.write(e):"";return this.lastNeed?t+this.lastChar.toString("base64",0,3-this.lastNeed):t}function d(e){return e.toString(this.encoding)}function f(e){return e&&e.length?this.write(e):""}t.I=s,s.prototype.write=function(e){if(0===e.length)return"";var t,n;if(this.lastNeed){if(void 0===(t=this.fillLast(e)))return"";n=this.lastNeed,this.lastNeed=0}else n=0;return n<e.length?t?t+this.text(e,n):this.text(e,n):t||""},s.prototype.end=function(e){var t=e&&e.length?this.write(e):"";return this.lastNeed?t+"�":t},s.prototype.text=function(e,t){var n=function(e,t,n){var r=t.length-1;if(r<n)return 0;var i=o(t[r]);if(i>=0)return i>0&&(e.lastNeed=i-1),i;if(--r<n||-2===i)return 0;if(i=o(t[r]),i>=0)return i>0&&(e.lastNeed=i-2),i;if(--r<n||-2===i)return 0;if(i=o(t[r]),i>=0)return i>0&&(2===i?i=0:e.lastNeed=i-3),i;return 0}(this,e,t);if(!this.lastNeed)return e.toString("utf8",t);this.lastTotal=n;var r=e.length-(n-this.lastNeed);return e.copy(this.lastChar,0,r),e.toString("utf8",t,r)},s.prototype.fillLast=function(e){if(this.lastNeed<=e.length)return e.copy(this.lastChar,this.lastTotal-this.lastNeed,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal);e.copy(this.lastChar,this.lastTotal-this.lastNeed,0,e.length),this.lastNeed-=e.length}},6868(e,t,n){var r=n(6284),i=n(6706),s=n(815),o=n(9505),a=n(9896),c=n(6928),l="win32"===n(857).platform(),h=function(){},u=function(e){return e},d=l?function(e){return e.replace(/\\/g,"/").replace(/[:?<>|]/g,"_")}:u,f=function(e,t){return function(n){n.name=n.name.split("/").slice(t).join("/");var r=n.linkname;return r&&("link"===n.type||c.isAbsolute(r))&&(n.linkname=r.split("/").slice(t).join("/")),e(n)}};t.pack=function(e,t){e||(e="."),t||(t={});var n=t.fs||a,r=t.ignore||t.filter||h,o=t.map||h,l=t.mapStream||u,p=function(e,t,n,r,i,s){var o=i||["."];return function(i){if(!o.length)return i();var a=o.shift(),l=c.join(n,a);t.call(e,l,function(t,h){return t?i(t):h.isDirectory()?void e.readdir(l,function(e,t){if(e)return i(e);s&&t.sort();for(var l=0;l<t.length;l++)r(c.join(n,a,t[l]))||o.push(c.join(a,t[l]));i(null,a,h)}):i(null,a,h)})}}(n,t.dereference?n.stat:n.lstat,e,r,t.entries,t.sort),m=!1!==t.strict,_="number"==typeof t.umask?~t.umask:~g(),y="number"==typeof t.dmode?t.dmode:0,v="number"==typeof t.fmode?t.fmode:0,b=t.pack||i.pack(),E=t.finish||h;t.strip&&(o=f(o,t.strip)),t.readable&&(y|=parseInt(555,8),v|=parseInt(444,8)),t.writable&&(y|=parseInt(333,8),v|=parseInt(222,8));var A=function(r,i,a){if(r)return b.destroy(r);if(!i)return!1!==t.finalize&&b.finalize(),E(b);if(a.isSocket())return S();var h={name:d(i),mode:(a.mode|(a.isDirectory()?y:v))&_,mtime:a.mtime,size:a.size,type:"file",uid:a.uid,gid:a.gid};if(a.isDirectory())return h.size=0,h.type="directory",h=o(h)||h,b.entry(h,S);if(a.isSymbolicLink())return h.size=0,h.type="symlink",function(t,r){n.readlink(c.join(e,t),function(e,t){if(e)return b.destroy(e);r.linkname=d(t),b.entry(r,S)})}(i,h=o(h)||h);if(h=o(h)||h,!a.isFile())return m?b.destroy(new Error("unsupported type for "+i)):S();var u=b.entry(h,S);if(u){var f=l(n.createReadStream(c.join(e,i),{start:0,end:h.size>0?h.size-1:h.size}),h);f.on("error",function(e){u.destroy(e)}),s(f,u)}},S=function(e){if(e)return b.destroy(e);p(A)};return S(),b};var p=function(e){return e.length?e[e.length-1]:null},g=function(){return process.umask?process.umask():0};function m(e,t,n,r){if(t===n)return r(null,!0);e.lstat(t,function(i,s){return i&&"ENOENT"!==i.code?r(i):i||s.isDirectory()?m(e,c.join(t,".."),n,r):void r(null,!1)})}function _(e,t,n){o(e,{fs:t.fs},function(e,i){!e&&i&&t.own?r(i,t.uid,t.gid,n):n(e)})}function y(e,t){return(t=c.resolve(t))===e||e.startsWith(t+c.sep)}t.extract=function(e,t){e||(e="."),t||(t={});var n=t.fs||a,r=t.ignore||t.filter||h,o=t.map||h,v=t.mapStream||u,b=!1!==t.chown&&!l&&0===(process.getuid?process.getuid():-1),E=t.extract||i.extract(),A=[],S=new Date,w="number"==typeof t.umask?~t.umask:~g(),C="number"==typeof t.dmode?t.dmode:0,I="number"==typeof t.fmode?t.fmode:0,k=!1!==t.strict;t.strip&&(o=f(o,t.strip)),t.readable&&(C|=parseInt(555,8),I|=parseInt(444,8)),t.writable&&(C|=parseInt(333,8),I|=parseInt(222,8));var T=function(e,t){for(var r;(r=p(A))&&e.slice(0,r[0].length)!==r[0];)A.pop();if(!r)return t();n.utimes(r[0],S,r[1],t)};return E.on("entry",function(i,a,h){(i=o(i)||i).name=d(i.name);var u=c.join(e,c.join("/",i.name));if(r(u,i))return a.resume(),h();var f=function(e){if(e)return h(e);!function(e,r,i){!1===t.utimes?i():"directory"===r.type?n.utimes(e,S,r.mtime,i):"symlink"===r.type?T(e,i):n.utimes(e,S,r.mtime,function(t){if(t)return i(t);T(e,i)})}(u,i,function(e){return e?h(e):l?h():void function(e,t,r){var i="symlink"===t.type,s=i?n.lchmod:n.chmod,o=i?n.lchown:n.chown;if(!s)return r();var a=(t.mode|("directory"===t.type?C:I))&w;function c(t){return t?r(t):s?void s.call(n,e,a,r):r()}o&&b?o.call(n,e,t.uid,t.gid,c):c(null)}(u,i,h)})},p=function(){var e=n.createWriteStream(u),t=v(a,i);e.on("error",function(e){t.destroy(e)}),s(t,e,function(t){if(t)return h(t);e.on("close",f)})};if("directory"===i.type)return A.push([u,i.mtime]),_(u,{fs:n,own:b,uid:i.uid,gid:i.gid},f);var g=c.dirname(u);m(n,g,c.join(e,"."),function(r,s){return r?h(r):s?void _(g,{fs:n,own:b,uid:i.uid,gid:i.gid},function(r){if(r)return h(r);switch(i.type){case"file":return p();case"link":return function(){if(l)return h();n.unlink(u,function(){var r=c.join(e,c.join("/",i.linkname));n.realpath(r,function(i,s){if(i||!y(s,e))return h(new Error(u+" is not a valid hardlink"));n.link(s,u,function(e){if(e&&"EPERM"===e.code&&t.hardlinkAsFilesFallback)return a=n.createReadStream(r),p();f(e)})})})}();case"symlink":return function(){if(l)return h();n.unlink(u,function(){if(!y(c.resolve(c.dirname(u),i.linkname),e))return h(new Error(u+" is not a valid symlink"));n.symlink(i.linkname,u,f)})}()}if(k)return h(new Error("unsupported type for "+u+" ("+i.type+")"));a.resume(),h()}):h(new Error(g+" is not a valid path"))})}),t.finish&&E.on("finish",t.finish),E}},5518(e,t,n){"use strict";const{Buffer:r}=n(181),i=Symbol.for("BufferList");function s(e){if(!(this instanceof s))return new s(e);s._init.call(this,e)}s._init=function(e){Object.defineProperty(this,i,{value:!0}),this._bufs=[],this.length=0,e&&this.append(e)},s.prototype._new=function(e){return new s(e)},s.prototype._offset=function(e){if(0===e)return[0,0];let t=0;for(let n=0;n<this._bufs.length;n++){const r=t+this._bufs[n].length;if(e<r||n===this._bufs.length-1)return[n,e-t];t=r}},s.prototype._reverseOffset=function(e){const t=e[0];let n=e[1];for(let e=0;e<t;e++)n+=this._bufs[e].length;return n},s.prototype.get=function(e){if(e>this.length||e<0)return;const t=this._offset(e);return this._bufs[t[0]][t[1]]},s.prototype.slice=function(e,t){return"number"==typeof e&&e<0&&(e+=this.length),"number"==typeof t&&t<0&&(t+=this.length),this.copy(null,0,e,t)},s.prototype.copy=function(e,t,n,i){if(("number"!=typeof n||n<0)&&(n=0),("number"!=typeof i||i>this.length)&&(i=this.length),n>=this.length)return e||r.alloc(0);if(i<=0)return e||r.alloc(0);const s=!!e,o=this._offset(n),a=i-n;let c=a,l=s&&t||0,h=o[1];if(0===n&&i===this.length){if(!s)return 1===this._bufs.length?this._bufs[0]:r.concat(this._bufs,this.length);for(let t=0;t<this._bufs.length;t++)this._bufs[t].copy(e,l),l+=this._bufs[t].length;return e}if(c<=this._bufs[o[0]].length-h)return s?this._bufs[o[0]].copy(e,t,h,h+c):this._bufs[o[0]].slice(h,h+c);s||(e=r.allocUnsafe(a));for(let t=o[0];t<this._bufs.length;t++){const n=this._bufs[t].length-h;if(!(c>n)){this._bufs[t].copy(e,l,h,h+c),l+=n;break}this._bufs[t].copy(e,l,h),l+=n,c-=n,h&&(h=0)}return e.length>l?e.slice(0,l):e},s.prototype.shallowSlice=function(e,t){if(e=e||0,t="number"!=typeof t?this.length:t,e<0&&(e+=this.length),t<0&&(t+=this.length),e===t)return this._new();const n=this._offset(e),r=this._offset(t),i=this._bufs.slice(n[0],r[0]+1);return 0===r[1]?i.pop():i[i.length-1]=i[i.length-1].slice(0,r[1]),0!==n[1]&&(i[0]=i[0].slice(n[1])),this._new(i)},s.prototype.toString=function(e,t,n){return this.slice(t,n).toString(e)},s.prototype.consume=function(e){if(e=Math.trunc(e),Number.isNaN(e)||e<=0)return this;for(;this._bufs.length;){if(!(e>=this._bufs[0].length)){this._bufs[0]=this._bufs[0].slice(e),this.length-=e;break}e-=this._bufs[0].length,this.length-=this._bufs[0].length,this._bufs.shift()}return this},s.prototype.duplicate=function(){const e=this._new();for(let t=0;t<this._bufs.length;t++)e.append(this._bufs[t]);return e},s.prototype.append=function(e){if(null==e)return this;if(e.buffer)this._appendBuffer(r.from(e.buffer,e.byteOffset,e.byteLength));else if(Array.isArray(e))for(let t=0;t<e.length;t++)this.append(e[t]);else if(this._isBufferList(e))for(let t=0;t<e._bufs.length;t++)this.append(e._bufs[t]);else"number"==typeof e&&(e=e.toString()),this._appendBuffer(r.from(e));return this},s.prototype._appendBuffer=function(e){this._bufs.push(e),this.length+=e.length},s.prototype.indexOf=function(e,t,n){if(void 0===n&&"string"==typeof t&&(n=t,t=void 0),"function"==typeof e||Array.isArray(e))throw new TypeError('The "value" argument must be one of type string, Buffer, BufferList, or Uint8Array.');if("number"==typeof e?e=r.from([e]):"string"==typeof e?e=r.from(e,n):this._isBufferList(e)?e=e.slice():Array.isArray(e.buffer)?e=r.from(e.buffer,e.byteOffset,e.byteLength):r.isBuffer(e)||(e=r.from(e)),t=Number(t||0),isNaN(t)&&(t=0),t<0&&(t=this.length+t),t<0&&(t=0),0===e.length)return t>this.length?this.length:t;const i=this._offset(t);let s=i[0],o=i[1];for(;s<this._bufs.length;s++){const t=this._bufs[s];for(;o<t.length;){if(t.length-o>=e.length){const n=t.indexOf(e,o);if(-1!==n)return this._reverseOffset([s,n]);o=t.length-e.length+1}else{const t=this._reverseOffset([s,o]);if(this._match(t,e))return t;o++}}o=0}return-1},s.prototype._match=function(e,t){if(this.length-e<t.length)return!1;for(let n=0;n<t.length;n++)if(this.get(e+n)!==t[n])return!1;return!0},function(){const e={readDoubleBE:8,readDoubleLE:8,readFloatBE:4,readFloatLE:4,readInt32BE:4,readInt32LE:4,readUInt32BE:4,readUInt32LE:4,readInt16BE:2,readInt16LE:2,readUInt16BE:2,readUInt16LE:2,readInt8:1,readUInt8:1,readIntBE:null,readIntLE:null,readUIntBE:null,readUIntLE:null};for(const t in e)(function(t){s.prototype[t]=null===e[t]?function(e,n){return this.slice(e,e+n)[t](0,n)}:function(n=0){return this.slice(n,n+e[t])[t](0)}})(t)}(),s.prototype._isBufferList=function(e){return e instanceof s||s.isBufferList(e)},s.isBufferList=function(e){return null!=e&&e[i]},e.exports=s},5278(e,t,n){"use strict";const r=n(4198).Duplex,i=n(2017),s=n(5518);function o(e){if(!(this instanceof o))return new o(e);if("function"==typeof e){this._callback=e;const t=function(e){this._callback&&(this._callback(e),this._callback=null)}.bind(this);this.on("pipe",function(e){e.on("error",t)}),this.on("unpipe",function(e){e.removeListener("error",t)}),e=null}s._init.call(this,e),r.call(this)}i(o,r),Object.assign(o.prototype,s.prototype),o.prototype._new=function(e){return new o(e)},o.prototype._write=function(e,t,n){this._appendBuffer(e),"function"==typeof n&&n()},o.prototype._read=function(e){if(!this.length)return this.push(null);e=Math.min(e,this.length),this.push(this.slice(0,e)),this.consume(e)},o.prototype.end=function(e){r.prototype.end.call(this,e),this._callback&&(this._callback(null,this.slice()),this._callback=null)},o.prototype._destroy=function(e,t){this._bufs.length=0,this.length=0,t(e)},o.prototype._isBufferList=function(e){return e instanceof o||e instanceof s||o.isBufferList(e)},o.isBufferList=s.isBufferList,e.exports=o,e.exports.BufferListStream=o,e.exports.BufferList=s},6284(e,t,n){"use strict";const r=n(9896),i=n(6928),s=r.lchown?"lchown":"chown",o=r.lchownSync?"lchownSync":"chownSync",a=r.lchown&&!process.version.match(/v1[1-9]+\./)&&!process.version.match(/v10\.[6-9]/),c=(e,t,n)=>{try{return r[o](e,t,n)}catch(e){if("ENOENT"!==e.code)throw e}},l=a?(e,t,n,i)=>s=>{s&&"EISDIR"===s.code?r.chown(e,t,n,i):i(s)}:(e,t,n,r)=>r,h=a?(e,t,n)=>{try{return c(e,t,n)}catch(i){if("EISDIR"!==i.code)throw i;((e,t,n)=>{try{return r.chownSync(e,t,n)}catch(e){if("ENOENT"!==e.code)throw e}})(e,t,n)}}:(e,t,n)=>c(e,t,n),u=process.version;let d=(e,t,n)=>r.readdir(e,t,n);/^v4\./.test(u)&&(d=(e,t,n)=>r.readdir(e,n));const f=(e,t,n,i)=>{r[s](e,t,n,l(e,t,n,e=>{i(e&&"ENOENT"!==e.code?e:null)}))},p=(e,t,n,s,o)=>{if("string"==typeof t)return r.lstat(i.resolve(e,t),(r,i)=>{if(r)return o("ENOENT"!==r.code?r:null);i.name=t,p(e,i,n,s,o)});if(t.isDirectory())g(i.resolve(e,t.name),n,s,r=>{if(r)return o(r);const a=i.resolve(e,t.name);f(a,n,s,o)});else{const r=i.resolve(e,t.name);f(r,n,s,o)}},g=(e,t,n,r)=>{d(e,{withFileTypes:!0},(i,s)=>{if(i){if("ENOENT"===i.code)return r();if("ENOTDIR"!==i.code&&"ENOTSUP"!==i.code)return r(i)}if(i||!s.length)return f(e,t,n,r);let o=s.length,a=null;const c=i=>{if(!a)return i?r(a=i):0===--o?f(e,t,n,r):void 0};s.forEach(r=>p(e,r,t,n,c))})},m=(e,t,n)=>{let s;try{s=((e,t)=>r.readdirSync(e,t))(e,{withFileTypes:!0})}catch(r){if("ENOENT"===r.code)return;if("ENOTDIR"===r.code||"ENOTSUP"===r.code)return h(e,t,n);throw r}return s&&s.length&&s.forEach(s=>((e,t,n,s)=>{if("string"==typeof t)try{const n=r.lstatSync(i.resolve(e,t));n.name=t,t=n}catch(e){if("ENOENT"===e.code)return;throw e}t.isDirectory()&&m(i.resolve(e,t.name),n,s),h(i.resolve(e,t.name),n,s)})(e,s,t,n)),h(e,t,n)};e.exports=g,g.sync=m},3807(e,t,n){var r=n(9023),i=n(5278),s=n(3544),o=n(4198).Writable,a=n(4198).PassThrough,c=function(){},l=function(e){return(e&=511)&&512-e},h=function(e,t){this._parent=e,this.offset=t,a.call(this,{autoDestroy:!1})};r.inherits(h,a),h.prototype.destroy=function(e){this._parent.destroy(e)};var u=function(e){if(!(this instanceof u))return new u(e);o.call(this,e),e=e||{},this._offset=0,this._buffer=i(),this._missing=0,this._partial=!1,this._onparse=c,this._header=null,this._stream=null,this._overflow=null,this._cb=null,this._locked=!1,this._destroyed=!1,this._pax=null,this._paxGlobal=null,this._gnuLongPath=null,this._gnuLongLinkPath=null;var t=this,n=t._buffer,r=function(){t._continue()},a=function(e){if(t._locked=!1,e)return t.destroy(e);t._stream||r()},d=function(){t._stream=null;var e=l(t._header.size);e?t._parse(e,f):t._parse(512,y),t._locked||r()},f=function(){t._buffer.consume(l(t._header.size)),t._parse(512,y),r()},p=function(){var e=t._header.size;t._paxGlobal=s.decodePax(n.slice(0,e)),n.consume(e),d()},g=function(){var e=t._header.size;t._pax=s.decodePax(n.slice(0,e)),t._paxGlobal&&(t._pax=Object.assign({},t._paxGlobal,t._pax)),n.consume(e),d()},m=function(){var r=t._header.size;this._gnuLongPath=s.decodeLongPath(n.slice(0,r),e.filenameEncoding),n.consume(r),d()},_=function(){var r=t._header.size;this._gnuLongLinkPath=s.decodeLongPath(n.slice(0,r),e.filenameEncoding),n.consume(r),d()},y=function(){var i,o=t._offset;try{i=t._header=s.decode(n.slice(0,512),e.filenameEncoding,e.allowUnknownFormat)}catch(e){t.emit("error",e)}return n.consume(512),i?"gnu-long-path"===i.type?(t._parse(i.size,m),void r()):"gnu-long-link-path"===i.type?(t._parse(i.size,_),void r()):"pax-global-header"===i.type?(t._parse(i.size,p),void r()):"pax-header"===i.type?(t._parse(i.size,g),void r()):(t._gnuLongPath&&(i.name=t._gnuLongPath,t._gnuLongPath=null),t._gnuLongLinkPath&&(i.linkname=t._gnuLongLinkPath,t._gnuLongLinkPath=null),t._pax&&(t._header=i=function(e,t){return t.path&&(e.name=t.path),t.linkpath&&(e.linkname=t.linkpath),t.size&&(e.size=parseInt(t.size,10)),e.pax=t,e}(i,t._pax),t._pax=null),t._locked=!0,i.size&&"directory"!==i.type?(t._stream=new h(t,o),t.emit("entry",i,t._stream,a),t._parse(i.size,d),void r()):(t._parse(512,y),void t.emit("entry",i,function(e,t){var n=new h(e,t);return n.end(),n}(t,o),a))):(t._parse(512,y),void r())};this._onheader=y,this._parse(512,y)};r.inherits(u,o),u.prototype.destroy=function(e){this._destroyed||(this._destroyed=!0,e&&this.emit("error",e),this.emit("close"),this._stream&&this._stream.emit("close"))},u.prototype._parse=function(e,t){this._destroyed||(this._offset+=e,this._missing=e,t===this._onheader&&(this._partial=!1),this._onparse=t)},u.prototype._continue=function(){if(!this._destroyed){var e=this._cb;this._cb=c,this._overflow?this._write(this._overflow,void 0,e):e()}},u.prototype._write=function(e,t,n){if(!this._destroyed){var r=this._stream,i=this._buffer,s=this._missing;if(e.length&&(this._partial=!0),e.length<s)return this._missing-=e.length,this._overflow=null,r?r.write(e,n):(i.append(e),n());this._cb=n,this._missing=0;var o=null;e.length>s&&(o=e.slice(s),e=e.slice(0,s)),r?r.end(e):i.append(e),this._overflow=o,this._onparse()}},u.prototype._final=function(e){if(this._partial)return this.destroy(new Error("Unexpected end of data"));e()},e.exports=u},3544(e,t){var n=Buffer.alloc,r="0".charCodeAt(0),i=Buffer.from("ustar\0","binary"),s=Buffer.from("00","binary"),o=Buffer.from("ustar ","binary"),a=Buffer.from(" \0","binary"),c=parseInt("7777",8),l=257,h=function(e,t,n,r){for(;n<r;n++)if(e[n]===t)return n;return r},u=function(e){for(var t=256,n=0;n<148;n++)t+=e[n];for(var r=156;r<512;r++)t+=e[r];return t},d=function(e,t){return(e=e.toString(8)).length>t?"7777777777777777777".slice(0,t)+" ":"0000000000000000000".slice(0,t-e.length)+e+" "};var f=function(e,t,n){if(128&(e=e.slice(t,t+n))[t=0])return function(e){var t;if(128===e[0])t=!0;else{if(255!==e[0])return null;t=!1}for(var n=[],r=e.length-1;r>0;r--){var i=e[r];t?n.push(i):n.push(255-i)}var s=0,o=n.length;for(r=0;r<o;r++)s+=n[r]*Math.pow(256,r);return t?s:-1*s}(e);for(;t<e.length&&32===e[t];)t++;for(var r=(i=h(e,32,t,e.length),s=e.length,o=e.length,"number"!=typeof i?o:(i=~~i)>=s?s:i>=0||(i+=s)>=0?i:0);t<r&&0===e[t];)t++;return r===t?0:parseInt(e.slice(t,r).toString(),8);var i,s,o},p=function(e,t,n,r){return e.slice(t,h(e,0,t,t+n)).toString(r)},g=function(e){var t=Buffer.byteLength(e),n=Math.floor(Math.log(t)/Math.log(10))+1;return t+n>=Math.pow(10,n)&&n++,t+n+e};t.decodeLongPath=function(e,t){return p(e,0,e.length,t)},t.encodePax=function(e){var t="";e.name&&(t+=g(" path="+e.name+"\n")),e.linkname&&(t+=g(" linkpath="+e.linkname+"\n"));var n=e.pax;if(n)for(var r in n)t+=g(" "+r+"="+n[r]+"\n");return Buffer.from(t)},t.decodePax=function(e){for(var t={};e.length;){for(var n=0;n<e.length&&32!==e[n];)n++;var r=parseInt(e.slice(0,n).toString(),10);if(!r)return t;var i=e.slice(n+1,r-1).toString(),s=i.indexOf("=");if(-1===s)return t;t[i.slice(0,s)]=i.slice(s+1),e=e.slice(r)}return t},t.encode=function(e){var t=n(512),o=e.name,a="";if(5===e.typeflag&&"/"!==o[o.length-1]&&(o+="/"),Buffer.byteLength(o)!==o.length)return null;for(;Buffer.byteLength(o)>100;){var h=o.indexOf("/");if(-1===h)return null;a+=a?"/"+o.slice(0,h):o.slice(0,h),o=o.slice(h+1)}return Buffer.byteLength(o)>100||Buffer.byteLength(a)>155||e.linkname&&Buffer.byteLength(e.linkname)>100?null:(t.write(o),t.write(d(e.mode&c,6),100),t.write(d(e.uid,6),108),t.write(d(e.gid,6),116),t.write(d(e.size,11),124),t.write(d(e.mtime.getTime()/1e3|0,11),136),t[156]=r+function(e){switch(e){case"file":return 0;case"link":return 1;case"symlink":return 2;case"character-device":return 3;case"block-device":return 4;case"directory":return 5;case"fifo":return 6;case"contiguous-file":return 7;case"pax-header":return 72}return 0}(e.type),e.linkname&&t.write(e.linkname,157),i.copy(t,l),s.copy(t,263),e.uname&&t.write(e.uname,265),e.gname&&t.write(e.gname,297),t.write(d(e.devmajor||0,6),329),t.write(d(e.devminor||0,6),337),a&&t.write(a,345),t.write(d(u(t),6),148),t)},t.decode=function(e,t,n){var s=0===e[156]?0:e[156]-r,c=p(e,0,100,t),h=f(e,100,8),d=f(e,108,8),g=f(e,116,8),m=f(e,124,12),_=f(e,136,12),y=function(e){switch(e){case 0:return"file";case 1:return"link";case 2:return"symlink";case 3:return"character-device";case 4:return"block-device";case 5:return"directory";case 6:return"fifo";case 7:return"contiguous-file";case 72:return"pax-header";case 55:return"pax-global-header";case 27:return"gnu-long-link-path";case 28:case 30:return"gnu-long-path"}return null}(s),v=0===e[157]?null:p(e,157,100,t),b=p(e,265,32),E=p(e,297,32),A=f(e,329,8),S=f(e,337,8),w=u(e);if(256===w)return null;if(w!==f(e,148,8))throw new Error("Invalid tar header. Maybe the tar is corrupted or it needs to be gunzipped?");if(0===i.compare(e,l,263))e[345]&&(c=p(e,345,155,t)+"/"+c);else if(0===o.compare(e,l,263)&&0===a.compare(e,263,265));else if(!n)throw new Error("Invalid tar header: unknown format.");return 0===s&&c&&"/"===c[c.length-1]&&(s=5),{name:c,mode:h,uid:d,gid:g,size:m,mtime:new Date(1e3*_),type:y,linkname:v,uname:b,gname:E,devmajor:A,devminor:S}}},6706(e,t,n){t.extract=n(3807),t.pack=n(4009)},4009(e,t,n){var r=n(2170),i=n(6611),s=n(2017),o=Buffer.alloc,a=n(4198).Readable,c=n(4198).Writable,l=n(3193).StringDecoder,h=n(3544),u=parseInt("755",8),d=parseInt("644",8),f=o(1024),p=function(){},g=function(e,t){(t&=511)&&e.push(f.slice(0,512-t))};var m=function(e){c.call(this),this.written=0,this._to=e,this._destroyed=!1};s(m,c),m.prototype._write=function(e,t,n){if(this.written+=e.length,this._to.push(e))return n();this._to._drain=n},m.prototype.destroy=function(){this._destroyed||(this._destroyed=!0,this.emit("close"))};var _=function(){c.call(this),this.linkname="",this._decoder=new l("utf-8"),this._destroyed=!1};s(_,c),_.prototype._write=function(e,t,n){this.linkname+=this._decoder.write(e),n()},_.prototype.destroy=function(){this._destroyed||(this._destroyed=!0,this.emit("close"))};var y=function(){c.call(this),this._destroyed=!1};s(y,c),y.prototype._write=function(e,t,n){n(new Error("No body allowed for this entry"))},y.prototype.destroy=function(){this._destroyed||(this._destroyed=!0,this.emit("close"))};var v=function(e){if(!(this instanceof v))return new v(e);a.call(this,e),this._drain=p,this._finalized=!1,this._finalizing=!1,this._destroyed=!1,this._stream=null};s(v,a),v.prototype.entry=function(e,t,n){if(this._stream)throw new Error("already piping an entry");if(!this._finalized&&!this._destroyed){"function"==typeof t&&(n=t,t=null),n||(n=p);var s=this;if(e.size&&"symlink"!==e.type||(e.size=0),e.type||(e.type=function(e){switch(e&r.S_IFMT){case r.S_IFBLK:return"block-device";case r.S_IFCHR:return"character-device";case r.S_IFDIR:return"directory";case r.S_IFIFO:return"fifo";case r.S_IFLNK:return"symlink"}return"file"}(e.mode)),e.mode||(e.mode="directory"===e.type?u:d),e.uid||(e.uid=0),e.gid||(e.gid=0),e.mtime||(e.mtime=new Date),"string"==typeof t&&(t=Buffer.from(t)),Buffer.isBuffer(t)){e.size=t.length,this._encode(e);var o=this.push(t);return g(s,e.size),o?process.nextTick(n):this._drain=n,new y}if("symlink"===e.type&&!e.linkname){var a=new _;return i(a,function(t){if(t)return s.destroy(),n(t);e.linkname=a.linkname,s._encode(e),n()}),a}if(this._encode(e),"file"!==e.type&&"contiguous-file"!==e.type)return process.nextTick(n),new y;var c=new m(this);return this._stream=c,i(c,function(t){return s._stream=null,t?(s.destroy(),n(t)):c.written!==e.size?(s.destroy(),n(new Error("size mismatch"))):(g(s,e.size),s._finalizing&&s.finalize(),void n())}),c}},v.prototype.finalize=function(){this._stream?this._finalizing=!0:this._finalized||(this._finalized=!0,this.push(f),this.push(null))},v.prototype.destroy=function(e){this._destroyed||(this._destroyed=!0,e&&this.emit("error",e),this.emit("close"),this._stream&&this._stream.destroy&&this._stream.destroy())},v.prototype._encode=function(e){if(!e.pax){var t=h.encode(e);if(t)return void this.push(t)}this._encodePax(e)},v.prototype._encodePax=function(e){var t=h.encodePax({name:e.name,linkname:e.linkname,pax:e.pax}),n={name:"PaxHeader",mode:e.mode,uid:e.uid,gid:e.gid,size:t.length,mtime:e.mtime,type:"pax-header",linkname:e.linkname&&"PaxHeader",uname:e.uname,gname:e.gname,devmajor:e.devmajor,devminor:e.devminor};this.push(h.encode(n)),this.push(t),g(this,t.length),n.size=e.size,n.type=e.type,this.push(h.encode(n))},v.prototype._read=function(e){var t=this._drain;this._drain=p,t()},e.exports=v},8947(e,t,n){!function(e){"use strict";var t=function(e){var t,n=new Float64Array(16);if(e)for(t=0;t<e.length;t++)n[t]=e[t];return n},r=function(){throw new Error("no PRNG")},i=new Uint8Array(16),s=new Uint8Array(32);s[0]=9;var o=t(),a=t([1]),c=t([56129,1]),l=t([30883,4953,19914,30187,55467,16705,2637,112,59544,30585,16505,36039,65139,11119,27886,20995]),h=t([61785,9906,39828,60374,45398,33411,5274,224,53552,61171,33010,6542,64743,22239,55772,9222]),u=t([54554,36645,11616,51542,42930,38181,51040,26924,56412,64982,57905,49316,21502,52590,14035,8553]),d=t([26200,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214]),f=t([41136,18958,6951,50414,58488,44335,6150,12099,55207,15867,153,11085,57099,20417,9344,11139]);function p(e,t,n,r){e[t]=n>>24&255,e[t+1]=n>>16&255,e[t+2]=n>>8&255,e[t+3]=255&n,e[t+4]=r>>24&255,e[t+5]=r>>16&255,e[t+6]=r>>8&255,e[t+7]=255&r}function g(e,t,n,r,i){var s,o=0;for(s=0;s<i;s++)o|=e[t+s]^n[r+s];return(1&o-1>>>8)-1}function m(e,t,n,r){return g(e,t,n,r,16)}function _(e,t,n,r){return g(e,t,n,r,32)}function y(e,t,n,r){!function(e,t,n,r){for(var i,s=255&r[0]|(255&r[1])<<8|(255&r[2])<<16|(255&r[3])<<24,o=255&n[0]|(255&n[1])<<8|(255&n[2])<<16|(255&n[3])<<24,a=255&n[4]|(255&n[5])<<8|(255&n[6])<<16|(255&n[7])<<24,c=255&n[8]|(255&n[9])<<8|(255&n[10])<<16|(255&n[11])<<24,l=255&n[12]|(255&n[13])<<8|(255&n[14])<<16|(255&n[15])<<24,h=255&r[4]|(255&r[5])<<8|(255&r[6])<<16|(255&r[7])<<24,u=255&t[0]|(255&t[1])<<8|(255&t[2])<<16|(255&t[3])<<24,d=255&t[4]|(255&t[5])<<8|(255&t[6])<<16|(255&t[7])<<24,f=255&t[8]|(255&t[9])<<8|(255&t[10])<<16|(255&t[11])<<24,p=255&t[12]|(255&t[13])<<8|(255&t[14])<<16|(255&t[15])<<24,g=255&r[8]|(255&r[9])<<8|(255&r[10])<<16|(255&r[11])<<24,m=255&n[16]|(255&n[17])<<8|(255&n[18])<<16|(255&n[19])<<24,_=255&n[20]|(255&n[21])<<8|(255&n[22])<<16|(255&n[23])<<24,y=255&n[24]|(255&n[25])<<8|(255&n[26])<<16|(255&n[27])<<24,v=255&n[28]|(255&n[29])<<8|(255&n[30])<<16|(255&n[31])<<24,b=255&r[12]|(255&r[13])<<8|(255&r[14])<<16|(255&r[15])<<24,E=s,A=o,S=a,w=c,C=l,I=h,k=u,T=d,R=f,O=p,N=g,P=m,B=_,L=y,x=v,D=b,M=0;M<20;M+=2)E^=(i=(B^=(i=(R^=(i=(C^=(i=E+B|0)<<7|i>>>25)+E|0)<<9|i>>>23)+C|0)<<13|i>>>19)+R|0)<<18|i>>>14,I^=(i=(A^=(i=(L^=(i=(O^=(i=I+A|0)<<7|i>>>25)+I|0)<<9|i>>>23)+O|0)<<13|i>>>19)+L|0)<<18|i>>>14,N^=(i=(k^=(i=(S^=(i=(x^=(i=N+k|0)<<7|i>>>25)+N|0)<<9|i>>>23)+x|0)<<13|i>>>19)+S|0)<<18|i>>>14,D^=(i=(P^=(i=(T^=(i=(w^=(i=D+P|0)<<7|i>>>25)+D|0)<<9|i>>>23)+w|0)<<13|i>>>19)+T|0)<<18|i>>>14,E^=(i=(w^=(i=(S^=(i=(A^=(i=E+w|0)<<7|i>>>25)+E|0)<<9|i>>>23)+A|0)<<13|i>>>19)+S|0)<<18|i>>>14,I^=(i=(C^=(i=(T^=(i=(k^=(i=I+C|0)<<7|i>>>25)+I|0)<<9|i>>>23)+k|0)<<13|i>>>19)+T|0)<<18|i>>>14,N^=(i=(O^=(i=(R^=(i=(P^=(i=N+O|0)<<7|i>>>25)+N|0)<<9|i>>>23)+P|0)<<13|i>>>19)+R|0)<<18|i>>>14,D^=(i=(x^=(i=(L^=(i=(B^=(i=D+x|0)<<7|i>>>25)+D|0)<<9|i>>>23)+B|0)<<13|i>>>19)+L|0)<<18|i>>>14;E=E+s|0,A=A+o|0,S=S+a|0,w=w+c|0,C=C+l|0,I=I+h|0,k=k+u|0,T=T+d|0,R=R+f|0,O=O+p|0,N=N+g|0,P=P+m|0,B=B+_|0,L=L+y|0,x=x+v|0,D=D+b|0,e[0]=E>>>0&255,e[1]=E>>>8&255,e[2]=E>>>16&255,e[3]=E>>>24&255,e[4]=A>>>0&255,e[5]=A>>>8&255,e[6]=A>>>16&255,e[7]=A>>>24&255,e[8]=S>>>0&255,e[9]=S>>>8&255,e[10]=S>>>16&255,e[11]=S>>>24&255,e[12]=w>>>0&255,e[13]=w>>>8&255,e[14]=w>>>16&255,e[15]=w>>>24&255,e[16]=C>>>0&255,e[17]=C>>>8&255,e[18]=C>>>16&255,e[19]=C>>>24&255,e[20]=I>>>0&255,e[21]=I>>>8&255,e[22]=I>>>16&255,e[23]=I>>>24&255,e[24]=k>>>0&255,e[25]=k>>>8&255,e[26]=k>>>16&255,e[27]=k>>>24&255,e[28]=T>>>0&255,e[29]=T>>>8&255,e[30]=T>>>16&255,e[31]=T>>>24&255,e[32]=R>>>0&255,e[33]=R>>>8&255,e[34]=R>>>16&255,e[35]=R>>>24&255,e[36]=O>>>0&255,e[37]=O>>>8&255,e[38]=O>>>16&255,e[39]=O>>>24&255,e[40]=N>>>0&255,e[41]=N>>>8&255,e[42]=N>>>16&255,e[43]=N>>>24&255,e[44]=P>>>0&255,e[45]=P>>>8&255,e[46]=P>>>16&255,e[47]=P>>>24&255,e[48]=B>>>0&255,e[49]=B>>>8&255,e[50]=B>>>16&255,e[51]=B>>>24&255,e[52]=L>>>0&255,e[53]=L>>>8&255,e[54]=L>>>16&255,e[55]=L>>>24&255,e[56]=x>>>0&255,e[57]=x>>>8&255,e[58]=x>>>16&255,e[59]=x>>>24&255,e[60]=D>>>0&255,e[61]=D>>>8&255,e[62]=D>>>16&255,e[63]=D>>>24&255}(e,t,n,r)}function v(e,t,n,r){!function(e,t,n,r){for(var i,s=255&r[0]|(255&r[1])<<8|(255&r[2])<<16|(255&r[3])<<24,o=255&n[0]|(255&n[1])<<8|(255&n[2])<<16|(255&n[3])<<24,a=255&n[4]|(255&n[5])<<8|(255&n[6])<<16|(255&n[7])<<24,c=255&n[8]|(255&n[9])<<8|(255&n[10])<<16|(255&n[11])<<24,l=255&n[12]|(255&n[13])<<8|(255&n[14])<<16|(255&n[15])<<24,h=255&r[4]|(255&r[5])<<8|(255&r[6])<<16|(255&r[7])<<24,u=255&t[0]|(255&t[1])<<8|(255&t[2])<<16|(255&t[3])<<24,d=255&t[4]|(255&t[5])<<8|(255&t[6])<<16|(255&t[7])<<24,f=255&t[8]|(255&t[9])<<8|(255&t[10])<<16|(255&t[11])<<24,p=255&t[12]|(255&t[13])<<8|(255&t[14])<<16|(255&t[15])<<24,g=255&r[8]|(255&r[9])<<8|(255&r[10])<<16|(255&r[11])<<24,m=255&n[16]|(255&n[17])<<8|(255&n[18])<<16|(255&n[19])<<24,_=255&n[20]|(255&n[21])<<8|(255&n[22])<<16|(255&n[23])<<24,y=255&n[24]|(255&n[25])<<8|(255&n[26])<<16|(255&n[27])<<24,v=255&n[28]|(255&n[29])<<8|(255&n[30])<<16|(255&n[31])<<24,b=255&r[12]|(255&r[13])<<8|(255&r[14])<<16|(255&r[15])<<24,E=0;E<20;E+=2)s^=(i=(_^=(i=(f^=(i=(l^=(i=s+_|0)<<7|i>>>25)+s|0)<<9|i>>>23)+l|0)<<13|i>>>19)+f|0)<<18|i>>>14,h^=(i=(o^=(i=(y^=(i=(p^=(i=h+o|0)<<7|i>>>25)+h|0)<<9|i>>>23)+p|0)<<13|i>>>19)+y|0)<<18|i>>>14,g^=(i=(u^=(i=(a^=(i=(v^=(i=g+u|0)<<7|i>>>25)+g|0)<<9|i>>>23)+v|0)<<13|i>>>19)+a|0)<<18|i>>>14,b^=(i=(m^=(i=(d^=(i=(c^=(i=b+m|0)<<7|i>>>25)+b|0)<<9|i>>>23)+c|0)<<13|i>>>19)+d|0)<<18|i>>>14,s^=(i=(c^=(i=(a^=(i=(o^=(i=s+c|0)<<7|i>>>25)+s|0)<<9|i>>>23)+o|0)<<13|i>>>19)+a|0)<<18|i>>>14,h^=(i=(l^=(i=(d^=(i=(u^=(i=h+l|0)<<7|i>>>25)+h|0)<<9|i>>>23)+u|0)<<13|i>>>19)+d|0)<<18|i>>>14,g^=(i=(p^=(i=(f^=(i=(m^=(i=g+p|0)<<7|i>>>25)+g|0)<<9|i>>>23)+m|0)<<13|i>>>19)+f|0)<<18|i>>>14,b^=(i=(v^=(i=(y^=(i=(_^=(i=b+v|0)<<7|i>>>25)+b|0)<<9|i>>>23)+_|0)<<13|i>>>19)+y|0)<<18|i>>>14;e[0]=s>>>0&255,e[1]=s>>>8&255,e[2]=s>>>16&255,e[3]=s>>>24&255,e[4]=h>>>0&255,e[5]=h>>>8&255,e[6]=h>>>16&255,e[7]=h>>>24&255,e[8]=g>>>0&255,e[9]=g>>>8&255,e[10]=g>>>16&255,e[11]=g>>>24&255,e[12]=b>>>0&255,e[13]=b>>>8&255,e[14]=b>>>16&255,e[15]=b>>>24&255,e[16]=u>>>0&255,e[17]=u>>>8&255,e[18]=u>>>16&255,e[19]=u>>>24&255,e[20]=d>>>0&255,e[21]=d>>>8&255,e[22]=d>>>16&255,e[23]=d>>>24&255,e[24]=f>>>0&255,e[25]=f>>>8&255,e[26]=f>>>16&255,e[27]=f>>>24&255,e[28]=p>>>0&255,e[29]=p>>>8&255,e[30]=p>>>16&255,e[31]=p>>>24&255}(e,t,n,r)}var b=new Uint8Array([101,120,112,97,110,100,32,51,50,45,98,121,116,101,32,107]);function E(e,t,n,r,i,s,o){var a,c,l=new Uint8Array(16),h=new Uint8Array(64);for(c=0;c<16;c++)l[c]=0;for(c=0;c<8;c++)l[c]=s[c];for(;i>=64;){for(y(h,l,o,b),c=0;c<64;c++)e[t+c]=n[r+c]^h[c];for(a=1,c=8;c<16;c++)a=a+(255&l[c])|0,l[c]=255&a,a>>>=8;i-=64,t+=64,r+=64}if(i>0)for(y(h,l,o,b),c=0;c<i;c++)e[t+c]=n[r+c]^h[c];return 0}function A(e,t,n,r,i){var s,o,a=new Uint8Array(16),c=new Uint8Array(64);for(o=0;o<16;o++)a[o]=0;for(o=0;o<8;o++)a[o]=r[o];for(;n>=64;){for(y(c,a,i,b),o=0;o<64;o++)e[t+o]=c[o];for(s=1,o=8;o<16;o++)s=s+(255&a[o])|0,a[o]=255&s,s>>>=8;n-=64,t+=64}if(n>0)for(y(c,a,i,b),o=0;o<n;o++)e[t+o]=c[o];return 0}function S(e,t,n,r,i){var s=new Uint8Array(32);v(s,r,i,b);for(var o=new Uint8Array(8),a=0;a<8;a++)o[a]=r[a+16];return A(e,t,n,o,s)}function w(e,t,n,r,i,s,o){var a=new Uint8Array(32);v(a,s,o,b);for(var c=new Uint8Array(8),l=0;l<8;l++)c[l]=s[l+16];return E(e,t,n,r,i,c,a)}var C=function(e){var t,n,r,i,s,o,a,c;this.buffer=new Uint8Array(16),this.r=new Uint16Array(10),this.h=new Uint16Array(10),this.pad=new Uint16Array(8),this.leftover=0,this.fin=0,t=255&e[0]|(255&e[1])<<8,this.r[0]=8191&t,n=255&e[2]|(255&e[3])<<8,this.r[1]=8191&(t>>>13|n<<3),r=255&e[4]|(255&e[5])<<8,this.r[2]=7939&(n>>>10|r<<6),i=255&e[6]|(255&e[7])<<8,this.r[3]=8191&(r>>>7|i<<9),s=255&e[8]|(255&e[9])<<8,this.r[4]=255&(i>>>4|s<<12),this.r[5]=s>>>1&8190,o=255&e[10]|(255&e[11])<<8,this.r[6]=8191&(s>>>14|o<<2),a=255&e[12]|(255&e[13])<<8,this.r[7]=8065&(o>>>11|a<<5),c=255&e[14]|(255&e[15])<<8,this.r[8]=8191&(a>>>8|c<<8),this.r[9]=c>>>5&127,this.pad[0]=255&e[16]|(255&e[17])<<8,this.pad[1]=255&e[18]|(255&e[19])<<8,this.pad[2]=255&e[20]|(255&e[21])<<8,this.pad[3]=255&e[22]|(255&e[23])<<8,this.pad[4]=255&e[24]|(255&e[25])<<8,this.pad[5]=255&e[26]|(255&e[27])<<8,this.pad[6]=255&e[28]|(255&e[29])<<8,this.pad[7]=255&e[30]|(255&e[31])<<8};function I(e,t,n,r,i,s){var o=new C(s);return o.update(n,r,i),o.finish(e,t),0}function k(e,t,n,r,i,s){var o=new Uint8Array(16);return I(o,0,n,r,i,s),m(e,t,o,0)}function T(e,t,n,r,i){var s;if(n<32)return-1;for(w(e,0,t,0,n,r,i),I(e,16,e,32,n-32,e),s=0;s<16;s++)e[s]=0;return 0}function R(e,t,n,r,i){var s,o=new Uint8Array(32);if(n<32)return-1;if(S(o,0,32,r,i),0!==k(t,16,t,32,n-32,o))return-1;for(w(e,0,t,0,n,r,i),s=0;s<32;s++)e[s]=0;return 0}function O(e,t){var n;for(n=0;n<16;n++)e[n]=0|t[n]}function N(e){var t,n,r=1;for(t=0;t<16;t++)n=e[t]+r+65535,r=Math.floor(n/65536),e[t]=n-65536*r;e[0]+=r-1+37*(r-1)}function P(e,t,n){for(var r,i=~(n-1),s=0;s<16;s++)r=i&(e[s]^t[s]),e[s]^=r,t[s]^=r}function B(e,n){var r,i,s,o=t(),a=t();for(r=0;r<16;r++)a[r]=n[r];for(N(a),N(a),N(a),i=0;i<2;i++){for(o[0]=a[0]-65517,r=1;r<15;r++)o[r]=a[r]-65535-(o[r-1]>>16&1),o[r-1]&=65535;o[15]=a[15]-32767-(o[14]>>16&1),s=o[15]>>16&1,o[14]&=65535,P(a,o,1-s)}for(r=0;r<16;r++)e[2*r]=255&a[r],e[2*r+1]=a[r]>>8}function L(e,t){var n=new Uint8Array(32),r=new Uint8Array(32);return B(n,e),B(r,t),_(n,0,r,0)}function x(e){var t=new Uint8Array(32);return B(t,e),1&t[0]}function D(e,t){var n;for(n=0;n<16;n++)e[n]=t[2*n]+(t[2*n+1]<<8);e[15]&=32767}function M(e,t,n){for(var r=0;r<16;r++)e[r]=t[r]+n[r]}function U(e,t,n){for(var r=0;r<16;r++)e[r]=t[r]-n[r]}function F(e,t,n){var r,i,s=0,o=0,a=0,c=0,l=0,h=0,u=0,d=0,f=0,p=0,g=0,m=0,_=0,y=0,v=0,b=0,E=0,A=0,S=0,w=0,C=0,I=0,k=0,T=0,R=0,O=0,N=0,P=0,B=0,L=0,x=0,D=n[0],M=n[1],U=n[2],F=n[3],H=n[4],j=n[5],W=n[6],Q=n[7],q=n[8],z=n[9],$=n[10],G=n[11],K=n[12],Y=n[13],V=n[14],X=n[15];s+=(r=t[0])*D,o+=r*M,a+=r*U,c+=r*F,l+=r*H,h+=r*j,u+=r*W,d+=r*Q,f+=r*q,p+=r*z,g+=r*$,m+=r*G,_+=r*K,y+=r*Y,v+=r*V,b+=r*X,o+=(r=t[1])*D,a+=r*M,c+=r*U,l+=r*F,h+=r*H,u+=r*j,d+=r*W,f+=r*Q,p+=r*q,g+=r*z,m+=r*$,_+=r*G,y+=r*K,v+=r*Y,b+=r*V,E+=r*X,a+=(r=t[2])*D,c+=r*M,l+=r*U,h+=r*F,u+=r*H,d+=r*j,f+=r*W,p+=r*Q,g+=r*q,m+=r*z,_+=r*$,y+=r*G,v+=r*K,b+=r*Y,E+=r*V,A+=r*X,c+=(r=t[3])*D,l+=r*M,h+=r*U,u+=r*F,d+=r*H,f+=r*j,p+=r*W,g+=r*Q,m+=r*q,_+=r*z,y+=r*$,v+=r*G,b+=r*K,E+=r*Y,A+=r*V,S+=r*X,l+=(r=t[4])*D,h+=r*M,u+=r*U,d+=r*F,f+=r*H,p+=r*j,g+=r*W,m+=r*Q,_+=r*q,y+=r*z,v+=r*$,b+=r*G,E+=r*K,A+=r*Y,S+=r*V,w+=r*X,h+=(r=t[5])*D,u+=r*M,d+=r*U,f+=r*F,p+=r*H,g+=r*j,m+=r*W,_+=r*Q,y+=r*q,v+=r*z,b+=r*$,E+=r*G,A+=r*K,S+=r*Y,w+=r*V,C+=r*X,u+=(r=t[6])*D,d+=r*M,f+=r*U,p+=r*F,g+=r*H,m+=r*j,_+=r*W,y+=r*Q,v+=r*q,b+=r*z,E+=r*$,A+=r*G,S+=r*K,w+=r*Y,C+=r*V,I+=r*X,d+=(r=t[7])*D,f+=r*M,p+=r*U,g+=r*F,m+=r*H,_+=r*j,y+=r*W,v+=r*Q,b+=r*q,E+=r*z,A+=r*$,S+=r*G,w+=r*K,C+=r*Y,I+=r*V,k+=r*X,f+=(r=t[8])*D,p+=r*M,g+=r*U,m+=r*F,_+=r*H,y+=r*j,v+=r*W,b+=r*Q,E+=r*q,A+=r*z,S+=r*$,w+=r*G,C+=r*K,I+=r*Y,k+=r*V,T+=r*X,p+=(r=t[9])*D,g+=r*M,m+=r*U,_+=r*F,y+=r*H,v+=r*j,b+=r*W,E+=r*Q,A+=r*q,S+=r*z,w+=r*$,C+=r*G,I+=r*K,k+=r*Y,T+=r*V,R+=r*X,g+=(r=t[10])*D,m+=r*M,_+=r*U,y+=r*F,v+=r*H,b+=r*j,E+=r*W,A+=r*Q,S+=r*q,w+=r*z,C+=r*$,I+=r*G,k+=r*K,T+=r*Y,R+=r*V,O+=r*X,m+=(r=t[11])*D,_+=r*M,y+=r*U,v+=r*F,b+=r*H,E+=r*j,A+=r*W,S+=r*Q,w+=r*q,C+=r*z,I+=r*$,k+=r*G,T+=r*K,R+=r*Y,O+=r*V,N+=r*X,_+=(r=t[12])*D,y+=r*M,v+=r*U,b+=r*F,E+=r*H,A+=r*j,S+=r*W,w+=r*Q,C+=r*q,I+=r*z,k+=r*$,T+=r*G,R+=r*K,O+=r*Y,N+=r*V,P+=r*X,y+=(r=t[13])*D,v+=r*M,b+=r*U,E+=r*F,A+=r*H,S+=r*j,w+=r*W,C+=r*Q,I+=r*q,k+=r*z,T+=r*$,R+=r*G,O+=r*K,N+=r*Y,P+=r*V,B+=r*X,v+=(r=t[14])*D,b+=r*M,E+=r*U,A+=r*F,S+=r*H,w+=r*j,C+=r*W,I+=r*Q,k+=r*q,T+=r*z,R+=r*$,O+=r*G,N+=r*K,P+=r*Y,B+=r*V,L+=r*X,b+=(r=t[15])*D,o+=38*(A+=r*U),a+=38*(S+=r*F),c+=38*(w+=r*H),l+=38*(C+=r*j),h+=38*(I+=r*W),u+=38*(k+=r*Q),d+=38*(T+=r*q),f+=38*(R+=r*z),p+=38*(O+=r*$),g+=38*(N+=r*G),m+=38*(P+=r*K),_+=38*(B+=r*Y),y+=38*(L+=r*V),v+=38*(x+=r*X),s=(r=(s+=38*(E+=r*M))+(i=1)+65535)-65536*(i=Math.floor(r/65536)),o=(r=o+i+65535)-65536*(i=Math.floor(r/65536)),a=(r=a+i+65535)-65536*(i=Math.floor(r/65536)),c=(r=c+i+65535)-65536*(i=Math.floor(r/65536)),l=(r=l+i+65535)-65536*(i=Math.floor(r/65536)),h=(r=h+i+65535)-65536*(i=Math.floor(r/65536)),u=(r=u+i+65535)-65536*(i=Math.floor(r/65536)),d=(r=d+i+65535)-65536*(i=Math.floor(r/65536)),f=(r=f+i+65535)-65536*(i=Math.floor(r/65536)),p=(r=p+i+65535)-65536*(i=Math.floor(r/65536)),g=(r=g+i+65535)-65536*(i=Math.floor(r/65536)),m=(r=m+i+65535)-65536*(i=Math.floor(r/65536)),_=(r=_+i+65535)-65536*(i=Math.floor(r/65536)),y=(r=y+i+65535)-65536*(i=Math.floor(r/65536)),v=(r=v+i+65535)-65536*(i=Math.floor(r/65536)),b=(r=b+i+65535)-65536*(i=Math.floor(r/65536)),s=(r=(s+=i-1+37*(i-1))+(i=1)+65535)-65536*(i=Math.floor(r/65536)),o=(r=o+i+65535)-65536*(i=Math.floor(r/65536)),a=(r=a+i+65535)-65536*(i=Math.floor(r/65536)),c=(r=c+i+65535)-65536*(i=Math.floor(r/65536)),l=(r=l+i+65535)-65536*(i=Math.floor(r/65536)),h=(r=h+i+65535)-65536*(i=Math.floor(r/65536)),u=(r=u+i+65535)-65536*(i=Math.floor(r/65536)),d=(r=d+i+65535)-65536*(i=Math.floor(r/65536)),f=(r=f+i+65535)-65536*(i=Math.floor(r/65536)),p=(r=p+i+65535)-65536*(i=Math.floor(r/65536)),g=(r=g+i+65535)-65536*(i=Math.floor(r/65536)),m=(r=m+i+65535)-65536*(i=Math.floor(r/65536)),_=(r=_+i+65535)-65536*(i=Math.floor(r/65536)),y=(r=y+i+65535)-65536*(i=Math.floor(r/65536)),v=(r=v+i+65535)-65536*(i=Math.floor(r/65536)),b=(r=b+i+65535)-65536*(i=Math.floor(r/65536)),s+=i-1+37*(i-1),e[0]=s,e[1]=o,e[2]=a,e[3]=c,e[4]=l,e[5]=h,e[6]=u,e[7]=d,e[8]=f,e[9]=p,e[10]=g,e[11]=m,e[12]=_,e[13]=y,e[14]=v,e[15]=b}function H(e,t){F(e,t,t)}function j(e,n){var r,i=t();for(r=0;r<16;r++)i[r]=n[r];for(r=253;r>=0;r--)H(i,i),2!==r&&4!==r&&F(i,i,n);for(r=0;r<16;r++)e[r]=i[r]}function W(e,n,r){var i,s,o=new Uint8Array(32),a=new Float64Array(80),l=t(),h=t(),u=t(),d=t(),f=t(),p=t();for(s=0;s<31;s++)o[s]=n[s];for(o[31]=127&n[31]|64,o[0]&=248,D(a,r),s=0;s<16;s++)h[s]=a[s],d[s]=l[s]=u[s]=0;for(l[0]=d[0]=1,s=254;s>=0;--s)P(l,h,i=o[s>>>3]>>>(7&s)&1),P(u,d,i),M(f,l,u),U(l,l,u),M(u,h,d),U(h,h,d),H(d,f),H(p,l),F(l,u,l),F(u,h,f),M(f,l,u),U(l,l,u),H(h,l),U(u,d,p),F(l,u,c),M(l,l,d),F(u,u,l),F(l,d,p),F(d,h,a),H(h,f),P(l,h,i),P(u,d,i);for(s=0;s<16;s++)a[s+16]=l[s],a[s+32]=u[s],a[s+48]=h[s],a[s+64]=d[s];var g=a.subarray(32),m=a.subarray(16);return j(g,g),F(m,m,g),B(e,m),0}function Q(e,t){return W(e,t,s)}function q(e,t){return r(t,32),Q(e,t)}function z(e,t,n){var r=new Uint8Array(32);return W(r,n,t),v(e,i,r,b)}C.prototype.blocks=function(e,t,n){for(var r,i,s,o,a,c,l,h,u,d,f,p,g,m,_,y,v,b,E,A=this.fin?0:2048,S=this.h[0],w=this.h[1],C=this.h[2],I=this.h[3],k=this.h[4],T=this.h[5],R=this.h[6],O=this.h[7],N=this.h[8],P=this.h[9],B=this.r[0],L=this.r[1],x=this.r[2],D=this.r[3],M=this.r[4],U=this.r[5],F=this.r[6],H=this.r[7],j=this.r[8],W=this.r[9];n>=16;)d=u=0,d+=(S+=8191&(r=255&e[t+0]|(255&e[t+1])<<8))*B,d+=(w+=8191&(r>>>13|(i=255&e[t+2]|(255&e[t+3])<<8)<<3))*(5*W),d+=(C+=8191&(i>>>10|(s=255&e[t+4]|(255&e[t+5])<<8)<<6))*(5*j),d+=(I+=8191&(s>>>7|(o=255&e[t+6]|(255&e[t+7])<<8)<<9))*(5*H),u=(d+=(k+=8191&(o>>>4|(a=255&e[t+8]|(255&e[t+9])<<8)<<12))*(5*F))>>>13,d&=8191,d+=(T+=a>>>1&8191)*(5*U),d+=(R+=8191&(a>>>14|(c=255&e[t+10]|(255&e[t+11])<<8)<<2))*(5*M),d+=(O+=8191&(c>>>11|(l=255&e[t+12]|(255&e[t+13])<<8)<<5))*(5*D),d+=(N+=8191&(l>>>8|(h=255&e[t+14]|(255&e[t+15])<<8)<<8))*(5*x),f=u+=(d+=(P+=h>>>5|A)*(5*L))>>>13,f+=S*L,f+=w*B,f+=C*(5*W),f+=I*(5*j),u=(f+=k*(5*H))>>>13,f&=8191,f+=T*(5*F),f+=R*(5*U),f+=O*(5*M),f+=N*(5*D),u+=(f+=P*(5*x))>>>13,f&=8191,p=u,p+=S*x,p+=w*L,p+=C*B,p+=I*(5*W),u=(p+=k*(5*j))>>>13,p&=8191,p+=T*(5*H),p+=R*(5*F),p+=O*(5*U),p+=N*(5*M),g=u+=(p+=P*(5*D))>>>13,g+=S*D,g+=w*x,g+=C*L,g+=I*B,u=(g+=k*(5*W))>>>13,g&=8191,g+=T*(5*j),g+=R*(5*H),g+=O*(5*F),g+=N*(5*U),m=u+=(g+=P*(5*M))>>>13,m+=S*M,m+=w*D,m+=C*x,m+=I*L,u=(m+=k*B)>>>13,m&=8191,m+=T*(5*W),m+=R*(5*j),m+=O*(5*H),m+=N*(5*F),_=u+=(m+=P*(5*U))>>>13,_+=S*U,_+=w*M,_+=C*D,_+=I*x,u=(_+=k*L)>>>13,_&=8191,_+=T*B,_+=R*(5*W),_+=O*(5*j),_+=N*(5*H),y=u+=(_+=P*(5*F))>>>13,y+=S*F,y+=w*U,y+=C*M,y+=I*D,u=(y+=k*x)>>>13,y&=8191,y+=T*L,y+=R*B,y+=O*(5*W),y+=N*(5*j),v=u+=(y+=P*(5*H))>>>13,v+=S*H,v+=w*F,v+=C*U,v+=I*M,u=(v+=k*D)>>>13,v&=8191,v+=T*x,v+=R*L,v+=O*B,v+=N*(5*W),b=u+=(v+=P*(5*j))>>>13,b+=S*j,b+=w*H,b+=C*F,b+=I*U,u=(b+=k*M)>>>13,b&=8191,b+=T*D,b+=R*x,b+=O*L,b+=N*B,E=u+=(b+=P*(5*W))>>>13,E+=S*W,E+=w*j,E+=C*H,E+=I*F,u=(E+=k*U)>>>13,E&=8191,E+=T*M,E+=R*D,E+=O*x,E+=N*L,S=d=8191&(u=(u=((u+=(E+=P*B)>>>13)<<2)+u|0)+(d&=8191)|0),w=f+=u>>>=13,C=p&=8191,I=g&=8191,k=m&=8191,T=_&=8191,R=y&=8191,O=v&=8191,N=b&=8191,P=E&=8191,t+=16,n-=16;this.h[0]=S,this.h[1]=w,this.h[2]=C,this.h[3]=I,this.h[4]=k,this.h[5]=T,this.h[6]=R,this.h[7]=O,this.h[8]=N,this.h[9]=P},C.prototype.finish=function(e,t){var n,r,i,s,o=new Uint16Array(10);if(this.leftover){for(s=this.leftover,this.buffer[s++]=1;s<16;s++)this.buffer[s]=0;this.fin=1,this.blocks(this.buffer,0,16)}for(n=this.h[1]>>>13,this.h[1]&=8191,s=2;s<10;s++)this.h[s]+=n,n=this.h[s]>>>13,this.h[s]&=8191;for(this.h[0]+=5*n,n=this.h[0]>>>13,this.h[0]&=8191,this.h[1]+=n,n=this.h[1]>>>13,this.h[1]&=8191,this.h[2]+=n,o[0]=this.h[0]+5,n=o[0]>>>13,o[0]&=8191,s=1;s<10;s++)o[s]=this.h[s]+n,n=o[s]>>>13,o[s]&=8191;for(o[9]-=8192,r=(1^n)-1,s=0;s<10;s++)o[s]&=r;for(r=~r,s=0;s<10;s++)this.h[s]=this.h[s]&r|o[s];for(this.h[0]=65535&(this.h[0]|this.h[1]<<13),this.h[1]=65535&(this.h[1]>>>3|this.h[2]<<10),this.h[2]=65535&(this.h[2]>>>6|this.h[3]<<7),this.h[3]=65535&(this.h[3]>>>9|this.h[4]<<4),this.h[4]=65535&(this.h[4]>>>12|this.h[5]<<1|this.h[6]<<14),this.h[5]=65535&(this.h[6]>>>2|this.h[7]<<11),this.h[6]=65535&(this.h[7]>>>5|this.h[8]<<8),this.h[7]=65535&(this.h[8]>>>8|this.h[9]<<5),i=this.h[0]+this.pad[0],this.h[0]=65535&i,s=1;s<8;s++)i=(this.h[s]+this.pad[s]|0)+(i>>>16)|0,this.h[s]=65535&i;e[t+0]=this.h[0]>>>0&255,e[t+1]=this.h[0]>>>8&255,e[t+2]=this.h[1]>>>0&255,e[t+3]=this.h[1]>>>8&255,e[t+4]=this.h[2]>>>0&255,e[t+5]=this.h[2]>>>8&255,e[t+6]=this.h[3]>>>0&255,e[t+7]=this.h[3]>>>8&255,e[t+8]=this.h[4]>>>0&255,e[t+9]=this.h[4]>>>8&255,e[t+10]=this.h[5]>>>0&255,e[t+11]=this.h[5]>>>8&255,e[t+12]=this.h[6]>>>0&255,e[t+13]=this.h[6]>>>8&255,e[t+14]=this.h[7]>>>0&255,e[t+15]=this.h[7]>>>8&255},C.prototype.update=function(e,t,n){var r,i;if(this.leftover){for((i=16-this.leftover)>n&&(i=n),r=0;r<i;r++)this.buffer[this.leftover+r]=e[t+r];if(n-=i,t+=i,this.leftover+=i,this.leftover<16)return;this.blocks(this.buffer,0,16),this.leftover=0}if(n>=16&&(i=n-n%16,this.blocks(e,t,i),t+=i,n-=i),n){for(r=0;r<n;r++)this.buffer[this.leftover+r]=e[t+r];this.leftover+=n}};var $=T,G=R;var K=[1116352408,3609767458,1899447441,602891725,3049323471,3964484399,3921009573,2173295548,961987163,4081628472,1508970993,3053834265,2453635748,2937671579,2870763221,3664609560,3624381080,2734883394,310598401,1164996542,607225278,1323610764,1426881987,3590304994,1925078388,4068182383,2162078206,991336113,2614888103,633803317,3248222580,3479774868,3835390401,2666613458,4022224774,944711139,264347078,2341262773,604807628,2007800933,770255983,1495990901,1249150122,1856431235,1555081692,3175218132,1996064986,2198950837,2554220882,3999719339,2821834349,766784016,2952996808,2566594879,3210313671,3203337956,3336571891,1034457026,3584528711,2466948901,113926993,3758326383,338241895,168717936,666307205,1188179964,773529912,1546045734,1294757372,1522805485,1396182291,2643833823,1695183700,2343527390,1986661051,1014477480,2177026350,1206759142,2456956037,344077627,2730485921,1290863460,2820302411,3158454273,3259730800,3505952657,3345764771,106217008,3516065817,3606008344,3600352804,1432725776,4094571909,1467031594,275423344,851169720,430227734,3100823752,506948616,1363258195,659060556,3750685593,883997877,3785050280,958139571,3318307427,1322822218,3812723403,1537002063,2003034995,1747873779,3602036899,1955562222,1575990012,2024104815,1125592928,2227730452,2716904306,2361852424,442776044,2428436474,593698344,2756734187,3733110249,3204031479,2999351573,3329325298,3815920427,3391569614,3928383900,3515267271,566280711,3940187606,3454069534,4118630271,4000239992,116418474,1914138554,174292421,2731055270,289380356,3203993006,460393269,320620315,685471733,587496836,852142971,1086792851,1017036298,365543100,1126000580,2618297676,1288033470,3409855158,1501505948,4234509866,1607167915,987167468,1816402316,1246189591];function Y(e,t,n,r){for(var i,s,o,a,c,l,h,u,d,f,p,g,m,_,y,v,b,E,A,S,w,C,I,k,T,R,O=new Int32Array(16),N=new Int32Array(16),P=e[0],B=e[1],L=e[2],x=e[3],D=e[4],M=e[5],U=e[6],F=e[7],H=t[0],j=t[1],W=t[2],Q=t[3],q=t[4],z=t[5],$=t[6],G=t[7],Y=0;r>=128;){for(A=0;A<16;A++)S=8*A+Y,O[A]=n[S+0]<<24|n[S+1]<<16|n[S+2]<<8|n[S+3],N[A]=n[S+4]<<24|n[S+5]<<16|n[S+6]<<8|n[S+7];for(A=0;A<80;A++)if(i=P,s=B,o=L,a=x,c=D,l=M,h=U,F,d=H,f=j,p=W,g=Q,m=q,_=z,y=$,G,I=65535&(C=G),k=C>>>16,T=65535&(w=F),R=w>>>16,I+=65535&(C=(q>>>14|D<<18)^(q>>>18|D<<14)^(D>>>9|q<<23)),k+=C>>>16,T+=65535&(w=(D>>>14|q<<18)^(D>>>18|q<<14)^(q>>>9|D<<23)),R+=w>>>16,I+=65535&(C=q&z^~q&$),k+=C>>>16,T+=65535&(w=D&M^~D&U),R+=w>>>16,I+=65535&(C=K[2*A+1]),k+=C>>>16,T+=65535&(w=K[2*A]),R+=w>>>16,w=O[A%16],k+=(C=N[A%16])>>>16,T+=65535&w,R+=w>>>16,T+=(k+=(I+=65535&C)>>>16)>>>16,I=65535&(C=E=65535&I|k<<16),k=C>>>16,T=65535&(w=b=65535&T|(R+=T>>>16)<<16),R=w>>>16,I+=65535&(C=(H>>>28|P<<4)^(P>>>2|H<<30)^(P>>>7|H<<25)),k+=C>>>16,T+=65535&(w=(P>>>28|H<<4)^(H>>>2|P<<30)^(H>>>7|P<<25)),R+=w>>>16,k+=(C=H&j^H&W^j&W)>>>16,T+=65535&(w=P&B^P&L^B&L),R+=w>>>16,u=65535&(T+=(k+=(I+=65535&C)>>>16)>>>16)|(R+=T>>>16)<<16,v=65535&I|k<<16,I=65535&(C=g),k=C>>>16,T=65535&(w=a),R=w>>>16,k+=(C=E)>>>16,T+=65535&(w=b),R+=w>>>16,B=i,L=s,x=o,D=a=65535&(T+=(k+=(I+=65535&C)>>>16)>>>16)|(R+=T>>>16)<<16,M=c,U=l,F=h,P=u,j=d,W=f,Q=p,q=g=65535&I|k<<16,z=m,$=_,G=y,H=v,A%16==15)for(S=0;S<16;S++)w=O[S],I=65535&(C=N[S]),k=C>>>16,T=65535&w,R=w>>>16,w=O[(S+9)%16],I+=65535&(C=N[(S+9)%16]),k+=C>>>16,T+=65535&w,R+=w>>>16,b=O[(S+1)%16],I+=65535&(C=((E=N[(S+1)%16])>>>1|b<<31)^(E>>>8|b<<24)^(E>>>7|b<<25)),k+=C>>>16,T+=65535&(w=(b>>>1|E<<31)^(b>>>8|E<<24)^b>>>7),R+=w>>>16,b=O[(S+14)%16],k+=(C=((E=N[(S+14)%16])>>>19|b<<13)^(b>>>29|E<<3)^(E>>>6|b<<26))>>>16,T+=65535&(w=(b>>>19|E<<13)^(E>>>29|b<<3)^b>>>6),R+=w>>>16,R+=(T+=(k+=(I+=65535&C)>>>16)>>>16)>>>16,O[S]=65535&T|R<<16,N[S]=65535&I|k<<16;I=65535&(C=H),k=C>>>16,T=65535&(w=P),R=w>>>16,w=e[0],k+=(C=t[0])>>>16,T+=65535&w,R+=w>>>16,R+=(T+=(k+=(I+=65535&C)>>>16)>>>16)>>>16,e[0]=P=65535&T|R<<16,t[0]=H=65535&I|k<<16,I=65535&(C=j),k=C>>>16,T=65535&(w=B),R=w>>>16,w=e[1],k+=(C=t[1])>>>16,T+=65535&w,R+=w>>>16,R+=(T+=(k+=(I+=65535&C)>>>16)>>>16)>>>16,e[1]=B=65535&T|R<<16,t[1]=j=65535&I|k<<16,I=65535&(C=W),k=C>>>16,T=65535&(w=L),R=w>>>16,w=e[2],k+=(C=t[2])>>>16,T+=65535&w,R+=w>>>16,R+=(T+=(k+=(I+=65535&C)>>>16)>>>16)>>>16,e[2]=L=65535&T|R<<16,t[2]=W=65535&I|k<<16,I=65535&(C=Q),k=C>>>16,T=65535&(w=x),R=w>>>16,w=e[3],k+=(C=t[3])>>>16,T+=65535&w,R+=w>>>16,R+=(T+=(k+=(I+=65535&C)>>>16)>>>16)>>>16,e[3]=x=65535&T|R<<16,t[3]=Q=65535&I|k<<16,I=65535&(C=q),k=C>>>16,T=65535&(w=D),R=w>>>16,w=e[4],k+=(C=t[4])>>>16,T+=65535&w,R+=w>>>16,R+=(T+=(k+=(I+=65535&C)>>>16)>>>16)>>>16,e[4]=D=65535&T|R<<16,t[4]=q=65535&I|k<<16,I=65535&(C=z),k=C>>>16,T=65535&(w=M),R=w>>>16,w=e[5],k+=(C=t[5])>>>16,T+=65535&w,R+=w>>>16,R+=(T+=(k+=(I+=65535&C)>>>16)>>>16)>>>16,e[5]=M=65535&T|R<<16,t[5]=z=65535&I|k<<16,I=65535&(C=$),k=C>>>16,T=65535&(w=U),R=w>>>16,w=e[6],k+=(C=t[6])>>>16,T+=65535&w,R+=w>>>16,R+=(T+=(k+=(I+=65535&C)>>>16)>>>16)>>>16,e[6]=U=65535&T|R<<16,t[6]=$=65535&I|k<<16,I=65535&(C=G),k=C>>>16,T=65535&(w=F),R=w>>>16,w=e[7],k+=(C=t[7])>>>16,T+=65535&w,R+=w>>>16,R+=(T+=(k+=(I+=65535&C)>>>16)>>>16)>>>16,e[7]=F=65535&T|R<<16,t[7]=G=65535&I|k<<16,Y+=128,r-=128}return r}function V(e,t,n){var r,i=new Int32Array(8),s=new Int32Array(8),o=new Uint8Array(256),a=n;for(i[0]=1779033703,i[1]=3144134277,i[2]=1013904242,i[3]=2773480762,i[4]=1359893119,i[5]=2600822924,i[6]=528734635,i[7]=1541459225,s[0]=4089235720,s[1]=2227873595,s[2]=4271175723,s[3]=1595750129,s[4]=2917565137,s[5]=725511199,s[6]=4215389547,s[7]=327033209,Y(i,s,t,n),n%=128,r=0;r<n;r++)o[r]=t[a-n+r];for(o[n]=128,o[(n=256-128*(n<112?1:0))-9]=0,p(o,n-8,a/536870912|0,a<<3),Y(i,s,o,n),r=0;r<8;r++)p(e,8*r,i[r],s[r]);return 0}function X(e,n){var r=t(),i=t(),s=t(),o=t(),a=t(),c=t(),l=t(),u=t(),d=t();U(r,e[1],e[0]),U(d,n[1],n[0]),F(r,r,d),M(i,e[0],e[1]),M(d,n[0],n[1]),F(i,i,d),F(s,e[3],n[3]),F(s,s,h),F(o,e[2],n[2]),M(o,o,o),U(a,i,r),U(c,o,s),M(l,o,s),M(u,i,r),F(e[0],a,c),F(e[1],u,l),F(e[2],l,c),F(e[3],a,u)}function J(e,t,n){var r;for(r=0;r<4;r++)P(e[r],t[r],n)}function Z(e,n){var r=t(),i=t(),s=t();j(s,n[2]),F(r,n[0],s),F(i,n[1],s),B(e,i),e[31]^=x(r)<<7}function ee(e,t,n){var r,i;for(O(e[0],o),O(e[1],a),O(e[2],a),O(e[3],o),i=255;i>=0;--i)J(e,t,r=n[i/8|0]>>(7&i)&1),X(t,e),X(e,e),J(e,t,r)}function te(e,n){var r=[t(),t(),t(),t()];O(r[0],u),O(r[1],d),O(r[2],a),F(r[3],u,d),ee(e,r,n)}function ne(e,n,i){var s,o=new Uint8Array(64),a=[t(),t(),t(),t()];for(i||r(n,32),V(o,n,32),o[0]&=248,o[31]&=127,o[31]|=64,te(a,o),Z(e,a),s=0;s<32;s++)n[s+32]=e[s];return 0}var re=new Float64Array([237,211,245,92,26,99,18,88,214,156,247,162,222,249,222,20,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,16]);function ie(e,t){var n,r,i,s;for(r=63;r>=32;--r){for(n=0,i=r-32,s=r-12;i<s;++i)t[i]+=n-16*t[r]*re[i-(r-32)],n=t[i]+128>>8,t[i]-=256*n;t[i]+=n,t[r]=0}for(n=0,i=0;i<32;i++)t[i]+=n-(t[31]>>4)*re[i],n=t[i]>>8,t[i]&=255;for(i=0;i<32;i++)t[i]-=n*re[i];for(r=0;r<32;r++)t[r+1]+=t[r]>>8,e[r]=255&t[r]}function se(e){var t,n=new Float64Array(64);for(t=0;t<64;t++)n[t]=e[t];for(t=0;t<64;t++)e[t]=0;ie(e,n)}function oe(e,n,r,i){var s,o,a=new Uint8Array(64),c=new Uint8Array(64),l=new Uint8Array(64),h=new Float64Array(64),u=[t(),t(),t(),t()];V(a,i,32),a[0]&=248,a[31]&=127,a[31]|=64;var d=r+64;for(s=0;s<r;s++)e[64+s]=n[s];for(s=0;s<32;s++)e[32+s]=a[32+s];for(V(l,e.subarray(32),r+32),se(l),te(u,l),Z(e,u),s=32;s<64;s++)e[s]=i[s];for(V(c,e,r+64),se(c),s=0;s<64;s++)h[s]=0;for(s=0;s<32;s++)h[s]=l[s];for(s=0;s<32;s++)for(o=0;o<32;o++)h[s+o]+=c[s]*a[o];return ie(e.subarray(32),h),d}function ae(e,n){var r=t(),i=t(),s=t(),c=t(),h=t(),u=t(),d=t();return O(e[2],a),D(e[1],n),H(s,e[1]),F(c,s,l),U(s,s,e[2]),M(c,e[2],c),H(h,c),H(u,h),F(d,u,h),F(r,d,s),F(r,r,c),function(e,n){var r,i=t();for(r=0;r<16;r++)i[r]=n[r];for(r=250;r>=0;r--)H(i,i),1!==r&&F(i,i,n);for(r=0;r<16;r++)e[r]=i[r]}(r,r),F(r,r,s),F(r,r,c),F(r,r,c),F(e[0],r,c),H(i,e[0]),F(i,i,c),L(i,s)&&F(e[0],e[0],f),H(i,e[0]),F(i,i,c),L(i,s)?-1:(x(e[0])===n[31]>>7&&U(e[0],o,e[0]),F(e[3],e[0],e[1]),0)}function ce(e,n,r,i){var s,o=new Uint8Array(32),a=new Uint8Array(64),c=[t(),t(),t(),t()],l=[t(),t(),t(),t()];if(r<64)return-1;if(ae(l,i))return-1;for(s=0;s<r;s++)e[s]=n[s];for(s=0;s<32;s++)e[s+32]=i[s];if(V(a,e,r),se(a),ee(c,l,a),te(l,n.subarray(32)),X(c,l),Z(o,c),r-=64,_(n,0,o,0)){for(s=0;s<r;s++)e[s]=0;return-1}for(s=0;s<r;s++)e[s]=n[s+64];return r}var le=16,he=64,ue=32,de=64;function fe(e,t){if(32!==e.length)throw new Error("bad key size");if(24!==t.length)throw new Error("bad nonce size")}function pe(){var e,t;for(t=0;t<arguments.length;t++)if("[object Uint8Array]"!==(e=Object.prototype.toString.call(arguments[t])))throw new TypeError("unexpected type "+e+", use Uint8Array")}function ge(e){for(var t=0;t<e.length;t++)e[t]=0}e.lowlevel={crypto_core_hsalsa20:v,crypto_stream_xor:w,crypto_stream:S,crypto_stream_salsa20_xor:E,crypto_stream_salsa20:A,crypto_onetimeauth:I,crypto_onetimeauth_verify:k,crypto_verify_16:m,crypto_verify_32:_,crypto_secretbox:T,crypto_secretbox_open:R,crypto_scalarmult:W,crypto_scalarmult_base:Q,crypto_box_beforenm:z,crypto_box_afternm:$,crypto_box:function(e,t,n,r,i,s){var o=new Uint8Array(32);return z(o,i,s),$(e,t,n,r,o)},crypto_box_open:function(e,t,n,r,i,s){var o=new Uint8Array(32);return z(o,i,s),G(e,t,n,r,o)},crypto_box_keypair:q,crypto_hash:V,crypto_sign:oe,crypto_sign_keypair:ne,crypto_sign_open:ce,crypto_secretbox_KEYBYTES:32,crypto_secretbox_NONCEBYTES:24,crypto_secretbox_ZEROBYTES:32,crypto_secretbox_BOXZEROBYTES:le,crypto_scalarmult_BYTES:32,crypto_scalarmult_SCALARBYTES:32,crypto_box_PUBLICKEYBYTES:32,crypto_box_SECRETKEYBYTES:32,crypto_box_BEFORENMBYTES:32,crypto_box_NONCEBYTES:24,crypto_box_ZEROBYTES:32,crypto_box_BOXZEROBYTES:16,crypto_sign_BYTES:he,crypto_sign_PUBLICKEYBYTES:ue,crypto_sign_SECRETKEYBYTES:de,crypto_sign_SEEDBYTES:32,crypto_hash_BYTES:64},e.util||(e.util={},e.util.decodeUTF8=e.util.encodeUTF8=e.util.encodeBase64=e.util.decodeBase64=function(){throw new Error("nacl.util moved into separate package: https://github.com/dchest/tweetnacl-util-js")}),e.randomBytes=function(e){var t=new Uint8Array(e);return r(t,e),t},e.secretbox=function(e,t,n){pe(e,t,n),fe(n,t);for(var r=new Uint8Array(32+e.length),i=new Uint8Array(r.length),s=0;s<e.length;s++)r[s+32]=e[s];return T(i,r,r.length,t,n),i.subarray(le)},e.secretbox.open=function(e,t,n){pe(e,t,n),fe(n,t);for(var r=new Uint8Array(le+e.length),i=new Uint8Array(r.length),s=0;s<e.length;s++)r[s+le]=e[s];return!(r.length<32)&&(0===R(i,r,r.length,t,n)&&i.subarray(32))},e.secretbox.keyLength=32,e.secretbox.nonceLength=24,e.secretbox.overheadLength=le,e.scalarMult=function(e,t){if(pe(e,t),32!==e.length)throw new Error("bad n size");if(32!==t.length)throw new Error("bad p size");var n=new Uint8Array(32);return W(n,e,t),n},e.scalarMult.base=function(e){if(pe(e),32!==e.length)throw new Error("bad n size");var t=new Uint8Array(32);return Q(t,e),t},e.scalarMult.scalarLength=32,e.scalarMult.groupElementLength=32,e.box=function(t,n,r,i){var s=e.box.before(r,i);return e.secretbox(t,n,s)},e.box.before=function(e,t){pe(e,t),function(e,t){if(32!==e.length)throw new Error("bad public key size");if(32!==t.length)throw new Error("bad secret key size")}(e,t);var n=new Uint8Array(32);return z(n,e,t),n},e.box.after=e.secretbox,e.box.open=function(t,n,r,i){var s=e.box.before(r,i);return e.secretbox.open(t,n,s)},e.box.open.after=e.secretbox.open,e.box.keyPair=function(){var e=new Uint8Array(32),t=new Uint8Array(32);return q(e,t),{publicKey:e,secretKey:t}},e.box.keyPair.fromSecretKey=function(e){if(pe(e),32!==e.length)throw new Error("bad secret key size");var t=new Uint8Array(32);return Q(t,e),{publicKey:t,secretKey:new Uint8Array(e)}},e.box.publicKeyLength=32,e.box.secretKeyLength=32,e.box.sharedKeyLength=32,e.box.nonceLength=24,e.box.overheadLength=e.secretbox.overheadLength,e.sign=function(e,t){if(pe(e,t),t.length!==de)throw new Error("bad secret key size");var n=new Uint8Array(he+e.length);return oe(n,e,e.length,t),n},e.sign.open=function(e,t){if(2!==arguments.length)throw new Error("nacl.sign.open accepts 2 arguments; did you mean to use nacl.sign.detached.verify?");if(pe(e,t),t.length!==ue)throw new Error("bad public key size");var n=new Uint8Array(e.length),r=ce(n,e,e.length,t);if(r<0)return null;for(var i=new Uint8Array(r),s=0;s<i.length;s++)i[s]=n[s];return i},e.sign.detached=function(t,n){for(var r=e.sign(t,n),i=new Uint8Array(he),s=0;s<i.length;s++)i[s]=r[s];return i},e.sign.detached.verify=function(e,t,n){if(pe(e,t,n),t.length!==he)throw new Error("bad signature size");if(n.length!==ue)throw new Error("bad public key size");var r,i=new Uint8Array(he+e.length),s=new Uint8Array(he+e.length);for(r=0;r<he;r++)i[r]=t[r];for(r=0;r<e.length;r++)i[r+he]=e[r];return ce(s,i,i.length,n)>=0},e.sign.keyPair=function(){var e=new Uint8Array(ue),t=new Uint8Array(de);return ne(e,t),{publicKey:e,secretKey:t}},e.sign.keyPair.fromSecretKey=function(e){if(pe(e),e.length!==de)throw new Error("bad secret key size");for(var t=new Uint8Array(ue),n=0;n<t.length;n++)t[n]=e[32+n];return{publicKey:t,secretKey:new Uint8Array(e)}},e.sign.keyPair.fromSeed=function(e){if(pe(e),32!==e.length)throw new Error("bad seed size");for(var t=new Uint8Array(ue),n=new Uint8Array(de),r=0;r<32;r++)n[r]=e[r];return ne(t,n,!0),{publicKey:t,secretKey:n}},e.sign.publicKeyLength=ue,e.sign.secretKeyLength=de,e.sign.seedLength=32,e.sign.signatureLength=he,e.hash=function(e){pe(e);var t=new Uint8Array(64);return V(t,e,e.length),t},e.hash.hashLength=64,e.verify=function(e,t){return pe(e,t),0!==e.length&&0!==t.length&&(e.length===t.length&&0===g(e,0,t,0,e.length))},e.setPRNG=function(e){r=e},function(){var t="undefined"!=typeof self?self.crypto||self.msCrypto:null;if(t&&t.getRandomValues){e.setPRNG(function(e,n){var r,i=new Uint8Array(n);for(r=0;r<n;r+=65536)t.getRandomValues(i.subarray(r,r+Math.min(n-r,65536)));for(r=0;r<n;r++)e[r]=i[r];ge(i)})}else(t=n(6982))&&t.randomBytes&&e.setPRNG(function(e,n){var r,i=t.randomBytes(n);for(r=0;r<n;r++)e[r]=i[r];ge(i)})}()}(e.exports?e.exports:self.nacl=self.nacl||{})},7983(e,t,n){e.exports=n(9023).deprecate},4679(e,t,n){"use strict";n.d(t,{v4:()=>u});const r=require("node:crypto");var i=n.n(r);const s={randomUUID:i().randomUUID},o=new Uint8Array(256);let a=o.length;function c(){return a>o.length-16&&(i().randomFillSync(o),a=0),o.slice(a,a+=16)}const l=[];for(let e=0;e<256;++e)l.push((e+256).toString(16).slice(1));function h(e,t=0){return(l[e[t+0]]+l[e[t+1]]+l[e[t+2]]+l[e[t+3]]+"-"+l[e[t+4]]+l[e[t+5]]+"-"+l[e[t+6]]+l[e[t+7]]+"-"+l[e[t+8]]+l[e[t+9]]+"-"+l[e[t+10]]+l[e[t+11]]+l[e[t+12]]+l[e[t+13]]+l[e[t+14]]+l[e[t+15]]).toLowerCase()}const u=function(e,t,n){if(s.randomUUID&&!t&&!e)return s.randomUUID();const r=(e=e||{}).random||(e.rng||c)();if(r[6]=15&r[6]|64,r[8]=63&r[8]|128,t){n=n||0;for(let e=0;e<16;++e)t[n+e]=r[e];return t}return h(r)}},6587(e){e.exports=function e(t,n){if(t&&n)return e(t)(n);if("function"!=typeof t)throw new TypeError("need wrapper function");return Object.keys(t).forEach(function(e){r[e]=t[e]}),r;function r(){for(var e=new Array(arguments.length),n=0;n<e.length;n++)e[n]=arguments[n];var r=t.apply(this,e),i=e[e.length-1];return"function"==typeof r&&r!==i&&Object.keys(i).forEach(function(e){r[e]=i[e]}),r}}},2613(e){"use strict";e.exports=require("assert")},181(e){"use strict";e.exports=require("buffer")},5317(e){"use strict";e.exports=require("child_process")},9140(e){"use strict";e.exports=require("constants")},6982(e){"use strict";e.exports=require("crypto")},2250(e){"use strict";e.exports=require("dns")},4434(e){"use strict";e.exports=require("events")},9896(e){"use strict";e.exports=require("fs")},8611(e){"use strict";e.exports=require("http")},5675(e){"use strict";e.exports=require("http2")},5692(e){"use strict";e.exports=require("https")},9278(e){"use strict";e.exports=require("net")},1421(e){"use strict";e.exports=require("node:child_process")},6760(e){"use strict";e.exports=require("node:path")},857(e){"use strict";e.exports=require("os")},6928(e){"use strict";e.exports=require("path")},932(e){"use strict";e.exports=require("process")},3480(e){"use strict";e.exports=require("querystring")},2203(e){"use strict";e.exports=require("stream")},3193(e){"use strict";e.exports=require("string_decoder")},4756(e){"use strict";e.exports=require("tls")},2018(e){"use strict";e.exports=require("tty")},7016(e){"use strict";e.exports=require("url")},9023(e){"use strict";e.exports=require("util")},8167(e){"use strict";e.exports=require("worker_threads")},3106(e){"use strict";e.exports=require("zlib")},5017(e,t){var n;"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self&&self,n=function(){var e={};return function(e){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.default=void 0;var t=null;try{t=new WebAssembly.Instance(new WebAssembly.Module(new Uint8Array([0,97,115,109,1,0,0,0,1,13,2,96,0,1,127,96,4,127,127,127,127,1,127,3,7,6,0,1,1,1,1,1,6,6,1,127,1,65,0,11,7,50,6,3,109,117,108,0,1,5,100,105,118,95,115,0,2,5,100,105,118,95,117,0,3,5,114,101,109,95,115,0,4,5,114,101,109,95,117,0,5,8,103,101,116,95,104,105,103,104,0,0,10,191,1,6,4,0,35,0,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,126,34,4,66,32,135,167,36,0,32,4,167,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,127,34,4,66,32,135,167,36,0,32,4,167,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,128,34,4,66,32,135,167,36,0,32,4,167,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,129,34,4,66,32,135,167,36,0,32,4,167,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,130,34,4,66,32,135,167,36,0,32,4,167,11])),{}).exports}catch{}function n(e,t,n){this.low=0|e,this.high=0|t,this.unsigned=!!n}function r(e){return!0===(e&&e.__isLong__)}function i(e){var t=Math.clz32(e&-e);return e?31-t:t}n.prototype.__isLong__,Object.defineProperty(n.prototype,"__isLong__",{value:!0}),n.isLong=r;var s={},o={};function a(e,t){var n,r,i;return t?(i=0<=(e>>>=0)&&e<256)&&(r=o[e])?r:(n=l(e,0,!0),i&&(o[e]=n),n):(i=-128<=(e|=0)&&e<128)&&(r=s[e])?r:(n=l(e,e<0?-1:0,!1),i&&(s[e]=n),n)}function c(e,t){if(isNaN(e))return t?v:y;if(t){if(e<0)return v;if(e>=g)return w}else{if(e<=-m)return C;if(e+1>=m)return S}return e<0?c(-e,t).neg():l(e%p|0,e/p|0,t)}function l(e,t,r){return new n(e,t,r)}n.fromInt=a,n.fromNumber=c,n.fromBits=l;var h=Math.pow;function u(e,t,n){if(0===e.length)throw Error("empty string");if("number"==typeof t?(n=t,t=!1):t=!!t,"NaN"===e||"Infinity"===e||"+Infinity"===e||"-Infinity"===e)return t?v:y;if((n=n||10)<2||36<n)throw RangeError("radix");var r;if((r=e.indexOf("-"))>0)throw Error("interior hyphen");if(0===r)return u(e.substring(1),t,n).neg();for(var i=c(h(n,8)),s=y,o=0;o<e.length;o+=8){var a=Math.min(8,e.length-o),l=parseInt(e.substring(o,o+a),n);if(a<8){var d=c(h(n,a));s=s.mul(d).add(c(l))}else s=(s=s.mul(i)).add(c(l))}return s.unsigned=t,s}function d(e,t){return"number"==typeof e?c(e,t):"string"==typeof e?u(e,t):l(e.low,e.high,"boolean"==typeof t?t:e.unsigned)}n.fromString=u,n.fromValue=d;var f=65536,p=f*f,g=p*p,m=g/2,_=a(1<<24),y=a(0);n.ZERO=y;var v=a(0,!0);n.UZERO=v;var b=a(1);n.ONE=b;var E=a(1,!0);n.UONE=E;var A=a(-1);n.NEG_ONE=A;var S=l(-1,2147483647,!1);n.MAX_VALUE=S;var w=l(-1,-1,!0);n.MAX_UNSIGNED_VALUE=w;var C=l(0,-2147483648,!1);n.MIN_VALUE=C;var I=n.prototype;I.toInt=function(){return this.unsigned?this.low>>>0:this.low},I.toNumber=function(){return this.unsigned?(this.high>>>0)*p+(this.low>>>0):this.high*p+(this.low>>>0)},I.toString=function(e){if((e=e||10)<2||36<e)throw RangeError("radix");if(this.isZero())return"0";if(this.isNegative()){if(this.eq(C)){var t=c(e),n=this.div(t),r=n.mul(t).sub(this);return n.toString(e)+r.toInt().toString(e)}return"-"+this.neg().toString(e)}for(var i=c(h(e,6),this.unsigned),s=this,o="";;){var a=s.div(i),l=(s.sub(a.mul(i)).toInt()>>>0).toString(e);if((s=a).isZero())return l+o;for(;l.length<6;)l="0"+l;o=""+l+o}},I.getHighBits=function(){return this.high},I.getHighBitsUnsigned=function(){return this.high>>>0},I.getLowBits=function(){return this.low},I.getLowBitsUnsigned=function(){return this.low>>>0},I.getNumBitsAbs=function(){if(this.isNegative())return this.eq(C)?64:this.neg().getNumBitsAbs();for(var e=0!=this.high?this.high:this.low,t=31;t>0&&!(e&1<<t);t--);return 0!=this.high?t+33:t+1},I.isSafeInteger=function(){var e=this.high>>21;return!e||!this.unsigned&&-1===e&&!(0===this.low&&-2097152===this.high)},I.isZero=function(){return 0===this.high&&0===this.low},I.eqz=I.isZero,I.isNegative=function(){return!this.unsigned&&this.high<0},I.isPositive=function(){return this.unsigned||this.high>=0},I.isOdd=function(){return!(1&~this.low)},I.isEven=function(){return!(1&this.low)},I.equals=function(e){return r(e)||(e=d(e)),(this.unsigned===e.unsigned||this.high>>>31!=1||e.high>>>31!=1)&&this.high===e.high&&this.low===e.low},I.eq=I.equals,I.notEquals=function(e){return!this.eq(e)},I.neq=I.notEquals,I.ne=I.notEquals,I.lessThan=function(e){return this.comp(e)<0},I.lt=I.lessThan,I.lessThanOrEqual=function(e){return this.comp(e)<=0},I.lte=I.lessThanOrEqual,I.le=I.lessThanOrEqual,I.greaterThan=function(e){return this.comp(e)>0},I.gt=I.greaterThan,I.greaterThanOrEqual=function(e){return this.comp(e)>=0},I.gte=I.greaterThanOrEqual,I.ge=I.greaterThanOrEqual,I.compare=function(e){if(r(e)||(e=d(e)),this.eq(e))return 0;var t=this.isNegative(),n=e.isNegative();return t&&!n?-1:!t&&n?1:this.unsigned?e.high>>>0>this.high>>>0||e.high===this.high&&e.low>>>0>this.low>>>0?-1:1:this.sub(e).isNegative()?-1:1},I.comp=I.compare,I.negate=function(){return!this.unsigned&&this.eq(C)?C:this.not().add(b)},I.neg=I.negate,I.add=function(e){r(e)||(e=d(e));var t=this.high>>>16,n=65535&this.high,i=this.low>>>16,s=65535&this.low,o=e.high>>>16,a=65535&e.high,c=e.low>>>16,h=0,u=0,f=0,p=0;return f+=(p+=s+(65535&e.low))>>>16,u+=(f+=i+c)>>>16,h+=(u+=n+a)>>>16,h+=t+o,l((f&=65535)<<16|(p&=65535),(h&=65535)<<16|(u&=65535),this.unsigned)},I.subtract=function(e){return r(e)||(e=d(e)),this.add(e.neg())},I.sub=I.subtract,I.multiply=function(e){if(this.isZero())return this;if(r(e)||(e=d(e)),t)return l(t.mul(this.low,this.high,e.low,e.high),t.get_high(),this.unsigned);if(e.isZero())return this.unsigned?v:y;if(this.eq(C))return e.isOdd()?C:y;if(e.eq(C))return this.isOdd()?C:y;if(this.isNegative())return e.isNegative()?this.neg().mul(e.neg()):this.neg().mul(e).neg();if(e.isNegative())return this.mul(e.neg()).neg();if(this.lt(_)&&e.lt(_))return c(this.toNumber()*e.toNumber(),this.unsigned);var n=this.high>>>16,i=65535&this.high,s=this.low>>>16,o=65535&this.low,a=e.high>>>16,h=65535&e.high,u=e.low>>>16,f=65535&e.low,p=0,g=0,m=0,b=0;return m+=(b+=o*f)>>>16,g+=(m+=s*f)>>>16,m&=65535,g+=(m+=o*u)>>>16,p+=(g+=i*f)>>>16,g&=65535,p+=(g+=s*u)>>>16,g&=65535,p+=(g+=o*h)>>>16,p+=n*f+i*u+s*h+o*a,l((m&=65535)<<16|(b&=65535),(p&=65535)<<16|(g&=65535),this.unsigned)},I.mul=I.multiply,I.divide=function(e){if(r(e)||(e=d(e)),e.isZero())throw Error("division by zero");var n,i,s;if(t)return this.unsigned||-2147483648!==this.high||-1!==e.low||-1!==e.high?l((this.unsigned?t.div_u:t.div_s)(this.low,this.high,e.low,e.high),t.get_high(),this.unsigned):this;if(this.isZero())return this.unsigned?v:y;if(this.unsigned){if(e.unsigned||(e=e.toUnsigned()),e.gt(this))return v;if(e.gt(this.shru(1)))return E;s=v}else{if(this.eq(C))return e.eq(b)||e.eq(A)?C:e.eq(C)?b:(n=this.shr(1).div(e).shl(1)).eq(y)?e.isNegative()?b:A:(i=this.sub(e.mul(n)),s=n.add(i.div(e)));if(e.eq(C))return this.unsigned?v:y;if(this.isNegative())return e.isNegative()?this.neg().div(e.neg()):this.neg().div(e).neg();if(e.isNegative())return this.div(e.neg()).neg();s=y}for(i=this;i.gte(e);){n=Math.max(1,Math.floor(i.toNumber()/e.toNumber()));for(var o=Math.ceil(Math.log(n)/Math.LN2),a=o<=48?1:h(2,o-48),u=c(n),f=u.mul(e);f.isNegative()||f.gt(i);)f=(u=c(n-=a,this.unsigned)).mul(e);u.isZero()&&(u=b),s=s.add(u),i=i.sub(f)}return s},I.div=I.divide,I.modulo=function(e){return r(e)||(e=d(e)),t?l((this.unsigned?t.rem_u:t.rem_s)(this.low,this.high,e.low,e.high),t.get_high(),this.unsigned):this.sub(this.div(e).mul(e))},I.mod=I.modulo,I.rem=I.modulo,I.not=function(){return l(~this.low,~this.high,this.unsigned)},I.countLeadingZeros=function(){return this.high?Math.clz32(this.high):Math.clz32(this.low)+32},I.clz=I.countLeadingZeros,I.countTrailingZeros=function(){return this.low?i(this.low):i(this.high)+32},I.ctz=I.countTrailingZeros,I.and=function(e){return r(e)||(e=d(e)),l(this.low&e.low,this.high&e.high,this.unsigned)},I.or=function(e){return r(e)||(e=d(e)),l(this.low|e.low,this.high|e.high,this.unsigned)},I.xor=function(e){return r(e)||(e=d(e)),l(this.low^e.low,this.high^e.high,this.unsigned)},I.shiftLeft=function(e){return r(e)&&(e=e.toInt()),0==(e&=63)?this:e<32?l(this.low<<e,this.high<<e|this.low>>>32-e,this.unsigned):l(0,this.low<<e-32,this.unsigned)},I.shl=I.shiftLeft,I.shiftRight=function(e){return r(e)&&(e=e.toInt()),0==(e&=63)?this:e<32?l(this.low>>>e|this.high<<32-e,this.high>>e,this.unsigned):l(this.high>>e-32,this.high>=0?0:-1,this.unsigned)},I.shr=I.shiftRight,I.shiftRightUnsigned=function(e){return r(e)&&(e=e.toInt()),0==(e&=63)?this:e<32?l(this.low>>>e|this.high<<32-e,this.high>>>e,this.unsigned):l(32===e?this.high:this.high>>>e-32,0,this.unsigned)},I.shru=I.shiftRightUnsigned,I.shr_u=I.shiftRightUnsigned,I.rotateLeft=function(e){var t;return r(e)&&(e=e.toInt()),0==(e&=63)?this:32===e?l(this.high,this.low,this.unsigned):e<32?(t=32-e,l(this.low<<e|this.high>>>t,this.high<<e|this.low>>>t,this.unsigned)):(t=32-(e-=32),l(this.high<<e|this.low>>>t,this.low<<e|this.high>>>t,this.unsigned))},I.rotl=I.rotateLeft,I.rotateRight=function(e){var t;return r(e)&&(e=e.toInt()),0==(e&=63)?this:32===e?l(this.high,this.low,this.unsigned):e<32?(t=32-e,l(this.high<<t|this.low>>>e,this.low<<t|this.high>>>e,this.unsigned)):(t=32-(e-=32),l(this.low<<t|this.high>>>e,this.high<<t|this.low>>>e,this.unsigned))},I.rotr=I.rotateRight,I.toSigned=function(){return this.unsigned?l(this.low,this.high,!1):this},I.toUnsigned=function(){return this.unsigned?this:l(this.low,this.high,!0)},I.toBytes=function(e){return e?this.toBytesLE():this.toBytesBE()},I.toBytesLE=function(){var e=this.high,t=this.low;return[255&t,t>>>8&255,t>>>16&255,t>>>24,255&e,e>>>8&255,e>>>16&255,e>>>24]},I.toBytesBE=function(){var e=this.high,t=this.low;return[e>>>24,e>>>16&255,e>>>8&255,255&e,t>>>24,t>>>16&255,t>>>8&255,255&t]},n.fromBytes=function(e,t,r){return r?n.fromBytesLE(e,t):n.fromBytesBE(e,t)},n.fromBytesLE=function(e,t){return new n(e[0]|e[1]<<8|e[2]<<16|e[3]<<24,e[4]|e[5]<<8|e[6]<<16|e[7]<<24,t)},n.fromBytesBE=function(e,t){return new n(e[4]<<24|e[5]<<16|e[6]<<8|e[7],e[0]<<24|e[1]<<16|e[2]<<8|e[3],t)},"function"==typeof BigInt&&(n.fromBigInt=function(e,t){return l(Number(BigInt.asIntN(32,e)),Number(BigInt.asIntN(32,e>>BigInt(32))),t)},n.fromValue=function(e,t){return"bigint"==typeof e?n.fromBigInt(e,t):d(e,t)},I.toBigInt=function(){var e=BigInt(this.low>>>0);return BigInt(this.unsigned?this.high>>>0:this.high)<<BigInt(32)|e}),e.default=n}(e),function(e){return e.default||e}(e)}.apply(t,[]),void 0===n||(e.exports=n)},9943(e){"use strict";e.exports={rE:"1.14.3"}},7191(e){"use strict";e.exports={rE:"1.16.0"}},5434(e){"use strict";e.exports=JSON.parse('{"nested":{"google":{"nested":{"protobuf":{"nested":{"Api":{"fields":{"name":{"type":"string","id":1},"methods":{"rule":"repeated","type":"Method","id":2},"options":{"rule":"repeated","type":"Option","id":3},"version":{"type":"string","id":4},"sourceContext":{"type":"SourceContext","id":5},"mixins":{"rule":"repeated","type":"Mixin","id":6},"syntax":{"type":"Syntax","id":7}}},"Method":{"fields":{"name":{"type":"string","id":1},"requestTypeUrl":{"type":"string","id":2},"requestStreaming":{"type":"bool","id":3},"responseTypeUrl":{"type":"string","id":4},"responseStreaming":{"type":"bool","id":5},"options":{"rule":"repeated","type":"Option","id":6},"syntax":{"type":"Syntax","id":7}}},"Mixin":{"fields":{"name":{"type":"string","id":1},"root":{"type":"string","id":2}}},"SourceContext":{"fields":{"fileName":{"type":"string","id":1}}},"Option":{"fields":{"name":{"type":"string","id":1},"value":{"type":"Any","id":2}}},"Syntax":{"values":{"SYNTAX_PROTO2":0,"SYNTAX_PROTO3":1}}}}}}}}')},3951(e){"use strict";e.exports=JSON.parse('{"nested":{"google":{"nested":{"protobuf":{"options":{"go_package":"google.golang.org/protobuf/types/descriptorpb","java_package":"com.google.protobuf","java_outer_classname":"DescriptorProtos","csharp_namespace":"Google.Protobuf.Reflection","objc_class_prefix":"GPB","cc_enable_arenas":true,"optimize_for":"SPEED"},"nested":{"FileDescriptorSet":{"edition":"proto2","fields":{"file":{"rule":"repeated","type":"FileDescriptorProto","id":1}},"extensions":[[536000000,536000000]]},"Edition":{"edition":"proto2","values":{"EDITION_UNKNOWN":0,"EDITION_LEGACY":900,"EDITION_PROTO2":998,"EDITION_PROTO3":999,"EDITION_2023":1000,"EDITION_2024":1001,"EDITION_1_TEST_ONLY":1,"EDITION_2_TEST_ONLY":2,"EDITION_99997_TEST_ONLY":99997,"EDITION_99998_TEST_ONLY":99998,"EDITION_99999_TEST_ONLY":99999,"EDITION_MAX":2147483647}},"FileDescriptorProto":{"edition":"proto2","fields":{"name":{"type":"string","id":1},"package":{"type":"string","id":2},"dependency":{"rule":"repeated","type":"string","id":3},"publicDependency":{"rule":"repeated","type":"int32","id":10},"weakDependency":{"rule":"repeated","type":"int32","id":11},"optionDependency":{"rule":"repeated","type":"string","id":15},"messageType":{"rule":"repeated","type":"DescriptorProto","id":4},"enumType":{"rule":"repeated","type":"EnumDescriptorProto","id":5},"service":{"rule":"repeated","type":"ServiceDescriptorProto","id":6},"extension":{"rule":"repeated","type":"FieldDescriptorProto","id":7},"options":{"type":"FileOptions","id":8},"sourceCodeInfo":{"type":"SourceCodeInfo","id":9},"syntax":{"type":"string","id":12},"edition":{"type":"Edition","id":14}}},"DescriptorProto":{"edition":"proto2","fields":{"name":{"type":"string","id":1},"field":{"rule":"repeated","type":"FieldDescriptorProto","id":2},"extension":{"rule":"repeated","type":"FieldDescriptorProto","id":6},"nestedType":{"rule":"repeated","type":"DescriptorProto","id":3},"enumType":{"rule":"repeated","type":"EnumDescriptorProto","id":4},"extensionRange":{"rule":"repeated","type":"ExtensionRange","id":5},"oneofDecl":{"rule":"repeated","type":"OneofDescriptorProto","id":8},"options":{"type":"MessageOptions","id":7},"reservedRange":{"rule":"repeated","type":"ReservedRange","id":9},"reservedName":{"rule":"repeated","type":"string","id":10},"visibility":{"type":"SymbolVisibility","id":11}},"nested":{"ExtensionRange":{"fields":{"start":{"type":"int32","id":1},"end":{"type":"int32","id":2},"options":{"type":"ExtensionRangeOptions","id":3}}},"ReservedRange":{"fields":{"start":{"type":"int32","id":1},"end":{"type":"int32","id":2}}}}},"ExtensionRangeOptions":{"edition":"proto2","fields":{"uninterpretedOption":{"rule":"repeated","type":"UninterpretedOption","id":999},"declaration":{"rule":"repeated","type":"Declaration","id":2,"options":{"retention":"RETENTION_SOURCE"}},"features":{"type":"FeatureSet","id":50},"verification":{"type":"VerificationState","id":3,"options":{"default":"UNVERIFIED","retention":"RETENTION_SOURCE"}}},"extensions":[[1000,536870911]],"nested":{"Declaration":{"fields":{"number":{"type":"int32","id":1},"fullName":{"type":"string","id":2},"type":{"type":"string","id":3},"reserved":{"type":"bool","id":5},"repeated":{"type":"bool","id":6}},"reserved":[[4,4]]},"VerificationState":{"values":{"DECLARATION":0,"UNVERIFIED":1}}}},"FieldDescriptorProto":{"edition":"proto2","fields":{"name":{"type":"string","id":1},"number":{"type":"int32","id":3},"label":{"type":"Label","id":4},"type":{"type":"Type","id":5},"typeName":{"type":"string","id":6},"extendee":{"type":"string","id":2},"defaultValue":{"type":"string","id":7},"oneofIndex":{"type":"int32","id":9},"jsonName":{"type":"string","id":10},"options":{"type":"FieldOptions","id":8},"proto3Optional":{"type":"bool","id":17}},"nested":{"Type":{"values":{"TYPE_DOUBLE":1,"TYPE_FLOAT":2,"TYPE_INT64":3,"TYPE_UINT64":4,"TYPE_INT32":5,"TYPE_FIXED64":6,"TYPE_FIXED32":7,"TYPE_BOOL":8,"TYPE_STRING":9,"TYPE_GROUP":10,"TYPE_MESSAGE":11,"TYPE_BYTES":12,"TYPE_UINT32":13,"TYPE_ENUM":14,"TYPE_SFIXED32":15,"TYPE_SFIXED64":16,"TYPE_SINT32":17,"TYPE_SINT64":18}},"Label":{"values":{"LABEL_OPTIONAL":1,"LABEL_REPEATED":3,"LABEL_REQUIRED":2}}}},"OneofDescriptorProto":{"edition":"proto2","fields":{"name":{"type":"string","id":1},"options":{"type":"OneofOptions","id":2}}},"EnumDescriptorProto":{"edition":"proto2","fields":{"name":{"type":"string","id":1},"value":{"rule":"repeated","type":"EnumValueDescriptorProto","id":2},"options":{"type":"EnumOptions","id":3},"reservedRange":{"rule":"repeated","type":"EnumReservedRange","id":4},"reservedName":{"rule":"repeated","type":"string","id":5},"visibility":{"type":"SymbolVisibility","id":6}},"nested":{"EnumReservedRange":{"fields":{"start":{"type":"int32","id":1},"end":{"type":"int32","id":2}}}}},"EnumValueDescriptorProto":{"edition":"proto2","fields":{"name":{"type":"string","id":1},"number":{"type":"int32","id":2},"options":{"type":"EnumValueOptions","id":3}}},"ServiceDescriptorProto":{"edition":"proto2","fields":{"name":{"type":"string","id":1},"method":{"rule":"repeated","type":"MethodDescriptorProto","id":2},"options":{"type":"ServiceOptions","id":3}}},"MethodDescriptorProto":{"edition":"proto2","fields":{"name":{"type":"string","id":1},"inputType":{"type":"string","id":2},"outputType":{"type":"string","id":3},"options":{"type":"MethodOptions","id":4},"clientStreaming":{"type":"bool","id":5},"serverStreaming":{"type":"bool","id":6}}},"FileOptions":{"edition":"proto2","fields":{"javaPackage":{"type":"string","id":1},"javaOuterClassname":{"type":"string","id":8},"javaMultipleFiles":{"type":"bool","id":10},"javaGenerateEqualsAndHash":{"type":"bool","id":20,"options":{"deprecated":true}},"javaStringCheckUtf8":{"type":"bool","id":27},"optimizeFor":{"type":"OptimizeMode","id":9,"options":{"default":"SPEED"}},"goPackage":{"type":"string","id":11},"ccGenericServices":{"type":"bool","id":16},"javaGenericServices":{"type":"bool","id":17},"pyGenericServices":{"type":"bool","id":18},"deprecated":{"type":"bool","id":23},"ccEnableArenas":{"type":"bool","id":31,"options":{"default":true}},"objcClassPrefix":{"type":"string","id":36},"csharpNamespace":{"type":"string","id":37},"swiftPrefix":{"type":"string","id":39},"phpClassPrefix":{"type":"string","id":40},"phpNamespace":{"type":"string","id":41},"phpMetadataNamespace":{"type":"string","id":44},"rubyPackage":{"type":"string","id":45},"features":{"type":"FeatureSet","id":50},"uninterpretedOption":{"rule":"repeated","type":"UninterpretedOption","id":999}},"extensions":[[1000,536870911]],"reserved":[[42,42],[38,38],"php_generic_services"],"nested":{"OptimizeMode":{"values":{"SPEED":1,"CODE_SIZE":2,"LITE_RUNTIME":3}}}},"MessageOptions":{"edition":"proto2","fields":{"messageSetWireFormat":{"type":"bool","id":1},"noStandardDescriptorAccessor":{"type":"bool","id":2},"deprecated":{"type":"bool","id":3},"mapEntry":{"type":"bool","id":7},"deprecatedLegacyJsonFieldConflicts":{"type":"bool","id":11,"options":{"deprecated":true}},"features":{"type":"FeatureSet","id":12},"uninterpretedOption":{"rule":"repeated","type":"UninterpretedOption","id":999}},"extensions":[[1000,536870911]],"reserved":[[4,4],[5,5],[6,6],[8,8],[9,9]]},"FieldOptions":{"edition":"proto2","fields":{"ctype":{"type":"CType","id":1,"options":{"default":"STRING"}},"packed":{"type":"bool","id":2},"jstype":{"type":"JSType","id":6,"options":{"default":"JS_NORMAL"}},"lazy":{"type":"bool","id":5},"unverifiedLazy":{"type":"bool","id":15},"deprecated":{"type":"bool","id":3},"weak":{"type":"bool","id":10,"options":{"deprecated":true}},"debugRedact":{"type":"bool","id":16},"retention":{"type":"OptionRetention","id":17},"targets":{"rule":"repeated","type":"OptionTargetType","id":19},"editionDefaults":{"rule":"repeated","type":"EditionDefault","id":20},"features":{"type":"FeatureSet","id":21},"featureSupport":{"type":"FeatureSupport","id":22},"uninterpretedOption":{"rule":"repeated","type":"UninterpretedOption","id":999}},"extensions":[[1000,536870911]],"reserved":[[4,4],[18,18]],"nested":{"CType":{"values":{"STRING":0,"CORD":1,"STRING_PIECE":2}},"JSType":{"values":{"JS_NORMAL":0,"JS_STRING":1,"JS_NUMBER":2}},"OptionRetention":{"values":{"RETENTION_UNKNOWN":0,"RETENTION_RUNTIME":1,"RETENTION_SOURCE":2}},"OptionTargetType":{"values":{"TARGET_TYPE_UNKNOWN":0,"TARGET_TYPE_FILE":1,"TARGET_TYPE_EXTENSION_RANGE":2,"TARGET_TYPE_MESSAGE":3,"TARGET_TYPE_FIELD":4,"TARGET_TYPE_ONEOF":5,"TARGET_TYPE_ENUM":6,"TARGET_TYPE_ENUM_ENTRY":7,"TARGET_TYPE_SERVICE":8,"TARGET_TYPE_METHOD":9}},"EditionDefault":{"fields":{"edition":{"type":"Edition","id":3},"value":{"type":"string","id":2}}},"FeatureSupport":{"fields":{"editionIntroduced":{"type":"Edition","id":1},"editionDeprecated":{"type":"Edition","id":2},"deprecationWarning":{"type":"string","id":3},"editionRemoved":{"type":"Edition","id":4}}}}},"OneofOptions":{"edition":"proto2","fields":{"features":{"type":"FeatureSet","id":1},"uninterpretedOption":{"rule":"repeated","type":"UninterpretedOption","id":999}},"extensions":[[1000,536870911]]},"EnumOptions":{"edition":"proto2","fields":{"allowAlias":{"type":"bool","id":2},"deprecated":{"type":"bool","id":3},"deprecatedLegacyJsonFieldConflicts":{"type":"bool","id":6,"options":{"deprecated":true}},"features":{"type":"FeatureSet","id":7},"uninterpretedOption":{"rule":"repeated","type":"UninterpretedOption","id":999}},"extensions":[[1000,536870911]],"reserved":[[5,5]]},"EnumValueOptions":{"edition":"proto2","fields":{"deprecated":{"type":"bool","id":1},"features":{"type":"FeatureSet","id":2},"debugRedact":{"type":"bool","id":3},"featureSupport":{"type":"FieldOptions.FeatureSupport","id":4},"uninterpretedOption":{"rule":"repeated","type":"UninterpretedOption","id":999}},"extensions":[[1000,536870911]]},"ServiceOptions":{"edition":"proto2","fields":{"features":{"type":"FeatureSet","id":34},"deprecated":{"type":"bool","id":33},"uninterpretedOption":{"rule":"repeated","type":"UninterpretedOption","id":999}},"extensions":[[1000,536870911]]},"MethodOptions":{"edition":"proto2","fields":{"deprecated":{"type":"bool","id":33},"idempotencyLevel":{"type":"IdempotencyLevel","id":34,"options":{"default":"IDEMPOTENCY_UNKNOWN"}},"features":{"type":"FeatureSet","id":35},"uninterpretedOption":{"rule":"repeated","type":"UninterpretedOption","id":999}},"extensions":[[1000,536870911]],"nested":{"IdempotencyLevel":{"values":{"IDEMPOTENCY_UNKNOWN":0,"NO_SIDE_EFFECTS":1,"IDEMPOTENT":2}}}},"UninterpretedOption":{"edition":"proto2","fields":{"name":{"rule":"repeated","type":"NamePart","id":2},"identifierValue":{"type":"string","id":3},"positiveIntValue":{"type":"uint64","id":4},"negativeIntValue":{"type":"int64","id":5},"doubleValue":{"type":"double","id":6},"stringValue":{"type":"bytes","id":7},"aggregateValue":{"type":"string","id":8}},"nested":{"NamePart":{"fields":{"namePart":{"rule":"required","type":"string","id":1},"isExtension":{"rule":"required","type":"bool","id":2}}}}},"FeatureSet":{"edition":"proto2","fields":{"fieldPresence":{"type":"FieldPresence","id":1,"options":{"retention":"RETENTION_RUNTIME","targets":"TARGET_TYPE_FILE","feature_support.edition_introduced":"EDITION_2023","edition_defaults.edition":"EDITION_2023","edition_defaults.value":"EXPLICIT"}},"enumType":{"type":"EnumType","id":2,"options":{"retention":"RETENTION_RUNTIME","targets":"TARGET_TYPE_FILE","feature_support.edition_introduced":"EDITION_2023","edition_defaults.edition":"EDITION_PROTO3","edition_defaults.value":"OPEN"}},"repeatedFieldEncoding":{"type":"RepeatedFieldEncoding","id":3,"options":{"retention":"RETENTION_RUNTIME","targets":"TARGET_TYPE_FILE","feature_support.edition_introduced":"EDITION_2023","edition_defaults.edition":"EDITION_PROTO3","edition_defaults.value":"PACKED"}},"utf8Validation":{"type":"Utf8Validation","id":4,"options":{"retention":"RETENTION_RUNTIME","targets":"TARGET_TYPE_FILE","feature_support.edition_introduced":"EDITION_2023","edition_defaults.edition":"EDITION_PROTO3","edition_defaults.value":"VERIFY"}},"messageEncoding":{"type":"MessageEncoding","id":5,"options":{"retention":"RETENTION_RUNTIME","targets":"TARGET_TYPE_FILE","feature_support.edition_introduced":"EDITION_2023","edition_defaults.edition":"EDITION_LEGACY","edition_defaults.value":"LENGTH_PREFIXED"}},"jsonFormat":{"type":"JsonFormat","id":6,"options":{"retention":"RETENTION_RUNTIME","targets":"TARGET_TYPE_FILE","feature_support.edition_introduced":"EDITION_2023","edition_defaults.edition":"EDITION_PROTO3","edition_defaults.value":"ALLOW"}},"enforceNamingStyle":{"type":"EnforceNamingStyle","id":7,"options":{"retention":"RETENTION_SOURCE","targets":"TARGET_TYPE_METHOD","feature_support.edition_introduced":"EDITION_2024","edition_defaults.edition":"EDITION_2024","edition_defaults.value":"STYLE2024"}},"defaultSymbolVisibility":{"type":"VisibilityFeature.DefaultSymbolVisibility","id":8,"options":{"retention":"RETENTION_SOURCE","targets":"TARGET_TYPE_FILE","feature_support.edition_introduced":"EDITION_2024","edition_defaults.edition":"EDITION_2024","edition_defaults.value":"EXPORT_TOP_LEVEL"}}},"extensions":[[1000,9994],[9995,9999],[10000,10000]],"reserved":[[999,999]],"nested":{"FieldPresence":{"values":{"FIELD_PRESENCE_UNKNOWN":0,"EXPLICIT":1,"IMPLICIT":2,"LEGACY_REQUIRED":3}},"EnumType":{"values":{"ENUM_TYPE_UNKNOWN":0,"OPEN":1,"CLOSED":2}},"RepeatedFieldEncoding":{"values":{"REPEATED_FIELD_ENCODING_UNKNOWN":0,"PACKED":1,"EXPANDED":2}},"Utf8Validation":{"values":{"UTF8_VALIDATION_UNKNOWN":0,"VERIFY":2,"NONE":3}},"MessageEncoding":{"values":{"MESSAGE_ENCODING_UNKNOWN":0,"LENGTH_PREFIXED":1,"DELIMITED":2}},"JsonFormat":{"values":{"JSON_FORMAT_UNKNOWN":0,"ALLOW":1,"LEGACY_BEST_EFFORT":2}},"EnforceNamingStyle":{"values":{"ENFORCE_NAMING_STYLE_UNKNOWN":0,"STYLE2024":1,"STYLE_LEGACY":2}},"VisibilityFeature":{"fields":{},"reserved":[[1,536870911]],"nested":{"DefaultSymbolVisibility":{"values":{"DEFAULT_SYMBOL_VISIBILITY_UNKNOWN":0,"EXPORT_ALL":1,"EXPORT_TOP_LEVEL":2,"LOCAL_ALL":3,"STRICT":4}}}}}},"FeatureSetDefaults":{"edition":"proto2","fields":{"defaults":{"rule":"repeated","type":"FeatureSetEditionDefault","id":1},"minimumEdition":{"type":"Edition","id":4},"maximumEdition":{"type":"Edition","id":5}},"nested":{"FeatureSetEditionDefault":{"fields":{"edition":{"type":"Edition","id":3},"overridableFeatures":{"type":"FeatureSet","id":4},"fixedFeatures":{"type":"FeatureSet","id":5}},"reserved":[[1,1],[2,2],"features"]}}},"SourceCodeInfo":{"edition":"proto2","fields":{"location":{"rule":"repeated","type":"Location","id":1}},"extensions":[[536000000,536000000]],"nested":{"Location":{"fields":{"path":{"rule":"repeated","type":"int32","id":1,"options":{"packed":true}},"span":{"rule":"repeated","type":"int32","id":2,"options":{"packed":true}},"leadingComments":{"type":"string","id":3},"trailingComments":{"type":"string","id":4},"leadingDetachedComments":{"rule":"repeated","type":"string","id":6}}}}},"GeneratedCodeInfo":{"edition":"proto2","fields":{"annotation":{"rule":"repeated","type":"Annotation","id":1}},"nested":{"Annotation":{"fields":{"path":{"rule":"repeated","type":"int32","id":1,"options":{"packed":true}},"sourceFile":{"type":"string","id":2},"begin":{"type":"int32","id":3},"end":{"type":"int32","id":4},"semantic":{"type":"Semantic","id":5}},"nested":{"Semantic":{"values":{"NONE":0,"SET":1,"ALIAS":2}}}}}},"SymbolVisibility":{"edition":"proto2","values":{"VISIBILITY_UNSET":0,"VISIBILITY_LOCAL":1,"VISIBILITY_EXPORT":2}}}}}}}}')},2939(e){"use strict";e.exports=JSON.parse('{"nested":{"google":{"nested":{"protobuf":{"nested":{"SourceContext":{"fields":{"fileName":{"type":"string","id":1}}}}}}}}}')},6710(e){"use strict";e.exports=JSON.parse('{"nested":{"google":{"nested":{"protobuf":{"nested":{"Type":{"fields":{"name":{"type":"string","id":1},"fields":{"rule":"repeated","type":"Field","id":2},"oneofs":{"rule":"repeated","type":"string","id":3},"options":{"rule":"repeated","type":"Option","id":4},"sourceContext":{"type":"SourceContext","id":5},"syntax":{"type":"Syntax","id":6}}},"Field":{"fields":{"kind":{"type":"Kind","id":1},"cardinality":{"type":"Cardinality","id":2},"number":{"type":"int32","id":3},"name":{"type":"string","id":4},"typeUrl":{"type":"string","id":6},"oneofIndex":{"type":"int32","id":7},"packed":{"type":"bool","id":8},"options":{"rule":"repeated","type":"Option","id":9},"jsonName":{"type":"string","id":10},"defaultValue":{"type":"string","id":11}},"nested":{"Kind":{"values":{"TYPE_UNKNOWN":0,"TYPE_DOUBLE":1,"TYPE_FLOAT":2,"TYPE_INT64":3,"TYPE_UINT64":4,"TYPE_INT32":5,"TYPE_FIXED64":6,"TYPE_FIXED32":7,"TYPE_BOOL":8,"TYPE_STRING":9,"TYPE_GROUP":10,"TYPE_MESSAGE":11,"TYPE_BYTES":12,"TYPE_UINT32":13,"TYPE_ENUM":14,"TYPE_SFIXED32":15,"TYPE_SFIXED64":16,"TYPE_SINT32":17,"TYPE_SINT64":18}},"Cardinality":{"values":{"CARDINALITY_UNKNOWN":0,"CARDINALITY_OPTIONAL":1,"CARDINALITY_REQUIRED":2,"CARDINALITY_REPEATED":3}}}},"Enum":{"fields":{"name":{"type":"string","id":1},"enumvalue":{"rule":"repeated","type":"EnumValue","id":2},"options":{"rule":"repeated","type":"Option","id":3},"sourceContext":{"type":"SourceContext","id":4},"syntax":{"type":"Syntax","id":5}}},"EnumValue":{"fields":{"name":{"type":"string","id":1},"number":{"type":"int32","id":2},"options":{"rule":"repeated","type":"Option","id":3}}},"Option":{"fields":{"name":{"type":"string","id":1},"value":{"type":"Any","id":2}}},"Syntax":{"values":{"SYNTAX_PROTO2":0,"SYNTAX_PROTO3":1}},"Any":{"fields":{"type_url":{"type":"string","id":1},"value":{"type":"bytes","id":2}}},"SourceContext":{"fields":{"fileName":{"type":"string","id":1}}}}}}}}}')}},__webpack_module_cache__={};function __webpack_require__(e){var t=__webpack_module_cache__[e];if(void 0!==t)return t.exports;var n=__webpack_module_cache__[e]={id:e,loaded:!1,exports:{}};return __webpack_modules__[e].call(n.exports,n,n.exports,__webpack_require__),n.loaded=!0,n.exports}__webpack_require__.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return __webpack_require__.d(t,{a:t}),t},__webpack_require__.d=(e,t)=>{for(var n in t)__webpack_require__.o(t,n)&&!__webpack_require__.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},__webpack_require__.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),__webpack_require__.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},__webpack_require__.nmd=e=>(e.paths=[],e.children||(e.children=[]),e),__webpack_require__.p="";var __webpack_exports__={};(()=>{"use strict";const e=__webpack_require__(3285),t=__webpack_require__(3054),n=__webpack_require__(8551);(0,e.file_search_start)(),(0,t.start_ai_agent_agent)(),(0,n.start_sys_worker)()})()})();
2
+ (()=>{var __webpack_modules__={3054(e,t,i){"use strict";var n=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.start_ai_agent_agent=function(){(0,r.register_threads_worker_handler)(s.threads_msg_type.docs_init,async e=>{const{index_storage_type:t,a:i,b:n}=e.data;if(v=t,!g&&(g=new o.default.Index({tokenize:"strict"}),m=new o.default.Index({tokenize:"strict"}),"sqlite"===t&&p.Database)){const e=(0,a.default)({db:new p.Database(i)}),t=(0,a.default)({db:new p.Database(n)});await g.mount(e),await m.mount(t)}}),(0,r.register_threads_worker_handler)(s.threads_msg_type.docs_add,async e=>{if(!g)return;let{use_zh_segmentation:t,content:i,file_path:n}=e.data;if(t){i=c(i,!0).join(" ").toLowerCase();const e=c(n,!0).join(" ").toLowerCase();m.add(n,e)}else m.add(n,n.toLowerCase());g.add(n,i),"sqlite"===v&&p.Database&&(await g.commit(),await m.commit())}),(0,r.register_threads_worker_handler)(s.threads_msg_type.docs_del,async e=>{if(!g)return;let{file_path:t}=e.data;g.remove(t),m.remove(t),"sqlite"===v&&p.Database&&(await g.commit(),await m.commit())}),(0,r.register_threads_worker_handler)(s.threads_msg_type.docs_close,async e=>{g&&(g.clear(),m.clear(),"sqlite"===v&&p.Database&&(await g.commit(),await m.commit()),g=null,m=null)}),(0,r.register_threads_worker_handler)(s.threads_msg_type.docs_search,async e=>{const{key:t}=e.data,i={suggest:!0,resolution:9,context:!0,limit:50},n=g.search(t,i),r=m.search(t,i);return"sqlite"===v&&p.Database?{ids:await n,names_ids:await r}:{ids:n,names_ids:r}})};const r=i(324),s=i(7525),o=n(i(5474)),a=n(i(6890)),l=i(3917),{cut:c,cut_all:u,cut_for_search:h,tokenize:d,add_word:f}=i(2880),p=(0,l.get_bin_dependency)("sqlite3");let g,m,v},3917(__unused_webpack_module,exports,__webpack_require__){"use strict";function get_bin_dependency(module,auto_throw=!1){try{if("sqlite3"===module)return __webpack_require__(948);if("exe"===process.env.run_env)switch(module){case"@xiaobaidadada/dockerode":return __webpack_require__(8608);case"@xiaobaidadada/node-pty-prebuilt":return __webpack_require__(6087);case"@xiaobaidadada/ssh2-prebuilt":return __webpack_require__(1217);case"node-process-watcher":return __webpack_require__(4505);case"@xiaobaidadada/node-tuntap2-wintun":return __webpack_require__(2710);default:throw{message:"不存在的包"}}return eval("require")(module)}catch(e){if(console.log(`${process.env.run_env} 模块没有加载失败,请手动安装 npm 依赖( -g 安装的就尝试全局安装,本地仓库安装的就在仓库内安装):${module} error ${e.message}`),auto_throw)throw e}return{}}Object.defineProperty(exports,"__esModule",{value:!0}),exports.get_bin_dependency=get_bin_dependency},6890(e,t,i){"use strict";var n=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.concat=o,t.toArray=a,t.default=p;const r=n(i(6928)),s=(0,i(3917).get_bin_dependency)("sqlite3");function o(e){return[].concat.apply([],e)}function a(e,t){const i=[];for(const n of e.keys())i.push(t?""+n:n);return i}const l=16e3,c=["map","ctx","reg","tag","cfg"],u={text:"text",char:"text",varchar:"text",string:"text",number:"int",numeric:"int",integer:"int",smallint:"int",tinyint:"int",mediumint:"int",int:"int",int8:"int",uint8:"int",int16:"int",uint16:"int",int32:"int",uint32:"bigint",int64:"bigint",bigint:"bigint"};function h(e){return e.toLowerCase().replace(/[^a-z0-9_]/g,"")}const d=Object.create(null),f=Object.create(null);function p(e,t={}){if(!this||this.constructor!==p)return new p(e,t);if("object"==typeof e&&(t=e,e=e.name),e||console.info("Default storage space was used, because a name was not passed."),this.id=t.path||(":memory:"===e?e:"flexsearch"+(e?"-"+h(e):"")+".sqlite"),this.field=t.field?"_"+h(t.field):"",this.support_tag_search=!0,this.db=t.db||f[this.id]||null,this.type=t.type?u[t.type.toLowerCase()]:"string",!this.type)throw new Error("Unknown type of ID '"+t.type+"'")}function g(e,t,i){if(t){for(let t=0;t<e.length;t++)i?e[t].doc&&(e[t].doc=JSON.parse(e[t].doc)):e[t]=e[t].id;return e}{const t=[];for(let n,r=0;r<e.length;r++)n=e[r],t[n.res]||(t[n.res]=[]),t[n.res].push(i?n:n.id);return t}}function m(e,t){let i=t?",(?)":",?";for(let n=1;n<e;){if(!(n<=e-n)){i+=i.substring(0,(e-n)*(t?4:2));break}i+=i,n*=2}return i.substring(1)}p.prototype.mount=function(e){return e.index?e.mount(this):(e.db=this,this.open())},p.prototype.open=async function(){if(!this.db&&!(this.db=f[this.id])){let e=this.id;if(":memory:"!==e&&"/"!==e[0]&&"\\"!==e[0]){const t=process.cwd();e=r.default.join(t,this.id)}this.db=f[this.id]=new s.Database(e)}const e=this.db;for(let t=0;t<c.length;t++){const i=await this.promisfy({method:"get",stmt:"SELECT EXISTS(SELECT 1 FROM sqlite_master WHERE type = 'table' AND name = ?) as exist",params:[c[t]+("reg"===c[t]?"":this.field)]});if(!i||!i.exist){let i,n;switch(c[t]){case"map":i=`\n CREATE TABLE IF NOT EXISTS main.map${this.field}(\n key TEXT NOT NULL,\n res INTEGER NOT NULL,\n id ${this.type} NOT NULL\n );\n `,n=`\n CREATE INDEX IF NOT EXISTS map_key_index${this.field} \n ON map${this.field} (key);\n CREATE INDEX IF NOT EXISTS map_id_index${this.field}\n ON map${this.field} (id);\n `;break;case"ctx":i=`\n CREATE TABLE IF NOT EXISTS main.ctx${this.field}(\n ctx TEXT NOT NULL,\n key TEXT NOT NULL,\n res INTEGER NOT NULL,\n id ${this.type} NOT NULL\n );\n \n `,n=`\n CREATE INDEX IF NOT EXISTS ctx_key_index${this.field} \n ON ctx${this.field} (ctx, key);\n CREATE INDEX IF NOT EXISTS ctx_id_index${this.field}\n ON ctx${this.field} (id);\n `;break;case"tag":i=`\n CREATE TABLE IF NOT EXISTS main.tag${this.field}(\n tag TEXT NOT NULL,\n id ${this.type} NOT NULL\n );\n `,n=`\n CREATE INDEX IF NOT EXISTS tag_index${this.field} \n ON tag${this.field} (tag);\n CREATE INDEX IF NOT EXISTS tag_id_index${this.field}\n ON tag${this.field} (id);\n `;break;case"reg":i=`\n CREATE TABLE IF NOT EXISTS main.reg(\n id ${this.type} NOT NULL\n CONSTRAINT reg_pk${this.field}\n PRIMARY KEY,\n doc TEXT DEFAULT NULL \n );\n `,n="\n CREATE INDEX IF NOT EXISTS reg_index\n ON reg (id);\n ";break;case"cfg":i=`\n CREATE TABLE IF NOT EXISTS main.cfg${this.field} (\n cfg TEXT NOT NULL\n );\n `}await new Promise(function(t,r){e.exec(i,function(i,s){if(i)return r(i);n?e.exec(n,function(e,i){if(e)return r(e);t(i)}):t(s)})})}}return e.exec("PRAGMA optimize = 0x10002"),e},p.prototype.close=function(){return this.db&&this.db.close(),this.db=null,f[this.id]=null,d[this.id]=null,this},p.prototype.destroy=function(){return this.transaction(function(){this.db.run("DROP TABLE IF EXISTS main.map"+this.field+";"),this.db.run("DROP TABLE IF EXISTS main.ctx"+this.field+";"),this.db.run("DROP TABLE IF EXISTS main.tag"+this.field+";"),this.db.run("DROP TABLE IF EXISTS main.cfg"+this.field+";"),this.db.run("DROP TABLE IF EXISTS main.reg;")})},p.prototype.clear=function(){return this.transaction(function(){this.db.run("DELETE FROM main.map"+this.field+" WHERE 1;"),this.db.run("DELETE FROM main.ctx"+this.field+" WHERE 1;"),this.db.run("DELETE FROM main.tag"+this.field+" WHERE 1;"),this.db.run("DELETE FROM main.cfg"+this.field+" WHERE 1;"),this.db.run("DELETE FROM main.reg WHERE 1;")})},p.prototype.get=function(e,t,i=0,n=0,r=!0,s=!1,o){let a,l="",c=t?[t,e]:[e],u="main."+(t?"ctx":"map")+this.field;if(o)for(let e=0;e<o.length;e+=2)l+=` AND ${u}.id IN (SELECT id FROM main.tag_${h(o[e])} WHERE tag = ?)`,c.push(o[e+1]);return a=t?this.promisfy({method:"all",stmt:`\n SELECT ${u}.id \n ${r?"":", res"}\n ${s?", doc":""}\n FROM ${u}\n ${s?`\n LEFT JOIN main.reg ON main.reg.id = ${u}.id\n `:""}\n WHERE ctx = ? AND key = ? ${l}\n ORDER BY res \n ${i?"LIMIT "+i:""}\n ${n?"OFFSET "+n:""}\n `,params:c}):this.promisfy({method:"all",stmt:`\n SELECT ${u}.id\n ${r?"":", res"} \n ${s?", doc":""}\n FROM ${u}\n ${s?`\n LEFT JOIN main.reg ON main.reg.id = ${u}.id\n `:""}\n WHERE key = ? ${l}\n ORDER BY res\n ${i?"LIMIT "+i:""}\n ${n?"OFFSET "+n:""}\n `,params:c}),a.then(function(e){return g(e,r,s)})},p.prototype.tag=function(e,t=0,i=0,n=!1){const r="main.tag"+this.field,s=this.promisfy({method:"all",stmt:`\n SELECT ${r}.id \n ${n?", doc":""}\n FROM ${r}\n ${n?`\n LEFT JOIN main.reg ON main.reg.id = ${r}.id\n `:""}\n WHERE tag = ? \n ${t?"LIMIT "+t:""}\n ${i?"OFFSET "+i:""}\n `,params:[e]});return n||s.then(function(e){return g(e,!0,!1)}),s},p.prototype.enrich=function(e){const t=[],i=[];"object"!=typeof e&&(e=[e]);for(let t=0;t<e.length;){const n=e.length-t>l?e.slice(t,t+l):t?e.slice(t):e,r=m(n.length);t+=n.length,i.push(this.promisfy({method:"all",stmt:`SELECT id, doc FROM main.reg WHERE id IN (${r})`,params:n}))}return Promise.all(i).then(function(e){for(let i,n=0;n<e.length;n++)if(i=e[n],i&&i.length){for(let e,t=0;t<i.length;t++)(e=i[t].doc)&&(i[t].doc=JSON.parse(e));t.push(i)}return 1===t.length?t[0]:t.length>1?o(t):t})},p.prototype.has=function(e){return this.promisfy({method:"get",stmt:"SELECT EXISTS(SELECT 1 FROM main.reg WHERE id = ?) as exist",params:[e]}).then(function(e){return!(!e||!e.exist)})},p.prototype.search=function(e,t,i=100,n=0,r=!1,s=!0,o=!1,a){let l;if(t.length>1&&e.depth){let c,u="",d=[],f=t[0];for(let i=1;i<t.length;i++){c=t[i];const n=e.bidirectional&&c>f;u+=(u?" OR ":"")+"(ctx = ? AND key = ?)",d.push(n?c:f,n?f:c),f=c}if(a){u="("+u+")";for(let e=0;e<a.length;e+=2)u+=` AND id IN (SELECT id FROM main.tag_${h(a[e])} WHERE tag = ?)`,d.push(a[e+1])}l=this.promisfy({method:"all",stmt:`\n SELECT r.id \n ${s?"":", res"}\n ${o?", doc":""}\n FROM (\n SELECT id, count(*) as count,\n SUM(res) as res\n FROM main.ctx${this.field}\n WHERE ${u}\n GROUP BY id\n ) as r\n ${o?"\n LEFT JOIN main.reg ON main.reg.id = r.id\n ":""} \n ${r?"":"WHERE count = "+(t.length-1)}\n ORDER BY ${r?"count DESC, res":"res"}\n ${i?"LIMIT "+i:""}\n ${n?"OFFSET "+n:""}\n `,params:d})}else{let e="",c=t.length;for(let t=0;t<c;t++)e+=(e?" OR ":"")+"key = ?";if(a){e="("+e+")";for(let i=0;i<a.length;i+=2)e+=` AND id IN (SELECT id FROM main.tag_${h(a[i])} WHERE tag = ?)`,t.push(a[i+1])}l=this.promisfy({method:"all",stmt:`\n SELECT r.id \n ${s?"":", res"} \n ${o?", doc":""}\n FROM (\n SELECT id, count(*) as count,\n SUM(res) as res\n FROM main.map${this.field}\n WHERE ${e}\n GROUP BY id\n ) as r\n ${o?"\n LEFT JOIN main.reg ON main.reg.id = r.id\n ":""} \n ${r?"":"WHERE count = "+c}\n ORDER BY ${r?"count DESC, res":"res"}\n ${i?"LIMIT "+i:""}\n ${n?"OFFSET "+n:""}\n `,params:t})}return l.then(function(e){return g(e,s,o)})},p.prototype.info=function(){},p.prototype.transaction=async function(e,t){if(d[this.id])return await e.call(this);const i=this.db,n=this;return d[this.id]=new Promise(function(r,s){i.exec("PRAGMA optimize"),i.exec("PRAGMA busy_timeout = 5000"),i.exec("BEGIN"),i.parallelize(function(){e.call(n)}),i.exec("COMMIT",function(e,o){if(d[n.id]=null,e)return s(e);t&&t(o),r(o),i.exec("PRAGMA shrink_memory")})})},p.prototype.commit=async function(e){let t=e.commit_task,i=[],n=[];e.commit_task=[];for(let e,r=0;r<t.length;r++)e=t[r],void 0!==e.del?i.push(e.del):void 0!==e.ins&&n.push(e.ins);i.length&&await this.remove(i),e.reg.size&&(await this.transaction(function(){for(const t of e.map){const e=t[0],i=t[1];for(let t,n=0;n<i.length;n++)if((t=i[n])&&t.length){let i="",r=[];for(let s=0;s<t.length;s++)i+=(i?",":"")+"(?,?,?)",r.push(e,n,t[s]),(s===t.length-1||r.length+3>l)&&(this.db.run("INSERT INTO main.map"+this.field+" (key, res, id) VALUES "+i,r),i="",r=[])}}for(const t of e.ctx){const e=t[0],i=t[1];for(const t of i){const i=t[0],n=t[1];for(let t,r=0;r<n.length;r++)if((t=n[r])&&t.length){let n="",s=[];for(let o=0;o<t.length;o++)n+=(n?",":"")+"(?,?,?,?)",s.push(e,i,r,t[o]),(o===t.length-1||s.length+4>l)&&(this.db.run("INSERT INTO main.ctx"+this.field+" (ctx, key, res, id) VALUES "+n,s),n="",s=[])}}}if(e.store){let t="",i=[];for(const n of e.store.entries()){const e=n[0],r=n[1];t+=(t?",":"")+"(?,?)",i.push(e,"object"==typeof r?JSON.stringify(r):r||null),i.length+2>l&&(this.db.run("INSERT INTO main.reg (id, doc) VALUES "+t+" ON CONFLICT DO NOTHING",i),t="",i=[])}i.length&&this.db.run("INSERT INTO main.reg (id, doc) VALUES "+t+" ON CONFLICT DO NOTHING",i)}else if(!e.bypass){let t=a(e.reg);for(let e=0;e<t.length;){const i=t.length-e>l?t.slice(e,e+l):e?t.slice(e):t;e+=i.length;const n=m(i.length,!0);this.db.run("INSERT INTO main.reg (id) VALUES "+n+" ON CONFLICT DO NOTHING",i)}}if(e.tag){let t="",i=[];for(const n of e.tag){const e=n[0],r=n[1];if(r.length){for(let n=0;n<r.length;n++)t+=(t?",":"")+"(?,?)",i.push(e,r[n]);i.length+2>l&&(this.db.run("INSERT INTO main.tag"+this.field+" (tag, id) VALUES "+t,i),t="",i=[])}}i.length&&this.db.run("INSERT INTO main.tag"+this.field+" (tag, id) VALUES "+t,i)}}),n.length&&await this.cleanup(),e.map.clear(),e.ctx.clear(),e.tag&&e.tag.clear(),e.store&&e.store.clear(),e.document||e.reg.clear())},p.prototype.remove=function(e){let t;"object"!=typeof e&&(e=[e]),e.length>l&&(t=e.slice(l),e=e.slice(0,l));const i=this;return this.transaction(function(){const t=m(e.length);this.db.run("DELETE FROM main.map"+i.field+" WHERE id IN ("+t+")",e),this.db.run("DELETE FROM main.ctx"+i.field+" WHERE id IN ("+t+")",e),this.db.run("DELETE FROM main.tag"+i.field+" WHERE id IN ("+t+")",e),this.db.run("DELETE FROM main.reg WHERE id IN ("+t+")",e)}).then(function(e){return t?i.remove(t):e})},p.prototype.cleanup=function(){return this.transaction(function(){this.db.run("DELETE FROM main.map"+this.field+" WHERE ROWID IN (SELECT ROWID FROM (SELECT ROWID, row_number() OVER dupes AS count FROM main.map"+this.field+" _t WINDOW dupes AS (PARTITION BY id, key ORDER BY res) ) WHERE count > 1)"),this.db.run("DELETE FROM main.ctx"+this.field+" WHERE ROWID IN (SELECT ROWID FROM (SELECT ROWID, row_number() OVER dupes AS count FROM main.ctx"+this.field+" _t WINDOW dupes AS (PARTITION BY id, ctx, key ORDER BY res) ) WHERE count > 1)")})},p.prototype.promisfy=function(e){const t=this.db;return new Promise(function(i,n){t[e.method](e.stmt,e.params||[],function(t,r){e.callback&&e.callback(r),t?n(t):i(r)})})}},948(e,t,i){const n=i(6928),r=i(7179),s=i(4434).EventEmitter;function o(e){return function(t,...i){let n;if("function"==typeof i[i.length-1]){const e=i[i.length-1];n=function(t){t&&e(t)}}const s=new r.Statement(this,t,n);return e.call(this,s,i)}}e.exports=r;const a=r.Database;r.cached={objects:{},Database:function(e,t,i){if(""===e||":memory:"===e)return new a(e,t,i);if(e=n.resolve(e),r.cached.objects[e]){const o=r.cached.objects[e],l="number"==typeof t?i:t;if("function"==typeof l){function s(){l.call(o,null)}o.open?process.nextTick(s):o.once("open",s)}}else r.cached.objects[e]=new a(e,t,i);return r.cached.objects[e]}},function(e,t){for(const i in t.prototype)e.prototype[i]=t.prototype[i]}(a,s),a.prototype.prepare=o(function(e,t){return t.length?e.bind.apply(e,t):e}),a.prototype.run=o(function(e,t){return e.run.apply(e,t).finalize(),this}),a.prototype.get=o(function(e,t){return e.get.apply(e,t).finalize(),this}),a.prototype.all=o(function(e,t){return e.all.apply(e,t).finalize(),this}),a.prototype.each=o(function(e,t){return e.each.apply(e,t).finalize(),this}),a.prototype.map=o(function(e,t){return e.map.apply(e,t).finalize(),this});const l=["trace","profile","change"];a.prototype.addListener=a.prototype.on=function(e,t){const i=s.prototype.addListener.apply(this,arguments);return l.indexOf(e)>=0&&this.configure(e,!0),i},a.prototype.removeListener=function(e){const t=s.prototype.removeListener.apply(this,arguments);return l.indexOf(e)>=0&&!this._events[e]&&this.configure(e,!1),t},a.prototype.removeAllListeners=function(e){const t=s.prototype.removeAllListeners.apply(this,arguments);return l.indexOf(e)>=0&&this.configure(e,!1),t}},3285(e,t,i){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.file_search_start=function(){(0,n.register_threads_worker_handler)(r.threads_msg_type.file_search,async e=>{const{start:t,end:i,file_path:c,query_text_buffer:u,ram_id:h}=e.data;let d=0,f=Buffer.alloc(0);const p=s.openSync(c,"r");let g=0;for(;d<i&&!l[h];){const e=Buffer.alloc(2097152);let t=s.readSync(p,e,0,e.length,d);if(0===t)break;d+=t,f=Buffer.concat([f,e.subarray(0,t)]),(0,n.threads_send)({type:r.threads_msg_type.search_file_progress,data:{progress:(100*d/i).toFixed(0),ram_id:h}});const l=[];if(a(f,u,l),l.length>0){for(let e=0;e<l.length;e++)l[e]+=g;(0,n.threads_send)({type:r.threads_msg_type.search_file_index,data:{find_index:l,ram_id:h}})}g+=f.length-u.length,f=o(f,f.length-u.length,f.length)}return(0,n.threads_send)({type:r.threads_msg_type.search_file_end,data:{ram_id:h}}),s.closeSync(p),"ok"}),(0,n.register_threads_worker_handler)(r.threads_msg_type.file_search_close,async e=>{const{ram_id:t}=e.data;return l[t]=!0,"ok"}),(0,n.register_threads_worker_handler)(r.threads_msg_type.file_search_start,async e=>{const{ram_id:t}=e.data;return delete l[t],"ok"})};const n=i(324),r=i(7525),s=i(9896);function o(e,t,i){const n=i-t,r=Buffer.alloc(n);return e.copy(r,0,t,i),r}function a(e,t,i){const n=function(e){const t={},i=e.length;for(let n=0;n<i;n++)t[e[n]]=n;return t}(t),r=e.length,s=t.length,o=r-s;let a=0;for(;a<=o;){let o=s-1;for(;o>=0&&e[a+o]===t[o];)o--;if(o<0)i.push(a),a+=a+s<r?s-n[e[a+s]]||s:1;else{const t=n[e[a+o]],i=void 0!==t?o-t:o+1;a+=Math.max(i,1)}}}const l={}},8551(e,t,i){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.start_sys_worker=function(){(0,n.register_threads_worker_handler)(r.threads_msg_type.sys_info,async e=>{(0,n.threads_send)({type:r.threads_msg_type.sys_info_send,data:{node_memory_usage:process.memoryUsage()}})})};const n=i(324),r=i(7525)},7525(e,t){"use strict";var i;Object.defineProperty(t,"__esModule",{value:!0}),t.threads_msg_type=void 0,function(e){e[e.hello=1]="hello",e[e.file_search_start=2]="file_search_start",e[e.file_search=3]="file_search",e[e.file_search_close=4]="file_search_close",e[e.search_file_index=5]="search_file_index",e[e.search_file_progress=6]="search_file_progress",e[e.search_file_end=7]="search_file_end",e[e.docs_init=8]="docs_init",e[e.docs_add=9]="docs_add",e[e.docs_del=10]="docs_del",e[e.docs_close=11]="docs_close",e[e.docs_search=12]="docs_search",e[e.sys_info=13]="sys_info",e[e.sys_info_send=14]="sys_info_send"}(i||(t.threads_msg_type=i={}))},324(e,t,i){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.register_threads_worker_handler=o,t.threads_send=a;const n=i(8167),r=i(7525);console.log("[worker] 子线程启动, workerData=",n.workerData);const s=new Map;function o(e,t){s.set(e,t)}function a(e){try{n.parentPort?.postMessage(e)}catch(e){console.error("[worker] send failed:",e)}}n.parentPort?.on("message",e=>{!async function(e){try{const t=s.get(e.type);if(!t)return void a({id:e.id,type:e.type,data:`unknown type ${e.type}`});const i=await t(e);a({id:e.id,type:e.type,data:i})}catch(t){a({id:e.id,type:e.type,data:null,error:t?.message||String(t)}),console.error("[worker] task error:",t)}}(e)}),o(r.threads_msg_type.hello,async e=>new Promise((t,i)=>setTimeout(()=>{if(Math.random()<.05)return i(new Error("模拟错误"));t(`done:${e.data}`)},500))),console.log("[worker] ready and waiting for messages..."),process.on("uncaughtException",e=>{console.error("子线程全局未捕获异常:",e)}),process.on("unhandledRejection",e=>{console.error("子线程未处理的 Promise 拒绝:",e)})},3065(e,t,i){"use strict";const n=i(6928),r=e=>new c(e);function s(e){return Array.isArray(e)?e:[e]}r.default=r,e.exports=r;const o="\\"===n.sep?/(?<=.)\\$/:/(?<=.)\/$/,a="undefined"!=typeof Symbol?Symbol.for("dockerignore"):"dockerignore";function l(e){return n.normalize(e).replace(o,"")}class c{constructor({ignorecase:e=!0}={}){this._rules=[],this._ignorecase=e,this[a]=!0,this._initCache()}_initCache(){this._cache={}}add(e){return this._added=!1,"string"==typeof e&&(e=e.split(/\r?\n/g)),s(e).forEach(this._addPattern,this),this._added&&this._initCache(),this}addPattern(e){return this.add(e)}_addPattern(e){if(e&&e[a])return this._rules=this._rules.concat(e._rules),void(this._added=!0);if(this._checkPattern(e)){const t=this._createRule(e.trim());null!==t&&(this._added=!0,this._rules.push(t))}}_checkPattern(e){return e&&"string"==typeof e&&0!==e.indexOf("#")&&""!==e.trim()}filter(e){return s(e).filter(e=>this._filter(e))}createFilter(){return e=>this._filter(e)}ignores(e){return!this._filter(e)}_createRule(e){const t=e;let i=!1;var r;if("!"===e[0]&&(i=!0,e=e.substring(1).trim()),e.length>0&&(e=l(e),r=e,(e="/"===n.sep?r:r.replace(/\\/g,"/")).length>1&&"/"===e[0]&&(e=e.slice(1))),i&&(e="!"+e),""===(e=e.trim()))return null;if("!"===(e=l(e))[0]){if(1===e.length)return null;i=!0,e=e.substring(1)}else i=!1;return{origin:t,pattern:e,dirs:e.split(n.sep),negative:i}}_filter(e){return!!e&&(e in this._cache?this._cache[e]:this._cache[e]=this._test(e))}_test(e){e=function(e){return"/"===n.sep?e:e.replace(/\//g,n.sep)}(e);const t=l(n.dirname(e)),i=t.split(n.sep);let r=!1;return this._rules.forEach(s=>{let o=this._match(e,s);if(!o&&"."!==t)if(s.dirs.includes("**"))for(let e=s.dirs.filter(e=>"**"!==e).length;e<=i.length;e++)o=o||this._match(i.slice(0,e).join(n.sep),s);else s.dirs.length<=i.length&&(o=this._match(i.slice(0,s.dirs.length).join(n.sep),s));o&&(r=!s.negative)}),!r}_match(e,t){return this._compile(t).regexp.test(e)}_compile(e){if(e.regexp)return e;let t="^",i="\\"===n.sep?"\\\\":n.sep;for(let r=0;r<e.pattern.length;r++){const s=e.pattern[r];if("*"===s)"*"===e.pattern[r+1]?(r++,e.pattern[r+1]===n.sep&&r++,void 0===e.pattern[r+1]?t+=".*":t+=`(.*${i})?`):t+=`[^${i}]*`;else if("?"===s)t+=`[^${i}]`;else if("."===s||"$"===s)t+=`\\${s}`;else if("\\"===s){if("\\"===n.sep){t+=i;continue}void 0!==e.pattern[r+1]?(t+="\\"+e.pattern[r+1],r++):t+="\\"}else t+=s}return t+="$",e.regexp=new RegExp(t,this._ignorecase?"i":""),e}}},2661(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.registerAdminService=function(e,t){i.push({getServiceDefinition:e,getHandlers:t})},t.addAdminServicesToServer=function(e){for(const{getServiceDefinition:t,getHandlers:n}of i)e.addService(t(),n())};const i=[]},3956(e,t,i){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.BackoffTimeout=void 0;const n=i(131),r=i(267);class s{constructor(e,t){this.callback=e,this.initialDelay=1e3,this.multiplier=1.6,this.maxDelay=12e4,this.jitter=.2,this.running=!1,this.hasRef=!0,this.startTime=new Date,this.endTime=new Date,this.id=s.getNextId(),t&&(t.initialDelay&&(this.initialDelay=t.initialDelay),t.multiplier&&(this.multiplier=t.multiplier),t.jitter&&(this.jitter=t.jitter),t.maxDelay&&(this.maxDelay=t.maxDelay)),this.trace("constructed initialDelay="+this.initialDelay+" multiplier="+this.multiplier+" jitter="+this.jitter+" maxDelay="+this.maxDelay),this.nextDelay=this.initialDelay,this.timerId=setTimeout(()=>{},0),clearTimeout(this.timerId)}static getNextId(){return this.nextId++}trace(e){r.trace(n.LogVerbosity.DEBUG,"backoff","{"+this.id+"} "+e)}runTimer(e){var t,i;this.trace("runTimer(delay="+e+")"),this.endTime=this.startTime,this.endTime.setMilliseconds(this.endTime.getMilliseconds()+e),clearTimeout(this.timerId),this.timerId=setTimeout(()=>{this.trace("timer fired"),this.running=!1,this.callback()},e),this.hasRef||null===(i=(t=this.timerId).unref)||void 0===i||i.call(t)}runOnce(){this.trace("runOnce()"),this.running=!0,this.startTime=new Date,this.runTimer(this.nextDelay);const e=Math.min(this.nextDelay*this.multiplier,this.maxDelay),t=e*this.jitter;var i,n;this.nextDelay=e+(i=-t,n=t,Math.random()*(n-i)+i)}stop(){this.trace("stop()"),clearTimeout(this.timerId),this.running=!1}reset(){if(this.trace("reset() running="+this.running),this.nextDelay=this.initialDelay,this.running){const e=new Date,t=this.startTime;t.setMilliseconds(t.getMilliseconds()+this.nextDelay),clearTimeout(this.timerId),e<t?this.runTimer(t.getTime()-e.getTime()):this.running=!1}}isRunning(){return this.running}ref(){var e,t;this.hasRef=!0,null===(t=(e=this.timerId).ref)||void 0===t||t.call(e)}unref(){var e,t;this.hasRef=!1,null===(t=(e=this.timerId).unref)||void 0===t||t.call(e)}getEndTime(){return this.endTime}}t.BackoffTimeout=s,s.nextId=0},2267(e,t,i){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.CallCredentials=void 0;const n=i(4097);class r{static createFromMetadataGenerator(e){return new o(e)}static createFromGoogleCredential(e){return r.createFromMetadataGenerator((t,i)=>{let r;var s;r="getRequestHeaders"in(s=e)&&"function"==typeof s.getRequestHeaders?e.getRequestHeaders(t.service_url):new Promise((i,n)=>{e.getRequestMetadata(t.service_url,(e,t)=>{e?n(e):t?i(t):n(new Error("Headers not set by metadata plugin"))})}),r.then(e=>{const t=new n.Metadata;for(const i of Object.keys(e))t.add(i,e[i]);i(null,t)},e=>{i(e)})})}static createEmpty(){return new a}}t.CallCredentials=r;class s extends r{constructor(e){super(),this.creds=e}async generateMetadata(e){const t=new n.Metadata,i=await Promise.all(this.creds.map(t=>t.generateMetadata(e)));for(const e of i)t.merge(e);return t}compose(e){return new s(this.creds.concat([e]))}_equals(e){return this===e||e instanceof s&&this.creds.every((t,i)=>t._equals(e.creds[i]))}}class o extends r{constructor(e){super(),this.metadataGenerator=e}generateMetadata(e){return new Promise((t,i)=>{this.metadataGenerator(e,(e,n)=>{void 0!==n?t(n):i(e)})})}compose(e){return new s([this,e])}_equals(e){return this===e||e instanceof o&&this.metadataGenerator===e.metadataGenerator}}class a extends r{generateMetadata(e){return Promise.resolve(new n.Metadata)}compose(e){return e}_equals(e){return e instanceof a}}},5034(e,t,i){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.InterceptingListenerImpl=void 0,t.statusOrFromValue=function(e){return{ok:!0,value:e}},t.statusOrFromError=function(e){var t;return{ok:!1,error:Object.assign(Object.assign({},e),{metadata:null!==(t=e.metadata)&&void 0!==t?t:new n.Metadata})}},t.isInterceptingListener=function(e){return void 0!==e.onReceiveMetadata&&1===e.onReceiveMetadata.length};const n=i(4097);t.InterceptingListenerImpl=class{constructor(e,t){this.listener=e,this.nextListener=t,this.processingMetadata=!1,this.hasPendingMessage=!1,this.processingMessage=!1,this.pendingStatus=null}processPendingMessage(){this.hasPendingMessage&&(this.nextListener.onReceiveMessage(this.pendingMessage),this.pendingMessage=null,this.hasPendingMessage=!1)}processPendingStatus(){this.pendingStatus&&this.nextListener.onReceiveStatus(this.pendingStatus)}onReceiveMetadata(e){this.processingMetadata=!0,this.listener.onReceiveMetadata(e,e=>{this.processingMetadata=!1,this.nextListener.onReceiveMetadata(e),this.processPendingMessage(),this.processPendingStatus()})}onReceiveMessage(e){this.processingMessage=!0,this.listener.onReceiveMessage(e,e=>{this.processingMessage=!1,this.processingMetadata?(this.pendingMessage=e,this.hasPendingMessage=!0):(this.nextListener.onReceiveMessage(e),this.processPendingStatus())})}onReceiveStatus(e){this.listener.onReceiveStatus(e,e=>{this.processingMetadata||this.processingMessage?this.pendingStatus=e:this.nextListener.onReceiveStatus(e)})}}},5572(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.getNextCallNumber=function(){return i++};let i=0},1544(e,t,i){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ClientDuplexStreamImpl=t.ClientWritableStreamImpl=t.ClientReadableStreamImpl=t.ClientUnaryCallImpl=void 0,t.callErrorFromStatus=function(e,t){const i=`${e.code} ${s.Status[e.code]}: ${e.details}`,n=`${new Error(i).stack}\nfor call at\n${t}`;return Object.assign(new Error(i),e,{stack:n})};const n=i(4434),r=i(2203),s=i(131);class o extends n.EventEmitter{constructor(){super()}cancel(){var e;null===(e=this.call)||void 0===e||e.cancelWithStatus(s.Status.CANCELLED,"Cancelled on client")}getPeer(){var e,t;return null!==(t=null===(e=this.call)||void 0===e?void 0:e.getPeer())&&void 0!==t?t:"unknown"}getAuthContext(){var e,t;return null!==(t=null===(e=this.call)||void 0===e?void 0:e.getAuthContext())&&void 0!==t?t:null}}t.ClientUnaryCallImpl=o;class a extends r.Readable{constructor(e){super({objectMode:!0}),this.deserialize=e}cancel(){var e;null===(e=this.call)||void 0===e||e.cancelWithStatus(s.Status.CANCELLED,"Cancelled on client")}getPeer(){var e,t;return null!==(t=null===(e=this.call)||void 0===e?void 0:e.getPeer())&&void 0!==t?t:"unknown"}getAuthContext(){var e,t;return null!==(t=null===(e=this.call)||void 0===e?void 0:e.getAuthContext())&&void 0!==t?t:null}_read(e){var t;null===(t=this.call)||void 0===t||t.startRead()}}t.ClientReadableStreamImpl=a;class l extends r.Writable{constructor(e){super({objectMode:!0}),this.serialize=e}cancel(){var e;null===(e=this.call)||void 0===e||e.cancelWithStatus(s.Status.CANCELLED,"Cancelled on client")}getPeer(){var e,t;return null!==(t=null===(e=this.call)||void 0===e?void 0:e.getPeer())&&void 0!==t?t:"unknown"}getAuthContext(){var e,t;return null!==(t=null===(e=this.call)||void 0===e?void 0:e.getAuthContext())&&void 0!==t?t:null}_write(e,t,i){var n;const r={callback:i},s=Number(t);Number.isNaN(s)||(r.flags=s),null===(n=this.call)||void 0===n||n.sendMessageWithContext(r,e)}_final(e){var t;null===(t=this.call)||void 0===t||t.halfClose(),e()}}t.ClientWritableStreamImpl=l;class c extends r.Duplex{constructor(e,t){super({objectMode:!0}),this.serialize=e,this.deserialize=t}cancel(){var e;null===(e=this.call)||void 0===e||e.cancelWithStatus(s.Status.CANCELLED,"Cancelled on client")}getPeer(){var e,t;return null!==(t=null===(e=this.call)||void 0===e?void 0:e.getPeer())&&void 0!==t?t:"unknown"}getAuthContext(){var e,t;return null!==(t=null===(e=this.call)||void 0===e?void 0:e.getAuthContext())&&void 0!==t?t:null}_read(e){var t;null===(t=this.call)||void 0===t||t.startRead()}_write(e,t,i){var n;const r={callback:i},s=Number(t);Number.isNaN(s)||(r.flags=s),null===(n=this.call)||void 0===n||n.sendMessageWithContext(r,e)}_final(e){var t;null===(t=this.call)||void 0===t||t.halfClose(),e()}}t.ClientDuplexStreamImpl=c},5819(e,t,i){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.FileWatcherCertificateProvider=void 0;const n=i(9896),r=i(267),s=i(131),o=i(9023);function a(e){r.trace(s.LogVerbosity.DEBUG,"certificate_provider",e)}const l=(0,o.promisify)(n.readFile);t.FileWatcherCertificateProvider=class{constructor(e){if(this.config=e,this.refreshTimer=null,this.fileResultPromise=null,this.latestCaUpdate=void 0,this.caListeners=new Set,this.latestIdentityUpdate=void 0,this.identityListeners=new Set,this.lastUpdateTime=null,void 0===e.certificateFile!=(void 0===e.privateKeyFile))throw new Error("certificateFile and privateKeyFile must be set or unset together");if(void 0===e.certificateFile&&void 0===e.caCertificateFile)throw new Error("At least one of certificateFile and caCertificateFile must be set");a("File watcher constructed with config "+JSON.stringify(e))}updateCertificates(){this.fileResultPromise||(this.fileResultPromise=Promise.allSettled([this.config.certificateFile?l(this.config.certificateFile):Promise.reject(),this.config.privateKeyFile?l(this.config.privateKeyFile):Promise.reject(),this.config.caCertificateFile?l(this.config.caCertificateFile):Promise.reject()]),this.fileResultPromise.then(([e,t,i])=>{if(this.refreshTimer){a("File watcher read certificates certificate "+e.status+", privateKey "+t.status+", CA certificate "+i.status),this.lastUpdateTime=new Date,this.fileResultPromise=null,"fulfilled"===e.status&&"fulfilled"===t.status?this.latestIdentityUpdate={certificate:e.value,privateKey:t.value}:this.latestIdentityUpdate=null,"fulfilled"===i.status?this.latestCaUpdate={caCertificate:i.value}:this.latestCaUpdate=null;for(const e of this.identityListeners)e(this.latestIdentityUpdate);for(const e of this.caListeners)e(this.latestCaUpdate)}}),a("File watcher initiated certificate update"))}maybeStartWatchingFiles(){if(!this.refreshTimer){const e=this.lastUpdateTime?(new Date).getTime()-this.lastUpdateTime.getTime():1/0;e>this.config.refreshIntervalMs&&this.updateCertificates(),e>2*this.config.refreshIntervalMs&&(this.latestCaUpdate=void 0,this.latestIdentityUpdate=void 0),this.refreshTimer=setInterval(()=>this.updateCertificates(),this.config.refreshIntervalMs),a("File watcher started watching")}}maybeStopWatchingFiles(){0===this.caListeners.size&&0===this.identityListeners.size&&(this.fileResultPromise=null,this.refreshTimer&&(clearInterval(this.refreshTimer),this.refreshTimer=null))}addCaCertificateListener(e){this.caListeners.add(e),this.maybeStartWatchingFiles(),void 0!==this.latestCaUpdate&&process.nextTick(e,this.latestCaUpdate)}removeCaCertificateListener(e){this.caListeners.delete(e),this.maybeStopWatchingFiles()}addIdentityCertificateListener(e){this.identityListeners.add(e),this.maybeStartWatchingFiles(),void 0!==this.latestIdentityUpdate&&process.nextTick(e,this.latestIdentityUpdate)}removeIdentityCertificateListener(e){this.identityListeners.delete(e),this.maybeStopWatchingFiles()}}},7434(e,t,i){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ChannelCredentials=void 0,t.createCertificateProviderChannelCredentials=function(e,t,i){return new m(e,t,null!=i?i:{})};const n=i(4756),r=i(2267),s=i(9167),o=i(3822),a=i(9302),l=i(267),c=i(131);function u(e,t){if(e&&!(e instanceof Buffer))throw new TypeError(`${t}, if provided, must be a Buffer.`)}class h{compose(e){return new v(this,e)}static createSsl(e,t,i,r){var o;if(u(e,"Root certificate"),u(t,"Private key"),u(i,"Certificate chain"),t&&!i)throw new Error("Private key must be given with accompanying certificate chain");if(!t&&i)throw new Error("Certificate chain must be given with accompanying private key");const a=(0,n.createSecureContext)({ca:null!==(o=null!=e?e:(0,s.getDefaultRootsData)())&&void 0!==o?o:void 0,key:null!=t?t:void 0,cert:null!=i?i:void 0,ciphers:s.CIPHER_SUITES});return new g(a,null!=r?r:{})}static createFromSecureContext(e,t){return new g(e,null!=t?t:{})}static createInsecure(){return new d}}t.ChannelCredentials=h;class d extends h{constructor(){super()}compose(e){throw new Error("Cannot compose insecure credentials")}_isSecure(){return!1}_equals(e){return e instanceof d}_createSecureConnector(e,t,i){return{connect:e=>Promise.resolve({socket:e,secure:!1}),waitForReady:()=>Promise.resolve(),getCallCredentials:()=>null!=i?i:r.CallCredentials.createEmpty(),destroy(){}}}}function f(e,t,i,r){var s,l;const c={secureContext:e};let u=i;if("grpc.http_connect_target"in r){const e=(0,o.parseUri)(r["grpc.http_connect_target"]);e&&(u=e)}const h=(0,a.getDefaultAuthority)(u),d=(0,o.splitHostPort)(h),f=null!==(s=null==d?void 0:d.host)&&void 0!==s?s:h;if(c.host=f,t.checkServerIdentity&&(c.checkServerIdentity=t.checkServerIdentity),void 0!==t.rejectUnauthorized&&(c.rejectUnauthorized=t.rejectUnauthorized),c.ALPNProtocols=["h2"],r["grpc.ssl_target_name_override"]){const e=r["grpc.ssl_target_name_override"],t=null!==(l=c.checkServerIdentity)&&void 0!==l?l:n.checkServerIdentity;c.checkServerIdentity=(i,n)=>t(e,n),c.servername=e}else c.servername=f;return r["grpc-node.tls_enable_trace"]&&(c.enableTrace=!0),c}class p{constructor(e,t){this.connectionOptions=e,this.callCredentials=t}connect(e){const t=Object.assign({socket:e},this.connectionOptions);return new Promise((e,i)=>{const r=(0,n.connect)(t,()=>{var t;null!==(t=this.connectionOptions.rejectUnauthorized)&&void 0!==t&&!t||r.authorized?e({socket:r,secure:!0}):i(r.authorizationError)});r.on("error",e=>{i(e)})})}waitForReady(){return Promise.resolve()}getCallCredentials(){return this.callCredentials}destroy(){}}class g extends h{constructor(e,t){super(),this.secureContext=e,this.verifyOptions=t}_isSecure(){return!0}_equals(e){return this===e||e instanceof g&&(this.secureContext===e.secureContext&&this.verifyOptions.checkServerIdentity===e.verifyOptions.checkServerIdentity)}_createSecureConnector(e,t,i){const n=f(this.secureContext,this.verifyOptions,e,t);return new p(n,null!=i?i:r.CallCredentials.createEmpty())}}class m extends h{constructor(e,t,i){super(),this.caCertificateProvider=e,this.identityCertificateProvider=t,this.verifyOptions=i,this.refcount=0,this.latestCaUpdate=void 0,this.latestIdentityUpdate=void 0,this.caCertificateUpdateListener=this.handleCaCertificateUpdate.bind(this),this.identityCertificateUpdateListener=this.handleIdentityCertitificateUpdate.bind(this),this.secureContextWatchers=[]}_isSecure(){return!0}_equals(e){var t,i;return this===e||e instanceof m&&(this.caCertificateProvider===e.caCertificateProvider&&this.identityCertificateProvider===e.identityCertificateProvider&&(null===(t=this.verifyOptions)||void 0===t?void 0:t.checkServerIdentity)===(null===(i=e.verifyOptions)||void 0===i?void 0:i.checkServerIdentity))}ref(){var e;0===this.refcount&&(this.caCertificateProvider.addCaCertificateListener(this.caCertificateUpdateListener),null===(e=this.identityCertificateProvider)||void 0===e||e.addIdentityCertificateListener(this.identityCertificateUpdateListener)),this.refcount+=1}unref(){var e;this.refcount-=1,0===this.refcount&&(this.caCertificateProvider.removeCaCertificateListener(this.caCertificateUpdateListener),null===(e=this.identityCertificateProvider)||void 0===e||e.removeIdentityCertificateListener(this.identityCertificateUpdateListener))}_createSecureConnector(e,t,i){return this.ref(),new m.SecureConnectorImpl(this,e,t,null!=i?i:r.CallCredentials.createEmpty())}maybeUpdateWatchers(){if(this.hasReceivedUpdates()){for(const e of this.secureContextWatchers)e(this.getLatestSecureContext());this.secureContextWatchers=[]}}handleCaCertificateUpdate(e){this.latestCaUpdate=e,this.maybeUpdateWatchers()}handleIdentityCertitificateUpdate(e){this.latestIdentityUpdate=e,this.maybeUpdateWatchers()}hasReceivedUpdates(){return void 0!==this.latestCaUpdate&&(!this.identityCertificateProvider||void 0!==this.latestIdentityUpdate)}getSecureContext(){return this.hasReceivedUpdates()?Promise.resolve(this.getLatestSecureContext()):new Promise(e=>{this.secureContextWatchers.push(e)})}getLatestSecureContext(){var e,t;if(!this.latestCaUpdate)return null;if(null!==this.identityCertificateProvider&&!this.latestIdentityUpdate)return null;try{return(0,n.createSecureContext)({ca:this.latestCaUpdate.caCertificate,key:null===(e=this.latestIdentityUpdate)||void 0===e?void 0:e.privateKey,cert:null===(t=this.latestIdentityUpdate)||void 0===t?void 0:t.certificate,ciphers:s.CIPHER_SUITES})}catch(e){return(0,l.log)(c.LogVerbosity.ERROR,"Failed to createSecureContext with error "+e.message),null}}}m.SecureConnectorImpl=class{constructor(e,t,i,n){this.parent=e,this.channelTarget=t,this.options=i,this.callCredentials=n}connect(e){return new Promise((t,i)=>{const r=this.parent.getLatestSecureContext();if(!r)return void i(new Error("Failed to load credentials"));e.closed&&i(new Error("Socket closed while loading credentials"));const s=f(r,this.parent.verifyOptions,this.channelTarget,this.options),o=Object.assign({socket:e},s),a=()=>{i(new Error("Socket closed"))},l=e=>{i(e)},c=(0,n.connect)(o,()=>{var e;c.removeListener("close",a),c.removeListener("error",l),null!==(e=this.parent.verifyOptions.rejectUnauthorized)&&void 0!==e&&!e||c.authorized?t({socket:c,secure:!0}):i(c.authorizationError)});c.once("close",a),c.once("error",l)})}async waitForReady(){await this.parent.getSecureContext()}getCallCredentials(){return this.callCredentials}destroy(){this.parent.unref()}};class v extends h{constructor(e,t){if(super(),this.channelCredentials=e,this.callCredentials=t,!e._isSecure())throw new Error("Cannot compose insecure credentials")}compose(e){const t=this.callCredentials.compose(e);return new v(this.channelCredentials,t)}_isSecure(){return!0}_equals(e){return this===e||e instanceof v&&(this.channelCredentials._equals(e.channelCredentials)&&this.callCredentials._equals(e.callCredentials))}_createSecureConnector(e,t,i){const n=this.callCredentials.compose(null!=i?i:r.CallCredentials.createEmpty());return this.channelCredentials._createSecureConnector(e,t,n)}}},6998(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.recognizedOptions=void 0,t.channelOptionsEqual=function(e,t){const i=Object.keys(e).sort(),n=Object.keys(t).sort();if(i.length!==n.length)return!1;for(let r=0;r<i.length;r+=1){if(i[r]!==n[r])return!1;if(e[i[r]]!==t[n[r]])return!1}return!0},t.recognizedOptions={"grpc.ssl_target_name_override":!0,"grpc.primary_user_agent":!0,"grpc.secondary_user_agent":!0,"grpc.default_authority":!0,"grpc.keepalive_time_ms":!0,"grpc.keepalive_timeout_ms":!0,"grpc.keepalive_permit_without_calls":!0,"grpc.service_config":!0,"grpc.max_concurrent_streams":!0,"grpc.initial_reconnect_backoff_ms":!0,"grpc.max_reconnect_backoff_ms":!0,"grpc.use_local_subchannel_pool":!0,"grpc.max_send_message_length":!0,"grpc.max_receive_message_length":!0,"grpc.enable_http_proxy":!0,"grpc.enable_channelz":!0,"grpc.dns_min_time_between_resolutions_ms":!0,"grpc.enable_retries":!0,"grpc.per_rpc_retry_buffer_size":!0,"grpc.retry_buffer_size":!0,"grpc.max_connection_age_ms":!0,"grpc.max_connection_age_grace_ms":!0,"grpc-node.max_session_memory":!0,"grpc.service_config_disable_resolution":!0,"grpc.client_idle_timeout_ms":!0,"grpc-node.tls_enable_trace":!0,"grpc.lb.ring_hash.ring_size_cap":!0,"grpc-node.retry_max_attempts_limit":!0,"grpc-node.flow_control_window":!0,"grpc.server_call_metric_recording":!0}},3653(e,t,i){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ChannelImplementation=void 0;const n=i(7434),r=i(8899);t.ChannelImplementation=class{constructor(e,t,i){if("string"!=typeof e)throw new TypeError("Channel target must be a string");if(!(t instanceof n.ChannelCredentials))throw new TypeError("Channel credentials must be a ChannelCredentials object");if(i&&"object"!=typeof i)throw new TypeError("Channel options must be an object");this.internalChannel=new r.InternalChannel(e,t,i)}close(){this.internalChannel.close()}getTarget(){return this.internalChannel.getTarget()}getConnectivityState(e){return this.internalChannel.getConnectivityState(e)}watchConnectivityState(e,t,i){this.internalChannel.watchConnectivityState(e,t,i)}getChannelzRef(){return this.internalChannel.getChannelzRef()}createCall(e,t,i,n,r){if("string"!=typeof e)throw new TypeError("Channel#createCall: method must be a string");if(!("number"==typeof t||t instanceof Date))throw new TypeError("Channel#createCall: deadline must be a number or Date");return this.internalChannel.createCall(e,t,i,n,r)}}},9503(e,t,i){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.registerChannelzSocket=t.registerChannelzServer=t.registerChannelzSubchannel=t.registerChannelzChannel=t.ChannelzCallTrackerStub=t.ChannelzCallTracker=t.ChannelzChildrenTrackerStub=t.ChannelzChildrenTracker=t.ChannelzTrace=t.ChannelzTraceStub=void 0,t.unregisterChannelzRef=function(e){g[e.kind].eraseElementByKey(e.id)},t.getChannelzHandlers=x,t.getChannelzServiceDefinition=M,t.setup=function(){(0,l.registerAdminService)(M,x)};const n=i(9278),r=i(6787),s=i(463),o=i(131),a=i(8996),l=i(2661),c=i(4056);function u(e){return{channel_id:e.id,name:e.name}}function h(e){return{subchannel_id:e.id,name:e.name}}function d(e){return{socket_id:e.id,name:e.name}}t.ChannelzTraceStub=class{constructor(){this.events=[],this.creationTimestamp=new Date,this.eventsLogged=0}addTrace(){}getTraceMessage(){return{creation_timestamp:_(this.creationTimestamp),num_events_logged:this.eventsLogged,events:[]}}};t.ChannelzTrace=class{constructor(){this.events=[],this.eventsLogged=0,this.creationTimestamp=new Date}addTrace(e,t,i){const n=new Date;this.events.push({description:t,severity:e,timestamp:n,childChannel:"channel"===(null==i?void 0:i.kind)?i:void 0,childSubchannel:"subchannel"===(null==i?void 0:i.kind)?i:void 0}),this.events.length>=64&&(this.events=this.events.slice(32)),this.eventsLogged+=1}getTraceMessage(){return{creation_timestamp:_(this.creationTimestamp),num_events_logged:this.eventsLogged,events:this.events.map(e=>({description:e.description,severity:e.severity,timestamp:_(e.timestamp),channel_ref:e.childChannel?u(e.childChannel):null,subchannel_ref:e.childSubchannel?h(e.childSubchannel):null}))}}};class f{constructor(){this.channelChildren=new r.OrderedMap,this.subchannelChildren=new r.OrderedMap,this.socketChildren=new r.OrderedMap,this.trackerMap={channel:this.channelChildren,subchannel:this.subchannelChildren,socket:this.socketChildren}}refChild(e){const t=this.trackerMap[e.kind],i=t.find(e.id);i.equals(t.end())?t.setElement(e.id,{ref:e,count:1},i):i.pointer[1].count+=1}unrefChild(e){const t=this.trackerMap[e.kind],i=t.getElementByKey(e.id);void 0!==i&&(i.count-=1,0===i.count&&t.eraseElementByKey(e.id))}getChildLists(){return{channels:this.channelChildren,subchannels:this.subchannelChildren,sockets:this.socketChildren}}}t.ChannelzChildrenTracker=f;t.ChannelzChildrenTrackerStub=class extends f{refChild(){}unrefChild(){}};class p{constructor(){this.callsStarted=0,this.callsSucceeded=0,this.callsFailed=0,this.lastCallStartedTimestamp=null}addCallStarted(){this.callsStarted+=1,this.lastCallStartedTimestamp=new Date}addCallSucceeded(){this.callsSucceeded+=1}addCallFailed(){this.callsFailed+=1}}t.ChannelzCallTracker=p;t.ChannelzCallTrackerStub=class extends p{addCallStarted(){}addCallSucceeded(){}addCallFailed(){}};const g={channel:new r.OrderedMap,subchannel:new r.OrderedMap,server:new r.OrderedMap,socket:new r.OrderedMap},m=e=>{let t=1;const i=g[e];return(n,r,s)=>{const o=t++,a={id:o,name:n,kind:e};return s&&i.setElement(o,{ref:a,getInfo:r}),a}};function v(e){if(""===e)return[];const t=e.split(":").map(e=>function(e){const t=Number.parseInt(e,16);return[t/256|0,t%256]}(e));return[].concat(...t)}function y(e){return Buffer.from(Uint8Array.from(e.split(".").map(e=>Number.parseInt(e))))}function b(e){if((0,n.isIPv4)(e))return y(e);if(function(e){return(0,n.isIPv6)(e)&&e.toLowerCase().startsWith("::ffff:")&&(0,n.isIPv4)(e.substring(7))}(e))return y(e.substring(7));if((0,n.isIPv6)(e)){let t,i;const n=e.indexOf("::");-1===n?(t=e,i=""):(t=e.substring(0,n),i=e.substring(n+2));const r=Buffer.from(v(t)),s=Buffer.from(v(i)),o=Buffer.alloc(16-r.length-s.length,0);return Buffer.concat([r,o,s])}return null}function S(e){switch(e){case s.ConnectivityState.CONNECTING:return{state:"CONNECTING"};case s.ConnectivityState.IDLE:return{state:"IDLE"};case s.ConnectivityState.READY:return{state:"READY"};case s.ConnectivityState.SHUTDOWN:return{state:"SHUTDOWN"};case s.ConnectivityState.TRANSIENT_FAILURE:return{state:"TRANSIENT_FAILURE"};default:return{state:"UNKNOWN"}}}function _(e){if(!e)return null;const t=e.getTime();return{seconds:t/1e3|0,nanos:t%1e3*1e6}}function C(e){const t=e.getInfo(),i=[],n=[];return t.children.channels.forEach(e=>{i.push(u(e[1].ref))}),t.children.subchannels.forEach(e=>{n.push(h(e[1].ref))}),{ref:u(e.ref),data:{target:t.target,state:S(t.state),calls_started:t.callTracker.callsStarted,calls_succeeded:t.callTracker.callsSucceeded,calls_failed:t.callTracker.callsFailed,last_call_started_timestamp:_(t.callTracker.lastCallStartedTimestamp),trace:t.trace.getTraceMessage()},channel_ref:i,subchannel_ref:n}}function E(e,t){const i=parseInt(e.request.channel_id,10),n=g.channel.getElementByKey(i);void 0!==n?t(null,{channel:C(n)}):t({code:o.Status.NOT_FOUND,details:"No channel data found for id "+i})}function w(e,t){const i=parseInt(e.request.max_results,10)||100,n=[],r=parseInt(e.request.start_channel_id,10),s=g.channel;let o;for(o=s.lowerBound(r);!o.equals(s.end())&&n.length<i;o=o.next())n.push(C(o.pointer[1]));t(null,{channel:n,end:o.equals(s.end())})}function T(e){const t=e.getInfo(),i=[];return t.listenerChildren.sockets.forEach(e=>{i.push(d(e[1].ref))}),{ref:(n=e.ref,{server_id:n.id}),data:{calls_started:t.callTracker.callsStarted,calls_succeeded:t.callTracker.callsSucceeded,calls_failed:t.callTracker.callsFailed,last_call_started_timestamp:_(t.callTracker.lastCallStartedTimestamp),trace:t.trace.getTraceMessage()},listen_socket:i};var n}function k(e,t){const i=parseInt(e.request.server_id,10),n=g.server.getElementByKey(i);void 0!==n?t(null,{server:T(n)}):t({code:o.Status.NOT_FOUND,details:"No server data found for id "+i})}function R(e,t){const i=parseInt(e.request.max_results,10)||100,n=parseInt(e.request.start_server_id,10),r=g.server,s=[];let o;for(o=r.lowerBound(n);!o.equals(r.end())&&s.length<i;o=o.next())s.push(T(o.pointer[1]));t(null,{server:s,end:o.equals(r.end())})}function O(e,t){const i=parseInt(e.request.subchannel_id,10),n=g.subchannel.getElementByKey(i);if(void 0===n)return void t({code:o.Status.NOT_FOUND,details:"No subchannel data found for id "+i});const r=n.getInfo(),s=[];r.children.sockets.forEach(e=>{s.push(d(e[1].ref))});t(null,{subchannel:{ref:h(n.ref),data:{target:r.target,state:S(r.state),calls_started:r.callTracker.callsStarted,calls_succeeded:r.callTracker.callsSucceeded,calls_failed:r.callTracker.callsFailed,last_call_started_timestamp:_(r.callTracker.lastCallStartedTimestamp),trace:r.trace.getTraceMessage()},socket_ref:s}})}function A(e){var t;return(0,a.isTcpSubchannelAddress)(e)?{address:"tcpip_address",tcpip_address:{ip_address:null!==(t=b(e.host))&&void 0!==t?t:void 0,port:e.port}}:{address:"uds_address",uds_address:{filename:e.path}}}function P(e,t){var i,n,r,s,a;const l=parseInt(e.request.socket_id,10),c=g.socket.getElementByKey(l);if(void 0===c)return void t({code:o.Status.NOT_FOUND,details:"No socket data found for id "+l});const u=c.getInfo(),h=u.security?{model:"tls",tls:{cipher_suite:u.security.cipherSuiteStandardName?"standard_name":"other_name",standard_name:null!==(i=u.security.cipherSuiteStandardName)&&void 0!==i?i:void 0,other_name:null!==(n=u.security.cipherSuiteOtherName)&&void 0!==n?n:void 0,local_certificate:null!==(r=u.security.localCertificate)&&void 0!==r?r:void 0,remote_certificate:null!==(s=u.security.remoteCertificate)&&void 0!==s?s:void 0}}:null;t(null,{socket:{ref:d(c.ref),local:u.localAddress?A(u.localAddress):null,remote:u.remoteAddress?A(u.remoteAddress):null,remote_name:null!==(a=u.remoteName)&&void 0!==a?a:void 0,security:h,data:{keep_alives_sent:u.keepAlivesSent,streams_started:u.streamsStarted,streams_succeeded:u.streamsSucceeded,streams_failed:u.streamsFailed,last_local_stream_created_timestamp:_(u.lastLocalStreamCreatedTimestamp),last_remote_stream_created_timestamp:_(u.lastRemoteStreamCreatedTimestamp),messages_received:u.messagesReceived,messages_sent:u.messagesSent,last_message_received_timestamp:_(u.lastMessageReceivedTimestamp),last_message_sent_timestamp:_(u.lastMessageSentTimestamp),local_flow_control_window:u.localFlowControlWindow?{value:u.localFlowControlWindow}:null,remote_flow_control_window:u.remoteFlowControlWindow?{value:u.remoteFlowControlWindow}:null}}})}function N(e,t){const i=parseInt(e.request.server_id,10),n=g.server.getElementByKey(i);if(void 0===n)return void t({code:o.Status.NOT_FOUND,details:"No server data found for id "+i});const r=parseInt(e.request.start_socket_id,10),s=parseInt(e.request.max_results,10)||100,a=n.getInfo().sessionChildren.sockets,l=[];let c;for(c=a.lowerBound(r);!c.equals(a.end())&&l.length<s;c=c.next())l.push(d(c.pointer[1].ref));t(null,{socket_ref:l,end:c.equals(a.end())})}function x(){return{GetChannel:E,GetTopChannels:w,GetServer:k,GetServers:R,GetSubchannel:O,GetSocket:P,GetServerSockets:N}}t.registerChannelzChannel=m("channel"),t.registerChannelzSubchannel=m("subchannel"),t.registerChannelzServer=m("server"),t.registerChannelzSocket=m("socket");let I=null;function M(){if(I)return I;const e=(0,i(5085).Yi)("channelz.proto",{keepCase:!0,longs:String,enums:String,defaults:!0,oneofs:!0,includeDirs:[`${__dirname}/../../proto`]}),t=(0,c.loadPackageDefinition)(e);return I=t.grpc.channelz.v1.Channelz.service,I}},3952(e,t,i){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.InterceptingCall=t.RequesterBuilder=t.ListenerBuilder=t.InterceptorConfigurationError=void 0,t.getInterceptingCall=function(e,t,i,n){if(e.clientInterceptors.length>0&&e.clientInterceptorProviders.length>0)throw new a("Both interceptors and interceptor_providers were passed as options to the client constructor. Only one of these is allowed.");if(e.callInterceptors.length>0&&e.callInterceptorProviders.length>0)throw new a("Both interceptors and interceptor_providers were passed as call options. Only one of these is allowed.");let r=[];r=e.callInterceptors.length>0||e.callInterceptorProviders.length>0?[].concat(e.callInterceptors,e.callInterceptorProviders.map(e=>e(t))).filter(e=>e):[].concat(e.clientInterceptors,e.clientInterceptorProviders.map(e=>e(t))).filter(e=>e);const s=Object.assign({},i,{method_definition:t}),o=r.reduceRight((e,t)=>i=>t(i,e),e=>f(n,e,t));return o(s)};const n=i(4097),r=i(5034),s=i(131),o=i(9752);class a extends Error{constructor(e){super(e),this.name="InterceptorConfigurationError",Error.captureStackTrace(this,a)}}t.InterceptorConfigurationError=a;t.ListenerBuilder=class{constructor(){this.metadata=void 0,this.message=void 0,this.status=void 0}withOnReceiveMetadata(e){return this.metadata=e,this}withOnReceiveMessage(e){return this.message=e,this}withOnReceiveStatus(e){return this.status=e,this}build(){return{onReceiveMetadata:this.metadata,onReceiveMessage:this.message,onReceiveStatus:this.status}}};t.RequesterBuilder=class{constructor(){this.start=void 0,this.message=void 0,this.halfClose=void 0,this.cancel=void 0}withStart(e){return this.start=e,this}withSendMessage(e){return this.message=e,this}withHalfClose(e){return this.halfClose=e,this}withCancel(e){return this.cancel=e,this}build(){return{start:this.start,sendMessage:this.message,halfClose:this.halfClose,cancel:this.cancel}}};const l={onReceiveMetadata:(e,t)=>{t(e)},onReceiveMessage:(e,t)=>{t(e)},onReceiveStatus:(e,t)=>{t(e)}},c={start:(e,t,i)=>{i(e,t)},sendMessage:(e,t)=>{t(e)},halfClose:e=>{e()},cancel:e=>{e()}};t.InterceptingCall=class{constructor(e,t){var i,n,r,s;this.nextCall=e,this.processingMetadata=!1,this.pendingMessageContext=null,this.processingMessage=!1,this.pendingHalfClose=!1,this.requester=t?{start:null!==(i=t.start)&&void 0!==i?i:c.start,sendMessage:null!==(n=t.sendMessage)&&void 0!==n?n:c.sendMessage,halfClose:null!==(r=t.halfClose)&&void 0!==r?r:c.halfClose,cancel:null!==(s=t.cancel)&&void 0!==s?s:c.cancel}:c}cancelWithStatus(e,t){this.requester.cancel(()=>{this.nextCall.cancelWithStatus(e,t)})}getPeer(){return this.nextCall.getPeer()}processPendingMessage(){this.pendingMessageContext&&(this.nextCall.sendMessageWithContext(this.pendingMessageContext,this.pendingMessage),this.pendingMessageContext=null,this.pendingMessage=null)}processPendingHalfClose(){this.pendingHalfClose&&this.nextCall.halfClose()}start(e,t){var i,n,s,o,a,c;const u={onReceiveMetadata:null!==(n=null===(i=null==t?void 0:t.onReceiveMetadata)||void 0===i?void 0:i.bind(t))&&void 0!==n?n:e=>{},onReceiveMessage:null!==(o=null===(s=null==t?void 0:t.onReceiveMessage)||void 0===s?void 0:s.bind(t))&&void 0!==o?o:e=>{},onReceiveStatus:null!==(c=null===(a=null==t?void 0:t.onReceiveStatus)||void 0===a?void 0:a.bind(t))&&void 0!==c?c:e=>{}};this.processingMetadata=!0,this.requester.start(e,u,(e,t)=>{var i,n,s;let o;if(this.processingMetadata=!1,(0,r.isInterceptingListener)(t))o=t;else{const e={onReceiveMetadata:null!==(i=t.onReceiveMetadata)&&void 0!==i?i:l.onReceiveMetadata,onReceiveMessage:null!==(n=t.onReceiveMessage)&&void 0!==n?n:l.onReceiveMessage,onReceiveStatus:null!==(s=t.onReceiveStatus)&&void 0!==s?s:l.onReceiveStatus};o=new r.InterceptingListenerImpl(e,u)}this.nextCall.start(e,o),this.processPendingMessage(),this.processPendingHalfClose()})}sendMessageWithContext(e,t){this.processingMessage=!0,this.requester.sendMessage(t,i=>{this.processingMessage=!1,this.processingMetadata?(this.pendingMessageContext=e,this.pendingMessage=t):(this.nextCall.sendMessageWithContext(e,i),this.processPendingHalfClose())})}sendMessage(e){this.sendMessageWithContext({},e)}startRead(){this.nextCall.startRead()}halfClose(){this.requester.halfClose(()=>{this.processingMetadata||this.processingMessage?this.pendingHalfClose=!0:this.nextCall.halfClose()})}getAuthContext(){return this.nextCall.getAuthContext()}};class u{constructor(e,t){this.call=e,this.methodDefinition=t}cancelWithStatus(e,t){this.call.cancelWithStatus(e,t)}getPeer(){return this.call.getPeer()}sendMessageWithContext(e,t){let i;try{i=this.methodDefinition.requestSerialize(t)}catch(e){return void this.call.cancelWithStatus(s.Status.INTERNAL,`Request message serialization failure: ${(0,o.getErrorMessage)(e)}`)}this.call.sendMessageWithContext(e,i)}sendMessage(e){this.sendMessageWithContext({},e)}start(e,t){let i=null;this.call.start(e,{onReceiveMetadata:e=>{var i;null===(i=null==t?void 0:t.onReceiveMetadata)||void 0===i||i.call(t,e)},onReceiveMessage:e=>{var r;let a;try{a=this.methodDefinition.responseDeserialize(e)}catch(e){return i={code:s.Status.INTERNAL,details:`Response message parsing error: ${(0,o.getErrorMessage)(e)}`,metadata:new n.Metadata},void this.call.cancelWithStatus(i.code,i.details)}null===(r=null==t?void 0:t.onReceiveMessage)||void 0===r||r.call(t,a)},onReceiveStatus:e=>{var n,r;i?null===(n=null==t?void 0:t.onReceiveStatus)||void 0===n||n.call(t,i):null===(r=null==t?void 0:t.onReceiveStatus)||void 0===r||r.call(t,e)}})}startRead(){this.call.startRead()}halfClose(){this.call.halfClose()}getAuthContext(){return this.call.getAuthContext()}}class h extends u{constructor(e,t){super(e,t)}start(e,t){var i,n;let r=!1;const s={onReceiveMetadata:null!==(n=null===(i=null==t?void 0:t.onReceiveMetadata)||void 0===i?void 0:i.bind(t))&&void 0!==n?n:e=>{},onReceiveMessage:e=>{var i;r=!0,null===(i=null==t?void 0:t.onReceiveMessage)||void 0===i||i.call(t,e)},onReceiveStatus:e=>{var i,n;r||null===(i=null==t?void 0:t.onReceiveMessage)||void 0===i||i.call(t,null),null===(n=null==t?void 0:t.onReceiveStatus)||void 0===n||n.call(t,e)}};super.start(e,s),this.call.startRead()}}class d extends u{}function f(e,t,i){const n=function(e,t,i){var n,r;const s=null!==(n=i.deadline)&&void 0!==n?n:1/0,o=i.host,a=null!==(r=i.parent)&&void 0!==r?r:null,l=i.propagate_flags,c=i.credentials,u=e.createCall(t,s,o,a,l);return c&&u.setCredentials(c),u}(e,i.path,t);return i.responseStream?new d(n,i):new h(n,i)}},5563(e,t,i){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Client=void 0;const n=i(1544),r=i(3653),s=i(463),o=i(131),a=i(4097),l=i(3952),c=Symbol(),u=Symbol(),h=Symbol(),d=Symbol();function f(e){return"function"==typeof e}function p(e){var t;return(null===(t=e.stack)||void 0===t?void 0:t.split("\n").slice(1).join("\n"))||"no stack trace available"}t.Client=class{constructor(e,t,i={}){var n,s;if(i=Object.assign({},i),this[u]=null!==(n=i.interceptors)&&void 0!==n?n:[],delete i.interceptors,this[h]=null!==(s=i.interceptor_providers)&&void 0!==s?s:[],delete i.interceptor_providers,this[u].length>0&&this[h].length>0)throw new Error("Both interceptors and interceptor_providers were passed as options to the client constructor. Only one of these is allowed.");if(this[d]=i.callInvocationTransformer,delete i.callInvocationTransformer,i.channelOverride)this[c]=i.channelOverride;else if(i.channelFactoryOverride){const n=i.channelFactoryOverride;delete i.channelFactoryOverride,this[c]=n(e,t,i)}else this[c]=new r.ChannelImplementation(e,t,i)}close(){this[c].close()}getChannel(){return this[c]}waitForReady(e,t){const i=n=>{if(n)return void t(new Error("Failed to connect before the deadline"));let r;try{r=this[c].getConnectivityState(!0)}catch(e){return void t(new Error("The channel has been closed"))}if(r===s.ConnectivityState.READY)t();else try{this[c].watchConnectivityState(r,e,i)}catch(e){t(new Error("The channel has been closed"))}};setImmediate(i)}checkOptionalUnaryResponseArguments(e,t,i){if(f(e))return{metadata:new a.Metadata,options:{},callback:e};if(f(t))return e instanceof a.Metadata?{metadata:e,options:{},callback:t}:{metadata:new a.Metadata,options:e,callback:t};if(!(e instanceof a.Metadata&&t instanceof Object&&f(i)))throw new Error("Incorrect arguments passed");return{metadata:e,options:t,callback:i}}makeUnaryRequest(e,t,i,r,s,a,f){var g,m;const v=this.checkOptionalUnaryResponseArguments(s,a,f),y={path:e,requestStream:!1,responseStream:!1,requestSerialize:t,responseDeserialize:i};let b={argument:r,metadata:v.metadata,call:new n.ClientUnaryCallImpl,channel:this[c],methodDefinition:y,callOptions:v.options,callback:v.callback};this[d]&&(b=this[d](b));const S=b.call,_={clientInterceptors:this[u],clientInterceptorProviders:this[h],callInterceptors:null!==(g=b.callOptions.interceptors)&&void 0!==g?g:[],callInterceptorProviders:null!==(m=b.callOptions.interceptor_providers)&&void 0!==m?m:[]},C=(0,l.getInterceptingCall)(_,b.methodDefinition,b.callOptions,b.channel);S.call=C;let E=null,w=!1,T=new Error;return C.start(b.metadata,{onReceiveMetadata:e=>{S.emit("metadata",e)},onReceiveMessage(e){null!==E&&C.cancelWithStatus(o.Status.UNIMPLEMENTED,"Too many responses received"),E=e},onReceiveStatus(e){if(!w){if(w=!0,e.code===o.Status.OK)if(null===E){const t=p(T);b.callback((0,n.callErrorFromStatus)({code:o.Status.UNIMPLEMENTED,details:"No message received",metadata:e.metadata},t))}else b.callback(null,E);else{const t=p(T);b.callback((0,n.callErrorFromStatus)(e,t))}T=null,S.emit("status",e)}}}),C.sendMessage(r),C.halfClose(),S}makeClientStreamRequest(e,t,i,r,s,a){var f,g;const m=this.checkOptionalUnaryResponseArguments(r,s,a),v={path:e,requestStream:!0,responseStream:!1,requestSerialize:t,responseDeserialize:i};let y={metadata:m.metadata,call:new n.ClientWritableStreamImpl(t),channel:this[c],methodDefinition:v,callOptions:m.options,callback:m.callback};this[d]&&(y=this[d](y));const b=y.call,S={clientInterceptors:this[u],clientInterceptorProviders:this[h],callInterceptors:null!==(f=y.callOptions.interceptors)&&void 0!==f?f:[],callInterceptorProviders:null!==(g=y.callOptions.interceptor_providers)&&void 0!==g?g:[]},_=(0,l.getInterceptingCall)(S,y.methodDefinition,y.callOptions,y.channel);b.call=_;let C=null,E=!1,w=new Error;return _.start(y.metadata,{onReceiveMetadata:e=>{b.emit("metadata",e)},onReceiveMessage(e){null!==C&&_.cancelWithStatus(o.Status.UNIMPLEMENTED,"Too many responses received"),C=e,_.startRead()},onReceiveStatus(e){if(!E){if(E=!0,e.code===o.Status.OK)if(null===C){const t=p(w);y.callback((0,n.callErrorFromStatus)({code:o.Status.UNIMPLEMENTED,details:"No message received",metadata:e.metadata},t))}else y.callback(null,C);else{const t=p(w);y.callback((0,n.callErrorFromStatus)(e,t))}w=null,b.emit("status",e)}}}),b}checkMetadataAndOptions(e,t){let i,n;return e instanceof a.Metadata?(i=e,n=t||{}):(n=e||{},i=new a.Metadata),{metadata:i,options:n}}makeServerStreamRequest(e,t,i,r,s,a){var f,g;const m=this.checkMetadataAndOptions(s,a),v={path:e,requestStream:!1,responseStream:!0,requestSerialize:t,responseDeserialize:i};let y={argument:r,metadata:m.metadata,call:new n.ClientReadableStreamImpl(i),channel:this[c],methodDefinition:v,callOptions:m.options};this[d]&&(y=this[d](y));const b=y.call,S={clientInterceptors:this[u],clientInterceptorProviders:this[h],callInterceptors:null!==(f=y.callOptions.interceptors)&&void 0!==f?f:[],callInterceptorProviders:null!==(g=y.callOptions.interceptor_providers)&&void 0!==g?g:[]},_=(0,l.getInterceptingCall)(S,y.methodDefinition,y.callOptions,y.channel);b.call=_;let C=!1,E=new Error;return _.start(y.metadata,{onReceiveMetadata(e){b.emit("metadata",e)},onReceiveMessage(e){b.push(e)},onReceiveStatus(e){if(!C){if(C=!0,b.push(null),e.code!==o.Status.OK){const t=p(E);b.emit("error",(0,n.callErrorFromStatus)(e,t))}E=null,b.emit("status",e)}}}),_.sendMessage(r),_.halfClose(),b}makeBidiStreamRequest(e,t,i,r,s){var a,f;const g=this.checkMetadataAndOptions(r,s),m={path:e,requestStream:!0,responseStream:!0,requestSerialize:t,responseDeserialize:i};let v={metadata:g.metadata,call:new n.ClientDuplexStreamImpl(t,i),channel:this[c],methodDefinition:m,callOptions:g.options};this[d]&&(v=this[d](v));const y=v.call,b={clientInterceptors:this[u],clientInterceptorProviders:this[h],callInterceptors:null!==(a=v.callOptions.interceptors)&&void 0!==a?a:[],callInterceptorProviders:null!==(f=v.callOptions.interceptor_providers)&&void 0!==f?f:[]},S=(0,l.getInterceptingCall)(b,v.methodDefinition,v.callOptions,v.channel);y.call=S;let _=!1,C=new Error;return S.start(v.metadata,{onReceiveMetadata(e){y.emit("metadata",e)},onReceiveMessage(e){y.push(e)},onReceiveStatus(e){if(!_){if(_=!0,y.push(null),e.code!==o.Status.OK){const t=p(C);y.emit("error",(0,n.callErrorFromStatus)(e,t))}C=null,y.emit("status",e)}}}),y}}},5179(e,t){"use strict";var i;Object.defineProperty(t,"__esModule",{value:!0}),t.CompressionAlgorithms=void 0,function(e){e[e.identity=0]="identity",e[e.deflate=1]="deflate",e[e.gzip=2]="gzip"}(i||(t.CompressionAlgorithms=i={}))},4987(e,t,i){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.CompressionFilterFactory=t.CompressionFilter=void 0;const n=i(3106),r=i(5179),s=i(131),o=i(2558),a=i(267);class l{async writeMessage(e,t){let i=e;t&&(i=await this.compressMessage(i));const n=Buffer.allocUnsafe(i.length+5);return n.writeUInt8(t?1:0,0),n.writeUInt32BE(i.length,1),i.copy(n,5),n}async readMessage(e){const t=1===e.readUInt8(0);let i=e.slice(5);return t&&(i=await this.decompressMessage(i)),i}}class c extends l{async compressMessage(e){return e}async writeMessage(e,t){const i=Buffer.allocUnsafe(e.length+5);return i.writeUInt8(0,0),i.writeUInt32BE(e.length,1),e.copy(i,5),i}decompressMessage(e){return Promise.reject(new Error('Received compressed message but "grpc-encoding" header was identity'))}}class u extends l{constructor(e){super(),this.maxRecvMessageLength=e}compressMessage(e){return new Promise((t,i)=>{n.deflate(e,(e,n)=>{e?i(e):t(n)})})}decompressMessage(e){return new Promise((t,i)=>{let r=0;const o=[],a=n.createInflate();a.on("data",e=>{o.push(e),r+=e.byteLength,-1!==this.maxRecvMessageLength&&r>this.maxRecvMessageLength&&(a.destroy(),i({code:s.Status.RESOURCE_EXHAUSTED,details:`Received message that decompresses to a size larger than ${this.maxRecvMessageLength}`}))}),a.on("end",()=>{t(Buffer.concat(o))}),a.write(e),a.end()})}}class h extends l{constructor(e){super(),this.maxRecvMessageLength=e}compressMessage(e){return new Promise((t,i)=>{n.gzip(e,(e,n)=>{e?i(e):t(n)})})}decompressMessage(e){return new Promise((t,i)=>{let r=0;const o=[],a=n.createGunzip();a.on("data",e=>{o.push(e),r+=e.byteLength,-1!==this.maxRecvMessageLength&&r>this.maxRecvMessageLength&&(a.destroy(),i({code:s.Status.RESOURCE_EXHAUSTED,details:`Received message that decompresses to a size larger than ${this.maxRecvMessageLength}`}))}),a.on("end",()=>{t(Buffer.concat(o))}),a.write(e),a.end()})}}class d extends l{constructor(e){super(),this.compressionName=e}compressMessage(e){return Promise.reject(new Error(`Received message compressed with unsupported compression method ${this.compressionName}`))}decompressMessage(e){return Promise.reject(new Error(`Compression method not supported: ${this.compressionName}`))}}function f(e,t){switch(e){case"identity":return new c;case"deflate":return new u(t);case"gzip":return new h(t);default:return new d(e)}}class p extends o.BaseFilter{constructor(e,t){var i,n,o;super(),this.sharedFilterConfig=t,this.sendCompression=new c,this.receiveCompression=new c,this.currentCompressionAlgorithm="identity";const l=e["grpc.default_compression_algorithm"];if(this.maxReceiveMessageLength=null!==(i=e["grpc.max_receive_message_length"])&&void 0!==i?i:s.DEFAULT_MAX_RECEIVE_MESSAGE_LENGTH,this.maxSendMessageLength=null!==(n=e["grpc.max_send_message_length"])&&void 0!==n?n:s.DEFAULT_MAX_SEND_MESSAGE_LENGTH,void 0!==l)if("number"==typeof(u=l)&&"string"==typeof r.CompressionAlgorithms[u]){const e=r.CompressionAlgorithms[l],i=null===(o=t.serverSupportedEncodingHeader)||void 0===o?void 0:o.split(",");i&&!i.includes(e)||(this.currentCompressionAlgorithm=e,this.sendCompression=f(this.currentCompressionAlgorithm,-1))}else a.log(s.LogVerbosity.ERROR,`Invalid value provided for grpc.default_compression_algorithm option: ${l}`);var u}async sendMetadata(e){const t=await e;return t.set("grpc-accept-encoding","identity,deflate,gzip"),t.set("accept-encoding","identity"),"identity"===this.currentCompressionAlgorithm?t.remove("grpc-encoding"):t.set("grpc-encoding",this.currentCompressionAlgorithm),t}receiveMetadata(e){const t=e.get("grpc-encoding");if(t.length>0){const e=t[0];"string"==typeof e&&(this.receiveCompression=f(e,this.maxReceiveMessageLength))}e.remove("grpc-encoding");const i=e.get("grpc-accept-encoding")[0];if(i){this.sharedFilterConfig.serverSupportedEncodingHeader=i;i.split(",").includes(this.currentCompressionAlgorithm)||(this.sendCompression=new c,this.currentCompressionAlgorithm="identity")}return e.remove("grpc-accept-encoding"),e}async sendMessage(e){var t;const i=await e;if(-1!==this.maxSendMessageLength&&i.message.length>this.maxSendMessageLength)throw{code:s.Status.RESOURCE_EXHAUSTED,details:`Attempted to send message with a size larger than ${this.maxSendMessageLength}`};let n;return n=!(this.sendCompression instanceof c)&&!(2&(null!==(t=i.flags)&&void 0!==t?t:0)),{message:await this.sendCompression.writeMessage(i.message,n),flags:i.flags}}async receiveMessage(e){return this.receiveCompression.readMessage(await e)}}t.CompressionFilter=p;t.CompressionFilterFactory=class{constructor(e,t){this.options=t,this.sharedFilterConfig={}}createFilter(){return new p(this.options,this.sharedFilterConfig)}}},463(e,t){"use strict";var i;Object.defineProperty(t,"__esModule",{value:!0}),t.ConnectivityState=void 0,function(e){e[e.IDLE=0]="IDLE",e[e.CONNECTING=1]="CONNECTING",e[e.READY=2]="READY",e[e.TRANSIENT_FAILURE=3]="TRANSIENT_FAILURE",e[e.SHUTDOWN=4]="SHUTDOWN"}(i||(t.ConnectivityState=i={}))},131(e,t){"use strict";var i,n,r;Object.defineProperty(t,"__esModule",{value:!0}),t.DEFAULT_MAX_RECEIVE_MESSAGE_LENGTH=t.DEFAULT_MAX_SEND_MESSAGE_LENGTH=t.Propagate=t.LogVerbosity=t.Status=void 0,function(e){e[e.OK=0]="OK",e[e.CANCELLED=1]="CANCELLED",e[e.UNKNOWN=2]="UNKNOWN",e[e.INVALID_ARGUMENT=3]="INVALID_ARGUMENT",e[e.DEADLINE_EXCEEDED=4]="DEADLINE_EXCEEDED",e[e.NOT_FOUND=5]="NOT_FOUND",e[e.ALREADY_EXISTS=6]="ALREADY_EXISTS",e[e.PERMISSION_DENIED=7]="PERMISSION_DENIED",e[e.RESOURCE_EXHAUSTED=8]="RESOURCE_EXHAUSTED",e[e.FAILED_PRECONDITION=9]="FAILED_PRECONDITION",e[e.ABORTED=10]="ABORTED",e[e.OUT_OF_RANGE=11]="OUT_OF_RANGE",e[e.UNIMPLEMENTED=12]="UNIMPLEMENTED",e[e.INTERNAL=13]="INTERNAL",e[e.UNAVAILABLE=14]="UNAVAILABLE",e[e.DATA_LOSS=15]="DATA_LOSS",e[e.UNAUTHENTICATED=16]="UNAUTHENTICATED"}(i||(t.Status=i={})),function(e){e[e.DEBUG=0]="DEBUG",e[e.INFO=1]="INFO",e[e.ERROR=2]="ERROR",e[e.NONE=3]="NONE"}(n||(t.LogVerbosity=n={})),function(e){e[e.DEADLINE=1]="DEADLINE",e[e.CENSUS_STATS_CONTEXT=2]="CENSUS_STATS_CONTEXT",e[e.CENSUS_TRACING_CONTEXT=4]="CENSUS_TRACING_CONTEXT",e[e.CANCELLATION=8]="CANCELLATION",e[e.DEFAULTS=65535]="DEFAULTS"}(r||(t.Propagate=r={})),t.DEFAULT_MAX_SEND_MESSAGE_LENGTH=-1,t.DEFAULT_MAX_RECEIVE_MESSAGE_LENGTH=4194304},6067(e,t,i){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.restrictControlPlaneStatusCode=function(e,t){return r.includes(e)?{code:n.Status.INTERNAL,details:`Invalid status from control plane: ${e} ${n.Status[e]} ${t}`}:{code:e,details:t}};const n=i(131),r=[n.Status.OK,n.Status.INVALID_ARGUMENT,n.Status.NOT_FOUND,n.Status.ALREADY_EXISTS,n.Status.FAILED_PRECONDITION,n.Status.ABORTED,n.Status.OUT_OF_RANGE,n.Status.DATA_LOSS]},6308(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.minDeadline=function(...e){let t=1/0;for(const i of e){const e=i instanceof Date?i.getTime():i;e<t&&(t=e)}return t},t.getDeadlineTimeoutString=function(e){const t=(new Date).getTime();e instanceof Date&&(e=e.getTime());const n=Math.max(e-t,0);for(const[e,t]of i){const i=n/t;if(i<1e8)return String(Math.ceil(i))+e}throw new Error("Deadline is too far in the future")},t.getRelativeTimeout=function(e){const t=e instanceof Date?e.getTime():e,i=(new Date).getTime(),n=t-i;return n<0?0:n>2147483647?1/0:n},t.deadlineToString=function(e){if(e instanceof Date)return e.toISOString();{const t=new Date(e);return Number.isNaN(t.getTime())?""+e:t.toISOString()}},t.formatDateDifference=function(e,t){return((t.getTime()-e.getTime())/1e3).toFixed(3)+"s"};const i=[["m",1],["S",1e3],["M",6e4],["H",36e5]]},4700(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.durationMessageToDuration=function(e){return{seconds:Number.parseInt(e.seconds),nanos:e.nanos}},t.msToDuration=function(e){return{seconds:e/1e3|0,nanos:e%1e3*1e6|0}},t.durationToMs=function(e){return 1e3*e.seconds+e.nanos/1e6|0},t.isDuration=function(e){return"number"==typeof e.seconds&&"number"==typeof e.nanos},t.isDurationMessage=function(e){return"string"==typeof e.seconds&&"number"==typeof e.nanos},t.parseDuration=function(e){const t=e.match(i);if(!t)return null;return{seconds:Number.parseInt(t[1],10),nanos:t[2]?Number.parseInt(t[2].padEnd(9,"0"),10):0}},t.durationToString=function(e){if(0===e.nanos)return`${e.seconds}s`;let t;t=e.nanos%1e6==0?1e6:e.nanos%1e3==0?1e3:1;return`${e.seconds}.${e.nanos/t}s`};const i=/^(\d+)(?:\.(\d+))?s$/},883(e,t){"use strict";var i;Object.defineProperty(t,"__esModule",{value:!0}),t.GRPC_NODE_USE_ALTERNATIVE_RESOLVER=void 0,t.GRPC_NODE_USE_ALTERNATIVE_RESOLVER="true"===(null!==(i=process.env.GRPC_NODE_USE_ALTERNATIVE_RESOLVER)&&void 0!==i?i:"false")},9752(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.getErrorMessage=function(e){return e instanceof Error?e.message:String(e)},t.getErrorCode=function(e){return"object"==typeof e&&null!==e&&"code"in e&&"number"==typeof e.code?e.code:null}},342(e,t,i){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.SUBCHANNEL_ARGS_EXCLUDE_KEY_PREFIX=t.createCertificateProviderChannelCredentials=t.FileWatcherCertificateProvider=t.createCertificateProviderServerCredentials=t.createServerCredentialsWithInterceptors=t.BaseSubchannelWrapper=t.registerAdminService=t.FilterStackFactory=t.BaseFilter=t.statusOrFromError=t.statusOrFromValue=t.PickResultType=t.QueuePicker=t.UnavailablePicker=t.ChildLoadBalancerHandler=t.EndpointMap=t.endpointHasAddress=t.endpointToString=t.subchannelAddressToString=t.LeafLoadBalancer=t.isLoadBalancerNameRegistered=t.parseLoadBalancingConfig=t.selectLbConfigFromList=t.registerLoadBalancerType=t.createChildChannelControlHelper=t.BackoffTimeout=t.parseDuration=t.durationToMs=t.splitHostPort=t.uriToString=t.CHANNEL_ARGS_CONFIG_SELECTOR_KEY=t.createResolver=t.registerResolver=t.log=t.trace=void 0;var n=i(267);Object.defineProperty(t,"trace",{enumerable:!0,get:function(){return n.trace}}),Object.defineProperty(t,"log",{enumerable:!0,get:function(){return n.log}});var r=i(9302);Object.defineProperty(t,"registerResolver",{enumerable:!0,get:function(){return r.registerResolver}}),Object.defineProperty(t,"createResolver",{enumerable:!0,get:function(){return r.createResolver}}),Object.defineProperty(t,"CHANNEL_ARGS_CONFIG_SELECTOR_KEY",{enumerable:!0,get:function(){return r.CHANNEL_ARGS_CONFIG_SELECTOR_KEY}});var s=i(3822);Object.defineProperty(t,"uriToString",{enumerable:!0,get:function(){return s.uriToString}}),Object.defineProperty(t,"splitHostPort",{enumerable:!0,get:function(){return s.splitHostPort}});var o=i(4700);Object.defineProperty(t,"durationToMs",{enumerable:!0,get:function(){return o.durationToMs}}),Object.defineProperty(t,"parseDuration",{enumerable:!0,get:function(){return o.parseDuration}});var a=i(3956);Object.defineProperty(t,"BackoffTimeout",{enumerable:!0,get:function(){return a.BackoffTimeout}});var l=i(8923);Object.defineProperty(t,"createChildChannelControlHelper",{enumerable:!0,get:function(){return l.createChildChannelControlHelper}}),Object.defineProperty(t,"registerLoadBalancerType",{enumerable:!0,get:function(){return l.registerLoadBalancerType}}),Object.defineProperty(t,"selectLbConfigFromList",{enumerable:!0,get:function(){return l.selectLbConfigFromList}}),Object.defineProperty(t,"parseLoadBalancingConfig",{enumerable:!0,get:function(){return l.parseLoadBalancingConfig}}),Object.defineProperty(t,"isLoadBalancerNameRegistered",{enumerable:!0,get:function(){return l.isLoadBalancerNameRegistered}});var c=i(6486);Object.defineProperty(t,"LeafLoadBalancer",{enumerable:!0,get:function(){return c.LeafLoadBalancer}});var u=i(8996);Object.defineProperty(t,"subchannelAddressToString",{enumerable:!0,get:function(){return u.subchannelAddressToString}}),Object.defineProperty(t,"endpointToString",{enumerable:!0,get:function(){return u.endpointToString}}),Object.defineProperty(t,"endpointHasAddress",{enumerable:!0,get:function(){return u.endpointHasAddress}}),Object.defineProperty(t,"EndpointMap",{enumerable:!0,get:function(){return u.EndpointMap}});var h=i(533);Object.defineProperty(t,"ChildLoadBalancerHandler",{enumerable:!0,get:function(){return h.ChildLoadBalancerHandler}});var d=i(178);Object.defineProperty(t,"UnavailablePicker",{enumerable:!0,get:function(){return d.UnavailablePicker}}),Object.defineProperty(t,"QueuePicker",{enumerable:!0,get:function(){return d.QueuePicker}}),Object.defineProperty(t,"PickResultType",{enumerable:!0,get:function(){return d.PickResultType}});var f=i(5034);Object.defineProperty(t,"statusOrFromValue",{enumerable:!0,get:function(){return f.statusOrFromValue}}),Object.defineProperty(t,"statusOrFromError",{enumerable:!0,get:function(){return f.statusOrFromError}});var p=i(2558);Object.defineProperty(t,"BaseFilter",{enumerable:!0,get:function(){return p.BaseFilter}});var g=i(1703);Object.defineProperty(t,"FilterStackFactory",{enumerable:!0,get:function(){return g.FilterStackFactory}});var m=i(2661);Object.defineProperty(t,"registerAdminService",{enumerable:!0,get:function(){return m.registerAdminService}});var v=i(2379);Object.defineProperty(t,"BaseSubchannelWrapper",{enumerable:!0,get:function(){return v.BaseSubchannelWrapper}});var y=i(8692);Object.defineProperty(t,"createServerCredentialsWithInterceptors",{enumerable:!0,get:function(){return y.createServerCredentialsWithInterceptors}}),Object.defineProperty(t,"createCertificateProviderServerCredentials",{enumerable:!0,get:function(){return y.createCertificateProviderServerCredentials}});var b=i(5819);Object.defineProperty(t,"FileWatcherCertificateProvider",{enumerable:!0,get:function(){return b.FileWatcherCertificateProvider}});var S=i(7434);Object.defineProperty(t,"createCertificateProviderChannelCredentials",{enumerable:!0,get:function(){return S.createCertificateProviderChannelCredentials}});var _=i(8899);Object.defineProperty(t,"SUBCHANNEL_ARGS_EXCLUDE_KEY_PREFIX",{enumerable:!0,get:function(){return _.SUBCHANNEL_ARGS_EXCLUDE_KEY_PREFIX}})},1703(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.FilterStackFactory=t.FilterStack=void 0;class i{constructor(e){this.filters=e}sendMetadata(e){let t=e;for(let e=0;e<this.filters.length;e++)t=this.filters[e].sendMetadata(t);return t}receiveMetadata(e){let t=e;for(let e=this.filters.length-1;e>=0;e--)t=this.filters[e].receiveMetadata(t);return t}sendMessage(e){let t=e;for(let e=0;e<this.filters.length;e++)t=this.filters[e].sendMessage(t);return t}receiveMessage(e){let t=e;for(let e=this.filters.length-1;e>=0;e--)t=this.filters[e].receiveMessage(t);return t}receiveTrailers(e){let t=e;for(let e=this.filters.length-1;e>=0;e--)t=this.filters[e].receiveTrailers(t);return t}push(e){this.filters.unshift(...e)}getFilters(){return this.filters}}t.FilterStack=i;class n{constructor(e){this.factories=e}push(e){this.factories.unshift(...e)}clone(){return new n([...this.factories])}createFilter(){return new i(this.factories.map(e=>e.createFilter()))}}t.FilterStackFactory=n},2558(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.BaseFilter=void 0;t.BaseFilter=class{async sendMetadata(e){return e}receiveMetadata(e){return e}async sendMessage(e){return e}async receiveMessage(e){return e}receiveTrailers(e){return e}}},7803(e,t,i){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.parseCIDR=f,t.mapProxyName=function(e,t){var i;const o={target:e,extraOptions:{}};if(0===(null!==(i=t["grpc.enable_http_proxy"])&&void 0!==i?i:1))return o;if("unix"===e.scheme)return o;const a=function(){let e,t="",i="";if(process.env.grpc_proxy)i="grpc_proxy",t=process.env.grpc_proxy;else if(process.env.https_proxy)i="https_proxy",t=process.env.https_proxy;else{if(!process.env.http_proxy)return{};i="http_proxy",t=process.env.http_proxy}try{e=new u.URL(t)}catch(e){return(0,n.log)(r.LogVerbosity.ERROR,`cannot parse value of "${i}" env var`),{}}if("http:"!==e.protocol)return(0,n.log)(r.LogVerbosity.ERROR,`"${e.protocol}" scheme not supported in proxy URI`),{};let s=null;e.username&&(e.password?((0,n.log)(r.LogVerbosity.INFO,"userinfo found in proxy URI"),s=decodeURIComponent(`${e.username}:${e.password}`)):s=e.username);const o=e.hostname;let a=e.port;""===a&&(a="80");const l={address:`${o}:${a}`};s&&(l.creds=s);return d("Proxy server "+l.address+" set by environment variable "+i),l}();if(!a.address)return o;const l=(0,c.splitHostPort)(e.path);if(!l)return o;if(function(e){for(const t of function(){let e=process.env.no_grpc_proxy,t="no_grpc_proxy";e||(e=process.env.no_proxy,t="no_proxy");return e?(d("No proxy server list set by environment variable "+t),e.split(",")):[]}()){const i=f(t);if((0,s.isIPv4)(e)&&i&&g(i,e))return!0;if(e.endsWith(t))return!0}return!1}(l.host))return d("Not using proxy for target in no_proxy list: "+(0,c.uriToString)(e)),o;const h={"grpc.http_connect_target":(0,c.uriToString)(e)};a.creds&&(h["grpc.http_connect_creds"]=a.creds);return{target:{scheme:"dns",path:a.address},extraOptions:h}},t.getProxiedConnection=function(e,t){var i;if(!("grpc.http_connect_target"in t))return Promise.resolve(null);const s=t["grpc.http_connect_target"],a=(0,c.parseUri)(s);if(null===a)return Promise.resolve(null);const u=(0,c.splitHostPort)(a.path);if(null===u)return Promise.resolve(null);const f=`${u.host}:${null!==(i=u.port)&&void 0!==i?i:h.DEFAULT_PORT}`,p={method:"CONNECT",path:f},g={Host:f};(0,l.isTcpSubchannelAddress)(e)?(p.host=e.host,p.port=e.port):p.socketPath=e.path;"grpc.http_connect_creds"in t&&(g["Proxy-Authorization"]="Basic "+Buffer.from(t["grpc.http_connect_creds"]).toString("base64"));p.headers=g;const m=(0,l.subchannelAddressToString)(e);return d("Using proxy "+m+" to connect to "+p.path),new Promise((e,t)=>{const i=o.request(p);i.once("connect",(s,o,a)=>{i.removeAllListeners(),o.removeAllListeners(),200===s.statusCode?(d("Successfully connected to "+p.path+" through proxy "+m),a.length>0&&o.unshift(a),d("Successfully established a plaintext connection to "+p.path+" through proxy "+m),e(o)):((0,n.log)(r.LogVerbosity.ERROR,"Failed to connect to "+p.path+" through proxy "+m+" with status "+s.statusCode),t())}),i.once("error",e=>{i.removeAllListeners(),(0,n.log)(r.LogVerbosity.ERROR,"Failed to connect to proxy "+m+" with error "+e.message),t()}),i.end()})};const n=i(267),r=i(131),s=i(9278),o=i(8611),a=i(267),l=i(8996),c=i(3822),u=i(7016),h=i(6700);function d(e){a.trace(r.LogVerbosity.DEBUG,"proxy",e)}function f(e){const t=e.split("/");if(2!==t.length)return null;const i=parseInt(t[1],10);return!(0,s.isIPv4)(t[0])||Number.isNaN(i)||i<0||i>32?null:{ip:p(t[0]),prefixLength:i}}function p(e){return e.split(".").reduce((e,t)=>(e<<8)+parseInt(t,10),0)}function g(e,t){const i=e.ip,n=-1<<32-e.prefixLength;return(p(t)&n)===(i&n)}},674(e,t,i){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.experimental=t.ServerMetricRecorder=t.ServerInterceptingCall=t.ResponderBuilder=t.ServerListenerBuilder=t.addAdminServicesToServer=t.getChannelzHandlers=t.getChannelzServiceDefinition=t.InterceptorConfigurationError=t.InterceptingCall=t.RequesterBuilder=t.ListenerBuilder=t.StatusBuilder=t.getClientChannel=t.ServerCredentials=t.Server=t.setLogVerbosity=t.setLogger=t.load=t.loadObject=t.CallCredentials=t.ChannelCredentials=t.waitForClientReady=t.closeClient=t.Channel=t.makeGenericClientConstructor=t.makeClientConstructor=t.loadPackageDefinition=t.Client=t.compressionAlgorithms=t.propagate=t.connectivityState=t.status=t.logVerbosity=t.Metadata=t.credentials=void 0;const n=i(2267);Object.defineProperty(t,"CallCredentials",{enumerable:!0,get:function(){return n.CallCredentials}});const r=i(3653);Object.defineProperty(t,"Channel",{enumerable:!0,get:function(){return r.ChannelImplementation}});const s=i(5179);Object.defineProperty(t,"compressionAlgorithms",{enumerable:!0,get:function(){return s.CompressionAlgorithms}});const o=i(463);Object.defineProperty(t,"connectivityState",{enumerable:!0,get:function(){return o.ConnectivityState}});const a=i(7434);Object.defineProperty(t,"ChannelCredentials",{enumerable:!0,get:function(){return a.ChannelCredentials}});const l=i(5563);Object.defineProperty(t,"Client",{enumerable:!0,get:function(){return l.Client}});const c=i(131);Object.defineProperty(t,"logVerbosity",{enumerable:!0,get:function(){return c.LogVerbosity}}),Object.defineProperty(t,"status",{enumerable:!0,get:function(){return c.Status}}),Object.defineProperty(t,"propagate",{enumerable:!0,get:function(){return c.Propagate}});const u=i(267),h=i(4056);Object.defineProperty(t,"loadPackageDefinition",{enumerable:!0,get:function(){return h.loadPackageDefinition}}),Object.defineProperty(t,"makeClientConstructor",{enumerable:!0,get:function(){return h.makeClientConstructor}}),Object.defineProperty(t,"makeGenericClientConstructor",{enumerable:!0,get:function(){return h.makeClientConstructor}});const d=i(4097);Object.defineProperty(t,"Metadata",{enumerable:!0,get:function(){return d.Metadata}});const f=i(5943);Object.defineProperty(t,"Server",{enumerable:!0,get:function(){return f.Server}});const p=i(8692);Object.defineProperty(t,"ServerCredentials",{enumerable:!0,get:function(){return p.ServerCredentials}});const g=i(2284);Object.defineProperty(t,"StatusBuilder",{enumerable:!0,get:function(){return g.StatusBuilder}}),t.credentials={combineChannelCredentials:(e,...t)=>t.reduce((e,t)=>e.compose(t),e),combineCallCredentials:(e,...t)=>t.reduce((e,t)=>e.compose(t),e),createInsecure:a.ChannelCredentials.createInsecure,createSsl:a.ChannelCredentials.createSsl,createFromSecureContext:a.ChannelCredentials.createFromSecureContext,createFromMetadataGenerator:n.CallCredentials.createFromMetadataGenerator,createFromGoogleCredential:n.CallCredentials.createFromGoogleCredential,createEmpty:n.CallCredentials.createEmpty};t.closeClient=e=>e.close();t.waitForClientReady=(e,t,i)=>e.waitForReady(t,i);t.loadObject=(e,t)=>{throw new Error("Not available in this library. Use @grpc/proto-loader and loadPackageDefinition instead")};t.load=(e,t,i)=>{throw new Error("Not available in this library. Use @grpc/proto-loader and loadPackageDefinition instead")};t.setLogger=e=>{u.setLogger(e)};t.setLogVerbosity=e=>{u.setLoggerVerbosity(e)};t.getClientChannel=e=>l.Client.prototype.getChannel.call(e);var m=i(3952);Object.defineProperty(t,"ListenerBuilder",{enumerable:!0,get:function(){return m.ListenerBuilder}}),Object.defineProperty(t,"RequesterBuilder",{enumerable:!0,get:function(){return m.RequesterBuilder}}),Object.defineProperty(t,"InterceptingCall",{enumerable:!0,get:function(){return m.InterceptingCall}}),Object.defineProperty(t,"InterceptorConfigurationError",{enumerable:!0,get:function(){return m.InterceptorConfigurationError}});var v=i(9503);Object.defineProperty(t,"getChannelzServiceDefinition",{enumerable:!0,get:function(){return v.getChannelzServiceDefinition}}),Object.defineProperty(t,"getChannelzHandlers",{enumerable:!0,get:function(){return v.getChannelzHandlers}});var y=i(2661);Object.defineProperty(t,"addAdminServicesToServer",{enumerable:!0,get:function(){return y.addAdminServicesToServer}});var b=i(4892);Object.defineProperty(t,"ServerListenerBuilder",{enumerable:!0,get:function(){return b.ServerListenerBuilder}}),Object.defineProperty(t,"ResponderBuilder",{enumerable:!0,get:function(){return b.ResponderBuilder}}),Object.defineProperty(t,"ServerInterceptingCall",{enumerable:!0,get:function(){return b.ServerInterceptingCall}});var S=i(2921);Object.defineProperty(t,"ServerMetricRecorder",{enumerable:!0,get:function(){return S.ServerMetricRecorder}});const _=i(342);t.experimental=_;const C=i(6700),E=i(305),w=i(82),T=i(6486),k=i(1563),R=i(9012),O=i(4117),A=i(9503);C.setup(),E.setup(),w.setup(),T.setup(),k.setup(),R.setup(),O.setup(),A.setup()},8899(e,t,i){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.InternalChannel=t.SUBCHANNEL_ARGS_EXCLUDE_KEY_PREFIX=void 0;const n=i(7434),r=i(4973),s=i(5716),o=i(178),a=i(4097),l=i(131),c=i(1703),u=i(4987),h=i(9302),d=i(267),f=i(7803),p=i(3822),g=i(463),m=i(9503),v=i(2611),y=i(6308),b=i(8446),S=i(5572),_=i(6067),C=i(3135),E=i(2379),w=new Map;class T extends E.BaseSubchannelWrapper{constructor(e,t){super(e),this.channel=t,this.refCount=0,this.subchannelStateListener=(e,i,n,r)=>{t.throttleKeepalive(r)}}ref(){0===this.refCount&&(this.child.addConnectivityStateListener(this.subchannelStateListener),this.channel.addWrappedSubchannel(this)),this.child.ref(),this.refCount+=1}unref(){this.child.unref(),this.refCount-=1,this.refCount<=0&&(this.child.removeConnectivityStateListener(this.subchannelStateListener),this.channel.removeWrappedSubchannel(this))}}class k{pick(e){return{pickResultType:o.PickResultType.DROP,status:{code:l.Status.UNAVAILABLE,details:"Channel closed before call started",metadata:new a.Metadata},subchannel:null,onCallStarted:null,onCallEnded:null}}}t.SUBCHANNEL_ARGS_EXCLUDE_KEY_PREFIX="grpc.internal.no_subchannel";class R{constructor(e){this.target=e,this.trace=new m.ChannelzTrace,this.callTracker=new m.ChannelzCallTracker,this.childrenTracker=new m.ChannelzChildrenTracker,this.state=g.ConnectivityState.IDLE}getChannelzInfoCallback(){return()=>({target:this.target,state:this.state,trace:this.trace,callTracker:this.callTracker,children:this.childrenTracker.getChildLists()})}}t.InternalChannel=class{constructor(e,i,a){var v,y,b,S,E,k;if(this.credentials=i,this.options=a,this.connectivityState=g.ConnectivityState.IDLE,this.currentPicker=new o.UnavailablePicker,this.configSelectionQueue=[],this.pickQueue=[],this.connectivityStateWatchers=[],this.callRefTimer=null,this.configSelector=null,this.currentResolutionError=null,this.wrappedSubchannels=new Set,this.callCount=0,this.idleTimer=null,this.channelzEnabled=!0,this.randomChannelId=Math.floor(Math.random()*Number.MAX_SAFE_INTEGER),"string"!=typeof e)throw new TypeError("Channel target must be a string");if(!(i instanceof n.ChannelCredentials))throw new TypeError("Channel credentials must be a ChannelCredentials object");if(a&&"object"!=typeof a)throw new TypeError("Channel options must be an object");this.channelzInfoTracker=new R(e);const O=(0,p.parseUri)(e);if(null===O)throw new Error(`Could not parse target name "${e}"`);const A=(0,h.mapUriDefaultScheme)(O);if(null===A)throw new Error(`Could not find a default scheme for target name "${e}"`);0===this.options["grpc.enable_channelz"]&&(this.channelzEnabled=!1),this.channelzRef=(0,m.registerChannelzChannel)(e,this.channelzInfoTracker.getChannelzInfoCallback(),this.channelzEnabled),this.channelzEnabled&&this.channelzInfoTracker.trace.addTrace("CT_INFO","Channel created"),this.options["grpc.default_authority"]?this.defaultAuthority=this.options["grpc.default_authority"]:this.defaultAuthority=(0,h.getDefaultAuthority)(A);const P=(0,f.mapProxyName)(A,a);this.target=P.target,this.options=Object.assign({},this.options,P.extraOptions),this.subchannelPool=(0,s.getSubchannelPool)(0===(null!==(v=this.options["grpc.use_local_subchannel_pool"])&&void 0!==v?v:0)),this.retryBufferTracker=new C.MessageBufferTracker(null!==(y=this.options["grpc.retry_buffer_size"])&&void 0!==y?y:16777216,null!==(b=this.options["grpc.per_rpc_retry_buffer_size"])&&void 0!==b?b:1048576),this.keepaliveTime=null!==(S=this.options["grpc.keepalive_time_ms"])&&void 0!==S?S:-1,this.idleTimeoutMs=Math.max(null!==(E=this.options["grpc.client_idle_timeout_ms"])&&void 0!==E?E:18e5,1e3);const N={createSubchannel:(e,i)=>{const n={};for(const[e,r]of Object.entries(i))e.startsWith(t.SUBCHANNEL_ARGS_EXCLUDE_KEY_PREFIX)||(n[e]=r);const r=this.subchannelPool.getOrCreateSubchannel(this.target,e,n,this.credentials);r.throttleKeepalive(this.keepaliveTime),this.channelzEnabled&&this.channelzInfoTracker.trace.addTrace("CT_INFO","Created subchannel or used existing subchannel",r.getChannelzRef());return new T(r,this)},updateState:(e,t)=>{this.currentPicker=t;const i=this.pickQueue.slice();this.pickQueue=[],i.length>0&&this.callRefTimerUnref();for(const e of i)e.doPick();this.updateState(e)},requestReresolution:()=>{throw new Error("Resolving load balancer should never call requestReresolution")},addChannelzChild:e=>{this.channelzEnabled&&this.channelzInfoTracker.childrenTracker.refChild(e)},removeChannelzChild:e=>{this.channelzEnabled&&this.channelzInfoTracker.childrenTracker.unrefChild(e)}};this.resolvingLoadBalancer=new r.ResolvingLoadBalancer(this.target,N,this.options,(e,t)=>{var i;e.retryThrottling?w.set(this.getTarget(),new C.RetryThrottler(e.retryThrottling.maxTokens,e.retryThrottling.tokenRatio,w.get(this.getTarget()))):w.delete(this.getTarget()),this.channelzEnabled&&this.channelzInfoTracker.trace.addTrace("CT_INFO","Address resolution succeeded"),null===(i=this.configSelector)||void 0===i||i.unref(),this.configSelector=t,this.currentResolutionError=null,process.nextTick(()=>{const e=this.configSelectionQueue;this.configSelectionQueue=[],e.length>0&&this.callRefTimerUnref();for(const t of e)t.getConfig()})},e=>{this.channelzEnabled&&this.channelzInfoTracker.trace.addTrace("CT_WARNING","Address resolution failed with code "+e.code+' and details "'+e.details+'"'),this.configSelectionQueue.length>0&&this.trace("Name resolution failed with calls queued for config selection"),null===this.configSelector&&(this.currentResolutionError=Object.assign(Object.assign({},(0,_.restrictControlPlaneStatusCode)(e.code,e.details)),{metadata:e.metadata}));const t=this.configSelectionQueue;this.configSelectionQueue=[],t.length>0&&this.callRefTimerUnref();for(const i of t)i.reportResolverError(e)}),this.filterStackFactory=new c.FilterStackFactory([new u.CompressionFilterFactory(this,this.options)]),this.trace("Channel constructed with options "+JSON.stringify(a,void 0,2));const x=new Error;(0,d.isTracerEnabled)("channel_stacktrace")&&(0,d.trace)(l.LogVerbosity.DEBUG,"channel_stacktrace","("+this.channelzRef.id+") Channel constructed \n"+(null===(k=x.stack)||void 0===k?void 0:k.substring(x.stack.indexOf("\n")+1))),this.lastActivityTimestamp=new Date}trace(e,t){(0,d.trace)(null!=t?t:l.LogVerbosity.DEBUG,"channel","("+this.channelzRef.id+") "+(0,p.uriToString)(this.target)+" "+e)}callRefTimerRef(){var e,t,i,n;this.callRefTimer||(this.callRefTimer=setInterval(()=>{},2147483647)),(null===(t=(e=this.callRefTimer).hasRef)||void 0===t?void 0:t.call(e))||(this.trace("callRefTimer.ref | configSelectionQueue.length="+this.configSelectionQueue.length+" pickQueue.length="+this.pickQueue.length),null===(n=(i=this.callRefTimer).ref)||void 0===n||n.call(i))}callRefTimerUnref(){var e,t,i;(null===(e=this.callRefTimer)||void 0===e?void 0:e.hasRef)&&!this.callRefTimer.hasRef()||(this.trace("callRefTimer.unref | configSelectionQueue.length="+this.configSelectionQueue.length+" pickQueue.length="+this.pickQueue.length),null===(i=null===(t=this.callRefTimer)||void 0===t?void 0:t.unref)||void 0===i||i.call(t))}removeConnectivityStateWatcher(e){const t=this.connectivityStateWatchers.findIndex(t=>t===e);t>=0&&this.connectivityStateWatchers.splice(t,1)}updateState(e){(0,d.trace)(l.LogVerbosity.DEBUG,"connectivity_state","("+this.channelzRef.id+") "+(0,p.uriToString)(this.target)+" "+g.ConnectivityState[this.connectivityState]+" -> "+g.ConnectivityState[e]),this.channelzEnabled&&this.channelzInfoTracker.trace.addTrace("CT_INFO","Connectivity state change to "+g.ConnectivityState[e]),this.connectivityState=e,this.channelzInfoTracker.state=e;const t=this.connectivityStateWatchers.slice();for(const i of t)e!==i.currentState&&(i.timer&&clearTimeout(i.timer),this.removeConnectivityStateWatcher(i),i.callback());e!==g.ConnectivityState.TRANSIENT_FAILURE&&(this.currentResolutionError=null)}throttleKeepalive(e){if(e>this.keepaliveTime){this.keepaliveTime=e;for(const t of this.wrappedSubchannels)t.throttleKeepalive(e)}}addWrappedSubchannel(e){this.wrappedSubchannels.add(e)}removeWrappedSubchannel(e){this.wrappedSubchannels.delete(e)}doPick(e,t){return this.currentPicker.pick({metadata:e,extraPickInfo:t})}queueCallForPick(e){this.pickQueue.push(e),this.callRefTimerRef()}getConfig(e,t){return this.connectivityState!==g.ConnectivityState.SHUTDOWN&&this.resolvingLoadBalancer.exitIdle(),this.configSelector?{type:"SUCCESS",config:this.configSelector.invoke(e,t,this.randomChannelId)}:this.currentResolutionError?{type:"ERROR",error:this.currentResolutionError}:{type:"NONE"}}queueCallForConfig(e){this.configSelectionQueue.push(e),this.callRefTimerRef()}enterIdle(){this.resolvingLoadBalancer.destroy(),this.updateState(g.ConnectivityState.IDLE),this.currentPicker=new o.QueuePicker(this.resolvingLoadBalancer),this.idleTimer&&(clearTimeout(this.idleTimer),this.idleTimer=null),this.callRefTimer&&(clearInterval(this.callRefTimer),this.callRefTimer=null)}startIdleTimeout(e){var t,i;this.idleTimer=setTimeout(()=>{if(this.callCount>0)return void this.startIdleTimeout(this.idleTimeoutMs);const e=(new Date).valueOf()-this.lastActivityTimestamp.valueOf();e>=this.idleTimeoutMs?(this.trace("Idle timer triggered after "+this.idleTimeoutMs+"ms of inactivity"),this.enterIdle()):this.startIdleTimeout(this.idleTimeoutMs-e)},e),null===(i=(t=this.idleTimer).unref)||void 0===i||i.call(t)}maybeStartIdleTimer(){this.connectivityState===g.ConnectivityState.SHUTDOWN||this.idleTimer||this.startIdleTimeout(this.idleTimeoutMs)}onCallStart(){this.channelzEnabled&&this.channelzInfoTracker.callTracker.addCallStarted(),this.callCount+=1}onCallEnd(e){this.channelzEnabled&&(e.code===l.Status.OK?this.channelzInfoTracker.callTracker.addCallSucceeded():this.channelzInfoTracker.callTracker.addCallFailed()),this.callCount-=1,this.lastActivityTimestamp=new Date,this.maybeStartIdleTimer()}createLoadBalancingCall(e,t,i,n,r){const s=(0,S.getNextCallNumber)();return this.trace("createLoadBalancingCall ["+s+'] method="'+t+'"'),new v.LoadBalancingCall(this,e,t,i,n,r,s)}createRetryingCall(e,t,i,n,r){const s=(0,S.getNextCallNumber)();return this.trace("createRetryingCall ["+s+'] method="'+t+'"'),new C.RetryingCall(this,e,t,i,n,r,s,this.retryBufferTracker,w.get(this.getTarget()))}createResolvingCall(e,t,i,n,r){const s=(0,S.getNextCallNumber)();this.trace("createResolvingCall ["+s+'] method="'+e+'", deadline='+(0,y.deadlineToString)(t));const o={deadline:t,flags:null!=r?r:l.Propagate.DEFAULTS,host:null!=i?i:this.defaultAuthority,parentCall:n},a=new b.ResolvingCall(this,e,o,this.filterStackFactory.clone(),s);return this.onCallStart(),a.addStatusWatcher(e=>{this.onCallEnd(e)}),a}close(){var e;this.resolvingLoadBalancer.destroy(),this.updateState(g.ConnectivityState.SHUTDOWN),this.currentPicker=new k;for(const e of this.configSelectionQueue)e.cancelWithStatus(l.Status.UNAVAILABLE,"Channel closed before call started");this.configSelectionQueue=[];for(const e of this.pickQueue)e.cancelWithStatus(l.Status.UNAVAILABLE,"Channel closed before call started");this.pickQueue=[],this.callRefTimer&&clearInterval(this.callRefTimer),this.idleTimer&&clearTimeout(this.idleTimer),this.channelzEnabled&&(0,m.unregisterChannelzRef)(this.channelzRef),this.subchannelPool.unrefUnusedSubchannels(),null===(e=this.configSelector)||void 0===e||e.unref(),this.configSelector=null}getTarget(){return(0,p.uriToString)(this.target)}getConnectivityState(e){const t=this.connectivityState;return e&&(this.resolvingLoadBalancer.exitIdle(),this.lastActivityTimestamp=new Date,this.maybeStartIdleTimer()),t}watchConnectivityState(e,t,i){if(this.connectivityState===g.ConnectivityState.SHUTDOWN)throw new Error("Channel has been shut down");let n=null;if(t!==1/0){const e=t instanceof Date?t:new Date(t),s=new Date;if(t===-1/0||e<=s)return void process.nextTick(i,new Error("Deadline passed without connectivity state change"));n=setTimeout(()=>{this.removeConnectivityStateWatcher(r),i(new Error("Deadline passed without connectivity state change"))},e.getTime()-s.getTime())}const r={currentState:e,callback:i,timer:n};this.connectivityStateWatchers.push(r)}getChannelzRef(){return this.channelzRef}createCall(e,t,i,n,r){if("string"!=typeof e)throw new TypeError("Channel#createCall: method must be a string");if(!("number"==typeof t||t instanceof Date))throw new TypeError("Channel#createCall: deadline must be a number or Date");if(this.connectivityState===g.ConnectivityState.SHUTDOWN)throw new Error("Channel has been shut down");return this.createResolvingCall(e,t,i,n,r)}getOptions(){return this.options}}},533(e,t,i){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ChildLoadBalancerHandler=void 0;const n=i(8923),r=i(463);t.ChildLoadBalancerHandler=class{constructor(e){this.channelControlHelper=e,this.currentChild=null,this.pendingChild=null,this.latestConfig=null,this.ChildPolicyHelper=class{constructor(e){this.parent=e,this.child=null}createSubchannel(e,t){return this.parent.channelControlHelper.createSubchannel(e,t)}updateState(e,t,i){var n;if(this.calledByPendingChild()){if(e===r.ConnectivityState.CONNECTING)return;null===(n=this.parent.currentChild)||void 0===n||n.destroy(),this.parent.currentChild=this.parent.pendingChild,this.parent.pendingChild=null}else if(!this.calledByCurrentChild())return;this.parent.channelControlHelper.updateState(e,t,i)}requestReresolution(){var e;const t=null!==(e=this.parent.pendingChild)&&void 0!==e?e:this.parent.currentChild;this.child===t&&this.parent.channelControlHelper.requestReresolution()}setChild(e){this.child=e}addChannelzChild(e){this.parent.channelControlHelper.addChannelzChild(e)}removeChannelzChild(e){this.parent.channelControlHelper.removeChannelzChild(e)}calledByPendingChild(){return this.child===this.parent.pendingChild}calledByCurrentChild(){return this.child===this.parent.currentChild}}}configUpdateRequiresNewPolicyInstance(e,t){return e.getLoadBalancerName()!==t.getLoadBalancerName()}updateAddressList(e,t,i,r){let s;if(null===this.currentChild||null===this.latestConfig||this.configUpdateRequiresNewPolicyInstance(this.latestConfig,t)){const e=new this.ChildPolicyHelper(this),i=(0,n.createLoadBalancer)(t,e);e.setChild(i),null===this.currentChild?(this.currentChild=i,s=this.currentChild):(this.pendingChild&&this.pendingChild.destroy(),this.pendingChild=i,s=this.pendingChild)}else s=null===this.pendingChild?this.currentChild:this.pendingChild;return this.latestConfig=t,s.updateAddressList(e,t,i,r)}exitIdle(){this.currentChild&&(this.currentChild.exitIdle(),this.pendingChild&&this.pendingChild.exitIdle())}resetBackoff(){this.currentChild&&(this.currentChild.resetBackoff(),this.pendingChild&&this.pendingChild.resetBackoff())}destroy(){this.currentChild&&(this.currentChild.destroy(),this.currentChild=null),this.pendingChild&&(this.pendingChild.destroy(),this.pendingChild=null)}getTypeName(){return"child_load_balancer_helper"}}},9012(e,t,i){"use strict";var n;Object.defineProperty(t,"__esModule",{value:!0}),t.OutlierDetectionLoadBalancer=t.OutlierDetectionLoadBalancingConfig=void 0,t.setup=function(){m&&(0,a.registerLoadBalancerType)(g,k,C)};const r=i(463),s=i(131),o=i(4700),a=i(342),l=i(8923),c=i(533),u=i(178),h=i(8996),d=i(2379),f=i(267);function p(e){f.trace(s.LogVerbosity.DEBUG,"outlier_detection",e)}const g="outlier_detection",m="true"===(null!==(n=process.env.GRPC_EXPERIMENTAL_ENABLE_OUTLIER_DETECTION)&&void 0!==n?n:"true"),v={stdev_factor:1900,enforcement_percentage:100,minimum_hosts:5,request_volume:100},y={threshold:85,enforcement_percentage:100,minimum_hosts:5,request_volume:50};function b(e,t,i,n){if(t in e&&void 0!==e[t]&&typeof e[t]!==i){throw new Error(`outlier detection config ${n?`${n}.${t}`:t} parse error: expected ${i}, got ${typeof e[t]}`)}}function S(e,t,i){const n=i?`${i}.${t}`:t;if(t in e&&void 0!==e[t]){if(!(0,o.isDuration)(e[t]))throw new Error(`outlier detection config ${n} parse error: expected Duration, got ${typeof e[t]}`);if(!(e[t].seconds>=0&&e[t].seconds<=315576e6&&e[t].nanos>=0&&e[t].nanos<=999999999))throw new Error(`outlier detection config ${n} parse error: values out of range for non-negative Duaration`)}}function _(e,t,i){const n=i?`${i}.${t}`:t;if(b(e,t,"number",i),t in e&&void 0!==e[t]&&!(e[t]>=0&&e[t]<=100))throw new Error(`outlier detection config ${n} parse error: value out of range for percentage (0-100)`)}class C{constructor(e,t,i,n,r,s,o){if(this.childPolicy=o,"pick_first"===o.getLoadBalancerName())throw new Error("outlier_detection LB policy cannot have a pick_first child policy");this.intervalMs=null!=e?e:1e4,this.baseEjectionTimeMs=null!=t?t:3e4,this.maxEjectionTimeMs=null!=i?i:3e5,this.maxEjectionPercent=null!=n?n:10,this.successRateEjection=r?Object.assign(Object.assign({},v),r):null,this.failurePercentageEjection=s?Object.assign(Object.assign({},y),s):null}getLoadBalancerName(){return g}toJsonObject(){var e,t;return{outlier_detection:{interval:(0,o.msToDuration)(this.intervalMs),base_ejection_time:(0,o.msToDuration)(this.baseEjectionTimeMs),max_ejection_time:(0,o.msToDuration)(this.maxEjectionTimeMs),max_ejection_percent:this.maxEjectionPercent,success_rate_ejection:null!==(e=this.successRateEjection)&&void 0!==e?e:void 0,failure_percentage_ejection:null!==(t=this.failurePercentageEjection)&&void 0!==t?t:void 0,child_policy:[this.childPolicy.toJsonObject()]}}}getIntervalMs(){return this.intervalMs}getBaseEjectionTimeMs(){return this.baseEjectionTimeMs}getMaxEjectionTimeMs(){return this.maxEjectionTimeMs}getMaxEjectionPercent(){return this.maxEjectionPercent}getSuccessRateEjectionConfig(){return this.successRateEjection}getFailurePercentageEjectionConfig(){return this.failurePercentageEjection}getChildPolicy(){return this.childPolicy}static createFromJson(e){var t;if(S(e,"interval"),S(e,"base_ejection_time"),S(e,"max_ejection_time"),_(e,"max_ejection_percent"),"success_rate_ejection"in e&&void 0!==e.success_rate_ejection){if("object"!=typeof e.success_rate_ejection)throw new Error("outlier detection config success_rate_ejection must be an object");b(e.success_rate_ejection,"stdev_factor","number","success_rate_ejection"),_(e.success_rate_ejection,"enforcement_percentage","success_rate_ejection"),b(e.success_rate_ejection,"minimum_hosts","number","success_rate_ejection"),b(e.success_rate_ejection,"request_volume","number","success_rate_ejection")}if("failure_percentage_ejection"in e&&void 0!==e.failure_percentage_ejection){if("object"!=typeof e.failure_percentage_ejection)throw new Error("outlier detection config failure_percentage_ejection must be an object");_(e.failure_percentage_ejection,"threshold","failure_percentage_ejection"),_(e.failure_percentage_ejection,"enforcement_percentage","failure_percentage_ejection"),b(e.failure_percentage_ejection,"minimum_hosts","number","failure_percentage_ejection"),b(e.failure_percentage_ejection,"request_volume","number","failure_percentage_ejection")}if(!("child_policy"in e)||!Array.isArray(e.child_policy))throw new Error("outlier detection config child_policy must be an array");const i=(0,l.selectLbConfigFromList)(e.child_policy);if(!i)throw new Error("outlier detection config child_policy: no valid recognized policy found");return new C(e.interval?(0,o.durationToMs)(e.interval):null,e.base_ejection_time?(0,o.durationToMs)(e.base_ejection_time):null,e.max_ejection_time?(0,o.durationToMs)(e.max_ejection_time):null,null!==(t=e.max_ejection_percent)&&void 0!==t?t:null,e.success_rate_ejection,e.failure_percentage_ejection,i)}}t.OutlierDetectionLoadBalancingConfig=C;class E extends d.BaseSubchannelWrapper{constructor(e,t){super(e),this.mapEntry=t,this.refCount=0}ref(){this.child.ref(),this.refCount+=1}unref(){if(this.child.unref(),this.refCount-=1,this.refCount<=0&&this.mapEntry){const e=this.mapEntry.subchannelWrappers.indexOf(this);e>=0&&this.mapEntry.subchannelWrappers.splice(e,1)}}eject(){this.setHealthy(!1)}uneject(){this.setHealthy(!0)}getMapEntry(){return this.mapEntry}getWrappedSubchannel(){return this.child}}class w{constructor(){this.activeBucket={success:0,failure:0},this.inactiveBucket={success:0,failure:0}}addSuccess(){this.activeBucket.success+=1}addFailure(){this.activeBucket.failure+=1}switchBuckets(){this.inactiveBucket=this.activeBucket,this.activeBucket={success:0,failure:0}}getLastSuccesses(){return this.inactiveBucket.success}getLastFailures(){return this.inactiveBucket.failure}}class T{constructor(e,t){this.wrappedPicker=e,this.countCalls=t}pick(e){const t=this.wrappedPicker.pick(e);if(t.pickResultType===u.PickResultType.COMPLETE){const e=t.subchannel,i=e.getMapEntry();if(i){let n=t.onCallEnded;return this.countCalls&&(n=(e,n,r)=>{var o;e===s.Status.OK?i.counter.addSuccess():i.counter.addFailure(),null===(o=t.onCallEnded)||void 0===o||o.call(t,e,n,r)}),Object.assign(Object.assign({},t),{subchannel:e.getWrappedSubchannel(),onCallEnded:n})}return Object.assign(Object.assign({},t),{subchannel:e.getWrappedSubchannel()})}return t}}class k{constructor(e){this.entryMap=new h.EndpointMap,this.latestConfig=null,this.timerStartTime=null,this.childBalancer=new c.ChildLoadBalancerHandler((0,a.createChildChannelControlHelper)(e,{createSubchannel:(t,i)=>{const n=e.createSubchannel(t,i),r=this.entryMap.getForSubchannelAddress(t),s=new E(n,r);return null!==(null==r?void 0:r.currentEjectionTimestamp)&&s.eject(),null==r||r.subchannelWrappers.push(s),s},updateState:(t,i,n)=>{t===r.ConnectivityState.READY?e.updateState(t,new T(i,this.isCountingEnabled()),n):e.updateState(t,i,n)}})),this.ejectionTimer=setInterval(()=>{},0),clearInterval(this.ejectionTimer)}isCountingEnabled(){return null!==this.latestConfig&&(null!==this.latestConfig.getSuccessRateEjectionConfig()||null!==this.latestConfig.getFailurePercentageEjectionConfig())}getCurrentEjectionPercent(){let e=0;for(const t of this.entryMap.values())null!==t.currentEjectionTimestamp&&(e+=1);return 100*e/this.entryMap.size}runSuccessRateCheck(e){if(!this.latestConfig)return;const t=this.latestConfig.getSuccessRateEjectionConfig();if(!t)return;p("Running success rate check");const i=t.request_volume;let n=0;const r=[];for(const[e,t]of this.entryMap.entries()){const s=t.counter.getLastSuccesses(),o=t.counter.getLastFailures();p("Stats for "+(0,h.endpointToString)(e)+": successes="+s+" failures="+o+" targetRequestVolume="+i),s+o>=i&&(n+=1,r.push(s/(s+o)))}if(p("Found "+n+" success rate candidates; currentEjectionPercent="+this.getCurrentEjectionPercent()+" successRates=["+r+"]"),n<t.minimum_hosts)return;const s=r.reduce((e,t)=>e+t)/r.length;let o=0;for(const e of r){const t=e-s;o+=t*t}const a=o/r.length,l=Math.sqrt(a),c=s-l*(t.stdev_factor/1e3);p("stdev="+l+" ejectionThreshold="+c);for(const[n,r]of this.entryMap.entries()){if(this.getCurrentEjectionPercent()>=this.latestConfig.getMaxEjectionPercent())break;const s=r.counter.getLastSuccesses(),o=r.counter.getLastFailures();if(s+o<i)continue;const a=s/(s+o);if(p("Checking candidate "+n+" successRate="+a),a<c){const i=100*Math.random();p("Candidate "+n+" randomNumber="+i+" enforcement_percentage="+t.enforcement_percentage),i<t.enforcement_percentage&&(p("Ejecting candidate "+n),this.eject(r,e))}}}runFailurePercentageCheck(e){if(!this.latestConfig)return;const t=this.latestConfig.getFailurePercentageEjectionConfig();if(!t)return;p("Running failure percentage check. threshold="+t.threshold+" request volume threshold="+t.request_volume);let i=0;for(const e of this.entryMap.values()){e.counter.getLastSuccesses()+e.counter.getLastFailures()>=t.request_volume&&(i+=1)}if(!(i<t.minimum_hosts))for(const[i,n]of this.entryMap.entries()){if(this.getCurrentEjectionPercent()>=this.latestConfig.getMaxEjectionPercent())break;const r=n.counter.getLastSuccesses(),s=n.counter.getLastFailures();if(p("Candidate successes="+r+" failures="+s),r+s<t.request_volume)continue;if(100*s/(s+r)>t.threshold){const r=100*Math.random();p("Candidate "+i+" randomNumber="+r+" enforcement_percentage="+t.enforcement_percentage),r<t.enforcement_percentage&&(p("Ejecting candidate "+i),this.eject(n,e))}}}eject(e,t){e.currentEjectionTimestamp=new Date,e.ejectionTimeMultiplier+=1;for(const t of e.subchannelWrappers)t.eject()}uneject(e){e.currentEjectionTimestamp=null;for(const t of e.subchannelWrappers)t.uneject()}switchAllBuckets(){for(const e of this.entryMap.values())e.counter.switchBuckets()}startTimer(e){var t,i;this.ejectionTimer=setTimeout(()=>this.runChecks(),e),null===(i=(t=this.ejectionTimer).unref)||void 0===i||i.call(t)}runChecks(){const e=new Date;if(p("Ejection timer running"),this.switchAllBuckets(),this.latestConfig){this.timerStartTime=e,this.startTimer(this.latestConfig.getIntervalMs()),this.runSuccessRateCheck(e),this.runFailurePercentageCheck(e);for(const[e,t]of this.entryMap.entries())if(null===t.currentEjectionTimestamp)t.ejectionTimeMultiplier>0&&(t.ejectionTimeMultiplier-=1);else{const i=this.latestConfig.getBaseEjectionTimeMs(),n=this.latestConfig.getMaxEjectionTimeMs(),r=new Date(t.currentEjectionTimestamp.getTime());r.setMilliseconds(r.getMilliseconds()+Math.min(i*t.ejectionTimeMultiplier,Math.max(i,n))),r<new Date&&(p("Unejecting "+e),this.uneject(t))}}}updateAddressList(e,t,i,n){if(!(t instanceof C))return!1;if(p("Received update with config: "+JSON.stringify(t.toJsonObject(),void 0,2)),e.ok){for(const t of e.value)this.entryMap.has(t)||(p("Adding map entry for "+(0,h.endpointToString)(t)),this.entryMap.set(t,{counter:new w,currentEjectionTimestamp:null,ejectionTimeMultiplier:0,subchannelWrappers:[]}));this.entryMap.deleteMissing(e.value)}const r=t.getChildPolicy();if(this.childBalancer.updateAddressList(e,r,i,n),t.getSuccessRateEjectionConfig()||t.getFailurePercentageEjectionConfig())if(this.timerStartTime){p("Previous timer existed. Replacing timer"),clearTimeout(this.ejectionTimer);const e=t.getIntervalMs()-((new Date).getTime()-this.timerStartTime.getTime());this.startTimer(e)}else p("Starting new timer"),this.timerStartTime=new Date,this.startTimer(t.getIntervalMs()),this.switchAllBuckets();else{p("Counting disabled. Cancelling timer."),this.timerStartTime=null,clearTimeout(this.ejectionTimer);for(const e of this.entryMap.values())this.uneject(e),e.ejectionTimeMultiplier=0}return this.latestConfig=t,!0}exitIdle(){this.childBalancer.exitIdle()}resetBackoff(){this.childBalancer.resetBackoff()}destroy(){clearTimeout(this.ejectionTimer),this.childBalancer.destroy()}getTypeName(){return g}}t.OutlierDetectionLoadBalancer=k},6486(e,t,i){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.LeafLoadBalancer=t.PickFirstLoadBalancer=t.PickFirstLoadBalancingConfig=void 0,t.shuffled=m,t.setup=function(){(0,n.registerLoadBalancerType)(f,y,p),(0,n.registerDefaultLoadBalancerType)(f)};const n=i(8923),r=i(463),s=i(178),o=i(8996),a=i(267),l=i(131),c=i(8996),u=i(9278),h=i(5034);function d(e){a.trace(l.LogVerbosity.DEBUG,"pick_first",e)}const f="pick_first";class p{constructor(e){this.shuffleAddressList=e}getLoadBalancerName(){return f}toJsonObject(){return{[f]:{shuffleAddressList:this.shuffleAddressList}}}getShuffleAddressList(){return this.shuffleAddressList}static createFromJson(e){if("shuffleAddressList"in e&&"boolean"!=typeof e.shuffleAddressList)throw new Error("pick_first config field shuffleAddressList must be a boolean if provided");return new p(!0===e.shuffleAddressList)}}t.PickFirstLoadBalancingConfig=p;class g{constructor(e){this.subchannel=e}pick(e){return{pickResultType:s.PickResultType.COMPLETE,subchannel:this.subchannel,status:null,onCallStarted:null,onCallEnded:null}}}function m(e){const t=e.slice();for(let e=t.length-1;e>1;e--){const i=Math.floor(Math.random()*(e+1)),n=t[e];t[e]=t[i],t[i]=n}return t}const v="grpc-node.internal.pick-first.report_health_status";class y{constructor(e){this.channelControlHelper=e,this.children=[],this.currentState=r.ConnectivityState.IDLE,this.currentSubchannelIndex=0,this.currentPick=null,this.subchannelStateListener=(e,t,i,n,r)=>{this.onSubchannelStateUpdate(e,t,i,r)},this.pickedSubchannelHealthListener=()=>this.calculateAndReportNewState(),this.stickyTransientFailureMode=!1,this.reportHealthStatus=!1,this.lastError=null,this.latestAddressList=null,this.latestOptions={},this.latestResolutionNote="",this.connectionDelayTimeout=setTimeout(()=>{},0),clearTimeout(this.connectionDelayTimeout)}allChildrenHaveReportedTF(){return this.children.every(e=>e.hasReportedTransientFailure)}resetChildrenReportedTF(){this.children.every(e=>e.hasReportedTransientFailure=!1)}calculateAndReportNewState(){var e;if(this.currentPick)if(this.reportHealthStatus&&!this.currentPick.isHealthy()){const e=`Picked subchannel ${this.currentPick.getAddress()} is unhealthy`;this.updateState(r.ConnectivityState.TRANSIENT_FAILURE,new s.UnavailablePicker({details:e}),e)}else this.updateState(r.ConnectivityState.READY,new g(this.currentPick),null);else if(0===(null===(e=this.latestAddressList)||void 0===e?void 0:e.length)){const e=`No connection established. Last error: ${this.lastError}. Resolution note: ${this.latestResolutionNote}`;this.updateState(r.ConnectivityState.TRANSIENT_FAILURE,new s.UnavailablePicker({details:e}),e)}else if(0===this.children.length)this.updateState(r.ConnectivityState.IDLE,new s.QueuePicker(this),null);else if(this.stickyTransientFailureMode){const e=`No connection established. Last error: ${this.lastError}. Resolution note: ${this.latestResolutionNote}`;this.updateState(r.ConnectivityState.TRANSIENT_FAILURE,new s.UnavailablePicker({details:e}),e)}else this.updateState(r.ConnectivityState.CONNECTING,new s.QueuePicker(this),null)}requestReresolution(){this.channelControlHelper.requestReresolution()}maybeEnterStickyTransientFailureMode(){if(this.allChildrenHaveReportedTF())if(this.requestReresolution(),this.resetChildrenReportedTF(),this.stickyTransientFailureMode)this.calculateAndReportNewState();else{this.stickyTransientFailureMode=!0;for(const{subchannel:e}of this.children)e.startConnecting();this.calculateAndReportNewState()}}removeCurrentPick(){null!==this.currentPick&&(this.currentPick.removeConnectivityStateListener(this.subchannelStateListener),this.channelControlHelper.removeChannelzChild(this.currentPick.getChannelzRef()),this.currentPick.removeHealthStateWatcher(this.pickedSubchannelHealthListener),this.currentPick.unref(),this.currentPick=null)}onSubchannelStateUpdate(e,t,i,n){var s;if(null===(s=this.currentPick)||void 0===s?void 0:s.realSubchannelEquals(e))i!==r.ConnectivityState.READY&&(this.removeCurrentPick(),this.calculateAndReportNewState());else for(const[t,s]of this.children.entries())if(e.realSubchannelEquals(s.subchannel))return i===r.ConnectivityState.READY&&this.pickSubchannel(s.subchannel),i===r.ConnectivityState.TRANSIENT_FAILURE&&(s.hasReportedTransientFailure=!0,n&&(this.lastError=n),this.maybeEnterStickyTransientFailureMode(),t===this.currentSubchannelIndex&&this.startNextSubchannelConnecting(t+1)),void s.subchannel.startConnecting()}startNextSubchannelConnecting(e){clearTimeout(this.connectionDelayTimeout);for(const[t,i]of this.children.entries())if(t>=e){const e=i.subchannel.getConnectivityState();if(e===r.ConnectivityState.IDLE||e===r.ConnectivityState.CONNECTING)return void this.startConnecting(t)}this.maybeEnterStickyTransientFailureMode()}startConnecting(e){var t,i;clearTimeout(this.connectionDelayTimeout),this.currentSubchannelIndex=e,this.children[e].subchannel.getConnectivityState()===r.ConnectivityState.IDLE&&(d("Start connecting to subchannel with address "+this.children[e].subchannel.getAddress()),process.nextTick(()=>{var t;null===(t=this.children[e])||void 0===t||t.subchannel.startConnecting()})),this.connectionDelayTimeout=setTimeout(()=>{this.startNextSubchannelConnecting(e+1)},250),null===(i=(t=this.connectionDelayTimeout).unref)||void 0===i||i.call(t)}pickSubchannel(e){d("Pick subchannel with address "+e.getAddress()),this.stickyTransientFailureMode=!1,e.ref(),this.channelControlHelper.addChannelzChild(e.getChannelzRef()),this.removeCurrentPick(),this.resetSubchannelList(),e.addConnectivityStateListener(this.subchannelStateListener),e.addHealthStateWatcher(this.pickedSubchannelHealthListener),this.currentPick=e,clearTimeout(this.connectionDelayTimeout),this.calculateAndReportNewState()}updateState(e,t,i){d(r.ConnectivityState[this.currentState]+" -> "+r.ConnectivityState[e]),this.currentState=e,this.channelControlHelper.updateState(e,t,i)}resetSubchannelList(){for(const e of this.children)e.subchannel.removeConnectivityStateListener(this.subchannelStateListener),e.subchannel.unref(),this.channelControlHelper.removeChannelzChild(e.subchannel.getChannelzRef());this.currentSubchannelIndex=0,this.children=[]}connectToAddressList(e,t){d("connectToAddressList(["+e.map(e=>(0,o.subchannelAddressToString)(e))+"])");const i=e.map(e=>({subchannel:this.channelControlHelper.createSubchannel(e,t),hasReportedTransientFailure:!1}));for(const{subchannel:e}of i)if(e.getConnectivityState()===r.ConnectivityState.READY)return void this.pickSubchannel(e);for(const{subchannel:e}of i)e.ref(),this.channelControlHelper.addChannelzChild(e.getChannelzRef());this.resetSubchannelList(),this.children=i;for(const{subchannel:e}of this.children)e.addConnectivityStateListener(this.subchannelStateListener);for(const e of this.children)e.subchannel.getConnectivityState()===r.ConnectivityState.TRANSIENT_FAILURE&&(e.hasReportedTransientFailure=!0);this.startNextSubchannelConnecting(0),this.calculateAndReportNewState()}updateAddressList(e,t,i,n){if(!(t instanceof p))return!1;if(!e.ok)return 0===this.children.length&&null===this.currentPick&&this.channelControlHelper.updateState(r.ConnectivityState.TRANSIENT_FAILURE,new s.UnavailablePicker(e.error),e.error.details),!0;let a=e.value;this.reportHealthStatus=i[v],t.getShuffleAddressList()&&(a=m(a));const l=[].concat(...a.map(e=>e.addresses));d("updateAddressList(["+l.map(e=>(0,o.subchannelAddressToString)(e))+"])");const h=function(e){if(0===e.length)return[];const t=[],i=[],n=[],r=(0,c.isTcpSubchannelAddress)(e[0])&&(0,u.isIPv6)(e[0].host);for(const t of e)(0,c.isTcpSubchannelAddress)(t)&&(0,u.isIPv6)(t.host)?i.push(t):n.push(t);const s=r?i:n,o=r?n:i;for(let e=0;e<Math.max(s.length,o.length);e++)e<s.length&&t.push(s[e]),e<o.length&&t.push(o[e]);return t}(l);return this.latestAddressList=h,this.latestOptions=i,this.connectToAddressList(h,i),this.latestResolutionNote=n,l.length>0||(this.lastError="No addresses resolved",!1)}exitIdle(){this.currentState===r.ConnectivityState.IDLE&&this.latestAddressList&&this.connectToAddressList(this.latestAddressList,this.latestOptions)}resetBackoff(){}destroy(){this.resetSubchannelList(),this.removeCurrentPick()}getTypeName(){return f}}t.PickFirstLoadBalancer=y;const b=new p(!1);t.LeafLoadBalancer=class{constructor(e,t,i,o){this.endpoint=e,this.options=i,this.resolutionNote=o,this.latestState=r.ConnectivityState.IDLE;const a=(0,n.createChildChannelControlHelper)(t,{updateState:(e,i,n)=>{this.latestState=e,this.latestPicker=i,t.updateState(e,i,n)}});this.pickFirstBalancer=new y(a),this.latestPicker=new s.QueuePicker(this.pickFirstBalancer)}startConnecting(){this.pickFirstBalancer.updateAddressList((0,h.statusOrFromValue)([this.endpoint]),b,Object.assign(Object.assign({},this.options),{[v]:!0}),this.resolutionNote)}updateEndpoint(e,t){this.options=t,this.endpoint=e,this.latestState!==r.ConnectivityState.IDLE&&this.startConnecting()}getConnectivityState(){return this.latestState}getPicker(){return this.latestPicker}getEndpoint(){return this.endpoint}exitIdle(){this.pickFirstBalancer.exitIdle()}destroy(){this.pickFirstBalancer.destroy()}}},1563(e,t,i){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.RoundRobinLoadBalancer=void 0,t.setup=function(){(0,n.registerLoadBalancerType)(h,p,d)};const n=i(8923),r=i(463),s=i(178),o=i(267),a=i(131),l=i(8996),c=i(6486);function u(e){o.trace(a.LogVerbosity.DEBUG,"round_robin",e)}const h="round_robin";class d{getLoadBalancerName(){return h}constructor(){}toJsonObject(){return{[h]:{}}}static createFromJson(e){return new d}}class f{constructor(e,t=0){this.children=e,this.nextIndex=t}pick(e){const t=this.children[this.nextIndex].picker;return this.nextIndex=(this.nextIndex+1)%this.children.length,t.pick(e)}peekNextEndpoint(){return this.children[this.nextIndex].endpoint}}class p{constructor(e){this.channelControlHelper=e,this.children=[],this.currentState=r.ConnectivityState.IDLE,this.currentReadyPicker=null,this.updatesPaused=!1,this.lastError=null,this.childChannelControlHelper=(0,n.createChildChannelControlHelper)(e,{updateState:(e,t,i)=>{this.currentState===r.ConnectivityState.READY&&e!==r.ConnectivityState.READY&&this.channelControlHelper.requestReresolution(),i&&(this.lastError=i),this.calculateAndUpdateState()}})}countChildrenWithState(e){return this.children.filter(t=>t.getConnectivityState()===e).length}calculateAndUpdateState(){if(!this.updatesPaused){if(this.countChildrenWithState(r.ConnectivityState.READY)>0){const e=this.children.filter(e=>e.getConnectivityState()===r.ConnectivityState.READY);let t=0;if(null!==this.currentReadyPicker){const i=this.currentReadyPicker.peekNextEndpoint();t=e.findIndex(e=>(0,l.endpointEqual)(e.getEndpoint(),i)),t<0&&(t=0)}this.updateState(r.ConnectivityState.READY,new f(e.map(e=>({endpoint:e.getEndpoint(),picker:e.getPicker()})),t),null)}else if(this.countChildrenWithState(r.ConnectivityState.CONNECTING)>0)this.updateState(r.ConnectivityState.CONNECTING,new s.QueuePicker(this),null);else if(this.countChildrenWithState(r.ConnectivityState.TRANSIENT_FAILURE)>0){const e=`round_robin: No connection established. Last error: ${this.lastError}`;this.updateState(r.ConnectivityState.TRANSIENT_FAILURE,new s.UnavailablePicker({details:e}),e)}else this.updateState(r.ConnectivityState.IDLE,new s.QueuePicker(this),null);for(const e of this.children)e.getConnectivityState()===r.ConnectivityState.IDLE&&e.exitIdle()}}updateState(e,t,i){u(r.ConnectivityState[this.currentState]+" -> "+r.ConnectivityState[e]),e===r.ConnectivityState.READY?this.currentReadyPicker=t:this.currentReadyPicker=null,this.currentState=e,this.channelControlHelper.updateState(e,t,i)}resetSubchannelList(){for(const e of this.children)e.destroy();this.children=[]}updateAddressList(e,t,i,n){if(!(t instanceof d))return!1;if(!e.ok)return 0===this.children.length&&this.updateState(r.ConnectivityState.TRANSIENT_FAILURE,new s.UnavailablePicker(e.error),e.error.details),!0;const o=Math.random()*e.value.length|0,a=function(e,t){return[...e.slice(t),...e.slice(0,t)]}(e.value,o);if(this.resetSubchannelList(),0===a.length){const e=`No addresses resolved. Resolution note: ${n}`;this.updateState(r.ConnectivityState.TRANSIENT_FAILURE,new s.UnavailablePicker({details:e}),e)}u("Connect to endpoint list "+a.map(l.endpointToString)),this.updatesPaused=!0,this.children=a.map(e=>new c.LeafLoadBalancer(e,this.childChannelControlHelper,i,n));for(const e of this.children)e.startConnecting();return this.updatesPaused=!1,this.calculateAndUpdateState(),!0}exitIdle(){}resetBackoff(){}destroy(){this.resetSubchannelList()}getTypeName(){return h}}t.RoundRobinLoadBalancer=p},4117(e,t,i){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.WeightedRoundRobinLoadBalancingConfig=void 0,t.setup=function(){(0,o.registerLoadBalancerType)(p,b,v)};const n=i(463),r=i(131),s=i(4700),o=i(8923),a=i(6486),l=i(267),c=i(2921),u=i(178),h=i(222),d=i(8996);function f(e){l.trace(r.LogVerbosity.DEBUG,"weighted_round_robin",e)}const p="weighted_round_robin";function g(e,t,i){if(t in e&&void 0!==e[t]&&typeof e[t]!==i)throw new Error(`weighted round robin config ${t} parse error: expected ${i}, got ${typeof e[t]}`)}function m(e,t){if(t in e&&void 0!==e[t]&&null!==e[t]){let i;if((0,s.isDuration)(e[t]))i=e[t];else if((0,s.isDurationMessage)(e[t]))i=(0,s.durationMessageToDuration)(e[t]);else{if("string"!=typeof e[t])throw new Error(`weighted round robin config ${t}: expected duration, got ${typeof e[t]}`);{const n=(0,s.parseDuration)(e[t]);if(!n)throw new Error(`weighted round robin config ${t}: failed to parse duration string ${e[t]}`);i=n}}return(0,s.durationToMs)(i)}return null}class v{constructor(e,t,i,n,r,s){this.enableOobLoadReport=null!=e&&e,this.oobLoadReportingPeriodMs=null!=t?t:1e4,this.blackoutPeriodMs=null!=i?i:1e4,this.weightExpirationPeriodMs=null!=n?n:18e4,this.weightUpdatePeriodMs=Math.max(null!=r?r:1e3,100),this.errorUtilizationPenalty=null!=s?s:1}getLoadBalancerName(){return p}toJsonObject(){return{enable_oob_load_report:this.enableOobLoadReport,oob_load_reporting_period:(0,s.durationToString)((0,s.msToDuration)(this.oobLoadReportingPeriodMs)),blackout_period:(0,s.durationToString)((0,s.msToDuration)(this.blackoutPeriodMs)),weight_expiration_period:(0,s.durationToString)((0,s.msToDuration)(this.weightExpirationPeriodMs)),weight_update_period:(0,s.durationToString)((0,s.msToDuration)(this.weightUpdatePeriodMs)),error_utilization_penalty:this.errorUtilizationPenalty}}static createFromJson(e){if(g(e,"enable_oob_load_report","boolean"),g(e,"error_utilization_penalty","number"),e.error_utilization_penalty<0)throw new Error("weighted round robin config error_utilization_penalty < 0");return new v(e.enable_oob_load_report,m(e,"oob_load_reporting_period"),m(e,"blackout_period"),m(e,"weight_expiration_period"),m(e,"weight_update_period"),e.error_utilization_penalty)}getEnableOobLoadReport(){return this.enableOobLoadReport}getOobLoadReportingPeriodMs(){return this.oobLoadReportingPeriodMs}getBlackoutPeriodMs(){return this.blackoutPeriodMs}getWeightExpirationPeriodMs(){return this.weightExpirationPeriodMs}getWeightUpdatePeriodMs(){return this.weightUpdatePeriodMs}getErrorUtilizationPenalty(){return this.errorUtilizationPenalty}}t.WeightedRoundRobinLoadBalancingConfig=v;class y{constructor(e,t){this.metricsHandler=t,this.queue=new h.PriorityQueue((e,t)=>e.deadline<t.deadline);const i=e.filter(e=>e.weight>0);let n;if(i.length<2)n=1;else{let e=0;for(const{weight:t}of i)e+=t;n=e/i.length}for(const t of e){const e=t.weight>0?1/t.weight:n;this.queue.push({endpointName:t.endpointName,picker:t.picker,period:e,deadline:Math.random()*e})}}pick(e){const t=this.queue.pop();this.queue.push(Object.assign(Object.assign({},t),{deadline:t.deadline+t.period}));const i=t.picker.pick(e);if(i.pickResultType===u.PickResultType.COMPLETE){if(this.metricsHandler)return Object.assign(Object.assign({},i),{onCallEnded:(0,c.createMetricsReader)(e=>this.metricsHandler(e,t.endpointName),i.onCallEnded)});{const e=i.subchannel;return Object.assign(Object.assign({},i),{subchannel:e.getWrappedSubchannel()})}}return i}}class b{constructor(e){this.channelControlHelper=e,this.latestConfig=null,this.children=new Map,this.currentState=n.ConnectivityState.IDLE,this.updatesPaused=!1,this.lastError=null,this.weightUpdateTimer=null}countChildrenWithState(e){let t=0;for(const i of this.children.values())i.child.getConnectivityState()===e&&(t+=1);return t}updateWeight(e,t){var i,n;const r=t.rps_fractional;let s=t.application_utilization;s>0&&r>0&&(s+=t.eps/r*(null!==(n=null===(i=this.latestConfig)||void 0===i?void 0:i.getErrorUtilizationPenalty())&&void 0!==n?n:0));const o=0===s?0:r/s;if(0===o)return;const a=new Date;null===e.nonEmptySince&&(e.nonEmptySince=a),e.lastUpdated=a,e.weight=o}getWeight(e){if(!this.latestConfig)return 0;const t=(new Date).getTime();if(t-e.lastUpdated.getTime()>=this.latestConfig.getWeightExpirationPeriodMs())return e.nonEmptySince=null,0;const i=this.latestConfig.getBlackoutPeriodMs();return i>0&&(null===e.nonEmptySince||t-e.nonEmptySince.getTime()<i)?0:e.weight}calculateAndUpdateState(){if(!this.updatesPaused&&this.latestConfig){if(this.countChildrenWithState(n.ConnectivityState.READY)>0){const e=[];for(const[t,i]of this.children)i.child.getConnectivityState()===n.ConnectivityState.READY&&e.push({endpointName:t,picker:i.child.getPicker(),weight:this.getWeight(i)});let t;f("Created picker with weights: "+e.map(e=>e.endpointName+":"+e.weight).join(",")),t=this.latestConfig.getEnableOobLoadReport()?null:(e,t)=>{const i=this.children.get(t);i&&this.updateWeight(i,e)},this.updateState(n.ConnectivityState.READY,new y(e,t),null)}else if(this.countChildrenWithState(n.ConnectivityState.CONNECTING)>0)this.updateState(n.ConnectivityState.CONNECTING,new u.QueuePicker(this),null);else if(this.countChildrenWithState(n.ConnectivityState.TRANSIENT_FAILURE)>0){const e=`weighted_round_robin: No connection established. Last error: ${this.lastError}`;this.updateState(n.ConnectivityState.TRANSIENT_FAILURE,new u.UnavailablePicker({details:e}),e)}else this.updateState(n.ConnectivityState.IDLE,new u.QueuePicker(this),null);for(const{child:e}of this.children.values())e.getConnectivityState()===n.ConnectivityState.IDLE&&e.exitIdle()}}updateState(e,t,i){f(n.ConnectivityState[this.currentState]+" -> "+n.ConnectivityState[e]),this.currentState=e,this.channelControlHelper.updateState(e,t,i)}updateAddressList(e,t,i,r){var s,l;if(!(t instanceof v))return!1;if(!e.ok)return 0===this.children.size&&this.updateState(n.ConnectivityState.TRANSIENT_FAILURE,new u.UnavailablePicker(e.error),e.error.details),!0;if(0===e.value.length){const e=`No addresses resolved. Resolution note: ${r}`;return this.updateState(n.ConnectivityState.TRANSIENT_FAILURE,new u.UnavailablePicker({details:e}),e),!1}f("Connect to endpoint list "+e.value.map(d.endpointToString));const h=new Date,p=new Set;this.updatesPaused=!0,this.latestConfig=t;for(const s of e.value){const e=(0,d.endpointToString)(s);p.add(e);let l=this.children.get(e);l||(l={child:new a.LeafLoadBalancer(s,(0,o.createChildChannelControlHelper)(this.channelControlHelper,{updateState:(e,t,i)=>{this.currentState===n.ConnectivityState.READY&&e!==n.ConnectivityState.READY&&this.channelControlHelper.requestReresolution(),e===n.ConnectivityState.READY&&(l.nonEmptySince=null),i&&(this.lastError=i),this.calculateAndUpdateState()},createSubchannel:(e,t)=>{const i=this.channelControlHelper.createSubchannel(e,t);return(null==l?void 0:l.oobMetricsListener)?new c.OrcaOobMetricsSubchannelWrapper(i,l.oobMetricsListener,this.latestConfig.getOobLoadReportingPeriodMs()):i}}),i,r),lastUpdated:h,nonEmptySince:null,weight:0,oobMetricsListener:null},this.children.set(e,l)),t.getEnableOobLoadReport()?l.oobMetricsListener=e=>{this.updateWeight(l,e)}:l.oobMetricsListener=null}for(const[e,t]of this.children)p.has(e)?t.child.startConnecting():(t.child.destroy(),this.children.delete(e));return this.updatesPaused=!1,this.calculateAndUpdateState(),this.weightUpdateTimer&&clearInterval(this.weightUpdateTimer),this.weightUpdateTimer=null===(l=(s=setInterval(()=>{this.currentState===n.ConnectivityState.READY&&this.calculateAndUpdateState()},t.getWeightUpdatePeriodMs())).unref)||void 0===l?void 0:l.call(s),!0}exitIdle(){}resetBackoff(){}destroy(){for(const e of this.children.values())e.child.destroy();this.children.clear(),this.weightUpdateTimer&&clearInterval(this.weightUpdateTimer)}getTypeName(){return p}}},8923(e,t,i){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.createChildChannelControlHelper=function(e,t){var i,n,r,s,o,a,l,c,u,h;return{createSubchannel:null!==(n=null===(i=t.createSubchannel)||void 0===i?void 0:i.bind(t))&&void 0!==n?n:e.createSubchannel.bind(e),updateState:null!==(s=null===(r=t.updateState)||void 0===r?void 0:r.bind(t))&&void 0!==s?s:e.updateState.bind(e),requestReresolution:null!==(a=null===(o=t.requestReresolution)||void 0===o?void 0:o.bind(t))&&void 0!==a?a:e.requestReresolution.bind(e),addChannelzChild:null!==(c=null===(l=t.addChannelzChild)||void 0===l?void 0:l.bind(t))&&void 0!==c?c:e.addChannelzChild.bind(e),removeChannelzChild:null!==(h=null===(u=t.removeChannelzChild)||void 0===u?void 0:u.bind(t))&&void 0!==h?h:e.removeChannelzChild.bind(e)}},t.registerLoadBalancerType=function(e,t,i){s[e]={LoadBalancer:t,LoadBalancingConfig:i}},t.registerDefaultLoadBalancerType=function(e){o=e},t.createLoadBalancer=function(e,t){const i=e.getLoadBalancerName();return i in s?new s[i].LoadBalancer(t):null},t.isLoadBalancerNameRegistered=function(e){return e in s},t.parseLoadBalancingConfig=a,t.getDefaultConfig=function(){if(!o)throw new Error("No default load balancer type registered");return new s[o].LoadBalancingConfig},t.selectLbConfigFromList=function(e,t=!1){for(const t of e)try{return a(t)}catch(e){(0,n.log)(r.LogVerbosity.DEBUG,"Config parsing failed with error",e.message);continue}return t&&o?new s[o].LoadBalancingConfig:null};const n=i(267),r=i(131);const s={};let o=null;function a(e){const t=Object.keys(e);if(1!==t.length)throw new Error("Provided load balancing config has multiple conflicting entries");const i=t[0];if(!(i in s))throw new Error(`Unrecognized load balancing config name ${i}`);try{return s[i].LoadBalancingConfig.createFromJson(e[i])}catch(e){throw new Error(`${i}: ${e.message}`)}}},2611(e,t,i){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.LoadBalancingCall=void 0;const n=i(463),r=i(131),s=i(6308),o=i(4097),a=i(178),l=i(3822),c=i(267),u=i(6067),h=i(5675);t.LoadBalancingCall=class{constructor(e,t,i,n,r,s,o){var a,c;this.channel=e,this.callConfig=t,this.methodName=i,this.host=n,this.credentials=r,this.deadline=s,this.callNumber=o,this.child=null,this.readPending=!1,this.pendingMessage=null,this.pendingHalfClose=!1,this.ended=!1,this.metadata=null,this.listener=null,this.onCallEnded=null,this.childStartTime=null;const u=this.methodName.split("/");let h="";u.length>=2&&(h=u[1]);const d=null!==(c=null===(a=(0,l.splitHostPort)(this.host))||void 0===a?void 0:a.host)&&void 0!==c?c:"localhost";this.serviceUrl=`https://${d}/${h}`,this.startTime=new Date}getDeadlineInfo(){var e,t;const i=[];return this.childStartTime?(this.childStartTime>this.startTime&&((null===(e=this.metadata)||void 0===e?void 0:e.getOptions().waitForReady)&&i.push("wait_for_ready"),i.push(`LB pick: ${(0,s.formatDateDifference)(this.startTime,this.childStartTime)}`)),i.push(...this.child.getDeadlineInfo()),i):((null===(t=this.metadata)||void 0===t?void 0:t.getOptions().waitForReady)&&i.push("wait_for_ready"),i.push("Waiting for LB pick"),i)}trace(e){c.trace(r.LogVerbosity.DEBUG,"load_balancing_call","["+this.callNumber+"] "+e)}outputStatus(e,t){var i,n;if(!this.ended){this.ended=!0,this.trace("ended with status: code="+e.code+' details="'+e.details+'" start time='+this.startTime.toISOString());const r=Object.assign(Object.assign({},e),{progress:t});null===(i=this.listener)||void 0===i||i.onReceiveStatus(r),null===(n=this.onCallEnded)||void 0===n||n.call(this,r.code,r.details,r.metadata)}}doPick(){var e,t;if(this.ended)return;if(!this.metadata)throw new Error("doPick called before start");this.trace("Pick called");const i=this.metadata.clone(),l=this.channel.doPick(i,this.callConfig.pickInformation),c=l.subchannel?"("+l.subchannel.getChannelzRef().id+") "+l.subchannel.getAddress():""+l.subchannel;switch(this.trace("Pick result: "+a.PickResultType[l.pickResultType]+" subchannel: "+c+" status: "+(null===(e=l.status)||void 0===e?void 0:e.code)+" "+(null===(t=l.status)||void 0===t?void 0:t.details)),l.pickResultType){case a.PickResultType.COMPLETE:this.credentials.compose(l.subchannel.getCallCredentials()).generateMetadata({method_name:this.methodName,service_url:this.serviceUrl}).then(e=>{var t;if(this.ended)this.trace("Credentials metadata generation finished after call ended");else{if(i.merge(e),i.get("authorization").length>1&&this.outputStatus({code:r.Status.INTERNAL,details:'"authorization" metadata cannot have multiple values',metadata:new o.Metadata},"PROCESSED"),l.subchannel.getConnectivityState()!==n.ConnectivityState.READY)return this.trace("Picked subchannel "+c+" has state "+n.ConnectivityState[l.subchannel.getConnectivityState()]+" after getting credentials metadata. Retrying pick"),void this.doPick();this.deadline!==1/0&&i.set("grpc-timeout",(0,s.getDeadlineTimeoutString)(this.deadline));try{this.child=l.subchannel.getRealSubchannel().createCall(i,this.host,this.methodName,{onReceiveMetadata:e=>{this.trace("Received metadata"),this.listener.onReceiveMetadata(e)},onReceiveMessage:e=>{this.trace("Received message"),this.listener.onReceiveMessage(e)},onReceiveStatus:e=>{this.trace("Received status"),e.rstCode===h.constants.NGHTTP2_REFUSED_STREAM?this.outputStatus(e,"REFUSED"):this.outputStatus(e,"PROCESSED")}}),this.childStartTime=new Date}catch(e){return this.trace("Failed to start call on picked subchannel "+c+" with error "+e.message),void this.outputStatus({code:r.Status.INTERNAL,details:"Failed to start HTTP/2 stream with error "+e.message,metadata:new o.Metadata},"NOT_STARTED")}null===(t=l.onCallStarted)||void 0===t||t.call(l),this.onCallEnded=l.onCallEnded,this.trace("Created child call ["+this.child.getCallNumber()+"]"),this.readPending&&this.child.startRead(),this.pendingMessage&&this.child.sendMessageWithContext(this.pendingMessage.context,this.pendingMessage.message),this.pendingHalfClose&&this.child.halfClose()}},e=>{const{code:t,details:i}=(0,u.restrictControlPlaneStatusCode)("number"==typeof e.code?e.code:r.Status.UNKNOWN,`Getting metadata from plugin failed with error: ${e.message}`);this.outputStatus({code:t,details:i,metadata:new o.Metadata},"PROCESSED")});break;case a.PickResultType.DROP:const{code:e,details:t}=(0,u.restrictControlPlaneStatusCode)(l.status.code,l.status.details);setImmediate(()=>{this.outputStatus({code:e,details:t,metadata:l.status.metadata},"DROP")});break;case a.PickResultType.TRANSIENT_FAILURE:if(this.metadata.getOptions().waitForReady)this.channel.queueCallForPick(this);else{const{code:e,details:t}=(0,u.restrictControlPlaneStatusCode)(l.status.code,l.status.details);setImmediate(()=>{this.outputStatus({code:e,details:t,metadata:l.status.metadata},"PROCESSED")})}break;case a.PickResultType.QUEUE:this.channel.queueCallForPick(this)}}cancelWithStatus(e,t){var i;this.trace("cancelWithStatus code: "+e+' details: "'+t+'"'),null===(i=this.child)||void 0===i||i.cancelWithStatus(e,t),this.outputStatus({code:e,details:t,metadata:new o.Metadata},"PROCESSED")}getPeer(){var e,t;return null!==(t=null===(e=this.child)||void 0===e?void 0:e.getPeer())&&void 0!==t?t:this.channel.getTarget()}start(e,t){this.trace("start called"),this.listener=t,this.metadata=e,this.doPick()}sendMessageWithContext(e,t){this.trace("write() called with message of length "+t.length),this.child?this.child.sendMessageWithContext(e,t):this.pendingMessage={context:e,message:t}}startRead(){this.trace("startRead called"),this.child?this.child.startRead():this.readPending=!0}halfClose(){this.trace("halfClose called"),this.child?this.child.halfClose():this.pendingHalfClose=!0}setCredentials(e){throw new Error("Method not implemented.")}getCallNumber(){return this.callNumber}getAuthContext(){return this.child?this.child.getAuthContext():null}}},267(e,t,i){"use strict";var n,r,s,o;Object.defineProperty(t,"__esModule",{value:!0}),t.log=t.setLoggerVerbosity=t.setLogger=t.getLogger=void 0,t.trace=function(e,i,n){m(i)&&(0,t.log)(e,(new Date).toISOString()+" | v"+c+" "+l.pid+" | "+i+" | "+n)},t.isTracerEnabled=m;const a=i(131),l=i(932),c=i(9943).rE;let u={error:(e,...t)=>{console.error("E "+e,...t)},info:(e,...t)=>{console.error("I "+e,...t)},debug:(e,...t)=>{console.error("D "+e,...t)}},h=a.LogVerbosity.ERROR;switch((null!==(r=null!==(n=process.env.GRPC_NODE_VERBOSITY)&&void 0!==n?n:process.env.GRPC_VERBOSITY)&&void 0!==r?r:"").toUpperCase()){case"DEBUG":h=a.LogVerbosity.DEBUG;break;case"INFO":h=a.LogVerbosity.INFO;break;case"ERROR":h=a.LogVerbosity.ERROR;break;case"NONE":h=a.LogVerbosity.NONE}t.getLogger=()=>u;t.setLogger=e=>{u=e};t.setLoggerVerbosity=e=>{h=e};t.log=(e,...t)=>{let i;if(e>=h){switch(e){case a.LogVerbosity.DEBUG:i=u.debug;break;case a.LogVerbosity.INFO:i=u.info;break;case a.LogVerbosity.ERROR:i=u.error}i||(i=u.error),i&&i.bind(u)(...t)}};const d=null!==(o=null!==(s=process.env.GRPC_NODE_TRACE)&&void 0!==s?s:process.env.GRPC_TRACE)&&void 0!==o?o:"",f=new Set,p=new Set;for(const e of d.split(","))e.startsWith("-")?p.add(e.substring(1)):f.add(e);const g=f.has("all");function m(e){return!p.has(e)&&(g||f.has(e))}},4056(e,t,i){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.makeClientConstructor=o,t.loadPackageDefinition=function(e){const t={};for(const i in e)if(Object.prototype.hasOwnProperty.call(e,i)){const n=e[i],r=i.split(".");if(r.some(e=>s(e)))continue;const l=r[r.length-1];let c=t;for(const e of r.slice(0,-1))c[e]||(c[e]={}),c=c[e];a(n)?c[l]=n:c[l]=o(n,l,{})}return t};const n=i(5563),r={unary:n.Client.prototype.makeUnaryRequest,server_stream:n.Client.prototype.makeServerStreamRequest,client_stream:n.Client.prototype.makeClientStreamRequest,bidi:n.Client.prototype.makeBidiStreamRequest};function s(e){return["__proto__","prototype","constructor"].includes(e)}function o(e,t,i){i||(i={});class o extends n.Client{}return Object.keys(e).forEach(t=>{if(s(t))return;const i=e[t];let n;if("string"==typeof t&&"$"===t.charAt(0))throw new Error("Method names cannot start with $");n=i.requestStream?i.responseStream?"bidi":"client_stream":i.responseStream?"server_stream":"unary";const a=i.requestSerialize,l=i.responseDeserialize,c=function(e,t,i,n){return function(...r){return e.call(this,t,i,n,...r)}}(r[n],i.path,a,l);o.prototype[t]=c,Object.assign(o.prototype[t],i),i.originalName&&!s(i.originalName)&&(o.prototype[i.originalName]=o.prototype[t])}),o.service=e,o.serviceName=t,o}function a(e){return"format"in e}},4097(e,t,i){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Metadata=void 0;const n=i(267),r=i(131),s=i(9752),o=/^[:0-9a-z_.-]+$/,a=/^[ -~]*$/;function l(e){return e.endsWith("-bin")}function c(e){return!e.startsWith("grpc-")}function u(e){return e.toLowerCase()}function h(e,t){if(!function(e){return o.test(e)}(e))throw new Error('Metadata key "'+e+'" contains illegal characters');if(null!=t)if(l(e)){if(!Buffer.isBuffer(t))throw new Error("keys that end with '-bin' must have Buffer values")}else{if(Buffer.isBuffer(t))throw new Error("keys that don't end with '-bin' must have String values");if(!function(e){return a.test(e)}(t))throw new Error('Metadata string value "'+t+'" contains illegal characters')}}class d{constructor(e={}){this.internalRepr=new Map,this.opaqueData=new Map,this.options=e}set(e,t){h(e=u(e),t),this.internalRepr.set(e,[t])}add(e,t){h(e=u(e),t);const i=this.internalRepr.get(e);void 0===i?this.internalRepr.set(e,[t]):i.push(t)}remove(e){e=u(e),this.internalRepr.delete(e)}get(e){return e=u(e),this.internalRepr.get(e)||[]}getMap(){const e={};for(const[t,i]of this.internalRepr)if(i.length>0){const n=i[0];e[t]=Buffer.isBuffer(n)?Buffer.from(n):n}return e}clone(){const e=new d(this.options),t=e.internalRepr;for(const[e,i]of this.internalRepr){const n=i.map(e=>Buffer.isBuffer(e)?Buffer.from(e):e);t.set(e,n)}return e}merge(e){for(const[t,i]of e.internalRepr){const e=(this.internalRepr.get(t)||[]).concat(i);this.internalRepr.set(t,e)}}setOptions(e){this.options=e}getOptions(){return this.options}toHttp2Headers(){const e={};for(const[t,i]of this.internalRepr)t.startsWith(":")||(e[t]=i.map(f));return e}toJSON(){const e={};for(const[t,i]of this.internalRepr)e[t]=i;return e}setOpaque(e,t){this.opaqueData.set(e,t)}getOpaque(e){return this.opaqueData.get(e)}static fromHttp2Headers(e){const t=new d;for(const i of Object.keys(e)){if(":"===i.charAt(0))continue;const o=e[i];try{l(i)?Array.isArray(o)?o.forEach(e=>{t.add(i,Buffer.from(e,"base64"))}):void 0!==o&&(c(i)?o.split(",").forEach(e=>{t.add(i,Buffer.from(e.trim(),"base64"))}):t.add(i,Buffer.from(o,"base64"))):Array.isArray(o)?o.forEach(e=>{t.add(i,e)}):void 0!==o&&t.add(i,o)}catch(e){const t=`Failed to add metadata entry ${i}: ${o}. ${(0,s.getErrorMessage)(e)}. For more information see https://github.com/grpc/grpc-node/issues/1173`;(0,n.log)(r.LogVerbosity.ERROR,t)}}return t}}t.Metadata=d;const f=e=>Buffer.isBuffer(e)?e.toString("base64"):e},2921(e,t,i){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.OrcaOobMetricsSubchannelWrapper=t.GRPC_METRICS_HEADER=t.ServerMetricRecorder=t.PerRequestMetricRecorder=void 0,t.createOrcaClient=h,t.createMetricsReader=function(e,i){return(n,r,s)=>{let o=s.getOpaque(d);if(o)e(o);else{const i=s.get(t.GRPC_METRICS_HEADER);if(i.length>0){o=u().xds.data.orca.v3.OrcaLoadReport.deserialize(i[0]),e(o),s.setOpaque(d,o)}}i&&i(n,r,s)}};const n=i(4056),r=i(4700),s=i(7434),o=i(2379),a=i(131),l=i(3956),c=i(463);function u(){const e=(0,i(5085).Yi)("xds/service/orca/v3/orca.proto",{keepCase:!0,longs:String,enums:String,defaults:!0,oneofs:!0,includeDirs:[`${__dirname}/../../proto/xds`,`${__dirname}/../../proto/protoc-gen-validate`]});return(0,n.loadPackageDefinition)(e)}t.PerRequestMetricRecorder=class{constructor(){this.message={}}recordRequestCostMetric(e,t){this.message.request_cost||(this.message.request_cost={}),this.message.request_cost[e]=t}recordUtilizationMetric(e,t){this.message.utilization||(this.message.utilization={}),this.message.utilization[e]=t}recordNamedMetric(e,t){this.message.named_metrics||(this.message.named_metrics={}),this.message.named_metrics[e]=t}recordCPUUtilizationMetric(e){this.message.cpu_utilization=e}recordMemoryUtilizationMetric(e){this.message.mem_utilization=e}recordApplicationUtilizationMetric(e){this.message.application_utilization=e}recordQpsMetric(e){this.message.rps_fractional=e}recordEpsMetric(e){this.message.eps=e}serialize(){return u().xds.data.orca.v3.OrcaLoadReport.serialize(this.message)}};function h(e){return new(0,u().xds.service.orca.v3.OpenRcaService)("unused",s.ChannelCredentials.createInsecure(),{channelOverride:e})}t.ServerMetricRecorder=class{constructor(){this.message={},this.serviceImplementation={StreamCoreMetrics:e=>{const t=e.request.report_interval?(0,r.durationToMs)((0,r.durationMessageToDuration)(e.request.report_interval)):3e4,i=setInterval(()=>{e.write(this.message)},t);e.on("cancelled",()=>{clearInterval(i)})}}}putUtilizationMetric(e,t){this.message.utilization||(this.message.utilization={}),this.message.utilization[e]=t}setAllUtilizationMetrics(e){this.message.utilization=Object.assign({},e)}deleteUtilizationMetric(e){var t;null===(t=this.message.utilization)||void 0===t||delete t[e]}setCpuUtilizationMetric(e){this.message.cpu_utilization=e}deleteCpuUtilizationMetric(){delete this.message.cpu_utilization}setApplicationUtilizationMetric(e){this.message.application_utilization=e}deleteApplicationUtilizationMetric(){delete this.message.application_utilization}setQpsMetric(e){this.message.rps_fractional=e}deleteQpsMetric(){delete this.message.rps_fractional}setEpsMetric(e){this.message.eps=e}deleteEpsMetric(){delete this.message.eps}addToServer(e){const t=u().xds.service.orca.v3.OpenRcaService.service;e.addService(t,this.serviceImplementation)}},t.GRPC_METRICS_HEADER="endpoint-load-metrics-bin";const d="grpc_orca_load_report";const f="orca_oob_metrics";class p{constructor(e,t){this.metricsListener=e,this.intervalMs=t,this.dataProducer=null}setSubchannel(e){const t=e.getOrCreateDataProducer(f,v);this.dataProducer=t,t.addDataWatcher(this)}destroy(){var e;null===(e=this.dataProducer)||void 0===e||e.removeDataWatcher(this)}getInterval(){return this.intervalMs}onMetricsUpdate(e){this.metricsListener(e)}}class g{constructor(e){this.subchannel=e,this.dataWatchers=new Set,this.orcaSupported=!0,this.metricsCall=null,this.currentInterval=1/0,this.backoffTimer=new l.BackoffTimeout(()=>this.updateMetricsSubscription()),this.subchannelStateListener=()=>this.updateMetricsSubscription();const t=e.getChannel();this.client=h(t),e.addConnectivityStateListener(this.subchannelStateListener)}addDataWatcher(e){this.dataWatchers.add(e),this.updateMetricsSubscription()}removeDataWatcher(e){var t;this.dataWatchers.delete(e),0===this.dataWatchers.size?(this.subchannel.removeDataProducer(f),null===(t=this.metricsCall)||void 0===t||t.cancel(),this.metricsCall=null,this.client.close(),this.subchannel.removeConnectivityStateListener(this.subchannelStateListener)):this.updateMetricsSubscription()}updateMetricsSubscription(){var e;if(0===this.dataWatchers.size||!this.orcaSupported||this.subchannel.getConnectivityState()!==c.ConnectivityState.READY)return;const t=Math.min(...Array.from(this.dataWatchers).map(e=>e.getInterval()));if(!this.metricsCall||t!==this.currentInterval){null===(e=this.metricsCall)||void 0===e||e.cancel(),this.currentInterval=t;const i=this.client.streamCoreMetrics({report_interval:(0,r.msToDuration)(t)});this.metricsCall=i,i.on("data",e=>{this.dataWatchers.forEach(t=>{t.onMetricsUpdate(e)})}),i.on("error",e=>{this.metricsCall=null,e.code!==a.Status.UNIMPLEMENTED?e.code!==a.Status.CANCELLED&&this.backoffTimer.runOnce():this.orcaSupported=!1})}}}class m extends o.BaseSubchannelWrapper{constructor(e,t,i){super(e),this.addDataWatcher(new p(t,i))}getWrappedSubchannel(){return this.child}}function v(e){return new g(e)}t.OrcaOobMetricsSubchannelWrapper=m},178(e,t,i){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.QueuePicker=t.UnavailablePicker=t.PickResultType=void 0;const n=i(4097),r=i(131);var s;!function(e){e[e.COMPLETE=0]="COMPLETE",e[e.QUEUE=1]="QUEUE",e[e.TRANSIENT_FAILURE=2]="TRANSIENT_FAILURE",e[e.DROP=3]="DROP"}(s||(t.PickResultType=s={}));t.UnavailablePicker=class{constructor(e){this.status=Object.assign({code:r.Status.UNAVAILABLE,details:"No connection established",metadata:new n.Metadata},e)}pick(e){return{pickResultType:s.TRANSIENT_FAILURE,subchannel:null,status:this.status,onCallStarted:null,onCallEnded:null}}};t.QueuePicker=class{constructor(e,t){this.loadBalancer=e,this.childPicker=t,this.calledExitIdle=!1}pick(e){return this.calledExitIdle||(process.nextTick(()=>{this.loadBalancer.exitIdle()}),this.calledExitIdle=!0),this.childPicker?this.childPicker.pick(e):{pickResultType:s.QUEUE,subchannel:null,status:null,onCallStarted:null,onCallEnded:null}}}},222(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.PriorityQueue=void 0;const i=e=>Math.floor(e/2),n=e=>2*e+1,r=e=>2*e+2;t.PriorityQueue=class{constructor(e=(e,t)=>e>t){this.comparator=e,this.heap=[]}size(){return this.heap.length}isEmpty(){return 0==this.size()}peek(){return this.heap[0]}push(...e){return e.forEach(e=>{this.heap.push(e),this.siftUp()}),this.size()}pop(){const e=this.peek(),t=this.size()-1;return t>0&&this.swap(0,t),this.heap.pop(),this.siftDown(),e}replace(e){const t=this.peek();return this.heap[0]=e,this.siftDown(),t}greater(e,t){return this.comparator(this.heap[e],this.heap[t])}swap(e,t){[this.heap[e],this.heap[t]]=[this.heap[t],this.heap[e]]}siftUp(){let e=this.size()-1;for(;e>0&&this.greater(e,i(e));)this.swap(e,i(e)),e=i(e)}siftDown(){let e=0;for(;n(e)<this.size()&&this.greater(n(e),e)||r(e)<this.size()&&this.greater(r(e),e);){let t=r(e)<this.size()&&this.greater(r(e),n(e))?r(e):n(e);this.swap(e,t),e=t}}}},6700(e,t,i){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.DEFAULT_PORT=void 0,t.setup=function(){(0,n.registerResolver)("dns",m),(0,n.registerDefaultScheme)("dns")};const n=i(9302),r=i(2250),s=i(5656),o=i(131),a=i(5034),l=i(4097),c=i(267),u=i(131),h=i(3822),d=i(9278),f=i(3956),p=i(883);function g(e){c.trace(u.LogVerbosity.DEBUG,"dns_resolver",e)}t.DEFAULT_PORT=443;class m{constructor(e,i,n){var s,a,c;this.target=e,this.listener=i,this.pendingLookupPromise=null,this.pendingTxtPromise=null,this.latestLookupResult=null,this.latestServiceConfigResult=null,this.continueResolving=!1,this.isNextResolutionTimerRunning=!1,this.isServiceConfigEnabled=!0,this.returnedIpResult=!1,this.alternativeResolver=new r.promises.Resolver,g("Resolver constructed for target "+(0,h.uriToString)(e)),e.authority&&this.alternativeResolver.setServers([e.authority]);const u=(0,h.splitHostPort)(e.path);null===u?(this.ipResult=null,this.dnsHostname=null,this.port=null):(0,d.isIPv4)(u.host)||(0,d.isIPv6)(u.host)?(this.ipResult=[{addresses:[{host:u.host,port:null!==(s=u.port)&&void 0!==s?s:t.DEFAULT_PORT}]}],this.dnsHostname=null,this.port=null):(this.ipResult=null,this.dnsHostname=u.host,this.port=null!==(a=u.port)&&void 0!==a?a:t.DEFAULT_PORT),this.percentage=100*Math.random(),1===n["grpc.service_config_disable_resolution"]&&(this.isServiceConfigEnabled=!1),this.defaultResolutionError={code:o.Status.UNAVAILABLE,details:`Name resolution failed for target ${(0,h.uriToString)(this.target)}`,metadata:new l.Metadata};const p={initialDelay:n["grpc.initial_reconnect_backoff_ms"],maxDelay:n["grpc.max_reconnect_backoff_ms"]};this.backoff=new f.BackoffTimeout(()=>{this.continueResolving&&this.startResolutionWithBackoff()},p),this.backoff.unref(),this.minTimeBetweenResolutionsMs=null!==(c=n["grpc.dns_min_time_between_resolutions_ms"])&&void 0!==c?c:3e4,this.nextResolutionTimer=setTimeout(()=>{},0),clearTimeout(this.nextResolutionTimer)}startResolution(){if(null!==this.ipResult)return this.returnedIpResult||(g("Returning IP address for target "+(0,h.uriToString)(this.target)),setImmediate(()=>{this.listener((0,a.statusOrFromValue)(this.ipResult),{},null,"")}),this.returnedIpResult=!0),this.backoff.stop(),this.backoff.reset(),void this.stopNextResolutionTimer();if(null===this.dnsHostname)g("Failed to parse DNS address "+(0,h.uriToString)(this.target)),setImmediate(()=>{this.listener((0,a.statusOrFromError)({code:o.Status.UNAVAILABLE,details:`Failed to parse DNS address ${(0,h.uriToString)(this.target)}`}),{},null,"")}),this.stopNextResolutionTimer();else{if(null!==this.pendingLookupPromise)return;g("Looking up DNS hostname "+this.dnsHostname),this.latestLookupResult=null;const e=this.dnsHostname;this.pendingLookupPromise=this.lookup(e),this.pendingLookupPromise.then(e=>{if(null===this.pendingLookupPromise)return;this.pendingLookupPromise=null,this.latestLookupResult=(0,a.statusOrFromValue)(e.map(e=>({addresses:[e]})));const t="["+e.map(e=>e.host+":"+e.port).join(",")+"]";g("Resolved addresses for target "+(0,h.uriToString)(this.target)+": "+t);const i=this.listener(this.latestLookupResult,{},this.latestServiceConfigResult,"");this.handleHealthStatus(i)},e=>{null!==this.pendingLookupPromise&&(g("Resolution error for target "+(0,h.uriToString)(this.target)+": "+e.message),this.pendingLookupPromise=null,this.stopNextResolutionTimer(),this.listener((0,a.statusOrFromError)(this.defaultResolutionError),{},this.latestServiceConfigResult,""))}),this.isServiceConfigEnabled&&null===this.pendingTxtPromise&&(this.pendingTxtPromise=this.resolveTxt(e),this.pendingTxtPromise.then(e=>{if(null===this.pendingTxtPromise)return;let t;this.pendingTxtPromise=null;try{t=(0,s.extractAndSelectServiceConfig)(e,this.percentage),this.latestServiceConfigResult=t?(0,a.statusOrFromValue)(t):null}catch(e){this.latestServiceConfigResult=(0,a.statusOrFromError)({code:o.Status.UNAVAILABLE,details:`Parsing service config failed with error ${e.message}`})}null!==this.latestLookupResult&&this.listener(this.latestLookupResult,{},this.latestServiceConfigResult,"")},e=>{}))}}handleHealthStatus(e){e?(this.backoff.stop(),this.backoff.reset()):this.continueResolving=!0}async lookup(e){if(p.GRPC_NODE_USE_ALTERNATIVE_RESOLVER){g("Using alternative DNS resolver.");const t=await Promise.allSettled([this.alternativeResolver.resolve4(e),this.alternativeResolver.resolve6(e)]);if(t.every(e=>"rejected"===e.status))throw new Error(t[0].reason);return t.reduce((e,t)=>"fulfilled"===t.status?[...e,...t.value]:e,[]).map(e=>({host:e,port:+this.port}))}return(await r.promises.lookup(e,{all:!0})).map(e=>({host:e.address,port:+this.port}))}async resolveTxt(e){return p.GRPC_NODE_USE_ALTERNATIVE_RESOLVER?(g("Using alternative DNS resolver."),this.alternativeResolver.resolveTxt(e)):r.promises.resolveTxt(e)}startNextResolutionTimer(){var e,t;clearTimeout(this.nextResolutionTimer),this.nextResolutionTimer=setTimeout(()=>{this.stopNextResolutionTimer(),this.continueResolving&&this.startResolutionWithBackoff()},this.minTimeBetweenResolutionsMs),null===(t=(e=this.nextResolutionTimer).unref)||void 0===t||t.call(e),this.isNextResolutionTimerRunning=!0}stopNextResolutionTimer(){clearTimeout(this.nextResolutionTimer),this.isNextResolutionTimerRunning=!1}startResolutionWithBackoff(){null===this.pendingLookupPromise&&(this.continueResolving=!1,this.backoff.runOnce(),this.startNextResolutionTimer(),this.startResolution())}updateResolution(){null===this.pendingLookupPromise&&(this.isNextResolutionTimerRunning||this.backoff.isRunning()?(this.isNextResolutionTimerRunning?g('resolution update delayed by "min time between resolutions" rate limit'):g("resolution update delayed by backoff timer until "+this.backoff.getEndTime().toISOString()),this.continueResolving=!0):this.startResolutionWithBackoff())}destroy(){this.continueResolving=!1,this.backoff.reset(),this.backoff.stop(),this.stopNextResolutionTimer(),this.pendingLookupPromise=null,this.pendingTxtPromise=null,this.latestLookupResult=null,this.latestServiceConfigResult=null,this.returnedIpResult=!1}static getDefaultAuthority(e){return e.path}}},82(e,t,i){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.setup=function(){(0,a.registerResolver)(d,p),(0,a.registerResolver)(f,p)};const n=i(9278),r=i(5034),s=i(131),o=i(4097),a=i(9302),l=i(8996),c=i(3822),u=i(267);function h(e){u.trace(s.LogVerbosity.DEBUG,"ip_resolver",e)}const d="ipv4",f="ipv6";class p{constructor(e,t,i){var r;this.listener=t,this.endpoints=[],this.error=null,this.hasReturnedResult=!1,h("Resolver constructed for target "+(0,c.uriToString)(e));const a=[];if(e.scheme!==d&&e.scheme!==f)return void(this.error={code:s.Status.UNAVAILABLE,details:`Unrecognized scheme ${e.scheme} in IP resolver`,metadata:new o.Metadata});const u=e.path.split(",");for(const t of u){const i=(0,c.splitHostPort)(t);if(null===i)return void(this.error={code:s.Status.UNAVAILABLE,details:`Failed to parse ${e.scheme} address ${t}`,metadata:new o.Metadata});if(e.scheme===d&&!(0,n.isIPv4)(i.host)||e.scheme===f&&!(0,n.isIPv6)(i.host))return void(this.error={code:s.Status.UNAVAILABLE,details:`Failed to parse ${e.scheme} address ${t}`,metadata:new o.Metadata});a.push({host:i.host,port:null!==(r=i.port)&&void 0!==r?r:443})}this.endpoints=a.map(e=>({addresses:[e]})),h("Parsed "+e.scheme+" address list "+a.map(l.subchannelAddressToString))}updateResolution(){this.hasReturnedResult||(this.hasReturnedResult=!0,process.nextTick(()=>{this.error?this.listener((0,r.statusOrFromError)(this.error),{},null,""):this.listener((0,r.statusOrFromValue)(this.endpoints),{},null,"")}))}destroy(){this.hasReturnedResult=!1}static getDefaultAuthority(e){return e.path.split(",")[0]}}},305(e,t,i){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.setup=function(){(0,n.registerResolver)("unix",s)};const n=i(9302),r=i(5034);class s{constructor(e,t,i){let n;this.listener=t,this.hasReturnedResult=!1,this.endpoints=[],n=""===e.authority?"/"+e.path:e.path,this.endpoints=[{addresses:[{path:n}]}]}updateResolution(){this.hasReturnedResult||(this.hasReturnedResult=!0,process.nextTick(this.listener,(0,r.statusOrFromValue)(this.endpoints),{},null,""))}destroy(){this.hasReturnedResult=!1}static getDefaultAuthority(e){return"localhost"}}},9302(e,t,i){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.CHANNEL_ARGS_CONFIG_SELECTOR_KEY=void 0,t.registerResolver=function(e,t){r[e]=t},t.registerDefaultScheme=function(e){s=e},t.createResolver=function(e,t,i){if(void 0!==e.scheme&&e.scheme in r)return new r[e.scheme](e,t,i);throw new Error(`No resolver could be created for target ${(0,n.uriToString)(e)}`)},t.getDefaultAuthority=function(e){if(void 0!==e.scheme&&e.scheme in r)return r[e.scheme].getDefaultAuthority(e);throw new Error(`Invalid target ${(0,n.uriToString)(e)}`)},t.mapUriDefaultScheme=function(e){if(void 0===e.scheme||!(e.scheme in r))return null!==s?{scheme:s,authority:void 0,path:(0,n.uriToString)(e)}:null;return e};const n=i(3822);t.CHANNEL_ARGS_CONFIG_SELECTOR_KEY="grpc.internal.config_selector";const r={};let s=null},8446(e,t,i){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ResolvingCall=void 0;const n=i(2267),r=i(131),s=i(6308),o=i(4097),a=i(267),l=i(6067);t.ResolvingCall=class{constructor(e,t,i,o,a){this.channel=e,this.method=t,this.filterStackFactory=o,this.callNumber=a,this.child=null,this.readPending=!1,this.pendingMessage=null,this.pendingHalfClose=!1,this.ended=!1,this.readFilterPending=!1,this.writeFilterPending=!1,this.pendingChildStatus=null,this.metadata=null,this.listener=null,this.statusWatchers=[],this.deadlineTimer=setTimeout(()=>{},0),this.filterStack=null,this.deadlineStartTime=null,this.configReceivedTime=null,this.childStartTime=null,this.credentials=n.CallCredentials.createEmpty(),this.deadline=i.deadline,this.host=i.host,i.parentCall&&(i.flags&r.Propagate.CANCELLATION&&i.parentCall.on("cancelled",()=>{this.cancelWithStatus(r.Status.CANCELLED,"Cancelled by parent call")}),i.flags&r.Propagate.DEADLINE&&(this.trace("Propagating deadline from parent: "+i.parentCall.getDeadline()),this.deadline=(0,s.minDeadline)(this.deadline,i.parentCall.getDeadline()))),this.trace("Created"),this.runDeadlineTimer()}trace(e){a.trace(r.LogVerbosity.DEBUG,"resolving_call","["+this.callNumber+"] "+e)}runDeadlineTimer(){clearTimeout(this.deadlineTimer),this.deadlineStartTime=new Date,this.trace("Deadline: "+(0,s.deadlineToString)(this.deadline));const e=(0,s.getRelativeTimeout)(this.deadline);if(e!==1/0){this.trace("Deadline will be reached in "+e+"ms");const t=()=>{if(!this.deadlineStartTime)return void this.cancelWithStatus(r.Status.DEADLINE_EXCEEDED,"Deadline exceeded");const e=[],t=new Date;e.push(`Deadline exceeded after ${(0,s.formatDateDifference)(this.deadlineStartTime,t)}`),this.configReceivedTime?(this.configReceivedTime>this.deadlineStartTime&&e.push(`name resolution: ${(0,s.formatDateDifference)(this.deadlineStartTime,this.configReceivedTime)}`),this.childStartTime?this.childStartTime>this.configReceivedTime&&e.push(`metadata filters: ${(0,s.formatDateDifference)(this.configReceivedTime,this.childStartTime)}`):e.push("waiting for metadata filters")):e.push("waiting for name resolution"),this.child&&e.push(...this.child.getDeadlineInfo()),this.cancelWithStatus(r.Status.DEADLINE_EXCEEDED,e.join(","))};e<=0?process.nextTick(t):this.deadlineTimer=setTimeout(t,e)}}outputStatus(e){if(!this.ended){this.ended=!0,this.filterStack||(this.filterStack=this.filterStackFactory.createFilter()),clearTimeout(this.deadlineTimer);const t=this.filterStack.receiveTrailers(e);this.trace("ended with status: code="+t.code+' details="'+t.details+'"'),this.statusWatchers.forEach(e=>e(t)),process.nextTick(()=>{var e;null===(e=this.listener)||void 0===e||e.onReceiveStatus(t)})}}sendMessageOnChild(e,t){if(!this.child)throw new Error("sendMessageonChild called with child not populated");const i=this.child;this.writeFilterPending=!0,this.filterStack.sendMessage(Promise.resolve({message:t,flags:e.flags})).then(t=>{this.writeFilterPending=!1,i.sendMessageWithContext(e,t.message),this.pendingHalfClose&&i.halfClose()},e=>{this.cancelWithStatus(e.code,e.details)})}getConfig(){if(this.ended)return;if(!this.metadata||!this.listener)throw new Error("getConfig called before start");const e=this.channel.getConfig(this.method,this.metadata);if("NONE"===e.type)return void this.channel.queueCallForConfig(this);if("ERROR"===e.type)return void(this.metadata.getOptions().waitForReady?this.channel.queueCallForConfig(this):this.outputStatus(e.error));this.configReceivedTime=new Date;const t=e.config;if(t.status!==r.Status.OK){const{code:e,details:i}=(0,l.restrictControlPlaneStatusCode)(t.status,"Failed to route call to method "+this.method);return void this.outputStatus({code:e,details:i,metadata:new o.Metadata})}if(t.methodConfig.timeout){const e=new Date;e.setSeconds(e.getSeconds()+t.methodConfig.timeout.seconds),e.setMilliseconds(e.getMilliseconds()+t.methodConfig.timeout.nanos/1e6),this.deadline=(0,s.minDeadline)(this.deadline,e),this.runDeadlineTimer()}this.filterStackFactory.push(t.dynamicFilterFactories),this.filterStack=this.filterStackFactory.createFilter(),this.filterStack.sendMetadata(Promise.resolve(this.metadata)).then(e=>{this.child=this.channel.createRetryingCall(t,this.method,this.host,this.credentials,this.deadline),this.trace("Created child ["+this.child.getCallNumber()+"]"),this.childStartTime=new Date,this.child.start(e,{onReceiveMetadata:e=>{this.trace("Received metadata"),this.listener.onReceiveMetadata(this.filterStack.receiveMetadata(e))},onReceiveMessage:e=>{this.trace("Received message"),this.readFilterPending=!0,this.filterStack.receiveMessage(e).then(e=>{this.trace("Finished filtering received message"),this.readFilterPending=!1,this.listener.onReceiveMessage(e),this.pendingChildStatus&&this.outputStatus(this.pendingChildStatus)},e=>{this.cancelWithStatus(e.code,e.details)})},onReceiveStatus:e=>{this.trace("Received status"),this.readFilterPending?this.pendingChildStatus=e:this.outputStatus(e)}}),this.readPending&&this.child.startRead(),this.pendingMessage?this.sendMessageOnChild(this.pendingMessage.context,this.pendingMessage.message):this.pendingHalfClose&&this.child.halfClose()},e=>{this.outputStatus(e)})}reportResolverError(e){var t;(null===(t=this.metadata)||void 0===t?void 0:t.getOptions().waitForReady)?this.channel.queueCallForConfig(this):this.outputStatus(e)}cancelWithStatus(e,t){var i;this.trace("cancelWithStatus code: "+e+' details: "'+t+'"'),null===(i=this.child)||void 0===i||i.cancelWithStatus(e,t),this.outputStatus({code:e,details:t,metadata:new o.Metadata})}getPeer(){var e,t;return null!==(t=null===(e=this.child)||void 0===e?void 0:e.getPeer())&&void 0!==t?t:this.channel.getTarget()}start(e,t){this.trace("start called"),this.metadata=e.clone(),this.listener=t,this.getConfig()}sendMessageWithContext(e,t){this.trace("write() called with message of length "+t.length),this.child?this.sendMessageOnChild(e,t):this.pendingMessage={context:e,message:t}}startRead(){this.trace("startRead called"),this.child?this.child.startRead():this.readPending=!0}halfClose(){this.trace("halfClose called"),this.child&&!this.writeFilterPending?this.child.halfClose():this.pendingHalfClose=!0}setCredentials(e){this.credentials=e}addStatusWatcher(e){this.statusWatchers.push(e)}getCallNumber(){return this.callNumber}getAuthContext(){return this.child?this.child.getAuthContext():null}}},4973(e,t,i){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ResolvingLoadBalancer=void 0;const n=i(8923),r=i(5656),s=i(463),o=i(9302),a=i(178),l=i(3956),c=i(131),u=i(4097),h=i(267),d=i(131),f=i(3822),p=i(533);function g(e){h.trace(d.LogVerbosity.DEBUG,"resolving_load_balancer",e)}const m=["SERVICE_AND_METHOD","SERVICE","EMPTY"];function v(e,t,i,n){for(const r of i.name)switch(n){case"EMPTY":if(!r.service&&!r.method)return!0;break;case"SERVICE":if(r.service===e&&!r.method)return!0;break;case"SERVICE_AND_METHOD":if(r.service===e&&r.method===t)return!0}return!1}function y(e,t,i,n){for(const r of i)if(v(e,t,r,n))return r;return null}t.ResolvingLoadBalancer=class{constructor(e,t,i,n,c){this.target=e,this.channelControlHelper=t,this.channelOptions=i,this.onSuccessfulResolution=n,this.onFailedResolution=c,this.latestChildState=s.ConnectivityState.IDLE,this.latestChildPicker=new a.QueuePicker(this),this.latestChildErrorMessage=null,this.currentState=s.ConnectivityState.IDLE,this.previousServiceConfig=null,this.continueResolving=!1,i["grpc.service_config"]?this.defaultServiceConfig=(0,r.validateServiceConfig)(JSON.parse(i["grpc.service_config"])):this.defaultServiceConfig={loadBalancingConfig:[],methodConfig:[]},this.updateState(s.ConnectivityState.IDLE,new a.QueuePicker(this),null),this.childLoadBalancer=new p.ChildLoadBalancerHandler({createSubchannel:t.createSubchannel.bind(t),requestReresolution:()=>{this.backoffTimeout.isRunning()?(g("requestReresolution delayed by backoff timer until "+this.backoffTimeout.getEndTime().toISOString()),this.continueResolving=!0):this.updateResolution()},updateState:(e,t,i)=>{this.latestChildState=e,this.latestChildPicker=t,this.latestChildErrorMessage=i,this.updateState(e,t,i)},addChannelzChild:t.addChannelzChild.bind(t),removeChannelzChild:t.removeChannelzChild.bind(t)}),this.innerResolver=(0,o.createResolver)(e,this.handleResolverResult.bind(this),i);const u={initialDelay:i["grpc.initial_reconnect_backoff_ms"],maxDelay:i["grpc.max_reconnect_backoff_ms"]};this.backoffTimeout=new l.BackoffTimeout(()=>{this.continueResolving?(this.updateResolution(),this.continueResolving=!1):this.updateState(this.latestChildState,this.latestChildPicker,this.latestChildErrorMessage)},u),this.backoffTimeout.unref()}handleResolverResult(e,t,i,r){var s,a;this.backoffTimeout.stop(),this.backoffTimeout.reset();let l=!0,h=null;if(null===i?h=this.defaultServiceConfig:i.ok?h=i.value:null!==this.previousServiceConfig?h=this.previousServiceConfig:(l=!1,this.handleResolutionFailure(i.error)),null!==h){const i=null!==(s=null==h?void 0:h.loadBalancingConfig)&&void 0!==s?s:[],o=(0,n.selectLbConfigFromList)(i,!0);null===o?(l=!1,this.handleResolutionFailure({code:c.Status.UNAVAILABLE,details:"All load balancer options in service config are not compatible",metadata:new u.Metadata})):l=this.childLoadBalancer.updateAddressList(e,o,Object.assign(Object.assign({},this.channelOptions),t),r)}return l&&this.onSuccessfulResolution(h,null!==(a=t[o.CHANNEL_ARGS_CONFIG_SELECTOR_KEY])&&void 0!==a?a:function(e){return{invoke(t,i){var n,r;const s=t.split("/").filter(e=>e.length>0),o=null!==(n=s[0])&&void 0!==n?n:"",a=null!==(r=s[1])&&void 0!==r?r:"";if(e&&e.methodConfig)for(const t of m){const i=y(o,a,e.methodConfig,t);if(i)return{methodConfig:i,pickInformation:{},status:c.Status.OK,dynamicFilterFactories:[]}}return{methodConfig:{name:[]},pickInformation:{},status:c.Status.OK,dynamicFilterFactories:[]}},unref(){}}}(h)),l}updateResolution(){this.innerResolver.updateResolution(),this.currentState===s.ConnectivityState.IDLE&&this.updateState(s.ConnectivityState.CONNECTING,this.latestChildPicker,this.latestChildErrorMessage),this.backoffTimeout.runOnce()}updateState(e,t,i){g((0,f.uriToString)(this.target)+" "+s.ConnectivityState[this.currentState]+" -> "+s.ConnectivityState[e]),e===s.ConnectivityState.IDLE&&(t=new a.QueuePicker(this,t)),this.currentState=e,this.channelControlHelper.updateState(e,t,i)}handleResolutionFailure(e){this.latestChildState===s.ConnectivityState.IDLE&&(this.updateState(s.ConnectivityState.TRANSIENT_FAILURE,new a.UnavailablePicker(e),e.details),this.onFailedResolution(e))}exitIdle(){this.currentState!==s.ConnectivityState.IDLE&&this.currentState!==s.ConnectivityState.TRANSIENT_FAILURE||(this.backoffTimeout.isRunning()?this.continueResolving=!0:this.updateResolution()),this.childLoadBalancer.exitIdle()}updateAddressList(e,t){throw new Error("updateAddressList not supported on ResolvingLoadBalancer")}resetBackoff(){this.backoffTimeout.reset(),this.childLoadBalancer.resetBackoff()}destroy(){this.childLoadBalancer.destroy(),this.innerResolver.destroy(),this.backoffTimeout.reset(),this.backoffTimeout.stop(),this.latestChildState=s.ConnectivityState.IDLE,this.latestChildPicker=new a.QueuePicker(this),this.currentState=s.ConnectivityState.IDLE,this.previousServiceConfig=null,this.continueResolving=!1}getTypeName(){return"resolving_load_balancer"}}},3135(e,t,i){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.RetryingCall=t.MessageBufferTracker=t.RetryThrottler=void 0;const n=i(131),r=i(6308),s=i(4097),o=i(267);t.RetryThrottler=class{constructor(e,t,i){this.maxTokens=e,this.tokenRatio=t,this.tokens=i?i.tokens*(e/i.maxTokens):e}addCallSucceeded(){this.tokens=Math.min(this.tokens+this.tokenRatio,this.maxTokens)}addCallFailed(){this.tokens=Math.max(this.tokens-1,0)}canRetryCall(){return this.tokens>this.maxTokens/2}};t.MessageBufferTracker=class{constructor(e,t){this.totalLimit=e,this.limitPerCall=t,this.totalAllocated=0,this.allocatedPerCall=new Map}allocate(e,t){var i;const n=null!==(i=this.allocatedPerCall.get(t))&&void 0!==i?i:0;return!(this.limitPerCall-n<e||this.totalLimit-this.totalAllocated<e)&&(this.allocatedPerCall.set(t,n+e),this.totalAllocated+=e,!0)}free(e,t){var i;if(this.totalAllocated<e)throw new Error(`Invalid buffer allocation state: call ${t} freed ${e} > total allocated ${this.totalAllocated}`);this.totalAllocated-=e;const n=null!==(i=this.allocatedPerCall.get(t))&&void 0!==i?i:0;if(n<e)throw new Error(`Invalid buffer allocation state: call ${t} freed ${e} > allocated for call ${n}`);this.allocatedPerCall.set(t,n-e)}freeAll(e){var t;const i=null!==(t=this.allocatedPerCall.get(e))&&void 0!==t?t:0;if(this.totalAllocated<i)throw new Error(`Invalid buffer allocation state: call ${e} allocated ${i} > total allocated ${this.totalAllocated}`);this.totalAllocated-=i,this.allocatedPerCall.delete(e)}};const a="grpc-previous-rpc-attempts";t.RetryingCall=class{constructor(e,t,i,n,r,s,o,a,l){var c;this.channel=e,this.callConfig=t,this.methodName=i,this.host=n,this.credentials=r,this.deadline=s,this.callNumber=o,this.bufferTracker=a,this.retryThrottler=l,this.listener=null,this.initialMetadata=null,this.underlyingCalls=[],this.writeBuffer=[],this.writeBufferOffset=0,this.readStarted=!1,this.transparentRetryUsed=!1,this.attempts=0,this.hedgingTimer=null,this.committedCallIndex=null,this.initialRetryBackoffSec=0,this.nextRetryBackoffSec=0;const u=null!==(c=e.getOptions()["grpc-node.retry_max_attempts_limit"])&&void 0!==c?c:5;if(0===e.getOptions()["grpc.enable_retries"])this.state="NO_RETRY",this.maxAttempts=1;else if(t.methodConfig.retryPolicy){this.state="RETRY";const e=t.methodConfig.retryPolicy;this.nextRetryBackoffSec=this.initialRetryBackoffSec=Number(e.initialBackoff.substring(0,e.initialBackoff.length-1)),this.maxAttempts=Math.min(e.maxAttempts,u)}else t.methodConfig.hedgingPolicy?(this.state="HEDGING",this.maxAttempts=Math.min(t.methodConfig.hedgingPolicy.maxAttempts,u)):(this.state="TRANSPARENT_ONLY",this.maxAttempts=1);this.startTime=new Date}getDeadlineInfo(){if(0===this.underlyingCalls.length)return[];const e=[],t=this.underlyingCalls[this.underlyingCalls.length-1];return this.underlyingCalls.length>1&&e.push("previous attempts: "+(this.underlyingCalls.length-1)),t.startTime>this.startTime&&e.push(`time to current attempt start: ${(0,r.formatDateDifference)(this.startTime,t.startTime)}`),e.push(...t.call.getDeadlineInfo()),e}getCallNumber(){return this.callNumber}trace(e){o.trace(n.LogVerbosity.DEBUG,"retrying_call","["+this.callNumber+"] "+e)}reportStatus(e){this.trace("ended with status: code="+e.code+' details="'+e.details+'" start time='+this.startTime.toISOString()),this.bufferTracker.freeAll(this.callNumber),this.writeBufferOffset=this.writeBufferOffset+this.writeBuffer.length,this.writeBuffer=[],process.nextTick(()=>{var t;null===(t=this.listener)||void 0===t||t.onReceiveStatus({code:e.code,details:e.details,metadata:e.metadata})})}cancelWithStatus(e,t){this.trace("cancelWithStatus code: "+e+' details: "'+t+'"'),this.reportStatus({code:e,details:t,metadata:new s.Metadata});for(const{call:i}of this.underlyingCalls)i.cancelWithStatus(e,t)}getPeer(){return null!==this.committedCallIndex?this.underlyingCalls[this.committedCallIndex].call.getPeer():"unknown"}getBufferEntry(e){var t;return null!==(t=this.writeBuffer[e-this.writeBufferOffset])&&void 0!==t?t:{entryType:"FREED",allocated:!1}}getNextBufferIndex(){return this.writeBufferOffset+this.writeBuffer.length}clearSentMessages(){if("COMMITTED"!==this.state)return;let e;e="COMPLETED"===this.underlyingCalls[this.committedCallIndex].state?this.getNextBufferIndex():this.underlyingCalls[this.committedCallIndex].nextMessageToSend;for(let t=this.writeBufferOffset;t<e;t++){const e=this.getBufferEntry(t);e.allocated&&this.bufferTracker.free(e.message.message.length,this.callNumber)}this.writeBuffer=this.writeBuffer.slice(e-this.writeBufferOffset),this.writeBufferOffset=e}commitCall(e){var t,i;if("COMMITTED"!==this.state){this.trace("Committing call ["+this.underlyingCalls[e].call.getCallNumber()+"] at index "+e),this.state="COMMITTED",null===(i=(t=this.callConfig).onCommitted)||void 0===i||i.call(t),this.committedCallIndex=e;for(let t=0;t<this.underlyingCalls.length;t++)t!==e&&"COMPLETED"!==this.underlyingCalls[t].state&&(this.underlyingCalls[t].state="COMPLETED",this.underlyingCalls[t].call.cancelWithStatus(n.Status.CANCELLED,"Discarded in favor of other hedged attempt"));this.clearSentMessages()}}commitCallWithMostMessages(){if("COMMITTED"===this.state)return;let e=-1,t=-1;for(const[i,n]of this.underlyingCalls.entries())"ACTIVE"===n.state&&n.nextMessageToSend>e&&(e=n.nextMessageToSend,t=i);-1===t?this.state="TRANSPARENT_ONLY":this.commitCall(t)}isStatusCodeInList(e,t){return e.some(e=>{var i;return e===t||e.toString().toLowerCase()===(null===(i=n.Status[t])||void 0===i?void 0:i.toLowerCase())})}getNextRetryJitter(){return Math.random()*(1.2-.8)+.8}getNextRetryBackoffMs(){var e;const t=null===(e=this.callConfig)||void 0===e?void 0:e.methodConfig.retryPolicy;if(!t)return 0;const i=this.getNextRetryJitter()*this.nextRetryBackoffSec*1e3,n=Number(t.maxBackoff.substring(0,t.maxBackoff.length-1));return this.nextRetryBackoffSec=Math.min(this.nextRetryBackoffSec*t.backoffMultiplier,n),i}maybeRetryCall(e,t){if("RETRY"!==this.state)return void t(!1);if(this.attempts>=this.maxAttempts)return void t(!1);let i;if(null===e)i=this.getNextRetryBackoffMs();else{if(e<0)return this.state="TRANSPARENT_ONLY",void t(!1);i=e,this.nextRetryBackoffSec=this.initialRetryBackoffSec}setTimeout(()=>{var e,i;"RETRY"===this.state?null===(i=null===(e=this.retryThrottler)||void 0===e?void 0:e.canRetryCall())||void 0===i||i?(t(!0),this.attempts+=1,this.startNewAttempt()):(this.trace("Retry attempt denied by throttling policy"),t(!1)):t(!1)},i)}countActiveCalls(){let e=0;for(const t of this.underlyingCalls)"ACTIVE"===(null==t?void 0:t.state)&&(e+=1);return e}handleProcessedStatus(e,t,i){var n,r,s;switch(this.state){case"COMMITTED":case"NO_RETRY":case"TRANSPARENT_ONLY":this.commitCall(t),this.reportStatus(e);break;case"HEDGING":if(this.isStatusCodeInList(null!==(n=this.callConfig.methodConfig.hedgingPolicy.nonFatalStatusCodes)&&void 0!==n?n:[],e.code)){let n;if(null===(r=this.retryThrottler)||void 0===r||r.addCallFailed(),null===i)n=0;else{if(i<0)return this.state="TRANSPARENT_ONLY",this.commitCall(t),void this.reportStatus(e);n=i}setTimeout(()=>{this.maybeStartHedgingAttempt(),0===this.countActiveCalls()&&(this.commitCall(t),this.reportStatus(e))},n)}else this.commitCall(t),this.reportStatus(e);break;case"RETRY":this.isStatusCodeInList(this.callConfig.methodConfig.retryPolicy.retryableStatusCodes,e.code)?(null===(s=this.retryThrottler)||void 0===s||s.addCallFailed(),this.maybeRetryCall(i,i=>{i||(this.commitCall(t),this.reportStatus(e))})):(this.commitCall(t),this.reportStatus(e))}}getPushback(e){const t=e.get("grpc-retry-pushback-ms");if(0===t.length)return null;try{return parseInt(t[0])}catch(e){return-1}}handleChildStatus(e,t){var i;if("COMPLETED"===this.underlyingCalls[t].state)return;if(this.trace("state="+this.state+" handling status with progress "+e.progress+" from child ["+this.underlyingCalls[t].call.getCallNumber()+"] in state "+this.underlyingCalls[t].state),this.underlyingCalls[t].state="COMPLETED",e.code===n.Status.OK)return null===(i=this.retryThrottler)||void 0===i||i.addCallSucceeded(),this.commitCall(t),void this.reportStatus(e);if("NO_RETRY"===this.state)return this.commitCall(t),void this.reportStatus(e);if("COMMITTED"===this.state)return void this.reportStatus(e);const r=this.getPushback(e.metadata);switch(e.progress){case"NOT_STARTED":this.startNewAttempt();break;case"REFUSED":this.transparentRetryUsed?this.handleProcessedStatus(e,t,r):(this.transparentRetryUsed=!0,this.startNewAttempt());break;case"DROP":this.commitCall(t),this.reportStatus(e);break;case"PROCESSED":this.handleProcessedStatus(e,t,r)}}maybeStartHedgingAttempt(){"HEDGING"===this.state&&this.callConfig.methodConfig.hedgingPolicy&&(this.attempts>=this.maxAttempts||(this.attempts+=1,this.startNewAttempt(),this.maybeStartHedgingTimer()))}maybeStartHedgingTimer(){var e,t,i;if(this.hedgingTimer&&clearTimeout(this.hedgingTimer),"HEDGING"!==this.state)return;if(!this.callConfig.methodConfig.hedgingPolicy)return;const n=this.callConfig.methodConfig.hedgingPolicy;if(this.attempts>=this.maxAttempts)return;const r=null!==(e=n.hedgingDelay)&&void 0!==e?e:"0s",s=Number(r.substring(0,r.length-1));this.hedgingTimer=setTimeout(()=>{this.maybeStartHedgingAttempt()},1e3*s),null===(i=(t=this.hedgingTimer).unref)||void 0===i||i.call(t)}startNewAttempt(){const e=this.channel.createLoadBalancingCall(this.callConfig,this.methodName,this.host,this.credentials,this.deadline);this.trace("Created child call ["+e.getCallNumber()+"] for attempt "+this.attempts);const t=this.underlyingCalls.length;this.underlyingCalls.push({state:"ACTIVE",call:e,nextMessageToSend:0,startTime:new Date});const i=this.attempts-1,n=this.initialMetadata.clone();i>0&&n.set(a,`${i}`);let r=!1;e.start(n,{onReceiveMetadata:n=>{this.trace("Received metadata from child ["+e.getCallNumber()+"]"),this.commitCall(t),r=!0,i>0&&n.set(a,`${i}`),"ACTIVE"===this.underlyingCalls[t].state&&this.listener.onReceiveMetadata(n)},onReceiveMessage:i=>{this.trace("Received message from child ["+e.getCallNumber()+"]"),this.commitCall(t),"ACTIVE"===this.underlyingCalls[t].state&&this.listener.onReceiveMessage(i)},onReceiveStatus:n=>{this.trace("Received status from child ["+e.getCallNumber()+"]"),!r&&i>0&&n.metadata.set(a,`${i}`),this.handleChildStatus(n,t)}}),this.sendNextChildMessage(t),this.readStarted&&e.startRead()}start(e,t){this.trace("start called"),this.listener=t,this.initialMetadata=e,this.attempts+=1,this.startNewAttempt(),this.maybeStartHedgingTimer()}handleChildWriteCompleted(e,t){var i,n;null===(n=(i=this.getBufferEntry(t)).callback)||void 0===n||n.call(i),this.clearSentMessages();this.underlyingCalls[e].nextMessageToSend+=1,this.sendNextChildMessage(e)}sendNextChildMessage(e){const t=this.underlyingCalls[e];if("COMPLETED"===t.state)return;const i=t.nextMessageToSend;if(this.getBufferEntry(i)){const n=this.getBufferEntry(i);switch(n.entryType){case"MESSAGE":t.call.sendMessageWithContext({callback:t=>{this.handleChildWriteCompleted(e,i)}},n.message.message);"HALF_CLOSE"===this.getBufferEntry(i+1).entryType&&(this.trace("Sending halfClose immediately after message to child ["+t.call.getCallNumber()+"] - optimizing for unary/final message"),t.nextMessageToSend+=1,t.call.halfClose());break;case"HALF_CLOSE":t.nextMessageToSend+=1,t.call.halfClose()}}}sendMessageWithContext(e,t){this.trace("write() called with message of length "+t.length);const i={message:t,flags:e.flags},n=this.getNextBufferIndex(),r={entryType:"MESSAGE",message:i,allocated:this.bufferTracker.allocate(t.length,this.callNumber)};if(this.writeBuffer.push(r),r.allocated){process.nextTick(()=>{var t;null===(t=e.callback)||void 0===t||t.call(e)});for(const[e,i]of this.underlyingCalls.entries())"ACTIVE"===i.state&&i.nextMessageToSend===n&&i.call.sendMessageWithContext({callback:t=>{this.handleChildWriteCompleted(e,n)}},t)}else{if(this.commitCallWithMostMessages(),null===this.committedCallIndex)return;const i=this.underlyingCalls[this.committedCallIndex];r.callback=e.callback,"ACTIVE"===i.state&&i.nextMessageToSend===n&&i.call.sendMessageWithContext({callback:e=>{this.handleChildWriteCompleted(this.committedCallIndex,n)}},t)}}startRead(){this.trace("startRead called"),this.readStarted=!0;for(const e of this.underlyingCalls)"ACTIVE"===(null==e?void 0:e.state)&&e.call.startRead()}halfClose(){this.trace("halfClose called");const e=this.getNextBufferIndex();this.writeBuffer.push({entryType:"HALF_CLOSE",allocated:!1});for(const t of this.underlyingCalls)"ACTIVE"===(null==t?void 0:t.state)&&(t.nextMessageToSend!==e&&t.nextMessageToSend!==e-1||(this.trace("Sending halfClose immediately to child ["+t.call.getCallNumber()+"] - all messages already sent"),t.nextMessageToSend+=1,t.call.halfClose()))}setCredentials(e){throw new Error("Method not implemented.")}getMethod(){return this.methodName}getHost(){return this.host}getAuthContext(){return null!==this.committedCallIndex?this.underlyingCalls[this.committedCallIndex].call.getAuthContext():null}}},6860(e,t,i){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ServerDuplexStreamImpl=t.ServerWritableStreamImpl=t.ServerReadableStreamImpl=t.ServerUnaryCallImpl=void 0,t.serverErrorToStatus=a;const n=i(4434),r=i(2203),s=i(131),o=i(4097);function a(e,t){var i;const n={code:s.Status.UNKNOWN,details:"message"in e?e.message:"Unknown Error",metadata:null!==(i=null!=t?t:e.metadata)&&void 0!==i?i:null};return"code"in e&&"number"==typeof e.code&&Number.isInteger(e.code)&&(n.code=e.code,"details"in e&&"string"==typeof e.details&&(n.details=e.details)),n}class l extends n.EventEmitter{constructor(e,t,i,n){super(),this.path=e,this.call=t,this.metadata=i,this.request=n,this.cancelled=!1}getPeer(){return this.call.getPeer()}sendMetadata(e){this.call.sendMetadata(e)}getDeadline(){return this.call.getDeadline()}getPath(){return this.path}getHost(){return this.call.getHost()}getAuthContext(){return this.call.getAuthContext()}getMetricsRecorder(){return this.call.getMetricsRecorder()}}t.ServerUnaryCallImpl=l;class c extends r.Readable{constructor(e,t,i){super({objectMode:!0}),this.path=e,this.call=t,this.metadata=i,this.cancelled=!1}_read(e){this.call.startRead()}getPeer(){return this.call.getPeer()}sendMetadata(e){this.call.sendMetadata(e)}getDeadline(){return this.call.getDeadline()}getPath(){return this.path}getHost(){return this.call.getHost()}getAuthContext(){return this.call.getAuthContext()}getMetricsRecorder(){return this.call.getMetricsRecorder()}}t.ServerReadableStreamImpl=c;class u extends r.Writable{constructor(e,t,i,n){super({objectMode:!0}),this.path=e,this.call=t,this.metadata=i,this.request=n,this.pendingStatus={code:s.Status.OK,details:"OK"},this.cancelled=!1,this.trailingMetadata=new o.Metadata,this.on("error",e=>{this.pendingStatus=a(e),this.end()})}getPeer(){return this.call.getPeer()}sendMetadata(e){this.call.sendMetadata(e)}getDeadline(){return this.call.getDeadline()}getPath(){return this.path}getHost(){return this.call.getHost()}getAuthContext(){return this.call.getAuthContext()}getMetricsRecorder(){return this.call.getMetricsRecorder()}_write(e,t,i){this.call.sendMessage(e,i)}_final(e){var t;e(null),this.call.sendStatus(Object.assign(Object.assign({},this.pendingStatus),{metadata:null!==(t=this.pendingStatus.metadata)&&void 0!==t?t:this.trailingMetadata}))}end(e){return e&&(this.trailingMetadata=e),super.end()}}t.ServerWritableStreamImpl=u;class h extends r.Duplex{constructor(e,t,i){super({objectMode:!0}),this.path=e,this.call=t,this.metadata=i,this.pendingStatus={code:s.Status.OK,details:"OK"},this.cancelled=!1,this.trailingMetadata=new o.Metadata,this.on("error",e=>{this.pendingStatus=a(e),this.end()})}getPeer(){return this.call.getPeer()}sendMetadata(e){this.call.sendMetadata(e)}getDeadline(){return this.call.getDeadline()}getPath(){return this.path}getHost(){return this.call.getHost()}getAuthContext(){return this.call.getAuthContext()}getMetricsRecorder(){return this.call.getMetricsRecorder()}_read(e){this.call.startRead()}_write(e,t,i){this.call.sendMessage(e,i)}_final(e){var t;e(null),this.call.sendStatus(Object.assign(Object.assign({},this.pendingStatus),{metadata:null!==(t=this.pendingStatus.metadata)&&void 0!==t?t:this.trailingMetadata}))}end(e){return e&&(this.trailingMetadata=e),super.end()}}t.ServerDuplexStreamImpl=h},8692(e,t,i){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ServerCredentials=void 0,t.createCertificateProviderServerCredentials=function(e,t,i){return new a(e,t,i)},t.createServerCredentialsWithInterceptors=function(e,t){return new l(e,t)};const n=i(9167);class r{constructor(e,t){this.serverConstructorOptions=e,this.watchers=new Set,this.latestContextOptions=null,this.latestContextOptions=null!=t?t:null}_addWatcher(e){this.watchers.add(e)}_removeWatcher(e){this.watchers.delete(e)}getWatcherCount(){return this.watchers.size}updateSecureContextOptions(e){this.latestContextOptions=e;for(const e of this.watchers)e(this.latestContextOptions)}_isSecure(){return null!==this.serverConstructorOptions}_getSecureContextOptions(){return this.latestContextOptions}_getConstructorOptions(){return this.serverConstructorOptions}_getInterceptors(){return[]}static createInsecure(){return new s}static createSsl(e,t,i=!1){var r;if(null!==e&&!Buffer.isBuffer(e))throw new TypeError("rootCerts must be null or a Buffer");if(!Array.isArray(t))throw new TypeError("keyCertPairs must be an array");if("boolean"!=typeof i)throw new TypeError("checkClientCertificate must be a boolean");const s=[],a=[];for(let e=0;e<t.length;e++){const i=t[e];if(null===i||"object"!=typeof i)throw new TypeError(`keyCertPair[${e}] must be an object`);if(!Buffer.isBuffer(i.private_key))throw new TypeError(`keyCertPair[${e}].private_key must be a Buffer`);if(!Buffer.isBuffer(i.cert_chain))throw new TypeError(`keyCertPair[${e}].cert_chain must be a Buffer`);s.push(i.cert_chain),a.push(i.private_key)}return new o({requestCert:i,ciphers:n.CIPHER_SUITES},{ca:null!==(r=null!=e?e:(0,n.getDefaultRootsData)())&&void 0!==r?r:void 0,cert:s,key:a})}}t.ServerCredentials=r;class s extends r{constructor(){super(null)}_getSettings(){return null}_equals(e){return e instanceof s}}class o extends r{constructor(e,t){super(e,t),this.options=Object.assign(Object.assign({},e),t)}_equals(e){if(this===e)return!0;if(!(e instanceof o))return!1;if(Buffer.isBuffer(this.options.ca)&&Buffer.isBuffer(e.options.ca)){if(!this.options.ca.equals(e.options.ca))return!1}else if(this.options.ca!==e.options.ca)return!1;if(Array.isArray(this.options.cert)&&Array.isArray(e.options.cert)){if(this.options.cert.length!==e.options.cert.length)return!1;for(let t=0;t<this.options.cert.length;t++){const i=this.options.cert[t],n=e.options.cert[t];if(Buffer.isBuffer(i)&&Buffer.isBuffer(n)){if(!i.equals(n))return!1}else if(i!==n)return!1}}else if(this.options.cert!==e.options.cert)return!1;if(Array.isArray(this.options.key)&&Array.isArray(e.options.key)){if(this.options.key.length!==e.options.key.length)return!1;for(let t=0;t<this.options.key.length;t++){const i=this.options.key[t],n=e.options.key[t];if(Buffer.isBuffer(i)&&Buffer.isBuffer(n)){if(!i.equals(n))return!1}else if(i!==n)return!1}}else if(this.options.key!==e.options.key)return!1;return this.options.requestCert===e.options.requestCert}}class a extends r{constructor(e,t,i){super({requestCert:null!==t,rejectUnauthorized:i,ciphers:n.CIPHER_SUITES}),this.identityCertificateProvider=e,this.caCertificateProvider=t,this.requireClientCertificate=i,this.latestCaUpdate=null,this.latestIdentityUpdate=null,this.caCertificateUpdateListener=this.handleCaCertificateUpdate.bind(this),this.identityCertificateUpdateListener=this.handleIdentityCertitificateUpdate.bind(this)}_addWatcher(e){var t;0===this.getWatcherCount()&&(null===(t=this.caCertificateProvider)||void 0===t||t.addCaCertificateListener(this.caCertificateUpdateListener),this.identityCertificateProvider.addIdentityCertificateListener(this.identityCertificateUpdateListener)),super._addWatcher(e)}_removeWatcher(e){var t;super._removeWatcher(e),0===this.getWatcherCount()&&(null===(t=this.caCertificateProvider)||void 0===t||t.removeCaCertificateListener(this.caCertificateUpdateListener),this.identityCertificateProvider.removeIdentityCertificateListener(this.identityCertificateUpdateListener))}_equals(e){return this===e||e instanceof a&&(this.caCertificateProvider===e.caCertificateProvider&&this.identityCertificateProvider===e.identityCertificateProvider&&this.requireClientCertificate===e.requireClientCertificate)}calculateSecureContextOptions(){var e;return null===this.latestIdentityUpdate||null!==this.caCertificateProvider&&null===this.latestCaUpdate?null:{ca:null===(e=this.latestCaUpdate)||void 0===e?void 0:e.caCertificate,cert:[this.latestIdentityUpdate.certificate],key:[this.latestIdentityUpdate.privateKey]}}finalizeUpdate(){const e=this.calculateSecureContextOptions();this.updateSecureContextOptions(e)}handleCaCertificateUpdate(e){this.latestCaUpdate=e,this.finalizeUpdate()}handleIdentityCertitificateUpdate(e){this.latestIdentityUpdate=e,this.finalizeUpdate()}}class l extends r{constructor(e,t){super({}),this.childCredentials=e,this.interceptors=t}_isSecure(){return this.childCredentials._isSecure()}_equals(e){if(!(e instanceof l))return!1;if(!this.childCredentials._equals(e.childCredentials))return!1;if(this.interceptors.length!==e.interceptors.length)return!1;for(let t=0;t<this.interceptors.length;t++)if(this.interceptors[t]!==e.interceptors[t])return!1;return!0}_getInterceptors(){return this.interceptors}_addWatcher(e){this.childCredentials._addWatcher(e)}_removeWatcher(e){this.childCredentials._removeWatcher(e)}_getConstructorOptions(){return this.childCredentials._getConstructorOptions()}_getSecureContextOptions(){return this.childCredentials._getSecureContextOptions()}}},4892(e,t,i){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.BaseServerInterceptingCall=t.ServerInterceptingCall=t.ResponderBuilder=t.ServerListenerBuilder=void 0,t.isInterceptingServerListener=function(e){return void 0!==e.onReceiveMetadata&&1===e.onReceiveMetadata.length},t.getServerInterceptingCall=function(e,t,i,n,r,s){const o={path:r.path,requestStream:"clientStream"===r.type||"bidi"===r.type,responseStream:"serverStream"===r.type||"bidi"===r.type,requestDeserialize:r.deserialize,responseSerialize:r.serialize},a=new R(t,i,n,r,s);return e.reduce((e,t)=>t(o,e),a)};const n=i(4097),r=i(131),s=i(5675),o=i(9752),a=i(3106),l=i(9453),c=i(267),u=i(4756),h=i(2921),d="server_call";function f(e){c.trace(r.LogVerbosity.DEBUG,d,e)}t.ServerListenerBuilder=class{constructor(){this.metadata=void 0,this.message=void 0,this.halfClose=void 0,this.cancel=void 0}withOnReceiveMetadata(e){return this.metadata=e,this}withOnReceiveMessage(e){return this.message=e,this}withOnReceiveHalfClose(e){return this.halfClose=e,this}withOnCancel(e){return this.cancel=e,this}build(){return{onReceiveMetadata:this.metadata,onReceiveMessage:this.message,onReceiveHalfClose:this.halfClose,onCancel:this.cancel}}};class p{constructor(e,t){this.listener=e,this.nextListener=t,this.cancelled=!1,this.processingMetadata=!1,this.hasPendingMessage=!1,this.pendingMessage=null,this.processingMessage=!1,this.hasPendingHalfClose=!1}processPendingMessage(){this.hasPendingMessage&&(this.nextListener.onReceiveMessage(this.pendingMessage),this.pendingMessage=null,this.hasPendingMessage=!1)}processPendingHalfClose(){this.hasPendingHalfClose&&(this.nextListener.onReceiveHalfClose(),this.hasPendingHalfClose=!1)}onReceiveMetadata(e){this.cancelled||(this.processingMetadata=!0,this.listener.onReceiveMetadata(e,e=>{this.processingMetadata=!1,this.cancelled||(this.nextListener.onReceiveMetadata(e),this.processPendingMessage(),this.processPendingHalfClose())}))}onReceiveMessage(e){this.cancelled||(this.processingMessage=!0,this.listener.onReceiveMessage(e,e=>{this.processingMessage=!1,this.cancelled||(this.processingMetadata?(this.pendingMessage=e,this.hasPendingMessage=!0):(this.nextListener.onReceiveMessage(e),this.processPendingHalfClose()))}))}onReceiveHalfClose(){this.cancelled||this.listener.onReceiveHalfClose(()=>{this.cancelled||(this.processingMetadata||this.processingMessage?this.hasPendingHalfClose=!0:this.nextListener.onReceiveHalfClose())})}onCancel(){this.cancelled=!0,this.listener.onCancel(),this.nextListener.onCancel()}}t.ResponderBuilder=class{constructor(){this.start=void 0,this.metadata=void 0,this.message=void 0,this.status=void 0}withStart(e){return this.start=e,this}withSendMetadata(e){return this.metadata=e,this}withSendMessage(e){return this.message=e,this}withSendStatus(e){return this.status=e,this}build(){return{start:this.start,sendMetadata:this.metadata,sendMessage:this.message,sendStatus:this.status}}};const g={onReceiveMetadata:(e,t)=>{t(e)},onReceiveMessage:(e,t)=>{t(e)},onReceiveHalfClose:e=>{e()},onCancel:()=>{}},m={start:e=>{e()},sendMetadata:(e,t)=>{t(e)},sendMessage:(e,t)=>{t(e)},sendStatus:(e,t)=>{t(e)}};t.ServerInterceptingCall=class{constructor(e,t){var i,n,r,s;this.nextCall=e,this.processingMetadata=!1,this.sentMetadata=!1,this.processingMessage=!1,this.pendingMessage=null,this.pendingMessageCallback=null,this.pendingStatus=null,this.responder={start:null!==(i=null==t?void 0:t.start)&&void 0!==i?i:m.start,sendMetadata:null!==(n=null==t?void 0:t.sendMetadata)&&void 0!==n?n:m.sendMetadata,sendMessage:null!==(r=null==t?void 0:t.sendMessage)&&void 0!==r?r:m.sendMessage,sendStatus:null!==(s=null==t?void 0:t.sendStatus)&&void 0!==s?s:m.sendStatus}}processPendingMessage(){this.pendingMessageCallback&&(this.nextCall.sendMessage(this.pendingMessage,this.pendingMessageCallback),this.pendingMessage=null,this.pendingMessageCallback=null)}processPendingStatus(){this.pendingStatus&&(this.nextCall.sendStatus(this.pendingStatus),this.pendingStatus=null)}start(e){this.responder.start(t=>{var i,n,r,s;const o={onReceiveMetadata:null!==(i=null==t?void 0:t.onReceiveMetadata)&&void 0!==i?i:g.onReceiveMetadata,onReceiveMessage:null!==(n=null==t?void 0:t.onReceiveMessage)&&void 0!==n?n:g.onReceiveMessage,onReceiveHalfClose:null!==(r=null==t?void 0:t.onReceiveHalfClose)&&void 0!==r?r:g.onReceiveHalfClose,onCancel:null!==(s=null==t?void 0:t.onCancel)&&void 0!==s?s:g.onCancel},a=new p(o,e);this.nextCall.start(a)})}sendMetadata(e){this.processingMetadata=!0,this.sentMetadata=!0,this.responder.sendMetadata(e,e=>{this.processingMetadata=!1,this.nextCall.sendMetadata(e),this.processPendingMessage(),this.processPendingStatus()})}sendMessage(e,t){this.processingMessage=!0,this.sentMetadata||this.sendMetadata(new n.Metadata),this.responder.sendMessage(e,e=>{this.processingMessage=!1,this.processingMetadata?(this.pendingMessage=e,this.pendingMessageCallback=t):this.nextCall.sendMessage(e,t)})}sendStatus(e){this.responder.sendStatus(e,e=>{this.processingMetadata||this.processingMessage?this.pendingStatus=e:this.nextCall.sendStatus(e)})}startRead(){this.nextCall.startRead()}getPeer(){return this.nextCall.getPeer()}getDeadline(){return this.nextCall.getDeadline()}getHost(){return this.nextCall.getHost()}getAuthContext(){return this.nextCall.getAuthContext()}getConnectionInfo(){return this.nextCall.getConnectionInfo()}getMetricsRecorder(){return this.nextCall.getMetricsRecorder()}};const v="grpc-accept-encoding",y="grpc-encoding",b="grpc-message",S="grpc-status",_="grpc-timeout",C=/(\d{1,8})\s*([HMSmun])/,E={H:36e5,M:6e4,S:1e3,m:1,u:.001,n:1e-6},w={[v]:"identity,deflate,gzip",[y]:"identity"},T={[s.constants.HTTP2_HEADER_STATUS]:s.constants.HTTP_STATUS_OK,[s.constants.HTTP2_HEADER_CONTENT_TYPE]:"application/grpc+proto"},k={waitForTrailers:!0};class R{constructor(e,t,i,o,a){var u,p;this.stream=e,this.callEventTracker=i,this.handler=o,this.listener=null,this.deadlineTimer=null,this.deadline=1/0,this.maxSendMessageSize=r.DEFAULT_MAX_SEND_MESSAGE_LENGTH,this.maxReceiveMessageSize=r.DEFAULT_MAX_RECEIVE_MESSAGE_LENGTH,this.cancelled=!1,this.metadataSent=!1,this.wantTrailers=!1,this.cancelNotified=!1,this.incomingEncoding="identity",this.readQueue=[],this.isReadPending=!1,this.receivedHalfClose=!1,this.streamEnded=!1,this.metricsRecorder=new h.PerRequestMetricRecorder,this.stream.once("error",e=>{}),this.stream.once("close",()=>{var e;f("Request to method "+(null===(e=this.handler)||void 0===e?void 0:e.path)+" stream closed with rstCode "+this.stream.rstCode),this.callEventTracker&&!this.streamEnded&&(this.streamEnded=!0,this.callEventTracker.onStreamEnd(!1),this.callEventTracker.onCallEnd({code:r.Status.CANCELLED,details:"Stream closed before sending status",metadata:null})),this.notifyOnCancel()}),this.stream.on("data",e=>{this.handleDataFrame(e)}),this.stream.pause(),this.stream.on("end",()=>{this.handleEndEvent()}),"grpc.max_send_message_length"in a&&(this.maxSendMessageSize=a["grpc.max_send_message_length"]),"grpc.max_receive_message_length"in a&&(this.maxReceiveMessageSize=a["grpc.max_receive_message_length"]),this.host=null!==(u=t[":authority"])&&void 0!==u?u:t.host,this.decoder=new l.StreamDecoder(this.maxReceiveMessageSize);const g=n.Metadata.fromHttp2Headers(t);c.isTracerEnabled(d)&&f("Request to "+this.handler.path+" received headers "+JSON.stringify(g.toJSON()));const m=g.get(_);m.length>0&&this.handleTimeoutHeader(m[0]);const b=g.get(y);b.length>0&&(this.incomingEncoding=b[0]),g.remove(_),g.remove(y),g.remove(v),g.remove(s.constants.HTTP2_HEADER_ACCEPT_ENCODING),g.remove(s.constants.HTTP2_HEADER_TE),g.remove(s.constants.HTTP2_HEADER_CONTENT_TYPE),this.metadata=g;const S=null===(p=e.session)||void 0===p?void 0:p.socket;this.connectionInfo={localAddress:null==S?void 0:S.localAddress,localPort:null==S?void 0:S.localPort,remoteAddress:null==S?void 0:S.remoteAddress,remotePort:null==S?void 0:S.remotePort},this.shouldSendMetrics=!!a["grpc.server_call_metric_recording"]}handleTimeoutHeader(e){const t=e.toString().match(C);if(null===t){const t={code:r.Status.INTERNAL,details:`Invalid ${_} value "${e}"`,metadata:null};return void process.nextTick(()=>{this.sendStatus(t)})}const i=+t[1]*E[t[2]]|0,n=new Date;this.deadline=n.setMilliseconds(n.getMilliseconds()+i),this.deadlineTimer=setTimeout(()=>{const e={code:r.Status.DEADLINE_EXCEEDED,details:"Deadline exceeded",metadata:null};this.sendStatus(e)},i)}checkCancelled(){return this.cancelled||!this.stream.destroyed&&!this.stream.closed||(this.notifyOnCancel(),this.cancelled=!0),this.cancelled}notifyOnCancel(){this.cancelNotified||(this.cancelNotified=!0,this.cancelled=!0,process.nextTick(()=>{var e;null===(e=this.listener)||void 0===e||e.onCancel()}),this.deadlineTimer&&clearTimeout(this.deadlineTimer),this.stream.resume())}maybeSendMetadata(){this.metadataSent||this.sendMetadata(new n.Metadata)}serializeMessage(e){const t=this.handler.serialize(e),i=t.byteLength,n=Buffer.allocUnsafe(i+5);return n.writeUInt8(0,0),n.writeUInt32BE(i,1),t.copy(n,5),n}decompressMessage(e,t){const i=e.subarray(5);if("identity"===t)return i;if("deflate"===t||"gzip"===t){let e;return e="deflate"===t?a.createInflate():a.createGunzip(),new Promise((t,n)=>{let s=0;const o=[];e.on("data",t=>{o.push(t),s+=t.byteLength,-1!==this.maxReceiveMessageSize&&s>this.maxReceiveMessageSize&&(e.destroy(),n({code:r.Status.RESOURCE_EXHAUSTED,details:`Received message that decompresses to a size larger than ${this.maxReceiveMessageSize}`}))}),e.on("end",()=>{t(Buffer.concat(o))}),e.write(i),e.end()})}return Promise.reject({code:r.Status.UNIMPLEMENTED,details:`Received message compressed with unsupported encoding "${t}"`})}async decompressAndMaybePush(e){if("COMPRESSED"!==e.type)throw new Error(`Invalid queue entry type: ${e.type}`);const t=1===e.compressedMessage.readUInt8(0)?this.incomingEncoding:"identity";let i;try{i=await this.decompressMessage(e.compressedMessage,t)}catch(e){return void this.sendStatus(e)}try{e.parsedMessage=this.handler.deserialize(i)}catch(e){return void this.sendStatus({code:r.Status.INTERNAL,details:`Error deserializing request: ${e.message}`})}e.type="READABLE",this.maybePushNextMessage()}maybePushNextMessage(){if(this.listener&&this.isReadPending&&this.readQueue.length>0&&"COMPRESSED"!==this.readQueue[0].type){this.isReadPending=!1;const e=this.readQueue.shift();"READABLE"===e.type?this.listener.onReceiveMessage(e.parsedMessage):this.listener.onReceiveHalfClose()}}handleDataFrame(e){var t;if(this.checkCancelled())return;let i;f("Request to "+this.handler.path+" received data frame of size "+e.length);try{i=this.decoder.write(e)}catch(e){return void this.sendStatus({code:r.Status.RESOURCE_EXHAUSTED,details:e.message})}for(const e of i){this.stream.pause();const i={type:"COMPRESSED",compressedMessage:e,parsedMessage:null};this.readQueue.push(i),this.decompressAndMaybePush(i),null===(t=this.callEventTracker)||void 0===t||t.addMessageReceived()}}handleEndEvent(){this.readQueue.push({type:"HALF_CLOSE",compressedMessage:null,parsedMessage:null}),this.receivedHalfClose=!0,this.maybePushNextMessage()}start(e){f("Request to "+this.handler.path+" start called"),this.checkCancelled()||(this.listener=e,e.onReceiveMetadata(this.metadata))}sendMetadata(e){if(this.checkCancelled())return;if(this.metadataSent)return;this.metadataSent=!0;const t=e?e.toHttp2Headers():null,i=Object.assign(Object.assign(Object.assign({},T),w),t);this.stream.respond(i,k)}sendMessage(e,t){if(this.checkCancelled())return;let i;try{i=this.serializeMessage(e)}catch(e){return void this.sendStatus({code:r.Status.INTERNAL,details:`Error serializing response: ${(0,o.getErrorMessage)(e)}`,metadata:null})}-1!==this.maxSendMessageSize&&i.length-5>this.maxSendMessageSize?this.sendStatus({code:r.Status.RESOURCE_EXHAUSTED,details:`Sent message larger than max (${i.length} vs. ${this.maxSendMessageSize})`,metadata:null}):(this.maybeSendMetadata(),f("Request to "+this.handler.path+" sent data frame of size "+i.length),this.stream.write(i,e=>{var i;e?this.sendStatus({code:r.Status.INTERNAL,details:`Error writing message: ${(0,o.getErrorMessage)(e)}`,metadata:null}):(null===(i=this.callEventTracker)||void 0===i||i.addMessageSent(),t())}))}sendStatus(e){var t,i,s;if(this.checkCancelled())return;f("Request to method "+(null===(t=this.handler)||void 0===t?void 0:t.path)+" ended with status code: "+r.Status[e.code]+" details: "+e.details);const o=null!==(s=null===(i=e.metadata)||void 0===i?void 0:i.clone())&&void 0!==s?s:new n.Metadata;if(this.shouldSendMetrics&&o.set(h.GRPC_METRICS_HEADER,this.metricsRecorder.serialize()),this.metadataSent)this.wantTrailers?this.notifyOnCancel():(this.wantTrailers=!0,this.stream.once("wantTrailers",()=>{this.callEventTracker&&!this.streamEnded&&(this.streamEnded=!0,this.callEventTracker.onStreamEnd(!0),this.callEventTracker.onCallEnd(e));const t=Object.assign({[S]:e.code,[b]:encodeURI(e.details)},o.toHttp2Headers());this.stream.sendTrailers(t),this.notifyOnCancel()}),this.stream.end());else{this.callEventTracker&&!this.streamEnded&&(this.streamEnded=!0,this.callEventTracker.onStreamEnd(!0),this.callEventTracker.onCallEnd(e));const t=Object.assign(Object.assign({[S]:e.code,[b]:encodeURI(e.details)},T),o.toHttp2Headers());this.stream.respond(t,{endStream:!0}),this.notifyOnCancel()}}startRead(){f("Request to "+this.handler.path+" startRead called"),this.checkCancelled()||(this.isReadPending=!0,0===this.readQueue.length?this.receivedHalfClose||this.stream.resume():this.maybePushNextMessage())}getPeer(){var e;const t=null===(e=this.stream.session)||void 0===e?void 0:e.socket;return(null==t?void 0:t.remoteAddress)?t.remotePort?`${t.remoteAddress}:${t.remotePort}`:t.remoteAddress:"unknown"}getDeadline(){return this.deadline}getHost(){return this.host}getAuthContext(){var e;if((null===(e=this.stream.session)||void 0===e?void 0:e.socket)instanceof u.TLSSocket){const e=this.stream.session.socket.getPeerCertificate();return{transportSecurityType:"ssl",sslPeerCertificate:e.raw?e:void 0}}return{}}getConnectionInfo(){return this.connectionInfo}getMetricsRecorder(){return this.metricsRecorder}}t.BaseServerInterceptingCall=R},5943(e,t,i){"use strict";var n=this&&this.__runInitializers||function(e,t,i){for(var n=arguments.length>2,r=0;r<t.length;r++)i=n?t[r].call(e,i):t[r].call(e);return n?i:void 0},r=this&&this.__esDecorate||function(e,t,i,n,r,s){function o(e){if(void 0!==e&&"function"!=typeof e)throw new TypeError("Function expected");return e}for(var a,l=n.kind,c="getter"===l?"get":"setter"===l?"set":"value",u=!t&&e?n.static?e:e.prototype:null,h=t||(u?Object.getOwnPropertyDescriptor(u,n.name):{}),d=!1,f=i.length-1;f>=0;f--){var p={};for(var g in n)p[g]="access"===g?{}:n[g];for(var g in n.access)p.access[g]=n.access[g];p.addInitializer=function(e){if(d)throw new TypeError("Cannot add initializers after decoration has completed");s.push(o(e||null))};var m=(0,i[f])("accessor"===l?{get:h.get,set:h.set}:h[c],p);if("accessor"===l){if(void 0===m)continue;if(null===m||"object"!=typeof m)throw new TypeError("Object expected");(a=o(m.get))&&(h.get=a),(a=o(m.set))&&(h.set=a),(a=o(m.init))&&r.unshift(a)}else(a=o(m))&&("field"===l?r.unshift(a):h[c]=a)}u&&Object.defineProperty(u,n.name,h),d=!0};Object.defineProperty(t,"__esModule",{value:!0}),t.Server=void 0;const s=i(5675),o=i(9023),a=i(131),l=i(6860),c=i(8692),u=i(9302),h=i(267),d=i(8996),f=i(3822),p=i(9503),g=i(4892),m=~(1<<31),v=~(1<<31),y=~(1<<31),{HTTP2_HEADER_PATH:b}=s.constants,S=Buffer.from("max_age");function _(e){h.trace(a.LogVerbosity.DEBUG,"server_call",e)}function C(){}function E(e){return{code:a.Status.UNIMPLEMENTED,details:`The server does not implement the method ${e}`}}let w=(()=>{var e;let t,i=[];return e=class{constructor(e){var t,r,s,o,a,l;this.boundPorts=(n(this,i),new Map),this.http2Servers=new Map,this.sessionIdleTimeouts=new Map,this.handlers=new Map,this.sessions=new Map,this.started=!1,this.shutdown=!1,this.serverAddressString="null",this.channelzEnabled=!0,this.options=null!=e?e:{},0===this.options["grpc.enable_channelz"]?(this.channelzEnabled=!1,this.channelzTrace=new p.ChannelzTraceStub,this.callTracker=new p.ChannelzCallTrackerStub,this.listenerChildrenTracker=new p.ChannelzChildrenTrackerStub,this.sessionChildrenTracker=new p.ChannelzChildrenTrackerStub):(this.channelzTrace=new p.ChannelzTrace,this.callTracker=new p.ChannelzCallTracker,this.listenerChildrenTracker=new p.ChannelzChildrenTracker,this.sessionChildrenTracker=new p.ChannelzChildrenTracker),this.channelzRef=(0,p.registerChannelzServer)("server",()=>this.getChannelzInfo(),this.channelzEnabled),this.channelzTrace.addTrace("CT_INFO","Server created"),this.maxConnectionAgeMs=null!==(t=this.options["grpc.max_connection_age_ms"])&&void 0!==t?t:m,this.maxConnectionAgeGraceMs=null!==(r=this.options["grpc.max_connection_age_grace_ms"])&&void 0!==r?r:m,this.keepaliveTimeMs=null!==(s=this.options["grpc.keepalive_time_ms"])&&void 0!==s?s:v,this.keepaliveTimeoutMs=null!==(o=this.options["grpc.keepalive_timeout_ms"])&&void 0!==o?o:2e4,this.sessionIdleTimeout=null!==(a=this.options["grpc.max_connection_idle_ms"])&&void 0!==a?a:y,this.commonServerOptions={maxSendHeaderBlockLength:Number.MAX_SAFE_INTEGER},"grpc-node.max_session_memory"in this.options?this.commonServerOptions.maxSessionMemory=this.options["grpc-node.max_session_memory"]:this.commonServerOptions.maxSessionMemory=Number.MAX_SAFE_INTEGER,"grpc.max_concurrent_streams"in this.options&&(this.commonServerOptions.settings={maxConcurrentStreams:this.options["grpc.max_concurrent_streams"]}),this.interceptors=null!==(l=this.options.interceptors)&&void 0!==l?l:[],this.trace("Server constructed")}getChannelzInfo(){return{trace:this.channelzTrace,callTracker:this.callTracker,listenerChildren:this.listenerChildrenTracker.getChildLists(),sessionChildren:this.sessionChildrenTracker.getChildLists()}}getChannelzSessionInfo(e){var t,i,n;const r=this.sessions.get(e),s=e.socket,o=s.remoteAddress?(0,d.stringToSubchannelAddress)(s.remoteAddress,s.remotePort):null,a=s.localAddress?(0,d.stringToSubchannelAddress)(s.localAddress,s.localPort):null;let l;if(e.encrypted){const e=s,i=e.getCipher(),n=e.getCertificate(),r=e.getPeerCertificate();l={cipherSuiteStandardName:null!==(t=i.standardName)&&void 0!==t?t:null,cipherSuiteOtherName:i.standardName?null:i.name,localCertificate:n&&"raw"in n?n.raw:null,remoteCertificate:r&&"raw"in r?r.raw:null}}else l=null;return{remoteAddress:o,localAddress:a,security:l,remoteName:null,streamsStarted:r.streamTracker.callsStarted,streamsSucceeded:r.streamTracker.callsSucceeded,streamsFailed:r.streamTracker.callsFailed,messagesSent:r.messagesSent,messagesReceived:r.messagesReceived,keepAlivesSent:r.keepAlivesSent,lastLocalStreamCreatedTimestamp:null,lastRemoteStreamCreatedTimestamp:r.streamTracker.lastCallStartedTimestamp,lastMessageSentTimestamp:r.lastMessageSentTimestamp,lastMessageReceivedTimestamp:r.lastMessageReceivedTimestamp,localFlowControlWindow:null!==(i=e.state.localWindowSize)&&void 0!==i?i:null,remoteFlowControlWindow:null!==(n=e.state.remoteWindowSize)&&void 0!==n?n:null}}trace(e){h.trace(a.LogVerbosity.DEBUG,"server","("+this.channelzRef.id+") "+e)}keepaliveTrace(e){h.trace(a.LogVerbosity.DEBUG,"keepalive","("+this.channelzRef.id+") "+e)}addProtoService(){throw new Error("Not implemented. Use addService() instead")}addService(e,t){if(null===e||"object"!=typeof e||null===t||"object"!=typeof t)throw new Error("addService() requires two objects as arguments");const i=Object.keys(e);if(0===i.length)throw new Error("Cannot add an empty service to a server");i.forEach(i=>{const n=e[i];let r;r=n.requestStream?n.responseStream?"bidi":"clientStream":n.responseStream?"serverStream":"unary";let s,o=t[i];void 0===o&&"string"==typeof n.originalName&&(o=t[n.originalName]),s=void 0!==o?o.bind(t):function(e,t){const i=E(t);switch(e){case"unary":case"clientStream":return(e,t)=>{t(i,null)};case"serverStream":case"bidi":return e=>{e.emit("error",i)};default:throw new Error(`Invalid handlerType ${e}`)}}(r,i);if(!1===this.register(n.path,s,n.responseSerialize,n.requestDeserialize,r))throw new Error(`Method handler for ${n.path} already provided.`)})}removeService(e){if(null===e||"object"!=typeof e)throw new Error("removeService() requires object as argument");Object.keys(e).forEach(t=>{const i=e[t];this.unregister(i.path)})}bind(e,t){throw new Error("Not implemented. Use bindAsync() instead")}experimentalRegisterListenerToChannelz(e){return(0,p.registerChannelzSocket)((0,d.subchannelAddressToString)(e),()=>({localAddress:e,remoteAddress:null,security:null,remoteName:null,streamsStarted:0,streamsSucceeded:0,streamsFailed:0,messagesSent:0,messagesReceived:0,keepAlivesSent:0,lastLocalStreamCreatedTimestamp:null,lastRemoteStreamCreatedTimestamp:null,lastMessageSentTimestamp:null,lastMessageReceivedTimestamp:null,localFlowControlWindow:null,remoteFlowControlWindow:null}),this.channelzEnabled)}experimentalUnregisterListenerFromChannelz(e){(0,p.unregisterChannelzRef)(e)}createHttp2Server(e){let t;if(e._isSecure()){const i=e._getConstructorOptions(),n=e._getSecureContextOptions(),r=Object.assign(Object.assign(Object.assign(Object.assign({},this.commonServerOptions),i),n),{enableTrace:1===this.options["grpc-node.tls_enable_trace"]});let o=null!==n;this.trace("Initial credentials valid: "+o),t=s.createSecureServer(r),t.prependListener("connection",e=>{o||(this.trace("Dropped connection from "+JSON.stringify(e.address())+" due to unloaded credentials"),e.destroy())}),t.on("secureConnection",e=>{e.on("error",e=>{this.trace("An incoming TLS connection closed with error: "+e.message)})});const l=e=>{if(e){const i=t;try{i.setSecureContext(e)}catch(t){h.log(a.LogVerbosity.ERROR,"Failed to set secure context with error "+t.message),e=null}}o=null!==e,this.trace("Post-update credentials valid: "+o)};e._addWatcher(l),t.on("close",()=>{e._removeWatcher(l)})}else t=s.createServer(this.commonServerOptions);return t.setTimeout(0,C),this._setupHandlers(t,e._getInterceptors()),t}bindOneAddress(e,t){this.trace("Attempting to bind "+(0,d.subchannelAddressToString)(e));const i=this.createHttp2Server(t.credentials);return new Promise((n,r)=>{const s=t=>{this.trace("Failed to bind "+(0,d.subchannelAddressToString)(e)+" with error "+t.message),n({port:"port"in e?e.port:1,error:t.message})};i.once("error",s),i.listen(e,()=>{const e=i.address();let r;r="string"==typeof e?{path:e}:{host:e.address,port:e.port};const o=this.experimentalRegisterListenerToChannelz(r);this.listenerChildrenTracker.refChild(o),this.http2Servers.set(i,{channelzRef:o,sessions:new Set,ownsChannelzRef:!0}),t.listeningServers.add(i),this.trace("Successfully bound "+(0,d.subchannelAddressToString)(r)),n({port:"port"in r?r.port:1}),i.removeListener("error",s)})})}async bindManyPorts(e,t){if(0===e.length)return{count:0,port:0,errors:[]};if((0,d.isTcpSubchannelAddress)(e[0])&&0===e[0].port){const i=await this.bindOneAddress(e[0],t);if(i.error){const n=await this.bindManyPorts(e.slice(1),t);return Object.assign(Object.assign({},n),{errors:[i.error,...n.errors]})}{const n=e.slice(1).map(e=>(0,d.isTcpSubchannelAddress)(e)?{host:e.host,port:i.port}:e),r=await Promise.all(n.map(e=>this.bindOneAddress(e,t))),s=[i,...r];return{count:s.filter(e=>void 0===e.error).length,port:i.port,errors:s.filter(e=>e.error).map(e=>e.error)}}}{const i=await Promise.all(e.map(e=>this.bindOneAddress(e,t)));return{count:i.filter(e=>void 0===e.error).length,port:i[0].port,errors:i.filter(e=>e.error).map(e=>e.error)}}}async bindAddressList(e,t){const i=await this.bindManyPorts(e,t);if(i.count>0)return i.count<e.length&&h.log(a.LogVerbosity.INFO,`WARNING Only ${i.count} addresses added out of total ${e.length} resolved`),i.port;{const t=`No address added out of total ${e.length} resolved`;throw h.log(a.LogVerbosity.ERROR,t),new Error(`${t} errors: [${i.errors.join(",")}]`)}}resolvePort(e){return new Promise((t,i)=>{let n=!1;(0,u.createResolver)(e,(r,s,o,a)=>{if(n)return!0;if(n=!0,!r.ok)return i(new Error(r.error.details)),!0;const l=[].concat(...r.value.map(e=>e.addresses));return 0===l.length?(i(new Error(`No addresses resolved for port ${e}`)),!0):(t(l),!0)},this.options).updateResolution()})}async bindPort(e,t){const i=await this.resolvePort(e);if(t.cancelled)throw this.completeUnbind(t),new Error("bindAsync operation cancelled by unbind call");const n=await this.bindAddressList(i,t);if(t.cancelled)throw this.completeUnbind(t),new Error("bindAsync operation cancelled by unbind call");return n}normalizePort(e){const t=(0,f.parseUri)(e);if(null===t)throw new Error(`Could not parse port "${e}"`);const i=(0,u.mapUriDefaultScheme)(t);if(null===i)throw new Error(`Could not get a default scheme for port "${e}"`);return i}bindAsync(e,t,i){if(this.shutdown)throw new Error("bindAsync called after shutdown");if("string"!=typeof e)throw new TypeError("port must be a string");if(null===t||!(t instanceof c.ServerCredentials))throw new TypeError("creds must be a ServerCredentials object");if("function"!=typeof i)throw new TypeError("callback must be a function");this.trace("bindAsync port="+e);const n=this.normalizePort(e),r=(e,t)=>{process.nextTick(()=>i(e,t))};let s=this.boundPorts.get((0,f.uriToString)(n));if(s)return t._equals(s.credentials)?(s.cancelled=!1,void(s.completionPromise?s.completionPromise.then(e=>i(null,e),e=>i(e,0)):r(null,s.portNumber))):void r(new Error(`${e} already bound with incompatible credentials`),0);s={mapKey:(0,f.uriToString)(n),originalUri:n,completionPromise:null,cancelled:!1,portNumber:0,credentials:t,listeningServers:new Set};const o=(0,f.splitHostPort)(n.path),a=this.bindPort(n,s);s.completionPromise=a,0===(null==o?void 0:o.port)?a.then(e=>{const t={scheme:n.scheme,authority:n.authority,path:(0,f.combineHostPort)({host:o.host,port:e})};s.mapKey=(0,f.uriToString)(t),s.completionPromise=null,s.portNumber=e,this.boundPorts.set(s.mapKey,s),i(null,e)},e=>{i(e,0)}):(this.boundPorts.set(s.mapKey,s),a.then(e=>{s.completionPromise=null,s.portNumber=e,i(null,e)},e=>{i(e,0)}))}registerInjectorToChannelz(){return(0,p.registerChannelzSocket)("injector",()=>({localAddress:null,remoteAddress:null,security:null,remoteName:null,streamsStarted:0,streamsSucceeded:0,streamsFailed:0,messagesSent:0,messagesReceived:0,keepAlivesSent:0,lastLocalStreamCreatedTimestamp:null,lastRemoteStreamCreatedTimestamp:null,lastMessageSentTimestamp:null,lastMessageReceivedTimestamp:null,localFlowControlWindow:null,remoteFlowControlWindow:null}),this.channelzEnabled)}experimentalCreateConnectionInjectorWithChannelzRef(e,t,i=!1){if(null===e||!(e instanceof c.ServerCredentials))throw new TypeError("creds must be a ServerCredentials object");this.channelzEnabled&&this.listenerChildrenTracker.refChild(t);const n=this.createHttp2Server(e),r=new Set;return this.http2Servers.set(n,{channelzRef:t,sessions:r,ownsChannelzRef:i}),{injectConnection:e=>{n.emit("connection",e)},drain:e=>{var t,i;for(const e of r)this.closeSession(e);null===(i=(t=setTimeout(()=>{for(const e of r)e.destroy(s.constants.NGHTTP2_CANCEL)},e)).unref)||void 0===i||i.call(t)},destroy:()=>{this.closeServer(n);for(const e of r)this.closeSession(e)}}}createConnectionInjector(e){if(null===e||!(e instanceof c.ServerCredentials))throw new TypeError("creds must be a ServerCredentials object");const t=this.registerInjectorToChannelz();return this.experimentalCreateConnectionInjectorWithChannelzRef(e,t,!0)}closeServer(e,t){this.trace("Closing server with address "+JSON.stringify(e.address()));const i=this.http2Servers.get(e);e.close(()=>{i&&i.ownsChannelzRef&&(this.listenerChildrenTracker.unrefChild(i.channelzRef),(0,p.unregisterChannelzRef)(i.channelzRef)),this.http2Servers.delete(e),null==t||t()})}closeSession(e,t){var i;this.trace("Closing session initiated by "+(null===(i=e.socket)||void 0===i?void 0:i.remoteAddress));const n=this.sessions.get(e),r=()=>{n&&(this.sessionChildrenTracker.unrefChild(n.ref),(0,p.unregisterChannelzRef)(n.ref)),null==t||t()};e.closed?queueMicrotask(r):e.close(r)}completeUnbind(e){for(const t of e.listeningServers){const i=this.http2Servers.get(t);if(this.closeServer(t,()=>{e.listeningServers.delete(t)}),i)for(const e of i.sessions)this.closeSession(e)}this.boundPorts.delete(e.mapKey)}unbind(e){this.trace("unbind port="+e);const t=this.normalizePort(e),i=(0,f.splitHostPort)(t.path);if(0===(null==i?void 0:i.port))throw new Error("Cannot unbind port 0");const n=this.boundPorts.get((0,f.uriToString)(t));n&&(this.trace("unbinding "+n.mapKey+" originally bound as "+(0,f.uriToString)(n.originalUri)),n.completionPromise?n.cancelled=!0:this.completeUnbind(n))}drain(e,t){var i,n;this.trace("drain port="+e+" graceTimeMs="+t);const r=this.normalizePort(e),o=(0,f.splitHostPort)(r.path);if(0===(null==o?void 0:o.port))throw new Error("Cannot drain port 0");const a=this.boundPorts.get((0,f.uriToString)(r));if(!a)return;const l=new Set;for(const e of a.listeningServers){const t=this.http2Servers.get(e);if(t)for(const e of t.sessions)l.add(e),this.closeSession(e,()=>{l.delete(e)})}null===(n=(i=setTimeout(()=>{for(const e of l)e.destroy(s.constants.NGHTTP2_CANCEL)},t)).unref)||void 0===n||n.call(i)}forceShutdown(){for(const e of this.boundPorts.values())e.cancelled=!0;this.boundPorts.clear();for(const e of this.http2Servers.keys())this.closeServer(e);this.sessions.forEach((e,t)=>{this.closeSession(t),t.destroy(s.constants.NGHTTP2_CANCEL)}),this.sessions.clear(),(0,p.unregisterChannelzRef)(this.channelzRef),this.shutdown=!0}register(e,t,i,n,r){return!this.handlers.has(e)&&(this.handlers.set(e,{func:t,serialize:i,deserialize:n,type:r,path:e}),!0)}unregister(e){return this.handlers.delete(e)}start(){if(0===this.http2Servers.size||[...this.http2Servers.keys()].every(e=>!e.listening))throw new Error("server must be bound in order to start");if(!0===this.started)throw new Error("server is already started");this.started=!0}tryShutdown(e){var t;const i=t=>{(0,p.unregisterChannelzRef)(this.channelzRef),e(t)};let n=0;function r(){n--,0===n&&i()}this.shutdown=!0;for(const[e,i]of this.http2Servers.entries()){n++;const s=i.channelzRef.name;this.trace("Waiting for server "+s+" to close"),this.closeServer(e,()=>{this.trace("Server "+s+" finished closing"),r()});for(const e of i.sessions.keys()){n++;const i=null===(t=e.socket)||void 0===t?void 0:t.remoteAddress;this.trace("Waiting for session "+i+" to close"),this.closeSession(e,()=>{this.trace("Session "+i+" finished closing"),r()})}}0===n&&i()}addHttp2Port(){throw new Error("Not yet implemented")}getChannelzRef(){return this.channelzRef}_verifyContentType(e,t){const i=t[s.constants.HTTP2_HEADER_CONTENT_TYPE];return!("string"!=typeof i||!i.startsWith("application/grpc"))||(e.respond({[s.constants.HTTP2_HEADER_STATUS]:s.constants.HTTP_STATUS_UNSUPPORTED_MEDIA_TYPE},{endStream:!0}),!1)}_retrieveHandler(e){_("Received call to method "+e+" at address "+this.serverAddressString);const t=this.handlers.get(e);return void 0===t?(_("No handler registered for method "+e+". Sending UNIMPLEMENTED status."),null):t}_respondWithError(e,t,i=null){var n,r;const o=Object.assign({"grpc-status":null!==(n=e.code)&&void 0!==n?n:a.Status.INTERNAL,"grpc-message":e.details,[s.constants.HTTP2_HEADER_STATUS]:s.constants.HTTP_STATUS_OK,[s.constants.HTTP2_HEADER_CONTENT_TYPE]:"application/grpc+proto"},null===(r=e.metadata)||void 0===r?void 0:r.toHttp2Headers());t.respond(o,{endStream:!0}),this.callTracker.addCallFailed(),null==i||i.streamTracker.addCallFailed()}_channelzHandler(e,t,i){this.onStreamOpened(t);const n=this.sessions.get(t.session);if(this.callTracker.addCallStarted(),null==n||n.streamTracker.addCallStarted(),!this._verifyContentType(t,i))return this.callTracker.addCallFailed(),void(null==n||n.streamTracker.addCallFailed());const r=i[b],s=this._retrieveHandler(r);if(!s)return void this._respondWithError(E(r),t,n);const o={addMessageSent:()=>{n&&(n.messagesSent+=1,n.lastMessageSentTimestamp=new Date)},addMessageReceived:()=>{n&&(n.messagesReceived+=1,n.lastMessageReceivedTimestamp=new Date)},onCallEnd:e=>{e.code===a.Status.OK?this.callTracker.addCallSucceeded():this.callTracker.addCallFailed()},onStreamEnd:e=>{n&&(e?n.streamTracker.addCallSucceeded():n.streamTracker.addCallFailed())}},l=(0,g.getServerInterceptingCall)([...e,...this.interceptors],t,i,o,s,this.options);this._runHandlerForCall(l,s)||(this.callTracker.addCallFailed(),null==n||n.streamTracker.addCallFailed(),l.sendStatus({code:a.Status.INTERNAL,details:`Unknown handler type: ${s.type}`}))}_streamHandler(e,t,i){if(this.onStreamOpened(t),!0!==this._verifyContentType(t,i))return;const n=i[b],r=this._retrieveHandler(n);if(!r)return void this._respondWithError(E(n),t,null);const s=(0,g.getServerInterceptingCall)([...e,...this.interceptors],t,i,null,r,this.options);this._runHandlerForCall(s,r)||s.sendStatus({code:a.Status.INTERNAL,details:`Unknown handler type: ${r.type}`})}_runHandlerForCall(e,t){const{type:i}=t;if("unary"===i)!async function(e,t){let i,n;function r(t,i,n,r){t?e.sendStatus((0,l.serverErrorToStatus)(t,n)):e.sendMessage(i,()=>{e.sendStatus({code:a.Status.OK,details:"OK",metadata:null!=n?n:null})})}let s=null;e.start({onReceiveMetadata(t){n=t,e.startRead()},onReceiveMessage(i){s?e.sendStatus({code:a.Status.UNIMPLEMENTED,details:`Received a second request message for server streaming method ${t.path}`,metadata:null}):(s=i,e.startRead())},onReceiveHalfClose(){if(s){i=new l.ServerWritableStreamImpl(t.path,e,n,s);try{t.func(i,r)}catch(t){e.sendStatus({code:a.Status.UNKNOWN,details:`Server method handler threw error ${t.message}`,metadata:null})}}else e.sendStatus({code:a.Status.UNIMPLEMENTED,details:`Received no request message for server streaming method ${t.path}`,metadata:null})},onCancel(){i&&(i.cancelled=!0,i.emit("cancelled","cancelled"))}})}(e,t);else if("clientStream"===i)!function(e,t){let i;function n(t,i,n,r){t?e.sendStatus((0,l.serverErrorToStatus)(t,n)):e.sendMessage(i,()=>{e.sendStatus({code:a.Status.OK,details:"OK",metadata:null!=n?n:null})})}e.start({onReceiveMetadata(r){i=new l.ServerDuplexStreamImpl(t.path,e,r);try{t.func(i,n)}catch(t){e.sendStatus({code:a.Status.UNKNOWN,details:`Server method handler threw error ${t.message}`,metadata:null})}},onReceiveMessage(e){i.push(e)},onReceiveHalfClose(){i.push(null)},onCancel(){i&&(i.cancelled=!0,i.emit("cancelled","cancelled"),i.destroy())}})}(e,t);else if("serverStream"===i)!function(e,t){let i,n,r=null;e.start({onReceiveMetadata(t){n=t,e.startRead()},onReceiveMessage(i){r?e.sendStatus({code:a.Status.UNIMPLEMENTED,details:`Received a second request message for server streaming method ${t.path}`,metadata:null}):(r=i,e.startRead())},onReceiveHalfClose(){if(r){i=new l.ServerWritableStreamImpl(t.path,e,n,r);try{t.func(i)}catch(t){e.sendStatus({code:a.Status.UNKNOWN,details:`Server method handler threw error ${t.message}`,metadata:null})}}else e.sendStatus({code:a.Status.UNIMPLEMENTED,details:`Received no request message for server streaming method ${t.path}`,metadata:null})},onCancel(){i&&(i.cancelled=!0,i.emit("cancelled","cancelled"),i.destroy())}})}(e,t);else{if("bidi"!==i)return!1;!function(e,t){let i;e.start({onReceiveMetadata(n){i=new l.ServerDuplexStreamImpl(t.path,e,n);try{t.func(i)}catch(t){e.sendStatus({code:a.Status.UNKNOWN,details:`Server method handler threw error ${t.message}`,metadata:null})}},onReceiveMessage(e){i.push(e)},onReceiveHalfClose(){i.push(null)},onCancel(){i&&(i.cancelled=!0,i.emit("cancelled","cancelled"),i.destroy())}})}(e,t)}return!0}_setupHandlers(e,t){if(null===e)return;const i=e.address();let n="null";i&&(n="string"==typeof i?i:i.address+":"+i.port),this.serverAddressString=n;const r=this.channelzEnabled?this._channelzHandler:this._streamHandler,s=this.channelzEnabled?this._channelzSessionHandler(e):this._sessionHandler(e);e.on("stream",r.bind(this,t)),e.on("session",s)}_sessionHandler(e){return t=>{var i,n;null===(i=this.http2Servers.get(e))||void 0===i||i.sessions.add(t);let r=null,o=null,a=null,l=!1;const c=this.enableIdleTimeout(t);if(this.maxConnectionAgeMs!==m){const e=this.maxConnectionAgeMs/10,i=Math.random()*e*2-e;r=setTimeout(()=>{var e,i;l=!0,this.trace("Connection dropped by max connection age: "+(null===(e=t.socket)||void 0===e?void 0:e.remoteAddress));try{t.goaway(s.constants.NGHTTP2_NO_ERROR,~(1<<31),S)}catch(e){return void t.destroy()}t.close(),this.maxConnectionAgeGraceMs!==m&&(o=setTimeout(()=>{t.destroy()},this.maxConnectionAgeGraceMs),null===(i=o.unref)||void 0===i||i.call(o))},this.maxConnectionAgeMs+i),null===(n=r.unref)||void 0===n||n.call(r)}const u=()=>{a&&(clearTimeout(a),a=null)},h=()=>!t.destroyed&&this.keepaliveTimeMs<v&&this.keepaliveTimeMs>0;let d;const f=()=>{var e;h()&&(this.keepaliveTrace("Starting keepalive timer for "+this.keepaliveTimeMs+"ms"),a=setTimeout(()=>{u(),d()},this.keepaliveTimeMs),null===(e=a.unref)||void 0===e||e.call(a))};d=()=>{var e;if(!h())return;this.keepaliveTrace("Sending ping with timeout "+this.keepaliveTimeoutMs+"ms");let i="";try{t.ping((e,i,n)=>{u(),e?(this.keepaliveTrace("Ping failed with error: "+e.message),l=!0,t.destroy()):(this.keepaliveTrace("Received ping response"),f())})||(i="Ping returned false")}catch(e){i=(e instanceof Error?e.message:"")||"Unknown error"}if(i)return this.keepaliveTrace("Ping send failed: "+i),this.trace("Connection dropped due to ping send error: "+i),l=!0,void t.destroy();a=setTimeout(()=>{u(),this.keepaliveTrace("Ping timeout passed without response"),this.trace("Connection dropped by keepalive timeout"),l=!0,t.destroy()},this.keepaliveTimeoutMs),null===(e=a.unref)||void 0===e||e.call(a)},f(),t.on("close",()=>{var i,n;l||this.trace(`Connection dropped by client ${null===(i=t.socket)||void 0===i?void 0:i.remoteAddress}`),r&&clearTimeout(r),o&&clearTimeout(o),u(),null!==c&&(clearTimeout(c.timeout),this.sessionIdleTimeouts.delete(t)),null===(n=this.http2Servers.get(e))||void 0===n||n.sessions.delete(t)})}}_channelzSessionHandler(e){return t=>{var i,n,r,o;const a=(0,p.registerChannelzSocket)(null!==(n=null===(i=t.socket)||void 0===i?void 0:i.remoteAddress)&&void 0!==n?n:"unknown",this.getChannelzSessionInfo.bind(this,t),this.channelzEnabled),l={ref:a,streamTracker:new p.ChannelzCallTracker,messagesSent:0,messagesReceived:0,keepAlivesSent:0,lastMessageSentTimestamp:null,lastMessageReceivedTimestamp:null};null===(r=this.http2Servers.get(e))||void 0===r||r.sessions.add(t),this.sessions.set(t,l);const c=`${t.socket.remoteAddress}:${t.socket.remotePort}`;this.channelzTrace.addTrace("CT_INFO","Connection established by client "+c),this.trace("Connection established by client "+c),this.sessionChildrenTracker.refChild(a);let u=null,h=null,d=null,f=!1;const g=this.enableIdleTimeout(t);if(this.maxConnectionAgeMs!==m){const e=this.maxConnectionAgeMs/10,i=Math.random()*e*2-e;u=setTimeout(()=>{var e;f=!0,this.channelzTrace.addTrace("CT_INFO","Connection dropped by max connection age from "+c);try{t.goaway(s.constants.NGHTTP2_NO_ERROR,~(1<<31),S)}catch(e){return void t.destroy()}t.close(),this.maxConnectionAgeGraceMs!==m&&(h=setTimeout(()=>{t.destroy()},this.maxConnectionAgeGraceMs),null===(e=h.unref)||void 0===e||e.call(h))},this.maxConnectionAgeMs+i),null===(o=u.unref)||void 0===o||o.call(u)}const y=()=>{d&&(clearTimeout(d),d=null)},b=()=>!t.destroyed&&this.keepaliveTimeMs<v&&this.keepaliveTimeMs>0;let _;const C=()=>{var e;b()&&(this.keepaliveTrace("Starting keepalive timer for "+this.keepaliveTimeMs+"ms"),d=setTimeout(()=>{y(),_()},this.keepaliveTimeMs),null===(e=d.unref)||void 0===e||e.call(d))};_=()=>{var e;if(!b())return;this.keepaliveTrace("Sending ping with timeout "+this.keepaliveTimeoutMs+"ms");let i="";try{t.ping((e,i,n)=>{y(),e?(this.keepaliveTrace("Ping failed with error: "+e.message),this.channelzTrace.addTrace("CT_INFO","Connection dropped due to error of a ping frame "+e.message+" return in "+i),f=!0,t.destroy()):(this.keepaliveTrace("Received ping response"),C())})||(i="Ping returned false")}catch(e){i=(e instanceof Error?e.message:"")||"Unknown error"}if(i)return this.keepaliveTrace("Ping send failed: "+i),this.channelzTrace.addTrace("CT_INFO","Connection dropped due to ping send error: "+i),f=!0,void t.destroy();l.keepAlivesSent+=1,d=setTimeout(()=>{y(),this.keepaliveTrace("Ping timeout passed without response"),this.channelzTrace.addTrace("CT_INFO","Connection dropped by keepalive timeout from "+c),f=!0,t.destroy()},this.keepaliveTimeoutMs),null===(e=d.unref)||void 0===e||e.call(d)},C(),t.on("close",()=>{var i;f||this.channelzTrace.addTrace("CT_INFO","Connection dropped by client "+c),this.sessionChildrenTracker.unrefChild(a),(0,p.unregisterChannelzRef)(a),u&&clearTimeout(u),h&&clearTimeout(h),y(),null!==g&&(clearTimeout(g.timeout),this.sessionIdleTimeouts.delete(t)),null===(i=this.http2Servers.get(e))||void 0===i||i.sessions.delete(t),this.sessions.delete(t)})}}enableIdleTimeout(e){var t,i;if(this.sessionIdleTimeout>=y)return null;const n={activeStreams:0,lastIdle:Date.now(),onClose:this.onStreamClose.bind(this,e),timeout:setTimeout(this.onIdleTimeout,this.sessionIdleTimeout,this,e)};null===(i=(t=n.timeout).unref)||void 0===i||i.call(t),this.sessionIdleTimeouts.set(e,n);const{socket:r}=e;return this.trace("Enable idle timeout for "+r.remoteAddress+":"+r.remotePort),n}onIdleTimeout(e,t){const{socket:i}=t,n=e.sessionIdleTimeouts.get(t);void 0!==n&&0===n.activeStreams&&(Date.now()-n.lastIdle>=e.sessionIdleTimeout?(e.trace("Session idle timeout triggered for "+(null==i?void 0:i.remoteAddress)+":"+(null==i?void 0:i.remotePort)+" last idle at "+n.lastIdle),e.closeSession(t)):n.timeout.refresh())}onStreamOpened(e){const t=e.session,i=this.sessionIdleTimeouts.get(t);i&&(i.activeStreams+=1,e.once("close",i.onClose))}onStreamClose(e){var t,i;const n=this.sessionIdleTimeouts.get(e);n&&(n.activeStreams-=1,0===n.activeStreams&&(n.lastIdle=Date.now(),n.timeout.refresh(),this.trace("Session onStreamClose"+(null===(t=e.socket)||void 0===t?void 0:t.remoteAddress)+":"+(null===(i=e.socket)||void 0===i?void 0:i.remotePort)+" at "+n.lastIdle)))}},(()=>{const n="function"==typeof Symbol&&Symbol.metadata?Object.create(null):void 0;var s;t=[(s="Calling start() is no longer necessary. It can be safely omitted.",function(e,t){return o.deprecate(e,s)})],r(e,null,t,{kind:"method",name:"start",static:!1,private:!1,access:{has:e=>"start"in e,get:e=>e.start},metadata:n},null,i),n&&Object.defineProperty(e,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:n})})(),e})();t.Server=w},5656(e,t,i){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.validateRetryThrottling=l,t.validateServiceConfig=u,t.extractAndSelectServiceConfig=function(e,t){for(const i of e)if(i.length>0&&i[0].startsWith("grpc_config=")){const e=i.join("").substring(12);return d(JSON.parse(e),t)}return null};const n=i(857),r=i(131),s=/^\d+(\.\d{1,9})?s$/;function o(e){if("service"in e&&""!==e.service){if("string"!=typeof e.service)throw new Error("Invalid method config name: invalid service: expected type string, got "+typeof e.service);if("method"in e&&""!==e.method){if("string"!=typeof e.method)throw new Error("Invalid method config name: invalid method: expected type string, got "+typeof e.service);return{service:e.service,method:e.method}}return{service:e.service}}if("method"in e&&void 0!==e.method)throw new Error("Invalid method config name: method set with empty or unset service");return{}}function a(e){var t;const i={name:[]};if(!("name"in e)||!Array.isArray(e.name))throw new Error("Invalid method config: invalid name array");for(const t of e.name)i.name.push(o(t));if("waitForReady"in e){if("boolean"!=typeof e.waitForReady)throw new Error("Invalid method config: invalid waitForReady");i.waitForReady=e.waitForReady}if("timeout"in e)if("object"==typeof e.timeout){if(!("seconds"in e.timeout)||"number"!=typeof e.timeout.seconds)throw new Error("Invalid method config: invalid timeout.seconds");if(!("nanos"in e.timeout)||"number"!=typeof e.timeout.nanos)throw new Error("Invalid method config: invalid timeout.nanos");i.timeout=e.timeout}else{if("string"!=typeof e.timeout||!s.test(e.timeout))throw new Error("Invalid method config: invalid timeout");{const n=e.timeout.substring(0,e.timeout.length-1).split(".");i.timeout={seconds:0|n[0],nanos:0|(null!==(t=n[1])&&void 0!==t?t:0)}}}if("maxRequestBytes"in e){if("number"!=typeof e.maxRequestBytes)throw new Error("Invalid method config: invalid maxRequestBytes");i.maxRequestBytes=e.maxRequestBytes}if("maxResponseBytes"in e){if("number"!=typeof e.maxResponseBytes)throw new Error("Invalid method config: invalid maxRequestBytes");i.maxResponseBytes=e.maxResponseBytes}if("retryPolicy"in e){if("hedgingPolicy"in e)throw new Error("Invalid method config: retryPolicy and hedgingPolicy cannot both be specified");i.retryPolicy=function(e){if(!("maxAttempts"in e)||!Number.isInteger(e.maxAttempts)||e.maxAttempts<2)throw new Error("Invalid method config retry policy: maxAttempts must be an integer at least 2");if(!("initialBackoff"in e)||"string"!=typeof e.initialBackoff||!s.test(e.initialBackoff))throw new Error("Invalid method config retry policy: initialBackoff must be a string consisting of a positive integer or decimal followed by s");if(!("maxBackoff"in e)||"string"!=typeof e.maxBackoff||!s.test(e.maxBackoff))throw new Error("Invalid method config retry policy: maxBackoff must be a string consisting of a positive integer or decimal followed by s");if(!("backoffMultiplier"in e)||"number"!=typeof e.backoffMultiplier||e.backoffMultiplier<=0)throw new Error("Invalid method config retry policy: backoffMultiplier must be a number greater than 0");if(!("retryableStatusCodes"in e)||!Array.isArray(e.retryableStatusCodes))throw new Error("Invalid method config retry policy: retryableStatusCodes is required");if(0===e.retryableStatusCodes.length)throw new Error("Invalid method config retry policy: retryableStatusCodes must be non-empty");for(const t of e.retryableStatusCodes)if("number"==typeof t){if(!Object.values(r.Status).includes(t))throw new Error("Invalid method config retry policy: retryableStatusCodes value not in status code range")}else{if("string"!=typeof t)throw new Error("Invalid method config retry policy: retryableStatusCodes value must be a string or number");if(!Object.values(r.Status).includes(t.toUpperCase()))throw new Error("Invalid method config retry policy: retryableStatusCodes value not a status code name")}return{maxAttempts:e.maxAttempts,initialBackoff:e.initialBackoff,maxBackoff:e.maxBackoff,backoffMultiplier:e.backoffMultiplier,retryableStatusCodes:e.retryableStatusCodes}}(e.retryPolicy)}else"hedgingPolicy"in e&&(i.hedgingPolicy=function(e){if(!("maxAttempts"in e)||!Number.isInteger(e.maxAttempts)||e.maxAttempts<2)throw new Error("Invalid method config hedging policy: maxAttempts must be an integer at least 2");if("hedgingDelay"in e&&("string"!=typeof e.hedgingDelay||!s.test(e.hedgingDelay)))throw new Error("Invalid method config hedging policy: hedgingDelay must be a string consisting of a positive integer followed by s");if("nonFatalStatusCodes"in e&&Array.isArray(e.nonFatalStatusCodes))for(const t of e.nonFatalStatusCodes)if("number"==typeof t){if(!Object.values(r.Status).includes(t))throw new Error("Invalid method config hedging policy: nonFatalStatusCodes value not in status code range")}else{if("string"!=typeof t)throw new Error("Invalid method config hedging policy: nonFatalStatusCodes value must be a string or number");if(!Object.values(r.Status).includes(t.toUpperCase()))throw new Error("Invalid method config hedging policy: nonFatalStatusCodes value not a status code name")}const t={maxAttempts:e.maxAttempts};return e.hedgingDelay&&(t.hedgingDelay=e.hedgingDelay),e.nonFatalStatusCodes&&(t.nonFatalStatusCodes=e.nonFatalStatusCodes),t}(e.hedgingPolicy));return i}function l(e){if(!("maxTokens"in e)||"number"!=typeof e.maxTokens||e.maxTokens<=0||e.maxTokens>1e3)throw new Error("Invalid retryThrottling: maxTokens must be a number in (0, 1000]");if(!("tokenRatio"in e)||"number"!=typeof e.tokenRatio||e.tokenRatio<=0)throw new Error("Invalid retryThrottling: tokenRatio must be a number greater than 0");return{maxTokens:+e.maxTokens.toFixed(3),tokenRatio:+e.tokenRatio.toFixed(3)}}function c(e){if("object"!=typeof e||null===e)throw new Error("Invalid loadBalancingConfig: unexpected type "+typeof e);const t=Object.keys(e);if(t.length>1)throw new Error(`Invalid loadBalancingConfig: unexpected multiple keys ${t}`);if(0===t.length)throw new Error("Invalid loadBalancingConfig: load balancing policy name required");return{[t[0]]:e[t[0]]}}function u(e){const t={loadBalancingConfig:[],methodConfig:[]};if("loadBalancingPolicy"in e){if("string"!=typeof e.loadBalancingPolicy)throw new Error("Invalid service config: invalid loadBalancingPolicy");t.loadBalancingPolicy=e.loadBalancingPolicy}if("loadBalancingConfig"in e){if(!Array.isArray(e.loadBalancingConfig))throw new Error("Invalid service config: invalid loadBalancingConfig");for(const i of e.loadBalancingConfig)t.loadBalancingConfig.push(c(i))}if("methodConfig"in e&&Array.isArray(e.methodConfig))for(const i of e.methodConfig)t.methodConfig.push(a(i));"retryThrottling"in e&&(t.retryThrottling=l(e.retryThrottling));const i=[];for(const e of t.methodConfig)for(const t of e.name){for(const e of i)if(t.service===e.service&&t.method===e.method)throw new Error(`Invalid service config: duplicate name ${t.service}/${t.method}`);i.push(t)}return t}function h(e){if(!("serviceConfig"in e))throw new Error("Invalid service config choice: missing service config");const t={serviceConfig:u(e.serviceConfig)};if("clientLanguage"in e){if(!Array.isArray(e.clientLanguage))throw new Error("Invalid service config choice: invalid clientLanguage");t.clientLanguage=[];for(const i of e.clientLanguage){if("string"!=typeof i)throw new Error("Invalid service config choice: invalid clientLanguage");t.clientLanguage.push(i)}}if("clientHostname"in e){if(!Array.isArray(e.clientHostname))throw new Error("Invalid service config choice: invalid clientHostname");t.clientHostname=[];for(const i of e.clientHostname){if("string"!=typeof i)throw new Error("Invalid service config choice: invalid clientHostname");t.clientHostname.push(i)}}if("percentage"in e){if(!("number"==typeof e.percentage&&0<=e.percentage&&e.percentage<=100))throw new Error("Invalid service config choice: invalid percentage");t.percentage=e.percentage}const i=["clientLanguage","percentage","clientHostname","serviceConfig"];for(const t in e)if(!i.includes(t))throw new Error(`Invalid service config choice: unexpected field ${t}`);return t}function d(e,t){if(!Array.isArray(e))throw new Error("Invalid service config list");for(const i of e){const e=h(i);if(!("number"==typeof e.percentage&&t>e.percentage)){if(Array.isArray(e.clientHostname)){let t=!1;for(const i of e.clientHostname)i===n.hostname()&&(t=!0);if(!t)continue}if(Array.isArray(e.clientLanguage)){let t=!1;for(const i of e.clientLanguage)"node"===i&&(t=!0);if(!t)continue}return e.serviceConfig}}throw new Error("No matching service config found")}},246(e,t,i){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.SingleSubchannelChannel=void 0;const n=i(5572),r=i(9503),s=i(4987),o=i(463),a=i(131),l=i(6067),c=i(6308),u=i(1703),h=i(4097),d=i(9302),f=i(3822);class p{constructor(e,t,i,n,r){var s,o;this.subchannel=e,this.method=t,this.options=n,this.callNumber=r,this.childCall=null,this.pendingMessage=null,this.readPending=!1,this.halfClosePending=!1,this.pendingStatus=null,this.readFilterPending=!1,this.writeFilterPending=!1;const l=this.method.split("/");let u="";l.length>=2&&(u=l[1]);const h=null!==(o=null===(s=(0,f.splitHostPort)(this.options.host))||void 0===s?void 0:s.host)&&void 0!==o?o:"localhost";this.serviceUrl=`https://${h}/${u}`;const d=(0,c.getRelativeTimeout)(n.deadline);d!==1/0&&(d<=0?this.cancelWithStatus(a.Status.DEADLINE_EXCEEDED,"Deadline exceeded"):setTimeout(()=>{this.cancelWithStatus(a.Status.DEADLINE_EXCEEDED,"Deadline exceeded")},d)),this.filterStack=i.createFilter()}cancelWithStatus(e,t){this.childCall?this.childCall.cancelWithStatus(e,t):this.pendingStatus={code:e,details:t,metadata:new h.Metadata}}getPeer(){var e,t;return null!==(t=null===(e=this.childCall)||void 0===e?void 0:e.getPeer())&&void 0!==t?t:this.subchannel.getAddress()}async start(e,t){if(this.pendingStatus)return void t.onReceiveStatus(this.pendingStatus);if(this.subchannel.getConnectivityState()!==o.ConnectivityState.READY)return void t.onReceiveStatus({code:a.Status.UNAVAILABLE,details:"Subchannel not ready",metadata:new h.Metadata});const i=await this.filterStack.sendMetadata(Promise.resolve(e));let n;try{n=await this.subchannel.getCallCredentials().generateMetadata({method_name:this.method,service_url:this.serviceUrl})}catch(e){const i=e,{code:n,details:r}=(0,l.restrictControlPlaneStatusCode)("number"==typeof i.code?i.code:a.Status.UNKNOWN,`Getting metadata from plugin failed with error: ${i.message}`);return void t.onReceiveStatus({code:n,details:r,metadata:new h.Metadata})}n.merge(i);const r={onReceiveMetadata:async e=>{t.onReceiveMetadata(await this.filterStack.receiveMetadata(e))},onReceiveMessage:async e=>{this.readFilterPending=!0;const i=await this.filterStack.receiveMessage(e);this.readFilterPending=!1,t.onReceiveMessage(i),this.pendingStatus&&t.onReceiveStatus(this.pendingStatus)},onReceiveStatus:async e=>{const i=await this.filterStack.receiveTrailers(e);this.readFilterPending?this.pendingStatus=i:t.onReceiveStatus(i)}};this.childCall=this.subchannel.createCall(n,this.options.host,this.method,r),this.readPending&&this.childCall.startRead(),this.pendingMessage&&this.childCall.sendMessageWithContext(this.pendingMessage.context,this.pendingMessage.message),this.halfClosePending&&!this.writeFilterPending&&this.childCall.halfClose()}async sendMessageWithContext(e,t){this.writeFilterPending=!0;const i=await this.filterStack.sendMessage(Promise.resolve({message:t,flags:e.flags}));this.writeFilterPending=!1,this.childCall?(this.childCall.sendMessageWithContext(e,i.message),this.halfClosePending&&this.childCall.halfClose()):this.pendingMessage={context:e,message:i.message}}startRead(){this.childCall?this.childCall.startRead():this.readPending=!0}halfClose(){this.childCall&&!this.writeFilterPending?this.childCall.halfClose():this.halfClosePending=!0}getCallNumber(){return this.callNumber}setCredentials(e){throw new Error("Method not implemented.")}getAuthContext(){return this.childCall?this.childCall.getAuthContext():null}}t.SingleSubchannelChannel=class{constructor(e,t,i){this.subchannel=e,this.target=t,this.channelzEnabled=!1,this.channelzTrace=new r.ChannelzTrace,this.callTracker=new r.ChannelzCallTracker,this.childrenTracker=new r.ChannelzChildrenTracker,this.channelzEnabled=0!==i["grpc.enable_channelz"],this.channelzRef=(0,r.registerChannelzChannel)((0,f.uriToString)(t),()=>({target:`${(0,f.uriToString)(t)} (${e.getAddress()})`,state:this.subchannel.getConnectivityState(),trace:this.channelzTrace,callTracker:this.callTracker,children:this.childrenTracker.getChildLists()}),this.channelzEnabled),this.channelzEnabled&&this.childrenTracker.refChild(e.getChannelzRef()),this.filterStackFactory=new u.FilterStackFactory([new s.CompressionFilterFactory(this,i)])}close(){this.channelzEnabled&&this.childrenTracker.unrefChild(this.subchannel.getChannelzRef()),(0,r.unregisterChannelzRef)(this.channelzRef)}getTarget(){return(0,f.uriToString)(this.target)}getConnectivityState(e){throw new Error("Method not implemented.")}watchConnectivityState(e,t,i){throw new Error("Method not implemented.")}getChannelzRef(){return this.channelzRef}createCall(e,t){const i={deadline:t,host:(0,d.getDefaultAuthority)(this.target),flags:a.Propagate.DEFAULTS,parentCall:null};return new p(this.subchannel,e,this.filterStackFactory,i,(0,n.getNextCallNumber)())}}},2284(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.StatusBuilder=void 0;t.StatusBuilder=class{constructor(){this.code=null,this.details=null,this.metadata=null}withCode(e){return this.code=e,this}withDetails(e){return this.details=e,this}withMetadata(e){return this.metadata=e,this}build(){const e={};return null!==this.code&&(e.code=this.code),null!==this.details&&(e.details=this.details),null!==this.metadata&&(e.metadata=this.metadata),e}}},9453(e,t){"use strict";var i;Object.defineProperty(t,"__esModule",{value:!0}),t.StreamDecoder=void 0,function(e){e[e.NO_DATA=0]="NO_DATA",e[e.READING_SIZE=1]="READING_SIZE",e[e.READING_MESSAGE=2]="READING_MESSAGE"}(i||(i={}));t.StreamDecoder=class{constructor(e){this.maxReadMessageLength=e,this.readState=i.NO_DATA,this.readCompressFlag=Buffer.alloc(1),this.readPartialSize=Buffer.alloc(4),this.readSizeRemaining=4,this.readMessageSize=0,this.readPartialMessage=[],this.readMessageRemaining=0}write(e){let t,n=0;const r=[];for(;n<e.length;)switch(this.readState){case i.NO_DATA:this.readCompressFlag=e.slice(n,n+1),n+=1,this.readState=i.READING_SIZE,this.readPartialSize.fill(0),this.readSizeRemaining=4,this.readMessageSize=0,this.readMessageRemaining=0,this.readPartialMessage=[];break;case i.READING_SIZE:if(t=Math.min(e.length-n,this.readSizeRemaining),e.copy(this.readPartialSize,4-this.readSizeRemaining,n,n+t),this.readSizeRemaining-=t,n+=t,0===this.readSizeRemaining){if(this.readMessageSize=this.readPartialSize.readUInt32BE(0),-1!==this.maxReadMessageLength&&this.readMessageSize>this.maxReadMessageLength)throw new Error(`Received message larger than max (${this.readMessageSize} vs ${this.maxReadMessageLength})`);if(this.readMessageRemaining=this.readMessageSize,this.readMessageRemaining>0)this.readState=i.READING_MESSAGE;else{const e=Buffer.concat([this.readCompressFlag,this.readPartialSize],5);this.readState=i.NO_DATA,r.push(e)}}break;case i.READING_MESSAGE:if(t=Math.min(e.length-n,this.readMessageRemaining),this.readPartialMessage.push(e.slice(n,n+t)),this.readMessageRemaining-=t,n+=t,0===this.readMessageRemaining){const e=[this.readCompressFlag,this.readPartialSize].concat(this.readPartialMessage),t=Buffer.concat(e,this.readMessageSize+5);this.readState=i.NO_DATA,r.push(t)}break;default:throw new Error("Unexpected read state")}return r}}},8996(e,t,i){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.EndpointMap=void 0,t.isTcpSubchannelAddress=r,t.subchannelAddressEqual=s,t.subchannelAddressToString=o,t.stringToSubchannelAddress=function(e,t){return(0,n.isIP)(e)?{host:e,port:null!=t?t:443}:{path:e}},t.endpointEqual=function(e,t){if(e.addresses.length!==t.addresses.length)return!1;for(let i=0;i<e.addresses.length;i++)if(!s(e.addresses[i],t.addresses[i]))return!1;return!0},t.endpointToString=function(e){return"["+e.addresses.map(o).join(", ")+"]"},t.endpointHasAddress=a;const n=i(9278);function r(e){return"port"in e}function s(e,t){return!e&&!t||!(!e||!t)&&(r(e)?r(t)&&e.host===t.host&&e.port===t.port:!r(t)&&e.path===t.path)}function o(e){return r(e)?(0,n.isIPv6)(e.host)?"["+e.host+"]:"+e.port:e.host+":"+e.port:e.path}function a(e,t){for(const i of e.addresses)if(s(i,t))return!0;return!1}function l(e,t){if(e.addresses.length!==t.addresses.length)return!1;for(const i of e.addresses){let e=!1;for(const n of t.addresses)if(s(i,n)){e=!0;break}if(!e)return!1}return!0}t.EndpointMap=class{constructor(){this.map=new Set}get size(){return this.map.size}getForSubchannelAddress(e){for(const t of this.map)if(a(t.key,e))return t.value}deleteMissing(e){const t=[];for(const i of this.map){let n=!1;for(const t of e)l(t,i.key)&&(n=!0);n||(t.push(i.value),this.map.delete(i))}return t}get(e){for(const t of this.map)if(l(e,t.key))return t.value}set(e,t){for(const i of this.map)if(l(e,i.key))return void(i.value=t);this.map.add({key:e,value:t})}delete(e){for(const t of this.map)if(l(e,t.key))return void this.map.delete(t)}has(e){for(const t of this.map)if(l(e,t.key))return!0;return!1}clear(){this.map.clear()}*keys(){for(const e of this.map)yield e.key}*values(){for(const e of this.map)yield e.value}*entries(){for(const e of this.map)yield[e.key,e.value]}}},5486(e,t,i){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Http2SubchannelCall=void 0;const n=i(5675),r=i(857),s=i(131),o=i(4097),a=i(9453),l=i(267),c=i(131);function u(e){const t=`Received HTTP status code ${e}`;let i;switch(e){case 400:i=s.Status.INTERNAL;break;case 401:i=s.Status.UNAUTHENTICATED;break;case 403:i=s.Status.PERMISSION_DENIED;break;case 404:i=s.Status.UNIMPLEMENTED;break;case 429:case 502:case 503:case 504:i=s.Status.UNAVAILABLE;break;default:i=s.Status.UNKNOWN}return{code:i,details:t,metadata:new o.Metadata}}t.Http2SubchannelCall=class{constructor(e,t,i,l,c){var h;this.http2Stream=e,this.callEventTracker=t,this.listener=i,this.transport=l,this.callId=c,this.isReadFilterPending=!1,this.isPushPending=!1,this.canPush=!1,this.readsClosed=!1,this.statusOutput=!1,this.unpushedReadMessages=[],this.finalStatus=null,this.internalError=null,this.serverEndedCall=!1,this.connectionDropped=!1;const d=null!==(h=l.getOptions()["grpc.max_receive_message_length"])&&void 0!==h?h:s.DEFAULT_MAX_RECEIVE_MESSAGE_LENGTH;this.decoder=new a.StreamDecoder(d),e.on("response",(e,t)=>{let i="";for(const t of Object.keys(e))i+="\t\t"+t+": "+e[t]+"\n";if(this.trace("Received server headers:\n"+i),this.httpStatusCode=e[":status"],t&n.constants.NGHTTP2_FLAG_END_STREAM)this.handleTrailers(e);else{let t;try{t=o.Metadata.fromHttp2Headers(e)}catch(e){return void this.endCall({code:s.Status.UNKNOWN,details:e.message,metadata:new o.Metadata})}this.listener.onReceiveMetadata(t)}}),e.on("trailers",e=>{this.handleTrailers(e)}),e.on("data",e=>{if(this.statusOutput)return;let t;this.trace("receive HTTP/2 data frame of length "+e.length);try{t=this.decoder.write(e)}catch(e){if(void 0!==this.httpStatusCode&&200!==this.httpStatusCode){const e=u(this.httpStatusCode);this.cancelWithStatus(e.code,e.details)}else this.cancelWithStatus(s.Status.RESOURCE_EXHAUSTED,e.message);return}for(const e of t)this.trace("parsed message of length "+e.length),this.callEventTracker.addMessageReceived(),this.tryPush(e)}),e.on("end",()=>{this.readsClosed=!0,this.maybeOutputStatus()}),e.on("close",()=>{this.serverEndedCall=!0,process.nextTick(()=>{var t;if(this.trace("HTTP/2 stream closed with code "+e.rstCode),(null===(t=this.finalStatus)||void 0===t?void 0:t.code)===s.Status.OK)return;let i,r="";switch(e.rstCode){case n.constants.NGHTTP2_NO_ERROR:if(null!==this.finalStatus)return;if(this.httpStatusCode&&200!==this.httpStatusCode){const e=u(this.httpStatusCode);i=e.code,r=e.details}else i=s.Status.INTERNAL,r=`Received RST_STREAM with code ${e.rstCode} (Call ended without gRPC status)`;break;case n.constants.NGHTTP2_REFUSED_STREAM:i=s.Status.UNAVAILABLE,r="Stream refused by server";break;case n.constants.NGHTTP2_CANCEL:this.connectionDropped?(i=s.Status.UNAVAILABLE,r="Connection dropped"):(i=s.Status.CANCELLED,r="Call cancelled");break;case n.constants.NGHTTP2_ENHANCE_YOUR_CALM:i=s.Status.RESOURCE_EXHAUSTED,r="Bandwidth exhausted or memory limit exceeded";break;case n.constants.NGHTTP2_INADEQUATE_SECURITY:i=s.Status.PERMISSION_DENIED,r="Protocol not secure enough";break;case n.constants.NGHTTP2_INTERNAL_ERROR:i=s.Status.INTERNAL,null===this.internalError?r=`Received RST_STREAM with code ${e.rstCode} (Internal server error)`:"ECONNRESET"===this.internalError.code||"ETIMEDOUT"===this.internalError.code?(i=s.Status.UNAVAILABLE,r=this.internalError.message):r=`Received RST_STREAM with code ${e.rstCode} triggered by internal client error: ${this.internalError.message}`;break;default:i=s.Status.INTERNAL,r=`Received RST_STREAM with code ${e.rstCode}`}this.endCall({code:i,details:r,metadata:new o.Metadata,rstCode:e.rstCode})})}),e.on("error",e=>{"ERR_HTTP2_STREAM_ERROR"!==e.code&&(this.trace("Node error event: message="+e.message+" code="+e.code+" errno="+function(e){for(const[t,i]of Object.entries(r.constants.errno))if(i===e)return t;return"Unknown system error "+e}(e.errno)+" syscall="+e.syscall),this.internalError=e),this.callEventTracker.onStreamEnd(!1)})}getDeadlineInfo(){return[`remote_addr=${this.getPeer()}`]}onDisconnect(){this.connectionDropped=!0,setImmediate(()=>{this.endCall({code:s.Status.UNAVAILABLE,details:"Connection dropped",metadata:new o.Metadata})})}outputStatus(){this.statusOutput||(this.statusOutput=!0,this.trace("ended with status: code="+this.finalStatus.code+' details="'+this.finalStatus.details+'"'),this.callEventTracker.onCallEnd(this.finalStatus),process.nextTick(()=>{this.listener.onReceiveStatus(this.finalStatus)}),this.http2Stream.resume())}trace(e){l.trace(c.LogVerbosity.DEBUG,"subchannel_call","["+this.callId+"] "+e)}endCall(e){null!==this.finalStatus&&this.finalStatus.code!==s.Status.OK||(this.finalStatus=e,this.maybeOutputStatus()),this.destroyHttp2Stream()}maybeOutputStatus(){null!==this.finalStatus&&(this.finalStatus.code!==s.Status.OK||this.readsClosed&&0===this.unpushedReadMessages.length&&!this.isReadFilterPending&&!this.isPushPending)&&this.outputStatus()}push(e){this.trace("pushing to reader message of length "+(e instanceof Buffer?e.length:null)),this.canPush=!1,this.isPushPending=!0,process.nextTick(()=>{this.isPushPending=!1,this.statusOutput||(this.listener.onReceiveMessage(e),this.maybeOutputStatus())})}tryPush(e){this.canPush?(this.http2Stream.pause(),this.push(e)):(this.trace("unpushedReadMessages.push message of length "+e.length),this.unpushedReadMessages.push(e))}handleTrailers(e){this.serverEndedCall=!0,this.callEventTracker.onStreamEnd(!0);let t,i="";for(const t of Object.keys(e))i+="\t\t"+t+": "+e[t]+"\n";this.trace("Received server trailers:\n"+i);try{t=o.Metadata.fromHttp2Headers(e)}catch(e){t=new o.Metadata}const n=t.getMap();let r;if("string"==typeof n["grpc-status"]){const e=Number(n["grpc-status"]);this.trace("received status code "+e+" from server"),t.remove("grpc-status");let i="";if("string"==typeof n["grpc-message"]){try{i=decodeURI(n["grpc-message"])}catch(e){i=n["grpc-message"]}t.remove("grpc-message"),this.trace('received status details string "'+i+'" from server')}r={code:e,details:i,metadata:t}}else this.httpStatusCode?(r=u(this.httpStatusCode),r.metadata=t):r={code:s.Status.UNKNOWN,details:"No status information received",metadata:t};this.endCall(r)}destroyHttp2Stream(){var e;if(!this.http2Stream.destroyed)if(this.serverEndedCall)this.http2Stream.end();else{let t;t=(null===(e=this.finalStatus)||void 0===e?void 0:e.code)===s.Status.OK?n.constants.NGHTTP2_NO_ERROR:n.constants.NGHTTP2_CANCEL,this.trace("close http2 stream with code "+t),this.http2Stream.close(t)}}cancelWithStatus(e,t){this.trace("cancelWithStatus code: "+e+' details: "'+t+'"'),this.endCall({code:e,details:t,metadata:new o.Metadata})}getStatus(){return this.finalStatus}getPeer(){return this.transport.getPeerName()}getCallNumber(){return this.callId}getAuthContext(){return this.transport.getAuthContext()}startRead(){if(null!==this.finalStatus&&this.finalStatus.code!==s.Status.OK)return this.readsClosed=!0,void this.maybeOutputStatus();if(this.canPush=!0,this.unpushedReadMessages.length>0){const e=this.unpushedReadMessages.shift();return void this.push(e)}this.http2Stream.resume()}sendMessageWithContext(e,t){this.trace("write() called with message of length "+t.length);const i=t=>{process.nextTick(()=>{var i;let n=s.Status.UNAVAILABLE;"ERR_STREAM_WRITE_AFTER_END"===(null==t?void 0:t.code)&&(n=s.Status.INTERNAL),t&&this.cancelWithStatus(n,`Write error: ${t.message}`),null===(i=e.callback)||void 0===i||i.call(e)})};this.trace("sending data chunk of length "+t.length),this.callEventTracker.addMessageSent();try{this.http2Stream.write(t,i)}catch(e){this.endCall({code:s.Status.UNAVAILABLE,details:`Write failed with error ${e.message}`,metadata:new o.Metadata})}}halfClose(){this.trace("end() called"),this.trace("calling end() on HTTP/2 stream"),this.http2Stream.end()}}},2379(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.BaseSubchannelWrapper=void 0;t.BaseSubchannelWrapper=class{constructor(e){this.child=e,this.healthy=!0,this.healthListeners=new Set,this.refcount=0,this.dataWatchers=new Set,e.addHealthStateWatcher(e=>{this.healthy&&this.updateHealthListeners()})}updateHealthListeners(){for(const e of this.healthListeners)e(this.isHealthy())}getConnectivityState(){return this.child.getConnectivityState()}addConnectivityStateListener(e){this.child.addConnectivityStateListener(e)}removeConnectivityStateListener(e){this.child.removeConnectivityStateListener(e)}startConnecting(){this.child.startConnecting()}getAddress(){return this.child.getAddress()}throttleKeepalive(e){this.child.throttleKeepalive(e)}ref(){this.child.ref(),this.refcount+=1}unref(){this.child.unref(),this.refcount-=1,0===this.refcount&&this.destroy()}destroy(){for(const e of this.dataWatchers)e.destroy()}getChannelzRef(){return this.child.getChannelzRef()}isHealthy(){return this.healthy&&this.child.isHealthy()}addHealthStateWatcher(e){this.healthListeners.add(e)}removeHealthStateWatcher(e){this.healthListeners.delete(e)}addDataWatcher(e){e.setSubchannel(this.getRealSubchannel()),this.dataWatchers.add(e)}setHealthy(e){e!==this.healthy&&(this.healthy=e,this.child.isHealthy()&&this.updateHealthListeners())}getRealSubchannel(){return this.child.getRealSubchannel()}realSubchannelEquals(e){return this.getRealSubchannel()===e.getRealSubchannel()}getCallCredentials(){return this.child.getCallCredentials()}getChannel(){return this.child.getChannel()}}},5716(e,t,i){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.SubchannelPool=void 0,t.getSubchannelPool=function(e){return e?c:new l};const n=i(6998),r=i(1385),s=i(8996),o=i(3822),a=i(2095);class l{constructor(){this.pool=Object.create(null),this.cleanupTimer=null}unrefUnusedSubchannels(){let e=!0;for(const t in this.pool){const i=this.pool[t].filter(e=>!e.subchannel.unrefIfOneRef());i.length>0&&(e=!1),this.pool[t]=i}e&&null!==this.cleanupTimer&&(clearInterval(this.cleanupTimer),this.cleanupTimer=null)}ensureCleanupTask(){var e,t;null===this.cleanupTimer&&(this.cleanupTimer=setInterval(()=>{this.unrefUnusedSubchannels()},1e4),null===(t=(e=this.cleanupTimer).unref)||void 0===t||t.call(e))}getOrCreateSubchannel(e,t,i,l){this.ensureCleanupTask();const c=(0,o.uriToString)(e);if(c in this.pool){const e=this.pool[c];for(const r of e)if((0,s.subchannelAddressEqual)(t,r.subchannelAddress)&&(0,n.channelOptionsEqual)(i,r.channelArguments)&&l._equals(r.channelCredentials))return r.subchannel}const u=new r.Subchannel(e,t,i,l,new a.Http2SubchannelConnector(e));return c in this.pool||(this.pool[c]=[]),this.pool[c].push({subchannelAddress:t,channelArguments:i,channelCredentials:l,subchannel:u}),u.ref(),u}}t.SubchannelPool=l;const c=new l},1385(e,t,i){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Subchannel=void 0;const n=i(463),r=i(3956),s=i(267),o=i(131),a=i(3822),l=i(8996),c=i(9503),u=i(246);t.Subchannel=class{constructor(e,t,i,s,o){var a;this.channelTarget=e,this.subchannelAddress=t,this.options=i,this.connector=o,this.connectivityState=n.ConnectivityState.IDLE,this.transport=null,this.continueConnecting=!1,this.stateListeners=new Set,this.refcount=0,this.channelzEnabled=!0,this.dataProducers=new Map,this.subchannelChannel=null;const u={initialDelay:i["grpc.initial_reconnect_backoff_ms"],maxDelay:i["grpc.max_reconnect_backoff_ms"]};this.backoffTimeout=new r.BackoffTimeout(()=>{this.handleBackoffTimer()},u),this.backoffTimeout.unref(),this.subchannelAddressString=(0,l.subchannelAddressToString)(t),this.keepaliveTime=null!==(a=i["grpc.keepalive_time_ms"])&&void 0!==a?a:-1,0===i["grpc.enable_channelz"]?(this.channelzEnabled=!1,this.channelzTrace=new c.ChannelzTraceStub,this.callTracker=new c.ChannelzCallTrackerStub,this.childrenTracker=new c.ChannelzChildrenTrackerStub,this.streamTracker=new c.ChannelzCallTrackerStub):(this.channelzTrace=new c.ChannelzTrace,this.callTracker=new c.ChannelzCallTracker,this.childrenTracker=new c.ChannelzChildrenTracker,this.streamTracker=new c.ChannelzCallTracker),this.channelzRef=(0,c.registerChannelzSubchannel)(this.subchannelAddressString,()=>this.getChannelzInfo(),this.channelzEnabled),this.channelzTrace.addTrace("CT_INFO","Subchannel created"),this.trace("Subchannel constructed with options "+JSON.stringify(i,void 0,2)),this.secureConnector=s._createSecureConnector(e,i)}getChannelzInfo(){return{state:this.connectivityState,trace:this.channelzTrace,callTracker:this.callTracker,children:this.childrenTracker.getChildLists(),target:this.subchannelAddressString}}trace(e){s.trace(o.LogVerbosity.DEBUG,"subchannel","("+this.channelzRef.id+") "+this.subchannelAddressString+" "+e)}refTrace(e){s.trace(o.LogVerbosity.DEBUG,"subchannel_refcount","("+this.channelzRef.id+") "+this.subchannelAddressString+" "+e)}handleBackoffTimer(){this.continueConnecting?this.transitionToState([n.ConnectivityState.TRANSIENT_FAILURE],n.ConnectivityState.CONNECTING):this.transitionToState([n.ConnectivityState.TRANSIENT_FAILURE],n.ConnectivityState.IDLE)}startBackoff(){this.backoffTimeout.runOnce()}stopBackoff(){this.backoffTimeout.stop(),this.backoffTimeout.reset()}startConnectingInternal(){let e=this.options;if(e["grpc.keepalive_time_ms"]){const t=Math.min(this.keepaliveTime,2147483647);e=Object.assign(Object.assign({},e),{"grpc.keepalive_time_ms":t})}this.connector.connect(this.subchannelAddress,this.secureConnector,e).then(e=>{this.transitionToState([n.ConnectivityState.CONNECTING],n.ConnectivityState.READY)?(this.transport=e,this.channelzEnabled&&this.childrenTracker.refChild(e.getChannelzRef()),e.addDisconnectListener(e=>{this.transitionToState([n.ConnectivityState.READY],n.ConnectivityState.IDLE),e&&this.keepaliveTime>0&&(this.keepaliveTime*=2,s.log(o.LogVerbosity.ERROR,`Connection to ${(0,a.uriToString)(this.channelTarget)} at ${this.subchannelAddressString} rejected by server because of excess pings. Increasing ping interval to ${this.keepaliveTime} ms`))})):e.shutdown()},e=>{this.transitionToState([n.ConnectivityState.CONNECTING],n.ConnectivityState.TRANSIENT_FAILURE,`${e}`)})}transitionToState(e,t,i){var r,s;if(-1===e.indexOf(this.connectivityState))return!1;i?this.trace(n.ConnectivityState[this.connectivityState]+" -> "+n.ConnectivityState[t]+' with error "'+i+'"'):this.trace(n.ConnectivityState[this.connectivityState]+" -> "+n.ConnectivityState[t]),this.channelzEnabled&&this.channelzTrace.addTrace("CT_INFO","Connectivity state change to "+n.ConnectivityState[t]);const o=this.connectivityState;switch(this.connectivityState=t,t){case n.ConnectivityState.READY:this.stopBackoff();break;case n.ConnectivityState.CONNECTING:this.startBackoff(),this.startConnectingInternal(),this.continueConnecting=!1;break;case n.ConnectivityState.TRANSIENT_FAILURE:this.channelzEnabled&&this.transport&&this.childrenTracker.unrefChild(this.transport.getChannelzRef()),null===(r=this.transport)||void 0===r||r.shutdown(),this.transport=null,this.backoffTimeout.isRunning()||process.nextTick(()=>{this.handleBackoffTimer()});break;case n.ConnectivityState.IDLE:this.channelzEnabled&&this.transport&&this.childrenTracker.unrefChild(this.transport.getChannelzRef()),null===(s=this.transport)||void 0===s||s.shutdown(),this.transport=null;break;default:throw new Error(`Invalid state: unknown ConnectivityState ${t}`)}for(const e of this.stateListeners)e(this,o,t,this.keepaliveTime,i);return!0}ref(){this.refTrace("refcount "+this.refcount+" -> "+(this.refcount+1)),this.refcount+=1}unref(){this.refTrace("refcount "+this.refcount+" -> "+(this.refcount-1)),this.refcount-=1,0===this.refcount&&(this.channelzTrace.addTrace("CT_INFO","Shutting down"),(0,c.unregisterChannelzRef)(this.channelzRef),this.secureConnector.destroy(),process.nextTick(()=>{this.transitionToState([n.ConnectivityState.CONNECTING,n.ConnectivityState.READY],n.ConnectivityState.IDLE)}))}unrefIfOneRef(){return 1===this.refcount&&(this.unref(),!0)}createCall(e,t,i,n){if(!this.transport)throw new Error("Cannot create call, subchannel not READY");let r;return this.channelzEnabled?(this.callTracker.addCallStarted(),this.streamTracker.addCallStarted(),r={onCallEnd:e=>{e.code===o.Status.OK?this.callTracker.addCallSucceeded():this.callTracker.addCallFailed()}}):r={},this.transport.createCall(e,t,i,n,r)}startConnecting(){process.nextTick(()=>{this.transitionToState([n.ConnectivityState.IDLE],n.ConnectivityState.CONNECTING)||this.connectivityState===n.ConnectivityState.TRANSIENT_FAILURE&&(this.continueConnecting=!0)})}getConnectivityState(){return this.connectivityState}addConnectivityStateListener(e){this.stateListeners.add(e)}removeConnectivityStateListener(e){this.stateListeners.delete(e)}resetBackoff(){process.nextTick(()=>{this.backoffTimeout.reset(),this.transitionToState([n.ConnectivityState.TRANSIENT_FAILURE],n.ConnectivityState.CONNECTING)})}getAddress(){return this.subchannelAddressString}getChannelzRef(){return this.channelzRef}isHealthy(){return!0}addHealthStateWatcher(e){}removeHealthStateWatcher(e){}getRealSubchannel(){return this}realSubchannelEquals(e){return e.getRealSubchannel()===this}throttleKeepalive(e){e>this.keepaliveTime&&(this.keepaliveTime=e)}getCallCredentials(){return this.secureConnector.getCallCredentials()}getChannel(){return this.subchannelChannel||(this.subchannelChannel=new u.SingleSubchannelChannel(this,this.channelTarget,this.options)),this.subchannelChannel}addDataWatcher(e){throw new Error("Not implemented")}getOrCreateDataProducer(e,t){const i=this.dataProducers.get(e);if(i)return i;const n=t(this);return this.dataProducers.set(e,n),n}removeDataProducer(e){this.dataProducers.delete(e)}}},9167(e,t,i){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.CIPHER_SUITES=void 0,t.getDefaultRootsData=function(){if(r)return null===s&&(s=n.readFileSync(r)),s;return null};const n=i(9896);t.CIPHER_SUITES=process.env.GRPC_SSL_CIPHER_SUITES;const r=process.env.GRPC_DEFAULT_SSL_ROOTS_FILE_PATH;let s=null},2095(e,t,i){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Http2SubchannelConnector=void 0;const n=i(5675),r=i(4756),s=i(9503),o=i(131),a=i(7803),l=i(267),c=i(9302),u=i(8996),h=i(3822),d=i(9278),f=i(5486),p=i(5572),g="transport",m=i(9943).rE,{HTTP2_HEADER_AUTHORITY:v,HTTP2_HEADER_CONTENT_TYPE:y,HTTP2_HEADER_METHOD:b,HTTP2_HEADER_PATH:S,HTTP2_HEADER_TE:_,HTTP2_HEADER_USER_AGENT:C}=n.constants,E=Buffer.from("too_many_pings","ascii");class w{constructor(e,t,i,o){this.session=e,this.options=i,this.remoteName=o,this.keepaliveTimer=null,this.pendingSendKeepalivePing=!1,this.activeCalls=new Set,this.disconnectListeners=[],this.disconnectHandled=!1,this.channelzEnabled=!0,this.keepalivesSent=0,this.messagesSent=0,this.messagesReceived=0,this.lastMessageSentTimestamp=null,this.lastMessageReceivedTimestamp=null,this.subchannelAddressString=(0,u.subchannelAddressToString)(t),0===i["grpc.enable_channelz"]?(this.channelzEnabled=!1,this.streamTracker=new s.ChannelzCallTrackerStub):this.streamTracker=new s.ChannelzCallTracker,this.channelzRef=(0,s.registerChannelzSocket)(this.subchannelAddressString,()=>this.getChannelzInfo(),this.channelzEnabled),this.userAgent=[i["grpc.primary_user_agent"],`grpc-node-js/${m}`,i["grpc.secondary_user_agent"]].filter(e=>e).join(" "),this.keepaliveTimeMs="grpc.keepalive_time_ms"in i?i["grpc.keepalive_time_ms"]:-1,this.keepaliveTimeoutMs="grpc.keepalive_timeout_ms"in i?i["grpc.keepalive_timeout_ms"]:2e4,this.keepaliveWithoutCalls="grpc.keepalive_permit_without_calls"in i&&1===i["grpc.keepalive_permit_without_calls"],e.once("close",()=>{this.trace("session closed"),this.handleDisconnect()}),e.once("goaway",(e,t,i)=>{let r=!1;e===n.constants.NGHTTP2_ENHANCE_YOUR_CALM&&i&&i.equals(E)&&(r=!0),this.trace("connection closed by GOAWAY with code "+e+" and data "+(null==i?void 0:i.toString())),this.reportDisconnectToOwner(r)}),e.once("error",e=>{this.trace("connection closed with error "+e.message),this.handleDisconnect()}),e.socket.once("close",e=>{this.trace("connection closed. hadError="+e),this.handleDisconnect()}),l.isTracerEnabled(g)&&(e.on("remoteSettings",t=>{this.trace("new settings received"+(this.session!==e?" on the old connection":"")+": "+JSON.stringify(t))}),e.on("localSettings",t=>{this.trace("local settings acknowledged by remote"+(this.session!==e?" on the old connection":"")+": "+JSON.stringify(t))})),this.keepaliveWithoutCalls&&this.maybeStartKeepalivePingTimer(),e.socket instanceof r.TLSSocket?this.authContext={transportSecurityType:"ssl",sslPeerCertificate:e.socket.getPeerCertificate()}:this.authContext={}}getChannelzInfo(){var e,t,i;const n=this.session.socket,r=n.remoteAddress?(0,u.stringToSubchannelAddress)(n.remoteAddress,n.remotePort):null,s=n.localAddress?(0,u.stringToSubchannelAddress)(n.localAddress,n.localPort):null;let o;if(this.session.encrypted){const t=n,i=t.getCipher(),r=t.getCertificate(),s=t.getPeerCertificate();o={cipherSuiteStandardName:null!==(e=i.standardName)&&void 0!==e?e:null,cipherSuiteOtherName:i.standardName?null:i.name,localCertificate:r&&"raw"in r?r.raw:null,remoteCertificate:s&&"raw"in s?s.raw:null}}else o=null;return{remoteAddress:r,localAddress:s,security:o,remoteName:this.remoteName,streamsStarted:this.streamTracker.callsStarted,streamsSucceeded:this.streamTracker.callsSucceeded,streamsFailed:this.streamTracker.callsFailed,messagesSent:this.messagesSent,messagesReceived:this.messagesReceived,keepAlivesSent:this.keepalivesSent,lastLocalStreamCreatedTimestamp:this.streamTracker.lastCallStartedTimestamp,lastRemoteStreamCreatedTimestamp:null,lastMessageSentTimestamp:this.lastMessageSentTimestamp,lastMessageReceivedTimestamp:this.lastMessageReceivedTimestamp,localFlowControlWindow:null!==(t=this.session.state.localWindowSize)&&void 0!==t?t:null,remoteFlowControlWindow:null!==(i=this.session.state.remoteWindowSize)&&void 0!==i?i:null}}trace(e){l.trace(o.LogVerbosity.DEBUG,g,"("+this.channelzRef.id+") "+this.subchannelAddressString+" "+e)}keepaliveTrace(e){l.trace(o.LogVerbosity.DEBUG,"keepalive","("+this.channelzRef.id+") "+this.subchannelAddressString+" "+e)}flowControlTrace(e){l.trace(o.LogVerbosity.DEBUG,"transport_flowctrl","("+this.channelzRef.id+") "+this.subchannelAddressString+" "+e)}internalsTrace(e){l.trace(o.LogVerbosity.DEBUG,"transport_internals","("+this.channelzRef.id+") "+this.subchannelAddressString+" "+e)}reportDisconnectToOwner(e){this.disconnectHandled||(this.disconnectHandled=!0,this.disconnectListeners.forEach(t=>t(e)))}handleDisconnect(){this.clearKeepaliveTimeout(),this.reportDisconnectToOwner(!1);for(const e of this.activeCalls)e.onDisconnect();setImmediate(()=>{this.session.destroy()})}addDisconnectListener(e){this.disconnectListeners.push(e)}canSendPing(){return!this.session.destroyed&&this.keepaliveTimeMs>0&&(this.keepaliveWithoutCalls||this.activeCalls.size>0)}maybeSendPing(){var e,t;if(!this.canSendPing())return void(this.pendingSendKeepalivePing=!0);if(this.keepaliveTimer)return void console.error("keepaliveTimeout is not null");this.channelzEnabled&&(this.keepalivesSent+=1),this.keepaliveTrace("Sending ping with timeout "+this.keepaliveTimeoutMs+"ms"),this.keepaliveTimer=setTimeout(()=>{this.keepaliveTimer=null,this.keepaliveTrace("Ping timeout passed without response"),this.handleDisconnect()},this.keepaliveTimeoutMs),null===(t=(e=this.keepaliveTimer).unref)||void 0===t||t.call(e);let i="";try{this.session.ping((e,t,i)=>{this.clearKeepaliveTimeout(),e?(this.keepaliveTrace("Ping failed with error "+e.message),this.handleDisconnect()):(this.keepaliveTrace("Received ping response"),this.maybeStartKeepalivePingTimer())})||(i="Ping returned false")}catch(e){i=(e instanceof Error?e.message:"")||"Unknown error"}i&&(this.keepaliveTrace("Ping send failed: "+i),this.handleDisconnect())}maybeStartKeepalivePingTimer(){var e,t;this.canSendPing()&&(this.pendingSendKeepalivePing?(this.pendingSendKeepalivePing=!1,this.maybeSendPing()):this.keepaliveTimer||(this.keepaliveTrace("Starting keepalive timer for "+this.keepaliveTimeMs+"ms"),this.keepaliveTimer=setTimeout(()=>{this.keepaliveTimer=null,this.maybeSendPing()},this.keepaliveTimeMs),null===(t=(e=this.keepaliveTimer).unref)||void 0===t||t.call(e)))}clearKeepaliveTimeout(){this.keepaliveTimer&&(clearTimeout(this.keepaliveTimer),this.keepaliveTimer=null)}removeActiveCall(e){this.activeCalls.delete(e),0===this.activeCalls.size&&this.session.unref()}addActiveCall(e){this.activeCalls.add(e),1===this.activeCalls.size&&(this.session.ref(),this.keepaliveWithoutCalls||this.maybeStartKeepalivePingTimer())}createCall(e,t,i,n,r){const s=e.toHttp2Headers();let o,a,l;s[v]=t,s[C]=this.userAgent,s[y]="application/grpc",s[b]="POST",s[S]=i,s[_]="trailers";try{o=this.session.request(s)}catch(e){throw this.handleDisconnect(),e}return this.flowControlTrace("local window size: "+this.session.state.localWindowSize+" remote window size: "+this.session.state.remoteWindowSize),this.internalsTrace("session.closed="+this.session.closed+" session.destroyed="+this.session.destroyed+" session.socket.destroyed="+this.session.socket.destroyed),this.channelzEnabled?(this.streamTracker.addCallStarted(),a={addMessageSent:()=>{var e;this.messagesSent+=1,this.lastMessageSentTimestamp=new Date,null===(e=r.addMessageSent)||void 0===e||e.call(r)},addMessageReceived:()=>{var e;this.messagesReceived+=1,this.lastMessageReceivedTimestamp=new Date,null===(e=r.addMessageReceived)||void 0===e||e.call(r)},onCallEnd:e=>{var t;null===(t=r.onCallEnd)||void 0===t||t.call(r,e),this.removeActiveCall(l)},onStreamEnd:e=>{var t;e?this.streamTracker.addCallSucceeded():this.streamTracker.addCallFailed(),null===(t=r.onStreamEnd)||void 0===t||t.call(r,e)}}):a={addMessageSent:()=>{var e;null===(e=r.addMessageSent)||void 0===e||e.call(r)},addMessageReceived:()=>{var e;null===(e=r.addMessageReceived)||void 0===e||e.call(r)},onCallEnd:e=>{var t;null===(t=r.onCallEnd)||void 0===t||t.call(r,e),this.removeActiveCall(l)},onStreamEnd:e=>{var t;null===(t=r.onStreamEnd)||void 0===t||t.call(r,e)}},l=new f.Http2SubchannelCall(o,a,n,this,(0,p.getNextCallNumber)()),this.addActiveCall(l),l}getChannelzRef(){return this.channelzRef}getPeerName(){return this.subchannelAddressString}getOptions(){return this.options}getAuthContext(){return this.authContext}shutdown(){this.session.close(),(0,s.unregisterChannelzRef)(this.channelzRef)}}t.Http2SubchannelConnector=class{constructor(e){this.channelTarget=e,this.session=null,this.isShutdown=!1}trace(e){l.trace(o.LogVerbosity.DEBUG,g,(0,h.uriToString)(this.channelTarget)+" "+e)}createSession(e,t,i){return this.isShutdown?Promise.reject():e.socket.closed?Promise.reject("Connection closed before starting HTTP/2 handshake"):new Promise((r,s)=>{var o,a,l,u,d,f,p,g;let m=null,v=this.channelTarget;if("grpc.http_connect_target"in i){const e=(0,h.parseUri)(i["grpc.http_connect_target"]);e&&(v=e,m=(0,h.uriToString)(e))}const y=e.secure?"https":"http",b=(0,c.getDefaultAuthority)(v),S=()=>{var e;null===(e=this.session)||void 0===e||e.destroy(),this.session=null,setImmediate(()=>{O||(O=!0,s(`${R.trim()} (${(new Date).toISOString()})`))})},_=e=>{var t;null===(t=this.session)||void 0===t||t.destroy(),R=e.message,this.trace("connection failed with error "+R),O||(O=!0,s(`${R} (${(new Date).toISOString()})`))},C={createConnection:(t,i)=>e.socket,settings:{initialWindowSize:null!==(u=null!==(o=i["grpc-node.flow_control_window"])&&void 0!==o?o:null===(l=null===(a=n.getDefaultSettings)||void 0===a?void 0:a.call(n))||void 0===l?void 0:l.initialWindowSize)&&void 0!==u?u:65535},maxSendHeaderBlockLength:Number.MAX_SAFE_INTEGER,maxSessionMemory:null!==(d=i["grpc-node.max_session_memory"])&&void 0!==d?d:Number.MAX_SAFE_INTEGER},E=n.connect(`${y}://${b}`,C),T=null!==(g=null===(p=null===(f=n.getDefaultSettings)||void 0===f?void 0:f.call(n))||void 0===p?void 0:p.initialWindowSize)&&void 0!==g?g:65535,k=i["grpc-node.flow_control_window"];this.session=E;let R="Failed to connect",O=!1;E.unref(),E.once("remoteSettings",()=>{var n;if(k&&k>T)try{E.setLocalWindowSize(k)}catch(e){const t=k-(null!==(n=E.state.localWindowSize)&&void 0!==n?n:T);t>0&&E.incrementWindowSize(t)}E.removeAllListeners(),e.socket.removeListener("close",S),e.socket.removeListener("error",_),r(new w(E,t,i,m)),this.session=null}),E.once("close",S),E.once("error",_),e.socket.once("close",S),e.socket.once("error",_)})}tcpConnect(e,t){return(0,a.getProxiedConnection)(e,t).then(t=>t||new Promise((t,i)=>{const n=()=>{i(new Error("Socket closed"))},r=e=>{i(e)},s=d.connect(e,()=>{s.removeListener("close",n),s.removeListener("error",r),t(s)});s.once("close",n),s.once("error",r)}))}async connect(e,t,i){if(this.isShutdown)return Promise.reject();let n=null,r=null;const s=(0,u.subchannelAddressToString)(e);try{return this.trace(s+" Waiting for secureConnector to be ready"),await t.waitForReady(),this.trace(s+" secureConnector is ready"),n=await this.tcpConnect(e,i),n.setNoDelay(),this.trace(s+" Established TCP connection"),r=await t.connect(n),this.trace(s+" Established secure connection"),this.createSession(r,e,i)}catch(e){throw null==n||n.destroy(),null==r||r.socket.destroy(),e}}shutdown(){var e;this.isShutdown=!0,null===(e=this.session)||void 0===e||e.close(),this.session=null}}},3822(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.parseUri=function(e){const t=i.exec(e);if(null===t)return null;return{scheme:t[1],authority:t[2],path:t[3]}},t.splitHostPort=function(e){if(e.startsWith("[")){const t=e.indexOf("]");if(-1===t)return null;const i=e.substring(1,t);if(-1===i.indexOf(":"))return null;if(e.length>t+1){if(":"===e[t+1]){const r=e.substring(t+2);return n.test(r)?{host:i,port:+r}:null}return null}return{host:i}}{const t=e.split(":");return 2===t.length?n.test(t[1])?{host:t[0],port:+t[1]}:null:{host:e}}},t.combineHostPort=function(e){return void 0===e.port?e.host:e.host.includes(":")?`[${e.host}]:${e.port}`:`${e.host}:${e.port}`},t.uriToString=function(e){let t="";void 0!==e.scheme&&(t+=e.scheme+":");void 0!==e.authority&&(t+="//"+e.authority+"/");return t+=e.path,t};const i=/^(?:([A-Za-z0-9+.-]+):)?(?:\/\/([^/]*)\/)?(.+)$/;const n=/^\d+$/},5085(e,t,i){"use strict";t.Yi=t.Ib=void 0;const n=i(2028),r=i(2549),s=i(5407),o=i(3197);var a;i(5017),function(e){e.IDEMPOTENCY_UNKNOWN="IDEMPOTENCY_UNKNOWN",e.NO_SIDE_EFFECTS="NO_SIDE_EFFECTS",e.IDEMPOTENT="IDEMPOTENT"}(a=t.Ib||(t.Ib={}));const l={longs:String,enums:String,bytes:String,defaults:!0,oneofs:!0,json:!0};function c(e,t){const i=(n=t,s=e.name,""===n?s:n+"."+s);var n,s;return function(e){return e instanceof r.Service||e instanceof r.Type||e instanceof r.Enum}(e)?[[i,e]]:function(e){return e instanceof r.Namespace||e instanceof r.Root}(e)&&void 0!==e.nested?Object.keys(e.nested).map(t=>c(e.nested[t],i)).reduce((e,t)=>e.concat(t),[]):[]}function u(e,t){return function(i){return e.toObject(e.decode(i),t)}}function h(e){return function(t){if(Array.isArray(t))throw new Error(`Failed to serialize message: expected object with ${e.name} structure, got array instead`);const i=e.fromObject(t);return e.encode(i).finish()}}function d(e){return(e||[]).reduce((e,t)=>{for(const[i,n]of Object.entries(t))if("uninterpreted_option"===i)e.uninterpreted_option.push(t.uninterpreted_option);else e[i]=n;return e},{deprecated:!1,idempotency_level:a.IDEMPOTENCY_UNKNOWN,uninterpreted_option:[]})}function f(e,t,i,r){const s=e.resolvedRequestType,o=e.resolvedResponseType;return{path:"/"+t+"/"+e.name,requestStream:!!e.requestStream,responseStream:!!e.responseStream,requestSerialize:h(s),requestDeserialize:u(s,i),responseSerialize:h(o),responseDeserialize:u(o,i),originalName:n(e.name),requestType:p(s,i,r),responseType:p(o,i,r),options:d(e.parsedOptions)}}function p(e,t,i){const n=e.toDescriptor("proto3");return{format:"Protocol Buffer 3 DescriptorProto",type:n.$type.toObject(n,l),fileDescriptorProtos:i,serialize:h(e),deserialize:u(e,t)}}function g(e,t,i,n){if(e instanceof r.Service)return function(e,t,i,n){const r={};for(const s of e.methodsArray)r[s.name]=f(s,t,i,n);return r}(e,t,i,n);if(e instanceof r.Type)return p(e,i,n);if(e instanceof r.Enum)return function(e,t){const i=e.toDescriptor("proto3");return{format:"Protocol Buffer 3 EnumDescriptorProto",type:i.$type.toObject(i,l),fileDescriptorProtos:t}}(e,n);throw new Error("Type mismatch in reflection object handling")}function m(e,t){const i={};e.resolveAll();const n=e.toDescriptor("proto3").file.map(e=>Buffer.from(s.FileDescriptorProto.encode(e).finish()));for(const[r,s]of c(e,""))i[r]=g(s,r,t,n);return i}function v(e,t){t=t||{};const i=r.Root.fromDescriptor(e);return i.resolveAll(),m(i,t)}t.Yi=function(e,t){return m((0,o.loadProtosWithOptionsSync)(e,t),t)},(0,o.addCommonProtos)()},3197(e,t,i){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.addCommonProtos=t.loadProtosWithOptionsSync=t.loadProtosWithOptions=void 0;const n=i(9896),r=i(6928),s=i(2549);function o(e,t){const i=e.resolvePath;e.resolvePath=(e,s)=>{if(r.isAbsolute(s))return s;for(const e of t){const t=r.join(e,s);try{return n.accessSync(t,n.constants.R_OK),t}catch(e){continue}}return process.emitWarning(`${s} not found in any of the include paths ${t}`),i(e,s)}}t.loadProtosWithOptions=async function(e,t){const i=new s.Root;if((t=t||{}).includeDirs){if(!Array.isArray(t.includeDirs))return Promise.reject(new Error("The includeDirs option must be an array"));o(i,t.includeDirs)}const n=await i.load(e,t);return n.resolveAll(),n},t.loadProtosWithOptionsSync=function(e,t){const i=new s.Root;if((t=t||{}).includeDirs){if(!Array.isArray(t.includeDirs))throw new Error("The includeDirs option must be an array");o(i,t.includeDirs)}const n=i.loadSync(e,t);return n.resolveAll(),n},t.addCommonProtos=function(){const e=i(5434),t=i(3951),n=i(2939),r=i(6710);s.common("api",e.nested.google.nested.protobuf.nested),s.common("descriptor",t.nested.google.nested.protobuf.nested),s.common("source_context",n.nested.google.nested.protobuf.nested),s.common("type",r.nested.google.nested.protobuf.nested)}},6340(e,t,i){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.loadFileDescriptorSetFromObject=t.loadFileDescriptorSetFromBuffer=t.fromJSON=t.loadSync=t.load=t.IdempotencyLevel=t.isAnyExtension=t.Long=void 0;const n=i(2028),r=i(2549),s=i(5407),o=i(1238),a=i(5017);var l;t.Long=a,t.isAnyExtension=function(e){return"@type"in e&&"string"==typeof e["@type"]},function(e){e.IDEMPOTENCY_UNKNOWN="IDEMPOTENCY_UNKNOWN",e.NO_SIDE_EFFECTS="NO_SIDE_EFFECTS",e.IDEMPOTENT="IDEMPOTENT"}(l=t.IdempotencyLevel||(t.IdempotencyLevel={}));const c={longs:String,enums:String,bytes:String,defaults:!0,oneofs:!0,json:!0};function u(e,t){const i=(n=t,s=e.name,""===n?s:n+"."+s);var n,s;return function(e){return e instanceof r.Service||e instanceof r.Type||e instanceof r.Enum}(e)?[[i,e]]:function(e){return e instanceof r.Namespace||e instanceof r.Root}(e)&&void 0!==e.nested?Object.keys(e.nested).map(t=>u(e.nested[t],i)).reduce((e,t)=>e.concat(t),[]):[]}function h(e,t){return function(i){return e.toObject(e.decode(i),t)}}function d(e){return function(t){if(Array.isArray(t))throw new Error(`Failed to serialize message: expected object with ${e.name} structure, got array instead`);const i=e.fromObject(t);return e.encode(i).finish()}}function f(e){return(e||[]).reduce((e,t)=>{for(const[i,n]of Object.entries(t))if("uninterpreted_option"===i)e.uninterpreted_option.push(t.uninterpreted_option);else e[i]=n;return e},{deprecated:!1,idempotency_level:l.IDEMPOTENCY_UNKNOWN,uninterpreted_option:[]})}function p(e,t,i,r){const s=e.resolvedRequestType,o=e.resolvedResponseType;return{path:"/"+t+"/"+e.name,requestStream:!!e.requestStream,responseStream:!!e.responseStream,requestSerialize:d(s),requestDeserialize:h(s,i),responseSerialize:d(o),responseDeserialize:h(o,i),originalName:n(e.name),requestType:g(s,r),responseType:g(o,r),options:f(e.parsedOptions)}}function g(e,t){const i=e.toDescriptor("proto3");return{format:"Protocol Buffer 3 DescriptorProto",type:i.$type.toObject(i,c),fileDescriptorProtos:t}}function m(e,t,i,n){if(e instanceof r.Service)return function(e,t,i,n){const r={};for(const s of e.methodsArray)r[s.name]=p(s,t,i,n);return r}(e,t,i,n);if(e instanceof r.Type)return g(e,n);if(e instanceof r.Enum)return function(e,t){const i=e.toDescriptor("proto3");return{format:"Protocol Buffer 3 EnumDescriptorProto",type:i.$type.toObject(i,c),fileDescriptorProtos:t}}(e,n);throw new Error("Type mismatch in reflection object handling")}function v(e,t){const i={};e.resolveAll();const n=e.toDescriptor("proto3").file.map(e=>Buffer.from(s.FileDescriptorProto.encode(e).finish()));for(const[r,s]of u(e,""))i[r]=m(s,r,t,n);return i}function y(e,t){t=t||{};const i=r.Root.fromDescriptor(e);return i.resolveAll(),v(i,t)}t.load=function(e,t){return(0,o.loadProtosWithOptions)(e,t).then(e=>v(e,t))},t.loadSync=function(e,t){return v((0,o.loadProtosWithOptionsSync)(e,t),t)},t.fromJSON=function(e,t){t=t||{};const i=r.Root.fromJSON(e);return i.resolveAll(),v(i,t)},t.loadFileDescriptorSetFromBuffer=function(e,t){return y(s.FileDescriptorSet.decode(e),t)},t.loadFileDescriptorSetFromObject=function(e,t){return y(s.FileDescriptorSet.fromObject(e),t)},(0,o.addCommonProtos)()},1238(e,t,i){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.addCommonProtos=t.loadProtosWithOptionsSync=t.loadProtosWithOptions=void 0;const n=i(9896),r=i(6928),s=i(2549);function o(e,t){const i=e.resolvePath;e.resolvePath=(e,s)=>{if(r.isAbsolute(s))return s;for(const e of t){const t=r.join(e,s);try{return n.accessSync(t,n.constants.R_OK),t}catch(e){continue}}return process.emitWarning(`${s} not found in any of the include paths ${t}`),i(e,s)}}t.loadProtosWithOptions=async function(e,t){const i=new s.Root;if((t=t||{}).includeDirs){if(!Array.isArray(t.includeDirs))return Promise.reject(new Error("The includeDirs option must be an array"));o(i,t.includeDirs)}const n=await i.load(e,t);return n.resolveAll(),n},t.loadProtosWithOptionsSync=function(e,t){const i=new s.Root;if((t=t||{}).includeDirs){if(!Array.isArray(t.includeDirs))throw new Error("The includeDirs option must be an array");o(i,t.includeDirs)}const n=i.loadSync(e,t);return n.resolveAll(),n},t.addCommonProtos=function(){const e=i(5434),t=i(3951),n=i(2939),r=i(6710);s.common("api",e.nested.google.nested.protobuf.nested),s.common("descriptor",t.nested.google.nested.protobuf.nested),s.common("source_context",n.nested.google.nested.protobuf.nested),s.common("type",r.nested.google.nested.protobuf.nested)}},6787(e,t,i){"use strict";i.r(t),i.d(t,{OrderedMap:()=>d});var n=function(e,t){return n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i])},n(e,t)};function r(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function i(){this.constructor=e}n(e,t),e.prototype=null===t?Object.create(t):(i.prototype=t.prototype,new i)}"function"==typeof SuppressedError&&SuppressedError;var s=function(){function e(e,t,i){void 0===i&&(i=1),this.t=void 0,this.i=void 0,this.h=void 0,this.u=e,this.o=t,this.l=i}return e.prototype.v=function(){var e=this,t=e.h.h===e;if(t&&1===e.l)e=e.i;else if(e.t)for(e=e.t;e.i;)e=e.i;else{if(t)return e.h;for(var i=e.h;i.t===e;)i=(e=i).h;e=i}return e},e.prototype.p=function(){var e=this;if(e.i){for(e=e.i;e.t;)e=e.t;return e}for(var t=e.h;t.i===e;)t=(e=t).h;return e.i!==t?t:e},e.prototype.T=function(){var e=this.h,t=this.i,i=t.t;return e.h===this?e.h=t:e.t===this?e.t=t:e.i=t,t.h=e,t.t=this,this.h=t,this.i=i,i&&(i.h=this),t},e.prototype.I=function(){var e=this.h,t=this.t,i=t.i;return e.h===this?e.h=t:e.t===this?e.t=t:e.i=t,t.h=e,t.i=this,this.h=t,this.t=i,i&&(i.h=this),t},e}(),o=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.O=1,t}return r(t,e),t.prototype.T=function(){var t=e.prototype.T.call(this);return this.M(),t.M(),t},t.prototype.I=function(){var t=e.prototype.I.call(this);return this.M(),t.M(),t},t.prototype.M=function(){this.O=1,this.t&&(this.O+=this.t.O),this.i&&(this.O+=this.i.O)},t}(s),a=function(){function e(e){void 0===e&&(e=0),this.iteratorType=e}return e.prototype.equals=function(e){return this.C===e.C},e}(),l=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return r(t,e),t}(function(){function e(){this._=0}return Object.defineProperty(e.prototype,"length",{get:function(){return this._},enumerable:!1,configurable:!0}),e.prototype.size=function(){return this._},e.prototype.empty=function(){return 0===this._},e}());function c(){throw new RangeError("Iterator access denied!")}var u=function(e){function t(t,i){void 0===t&&(t=function(e,t){return e<t?-1:e>t?1:0}),void 0===i&&(i=!1);var n=e.call(this)||this;return n.N=void 0,n.g=t,n.enableIndex=i,n.S=i?o:s,n.A=new n.S,n}return r(t,e),t.prototype.m=function(e,t){for(var i=this.A;e;){var n=this.g(e.u,t);if(n<0)e=e.i;else{if(!(n>0))return e;i=e,e=e.t}}return i},t.prototype.B=function(e,t){for(var i=this.A;e;){this.g(e.u,t)<=0?e=e.i:(i=e,e=e.t)}return i},t.prototype.j=function(e,t){for(var i=this.A;e;){var n=this.g(e.u,t);if(n<0)i=e,e=e.i;else{if(!(n>0))return e;e=e.t}}return i},t.prototype.k=function(e,t){for(var i=this.A;e;){this.g(e.u,t)<0?(i=e,e=e.i):e=e.t}return i},t.prototype.R=function(e){for(;;){var t,i=e.h;if(i===this.A)return;if(1===e.l)return void(e.l=0);if(e===i.t)if(1===(t=i.i).l)t.l=0,i.l=1,i===this.N?this.N=i.T():i.T();else{if(t.i&&1===t.i.l)return t.l=i.l,i.l=0,t.i.l=0,void(i===this.N?this.N=i.T():i.T());t.t&&1===t.t.l?(t.l=1,t.t.l=0,t.I()):(t.l=1,e=i)}else if(1===(t=i.t).l)t.l=0,i.l=1,i===this.N?this.N=i.I():i.I();else{if(t.t&&1===t.t.l)return t.l=i.l,i.l=0,t.t.l=0,void(i===this.N?this.N=i.I():i.I());t.i&&1===t.i.l?(t.l=1,t.i.l=0,t.T()):(t.l=1,e=i)}}},t.prototype.G=function(e){if(1!==this._){for(var t=e;t.t||t.i;){if(t.i)for(t=t.i;t.t;)t=t.t;else t=t.t;var i=e.u;e.u=t.u,t.u=i;var n=e.o;e.o=t.o,t.o=n,e=t}this.A.t===t?this.A.t=t.h:this.A.i===t&&(this.A.i=t.h),this.R(t);var r=t.h;if(t===r.t?r.t=void 0:r.i=void 0,this._-=1,this.N.l=0,this.enableIndex)for(;r!==this.A;)r.O-=1,r=r.h}else this.clear()},t.prototype.P=function(e){for(var t="number"==typeof e?e:void 0,i="function"==typeof e?e:void 0,n=void 0===e?[]:void 0,r=0,s=this.N,o=[];o.length||s;)if(s)o.push(s),s=s.t;else{if(s=o.pop(),r===t)return s;n&&n.push(s),i&&i(s,r,this),r+=1,s=s.i}return n},t.prototype.q=function(e){for(;;){var t=e.h;if(0===t.l)return;var i=t.h;if(t===i.t){if((n=i.i)&&1===n.l){if(n.l=t.l=0,i===this.N)return;i.l=1,e=i;continue}if(e!==t.i)return t.l=0,i===this.N?this.N=i.I():i.I(),void(i.l=1);e.l=0,e.t&&(e.t.h=t),e.i&&(e.i.h=i),t.i=e.t,i.t=e.i,e.t=t,e.i=i,i===this.N?(this.N=e,this.A.h=e):(r=i.h).t===i?r.t=e:r.i=e,e.h=i.h,t.h=e,i.h=e,i.l=1}else{var n,r;if((n=i.t)&&1===n.l){if(n.l=t.l=0,i===this.N)return;i.l=1,e=i;continue}if(e!==t.t)return t.l=0,i===this.N?this.N=i.T():i.T(),void(i.l=1);e.l=0,e.t&&(e.t.h=i),e.i&&(e.i.h=t),i.i=e.t,t.t=e.i,e.t=i,e.i=t,i===this.N?(this.N=e,this.A.h=e):(r=i.h).t===i?r.t=e:r.i=e,e.h=i.h,t.h=e,i.h=e,i.l=1}return void(this.enableIndex&&(t.M(),i.M(),e.M()))}},t.prototype.D=function(e,t,i){if(void 0===this.N)return this._+=1,this.N=new this.S(e,t,0),this.N.h=this.A,this.A.h=this.A.t=this.A.i=this.N,this._;var n,r=this.A.t,s=this.g(r.u,e);if(0===s)return r.o=t,this._;if(s>0)r.t=new this.S(e,t),r.t.h=r,n=r.t,this.A.t=n;else{var o=this.A.i,a=this.g(o.u,e);if(0===a)return o.o=t,this._;if(a<0)o.i=new this.S(e,t),o.i.h=o,n=o.i,this.A.i=n;else{if(void 0!==i){var l=i.C;if(l!==this.A){var c=this.g(l.u,e);if(0===c)return l.o=t,this._;if(c>0){var u=l.v(),h=this.g(u.u,e);if(0===h)return u.o=t,this._;h<0&&(n=new this.S(e,t),void 0===u.i?(u.i=n,n.h=u):(l.t=n,n.h=l))}}}if(void 0===n)for(n=this.N;;){var d=this.g(n.u,e);if(d>0){if(void 0===n.t){n.t=new this.S(e,t),n.t.h=n,n=n.t;break}n=n.t}else{if(!(d<0))return n.o=t,this._;if(void 0===n.i){n.i=new this.S(e,t),n.i.h=n,n=n.i;break}n=n.i}}}}if(this.enableIndex)for(var f=n.h;f!==this.A;)f.O+=1,f=f.h;return this.q(n),this._+=1,this._},t.prototype.F=function(e,t){for(;e;){var i=this.g(e.u,t);if(i<0)e=e.i;else{if(!(i>0))return e;e=e.t}}return e||this.A},t.prototype.clear=function(){this._=0,this.N=void 0,this.A.h=void 0,this.A.t=this.A.i=void 0},t.prototype.updateKeyByIterator=function(e,t){var i=e.C;if(i===this.A&&c(),1===this._)return i.u=t,!0;var n=i.p().u;if(i===this.A.t)return this.g(n,t)>0&&(i.u=t,!0);var r=i.v().u;return i===this.A.i?this.g(r,t)<0&&(i.u=t,!0):!(this.g(r,t)>=0||this.g(n,t)<=0)&&(i.u=t,!0)},t.prototype.eraseElementByPos=function(e){if(e<0||e>this._-1)throw new RangeError;var t=this.P(e);return this.G(t),this._},t.prototype.eraseElementByKey=function(e){if(0===this._)return!1;var t=this.F(this.N,e);return t!==this.A&&(this.G(t),!0)},t.prototype.eraseElementByIterator=function(e){var t=e.C;t===this.A&&c();var i=void 0===t.i;return 0===e.iteratorType?i&&e.next():i&&void 0!==t.t||e.next(),this.G(t),e},t.prototype.getHeight=function(){if(0===this._)return 0;return function e(t){return t?Math.max(e(t.t),e(t.i))+1:0}(this.N)},t}(l),h=function(e){function t(t,i,n,r){var s=e.call(this,t,i,r)||this;return s.container=n,s}return r(t,e),Object.defineProperty(t.prototype,"pointer",{get:function(){this.C===this.A&&c();var e=this;return new Proxy([],{get:function(t,i){return"0"===i?e.C.u:"1"===i?e.C.o:(t[0]=e.C.u,t[1]=e.C.o,t[i])},set:function(t,i,n){if("1"!==i)throw new TypeError("prop must be 1");return e.C.o=n,!0}})},enumerable:!1,configurable:!0}),t.prototype.copy=function(){return new t(this.C,this.A,this.container,this.iteratorType)},t}(function(e){function t(t,i,n){var r=e.call(this,n)||this;return r.C=t,r.A=i,0===r.iteratorType?(r.pre=function(){return this.C===this.A.t&&c(),this.C=this.C.v(),this},r.next=function(){return this.C===this.A&&c(),this.C=this.C.p(),this}):(r.pre=function(){return this.C===this.A.i&&c(),this.C=this.C.p(),this},r.next=function(){return this.C===this.A&&c(),this.C=this.C.v(),this}),r}return r(t,e),Object.defineProperty(t.prototype,"index",{get:function(){var e=this.C,t=this.A.h;if(e===this.A)return t?t.O-1:0;var i=0;for(e.t&&(i+=e.t.O);e!==t;){var n=e.h;e===n.i&&(i+=1,n.t&&(i+=n.t.O)),e=n}return i},enumerable:!1,configurable:!0}),t.prototype.isAccessible=function(){return this.C!==this.A},t}(a)),d=function(e){function t(t,i,n){void 0===t&&(t=[]);var r=e.call(this,i,n)||this,s=r;return t.forEach(function(e){s.setElement(e[0],e[1])}),r}return r(t,e),t.prototype.begin=function(){return new h(this.A.t||this.A,this.A,this)},t.prototype.end=function(){return new h(this.A,this.A,this)},t.prototype.rBegin=function(){return new h(this.A.i||this.A,this.A,this,1)},t.prototype.rEnd=function(){return new h(this.A,this.A,this,1)},t.prototype.front=function(){if(0!==this._){var e=this.A.t;return[e.u,e.o]}},t.prototype.back=function(){if(0!==this._){var e=this.A.i;return[e.u,e.o]}},t.prototype.lowerBound=function(e){var t=this.m(this.N,e);return new h(t,this.A,this)},t.prototype.upperBound=function(e){var t=this.B(this.N,e);return new h(t,this.A,this)},t.prototype.reverseLowerBound=function(e){var t=this.j(this.N,e);return new h(t,this.A,this)},t.prototype.reverseUpperBound=function(e){var t=this.k(this.N,e);return new h(t,this.A,this)},t.prototype.forEach=function(e){this.P(function(t,i,n){e([t.u,t.o],i,n)})},t.prototype.setElement=function(e,t,i){return this.D(e,t,i)},t.prototype.getElementByPos=function(e){if(e<0||e>this._-1)throw new RangeError;var t=this.P(e);return[t.u,t.o]},t.prototype.find=function(e){var t=this.F(this.N,e);return new h(t,this.A,this)},t.prototype.getElementByKey=function(e){return this.F(this.N,e).o},t.prototype.union=function(e){var t=this;return e.forEach(function(e){t.setElement(e[0],e[1])}),this._},t.prototype[Symbol.iterator]=function(){var e,t,i,n;return function(e,t){var i,n,r,s,o={label:0,sent:function(){if(1&r[0])throw r[1];return r[1]},trys:[],ops:[]};return s={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(s[Symbol.iterator]=function(){return this}),s;function a(e){return function(t){return l([e,t])}}function l(a){if(i)throw new TypeError("Generator is already executing.");for(;s&&(s=0,a[0]&&(o=0)),o;)try{if(i=1,n&&(r=2&a[0]?n.return:a[0]?n.throw||((r=n.return)&&r.call(n),0):n.next)&&!(r=r.call(n,a[1])).done)return r;switch(n=0,r&&(a=[2&a[0],r.value]),a[0]){case 0:case 1:r=a;break;case 4:return o.label++,{value:a[1],done:!1};case 5:o.label++,n=a[1],a=[0];continue;case 7:a=o.ops.pop(),o.trys.pop();continue;default:if(!((r=(r=o.trys).length>0&&r[r.length-1])||6!==a[0]&&2!==a[0])){o=0;continue}if(3===a[0]&&(!r||a[1]>r[0]&&a[1]<r[3])){o.label=a[1];break}if(6===a[0]&&o.label<r[1]){o.label=r[1],r=a;break}if(r&&o.label<r[2]){o.label=r[2],o.ops.push(a);break}r[2]&&o.ops.pop(),o.trys.pop();continue}a=t.call(e,o)}catch(e){a=[6,e],n=0}finally{i=r=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}}(this,function(r){switch(r.label){case 0:e=this._,t=this.P(),i=0,r.label=1;case 1:return i<e?[4,[(n=t[i]).u,n.o]]:[3,4];case 2:r.sent(),r.label=3;case 3:return++i,[3,1];case 4:return[2]}})},t}(u)},8045(e){"use strict";e.exports=function(e,t){var i=new Array(arguments.length-1),n=0,r=2,s=!0;for(;r<arguments.length;)i[n++]=arguments[r++];return new Promise(function(r,o){i[n]=function(e){if(s)if(s=!1,e)o(e);else{for(var t=new Array(arguments.length-1),i=0;i<t.length;)t[i++]=arguments[i];r.apply(null,t)}};try{e.apply(t||null,i)}catch(e){s&&(s=!1,o(e))}})}},8839(e,t){"use strict";var i=t;i.length=function(e){var t=e.length;if(!t)return 0;for(var i=0;--t%4>1&&"="===e.charAt(t);)++i;return Math.ceil(3*e.length)/4-i};for(var n=new Array(64),r=new Array(123),s=0;s<64;)r[n[s]=s<26?s+65:s<52?s+71:s<62?s-4:s-59|43]=s++;i.encode=function(e,t,i){for(var r,s=null,o=[],a=0,l=0;t<i;){var c=e[t++];switch(l){case 0:o[a++]=n[c>>2],r=(3&c)<<4,l=1;break;case 1:o[a++]=n[r|c>>4],r=(15&c)<<2,l=2;break;case 2:o[a++]=n[r|c>>6],o[a++]=n[63&c],l=0}a>8191&&((s||(s=[])).push(String.fromCharCode.apply(String,o)),a=0)}return l&&(o[a++]=n[r],o[a++]=61,1===l&&(o[a++]=61)),s?(a&&s.push(String.fromCharCode.apply(String,o.slice(0,a))),s.join("")):String.fromCharCode.apply(String,o.slice(0,a))};var o="invalid encoding";i.decode=function(e,t,i){for(var n,s=i,a=0,l=0;l<e.length;){var c=e.charCodeAt(l++);if(61===c&&a>1)break;if(void 0===(c=r[c]))throw Error(o);switch(a){case 0:n=c,a=1;break;case 1:t[i++]=n<<2|(48&c)>>4,n=c,a=2;break;case 2:t[i++]=(15&n)<<4|(60&c)>>2,n=c,a=3;break;case 3:t[i++]=(3&n)<<6|c,a=0}}if(1===a)throw Error(o);return i-s},i.test=function(e){return/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/.test(e)}},8561(e){"use strict";function t(e,i){"string"==typeof e&&(i=e,e=void 0);var n=[];function r(e){if("string"!=typeof e){var i=s();if(t.verbose&&console.log("codegen: "+i),i="return "+i,e){for(var o=Object.keys(e),a=new Array(o.length+1),l=new Array(o.length),c=0;c<o.length;)a[c]=o[c],l[c]=e[o[c++]];return a[c]=i,Function.apply(null,a).apply(null,l)}return Function(i)()}for(var u=new Array(arguments.length-1),h=0;h<u.length;)u[h]=arguments[++h];if(h=0,e=e.replace(/%([%dfijs])/g,function(e,t){var i=u[h++];switch(t){case"d":case"f":return String(Number(i));case"i":return String(Math.floor(i));case"j":return JSON.stringify(i);case"s":return String(i)}return"%"}),h!==u.length)throw Error("parameter count mismatch");return n.push(e),r}function s(t){return"function "+(t||i||"")+"("+(e&&e.join(",")||"")+"){\n "+n.join("\n ")+"\n}"}return r.toString=s,r}e.exports=t,t.verbose=!1},4358(e){"use strict";function t(){this._listeners={}}e.exports=t,t.prototype.on=function(e,t,i){return(this._listeners[e]||(this._listeners[e]=[])).push({fn:t,ctx:i||this}),this},t.prototype.off=function(e,t){if(void 0===e)this._listeners={};else if(void 0===t)this._listeners[e]=[];else for(var i=this._listeners[e],n=0;n<i.length;)i[n].fn===t?i.splice(n,1):++n;return this},t.prototype.emit=function(e){var t=this._listeners[e];if(t){for(var i=[],n=1;n<arguments.length;)i.push(arguments[n++]);for(n=0;n<t.length;)t[n].fn.apply(t[n++].ctx,i)}return this}},5212(e,t,i){"use strict";e.exports=s;var n=i(8045),r=i(4153)("fs");function s(e,t,i){return"function"==typeof t?(i=t,t={}):t||(t={}),i?!t.xhr&&r&&r.readFile?r.readFile(e,function(n,r){return n&&"undefined"!=typeof XMLHttpRequest?s.xhr(e,t,i):n?i(n):i(null,t.binary?r:r.toString("utf8"))}):s.xhr(e,t,i):n(s,this,e,t)}s.xhr=function(e,t,i){var n=new XMLHttpRequest;n.onreadystatechange=function(){if(4===n.readyState){if(0!==n.status&&200!==n.status)return i(Error("status "+n.status));if(t.binary){var e=n.response;if(!e){e=[];for(var r=0;r<n.responseText.length;++r)e.push(255&n.responseText.charCodeAt(r))}return i(null,"undefined"!=typeof Uint8Array?new Uint8Array(e):e)}return i(null,n.responseText)}},t.binary&&("overrideMimeType"in n&&n.overrideMimeType("text/plain; charset=x-user-defined"),n.responseType="arraybuffer"),n.open("GET",e),n.send()}},9410(e){"use strict";function t(e){return"undefined"!=typeof Float32Array?function(){var t=new Float32Array([-0]),i=new Uint8Array(t.buffer),n=128===i[3];function r(e,n,r){t[0]=e,n[r]=i[0],n[r+1]=i[1],n[r+2]=i[2],n[r+3]=i[3]}function s(e,n,r){t[0]=e,n[r]=i[3],n[r+1]=i[2],n[r+2]=i[1],n[r+3]=i[0]}function o(e,n){return i[0]=e[n],i[1]=e[n+1],i[2]=e[n+2],i[3]=e[n+3],t[0]}function a(e,n){return i[3]=e[n],i[2]=e[n+1],i[1]=e[n+2],i[0]=e[n+3],t[0]}e.writeFloatLE=n?r:s,e.writeFloatBE=n?s:r,e.readFloatLE=n?o:a,e.readFloatBE=n?a:o}():function(){function t(e,t,i,n){var r=t<0?1:0;if(r&&(t=-t),0===t)e(1/t>0?0:2147483648,i,n);else if(isNaN(t))e(2143289344,i,n);else if(t>34028234663852886e22)e((r<<31|2139095040)>>>0,i,n);else if(t<11754943508222875e-54)e((r<<31|Math.round(t/1401298464324817e-60))>>>0,i,n);else{var s=Math.floor(Math.log(t)/Math.LN2);e((r<<31|s+127<<23|8388607&Math.round(t*Math.pow(2,-s)*8388608))>>>0,i,n)}}function o(e,t,i){var n=e(t,i),r=2*(n>>31)+1,s=n>>>23&255,o=8388607&n;return 255===s?o?NaN:r*(1/0):0===s?1401298464324817e-60*r*o:r*Math.pow(2,s-150)*(o+8388608)}e.writeFloatLE=t.bind(null,i),e.writeFloatBE=t.bind(null,n),e.readFloatLE=o.bind(null,r),e.readFloatBE=o.bind(null,s)}(),"undefined"!=typeof Float64Array?function(){var t=new Float64Array([-0]),i=new Uint8Array(t.buffer),n=128===i[7];function r(e,n,r){t[0]=e,n[r]=i[0],n[r+1]=i[1],n[r+2]=i[2],n[r+3]=i[3],n[r+4]=i[4],n[r+5]=i[5],n[r+6]=i[6],n[r+7]=i[7]}function s(e,n,r){t[0]=e,n[r]=i[7],n[r+1]=i[6],n[r+2]=i[5],n[r+3]=i[4],n[r+4]=i[3],n[r+5]=i[2],n[r+6]=i[1],n[r+7]=i[0]}function o(e,n){return i[0]=e[n],i[1]=e[n+1],i[2]=e[n+2],i[3]=e[n+3],i[4]=e[n+4],i[5]=e[n+5],i[6]=e[n+6],i[7]=e[n+7],t[0]}function a(e,n){return i[7]=e[n],i[6]=e[n+1],i[5]=e[n+2],i[4]=e[n+3],i[3]=e[n+4],i[2]=e[n+5],i[1]=e[n+6],i[0]=e[n+7],t[0]}e.writeDoubleLE=n?r:s,e.writeDoubleBE=n?s:r,e.readDoubleLE=n?o:a,e.readDoubleBE=n?a:o}():function(){function t(e,t,i,n,r,s){var o=n<0?1:0;if(o&&(n=-n),0===n)e(0,r,s+t),e(1/n>0?0:2147483648,r,s+i);else if(isNaN(n))e(0,r,s+t),e(2146959360,r,s+i);else if(n>17976931348623157e292)e(0,r,s+t),e((o<<31|2146435072)>>>0,r,s+i);else{var a;if(n<22250738585072014e-324)e((a=n/5e-324)>>>0,r,s+t),e((o<<31|a/4294967296)>>>0,r,s+i);else{var l=Math.floor(Math.log(n)/Math.LN2);1024===l&&(l=1023),e(4503599627370496*(a=n*Math.pow(2,-l))>>>0,r,s+t),e((o<<31|l+1023<<20|1048576*a&1048575)>>>0,r,s+i)}}}function o(e,t,i,n,r){var s=e(n,r+t),o=e(n,r+i),a=2*(o>>31)+1,l=o>>>20&2047,c=4294967296*(1048575&o)+s;return 2047===l?c?NaN:a*(1/0):0===l?5e-324*a*c:a*Math.pow(2,l-1075)*(c+4503599627370496)}e.writeDoubleLE=t.bind(null,i,0,4),e.writeDoubleBE=t.bind(null,n,4,0),e.readDoubleLE=o.bind(null,r,0,4),e.readDoubleBE=o.bind(null,s,4,0)}(),e}function i(e,t,i){t[i]=255&e,t[i+1]=e>>>8&255,t[i+2]=e>>>16&255,t[i+3]=e>>>24}function n(e,t,i){t[i]=e>>>24,t[i+1]=e>>>16&255,t[i+2]=e>>>8&255,t[i+3]=255&e}function r(e,t){return(e[t]|e[t+1]<<8|e[t+2]<<16|e[t+3]<<24)>>>0}function s(e,t){return(e[t]<<24|e[t+1]<<16|e[t+2]<<8|e[t+3])>>>0}e.exports=t(t)},4153(module){"use strict";function inquire(moduleName){try{var mod=eval("quire".replace(/^/,"re"))(moduleName);if(mod&&(mod.length||Object.keys(mod).length))return mod}catch(e){}return null}module.exports=inquire},9207(e,t){"use strict";var i=t,n=i.isAbsolute=function(e){return/^(?:\/|\w+:)/.test(e)},r=i.normalize=function(e){var t=(e=e.replace(/\\/g,"/").replace(/\/{2,}/g,"/")).split("/"),i=n(e),r="";i&&(r=t.shift()+"/");for(var s=0;s<t.length;)".."===t[s]?s>0&&".."!==t[s-1]?t.splice(--s,2):i?t.splice(s,1):++s:"."===t[s]?t.splice(s,1):++s;return r+t.join("/")};i.resolve=function(e,t,i){return i||(t=r(t)),n(t)?t:(i||(e=r(e)),(e=e.replace(/(?:\/|^)[^/]+$/,"")).length?r(e+"/"+t):t)}},9390(e){"use strict";e.exports=function(e,t,i){var n=i||8192,r=n>>>1,s=null,o=n;return function(i){if(i<1||i>r)return e(i);o+i>n&&(s=e(n),o=0);var a=t.call(s,o,o+=i);return 7&o&&(o=1+(7|o)),a}}},1447(e,t){"use strict";var i=t;i.length=function(e){for(var t=0,i=0,n=0;n<e.length;++n)(i=e.charCodeAt(n))<128?t+=1:i<2048?t+=2:55296==(64512&i)&&56320==(64512&e.charCodeAt(n+1))?(++n,t+=4):t+=3;return t},i.read=function(e,t,i){if(i-t<1)return"";for(var n,r=null,s=[],o=0;t<i;)(n=e[t++])<128?s[o++]=n:n>191&&n<224?s[o++]=(31&n)<<6|63&e[t++]:n>239&&n<365?(n=((7&n)<<18|(63&e[t++])<<12|(63&e[t++])<<6|63&e[t++])-65536,s[o++]=55296+(n>>10),s[o++]=56320+(1023&n)):s[o++]=(15&n)<<12|(63&e[t++])<<6|63&e[t++],o>8191&&((r||(r=[])).push(String.fromCharCode.apply(String,s)),o=0);return r?(o&&r.push(String.fromCharCode.apply(String,s.slice(0,o))),r.join("")):String.fromCharCode.apply(String,s.slice(0,o))},i.write=function(e,t,i){for(var n,r,s=i,o=0;o<e.length;++o)(n=e.charCodeAt(o))<128?t[i++]=n:n<2048?(t[i++]=n>>6|192,t[i++]=63&n|128):55296==(64512&n)&&56320==(64512&(r=e.charCodeAt(o+1)))?(n=65536+((1023&n)<<10)+(1023&r),++o,t[i++]=n>>18|240,t[i++]=n>>12&63|128,t[i++]=n>>6&63|128,t[i++]=63&n|128):(t[i++]=n>>12|224,t[i++]=n>>6&63|128,t[i++]=63&n|128);return i-s}},8591(e,t,i){var n=i(5692),r=i(8611),s=i(7016),o=i(3294),a=(e.exports.maxRedirects=5,{https:n,http:r});for(var l in a){var c=function(){};c.prototype=a[l],(c=new c).request=function(i){return function(n,r,a){a=a||{};var c,u="object"==typeof n&&"maxRedirects"in n?n.maxRedirects:t.maxRedirects,h=o.extend({count:0,max:u,clientRequest:null,userCallback:r},a);if(h.count>h.max){var d=new Error("Max redirects exceeded. To allow more redirects, pass options.maxRedirects property.");return h.clientRequest.emit("error",d),h.clientRequest}h.count++,c="string"==typeof n?n:s.format(o.extend({protocol:l},n));var f=Object.getPrototypeOf(i).request(n,function t(i,n){return function(r){if(r.statusCode<300||r.statusCode>399)return n.userCallback(r);if(!("location"in r.headers))return n.userCallback(r);var o=s.resolve(i,r.headers.location),a=s.parse(o).protocol;return a=a.substr(0,a.length-1),e.exports[a].get(o,t(i,n),n)}}(c,h));return h.clientRequest||(h.clientRequest=f),f}}(c),c.get=function(e){return function(t,i,n){var r=e.request(t,i,n);return r.end(),r}}(c),e.exports[l]=c}},8280(e,t,i){e.exports=s;var n=i(9023),r=i(4198);function s(e,t,i){var n=this;if(!(n instanceof s))return new s(e,t,i);r.Duplex.call(n,i),n._output=null,n.connect(e,t)}n.inherits(s,r.Duplex),s.prototype.connect=function(e,t){var i=this;i.req=e,i._output=t,i.emit("response",t),t.on("data",function(e){i.push(e)||i._output.pause()}),t.on("end",function(){i.push(null)})},s.prototype._read=function(e){this._output&&this._output.resume()},s.prototype._write=function(e,t,i){this.req.write(e,t),i()},s.prototype.end=function(e,t,i){return this._output.socket.destroySoon(),this.req.end(e,t,i)},s.prototype.destroy=function(){this.req.destroy(),this._output.socket.destroy()},s.prototype.destroySoon=function(){this.req.destroy(),this._output.socket.destroy()}},7469(e,t,i){var n=i(3480),r=i(8591),s=i(9896),o=i(6928),a=i(7016),l=i(8397),c=i(8280),u=i(3294),h=(i(9023),i(4546)),d=i(857),f="Windows_NT"===d.type(),p=i(2203),g=function(){return new Promise(function(e){var t=o.join(d.homedir(),".docker","run","docker.sock");s.access(t,function(i){e(i?"/var/run/docker.sock":t)})})},m=function(e){var t=function(){var e,t={};if(process.env.DOCKER_HOST)if(0===process.env.DOCKER_HOST.indexOf("unix://"))t.socketPath=process.env.DOCKER_HOST.substring(7)||g;else if(0===process.env.DOCKER_HOST.indexOf("npipe://"))t.socketPath=process.env.DOCKER_HOST.substring(8)||"//./pipe/docker_engine";else{var i=process.env.DOCKER_HOST;i.indexOf("//")<0&&(i="tcp://"+i);try{e=new a.URL(i)}catch(e){throw new Error("DOCKER_HOST env variable should be something like tcp://localhost:1234")}t.port=e.port,"1"===process.env.DOCKER_TLS_VERIFY||"2376"===t.port?t.protocol="https":"ssh:"===e.protocol?(t.protocol="ssh",t.username=e.username,t.sshOptions={agent:process.env.SSH_AUTH_SOCK}):t.protocol="http",process.env.DOCKER_PATH_PREFIX?t.pathPrefix=process.env.DOCKER_PATH_PREFIX:t.pathPrefix="/",t.host=e.hostname,process.env.DOCKER_CERT_PATH&&(t.ca=h(o.join(process.env.DOCKER_CERT_PATH,"ca.pem")),t.cert=s.readFileSync(o.join(process.env.DOCKER_CERT_PATH,"cert.pem")),t.key=s.readFileSync(o.join(process.env.DOCKER_CERT_PATH,"key.pem"))),process.env.DOCKER_CLIENT_TIMEOUT&&(t.timeout=parseInt(process.env.DOCKER_CLIENT_TIMEOUT,10))}else t.socketPath=f?"//./pipe/docker_engine":g;return t}(),i=Object.assign({},t,e);this.host=i.host,this.host||(this.socketPath=i.socketPath),this.port=i.port,this.pathPrefix=i.pathPrefix,this.username=i.username,this.password=i.password,this.version=i.version,this.key=i.key,this.cert=i.cert,this.ca=i.ca,this.timeout=i.timeout,this.connectionTimeout=i.connectionTimeout,this.checkServerIdentity=i.checkServerIdentity,this.agent=i.agent,this.headers=i.headers||{},this.sshOptions=Object.assign({},e?e.sshOptions:{},t.sshOptions),void 0===this.sshOptions.agentForward&&(this.sshOptions.agentForward=i.agentForward),this.key&&this.cert&&this.ca&&(this.protocol="https"),this.protocol=i.protocol||this.protocol||"http"};m.prototype.dial=function(e,t){var i,n,r;if(e.options&&(i=e.options),i&&i.authconfig&&delete i.authconfig,i&&i.abortSignal&&delete i.abortSignal,this.version&&(e.path="/"+this.version+e.path),this.host){var l=a.parse(this.host);n=a.format({protocol:l.protocol||this.protocol,hostname:l.hostname||this.host,port:this.port,pathname:l.pathname||this.pathPrefix}),n=a.resolve(n,e.path)}else n=e.path;-1!==e.path.indexOf("?")&&(i&&Object.keys(i).length>0?n+=this.buildQuerystring(i._query||i):n=n.substring(0,n.length-1));var c={path:n,method:e.method,headers:e.headers||Object.assign({},this.headers),key:this.key,cert:this.cert,ca:this.ca};if(this.checkServerIdentity&&(c.checkServerIdentity=this.checkServerIdentity),this.agent&&(c.agent=this.agent),e.authconfig&&(c.headers["X-Registry-Auth"]=e.authconfig.key||e.authconfig.base64||Buffer.from(JSON.stringify(e.authconfig)).toString("base64").replace(/\+/g,"-").replace(/\//g,"_")),e.registryconfig&&(c.headers["X-Registry-Config"]=e.registryconfig.base64||Buffer.from(JSON.stringify(e.registryconfig)).toString("base64")),e.abortSignal&&(c.signal=e.abortSignal),e.file?(r="string"==typeof e.file?s.createReadStream(o.resolve(e.file)):e.file,c.headers["Content-Type"]="application/tar"):i&&"POST"===e.method&&(r=JSON.stringify(i._body||i),e.allowEmpty||"{}"!==r&&'""'!==r?c.headers["Content-Type"]="application/json":r=void 0),"string"==typeof r?c.headers["Content-Length"]=Buffer.byteLength(r):!0===Buffer.isBuffer(r)?c.headers["Content-Length"]=r.length:("PUT"===c.method||e.hijack||e.openStdin)&&(c.headers["Transfer-Encoding"]="chunked"),e.hijack&&(c.headers.Connection="Upgrade",c.headers.Upgrade=c.headers.Upgrade??"tcp"),this.socketPath)this.getSocketPath().then(i=>{c.socketPath=i,this.buildRequest(c,e,r,t)});else{var u=a.parse(n);c.hostname=u.hostname,c.port=u.port,c.path=u.path,this.buildRequest(c,e,r,t)}},m.prototype.getSocketPath=function(){if(this.socketPath){if(this.socketPathCache)return Promise.resolve(this.socketPathCache);var e="function"==typeof this.socketPath?this.socketPath():this.socketPath;return this.socketPathCache=e,Promise.resolve(e)}},m.prototype.buildRequest=function(e,t,i,n){var s,o=this,a=!1,c="ssh"===o.protocol?Object.assign(e,{agent:l(Object.assign({},o.sshOptions,{host:o.host,port:o.port,username:o.username,password:o.password})),protocol:"http:"}):e,h=null;try{h=r["ssh"===o.protocol?"http":o.protocol].request(c,function(){})}catch(e){return void n(e)}o.connectionTimeout&&(s=setTimeout(function(){h.destroy()},o.connectionTimeout)),o.timeout&&(h.setTimeout(o.timeout),h.on("timeout",function(){h.destroy()})),!0===t.hijack&&(clearTimeout(s),h.on("upgrade",function(e,t,i){if(!1===a)return a=!0,i.length>0&&t.unshift(i),n(null,t)})),h.on("connect",function(){clearTimeout(s)}),h.on("disconnect",function(){clearTimeout(s)}),h.on("response",function(i){if(clearTimeout(s),!0===t.isStream)!1===a&&(a=!0,o.buildPayload(null,t.isStream,t.statusCodes,t.openStdin,h,i,null,n));else{null!=e.signal&&p.addAbortSignal(e.signal,i);var r=[];i.on("data",function(e){r.push(e)}),i.on("end",function(){var e=Buffer.concat(r),s=e.toString(),l=u.parseJSON(s)||e;!1===a&&(a=!0,o.buildPayload(null,t.isStream,t.statusCodes,!1,h,i,l,n))})}}),h.on("error",function(e){clearTimeout(s),!1===a&&(a=!0,o.buildPayload(e,t.isStream,t.statusCodes,!1,{},{},null,n))}),"string"==typeof i||Buffer.isBuffer(i)?h.write(i):i&&(i.on("error",function(e){h.destroy(e)}),i.pipe(h)),t.openStdin||"string"!=typeof i&&void 0!==i&&!Buffer.isBuffer(i)||h.end()},m.prototype.buildPayload=function(e,t,i,n,r,s,o,a){if(e)return a(e,null);!0!==i[s.statusCode]?function(e,t,i,n){var r="",s=!1;e?(t.on("data",function(e){r+=e}),t.on("error",function(e){o(e,null)}),t.on("end",function(){o(null,u.parseJSON(r)||r)})):n(null,i);function o(e,t){!1===s&&(e?n(e):n(null,t)),s=!0}}(t,s,o,function(e,t){if(e)return a(e,null);var n=new Error("(HTTP code "+s.statusCode+") "+(i[s.statusCode]||"unexpected")+" - "+(t.message||t.error||t)+" ");n.reason=i[s.statusCode],n.statusCode=s.statusCode,n.json=o,a(n,null)}):a(null,n?new c(r,s):t?s:o)},m.prototype.demuxStream=function(e,t,i){var n=null,r=null,s=Buffer.from("");function o(e){var t=s.subarray(0,e);return s=Buffer.from(s.subarray(e,s.length)),t}e.on("data",function e(a){if(a&&(s=Buffer.concat([s,a])),n){if(s.length>=r){var l=o(r);1===n?t.write(l):i.write(l),n=null,e()}}else if(s.length>=8){var c=o(8);n=c.readUInt8(0),r=c.readUInt32BE(4),e()}})},m.prototype.followProgress=function(e,t,i){var n="",r=[],s=!1;function o(e){function t(e){if("\r"==e[e.length-1]&&(e=e.substr(0,e.length-1)),e.length>0){var t=JSON.parse(e);r.push(t),i&&i(t)}}n+=e.toString(),function(){var e;for(;(e=n.indexOf("\n"))>=0;)0!=e?(t(n.slice(0,e)),n=n.slice(e+1)):n=n.slice(1)}()}function a(){s||t(null,r),s=!0}e.on("data",o),e.on("error",function i(n){s=!0,e.removeListener("data",o),e.removeListener("error",i),e.removeListener("end",a),e.removeListener("close",a),t(n,r)}),e.on("end",a),e.on("close",a)},m.prototype.buildQuerystring=function(e){var t={};return Object.keys(e).map(function(i,n){e[i]&&"object"==typeof e[i]&&!Array.isArray(e[i])?t[i]=JSON.stringify(e[i]):t[i]=e[i]}),n.stringify(t)},e.exports=m},8397(e,t,i){var n=i(1217).Client,r=i(8611);e.exports=function(e){var t=new n,i=new r.Agent;function s(e,n){if(t.end(),i.destroy(),!n)throw e;n(e)}return i.createConnection=function(n,r){try{t.once("ready",function(){t.exec("docker system dial-stdio",function(e,n){e&&s(e,r),r(null,n),n.addListener("error",e=>{s(e,r)}),n.once("close",()=>{t.end(),i.destroy()})})}).on("error",e=>{s(e,r)}).connect(e),t.once("end",()=>i.destroy())}catch(e){s(e)}},i}},3294(e){var t=[],i=t.forEach,n=t.slice;e.exports.extend=function(e){return i.call(n.call(arguments,1),function(t){if(t)for(var i in t)e[i]=t[i]}),e},e.exports.parseJSON=function(e){try{return JSON.parse(e)}catch(e){return null}}},6474(e,t,i){var n=i(7052),r=function(e,t){this.modem=e,this.id=t};r.prototype[i(9023).inspect.custom]=function(){return this},r.prototype.inspect=function(e,t){var i=this,r=n.processArgs(e,t),s={path:"/configs/"+this.id,method:"GET",abortSignal:r.opts.abortSignal,statusCodes:{200:!0,404:"config not found",500:"server error",503:"node is not part of a swarm"}};if(void 0===r.callback)return new this.modem.Promise(function(e,t){i.modem.dial(s,function(i,n){if(i)return t(i);e(n)})});this.modem.dial(s,function(e,t){r.callback(e,t)})},r.prototype.update=function(e,t){var i=this,r=n.processArgs(e,t),s={path:"/configs/"+this.id+"/update?",method:"POST",abortSignal:r.opts.abortSignal,statusCodes:{200:!0,404:"config not found",500:"server error",503:"node is not part of a swarm"},options:r.opts};if(void 0===r.callback)return new this.modem.Promise(function(e,t){i.modem.dial(s,function(i,n){if(i)return t(i);e(n)})});this.modem.dial(s,function(e,t){r.callback(e,t)})},r.prototype.remove=function(e,t){var i=this,r=n.processArgs(e,t),s={path:"/configs/"+this.id,method:"DELETE",abortSignal:r.opts.abortSignal,statusCodes:{200:!0,204:!0,404:"config not found",500:"server error",503:"node is not part of a swarm"},options:r.opts};if(void 0===r.callback)return new this.modem.Promise(function(e,t){i.modem.dial(s,function(i,n){if(i)return t(i);e(n)})});this.modem.dial(s,function(e,t){r.callback(e,t)})},e.exports=r},4985(e,t,i){i(7052).extend;var n=i(6033),r=i(7052),s=function(e,t){this.modem=e,this.id=t,this.defaultOptions={top:{},start:{},commit:{},stop:{},pause:{},unpause:{},restart:{},resize:{},attach:{},remove:{},copy:{},kill:{},exec:{},rename:{},log:{},stats:{},getArchive:{},infoArchive:{},putArchive:{},update:{},wait:{}}};s.prototype[i(9023).inspect.custom]=function(){return this},s.prototype.inspect=function(e,t){var i=this,n=r.processArgs(e,t),s={path:"/containers/"+this.id+"/json?",method:"GET",options:n.opts,abortSignal:n.opts.abortSignal,statusCodes:{200:!0,404:"no such container",500:"server error"}};if(void 0===n.callback)return new this.modem.Promise(function(e,t){i.modem.dial(s,function(i,n){if(i)return t(i);e(n)})});this.modem.dial(s,function(e,t){n.callback(e,t)})},s.prototype.rename=function(e,t){var i=this,n=r.processArgs(e,t,this.defaultOptions.rename),s={path:"/containers/"+this.id+"/rename?",method:"POST",abortSignal:n.opts.abortSignal,statusCodes:{200:!0,204:!0,404:"no such container",500:"server error"},options:n.opts};if(void 0===n.callback)return new this.modem.Promise(function(e,t){i.modem.dial(s,function(i,n){if(i)return t(i);e(n)})});this.modem.dial(s,function(e,t){n.callback(e,t)})},s.prototype.update=function(e,t){var i=this,n=r.processArgs(e,t,this.defaultOptions.update),s={path:"/containers/"+this.id+"/update",method:"POST",abortSignal:n.opts.abortSignal,statusCodes:{200:!0,204:!0,400:"bad parameter",404:"no such container",500:"server error"},options:n.opts};if(void 0===n.callback)return new this.modem.Promise(function(e,t){i.modem.dial(s,function(i,n){if(i)return t(i);e(n)})});this.modem.dial(s,function(e,t){n.callback(e,t)})},s.prototype.top=function(e,t){var i=this,n=r.processArgs(e,t,this.defaultOptions.top),s={path:"/containers/"+this.id+"/top?",method:"GET",abortSignal:n.opts.abortSignal,statusCodes:{200:!0,404:"no such container",500:"server error"},options:n.opts};if(void 0===n.callback)return new this.modem.Promise(function(e,t){i.modem.dial(s,function(i,n){if(i)return t(i);e(n)})});this.modem.dial(s,function(e,t){n.callback(e,t)})},s.prototype.changes=function(e,t){var i=this,n=r.processArgs(e,t),s={path:"/containers/"+this.id+"/changes",method:"GET",abortSignal:n.opts.abortSignal,statusCodes:{200:!0,404:"no such container",500:"server error"}};if(void 0===n.callback)return new this.modem.Promise(function(e,t){i.modem.dial(s,function(i,n){if(i)return t(i);e(n)})});this.modem.dial(s,function(e,t){n.callback(e,t)})},s.prototype.listCheckpoint=function(e,t){var i=this,n=r.processArgs(e,t),s={path:"/containers/"+this.id+"/checkpoints?",method:"GET",abortSignal:n.opts.abortSignal,statusCodes:{200:!0,404:"no such container",500:"server error"},options:n.opts};if(void 0===n.callback)return new this.modem.Promise(function(e,t){i.modem.dial(s,function(i,n){if(i)return t(i);e(n)})});this.modem.dial(s,function(e,t){n.callback(e,t)})},s.prototype.deleteCheckpoint=function(e,t,i){var n=this,s=r.processArgs(t,i),o={path:"/containers/"+this.id+"/checkpoints/"+e+"?",method:"DELETE",abortSignal:s.opts.abortSignal,statusCodes:{200:!0,204:!0,404:"no such container",500:"server error"},options:s.opts};if(void 0===s.callback)return new this.modem.Promise(function(e,t){n.modem.dial(o,function(i,n){if(i)return t(i);e(n)})});this.modem.dial(o,function(e,t){s.callback(e,t)})},s.prototype.createCheckpoint=function(e,t){var i=this,n=r.processArgs(e,t),s={path:"/containers/"+this.id+"/checkpoints",method:"POST",abortSignal:n.opts.abortSignal,allowEmpty:!0,statusCodes:{200:!0,201:!0,204:!0,404:"no such container",500:"server error"},options:n.opts};if(void 0===n.callback)return new this.modem.Promise(function(e,t){i.modem.dial(s,function(i,n){if(i)return t(i);e(n)})});this.modem.dial(s,function(e,t){n.callback(e,t)})},s.prototype.export=function(e,t){var i=this,n=r.processArgs(e,t),s={path:"/containers/"+this.id+"/export",method:"GET",abortSignal:n.opts.abortSignal,isStream:!0,statusCodes:{200:!0,404:"no such container",500:"server error"}};if(void 0===n.callback)return new this.modem.Promise(function(e,t){i.modem.dial(s,function(i,n){if(i)return t(i);e(n)})});this.modem.dial(s,function(e,t){n.callback(e,t)})},s.prototype.start=function(e,t){var i=this,n=r.processArgs(e,t,this.defaultOptions.start),s={path:"/containers/"+this.id+"/start?",method:"POST",abortSignal:n.opts.abortSignal,statusCodes:{200:!0,204:!0,304:"container already started",404:"no such container",500:"server error"},options:n.opts};if(void 0===n.callback)return new this.modem.Promise(function(e,t){i.modem.dial(s,function(i,n){if(i)return t(i);e(n)})});this.modem.dial(s,function(e,t){n.callback(e,t)})},s.prototype.pause=function(e,t){var i=this,n=r.processArgs(e,t,this.defaultOptions.pause),s={path:"/containers/"+this.id+"/pause",method:"POST",abortSignal:n.opts.abortSignal,statusCodes:{200:!0,204:!0,500:"server error"},options:n.opts};if(void 0===n.callback)return new this.modem.Promise(function(e,t){i.modem.dial(s,function(i,n){if(i)return t(i);e(n)})});this.modem.dial(s,function(e,t){n.callback(e,t)})},s.prototype.unpause=function(e,t){var i=this,n=r.processArgs(e,t,this.defaultOptions.unpause),s={path:"/containers/"+this.id+"/unpause",method:"POST",abortSignal:n.opts.abortSignal,statusCodes:{200:!0,204:!0,404:"no such container",500:"server error"},options:n.opts};if(void 0===n.callback)return new this.modem.Promise(function(e,t){i.modem.dial(s,function(i,n){if(i)return t(i);e(n)})});this.modem.dial(s,function(e,t){n.callback(e,t)})},s.prototype.exec=function(e,t){var i=this,s=r.processArgs(e,t,this.defaultOptions.exec),o={path:"/containers/"+this.id+"/exec",method:"POST",abortSignal:s.opts.abortSignal,statusCodes:{200:!0,201:!0,404:"no such container",409:"container stopped/paused",500:"server error"},options:s.opts};if(void 0===s.callback)return new this.modem.Promise(function(e,t){i.modem.dial(o,function(r,s){if(r)return t(r);e(new n(i.modem,s.Id))})});this.modem.dial(o,function(e,t){if(e)return s.callback(e,t);s.callback(e,new n(i.modem,t.Id))})},s.prototype.commit=function(e,t){var i=this,n=r.processArgs(e,t,this.defaultOptions.commit);n.opts.container=this.id;var s={path:"/commit?",method:"POST",abortSignal:n.opts.abortSignal,statusCodes:{200:!0,201:!0,404:"no such container",500:"server error"},options:n.opts};if(void 0===n.callback)return new this.modem.Promise(function(e,t){i.modem.dial(s,function(i,n){if(i)return t(i);e(n)})});this.modem.dial(s,function(e,t){n.callback(e,t)})},s.prototype.stop=function(e,t){var i=this,n=r.processArgs(e,t,this.defaultOptions.stop),s={path:"/containers/"+this.id+"/stop?",method:"POST",abortSignal:n.opts.abortSignal,statusCodes:{200:!0,204:!0,304:"container already stopped",404:"no such container",500:"server error"},options:n.opts};if(void 0===n.callback)return new this.modem.Promise(function(e,t){i.modem.dial(s,function(i,n){if(i)return t(i);e(n)})});this.modem.dial(s,function(e,t){n.callback(e,t)})},s.prototype.restart=function(e,t){var i=this,n=r.processArgs(e,t,this.defaultOptions.restart),s={path:"/containers/"+this.id+"/restart?",method:"POST",abortSignal:n.opts.abortSignal,statusCodes:{200:!0,204:!0,404:"no such container",500:"server error"},options:n.opts};if(void 0===n.callback)return new this.modem.Promise(function(e,t){i.modem.dial(s,function(i,n){if(i)return t(i);e(n)})});this.modem.dial(s,function(e,t){n.callback(e,t)})},s.prototype.kill=function(e,t){var i=this,n=r.processArgs(e,t,this.defaultOptions.kill),s={path:"/containers/"+this.id+"/kill?",method:"POST",abortSignal:n.opts.abortSignal,statusCodes:{200:!0,204:!0,404:"no such container",500:"server error"},options:n.opts};if(void 0===n.callback)return new this.modem.Promise(function(e,t){i.modem.dial(s,function(i,n){if(i)return t(i);e(n)})});this.modem.dial(s,function(e,t){n.callback(e,t)})},s.prototype.resize=function(e,t){var i=this,n=r.processArgs(e,t,this.defaultOptions.resize),s={path:"/containers/"+this.id+"/resize?",method:"POST",abortSignal:n.opts.abortSignal,statusCodes:{200:!0,400:"bad parameter",404:"no such container",500:"server error"},options:n.opts};if(void 0===n.callback)return new this.modem.Promise(function(e,t){i.modem.dial(s,function(i,n){if(i)return t(i);e(n)})});this.modem.dial(s,function(e,t){n.callback(e,t)})},s.prototype.attach=function(e,t){var i=this,n=r.processArgs(e,t,this.defaultOptions.attach),s={path:"/containers/"+this.id+"/attach?",method:"POST",abortSignal:n.opts.abortSignal,isStream:!0,hijack:n.opts.hijack,openStdin:n.opts.stdin,statusCodes:{200:!0,404:"no such container",500:"server error"},options:n.opts};if(void 0===n.callback)return new this.modem.Promise(function(e,t){i.modem.dial(s,function(i,n){if(i)return t(i);e(n)})});this.modem.dial(s,function(e,t){n.callback(e,t)})},s.prototype.wait=function(e,t){var i=this,n=r.processArgs(e,t,this.defaultOptions.wait),s={path:"/containers/"+this.id+"/wait?",method:"POST",abortSignal:n.opts.abortSignal,statusCodes:{200:!0,400:"bad parameter",404:"no such container",500:"server error"},options:n.opts};if(void 0===n.callback)return new this.modem.Promise(function(e,t){i.modem.dial(s,function(i,n){if(i)return t(i);e(n)})});this.modem.dial(s,function(e,t){n.callback(e,t)})},s.prototype.remove=function(e,t){var i=this,n=r.processArgs(e,t,this.defaultOptions.remove),s={path:"/containers/"+this.id+"?",method:"DELETE",abortSignal:n.opts.abortSignal,statusCodes:{200:!0,204:!0,400:"bad parameter",404:"no such container",500:"server error"},options:n.opts};if(void 0===n.callback)return new this.modem.Promise(function(e,t){i.modem.dial(s,function(i,n){if(i)return t(i);e(n)})});this.modem.dial(s,function(e,t){n.callback(e,t)})},s.prototype.copy=function(e,t){var i=this;console.log("container.copy is deprecated since Docker v1.8.x");var n=r.processArgs(e,t,this.defaultOptions.copy),s={path:"/containers/"+this.id+"/copy",method:"POST",abortSignal:n.opts.abortSignal,isStream:!0,statusCodes:{200:!0,404:"no such container",500:"server error"},options:n.opts};if(void 0===n.callback)return new this.modem.Promise(function(e,t){i.modem.dial(s,function(i,n){if(i)return t(i);e(n)})});this.modem.dial(s,function(e,t){n.callback(e,t)})},s.prototype.getArchive=function(e,t){var i=this,n=r.processArgs(e,t,this.defaultOptions.getArchive),s={path:"/containers/"+this.id+"/archive?",method:"GET",abortSignal:n.opts.abortSignal,isStream:!0,statusCodes:{200:!0,400:"client error, bad parameters",404:"no such container",500:"server error"},options:n.opts};if(void 0===n.callback)return new this.modem.Promise(function(e,t){i.modem.dial(s,function(i,n){if(i)return t(i);e(n)})});this.modem.dial(s,function(e,t){n.callback(e,t)})},s.prototype.infoArchive=function(e,t){var i=this,n=r.processArgs(e,t,this.defaultOptions.infoArchive),s={path:"/containers/"+this.id+"/archive?",method:"HEAD",abortSignal:n.opts.abortSignal,isStream:!0,statusCodes:{200:!0,400:"client error, bad parameters",404:"no such container",500:"server error"},options:n.opts};if(void 0===n.callback)return new this.modem.Promise(function(e,t){i.modem.dial(s,function(i,n){if(i)return t(i);e(n)})});this.modem.dial(s,function(e,t){n.callback(e,t)})},s.prototype.putArchive=function(e,t,i){var n=this,s=r.processArgs(t,i,this.defaultOptions.putArchive),o={path:"/containers/"+this.id+"/archive?",method:"PUT",file:e,abortSignal:s.opts.abortSignal,statusCodes:{200:!0,400:"client error, bad parameters",403:"client error, permission denied",404:"no such container",500:"server error"},options:s.opts};if(void 0===s.callback)return new this.modem.Promise(function(e,t){n.modem.dial(o,function(i,n){if(i)return t(i);e(n)})});this.modem.dial(o,function(e,t){s.callback(e,t)})},s.prototype.logs=function(e,t){var i=this,n=r.processArgs(e,t,this.defaultOptions.log),s={path:"/containers/"+this.id+"/logs?",method:"GET",abortSignal:n.opts.abortSignal,isStream:n.opts.follow||!1,statusCodes:{200:!0,404:"no such container",500:"server error"},options:n.opts};if(void 0===n.callback)return new this.modem.Promise(function(e,t){i.modem.dial(s,function(i,n){if(i)return t(i);e(n)})});this.modem.dial(s,function(e,t){n.callback(e,t)})},s.prototype.stats=function(e,t){var i=this,n=r.processArgs(e,t,this.defaultOptions.stats),s=!0;!1===n.opts.stream&&(s=!1);var o={path:"/containers/"+this.id+"/stats?",method:"GET",abortSignal:n.opts.abortSignal,isStream:s,statusCodes:{200:!0,404:"no such container",500:"server error"},options:n.opts};if(void 0===n.callback)return new this.modem.Promise(function(e,t){i.modem.dial(o,function(i,n){if(i)return t(i);e(n)})});this.modem.dial(o,function(e,t){n.callback(e,t)})},e.exports=s},8608(e,t,i){var n=i(4434).EventEmitter,r=i(7469),s=i(4985),o=i(1991),a=i(4974),l=i(384),c=i(3569),u=i(3303),h=i(9360),d=i(6474),f=i(5517),p=i(4024),g=i(6033),m=i(7052),v=i(7054),y=m.extend,b=function(e){if(!(this instanceof b))return new b(e);var t=global.Promise;e&&e.Promise&&(t=e.Promise,1===Object.keys(e).length&&(e=void 0)),e&&e.modem?this.modem=e.modem:this.modem=new r(e),this.modem.Promise=t};b.prototype.createContainer=function(e,t){var i=this,n={path:"/containers/create?",method:"POST",options:e,authconfig:e.authconfig,abortSignal:e.abortSignal,statusCodes:{200:!0,201:!0,400:"bad parameter",404:"no such container",406:"impossible to attach",500:"server error"}};if(delete e.authconfig,void 0===t)return new this.modem.Promise(function(e,t){i.modem.dial(n,function(n,r){if(n)return t(n);e(i.getContainer(r.Id))})});this.modem.dial(n,function(e,n){if(e)return t(e,n);t(e,i.getContainer(n.Id))})},b.prototype.createImage=function(e,t,i){var n=this;i||"function"!=typeof t?i||t||(e=(t=e).authconfig):(i=t,e=(t=e).authconfig||void 0);var r={path:"/images/create?",method:"POST",options:t,authconfig:e,abortSignal:t.abortSignal,isStream:!0,statusCodes:{200:!0,500:"server error"}};if(void 0===i)return new this.modem.Promise(function(e,t){n.modem.dial(r,function(i,n){if(i)return t(i);e(n)})});this.modem.dial(r,function(e,t){i(e,t)})},b.prototype.loadImage=function(e,t,i){var n=this;i||"function"!=typeof t||(i=t,t=null);var r={path:"/images/load?",method:"POST",options:t,file:e,abortSignal:t&&t.abortSignal,isStream:!0,statusCodes:{200:!0,500:"server error"}};if(void 0===i)return new this.modem.Promise(function(e,t){n.modem.dial(r,function(i,n){if(i)return t(i);e(n)})});this.modem.dial(r,function(e,t){i(e,t)})},b.prototype.importImage=function(e,t,i){var n=this;i||"function"!=typeof t||(i=t,t=void 0),t||(t={}),t.fromSrc="-";var r={path:"/images/create?",method:"POST",options:t,file:e,abortSignal:t.abortSignal,isStream:!0,statusCodes:{200:!0,500:"server error"}};if(void 0===i)return new this.modem.Promise(function(e,t){n.modem.dial(r,function(i,n){if(i)return t(i);e(n)})});this.modem.dial(r,function(e,t){i(e,t)})},b.prototype.checkAuth=function(e,t){var i=this,n={path:"/auth",method:"POST",options:e,abortSignal:e.abortSignal,statusCodes:{200:!0,204:!0,500:"server error"}};if(void 0===t)return new this.modem.Promise(function(e,t){i.modem.dial(n,function(i,n){if(i)return t(i);e(n)})});this.modem.dial(n,function(e,i){t(e,i)})},b.prototype.buildImage=function(e,t,i){var n=this;i||"function"!=typeof t||(i=t,t=null);var r={path:"/build?",method:"POST",file:void 0,options:t,abortSignal:t&&t.abortSignal,isStream:!0,statusCodes:{200:!0,500:"server error"}};function s(t){m.prepareBuildContext(e,e=>{r.file=e,n.modem.dial(r,t)})}function o(e){"2"===t?.version?v(n,r.authconfig,(t,i,n)=>{if(t)return e(t);r.options.session=i,s((t,i)=>{e(t,i),i&&i.on("end",n)})}):s(e)}if(t&&(t.registryconfig&&(r.registryconfig=r.options.registryconfig,delete r.options.registryconfig),t.authconfig&&(r.authconfig=r.options.authconfig,delete r.options.authconfig),t.cachefrom&&Array.isArray(t.cachefrom)&&(r.options.cachefrom=JSON.stringify(t.cachefrom))),void 0===i)return new n.modem.Promise(function(e,t){o(function(i,n){if(i)return t(i);e(n)})});o(i)},b.prototype.getContainer=function(e){return new s(this.modem,e)},b.prototype.getImage=function(e){return new o(this.modem,e)},b.prototype.getVolume=function(e){return new a(this.modem,e)},b.prototype.getPlugin=function(e,t){return new u(this.modem,e,t)},b.prototype.getService=function(e){return new c(this.modem,e)},b.prototype.getTask=function(e){return new f(this.modem,e)},b.prototype.getNode=function(e){return new p(this.modem,e)},b.prototype.getNetwork=function(e){return new l(this.modem,e)},b.prototype.getSecret=function(e){return new h(this.modem,e)},b.prototype.getConfig=function(e){return new d(this.modem,e)},b.prototype.getExec=function(e){return new g(this.modem,e)},b.prototype.listContainers=function(e,t){var i=this,n=m.processArgs(e,t),r={path:"/containers/json?",method:"GET",options:n.opts,abortSignal:n.opts.abortSignal,statusCodes:{200:!0,400:"bad parameter",500:"server error"}};if(void 0===n.callback)return new this.modem.Promise(function(e,t){i.modem.dial(r,function(i,n){if(i)return t(i);e(n)})});this.modem.dial(r,function(e,t){n.callback(e,t)})},b.prototype.listImages=function(e,t){var i=this,n=m.processArgs(e,t),r={path:"/images/json?",method:"GET",options:n.opts,abortSignal:n.opts.abortSignal,statusCodes:{200:!0,400:"bad parameter",500:"server error"}};if(void 0===n.callback)return new this.modem.Promise(function(e,t){i.modem.dial(r,function(i,n){if(i)return t(i);e(n)})});this.modem.dial(r,function(e,t){n.callback(e,t)})},b.prototype.getImages=function(e,t){var i=this,n=m.processArgs(e,t),r={path:"/images/get?",method:"GET",options:n.opts,abortSignal:n.opts.abortSignal,isStream:!0,statusCodes:{200:!0,400:"bad parameter",500:"server error"}};if(void 0===n.callback)return new this.modem.Promise(function(e,t){i.modem.dial(r,function(i,n){if(i)return t(i);e(n)})});this.modem.dial(r,function(e,t){n.callback(e,t)})},b.prototype.listServices=function(e,t){var i=this,n=m.processArgs(e,t),r={path:"/services?",method:"GET",options:n.opts,abortSignal:n.opts.abortSignal,statusCodes:{200:!0,500:"server error"}};if(void 0===n.callback)return new this.modem.Promise(function(e,t){i.modem.dial(r,function(i,n){if(i)return t(i);e(n)})});this.modem.dial(r,function(e,t){n.callback(e,t)})},b.prototype.listNodes=function(e,t){var i=this,n=m.processArgs(e,t),r={path:"/nodes?",method:"GET",options:n.opts,abortSignal:n.opts.abortSignal,statusCodes:{200:!0,400:"bad parameter",404:"no such node",500:"server error",503:"node is not part of a swarm"}};if(void 0===n.callback)return new this.modem.Promise(function(e,t){i.modem.dial(r,function(i,n){if(i)return t(i);e(n)})});this.modem.dial(r,function(e,t){n.callback(e,t)})},b.prototype.listTasks=function(e,t){var i=this,n=m.processArgs(e,t),r={path:"/tasks?",method:"GET",options:n.opts,abortSignal:n.opts.abortSignal,statusCodes:{200:!0,500:"server error"}};if(void 0===n.callback)return new this.modem.Promise(function(e,t){i.modem.dial(r,function(i,n){if(i)return t(i);e(n)})});this.modem.dial(r,function(e,t){n.callback(e,t)})},b.prototype.createSecret=function(e,t){var i=m.processArgs(e,t),n=this,r={path:"/secrets/create?",method:"POST",options:i.opts,abortSignal:i.opts.abortSignal,statusCodes:{200:!0,201:!0,406:"server error or node is not part of a swarm",409:"name conflicts with an existing object",500:"server error"}};if(void 0===i.callback)return new this.modem.Promise(function(e,t){n.modem.dial(r,function(i,r){if(i)return t(i);e(n.getSecret(r.ID))})});this.modem.dial(r,function(e,t){if(e)return i.callback(e,t);i.callback(e,n.getSecret(t.ID))})},b.prototype.createConfig=function(e,t){var i=m.processArgs(e,t),n=this,r={path:"/configs/create?",method:"POST",options:i.opts,abortSignal:i.opts.abortSignal,statusCodes:{200:!0,201:!0,406:"server error or node is not part of a swarm",409:"name conflicts with an existing object",500:"server error"}};if(void 0===i.callback)return new this.modem.Promise(function(e,t){n.modem.dial(r,function(i,r){if(i)return t(i);e(n.getConfig(r.ID))})});this.modem.dial(r,function(e,t){if(e)return i.callback(e,t);i.callback(e,n.getConfig(t.ID))})},b.prototype.listSecrets=function(e,t){var i=this,n=m.processArgs(e,t),r={path:"/secrets?",method:"GET",options:n.opts,abortSignal:n.opts.abortSignal,statusCodes:{200:!0,500:"server error"}};if(void 0===n.callback)return new this.modem.Promise(function(e,t){i.modem.dial(r,function(i,n){if(i)return t(i);e(n)})});this.modem.dial(r,function(e,t){n.callback(e,t)})},b.prototype.listConfigs=function(e,t){var i=this,n=m.processArgs(e,t),r={path:"/configs?",method:"GET",options:n.opts,abortSignal:n.opts.abortSignal,statusCodes:{200:!0,500:"server error"}};if(void 0===n.callback)return new this.modem.Promise(function(e,t){i.modem.dial(r,function(i,n){if(i)return t(i);e(n)})});this.modem.dial(r,function(e,t){n.callback(e,t)})},b.prototype.createPlugin=function(e,t){var i=this,n=m.processArgs(e,t),r={path:"/plugins/create?",method:"POST",options:n.opts,abortSignal:n.opts.abortSignal,statusCodes:{200:!0,204:!0,500:"server error"}};if(void 0===n.callback)return new this.modem.Promise(function(e,t){i.modem.dial(r,function(r,s){if(r)return t(r);e(i.getPlugin(n.opts.name))})});this.modem.dial(r,function(e,t){if(e)return n.callback(e,t);n.callback(e,i.getPlugin(n.opts.name))})},b.prototype.listPlugins=function(e,t){var i=this,n=m.processArgs(e,t),r={path:"/plugins?",method:"GET",options:n.opts,abortSignal:n.opts.abortSignal,statusCodes:{200:!0,500:"server error"}};if(void 0===n.callback)return new this.modem.Promise(function(e,t){i.modem.dial(r,function(i,n){if(i)return t(i);e(n)})});this.modem.dial(r,function(e,t){n.callback(e,t)})},b.prototype.pruneImages=function(e,t){var i=this,n=m.processArgs(e,t),r={path:"/images/prune?",method:"POST",options:n.opts,abortSignal:n.opts.abortSignal,statusCodes:{200:!0,500:"server error"}};if(void 0===n.callback)return new this.modem.Promise(function(e,t){i.modem.dial(r,function(i,n){if(i)return t(i);e(n)})});this.modem.dial(r,function(e,t){n.callback(e,t)})},b.prototype.pruneBuilder=function(e,t){var i=this,n=m.processArgs(e,t),r={path:"/build/prune",method:"POST",abortSignal:n.opts.abortSignal,statusCodes:{200:!0,500:"server error"}};if(void 0===n.callback)return new this.modem.Promise(function(e,t){i.modem.dial(r,function(i,n){if(i)return t(i);e(n)})});this.modem.dial(r,function(e,t){n.callback(e,t)})},b.prototype.pruneContainers=function(e,t){var i=this,n=m.processArgs(e,t),r={path:"/containers/prune?",method:"POST",options:n.opts,abortSignal:n.opts.abortSignal,statusCodes:{200:!0,500:"server error"}};if(void 0===n.callback)return new this.modem.Promise(function(e,t){i.modem.dial(r,function(i,n){if(i)return t(i);e(n)})});this.modem.dial(r,function(e,t){n.callback(e,t)})},b.prototype.pruneVolumes=function(e,t){var i=this,n=m.processArgs(e,t),r={path:"/volumes/prune?",method:"POST",options:n.opts,abortSignal:n.opts.abortSignal,statusCodes:{200:!0,500:"server error"}};if(void 0===n.callback)return new this.modem.Promise(function(e,t){i.modem.dial(r,function(i,n){if(i)return t(i);e(n)})});this.modem.dial(r,function(e,t){n.callback(e,t)})},b.prototype.pruneNetworks=function(e,t){var i=this,n=m.processArgs(e,t),r={path:"/networks/prune?",method:"POST",options:n.opts,abortSignal:n.opts.abortSignal,statusCodes:{200:!0,500:"server error"}};if(void 0===n.callback)return new this.modem.Promise(function(e,t){i.modem.dial(r,function(i,n){if(i)return t(i);e(n)})});this.modem.dial(r,function(e,t){n.callback(e,t)})},b.prototype.createVolume=function(e,t){var i=this,n=m.processArgs(e,t),r={path:"/volumes/create?",method:"POST",allowEmpty:!0,options:n.opts,abortSignal:n.opts.abortSignal,statusCodes:{200:!0,201:!0,500:"server error"}};if(void 0===n.callback)return new this.modem.Promise(function(e,t){i.modem.dial(r,function(n,r){if(n)return t(n);e(i.getVolume(r.Name))})});this.modem.dial(r,function(e,t){if(e)return n.callback(e,t);n.callback(e,i.getVolume(t.Name))})},b.prototype.createService=function(e,t,i){i||"function"!=typeof t?t||i||(t=e):(i=t,e=(t=e).authconfig||void 0);var n=this,r={path:"/services/create",method:"POST",options:t,authconfig:e,abortSignal:t&&t.abortSignal,statusCodes:{200:!0,201:!0,500:"server error"}};if(void 0===i)return new this.modem.Promise(function(e,t){n.modem.dial(r,function(i,r){if(i)return t(i);e(n.getService(r.ID||r.Id))})});this.modem.dial(r,function(e,t){if(e)return i(e,t);i(e,n.getService(t.ID||t.Id))})},b.prototype.listVolumes=function(e,t){var i=this,n=m.processArgs(e,t),r={path:"/volumes?",method:"GET",options:n.opts,abortSignal:n.opts.abortSignal,statusCodes:{200:!0,400:"bad parameter",500:"server error"}};if(void 0===n.callback)return new this.modem.Promise(function(e,t){i.modem.dial(r,function(i,n){if(i)return t(i);e(n)})});this.modem.dial(r,function(e,t){n.callback(e,t)})},b.prototype.createNetwork=function(e,t){var i=this,n=m.processArgs(e,t),r={path:"/networks/create?",method:"POST",options:n.opts,abortSignal:n.opts.abortSignal,statusCodes:{200:!0,201:!0,404:"driver not found",500:"server error"}};if(void 0===n.callback)return new this.modem.Promise(function(e,t){i.modem.dial(r,function(n,r){if(n)return t(n);e(i.getNetwork(r.Id))})});this.modem.dial(r,function(e,t){if(e)return n.callback(e,t);n.callback(e,i.getNetwork(t.Id))})},b.prototype.listNetworks=function(e,t){var i=this,n=m.processArgs(e,t),r={path:"/networks?",method:"GET",options:n.opts,abortSignal:n.opts.abortSignal,statusCodes:{200:!0,400:"bad parameter",500:"server error"}};if(void 0===n.callback)return new this.modem.Promise(function(e,t){i.modem.dial(r,function(i,n){if(i)return t(i);e(n)})});this.modem.dial(r,function(e,t){n.callback(e,t)})},b.prototype.searchImages=function(e,t){var i=this,n={path:"/images/search?",method:"GET",options:e,authconfig:e.authconfig,abortSignal:e.abortSignal,statusCodes:{200:!0,500:"server error"}};if(void 0===t)return new this.modem.Promise(function(e,t){i.modem.dial(n,function(i,n){if(i)return t(i);e(n)})});this.modem.dial(n,function(e,i){t(e,i)})},b.prototype.info=function(e,t){var i=this,n=m.processArgs(e,t);e={path:"/info",method:"GET",abortSignal:n.opts.abortSignal,statusCodes:{200:!0,500:"server error"}};if(void 0===n.callback)return new this.modem.Promise(function(t,n){i.modem.dial(e,function(e,i){if(e)return n(e);t(i)})});this.modem.dial(e,function(e,t){n.callback(e,t)})},b.prototype.version=function(e,t){var i=this,n=m.processArgs(e,t);e={path:"/version",method:"GET",abortSignal:n.opts.abortSignal,statusCodes:{200:!0,500:"server error"}};if(void 0===n.callback)return new this.modem.Promise(function(t,n){i.modem.dial(e,function(e,i){if(e)return n(e);t(i)})});this.modem.dial(e,function(e,t){n.callback(e,t)})},b.prototype.ping=function(e,t){var i=this,n=m.processArgs(e,t),r={path:"/_ping",method:"GET",abortSignal:n.opts.abortSignal,statusCodes:{200:!0,500:"server error"}};if(void 0===n.callback)return new this.modem.Promise(function(e,t){i.modem.dial(r,function(i,n){if(i)return t(i);e(n)})});this.modem.dial(r,function(e,t){n.callback(e,t)})},b.prototype.df=function(e,t){var i=this,n=m.processArgs(e,t),r={path:"/system/df",method:"GET",abortSignal:n.opts.abortSignal,statusCodes:{200:!0,500:"server error"}};if(void 0===n.callback)return new this.modem.Promise(function(e,t){i.modem.dial(r,function(i,n){if(i)return t(i);e(n)})});this.modem.dial(r,function(e,t){n.callback(e,t)})},b.prototype.getEvents=function(e,t){var i=this,n=m.processArgs(e,t),r={path:"/events?",method:"GET",options:n.opts,abortSignal:n.opts.abortSignal,isStream:!0,statusCodes:{200:!0,500:"server error"}};if(void 0===n.callback)return new this.modem.Promise(function(e,t){i.modem.dial(r,function(i,n){if(i)return t(i);e(n)})});this.modem.dial(r,function(e,t){n.callback(e,t)})},b.prototype.pull=function(e,t,i,n){var r=m.processArgs(t,i),s=m.parseRepositoryTag(e);r.opts.fromImage=s.repository,r.opts.tag=s.tag||"latest";var o=[r.opts,r.callback];return n&&(o=[n,r.opts,r.callback]),this.createImage.apply(this,o)},b.prototype.pullAll=function(e,t,i,n){var r=m.processArgs(t,i),s=m.parseRepositoryTag(e);r.opts.fromImage=s.repository;var o=[r.opts,r.callback];return n&&(o=[n,r.opts,r.callback]),this.createImage.apply(this,o)},b.prototype.run=function(e,t,i,n,r,s){return"function"==typeof arguments[arguments.length-1]?this.runCallback(e,t,i,n,r,s):this.runPromise(e,t,i,n,r)},b.prototype.runCallback=function(e,t,i,r,s,o){o||"function"!=typeof r?o||"function"!=typeof s||(o=s,s={}):(o=r,r={},s={});var a=new n;var l={Hostname:"",User:"",AttachStdin:!1,AttachStdout:!0,AttachStderr:!0,Tty:!0,OpenStdin:!1,StdinOnce:!1,Env:null,Cmd:t,Image:e,Volumes:{},VolumesFrom:[]};return y(l,r),this.createContainer(l,function(e,t){if(e)return o(e,null,t);a.emit("container",t),t.attach({stream:!0,stdout:!0,stderr:!0},function(e,n){if(e)return o(e,null,t);a.emit("stream",n),i&&(i instanceof Array?(n.on("end",function(){try{i[0].end()}catch(e){}try{i[1].end()}catch(e){}}),t.modem.demuxStream(n,i[0],i[1])):(n.setEncoding("utf8"),n.pipe(i,{end:!0}))),t.start(s,function(e,i){if(e)return o(e,i,t);a.emit("start",t),t.wait(function(e,i){a.emit("data",i),o(e,i,t)})})})}),a},b.prototype.runPromise=function(e,t,i,n,r){var s=this;r=r||{};var o,a={Hostname:"",User:"",AttachStdin:!1,AttachStdout:!0,AttachStderr:!0,Tty:!0,OpenStdin:!1,StdinOnce:!1,Env:null,Cmd:t,Image:e,Volumes:{},VolumesFrom:[]};return y(a,n=n||{}),new this.modem.Promise(function(e,t){s.createContainer(a).then(function(e){return o=e,e.attach({stream:!0,stdout:!0,stderr:!0})}).then(function(e){return i&&(i instanceof Array?(e.on("end",function(){try{i[0].end()}catch(e){}try{i[1].end()}catch(e){}}),o.modem.demuxStream(e,i[0],i[1])):(e.setEncoding("utf8"),e.pipe(i,{end:!0}))),o.start(r)}).then(function(e){return o.wait()}).then(function(t){e([t,o])}).catch(function(e){t(e)})})},b.prototype.swarmInit=function(e,t){var i=this,n=m.processArgs(e,t),r={path:"/swarm/init",method:"POST",abortSignal:n.opts.abortSignal,statusCodes:{200:!0,400:"bad parameter",406:"node is already part of a Swarm"},options:n.opts};if(void 0===n.callback)return new this.modem.Promise(function(e,t){i.modem.dial(r,function(i,n){if(i)return t(i);e(n)})});this.modem.dial(r,function(e,t){n.callback(e,t)})},b.prototype.swarmJoin=function(e,t){var i=this,n=m.processArgs(e,t),r={path:"/swarm/join",method:"POST",abortSignal:n.opts.abortSignal,statusCodes:{200:!0,400:"bad parameter",406:"node is already part of a Swarm"},options:n.opts};if(void 0===n.callback)return new this.modem.Promise(function(e,t){i.modem.dial(r,function(i,n){if(i)return t(i);e(n)})});this.modem.dial(r,function(e,t){n.callback(e,t)})},b.prototype.swarmLeave=function(e,t){var i=this,n=m.processArgs(e,t),r={path:"/swarm/leave?",method:"POST",abortSignal:n.opts.abortSignal,statusCodes:{200:!0,406:"node is not part of a Swarm"},options:n.opts};if(void 0===n.callback)return new this.modem.Promise(function(e,t){i.modem.dial(r,function(i,n){if(i)return t(i);e(n)})});this.modem.dial(r,function(e,t){n.callback(e,t)})},b.prototype.swarmUpdate=function(e,t){var i=this,n=m.processArgs(e,t),r={path:"/swarm/update?",method:"POST",abortSignal:n.opts.abortSignal,statusCodes:{200:!0,400:"bad parameter",406:"node is already part of a Swarm"},options:n.opts};if(void 0===n.callback)return new this.modem.Promise(function(e,t){i.modem.dial(r,function(i,n){if(i)return t(i);e(n)})});this.modem.dial(r,function(e,t){n.callback(e,t)})},b.prototype.swarmInspect=function(e,t){var i=this,n=m.processArgs(e,t),r={path:"/swarm",method:"GET",abortSignal:n.opts.abortSignal,statusCodes:{200:!0,406:"This node is not a swarm manager",500:"server error"}};if(void 0===n.callback)return new this.modem.Promise(function(e,t){i.modem.dial(r,function(i,n){if(i)return t(i);e(n)})});this.modem.dial(r,function(e,t){n.callback(e,t)})},b.Container=s,b.Image=o,b.Volume=a,b.Network=l,b.Service=c,b.Plugin=u,b.Secret=h,b.Task=f,b.Node=p,b.Exec=g,e.exports=b},6033(e,t,i){var n=i(7052),r=function(e,t){this.modem=e,this.id=t};r.prototype[i(9023).inspect.custom]=function(){return this},r.prototype.start=function(e,t){var i=this,r=n.processArgs(e,t),s={path:"/exec/"+this.id+"/start",method:"POST",abortSignal:r.opts.abortSignal,isStream:!0,allowEmpty:!0,hijack:r.opts.hijack,openStdin:r.opts.stdin,statusCodes:{200:!0,204:!0,404:"no such exec",409:"container stopped/paused",500:"container not running"},options:r.opts};if(void 0===r.callback)return new this.modem.Promise(function(e,t){i.modem.dial(s,function(i,n){if(i)return t(i);e(n)})});this.modem.dial(s,function(e,t){if(e)return r.callback(e,t);r.callback(e,t)})},r.prototype.resize=function(e,t){var i=this,r=n.processArgs(e,t),s={path:"/exec/"+this.id+"/resize?",method:"POST",abortSignal:r.opts.abortSignal,statusCodes:{200:!0,404:"no such exec",500:"container not running"},options:r.opts};if(void 0===r.callback)return new this.modem.Promise(function(e,t){i.modem.dial(s,function(i,n){if(i)return t(i);e(n)})});this.modem.dial(s,function(e,t){if(e)return r.callback(e,t);r.callback(e,t)})},r.prototype.inspect=function(e,t){var i=this,r=n.processArgs(e,t),s={path:"/exec/"+this.id+"/json",method:"GET",abortSignal:r.opts.abortSignal,statusCodes:{200:!0,404:"no such exec",500:"server error"}};if(void 0===r.callback)return new this.modem.Promise(function(e,t){i.modem.dial(s,function(i,n){if(i)return t(i);e(n)})});this.modem.dial(s,function(e,t){if(e)return r.callback(e,t);r.callback(e,t)})},e.exports=r},1991(e,t,i){var n=i(7052),r=function(e,t){this.modem=e,this.name=t};r.prototype[i(9023).inspect.custom]=function(){return this},r.prototype.inspect=function(e,t){var i=n.processArgs(e,t),r=this;e={path:"/images/"+this.name+"/json",method:"GET",options:i.opts,statusCodes:{200:!0,404:"no such image",500:"server error"}};if(void 0===i.callback)return new this.modem.Promise(function(t,i){r.modem.dial(e,function(e,n){if(e)return i(e);t(n)})});this.modem.dial(e,function(e,t){if(e)return i.callback(e,t);i.callback(e,t)})},r.prototype.distribution=function(e,t){var i=n.processArgs(e,t),r=this,s={path:"/distribution/"+this.name+"/json",method:"GET",statusCodes:{200:!0,401:"no such image",500:"server error"},authconfig:i.opts?i.opts.authconfig:void 0};if(void 0===i.callback)return new this.modem.Promise(function(e,t){r.modem.dial(s,function(i,n){if(i)return t(i);e(n)})});this.modem.dial(s,function(e,t){if(e)return i.callback(e,t);i.callback(e,t)})},r.prototype.history=function(e){var t=this,i={path:"/images/"+this.name+"/history",method:"GET",statusCodes:{200:!0,404:"no such image",500:"server error"}};if(void 0===e)return new this.modem.Promise(function(e,n){t.modem.dial(i,function(t,i){if(t)return n(t);e(i)})});this.modem.dial(i,function(t,i){if(t)return e(t,i);e(t,i)})},r.prototype.get=function(e){var t=this,i={path:"/images/"+this.name+"/get",method:"GET",isStream:!0,statusCodes:{200:!0,500:"server error"}};if(void 0===e)return new this.modem.Promise(function(e,n){t.modem.dial(i,function(t,i){if(t)return n(t);e(i)})});this.modem.dial(i,function(t,i){if(t)return e(t,i);e(t,i)})},r.prototype.push=function(e,t,i){var r=this,s=n.processArgs(e,t),o=!0;!1===s.opts.stream&&(o=!1);var a={path:"/images/"+this.name+"/push?",method:"POST",options:s.opts,authconfig:s.opts.authconfig||i,abortSignal:s.opts.abortSignal,isStream:o,statusCodes:{200:!0,404:"no such image",500:"server error"}};if(delete a.options.authconfig,void 0===t)return new this.modem.Promise(function(e,t){r.modem.dial(a,function(i,n){if(i)return t(i);e(n)})});this.modem.dial(a,function(e,i){t(e,i)})},r.prototype.tag=function(e,t){var i=this,n={path:"/images/"+this.name+"/tag?",method:"POST",options:e,abortSignal:e&&e.abortSignal,statusCodes:{200:!0,201:!0,400:"bad parameter",404:"no such image",409:"conflict",500:"server error"}};if(void 0===t)return new this.modem.Promise(function(e,t){i.modem.dial(n,function(i,n){if(i)return t(i);e(n)})});this.modem.dial(n,function(e,i){t(e,i)})},r.prototype.remove=function(e,t){var i=this,r=n.processArgs(e,t),s={path:"/images/"+this.name+"?",method:"DELETE",abortSignal:r.opts.abortSignal,statusCodes:{200:!0,404:"no such image",409:"conflict",500:"server error"},options:r.opts};if(void 0===r.callback)return new this.modem.Promise(function(e,t){i.modem.dial(s,function(i,n){if(i)return t(i);e(n)})});this.modem.dial(s,function(e,t){r.callback(e,t)})},e.exports=r},384(e,t,i){var n=i(7052),r=function(e,t){this.modem=e,this.id=t};r.prototype[i(9023).inspect.custom]=function(){return this},r.prototype.inspect=function(e,t){var i=this,r=n.processArgs(e,t);e={path:"/networks/"+this.id+"?",method:"GET",statusCodes:{200:!0,404:"no such network",500:"server error"},options:r.opts};if(void 0===r.callback)return new this.modem.Promise(function(t,n){i.modem.dial(e,function(e,i){if(e)return n(e);t(i)})});this.modem.dial(e,function(e,t){r.callback(e,t)})},r.prototype.remove=function(e,t){var i=this,r=n.processArgs(e,t),s={path:"/networks/"+this.id,method:"DELETE",abortSignal:r.opts.abortSignal,statusCodes:{200:!0,204:!0,404:"no such network",409:"conflict",500:"server error"},options:r.opts};if(void 0===r.callback)return new this.modem.Promise(function(e,t){i.modem.dial(s,function(i,n){if(i)return t(i);e(n)})});this.modem.dial(s,function(e,t){r.callback(e,t)})},r.prototype.connect=function(e,t){var i=this,r=n.processArgs(e,t),s={path:"/networks/"+this.id+"/connect",method:"POST",abortSignal:r.opts.abortSignal,statusCodes:{200:!0,201:!0,404:"network or container is not found",500:"server error"},options:r.opts};if(void 0===r.callback)return new this.modem.Promise(function(e,t){i.modem.dial(s,function(i,n){if(i)return t(i);e(n)})});this.modem.dial(s,function(e,t){r.callback(e,t)})},r.prototype.disconnect=function(e,t){var i=this,r=n.processArgs(e,t),s={path:"/networks/"+this.id+"/disconnect",method:"POST",abortSignal:r.opts.abortSignal,statusCodes:{200:!0,201:!0,404:"network or container is not found",500:"server error"},options:r.opts};if(void 0===r.callback)return new this.modem.Promise(function(e,t){i.modem.dial(s,function(i,n){if(i)return t(i);e(n)})});this.modem.dial(s,function(e,t){r.callback(e,t)})},e.exports=r},4024(e,t,i){var n=i(7052),r=function(e,t){this.modem=e,this.id=t};r.prototype[i(9023).inspect.custom]=function(){return this},r.prototype.inspect=function(e,t){var i=this,r=n.processArgs(e,t),s={path:"/nodes/"+this.id,method:"GET",abortSignal:r.opts.abortSignal,statusCodes:{200:!0,404:"no such node",500:"server error"}};if(void 0===r.callback)return new this.modem.Promise(function(e,t){i.modem.dial(s,function(i,n){if(i)return t(i);e(n)})});this.modem.dial(s,function(e,t){r.callback(e,t)})},r.prototype.update=function(e,t){var i=this;t||"function"!=typeof e||(t=e);var n={path:"/nodes/"+this.id+"/update?",method:"POST",abortSignal:e&&e.abortSignal,statusCodes:{200:!0,404:"no such node",406:"node is not part of a swarm",500:"server error"},options:e};if(void 0===t)return new this.modem.Promise(function(e,t){i.modem.dial(n,function(i,n){if(i)return t(i);e(n)})});this.modem.dial(n,function(e,i){t(e,i)})},r.prototype.remove=function(e,t){var i=this,r=n.processArgs(e,t),s={path:"/nodes/"+this.id+"?",method:"DELETE",abortSignal:r.opts.abortSignal,statusCodes:{200:!0,404:"no such node",500:"server error"},options:r.opts};if(void 0===r.callback)return new this.modem.Promise(function(e,t){i.modem.dial(s,function(i,n){if(i)return t(i);e(n)})});this.modem.dial(s,function(e,t){r.callback(e,t)})},e.exports=r},3303(e,t,i){var n=i(7052),r=function(e,t,i){this.modem=e,this.name=t,this.remote=i||t};r.prototype[i(9023).inspect.custom]=function(){return this},r.prototype.inspect=function(e,t){var i=this,r=n.processArgs(e,t),s={path:"/plugins/"+this.name+"/json",method:"GET",abortSignal:r.opts.abortSignal,statusCodes:{200:!0,404:"plugin is not installed",500:"server error"}};if(void 0===r.callback)return new this.modem.Promise(function(e,t){i.modem.dial(s,function(i,n){if(i)return t(i);e(n)})});this.modem.dial(s,function(e,t){r.callback(e,t)})},r.prototype.remove=function(e,t){var i=this,r=n.processArgs(e,t),s={path:"/plugins/"+this.name+"?",method:"DELETE",abortSignal:r.opts.abortSignal,statusCodes:{200:!0,404:"plugin is not installed",500:"server error"},options:r.opts};if(void 0===r.callback)return new this.modem.Promise(function(e,t){i.modem.dial(s,function(i,n){if(i)return t(i);e(n)})});this.modem.dial(s,function(e,t){if(e)return r.callback(e,t);r.callback(e,t)})},r.prototype.privileges=function(e,t){var i=this,r=n.processArgs(e,t),s={path:"/plugins/privileges?",method:"GET",options:{remote:this.remote},abortSignal:r.opts.abortSignal,statusCodes:{200:!0,500:"server error"}};if(void 0===r.callback)return new this.modem.Promise(function(e,t){i.modem.dial(s,function(i,n){if(i)return t(i);e(n)})});this.modem.dial(s,function(e,t){r.callback(e,t)})},r.prototype.pull=function(e,t){var i=this,r=n.processArgs(e,t);r.opts._query&&!r.opts._query.name&&(r.opts._query.name=this.name),r.opts._query&&!r.opts._query.remote&&(r.opts._query.remote=this.remote);var s={path:"/plugins/pull?",method:"POST",abortSignal:r.opts.abortSignal,isStream:!0,options:r.opts,statusCodes:{200:!0,204:!0,500:"server error"}};if(void 0===r.callback)return new this.modem.Promise(function(e,t){i.modem.dial(s,function(i,n){if(i)return t(i);e(n)})});this.modem.dial(s,function(e,t){r.callback(e,t)})},r.prototype.enable=function(e,t){var i=this,r=n.processArgs(e,t),s={path:"/plugins/"+this.name+"/enable?",method:"POST",abortSignal:r.opts.abortSignal,statusCodes:{200:!0,500:"server error"},options:r.opts};if(void 0===r.callback)return new this.modem.Promise(function(e,t){i.modem.dial(s,function(i,n){if(i)return t(i);e(n)})});this.modem.dial(s,function(e,t){r.callback(e,t)})},r.prototype.disable=function(e,t){var i=this,r=n.processArgs(e,t),s={path:"/plugins/"+this.name+"/disable",method:"POST",abortSignal:r.opts.abortSignal,statusCodes:{200:!0,500:"server error"},options:r.opts};if(void 0===r.callback)return new this.modem.Promise(function(e,t){i.modem.dial(s,function(i,n){if(i)return t(i);e(n)})});this.modem.dial(s,function(e,t){r.callback(e,t)})},r.prototype.push=function(e,t){var i=this,r=n.processArgs(e,t),s={path:"/plugins/"+this.name+"/push",method:"POST",abortSignal:r.opts.abortSignal,statusCodes:{200:!0,404:"plugin not installed",500:"server error"},options:r.opts};if(void 0===r.callback)return new this.modem.Promise(function(e,t){i.modem.dial(s,function(i,n){if(i)return t(i);e(n)})});this.modem.dial(s,function(e,t){r.callback(e,t)})},r.prototype.configure=function(e,t){var i=this,r=n.processArgs(e,t),s={path:"/plugins/"+this.name+"/set",method:"POST",abortSignal:r.opts.abortSignal,statusCodes:{200:!0,204:!0,404:"plugin not installed",500:"server error"},options:r.opts};if(void 0===r.callback)return new this.modem.Promise(function(e,t){i.modem.dial(s,function(i,n){if(i)return t(i);e(n)})});this.modem.dial(s,function(e,t){r.callback(e,t)})},r.prototype.upgrade=function(e,t,i){var n=this;i||"function"!=typeof t||(i=t,e=(t=e).authconfig||void 0);var r={path:"/plugins/"+this.name+"/upgrade?",method:"POST",abortSignal:t&&t.abortSignal,statusCodes:{200:!0,204:!0,404:"plugin not installed",500:"server error"},authconfig:e,options:t};if(void 0===i)return new this.modem.Promise(function(e,t){n.modem.dial(r,function(i,n){if(i)return t(i);e(n)})});this.modem.dial(r,function(e,t){i(e,t)})},e.exports=r},9360(e,t,i){var n=i(7052),r=function(e,t){this.modem=e,this.id=t};r.prototype[i(9023).inspect.custom]=function(){return this},r.prototype.inspect=function(e,t){var i=this,r=n.processArgs(e,t),s={path:"/secrets/"+this.id,method:"GET",abortSignal:r.opts.abortSignal,statusCodes:{200:!0,404:"secret not found",406:"node is not part of a swarm",500:"server error"}};if(void 0===r.callback)return new this.modem.Promise(function(e,t){i.modem.dial(s,function(i,n){if(i)return t(i);e(n)})});this.modem.dial(s,function(e,t){r.callback(e,t)})},r.prototype.update=function(e,t){var i=this;t||"function"!=typeof e||(t=e);var n={path:"/secrets/"+this.id+"/update?",method:"POST",abortSignal:e&&e.abortSignal,statusCodes:{200:!0,404:"secret not found",500:"server error"},options:e};if(void 0===t)return new this.modem.Promise(function(e,t){i.modem.dial(n,function(i,n){if(i)return t(i);e(n)})});this.modem.dial(n,function(e,i){t(e,i)})},r.prototype.remove=function(e,t){var i=this,r=n.processArgs(e,t),s={path:"/secrets/"+this.id,method:"DELETE",abortSignal:r.opts.abortSignal,statusCodes:{200:!0,204:!0,404:"secret not found",500:"server error"},options:r.opts};if(void 0===r.callback)return new this.modem.Promise(function(e,t){i.modem.dial(s,function(i,n){if(i)return t(i);e(n)})});this.modem.dial(s,function(e,t){r.callback(e,t)})},e.exports=r},3569(e,t,i){var n=i(7052),r=function(e,t){this.modem=e,this.id=t};r.prototype[i(9023).inspect.custom]=function(){return this},r.prototype.inspect=function(e,t){var i=this,r=n.processArgs(e,t),s={path:"/services/"+this.id,method:"GET",abortSignal:r.opts.abortSignal,statusCodes:{200:!0,404:"no such service",500:"server error"}};if(void 0===r.callback)return new this.modem.Promise(function(e,t){i.modem.dial(s,function(i,n){if(i)return t(i);e(n)})});this.modem.dial(s,function(e,t){r.callback(e,t)})},r.prototype.remove=function(e,t){var i=this,r=n.processArgs(e,t),s={path:"/services/"+this.id,method:"DELETE",abortSignal:r.opts.abortSignal,statusCodes:{200:!0,204:!0,404:"no such service",500:"server error"}};if(void 0===r.callback)return new this.modem.Promise(function(e,t){i.modem.dial(s,function(i,n){if(i)return t(i);e(n)})});this.modem.dial(s,function(e,t){r.callback(e,t)})},r.prototype.update=function(e,t,i){var n=this;if(!i){var r=typeof t;"function"===r?(i=t,e=(t=e).authconfig||void 0):"undefined"===r&&(e=(t=e).authconfig||void 0)}var s={path:"/services/"+this.id+"/update?",method:"POST",abortSignal:t&&t.abortSignal,statusCodes:{200:!0,404:"no such service",500:"server error"},authconfig:e,options:t};if(void 0===i)return new this.modem.Promise(function(e,t){n.modem.dial(s,function(i,n){if(i)return t(i);e(n)})});this.modem.dial(s,function(e,t){i(e,t)})},r.prototype.logs=function(e,t){var i=this,r=n.processArgs(e,t,{}),s={path:"/services/"+this.id+"/logs?",method:"GET",abortSignal:r.opts.abortSignal,isStream:r.opts.follow||!1,statusCodes:{200:!0,404:"no such service",500:"server error",503:"node is not part of a swarm"},options:r.opts};if(void 0===r.callback)return new this.modem.Promise(function(e,t){i.modem.dial(s,function(i,n){if(i)return t(i);e(n)})});this.modem.dial(s,function(e,t){r.callback(e,t)})},e.exports=r},7054(e,t,i){var n=i(674),r=i(6340),s=i(6928),o=i(4679).v4;e.exports=function(e,t,i){const a=o(),l={method:"POST",path:"/session",hijack:!0,headers:{Upgrade:"h2c","X-Docker-Expose-Session-Uuid":a,"X-Docker-Expose-Session-Name":"testcontainers"},statusCodes:{200:!0,500:"server error"}};e.modem.dial(l,function(e,o){if(e)return i(e,null,()=>{});const l=new n.Server,c=n.ServerCredentials.createInsecure();l.createConnectionInjector(c).injectConnection(o);const u=r.loadSync(s.resolve(__dirname,"proto","auth.proto")),h=n.loadPackageDefinition(u);l.addService(h.moby.filesync.v1.Auth.service,{Credentials({request:e},i){i(null,t?{Username:t.username,Secret:t.password}:{})}}),i(null,a,function(){l.forceShutdown(),o.end()})})}},5517(e,t,i){var n=i(7052),r=function(e,t){this.modem=e,this.id=t,this.defaultOptions={log:{}}};r.prototype[i(9023).inspect.custom]=function(){return this},r.prototype.inspect=function(e,t){var i=this,r=n.processArgs(e,t),s={path:"/tasks/"+this.id,method:"GET",abortSignal:r.opts.abortSignal,statusCodes:{200:!0,404:"unknown task",500:"server error"}};if(void 0===r.callback)return new this.modem.Promise(function(e,t){i.modem.dial(s,function(i,n){if(i)return t(i);e(n)})});this.modem.dial(s,function(e,t){r.callback(e,t)})},r.prototype.logs=function(e,t){var i=this,r=n.processArgs(e,t,this.defaultOptions.log),s={path:"/tasks/"+this.id+"/logs?",method:"GET",abortSignal:r.opts.abortSignal,isStream:r.opts.follow||!1,statusCodes:{101:!0,200:!0,404:"no such container",500:"server error",503:"node is not part of a swarm"},options:r.opts};if(void 0===r.callback)return new this.modem.Promise(function(e,t){i.modem.dial(s,function(i,n){if(i)return t(i);e(n)})});this.modem.dial(s,function(e,t){r.callback(e,t)})},e.exports=r},7052(e,t,i){var n=i(3065),r=i(9896),s=i(6928),o=i(6868),a=i(3106),l=[],c=l.forEach,u=l.slice;e.exports.extend=function(e){return c.call(u.call(arguments,1),function(t){if(t)for(var i in t)e[i]=t[i]}),e},e.exports.processArgs=function(t,i,n){return i||"function"!=typeof t||(i=t,t=null),{callback:i,opts:e.exports.extend({},n,t)}},e.exports.parseRepositoryTag=function(e){var t,i=e.indexOf("@"),n=e.lastIndexOf(":");if(i>=0)t=i;else{if(!(n>=0))return{repository:e};t=n}var r=e.slice(t+1);return-1===r.indexOf("/")?{repository:e.slice(0,t),tag:r}:{repository:e}},e.exports.prepareBuildContext=function(e,t){e&&e.context?r.readFile(s.join(e.context,".dockerignore"),(i,r)=>{let s,l;if(!i){const e=n({ignorecase:!1}).add(r.toString());l=e.createFilter(),s=e=>!l(e)}const c=e.src.slice()||[],u=o.pack(e.context,{entries:l?c.filter(l):c,ignore:s});t(u.pipe(a.createGzip()))}):t(e)}},4974(e,t,i){var n=i(7052),r=function(e,t){this.modem=e,this.name=t};r.prototype[i(9023).inspect.custom]=function(){return this},r.prototype.inspect=function(e,t){var i=this,r=n.processArgs(e,t),s={path:"/volumes/"+this.name,method:"GET",abortSignal:r.opts.abortSignal,statusCodes:{200:!0,404:"no such volume",500:"server error"}};if(void 0===r.callback)return new this.modem.Promise(function(e,t){i.modem.dial(s,function(i,n){if(i)return t(i);e(n)})});this.modem.dial(s,function(e,t){r.callback(e,t)})},r.prototype.remove=function(e,t){var i=this,r=n.processArgs(e,t),s={path:"/volumes/"+this.name,method:"DELETE",abortSignal:r.opts.abortSignal,statusCodes:{204:!0,404:"no such volume",409:"conflict",500:"server error"},options:r.opts};if(void 0===r.callback)return new this.modem.Promise(function(e,t){i.modem.dial(s,function(i,n){if(i)return t(i);e(n)})});this.modem.dial(s,function(e,t){r.callback(e,t)})},e.exports=r},6611(e,t,i){var n=i(3519),r=function(){},s=global.Bare?queueMicrotask:process.nextTick.bind(process),o=function(e,t,i){if("function"==typeof t)return o(e,null,t);t||(t={}),i=n(i||r);var a=e._writableState,l=e._readableState,c=t.readable||!1!==t.readable&&e.readable,u=t.writable||!1!==t.writable&&e.writable,h=!1,d=function(){e.writable||f()},f=function(){u=!1,c||i.call(e)},p=function(){c=!1,u||i.call(e)},g=function(t){i.call(e,t?new Error("exited with error code: "+t):null)},m=function(t){i.call(e,t)},v=function(){s(y)},y=function(){if(!h)return(!c||l&&l.ended&&!l.destroyed)&&(!u||a&&a.ended&&!a.destroyed)?void 0:i.call(e,new Error("premature close"))},b=function(){e.req.on("finish",f)};return!function(e){return e.setHeader&&"function"==typeof e.abort}(e)?u&&!a&&(e.on("end",d),e.on("close",d)):(e.on("complete",f),e.on("abort",v),e.req?b():e.on("request",b)),function(e){return e.stdio&&Array.isArray(e.stdio)&&3===e.stdio.length}(e)&&e.on("exit",g),e.on("end",p),e.on("finish",f),!1!==t.error&&e.on("error",m),e.on("close",v),function(){h=!0,e.removeListener("complete",f),e.removeListener("abort",v),e.removeListener("request",b),e.req&&e.req.removeListener("finish",f),e.removeListener("end",d),e.removeListener("close",d),e.removeListener("finish",f),e.removeListener("exit",g),e.removeListener("end",p),e.removeListener("error",m),e.removeListener("close",v)}};e.exports=o},5474(e,t,i){e=i.nmd(e),function t(n){"use strict";var r;function s(e,t,i){const n=typeof i,r=typeof e;if("undefined"!==n){if("undefined"!==r){if(i){if("function"===r&&n===r)return function(t){return e(i(t))};if((t=e.constructor)===i.constructor){if(t===Array)return i.concat(e);if(t===Map){var s=new Map(i);for(var o of e)s.set(o[0],o[1]);return s}if(t===Set){for(s of(o=new Set(i),e.values()))o.add(s);return o}}}return e}return i}return"undefined"===r?t:e}function o(e,t){return void 0===e?t:e}function a(){return Object.create(null)}function l(e){return"string"==typeof e}function c(e){return"object"==typeof e}function u(e,t){if(l(t))e=e[t];else for(let i=0;e&&i<t.length;i++)e=e[t[i]];return e}(n=e)._factory=t;const h=/[^\p{L}\p{N}]+/u,d=/(\d{3})/g,f=/(\D)(\d{3})/g,p=/(\d{3})(\D)/g,g=/[\u0300-\u036f]/g;function m(e={}){if(!this||this.constructor!==m)return new m(...arguments);if(arguments.length)for(e=0;e<arguments.length;e++)this.assign(arguments[e]);else this.assign(e)}function v(e){e.F=null,e.B.clear(),e.D.clear()}function y(e,t,i){i||(t||"object"!=typeof e?"object"==typeof t&&(i=t,t=0):i=e),i&&(e=i.query||e,t=i.limit||t);let n=""+(t||0);i&&(n+=(i.offset||0)+!!i.context+!!i.suggest+(!1!==i.resolve)+(i.resolution||this.resolution)+(i.boost||0)),e=(""+e).toLowerCase(),this.cache||(this.cache=new b);let r=this.cache.get(e+n);if(!r){const s=i&&i.cache;s&&(i.cache=!1),r=this.search(e,t,i),s&&(i.cache=s),this.cache.set(e+n,r)}return r}function b(e){this.limit=e&&!0!==e?e:1e3,this.cache=new Map,this.h=""}(r=m.prototype).assign=function(e){this.normalize=s(e.normalize,!0,this.normalize);let t,i=e.include,n=i||e.exclude||e.split;if(n||""===n){if("object"==typeof n&&n.constructor!==RegExp){let e="";t=!i,i||(e+="\\p{Z}"),n.letter&&(e+="\\p{L}"),n.number&&(e+="\\p{N}",t=!!i),n.symbol&&(e+="\\p{S}"),n.punctuation&&(e+="\\p{P}"),n.control&&(e+="\\p{C}"),(n=n.char)&&(e+="object"==typeof n?n.join(""):n);try{this.split=new RegExp("["+(i?"^":"")+e+"]+","u")}catch(e){this.split=/\s+/}}else this.split=n,t=!1===n||"a1a".split(n).length<2;this.numeric=s(e.numeric,t)}else{try{this.split=s(this.split,h)}catch(e){this.split=/\s+/}this.numeric=s(e.numeric,s(this.numeric,!0))}if(this.prepare=s(e.prepare,null,this.prepare),this.finalize=s(e.finalize,null,this.finalize),n=e.filter,this.filter="function"==typeof n?n:s(n&&new Set(n),null,this.filter),this.dedupe=s(e.dedupe,!0,this.dedupe),this.matcher=s((n=e.matcher)&&new Map(n),null,this.matcher),this.mapper=s((n=e.mapper)&&new Map(n),null,this.mapper),this.stemmer=s((n=e.stemmer)&&new Map(n),null,this.stemmer),this.replacer=s(e.replacer,null,this.replacer),this.minlength=s(e.minlength,1,this.minlength),this.maxlength=s(e.maxlength,1024,this.maxlength),this.rtl=s(e.rtl,!1,this.rtl),(this.cache=n=s(e.cache,!0,this.cache))&&(this.F=null,this.L="number"==typeof n?n:2e5,this.B=new Map,this.D=new Map,this.I=this.H=128),this.h="",this.J=null,this.A="",this.K=null,this.matcher)for(const e of this.matcher.keys())this.h+=(this.h?"|":"")+e;if(this.stemmer)for(const e of this.stemmer.keys())this.A+=(this.A?"|":"")+e;return this},r.addStemmer=function(e,t){return this.stemmer||(this.stemmer=new Map),this.stemmer.set(e,t),this.A+=(this.A?"|":"")+e,this.K=null,this.cache&&v(this),this},r.addFilter=function(e){return"function"==typeof e?this.filter=e:(this.filter||(this.filter=new Set),this.filter.add(e)),this.cache&&v(this),this},r.addMapper=function(e,t){return"object"==typeof e?this.addReplacer(e,t):e.length>1?this.addMatcher(e,t):(this.mapper||(this.mapper=new Map),this.mapper.set(e,t),this.cache&&v(this),this)},r.addMatcher=function(e,t){return"object"==typeof e?this.addReplacer(e,t):e.length<2&&(this.dedupe||this.mapper)?this.addMapper(e,t):(this.matcher||(this.matcher=new Map),this.matcher.set(e,t),this.h+=(this.h?"|":"")+e,this.J=null,this.cache&&v(this),this)},r.addReplacer=function(e,t){return"string"==typeof e?this.addMatcher(e,t):(this.replacer||(this.replacer=[]),this.replacer.push(e,t),this.cache&&v(this),this)},r.encode=function(e,t){if(this.cache&&e.length<=this.H)if(this.F){if(this.B.has(e))return this.B.get(e)}else this.F=setTimeout(v,50,this);this.normalize&&(e="function"==typeof this.normalize?this.normalize(e):g?e.normalize("NFKD").replace(g,"").toLowerCase():e.toLowerCase()),this.prepare&&(e=this.prepare(e)),this.numeric&&e.length>3&&(e=e.replace(f,"$1 $2").replace(p,"$1 $2").replace(d,"$1 "));const i=!(this.dedupe||this.mapper||this.filter||this.matcher||this.stemmer||this.replacer);let n,r,s=[],o=a(),l=this.split||""===this.split?e.split(this.split):[e];for(let e,a,u=0;u<l.length;u++)if((e=a=l[u])&&!(e.length<this.minlength||e.length>this.maxlength)){if(t){if(o[e])continue;o[e]=1}else{if(n===e)continue;n=e}if(i)s.push(e);else if(!this.filter||("function"==typeof this.filter?this.filter(e):!this.filter.has(e))){if(this.cache&&e.length<=this.I)if(this.F){var c=this.D.get(e);if(c||""===c){c&&s.push(c);continue}}else this.F=setTimeout(v,50,this);if(this.stemmer){let t;for(this.K||(this.K=new RegExp("(?!^)("+this.A+")$"));t!==e&&e.length>2;)t=e,e=e.replace(this.K,e=>this.stemmer.get(e))}if(e&&(this.mapper||this.dedupe&&e.length>1)){c="";for(let t,i,n=0,r="";n<e.length;n++)t=e.charAt(n),t===r&&this.dedupe||((i=this.mapper&&this.mapper.get(t))||""===i?i===r&&this.dedupe||!(r=i)||(c+=i):c+=r=t);e=c}if(this.matcher&&e.length>1&&(this.J||(this.J=new RegExp("("+this.h+")","g")),e=e.replace(this.J,e=>this.matcher.get(e))),e&&this.replacer)for(c=0;e&&c<this.replacer.length;c+=2)e=e.replace(this.replacer[c],this.replacer[c+1]);if(this.cache&&a.length<=this.I&&(this.D.set(a,e),this.D.size>this.L&&(this.D.clear(),this.I=this.I/1.1|0)),e){if(e!==a)if(t){if(o[e])continue;o[e]=1}else{if(r===e)continue;r=e}s.push(e)}}}return this.finalize&&(s=this.finalize(s)||s),this.cache&&e.length<=this.H&&(this.B.set(e,s),this.B.size>this.L&&(this.B.clear(),this.H=this.H/1.1|0)),s},b.prototype.set=function(e,t){this.cache.set(this.h=e,t),this.cache.size>this.limit&&this.cache.delete(this.cache.keys().next().value)},b.prototype.get=function(e){const t=this.cache.get(e);return t&&this.h!==e&&(this.cache.delete(e),this.cache.set(this.h=e,t)),t},b.prototype.remove=function(e){for(const t of this.cache){const i=t[0];t[1].includes(e)&&this.cache.delete(i)}},b.prototype.clear=function(){this.cache.clear(),this.h=""};const S={normalize:!1,numeric:!1,dedupe:!1},_={},C=new Map([["b","p"],["v","f"],["w","f"],["z","s"],["x","s"],["d","t"],["n","m"],["c","k"],["g","k"],["j","k"],["q","k"],["i","e"],["y","e"],["u","o"]]),E=new Map([["ae","a"],["oe","o"],["sh","s"],["kh","k"],["th","t"],["ph","f"],["pf","f"]]),w=[/([^aeo])h(.)/g,"$1$2",/([aeo])h([^aeo]|$)/g,"$1$2",/(.)\1+/g,"$1"],T={a:"",e:"",i:"",o:"",u:"",y:"",b:1,f:1,p:1,v:1,c:2,g:2,j:2,k:2,q:2,s:2,x:2,z:2,ß:2,d:3,t:3,l:4,m:5,n:5,r:6};var k={Exact:S,Default:_,Normalize:_,LatinBalance:{mapper:C},LatinAdvanced:{mapper:C,matcher:E,replacer:w},LatinExtra:{mapper:C,replacer:w.concat([/(?!^)[aeo]/g,""]),matcher:E},LatinSoundex:{dedupe:!1,include:{letter:!0},finalize:function(e){for(let i=0;i<e.length;i++){var t=e[i];let n=t.charAt(0),r=T[n];for(let e,i=1;i<t.length&&(e=t.charAt(i),"h"===e||"w"===e||!(e=T[e])||e===r||(n+=e,r=e,4!==n.length));i++);e[i]=n}}},CJK:{split:""},LatinExact:S,LatinDefault:_,LatinSimple:_};function R(e,t,i,n){let r=[];for(let s,o=0;o<e.index.length;o++)if(s=e.index[o],t>=s.length)t-=s.length;else{const o=(t=s[n?"splice":"slice"](t,i)).length;if(o&&(r=r.length?r.concat(t):t,i-=o,n&&(e.length-=o),!i))break;t=0}return r}function O(e){if(!this||this.constructor!==O)return new O(e);this.index=e?[e]:[],this.length=e?e.length:0;const t=this;return new Proxy([],{get:(e,i)=>"length"===i?t.length:"push"===i?function(e){t.index[t.index.length-1].push(e),t.length++}:"pop"===i?function(){if(t.length)return t.length--,t.index[t.index.length-1].pop()}:"indexOf"===i?function(e){let i=0;for(let n,r,s=0;s<t.index.length;s++){if(n=t.index[s],r=n.indexOf(e),r>=0)return i+r;i+=n.length}return-1}:"includes"===i?function(e){for(let i=0;i<t.index.length;i++)if(t.index[i].includes(e))return!0;return!1}:"slice"===i?function(e,i){return R(t,e||0,i||t.length,!1)}:"splice"===i?function(e,i){return R(t,e||0,i||t.length,!0)}:"constructor"===i?Array:"symbol"!=typeof i?(e=t.index[i/2**31|0])&&e[i]:void 0,set:(e,i,n)=>(e=i/2**31|0,(t.index[e]||(t.index[e]=[]))[i]=n,t.length++,!0)})}function A(e=8){if(!this||this.constructor!==A)return new A(e);this.index=a(),this.h=[],this.size=0,e>32?(this.B=x,this.A=BigInt(e)):(this.B=N,this.A=e)}function P(e=8){if(!this||this.constructor!==P)return new P(e);this.index=a(),this.h=[],this.size=0,e>32?(this.B=x,this.A=BigInt(e)):(this.B=N,this.A=e)}function N(e){let t=2**this.A-1;if("number"==typeof e)return e&t;let i=0,n=this.A+1;for(let r=0;r<e.length;r++)i=(i*n^e.charCodeAt(r))&t;return 32===this.A?i+2**31:i}function x(e){let t=BigInt(2)**this.A-BigInt(1);var i=typeof e;if("bigint"===i)return e&t;if("number"===i)return BigInt(e)&t;i=BigInt(0);let n=this.A+BigInt(1);for(let r=0;r<e.length;r++)i=(i*n^BigInt(e.charCodeAt(r)))&t;return i}let I,M,L,D,j;async function F(e){var t=(e=e.data).task;const i=e.id;let r=e.args;if("init"===t)M=e.options||{},(t=e.factory)?(Function("return "+t)()(n),I=new n.FlexSearch.Index(M),delete n.FlexSearch):I=new Oe(M),postMessage({id:i});else{let n;"export"===t&&(r[1]?(r[0]=M.export,r[2]=0,r[3]=1):r=null),"import"===t?r[0]&&(e=await M.import.call(I,r[0]),I.import(r[0],e)):((n=r&&I[t].apply(I,r))&&n.then&&(n=await n),n&&n.await&&(n=await n.await),"search"===t&&n.result&&(n=n.result)),postMessage("search"===t?{id:i,msg:n}:{id:i})}}function B(e){z.call(e,"add"),z.call(e,"append"),z.call(e,"search"),z.call(e,"update"),z.call(e,"remove"),z.call(e,"searchCache")}function U(){L=j=0}function z(e){this[e+"Async"]=function(){const t=arguments;var i=t[t.length-1];let n;if("function"==typeof i&&(n=i,delete t[t.length-1]),L?j||(j=Date.now()-D>=this.priority*this.priority*3):(L=setTimeout(U,0),D=Date.now()),j){const i=this;return new Promise(n=>{setTimeout(function(){n(i[e+"Async"].apply(i,t))},0)})}const r=this[e].apply(this,t);return i=r.then?r:new Promise(e=>e(r)),n&&i.then(n),i}}O.prototype.clear=function(){this.index.length=0},O.prototype.push=function(){},A.prototype.get=function(e){const t=this.index[this.B(e)];return t&&t.get(e)},A.prototype.set=function(e,t){var i=this.B(e);let n=this.index[i];n?(i=n.size,n.set(e,t),(i-=n.size)&&this.size++):(this.index[i]=n=new Map([[e,t]]),this.h.push(n),this.size++)},P.prototype.add=function(e){var t=this.B(e);let i=this.index[t];i?(t=i.size,i.add(e),(t-=i.size)&&this.size++):(this.index[t]=i=new Set([e]),this.h.push(i),this.size++)},(r=A.prototype).has=P.prototype.has=function(e){const t=this.index[this.B(e)];return t&&t.has(e)},r.delete=P.prototype.delete=function(e){const t=this.index[this.B(e)];t&&t.delete(e)&&this.size--},r.clear=P.prototype.clear=function(){this.index=a(),this.h=[],this.size=0},r.values=P.prototype.values=function*(){for(let e=0;e<this.h.length;e++)for(let t of this.h[e].values())yield t},r.keys=P.prototype.keys=function*(){for(let e=0;e<this.h.length;e++)for(let t of this.h[e].keys())yield t},r.entries=P.prototype.entries=function*(){for(let e=0;e<this.h.length;e++)for(let t of this.h[e].entries())yield t};let H=0;function W(e={},t){function r(i){function n(e){const t=(e=e.data||e).id,i=t&&l.h[t];i&&(i(e.msg),delete l.h[t])}if(this.worker=i,this.h=a(),this.worker)return o?this.worker.on("message",n):this.worker.onmessage=n,e.config?new Promise(function(t){H>1e9&&(H=0),l.h[++H]=function(){t(l)},l.worker.postMessage({id:H,task:"init",factory:s,options:e})}):(this.priority=e.priority||4,this.encoder=t||null,this.worker.postMessage({task:"init",factory:s,options:e}),this)}if(!this||this.constructor!==W)return new W(e);let s=void 0!==n?n._factory:"undefined"!=typeof window?window._factory:null;s&&(s=s.toString());const o="undefined"==typeof window,l=this,c=function(e,t,n){return t?new(i(8167).Worker)(__dirname+"/node/node.js"):e?new window.Worker(URL.createObjectURL(new Blob(["onmessage="+F.toString()],{type:"text/javascript"}))):new window.Worker("string"==typeof n?n:(0,eval)("import.meta.url").replace("/worker.js","/worker/worker.js").replace("flexsearch.bundle.module.min.js","module/worker/worker.js").replace("flexsearch.bundle.module.min.mjs","module/worker/worker.js"),{type:"module"})}(s,o,e.worker);return c.then?c.then(function(e){return r.call(l,e)}):r.call(this,c)}function q(e){W.prototype[e]=function(){const t=this,i=[].slice.call(arguments);var n=i[i.length-1];let r;return"function"==typeof n&&(r=n,i.pop()),n=new Promise(function(n){"export"===e&&"function"==typeof i[0]&&(i[0]=null),H>1e9&&(H=0),t.h[++H]=n,t.worker.postMessage({task:e,id:H,args:i})}),r?(n.then(r),this):n}}function $(e,t,i,n,r,s){if(e=e[r],n===i.length-1)t[r]=s||e;else if(e)if(e.constructor===Array)for(t=t[r]=Array(e.length),r=0;r<e.length;r++)$(e,t,i,n,r);else t=t[r]||(t[r]=a()),r=i[++n],$(e,t,i,n,r)}function G(e,t,i,n,r,s,o,a){if(e=e[o])if(n===t.length-1){if(e.constructor===Array){if(i[n]){for(t=0;t<e.length;t++)r.add(s,e[t],!0,!0);return}e=e.join(" ")}r.add(s,e,a,!0)}else if(e.constructor===Array)for(o=0;o<e.length;o++)G(e,t,i,n,r,s,o,a);else o=t[++n],G(e,t,i,n,r,s,o,a)}function V(e,t,i,n){if(!e.length)return e;if(1===e.length)return e=e[0],e=i||e.length>t?e.slice(i,i+t):e,n?le.call(this,e):e;let r=[];for(let s,o,a=0;a<e.length;a++)if((s=e[a])&&(o=s.length)){if(i){if(i>=o){i-=o;continue}s=s.slice(i,i+t),o=s.length,i=0}if(o>t&&(s=s.slice(0,t),o=t),!r.length&&o>=t)return n?le.call(this,s):s;if(r.push(s),!(t-=o))break}return r=r.length>1?[].concat.apply([],r):r[0],n?le.call(this,r):r}function Y(e,t,i,n){var r=n[0];if(r[0]&&r[0].query)return e[t].apply(e,r);if(!("and"!==t&&"not"!==t||e.result.length||e.await||r.suggest))return n.length>1&&(r=n[n.length-1]),(n=r.resolve)?e.await||e.result:e;let s,o,a,l,c,u=[],h=0,d=0;for(t=0;t<n.length;t++)if(r=n[t]){var f=void 0;if(r.constructor===te)f=r.await||r.result;else if(r.then||r.constructor===Array)f=r;else{h=r.limit||0,d=r.offset||0,a=r.suggest,o=r.resolve,s=((l=r.highlight||e.highlight)||r.enrich)&&o,f=r.queue;let i=r.async||f,n=r.index,p=r.query;if(n?e.index||(e.index=n):n=e.index,p||r.tag){const s=r.field||r.pluck;if(s&&(!p||e.query&&!l||(e.query=p,e.field=s,e.highlight=l),n=n.index.get(s)),f&&(c||e.await)){let s;c=1;const o=e.C.length,a=new Promise(function(e){s=e});(function(t,n){a.h=function(){n.index=null,n.resolve=!1;let r=i?t.searchAsync(n):t.search(n);return r.then?r.then(function(t){return e.C[o]=t=t.result||t,s(t),t}):(r=r.result||r,s(r),r)}})(n,Object.assign({},r)),e.C.push(a),u[t]=a;continue}r.resolve=!1,r.index=null,f=i?n.searchAsync(r):n.search(r),r.resolve=o,r.index=n}else if(r.and)f=K(r,"and",n);else if(r.or)f=K(r,"or",n);else if(r.not)f=K(r,"not",n);else{if(!r.xor)continue;f=K(r,"xor",n)}}f.await?(c=1,f=f.await):f.then?(c=1,f=f.then(function(e){return e.result||e})):f=f.result||f,u[t]=f}if(c&&!e.await&&(e.await=new Promise(function(t){e.return=t})),c){const t=Promise.all(u).then(function(n){for(let r=0;r<e.C.length;r++)if(e.C[r]===t){e.C[r]=function(){return i.call(e,n,h,d,s,o,a,l)};break}ie(e)});e.C.push(t)}else{if(!e.await)return i.call(e,u,h,d,s,o,a,l);e.C.push(function(){return i.call(e,u,h,d,s,o,a,l)})}return o?e.await||e.result:e}function K(e,t,i){const n=(e=e[t])[0]||e;return n.index||(n.index=i),i=new te(n),e.length>1&&(i=i[t].apply(i,e.slice(1))),i}function J(e,t,i,n,r,s,o){return e.length&&(this.result.length&&e.push(this.result),e.length<2?this.result=e[0]:(this.result=re(e,t,i,!1,this.h),i=0)),r&&(this.await=null),r?this.resolve(t,i,n,o):this}function X(e,t,i,n,r,s,o){if(!s&&!this.result.length)return r?this.result:this;let a;if(e.length)if(this.result.length&&e.unshift(this.result),e.length<2)this.result=e[0];else{let n=0;for(let t,i,r=0;r<e.length;r++)if((t=e[r])&&(i=t.length))n<i&&(n=i);else if(!s){n=0;break}n?(this.result=ne(e,n,t,i,s,this.h,r),a=!0):this.result=[]}else s||(this.result=e);return r&&(this.await=null),r?this.resolve(t,i,n,o,a):this}function Q(e,t,i,n,r,s,o){if(e.length)if(this.result.length&&e.unshift(this.result),e.length<2)this.result=e[0];else{e:{s=i;var l=this.h;const n=[],o=a();let c=0;for(let t,i=0;i<e.length;i++)if(t=e[i]){c<t.length&&(c=t.length);for(let e,i=0;i<t.length;i++)if(e=t[i])for(let t,i=0;i<e.length;i++)t=e[i],o[t]=o[t]?2:1}for(let i,a=0,u=0;a<c;a++)for(let c,h=0;h<e.length;h++)if((c=e[h])&&(i=c[a]))for(let c,d=0;d<i.length;d++)if(c=i[d],1===o[c])if(s)s--;else if(r){if(n.push(c),n.length===t){e=n;break e}}else{const i=a+(h?l:0);if(n[i]||(n[i]=[]),n[i].push(c),++u===t){e=n;break e}}e=n}this.result=e,l=!0}else s||(this.result=e);return r&&(this.await=null),r?this.resolve(t,i,n,o,l):this}function Z(e,t,i,n,r,s,o){if(!s&&!this.result.length)return r?this.result:this;if(e.length&&this.result.length){e:{s=i;var a=[];e=new Set(e.flat().flat());for(let i,n=0,o=0;n<this.result.length;n++)if(i=this.result[n])for(let l,c=0;c<i.length;c++)if(l=i[c],!e.has(l))if(s)s--;else if(r){if(a.push(l),a.length===t){e=a;break e}}else if(a[n]||(a[n]=[]),a[n].push(l),++o===t){e=a;break e}e=a}this.result=e,a=!0}return r&&(this.await=null),r?this.resolve(t,i,n,o,a):this}function ee(e,t,i,n,r){let s,o,a;"string"==typeof r?(s=r,r=""):s=r.template,o=s.indexOf("$1"),a=s.substring(o+2),o=s.substring(0,o);let l=r&&r.boundary,c=!r||!1!==r.clip,h=r&&r.merge&&a&&o&&new RegExp(a+" "+o,"g");var d=0;if("object"==typeof(r=r&&r.ellipsis)){var f=r.template;d=f.length-2,r=r.pattern}let p,g;"string"!=typeof r&&(r=!1===r?"":"..."),d&&(r=f.replace("$1",r)),f=r.length-d,"object"==typeof l&&(p=l.before,0===p&&(p=-1),g=l.after,0===g&&(g=-1),l=l.total||9e5),d=new Map;for(let M,L,D,j=0;j<t.length;j++){let F;if(n)F=t,D=n;else{var m=t[j];if(D=m.field,!D)continue;F=m.result}L=i.get(D),M=L.encoder,"string"!=typeof(m=d.get(M))&&(m=M.encode(e),d.set(M,m));for(let e=0;e<F.length;e++){var v=F[e].doc;if(!v)continue;if(!(v=u(v,D)))continue;var y=v.trim().split(/\s+/);if(!y.length)continue;v="";var b=[];let t=[];for(var S=-1,_=-1,C=0,E=0;E<y.length;E++){var w=y[E],T=M.encode(w);let e;if((T=T.length>1?T.join(" "):T[0])&&w){for(var k=w.length,R=(M.split?w.replace(M.split,""):w).length-T.length,O="",A=0,P=0;P<m.length;P++){var N=m[P];if(N){var x=N.length;x+=R<0?0:R,A&&x<=A||(N=T.indexOf(N))>-1&&(O=(N?w.substring(0,N):"")+o+w.substring(N,N+x)+a+(N+x<k?w.substring(N+x):""),A=x,e=!0)}}O&&(l&&(S<0&&(S=v.length+(v?1:0)),_=v.length+(v?1:0)+O.length,C+=k,t.push(b.length),b.push({match:O})),v+=(v?" ":"")+O)}if(e){if(l&&C>=l)break}else v+=(v?" ":"")+(w=y[E]),l&&b.push({text:w})}if(C=t.length*(s.length-2),p||g||l&&v.length-C>l)if(E=_-S,p>0&&(E+=p),g>0&&(E+=g),E<=(C=l+C-2*f))y=p?S-(p>0?p:0):S-((C-E)/2|0),b=g?_+(g>0?g:0):y+C,c||(y>0&&" "!==v.charAt(y)&&" "!==v.charAt(y-1)&&((y=v.indexOf(" ",y))<0&&(y=0)),b<v.length&&" "!==v.charAt(b-1)&&" "!==v.charAt(b)&&((b=v.lastIndexOf(" ",b))<_?b=_:++b)),v=(y?r:"")+v.substring(y,b)+(b<v.length?r:"");else{for(_=[],S={},C={},E={},w={},T={},O=R=k=0,P=A=1;;){var I=void 0;for(let e,i=0;i<t.length;i++){if(e=t[i],O)if(R!==O){if(E[i+1])continue;if(e+=O,S[e]){k-=f,C[i+1]=1,E[i+1]=1;continue}if(e>=b.length-1){if(e>=b.length){E[i+1]=1,e>=y.length&&(C[i+1]=1);continue}k-=f}if(v=b[e].text,x=g&&T[i]){if(!(x>0)){E[i+1]=1;continue}if(v.length>x){if(E[i+1]=1,!c)continue;v=v.substring(0,x)}(x-=v.length)||(x=-1),T[i]=x}if(k+v.length+1<=l)v=" "+v,_[i]+=v;else{if(!c){E[i+1]=1;continue}(I=l-k-1)>0&&(v=" "+v.substring(0,I),_[i]+=v),E[i+1]=1}}else{if(E[i])continue;if(e-=R,S[e]){k-=f,E[i]=1,C[i]=1;continue}if(e<=0){if(e<0){E[i]=1,C[i]=1;continue}k-=f}if(v=b[e].text,x=p&&w[i]){if(!(x>0)){E[i]=1;continue}if(v.length>x){if(E[i]=1,!c)continue;v=v.substring(v.length-x)}(x-=v.length)||(x=-1),w[i]=x}if(k+v.length+1<=l)v+=" ",_[i]=v+_[i];else{if(!c){E[i]=1;continue}(I=v.length+1-(l-k))>=0&&I<v.length&&(v=v.substring(I)+" ",_[i]=v+_[i]),E[i]=1}}else{let t;if(v=b[e].match,p&&(w[i]=p),g&&(T[i]=g),i&&k++,e?!i&&f&&(k+=f):(C[i]=1,E[i]=1),e>=y.length-1||e<b.length-1&&b[e+1].match?t=1:f&&(k+=f),k-=s.length-2,i&&!(k+v.length<=l)){I=A=P=C[i]=0;break}_[i]=v,t&&(C[i+1]=1,E[i+1]=1)}k+=v.length,I=S[e]=1}if(I)R===O?O++:R++;else{if(R===O?A=0:P=0,!A&&!P)break;A?O=++R:O++}}v="";for(let e,t=0;t<_.length;t++)e=(C[t]?t?" ":"":(t&&!r?" ":"")+r)+_[t],v+=e;r&&!C[_.length]&&(v+=r)}h&&(v=v.replace(h," ")),F[e].highlight=v}if(n)break}return t}function te(e,t){if(!this||this.constructor!==te)return new te(e,t);let i,n,r,s,o,a,l=0;if(e&&e.index){const i=e;if(t=i.index,l=i.boost||0,n=i.query){r=i.field||i.pluck,s=i.highlight;const n=i.resolve;e=i.async||i.queue,i.resolve=!1,i.index=null,e=e?t.searchAsync(i):t.search(i),i.resolve=n,i.index=t,e=e.result||e}else e=[]}if(e&&e.then){const t=this;i=[e=e.then(function(e){t.C[0]=t.result=e.result||e,ie(t)})],e=[],o=new Promise(function(e){a=e})}this.index=t||null,this.result=e||[],this.h=l,this.C=i||[],this.await=o||null,this.return=a||null,this.highlight=s||null,this.query=n||"",this.field=r||""}function ie(e,t){let i=e.result;var n=e.await;e.await=null;for(let t,r=0;r<e.C.length;r++)if(t=e.C[r])if("function"==typeof t)i=t(),e.C[r]=i=i.result||i,r--;else if(t.h)i=t.h(),e.C[r]=i=i.result||i,r--;else if(t.then)return e.await=n;return n=e.return,e.C=[],e.return=null,t||n(i),i}function ne(e,t,i,n,r,s,o){const l=e.length;let c,u,h=[];c=a();for(let a,d,f,p,g=0;g<t;g++)for(let t=0;t<l;t++)if(f=e[t],g<f.length&&(a=f[g]))for(let e=0;e<a.length;e++){if(d=a[e],(u=c[d])?c[d]++:(u=0,c[d]=1),p=h[u]||(h[u]=[]),!o){let e=g+(t||!r?0:s||0);p=p[e]||(p[e]=[])}if(p.push(d),o&&i&&u===l-1&&p.length-n===i)return n?p.slice(n):p}if(e=h.length)if(r)h=h.length>1?re(h,i,n,o,s):(h=h[0])&&i&&h.length>i||n?h.slice(n,i+n):h;else{if(e<l)return[];if(h=h[e-1],i||n)if(o)(h.length>i||n)&&(h=h.slice(n,i+n));else{r=[];for(let e,t=0;t<h.length;t++)if(e=h[t])if(n&&e.length>n)n-=e.length;else if((i&&e.length>i||n)&&(e=e.slice(n,i+n),i-=e.length,n&&(n-=e.length)),r.push(e),!i)break;h=r}}return h}function re(e,t,i,n,r){const s=[],o=a();let l;var c=e.length;let u;if(n){for(r=c-1;r>=0;r--)if(u=(n=e[r])&&n.length)for(c=0;c<u;c++)if(l=n[c],!o[l])if(o[l]=1,i)i--;else if(s.push(l),s.length===t)return s}else for(let a,h=c-1,d=0;h>=0;h--){a=e[h];for(let e=0;e<a.length;e++)if(u=(n=a[e])&&n.length)for(let a=0;a<u;a++)if(l=n[a],!o[l])if(o[l]=1,i)i--;else{let i=(e+(h<c-1&&r||0))/(h+1)|0;if((s[i]||(s[i]=[])).push(l),++d===t)return s}}return s}function se(e,t,i,n,r){const s=a(),o=[];for(let e,i=0;i<t.length;i++){e=t[i];for(let t=0;t<e.length;t++)s[e[t]]=1}if(r){for(let t,r=0;r<e.length;r++)if(t=e[r],s[t])if(n)n--;else if(o.push(t),s[t]=0,i&&0===--i)break}else for(let i,n,r=0;r<e.result.length;r++)for(i=e.result[r],t=0;t<i.length;t++)n=i[t],s[n]&&((o[r]||(o[r]=[])).push(n),s[n]=0);return o}function oe(e){const t=[],i=a(),n=a();for(let r,s,o,a,l,c,u,h=0;h<e.length;h++){r=e[h],s=r.field,o=r.result;for(let e=0;e<o.length;e++)l=o[e],"object"!=typeof l?l={id:a=l}:a=l.id,(c=i[a])?c.push(s):(l.field=i[a]=[s],t.push(l)),(u=l.highlight)&&(c=n[a],c||(n[a]=c={},l.highlight=c),c[s]=u)}return t}function ae(e,t,i,n,r){return(e=this.tag.get(e))&&(e=e.get(t))?((t=e.length-n)>0&&((i&&t>i||n)&&(e=e.slice(n,n+i)),r&&(e=le.call(this,e))),e):[]}function le(e){if(!this||!this.store)return e;if(this.db)return this.index.get(this.field[0]).db.enrich(e);const t=Array(e.length);for(let i,n=0;n<e.length;n++)i=e[n],t[n]={id:i,doc:this.store.get(i)};return t}function ce(e){if(!this||this.constructor!==ce)return new ce(e);const t=e.document||e.doc||e;let i,n;if(this.B=[],this.field=[],this.D=[],this.key=(i=t.key||t.id)&&he(i,this.D)||"id",(n=e.keystore||0)&&(this.keystore=n),this.fastupdate=!!e.fastupdate,this.reg=!this.fastupdate||e.worker||e.db?n?new P(n):new Set:n?new A(n):new Map,this.h=(i=t.store||null)&&i&&!0!==i&&[],this.store=i?n?new A(n):new Map:null,this.cache=(i=e.cache||null)&&new b(i),e.cache=!1,this.worker=e.worker||!1,this.priority=e.priority||4,this.index=ue.call(this,e,t),this.tag=null,(i=t.tag)&&("string"==typeof i&&(i=[i]),i.length)){this.tag=new Map,this.A=[],this.F=[];for(let e,t,n=0;n<i.length;n++){if(e=i[n],t=e.field||e,!t)throw Error("The tag field from the document descriptor is undefined.");e.custom?this.A[n]=e.custom:(this.A[n]=he(t,this.D),e.filter&&("string"==typeof this.A[n]&&(this.A[n]=new String(this.A[n])),this.A[n].G=e.filter)),this.F[n]=t,this.tag.set(t,new Map)}}if(this.worker){this.fastupdate=!1,e=[];for(const t of this.index.values())t.then&&e.push(t);if(e.length){const t=this;return Promise.all(e).then(function(e){let i=0;for(const n of t.index.entries()){const r=n[0];let s=n[1];s.then&&(s=e[i],t.index.set(r,s),i++)}return t})}}else e.db&&(this.fastupdate=!1,this.mount(e.db))}function ue(e,t){const i=new Map;let n=t.index||t.field||t;l(n)&&(n=[n]);for(let t,s,o=0;o<n.length;o++){if(t=n[o],l(t)||(s=t,t=t.field),s=c(s)?Object.assign({},e,s):e,this.worker){var r=void 0;r=new W(s,r=(r=s.encoder)&&r.encode?r:new m("string"==typeof r?k[r]:r||{})),i.set(t,r)}this.worker||i.set(t,new Oe(s,this.reg)),s.custom?this.B[o]=s.custom:(this.B[o]=he(t,this.D),s.filter&&("string"==typeof this.B[o]&&(this.B[o]=new String(this.B[o])),this.B[o].G=s.filter)),this.field[o]=t}if(this.h){l(e=t.store)&&(e=[e]);for(let t,i,n=0;n<e.length;n++)t=e[n],i=t.field||t,t.custom?(this.h[n]=t.custom,t.custom.O=i):(this.h[n]=he(i,this.D),t.filter&&("string"==typeof this.h[n]&&(this.h[n]=new String(this.h[n])),this.h[n].G=t.filter))}return i}function he(e,t){const i=e.split(":");let n=0;for(let r=0;r<i.length;r++)"]"===(e=i[r])[e.length-1]&&(e=e.substring(0,e.length-2))&&(t[n]=!0),e&&(i[n++]=e);return n<i.length&&(i.length=n),n>1?i:i[0]}function de(e,t=0){let i=[],n=[];t&&(t=25e4/t*5e3|0);for(const r of e.entries())n.push(r),n.length===t&&(i.push(n),n=[]);return n.length&&i.push(n),i}function fe(e,t){t||(t=new Map);for(let i,n=0;n<e.length;n++)i=e[n],t.set(i[0],i[1]);return t}function pe(e,t=0){let i=[],n=[];t&&(t=25e4/t*1e3|0);for(const r of e.entries())n.push([r[0],de(r[1])[0]||[]]),n.length===t&&(i.push(n),n=[]);return n.length&&i.push(n),i}function ge(e,t){t||(t=new Map);for(let i,n,r=0;r<e.length;r++)i=e[r],n=t.get(i[0]),t.set(i[0],fe(i[1],n));return t}function me(e){let t=[],i=[];for(const n of e.keys())i.push(n),25e4===i.length&&(t.push(i),i=[]);return i.length&&t.push(i),t}function ve(e,t){t||(t=new Set);for(let i=0;i<e.length;i++)t.add(e[i]);return t}function ye(e,t,i,n,r,s,o=0){const a=n&&n.constructor===Array;var l=a?n.shift():n;if(!l)return this.export(e,t,r,s+1);if((l=e((t?t+".":"")+(o+1)+"."+i,JSON.stringify(l)))&&l.then){const c=this;return l.then(function(){return ye.call(c,e,t,i,a?n:null,r,s,o+1)})}return ye.call(this,e,t,i,a?n:null,r,s,o+1)}function be(e,t){let i="";for(const n of e.entries()){e=n[0];const r=n[1];let s="";for(let e,i=0;i<r.length;i++){e=r[i]||[""];let n="";for(let i=0;i<e.length;i++)n+=(n?",":"")+("string"===t?'"'+e[i]+'"':e[i]);n="["+n+"]",s+=(s?",":"")+n}s='["'+e+'",['+s+"]]",i+=(i?",":"")+s}return i}function Se(e,t){let i=0;var n=void 0===t;if(e.constructor===Array){for(let r,s,o,a=0;a<e.length;a++)if((r=e[a])&&r.length){if(n)return 1;if(s=r.indexOf(t),s>=0){if(r.length>1)return r.splice(s,1),1;if(delete e[a],i)return 1;o=1}else{if(o)return 1;i++}}}else for(let r of e.entries())n=r[0],Se(r[1],t)?i++:e.delete(n);return i}q("add"),q("append"),q("search"),q("update"),q("remove"),q("clear"),q("export"),q("import"),W.prototype.searchCache=y,B(W.prototype),ce.prototype.add=function(e,t,i){if(c(e)&&(e=u(t=e,this.key)),t&&(e||0===e)){if(!i&&this.reg.has(e))return this.update(e,t);for(let s,o=0;o<this.field.length;o++){s=this.B[o];var n=this.index.get(this.field[o]);if("function"==typeof s){var r=s(t);r&&n.add(e,r,i,!0)}else(!(r=s.G)||r(t))&&(s.constructor===String?s=[""+s]:l(s)&&(s=[s]),G(t,s,this.D,0,n,e,s[0],i))}if(this.tag)for(n=0;n<this.A.length;n++){var s=this.A[n];r=this.tag.get(this.F[n]);let c=a();if("function"==typeof s){if(!(s=s(t)))continue}else{var o=s.G;if(o&&!o(t))continue;s.constructor===String&&(s=""+s),s=u(t,s)}if(r&&s){l(s)&&(s=[s]);for(let t,n,a=0;a<s.length;a++)if(t=s[a],!c[t]&&(c[t]=1,(o=r.get(t))?n=o:r.set(t,n=[]),!i||!n.includes(e))){if(n.length===2**31-1){if(o=new O(n),this.fastupdate)for(let e of this.reg.values())e.includes(n)&&(e[e.indexOf(n)]=o);r.set(t,n=o)}n.push(e),this.fastupdate&&((o=this.reg.get(e))?o.push(n):this.reg.set(e,[n]))}}}if(this.store&&(!i||!this.store.has(e))){let n;if(this.h){n=a();for(let e,r=0;r<this.h.length;r++){if(e=this.h[r],(i=e.G)&&!i(t))continue;let s;if("function"==typeof e){if(s=e(t),!s)continue;e=[e.O]}else if(l(e)||e.constructor===String){n[e]=t[e];continue}$(t,n,e,0,e[0],s)}}this.store.set(e,n||t)}this.worker&&(this.fastupdate||this.reg.add(e))}return this},te.prototype.or=function(){return Y(this,"or",J,arguments)},te.prototype.and=function(){return Y(this,"and",X,arguments)},te.prototype.xor=function(){return Y(this,"xor",Q,arguments)},te.prototype.not=function(){return Y(this,"not",Z,arguments)},(r=te.prototype).limit=function(e){if(this.await){const t=this;this.C.push(function(){return t.limit(e).result})}else if(this.result.length){const t=[];for(let i,n=0;n<this.result.length;n++)if(i=this.result[n]){if(!(i.length<=e)){t[n]=i.slice(0,e);break}if(t[n]=i,!(e-=i.length))break}this.result=t}return this},r.offset=function(e){if(this.await){const t=this;this.C.push(function(){return t.offset(e).result})}else if(this.result.length){const t=[];for(let i,n=0;n<this.result.length;n++)(i=this.result[n])&&(i.length<=e?e-=i.length:(t[n]=i.slice(e),e=0));this.result=t}return this},r.boost=function(e){if(this.await){const t=this;this.C.push(function(){return t.boost(e).result})}else this.h+=e;return this},r.resolve=function(e,t,i,n,r){let s=this.await?ie(this,!0):this.result;if(s.then){const o=this;return s.then(function(){return o.resolve(e,t,i,n,r)})}return s.length&&("object"==typeof e?(n=e.highlight||this.highlight,i=!!n||e.enrich,t=e.offset,e=e.limit):(n=n||this.highlight,i=!!n||i),s=r?i?le.call(this.index,s):s:V.call(this.index,s,e||100,t,i)),this.finalize(s,n)},r.finalize=function(e,t){if(e.then){const i=this;return e.then(function(e){return i.finalize(e,t)})}t&&e.length&&this.query&&(e=ee(this.query,e,this.index.index,this.field,t));const i=this.return;return this.highlight=this.index=this.result=this.C=this.await=this.return=null,this.query=this.field="",i&&i(e),e},a(),ce.prototype.search=function(e,t,i,n){i||(!t&&c(e)?(i=e,e=""):c(t)&&(i=t,t=0));let r=[];var s=[];let a,u,h,d,f,p,g,m,v=0,y=!0;if(i){i.constructor===Array&&(i={index:i}),e=i.query||e,a=i.pluck,u=i.merge,d=i.boost,p=a||i.field||(p=i.index)&&(p.index?null:p);var b=this.tag&&i.tag;h=i.suggest,y=!1!==i.resolve,f=i.cache,g=y&&this.store&&i.highlight;var S=!!g||y&&this.store&&i.enrich;t=i.limit||t;var _=i.offset||0;if(t||(t=y?100:0),b&&(!this.db||!n)){b.constructor!==Array&&(b=[b]);var C=[];for(let e,t=0;t<b.length;t++)if(e=b[t],e.field&&e.tag){var E=e.tag;if(E.constructor===Array)for(var w=0;w<E.length;w++)C.push(e.field,E[w]);else C.push(e.field,E)}else{E=Object.keys(e);for(let t,i,n=0;n<E.length;n++)if(t=E[n],i=e[t],i.constructor===Array)for(w=0;w<i.length;w++)C.push(t,i[w]);else C.push(t,i)}if(b=C,!e){if(s=[],C.length)for(b=0;b<C.length;b+=2){if(this.db){if(!(n=this.index.get(C[b])))continue;s.push(n=n.db.tag(C[b+1],t,_,S))}else n=ae.call(this,C[b],C[b+1],t,_,S);r.push(y?{field:C[b],tag:C[b+1],result:n}:[n])}if(s.length){const e=this;return Promise.all(s).then(function(t){for(let e=0;e<t.length;e++)y?r[e].result=t[e]:r[e]=t[e];return y?r:new te(r.length>1?ne(r,1,0,0,h,d):r[0],e)})}return y?r:new te(r.length>1?ne(r,1,0,0,h,d):r[0],this)}}y||a||!(p=p||this.field)||(l(p)?a=p:(p.constructor===Array&&1===p.length&&(p=p[0]),a=p.field||p.index)),p&&p.constructor!==Array&&(p=[p])}p||(p=this.field),C=(this.worker||this.db)&&!n&&[];for(let a,c,u,d=0;d<p.length;d++){if(c=p[d],this.db&&this.tag&&!this.B[d])continue;let k;if(l(c)||(k=c,c=k.field,e=k.query||e,t=o(k.limit,t),_=o(k.offset,_),h=o(k.suggest,h),g=y&&this.store&&o(k.highlight,g),S=!!g||y&&this.store&&o(k.enrich,S),f=o(k.cache,f)),n)a=n[d];else{w=(E=k||i||{}).enrich;var T=this.index.get(c);if(b&&(this.db&&(E.tag=b,E.field=p,m=T.db.support_tag_search),!m&&w&&(E.enrich=!1),m||(E.limit=0,E.offset=0)),a=f?T.searchCache(e,b&&!m?0:t,E):T.search(e,b&&!m?0:t,E),b&&!m&&(E.limit=t,E.offset=_),w&&(E.enrich=w),C){C[d]=a;continue}}if(u=(a=a.result||a)&&a.length,b&&u){if(E=[],w=0,this.db&&n){if(!m)for(T=p.length;T<n.length;T++){let e=n[T];if(e&&e.length)w++,E.push(e);else if(!h)return y?r:new te(r,this)}}else for(let e,t,i=0;i<b.length;i+=2){if(e=this.tag.get(b[i]),!e){if(h)continue;return y?r:new te(r,this)}if(t=(e=e&&e.get(b[i+1]))&&e.length)w++,E.push(e);else if(!h)return y?r:new te(r,this)}if(w){if(a=se(a,E,t,_,y),u=a.length,!u&&!h)return y?a:new te(a,this);w--}}if(u)s[v]=c,r.push(a),v++;else if(1===p.length)return y?r:new te(r,this)}if(C){if(this.db&&b&&b.length&&!m)for(S=0;S<b.length;S+=2){if(!(s=this.index.get(b[S]))){if(h)continue;return y?r:new te(r,this)}C.push(s.db.tag(b[S+1],t,_,!1))}const n=this;return Promise.all(C).then(function(r){return i&&(i.resolve=y),r.length&&(r=n.search(e,t,i,r)),r})}if(!v)return y?r:new te(r,this);if(a&&(!S||!this.store))return r=r[0],y?r:new te(r,this);for(C=[],_=0;_<s.length;_++){if(b=r[_],S&&b.length&&void 0===b[0].doc&&(this.db?C.push(b=this.index.get(this.field[0]).db.enrich(b)):b=le.call(this,b)),a)return y?g?ee(e,b,this.index,a,g):b:new te(b,this);r[_]={field:s[_],result:b}}if(S&&this.db&&C.length){const t=this;return Promise.all(C).then(function(i){for(let e=0;e<i.length;e++)r[e].result=i[e];return g&&(r=ee(e,r,t.index,a,g)),u?oe(r):r})}return g&&(r=ee(e,r,this.index,a,g)),u?oe(r):r},(r=ce.prototype).mount=function(e){let t=this.field;if(this.tag)for(let e,n=0;n<this.F.length;n++){e=this.F[n];var i=void 0;this.index.set(e,i=new Oe({},this.reg)),t===this.field&&(t=t.slice(0)),t.push(e),i.tag=this.tag.get(e)}i=[];const n={db:e.db,type:e.type,fastupdate:e.fastupdate};for(let r,s,o=0;o<t.length;o++){n.field=s=t[o],r=this.index.get(s);const a=new e.constructor(e.id,n);a.id=e.id,i[o]=a.mount(r),r.document=!0,o?r.bypass=!0:r.store=this.store}const r=this;return this.db=Promise.all(i).then(function(){r.db=!0})},r.commit=async function(){const e=[];for(const t of this.index.values())e.push(t.commit());await Promise.all(e),this.reg.clear()},r.destroy=function(){const e=[];for(const t of this.index.values())e.push(t.destroy());return Promise.all(e)},r.append=function(e,t){return this.add(e,t,!0)},r.update=function(e,t){return this.remove(e).add(e,t)},r.remove=function(e){for(var t of(c(e)&&(e=u(e,this.key)),this.index.values()))t.remove(e,!0);if(this.reg.has(e)){if(this.tag&&!this.fastupdate)for(let i of this.tag.values())for(let n of i){t=n[0];const r=n[1],s=r.indexOf(e);s>-1&&(r.length>1?r.splice(s,1):i.delete(t))}this.store&&this.store.delete(e),this.reg.delete(e)}return this.cache&&this.cache.remove(e),this},r.clear=function(){const e=[];for(const t of this.index.values()){const i=t.clear();i.then&&e.push(i)}if(this.tag)for(const e of this.tag.values())e.clear();return this.store&&this.store.clear(),this.cache&&this.cache.clear(),e.length?Promise.all(e):this},r.contain=function(e){return this.db?this.index.get(this.field[0]).db.has(e):this.reg.has(e)},r.cleanup=function(){for(const e of this.index.values())e.cleanup();return this},r.get=function(e){return this.db?this.index.get(this.field[0]).db.enrich(e).then(function(e){return e[0]&&e[0].doc||null}):this.store.get(e)||null},r.set=function(e,t){return"object"==typeof e&&(e=u(t=e,this.key)),this.store.set(e,t),this},r.searchCache=y,r.export=function(e,t,i=0,n=0){if(i<this.field.length){const r=this.field[i];if((t=this.index.get(r).export(e,r,i,n=1))&&t.then){const n=this;return t.then(function(){return n.export(e,r,i+1)})}return this.export(e,r,i+1)}let r,s;switch(n){case 0:r="reg",s=me(this.reg),t=null;break;case 1:r="tag",s=this.tag&&pe(this.tag,this.reg.size),t=null;break;case 2:r="doc",s=this.store&&de(this.store),t=null;break;default:return}return ye.call(this,e,t,r,s||null,i,n)},r.import=function(e,t){var i=e.split(".");"json"===i[i.length-1]&&i.pop();const n=i.length>2?i[0]:"";if(i=i.length>2?i[2]:i[1],this.worker&&n)return this.index.get(n).import(e);if(t){if("string"==typeof t&&(t=JSON.parse(t)),n)return this.index.get(n).import(i,t);switch(i){case"reg":this.fastupdate=!1,this.reg=ve(t,this.reg);for(let e,t=0;t<this.field.length;t++)e=this.index.get(this.field[t]),e.fastupdate=!1,e.reg=this.reg;if(this.worker){t=[];for(const i of this.index.values())t.push(i.import(e));return Promise.all(t)}break;case"tag":this.tag=ge(t,this.tag);break;case"doc":this.store=fe(t,this.store)}}},B(ce.prototype),Oe.prototype.remove=function(e,t){const i=this.reg.size&&(this.fastupdate?this.reg.get(e):this.reg.has(e));if(i){if(this.fastupdate){for(let t,n,r=0;r<i.length;r++)if((t=i[r])&&(n=t.length))if(t[n-1]===e)t.pop();else{const i=t.indexOf(e);i>=0&&t.splice(i,1)}}else Se(this.map,e),this.depth&&Se(this.ctx,e);t||this.reg.delete(e)}return this.db&&(this.commit_task.push({del:e}),this.M&&Ae(this)),this.cache&&this.cache.remove(e),this};const _e={memory:{resolution:1},performance:{resolution:3,fastupdate:!0,context:{depth:1,resolution:1}},match:{tokenize:"forward"},score:{resolution:9,context:{depth:2,resolution:3}}};function Ce(e,t,i,n,r,s,o){let l,c;if(!(l=t[i])||o&&!l[o]){if(o?((t=l||(t[i]=a()))[o]=1,c=e.ctx,(l=c.get(o))?c=l:c.set(o,c=e.keystore?new A(e.keystore):new Map)):(c=e.map,t[i]=1),(l=c.get(i))?c=l:c.set(i,c=l=[]),s)for(let i,s=0;s<l.length;s++)if((i=l[s])&&i.includes(r)){if(s<=n)return;i.splice(i.indexOf(r),1),e.fastupdate&&(t=e.reg.get(r))&&t.splice(t.indexOf(i),1);break}if(c=c[n]||(c[n]=[]),c.push(r),c.length===2**31-1){if(t=new O(c),e.fastupdate)for(let i of e.reg.values())i.includes(c)&&(i[i.indexOf(c)]=t);l[n]=c=t}e.fastupdate&&((n=e.reg.get(r))?n.push(c):e.reg.set(r,[c]))}}function Ee(e,t,i,n,r){return i&&e>1?t+(n||0)<=e?i+(r||0):(e-1)/(t+(n||0))*(i+(r||0))+1|0:0}function we(e,t,i,n,r,s,o){let a=e.length,l=e;if(a>1)l=ne(e,t,i,n,r,s,o);else if(1===a)return o?V.call(null,e[0],i,n):new te(e[0],this);return o?l:new te(l,this)}function Te(e,t,i,n,r,s,o){return e=Re(this,e,t,i,n,r,s,o),this.db?e.then(function(e){return r?e||[]:new te(e,this)}):e&&e.length?r?V.call(this,e,i,n):new te(e,this):r?[]:new te([],this)}function ke(e,t,i,n){let r=[];if(e&&e.length){if(e.length<=n)return void t.push(e);for(let t,i=0;i<n;i++)(t=e[i])&&(r[i]=t);if(r.length)return void t.push(r)}if(!i)return r}function Re(e,t,i,n,r,s,o,a){let l;return i&&(l=e.bidirectional&&t>i)&&(l=i,i=t,t=l),e.db?e.db.get(t,i,n,r,s,o,a):e=i?(e=e.ctx.get(i))&&e.get(t):e.map.get(t)}function Oe(e,t){if(!this||this.constructor!==Oe)return new Oe(e);if(e){var i=l(e)?e:e.preset;i&&(e=Object.assign({},_e[i],e))}else e={};const n=!0===(i=e.context)?{depth:1}:i||{},r=l(e.encoder)?k[e.encoder]:e.encode||e.encoder||{};this.encoder=r.encode?r:"object"==typeof r?new m(r):{encode:r},this.resolution=e.resolution||9,this.tokenize=i=(i=e.tokenize)&&"default"!==i&&"exact"!==i&&i||"strict",this.depth="strict"===i&&n.depth||0,this.bidirectional=!1!==n.bidirectional,this.fastupdate=!!e.fastupdate,this.score=e.score||null,(i=e.keystore||0)&&(this.keystore=i),this.map=i?new A(i):new Map,this.ctx=i?new A(i):new Map,this.reg=t||(this.fastupdate?i?new A(i):new Map:i?new P(i):new Set),this.N=n.resolution||3,this.rtl=r.rtl||e.rtl||!1,this.cache=(i=e.cache||null)&&new b(i),this.resolve=!1!==e.resolve,(i=e.db)&&(this.db=this.mount(i)),this.M=!1!==e.commit,this.commit_task=[],this.commit_timer=null,this.priority=e.priority||4}function Ae(e){e.commit_timer||(e.commit_timer=setTimeout(function(){e.commit_timer=null,e.db.commit(e)},1))}Oe.prototype.add=function(e,t,i,n){if(t&&(e||0===e)){if(!n&&!i&&this.reg.has(e))return this.update(e,t);n=this.depth;const u=(t=this.encoder.encode(t,!n)).length;if(u){const h=a(),d=a(),f=this.resolution;for(let a=0;a<u;a++){let p=t[this.rtl?u-1-a:a];var r=p.length;if(r&&(n||!d[p])){var s=this.score?this.score(t,p,a,null,0):Ee(f,u,a),o="";switch(this.tokenize){case"tolerant":if(Ce(this,d,p,s,e,i),r>2){for(let t,n,a,l,c=1;c<r-1;c++)t=p.charAt(c),n=p.charAt(c+1),a=p.substring(0,c)+n,l=p.substring(c+2),Ce(this,d,o=a+t+l,s,e,i),Ce(this,d,o=a+l,s,e,i);Ce(this,d,p.substring(0,p.length-1),s,e,i)}break;case"full":if(r>2){for(let n,c=0;c<r;c++)for(s=r;s>c;s--){o=p.substring(c,s),n=this.rtl?r-1-c:c;var l=this.score?this.score(t,p,a,o,n):Ee(f,u,a,r,n);Ce(this,d,o,l,e,i)}break}case"bidirectional":case"reverse":if(r>1){for(l=r-1;l>0;l--){o=p[this.rtl?r-1-l:l]+o;var c=this.score?this.score(t,p,a,o,l):Ee(f,u,a,r,l);Ce(this,d,o,c,e,i)}o=""}case"forward":if(r>1){for(l=0;l<r;l++)Ce(this,d,o+=p[this.rtl?r-1-l:l],s,e,i);break}default:if(Ce(this,d,p,s,e,i),n&&u>1&&a<u-1)for(r=this.N,o=p,s=Math.min(n+1,this.rtl?a+1:u-a),l=1;l<s;l++){p=t[this.rtl?u-1-a-l:a+l];Ce(this,h,(c=this.bidirectional&&p>o)?o:p,this.score?this.score(t,o,a,p,l-1):Ee(r+(u/2>r?0:1),u,a,s-1,l-1),e,i,c?p:o)}}}}this.fastupdate||this.reg.add(e)}}return this.db&&(this.commit_task.push(i?{ins:e}:{del:e}),this.M&&Ae(this)),this},Oe.prototype.search=function(e,t,i){if(i||(t||"object"!=typeof e?"object"==typeof t&&(i=t,t=0):(i=e,e="")),i&&i.cache)return i.cache=!1,e=this.searchCache(e,t,i),i.cache=!0,e;let n,r,s,o,l,c,u,h,d=[],f=0;i&&(e=i.query||e,t=i.limit||t,f=i.offset||0,r=i.context,s=i.suggest,h=(o=i.resolve)&&i.enrich,c=i.boost,u=i.resolution,l=this.db&&i.tag),void 0===o&&(o=this.resolve),r=this.depth&&!1!==r;let p=this.encoder.encode(e,!r);if(n=p.length,t=t||(o?100:0),1===n)return Te.call(this,p[0],"",t,f,o,h,l);if(2===n&&r&&!s)return Te.call(this,p[1],p[0],t,f,o,h,l);let g,m=a(),v=0;if(r&&(g=p[0],v=1),u||0===u||(u=g?this.N:this.resolution),this.db){if(this.db.search&&!1!==(i=this.db.search(this,p,t,f,s,o,h,l)))return i;const e=this;return async function(){for(let t,i;v<n;v++){if((i=p[v])&&!m[i]){if(m[i]=1,t=await Re(e,i,g,0,0,!1,!1),t=ke(t,d,s,u)){d=t;break}g&&(s&&t&&d.length||(g=i))}s&&g&&v===n-1&&!d.length&&(u=e.resolution,g="",v=-1,m=a())}return we(d,u,t,f,s,c,o)}()}for(let e,t;v<n;v++){if((t=p[v])&&!m[t]){if(m[t]=1,e=Re(this,t,g,0,0,!1,!1),e=ke(e,d,s,u)){d=e;break}g&&(s&&e&&d.length||(g=t))}s&&g&&v===n-1&&!d.length&&(u=this.resolution,g="",v=-1,m=a())}return we(d,u,t,f,s,c,o)},(r=Oe.prototype).mount=function(e){return this.commit_timer&&(clearTimeout(this.commit_timer),this.commit_timer=null),e.mount(this)},r.commit=function(){return this.commit_timer&&(clearTimeout(this.commit_timer),this.commit_timer=null),this.db.commit(this)},r.destroy=function(){return this.commit_timer&&(clearTimeout(this.commit_timer),this.commit_timer=null),this.db.destroy()},r.clear=function(){return this.map.clear(),this.ctx.clear(),this.reg.clear(),this.cache&&this.cache.clear(),this.db?(this.commit_timer&&clearTimeout(this.commit_timer),this.commit_timer=null,this.commit_task=[],this.db.clear()):this},r.append=function(e,t){return this.add(e,t,!0)},r.contain=function(e){return this.db?this.db.has(e):this.reg.has(e)},r.update=function(e,t){const i=this,n=this.remove(e);return n&&n.then?n.then(()=>i.add(e,t)):this.add(e,t)},r.cleanup=function(){return this.fastupdate?(Se(this.map),this.depth&&Se(this.ctx),this):this},r.searchCache=y,r.export=function(e,t,i=0,n=0){let r,s;switch(n){case 0:r="reg",s=me(this.reg);break;case 1:r="cfg",s=null;break;case 2:r="map",s=de(this.map,this.reg.size);break;case 3:r="ctx",s=pe(this.ctx,this.reg.size);break;default:return}return ye.call(this,e,t,r,s,i,n)},r.import=function(e,t){if(t)switch("string"==typeof t&&(t=JSON.parse(t)),e=e.split("."),"json"===e[e.length-1]&&e.pop(),3===e.length&&e.shift(),e=e.length>1?e[1]:e[0],e){case"reg":this.fastupdate=!1,this.reg=ve(t,this.reg);break;case"map":this.map=fe(t,this.map);break;case"ctx":this.ctx=ge(t,this.ctx)}},r.serialize=function(e=!0){let t="",i="",n="";if(this.reg.size){let e;for(var r of this.reg.keys())e||(e=typeof r),t+=(t?",":"")+("string"===e?'"'+r+'"':r);t="index.reg=new Set(["+t+"]);",i=be(this.map,e),i="index.map=new Map(["+i+"]);";for(const t of this.ctx.entries()){r=t[0];let i=be(t[1],e);i="new Map(["+i+"])",i='["'+r+'",'+i+"]",n+=(n?",":"")+i}n="index.ctx=new Map(["+n+"]);"}return e?"function inject(index){"+t+i+n+"}":t+i+n},B(Oe.prototype);const Pe="undefined"!=typeof window&&(window.indexedDB||window.mozIndexedDB||window.webkitIndexedDB||window.msIndexedDB),Ne=["map","ctx","tag","reg","cfg"],xe=a();function Ie(e,t={}){if(!this||this.constructor!==Ie)return new Ie(e,t);"object"==typeof e&&(t=e,e=e.name),e||console.info("Default storage space was used, because a name was not passed."),this.id="flexsearch"+(e?":"+e.toLowerCase().replace(/[^a-z0-9_\-]/g,""):""),this.field=t.field?t.field.toLowerCase().replace(/[^a-z0-9_\-]/g,""):"",this.type=t.type,this.fastupdate=this.support_tag_search=!1,this.db=null,this.h={}}function Me(e,t,i){const n=e.value;let r,s=0;for(let e,o=0;o<n.length;o++){if(e=i?n:n[o]){for(let i,s,a=0;a<t.length;a++)if(s=t[a],i=e.indexOf(s),i>=0){if(r=1,!(e.length>1)){n[o]=[];break}e.splice(i,1)}s+=e.length}if(i)break}s?r&&e.update(n):e.delete(),e.continue()}function Le(e,t){return new Promise((i,n)=>{e.onsuccess=e.oncomplete=function(){t&&t(this.result),t=null,i(this.result)},e.onerror=e.onblocked=n,e=null})}(r=Ie.prototype).mount=function(e){return e.index?e.mount(this):(e.db=this,this.open())},r.open=function(){if(this.db)return this.db;let e=this;navigator.storage&&navigator.storage.persist&&navigator.storage.persist(),xe[e.id]||(xe[e.id]=[]),xe[e.id].push(e.field);const t=Pe.open(e.id,1);return t.onupgradeneeded=function(){const t=e.db=this.result;for(let i,n=0;n<Ne.length;n++){i=Ne[n];for(let n,r=0;r<xe[e.id].length;r++)n=xe[e.id][r],t.objectStoreNames.contains(i+("reg"!==i&&n?":"+n:""))||t.createObjectStore(i+("reg"!==i&&n?":"+n:""))}},e.db=Le(t,function(t){e.db=t,e.db.onversionchange=function(){e.close()}})},r.close=function(){this.db&&this.db.close(),this.db=null},r.destroy=function(){return Le(Pe.deleteDatabase(this.id))},r.clear=function(){const e=[];for(let t,i=0;i<Ne.length;i++){t=Ne[i];for(let i,n=0;n<xe[this.id].length;n++)i=xe[this.id][n],e.push(t+("reg"!==t&&i?":"+i:""))}const t=this.db.transaction(e,"readwrite");for(let i=0;i<e.length;i++)t.objectStore(e[i]).clear();return Le(t)},r.get=function(e,t,i=0,n=0,r=!0,s=!1){e=this.db.transaction((t?"ctx":"map")+(this.field?":"+this.field:""),"readonly").objectStore((t?"ctx":"map")+(this.field?":"+this.field:"")).get(t?t+":"+e:e);const o=this;return Le(e).then(function(e){let t=[];if(!e||!e.length)return t;if(r){if(!i&&!n&&1===e.length)return e[0];for(let r,s=0;s<e.length;s++)if((r=e[s])&&r.length){if(n>=r.length){n-=r.length;continue}const e=i?n+Math.min(r.length-n,i):r.length;for(let i=n;i<e;i++)t.push(r[i]);if(n=0,t.length===i)break}return s?o.enrich(t):t}return e})},r.tag=function(e,t=0,i=0,n=!1){e=this.db.transaction("tag"+(this.field?":"+this.field:""),"readonly").objectStore("tag"+(this.field?":"+this.field:"")).get(e);const r=this;return Le(e).then(function(e){return!e||!e.length||i>=e.length?[]:t||i?(e=e.slice(i,i+t),n?r.enrich(e):e):e})},r.enrich=function(e){"object"!=typeof e&&(e=[e]);const t=this.db.transaction("reg","readonly").objectStore("reg"),i=[];for(let n=0;n<e.length;n++)i[n]=Le(t.get(e[n]));return Promise.all(i).then(function(t){for(let i=0;i<t.length;i++)t[i]={id:e[i],doc:t[i]?JSON.parse(t[i]):null};return t})},r.has=function(e){return Le(e=this.db.transaction("reg","readonly").objectStore("reg").getKey(e)).then(function(e){return!!e})},r.search=null,r.info=function(){},r.transaction=function(e,t,i){e+="reg"!==e&&this.field?":"+this.field:"";let n=this.h[e+":"+t];if(n)return i.call(this,n);let r=this.db.transaction(e,t);this.h[e+":"+t]=n=r.objectStore(e);const s=i.call(this,n);return this.h[e+":"+t]=null,Le(r).finally(function(){return s})},r.commit=async function(e){let t=e.commit_task,i=[];e.commit_task=[];for(let e,n=0;n<t.length;n++)e=t[n],e.del&&i.push(e.del);i.length&&await this.remove(i),e.reg.size&&(await this.transaction("map","readwrite",function(t){for(const i of e.map){const e=i[0],n=i[1];n.length&&(t.get(e).onsuccess=function(){let i=this.result;var r;if(i&&i.length){const e=Math.max(i.length,n.length);for(let t,s,o=0;o<e;o++)if((s=n[o])&&s.length){if((t=i[o])&&t.length)for(r=0;r<s.length;r++)t.push(s[r]);else i[o]=s;r=1}}else i=n,r=1;r&&t.put(i,e)})}}),await this.transaction("ctx","readwrite",function(t){for(const i of e.ctx){const e=i[0],n=i[1];for(const i of n){const n=i[0],r=i[1];r.length&&(t.get(e+":"+n).onsuccess=function(){let i=this.result;var s;if(i&&i.length){const e=Math.max(i.length,r.length);for(let t,n,o=0;o<e;o++)if((n=r[o])&&n.length){if((t=i[o])&&t.length)for(s=0;s<n.length;s++)t.push(n[s]);else i[o]=n;s=1}}else i=r,s=1;s&&t.put(i,e+":"+n)})}}}),e.store?await this.transaction("reg","readwrite",function(t){for(const i of e.store){const e=i[0],n=i[1];t.put("object"==typeof n?JSON.stringify(n):1,e)}}):e.bypass||await this.transaction("reg","readwrite",function(t){for(const i of e.reg.keys())t.put(1,i)}),e.tag&&await this.transaction("tag","readwrite",function(t){for(const i of e.tag){const e=i[0],n=i[1];n.length&&(t.get(e).onsuccess=function(){let i=this.result;i=i&&i.length?i.concat(n):n,t.put(i,e)})}}),e.map.clear(),e.ctx.clear(),e.tag&&e.tag.clear(),e.store&&e.store.clear(),e.document||e.reg.clear())},r.remove=function(e){return"object"!=typeof e&&(e=[e]),Promise.all([this.transaction("map","readwrite",function(t){t.openCursor().onsuccess=function(){const t=this.result;t&&Me(t,e)}}),this.transaction("ctx","readwrite",function(t){t.openCursor().onsuccess=function(){const t=this.result;t&&Me(t,e)}}),this.transaction("tag","readwrite",function(t){t.openCursor().onsuccess=function(){const t=this.result;t&&Me(t,e,!0)}}),this.transaction("reg","readwrite",function(t){for(let i=0;i<e.length;i++)t.delete(e[i])})])};const De={Index:Oe,Charset:k,Encoder:m,Document:ce,Worker:W,Resolver:te,IndexedDB:Ie,Language:{}},je=void 0!==n?n:"undefined"!=typeof global?global:n;let Fe;(Fe=je.define)&&Fe.amd?Fe([],function(){return De}):"object"==typeof je.exports?je.exports=De:je.FlexSearch=De}(this||self)},2170(e,t,i){e.exports=i(9896).constants||i(9140)},2017(e,t,i){try{var n=i(9023);if("function"!=typeof n.inherits)throw"";e.exports=n.inherits}catch(t){e.exports=i(6698)}},6698(e){"function"==typeof Object.create?e.exports=function(e,t){t&&(e.super_=t,e.prototype=Object.create(t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}))}:e.exports=function(e,t){if(t){e.super_=t;var i=function(){};i.prototype=t.prototype,e.prototype=new i,e.prototype.constructor=e}}},2880(e,t,i){let n,r={};r.__wbindgen_placeholder__=e.exports;const{TextDecoder:s,TextEncoder:o}=i(9023);let a=null;function l(){return null!==a&&0!==a.byteLength||(a=new Uint8Array(n.memory.buffer)),a}let c=new s("utf-8",{ignoreBOM:!0,fatal:!0});function u(e,t){return function(e,t){return c.decode(l().subarray(e,e+t))}(e>>>=0,t)}function h(e){const t=typeof e;if("number"==t||"boolean"==t||null==e)return`${e}`;if("string"==t)return`"${e}"`;if("symbol"==t){const t=e.description;return null==t?"Symbol":`Symbol(${t})`}if("function"==t){const t=e.name;return"string"==typeof t&&t.length>0?`Function(${t})`:"Function"}if(Array.isArray(e)){const t=e.length;let i="[";t>0&&(i+=h(e[0]));for(let n=1;n<t;n++)i+=", "+h(e[n]);return i+="]",i}const i=/\[object ([^\]]+)\]/.exec(toString.call(e));let n;if(!(i&&i.length>1))return toString.call(e);if(n=i[1],"Object"==n)try{return"Object("+JSON.stringify(e)+")"}catch(e){return"Object"}return e instanceof Error?`${e.name}: ${e.message}\n${e.stack}`:n}c.decode();let d=0;const f=new o("utf-8"),p="function"==typeof f.encodeInto?function(e,t){return f.encodeInto(e,t)}:function(e,t){const i=f.encode(e);return t.set(i),{read:e.length,written:i.length}};function g(e,t,i){if(void 0===i){const i=f.encode(e),n=t(i.length,1)>>>0;return l().subarray(n,n+i.length).set(i),d=i.length,n}let n=e.length,r=t(n,1)>>>0;const s=l();let o=0;for(;o<n;o++){const t=e.charCodeAt(o);if(t>127)break;s[r+o]=t}if(o!==n){0!==o&&(e=e.slice(o)),r=i(r,n,n=o+3*e.length,1)>>>0;const t=l().subarray(r+o,r+n);o+=p(e,t).written,r=i(r,n,o,1)>>>0}return d=o,r}let m=null;function v(){return(null===m||!0===m.buffer.detached||void 0===m.buffer.detached&&m.buffer!==n.memory.buffer)&&(m=new DataView(n.memory.buffer)),m}function y(e){return null==e}function b(e,t){e>>>=0;const i=v(),r=[];for(let s=e;s<e+4*t;s+=4)r.push(n.__wbindgen_export_2.get(i.getUint32(s,!0)));return n.__externref_drop_slice(e,t),r}function S(e){const t=n.__wbindgen_export_2.get(e);return n.__externref_table_dealloc(e),t}e.exports.cut=function(e,t){const i=g(e,n.__wbindgen_malloc,n.__wbindgen_realloc),r=d,s=n.cut(i,r,y(t)?16777215:t?1:0);var o=b(s[0],s[1]).slice();return n.__wbindgen_free(s[0],4*s[1],4),o},e.exports.cut_all=function(e){const t=g(e,n.__wbindgen_malloc,n.__wbindgen_realloc),i=d,r=n.cut_all(t,i);var s=b(r[0],r[1]).slice();return n.__wbindgen_free(r[0],4*r[1],4),s},e.exports.cut_for_search=function(e,t){const i=g(e,n.__wbindgen_malloc,n.__wbindgen_realloc),r=d,s=n.cut_for_search(i,r,y(t)?16777215:t?1:0);var o=b(s[0],s[1]).slice();return n.__wbindgen_free(s[0],4*s[1],4),o},e.exports.tokenize=function(e,t,i){const r=g(e,n.__wbindgen_malloc,n.__wbindgen_realloc),s=d,o=g(t,n.__wbindgen_malloc,n.__wbindgen_realloc),a=d,l=n.tokenize(r,s,o,a,y(i)?16777215:i?1:0);if(l[3])throw S(l[2]);var c=b(l[0],l[1]).slice();return n.__wbindgen_free(l[0],4*l[1],4),c},e.exports.add_word=function(e,t,i){const r=g(e,n.__wbindgen_malloc,n.__wbindgen_realloc),s=d;var o=y(i)?0:g(i,n.__wbindgen_malloc,n.__wbindgen_realloc),a=d;return n.add_word(r,s,y(t)?4294967297:t>>>0,o,a)>>>0},e.exports.tag=function(e,t){const i=g(e,n.__wbindgen_malloc,n.__wbindgen_realloc),r=d,s=n.tag(i,r,y(t)?16777215:t?1:0);var o=b(s[0],s[1]).slice();return n.__wbindgen_free(s[0],4*s[1],4),o},e.exports.with_dict=function(e){const t=g(e,n.__wbindgen_malloc,n.__wbindgen_realloc),i=d,r=n.with_dict(t,i);if(r[1])throw S(r[0])},e.exports.__wbg_Error_0497d5bdba9362e5=function(e,t){return Error(u(e,t))},e.exports.__wbg_new_07b483f72211fd66=function(){return new Object},e.exports.__wbg_set_3f1d0b984ed272ed=function(e,t,i){e[t]=i},e.exports.__wbindgen_bigint_from_u64=function(e){return BigInt.asUintN(64,e)},e.exports.__wbindgen_debug_string=function(e,t){const i=g(h(t),n.__wbindgen_malloc,n.__wbindgen_realloc),r=d;v().setInt32(e+4,r,!0),v().setInt32(e+0,i,!0)},e.exports.__wbindgen_init_externref_table=function(){const e=n.__wbindgen_export_2,t=e.grow(4);e.set(0,void 0),e.set(t+0,void 0),e.set(t+1,null),e.set(t+2,!0),e.set(t+3,!1)},e.exports.__wbindgen_number_new=function(e){return e},e.exports.__wbindgen_string_new=function(e,t){return u(e,t)},e.exports.__wbindgen_throw=function(e,t){throw new Error(u(e,t))};const _=i(6928).join(__dirname,"jieba_rs_wasm_bg.wasm"),C=i(9896).readFileSync(_),E=new WebAssembly.Module(C),w=new WebAssembly.Instance(E,r);n=w.exports,e.exports.__wasm=n,n.__wbindgen_start()},2028(e){var t="[object Symbol]",i=/[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g,n=/[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g,r="\\ud800-\\udfff",s="\\u0300-\\u036f\\ufe20-\\ufe23",o="\\u20d0-\\u20f0",a="\\u2700-\\u27bf",l="a-z\\xdf-\\xf6\\xf8-\\xff",c="A-Z\\xc0-\\xd6\\xd8-\\xde",u="\\ufe0e\\ufe0f",h="\\xac\\xb1\\xd7\\xf7\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf\\u2000-\\u206f \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000",d="['’]",f="["+r+"]",p="["+h+"]",g="["+s+o+"]",m="\\d+",v="["+a+"]",y="["+l+"]",b="[^"+r+h+m+a+l+c+"]",S="\\ud83c[\\udffb-\\udfff]",_="[^"+r+"]",C="(?:\\ud83c[\\udde6-\\uddff]){2}",E="[\\ud800-\\udbff][\\udc00-\\udfff]",w="["+c+"]",T="\\u200d",k="(?:"+y+"|"+b+")",R="(?:"+w+"|"+b+")",O="(?:['’](?:d|ll|m|re|s|t|ve))?",A="(?:['’](?:D|LL|M|RE|S|T|VE))?",P="(?:"+g+"|"+S+")"+"?",N="["+u+"]?",x=N+P+("(?:"+T+"(?:"+[_,C,E].join("|")+")"+N+P+")*"),I="(?:"+[v,C,E].join("|")+")"+x,M="(?:"+[_+g+"?",g,C,E,f].join("|")+")",L=RegExp(d,"g"),D=RegExp(g,"g"),j=RegExp(S+"(?="+S+")|"+M+x,"g"),F=RegExp([w+"?"+y+"+"+O+"(?="+[p,w,"$"].join("|")+")",R+"+"+A+"(?="+[p,w+k,"$"].join("|")+")",w+"?"+k+"+"+O,w+"+"+A,m,I].join("|"),"g"),B=RegExp("["+T+r+s+o+u+"]"),U=/[a-z][A-Z]|[A-Z]{2,}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/,z="object"==typeof global&&global&&global.Object===Object&&global,H="object"==typeof self&&self&&self.Object===Object&&self,W=z||H||Function("return this")();var q,$=(q={À:"A",Á:"A",Â:"A",Ã:"A",Ä:"A",Å:"A",à:"a",á:"a",â:"a",ã:"a",ä:"a",å:"a",Ç:"C",ç:"c",Ð:"D",ð:"d",È:"E",É:"E",Ê:"E",Ë:"E",è:"e",é:"e",ê:"e",ë:"e",Ì:"I",Í:"I",Î:"I",Ï:"I",ì:"i",í:"i",î:"i",ï:"i",Ñ:"N",ñ:"n",Ò:"O",Ó:"O",Ô:"O",Õ:"O",Ö:"O",Ø:"O",ò:"o",ó:"o",ô:"o",õ:"o",ö:"o",ø:"o",Ù:"U",Ú:"U",Û:"U",Ü:"U",ù:"u",ú:"u",û:"u",ü:"u",Ý:"Y",ý:"y",ÿ:"y",Æ:"Ae",æ:"ae",Þ:"Th",þ:"th",ß:"ss",Ā:"A",Ă:"A",Ą:"A",ā:"a",ă:"a",ą:"a",Ć:"C",Ĉ:"C",Ċ:"C",Č:"C",ć:"c",ĉ:"c",ċ:"c",č:"c",Ď:"D",Đ:"D",ď:"d",đ:"d",Ē:"E",Ĕ:"E",Ė:"E",Ę:"E",Ě:"E",ē:"e",ĕ:"e",ė:"e",ę:"e",ě:"e",Ĝ:"G",Ğ:"G",Ġ:"G",Ģ:"G",ĝ:"g",ğ:"g",ġ:"g",ģ:"g",Ĥ:"H",Ħ:"H",ĥ:"h",ħ:"h",Ĩ:"I",Ī:"I",Ĭ:"I",Į:"I",İ:"I",ĩ:"i",ī:"i",ĭ:"i",į:"i",ı:"i",Ĵ:"J",ĵ:"j",Ķ:"K",ķ:"k",ĸ:"k",Ĺ:"L",Ļ:"L",Ľ:"L",Ŀ:"L",Ł:"L",ĺ:"l",ļ:"l",ľ:"l",ŀ:"l",ł:"l",Ń:"N",Ņ:"N",Ň:"N",Ŋ:"N",ń:"n",ņ:"n",ň:"n",ŋ:"n",Ō:"O",Ŏ:"O",Ő:"O",ō:"o",ŏ:"o",ő:"o",Ŕ:"R",Ŗ:"R",Ř:"R",ŕ:"r",ŗ:"r",ř:"r",Ś:"S",Ŝ:"S",Ş:"S",Š:"S",ś:"s",ŝ:"s",ş:"s",š:"s",Ţ:"T",Ť:"T",Ŧ:"T",ţ:"t",ť:"t",ŧ:"t",Ũ:"U",Ū:"U",Ŭ:"U",Ů:"U",Ű:"U",Ų:"U",ũ:"u",ū:"u",ŭ:"u",ů:"u",ű:"u",ų:"u",Ŵ:"W",ŵ:"w",Ŷ:"Y",ŷ:"y",Ÿ:"Y",Ź:"Z",Ż:"Z",Ž:"Z",ź:"z",ż:"z",ž:"z",IJ:"IJ",ij:"ij",Œ:"Oe",œ:"oe",ʼn:"'n",ſ:"ss"},function(e){return null==q?void 0:q[e]});function G(e){return B.test(e)}function V(e){return G(e)?function(e){return e.match(j)||[]}(e):function(e){return e.split("")}(e)}var Y=Object.prototype.toString,K=W.Symbol,J=K?K.prototype:void 0,X=J?J.toString:void 0;function Q(e){if("string"==typeof e)return e;if(function(e){return"symbol"==typeof e||function(e){return!!e&&"object"==typeof e}(e)&&Y.call(e)==t}(e))return X?X.call(e):"";var i=e+"";return"0"==i&&1/e==-1/0?"-0":i}function Z(e,t,i){var n=e.length;return i=void 0===i?n:i,!t&&i>=n?e:function(e,t,i){var n=-1,r=e.length;t<0&&(t=-t>r?0:r+t),(i=i>r?r:i)<0&&(i+=r),r=t>i?0:i-t>>>0,t>>>=0;for(var s=Array(r);++n<r;)s[n]=e[n+t];return s}(e,t,i)}function ee(e){return null==e?"":Q(e)}var te,ie=(te=function(e,t,i){return t=t.toLowerCase(),e+(i?re(ee(t).toLowerCase()):t)},function(e){return function(e,t,i,n){var r=-1,s=e?e.length:0;for(n&&s&&(i=e[++r]);++r<s;)i=t(i,e[r],r,e);return i}(function(e,t,n){return e=ee(e),void 0===(t=n?void 0:t)?function(e){return U.test(e)}(e)?function(e){return e.match(F)||[]}(e):function(e){return e.match(i)||[]}(e):e.match(t)||[]}(function(e){return(e=ee(e))&&e.replace(n,$).replace(D,"")}(e).replace(L,"")),te,"")});var ne,re=(ne="toUpperCase",function(e){var t=G(e=ee(e))?V(e):void 0,i=t?t[0]:e.charAt(0),n=t?Z(t,1).join(""):e.slice(1);return i[ne]()+n});e.exports=ie},9505(e,t,i){var n=i(6928),r=i(9896),s=parseInt("0777",8);function o(e,t,i,a){"function"==typeof t?(i=t,t={}):t&&"object"==typeof t||(t={mode:t});var l=t.mode,c=t.fs||r;void 0===l&&(l=s&~process.umask()),a||(a=null);var u=i||function(){};e=n.resolve(e),c.mkdir(e,l,function(i){if(!i)return u(null,a=a||e);if("ENOENT"===i.code)o(n.dirname(e),t,function(i,n){i?u(i,n):o(e,t,u,n)});else c.stat(e,function(e,t){e||!t.isDirectory()?u(i,a):u(null,a)})})}e.exports=o.mkdirp=o.mkdirP=o,o.sync=function e(t,i,o){i&&"object"==typeof i||(i={mode:i});var a=i.mode,l=i.fs||r;void 0===a&&(a=s&~process.umask()),o||(o=null),t=n.resolve(t);try{l.mkdirSync(t,a),o=o||t}catch(r){if("ENOENT"===r.code)o=e(n.dirname(t),i,o),e(t,i,o);else{var c;try{c=l.statSync(t)}catch(e){throw r}if(!c.isDirectory())throw r}}return o}},3519(e,t,i){var n=i(6587);function r(e){var t=function(){return t.called?t.value:(t.called=!0,t.value=e.apply(this,arguments))};return t.called=!1,t}function s(e){var t=function(){if(t.called)throw new Error(t.onceError);return t.called=!0,t.value=e.apply(this,arguments)},i=e.name||"Function wrapped with `once`";return t.onceError=i+" shouldn't be called more than once",t.called=!1,t}e.exports=n(r),e.exports.strict=n(s),r.proto=r(function(){Object.defineProperty(Function.prototype,"once",{value:function(){return r(this)},configurable:!0}),Object.defineProperty(Function.prototype,"onceStrict",{value:function(){return s(this)},configurable:!0})})},5407(e,t,i){"use strict";var n=i(2549);e.exports=t=n.descriptor=n.Root.fromJSON(i(3951)).lookup(".google.protobuf");var r=n.Namespace,s=n.Root,o=n.Enum,a=n.Type,l=n.Field,c=n.MapField,u=n.OneOf,h=n.Service,d=n.Method;function f(e,i,n){var c=t.FileDescriptorProto.create({name:e.filename||(e.fullName.substring(1).replace(/\./g,"_")||"root")+".proto"});!function(e,i){if(!e)return;if("proto2"===e||"proto3"===e)i.syntax=e;else{if(i.syntax="editions","2023"!==e)throw new Error("Unsupported edition "+e);i.edition=t.Edition.EDITION_2023}}(n,c),e instanceof s||(c.package=e.fullName.substring(1));for(var u,d=0;d<e.nestedArray.length;++d)(u=e._nestedArray[d])instanceof a?c.messageType.push(u.toDescriptor(n)):u instanceof o?c.enumType.push(u.toDescriptor()):u instanceof l?c.extension.push(u.toDescriptor(n)):u instanceof h?c.service.push(u.toDescriptor()):u instanceof r&&f(u,i,n);c.options=w(e.options,t.FileOptions),c.messageType.length+c.enumType.length+c.extension.length+c.service.length&&i.push(c)}s.fromDescriptor=function(e){"number"==typeof e.length&&(e=t.FileDescriptorSet.decode(e));var i=new s;if(e.file)for(var n,r,c,u=0;u<e.file.length;++u){r=i,(n=e.file[u]).package&&n.package.length&&(r=i.define(n.package));var d=R(n);if(n.name&&n.name.length&&i.files.push(r.filename=n.name),n.messageType)for(c=0;c<n.messageType.length;++c)r.add(a.fromDescriptor(n.messageType[c],d));if(n.enumType)for(c=0;c<n.enumType.length;++c)r.add(o.fromDescriptor(n.enumType[c],d));if(n.extension)for(c=0;c<n.extension.length;++c)r.add(l.fromDescriptor(n.extension[c],d));if(n.service)for(c=0;c<n.service.length;++c)r.add(h.fromDescriptor(n.service[c],d));var f=C(n.options,t.FileOptions);if(f){var p=Object.keys(f);for(c=0;c<p.length;++c)r.setOption(p[c],f[p[c]])}}return i.resolveAll()},s.prototype.toDescriptor=function(e){var i=t.FileDescriptorSet.create();return f(this,i.file,e),i};var p=0;a.fromDescriptor=function(e,i,n){"number"==typeof e.length&&(e=t.DescriptorProto.decode(e));var r,s=new a(e.name.length?e.name:"Type"+p++,C(e.options,t.MessageOptions));if(n||(s._edition=i),e.oneofDecl)for(r=0;r<e.oneofDecl.length;++r)s.add(u.fromDescriptor(e.oneofDecl[r]));if(e.field)for(r=0;r<e.field.length;++r){var c=l.fromDescriptor(e.field[r],i,!0);s.add(c),e.field[r].hasOwnProperty("oneofIndex")&&s.oneofsArray[e.field[r].oneofIndex].add(c)}if(e.extension)for(r=0;r<e.extension.length;++r)s.add(l.fromDescriptor(e.extension[r],i,!0));if(e.nestedType)for(r=0;r<e.nestedType.length;++r)s.add(a.fromDescriptor(e.nestedType[r],i,!0)),e.nestedType[r].options&&e.nestedType[r].options.mapEntry&&s.setOption("map_entry",!0);if(e.enumType)for(r=0;r<e.enumType.length;++r)s.add(o.fromDescriptor(e.enumType[r],i,!0));if(e.extensionRange&&e.extensionRange.length)for(s.extensions=[],r=0;r<e.extensionRange.length;++r)s.extensions.push([e.extensionRange[r].start,e.extensionRange[r].end]);if(e.reservedRange&&e.reservedRange.length||e.reservedName&&e.reservedName.length){if(s.reserved=[],e.reservedRange)for(r=0;r<e.reservedRange.length;++r)s.reserved.push([e.reservedRange[r].start,e.reservedRange[r].end]);if(e.reservedName)for(r=0;r<e.reservedName.length;++r)s.reserved.push(e.reservedName[r])}return s},a.prototype.toDescriptor=function(e){var i,n=t.DescriptorProto.create({name:this.name});for(i=0;i<this.fieldsArray.length;++i){var r;if(n.field.push(r=this._fieldsArray[i].toDescriptor(e)),this._fieldsArray[i]instanceof c){var s=S(this._fieldsArray[i].keyType,this._fieldsArray[i].resolvedKeyType,!1),u=S(this._fieldsArray[i].type,this._fieldsArray[i].resolvedType,!1),h=11===u||14===u?this._fieldsArray[i].resolvedType&&T(this.parent,this._fieldsArray[i].resolvedType)||this._fieldsArray[i].type:void 0;n.nestedType.push(t.DescriptorProto.create({name:r.typeName,field:[t.FieldDescriptorProto.create({name:"key",number:1,label:1,type:s}),t.FieldDescriptorProto.create({name:"value",number:2,label:1,type:u,typeName:h})],options:t.MessageOptions.create({mapEntry:!0})}))}}for(i=0;i<this.oneofsArray.length;++i)n.oneofDecl.push(this._oneofsArray[i].toDescriptor());for(i=0;i<this.nestedArray.length;++i)this._nestedArray[i]instanceof l?n.field.push(this._nestedArray[i].toDescriptor(e)):this._nestedArray[i]instanceof a?n.nestedType.push(this._nestedArray[i].toDescriptor(e)):this._nestedArray[i]instanceof o&&n.enumType.push(this._nestedArray[i].toDescriptor());if(this.extensions)for(i=0;i<this.extensions.length;++i)n.extensionRange.push(t.DescriptorProto.ExtensionRange.create({start:this.extensions[i][0],end:this.extensions[i][1]}));if(this.reserved)for(i=0;i<this.reserved.length;++i)"string"==typeof this.reserved[i]?n.reservedName.push(this.reserved[i]):n.reservedRange.push(t.DescriptorProto.ReservedRange.create({start:this.reserved[i][0],end:this.reserved[i][1]}));return n.options=w(this.options,t.MessageOptions),n};var g=/^(?![eE])[0-9]*(?:\.[0-9]*)?(?:[eE][+-]?[0-9]+)?$/;l.fromDescriptor=function(e,i,n){if("number"==typeof e.length&&(e=t.DescriptorProto.decode(e)),"number"!=typeof e.number)throw Error("missing field id");var r,s;switch(r=e.typeName&&e.typeName.length?e.typeName:function(e){switch(e){case 1:return"double";case 2:return"float";case 3:return"int64";case 4:return"uint64";case 5:return"int32";case 6:return"fixed64";case 7:return"fixed32";case 8:return"bool";case 9:return"string";case 12:return"bytes";case 13:return"uint32";case 15:return"sfixed32";case 16:return"sfixed64";case 17:return"sint32";case 18:return"sint64"}throw Error("illegal type: "+e)}(e.type),e.label){case 1:s=void 0;break;case 2:s="required";break;case 3:s="repeated";break;default:throw Error("illegal label: "+e.label)}var o=e.extendee;void 0!==e.extendee&&(o=o.length?o:void 0);var a=new l(e.name.length?e.name:"field"+e.number,e.number,r,s,o);if(n||(a._edition=i),a.options=C(e.options,t.FieldOptions),e.proto3_optional&&(a.options.proto3_optional=!0),e.defaultValue&&e.defaultValue.length){var c=e.defaultValue;switch(c){case"true":case"TRUE":c=!0;break;case"false":case"FALSE":c=!1;break;default:g.exec(c)&&(c=parseInt(c))}a.setOption("default",c)}return function(e){switch(e){case 1:case 2:case 3:case 4:case 5:case 6:case 7:case 8:case 13:case 14:case 15:case 16:case 17:case 18:return!0}return!1}(e.type)&&("proto3"===i?e.options&&!e.options.packed&&a.setOption("packed",!1):i&&"proto2"!==i||!e.options||!e.options.packed||a.setOption("packed",!0)),a},l.prototype.toDescriptor=function(e){var i=t.FieldDescriptorProto.create({name:this.name,number:this.id});if(this.map)i.type=11,i.typeName=n.util.ucFirst(this.name),i.label=3;else{switch(i.type=S(this.type,this.resolve().resolvedType,this.delimited)){case 10:case 11:case 14:i.typeName=this.resolvedType?T(this.parent,this.resolvedType):this.type}"repeated"===this.rule?i.label=3:this.required&&"proto2"===e?i.label=2:i.label=1}if(i.extendee=this.extensionField?this.extensionField.parent.fullName:this.extend,this.partOf&&(i.oneofIndex=this.parent.oneofsArray.indexOf(this.partOf))<0)throw Error("missing oneof");return this.options&&(i.options=w(this.options,t.FieldOptions),null!=this.options.default&&(i.defaultValue=String(this.options.default)),this.options.proto3_optional&&(i.proto3_optional=!0)),"proto3"===e?this.packed||((i.options||(i.options=t.FieldOptions.create())).packed=!1):e&&"proto2"!==e||!this.packed||((i.options||(i.options=t.FieldOptions.create())).packed=!0),i};var m=0;o.fromDescriptor=function(e,i,n){"number"==typeof e.length&&(e=t.EnumDescriptorProto.decode(e));var r={};if(e.value)for(var s=0;s<e.value.length;++s){var a=e.value[s].name,l=e.value[s].number||0;r[a&&a.length?a:"NAME"+l]=l}var c=new o(e.name&&e.name.length?e.name:"Enum"+m++,r,C(e.options,t.EnumOptions));return n||(c._edition=i),c},o.prototype.toDescriptor=function(){for(var e=[],i=0,n=Object.keys(this.values);i<n.length;++i)e.push(t.EnumValueDescriptorProto.create({name:n[i],number:this.values[n[i]]}));return t.EnumDescriptorProto.create({name:this.name,value:e,options:w(this.options,t.EnumOptions)})};var v=0;u.fromDescriptor=function(e){return"number"==typeof e.length&&(e=t.OneofDescriptorProto.decode(e)),new u(e.name&&e.name.length?e.name:"oneof"+v++)},u.prototype.toDescriptor=function(){return t.OneofDescriptorProto.create({name:this.name})};var y=0;h.fromDescriptor=function(e,i,n){"number"==typeof e.length&&(e=t.ServiceDescriptorProto.decode(e));var r=new h(e.name&&e.name.length?e.name:"Service"+y++,C(e.options,t.ServiceOptions));if(n||(r._edition=i),e.method)for(var s=0;s<e.method.length;++s)r.add(d.fromDescriptor(e.method[s]));return r},h.prototype.toDescriptor=function(){for(var e=[],i=0;i<this.methodsArray.length;++i)e.push(this._methodsArray[i].toDescriptor());return t.ServiceDescriptorProto.create({name:this.name,method:e,options:w(this.options,t.ServiceOptions)})};var b=0;function S(e,t,i){switch(e){case"double":return 1;case"float":return 2;case"int64":return 3;case"uint64":return 4;case"int32":return 5;case"fixed64":return 6;case"fixed32":return 7;case"bool":return 8;case"string":return 9;case"bytes":return 12;case"uint32":return 13;case"sfixed32":return 15;case"sfixed64":return 16;case"sint32":return 17;case"sint64":return 18}if(t instanceof o)return 14;if(t instanceof a)return i?10:11;throw Error("illegal type: "+e)}function _(e,t){for(var i,n,r={},s=0;s<t.fieldsArray.length;++s)if("uninterpretedOption"!==(n=(i=t._fieldsArray[s]).name)&&Object.prototype.hasOwnProperty.call(e,n)){var l=k(n);i.resolvedType instanceof a?r[l]=_(e[n],i.resolvedType):i.resolvedType instanceof o?r[l]=i.resolvedType.valuesById[e[n]]:r[l]=e[n]}return r}function C(e,t){if(e)return _(t.toObject(e),t)}function E(e,t){for(var i={},r=Object.keys(e),s=0;s<r.length;++s){var o=r[s],l=n.util.camelCase(o);if(Object.prototype.hasOwnProperty.call(t.fields,l)){var c=t.fields[l];c.resolvedType instanceof a?i[l]=E(e[o],c.resolvedType):i[l]=e[o],c.repeated&&!Array.isArray(i[l])&&(i[l]=[i[l]])}}return i}function w(e,t){if(e)return t.fromObject(E(e,t))}function T(e,t){var i=e.fullName.split("."),n=t.fullName.split("."),o=0,a=0,l=n.length-1;if(!(e instanceof s)&&t instanceof r)for(;o<i.length&&a<l&&i[o]===n[a];){var c=t.lookup(i[o++],!0);if(null!==c&&c!==t)break;++a}else for(;o<i.length&&a<l&&i[o]===n[a];++o,++a);return n.slice(a).join(".")}function k(e){return e.substring(0,1)+e.substring(1).replace(/([A-Z])(?=[a-z]|$)/g,function(e,t){return"_"+t.toLowerCase()})}function R(e){if("editions"===e.syntax){if(e.edition===t.Edition.EDITION_2023)return"2023";throw new Error("Unsupported edition "+e.edition)}return"proto3"===e.syntax?"proto3":"proto2"}d.fromDescriptor=function(e){return"number"==typeof e.length&&(e=t.MethodDescriptorProto.decode(e)),new d(e.name&&e.name.length?e.name:"Method"+b++,"rpc",e.inputType,e.outputType,Boolean(e.clientStreaming),Boolean(e.serverStreaming),C(e.options,t.MethodOptions))},d.prototype.toDescriptor=function(){return t.MethodDescriptorProto.create({name:this.name,inputType:this.resolvedRequestType?this.resolvedRequestType.fullName:this.requestType,outputType:this.resolvedResponseType?this.resolvedResponseType.fullName:this.responseType,clientStreaming:this.requestStream,serverStreaming:this.responseStream,options:w(this.options,t.MethodOptions)})}},2549(e,t,i){"use strict";e.exports=i(9100)},5095(e){"use strict";e.exports=n;var t,i=/\/|\./;function n(e,t){i.test(e)||(e="google/protobuf/"+e+".proto",t={nested:{google:{nested:{protobuf:{nested:t}}}}}),n[e]=t}n("any",{Any:{fields:{type_url:{type:"string",id:1},value:{type:"bytes",id:2}}}}),n("duration",{Duration:t={fields:{seconds:{type:"int64",id:1},nanos:{type:"int32",id:2}}}}),n("timestamp",{Timestamp:t}),n("empty",{Empty:{fields:{}}}),n("struct",{Struct:{fields:{fields:{keyType:"string",type:"Value",id:1}}},Value:{oneofs:{kind:{oneof:["nullValue","numberValue","stringValue","boolValue","structValue","listValue"]}},fields:{nullValue:{type:"NullValue",id:1},numberValue:{type:"double",id:2},stringValue:{type:"string",id:3},boolValue:{type:"bool",id:4},structValue:{type:"Struct",id:5},listValue:{type:"ListValue",id:6}}},NullValue:{values:{NULL_VALUE:0}},ListValue:{fields:{values:{rule:"repeated",type:"Value",id:1}}}}),n("wrappers",{DoubleValue:{fields:{value:{type:"double",id:1}}},FloatValue:{fields:{value:{type:"float",id:1}}},Int64Value:{fields:{value:{type:"int64",id:1}}},UInt64Value:{fields:{value:{type:"uint64",id:1}}},Int32Value:{fields:{value:{type:"int32",id:1}}},UInt32Value:{fields:{value:{type:"uint32",id:1}}},BoolValue:{fields:{value:{type:"bool",id:1}}},StringValue:{fields:{value:{type:"string",id:1}}},BytesValue:{fields:{value:{type:"bytes",id:1}}}}),n("field_mask",{FieldMask:{fields:{paths:{rule:"repeated",type:"string",id:1}}}}),n.get=function(e){return n[e]||null}},744(e,t,i){"use strict";var n=t,r=i(5643),s=i(3262);function o(e,t,i,n){var s=!1;if(t.resolvedType)if(t.resolvedType instanceof r){e("switch(d%s){",n);for(var o=t.resolvedType.values,a=Object.keys(o),l=0;l<a.length;++l)o[a[l]]!==t.typeDefault||s||(e("default:")('if(typeof(d%s)==="number"){m%s=d%s;break}',n,n,n),t.repeated||e("break"),s=!0),e("case%j:",a[l])("case %i:",o[a[l]])("m%s=%j",n,o[a[l]])("break");e("}")}else e('if(typeof d%s!=="object")',n)("throw TypeError(%j)",t.fullName+": object expected")("m%s=types[%i].fromObject(d%s)",n,i,n);else{var c=!1;switch(t.type){case"double":case"float":e("m%s=Number(d%s)",n,n);break;case"uint32":case"fixed32":e("m%s=d%s>>>0",n,n);break;case"int32":case"sint32":case"sfixed32":e("m%s=d%s|0",n,n);break;case"uint64":c=!0;case"int64":case"sint64":case"fixed64":case"sfixed64":e("if(util.Long)")("(m%s=util.Long.fromValue(d%s)).unsigned=%j",n,n,c)('else if(typeof d%s==="string")',n)("m%s=parseInt(d%s,10)",n,n)('else if(typeof d%s==="number")',n)("m%s=d%s",n,n)('else if(typeof d%s==="object")',n)("m%s=new util.LongBits(d%s.low>>>0,d%s.high>>>0).toNumber(%s)",n,n,n,c?"true":"");break;case"bytes":e('if(typeof d%s==="string")',n)("util.base64.decode(d%s,m%s=util.newBuffer(util.base64.length(d%s)),0)",n,n,n)("else if(d%s.length >= 0)",n)("m%s=d%s",n,n);break;case"string":e("m%s=String(d%s)",n,n);break;case"bool":e("m%s=Boolean(d%s)",n,n)}}return e}function a(e,t,i,n){if(t.resolvedType)t.resolvedType instanceof r?e("d%s=o.enums===String?(types[%i].values[m%s]===undefined?m%s:types[%i].values[m%s]):m%s",n,i,n,n,i,n,n):e("d%s=types[%i].toObject(m%s,o)",n,i,n);else{var s=!1;switch(t.type){case"double":case"float":e("d%s=o.json&&!isFinite(m%s)?String(m%s):m%s",n,n,n,n);break;case"uint64":s=!0;case"int64":case"sint64":case"fixed64":case"sfixed64":e('if(typeof m%s==="number")',n)("d%s=o.longs===String?String(m%s):m%s",n,n,n)("else")("d%s=o.longs===String?util.Long.prototype.toString.call(m%s):o.longs===Number?new util.LongBits(m%s.low>>>0,m%s.high>>>0).toNumber(%s):m%s",n,n,n,n,s?"true":"",n);break;case"bytes":e("d%s=o.bytes===String?util.base64.encode(m%s,0,m%s.length):o.bytes===Array?Array.prototype.slice.call(m%s):m%s",n,n,n,n,n);break;default:e("d%s=m%s",n,n)}}return e}n.fromObject=function(e){var t=e.fieldsArray,i=s.codegen(["d"],e.name+"$fromObject")("if(d instanceof this.ctor)")("return d");if(!t.length)return i("return new this.ctor");i("var m=new this.ctor");for(var n=0;n<t.length;++n){var a=t[n].resolve(),l=s.safeProp(a.name);a.map?(i("if(d%s){",l)('if(typeof d%s!=="object")',l)("throw TypeError(%j)",a.fullName+": object expected")("m%s={}",l)("for(var ks=Object.keys(d%s),i=0;i<ks.length;++i){",l),o(i,a,n,l+"[ks[i]]")("}")("}")):a.repeated?(i("if(d%s){",l)("if(!Array.isArray(d%s))",l)("throw TypeError(%j)",a.fullName+": array expected")("m%s=[]",l)("for(var i=0;i<d%s.length;++i){",l),o(i,a,n,l+"[i]")("}")("}")):(a.resolvedType instanceof r||i("if(d%s!=null){",l),o(i,a,n,l),a.resolvedType instanceof r||i("}"))}return i("return m")},n.toObject=function(e){var t=e.fieldsArray.slice().sort(s.compareFieldsById);if(!t.length)return s.codegen()("return {}");for(var i=s.codegen(["m","o"],e.name+"$toObject")("if(!o)")("o={}")("var d={}"),n=[],o=[],l=[],c=0;c<t.length;++c)t[c].partOf||(t[c].resolve().repeated?n:t[c].map?o:l).push(t[c]);if(n.length){for(i("if(o.arrays||o.defaults){"),c=0;c<n.length;++c)i("d%s=[]",s.safeProp(n[c].name));i("}")}if(o.length){for(i("if(o.objects||o.defaults){"),c=0;c<o.length;++c)i("d%s={}",s.safeProp(o[c].name));i("}")}if(l.length){for(i("if(o.defaults){"),c=0;c<l.length;++c){var u=l[c],h=s.safeProp(u.name);if(u.resolvedType instanceof r)i("d%s=o.enums===String?%j:%j",h,u.resolvedType.valuesById[u.typeDefault],u.typeDefault);else if(u.long)i("if(util.Long){")("var n=new util.Long(%i,%i,%j)",u.typeDefault.low,u.typeDefault.high,u.typeDefault.unsigned)("d%s=o.longs===String?n.toString():o.longs===Number?n.toNumber():n",h)("}else")("d%s=o.longs===String?%j:%i",h,u.typeDefault.toString(),u.typeDefault.toNumber());else if(u.bytes){var d="["+Array.prototype.slice.call(u.typeDefault).join(",")+"]";i("if(o.bytes===String)d%s=%j",h,String.fromCharCode.apply(String,u.typeDefault))("else{")("d%s=%s",h,d)("if(o.bytes!==Array)d%s=util.newBuffer(d%s)",h,h)("}")}else i("d%s=%j",h,u.typeDefault)}i("}")}var f=!1;for(c=0;c<t.length;++c){u=t[c];var p=e._fieldsArray.indexOf(u);h=s.safeProp(u.name);u.map?(f||(f=!0,i("var ks2")),i("if(m%s&&(ks2=Object.keys(m%s)).length){",h,h)("d%s={}",h)("for(var j=0;j<ks2.length;++j){"),a(i,u,p,h+"[ks2[j]]")("}")):u.repeated?(i("if(m%s&&m%s.length){",h,h)("d%s=[]",h)("for(var j=0;j<m%s.length;++j){",h),a(i,u,p,h+"[j]")("}")):(i("if(m%s!=null&&m.hasOwnProperty(%j)){",h,u.name),a(i,u,p,h),u.partOf&&i("if(o.oneofs)")("d%s=%j",s.safeProp(u.partOf.name),u.name)),i("}")}return i("return d")}},7728(e,t,i){"use strict";e.exports=function(e){for(var t=s.codegen(["r","l","e"],e.name+"$decode")("if(!(r instanceof Reader))")("r=Reader.create(r)")("var c=l===undefined?r.len:r.pos+l,m=new this.ctor"+(e.fieldsArray.filter(function(e){return e.map}).length?",k,value":""))("while(r.pos<c){")("var t=r.uint32()")("if(t===e)")("break")("switch(t>>>3){"),i=0;i<e.fieldsArray.length;++i){var a=e._fieldsArray[i].resolve(),l=a.resolvedType instanceof n?"int32":a.type,c="m"+s.safeProp(a.name);t("case %i: {",a.id),a.map?(t("if(%s===util.emptyObject)",c)("%s={}",c)("var c2 = r.uint32()+r.pos"),void 0!==r.defaults[a.keyType]?t("k=%j",r.defaults[a.keyType]):t("k=null"),void 0!==r.defaults[l]?t("value=%j",r.defaults[l]):t("value=null"),t("while(r.pos<c2){")("var tag2=r.uint32()")("switch(tag2>>>3){")("case 1: k=r.%s(); break",a.keyType)("case 2:"),void 0===r.basic[l]?t("value=types[%i].decode(r,r.uint32())",i):t("value=r.%s()",l),t("break")("default:")("r.skipType(tag2&7)")("break")("}")("}"),void 0!==r.long[a.keyType]?t('%s[typeof k==="object"?util.longToHash(k):k]=value',c):t("%s[k]=value",c)):a.repeated?(t("if(!(%s&&%s.length))",c,c)("%s=[]",c),void 0!==r.packed[l]&&t("if((t&7)===2){")("var c2=r.uint32()+r.pos")("while(r.pos<c2)")("%s.push(r.%s())",c,l)("}else"),void 0===r.basic[l]?t(a.delimited?"%s.push(types[%i].decode(r,undefined,((t&~7)|4)))":"%s.push(types[%i].decode(r,r.uint32()))",c,i):t("%s.push(r.%s())",c,l)):void 0===r.basic[l]?t(a.delimited?"%s=types[%i].decode(r,undefined,((t&~7)|4))":"%s=types[%i].decode(r,r.uint32())",c,i):t("%s=r.%s()",c,l),t("break")("}")}for(t("default:")("r.skipType(t&7)")("break")("}")("}"),i=0;i<e._fieldsArray.length;++i){var u=e._fieldsArray[i];u.required&&t("if(!m.hasOwnProperty(%j))",u.name)("throw util.ProtocolError(%j,{instance:m})",o(u))}return t("return m")};var n=i(5643),r=i(361),s=i(3262);function o(e){return"missing required '"+e.name+"'"}},1080(e,t,i){"use strict";e.exports=function(e){for(var t,i=s.codegen(["m","w"],e.name+"$encode")("if(!w)")("w=Writer.create()"),a=e.fieldsArray.slice().sort(s.compareFieldsById),l=0;l<a.length;++l){var c=a[l].resolve(),u=e._fieldsArray.indexOf(c),h=c.resolvedType instanceof n?"int32":c.type,d=r.basic[h];t="m"+s.safeProp(c.name),c.map?(i("if(%s!=null&&Object.hasOwnProperty.call(m,%j)){",t,c.name)("for(var ks=Object.keys(%s),i=0;i<ks.length;++i){",t)("w.uint32(%i).fork().uint32(%i).%s(ks[i])",(c.id<<3|2)>>>0,8|r.mapKey[c.keyType],c.keyType),void 0===d?i("types[%i].encode(%s[ks[i]],w.uint32(18).fork()).ldelim().ldelim()",u,t):i(".uint32(%i).%s(%s[ks[i]]).ldelim()",16|d,h,t),i("}")("}")):c.repeated?(i("if(%s!=null&&%s.length){",t,t),c.packed&&void 0!==r.packed[h]?i("w.uint32(%i).fork()",(c.id<<3|2)>>>0)("for(var i=0;i<%s.length;++i)",t)("w.%s(%s[i])",h,t)("w.ldelim()"):(i("for(var i=0;i<%s.length;++i)",t),void 0===d?o(i,c,u,t+"[i]"):i("w.uint32(%i).%s(%s[i])",(c.id<<3|d)>>>0,h,t)),i("}")):(c.optional&&i("if(%s!=null&&Object.hasOwnProperty.call(m,%j))",t,c.name),void 0===d?o(i,c,u,t):i("w.uint32(%i).%s(%s)",(c.id<<3|d)>>>0,h,t))}return i("return w")};var n=i(5643),r=i(361),s=i(3262);function o(e,t,i,n){return t.delimited?e("types[%i].encode(%s,w.uint32(%i)).uint32(%i)",i,n,(t.id<<3|3)>>>0,(t.id<<3|4)>>>0):e("types[%i].encode(%s,w.uint32(%i).fork()).ldelim()",i,n,(t.id<<3|2)>>>0)}},5643(e,t,i){"use strict";e.exports=o;var n=i(7209);((o.prototype=Object.create(n.prototype)).constructor=o).className="Enum";var r=i(1304),s=i(3262);function o(e,t,i,r,s,o){if(n.call(this,e,i),t&&"object"!=typeof t)throw TypeError("values must be an object");if(this.valuesById={},this.values=Object.create(this.valuesById),this.comment=r,this.comments=s||{},this.valuesOptions=o,this._valuesFeatures={},this.reserved=void 0,t)for(var a=Object.keys(t),l=0;l<a.length;++l)"number"==typeof t[a[l]]&&(this.valuesById[this.values[a[l]]=t[a[l]]]=a[l])}o.prototype._resolveFeatures=function(e){return e=this._edition||e,n.prototype._resolveFeatures.call(this,e),Object.keys(this.values).forEach(e=>{var t=Object.assign({},this._features);this._valuesFeatures[e]=Object.assign(t,this.valuesOptions&&this.valuesOptions[e]&&this.valuesOptions[e].features)}),this},o.fromJSON=function(e,t){var i=new o(e,t.values,t.options,t.comment,t.comments);return i.reserved=t.reserved,t.edition&&(i._edition=t.edition),i._defaultEdition="proto3",i},o.prototype.toJSON=function(e){var t=!!e&&Boolean(e.keepComments);return s.toObject(["edition",this._editionToJSON(),"options",this.options,"valuesOptions",this.valuesOptions,"values",this.values,"reserved",this.reserved&&this.reserved.length?this.reserved:void 0,"comment",t?this.comment:void 0,"comments",t?this.comments:void 0])},o.prototype.add=function(e,t,i,n){if(!s.isString(e))throw TypeError("name must be a string");if(!s.isInteger(t))throw TypeError("id must be an integer");if(void 0!==this.values[e])throw Error("duplicate name '"+e+"' in "+this);if(this.isReservedId(t))throw Error("id "+t+" is reserved in "+this);if(this.isReservedName(e))throw Error("name '"+e+"' is reserved in "+this);if(void 0!==this.valuesById[t]){if(!this.options||!this.options.allow_alias)throw Error("duplicate id "+t+" in "+this);this.values[e]=t}else this.valuesById[this.values[e]=t]=e;return n&&(void 0===this.valuesOptions&&(this.valuesOptions={}),this.valuesOptions[e]=n||null),this.comments[e]=i||null,this},o.prototype.remove=function(e){if(!s.isString(e))throw TypeError("name must be a string");var t=this.values[e];if(null==t)throw Error("name '"+e+"' does not exist in "+this);return delete this.valuesById[t],delete this.values[e],delete this.comments[e],this.valuesOptions&&delete this.valuesOptions[e],this},o.prototype.isReservedId=function(e){return r.isReservedId(this.reserved,e)},o.prototype.isReservedName=function(e){return r.isReservedName(this.reserved,e)}},1344(e,t,i){"use strict";e.exports=c;var n=i(7209);((c.prototype=Object.create(n.prototype)).constructor=c).className="Field";var r,s=i(5643),o=i(361),a=i(3262),l=/^required|optional|repeated$/;function c(e,t,i,r,s,c,u){if(a.isObject(r)?(u=s,c=r,r=s=void 0):a.isObject(s)&&(u=c,c=s,s=void 0),n.call(this,e,c),!a.isInteger(t)||t<0)throw TypeError("id must be a non-negative integer");if(!a.isString(i))throw TypeError("type must be a string");if(void 0!==r&&!l.test(r=r.toString().toLowerCase()))throw TypeError("rule must be a string rule");if(void 0!==s&&!a.isString(s))throw TypeError("extend must be a string");"proto3_optional"===r&&(r="optional"),this.rule=r&&"optional"!==r?r:void 0,this.type=i,this.id=t,this.extend=s||void 0,this.repeated="repeated"===r,this.map=!1,this.message=null,this.partOf=null,this.typeDefault=null,this.defaultValue=null,this.long=!!a.Long&&void 0!==o.long[i],this.bytes="bytes"===i,this.resolvedType=null,this.extensionField=null,this.declaringField=null,this.comment=u}c.fromJSON=function(e,t){var i=new c(e,t.id,t.type,t.rule,t.extend,t.options,t.comment);return t.edition&&(i._edition=t.edition),i._defaultEdition="proto3",i},Object.defineProperty(c.prototype,"required",{get:function(){return"LEGACY_REQUIRED"===this._features.field_presence}}),Object.defineProperty(c.prototype,"optional",{get:function(){return!this.required}}),Object.defineProperty(c.prototype,"delimited",{get:function(){return this.resolvedType instanceof r&&"DELIMITED"===this._features.message_encoding}}),Object.defineProperty(c.prototype,"packed",{get:function(){return"PACKED"===this._features.repeated_field_encoding}}),Object.defineProperty(c.prototype,"hasPresence",{get:function(){return!this.repeated&&!this.map&&(this.partOf||this.declaringField||this.extensionField||"IMPLICIT"!==this._features.field_presence)}}),c.prototype.setOption=function(e,t,i){return n.prototype.setOption.call(this,e,t,i)},c.prototype.toJSON=function(e){var t=!!e&&Boolean(e.keepComments);return a.toObject(["edition",this._editionToJSON(),"rule","optional"!==this.rule&&this.rule||void 0,"type",this.type,"id",this.id,"extend",this.extend,"options",this.options,"comment",t?this.comment:void 0])},c.prototype.resolve=function(){if(this.resolved)return this;if(void 0===(this.typeDefault=o.defaults[this.type])?(this.resolvedType=(this.declaringField?this.declaringField.parent:this.parent).lookupTypeOrEnum(this.type),this.resolvedType instanceof r?this.typeDefault=null:this.typeDefault=this.resolvedType.values[Object.keys(this.resolvedType.values)[0]]):this.options&&this.options.proto3_optional&&(this.typeDefault=null),this.options&&null!=this.options.default&&(this.typeDefault=this.options.default,this.resolvedType instanceof s&&"string"==typeof this.typeDefault&&(this.typeDefault=this.resolvedType.values[this.typeDefault])),this.options&&(void 0===this.options.packed||!this.resolvedType||this.resolvedType instanceof s||delete this.options.packed,Object.keys(this.options).length||(this.options=void 0)),this.long)this.typeDefault=a.Long.fromNumber(this.typeDefault,"u"===this.type.charAt(0)),Object.freeze&&Object.freeze(this.typeDefault);else if(this.bytes&&"string"==typeof this.typeDefault){var e;a.base64.test(this.typeDefault)?a.base64.decode(this.typeDefault,e=a.newBuffer(a.base64.length(this.typeDefault)),0):a.utf8.write(this.typeDefault,e=a.newBuffer(a.utf8.length(this.typeDefault)),0),this.typeDefault=e}return this.map?this.defaultValue=a.emptyObject:this.repeated?this.defaultValue=a.emptyArray:this.defaultValue=this.typeDefault,this.parent instanceof r&&(this.parent.ctor.prototype[this.name]=this.defaultValue),n.prototype.resolve.call(this)},c.prototype._inferLegacyProtoFeatures=function(e){if("proto2"!==e&&"proto3"!==e)return{};var t={};if("required"===this.rule&&(t.field_presence="LEGACY_REQUIRED"),this.parent&&void 0===o.defaults[this.type]){var i=this.parent.get(this.type.split(".").pop());i&&i instanceof r&&i.group&&(t.message_encoding="DELIMITED")}return!0===this.getOption("packed")?t.repeated_field_encoding="PACKED":!1===this.getOption("packed")&&(t.repeated_field_encoding="EXPANDED"),t},c.prototype._resolveFeatures=function(e){return n.prototype._resolveFeatures.call(this,this._edition||e)},c.d=function(e,t,i,n){return"function"==typeof t?t=a.decorateType(t).name:t&&"object"==typeof t&&(t=a.decorateEnum(t).name),function(r,s){a.decorateType(r.constructor).add(new c(s,e,t,i,{default:n}))}},c._configure=function(e){r=e}},5325(e,t,i){"use strict";var n=e.exports=i(4394);n.build="light",n.load=function(e,t,i){return"function"==typeof t?(i=t,t=new n.Root):t||(t=new n.Root),t.load(e,i)},n.loadSync=function(e,t){return t||(t=new n.Root),t.loadSync(e)},n.encoder=i(1080),n.decoder=i(7728),n.verifier=i(420),n.converter=i(744),n.ReflectionObject=i(7209),n.Namespace=i(1304),n.Root=i(5330),n.Enum=i(5643),n.Type=i(7882),n.Field=i(1344),n.OneOf=i(1457),n.MapField=i(8252),n.Service=i(9687),n.Method=i(8811),n.Message=i(2551),n.wrappers=i(6434),n.types=i(361),n.util=i(3262),n.ReflectionObject._configure(n.Root),n.Namespace._configure(n.Type,n.Service,n.Enum),n.Root._configure(n.Type),n.Field._configure(n.Type)},4394(e,t,i){"use strict";var n=t;function r(){n.util._configure(),n.Writer._configure(n.BufferWriter),n.Reader._configure(n.BufferReader)}n.build="minimal",n.Writer=i(3449),n.BufferWriter=i(818),n.Reader=i(6237),n.BufferReader=i(3158),n.util=i(3610),n.rpc=i(5047),n.roots=i(4529),n.configure=r,r()},9100(e,t,i){"use strict";var n=e.exports=i(5325);n.build="full",n.tokenize=i(527),n.parse=i(4863),n.common=i(5095),n.Root._configure(n.Type,n.parse,n.common)},8252(e,t,i){"use strict";e.exports=o;var n=i(1344);((o.prototype=Object.create(n.prototype)).constructor=o).className="MapField";var r=i(361),s=i(3262);function o(e,t,i,r,o,a){if(n.call(this,e,t,r,void 0,void 0,o,a),!s.isString(i))throw TypeError("keyType must be a string");this.keyType=i,this.resolvedKeyType=null,this.map=!0}o.fromJSON=function(e,t){return new o(e,t.id,t.keyType,t.type,t.options,t.comment)},o.prototype.toJSON=function(e){var t=!!e&&Boolean(e.keepComments);return s.toObject(["keyType",this.keyType,"type",this.type,"id",this.id,"extend",this.extend,"options",this.options,"comment",t?this.comment:void 0])},o.prototype.resolve=function(){if(this.resolved)return this;if(void 0===r.mapKey[this.keyType])throw Error("invalid key type: "+this.keyType);return n.prototype.resolve.call(this)},o.d=function(e,t,i){return"function"==typeof i?i=s.decorateType(i).name:i&&"object"==typeof i&&(i=s.decorateEnum(i).name),function(n,r){s.decorateType(n.constructor).add(new o(r,e,t,i))}}},2551(e,t,i){"use strict";e.exports=r;var n=i(3610);function r(e){if(e)for(var t=Object.keys(e),i=0;i<t.length;++i)this[t[i]]=e[t[i]]}r.create=function(e){return this.$type.create(e)},r.encode=function(e,t){return this.$type.encode(e,t)},r.encodeDelimited=function(e,t){return this.$type.encodeDelimited(e,t)},r.decode=function(e){return this.$type.decode(e)},r.decodeDelimited=function(e){return this.$type.decodeDelimited(e)},r.verify=function(e){return this.$type.verify(e)},r.fromObject=function(e){return this.$type.fromObject(e)},r.toObject=function(e,t){return this.$type.toObject(e,t)},r.prototype.toJSON=function(){return this.$type.toObject(this,n.toJSONOptions)}},8811(e,t,i){"use strict";e.exports=s;var n=i(7209);((s.prototype=Object.create(n.prototype)).constructor=s).className="Method";var r=i(3262);function s(e,t,i,s,o,a,l,c,u){if(r.isObject(o)?(l=o,o=a=void 0):r.isObject(a)&&(l=a,a=void 0),void 0!==t&&!r.isString(t))throw TypeError("type must be a string");if(!r.isString(i))throw TypeError("requestType must be a string");if(!r.isString(s))throw TypeError("responseType must be a string");n.call(this,e,l),this.type=t||"rpc",this.requestType=i,this.requestStream=!!o||void 0,this.responseType=s,this.responseStream=!!a||void 0,this.resolvedRequestType=null,this.resolvedResponseType=null,this.comment=c,this.parsedOptions=u}s.fromJSON=function(e,t){return new s(e,t.type,t.requestType,t.responseType,t.requestStream,t.responseStream,t.options,t.comment,t.parsedOptions)},s.prototype.toJSON=function(e){var t=!!e&&Boolean(e.keepComments);return r.toObject(["type","rpc"!==this.type&&this.type||void 0,"requestType",this.requestType,"requestStream",this.requestStream,"responseType",this.responseType,"responseStream",this.responseStream,"options",this.options,"comment",t?this.comment:void 0,"parsedOptions",this.parsedOptions])},s.prototype.resolve=function(){return this.resolved?this:(this.resolvedRequestType=this.parent.lookupType(this.requestType),this.resolvedResponseType=this.parent.lookupType(this.responseType),n.prototype.resolve.call(this))}},1304(e,t,i){"use strict";e.exports=h;var n=i(7209);((h.prototype=Object.create(n.prototype)).constructor=h).className="Namespace";var r,s,o,a=i(1344),l=i(3262),c=i(1457);function u(e,t){if(e&&e.length){for(var i={},n=0;n<e.length;++n)i[e[n].name]=e[n].toJSON(t);return i}}function h(e,t){n.call(this,e,t),this.nested=void 0,this._nestedArray=null,this._lookupCache={},this._needsRecursiveFeatureResolution=!0,this._needsRecursiveResolve=!0}function d(e){e._nestedArray=null,e._lookupCache={};for(var t=e;t=t.parent;)t._lookupCache={};return e}h.fromJSON=function(e,t){return new h(e,t.options).addJSON(t.nested)},h.arrayToJSON=u,h.isReservedId=function(e,t){if(e)for(var i=0;i<e.length;++i)if("string"!=typeof e[i]&&e[i][0]<=t&&e[i][1]>t)return!0;return!1},h.isReservedName=function(e,t){if(e)for(var i=0;i<e.length;++i)if(e[i]===t)return!0;return!1},Object.defineProperty(h.prototype,"nestedArray",{get:function(){return this._nestedArray||(this._nestedArray=l.toArray(this.nested))}}),h.prototype.toJSON=function(e){return l.toObject(["options",this.options,"nested",u(this.nestedArray,e)])},h.prototype.addJSON=function(e){if(e)for(var t,i=Object.keys(e),n=0;n<i.length;++n)t=e[i[n]],this.add((void 0!==t.fields?r.fromJSON:void 0!==t.values?o.fromJSON:void 0!==t.methods?s.fromJSON:void 0!==t.id?a.fromJSON:h.fromJSON)(i[n],t));return this},h.prototype.get=function(e){return this.nested&&this.nested[e]||null},h.prototype.getEnum=function(e){if(this.nested&&this.nested[e]instanceof o)return this.nested[e].values;throw Error("no such enum: "+e)},h.prototype.add=function(e){if(!(e instanceof a&&void 0!==e.extend||e instanceof r||e instanceof c||e instanceof o||e instanceof s||e instanceof h))throw TypeError("object must be a valid nested object");if(this.nested){var t=this.get(e.name);if(t){if(!(t instanceof h&&e instanceof h)||t instanceof r||t instanceof s)throw Error("duplicate name '"+e.name+"' in "+this);for(var i=t.nestedArray,n=0;n<i.length;++n)e.add(i[n]);this.remove(t),this.nested||(this.nested={}),e.setOptions(t.options,!0)}}else this.nested={};this.nested[e.name]=e,this instanceof r||this instanceof s||this instanceof o||this instanceof a||e._edition||(e._edition=e._defaultEdition),this._needsRecursiveFeatureResolution=!0,this._needsRecursiveResolve=!0;for(var l=this;l=l.parent;)l._needsRecursiveFeatureResolution=!0,l._needsRecursiveResolve=!0;return e.onAdd(this),d(this)},h.prototype.remove=function(e){if(!(e instanceof n))throw TypeError("object must be a ReflectionObject");if(e.parent!==this)throw Error(e+" is not a member of "+this);return delete this.nested[e.name],Object.keys(this.nested).length||(this.nested=void 0),e.onRemove(this),d(this)},h.prototype.define=function(e,t){if(l.isString(e))e=e.split(".");else if(!Array.isArray(e))throw TypeError("illegal path");if(e&&e.length&&""===e[0])throw Error("path must be relative");for(var i=this;e.length>0;){var n=e.shift();if(i.nested&&i.nested[n]){if(!((i=i.nested[n])instanceof h))throw Error("path conflicts with non-namespace objects")}else i.add(i=new h(n))}return t&&i.addJSON(t),i},h.prototype.resolveAll=function(){if(!this._needsRecursiveResolve)return this;this._resolveFeaturesRecursive(this._edition);var e=this.nestedArray,t=0;for(this.resolve();t<e.length;)e[t]instanceof h?e[t++].resolveAll():e[t++].resolve();return this._needsRecursiveResolve=!1,this},h.prototype._resolveFeaturesRecursive=function(e){return this._needsRecursiveFeatureResolution?(this._needsRecursiveFeatureResolution=!1,e=this._edition||e,n.prototype._resolveFeaturesRecursive.call(this,e),this.nestedArray.forEach(t=>{t._resolveFeaturesRecursive(e)}),this):this},h.prototype.lookup=function(e,t,i){if("boolean"==typeof t?(i=t,t=void 0):t&&!Array.isArray(t)&&(t=[t]),l.isString(e)&&e.length){if("."===e)return this.root;e=e.split(".")}else if(!e.length)return this;var n=e.join(".");if(""===e[0])return this.root.lookup(e.slice(1),t);var r=this.root._fullyQualifiedObjects&&this.root._fullyQualifiedObjects["."+n];if(r&&(!t||t.indexOf(r.constructor)>-1))return r;if((r=this._lookupImpl(e,n))&&(!t||t.indexOf(r.constructor)>-1))return r;if(i)return null;for(var s=this;s.parent;){if((r=s.parent._lookupImpl(e,n))&&(!t||t.indexOf(r.constructor)>-1))return r;s=s.parent}return null},h.prototype._lookupImpl=function(e,t){if(Object.prototype.hasOwnProperty.call(this._lookupCache,t))return this._lookupCache[t];var i=this.get(e[0]),n=null;if(i)1===e.length?n=i:i instanceof h&&(e=e.slice(1),n=i._lookupImpl(e,e.join(".")));else for(var r=0;r<this.nestedArray.length;++r)this._nestedArray[r]instanceof h&&(i=this._nestedArray[r]._lookupImpl(e,t))&&(n=i);return this._lookupCache[t]=n,n},h.prototype.lookupType=function(e){var t=this.lookup(e,[r]);if(!t)throw Error("no such type: "+e);return t},h.prototype.lookupEnum=function(e){var t=this.lookup(e,[o]);if(!t)throw Error("no such Enum '"+e+"' in "+this);return t},h.prototype.lookupTypeOrEnum=function(e){var t=this.lookup(e,[r,o]);if(!t)throw Error("no such Type or Enum '"+e+"' in "+this);return t},h.prototype.lookupService=function(e){var t=this.lookup(e,[s]);if(!t)throw Error("no such Service '"+e+"' in "+this);return t},h._configure=function(e,t,i){r=e,s=t,o=i}},7209(e,t,i){"use strict";e.exports=c,c.className="ReflectionObject";const n=i(1457);var r,s=i(3262),o={enum_type:"OPEN",field_presence:"EXPLICIT",json_format:"ALLOW",message_encoding:"LENGTH_PREFIXED",repeated_field_encoding:"PACKED",utf8_validation:"VERIFY"},a={enum_type:"CLOSED",field_presence:"EXPLICIT",json_format:"LEGACY_BEST_EFFORT",message_encoding:"LENGTH_PREFIXED",repeated_field_encoding:"EXPANDED",utf8_validation:"NONE"},l={enum_type:"OPEN",field_presence:"IMPLICIT",json_format:"ALLOW",message_encoding:"LENGTH_PREFIXED",repeated_field_encoding:"PACKED",utf8_validation:"VERIFY"};function c(e,t){if(!s.isString(e))throw TypeError("name must be a string");if(t&&!s.isObject(t))throw TypeError("options must be an object");this.options=t,this.parsedOptions=null,this.name=e,this._edition=null,this._defaultEdition="proto2",this._features={},this._featuresResolved=!1,this.parent=null,this.resolved=!1,this.comment=null,this.filename=null}Object.defineProperties(c.prototype,{root:{get:function(){for(var e=this;null!==e.parent;)e=e.parent;return e}},fullName:{get:function(){for(var e=[this.name],t=this.parent;t;)e.unshift(t.name),t=t.parent;return e.join(".")}}}),c.prototype.toJSON=function(){throw Error()},c.prototype.onAdd=function(e){this.parent&&this.parent!==e&&this.parent.remove(this),this.parent=e,this.resolved=!1;var t=e.root;t instanceof r&&t._handleAdd(this)},c.prototype.onRemove=function(e){var t=e.root;t instanceof r&&t._handleRemove(this),this.parent=null,this.resolved=!1},c.prototype.resolve=function(){return this.resolved||this.root instanceof r&&(this.resolved=!0),this},c.prototype._resolveFeaturesRecursive=function(e){return this._resolveFeatures(this._edition||e)},c.prototype._resolveFeatures=function(e){if(!this._featuresResolved){var t={};if(!e)throw new Error("Unknown edition for "+this.fullName);var i=Object.assign(this.options?Object.assign({},this.options.features):{},this._inferLegacyProtoFeatures(e));if(this._edition){if("proto2"===e)t=Object.assign({},a);else if("proto3"===e)t=Object.assign({},l);else{if("2023"!==e)throw new Error("Unknown edition: "+e);t=Object.assign({},o)}return this._features=Object.assign(t,i||{}),void(this._featuresResolved=!0)}if(this.partOf instanceof n){var r=Object.assign({},this.partOf._features);this._features=Object.assign(r,i||{})}else if(this.declaringField);else{if(!this.parent)throw new Error("Unable to find a parent for "+this.fullName);var s=Object.assign({},this.parent._features);this._features=Object.assign(s,i||{})}this.extensionField&&(this.extensionField._features=this._features),this._featuresResolved=!0}},c.prototype._inferLegacyProtoFeatures=function(){return{}},c.prototype.getOption=function(e){if(this.options)return this.options[e]},c.prototype.setOption=function(e,t,i){return this.options||(this.options={}),/^features\./.test(e)?s.setProperty(this.options,e,t,i):i&&void 0!==this.options[e]||(this.getOption(e)!==t&&(this.resolved=!1),this.options[e]=t),this},c.prototype.setParsedOption=function(e,t,i){this.parsedOptions||(this.parsedOptions=[]);var n=this.parsedOptions;if(i){var r=n.find(function(t){return Object.prototype.hasOwnProperty.call(t,e)});if(r){var o=r[e];s.setProperty(o,i,t)}else(r={})[e]=s.setProperty({},i,t),n.push(r)}else{var a={};a[e]=t,n.push(a)}return this},c.prototype.setOptions=function(e,t){if(e)for(var i=Object.keys(e),n=0;n<i.length;++n)this.setOption(i[n],e[i[n]],t);return this},c.prototype.toString=function(){var e=this.constructor.className,t=this.fullName;return t.length?e+" "+t:e},c.prototype._editionToJSON=function(){if(this._edition&&"proto3"!==this._edition)return this._edition},c._configure=function(e){r=e}},1457(e,t,i){"use strict";e.exports=o;var n=i(7209);((o.prototype=Object.create(n.prototype)).constructor=o).className="OneOf";var r=i(1344),s=i(3262);function o(e,t,i,r){if(Array.isArray(t)||(i=t,t=void 0),n.call(this,e,i),void 0!==t&&!Array.isArray(t))throw TypeError("fieldNames must be an Array");this.oneof=t||[],this.fieldsArray=[],this.comment=r}function a(e){if(e.parent)for(var t=0;t<e.fieldsArray.length;++t)e.fieldsArray[t].parent||e.parent.add(e.fieldsArray[t])}o.fromJSON=function(e,t){return new o(e,t.oneof,t.options,t.comment)},o.prototype.toJSON=function(e){var t=!!e&&Boolean(e.keepComments);return s.toObject(["options",this.options,"oneof",this.oneof,"comment",t?this.comment:void 0])},o.prototype.add=function(e){if(!(e instanceof r))throw TypeError("field must be a Field");return e.parent&&e.parent!==this.parent&&e.parent.remove(e),this.oneof.push(e.name),this.fieldsArray.push(e),e.partOf=this,a(this),this},o.prototype.remove=function(e){if(!(e instanceof r))throw TypeError("field must be a Field");var t=this.fieldsArray.indexOf(e);if(t<0)throw Error(e+" is not a member of "+this);return this.fieldsArray.splice(t,1),(t=this.oneof.indexOf(e.name))>-1&&this.oneof.splice(t,1),e.partOf=null,this},o.prototype.onAdd=function(e){n.prototype.onAdd.call(this,e);for(var t=0;t<this.oneof.length;++t){var i=e.get(this.oneof[t]);i&&!i.partOf&&(i.partOf=this,this.fieldsArray.push(i))}a(this)},o.prototype.onRemove=function(e){for(var t,i=0;i<this.fieldsArray.length;++i)(t=this.fieldsArray[i]).parent&&t.parent.remove(t);n.prototype.onRemove.call(this,e)},Object.defineProperty(o.prototype,"isProto3Optional",{get:function(){if(null==this.fieldsArray||1!==this.fieldsArray.length)return!1;var e=this.fieldsArray[0];return null!=e.options&&!0===e.options.proto3_optional}}),o.d=function(){for(var e=new Array(arguments.length),t=0;t<arguments.length;)e[t]=arguments[t++];return function(t,i){s.decorateType(t.constructor).add(new o(i,e)),Object.defineProperty(t,i,{get:s.oneOfGetter(e),set:s.oneOfSetter(e)})}}},4863(e,t,i){"use strict";e.exports=w,w.filename=null,w.defaults={keepCase:!1};var n=i(527),r=i(5330),s=i(7882),o=i(1344),a=i(8252),l=i(1457),c=i(5643),u=i(9687),h=i(8811),d=i(7209),f=i(361),p=i(3262),g=/^[1-9][0-9]*$/,m=/^-?[1-9][0-9]*$/,v=/^0[x][0-9a-fA-F]+$/,y=/^-?0[x][0-9a-fA-F]+$/,b=/^0[0-7]+$/,S=/^-?0[0-7]+$/,_=/^(?![eE])[0-9]*(?:\.[0-9]*)?(?:[eE][+-]?[0-9]+)?$/,C=/^[a-zA-Z_][a-zA-Z_0-9]*$/,E=/^(?:\.?[a-zA-Z_][a-zA-Z_0-9]*)(?:\.[a-zA-Z_][a-zA-Z_0-9]*)*$/;function w(e,t,i){t instanceof r||(i=t,t=new r),i||(i=w.defaults);var T,k,R,O,A=i.preferTrailingComment||!1,P=n(e,i.alternateCommentMode||!1),N=P.next,x=P.push,I=P.peek,M=P.skip,L=P.cmnt,D=!0,j="proto2",F=t,B=[],U={},z=i.keepCase?function(e){return e}:p.camelCase;function H(e,t,i){var n=w.filename;return i||(w.filename=null),Error("illegal "+(t||"token")+" '"+e+"' ("+(n?n+", ":"")+"line "+P.line+")")}function W(){var e,t=[];do{if('"'!==(e=N())&&"'"!==e)throw H(e);t.push(N()),M(e),e=I()}while('"'===e||"'"===e);return t.join("")}function q(e){var t=N();switch(t){case"'":case'"':return x(t),W();case"true":case"TRUE":return!0;case"false":case"FALSE":return!1}try{return function(e,t){var i=1;"-"===e.charAt(0)&&(i=-1,e=e.substring(1));switch(e){case"inf":case"INF":case"Inf":return i*(1/0);case"nan":case"NAN":case"Nan":case"NaN":return NaN;case"0":return 0}if(g.test(e))return i*parseInt(e,10);if(v.test(e))return i*parseInt(e,16);if(b.test(e))return i*parseInt(e,8);if(_.test(e))return i*parseFloat(e);throw H(e,"number",t)}(t,!0)}catch(i){if(e&&E.test(t))return t;throw H(t,"value")}}function $(e,t){var i,n;do{if(!t||'"'!==(i=I())&&"'"!==i)try{e.push([n=G(N()),M("to",!0)?G(N()):n])}catch(n){if(!(t&&E.test(i)&&j>=2023))throw n;e.push(i)}else{var r=W();if(e.push(r),j>=2023)throw H(r,"id")}}while(M(",",!0));var s={options:void 0,setOption:function(e,t){void 0===this.options&&(this.options={}),this.options[e]=t}};Q(s,function(e){if("option"!==e)throw H(e);ie(s,e),M(";")},function(){se(s)})}function G(e,t){switch(e){case"max":case"MAX":case"Max":return 536870911;case"0":return 0}if(!t&&"-"===e.charAt(0))throw H(e,"id");if(m.test(e))return parseInt(e,10);if(y.test(e))return parseInt(e,16);if(S.test(e))return parseInt(e,8);throw H(e,"id")}function V(){if(void 0!==T)throw H("package");if(T=N(),!E.test(T))throw H(T,"name");F=F.define(T),M(";")}function Y(){var e,t=I();switch(t){case"weak":e=R||(R=[]),N();break;case"public":N();default:e=k||(k=[])}t=W(),M(";"),e.push(t)}function K(){if(M("="),(j=W())<2023)throw H(j,"syntax");M(";")}function J(){M("="),j=W();if(!["2023"].includes(j))throw H(j,"edition");M(";")}function X(e,t){switch(t){case"option":return ie(e,t),M(";"),!0;case"message":return Z(e,t),!0;case"enum":return te(e,t),!0;case"service":return function(e,t){if(!C.test(t=N()))throw H(t,"service name");var i=new u(t);Q(i,function(e){if(!X(i,e)){if("rpc"!==e)throw H(e);!function(e,t){var i=L(),n=t;if(!C.test(t=N()))throw H(t,"name");var r,s,o,a,l=t;M("("),M("stream",!0)&&(s=!0);if(!E.test(t=N()))throw H(t);r=t,M(")"),M("returns"),M("("),M("stream",!0)&&(a=!0);if(!E.test(t=N()))throw H(t);o=t,M(")");var c=new h(l,n,r,o,s,a);c.comment=i,Q(c,function(e){if("option"!==e)throw H(e);ie(c,e),M(";")}),e.add(c)}(i,e)}}),e.add(i),e===F&&B.push(i)}(e,t),!0;case"extend":return function(e,t){if(!E.test(t=N()))throw H(t,"reference");var i=t;Q(null,function(t){switch(t){case"required":case"repeated":ee(e,t,i);break;case"optional":ee(e,"proto3"===j?"proto3_optional":"optional",i);break;default:if("proto2"===j||!E.test(t))throw H(t);x(t),ee(e,"optional",i)}})}(e,t),!0}return!1}function Q(e,t,i){var n=P.line;if(e&&("string"!=typeof e.comment&&(e.comment=L()),e.filename=w.filename),M("{",!0)){for(var r;"}"!==(r=N());)t(r);M(";",!0)}else i&&i(),M(";"),e&&("string"!=typeof e.comment||A)&&(e.comment=L(n)||e.comment)}function Z(e,t){if(!C.test(t=N()))throw H(t,"type name");var i=new s(t);Q(i,function(e){if(!X(i,e))switch(e){case"map":!function(e){M("<");var t=N();if(void 0===f.mapKey[t])throw H(t,"type");M(",");var i=N();if(!E.test(i))throw H(i,"type");M(">");var n=N();if(!C.test(n))throw H(n,"name");M("=");var r=new a(z(n),G(N()),t,i);Q(r,function(e){if("option"!==e)throw H(e);ie(r,e),M(";")},function(){se(r)}),e.add(r)}(i);break;case"required":if("proto2"!==j)throw H(e);case"repeated":ee(i,e);break;case"optional":if("proto3"===j)ee(i,"proto3_optional");else{if("proto2"!==j)throw H(e);ee(i,"optional")}break;case"oneof":!function(e,t){if(!C.test(t=N()))throw H(t,"name");var i=new l(z(t));Q(i,function(e){"option"===e?(ie(i,e),M(";")):(x(e),ee(i,"optional"))}),e.add(i)}(i,e);break;case"extensions":$(i.extensions||(i.extensions=[]));break;case"reserved":$(i.reserved||(i.reserved=[]),!0);break;default:if("proto2"===j||!E.test(e))throw H(e);x(e),ee(i,"optional")}}),e.add(i),e===F&&B.push(i)}function ee(e,t,i){var n=N();if("group"!==n){for(;n.endsWith(".")||I().startsWith(".");)n+=N();if(!E.test(n))throw H(n,"type");var r=N();if(!C.test(r))throw H(r,"name");r=z(r),M("=");var a=new o(r,G(N()),n,t,i);if(Q(a,function(e){if("option"!==e)throw H(e);ie(a,e),M(";")},function(){se(a)}),"proto3_optional"===t){var c=new l("_"+r);a.setOption("proto3_optional",!0),c.add(a),e.add(c)}else e.add(a);e===F&&B.push(a)}else!function(e,t){if(j>=2023)throw H("group");var i=N();if(!C.test(i))throw H(i,"name");var n=p.lcFirst(i);i===n&&(i=p.ucFirst(i));M("=");var r=G(N()),a=new s(i);a.group=!0;var l=new o(n,r,i,t);l.filename=w.filename,Q(a,function(e){switch(e){case"option":ie(a,e),M(";");break;case"required":case"repeated":ee(a,e);break;case"optional":ee(a,"proto3"===j?"proto3_optional":"optional");break;case"message":Z(a,e);break;case"enum":te(a,e);break;case"reserved":$(a.reserved||(a.reserved=[]),!0);break;default:throw H(e)}}),e.add(a).add(l)}(e,t)}function te(e,t){if(!C.test(t=N()))throw H(t,"name");var i=new c(t);Q(i,function(e){switch(e){case"option":ie(i,e),M(";");break;case"reserved":$(i.reserved||(i.reserved=[]),!0),void 0===i.reserved&&(i.reserved=[]);break;default:!function(e,t){if(!C.test(t))throw H(t,"name");M("=");var i=G(N(),!0),n={options:void 0,getOption:function(e){return this.options[e]}};n.setOption=function(e,t){d.prototype.setOption.call(n,e,t)},n.setParsedOption=function(){},Q(n,function(e){if("option"!==e)throw H(e);ie(n,e),M(";")},function(){se(n)}),e.add(t,i,n.comment,n.parsedOptions||n.options)}(i,e)}}),e.add(i),e===F&&B.push(i)}function ie(e,t){var i,n,r=!0;for("option"===t&&(t=N());"="!==t;){if("("===t){var s=N();M(")"),t="("+s+")"}if(r){if(r=!1,t.includes(".")&&!t.includes("(")){var o=t.split(".");i=o[0]+".",t=o[1];continue}i=t}else n=n?n+=t:t;t=N()}var a=ne(e,n?i.concat(n):i);n=n&&"."===n[0]?n.slice(1):n,function(e,t,i,n){e.setParsedOption&&e.setParsedOption(t,i,n)}(e,i=i&&"."===i[i.length-1]?i.slice(0,-1):i,a,n)}function ne(e,t){if(M("{",!0)){for(var i={};!M("}",!0);){if(!C.test(O=N()))throw H(O,"name");if(null===O)throw H(O,"end of input");var n,r=O;if(M(":",!0),"{"===I())n=ne(e,t+"."+O);else if("["===I()){var s;if(n=[],M("[",!0)){do{s=q(!0),n.push(s)}while(M(",",!0));M("]"),void 0!==s&&re(e,t+"."+O,s)}}else n=q(!0),re(e,t+"."+O,n);var o=i[r];o&&(n=[].concat(o).concat(n)),i[r]=n,M(",",!0),M(";",!0)}return i}var a=q(!0);return re(e,t,a),a}function re(e,t,i){F===e&&/^features\./.test(t)?U[t]=i:e.setOption&&e.setOption(t,i)}function se(e){if(M("[",!0)){do{ie(e,"option")}while(M(",",!0));M("]")}return e}for(;null!==(O=N());)switch(O){case"package":if(!D)throw H(O);V();break;case"import":if(!D)throw H(O);Y();break;case"syntax":if(!D)throw H(O);K();break;case"edition":if(!D)throw H(O);J();break;case"option":ie(F,O),M(";",!0);break;default:if(X(F,O)){D=!1;continue}throw H(O)}return B.forEach(e=>{e._edition=j,Object.keys(U).forEach(t=>{void 0===e.getOption(t)&&e.setOption(t,U[t],!0)})}),w.filename=null,{package:T,imports:k,weakImports:R,root:t}}},6237(e,t,i){"use strict";e.exports=l;var n,r=i(3610),s=r.LongBits,o=r.utf8;function a(e,t){return RangeError("index out of range: "+e.pos+" + "+(t||1)+" > "+e.len)}function l(e){this.buf=e,this.pos=0,this.len=e.length}var c,u="undefined"!=typeof Uint8Array?function(e){if(e instanceof Uint8Array||Array.isArray(e))return new l(e);throw Error("illegal buffer")}:function(e){if(Array.isArray(e))return new l(e);throw Error("illegal buffer")},h=function(){return r.Buffer?function(e){return(l.create=function(e){return r.Buffer.isBuffer(e)?new n(e):u(e)})(e)}:u};function d(){var e=new s(0,0),t=0;if(!(this.len-this.pos>4)){for(;t<3;++t){if(this.pos>=this.len)throw a(this);if(e.lo=(e.lo|(127&this.buf[this.pos])<<7*t)>>>0,this.buf[this.pos++]<128)return e}return e.lo=(e.lo|(127&this.buf[this.pos++])<<7*t)>>>0,e}for(;t<4;++t)if(e.lo=(e.lo|(127&this.buf[this.pos])<<7*t)>>>0,this.buf[this.pos++]<128)return e;if(e.lo=(e.lo|(127&this.buf[this.pos])<<28)>>>0,e.hi=(e.hi|(127&this.buf[this.pos])>>4)>>>0,this.buf[this.pos++]<128)return e;if(t=0,this.len-this.pos>4){for(;t<5;++t)if(e.hi=(e.hi|(127&this.buf[this.pos])<<7*t+3)>>>0,this.buf[this.pos++]<128)return e}else for(;t<5;++t){if(this.pos>=this.len)throw a(this);if(e.hi=(e.hi|(127&this.buf[this.pos])<<7*t+3)>>>0,this.buf[this.pos++]<128)return e}throw Error("invalid varint encoding")}function f(e,t){return(e[t-4]|e[t-3]<<8|e[t-2]<<16|e[t-1]<<24)>>>0}function p(){if(this.pos+8>this.len)throw a(this,8);return new s(f(this.buf,this.pos+=4),f(this.buf,this.pos+=4))}l.create=h(),l.prototype._slice=r.Array.prototype.subarray||r.Array.prototype.slice,l.prototype.uint32=(c=4294967295,function(){if(c=(127&this.buf[this.pos])>>>0,this.buf[this.pos++]<128)return c;if(c=(c|(127&this.buf[this.pos])<<7)>>>0,this.buf[this.pos++]<128)return c;if(c=(c|(127&this.buf[this.pos])<<14)>>>0,this.buf[this.pos++]<128)return c;if(c=(c|(127&this.buf[this.pos])<<21)>>>0,this.buf[this.pos++]<128)return c;if(c=(c|(15&this.buf[this.pos])<<28)>>>0,this.buf[this.pos++]<128)return c;if((this.pos+=5)>this.len)throw this.pos=this.len,a(this,10);return c}),l.prototype.int32=function(){return 0|this.uint32()},l.prototype.sint32=function(){var e=this.uint32();return e>>>1^-(1&e)},l.prototype.bool=function(){return 0!==this.uint32()},l.prototype.fixed32=function(){if(this.pos+4>this.len)throw a(this,4);return f(this.buf,this.pos+=4)},l.prototype.sfixed32=function(){if(this.pos+4>this.len)throw a(this,4);return 0|f(this.buf,this.pos+=4)},l.prototype.float=function(){if(this.pos+4>this.len)throw a(this,4);var e=r.float.readFloatLE(this.buf,this.pos);return this.pos+=4,e},l.prototype.double=function(){if(this.pos+8>this.len)throw a(this,4);var e=r.float.readDoubleLE(this.buf,this.pos);return this.pos+=8,e},l.prototype.bytes=function(){var e=this.uint32(),t=this.pos,i=this.pos+e;if(i>this.len)throw a(this,e);if(this.pos+=e,Array.isArray(this.buf))return this.buf.slice(t,i);if(t===i){var n=r.Buffer;return n?n.alloc(0):new this.buf.constructor(0)}return this._slice.call(this.buf,t,i)},l.prototype.string=function(){var e=this.bytes();return o.read(e,0,e.length)},l.prototype.skip=function(e){if("number"==typeof e){if(this.pos+e>this.len)throw a(this,e);this.pos+=e}else do{if(this.pos>=this.len)throw a(this)}while(128&this.buf[this.pos++]);return this},l.prototype.skipType=function(e){switch(e){case 0:this.skip();break;case 1:this.skip(8);break;case 2:this.skip(this.uint32());break;case 3:for(;4!=(e=7&this.uint32());)this.skipType(e);break;case 5:this.skip(4);break;default:throw Error("invalid wire type "+e+" at offset "+this.pos)}return this},l._configure=function(e){n=e,l.create=h(),n._configure();var t=r.Long?"toLong":"toNumber";r.merge(l.prototype,{int64:function(){return d.call(this)[t](!1)},uint64:function(){return d.call(this)[t](!0)},sint64:function(){return d.call(this).zzDecode()[t](!1)},fixed64:function(){return p.call(this)[t](!0)},sfixed64:function(){return p.call(this)[t](!1)}})}},3158(e,t,i){"use strict";e.exports=s;var n=i(6237);(s.prototype=Object.create(n.prototype)).constructor=s;var r=i(3610);function s(e){n.call(this,e)}s._configure=function(){r.Buffer&&(s.prototype._slice=r.Buffer.prototype.slice)},s.prototype.string=function(){var e=this.uint32();return this.buf.utf8Slice?this.buf.utf8Slice(this.pos,this.pos=Math.min(this.pos+e,this.len)):this.buf.toString("utf-8",this.pos,this.pos=Math.min(this.pos+e,this.len))},s._configure()},5330(e,t,i){"use strict";e.exports=h;var n=i(1304);((h.prototype=Object.create(n.prototype)).constructor=h).className="Root";var r,s,o,a=i(1344),l=i(5643),c=i(1457),u=i(3262);function h(e){n.call(this,"",e),this.deferred=[],this.files=[],this._edition="proto2",this._fullyQualifiedObjects={}}function d(){}h.fromJSON=function(e,t){return t||(t=new h),e.options&&t.setOptions(e.options),t.addJSON(e.nested).resolveAll()},h.prototype.resolvePath=u.path.resolve,h.prototype.fetch=u.fetch,h.prototype.load=function e(t,i,n){"function"==typeof i&&(n=i,i=void 0);var r=this;if(!n)return u.asPromise(e,r,t,i);var a=n===d;function l(e,t){if(n){if(a)throw e;t&&t.resolveAll();var i=n;n=null,i(e,t)}}function c(e){var t=e.lastIndexOf("google/protobuf/");if(t>-1){var i=e.substring(t);if(i in o)return i}return null}function h(e,t){try{if(u.isString(t)&&"{"===t.charAt(0)&&(t=JSON.parse(t)),u.isString(t)){s.filename=e;var n,o=s(t,r,i),h=0;if(o.imports)for(;h<o.imports.length;++h)(n=c(o.imports[h])||r.resolvePath(e,o.imports[h]))&&f(n);if(o.weakImports)for(h=0;h<o.weakImports.length;++h)(n=c(o.weakImports[h])||r.resolvePath(e,o.weakImports[h]))&&f(n,!0)}else r.setOptions(t.options).addJSON(t.nested)}catch(e){l(e)}a||p||l(null,r)}function f(e,t){if(e=c(e)||e,!(r.files.indexOf(e)>-1))if(r.files.push(e),e in o)a?h(e,o[e]):(++p,setTimeout(function(){--p,h(e,o[e])}));else if(a){var i;try{i=u.fs.readFileSync(e).toString("utf8")}catch(e){return void(t||l(e))}h(e,i)}else++p,r.fetch(e,function(i,s){--p,n&&(i?t?p||l(null,r):l(i):h(e,s))})}var p=0;u.isString(t)&&(t=[t]);for(var g,m=0;m<t.length;++m)(g=r.resolvePath("",t[m]))&&f(g);return a?(r.resolveAll(),r):(p||l(null,r),r)},h.prototype.loadSync=function(e,t){if(!u.isNode)throw Error("not supported");return this.load(e,t,d)},h.prototype.resolveAll=function(){if(!this._needsRecursiveResolve)return this;if(this.deferred.length)throw Error("unresolvable extensions: "+this.deferred.map(function(e){return"'extend "+e.extend+"' in "+e.parent.fullName}).join(", "));return n.prototype.resolveAll.call(this)};var f=/^[A-Z]/;function p(e,t){var i=t.parent.lookup(t.extend);if(i){var n=new a(t.fullName,t.id,t.type,t.rule,void 0,t.options);return i.get(n.name)||(n.declaringField=t,t.extensionField=n,i.add(n)),!0}return!1}h.prototype._handleAdd=function(e){if(e instanceof a)void 0===e.extend||e.extensionField||p(0,e)||this.deferred.push(e);else if(e instanceof l)f.test(e.name)&&(e.parent[e.name]=e.values);else if(!(e instanceof c)){if(e instanceof r)for(var t=0;t<this.deferred.length;)p(0,this.deferred[t])?this.deferred.splice(t,1):++t;for(var i=0;i<e.nestedArray.length;++i)this._handleAdd(e._nestedArray[i]);f.test(e.name)&&(e.parent[e.name]=e)}(e instanceof r||e instanceof l||e instanceof a)&&(this._fullyQualifiedObjects[e.fullName]=e)},h.prototype._handleRemove=function(e){if(e instanceof a){if(void 0!==e.extend)if(e.extensionField)e.extensionField.parent.remove(e.extensionField),e.extensionField=null;else{var t=this.deferred.indexOf(e);t>-1&&this.deferred.splice(t,1)}}else if(e instanceof l)f.test(e.name)&&delete e.parent[e.name];else if(e instanceof n){for(var i=0;i<e.nestedArray.length;++i)this._handleRemove(e._nestedArray[i]);f.test(e.name)&&delete e.parent[e.name]}delete this._fullyQualifiedObjects[e.fullName]},h._configure=function(e,t,i){r=e,s=t,o=i}},4529(e){"use strict";e.exports={}},5047(e,t,i){"use strict";t.Service=i(7595)},7595(e,t,i){"use strict";e.exports=r;var n=i(3610);function r(e,t,i){if("function"!=typeof e)throw TypeError("rpcImpl must be a function");n.EventEmitter.call(this),this.rpcImpl=e,this.requestDelimited=Boolean(t),this.responseDelimited=Boolean(i)}(r.prototype=Object.create(n.EventEmitter.prototype)).constructor=r,r.prototype.rpcCall=function e(t,i,r,s,o){if(!s)throw TypeError("request must be specified");var a=this;if(!o)return n.asPromise(e,a,t,i,r,s);if(a.rpcImpl)try{return a.rpcImpl(t,i[a.requestDelimited?"encodeDelimited":"encode"](s).finish(),function(e,i){if(e)return a.emit("error",e,t),o(e);if(null!==i){if(!(i instanceof r))try{i=r[a.responseDelimited?"decodeDelimited":"decode"](i)}catch(e){return a.emit("error",e,t),o(e)}return a.emit("data",i,t),o(null,i)}a.end(!0)})}catch(e){return a.emit("error",e,t),void setTimeout(function(){o(e)},0)}else setTimeout(function(){o(Error("already ended"))},0)},r.prototype.end=function(e){return this.rpcImpl&&(e||this.rpcImpl(null,null,null),this.rpcImpl=null,this.emit("end").off()),this}},9687(e,t,i){"use strict";e.exports=a;var n=i(1304);((a.prototype=Object.create(n.prototype)).constructor=a).className="Service";var r=i(8811),s=i(3262),o=i(5047);function a(e,t){n.call(this,e,t),this.methods={},this._methodsArray=null}function l(e){return e._methodsArray=null,e}a.fromJSON=function(e,t){var i=new a(e,t.options);if(t.methods)for(var n=Object.keys(t.methods),s=0;s<n.length;++s)i.add(r.fromJSON(n[s],t.methods[n[s]]));return t.nested&&i.addJSON(t.nested),t.edition&&(i._edition=t.edition),i.comment=t.comment,i._defaultEdition="proto3",i},a.prototype.toJSON=function(e){var t=n.prototype.toJSON.call(this,e),i=!!e&&Boolean(e.keepComments);return s.toObject(["edition",this._editionToJSON(),"options",t&&t.options||void 0,"methods",n.arrayToJSON(this.methodsArray,e)||{},"nested",t&&t.nested||void 0,"comment",i?this.comment:void 0])},Object.defineProperty(a.prototype,"methodsArray",{get:function(){return this._methodsArray||(this._methodsArray=s.toArray(this.methods))}}),a.prototype.get=function(e){return this.methods[e]||n.prototype.get.call(this,e)},a.prototype.resolveAll=function(){if(!this._needsRecursiveResolve)return this;n.prototype.resolve.call(this);for(var e=this.methodsArray,t=0;t<e.length;++t)e[t].resolve();return this},a.prototype._resolveFeaturesRecursive=function(e){return this._needsRecursiveFeatureResolution?(e=this._edition||e,n.prototype._resolveFeaturesRecursive.call(this,e),this.methodsArray.forEach(t=>{t._resolveFeaturesRecursive(e)}),this):this},a.prototype.add=function(e){if(this.get(e.name))throw Error("duplicate name '"+e.name+"' in "+this);return e instanceof r?(this.methods[e.name]=e,e.parent=this,l(this)):n.prototype.add.call(this,e)},a.prototype.remove=function(e){if(e instanceof r){if(this.methods[e.name]!==e)throw Error(e+" is not a member of "+this);return delete this.methods[e.name],e.parent=null,l(this)}return n.prototype.remove.call(this,e)},a.prototype.create=function(e,t,i){for(var n,r=new o.Service(e,t,i),a=0;a<this.methodsArray.length;++a){var l=s.lcFirst((n=this._methodsArray[a]).resolve().name).replace(/[^$\w_]/g,"");r[l]=s.codegen(["r","c"],s.isReserved(l)?l+"_":l)("return this.rpcCall(m,q,s,r,c)")({m:n,q:n.resolvedRequestType.ctor,s:n.resolvedResponseType.ctor})}return r}},527(e){"use strict";e.exports=h;var t=/[\s{}=;:[\],'"()<>]/g,i=/(?:"([^"\\]*(?:\\.[^"\\]*)*)")/g,n=/(?:'([^'\\]*(?:\\.[^'\\]*)*)')/g,r=/^ *[*/]+ */,s=/^\s*\*?\/*/,o=/\n/g,a=/\s/,l=/\\(.?)/g,c={0:"\0",r:"\r",n:"\n",t:"\t"};function u(e){return e.replace(l,function(e,t){switch(t){case"\\":case"":return t;default:return c[t]||""}})}function h(e,l){e=e.toString();var c=0,h=e.length,d=1,f=0,p={},g=[],m=null;function v(e){return Error("illegal "+e+" (line "+d+")")}function y(t){return e.charAt(t)}function b(t,i,n){var a,c={type:e.charAt(t++),lineEmpty:!1,leading:n},u=t-(l?2:3);do{if(--u<0||"\n"===(a=e.charAt(u))){c.lineEmpty=!0;break}}while(" "===a||"\t"===a);for(var h=e.substring(t,i).split(o),g=0;g<h.length;++g)h[g]=h[g].replace(l?s:r,"").trim();c.text=h.join("\n").trim(),p[d]=c,f=d}function S(t){var i=_(t),n=e.substring(t,i);return/^\s*\/\//.test(n)}function _(e){for(var t=e;t<h&&"\n"!==y(t);)t++;return t}function C(){if(g.length>0)return g.shift();if(m)return function(){var t="'"===m?n:i;t.lastIndex=c-1;var r=t.exec(e);if(!r)throw v("string");return c=t.lastIndex,E(m),m=null,u(r[1])}();var r,s,o,f,p,C=0===c;do{if(c===h)return null;for(r=!1;a.test(o=y(c));)if("\n"===o&&(C=!0,++d),++c===h)return null;if("/"===y(c)){if(++c===h)throw v("comment");if("/"===y(c))if(l){if(f=c,p=!1,S(c-1)){p=!0;do{if((c=_(c))===h)break;if(c++,!C)break}while(S(c))}else c=Math.min(h,_(c)+1);p&&(b(f,c,C),C=!0),d++,r=!0}else{for(p="/"===y(f=c+1);"\n"!==y(++c);)if(c===h)return null;++c,p&&(b(f,c-1,C),C=!0),++d,r=!0}else{if("*"!==(o=y(c)))return"/";f=c+1,p=l||"*"===y(f);do{if("\n"===o&&++d,++c===h)throw v("comment");s=o,o=y(c)}while("*"!==s||"/"!==o);++c,p&&(b(f,c-2,C),C=!0),r=!0}}}while(r);var w=c;if(t.lastIndex=0,!t.test(y(w++)))for(;w<h&&!t.test(y(w));)++w;var T=e.substring(c,c=w);return'"'!==T&&"'"!==T||(m=T),T}function E(e){g.push(e)}function w(){if(!g.length){var e=C();if(null===e)return null;E(e)}return g[0]}return Object.defineProperty({next:C,peek:w,push:E,skip:function(e,t){var i=w();if(i===e)return C(),!0;if(!t)throw v("token '"+i+"', '"+e+"' expected");return!1},cmnt:function(e){var t,i=null;return void 0===e?(t=p[d-1],delete p[d-1],t&&(l||"*"===t.type||t.lineEmpty)&&(i=t.leading?t.text:null)):(f<e&&w(),t=p[e],delete p[e],!t||t.lineEmpty||!l&&"/"!==t.type||(i=t.leading?null:t.text)),i}},"line",{get:function(){return d}})}h.unescape=u},7882(e,t,i){"use strict";e.exports=y;var n=i(1304);((y.prototype=Object.create(n.prototype)).constructor=y).className="Type";var r=i(5643),s=i(1457),o=i(1344),a=i(8252),l=i(9687),c=i(2551),u=i(6237),h=i(3449),d=i(3262),f=i(1080),p=i(7728),g=i(420),m=i(744),v=i(6434);function y(e,t){n.call(this,e,t),this.fields={},this.oneofs=void 0,this.extensions=void 0,this.reserved=void 0,this.group=void 0,this._fieldsById=null,this._fieldsArray=null,this._oneofsArray=null,this._ctor=null}function b(e){return e._fieldsById=e._fieldsArray=e._oneofsArray=null,delete e.encode,delete e.decode,delete e.verify,e}Object.defineProperties(y.prototype,{fieldsById:{get:function(){if(this._fieldsById)return this._fieldsById;this._fieldsById={};for(var e=Object.keys(this.fields),t=0;t<e.length;++t){var i=this.fields[e[t]],n=i.id;if(this._fieldsById[n])throw Error("duplicate id "+n+" in "+this);this._fieldsById[n]=i}return this._fieldsById}},fieldsArray:{get:function(){return this._fieldsArray||(this._fieldsArray=d.toArray(this.fields))}},oneofsArray:{get:function(){return this._oneofsArray||(this._oneofsArray=d.toArray(this.oneofs))}},ctor:{get:function(){return this._ctor||(this.ctor=y.generateConstructor(this)())},set:function(e){var t=e.prototype;t instanceof c||((e.prototype=new c).constructor=e,d.merge(e.prototype,t)),e.$type=e.prototype.$type=this,d.merge(e,c,!0),this._ctor=e;for(var i=0;i<this.fieldsArray.length;++i)this._fieldsArray[i].resolve();var n={};for(i=0;i<this.oneofsArray.length;++i)n[this._oneofsArray[i].resolve().name]={get:d.oneOfGetter(this._oneofsArray[i].oneof),set:d.oneOfSetter(this._oneofsArray[i].oneof)};i&&Object.defineProperties(e.prototype,n)}}}),y.generateConstructor=function(e){for(var t,i=d.codegen(["p"],e.name),n=0;n<e.fieldsArray.length;++n)(t=e._fieldsArray[n]).map?i("this%s={}",d.safeProp(t.name)):t.repeated&&i("this%s=[]",d.safeProp(t.name));return i("if(p)for(var ks=Object.keys(p),i=0;i<ks.length;++i)if(p[ks[i]]!=null)")("this[ks[i]]=p[ks[i]]")},y.fromJSON=function(e,t){var i=new y(e,t.options);i.extensions=t.extensions,i.reserved=t.reserved;for(var c=Object.keys(t.fields),u=0;u<c.length;++u)i.add((void 0!==t.fields[c[u]].keyType?a.fromJSON:o.fromJSON)(c[u],t.fields[c[u]]));if(t.oneofs)for(c=Object.keys(t.oneofs),u=0;u<c.length;++u)i.add(s.fromJSON(c[u],t.oneofs[c[u]]));if(t.nested)for(c=Object.keys(t.nested),u=0;u<c.length;++u){var h=t.nested[c[u]];i.add((void 0!==h.id?o.fromJSON:void 0!==h.fields?y.fromJSON:void 0!==h.values?r.fromJSON:void 0!==h.methods?l.fromJSON:n.fromJSON)(c[u],h))}return t.extensions&&t.extensions.length&&(i.extensions=t.extensions),t.reserved&&t.reserved.length&&(i.reserved=t.reserved),t.group&&(i.group=!0),t.comment&&(i.comment=t.comment),t.edition&&(i._edition=t.edition),i._defaultEdition="proto3",i},y.prototype.toJSON=function(e){var t=n.prototype.toJSON.call(this,e),i=!!e&&Boolean(e.keepComments);return d.toObject(["edition",this._editionToJSON(),"options",t&&t.options||void 0,"oneofs",n.arrayToJSON(this.oneofsArray,e),"fields",n.arrayToJSON(this.fieldsArray.filter(function(e){return!e.declaringField}),e)||{},"extensions",this.extensions&&this.extensions.length?this.extensions:void 0,"reserved",this.reserved&&this.reserved.length?this.reserved:void 0,"group",this.group||void 0,"nested",t&&t.nested||void 0,"comment",i?this.comment:void 0])},y.prototype.resolveAll=function(){if(!this._needsRecursiveResolve)return this;n.prototype.resolveAll.call(this);var e=this.oneofsArray;for(i=0;i<e.length;)e[i++].resolve();for(var t=this.fieldsArray,i=0;i<t.length;)t[i++].resolve();return this},y.prototype._resolveFeaturesRecursive=function(e){return this._needsRecursiveFeatureResolution?(e=this._edition||e,n.prototype._resolveFeaturesRecursive.call(this,e),this.oneofsArray.forEach(t=>{t._resolveFeatures(e)}),this.fieldsArray.forEach(t=>{t._resolveFeatures(e)}),this):this},y.prototype.get=function(e){return this.fields[e]||this.oneofs&&this.oneofs[e]||this.nested&&this.nested[e]||null},y.prototype.add=function(e){if(this.get(e.name))throw Error("duplicate name '"+e.name+"' in "+this);if(e instanceof o&&void 0===e.extend){if(this._fieldsById?this._fieldsById[e.id]:this.fieldsById[e.id])throw Error("duplicate id "+e.id+" in "+this);if(this.isReservedId(e.id))throw Error("id "+e.id+" is reserved in "+this);if(this.isReservedName(e.name))throw Error("name '"+e.name+"' is reserved in "+this);return e.parent&&e.parent.remove(e),this.fields[e.name]=e,e.message=this,e.onAdd(this),b(this)}return e instanceof s?(this.oneofs||(this.oneofs={}),this.oneofs[e.name]=e,e.onAdd(this),b(this)):n.prototype.add.call(this,e)},y.prototype.remove=function(e){if(e instanceof o&&void 0===e.extend){if(!this.fields||this.fields[e.name]!==e)throw Error(e+" is not a member of "+this);return delete this.fields[e.name],e.parent=null,e.onRemove(this),b(this)}if(e instanceof s){if(!this.oneofs||this.oneofs[e.name]!==e)throw Error(e+" is not a member of "+this);return delete this.oneofs[e.name],e.parent=null,e.onRemove(this),b(this)}return n.prototype.remove.call(this,e)},y.prototype.isReservedId=function(e){return n.isReservedId(this.reserved,e)},y.prototype.isReservedName=function(e){return n.isReservedName(this.reserved,e)},y.prototype.create=function(e){return new this.ctor(e)},y.prototype.setup=function(){for(var e=this.fullName,t=[],i=0;i<this.fieldsArray.length;++i)t.push(this._fieldsArray[i].resolve().resolvedType);this.encode=f(this)({Writer:h,types:t,util:d}),this.decode=p(this)({Reader:u,types:t,util:d}),this.verify=g(this)({types:t,util:d}),this.fromObject=m.fromObject(this)({types:t,util:d}),this.toObject=m.toObject(this)({types:t,util:d});var n=v[e];if(n){var r=Object.create(this);r.fromObject=this.fromObject,this.fromObject=n.fromObject.bind(r),r.toObject=this.toObject,this.toObject=n.toObject.bind(r)}return this},y.prototype.encode=function(e,t){return this.setup().encode(e,t)},y.prototype.encodeDelimited=function(e,t){return this.encode(e,t&&t.len?t.fork():t).ldelim()},y.prototype.decode=function(e,t){return this.setup().decode(e,t)},y.prototype.decodeDelimited=function(e){return e instanceof u||(e=u.create(e)),this.decode(e,e.uint32())},y.prototype.verify=function(e){return this.setup().verify(e)},y.prototype.fromObject=function(e){return this.setup().fromObject(e)},y.prototype.toObject=function(e,t){return this.setup().toObject(e,t)},y.d=function(e){return function(t){d.decorateType(t,e)}}},361(e,t,i){"use strict";var n=t,r=i(3262),s=["double","float","int32","uint32","sint32","fixed32","sfixed32","int64","uint64","sint64","fixed64","sfixed64","bool","string","bytes"];function o(e,t){var i=0,n={};for(t|=0;i<e.length;)n[s[i+t]]=e[i++];return n}n.basic=o([1,5,0,0,0,5,5,0,0,0,1,1,0,2,2]),n.defaults=o([0,0,0,0,0,0,0,0,0,0,0,0,!1,"",r.emptyArray,null]),n.long=o([0,0,0,1,1],7),n.mapKey=o([0,0,0,5,5,0,0,0,1,1,0,2],2),n.packed=o([1,5,0,0,0,5,5,0,0,0,1,1,0])},3262(e,t,i){"use strict";var n,r,s=e.exports=i(3610),o=i(4529);s.codegen=i(8561),s.fetch=i(5212),s.path=i(9207),s.fs=s.inquire("fs"),s.toArray=function(e){if(e){for(var t=Object.keys(e),i=new Array(t.length),n=0;n<t.length;)i[n]=e[t[n++]];return i}return[]},s.toObject=function(e){for(var t={},i=0;i<e.length;){var n=e[i++],r=e[i++];void 0!==r&&(t[n]=r)}return t};var a=/\\/g,l=/"/g;s.isReserved=function(e){return/^(?:do|if|in|for|let|new|try|var|case|else|enum|eval|false|null|this|true|void|with|break|catch|class|const|super|throw|while|yield|delete|export|import|public|return|static|switch|typeof|default|extends|finally|package|private|continue|debugger|function|arguments|interface|protected|implements|instanceof)$/.test(e)},s.safeProp=function(e){return!/^[$\w_]+$/.test(e)||s.isReserved(e)?'["'+e.replace(a,"\\\\").replace(l,'\\"')+'"]':"."+e},s.ucFirst=function(e){return e.charAt(0).toUpperCase()+e.substring(1)};var c=/_([a-z])/g;s.camelCase=function(e){return e.substring(0,1)+e.substring(1).replace(c,function(e,t){return t.toUpperCase()})},s.compareFieldsById=function(e,t){return e.id-t.id},s.decorateType=function(e,t){if(e.$type)return t&&e.$type.name!==t&&(s.decorateRoot.remove(e.$type),e.$type.name=t,s.decorateRoot.add(e.$type)),e.$type;n||(n=i(7882));var r=new n(t||e.name);return s.decorateRoot.add(r),r.ctor=e,Object.defineProperty(e,"$type",{value:r,enumerable:!1}),Object.defineProperty(e.prototype,"$type",{value:r,enumerable:!1}),r};var u=0;s.decorateEnum=function(e){if(e.$type)return e.$type;r||(r=i(5643));var t=new r("Enum"+u++,e);return s.decorateRoot.add(t),Object.defineProperty(e,"$type",{value:t,enumerable:!1}),t},s.setProperty=function(e,t,i,n){if("object"!=typeof e)throw TypeError("dst must be an object");if(!t)throw TypeError("path must be specified");return function e(t,i,r){var s=i.shift();if("__proto__"===s||"prototype"===s)return t;if(i.length>0)t[s]=e(t[s]||{},i,r);else{var o=t[s];if(o&&n)return t;o&&(r=[].concat(o).concat(r)),t[s]=r}return t}(e,t=t.split("."),i)},Object.defineProperty(s,"decorateRoot",{get:function(){return o.decorated||(o.decorated=new(i(5330)))}})},2239(e,t,i){"use strict";e.exports=r;var n=i(3610);function r(e,t){this.lo=e>>>0,this.hi=t>>>0}var s=r.zero=new r(0,0);s.toNumber=function(){return 0},s.zzEncode=s.zzDecode=function(){return this},s.length=function(){return 1};var o=r.zeroHash="\0\0\0\0\0\0\0\0";r.fromNumber=function(e){if(0===e)return s;var t=e<0;t&&(e=-e);var i=e>>>0,n=(e-i)/4294967296>>>0;return t&&(n=~n>>>0,i=~i>>>0,++i>4294967295&&(i=0,++n>4294967295&&(n=0))),new r(i,n)},r.from=function(e){if("number"==typeof e)return r.fromNumber(e);if(n.isString(e)){if(!n.Long)return r.fromNumber(parseInt(e,10));e=n.Long.fromString(e)}return e.low||e.high?new r(e.low>>>0,e.high>>>0):s},r.prototype.toNumber=function(e){if(!e&&this.hi>>>31){var t=1+~this.lo>>>0,i=~this.hi>>>0;return t||(i=i+1>>>0),-(t+4294967296*i)}return this.lo+4294967296*this.hi},r.prototype.toLong=function(e){return n.Long?new n.Long(0|this.lo,0|this.hi,Boolean(e)):{low:0|this.lo,high:0|this.hi,unsigned:Boolean(e)}};var a=String.prototype.charCodeAt;r.fromHash=function(e){return e===o?s:new r((a.call(e,0)|a.call(e,1)<<8|a.call(e,2)<<16|a.call(e,3)<<24)>>>0,(a.call(e,4)|a.call(e,5)<<8|a.call(e,6)<<16|a.call(e,7)<<24)>>>0)},r.prototype.toHash=function(){return String.fromCharCode(255&this.lo,this.lo>>>8&255,this.lo>>>16&255,this.lo>>>24,255&this.hi,this.hi>>>8&255,this.hi>>>16&255,this.hi>>>24)},r.prototype.zzEncode=function(){var e=this.hi>>31;return this.hi=((this.hi<<1|this.lo>>>31)^e)>>>0,this.lo=(this.lo<<1^e)>>>0,this},r.prototype.zzDecode=function(){var e=-(1&this.lo);return this.lo=((this.lo>>>1|this.hi<<31)^e)>>>0,this.hi=(this.hi>>>1^e)>>>0,this},r.prototype.length=function(){var e=this.lo,t=(this.lo>>>28|this.hi<<4)>>>0,i=this.hi>>>24;return 0===i?0===t?e<16384?e<128?1:2:e<2097152?3:4:t<16384?t<128?5:6:t<2097152?7:8:i<128?9:10}},3610(e,t,i){"use strict";var n=t;function r(e,t,i){for(var n=Object.keys(t),r=0;r<n.length;++r)void 0!==e[n[r]]&&i||(e[n[r]]=t[n[r]]);return e}function s(e){function t(e,i){if(!(this instanceof t))return new t(e,i);Object.defineProperty(this,"message",{get:function(){return e}}),Error.captureStackTrace?Error.captureStackTrace(this,t):Object.defineProperty(this,"stack",{value:(new Error).stack||""}),i&&r(this,i)}return t.prototype=Object.create(Error.prototype,{constructor:{value:t,writable:!0,enumerable:!1,configurable:!0},name:{get:function(){return e},set:void 0,enumerable:!1,configurable:!0},toString:{value:function(){return this.name+": "+this.message},writable:!0,enumerable:!1,configurable:!0}}),t}n.asPromise=i(8045),n.base64=i(8839),n.EventEmitter=i(4358),n.float=i(9410),n.inquire=i(4153),n.utf8=i(1447),n.pool=i(9390),n.LongBits=i(2239),n.isNode=Boolean("undefined"!=typeof global&&global&&global.process&&global.process.versions&&global.process.versions.node),n.global=n.isNode&&global||"undefined"!=typeof window&&window||"undefined"!=typeof self&&self||this,n.emptyArray=Object.freeze?Object.freeze([]):[],n.emptyObject=Object.freeze?Object.freeze({}):{},n.isInteger=Number.isInteger||function(e){return"number"==typeof e&&isFinite(e)&&Math.floor(e)===e},n.isString=function(e){return"string"==typeof e||e instanceof String},n.isObject=function(e){return e&&"object"==typeof e},n.isset=n.isSet=function(e,t){var i=e[t];return!(null==i||!e.hasOwnProperty(t))&&("object"!=typeof i||(Array.isArray(i)?i.length:Object.keys(i).length)>0)},n.Buffer=function(){try{var e=n.inquire("buffer").Buffer;return e.prototype.utf8Write?e:null}catch(e){return null}}(),n._Buffer_from=null,n._Buffer_allocUnsafe=null,n.newBuffer=function(e){return"number"==typeof e?n.Buffer?n._Buffer_allocUnsafe(e):new n.Array(e):n.Buffer?n._Buffer_from(e):"undefined"==typeof Uint8Array?e:new Uint8Array(e)},n.Array="undefined"!=typeof Uint8Array?Uint8Array:Array,n.Long=n.global.dcodeIO&&n.global.dcodeIO.Long||n.global.Long||n.inquire("long"),n.key2Re=/^true|false|0|1$/,n.key32Re=/^-?(?:0|[1-9][0-9]*)$/,n.key64Re=/^(?:[\\x00-\\xff]{8}|-?(?:0|[1-9][0-9]*))$/,n.longToHash=function(e){return e?n.LongBits.from(e).toHash():n.LongBits.zeroHash},n.longFromHash=function(e,t){var i=n.LongBits.fromHash(e);return n.Long?n.Long.fromBits(i.lo,i.hi,t):i.toNumber(Boolean(t))},n.merge=r,n.lcFirst=function(e){return e.charAt(0).toLowerCase()+e.substring(1)},n.newError=s,n.ProtocolError=s("ProtocolError"),n.oneOfGetter=function(e){for(var t={},i=0;i<e.length;++i)t[e[i]]=1;return function(){for(var e=Object.keys(this),i=e.length-1;i>-1;--i)if(1===t[e[i]]&&void 0!==this[e[i]]&&null!==this[e[i]])return e[i]}},n.oneOfSetter=function(e){return function(t){for(var i=0;i<e.length;++i)e[i]!==t&&delete this[e[i]]}},n.toJSONOptions={longs:String,enums:String,bytes:String,json:!0},n._configure=function(){var e=n.Buffer;e?(n._Buffer_from=e.from!==Uint8Array.from&&e.from||function(t,i){return new e(t,i)},n._Buffer_allocUnsafe=e.allocUnsafe||function(t){return new e(t)}):n._Buffer_from=n._Buffer_allocUnsafe=null}},420(e,t,i){"use strict";e.exports=function(e){var t=r.codegen(["m"],e.name+"$verify")('if(typeof m!=="object"||m===null)')("return%j","object expected"),i=e.oneofsArray,n={};i.length&&t("var p={}");for(var l=0;l<e.fieldsArray.length;++l){var c=e._fieldsArray[l].resolve(),u="m"+r.safeProp(c.name);if(c.optional&&t("if(%s!=null&&m.hasOwnProperty(%j)){",u,c.name),c.map)t("if(!util.isObject(%s))",u)("return%j",s(c,"object"))("var k=Object.keys(%s)",u)("for(var i=0;i<k.length;++i){"),a(t,c,"k[i]"),o(t,c,l,u+"[k[i]]")("}");else if(c.repeated)t("if(!Array.isArray(%s))",u)("return%j",s(c,"array"))("for(var i=0;i<%s.length;++i){",u),o(t,c,l,u+"[i]")("}");else{if(c.partOf){var h=r.safeProp(c.partOf.name);1===n[c.partOf.name]&&t("if(p%s===1)",h)("return%j",c.partOf.name+": multiple values"),n[c.partOf.name]=1,t("p%s=1",h)}o(t,c,l,u)}c.optional&&t("}")}return t("return null")};var n=i(5643),r=i(3262);function s(e,t){return e.name+": "+t+(e.repeated&&"array"!==t?"[]":e.map&&"object"!==t?"{k:"+e.keyType+"}":"")+" expected"}function o(e,t,i,r){if(t.resolvedType)if(t.resolvedType instanceof n){e("switch(%s){",r)("default:")("return%j",s(t,"enum value"));for(var o=Object.keys(t.resolvedType.values),a=0;a<o.length;++a)e("case %i:",t.resolvedType.values[o[a]]);e("break")("}")}else e("{")("var e=types[%i].verify(%s);",i,r)("if(e)")("return%j+e",t.name+".")("}");else switch(t.type){case"int32":case"uint32":case"sint32":case"fixed32":case"sfixed32":e("if(!util.isInteger(%s))",r)("return%j",s(t,"integer"));break;case"int64":case"uint64":case"sint64":case"fixed64":case"sfixed64":e("if(!util.isInteger(%s)&&!(%s&&util.isInteger(%s.low)&&util.isInteger(%s.high)))",r,r,r,r)("return%j",s(t,"integer|Long"));break;case"float":case"double":e('if(typeof %s!=="number")',r)("return%j",s(t,"number"));break;case"bool":e('if(typeof %s!=="boolean")',r)("return%j",s(t,"boolean"));break;case"string":e("if(!util.isString(%s))",r)("return%j",s(t,"string"));break;case"bytes":e('if(!(%s&&typeof %s.length==="number"||util.isString(%s)))',r,r,r)("return%j",s(t,"buffer"))}return e}function a(e,t,i){switch(t.keyType){case"int32":case"uint32":case"sint32":case"fixed32":case"sfixed32":e("if(!util.key32Re.test(%s))",i)("return%j",s(t,"integer key"));break;case"int64":case"uint64":case"sint64":case"fixed64":case"sfixed64":e("if(!util.key64Re.test(%s))",i)("return%j",s(t,"integer|Long key"));break;case"bool":e("if(!util.key2Re.test(%s))",i)("return%j",s(t,"boolean key"))}return e}},6434(e,t,i){"use strict";var n=t,r=i(2551);n[".google.protobuf.Any"]={fromObject:function(e){if(e&&e["@type"]){var t=e["@type"].substring(e["@type"].lastIndexOf("/")+1),i=this.lookup(t);if(i){var n="."===e["@type"].charAt(0)?e["@type"].slice(1):e["@type"];return-1===n.indexOf("/")&&(n="/"+n),this.create({type_url:n,value:i.encode(i.fromObject(e)).finish()})}}return this.fromObject(e)},toObject:function(e,t){var i="",n="";if(t&&t.json&&e.type_url&&e.value){n=e.type_url.substring(e.type_url.lastIndexOf("/")+1),i=e.type_url.substring(0,e.type_url.lastIndexOf("/")+1);var s=this.lookup(n);s&&(e=s.decode(e.value))}if(!(e instanceof this.ctor)&&e instanceof r){var o=e.$type.toObject(e,t);return""===i&&(i="type.googleapis.com/"),n=i+("."===e.$type.fullName[0]?e.$type.fullName.slice(1):e.$type.fullName),o["@type"]=n,o}return this.toObject(e,t)}}},3449(e,t,i){"use strict";e.exports=h;var n,r=i(3610),s=r.LongBits,o=r.base64,a=r.utf8;function l(e,t,i){this.fn=e,this.len=t,this.next=void 0,this.val=i}function c(){}function u(e){this.head=e.head,this.tail=e.tail,this.len=e.len,this.next=e.states}function h(){this.len=0,this.head=new l(c,0,0),this.tail=this.head,this.states=null}var d=function(){return r.Buffer?function(){return(h.create=function(){return new n})()}:function(){return new h}};function f(e,t,i){t[i]=255&e}function p(e,t){this.len=e,this.next=void 0,this.val=t}function g(e,t,i){for(;e.hi;)t[i++]=127&e.lo|128,e.lo=(e.lo>>>7|e.hi<<25)>>>0,e.hi>>>=7;for(;e.lo>127;)t[i++]=127&e.lo|128,e.lo=e.lo>>>7;t[i++]=e.lo}function m(e,t,i){t[i]=255&e,t[i+1]=e>>>8&255,t[i+2]=e>>>16&255,t[i+3]=e>>>24}h.create=d(),h.alloc=function(e){return new r.Array(e)},r.Array!==Array&&(h.alloc=r.pool(h.alloc,r.Array.prototype.subarray)),h.prototype._push=function(e,t,i){return this.tail=this.tail.next=new l(e,t,i),this.len+=t,this},p.prototype=Object.create(l.prototype),p.prototype.fn=function(e,t,i){for(;e>127;)t[i++]=127&e|128,e>>>=7;t[i]=e},h.prototype.uint32=function(e){return this.len+=(this.tail=this.tail.next=new p((e>>>=0)<128?1:e<16384?2:e<2097152?3:e<268435456?4:5,e)).len,this},h.prototype.int32=function(e){return e<0?this._push(g,10,s.fromNumber(e)):this.uint32(e)},h.prototype.sint32=function(e){return this.uint32((e<<1^e>>31)>>>0)},h.prototype.uint64=function(e){var t=s.from(e);return this._push(g,t.length(),t)},h.prototype.int64=h.prototype.uint64,h.prototype.sint64=function(e){var t=s.from(e).zzEncode();return this._push(g,t.length(),t)},h.prototype.bool=function(e){return this._push(f,1,e?1:0)},h.prototype.fixed32=function(e){return this._push(m,4,e>>>0)},h.prototype.sfixed32=h.prototype.fixed32,h.prototype.fixed64=function(e){var t=s.from(e);return this._push(m,4,t.lo)._push(m,4,t.hi)},h.prototype.sfixed64=h.prototype.fixed64,h.prototype.float=function(e){return this._push(r.float.writeFloatLE,4,e)},h.prototype.double=function(e){return this._push(r.float.writeDoubleLE,8,e)};var v=r.Array.prototype.set?function(e,t,i){t.set(e,i)}:function(e,t,i){for(var n=0;n<e.length;++n)t[i+n]=e[n]};h.prototype.bytes=function(e){var t=e.length>>>0;if(!t)return this._push(f,1,0);if(r.isString(e)){var i=h.alloc(t=o.length(e));o.decode(e,i,0),e=i}return this.uint32(t)._push(v,t,e)},h.prototype.string=function(e){var t=a.length(e);return t?this.uint32(t)._push(a.write,t,e):this._push(f,1,0)},h.prototype.fork=function(){return this.states=new u(this),this.head=this.tail=new l(c,0,0),this.len=0,this},h.prototype.reset=function(){return this.states?(this.head=this.states.head,this.tail=this.states.tail,this.len=this.states.len,this.states=this.states.next):(this.head=this.tail=new l(c,0,0),this.len=0),this},h.prototype.ldelim=function(){var e=this.head,t=this.tail,i=this.len;return this.reset().uint32(i),i&&(this.tail.next=e.next,this.tail=t,this.len+=i),this},h.prototype.finish=function(){for(var e=this.head.next,t=this.constructor.alloc(this.len),i=0;e;)e.fn(e.val,t,i),i+=e.len,e=e.next;return t},h._configure=function(e){n=e,h.create=d(),n._configure()}},818(e,t,i){"use strict";e.exports=s;var n=i(3449);(s.prototype=Object.create(n.prototype)).constructor=s;var r=i(3610);function s(){n.call(this)}function o(e,t,i){e.length<40?r.utf8.write(e,t,i):t.utf8Write?t.utf8Write(e,i):t.write(e,i)}s._configure=function(){s.alloc=r._Buffer_allocUnsafe,s.writeBytesBuffer=r.Buffer&&r.Buffer.prototype instanceof Uint8Array&&"set"===r.Buffer.prototype.set.name?function(e,t,i){t.set(e,i)}:function(e,t,i){if(e.copy)e.copy(t,i,0,e.length);else for(var n=0;n<e.length;)t[i++]=e[n++]}},s.prototype.bytes=function(e){r.isString(e)&&(e=r._Buffer_from(e,"base64"));var t=e.length>>>0;return this.uint32(t),t&&this._push(s.writeBytesBuffer,t,e),this},s.prototype.string=function(e){var t=r.Buffer.byteLength(e);return this.uint32(t),t&&this._push(o,t,e),this},s._configure()},815(e,t,i){var n,r=i(3519),s=i(6611);try{n=i(9896)}catch(e){}var o=function(){},a="undefined"!=typeof process&&/^v?\.0/.test(process.version),l=function(e){return"function"==typeof e},c=function(e,t,i,c){c=r(c);var u=!1;e.on("close",function(){u=!0}),s(e,{readable:t,writable:i},function(e){if(e)return c(e);u=!0,c()});var h=!1;return function(t){if(!u&&!h)return h=!0,function(e){return!!a&&!!n&&(e instanceof(n.ReadStream||o)||e instanceof(n.WriteStream||o))&&l(e.close)}(e)?e.close(o):function(e){return e.setHeader&&l(e.abort)}(e)?e.abort():l(e.destroy)?e.destroy():void c(t||new Error("stream was destroyed"))}},u=function(e){e()},h=function(e,t){return e.pipe(t)};e.exports=function(){var e,t=Array.prototype.slice.call(arguments),i=l(t[t.length-1]||o)&&t.pop()||o;if(Array.isArray(t[0])&&(t=t[0]),t.length<2)throw new Error("pump requires two streams per minimum");var n=t.map(function(r,s){var o=s<t.length-1;return c(r,o,s>0,function(t){e||(e=t),t&&n.forEach(u),o||(n.forEach(u),i(e))})});return t.reduce(h)}},113(e){"use strict";const t={};function i(e,i,n){n||(n=Error);class r extends n{constructor(e,t,n){super(function(e,t,n){return"string"==typeof i?i:i(e,t,n)}(e,t,n))}}r.prototype.name=n.name,r.prototype.code=e,t[e]=r}function n(e,t){if(Array.isArray(e)){const i=e.length;return e=e.map(e=>String(e)),i>2?`one of ${t} ${e.slice(0,i-1).join(", ")}, or `+e[i-1]:2===i?`one of ${t} ${e[0]} or ${e[1]}`:`of ${t} ${e[0]}`}return`of ${t} ${String(e)}`}i("ERR_INVALID_OPT_VALUE",function(e,t){return'The value "'+t+'" is invalid for option "'+e+'"'},TypeError),i("ERR_INVALID_ARG_TYPE",function(e,t,i){let r;var s,o;let a;if("string"==typeof t&&(s="not ",t.substr(!o||o<0?0:+o,s.length)===s)?(r="must not be",t=t.replace(/^not /,"")):r="must be",function(e,t,i){return(void 0===i||i>e.length)&&(i=e.length),e.substring(i-t.length,i)===t}(e," argument"))a=`The ${e} ${r} ${n(t,"type")}`;else{const i=function(e,t,i){return"number"!=typeof i&&(i=0),!(i+t.length>e.length)&&-1!==e.indexOf(t,i)}(e,".")?"property":"argument";a=`The "${e}" ${i} ${r} ${n(t,"type")}`}return a+=". Received type "+typeof i,a},TypeError),i("ERR_STREAM_PUSH_AFTER_EOF","stream.push() after EOF"),i("ERR_METHOD_NOT_IMPLEMENTED",function(e){return"The "+e+" method is not implemented"}),i("ERR_STREAM_PREMATURE_CLOSE","Premature close"),i("ERR_STREAM_DESTROYED",function(e){return"Cannot call "+e+" after a stream was destroyed"}),i("ERR_MULTIPLE_CALLBACK","Callback called multiple times"),i("ERR_STREAM_CANNOT_PIPE","Cannot pipe, not readable"),i("ERR_STREAM_WRITE_AFTER_END","write after end"),i("ERR_STREAM_NULL_VALUES","May not write null values to stream",TypeError),i("ERR_UNKNOWN_ENCODING",function(e){return"Unknown encoding: "+e},TypeError),i("ERR_STREAM_UNSHIFT_AFTER_END_EVENT","stream.unshift() after end event"),e.exports.F=t},5382(e,t,i){"use strict";var n=Object.keys||function(e){var t=[];for(var i in e)t.push(i);return t};e.exports=c;var r=i(5412),s=i(6708);i(2017)(c,r);for(var o=n(s.prototype),a=0;a<o.length;a++){var l=o[a];c.prototype[l]||(c.prototype[l]=s.prototype[l])}function c(e){if(!(this instanceof c))return new c(e);r.call(this,e),s.call(this,e),this.allowHalfOpen=!0,e&&(!1===e.readable&&(this.readable=!1),!1===e.writable&&(this.writable=!1),!1===e.allowHalfOpen&&(this.allowHalfOpen=!1,this.once("end",u)))}function u(){this._writableState.ended||process.nextTick(h,this)}function h(e){e.end()}Object.defineProperty(c.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}}),Object.defineProperty(c.prototype,"writableBuffer",{enumerable:!1,get:function(){return this._writableState&&this._writableState.getBuffer()}}),Object.defineProperty(c.prototype,"writableLength",{enumerable:!1,get:function(){return this._writableState.length}}),Object.defineProperty(c.prototype,"destroyed",{enumerable:!1,get:function(){return void 0!==this._readableState&&void 0!==this._writableState&&(this._readableState.destroyed&&this._writableState.destroyed)},set:function(e){void 0!==this._readableState&&void 0!==this._writableState&&(this._readableState.destroyed=e,this._writableState.destroyed=e)}})},3600(e,t,i){"use strict";e.exports=r;var n=i(4610);function r(e){if(!(this instanceof r))return new r(e);n.call(this,e)}i(2017)(r,n),r.prototype._transform=function(e,t,i){i(null,e)}},5412(e,t,i){"use strict";var n;e.exports=w,w.ReadableState=E;i(4434).EventEmitter;var r=function(e,t){return e.listeners(t).length},s=i(1416),o=i(181).Buffer,a=("undefined"!=typeof global?global:"undefined"!=typeof window?window:"undefined"!=typeof self?self:{}).Uint8Array||function(){};var l,c=i(9023);l=c&&c.debuglog?c.debuglog("stream"):function(){};var u,h,d,f=i(345),p=i(5896),g=i(5291).getHighWaterMark,m=i(113).F,v=m.ERR_INVALID_ARG_TYPE,y=m.ERR_STREAM_PUSH_AFTER_EOF,b=m.ERR_METHOD_NOT_IMPLEMENTED,S=m.ERR_STREAM_UNSHIFT_AFTER_END_EVENT;i(2017)(w,s);var _=p.errorOrDestroy,C=["error","close","destroy","pause","resume"];function E(e,t,r){n=n||i(5382),e=e||{},"boolean"!=typeof r&&(r=t instanceof n),this.objectMode=!!e.objectMode,r&&(this.objectMode=this.objectMode||!!e.readableObjectMode),this.highWaterMark=g(this,e,"readableHighWaterMark",r),this.buffer=new f,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.resumeScheduled=!1,this.paused=!0,this.emitClose=!1!==e.emitClose,this.autoDestroy=!!e.autoDestroy,this.destroyed=!1,this.defaultEncoding=e.defaultEncoding||"utf8",this.awaitDrain=0,this.readingMore=!1,this.decoder=null,this.encoding=null,e.encoding&&(u||(u=i(3141).I),this.decoder=new u(e.encoding),this.encoding=e.encoding)}function w(e){if(n=n||i(5382),!(this instanceof w))return new w(e);var t=this instanceof n;this._readableState=new E(e,this,t),this.readable=!0,e&&("function"==typeof e.read&&(this._read=e.read),"function"==typeof e.destroy&&(this._destroy=e.destroy)),s.call(this)}function T(e,t,i,n,r){l("readableAddChunk",t);var s,c=e._readableState;if(null===t)c.reading=!1,function(e,t){if(l("onEofChunk"),t.ended)return;if(t.decoder){var i=t.decoder.end();i&&i.length&&(t.buffer.push(i),t.length+=t.objectMode?1:i.length)}t.ended=!0,t.sync?A(e):(t.needReadable=!1,t.emittedReadable||(t.emittedReadable=!0,P(e)))}(e,c);else if(r||(s=function(e,t){var i;n=t,o.isBuffer(n)||n instanceof a||"string"==typeof t||void 0===t||e.objectMode||(i=new v("chunk",["string","Buffer","Uint8Array"],t));var n;return i}(c,t)),s)_(e,s);else if(c.objectMode||t&&t.length>0)if("string"==typeof t||c.objectMode||Object.getPrototypeOf(t)===o.prototype||(t=function(e){return o.from(e)}(t)),n)c.endEmitted?_(e,new S):k(e,c,t,!0);else if(c.ended)_(e,new y);else{if(c.destroyed)return!1;c.reading=!1,c.decoder&&!i?(t=c.decoder.write(t),c.objectMode||0!==t.length?k(e,c,t,!1):N(e,c)):k(e,c,t,!1)}else n||(c.reading=!1,N(e,c));return!c.ended&&(c.length<c.highWaterMark||0===c.length)}function k(e,t,i,n){t.flowing&&0===t.length&&!t.sync?(t.awaitDrain=0,e.emit("data",i)):(t.length+=t.objectMode?1:i.length,n?t.buffer.unshift(i):t.buffer.push(i),t.needReadable&&A(e)),N(e,t)}Object.defineProperty(w.prototype,"destroyed",{enumerable:!1,get:function(){return void 0!==this._readableState&&this._readableState.destroyed},set:function(e){this._readableState&&(this._readableState.destroyed=e)}}),w.prototype.destroy=p.destroy,w.prototype._undestroy=p.undestroy,w.prototype._destroy=function(e,t){t(e)},w.prototype.push=function(e,t){var i,n=this._readableState;return n.objectMode?i=!0:"string"==typeof e&&((t=t||n.defaultEncoding)!==n.encoding&&(e=o.from(e,t),t=""),i=!0),T(this,e,t,!1,i)},w.prototype.unshift=function(e){return T(this,e,null,!0,!1)},w.prototype.isPaused=function(){return!1===this._readableState.flowing},w.prototype.setEncoding=function(e){u||(u=i(3141).I);var t=new u(e);this._readableState.decoder=t,this._readableState.encoding=this._readableState.decoder.encoding;for(var n=this._readableState.buffer.head,r="";null!==n;)r+=t.write(n.data),n=n.next;return this._readableState.buffer.clear(),""!==r&&this._readableState.buffer.push(r),this._readableState.length=r.length,this};var R=1073741824;function O(e,t){return e<=0||0===t.length&&t.ended?0:t.objectMode?1:e!=e?t.flowing&&t.length?t.buffer.head.data.length:t.length:(e>t.highWaterMark&&(t.highWaterMark=function(e){return e>=R?e=R:(e--,e|=e>>>1,e|=e>>>2,e|=e>>>4,e|=e>>>8,e|=e>>>16,e++),e}(e)),e<=t.length?e:t.ended?t.length:(t.needReadable=!0,0))}function A(e){var t=e._readableState;l("emitReadable",t.needReadable,t.emittedReadable),t.needReadable=!1,t.emittedReadable||(l("emitReadable",t.flowing),t.emittedReadable=!0,process.nextTick(P,e))}function P(e){var t=e._readableState;l("emitReadable_",t.destroyed,t.length,t.ended),t.destroyed||!t.length&&!t.ended||(e.emit("readable"),t.emittedReadable=!1),t.needReadable=!t.flowing&&!t.ended&&t.length<=t.highWaterMark,D(e)}function N(e,t){t.readingMore||(t.readingMore=!0,process.nextTick(x,e,t))}function x(e,t){for(;!t.reading&&!t.ended&&(t.length<t.highWaterMark||t.flowing&&0===t.length);){var i=t.length;if(l("maybeReadMore read 0"),e.read(0),i===t.length)break}t.readingMore=!1}function I(e){var t=e._readableState;t.readableListening=e.listenerCount("readable")>0,t.resumeScheduled&&!t.paused?t.flowing=!0:e.listenerCount("data")>0&&e.resume()}function M(e){l("readable nexttick read 0"),e.read(0)}function L(e,t){l("resume",t.reading),t.reading||e.read(0),t.resumeScheduled=!1,e.emit("resume"),D(e),t.flowing&&!t.reading&&e.read(0)}function D(e){var t=e._readableState;for(l("flow",t.flowing);t.flowing&&null!==e.read(););}function j(e,t){return 0===t.length?null:(t.objectMode?i=t.buffer.shift():!e||e>=t.length?(i=t.decoder?t.buffer.join(""):1===t.buffer.length?t.buffer.first():t.buffer.concat(t.length),t.buffer.clear()):i=t.buffer.consume(e,t.decoder),i);var i}function F(e){var t=e._readableState;l("endReadable",t.endEmitted),t.endEmitted||(t.ended=!0,process.nextTick(B,t,e))}function B(e,t){if(l("endReadableNT",e.endEmitted,e.length),!e.endEmitted&&0===e.length&&(e.endEmitted=!0,t.readable=!1,t.emit("end"),e.autoDestroy)){var i=t._writableState;(!i||i.autoDestroy&&i.finished)&&t.destroy()}}function U(e,t){for(var i=0,n=e.length;i<n;i++)if(e[i]===t)return i;return-1}w.prototype.read=function(e){l("read",e),e=parseInt(e,10);var t=this._readableState,i=e;if(0!==e&&(t.emittedReadable=!1),0===e&&t.needReadable&&((0!==t.highWaterMark?t.length>=t.highWaterMark:t.length>0)||t.ended))return l("read: emitReadable",t.length,t.ended),0===t.length&&t.ended?F(this):A(this),null;if(0===(e=O(e,t))&&t.ended)return 0===t.length&&F(this),null;var n,r=t.needReadable;return l("need readable",r),(0===t.length||t.length-e<t.highWaterMark)&&l("length less than watermark",r=!0),t.ended||t.reading?l("reading or ended",r=!1):r&&(l("do read"),t.reading=!0,t.sync=!0,0===t.length&&(t.needReadable=!0),this._read(t.highWaterMark),t.sync=!1,t.reading||(e=O(i,t))),null===(n=e>0?j(e,t):null)?(t.needReadable=t.length<=t.highWaterMark,e=0):(t.length-=e,t.awaitDrain=0),0===t.length&&(t.ended||(t.needReadable=!0),i!==e&&t.ended&&F(this)),null!==n&&this.emit("data",n),n},w.prototype._read=function(e){_(this,new b("_read()"))},w.prototype.pipe=function(e,t){var i=this,n=this._readableState;switch(n.pipesCount){case 0:n.pipes=e;break;case 1:n.pipes=[n.pipes,e];break;default:n.pipes.push(e)}n.pipesCount+=1,l("pipe count=%d opts=%j",n.pipesCount,t);var s=(!t||!1!==t.end)&&e!==process.stdout&&e!==process.stderr?a:g;function o(t,r){l("onunpipe"),t===i&&r&&!1===r.hasUnpiped&&(r.hasUnpiped=!0,l("cleanup"),e.removeListener("close",f),e.removeListener("finish",p),e.removeListener("drain",c),e.removeListener("error",d),e.removeListener("unpipe",o),i.removeListener("end",a),i.removeListener("end",g),i.removeListener("data",h),u=!0,!n.awaitDrain||e._writableState&&!e._writableState.needDrain||c())}function a(){l("onend"),e.end()}n.endEmitted?process.nextTick(s):i.once("end",s),e.on("unpipe",o);var c=function(e){return function(){var t=e._readableState;l("pipeOnDrain",t.awaitDrain),t.awaitDrain&&t.awaitDrain--,0===t.awaitDrain&&r(e,"data")&&(t.flowing=!0,D(e))}}(i);e.on("drain",c);var u=!1;function h(t){l("ondata");var r=e.write(t);l("dest.write",r),!1===r&&((1===n.pipesCount&&n.pipes===e||n.pipesCount>1&&-1!==U(n.pipes,e))&&!u&&(l("false write response, pause",n.awaitDrain),n.awaitDrain++),i.pause())}function d(t){l("onerror",t),g(),e.removeListener("error",d),0===r(e,"error")&&_(e,t)}function f(){e.removeListener("finish",p),g()}function p(){l("onfinish"),e.removeListener("close",f),g()}function g(){l("unpipe"),i.unpipe(e)}return i.on("data",h),function(e,t,i){if("function"==typeof e.prependListener)return e.prependListener(t,i);e._events&&e._events[t]?Array.isArray(e._events[t])?e._events[t].unshift(i):e._events[t]=[i,e._events[t]]:e.on(t,i)}(e,"error",d),e.once("close",f),e.once("finish",p),e.emit("pipe",i),n.flowing||(l("pipe resume"),i.resume()),e},w.prototype.unpipe=function(e){var t=this._readableState,i={hasUnpiped:!1};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,i)),this;if(!e){var n=t.pipes,r=t.pipesCount;t.pipes=null,t.pipesCount=0,t.flowing=!1;for(var s=0;s<r;s++)n[s].emit("unpipe",this,{hasUnpiped:!1});return this}var o=U(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,i)),this},w.prototype.on=function(e,t){var i=s.prototype.on.call(this,e,t),n=this._readableState;return"data"===e?(n.readableListening=this.listenerCount("readable")>0,!1!==n.flowing&&this.resume()):"readable"===e&&(n.endEmitted||n.readableListening||(n.readableListening=n.needReadable=!0,n.flowing=!1,n.emittedReadable=!1,l("on readable",n.length,n.reading),n.length?A(this):n.reading||process.nextTick(M,this))),i},w.prototype.addListener=w.prototype.on,w.prototype.removeListener=function(e,t){var i=s.prototype.removeListener.call(this,e,t);return"readable"===e&&process.nextTick(I,this),i},w.prototype.removeAllListeners=function(e){var t=s.prototype.removeAllListeners.apply(this,arguments);return"readable"!==e&&void 0!==e||process.nextTick(I,this),t},w.prototype.resume=function(){var e=this._readableState;return e.flowing||(l("resume"),e.flowing=!e.readableListening,function(e,t){t.resumeScheduled||(t.resumeScheduled=!0,process.nextTick(L,e,t))}(this,e)),e.paused=!1,this},w.prototype.pause=function(){return l("call pause flowing=%j",this._readableState.flowing),!1!==this._readableState.flowing&&(l("pause"),this._readableState.flowing=!1,this.emit("pause")),this._readableState.paused=!0,this},w.prototype.wrap=function(e){var t=this,i=this._readableState,n=!1;for(var r in e.on("end",function(){if(l("wrapped end"),i.decoder&&!i.ended){var e=i.decoder.end();e&&e.length&&t.push(e)}t.push(null)}),e.on("data",function(r){(l("wrapped data"),i.decoder&&(r=i.decoder.write(r)),i.objectMode&&null==r)||(i.objectMode||r&&r.length)&&(t.push(r)||(n=!0,e.pause()))}),e)void 0===this[r]&&"function"==typeof e[r]&&(this[r]=function(t){return function(){return e[t].apply(e,arguments)}}(r));for(var s=0;s<C.length;s++)e.on(C[s],this.emit.bind(this,C[s]));return this._read=function(t){l("wrapped _read",t),n&&(n=!1,e.resume())},this},"function"==typeof Symbol&&(w.prototype[Symbol.asyncIterator]=function(){return void 0===h&&(h=i(2955)),h(this)}),Object.defineProperty(w.prototype,"readableHighWaterMark",{enumerable:!1,get:function(){return this._readableState.highWaterMark}}),Object.defineProperty(w.prototype,"readableBuffer",{enumerable:!1,get:function(){return this._readableState&&this._readableState.buffer}}),Object.defineProperty(w.prototype,"readableFlowing",{enumerable:!1,get:function(){return this._readableState.flowing},set:function(e){this._readableState&&(this._readableState.flowing=e)}}),w._fromList=j,Object.defineProperty(w.prototype,"readableLength",{enumerable:!1,get:function(){return this._readableState.length}}),"function"==typeof Symbol&&(w.from=function(e,t){return void 0===d&&(d=i(6532)),d(w,e,t)})},4610(e,t,i){"use strict";e.exports=u;var n=i(113).F,r=n.ERR_METHOD_NOT_IMPLEMENTED,s=n.ERR_MULTIPLE_CALLBACK,o=n.ERR_TRANSFORM_ALREADY_TRANSFORMING,a=n.ERR_TRANSFORM_WITH_LENGTH_0,l=i(5382);function c(e,t){var i=this._transformState;i.transforming=!1;var n=i.writecb;if(null===n)return this.emit("error",new s);i.writechunk=null,i.writecb=null,null!=t&&this.push(t),n(e);var r=this._readableState;r.reading=!1,(r.needReadable||r.length<r.highWaterMark)&&this._read(r.highWaterMark)}function u(e){if(!(this instanceof u))return new u(e);l.call(this,e),this._transformState={afterTransform:c.bind(this),needTransform:!1,transforming:!1,writecb:null,writechunk:null,writeencoding:null},this._readableState.needReadable=!0,this._readableState.sync=!1,e&&("function"==typeof e.transform&&(this._transform=e.transform),"function"==typeof e.flush&&(this._flush=e.flush)),this.on("prefinish",h)}function h(){var e=this;"function"!=typeof this._flush||this._readableState.destroyed?d(this,null,null):this._flush(function(t,i){d(e,t,i)})}function d(e,t,i){if(t)return e.emit("error",t);if(null!=i&&e.push(i),e._writableState.length)throw new a;if(e._transformState.transforming)throw new o;return e.push(null)}i(2017)(u,l),u.prototype.push=function(e,t){return this._transformState.needTransform=!1,l.prototype.push.call(this,e,t)},u.prototype._transform=function(e,t,i){i(new r("_transform()"))},u.prototype._write=function(e,t,i){var n=this._transformState;if(n.writecb=i,n.writechunk=e,n.writeencoding=t,!n.transforming){var r=this._readableState;(n.needTransform||r.needReadable||r.length<r.highWaterMark)&&this._read(r.highWaterMark)}},u.prototype._read=function(e){var t=this._transformState;null===t.writechunk||t.transforming?t.needTransform=!0:(t.transforming=!0,this._transform(t.writechunk,t.writeencoding,t.afterTransform))},u.prototype._destroy=function(e,t){l.prototype._destroy.call(this,e,function(e){t(e)})}},6708(e,t,i){"use strict";function n(e){var t=this;this.next=null,this.entry=null,this.finish=function(){!function(e,t,i){var n=e.entry;e.entry=null;for(;n;){var r=n.callback;t.pendingcb--,r(i),n=n.next}t.corkedRequestsFree.next=e}(t,e)}}var r;e.exports=w,w.WritableState=E;var s={deprecate:i(7983)},o=i(1416),a=i(181).Buffer,l=("undefined"!=typeof global?global:"undefined"!=typeof window?window:"undefined"!=typeof self?self:{}).Uint8Array||function(){};var c,u=i(5896),h=i(5291).getHighWaterMark,d=i(113).F,f=d.ERR_INVALID_ARG_TYPE,p=d.ERR_METHOD_NOT_IMPLEMENTED,g=d.ERR_MULTIPLE_CALLBACK,m=d.ERR_STREAM_CANNOT_PIPE,v=d.ERR_STREAM_DESTROYED,y=d.ERR_STREAM_NULL_VALUES,b=d.ERR_STREAM_WRITE_AFTER_END,S=d.ERR_UNKNOWN_ENCODING,_=u.errorOrDestroy;function C(){}function E(e,t,s){r=r||i(5382),e=e||{},"boolean"!=typeof s&&(s=t instanceof r),this.objectMode=!!e.objectMode,s&&(this.objectMode=this.objectMode||!!e.writableObjectMode),this.highWaterMark=h(this,e,"writableHighWaterMark",s),this.finalCalled=!1,this.needDrain=!1,this.ending=!1,this.ended=!1,this.finished=!1,this.destroyed=!1;var o=!1===e.decodeStrings;this.decodeStrings=!o,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 i=e._writableState,n=i.sync,r=i.writecb;if("function"!=typeof r)throw new g;if(function(e){e.writing=!1,e.writecb=null,e.length-=e.writelen,e.writelen=0}(i),t)!function(e,t,i,n,r){--t.pendingcb,i?(process.nextTick(r,n),process.nextTick(P,e,t),e._writableState.errorEmitted=!0,_(e,n)):(r(n),e._writableState.errorEmitted=!0,_(e,n),P(e,t))}(e,i,n,t,r);else{var s=O(i)||e.destroyed;s||i.corked||i.bufferProcessing||!i.bufferedRequest||R(e,i),n?process.nextTick(k,e,i,s,r):k(e,i,s,r)}}(t,e)},this.writecb=null,this.writelen=0,this.bufferedRequest=null,this.lastBufferedRequest=null,this.pendingcb=0,this.prefinished=!1,this.errorEmitted=!1,this.emitClose=!1!==e.emitClose,this.autoDestroy=!!e.autoDestroy,this.bufferedRequestCount=0,this.corkedRequestsFree=new n(this)}function w(e){var t=this instanceof(r=r||i(5382));if(!t&&!c.call(w,this))return new w(e);this._writableState=new E(e,this,t),this.writable=!0,e&&("function"==typeof e.write&&(this._write=e.write),"function"==typeof e.writev&&(this._writev=e.writev),"function"==typeof e.destroy&&(this._destroy=e.destroy),"function"==typeof e.final&&(this._final=e.final)),o.call(this)}function T(e,t,i,n,r,s,o){t.writelen=n,t.writecb=o,t.writing=!0,t.sync=!0,t.destroyed?t.onwrite(new v("write")):i?e._writev(r,t.onwrite):e._write(r,s,t.onwrite),t.sync=!1}function k(e,t,i,n){i||function(e,t){0===t.length&&t.needDrain&&(t.needDrain=!1,e.emit("drain"))}(e,t),t.pendingcb--,n(),P(e,t)}function R(e,t){t.bufferProcessing=!0;var i=t.bufferedRequest;if(e._writev&&i&&i.next){var r=t.bufferedRequestCount,s=new Array(r),o=t.corkedRequestsFree;o.entry=i;for(var a=0,l=!0;i;)s[a]=i,i.isBuf||(l=!1),i=i.next,a+=1;s.allBuffers=l,T(e,t,!0,t.length,s,"",o.finish),t.pendingcb++,t.lastBufferedRequest=null,o.next?(t.corkedRequestsFree=o.next,o.next=null):t.corkedRequestsFree=new n(t),t.bufferedRequestCount=0}else{for(;i;){var c=i.chunk,u=i.encoding,h=i.callback;if(T(e,t,!1,t.objectMode?1:c.length,c,u,h),i=i.next,t.bufferedRequestCount--,t.writing)break}null===i&&(t.lastBufferedRequest=null)}t.bufferedRequest=i,t.bufferProcessing=!1}function O(e){return e.ending&&0===e.length&&null===e.bufferedRequest&&!e.finished&&!e.writing}function A(e,t){e._final(function(i){t.pendingcb--,i&&_(e,i),t.prefinished=!0,e.emit("prefinish"),P(e,t)})}function P(e,t){var i=O(t);if(i&&(function(e,t){t.prefinished||t.finalCalled||("function"!=typeof e._final||t.destroyed?(t.prefinished=!0,e.emit("prefinish")):(t.pendingcb++,t.finalCalled=!0,process.nextTick(A,e,t)))}(e,t),0===t.pendingcb&&(t.finished=!0,e.emit("finish"),t.autoDestroy))){var n=e._readableState;(!n||n.autoDestroy&&n.endEmitted)&&e.destroy()}return i}i(2017)(w,o),E.prototype.getBuffer=function(){for(var e=this.bufferedRequest,t=[];e;)t.push(e),e=e.next;return t},function(){try{Object.defineProperty(E.prototype,"buffer",{get:s.deprecate(function(){return this.getBuffer()},"_writableState.buffer is deprecated. Use _writableState.getBuffer instead.","DEP0003")})}catch(e){}}(),"function"==typeof Symbol&&Symbol.hasInstance&&"function"==typeof Function.prototype[Symbol.hasInstance]?(c=Function.prototype[Symbol.hasInstance],Object.defineProperty(w,Symbol.hasInstance,{value:function(e){return!!c.call(this,e)||this===w&&(e&&e._writableState instanceof E)}})):c=function(e){return e instanceof this},w.prototype.pipe=function(){_(this,new m)},w.prototype.write=function(e,t,i){var n,r=this._writableState,s=!1,o=!r.objectMode&&(n=e,a.isBuffer(n)||n instanceof l);return o&&!a.isBuffer(e)&&(e=function(e){return a.from(e)}(e)),"function"==typeof t&&(i=t,t=null),o?t="buffer":t||(t=r.defaultEncoding),"function"!=typeof i&&(i=C),r.ending?function(e,t){var i=new b;_(e,i),process.nextTick(t,i)}(this,i):(o||function(e,t,i,n){var r;return null===i?r=new y:"string"==typeof i||t.objectMode||(r=new f("chunk",["string","Buffer"],i)),!r||(_(e,r),process.nextTick(n,r),!1)}(this,r,e,i))&&(r.pendingcb++,s=function(e,t,i,n,r,s){if(!i){var o=function(e,t,i){e.objectMode||!1===e.decodeStrings||"string"!=typeof t||(t=a.from(t,i));return t}(t,n,r);n!==o&&(i=!0,r="buffer",n=o)}var l=t.objectMode?1:n.length;t.length+=l;var c=t.length<t.highWaterMark;c||(t.needDrain=!0);if(t.writing||t.corked){var u=t.lastBufferedRequest;t.lastBufferedRequest={chunk:n,encoding:r,isBuf:i,callback:s,next:null},u?u.next=t.lastBufferedRequest:t.bufferedRequest=t.lastBufferedRequest,t.bufferedRequestCount+=1}else T(e,t,!1,l,n,r,s);return c}(this,r,o,e,t,i)),s},w.prototype.cork=function(){this._writableState.corked++},w.prototype.uncork=function(){var e=this._writableState;e.corked&&(e.corked--,e.writing||e.corked||e.bufferProcessing||!e.bufferedRequest||R(this,e))},w.prototype.setDefaultEncoding=function(e){if("string"==typeof e&&(e=e.toLowerCase()),!(["hex","utf8","utf-8","ascii","binary","base64","ucs2","ucs-2","utf16le","utf-16le","raw"].indexOf((e+"").toLowerCase())>-1))throw new S(e);return this._writableState.defaultEncoding=e,this},Object.defineProperty(w.prototype,"writableBuffer",{enumerable:!1,get:function(){return this._writableState&&this._writableState.getBuffer()}}),Object.defineProperty(w.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}}),w.prototype._write=function(e,t,i){i(new p("_write()"))},w.prototype._writev=null,w.prototype.end=function(e,t,i){var n=this._writableState;return"function"==typeof e?(i=e,e=null,t=null):"function"==typeof t&&(i=t,t=null),null!=e&&this.write(e,t),n.corked&&(n.corked=1,this.uncork()),n.ending||function(e,t,i){t.ending=!0,P(e,t),i&&(t.finished?process.nextTick(i):e.once("finish",i));t.ended=!0,e.writable=!1}(this,n,i),this},Object.defineProperty(w.prototype,"writableLength",{enumerable:!1,get:function(){return this._writableState.length}}),Object.defineProperty(w.prototype,"destroyed",{enumerable:!1,get:function(){return void 0!==this._writableState&&this._writableState.destroyed},set:function(e){this._writableState&&(this._writableState.destroyed=e)}}),w.prototype.destroy=u.destroy,w.prototype._undestroy=u.undestroy,w.prototype._destroy=function(e,t){t(e)}},2955(e,t,i){"use strict";var n;function r(e,t,i){return(t=function(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var i=e[Symbol.toPrimitive];if(void 0!==i){var n=i.call(e,t||"default");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:i,enumerable:!0,configurable:!0,writable:!0}):e[t]=i,e}var s=i(6238),o=Symbol("lastResolve"),a=Symbol("lastReject"),l=Symbol("error"),c=Symbol("ended"),u=Symbol("lastPromise"),h=Symbol("handlePromise"),d=Symbol("stream");function f(e,t){return{value:e,done:t}}function p(e){var t=e[o];if(null!==t){var i=e[d].read();null!==i&&(e[u]=null,e[o]=null,e[a]=null,t(f(i,!1)))}}function g(e){process.nextTick(p,e)}var m=Object.getPrototypeOf(function(){}),v=Object.setPrototypeOf((r(n={get stream(){return this[d]},next:function(){var e=this,t=this[l];if(null!==t)return Promise.reject(t);if(this[c])return Promise.resolve(f(void 0,!0));if(this[d].destroyed)return new Promise(function(t,i){process.nextTick(function(){e[l]?i(e[l]):t(f(void 0,!0))})});var i,n=this[u];if(n)i=new Promise(function(e,t){return function(i,n){e.then(function(){t[c]?i(f(void 0,!0)):t[h](i,n)},n)}}(n,this));else{var r=this[d].read();if(null!==r)return Promise.resolve(f(r,!1));i=new Promise(this[h])}return this[u]=i,i}},Symbol.asyncIterator,function(){return this}),r(n,"return",function(){var e=this;return new Promise(function(t,i){e[d].destroy(null,function(e){e?i(e):t(f(void 0,!0))})})}),n),m);e.exports=function(e){var t,i=Object.create(v,(r(t={},d,{value:e,writable:!0}),r(t,o,{value:null,writable:!0}),r(t,a,{value:null,writable:!0}),r(t,l,{value:null,writable:!0}),r(t,c,{value:e._readableState.endEmitted,writable:!0}),r(t,h,{value:function(e,t){var n=i[d].read();n?(i[u]=null,i[o]=null,i[a]=null,e(f(n,!1))):(i[o]=e,i[a]=t)},writable:!0}),t));return i[u]=null,s(e,function(e){if(e&&"ERR_STREAM_PREMATURE_CLOSE"!==e.code){var t=i[a];return null!==t&&(i[u]=null,i[o]=null,i[a]=null,t(e)),void(i[l]=e)}var n=i[o];null!==n&&(i[u]=null,i[o]=null,i[a]=null,n(f(void 0,!0))),i[c]=!0}),e.on("readable",g.bind(null,i)),i}},345(e,t,i){"use strict";function n(e,t){var i=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),i.push.apply(i,n)}return i}function r(e){for(var t=1;t<arguments.length;t++){var i=null!=arguments[t]?arguments[t]:{};t%2?n(Object(i),!0).forEach(function(t){s(e,t,i[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(i)):n(Object(i)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(i,t))})}return e}function s(e,t,i){return(t=a(t))in e?Object.defineProperty(e,t,{value:i,enumerable:!0,configurable:!0,writable:!0}):e[t]=i,e}function o(e,t){for(var i=0;i<t.length;i++){var n=t[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,a(n.key),n)}}function a(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var i=e[Symbol.toPrimitive];if(void 0!==i){var n=i.call(e,t||"default");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:String(t)}var l=i(181).Buffer,c=i(9023).inspect,u=c&&c.custom||"inspect";function h(e,t,i){l.prototype.copy.call(e,t,i)}e.exports=function(){function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.head=null,this.tail=null,this.length=0}var t,i,n;return t=e,(i=[{key:"push",value:function(e){var t={data:e,next:null};this.length>0?this.tail.next=t:this.head=t,this.tail=t,++this.length}},{key:"unshift",value:function(e){var t={data:e,next:this.head};0===this.length&&(this.tail=t),this.head=t,++this.length}},{key:"shift",value:function(){if(0!==this.length){var e=this.head.data;return 1===this.length?this.head=this.tail=null:this.head=this.head.next,--this.length,e}}},{key:"clear",value:function(){this.head=this.tail=null,this.length=0}},{key:"join",value:function(e){if(0===this.length)return"";for(var t=this.head,i=""+t.data;t=t.next;)i+=e+t.data;return i}},{key:"concat",value:function(e){if(0===this.length)return l.alloc(0);for(var t=l.allocUnsafe(e>>>0),i=this.head,n=0;i;)h(i.data,t,n),n+=i.data.length,i=i.next;return t}},{key:"consume",value:function(e,t){var i;return e<this.head.data.length?(i=this.head.data.slice(0,e),this.head.data=this.head.data.slice(e)):i=e===this.head.data.length?this.shift():t?this._getString(e):this._getBuffer(e),i}},{key:"first",value:function(){return this.head.data}},{key:"_getString",value:function(e){var t=this.head,i=1,n=t.data;for(e-=n.length;t=t.next;){var r=t.data,s=e>r.length?r.length:e;if(s===r.length?n+=r:n+=r.slice(0,e),0===(e-=s)){s===r.length?(++i,t.next?this.head=t.next:this.head=this.tail=null):(this.head=t,t.data=r.slice(s));break}++i}return this.length-=i,n}},{key:"_getBuffer",value:function(e){var t=l.allocUnsafe(e),i=this.head,n=1;for(i.data.copy(t),e-=i.data.length;i=i.next;){var r=i.data,s=e>r.length?r.length:e;if(r.copy(t,t.length-e,0,s),0===(e-=s)){s===r.length?(++n,i.next?this.head=i.next:this.head=this.tail=null):(this.head=i,i.data=r.slice(s));break}++n}return this.length-=n,t}},{key:u,value:function(e,t){return c(this,r(r({},t),{},{depth:0,customInspect:!1}))}}])&&o(t.prototype,i),n&&o(t,n),Object.defineProperty(t,"prototype",{writable:!1}),e}()},5896(e){"use strict";function t(e,t){n(e,t),i(e)}function i(e){e._writableState&&!e._writableState.emitClose||e._readableState&&!e._readableState.emitClose||e.emit("close")}function n(e,t){e.emit("error",t)}e.exports={destroy:function(e,r){var s=this,o=this._readableState&&this._readableState.destroyed,a=this._writableState&&this._writableState.destroyed;return o||a?(r?r(e):e&&(this._writableState?this._writableState.errorEmitted||(this._writableState.errorEmitted=!0,process.nextTick(n,this,e)):process.nextTick(n,this,e)),this):(this._readableState&&(this._readableState.destroyed=!0),this._writableState&&(this._writableState.destroyed=!0),this._destroy(e||null,function(e){!r&&e?s._writableState?s._writableState.errorEmitted?process.nextTick(i,s):(s._writableState.errorEmitted=!0,process.nextTick(t,s,e)):process.nextTick(t,s,e):r?(process.nextTick(i,s),r(e)):process.nextTick(i,s)}),this)},undestroy:function(){this._readableState&&(this._readableState.destroyed=!1,this._readableState.reading=!1,this._readableState.ended=!1,this._readableState.endEmitted=!1),this._writableState&&(this._writableState.destroyed=!1,this._writableState.ended=!1,this._writableState.ending=!1,this._writableState.finalCalled=!1,this._writableState.prefinished=!1,this._writableState.finished=!1,this._writableState.errorEmitted=!1)},errorOrDestroy:function(e,t){var i=e._readableState,n=e._writableState;i&&i.autoDestroy||n&&n.autoDestroy?e.destroy(t):e.emit("error",t)}}},6238(e,t,i){"use strict";var n=i(113).F.ERR_STREAM_PREMATURE_CLOSE;function r(){}e.exports=function e(t,i,s){if("function"==typeof i)return e(t,null,i);i||(i={}),s=function(e){var t=!1;return function(){if(!t){t=!0;for(var i=arguments.length,n=new Array(i),r=0;r<i;r++)n[r]=arguments[r];e.apply(this,n)}}}(s||r);var o=i.readable||!1!==i.readable&&t.readable,a=i.writable||!1!==i.writable&&t.writable,l=function(){t.writable||u()},c=t._writableState&&t._writableState.finished,u=function(){a=!1,c=!0,o||s.call(t)},h=t._readableState&&t._readableState.endEmitted,d=function(){o=!1,h=!0,a||s.call(t)},f=function(e){s.call(t,e)},p=function(){var e;return o&&!h?(t._readableState&&t._readableState.ended||(e=new n),s.call(t,e)):a&&!c?(t._writableState&&t._writableState.ended||(e=new n),s.call(t,e)):void 0},g=function(){t.req.on("finish",u)};return!function(e){return e.setHeader&&"function"==typeof e.abort}(t)?a&&!t._writableState&&(t.on("end",l),t.on("close",l)):(t.on("complete",u),t.on("abort",p),t.req?g():t.on("request",g)),t.on("end",d),t.on("finish",u),!1!==i.error&&t.on("error",f),t.on("close",p),function(){t.removeListener("complete",u),t.removeListener("abort",p),t.removeListener("request",g),t.req&&t.req.removeListener("finish",u),t.removeListener("end",l),t.removeListener("close",l),t.removeListener("finish",u),t.removeListener("end",d),t.removeListener("error",f),t.removeListener("close",p)}}},6532(e,t,i){"use strict";function n(e,t,i,n,r,s,o){try{var a=e[s](o),l=a.value}catch(e){return void i(e)}a.done?t(l):Promise.resolve(l).then(n,r)}function r(e,t){var i=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),i.push.apply(i,n)}return i}function s(e,t,i){return(t=function(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var i=e[Symbol.toPrimitive];if(void 0!==i){var n=i.call(e,t||"default");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:i,enumerable:!0,configurable:!0,writable:!0}):e[t]=i,e}var o=i(113).F.ERR_INVALID_ARG_TYPE;e.exports=function(e,t,i){var a;if(t&&"function"==typeof t.next)a=t;else if(t&&t[Symbol.asyncIterator])a=t[Symbol.asyncIterator]();else{if(!t||!t[Symbol.iterator])throw new o("iterable",["Iterable"],t);a=t[Symbol.iterator]()}var l=new e(function(e){for(var t=1;t<arguments.length;t++){var i=null!=arguments[t]?arguments[t]:{};t%2?r(Object(i),!0).forEach(function(t){s(e,t,i[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(i)):r(Object(i)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(i,t))})}return e}({objectMode:!0},i)),c=!1;function u(){return h.apply(this,arguments)}function h(){var e;return e=function*(){try{var e=yield a.next(),t=e.value;e.done?l.push(null):l.push(yield t)?u():c=!1}catch(e){l.destroy(e)}},h=function(){var t=this,i=arguments;return new Promise(function(r,s){var o=e.apply(t,i);function a(e){n(o,r,s,a,l,"next",e)}function l(e){n(o,r,s,a,l,"throw",e)}a(void 0)})},h.apply(this,arguments)}return l._read=function(){c||(c=!0,u())},l}},7758(e,t,i){"use strict";var n;var r=i(113).F,s=r.ERR_MISSING_ARGS,o=r.ERR_STREAM_DESTROYED;function a(e){if(e)throw e}function l(e){e()}function c(e,t){return e.pipe(t)}e.exports=function(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];var u,h=function(e){return e.length?"function"!=typeof e[e.length-1]?a:e.pop():a}(t);if(Array.isArray(t[0])&&(t=t[0]),t.length<2)throw new s("streams");var d=t.map(function(e,r){var s=r<t.length-1;return function(e,t,r,s){s=function(e){var t=!1;return function(){t||(t=!0,e.apply(void 0,arguments))}}(s);var a=!1;e.on("close",function(){a=!0}),void 0===n&&(n=i(6238)),n(e,{readable:t,writable:r},function(e){if(e)return s(e);a=!0,s()});var l=!1;return function(t){if(!a&&!l)return l=!0,function(e){return e.setHeader&&"function"==typeof e.abort}(e)?e.abort():"function"==typeof e.destroy?e.destroy():void s(t||new o("pipe"))}}(e,s,r>0,function(e){u||(u=e),e&&d.forEach(l),s||(d.forEach(l),h(u))})});return t.reduce(c)}},5291(e,t,i){"use strict";var n=i(113).F.ERR_INVALID_OPT_VALUE;e.exports={getHighWaterMark:function(e,t,i,r){var s=function(e,t,i){return null!=e.highWaterMark?e.highWaterMark:t?e[i]:null}(t,r,i);if(null!=s){if(!isFinite(s)||Math.floor(s)!==s||s<0)throw new n(r?i:"highWaterMark",s);return Math.floor(s)}return e.objectMode?16:16384}}},1416(e,t,i){e.exports=i(2203)},4198(e,t,i){var n=i(2203);"disable"===process.env.READABLE_STREAM&&n?(e.exports=n.Readable,Object.assign(e.exports,n),e.exports.Stream=n):((t=e.exports=i(5412)).Stream=n||t,t.Readable=t,t.Writable=i(6708),t.Duplex=i(5382),t.Transform=i(4610),t.PassThrough=i(3600),t.finished=i(6238),t.pipeline=i(7758))},2861(e,t,i){var n=i(181),r=n.Buffer;function s(e,t){for(var i in e)t[i]=e[i]}function o(e,t,i){return r(e,t,i)}r.from&&r.alloc&&r.allocUnsafe&&r.allocUnsafeSlow?e.exports=n:(s(n,t),t.Buffer=o),o.prototype=Object.create(r.prototype),s(r,o),o.from=function(e,t,i){if("number"==typeof e)throw new TypeError("Argument must not be a number");return r(e,t,i)},o.alloc=function(e,t,i){if("number"!=typeof e)throw new TypeError("Argument must be a number");var n=r(e);return void 0!==t?"string"==typeof i?n.fill(t,i):n.fill(t):n.fill(0),n},o.allocUnsafe=function(e){if("number"!=typeof e)throw new TypeError("Argument must be a number");return r(e)},o.allocUnsafeSlow=function(e){if("number"!=typeof e)throw new TypeError("Argument must be a number");return n.SlowBuffer(e)}},4546(e,t,i){var n=i(9896);e.exports=function(e,t,i){t=void 0!==t?t:"\n",i=void 0!==i?i:"utf8";var r=[],s=n.readFileSync(e,i);if(s.indexOf("-END CERTIFICATE-")<0||s.indexOf("-BEGIN CERTIFICATE-")<0)throw Error("File does not contain 'BEGIN CERTIFICATE' or 'END CERTIFICATE'");var o,a,l=[];for(o=0,a=(s=s.split(t)).length;o<a;o++){var c=s[o];0!==c.length&&(l.push(c),c.match(/-END CERTIFICATE-/)&&(r.push(l.join(t)),l=[]))}return r}},3141(e,t,i){"use strict";var n=i(2861).Buffer,r=n.isEncoding||function(e){switch((e=""+e)&&e.toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":case"raw":return!0;default:return!1}};function s(e){var t;switch(this.encoding=function(e){var t=function(e){if(!e)return"utf8";for(var t;;)switch(e){case"utf8":case"utf-8":return"utf8";case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return"utf16le";case"latin1":case"binary":return"latin1";case"base64":case"ascii":case"hex":return e;default:if(t)return;e=(""+e).toLowerCase(),t=!0}}(e);if("string"!=typeof t&&(n.isEncoding===r||!r(e)))throw new Error("Unknown encoding: "+e);return t||e}(e),this.encoding){case"utf16le":this.text=l,this.end=c,t=4;break;case"utf8":this.fillLast=a,t=4;break;case"base64":this.text=u,this.end=h,t=3;break;default:return this.write=d,void(this.end=f)}this.lastNeed=0,this.lastTotal=0,this.lastChar=n.allocUnsafe(t)}function o(e){return e<=127?0:e>>5==6?2:e>>4==14?3:e>>3==30?4:e>>6==2?-1:-2}function a(e){var t=this.lastTotal-this.lastNeed,i=function(e,t){if(128!=(192&t[0]))return e.lastNeed=0,"�";if(e.lastNeed>1&&t.length>1){if(128!=(192&t[1]))return e.lastNeed=1,"�";if(e.lastNeed>2&&t.length>2&&128!=(192&t[2]))return e.lastNeed=2,"�"}}(this,e);return void 0!==i?i:this.lastNeed<=e.length?(e.copy(this.lastChar,t,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal)):(e.copy(this.lastChar,t,0,e.length),void(this.lastNeed-=e.length))}function l(e,t){if((e.length-t)%2==0){var i=e.toString("utf16le",t);if(i){var n=i.charCodeAt(i.length-1);if(n>=55296&&n<=56319)return this.lastNeed=2,this.lastTotal=4,this.lastChar[0]=e[e.length-2],this.lastChar[1]=e[e.length-1],i.slice(0,-1)}return i}return this.lastNeed=1,this.lastTotal=2,this.lastChar[0]=e[e.length-1],e.toString("utf16le",t,e.length-1)}function c(e){var t=e&&e.length?this.write(e):"";if(this.lastNeed){var i=this.lastTotal-this.lastNeed;return t+this.lastChar.toString("utf16le",0,i)}return t}function u(e,t){var i=(e.length-t)%3;return 0===i?e.toString("base64",t):(this.lastNeed=3-i,this.lastTotal=3,1===i?this.lastChar[0]=e[e.length-1]:(this.lastChar[0]=e[e.length-2],this.lastChar[1]=e[e.length-1]),e.toString("base64",t,e.length-i))}function h(e){var t=e&&e.length?this.write(e):"";return this.lastNeed?t+this.lastChar.toString("base64",0,3-this.lastNeed):t}function d(e){return e.toString(this.encoding)}function f(e){return e&&e.length?this.write(e):""}t.I=s,s.prototype.write=function(e){if(0===e.length)return"";var t,i;if(this.lastNeed){if(void 0===(t=this.fillLast(e)))return"";i=this.lastNeed,this.lastNeed=0}else i=0;return i<e.length?t?t+this.text(e,i):this.text(e,i):t||""},s.prototype.end=function(e){var t=e&&e.length?this.write(e):"";return this.lastNeed?t+"�":t},s.prototype.text=function(e,t){var i=function(e,t,i){var n=t.length-1;if(n<i)return 0;var r=o(t[n]);if(r>=0)return r>0&&(e.lastNeed=r-1),r;if(--n<i||-2===r)return 0;if(r=o(t[n]),r>=0)return r>0&&(e.lastNeed=r-2),r;if(--n<i||-2===r)return 0;if(r=o(t[n]),r>=0)return r>0&&(2===r?r=0:e.lastNeed=r-3),r;return 0}(this,e,t);if(!this.lastNeed)return e.toString("utf8",t);this.lastTotal=i;var n=e.length-(i-this.lastNeed);return e.copy(this.lastChar,0,n),e.toString("utf8",t,n)},s.prototype.fillLast=function(e){if(this.lastNeed<=e.length)return e.copy(this.lastChar,this.lastTotal-this.lastNeed,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal);e.copy(this.lastChar,this.lastTotal-this.lastNeed,0,e.length),this.lastNeed-=e.length}},6868(e,t,i){var n=i(6284),r=i(6706),s=i(815),o=i(9505),a=i(9896),l=i(6928),c="win32"===i(857).platform(),u=function(){},h=function(e){return e},d=c?function(e){return e.replace(/\\/g,"/").replace(/[:?<>|]/g,"_")}:h,f=function(e,t){return function(i){i.name=i.name.split("/").slice(t).join("/");var n=i.linkname;return n&&("link"===i.type||l.isAbsolute(n))&&(i.linkname=n.split("/").slice(t).join("/")),e(i)}};t.pack=function(e,t){e||(e="."),t||(t={});var i=t.fs||a,n=t.ignore||t.filter||u,o=t.map||u,c=t.mapStream||h,p=function(e,t,i,n,r,s){var o=r||["."];return function(r){if(!o.length)return r();var a=o.shift(),c=l.join(i,a);t.call(e,c,function(t,u){return t?r(t):u.isDirectory()?void e.readdir(c,function(e,t){if(e)return r(e);s&&t.sort();for(var c=0;c<t.length;c++)n(l.join(i,a,t[c]))||o.push(l.join(a,t[c]));r(null,a,u)}):r(null,a,u)})}}(i,t.dereference?i.stat:i.lstat,e,n,t.entries,t.sort),m=!1!==t.strict,v="number"==typeof t.umask?~t.umask:~g(),y="number"==typeof t.dmode?t.dmode:0,b="number"==typeof t.fmode?t.fmode:0,S=t.pack||r.pack(),_=t.finish||u;t.strip&&(o=f(o,t.strip)),t.readable&&(y|=parseInt(555,8),b|=parseInt(444,8)),t.writable&&(y|=parseInt(333,8),b|=parseInt(222,8));var C=function(n,r,a){if(n)return S.destroy(n);if(!r)return!1!==t.finalize&&S.finalize(),_(S);if(a.isSocket())return E();var u={name:d(r),mode:(a.mode|(a.isDirectory()?y:b))&v,mtime:a.mtime,size:a.size,type:"file",uid:a.uid,gid:a.gid};if(a.isDirectory())return u.size=0,u.type="directory",u=o(u)||u,S.entry(u,E);if(a.isSymbolicLink())return u.size=0,u.type="symlink",function(t,n){i.readlink(l.join(e,t),function(e,t){if(e)return S.destroy(e);n.linkname=d(t),S.entry(n,E)})}(r,u=o(u)||u);if(u=o(u)||u,!a.isFile())return m?S.destroy(new Error("unsupported type for "+r)):E();var h=S.entry(u,E);if(h){var f=c(i.createReadStream(l.join(e,r),{start:0,end:u.size>0?u.size-1:u.size}),u);f.on("error",function(e){h.destroy(e)}),s(f,h)}},E=function(e){if(e)return S.destroy(e);p(C)};return E(),S};var p=function(e){return e.length?e[e.length-1]:null},g=function(){return process.umask?process.umask():0};function m(e,t,i,n){if(t===i)return n(null,!0);e.lstat(t,function(r,s){return r&&"ENOENT"!==r.code?n(r):r||s.isDirectory()?m(e,l.join(t,".."),i,n):void n(null,!1)})}function v(e,t,i){o(e,{fs:t.fs},function(e,r){!e&&r&&t.own?n(r,t.uid,t.gid,i):i(e)})}function y(e,t){return(t=l.resolve(t))===e||e.startsWith(t+l.sep)}t.extract=function(e,t){e||(e="."),t||(t={});var i=t.fs||a,n=t.ignore||t.filter||u,o=t.map||u,b=t.mapStream||h,S=!1!==t.chown&&!c&&0===(process.getuid?process.getuid():-1),_=t.extract||r.extract(),C=[],E=new Date,w="number"==typeof t.umask?~t.umask:~g(),T="number"==typeof t.dmode?t.dmode:0,k="number"==typeof t.fmode?t.fmode:0,R=!1!==t.strict;t.strip&&(o=f(o,t.strip)),t.readable&&(T|=parseInt(555,8),k|=parseInt(444,8)),t.writable&&(T|=parseInt(333,8),k|=parseInt(222,8));var O=function(e,t){for(var n;(n=p(C))&&e.slice(0,n[0].length)!==n[0];)C.pop();if(!n)return t();i.utimes(n[0],E,n[1],t)};return _.on("entry",function(r,a,u){(r=o(r)||r).name=d(r.name);var h=l.join(e,l.join("/",r.name));if(n(h,r))return a.resume(),u();var f=function(e){if(e)return u(e);!function(e,n,r){!1===t.utimes?r():"directory"===n.type?i.utimes(e,E,n.mtime,r):"symlink"===n.type?O(e,r):i.utimes(e,E,n.mtime,function(t){if(t)return r(t);O(e,r)})}(h,r,function(e){return e?u(e):c?u():void function(e,t,n){var r="symlink"===t.type,s=r?i.lchmod:i.chmod,o=r?i.lchown:i.chown;if(!s)return n();var a=(t.mode|("directory"===t.type?T:k))&w;function l(t){return t?n(t):s?void s.call(i,e,a,n):n()}o&&S?o.call(i,e,t.uid,t.gid,l):l(null)}(h,r,u)})},p=function(){var e=i.createWriteStream(h),t=b(a,r);e.on("error",function(e){t.destroy(e)}),s(t,e,function(t){if(t)return u(t);e.on("close",f)})};if("directory"===r.type)return C.push([h,r.mtime]),v(h,{fs:i,own:S,uid:r.uid,gid:r.gid},f);var g=l.dirname(h);m(i,g,l.join(e,"."),function(n,s){return n?u(n):s?void v(g,{fs:i,own:S,uid:r.uid,gid:r.gid},function(n){if(n)return u(n);switch(r.type){case"file":return p();case"link":return function(){if(c)return u();i.unlink(h,function(){var n=l.join(e,l.join("/",r.linkname));i.realpath(n,function(r,s){if(r||!y(s,e))return u(new Error(h+" is not a valid hardlink"));i.link(s,h,function(e){if(e&&"EPERM"===e.code&&t.hardlinkAsFilesFallback)return a=i.createReadStream(n),p();f(e)})})})}();case"symlink":return function(){if(c)return u();i.unlink(h,function(){if(!y(l.resolve(l.dirname(h),r.linkname),e))return u(new Error(h+" is not a valid symlink"));i.symlink(r.linkname,h,f)})}()}if(R)return u(new Error("unsupported type for "+h+" ("+r.type+")"));a.resume(),u()}):u(new Error(g+" is not a valid path"))})}),t.finish&&_.on("finish",t.finish),_}},5518(e,t,i){"use strict";const{Buffer:n}=i(181),r=Symbol.for("BufferList");function s(e){if(!(this instanceof s))return new s(e);s._init.call(this,e)}s._init=function(e){Object.defineProperty(this,r,{value:!0}),this._bufs=[],this.length=0,e&&this.append(e)},s.prototype._new=function(e){return new s(e)},s.prototype._offset=function(e){if(0===e)return[0,0];let t=0;for(let i=0;i<this._bufs.length;i++){const n=t+this._bufs[i].length;if(e<n||i===this._bufs.length-1)return[i,e-t];t=n}},s.prototype._reverseOffset=function(e){const t=e[0];let i=e[1];for(let e=0;e<t;e++)i+=this._bufs[e].length;return i},s.prototype.get=function(e){if(e>this.length||e<0)return;const t=this._offset(e);return this._bufs[t[0]][t[1]]},s.prototype.slice=function(e,t){return"number"==typeof e&&e<0&&(e+=this.length),"number"==typeof t&&t<0&&(t+=this.length),this.copy(null,0,e,t)},s.prototype.copy=function(e,t,i,r){if(("number"!=typeof i||i<0)&&(i=0),("number"!=typeof r||r>this.length)&&(r=this.length),i>=this.length)return e||n.alloc(0);if(r<=0)return e||n.alloc(0);const s=!!e,o=this._offset(i),a=r-i;let l=a,c=s&&t||0,u=o[1];if(0===i&&r===this.length){if(!s)return 1===this._bufs.length?this._bufs[0]:n.concat(this._bufs,this.length);for(let t=0;t<this._bufs.length;t++)this._bufs[t].copy(e,c),c+=this._bufs[t].length;return e}if(l<=this._bufs[o[0]].length-u)return s?this._bufs[o[0]].copy(e,t,u,u+l):this._bufs[o[0]].slice(u,u+l);s||(e=n.allocUnsafe(a));for(let t=o[0];t<this._bufs.length;t++){const i=this._bufs[t].length-u;if(!(l>i)){this._bufs[t].copy(e,c,u,u+l),c+=i;break}this._bufs[t].copy(e,c,u),c+=i,l-=i,u&&(u=0)}return e.length>c?e.slice(0,c):e},s.prototype.shallowSlice=function(e,t){if(e=e||0,t="number"!=typeof t?this.length:t,e<0&&(e+=this.length),t<0&&(t+=this.length),e===t)return this._new();const i=this._offset(e),n=this._offset(t),r=this._bufs.slice(i[0],n[0]+1);return 0===n[1]?r.pop():r[r.length-1]=r[r.length-1].slice(0,n[1]),0!==i[1]&&(r[0]=r[0].slice(i[1])),this._new(r)},s.prototype.toString=function(e,t,i){return this.slice(t,i).toString(e)},s.prototype.consume=function(e){if(e=Math.trunc(e),Number.isNaN(e)||e<=0)return this;for(;this._bufs.length;){if(!(e>=this._bufs[0].length)){this._bufs[0]=this._bufs[0].slice(e),this.length-=e;break}e-=this._bufs[0].length,this.length-=this._bufs[0].length,this._bufs.shift()}return this},s.prototype.duplicate=function(){const e=this._new();for(let t=0;t<this._bufs.length;t++)e.append(this._bufs[t]);return e},s.prototype.append=function(e){if(null==e)return this;if(e.buffer)this._appendBuffer(n.from(e.buffer,e.byteOffset,e.byteLength));else if(Array.isArray(e))for(let t=0;t<e.length;t++)this.append(e[t]);else if(this._isBufferList(e))for(let t=0;t<e._bufs.length;t++)this.append(e._bufs[t]);else"number"==typeof e&&(e=e.toString()),this._appendBuffer(n.from(e));return this},s.prototype._appendBuffer=function(e){this._bufs.push(e),this.length+=e.length},s.prototype.indexOf=function(e,t,i){if(void 0===i&&"string"==typeof t&&(i=t,t=void 0),"function"==typeof e||Array.isArray(e))throw new TypeError('The "value" argument must be one of type string, Buffer, BufferList, or Uint8Array.');if("number"==typeof e?e=n.from([e]):"string"==typeof e?e=n.from(e,i):this._isBufferList(e)?e=e.slice():Array.isArray(e.buffer)?e=n.from(e.buffer,e.byteOffset,e.byteLength):n.isBuffer(e)||(e=n.from(e)),t=Number(t||0),isNaN(t)&&(t=0),t<0&&(t=this.length+t),t<0&&(t=0),0===e.length)return t>this.length?this.length:t;const r=this._offset(t);let s=r[0],o=r[1];for(;s<this._bufs.length;s++){const t=this._bufs[s];for(;o<t.length;){if(t.length-o>=e.length){const i=t.indexOf(e,o);if(-1!==i)return this._reverseOffset([s,i]);o=t.length-e.length+1}else{const t=this._reverseOffset([s,o]);if(this._match(t,e))return t;o++}}o=0}return-1},s.prototype._match=function(e,t){if(this.length-e<t.length)return!1;for(let i=0;i<t.length;i++)if(this.get(e+i)!==t[i])return!1;return!0},function(){const e={readDoubleBE:8,readDoubleLE:8,readFloatBE:4,readFloatLE:4,readInt32BE:4,readInt32LE:4,readUInt32BE:4,readUInt32LE:4,readInt16BE:2,readInt16LE:2,readUInt16BE:2,readUInt16LE:2,readInt8:1,readUInt8:1,readIntBE:null,readIntLE:null,readUIntBE:null,readUIntLE:null};for(const t in e)(function(t){s.prototype[t]=null===e[t]?function(e,i){return this.slice(e,e+i)[t](0,i)}:function(i=0){return this.slice(i,i+e[t])[t](0)}})(t)}(),s.prototype._isBufferList=function(e){return e instanceof s||s.isBufferList(e)},s.isBufferList=function(e){return null!=e&&e[r]},e.exports=s},5278(e,t,i){"use strict";const n=i(4198).Duplex,r=i(2017),s=i(5518);function o(e){if(!(this instanceof o))return new o(e);if("function"==typeof e){this._callback=e;const t=function(e){this._callback&&(this._callback(e),this._callback=null)}.bind(this);this.on("pipe",function(e){e.on("error",t)}),this.on("unpipe",function(e){e.removeListener("error",t)}),e=null}s._init.call(this,e),n.call(this)}r(o,n),Object.assign(o.prototype,s.prototype),o.prototype._new=function(e){return new o(e)},o.prototype._write=function(e,t,i){this._appendBuffer(e),"function"==typeof i&&i()},o.prototype._read=function(e){if(!this.length)return this.push(null);e=Math.min(e,this.length),this.push(this.slice(0,e)),this.consume(e)},o.prototype.end=function(e){n.prototype.end.call(this,e),this._callback&&(this._callback(null,this.slice()),this._callback=null)},o.prototype._destroy=function(e,t){this._bufs.length=0,this.length=0,t(e)},o.prototype._isBufferList=function(e){return e instanceof o||e instanceof s||o.isBufferList(e)},o.isBufferList=s.isBufferList,e.exports=o,e.exports.BufferListStream=o,e.exports.BufferList=s},6284(e,t,i){"use strict";const n=i(9896),r=i(6928),s=n.lchown?"lchown":"chown",o=n.lchownSync?"lchownSync":"chownSync",a=n.lchown&&!process.version.match(/v1[1-9]+\./)&&!process.version.match(/v10\.[6-9]/),l=(e,t,i)=>{try{return n[o](e,t,i)}catch(e){if("ENOENT"!==e.code)throw e}},c=a?(e,t,i,r)=>s=>{s&&"EISDIR"===s.code?n.chown(e,t,i,r):r(s)}:(e,t,i,n)=>n,u=a?(e,t,i)=>{try{return l(e,t,i)}catch(r){if("EISDIR"!==r.code)throw r;((e,t,i)=>{try{return n.chownSync(e,t,i)}catch(e){if("ENOENT"!==e.code)throw e}})(e,t,i)}}:(e,t,i)=>l(e,t,i),h=process.version;let d=(e,t,i)=>n.readdir(e,t,i);/^v4\./.test(h)&&(d=(e,t,i)=>n.readdir(e,i));const f=(e,t,i,r)=>{n[s](e,t,i,c(e,t,i,e=>{r(e&&"ENOENT"!==e.code?e:null)}))},p=(e,t,i,s,o)=>{if("string"==typeof t)return n.lstat(r.resolve(e,t),(n,r)=>{if(n)return o("ENOENT"!==n.code?n:null);r.name=t,p(e,r,i,s,o)});if(t.isDirectory())g(r.resolve(e,t.name),i,s,n=>{if(n)return o(n);const a=r.resolve(e,t.name);f(a,i,s,o)});else{const n=r.resolve(e,t.name);f(n,i,s,o)}},g=(e,t,i,n)=>{d(e,{withFileTypes:!0},(r,s)=>{if(r){if("ENOENT"===r.code)return n();if("ENOTDIR"!==r.code&&"ENOTSUP"!==r.code)return n(r)}if(r||!s.length)return f(e,t,i,n);let o=s.length,a=null;const l=r=>{if(!a)return r?n(a=r):0===--o?f(e,t,i,n):void 0};s.forEach(n=>p(e,n,t,i,l))})},m=(e,t,i)=>{let s;try{s=((e,t)=>n.readdirSync(e,t))(e,{withFileTypes:!0})}catch(n){if("ENOENT"===n.code)return;if("ENOTDIR"===n.code||"ENOTSUP"===n.code)return u(e,t,i);throw n}return s&&s.length&&s.forEach(s=>((e,t,i,s)=>{if("string"==typeof t)try{const i=n.lstatSync(r.resolve(e,t));i.name=t,t=i}catch(e){if("ENOENT"===e.code)return;throw e}t.isDirectory()&&m(r.resolve(e,t.name),i,s),u(r.resolve(e,t.name),i,s)})(e,s,t,i)),u(e,t,i)};e.exports=g,g.sync=m},3807(e,t,i){var n=i(9023),r=i(5278),s=i(3544),o=i(4198).Writable,a=i(4198).PassThrough,l=function(){},c=function(e){return(e&=511)&&512-e},u=function(e,t){this._parent=e,this.offset=t,a.call(this,{autoDestroy:!1})};n.inherits(u,a),u.prototype.destroy=function(e){this._parent.destroy(e)};var h=function(e){if(!(this instanceof h))return new h(e);o.call(this,e),e=e||{},this._offset=0,this._buffer=r(),this._missing=0,this._partial=!1,this._onparse=l,this._header=null,this._stream=null,this._overflow=null,this._cb=null,this._locked=!1,this._destroyed=!1,this._pax=null,this._paxGlobal=null,this._gnuLongPath=null,this._gnuLongLinkPath=null;var t=this,i=t._buffer,n=function(){t._continue()},a=function(e){if(t._locked=!1,e)return t.destroy(e);t._stream||n()},d=function(){t._stream=null;var e=c(t._header.size);e?t._parse(e,f):t._parse(512,y),t._locked||n()},f=function(){t._buffer.consume(c(t._header.size)),t._parse(512,y),n()},p=function(){var e=t._header.size;t._paxGlobal=s.decodePax(i.slice(0,e)),i.consume(e),d()},g=function(){var e=t._header.size;t._pax=s.decodePax(i.slice(0,e)),t._paxGlobal&&(t._pax=Object.assign({},t._paxGlobal,t._pax)),i.consume(e),d()},m=function(){var n=t._header.size;this._gnuLongPath=s.decodeLongPath(i.slice(0,n),e.filenameEncoding),i.consume(n),d()},v=function(){var n=t._header.size;this._gnuLongLinkPath=s.decodeLongPath(i.slice(0,n),e.filenameEncoding),i.consume(n),d()},y=function(){var r,o=t._offset;try{r=t._header=s.decode(i.slice(0,512),e.filenameEncoding,e.allowUnknownFormat)}catch(e){t.emit("error",e)}return i.consume(512),r?"gnu-long-path"===r.type?(t._parse(r.size,m),void n()):"gnu-long-link-path"===r.type?(t._parse(r.size,v),void n()):"pax-global-header"===r.type?(t._parse(r.size,p),void n()):"pax-header"===r.type?(t._parse(r.size,g),void n()):(t._gnuLongPath&&(r.name=t._gnuLongPath,t._gnuLongPath=null),t._gnuLongLinkPath&&(r.linkname=t._gnuLongLinkPath,t._gnuLongLinkPath=null),t._pax&&(t._header=r=function(e,t){return t.path&&(e.name=t.path),t.linkpath&&(e.linkname=t.linkpath),t.size&&(e.size=parseInt(t.size,10)),e.pax=t,e}(r,t._pax),t._pax=null),t._locked=!0,r.size&&"directory"!==r.type?(t._stream=new u(t,o),t.emit("entry",r,t._stream,a),t._parse(r.size,d),void n()):(t._parse(512,y),void t.emit("entry",r,function(e,t){var i=new u(e,t);return i.end(),i}(t,o),a))):(t._parse(512,y),void n())};this._onheader=y,this._parse(512,y)};n.inherits(h,o),h.prototype.destroy=function(e){this._destroyed||(this._destroyed=!0,e&&this.emit("error",e),this.emit("close"),this._stream&&this._stream.emit("close"))},h.prototype._parse=function(e,t){this._destroyed||(this._offset+=e,this._missing=e,t===this._onheader&&(this._partial=!1),this._onparse=t)},h.prototype._continue=function(){if(!this._destroyed){var e=this._cb;this._cb=l,this._overflow?this._write(this._overflow,void 0,e):e()}},h.prototype._write=function(e,t,i){if(!this._destroyed){var n=this._stream,r=this._buffer,s=this._missing;if(e.length&&(this._partial=!0),e.length<s)return this._missing-=e.length,this._overflow=null,n?n.write(e,i):(r.append(e),i());this._cb=i,this._missing=0;var o=null;e.length>s&&(o=e.slice(s),e=e.slice(0,s)),n?n.end(e):r.append(e),this._overflow=o,this._onparse()}},h.prototype._final=function(e){if(this._partial)return this.destroy(new Error("Unexpected end of data"));e()},e.exports=h},3544(e,t){var i=Buffer.alloc,n="0".charCodeAt(0),r=Buffer.from("ustar\0","binary"),s=Buffer.from("00","binary"),o=Buffer.from("ustar ","binary"),a=Buffer.from(" \0","binary"),l=parseInt("7777",8),c=257,u=function(e,t,i,n){for(;i<n;i++)if(e[i]===t)return i;return n},h=function(e){for(var t=256,i=0;i<148;i++)t+=e[i];for(var n=156;n<512;n++)t+=e[n];return t},d=function(e,t){return(e=e.toString(8)).length>t?"7777777777777777777".slice(0,t)+" ":"0000000000000000000".slice(0,t-e.length)+e+" "};var f=function(e,t,i){if(128&(e=e.slice(t,t+i))[t=0])return function(e){var t;if(128===e[0])t=!0;else{if(255!==e[0])return null;t=!1}for(var i=[],n=e.length-1;n>0;n--){var r=e[n];t?i.push(r):i.push(255-r)}var s=0,o=i.length;for(n=0;n<o;n++)s+=i[n]*Math.pow(256,n);return t?s:-1*s}(e);for(;t<e.length&&32===e[t];)t++;for(var n=(r=u(e,32,t,e.length),s=e.length,o=e.length,"number"!=typeof r?o:(r=~~r)>=s?s:r>=0||(r+=s)>=0?r:0);t<n&&0===e[t];)t++;return n===t?0:parseInt(e.slice(t,n).toString(),8);var r,s,o},p=function(e,t,i,n){return e.slice(t,u(e,0,t,t+i)).toString(n)},g=function(e){var t=Buffer.byteLength(e),i=Math.floor(Math.log(t)/Math.log(10))+1;return t+i>=Math.pow(10,i)&&i++,t+i+e};t.decodeLongPath=function(e,t){return p(e,0,e.length,t)},t.encodePax=function(e){var t="";e.name&&(t+=g(" path="+e.name+"\n")),e.linkname&&(t+=g(" linkpath="+e.linkname+"\n"));var i=e.pax;if(i)for(var n in i)t+=g(" "+n+"="+i[n]+"\n");return Buffer.from(t)},t.decodePax=function(e){for(var t={};e.length;){for(var i=0;i<e.length&&32!==e[i];)i++;var n=parseInt(e.slice(0,i).toString(),10);if(!n)return t;var r=e.slice(i+1,n-1).toString(),s=r.indexOf("=");if(-1===s)return t;t[r.slice(0,s)]=r.slice(s+1),e=e.slice(n)}return t},t.encode=function(e){var t=i(512),o=e.name,a="";if(5===e.typeflag&&"/"!==o[o.length-1]&&(o+="/"),Buffer.byteLength(o)!==o.length)return null;for(;Buffer.byteLength(o)>100;){var u=o.indexOf("/");if(-1===u)return null;a+=a?"/"+o.slice(0,u):o.slice(0,u),o=o.slice(u+1)}return Buffer.byteLength(o)>100||Buffer.byteLength(a)>155||e.linkname&&Buffer.byteLength(e.linkname)>100?null:(t.write(o),t.write(d(e.mode&l,6),100),t.write(d(e.uid,6),108),t.write(d(e.gid,6),116),t.write(d(e.size,11),124),t.write(d(e.mtime.getTime()/1e3|0,11),136),t[156]=n+function(e){switch(e){case"file":return 0;case"link":return 1;case"symlink":return 2;case"character-device":return 3;case"block-device":return 4;case"directory":return 5;case"fifo":return 6;case"contiguous-file":return 7;case"pax-header":return 72}return 0}(e.type),e.linkname&&t.write(e.linkname,157),r.copy(t,c),s.copy(t,263),e.uname&&t.write(e.uname,265),e.gname&&t.write(e.gname,297),t.write(d(e.devmajor||0,6),329),t.write(d(e.devminor||0,6),337),a&&t.write(a,345),t.write(d(h(t),6),148),t)},t.decode=function(e,t,i){var s=0===e[156]?0:e[156]-n,l=p(e,0,100,t),u=f(e,100,8),d=f(e,108,8),g=f(e,116,8),m=f(e,124,12),v=f(e,136,12),y=function(e){switch(e){case 0:return"file";case 1:return"link";case 2:return"symlink";case 3:return"character-device";case 4:return"block-device";case 5:return"directory";case 6:return"fifo";case 7:return"contiguous-file";case 72:return"pax-header";case 55:return"pax-global-header";case 27:return"gnu-long-link-path";case 28:case 30:return"gnu-long-path"}return null}(s),b=0===e[157]?null:p(e,157,100,t),S=p(e,265,32),_=p(e,297,32),C=f(e,329,8),E=f(e,337,8),w=h(e);if(256===w)return null;if(w!==f(e,148,8))throw new Error("Invalid tar header. Maybe the tar is corrupted or it needs to be gunzipped?");if(0===r.compare(e,c,263))e[345]&&(l=p(e,345,155,t)+"/"+l);else if(0===o.compare(e,c,263)&&0===a.compare(e,263,265));else if(!i)throw new Error("Invalid tar header: unknown format.");return 0===s&&l&&"/"===l[l.length-1]&&(s=5),{name:l,mode:u,uid:d,gid:g,size:m,mtime:new Date(1e3*v),type:y,linkname:b,uname:S,gname:_,devmajor:C,devminor:E}}},6706(e,t,i){t.extract=i(3807),t.pack=i(4009)},4009(e,t,i){var n=i(2170),r=i(6611),s=i(2017),o=Buffer.alloc,a=i(4198).Readable,l=i(4198).Writable,c=i(3193).StringDecoder,u=i(3544),h=parseInt("755",8),d=parseInt("644",8),f=o(1024),p=function(){},g=function(e,t){(t&=511)&&e.push(f.slice(0,512-t))};var m=function(e){l.call(this),this.written=0,this._to=e,this._destroyed=!1};s(m,l),m.prototype._write=function(e,t,i){if(this.written+=e.length,this._to.push(e))return i();this._to._drain=i},m.prototype.destroy=function(){this._destroyed||(this._destroyed=!0,this.emit("close"))};var v=function(){l.call(this),this.linkname="",this._decoder=new c("utf-8"),this._destroyed=!1};s(v,l),v.prototype._write=function(e,t,i){this.linkname+=this._decoder.write(e),i()},v.prototype.destroy=function(){this._destroyed||(this._destroyed=!0,this.emit("close"))};var y=function(){l.call(this),this._destroyed=!1};s(y,l),y.prototype._write=function(e,t,i){i(new Error("No body allowed for this entry"))},y.prototype.destroy=function(){this._destroyed||(this._destroyed=!0,this.emit("close"))};var b=function(e){if(!(this instanceof b))return new b(e);a.call(this,e),this._drain=p,this._finalized=!1,this._finalizing=!1,this._destroyed=!1,this._stream=null};s(b,a),b.prototype.entry=function(e,t,i){if(this._stream)throw new Error("already piping an entry");if(!this._finalized&&!this._destroyed){"function"==typeof t&&(i=t,t=null),i||(i=p);var s=this;if(e.size&&"symlink"!==e.type||(e.size=0),e.type||(e.type=function(e){switch(e&n.S_IFMT){case n.S_IFBLK:return"block-device";case n.S_IFCHR:return"character-device";case n.S_IFDIR:return"directory";case n.S_IFIFO:return"fifo";case n.S_IFLNK:return"symlink"}return"file"}(e.mode)),e.mode||(e.mode="directory"===e.type?h:d),e.uid||(e.uid=0),e.gid||(e.gid=0),e.mtime||(e.mtime=new Date),"string"==typeof t&&(t=Buffer.from(t)),Buffer.isBuffer(t)){e.size=t.length,this._encode(e);var o=this.push(t);return g(s,e.size),o?process.nextTick(i):this._drain=i,new y}if("symlink"===e.type&&!e.linkname){var a=new v;return r(a,function(t){if(t)return s.destroy(),i(t);e.linkname=a.linkname,s._encode(e),i()}),a}if(this._encode(e),"file"!==e.type&&"contiguous-file"!==e.type)return process.nextTick(i),new y;var l=new m(this);return this._stream=l,r(l,function(t){return s._stream=null,t?(s.destroy(),i(t)):l.written!==e.size?(s.destroy(),i(new Error("size mismatch"))):(g(s,e.size),s._finalizing&&s.finalize(),void i())}),l}},b.prototype.finalize=function(){this._stream?this._finalizing=!0:this._finalized||(this._finalized=!0,this.push(f),this.push(null))},b.prototype.destroy=function(e){this._destroyed||(this._destroyed=!0,e&&this.emit("error",e),this.emit("close"),this._stream&&this._stream.destroy&&this._stream.destroy())},b.prototype._encode=function(e){if(!e.pax){var t=u.encode(e);if(t)return void this.push(t)}this._encodePax(e)},b.prototype._encodePax=function(e){var t=u.encodePax({name:e.name,linkname:e.linkname,pax:e.pax}),i={name:"PaxHeader",mode:e.mode,uid:e.uid,gid:e.gid,size:t.length,mtime:e.mtime,type:"pax-header",linkname:e.linkname&&"PaxHeader",uname:e.uname,gname:e.gname,devmajor:e.devmajor,devminor:e.devminor};this.push(u.encode(i)),this.push(t),g(this,t.length),i.size=e.size,i.type=e.type,this.push(u.encode(i))},b.prototype._read=function(e){var t=this._drain;this._drain=p,t()},e.exports=b},7983(e,t,i){e.exports=i(9023).deprecate},4679(e,t,i){"use strict";i.d(t,{v4:()=>h});const n=require("node:crypto");var r=i.n(n);const s={randomUUID:r().randomUUID},o=new Uint8Array(256);let a=o.length;function l(){return a>o.length-16&&(r().randomFillSync(o),a=0),o.slice(a,a+=16)}const c=[];for(let e=0;e<256;++e)c.push((e+256).toString(16).slice(1));function u(e,t=0){return(c[e[t+0]]+c[e[t+1]]+c[e[t+2]]+c[e[t+3]]+"-"+c[e[t+4]]+c[e[t+5]]+"-"+c[e[t+6]]+c[e[t+7]]+"-"+c[e[t+8]]+c[e[t+9]]+"-"+c[e[t+10]]+c[e[t+11]]+c[e[t+12]]+c[e[t+13]]+c[e[t+14]]+c[e[t+15]]).toLowerCase()}const h=function(e,t,i){if(s.randomUUID&&!t&&!e)return s.randomUUID();const n=(e=e||{}).random||(e.rng||l)();if(n[6]=15&n[6]|64,n[8]=63&n[8]|128,t){i=i||0;for(let e=0;e<16;++e)t[i+e]=n[e];return t}return u(n)}},6587(e){e.exports=function e(t,i){if(t&&i)return e(t)(i);if("function"!=typeof t)throw new TypeError("need wrapper function");return Object.keys(t).forEach(function(e){n[e]=t[e]}),n;function n(){for(var e=new Array(arguments.length),i=0;i<e.length;i++)e[i]=arguments[i];var n=t.apply(this,e),r=e[e.length-1];return"function"==typeof n&&n!==r&&Object.keys(r).forEach(function(e){n[e]=r[e]}),n}}},6087(e){"use strict";e.exports=require("@xiaobaidadada/node-pty-prebuilt")},2710(e){"use strict";e.exports=require("@xiaobaidadada/node-tuntap2-wintun")},1217(e){"use strict";e.exports=require("@xiaobaidadada/ssh2-prebuilt")},4505(e){"use strict";e.exports=require("node-process-watcher")},7179(e){"use strict";e.exports=require("sqlite3/build/Release/node_sqlite3.node")},181(e){"use strict";e.exports=require("buffer")},9140(e){"use strict";e.exports=require("constants")},2250(e){"use strict";e.exports=require("dns")},4434(e){"use strict";e.exports=require("events")},9896(e){"use strict";e.exports=require("fs")},8611(e){"use strict";e.exports=require("http")},5675(e){"use strict";e.exports=require("http2")},5692(e){"use strict";e.exports=require("https")},9278(e){"use strict";e.exports=require("net")},857(e){"use strict";e.exports=require("os")},6928(e){"use strict";e.exports=require("path")},932(e){"use strict";e.exports=require("process")},3480(e){"use strict";e.exports=require("querystring")},2203(e){"use strict";e.exports=require("stream")},3193(e){"use strict";e.exports=require("string_decoder")},4756(e){"use strict";e.exports=require("tls")},7016(e){"use strict";e.exports=require("url")},9023(e){"use strict";e.exports=require("util")},8167(e){"use strict";e.exports=require("worker_threads")},3106(e){"use strict";e.exports=require("zlib")},5017(e,t){var i;"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self&&self,i=function(){var e={};return function(e){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.default=void 0;var t=null;try{t=new WebAssembly.Instance(new WebAssembly.Module(new Uint8Array([0,97,115,109,1,0,0,0,1,13,2,96,0,1,127,96,4,127,127,127,127,1,127,3,7,6,0,1,1,1,1,1,6,6,1,127,1,65,0,11,7,50,6,3,109,117,108,0,1,5,100,105,118,95,115,0,2,5,100,105,118,95,117,0,3,5,114,101,109,95,115,0,4,5,114,101,109,95,117,0,5,8,103,101,116,95,104,105,103,104,0,0,10,191,1,6,4,0,35,0,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,126,34,4,66,32,135,167,36,0,32,4,167,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,127,34,4,66,32,135,167,36,0,32,4,167,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,128,34,4,66,32,135,167,36,0,32,4,167,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,129,34,4,66,32,135,167,36,0,32,4,167,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,130,34,4,66,32,135,167,36,0,32,4,167,11])),{}).exports}catch{}function i(e,t,i){this.low=0|e,this.high=0|t,this.unsigned=!!i}function n(e){return!0===(e&&e.__isLong__)}function r(e){var t=Math.clz32(e&-e);return e?31-t:t}i.prototype.__isLong__,Object.defineProperty(i.prototype,"__isLong__",{value:!0}),i.isLong=n;var s={},o={};function a(e,t){var i,n,r;return t?(r=0<=(e>>>=0)&&e<256)&&(n=o[e])?n:(i=c(e,0,!0),r&&(o[e]=i),i):(r=-128<=(e|=0)&&e<128)&&(n=s[e])?n:(i=c(e,e<0?-1:0,!1),r&&(s[e]=i),i)}function l(e,t){if(isNaN(e))return t?b:y;if(t){if(e<0)return b;if(e>=g)return w}else{if(e<=-m)return T;if(e+1>=m)return E}return e<0?l(-e,t).neg():c(e%p|0,e/p|0,t)}function c(e,t,n){return new i(e,t,n)}i.fromInt=a,i.fromNumber=l,i.fromBits=c;var u=Math.pow;function h(e,t,i){if(0===e.length)throw Error("empty string");if("number"==typeof t?(i=t,t=!1):t=!!t,"NaN"===e||"Infinity"===e||"+Infinity"===e||"-Infinity"===e)return t?b:y;if((i=i||10)<2||36<i)throw RangeError("radix");var n;if((n=e.indexOf("-"))>0)throw Error("interior hyphen");if(0===n)return h(e.substring(1),t,i).neg();for(var r=l(u(i,8)),s=y,o=0;o<e.length;o+=8){var a=Math.min(8,e.length-o),c=parseInt(e.substring(o,o+a),i);if(a<8){var d=l(u(i,a));s=s.mul(d).add(l(c))}else s=(s=s.mul(r)).add(l(c))}return s.unsigned=t,s}function d(e,t){return"number"==typeof e?l(e,t):"string"==typeof e?h(e,t):c(e.low,e.high,"boolean"==typeof t?t:e.unsigned)}i.fromString=h,i.fromValue=d;var f=65536,p=f*f,g=p*p,m=g/2,v=a(1<<24),y=a(0);i.ZERO=y;var b=a(0,!0);i.UZERO=b;var S=a(1);i.ONE=S;var _=a(1,!0);i.UONE=_;var C=a(-1);i.NEG_ONE=C;var E=c(-1,2147483647,!1);i.MAX_VALUE=E;var w=c(-1,-1,!0);i.MAX_UNSIGNED_VALUE=w;var T=c(0,-2147483648,!1);i.MIN_VALUE=T;var k=i.prototype;k.toInt=function(){return this.unsigned?this.low>>>0:this.low},k.toNumber=function(){return this.unsigned?(this.high>>>0)*p+(this.low>>>0):this.high*p+(this.low>>>0)},k.toString=function(e){if((e=e||10)<2||36<e)throw RangeError("radix");if(this.isZero())return"0";if(this.isNegative()){if(this.eq(T)){var t=l(e),i=this.div(t),n=i.mul(t).sub(this);return i.toString(e)+n.toInt().toString(e)}return"-"+this.neg().toString(e)}for(var r=l(u(e,6),this.unsigned),s=this,o="";;){var a=s.div(r),c=(s.sub(a.mul(r)).toInt()>>>0).toString(e);if((s=a).isZero())return c+o;for(;c.length<6;)c="0"+c;o=""+c+o}},k.getHighBits=function(){return this.high},k.getHighBitsUnsigned=function(){return this.high>>>0},k.getLowBits=function(){return this.low},k.getLowBitsUnsigned=function(){return this.low>>>0},k.getNumBitsAbs=function(){if(this.isNegative())return this.eq(T)?64:this.neg().getNumBitsAbs();for(var e=0!=this.high?this.high:this.low,t=31;t>0&&!(e&1<<t);t--);return 0!=this.high?t+33:t+1},k.isSafeInteger=function(){var e=this.high>>21;return!e||!this.unsigned&&-1===e&&!(0===this.low&&-2097152===this.high)},k.isZero=function(){return 0===this.high&&0===this.low},k.eqz=k.isZero,k.isNegative=function(){return!this.unsigned&&this.high<0},k.isPositive=function(){return this.unsigned||this.high>=0},k.isOdd=function(){return!(1&~this.low)},k.isEven=function(){return!(1&this.low)},k.equals=function(e){return n(e)||(e=d(e)),(this.unsigned===e.unsigned||this.high>>>31!=1||e.high>>>31!=1)&&this.high===e.high&&this.low===e.low},k.eq=k.equals,k.notEquals=function(e){return!this.eq(e)},k.neq=k.notEquals,k.ne=k.notEquals,k.lessThan=function(e){return this.comp(e)<0},k.lt=k.lessThan,k.lessThanOrEqual=function(e){return this.comp(e)<=0},k.lte=k.lessThanOrEqual,k.le=k.lessThanOrEqual,k.greaterThan=function(e){return this.comp(e)>0},k.gt=k.greaterThan,k.greaterThanOrEqual=function(e){return this.comp(e)>=0},k.gte=k.greaterThanOrEqual,k.ge=k.greaterThanOrEqual,k.compare=function(e){if(n(e)||(e=d(e)),this.eq(e))return 0;var t=this.isNegative(),i=e.isNegative();return t&&!i?-1:!t&&i?1:this.unsigned?e.high>>>0>this.high>>>0||e.high===this.high&&e.low>>>0>this.low>>>0?-1:1:this.sub(e).isNegative()?-1:1},k.comp=k.compare,k.negate=function(){return!this.unsigned&&this.eq(T)?T:this.not().add(S)},k.neg=k.negate,k.add=function(e){n(e)||(e=d(e));var t=this.high>>>16,i=65535&this.high,r=this.low>>>16,s=65535&this.low,o=e.high>>>16,a=65535&e.high,l=e.low>>>16,u=0,h=0,f=0,p=0;return f+=(p+=s+(65535&e.low))>>>16,h+=(f+=r+l)>>>16,u+=(h+=i+a)>>>16,u+=t+o,c((f&=65535)<<16|(p&=65535),(u&=65535)<<16|(h&=65535),this.unsigned)},k.subtract=function(e){return n(e)||(e=d(e)),this.add(e.neg())},k.sub=k.subtract,k.multiply=function(e){if(this.isZero())return this;if(n(e)||(e=d(e)),t)return c(t.mul(this.low,this.high,e.low,e.high),t.get_high(),this.unsigned);if(e.isZero())return this.unsigned?b:y;if(this.eq(T))return e.isOdd()?T:y;if(e.eq(T))return this.isOdd()?T:y;if(this.isNegative())return e.isNegative()?this.neg().mul(e.neg()):this.neg().mul(e).neg();if(e.isNegative())return this.mul(e.neg()).neg();if(this.lt(v)&&e.lt(v))return l(this.toNumber()*e.toNumber(),this.unsigned);var i=this.high>>>16,r=65535&this.high,s=this.low>>>16,o=65535&this.low,a=e.high>>>16,u=65535&e.high,h=e.low>>>16,f=65535&e.low,p=0,g=0,m=0,S=0;return m+=(S+=o*f)>>>16,g+=(m+=s*f)>>>16,m&=65535,g+=(m+=o*h)>>>16,p+=(g+=r*f)>>>16,g&=65535,p+=(g+=s*h)>>>16,g&=65535,p+=(g+=o*u)>>>16,p+=i*f+r*h+s*u+o*a,c((m&=65535)<<16|(S&=65535),(p&=65535)<<16|(g&=65535),this.unsigned)},k.mul=k.multiply,k.divide=function(e){if(n(e)||(e=d(e)),e.isZero())throw Error("division by zero");var i,r,s;if(t)return this.unsigned||-2147483648!==this.high||-1!==e.low||-1!==e.high?c((this.unsigned?t.div_u:t.div_s)(this.low,this.high,e.low,e.high),t.get_high(),this.unsigned):this;if(this.isZero())return this.unsigned?b:y;if(this.unsigned){if(e.unsigned||(e=e.toUnsigned()),e.gt(this))return b;if(e.gt(this.shru(1)))return _;s=b}else{if(this.eq(T))return e.eq(S)||e.eq(C)?T:e.eq(T)?S:(i=this.shr(1).div(e).shl(1)).eq(y)?e.isNegative()?S:C:(r=this.sub(e.mul(i)),s=i.add(r.div(e)));if(e.eq(T))return this.unsigned?b:y;if(this.isNegative())return e.isNegative()?this.neg().div(e.neg()):this.neg().div(e).neg();if(e.isNegative())return this.div(e.neg()).neg();s=y}for(r=this;r.gte(e);){i=Math.max(1,Math.floor(r.toNumber()/e.toNumber()));for(var o=Math.ceil(Math.log(i)/Math.LN2),a=o<=48?1:u(2,o-48),h=l(i),f=h.mul(e);f.isNegative()||f.gt(r);)f=(h=l(i-=a,this.unsigned)).mul(e);h.isZero()&&(h=S),s=s.add(h),r=r.sub(f)}return s},k.div=k.divide,k.modulo=function(e){return n(e)||(e=d(e)),t?c((this.unsigned?t.rem_u:t.rem_s)(this.low,this.high,e.low,e.high),t.get_high(),this.unsigned):this.sub(this.div(e).mul(e))},k.mod=k.modulo,k.rem=k.modulo,k.not=function(){return c(~this.low,~this.high,this.unsigned)},k.countLeadingZeros=function(){return this.high?Math.clz32(this.high):Math.clz32(this.low)+32},k.clz=k.countLeadingZeros,k.countTrailingZeros=function(){return this.low?r(this.low):r(this.high)+32},k.ctz=k.countTrailingZeros,k.and=function(e){return n(e)||(e=d(e)),c(this.low&e.low,this.high&e.high,this.unsigned)},k.or=function(e){return n(e)||(e=d(e)),c(this.low|e.low,this.high|e.high,this.unsigned)},k.xor=function(e){return n(e)||(e=d(e)),c(this.low^e.low,this.high^e.high,this.unsigned)},k.shiftLeft=function(e){return n(e)&&(e=e.toInt()),0==(e&=63)?this:e<32?c(this.low<<e,this.high<<e|this.low>>>32-e,this.unsigned):c(0,this.low<<e-32,this.unsigned)},k.shl=k.shiftLeft,k.shiftRight=function(e){return n(e)&&(e=e.toInt()),0==(e&=63)?this:e<32?c(this.low>>>e|this.high<<32-e,this.high>>e,this.unsigned):c(this.high>>e-32,this.high>=0?0:-1,this.unsigned)},k.shr=k.shiftRight,k.shiftRightUnsigned=function(e){return n(e)&&(e=e.toInt()),0==(e&=63)?this:e<32?c(this.low>>>e|this.high<<32-e,this.high>>>e,this.unsigned):c(32===e?this.high:this.high>>>e-32,0,this.unsigned)},k.shru=k.shiftRightUnsigned,k.shr_u=k.shiftRightUnsigned,k.rotateLeft=function(e){var t;return n(e)&&(e=e.toInt()),0==(e&=63)?this:32===e?c(this.high,this.low,this.unsigned):e<32?(t=32-e,c(this.low<<e|this.high>>>t,this.high<<e|this.low>>>t,this.unsigned)):(t=32-(e-=32),c(this.high<<e|this.low>>>t,this.low<<e|this.high>>>t,this.unsigned))},k.rotl=k.rotateLeft,k.rotateRight=function(e){var t;return n(e)&&(e=e.toInt()),0==(e&=63)?this:32===e?c(this.high,this.low,this.unsigned):e<32?(t=32-e,c(this.high<<t|this.low>>>e,this.low<<t|this.high>>>e,this.unsigned)):(t=32-(e-=32),c(this.low<<t|this.high>>>e,this.high<<t|this.low>>>e,this.unsigned))},k.rotr=k.rotateRight,k.toSigned=function(){return this.unsigned?c(this.low,this.high,!1):this},k.toUnsigned=function(){return this.unsigned?this:c(this.low,this.high,!0)},k.toBytes=function(e){return e?this.toBytesLE():this.toBytesBE()},k.toBytesLE=function(){var e=this.high,t=this.low;return[255&t,t>>>8&255,t>>>16&255,t>>>24,255&e,e>>>8&255,e>>>16&255,e>>>24]},k.toBytesBE=function(){var e=this.high,t=this.low;return[e>>>24,e>>>16&255,e>>>8&255,255&e,t>>>24,t>>>16&255,t>>>8&255,255&t]},i.fromBytes=function(e,t,n){return n?i.fromBytesLE(e,t):i.fromBytesBE(e,t)},i.fromBytesLE=function(e,t){return new i(e[0]|e[1]<<8|e[2]<<16|e[3]<<24,e[4]|e[5]<<8|e[6]<<16|e[7]<<24,t)},i.fromBytesBE=function(e,t){return new i(e[4]<<24|e[5]<<16|e[6]<<8|e[7],e[0]<<24|e[1]<<16|e[2]<<8|e[3],t)},"function"==typeof BigInt&&(i.fromBigInt=function(e,t){return c(Number(BigInt.asIntN(32,e)),Number(BigInt.asIntN(32,e>>BigInt(32))),t)},i.fromValue=function(e,t){return"bigint"==typeof e?i.fromBigInt(e,t):d(e,t)},k.toBigInt=function(){var e=BigInt(this.low>>>0);return BigInt(this.unsigned?this.high>>>0:this.high)<<BigInt(32)|e}),e.default=i}(e),function(e){return e.default||e}(e)}.apply(t,[]),void 0===i||(e.exports=i)},9943(e){"use strict";e.exports={rE:"1.14.3"}},5434(e){"use strict";e.exports=JSON.parse('{"nested":{"google":{"nested":{"protobuf":{"nested":{"Api":{"fields":{"name":{"type":"string","id":1},"methods":{"rule":"repeated","type":"Method","id":2},"options":{"rule":"repeated","type":"Option","id":3},"version":{"type":"string","id":4},"sourceContext":{"type":"SourceContext","id":5},"mixins":{"rule":"repeated","type":"Mixin","id":6},"syntax":{"type":"Syntax","id":7}}},"Method":{"fields":{"name":{"type":"string","id":1},"requestTypeUrl":{"type":"string","id":2},"requestStreaming":{"type":"bool","id":3},"responseTypeUrl":{"type":"string","id":4},"responseStreaming":{"type":"bool","id":5},"options":{"rule":"repeated","type":"Option","id":6},"syntax":{"type":"Syntax","id":7}}},"Mixin":{"fields":{"name":{"type":"string","id":1},"root":{"type":"string","id":2}}},"SourceContext":{"fields":{"fileName":{"type":"string","id":1}}},"Option":{"fields":{"name":{"type":"string","id":1},"value":{"type":"Any","id":2}}},"Syntax":{"values":{"SYNTAX_PROTO2":0,"SYNTAX_PROTO3":1}}}}}}}}')},3951(e){"use strict";e.exports=JSON.parse('{"nested":{"google":{"nested":{"protobuf":{"options":{"go_package":"google.golang.org/protobuf/types/descriptorpb","java_package":"com.google.protobuf","java_outer_classname":"DescriptorProtos","csharp_namespace":"Google.Protobuf.Reflection","objc_class_prefix":"GPB","cc_enable_arenas":true,"optimize_for":"SPEED"},"nested":{"FileDescriptorSet":{"edition":"proto2","fields":{"file":{"rule":"repeated","type":"FileDescriptorProto","id":1}},"extensions":[[536000000,536000000]]},"Edition":{"edition":"proto2","values":{"EDITION_UNKNOWN":0,"EDITION_LEGACY":900,"EDITION_PROTO2":998,"EDITION_PROTO3":999,"EDITION_2023":1000,"EDITION_2024":1001,"EDITION_1_TEST_ONLY":1,"EDITION_2_TEST_ONLY":2,"EDITION_99997_TEST_ONLY":99997,"EDITION_99998_TEST_ONLY":99998,"EDITION_99999_TEST_ONLY":99999,"EDITION_MAX":2147483647}},"FileDescriptorProto":{"edition":"proto2","fields":{"name":{"type":"string","id":1},"package":{"type":"string","id":2},"dependency":{"rule":"repeated","type":"string","id":3},"publicDependency":{"rule":"repeated","type":"int32","id":10},"weakDependency":{"rule":"repeated","type":"int32","id":11},"optionDependency":{"rule":"repeated","type":"string","id":15},"messageType":{"rule":"repeated","type":"DescriptorProto","id":4},"enumType":{"rule":"repeated","type":"EnumDescriptorProto","id":5},"service":{"rule":"repeated","type":"ServiceDescriptorProto","id":6},"extension":{"rule":"repeated","type":"FieldDescriptorProto","id":7},"options":{"type":"FileOptions","id":8},"sourceCodeInfo":{"type":"SourceCodeInfo","id":9},"syntax":{"type":"string","id":12},"edition":{"type":"Edition","id":14}}},"DescriptorProto":{"edition":"proto2","fields":{"name":{"type":"string","id":1},"field":{"rule":"repeated","type":"FieldDescriptorProto","id":2},"extension":{"rule":"repeated","type":"FieldDescriptorProto","id":6},"nestedType":{"rule":"repeated","type":"DescriptorProto","id":3},"enumType":{"rule":"repeated","type":"EnumDescriptorProto","id":4},"extensionRange":{"rule":"repeated","type":"ExtensionRange","id":5},"oneofDecl":{"rule":"repeated","type":"OneofDescriptorProto","id":8},"options":{"type":"MessageOptions","id":7},"reservedRange":{"rule":"repeated","type":"ReservedRange","id":9},"reservedName":{"rule":"repeated","type":"string","id":10},"visibility":{"type":"SymbolVisibility","id":11}},"nested":{"ExtensionRange":{"fields":{"start":{"type":"int32","id":1},"end":{"type":"int32","id":2},"options":{"type":"ExtensionRangeOptions","id":3}}},"ReservedRange":{"fields":{"start":{"type":"int32","id":1},"end":{"type":"int32","id":2}}}}},"ExtensionRangeOptions":{"edition":"proto2","fields":{"uninterpretedOption":{"rule":"repeated","type":"UninterpretedOption","id":999},"declaration":{"rule":"repeated","type":"Declaration","id":2,"options":{"retention":"RETENTION_SOURCE"}},"features":{"type":"FeatureSet","id":50},"verification":{"type":"VerificationState","id":3,"options":{"default":"UNVERIFIED","retention":"RETENTION_SOURCE"}}},"extensions":[[1000,536870911]],"nested":{"Declaration":{"fields":{"number":{"type":"int32","id":1},"fullName":{"type":"string","id":2},"type":{"type":"string","id":3},"reserved":{"type":"bool","id":5},"repeated":{"type":"bool","id":6}},"reserved":[[4,4]]},"VerificationState":{"values":{"DECLARATION":0,"UNVERIFIED":1}}}},"FieldDescriptorProto":{"edition":"proto2","fields":{"name":{"type":"string","id":1},"number":{"type":"int32","id":3},"label":{"type":"Label","id":4},"type":{"type":"Type","id":5},"typeName":{"type":"string","id":6},"extendee":{"type":"string","id":2},"defaultValue":{"type":"string","id":7},"oneofIndex":{"type":"int32","id":9},"jsonName":{"type":"string","id":10},"options":{"type":"FieldOptions","id":8},"proto3Optional":{"type":"bool","id":17}},"nested":{"Type":{"values":{"TYPE_DOUBLE":1,"TYPE_FLOAT":2,"TYPE_INT64":3,"TYPE_UINT64":4,"TYPE_INT32":5,"TYPE_FIXED64":6,"TYPE_FIXED32":7,"TYPE_BOOL":8,"TYPE_STRING":9,"TYPE_GROUP":10,"TYPE_MESSAGE":11,"TYPE_BYTES":12,"TYPE_UINT32":13,"TYPE_ENUM":14,"TYPE_SFIXED32":15,"TYPE_SFIXED64":16,"TYPE_SINT32":17,"TYPE_SINT64":18}},"Label":{"values":{"LABEL_OPTIONAL":1,"LABEL_REPEATED":3,"LABEL_REQUIRED":2}}}},"OneofDescriptorProto":{"edition":"proto2","fields":{"name":{"type":"string","id":1},"options":{"type":"OneofOptions","id":2}}},"EnumDescriptorProto":{"edition":"proto2","fields":{"name":{"type":"string","id":1},"value":{"rule":"repeated","type":"EnumValueDescriptorProto","id":2},"options":{"type":"EnumOptions","id":3},"reservedRange":{"rule":"repeated","type":"EnumReservedRange","id":4},"reservedName":{"rule":"repeated","type":"string","id":5},"visibility":{"type":"SymbolVisibility","id":6}},"nested":{"EnumReservedRange":{"fields":{"start":{"type":"int32","id":1},"end":{"type":"int32","id":2}}}}},"EnumValueDescriptorProto":{"edition":"proto2","fields":{"name":{"type":"string","id":1},"number":{"type":"int32","id":2},"options":{"type":"EnumValueOptions","id":3}}},"ServiceDescriptorProto":{"edition":"proto2","fields":{"name":{"type":"string","id":1},"method":{"rule":"repeated","type":"MethodDescriptorProto","id":2},"options":{"type":"ServiceOptions","id":3}}},"MethodDescriptorProto":{"edition":"proto2","fields":{"name":{"type":"string","id":1},"inputType":{"type":"string","id":2},"outputType":{"type":"string","id":3},"options":{"type":"MethodOptions","id":4},"clientStreaming":{"type":"bool","id":5},"serverStreaming":{"type":"bool","id":6}}},"FileOptions":{"edition":"proto2","fields":{"javaPackage":{"type":"string","id":1},"javaOuterClassname":{"type":"string","id":8},"javaMultipleFiles":{"type":"bool","id":10},"javaGenerateEqualsAndHash":{"type":"bool","id":20,"options":{"deprecated":true}},"javaStringCheckUtf8":{"type":"bool","id":27},"optimizeFor":{"type":"OptimizeMode","id":9,"options":{"default":"SPEED"}},"goPackage":{"type":"string","id":11},"ccGenericServices":{"type":"bool","id":16},"javaGenericServices":{"type":"bool","id":17},"pyGenericServices":{"type":"bool","id":18},"deprecated":{"type":"bool","id":23},"ccEnableArenas":{"type":"bool","id":31,"options":{"default":true}},"objcClassPrefix":{"type":"string","id":36},"csharpNamespace":{"type":"string","id":37},"swiftPrefix":{"type":"string","id":39},"phpClassPrefix":{"type":"string","id":40},"phpNamespace":{"type":"string","id":41},"phpMetadataNamespace":{"type":"string","id":44},"rubyPackage":{"type":"string","id":45},"features":{"type":"FeatureSet","id":50},"uninterpretedOption":{"rule":"repeated","type":"UninterpretedOption","id":999}},"extensions":[[1000,536870911]],"reserved":[[42,42],[38,38],"php_generic_services"],"nested":{"OptimizeMode":{"values":{"SPEED":1,"CODE_SIZE":2,"LITE_RUNTIME":3}}}},"MessageOptions":{"edition":"proto2","fields":{"messageSetWireFormat":{"type":"bool","id":1},"noStandardDescriptorAccessor":{"type":"bool","id":2},"deprecated":{"type":"bool","id":3},"mapEntry":{"type":"bool","id":7},"deprecatedLegacyJsonFieldConflicts":{"type":"bool","id":11,"options":{"deprecated":true}},"features":{"type":"FeatureSet","id":12},"uninterpretedOption":{"rule":"repeated","type":"UninterpretedOption","id":999}},"extensions":[[1000,536870911]],"reserved":[[4,4],[5,5],[6,6],[8,8],[9,9]]},"FieldOptions":{"edition":"proto2","fields":{"ctype":{"type":"CType","id":1,"options":{"default":"STRING"}},"packed":{"type":"bool","id":2},"jstype":{"type":"JSType","id":6,"options":{"default":"JS_NORMAL"}},"lazy":{"type":"bool","id":5},"unverifiedLazy":{"type":"bool","id":15},"deprecated":{"type":"bool","id":3},"weak":{"type":"bool","id":10,"options":{"deprecated":true}},"debugRedact":{"type":"bool","id":16},"retention":{"type":"OptionRetention","id":17},"targets":{"rule":"repeated","type":"OptionTargetType","id":19},"editionDefaults":{"rule":"repeated","type":"EditionDefault","id":20},"features":{"type":"FeatureSet","id":21},"featureSupport":{"type":"FeatureSupport","id":22},"uninterpretedOption":{"rule":"repeated","type":"UninterpretedOption","id":999}},"extensions":[[1000,536870911]],"reserved":[[4,4],[18,18]],"nested":{"CType":{"values":{"STRING":0,"CORD":1,"STRING_PIECE":2}},"JSType":{"values":{"JS_NORMAL":0,"JS_STRING":1,"JS_NUMBER":2}},"OptionRetention":{"values":{"RETENTION_UNKNOWN":0,"RETENTION_RUNTIME":1,"RETENTION_SOURCE":2}},"OptionTargetType":{"values":{"TARGET_TYPE_UNKNOWN":0,"TARGET_TYPE_FILE":1,"TARGET_TYPE_EXTENSION_RANGE":2,"TARGET_TYPE_MESSAGE":3,"TARGET_TYPE_FIELD":4,"TARGET_TYPE_ONEOF":5,"TARGET_TYPE_ENUM":6,"TARGET_TYPE_ENUM_ENTRY":7,"TARGET_TYPE_SERVICE":8,"TARGET_TYPE_METHOD":9}},"EditionDefault":{"fields":{"edition":{"type":"Edition","id":3},"value":{"type":"string","id":2}}},"FeatureSupport":{"fields":{"editionIntroduced":{"type":"Edition","id":1},"editionDeprecated":{"type":"Edition","id":2},"deprecationWarning":{"type":"string","id":3},"editionRemoved":{"type":"Edition","id":4}}}}},"OneofOptions":{"edition":"proto2","fields":{"features":{"type":"FeatureSet","id":1},"uninterpretedOption":{"rule":"repeated","type":"UninterpretedOption","id":999}},"extensions":[[1000,536870911]]},"EnumOptions":{"edition":"proto2","fields":{"allowAlias":{"type":"bool","id":2},"deprecated":{"type":"bool","id":3},"deprecatedLegacyJsonFieldConflicts":{"type":"bool","id":6,"options":{"deprecated":true}},"features":{"type":"FeatureSet","id":7},"uninterpretedOption":{"rule":"repeated","type":"UninterpretedOption","id":999}},"extensions":[[1000,536870911]],"reserved":[[5,5]]},"EnumValueOptions":{"edition":"proto2","fields":{"deprecated":{"type":"bool","id":1},"features":{"type":"FeatureSet","id":2},"debugRedact":{"type":"bool","id":3},"featureSupport":{"type":"FieldOptions.FeatureSupport","id":4},"uninterpretedOption":{"rule":"repeated","type":"UninterpretedOption","id":999}},"extensions":[[1000,536870911]]},"ServiceOptions":{"edition":"proto2","fields":{"features":{"type":"FeatureSet","id":34},"deprecated":{"type":"bool","id":33},"uninterpretedOption":{"rule":"repeated","type":"UninterpretedOption","id":999}},"extensions":[[1000,536870911]]},"MethodOptions":{"edition":"proto2","fields":{"deprecated":{"type":"bool","id":33},"idempotencyLevel":{"type":"IdempotencyLevel","id":34,"options":{"default":"IDEMPOTENCY_UNKNOWN"}},"features":{"type":"FeatureSet","id":35},"uninterpretedOption":{"rule":"repeated","type":"UninterpretedOption","id":999}},"extensions":[[1000,536870911]],"nested":{"IdempotencyLevel":{"values":{"IDEMPOTENCY_UNKNOWN":0,"NO_SIDE_EFFECTS":1,"IDEMPOTENT":2}}}},"UninterpretedOption":{"edition":"proto2","fields":{"name":{"rule":"repeated","type":"NamePart","id":2},"identifierValue":{"type":"string","id":3},"positiveIntValue":{"type":"uint64","id":4},"negativeIntValue":{"type":"int64","id":5},"doubleValue":{"type":"double","id":6},"stringValue":{"type":"bytes","id":7},"aggregateValue":{"type":"string","id":8}},"nested":{"NamePart":{"fields":{"namePart":{"rule":"required","type":"string","id":1},"isExtension":{"rule":"required","type":"bool","id":2}}}}},"FeatureSet":{"edition":"proto2","fields":{"fieldPresence":{"type":"FieldPresence","id":1,"options":{"retention":"RETENTION_RUNTIME","targets":"TARGET_TYPE_FILE","feature_support.edition_introduced":"EDITION_2023","edition_defaults.edition":"EDITION_2023","edition_defaults.value":"EXPLICIT"}},"enumType":{"type":"EnumType","id":2,"options":{"retention":"RETENTION_RUNTIME","targets":"TARGET_TYPE_FILE","feature_support.edition_introduced":"EDITION_2023","edition_defaults.edition":"EDITION_PROTO3","edition_defaults.value":"OPEN"}},"repeatedFieldEncoding":{"type":"RepeatedFieldEncoding","id":3,"options":{"retention":"RETENTION_RUNTIME","targets":"TARGET_TYPE_FILE","feature_support.edition_introduced":"EDITION_2023","edition_defaults.edition":"EDITION_PROTO3","edition_defaults.value":"PACKED"}},"utf8Validation":{"type":"Utf8Validation","id":4,"options":{"retention":"RETENTION_RUNTIME","targets":"TARGET_TYPE_FILE","feature_support.edition_introduced":"EDITION_2023","edition_defaults.edition":"EDITION_PROTO3","edition_defaults.value":"VERIFY"}},"messageEncoding":{"type":"MessageEncoding","id":5,"options":{"retention":"RETENTION_RUNTIME","targets":"TARGET_TYPE_FILE","feature_support.edition_introduced":"EDITION_2023","edition_defaults.edition":"EDITION_LEGACY","edition_defaults.value":"LENGTH_PREFIXED"}},"jsonFormat":{"type":"JsonFormat","id":6,"options":{"retention":"RETENTION_RUNTIME","targets":"TARGET_TYPE_FILE","feature_support.edition_introduced":"EDITION_2023","edition_defaults.edition":"EDITION_PROTO3","edition_defaults.value":"ALLOW"}},"enforceNamingStyle":{"type":"EnforceNamingStyle","id":7,"options":{"retention":"RETENTION_SOURCE","targets":"TARGET_TYPE_METHOD","feature_support.edition_introduced":"EDITION_2024","edition_defaults.edition":"EDITION_2024","edition_defaults.value":"STYLE2024"}},"defaultSymbolVisibility":{"type":"VisibilityFeature.DefaultSymbolVisibility","id":8,"options":{"retention":"RETENTION_SOURCE","targets":"TARGET_TYPE_FILE","feature_support.edition_introduced":"EDITION_2024","edition_defaults.edition":"EDITION_2024","edition_defaults.value":"EXPORT_TOP_LEVEL"}}},"extensions":[[1000,9994],[9995,9999],[10000,10000]],"reserved":[[999,999]],"nested":{"FieldPresence":{"values":{"FIELD_PRESENCE_UNKNOWN":0,"EXPLICIT":1,"IMPLICIT":2,"LEGACY_REQUIRED":3}},"EnumType":{"values":{"ENUM_TYPE_UNKNOWN":0,"OPEN":1,"CLOSED":2}},"RepeatedFieldEncoding":{"values":{"REPEATED_FIELD_ENCODING_UNKNOWN":0,"PACKED":1,"EXPANDED":2}},"Utf8Validation":{"values":{"UTF8_VALIDATION_UNKNOWN":0,"VERIFY":2,"NONE":3}},"MessageEncoding":{"values":{"MESSAGE_ENCODING_UNKNOWN":0,"LENGTH_PREFIXED":1,"DELIMITED":2}},"JsonFormat":{"values":{"JSON_FORMAT_UNKNOWN":0,"ALLOW":1,"LEGACY_BEST_EFFORT":2}},"EnforceNamingStyle":{"values":{"ENFORCE_NAMING_STYLE_UNKNOWN":0,"STYLE2024":1,"STYLE_LEGACY":2}},"VisibilityFeature":{"fields":{},"reserved":[[1,536870911]],"nested":{"DefaultSymbolVisibility":{"values":{"DEFAULT_SYMBOL_VISIBILITY_UNKNOWN":0,"EXPORT_ALL":1,"EXPORT_TOP_LEVEL":2,"LOCAL_ALL":3,"STRICT":4}}}}}},"FeatureSetDefaults":{"edition":"proto2","fields":{"defaults":{"rule":"repeated","type":"FeatureSetEditionDefault","id":1},"minimumEdition":{"type":"Edition","id":4},"maximumEdition":{"type":"Edition","id":5}},"nested":{"FeatureSetEditionDefault":{"fields":{"edition":{"type":"Edition","id":3},"overridableFeatures":{"type":"FeatureSet","id":4},"fixedFeatures":{"type":"FeatureSet","id":5}},"reserved":[[1,1],[2,2],"features"]}}},"SourceCodeInfo":{"edition":"proto2","fields":{"location":{"rule":"repeated","type":"Location","id":1}},"extensions":[[536000000,536000000]],"nested":{"Location":{"fields":{"path":{"rule":"repeated","type":"int32","id":1,"options":{"packed":true}},"span":{"rule":"repeated","type":"int32","id":2,"options":{"packed":true}},"leadingComments":{"type":"string","id":3},"trailingComments":{"type":"string","id":4},"leadingDetachedComments":{"rule":"repeated","type":"string","id":6}}}}},"GeneratedCodeInfo":{"edition":"proto2","fields":{"annotation":{"rule":"repeated","type":"Annotation","id":1}},"nested":{"Annotation":{"fields":{"path":{"rule":"repeated","type":"int32","id":1,"options":{"packed":true}},"sourceFile":{"type":"string","id":2},"begin":{"type":"int32","id":3},"end":{"type":"int32","id":4},"semantic":{"type":"Semantic","id":5}},"nested":{"Semantic":{"values":{"NONE":0,"SET":1,"ALIAS":2}}}}}},"SymbolVisibility":{"edition":"proto2","values":{"VISIBILITY_UNSET":0,"VISIBILITY_LOCAL":1,"VISIBILITY_EXPORT":2}}}}}}}}')},2939(e){"use strict";e.exports=JSON.parse('{"nested":{"google":{"nested":{"protobuf":{"nested":{"SourceContext":{"fields":{"fileName":{"type":"string","id":1}}}}}}}}}')},6710(e){"use strict";e.exports=JSON.parse('{"nested":{"google":{"nested":{"protobuf":{"nested":{"Type":{"fields":{"name":{"type":"string","id":1},"fields":{"rule":"repeated","type":"Field","id":2},"oneofs":{"rule":"repeated","type":"string","id":3},"options":{"rule":"repeated","type":"Option","id":4},"sourceContext":{"type":"SourceContext","id":5},"syntax":{"type":"Syntax","id":6}}},"Field":{"fields":{"kind":{"type":"Kind","id":1},"cardinality":{"type":"Cardinality","id":2},"number":{"type":"int32","id":3},"name":{"type":"string","id":4},"typeUrl":{"type":"string","id":6},"oneofIndex":{"type":"int32","id":7},"packed":{"type":"bool","id":8},"options":{"rule":"repeated","type":"Option","id":9},"jsonName":{"type":"string","id":10},"defaultValue":{"type":"string","id":11}},"nested":{"Kind":{"values":{"TYPE_UNKNOWN":0,"TYPE_DOUBLE":1,"TYPE_FLOAT":2,"TYPE_INT64":3,"TYPE_UINT64":4,"TYPE_INT32":5,"TYPE_FIXED64":6,"TYPE_FIXED32":7,"TYPE_BOOL":8,"TYPE_STRING":9,"TYPE_GROUP":10,"TYPE_MESSAGE":11,"TYPE_BYTES":12,"TYPE_UINT32":13,"TYPE_ENUM":14,"TYPE_SFIXED32":15,"TYPE_SFIXED64":16,"TYPE_SINT32":17,"TYPE_SINT64":18}},"Cardinality":{"values":{"CARDINALITY_UNKNOWN":0,"CARDINALITY_OPTIONAL":1,"CARDINALITY_REQUIRED":2,"CARDINALITY_REPEATED":3}}}},"Enum":{"fields":{"name":{"type":"string","id":1},"enumvalue":{"rule":"repeated","type":"EnumValue","id":2},"options":{"rule":"repeated","type":"Option","id":3},"sourceContext":{"type":"SourceContext","id":4},"syntax":{"type":"Syntax","id":5}}},"EnumValue":{"fields":{"name":{"type":"string","id":1},"number":{"type":"int32","id":2},"options":{"rule":"repeated","type":"Option","id":3}}},"Option":{"fields":{"name":{"type":"string","id":1},"value":{"type":"Any","id":2}}},"Syntax":{"values":{"SYNTAX_PROTO2":0,"SYNTAX_PROTO3":1}},"Any":{"fields":{"type_url":{"type":"string","id":1},"value":{"type":"bytes","id":2}}},"SourceContext":{"fields":{"fileName":{"type":"string","id":1}}}}}}}}}')}},__webpack_module_cache__={};function __webpack_require__(e){var t=__webpack_module_cache__[e];if(void 0!==t)return t.exports;var i=__webpack_module_cache__[e]={id:e,loaded:!1,exports:{}};return __webpack_modules__[e].call(i.exports,i,i.exports,__webpack_require__),i.loaded=!0,i.exports}__webpack_require__.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return __webpack_require__.d(t,{a:t}),t},__webpack_require__.d=(e,t)=>{for(var i in t)__webpack_require__.o(t,i)&&!__webpack_require__.o(e,i)&&Object.defineProperty(e,i,{enumerable:!0,get:t[i]})},__webpack_require__.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),__webpack_require__.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},__webpack_require__.nmd=e=>(e.paths=[],e.children||(e.children=[]),e);var __webpack_exports__={};(()=>{"use strict";const e=__webpack_require__(3285),t=__webpack_require__(3054),i=__webpack_require__(8551);(0,e.file_search_start)(),(0,t.start_ai_agent_agent)(),(0,i.start_sys_worker)()})()})();