@apocaliss92/scrypted-reolink-native 0.1.15 → 0.1.16

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.
@@ -1,3 +1,3 @@
1
1
  /*! For license information please see main.nodejs.js.LICENSE.txt */
2
- (()=>{var e={9038:(e,t,s)=>{"use strict";const r=s(1167),n=s(5497),A=s(8542),i=s(8055),o=s(3315),a=s(9246),c=s(4667),l=s(8712),h=s(8297),g=s(4465),d=s(2858),{InvalidArgumentError:u}=g,E=s(9713),I=s(1986),C=s(615),{MockCallHistory:B,MockCallHistoryLog:Q}=s(4969),p=s(7467),f=s(5846),m=s(1313),y=s(3123),w=s(6294),{getGlobalDispatcher:S,setGlobalDispatcher:D}=s(9879),b=s(6917),v=s(8064);Object.assign(n.prototype,E),e.exports.g6=o,s(5132),s(2936),s(532),s(3562),s(6677),s(5752),s(4951),s(9903);function R(e){return(t,s,r)=>{if("function"==typeof s&&(r=s,s=null),!t||"string"!=typeof t&&"object"!=typeof t&&!(t instanceof URL))throw new u("invalid url");if(null!=s&&"object"!=typeof s)throw new u("invalid opts");if(s&&null!=s.path){if("string"!=typeof s.path)throw new u("invalid opts.path");let e=s.path;s.path.startsWith("/")||(e=`/${e}`),t=new URL(d.parseOrigin(t).origin+e)}else s||(s="object"==typeof t?t:{}),t=d.parseURL(t);const{agent:n,dispatcher:A=S()}=s;if(n)throw new u("unsupported opts.agent. Did you mean opts.client?");return e.call(A,{...s,origin:t.origin,path:t.search?`${t.pathname}${t.search}`:t.pathname,method:s.method||(s.body?"PUT":"GET")},r)}}s(2636),d.parseHeaders,d.headerNameToString;const N=s(7388).fetch;e.exports.hd=function(e,t=void 0){return N(e,t).catch((e=>{throw e&&"object"==typeof e&&Error.captureStackTrace(e),e}))},e.exports.Headers=s(6558).Headers,e.exports.Response=s(4821).Response,e.exports.Request=s(4609).Request,e.exports.FormData=s(3944).FormData;const{setGlobalOrigin:k,getGlobalOrigin:T}=s(2837);const{CacheStorage:F}=s(6939),{kConstruct:M}=s(257);new F(M);const{deleteCookie:U,getCookies:L,getSetCookies:H,setCookie:P,parseCookie:x}=s(9391);const{parseMIMEType:Y,serializeAMimeType:V}=s(9934);const{CloseEvent:O,ErrorEvent:G,MessageEvent:J}=s(878),{WebSocket:W,ping:_}=s(2984);e.exports.kb=W,e.exports.rd=O,e.exports.NN=G,e.exports.aM=J,s(27).WebSocketStream,s(7053).WebSocketError,R(E.request),R(E.stream),R(E.pipeline),R(E.connect),R(E.upgrade);const{EventSource:q}=s(7928);e.exports.GD=q},3904:(e,t,s)=>{"use strict";const{addAbortListener:r}=s(2858),{RequestAbortedError:n}=s(4465),A=Symbol("kListener"),i=Symbol("kSignal");function o(e){e.abort?e.abort(e[i]?.reason):e.reason=e[i]?.reason??new n,a(e)}function a(e){e[i]&&("removeEventListener"in e[i]?e[i].removeEventListener("abort",e[A]):e[i].removeListener("abort",e[A]),e[i]=null,e[A]=null)}e.exports={addSignal:function(e,t){e.reason=null,e[i]=null,e[A]=null,t&&(t.aborted?o(e):(e[i]=t,e[A]=()=>{o(e)},r(e[i],e[A])))},removeSignal:a}},3102:(e,t,s)=>{"use strict";const r=s(4589),{AsyncResource:n}=s(6698),{InvalidArgumentError:A,SocketError:i}=s(4465),o=s(2858),{addSignal:a,removeSignal:c}=s(3904);class l extends n{constructor(e,t){if(!e||"object"!=typeof e)throw new A("invalid opts");if("function"!=typeof t)throw new A("invalid callback");const{signal:s,opaque:r,responseHeaders:n}=e;if(s&&"function"!=typeof s.on&&"function"!=typeof s.addEventListener)throw new A("signal must be an EventEmitter or EventTarget");super("UNDICI_CONNECT"),this.opaque=r||null,this.responseHeaders=n||null,this.callback=t,this.abort=null,a(this,s)}onConnect(e,t){this.reason?e(this.reason):(r(this.callback),this.abort=e,this.context=t)}onHeaders(){throw new i("bad connect",null)}onUpgrade(e,t,s){const{callback:r,opaque:n,context:A}=this;c(this),this.callback=null;let i=t;null!=i&&(i="raw"===this.responseHeaders?o.parseRawHeaders(t):o.parseHeaders(t)),this.runInAsyncScope(r,null,null,{statusCode:e,headers:i,socket:s,opaque:n,context:A})}onError(e){const{callback:t,opaque:s}=this;c(this),t&&(this.callback=null,queueMicrotask((()=>{this.runInAsyncScope(t,null,e,{opaque:s})})))}}e.exports=function e(t,s){if(void 0===s)return new Promise(((s,r)=>{e.call(this,t,((e,t)=>e?r(e):s(t)))}));try{const e=new l(t,s),r={...t,method:"CONNECT"};this.dispatch(r,e)}catch(e){if("function"!=typeof s)throw e;const r=t?.opaque;queueMicrotask((()=>s(e,{opaque:r})))}}},8660:(e,t,s)=>{"use strict";const{Readable:r,Duplex:n,PassThrough:A}=s(7075),i=s(4589),{AsyncResource:o}=s(6698),{InvalidArgumentError:a,InvalidReturnValueError:c,RequestAbortedError:l}=s(4465),h=s(2858),{addSignal:g,removeSignal:d}=s(3904);function u(){}const E=Symbol("resume");class I extends r{constructor(){super({autoDestroy:!0}),this[E]=null}_read(){const{[E]:e}=this;e&&(this[E]=null,e())}_destroy(e,t){this._read(),t(e)}}class C extends r{constructor(e){super({autoDestroy:!0}),this[E]=e}_read(){this[E]()}_destroy(e,t){e||this._readableState.endEmitted||(e=new l),t(e)}}class B extends o{constructor(e,t){if(!e||"object"!=typeof e)throw new a("invalid opts");if("function"!=typeof t)throw new a("invalid handler");const{signal:s,method:r,opaque:A,onInfo:i,responseHeaders:o}=e;if(s&&"function"!=typeof s.on&&"function"!=typeof s.addEventListener)throw new a("signal must be an EventEmitter or EventTarget");if("CONNECT"===r)throw new a("invalid method");if(i&&"function"!=typeof i)throw new a("invalid onInfo callback");super("UNDICI_PIPELINE"),this.opaque=A||null,this.responseHeaders=o||null,this.handler=t,this.abort=null,this.context=null,this.onInfo=i||null,this.req=(new I).on("error",u),this.ret=new n({readableObjectMode:e.objectMode,autoDestroy:!0,read:()=>{const{body:e}=this;e?.resume&&e.resume()},write:(e,t,s)=>{const{req:r}=this;r.push(e,t)||r._readableState.destroyed?s():r[E]=s},destroy:(e,t)=>{const{body:s,req:r,res:n,ret:A,abort:i}=this;e||A._readableState.endEmitted||(e=new l),i&&e&&i(),h.destroy(s,e),h.destroy(r,e),h.destroy(n,e),d(this),t(e)}}).on("prefinish",(()=>{const{req:e}=this;e.push(null)})),this.res=null,g(this,s)}onConnect(e,t){const{res:s}=this;this.reason?e(this.reason):(i(!s,"pipeline cannot be retried"),this.abort=e,this.context=t)}onHeaders(e,t,s){const{opaque:r,handler:n,context:A}=this;if(e<200){if(this.onInfo){const s="raw"===this.responseHeaders?h.parseRawHeaders(t):h.parseHeaders(t);this.onInfo({statusCode:e,headers:s})}return}let i;this.res=new C(s);try{this.handler=null;const s="raw"===this.responseHeaders?h.parseRawHeaders(t):h.parseHeaders(t);i=this.runInAsyncScope(n,null,{statusCode:e,headers:s,opaque:r,body:this.res,context:A})}catch(e){throw this.res.on("error",u),e}if(!i||"function"!=typeof i.on)throw new c("expected Readable");i.on("data",(e=>{const{ret:t,body:s}=this;!t.push(e)&&s.pause&&s.pause()})).on("error",(e=>{const{ret:t}=this;h.destroy(t,e)})).on("end",(()=>{const{ret:e}=this;e.push(null)})).on("close",(()=>{const{ret:e}=this;e._readableState.ended||h.destroy(e,new l)})),this.body=i}onData(e){const{res:t}=this;return t.push(e)}onComplete(e){const{res:t}=this;t.push(null)}onError(e){const{ret:t}=this;this.handler=null,h.destroy(t,e)}}e.exports=function(e,t){try{const s=new B(e,t);return this.dispatch({...e,body:s.req},s),s.ret}catch(e){return(new A).destroy(e)}}},7745:(e,t,s)=>{"use strict";const r=s(4589),{AsyncResource:n}=s(6698),{Readable:A}=s(777),{InvalidArgumentError:i,RequestAbortedError:o}=s(4465),a=s(2858);function c(){}class l extends n{constructor(e,t){if(!e||"object"!=typeof e)throw new i("invalid opts");const{signal:s,method:r,opaque:n,body:A,onInfo:l,responseHeaders:h,highWaterMark:g}=e;try{if("function"!=typeof t)throw new i("invalid callback");if(g&&("number"!=typeof g||g<0))throw new i("invalid highWaterMark");if(s&&"function"!=typeof s.on&&"function"!=typeof s.addEventListener)throw new i("signal must be an EventEmitter or EventTarget");if("CONNECT"===r)throw new i("invalid method");if(l&&"function"!=typeof l)throw new i("invalid onInfo callback");super("UNDICI_REQUEST")}catch(e){throw a.isStream(A)&&a.destroy(A.on("error",c),e),e}this.method=r,this.responseHeaders=h||null,this.opaque=n||null,this.callback=t,this.res=null,this.abort=null,this.body=A,this.trailers={},this.context=null,this.onInfo=l||null,this.highWaterMark=g,this.reason=null,this.removeAbortListener=null,s?.aborted?this.reason=s.reason??new o:s&&(this.removeAbortListener=a.addAbortListener(s,(()=>{this.reason=s.reason??new o,this.res?a.destroy(this.res.on("error",c),this.reason):this.abort&&this.abort(this.reason)})))}onConnect(e,t){this.reason?e(this.reason):(r(this.callback),this.abort=e,this.context=t)}onHeaders(e,t,s,r){const{callback:n,opaque:i,abort:o,context:l,responseHeaders:h,highWaterMark:g}=this,d="raw"===h?a.parseRawHeaders(t):a.parseHeaders(t);if(e<200)return void(this.onInfo&&this.onInfo({statusCode:e,headers:d}));const u="raw"===h?a.parseHeaders(t):d,E=u["content-type"],I=u["content-length"],C=new A({resume:s,abort:o,contentType:E,contentLength:"HEAD"!==this.method&&I?Number(I):null,highWaterMark:g});if(this.removeAbortListener&&(C.on("close",this.removeAbortListener),this.removeAbortListener=null),this.callback=null,this.res=C,null!==n)try{this.runInAsyncScope(n,null,null,{statusCode:e,headers:d,trailers:this.trailers,opaque:i,body:C,context:l})}catch(e){this.res=null,a.destroy(C.on("error",c),e),queueMicrotask((()=>{throw e}))}}onData(e){return this.res.push(e)}onComplete(e){a.parseHeaders(e,this.trailers),this.res.push(null)}onError(e){const{res:t,callback:s,body:r,opaque:n}=this;s&&(this.callback=null,queueMicrotask((()=>{this.runInAsyncScope(s,null,e,{opaque:n})}))),t&&(this.res=null,queueMicrotask((()=>{a.destroy(t.on("error",c),e)}))),r&&(this.body=null,a.isStream(r)&&(r.on("error",c),a.destroy(r,e))),this.removeAbortListener&&(this.removeAbortListener(),this.removeAbortListener=null)}}e.exports=function e(t,s){if(void 0===s)return new Promise(((s,r)=>{e.call(this,t,((e,t)=>e?r(e):s(t)))}));try{const e=new l(t,s);this.dispatch(t,e)}catch(e){if("function"!=typeof s)throw e;const r=t?.opaque;queueMicrotask((()=>s(e,{opaque:r})))}},e.exports.RequestHandler=l},322:(e,t,s)=>{"use strict";const r=s(4589),{finished:n}=s(7075),{AsyncResource:A}=s(6698),{InvalidArgumentError:i,InvalidReturnValueError:o}=s(4465),a=s(2858),{addSignal:c,removeSignal:l}=s(3904);function h(){}class g extends A{constructor(e,t,s){if(!e||"object"!=typeof e)throw new i("invalid opts");const{signal:r,method:n,opaque:A,body:o,onInfo:l,responseHeaders:g}=e;try{if("function"!=typeof s)throw new i("invalid callback");if("function"!=typeof t)throw new i("invalid factory");if(r&&"function"!=typeof r.on&&"function"!=typeof r.addEventListener)throw new i("signal must be an EventEmitter or EventTarget");if("CONNECT"===n)throw new i("invalid method");if(l&&"function"!=typeof l)throw new i("invalid onInfo callback");super("UNDICI_STREAM")}catch(e){throw a.isStream(o)&&a.destroy(o.on("error",h),e),e}this.responseHeaders=g||null,this.opaque=A||null,this.factory=t,this.callback=s,this.res=null,this.abort=null,this.context=null,this.trailers=null,this.body=o,this.onInfo=l||null,a.isStream(o)&&o.on("error",(e=>{this.onError(e)})),c(this,r)}onConnect(e,t){this.reason?e(this.reason):(r(this.callback),this.abort=e,this.context=t)}onHeaders(e,t,s,r){const{factory:A,opaque:i,context:c,responseHeaders:l}=this,h="raw"===l?a.parseRawHeaders(t):a.parseHeaders(t);if(e<200)return void(this.onInfo&&this.onInfo({statusCode:e,headers:h}));if(this.factory=null,null===A)return;const g=this.runInAsyncScope(A,null,{statusCode:e,headers:h,opaque:i,context:c});if(!g||"function"!=typeof g.write||"function"!=typeof g.end||"function"!=typeof g.on)throw new o("expected Writable");n(g,{readable:!1},(e=>{const{callback:t,res:s,opaque:r,trailers:n,abort:A}=this;this.res=null,!e&&s?.readable||a.destroy(s,e),this.callback=null,this.runInAsyncScope(t,null,e||null,{opaque:r,trailers:n}),e&&A()})),g.on("drain",s),this.res=g;return!0!==(void 0!==g.writableNeedDrain?g.writableNeedDrain:g._writableState?.needDrain)}onData(e){const{res:t}=this;return!t||t.write(e)}onComplete(e){const{res:t}=this;l(this),t&&(this.trailers=a.parseHeaders(e),t.end())}onError(e){const{res:t,callback:s,opaque:r,body:n}=this;l(this),this.factory=null,t?(this.res=null,a.destroy(t,e)):s&&(this.callback=null,queueMicrotask((()=>{this.runInAsyncScope(s,null,e,{opaque:r})}))),n&&(this.body=null,a.destroy(n,e))}}e.exports=function e(t,s,r){if(void 0===r)return new Promise(((r,n)=>{e.call(this,t,s,((e,t)=>e?n(e):r(t)))}));try{const e=new g(t,s,r);this.dispatch(t,e)}catch(e){if("function"!=typeof r)throw e;const s=t?.opaque;queueMicrotask((()=>r(e,{opaque:s})))}}},3936:(e,t,s)=>{"use strict";const{InvalidArgumentError:r,SocketError:n}=s(4465),{AsyncResource:A}=s(6698),i=s(4589),o=s(2858),{addSignal:a,removeSignal:c}=s(3904);class l extends A{constructor(e,t){if(!e||"object"!=typeof e)throw new r("invalid opts");if("function"!=typeof t)throw new r("invalid callback");const{signal:s,opaque:n,responseHeaders:A}=e;if(s&&"function"!=typeof s.on&&"function"!=typeof s.addEventListener)throw new r("signal must be an EventEmitter or EventTarget");super("UNDICI_UPGRADE"),this.responseHeaders=A||null,this.opaque=n||null,this.callback=t,this.abort=null,this.context=null,a(this,s)}onConnect(e,t){this.reason?e(this.reason):(i(this.callback),this.abort=e,this.context=null)}onHeaders(){throw new n("bad upgrade",null)}onUpgrade(e,t,s){i(101===e);const{callback:r,opaque:n,context:A}=this;c(this),this.callback=null;const a="raw"===this.responseHeaders?o.parseRawHeaders(t):o.parseHeaders(t);this.runInAsyncScope(r,null,null,{headers:a,socket:s,opaque:n,context:A})}onError(e){const{callback:t,opaque:s}=this;c(this),t&&(this.callback=null,queueMicrotask((()=>{this.runInAsyncScope(t,null,e,{opaque:s})})))}}e.exports=function e(t,s){if(void 0===s)return new Promise(((s,r)=>{e.call(this,t,((e,t)=>e?r(e):s(t)))}));try{const e=new l(t,s),r={...t,method:t.method||"GET",upgrade:t.protocol||"Websocket"};this.dispatch(r,e)}catch(e){if("function"!=typeof s)throw e;const r=t?.opaque;queueMicrotask((()=>s(e,{opaque:r})))}}},9713:(e,t,s)=>{"use strict";e.exports.request=s(7745),e.exports.stream=s(322),e.exports.pipeline=s(8660),e.exports.upgrade=s(3936),e.exports.connect=s(3102)},777:(e,t,s)=>{"use strict";const r=s(4589),{Readable:n}=s(7075),{RequestAbortedError:A,NotSupportedError:i,InvalidArgumentError:o,AbortError:a}=s(4465),c=s(2858),{ReadableStreamFrom:l}=s(2858),h=Symbol("kConsume"),g=Symbol("kReading"),d=Symbol("kBody"),u=Symbol("kAbort"),E=Symbol("kContentType"),I=Symbol("kContentLength"),C=Symbol("kUsed"),B=Symbol("kBytesRead"),Q=()=>{};function p(e){return c.isDisturbed(e)||function(e){return!0===e[d]?.locked||null!==e[h]}(e)}function f(e,t){return r(!e[h]),new Promise(((s,r)=>{if(p(e)){const t=e._readableState;t.destroyed&&!1===t.closeEmitted?e.on("error",r).on("close",(()=>{r(new TypeError("unusable"))})):r(t.errored??new TypeError("unusable"))}else queueMicrotask((()=>{e[h]={type:t,stream:e,resolve:s,reject:r,length:0,body:[]},e.on("error",(function(e){D(this[h],e)})).on("close",(function(){null!==this[h].body&&D(this[h],new A)})),function(e){if(null===e.body)return;const{_readableState:t}=e.stream;if(t.bufferIndex){const s=t.bufferIndex,r=t.buffer.length;for(let n=s;n<r;n++)S(e,t.buffer[n])}else for(const s of t.buffer)S(e,s);t.endEmitted?w(this[h],this._readableState.encoding):e.stream.on("end",(function(){w(this[h],this._readableState.encoding)}));e.stream.resume();for(;null!=e.stream.read(););}(e[h])}))}))}function m(e,t,s){if(0===e.length||0===t)return"";const r=1===e.length?e[0]:Buffer.concat(e,t),n=r.length,A=n>2&&239===r[0]&&187===r[1]&&191===r[2]?3:0;return s&&"utf8"!==s&&"utf-8"!==s?r.subarray(A,n).toString(s):r.utf8Slice(A,n)}function y(e,t){if(0===e.length||0===t)return new Uint8Array(0);if(1===e.length)return new Uint8Array(e[0]);const s=new Uint8Array(Buffer.allocUnsafeSlow(t).buffer);let r=0;for(let t=0;t<e.length;++t){const n=e[t];s.set(n,r),r+=n.length}return s}function w(e,t){const{type:s,body:r,resolve:n,stream:A,length:i}=e;try{"text"===s?n(m(r,i,t)):"json"===s?n(JSON.parse(m(r,i,t))):"arrayBuffer"===s?n(y(r,i).buffer):"blob"===s?n(new Blob(r,{type:A[E]})):"bytes"===s&&n(y(r,i)),D(e)}catch(e){A.destroy(e)}}function S(e,t){e.length+=t.length,e.body.push(t)}function D(e,t){null!==e.body&&(t?e.reject(t):e.resolve(),e.type=null,e.stream=null,e.resolve=null,e.reject=null,e.length=0,e.body=null)}e.exports={Readable:class extends n{constructor({resume:e,abort:t,contentType:s="",contentLength:r,highWaterMark:n=65536}){super({autoDestroy:!0,read:e,highWaterMark:n}),this._readableState.dataEmitted=!1,this[u]=t,this[h]=null,this[B]=0,this[d]=null,this[C]=!1,this[E]=s,this[I]=Number.isFinite(r)?r:null,this[g]=!1}_destroy(e,t){e||this._readableState.endEmitted||(e=new A),e&&this[u](),this[C]?t(e):setImmediate(t,e)}on(e,t){return"data"!==e&&"readable"!==e||(this[g]=!0,this[C]=!0),super.on(e,t)}addListener(e,t){return this.on(e,t)}off(e,t){const s=super.off(e,t);return"data"!==e&&"readable"!==e||(this[g]=this.listenerCount("data")>0||this.listenerCount("readable")>0),s}removeListener(e,t){return this.off(e,t)}push(e){return e&&(this[B]+=e.length,this[h])?(S(this[h],e),!this[g]||super.push(e)):super.push(e)}text(){return f(this,"text")}json(){return f(this,"json")}blob(){return f(this,"blob")}bytes(){return f(this,"bytes")}arrayBuffer(){return f(this,"arrayBuffer")}async formData(){throw new i}get bodyUsed(){return c.isDisturbed(this)}get body(){return this[d]||(this[d]=l(this),this[h]&&(this[d].getReader(),r(this[d].locked))),this[d]}dump(e){const t=e?.signal;if(null!=t&&("object"!=typeof t||!("aborted"in t)))return Promise.reject(new o("signal must be an AbortSignal"));const s=e?.limit&&Number.isFinite(e.limit)?e.limit:131072;return t?.aborted?Promise.reject(t.reason??new a):this._readableState.closeEmitted?Promise.resolve(null):new Promise(((e,r)=>{if((this[I]&&this[I]>s||this[B]>s)&&this.destroy(new a),t){const s=()=>{this.destroy(t.reason??new a)};t.addEventListener("abort",s),this.on("close",(function(){t.removeEventListener("abort",s),t.aborted?r(t.reason??new a):e(null)}))}else this.on("close",e);this.on("error",Q).on("data",(()=>{this[B]>s&&this.destroy()})).resume()}))}setEncoding(e){return Buffer.isEncoding(e)&&(this._readableState.encoding=e),this}},chunksDecode:m}},9903:(e,t,s)=>{"use strict";const{Writable:r}=s(7075),{EventEmitter:n}=s(8474),{assertCacheKey:A,assertCacheValue:i}=s(9453);function o(e,t,s){return t.find((t=>t.deleteAt>s&&t.method===e.method&&(null==t.vary||Object.keys(t.vary).every((s=>null===t.vary[s]?void 0===e.headers[s]:t.vary[s]===e.headers[s])))))}e.exports=class extends n{#e=1024;#t=104857600;#s=5242880;#r=0;#n=0;#A=new Map;#i=!1;constructor(e){if(super(),e){if("object"!=typeof e)throw new TypeError("MemoryCacheStore options must be an object");if(void 0!==e.maxCount){if("number"!=typeof e.maxCount||!Number.isInteger(e.maxCount)||e.maxCount<0)throw new TypeError("MemoryCacheStore options.maxCount must be a non-negative integer");this.#e=e.maxCount}if(void 0!==e.maxSize){if("number"!=typeof e.maxSize||!Number.isInteger(e.maxSize)||e.maxSize<0)throw new TypeError("MemoryCacheStore options.maxSize must be a non-negative integer");this.#t=e.maxSize}if(void 0!==e.maxEntrySize){if("number"!=typeof e.maxEntrySize||!Number.isInteger(e.maxEntrySize)||e.maxEntrySize<0)throw new TypeError("MemoryCacheStore options.maxEntrySize must be a non-negative integer");this.#s=e.maxEntrySize}}}get size(){return this.#r}isFull(){return this.#r>=this.#t||this.#n>=this.#e}get(e){A(e);const t=`${e.origin}:${e.path}`,s=Date.now(),r=this.#A.get(t),n=r?o(e,r,s):null;return null==n?void 0:{statusMessage:n.statusMessage,statusCode:n.statusCode,headers:n.headers,body:n.body,vary:n.vary?n.vary:void 0,etag:n.etag,cacheControlDirectives:n.cacheControlDirectives,cachedAt:n.cachedAt,staleAt:n.staleAt,deleteAt:n.deleteAt}}createWriteStream(e,t){A(e),i(t);const s=`${e.origin}:${e.path}`,n=this,a={...e,...t,body:[],size:0};return new r({write(e,t,s){"string"==typeof e&&(e=Buffer.from(e,t)),a.size+=e.byteLength,a.size>=n.#s?this.destroy():a.body.push(e),s(null)},final(t){let r=n.#A.get(s);r||(r=[],n.#A.set(s,r));const A=o(e,r,Date.now());if(A){const e=r.indexOf(A);r.splice(e,1,a),n.#r-=A.size}else r.push(a),n.#n+=1;if(n.#r+=a.size,n.#r>n.#t||n.#n>n.#e){n.#i||(n.emit("maxSizeExceeded",{size:n.#r,maxSize:n.#t,count:n.#n,maxCount:n.#e}),n.#i=!0);for(const[e,t]of n.#A){for(const e of t.splice(0,t.length/2))n.#r-=e.size,n.#n-=1;0===t.length&&n.#A.delete(e)}n.#r<n.#t&&n.#n<n.#e&&(n.#i=!1)}t(null)}})}delete(e){if("object"!=typeof e)throw new TypeError("expected key to be object, got "+typeof e);const t=`${e.origin}:${e.path}`;for(const e of this.#A.get(t)??[])this.#r-=e.size,this.#n-=1;this.#A.delete(t)}}},2636:(e,t,s)=>{"use strict";const{Writable:r}=s(7075),{assertCacheKey:n,assertCacheValue:A}=s(9453);let i;const o=2e9;function a(e,t){return null==e&&null==t||!(null==e&&null!=t||null!=e&&null==t)&&(Array.isArray(e)&&Array.isArray(t)?e.length===t.length&&e.every(((e,s)=>e===t[s])):e===t)}e.exports=class{#s=o;#e=1/0;#o;#a;#c;#l;#h;#g;#d;#u;constructor(e){if(e){if("object"!=typeof e)throw new TypeError("SqliteCacheStore options must be an object");if(void 0!==e.maxEntrySize){if("number"!=typeof e.maxEntrySize||!Number.isInteger(e.maxEntrySize)||e.maxEntrySize<0)throw new TypeError("SqliteCacheStore options.maxEntrySize must be a non-negative integer");if(e.maxEntrySize>o)throw new TypeError("SqliteCacheStore options.maxEntrySize must be less than 2gb");this.#s=e.maxEntrySize}if(void 0!==e.maxCount){if("number"!=typeof e.maxCount||!Number.isInteger(e.maxCount)||e.maxCount<0)throw new TypeError("SqliteCacheStore options.maxCount must be a non-negative integer");this.#e=e.maxCount}}i||(i=s(99).DatabaseSync),this.#o=new i(e?.location??":memory:"),this.#o.exec("\n PRAGMA journal_mode = WAL;\n PRAGMA synchronous = NORMAL;\n PRAGMA temp_store = memory;\n PRAGMA optimize;\n\n CREATE TABLE IF NOT EXISTS cacheInterceptorV3 (\n -- Data specific to us\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n url TEXT NOT NULL,\n method TEXT NOT NULL,\n\n -- Data returned to the interceptor\n body BUF NULL,\n deleteAt INTEGER NOT NULL,\n statusCode INTEGER NOT NULL,\n statusMessage TEXT NOT NULL,\n headers TEXT NULL,\n cacheControlDirectives TEXT NULL,\n etag TEXT NULL,\n vary TEXT NULL,\n cachedAt INTEGER NOT NULL,\n staleAt INTEGER NOT NULL\n );\n\n CREATE INDEX IF NOT EXISTS idx_cacheInterceptorV3_getValuesQuery ON cacheInterceptorV3(url, method, deleteAt);\n CREATE INDEX IF NOT EXISTS idx_cacheInterceptorV3_deleteByUrlQuery ON cacheInterceptorV3(deleteAt);\n "),this.#a=this.#o.prepare("\n SELECT\n id,\n body,\n deleteAt,\n statusCode,\n statusMessage,\n headers,\n etag,\n cacheControlDirectives,\n vary,\n cachedAt,\n staleAt\n FROM cacheInterceptorV3\n WHERE\n url = ?\n AND method = ?\n ORDER BY\n deleteAt ASC\n "),this.#c=this.#o.prepare("\n UPDATE cacheInterceptorV3 SET\n body = ?,\n deleteAt = ?,\n statusCode = ?,\n statusMessage = ?,\n headers = ?,\n etag = ?,\n cacheControlDirectives = ?,\n cachedAt = ?,\n staleAt = ?\n WHERE\n id = ?\n "),this.#l=this.#o.prepare("\n INSERT INTO cacheInterceptorV3 (\n url,\n method,\n body,\n deleteAt,\n statusCode,\n statusMessage,\n headers,\n etag,\n cacheControlDirectives,\n vary,\n cachedAt,\n staleAt\n ) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)\n "),this.#g=this.#o.prepare("DELETE FROM cacheInterceptorV3 WHERE url = ?"),this.#d=this.#o.prepare("SELECT COUNT(*) AS total FROM cacheInterceptorV3"),this.#h=this.#o.prepare("DELETE FROM cacheInterceptorV3 WHERE deleteAt <= ?"),this.#u=this.#e===1/0?null:this.#o.prepare("\n DELETE FROM cacheInterceptorV3\n WHERE id IN (\n SELECT\n id\n FROM cacheInterceptorV3\n ORDER BY cachedAt DESC\n LIMIT ?\n )\n ")}close(){this.#o.close()}get(e){n(e);const t=this.#E(e);return t?{body:t.body?Buffer.from(t.body.buffer,t.body.byteOffset,t.body.byteLength):void 0,statusCode:t.statusCode,statusMessage:t.statusMessage,headers:t.headers?JSON.parse(t.headers):void 0,etag:t.etag?t.etag:void 0,vary:t.vary?JSON.parse(t.vary):void 0,cacheControlDirectives:t.cacheControlDirectives?JSON.parse(t.cacheControlDirectives):void 0,cachedAt:t.cachedAt,staleAt:t.staleAt,deleteAt:t.deleteAt}:void 0}set(e,t){n(e);const s=this.#I(e),r=Array.isArray(t.body)?Buffer.concat(t.body):t.body,A=r?.byteLength;if(A&&A>this.#s)return;const i=this.#E(e,!0);i?this.#c.run(r,t.deleteAt,t.statusCode,t.statusMessage,t.headers?JSON.stringify(t.headers):null,t.etag?t.etag:null,t.cacheControlDirectives?JSON.stringify(t.cacheControlDirectives):null,t.cachedAt,t.staleAt,i.id):(this.#C(),this.#l.run(s,e.method,r,t.deleteAt,t.statusCode,t.statusMessage,t.headers?JSON.stringify(t.headers):null,t.etag?t.etag:null,t.cacheControlDirectives?JSON.stringify(t.cacheControlDirectives):null,t.vary?JSON.stringify(t.vary):null,t.cachedAt,t.staleAt))}createWriteStream(e,t){n(e),A(t);let s=0;const i=[],o=this;return new r({decodeStrings:!0,write(e,t,r){s+=e.byteLength,s<o.#s?i.push(e):this.destroy(),r()},final(s){o.set(e,{...t,body:i}),s()}})}delete(e){if("object"!=typeof e)throw new TypeError("expected key to be object, got "+typeof e);this.#g.run(this.#I(e))}#C(){if(Number.isFinite(this.#e)&&this.size<=this.#e)return 0;{const e=this.#h.run(Date.now()).changes;if(e)return e}{const e=this.#u?.run(Math.max(Math.floor(.1*this.#e),1)).changes;if(e)return e}return 0}get size(){const{total:e}=this.#d.get();return e}#I(e){return`${e.origin}/${e.path}`}#E(e,t=!1){const s=this.#I(e),{headers:r,method:n}=e,A=this.#a.all(s,n);if(0===A.length)return;const i=Date.now();for(const e of A){if(i>=e.deleteAt&&!t)return;let s=!0;if(e.vary){const t=JSON.parse(e.vary);for(const e in t)if(!a(r[e],t[e])){s=!1;break}}if(s)return e}}}},1986:(e,t,s)=>{"use strict";const r=s(7030),n=s(4589),A=s(2858),{InvalidArgumentError:i}=s(4465);let o;const a=class{constructor(e){this._maxCachedSessions=e,this._sessionCache=new Map,this._sessionRegistry=new FinalizationRegistry((e=>{if(this._sessionCache.size<this._maxCachedSessions)return;const t=this._sessionCache.get(e);void 0!==t&&void 0===t.deref()&&this._sessionCache.delete(e)}))}get(e){const t=this._sessionCache.get(e);return t?t.deref():null}set(e,t){0!==this._maxCachedSessions&&(this._sessionCache.set(e,new WeakRef(t)),this._sessionRegistry.register(t,e))}};e.exports=function({allowH2:e,maxCachedSessions:t,socketPath:c,timeout:l,session:h,...g}){if(null!=t&&(!Number.isInteger(t)||t<0))throw new i("maxCachedSessions must be a positive integer or zero");const d={path:c,...g},u=new a(null==t?100:t);return l=null==l?1e4:l,e=null!=e&&e,function({hostname:t,host:i,protocol:a,port:c,servername:g,localAddress:E,httpSocket:I},C){let B;if("https:"===a){o||(o=s(1692));const r=(g=g||d.servername||A.getServerName(i)||null)||t;n(r);const a=h||u.get(r)||null;c=c||443,B=o.connect({highWaterMark:16384,...d,servername:g,session:a,localAddress:E,ALPNProtocols:e?["http/1.1","h2"]:["http/1.1"],socket:I,port:c,host:t}),B.on("session",(function(e){u.set(r,e)}))}else n(!I,"httpSocket can only be sent on TLS update"),c=c||80,B=r.connect({highWaterMark:65536,...d,localAddress:E,port:c,host:t});if(null==d.keepAlive||d.keepAlive){const e=void 0===d.keepAliveInitialDelay?6e4:d.keepAliveInitialDelay;B.setKeepAlive(!0,e)}const Q=A.setupConnectTimeout(new WeakRef(B),{timeout:l,hostname:t,port:c});return B.setNoDelay(!0).once("https:"===a?"secureConnect":"connect",(function(){if(queueMicrotask(Q),C){const e=C;C=null,e(null,this)}})).on("error",(function(e){if(queueMicrotask(Q),C){const t=C;C=null,t(e)}})),B}}},9605:e=>{"use strict";const t=["Accept","Accept-Encoding","Accept-Language","Accept-Ranges","Access-Control-Allow-Credentials","Access-Control-Allow-Headers","Access-Control-Allow-Methods","Access-Control-Allow-Origin","Access-Control-Expose-Headers","Access-Control-Max-Age","Access-Control-Request-Headers","Access-Control-Request-Method","Age","Allow","Alt-Svc","Alt-Used","Authorization","Cache-Control","Clear-Site-Data","Connection","Content-Disposition","Content-Encoding","Content-Language","Content-Length","Content-Location","Content-Range","Content-Security-Policy","Content-Security-Policy-Report-Only","Content-Type","Cookie","Cross-Origin-Embedder-Policy","Cross-Origin-Opener-Policy","Cross-Origin-Resource-Policy","Date","Device-Memory","Downlink","ECT","ETag","Expect","Expect-CT","Expires","Forwarded","From","Host","If-Match","If-Modified-Since","If-None-Match","If-Range","If-Unmodified-Since","Keep-Alive","Last-Modified","Link","Location","Max-Forwards","Origin","Permissions-Policy","Pragma","Proxy-Authenticate","Proxy-Authorization","RTT","Range","Referer","Referrer-Policy","Refresh","Retry-After","Sec-WebSocket-Accept","Sec-WebSocket-Extensions","Sec-WebSocket-Key","Sec-WebSocket-Protocol","Sec-WebSocket-Version","Server","Server-Timing","Service-Worker-Allowed","Service-Worker-Navigation-Preload","Set-Cookie","SourceMap","Strict-Transport-Security","Supports-Loading-Mode","TE","Timing-Allow-Origin","Trailer","Transfer-Encoding","Upgrade","Upgrade-Insecure-Requests","User-Agent","Vary","Via","WWW-Authenticate","X-Content-Type-Options","X-DNS-Prefetch-Control","X-Frame-Options","X-Permitted-Cross-Domain-Policies","X-Powered-By","X-Requested-With","X-XSS-Protection"],s={};Object.setPrototypeOf(s,null);const r={};Object.setPrototypeOf(r,null);for(let e=0;e<t.length;++e){const r=t[e],n=r.toLowerCase();s[r]=s[n]=n}e.exports={wellknownHeaderNames:t,headerNameLowerCasedRecord:s,getHeaderNameAsBuffer:function(e){let t=r[e];return void 0===t&&(t=Buffer.from(e)),t}}},772:(e,t,s)=>{"use strict";const r=s(3053),n=s(7975),A=n.debuglog("undici"),i=n.debuglog("fetch"),o=n.debuglog("websocket"),a={beforeConnect:r.channel("undici:client:beforeConnect"),connected:r.channel("undici:client:connected"),connectError:r.channel("undici:client:connectError"),sendHeaders:r.channel("undici:client:sendHeaders"),create:r.channel("undici:request:create"),bodySent:r.channel("undici:request:bodySent"),bodyChunkSent:r.channel("undici:request:bodyChunkSent"),bodyChunkReceived:r.channel("undici:request:bodyChunkReceived"),headers:r.channel("undici:request:headers"),trailers:r.channel("undici:request:trailers"),error:r.channel("undici:request:error"),open:r.channel("undici:websocket:open"),close:r.channel("undici:websocket:close"),socketError:r.channel("undici:websocket:socket_error"),ping:r.channel("undici:websocket:ping"),pong:r.channel("undici:websocket:pong")};let c=!1;function l(e=A){c||(c=!0,r.subscribe("undici:client:beforeConnect",(t=>{const{connectParams:{version:s,protocol:r,port:n,host:A}}=t;e("connecting to %s%s using %s%s",A,n?`:${n}`:"",r,s)})),r.subscribe("undici:client:connected",(t=>{const{connectParams:{version:s,protocol:r,port:n,host:A}}=t;e("connected to %s%s using %s%s",A,n?`:${n}`:"",r,s)})),r.subscribe("undici:client:connectError",(t=>{const{connectParams:{version:s,protocol:r,port:n,host:A},error:i}=t;e("connection to %s%s using %s%s errored - %s",A,n?`:${n}`:"",r,s,i.message)})),r.subscribe("undici:client:sendHeaders",(t=>{const{request:{method:s,path:r,origin:n}}=t;e("sending request to %s %s%s",s,n,r)})))}let h=!1;let g=!1;(A.enabled||i.enabled)&&(l(i.enabled?i:A),function(e=A){h||(h=!0,r.subscribe("undici:request:headers",(t=>{const{request:{method:s,path:r,origin:n},response:{statusCode:A}}=t;e("received response to %s %s%s - HTTP %d",s,n,r,A)})),r.subscribe("undici:request:trailers",(t=>{const{request:{method:s,path:r,origin:n}}=t;e("trailers received from %s %s%s",s,n,r)})),r.subscribe("undici:request:error",(t=>{const{request:{method:s,path:r,origin:n},error:A}=t;e("request to %s %s%s errored - %s",s,n,r,A.message)})))}(i.enabled?i:A)),o.enabled&&(l(A.enabled?A:o),function(e=o){g||(g=!0,r.subscribe("undici:websocket:open",(t=>{const{address:{address:s,port:r}}=t;e("connection opened %s%s",s,r?`:${r}`:"")})),r.subscribe("undici:websocket:close",(t=>{const{websocket:s,code:r,reason:n}=t;e("closed connection to %s - %s %s",s.url,r,n)})),r.subscribe("undici:websocket:socket_error",(t=>{e("connection errored - %s",t.message)})),r.subscribe("undici:websocket:ping",(t=>{e("ping received")})),r.subscribe("undici:websocket:pong",(t=>{e("pong received")})))}(o)),e.exports={channels:a}},4465:e=>{"use strict";const t=Symbol.for("undici.error.UND_ERR");class s extends Error{constructor(e,t){super(e,t),this.name="UndiciError",this.code="UND_ERR"}static[Symbol.hasInstance](e){return e&&!0===e[t]}get[t](){return!0}}const r=Symbol.for("undici.error.UND_ERR_CONNECT_TIMEOUT");class n extends s{constructor(e){super(e),this.name="ConnectTimeoutError",this.message=e||"Connect Timeout Error",this.code="UND_ERR_CONNECT_TIMEOUT"}static[Symbol.hasInstance](e){return e&&!0===e[r]}get[r](){return!0}}const A=Symbol.for("undici.error.UND_ERR_HEADERS_TIMEOUT");class i extends s{constructor(e){super(e),this.name="HeadersTimeoutError",this.message=e||"Headers Timeout Error",this.code="UND_ERR_HEADERS_TIMEOUT"}static[Symbol.hasInstance](e){return e&&!0===e[A]}get[A](){return!0}}const o=Symbol.for("undici.error.UND_ERR_HEADERS_OVERFLOW");class a extends s{constructor(e){super(e),this.name="HeadersOverflowError",this.message=e||"Headers Overflow Error",this.code="UND_ERR_HEADERS_OVERFLOW"}static[Symbol.hasInstance](e){return e&&!0===e[o]}get[o](){return!0}}const c=Symbol.for("undici.error.UND_ERR_BODY_TIMEOUT");class l extends s{constructor(e){super(e),this.name="BodyTimeoutError",this.message=e||"Body Timeout Error",this.code="UND_ERR_BODY_TIMEOUT"}static[Symbol.hasInstance](e){return e&&!0===e[c]}get[c](){return!0}}const h=Symbol.for("undici.error.UND_ERR_INVALID_ARG");class g extends s{constructor(e){super(e),this.name="InvalidArgumentError",this.message=e||"Invalid Argument Error",this.code="UND_ERR_INVALID_ARG"}static[Symbol.hasInstance](e){return e&&!0===e[h]}get[h](){return!0}}const d=Symbol.for("undici.error.UND_ERR_INVALID_RETURN_VALUE");class u extends s{constructor(e){super(e),this.name="InvalidReturnValueError",this.message=e||"Invalid Return Value Error",this.code="UND_ERR_INVALID_RETURN_VALUE"}static[Symbol.hasInstance](e){return e&&!0===e[d]}get[d](){return!0}}const E=Symbol.for("undici.error.UND_ERR_ABORT");class I extends s{constructor(e){super(e),this.name="AbortError",this.message=e||"The operation was aborted",this.code="UND_ERR_ABORT"}static[Symbol.hasInstance](e){return e&&!0===e[E]}get[E](){return!0}}const C=Symbol.for("undici.error.UND_ERR_ABORTED");class B extends I{constructor(e){super(e),this.name="AbortError",this.message=e||"Request aborted",this.code="UND_ERR_ABORTED"}static[Symbol.hasInstance](e){return e&&!0===e[C]}get[C](){return!0}}const Q=Symbol.for("undici.error.UND_ERR_INFO");class p extends s{constructor(e){super(e),this.name="InformationalError",this.message=e||"Request information",this.code="UND_ERR_INFO"}static[Symbol.hasInstance](e){return e&&!0===e[Q]}get[Q](){return!0}}const f=Symbol.for("undici.error.UND_ERR_REQ_CONTENT_LENGTH_MISMATCH");class m extends s{constructor(e){super(e),this.name="RequestContentLengthMismatchError",this.message=e||"Request body length does not match content-length header",this.code="UND_ERR_REQ_CONTENT_LENGTH_MISMATCH"}static[Symbol.hasInstance](e){return e&&!0===e[f]}get[f](){return!0}}const y=Symbol.for("undici.error.UND_ERR_RES_CONTENT_LENGTH_MISMATCH");class w extends s{constructor(e){super(e),this.name="ResponseContentLengthMismatchError",this.message=e||"Response body length does not match content-length header",this.code="UND_ERR_RES_CONTENT_LENGTH_MISMATCH"}static[Symbol.hasInstance](e){return e&&!0===e[y]}get[y](){return!0}}const S=Symbol.for("undici.error.UND_ERR_DESTROYED");class D extends s{constructor(e){super(e),this.name="ClientDestroyedError",this.message=e||"The client is destroyed",this.code="UND_ERR_DESTROYED"}static[Symbol.hasInstance](e){return e&&!0===e[S]}get[S](){return!0}}const b=Symbol.for("undici.error.UND_ERR_CLOSED");class v extends s{constructor(e){super(e),this.name="ClientClosedError",this.message=e||"The client is closed",this.code="UND_ERR_CLOSED"}static[Symbol.hasInstance](e){return e&&!0===e[b]}get[b](){return!0}}const R=Symbol.for("undici.error.UND_ERR_SOCKET");class N extends s{constructor(e,t){super(e),this.name="SocketError",this.message=e||"Socket error",this.code="UND_ERR_SOCKET",this.socket=t}static[Symbol.hasInstance](e){return e&&!0===e[R]}get[R](){return!0}}const k=Symbol.for("undici.error.UND_ERR_NOT_SUPPORTED");class T extends s{constructor(e){super(e),this.name="NotSupportedError",this.message=e||"Not supported error",this.code="UND_ERR_NOT_SUPPORTED"}static[Symbol.hasInstance](e){return e&&!0===e[k]}get[k](){return!0}}const F=Symbol.for("undici.error.UND_ERR_BPL_MISSING_UPSTREAM");class M extends s{constructor(e){super(e),this.name="MissingUpstreamError",this.message=e||"No upstream has been added to the BalancedPool",this.code="UND_ERR_BPL_MISSING_UPSTREAM"}static[Symbol.hasInstance](e){return e&&!0===e[F]}get[F](){return!0}}const U=Symbol.for("undici.error.UND_ERR_HTTP_PARSER");class L extends Error{constructor(e,t,s){super(e),this.name="HTTPParserError",this.code=t?`HPE_${t}`:void 0,this.data=s?s.toString():void 0}static[Symbol.hasInstance](e){return e&&!0===e[U]}get[U](){return!0}}const H=Symbol.for("undici.error.UND_ERR_RES_EXCEEDED_MAX_SIZE");class P extends s{constructor(e){super(e),this.name="ResponseExceededMaxSizeError",this.message=e||"Response content exceeded max size",this.code="UND_ERR_RES_EXCEEDED_MAX_SIZE"}static[Symbol.hasInstance](e){return e&&!0===e[H]}get[H](){return!0}}const x=Symbol.for("undici.error.UND_ERR_REQ_RETRY");class Y extends s{constructor(e,t,{headers:s,data:r}){super(e),this.name="RequestRetryError",this.message=e||"Request retry error",this.code="UND_ERR_REQ_RETRY",this.statusCode=t,this.data=r,this.headers=s}static[Symbol.hasInstance](e){return e&&!0===e[x]}get[x](){return!0}}const V=Symbol.for("undici.error.UND_ERR_RESPONSE");class O extends s{constructor(e,t,{headers:s,body:r}){super(e),this.name="ResponseError",this.message=e||"Response error",this.code="UND_ERR_RESPONSE",this.statusCode=t,this.body=r,this.headers=s}static[Symbol.hasInstance](e){return e&&!0===e[V]}get[V](){return!0}}const G=Symbol.for("undici.error.UND_ERR_PRX_TLS");class J extends s{constructor(e,t,s={}){super(t,{cause:e,...s}),this.name="SecureProxyConnectionError",this.message=t||"Secure Proxy Connection failed",this.code="UND_ERR_PRX_TLS",this.cause=e}static[Symbol.hasInstance](e){return e&&!0===e[G]}get[G](){return!0}}const W=Symbol.for("undici.error.UND_ERR_MAX_ORIGINS_REACHED");class _ extends s{constructor(e){super(e),this.name="MaxOriginsReachedError",this.message=e||"Maximum allowed origins reached",this.code="UND_ERR_MAX_ORIGINS_REACHED"}static[Symbol.hasInstance](e){return e&&!0===e[W]}get[W](){return!0}}e.exports={AbortError:I,HTTPParserError:L,UndiciError:s,HeadersTimeoutError:i,HeadersOverflowError:a,BodyTimeoutError:l,RequestContentLengthMismatchError:m,ConnectTimeoutError:n,InvalidArgumentError:g,InvalidReturnValueError:u,RequestAbortedError:B,ClientDestroyedError:D,ClientClosedError:v,InformationalError:p,SocketError:N,NotSupportedError:T,ResponseContentLengthMismatchError:w,BalancedPoolMissingUpstreamError:M,ResponseExceededMaxSizeError:P,RequestRetryError:Y,ResponseError:O,SecureProxyConnectionError:J,MaxOriginsReachedError:_}},5837:(e,t,s)=>{"use strict";const{InvalidArgumentError:r,NotSupportedError:n}=s(4465),A=s(4589),{isValidHTTPToken:i,isValidHeaderValue:o,isStream:a,destroy:c,isBuffer:l,isFormDataLike:h,isIterable:g,isBlobLike:d,serializePathWithQuery:u,assertRequestHandler:E,getServerName:I,normalizedMethodRecords:C,getProtocolFromUrlString:B}=s(2858),{channels:Q}=s(772),{headerNameLowerCasedRecord:p}=s(9605),f=/[^\u0021-\u00ff]/,m=Symbol("handler");function y(e,t,s){if(s&&"object"==typeof s&&!Array.isArray(s))throw new r(`invalid ${t} header`);if(void 0===s)return;let A=p[t];if(void 0===A&&(A=t.toLowerCase(),void 0===p[A]&&!i(A)))throw new r("invalid header key");if(Array.isArray(s)){const e=[];for(let n=0;n<s.length;n++)if("string"==typeof s[n]){if(!o(s[n]))throw new r(`invalid ${t} header`);e.push(s[n])}else if(null===s[n])e.push("");else{if("object"==typeof s[n])throw new r(`invalid ${t} header`);e.push(`${s[n]}`)}s=e}else if("string"==typeof s){if(!o(s))throw new r(`invalid ${t} header`)}else s=null===s?"":`${s}`;if(null===e.host&&"host"===A){if("string"!=typeof s)throw new r("invalid host header");e.host=s}else if(null===e.contentLength&&"content-length"===A){if(e.contentLength=parseInt(s,10),!Number.isFinite(e.contentLength))throw new r("invalid content-length header")}else if(null===e.contentType&&"content-type"===A)e.contentType=s,e.headers.push(t,s);else{if("transfer-encoding"===A||"keep-alive"===A||"upgrade"===A)throw new r(`invalid ${A} header`);if("connection"===A){const t="string"==typeof s?s.toLowerCase():null;if("close"!==t&&"keep-alive"!==t)throw new r("invalid connection header");"close"===t&&(e.reset=!0)}else{if("expect"===A)throw new n("expect header not supported");e.headers.push(t,s)}}}e.exports=class{constructor(e,{path:t,method:s,body:n,headers:A,query:o,idempotent:p,blocking:w,upgrade:S,headersTimeout:D,bodyTimeout:b,reset:v,expectContinue:R,servername:N,throwOnError:k,maxRedirections:T},F){if("string"!=typeof t)throw new r("path must be a string");if("/"!==t[0]&&!t.startsWith("http://")&&!t.startsWith("https://")&&"CONNECT"!==s)throw new r("path must be an absolute URL or start with a slash");if(f.test(t))throw new r("invalid request path");if("string"!=typeof s)throw new r("method must be a string");if(void 0===C[s]&&!i(s))throw new r("invalid request method");if(S&&"string"!=typeof S)throw new r("upgrade must be a string");if(null!=D&&(!Number.isFinite(D)||D<0))throw new r("invalid headersTimeout");if(null!=b&&(!Number.isFinite(b)||b<0))throw new r("invalid bodyTimeout");if(null!=v&&"boolean"!=typeof v)throw new r("invalid reset");if(null!=R&&"boolean"!=typeof R)throw new r("invalid expectContinue");if(null!=k)throw new r("invalid throwOnError");if(null!=T&&0!==T)throw new r("maxRedirections is not supported, use the redirect interceptor");if(this.headersTimeout=D,this.bodyTimeout=b,this.method=s,this.abort=null,null==n)this.body=null;else if(a(n)){this.body=n;const e=this.body._readableState;e&&e.autoDestroy||(this.endHandler=function(){c(this)},this.body.on("end",this.endHandler)),this.errorHandler=e=>{this.abort?this.abort(e):this.error=e},this.body.on("error",this.errorHandler)}else if(l(n))this.body=n.byteLength?n:null;else if(ArrayBuffer.isView(n))this.body=n.buffer.byteLength?Buffer.from(n.buffer,n.byteOffset,n.byteLength):null;else if(n instanceof ArrayBuffer)this.body=n.byteLength?Buffer.from(n):null;else if("string"==typeof n)this.body=n.length?Buffer.from(n):null;else{if(!(h(n)||g(n)||d(n)))throw new r("body must be a string, a Buffer, a Readable stream, an iterable, or an async iterable");this.body=n}if(this.completed=!1,this.aborted=!1,this.upgrade=S||null,this.path=o?u(t,o):t,this.origin=e,this.protocol=B(e),this.idempotent=null==p?"HEAD"===s||"GET"===s:p,this.blocking=w??"HEAD"!==this.method,this.reset=null==v?null:v,this.host=null,this.contentLength=null,this.contentType=null,this.headers=[],this.expectContinue=null!=R&&R,Array.isArray(A)){if(A.length%2!=0)throw new r("headers array must be even");for(let e=0;e<A.length;e+=2)y(this,A[e],A[e+1])}else if(A&&"object"==typeof A)if(A[Symbol.iterator])for(const e of A){if(!Array.isArray(e)||2!==e.length)throw new r("headers must be in key-value pair format");y(this,e[0],e[1])}else{const e=Object.keys(A);for(let t=0;t<e.length;++t)y(this,e[t],A[e[t]])}else if(null!=A)throw new r("headers must be an object or an array");E(F,s,S),this.servername=N||I(this.host)||null,this[m]=F,Q.create.hasSubscribers&&Q.create.publish({request:this})}onBodySent(e){if(Q.bodyChunkSent.hasSubscribers&&Q.bodyChunkSent.publish({request:this,chunk:e}),this[m].onBodySent)try{return this[m].onBodySent(e)}catch(e){this.abort(e)}}onRequestSent(){if(Q.bodySent.hasSubscribers&&Q.bodySent.publish({request:this}),this[m].onRequestSent)try{return this[m].onRequestSent()}catch(e){this.abort(e)}}onConnect(e){if(A(!this.aborted),A(!this.completed),!this.error)return this.abort=e,this[m].onConnect(e);e(this.error)}onResponseStarted(){return this[m].onResponseStarted?.()}onHeaders(e,t,s,r){A(!this.aborted),A(!this.completed),Q.headers.hasSubscribers&&Q.headers.publish({request:this,response:{statusCode:e,headers:t,statusText:r}});try{return this[m].onHeaders(e,t,s,r)}catch(e){this.abort(e)}}onData(e){A(!this.aborted),A(!this.completed),Q.bodyChunkReceived.hasSubscribers&&Q.bodyChunkReceived.publish({request:this,chunk:e});try{return this[m].onData(e)}catch(e){return this.abort(e),!1}}onUpgrade(e,t,s){return A(!this.aborted),A(!this.completed),this[m].onUpgrade(e,t,s)}onComplete(e){this.onFinally(),A(!this.aborted),A(!this.completed),this.completed=!0,Q.trailers.hasSubscribers&&Q.trailers.publish({request:this,trailers:e});try{return this[m].onComplete(e)}catch(e){this.onError(e)}}onError(e){if(this.onFinally(),Q.error.hasSubscribers&&Q.error.publish({request:this,error:e}),!this.aborted)return this.aborted=!0,this[m].onError(e)}onFinally(){this.errorHandler&&(this.body.off("error",this.errorHandler),this.errorHandler=null),this.endHandler&&(this.body.off("end",this.endHandler),this.endHandler=null)}addHeader(e,t){return y(this,e,t),this}}},257:e=>{"use strict";e.exports={kClose:Symbol("close"),kDestroy:Symbol("destroy"),kDispatch:Symbol("dispatch"),kUrl:Symbol("url"),kWriting:Symbol("writing"),kResuming:Symbol("resuming"),kQueue:Symbol("queue"),kConnect:Symbol("connect"),kConnecting:Symbol("connecting"),kKeepAliveDefaultTimeout:Symbol("default keep alive timeout"),kKeepAliveMaxTimeout:Symbol("max keep alive timeout"),kKeepAliveTimeoutThreshold:Symbol("keep alive timeout threshold"),kKeepAliveTimeoutValue:Symbol("keep alive timeout"),kKeepAlive:Symbol("keep alive"),kHeadersTimeout:Symbol("headers timeout"),kBodyTimeout:Symbol("body timeout"),kServerName:Symbol("server name"),kLocalAddress:Symbol("local address"),kHost:Symbol("host"),kNoRef:Symbol("no ref"),kBodyUsed:Symbol("used"),kBody:Symbol("abstracted request body"),kRunning:Symbol("running"),kBlocking:Symbol("blocking"),kPending:Symbol("pending"),kSize:Symbol("size"),kBusy:Symbol("busy"),kQueued:Symbol("queued"),kFree:Symbol("free"),kConnected:Symbol("connected"),kClosed:Symbol("closed"),kNeedDrain:Symbol("need drain"),kReset:Symbol("reset"),kDestroyed:Symbol.for("nodejs.stream.destroyed"),kResume:Symbol("resume"),kOnError:Symbol("on error"),kMaxHeadersSize:Symbol("max headers size"),kRunningIdx:Symbol("running index"),kPendingIdx:Symbol("pending index"),kError:Symbol("error"),kClients:Symbol("clients"),kClient:Symbol("client"),kParser:Symbol("parser"),kOnDestroyed:Symbol("destroy callbacks"),kPipelining:Symbol("pipelining"),kSocket:Symbol("socket"),kHostHeader:Symbol("host header"),kConnector:Symbol("connector"),kStrictContentLength:Symbol("strict content length"),kMaxRedirections:Symbol("maxRedirections"),kMaxRequests:Symbol("maxRequestsPerClient"),kProxy:Symbol("proxy agent options"),kCounter:Symbol("socket request counter"),kMaxResponseSize:Symbol("max response size"),kHTTP2Session:Symbol("http2Session"),kHTTP2SessionState:Symbol("http2Session state"),kRetryHandlerDefaultRetry:Symbol("retry agent default retry"),kConstruct:Symbol("constructable"),kListeners:Symbol("listeners"),kHTTPContext:Symbol("http context"),kMaxConcurrentStreams:Symbol("max concurrent streams"),kNoProxyAgent:Symbol("no proxy agent"),kHttpProxyAgent:Symbol("http proxy agent"),kHttpsProxyAgent:Symbol("https proxy agent")}},1310:(e,t,s)=>{"use strict";const{wellknownHeaderNames:r,headerNameLowerCasedRecord:n}=s(9605);class A{value=null;left=null;middle=null;right=null;code;constructor(e,t,s){if(void 0===s||s>=e.length)throw new TypeError("Unreachable");if((this.code=e.charCodeAt(s))>127)throw new TypeError("key must be ascii string");e.length!==++s?this.middle=new A(e,t,s):this.value=t}add(e,t){const s=e.length;if(0===s)throw new TypeError("Unreachable");let r=0,n=this;for(;;){const i=e.charCodeAt(r);if(i>127)throw new TypeError("key must be ascii string");if(n.code===i){if(s===++r){n.value=t;break}if(null===n.middle){n.middle=new A(e,t,r);break}n=n.middle}else if(n.code<i){if(null===n.left){n.left=new A(e,t,r);break}n=n.left}else{if(null===n.right){n.right=new A(e,t,r);break}n=n.right}}}search(e){const t=e.length;let s=0,r=this;for(;null!==r&&s<t;){let n=e[s];for(n<=90&&n>=65&&(n|=32);null!==r;){if(n===r.code){if(t===++s)return r;r=r.middle;break}r=r.code<n?r.left:r.right}}return null}}class i{node=null;insert(e,t){null===this.node?this.node=new A(e,t,0):this.node.add(e,t)}lookup(e){return this.node?.search(e)?.value??null}}const o=new i;for(let e=0;e<r.length;++e){const t=n[r[e]];o.insert(t,t)}e.exports={TernarySearchTree:i,tree:o}},2858:(e,t,s)=>{"use strict";const r=s(4589),{kDestroyed:n,kBodyUsed:A,kListeners:i,kBody:o}=s(257),{IncomingMessage:a}=s(7067),c=s(7075),l=s(7030),{stringify:h}=s(1792),{EventEmitter:g}=s(8474),d=s(3801),{InvalidArgumentError:u,ConnectTimeoutError:E}=s(4465),{headerNameLowerCasedRecord:I}=s(9605),{tree:C}=s(1310),[B,Q]=process.versions.node.split(".",2).map((e=>Number(e)));class p{constructor(e){this[o]=e,this[A]=!1}async*[Symbol.asyncIterator](){r(!this[A],"disturbed"),this[A]=!0,yield*this[o]}}function f(){}function m(e){return e&&"object"==typeof e&&"function"==typeof e.pipe&&"function"==typeof e.on}function y(e){if(null===e)return!1;if(e instanceof Blob)return!0;if("object"!=typeof e)return!1;{const t=e[Symbol.toStringTag];return("Blob"===t||"File"===t)&&("stream"in e&&"function"==typeof e.stream||"arrayBuffer"in e&&"function"==typeof e.arrayBuffer)}}function w(e){return e.includes("?")||e.includes("#")}function S(e){const t=parseInt(e,10);return t===Number(e)&&t>=0&&t<=65535}function D(e){return null!=e&&"h"===e[0]&&"t"===e[1]&&"t"===e[2]&&"p"===e[3]&&(":"===e[4]||"s"===e[4]&&":"===e[5])}function b(e){if("string"==typeof e){if(!D((e=new URL(e)).origin||e.protocol))throw new u("Invalid URL protocol: the URL must start with `http:` or `https:`.");return e}if(!e||"object"!=typeof e)throw new u("Invalid URL: The URL argument must be a non-null object.");if(!(e instanceof URL)){if(null!=e.port&&""!==e.port&&!1===S(e.port))throw new u("Invalid URL: port must be a valid integer or a string representation of an integer.");if(null!=e.path&&"string"!=typeof e.path)throw new u("Invalid URL path: the path must be a string or null/undefined.");if(null!=e.pathname&&"string"!=typeof e.pathname)throw new u("Invalid URL pathname: the pathname must be a string or null/undefined.");if(null!=e.hostname&&"string"!=typeof e.hostname)throw new u("Invalid URL hostname: the hostname must be a string or null/undefined.");if(null!=e.origin&&"string"!=typeof e.origin)throw new u("Invalid URL origin: the origin must be a string or null/undefined.");if(!D(e.origin||e.protocol))throw new u("Invalid URL protocol: the URL must start with `http:` or `https:`.");const t=null!=e.port?e.port:"https:"===e.protocol?443:80;let s=null!=e.origin?e.origin:`${e.protocol||""}//${e.hostname||""}:${t}`,r=null!=e.path?e.path:`${e.pathname||""}${e.search||""}`;return"/"===s[s.length-1]&&(s=s.slice(0,s.length-1)),r&&"/"!==r[0]&&(r=`/${r}`),new URL(`${s}${r}`)}if(!D(e.origin||e.protocol))throw new u("Invalid URL protocol: the URL must start with `http:` or `https:`.");return e}function v(e){return!(null==e||"function"!=typeof e[Symbol.iterator]&&"function"!=typeof e[Symbol.asyncIterator])}function R(e){if(null==e)return 0;if(m(e)){const t=e._readableState;return t&&!1===t.objectMode&&!0===t.ended&&Number.isFinite(t.length)?t.length:null}return y(e)?null!=e.size?e.size:null:M(e)?e.byteLength:null}function N(e){return e&&!!(e.destroyed||e[n]||c.isDestroyed?.(e))}function k(e,t){null!=e&&m(e)&&!N(e)&&("function"==typeof e.destroy?(Object.getPrototypeOf(e).constructor===a&&(e.socket=null),e.destroy(t)):t&&queueMicrotask((()=>{e.emit("error",t)})),!0!==e.destroyed&&(e[n]=!0))}const T=/timeout=(\d+)/;function F(e){return"string"==typeof e?I[e]??e.toLowerCase():C.lookup(e)??e.toString("latin1").toLowerCase()}function M(e){return e instanceof Uint8Array||Buffer.isBuffer(e)}function U(e){switch(e){case 34:case 40:case 41:case 44:case 47:case 58:case 59:case 60:case 61:case 62:case 63:case 64:case 91:case 92:case 93:case 123:case 125:return!1;default:return e>=33&&e<=126}}const L=/[^\t\x20-\x7e\x80-\xff]/;const H=/^bytes (\d+)-(\d+)\/(\d+)?$/;const P="win32"===process.platform?(e,t)=>{if(!t.timeout)return f;let s=null,r=null;const n=d.setFastTimeout((()=>{s=setImmediate((()=>{r=setImmediate((()=>x(e.deref(),t)))}))}),t.timeout);return()=>{d.clearFastTimeout(n),clearImmediate(s),clearImmediate(r)}}:(e,t)=>{if(!t.timeout)return f;let s=null;const r=d.setFastTimeout((()=>{s=setImmediate((()=>{x(e.deref(),t)}))}),t.timeout);return()=>{d.clearFastTimeout(r),clearImmediate(s)}};function x(e,t){if(null==e)return;let s="Connect Timeout Error";Array.isArray(e.autoSelectFamilyAttemptedAddresses)?s+=` (attempted addresses: ${e.autoSelectFamilyAttemptedAddresses.join(", ")},`:s+=` (attempted address: ${t.hostname}:${t.port},`,s+=` timeout: ${t.timeout}ms)`,k(e,new E(s))}const Y=Object.create(null);Y.enumerable=!0;const V={delete:"DELETE",DELETE:"DELETE",get:"GET",GET:"GET",head:"HEAD",HEAD:"HEAD",options:"OPTIONS",OPTIONS:"OPTIONS",post:"POST",POST:"POST",put:"PUT",PUT:"PUT"},O={...V,patch:"patch",PATCH:"PATCH"};Object.setPrototypeOf(V,null),Object.setPrototypeOf(O,null),e.exports={kEnumerableProperty:Y,isDisturbed:function(e){return!(!e||!c.isDisturbed(e)&&!e[A])},isBlobLike:y,parseOrigin:function(e){if("/"!==(e=b(e)).pathname||e.search||e.hash)throw new u("invalid url");return e},parseURL:b,getServerName:function(e){if(!e)return null;r("string"==typeof e);const t=function(e){if("["===e[0]){const t=e.indexOf("]");return r(-1!==t),e.substring(1,t)}const t=e.indexOf(":");return-1===t?e:e.substring(0,t)}(e);return l.isIP(t)?"":t},isStream:m,isIterable:v,isAsyncIterable:function(e){return!(null==e||"function"!=typeof e[Symbol.asyncIterator])},isDestroyed:N,headerNameToString:F,bufferToLowerCasedHeaderName:function(e){return C.lookup(e)??e.toString("latin1").toLowerCase()},addListener:function(e,t,s){return(e[i]??=[]).push([t,s]),e.on(t,s),e},removeAllListeners:function(e){if(null!=e[i]){for(const[t,s]of e[i])e.removeListener(t,s);e[i]=null}return e},errorRequest:function(e,t,s){try{t.onError(s),r(t.aborted)}catch(s){e.emit("error",s)}},parseRawHeaders:function(e){const t=e.length,s=new Array(t);let r,n,A=!1,i=-1,o=0;for(let a=0;a<t;a+=2)r=e[a],n=e[a+1],"string"!=typeof r&&(r=r.toString()),"string"!=typeof n&&(n=n.toString("utf8")),o=r.length,14!==o||"-"!==r[7]||"content-length"!==r&&"content-length"!==r.toLowerCase()?19!==o||"-"!==r[7]||"content-disposition"!==r&&"content-disposition"!==r.toLowerCase()||(i=a+1):A=!0,s[a]=r,s[a+1]=n;return A&&-1!==i&&(s[i]=Buffer.from(s[i]).toString("latin1")),s},encodeRawHeaders:function(e){if(!Array.isArray(e))throw new TypeError("expected headers to be an array");return e.map((e=>Buffer.from(e)))},parseHeaders:function(e,t){void 0===t&&(t={});for(let s=0;s<e.length;s+=2){const r=F(e[s]);let n=t[r];if(n)"string"==typeof n&&(n=[n],t[r]=n),n.push(e[s+1].toString("utf8"));else{const n=e[s+1];t[r]="string"==typeof n?n:Array.isArray(n)?n.map((e=>e.toString("utf8"))):n.toString("utf8")}}return"content-length"in t&&"content-disposition"in t&&(t["content-disposition"]=Buffer.from(t["content-disposition"]).toString("latin1")),t},parseKeepAliveTimeout:function(e){const t=e.match(T);return t?1e3*parseInt(t[1],10):null},destroy:k,bodyLength:R,deepClone:function(e){return JSON.parse(JSON.stringify(e))},ReadableStreamFrom:function(e){let t;return new ReadableStream({start(){t=e[Symbol.asyncIterator]()},pull(e){return t.next().then((({done:t,value:s})=>{if(t)queueMicrotask((()=>{e.close(),e.byobRequest?.respond(0)}));else{const t=Buffer.isBuffer(s)?s:Buffer.from(s);if(!t.byteLength)return this.pull(e);e.enqueue(new Uint8Array(t))}}))},cancel:()=>t.return(),type:"bytes"})},isBuffer:M,assertRequestHandler:function(e,t,s){if(!e||"object"!=typeof e)throw new u("handler must be an object");if("function"!=typeof e.onRequestStart){if("function"!=typeof e.onConnect)throw new u("invalid onConnect method");if("function"!=typeof e.onError)throw new u("invalid onError method");if("function"!=typeof e.onBodySent&&void 0!==e.onBodySent)throw new u("invalid onBodySent method");if(s||"CONNECT"===t){if("function"!=typeof e.onUpgrade)throw new u("invalid onUpgrade method")}else{if("function"!=typeof e.onHeaders)throw new u("invalid onHeaders method");if("function"!=typeof e.onData)throw new u("invalid onData method");if("function"!=typeof e.onComplete)throw new u("invalid onComplete method")}}},getSocketInfo:function(e){return{localAddress:e.localAddress,localPort:e.localPort,remoteAddress:e.remoteAddress,remotePort:e.remotePort,remoteFamily:e.remoteFamily,timeout:e.timeout,bytesWritten:e.bytesWritten,bytesRead:e.bytesRead}},isFormDataLike:function(e){return e&&"object"==typeof e&&"function"==typeof e.append&&"function"==typeof e.delete&&"function"==typeof e.get&&"function"==typeof e.getAll&&"function"==typeof e.has&&"function"==typeof e.set&&"FormData"===e[Symbol.toStringTag]},pathHasQueryOrFragment:w,serializePathWithQuery:function(e,t){if(w(e))throw new Error('Query params cannot be passed when url already contains "?" or "#".');const s=h(t);return s&&(e+="?"+s),e},addAbortListener:function(e,t){return"addEventListener"in e?(e.addEventListener("abort",t,{once:!0}),()=>e.removeEventListener("abort",t)):(e.once("abort",t),()=>e.removeListener("abort",t))},isValidHTTPToken:function(e){if(0===e.length)return!1;for(let t=0;t<e.length;++t)if(!U(e.charCodeAt(t)))return!1;return!0},isValidHeaderValue:function(e){return!L.test(e)},isTokenCharCode:U,parseRangeHeader:function(e){if(null==e||""===e)return{start:0,end:null,size:null};const t=e?e.match(H):null;return t?{start:parseInt(t[1]),end:t[2]?parseInt(t[2]):null,size:t[3]?parseInt(t[3]):null}:null},normalizedMethodRecordsBase:V,normalizedMethodRecords:O,isValidPort:S,isHttpOrHttpsPrefixed:D,nodeMajor:B,nodeMinor:Q,safeHTTPMethods:Object.freeze(["GET","HEAD","OPTIONS","TRACE"]),wrapRequestBody:function(e){return m(e)?(0===R(e)&&e.on("data",(function(){r(!1)})),"boolean"!=typeof e.readableDidRead&&(e[A]=!1,g.prototype.on.call(e,"data",(function(){this[A]=!0}))),e):e&&"function"==typeof e.pipeTo||e&&"string"!=typeof e&&!ArrayBuffer.isView(e)&&v(e)?new p(e):e},setupConnectTimeout:P,getProtocolFromUrlString:function(e){if("h"===e[0]&&"t"===e[1]&&"t"===e[2]&&"p"===e[3])switch(e[4]){case":":return"http:";case"s":if(":"===e[5])return"https:"}return e.slice(0,e.indexOf(":")+1)}}},3315:(e,t,s)=>{"use strict";const{InvalidArgumentError:r,MaxOriginsReachedError:n}=s(4465),{kClients:A,kRunning:i,kClose:o,kDestroy:a,kDispatch:c,kUrl:l}=s(257),h=s(7779),g=s(8542),d=s(1167),u=s(2858),E=Symbol("onConnect"),I=Symbol("onDisconnect"),C=Symbol("onConnectionError"),B=Symbol("onDrain"),Q=Symbol("factory"),p=Symbol("options"),f=Symbol("origins");function m(e,t){return t&&1===t.connections?new d(e,t):new g(e,t)}e.exports=class extends h{constructor({factory:e=m,maxOrigins:t=1/0,connect:s,...n}={}){if("function"!=typeof e)throw new r("factory must be a function.");if(null!=s&&"function"!=typeof s&&"object"!=typeof s)throw new r("connect must be a function or an object");if("number"!=typeof t||Number.isNaN(t)||t<=0)throw new r("maxOrigins must be a number greater than 0");super(),s&&"function"!=typeof s&&(s={...s}),this[p]={...u.deepClone(n),maxOrigins:t,connect:s},this[Q]=e,this[A]=new Map,this[f]=new Set,this[B]=(e,t)=>{this.emit("drain",e,[this,...t])},this[E]=(e,t)=>{this.emit("connect",e,[this,...t])},this[I]=(e,t,s)=>{this.emit("disconnect",e,[this,...t],s)},this[C]=(e,t,s)=>{this.emit("connectionError",e,[this,...t],s)}}get[i](){let e=0;for(const{dispatcher:t}of this[A].values())e+=t[i];return e}[c](e,t){let s;if(!e.origin||!("string"==typeof e.origin||e.origin instanceof URL))throw new r("opts.origin must be a non-empty string or URL.");if(s=String(e.origin),this[f].size>=this[p].maxOrigins&&!this[f].has(s))throw new n;const i=this[A].get(s);let o=i&&i.dispatcher;if(!o){const t=e=>{const t=this[A].get(s);t&&(e&&(t.count-=1),t.count<=0&&(this[A].delete(s),t.dispatcher.close()),this[f].delete(s))};o=this[Q](e.origin,this[p]).on("drain",this[B]).on("connect",((e,t)=>{const r=this[A].get(s);r&&(r.count+=1),this[E](e,t)})).on("disconnect",((e,s,r)=>{t(!0),this[I](e,s,r)})).on("connectionError",((e,s,r)=>{t(!1),this[C](e,s,r)})),this[A].set(s,{count:0,dispatcher:o}),this[f].add(s)}return o.dispatch(e,t)}[o](){const e=[];for(const{dispatcher:t}of this[A].values())e.push(t.close());return this[A].clear(),Promise.all(e)}[a](e){const t=[];for(const{dispatcher:s}of this[A].values())t.push(s.destroy(e));return this[A].clear(),Promise.all(t)}get stats(){const e={};for(const{dispatcher:t}of this[A].values())t.stats&&(e[t[l].origin]=t.stats);return e}}},8055:(e,t,s)=>{"use strict";const{BalancedPoolMissingUpstreamError:r,InvalidArgumentError:n}=s(4465),{PoolBase:A,kClients:i,kNeedDrain:o,kAddClient:a,kRemoveClient:c,kGetDispatcher:l}=s(1694),h=s(8542),{kUrl:g}=s(257),{parseOrigin:d}=s(2858),u=Symbol("factory"),E=Symbol("options"),I=Symbol("kGreatestCommonDivisor"),C=Symbol("kCurrentWeight"),B=Symbol("kIndex"),Q=Symbol("kWeight"),p=Symbol("kMaxWeightPerServer"),f=Symbol("kErrorPenalty");function m(e,t){if(0===e)return t;for(;0!==t;){const s=t;t=e%t,e=s}return e}function y(e,t){return new h(e,t)}e.exports=class extends A{constructor(e=[],{factory:t=y,...s}={}){if("function"!=typeof t)throw new n("factory must be a function.");super(),this[E]=s,this[B]=-1,this[C]=0,this[p]=this[E].maxWeightPerServer||100,this[f]=this[E].errorPenalty||15,Array.isArray(e)||(e=[e]),this[u]=t;for(const t of e)this.addUpstream(t);this._updateBalancedPoolStats()}addUpstream(e){const t=d(e).origin;if(this[i].find((e=>e[g].origin===t&&!0!==e.closed&&!0!==e.destroyed)))return this;const s=this[u](t,Object.assign({},this[E]));this[a](s),s.on("connect",(()=>{s[Q]=Math.min(this[p],s[Q]+this[f])})),s.on("connectionError",(()=>{s[Q]=Math.max(1,s[Q]-this[f]),this._updateBalancedPoolStats()})),s.on("disconnect",((...e)=>{const t=e[2];t&&"UND_ERR_SOCKET"===t.code&&(s[Q]=Math.max(1,s[Q]-this[f]),this._updateBalancedPoolStats())}));for(const e of this[i])e[Q]=this[p];return this._updateBalancedPoolStats(),this}_updateBalancedPoolStats(){let e=0;for(let t=0;t<this[i].length;t++)e=m(this[i][t][Q],e);this[I]=e}removeUpstream(e){const t=d(e).origin,s=this[i].find((e=>e[g].origin===t&&!0!==e.closed&&!0!==e.destroyed));return s&&this[c](s),this}get upstreams(){return this[i].filter((e=>!0!==e.closed&&!0!==e.destroyed)).map((e=>e[g].origin))}[l](){if(0===this[i].length)throw new r;if(!this[i].find((e=>!e[o]&&!0!==e.closed&&!0!==e.destroyed)))return;if(this[i].map((e=>e[o])).reduce(((e,t)=>e&&t),!0))return;let e=0,t=this[i].findIndex((e=>!e[o]));for(;e++<this[i].length;){this[B]=(this[B]+1)%this[i].length;const e=this[i][this[B]];if(e[Q]>this[i][t][Q]&&!e[o]&&(t=this[B]),0===this[B]&&(this[C]=this[C]-this[I],this[C]<=0&&(this[C]=this[p])),e[Q]>=this[C]&&!e[o])return e}return this[C]=this[i][t][Q],this[B]=t,this[i][t]}}},9355:(e,t,s)=>{"use strict";const r=s(4589),n=s(2858),{channels:A}=s(772),i=s(3801),{RequestContentLengthMismatchError:o,ResponseContentLengthMismatchError:a,RequestAbortedError:c,HeadersTimeoutError:l,HeadersOverflowError:h,SocketError:g,InformationalError:d,BodyTimeoutError:u,HTTPParserError:E,ResponseExceededMaxSizeError:I}=s(4465),{kUrl:C,kReset:B,kClient:Q,kParser:p,kBlocking:f,kRunning:m,kPending:y,kSize:w,kWriting:S,kQueue:D,kNoRef:b,kKeepAliveDefaultTimeout:v,kHostHeader:R,kPendingIdx:N,kRunningIdx:k,kError:T,kPipelining:F,kSocket:M,kKeepAliveTimeoutValue:U,kMaxHeadersSize:L,kKeepAliveMaxTimeout:H,kKeepAliveTimeoutThreshold:P,kHeadersTimeout:x,kBodyTimeout:Y,kStrictContentLength:V,kMaxRequests:O,kCounter:G,kMaxResponseSize:J,kOnError:W,kResume:_,kHTTPContext:q,kClosed:$}=s(257),z=s(4178),X=Buffer.alloc(0),j=Buffer[Symbol.species],Z=n.removeAllListeners;let K;let ee=null,te=null,se=null,re=0,ne=null;class Ae{constructor(e,t,{exports:s}){this.llhttp=s,this.ptr=this.llhttp.llhttp_alloc(z.TYPE.RESPONSE),this.client=e,this.socket=t,this.timeout=null,this.timeoutValue=null,this.timeoutType=null,this.statusCode=0,this.statusText="",this.upgrade=!1,this.headers=[],this.headersSize=0,this.headersMaxSize=e[L],this.shouldKeepAlive=!1,this.paused=!1,this.resume=this.resume.bind(this),this.bytesRead=0,this.keepAlive="",this.contentLength="",this.connection="",this.maxResponseSize=e[J]}setTimeout(e,t){e!==this.timeoutValue||1&t^1&this.timeoutType?(this.timeout&&(i.clearTimeout(this.timeout),this.timeout=null),e&&(1&t?this.timeout=i.setFastTimeout(ie,e,new WeakRef(this)):(this.timeout=setTimeout(ie,e,new WeakRef(this)),this.timeout?.unref())),this.timeoutValue=e):this.timeout&&this.timeout.refresh&&this.timeout.refresh(),this.timeoutType=t}resume(){!this.socket.destroyed&&this.paused&&(r(null!=this.ptr),r(null===te),this.llhttp.llhttp_resume(this.ptr),r(5===this.timeoutType),this.timeout&&this.timeout.refresh&&this.timeout.refresh(),this.paused=!1,this.execute(this.socket.read()||X),this.readMore())}readMore(){for(;!this.paused&&this.ptr;){const e=this.socket.read();if(null===e)break;this.execute(e)}}execute(e){r(null===te),r(null!=this.ptr),r(!this.paused);const{socket:t,llhttp:s}=this;e.length>re&&(ne&&s.free(ne),re=4096*Math.ceil(e.length/4096),ne=s.malloc(re)),new Uint8Array(s.memory.buffer,ne,re).set(e);try{let r;try{se=e,te=this,r=s.llhttp_execute(this.ptr,ne,e.length)}finally{te=null,se=null}if(r!==z.ERROR.OK){const n=e.subarray(s.llhttp_get_error_pos(this.ptr)-ne);if(r===z.ERROR.PAUSED_UPGRADE)this.onUpgrade(n);else{if(r!==z.ERROR.PAUSED){const e=s.llhttp_get_error_reason(this.ptr);let t="";if(e){const r=new Uint8Array(s.memory.buffer,e).indexOf(0);t="Response does not match the HTTP/1.1 protocol ("+Buffer.from(s.memory.buffer,e,r).toString()+")"}throw new E(t,z.ERROR[r],n)}this.paused=!0,t.unshift(n)}}}catch(e){n.destroy(t,e)}}destroy(){r(null===te),r(null!=this.ptr),this.llhttp.llhttp_free(this.ptr),this.ptr=null,this.timeout&&i.clearTimeout(this.timeout),this.timeout=null,this.timeoutValue=null,this.timeoutType=null,this.paused=!1}onStatus(e){return this.statusText=e.toString(),0}onMessageBegin(){const{socket:e,client:t}=this;if(e.destroyed)return-1;const s=t[D][t[k]];return s?(s.onResponseStarted(),0):-1}onHeaderField(e){const t=this.headers.length;return 1&t?this.headers[t-1]=Buffer.concat([this.headers[t-1],e]):this.headers.push(e),this.trackHeader(e.length),0}onHeaderValue(e){let t=this.headers.length;1&~t?this.headers[t-1]=Buffer.concat([this.headers[t-1],e]):(this.headers.push(e),t+=1);const s=this.headers[t-2];if(10===s.length){const t=n.bufferToLowerCasedHeaderName(s);"keep-alive"===t?this.keepAlive+=e.toString():"connection"===t&&(this.connection+=e.toString())}else 14===s.length&&"content-length"===n.bufferToLowerCasedHeaderName(s)&&(this.contentLength+=e.toString());return this.trackHeader(e.length),0}trackHeader(e){this.headersSize+=e,this.headersSize>=this.headersMaxSize&&n.destroy(this.socket,new h)}onUpgrade(e){const{upgrade:t,client:s,socket:A,headers:i,statusCode:o}=this;r(t),r(s[M]===A),r(!A.destroyed),r(!this.paused),r(!(1&i.length));const a=s[D][s[k]];r(a),r(a.upgrade||"CONNECT"===a.method),this.statusCode=0,this.statusText="",this.shouldKeepAlive=!1,this.headers=[],this.headersSize=0,A.unshift(e),A[p].destroy(),A[p]=null,A[Q]=null,A[T]=null,Z(A),s[M]=null,s[q]=null,s[D][s[k]++]=null,s.emit("disconnect",s[C],[s],new d("upgrade"));try{a.onUpgrade(o,i,A)}catch(e){n.destroy(A,e)}s[_]()}onHeadersComplete(e,t,s){const{client:A,socket:i,headers:o,statusText:a}=this;if(i.destroyed)return-1;const c=A[D][A[k]];if(!c)return-1;if(r(!this.upgrade),r(this.statusCode<200),100===e)return n.destroy(i,new g("bad response",n.getSocketInfo(i))),-1;if(t&&!c.upgrade)return n.destroy(i,new g("bad upgrade",n.getSocketInfo(i))),-1;if(r(3===this.timeoutType),this.statusCode=e,this.shouldKeepAlive=s||"HEAD"===c.method&&!i[B]&&"keep-alive"===this.connection.toLowerCase(),this.statusCode>=200){const e=null!=c.bodyTimeout?c.bodyTimeout:A[Y];this.setTimeout(e,5)}else this.timeout&&this.timeout.refresh&&this.timeout.refresh();if("CONNECT"===c.method)return r(1===A[m]),this.upgrade=!0,2;if(t)return r(1===A[m]),this.upgrade=!0,2;if(r(!(1&this.headers.length)),this.headers=[],this.headersSize=0,this.shouldKeepAlive&&A[F]){const e=this.keepAlive?n.parseKeepAliveTimeout(this.keepAlive):null;if(null!=e){const t=Math.min(e-A[P],A[H]);t<=0?i[B]=!0:A[U]=t}else A[U]=A[v]}else i[B]=!0;const l=!1===c.onHeaders(e,o,this.resume,a);return c.aborted?-1:"HEAD"===c.method||e<200?1:(i[f]&&(i[f]=!1,A[_]()),l?z.ERROR.PAUSED:0)}onBody(e){const{client:t,socket:s,statusCode:A,maxResponseSize:i}=this;if(s.destroyed)return-1;const o=t[D][t[k]];return r(o),r(5===this.timeoutType),this.timeout&&this.timeout.refresh&&this.timeout.refresh(),r(A>=200),i>-1&&this.bytesRead+e.length>i?(n.destroy(s,new I),-1):(this.bytesRead+=e.length,!1===o.onData(e)?z.ERROR.PAUSED:0)}onMessageComplete(){const{client:e,socket:t,statusCode:s,upgrade:A,headers:i,contentLength:o,bytesRead:c,shouldKeepAlive:l}=this;if(t.destroyed&&(!s||l))return-1;if(A)return 0;r(s>=100),r(!(1&this.headers.length));const h=e[D][e[k]];return r(h),this.statusCode=0,this.statusText="",this.bytesRead=0,this.contentLength="",this.keepAlive="",this.connection="",this.headers=[],this.headersSize=0,s<200?0:"HEAD"!==h.method&&o&&c!==parseInt(o,10)?(n.destroy(t,new a),-1):(h.onComplete(i),e[D][e[k]++]=null,t[S]?(r(0===e[m]),n.destroy(t,new d("reset")),z.ERROR.PAUSED):l?t[B]&&0===e[m]?(n.destroy(t,new d("reset")),z.ERROR.PAUSED):(null==e[F]||1===e[F]?setImmediate(e[_]):e[_](),0):(n.destroy(t,new d("reset")),z.ERROR.PAUSED))}}function ie(e){const{socket:t,timeoutType:s,client:A,paused:i}=e.deref();3===s?(!t[S]||t.writableNeedDrain||A[m]>1)&&(r(!i,"cannot be paused while waiting for headers"),n.destroy(t,new l)):5===s?i||n.destroy(t,new u):8===s&&(r(0===A[m]&&A[U]),n.destroy(t,new d("socket idle timeout")))}function oe(e){r("ERR_TLS_CERT_ALTNAME_INVALID"!==e.code);const t=this[p];"ECONNRESET"!==e.code||!t.statusCode||t.shouldKeepAlive?(this[T]=e,this[Q][W](e)):t.onMessageComplete()}function ae(){this[p]?.readMore()}function ce(){const e=this[p];!e.statusCode||e.shouldKeepAlive?n.destroy(this,new g("other side closed",n.getSocketInfo(this))):e.onMessageComplete()}function le(){const e=this[p];e&&(this[T]||!e.statusCode||e.shouldKeepAlive||e.onMessageComplete(),this[p].destroy(),this[p]=null);const t=this[T]||new g("closed",n.getSocketInfo(this)),s=this[Q];if(s[M]=null,s[q]=null,s.destroyed){r(0===s[y]);const e=s[D].splice(s[k]);for(let r=0;r<e.length;r++){const A=e[r];n.errorRequest(s,A,t)}}else if(s[m]>0&&"UND_ERR_INFO"!==t.code){const e=s[D][s[k]];s[D][s[k]++]=null,n.errorRequest(s,e,t)}s[N]=s[k],r(0===s[m]),s.emit("disconnect",s[C],[s],t),s[_]()}function he(){this[$]=!0}function ge(e,t,s,A,i,o,a,c){try{t?n.isBuffer(t)&&(r(o===t.byteLength,"buffer body must have content length"),i.cork(),i.write(`${a}content-length: ${o}\r\n\r\n`,"latin1"),i.write(t),i.uncork(),A.onBodySent(t),c||!1===A.reset||(i[B]=!0)):0===o?i.write(`${a}content-length: 0\r\n\r\n`,"latin1"):(r(null===o,"no body must not have content length"),i.write(`${a}\r\n`,"latin1")),A.onRequestSent(),s[_]()}catch(t){e(t)}}async function de(e,t,s,n,A,i,o,a){r(0!==i||0===s[m],"iterator body cannot be pipelined");let c=null;function l(){if(c){const e=c;c=null,e()}}A.on("close",l).on("drain",l);const h=new ue({abort:e,socket:A,request:n,contentLength:i,client:s,expectsPayload:a,header:o});try{for await(const e of t){if(A[T])throw A[T];h.write(e)||await new Promise(((e,t)=>{r(null===c),A[T]?t(A[T]):c=e}))}h.end()}catch(e){h.destroy(e)}finally{A.off("close",l).off("drain",l)}}class ue{constructor({abort:e,socket:t,request:s,contentLength:r,client:n,expectsPayload:A,header:i}){this.socket=t,this.request=s,this.contentLength=r,this.client=n,this.bytesWritten=0,this.expectsPayload=A,this.header=i,this.abort=e,t[S]=!0}write(e){const{socket:t,request:s,contentLength:r,client:n,bytesWritten:A,expectsPayload:i,header:a}=this;if(t[T])throw t[T];if(t.destroyed)return!1;const c=Buffer.byteLength(e);if(!c)return!0;if(null!==r&&A+c>r){if(n[V])throw new o;process.emitWarning(new o)}t.cork(),0===A&&(i||!1===s.reset||(t[B]=!0),null===r?t.write(`${a}transfer-encoding: chunked\r\n`,"latin1"):t.write(`${a}content-length: ${r}\r\n\r\n`,"latin1")),null===r&&t.write(`\r\n${c.toString(16)}\r\n`,"latin1"),this.bytesWritten+=c;const l=t.write(e);return t.uncork(),s.onBodySent(e),l||t[p].timeout&&3===t[p].timeoutType&&t[p].timeout.refresh&&t[p].timeout.refresh(),l}end(){const{socket:e,contentLength:t,client:s,bytesWritten:r,expectsPayload:n,header:A,request:i}=this;if(i.onRequestSent(),e[S]=!1,e[T])throw e[T];if(!e.destroyed){if(0===r?n?e.write(`${A}content-length: 0\r\n\r\n`,"latin1"):e.write(`${A}\r\n`,"latin1"):null===t&&e.write("\r\n0\r\n\r\n","latin1"),null!==t&&r!==t){if(s[V])throw new o;process.emitWarning(new o)}e[p].timeout&&3===e[p].timeoutType&&e[p].timeout.refresh&&e[p].timeout.refresh(),s[_]()}}destroy(e){const{socket:t,client:s,abort:n}=this;t[S]=!1,e&&(r(s[m]<=1,"pipeline should only contain this request"),n(e))}}e.exports=function(e,t){if(e[M]=t,ee||(ee=function(){const e=process.env.JEST_WORKER_ID?s(4744):void 0;let t,n="ppc64"!==process.arch;if("1"===process.env.UNDICI_NO_WASM_SIMD?n=!0:"0"===process.env.UNDICI_NO_WASM_SIMD&&(n=!1),n)try{t=new WebAssembly.Module(s(7136))}catch{}return t||(t=new WebAssembly.Module(e||s(4744))),new WebAssembly.Instance(t,{env:{wasm_on_url:(e,t,s)=>0,wasm_on_status:(e,t,s)=>{r(te.ptr===e);const n=t-ne+se.byteOffset;return te.onStatus(new j(se.buffer,n,s))},wasm_on_message_begin:e=>(r(te.ptr===e),te.onMessageBegin()),wasm_on_header_field:(e,t,s)=>{r(te.ptr===e);const n=t-ne+se.byteOffset;return te.onHeaderField(new j(se.buffer,n,s))},wasm_on_header_value:(e,t,s)=>{r(te.ptr===e);const n=t-ne+se.byteOffset;return te.onHeaderValue(new j(se.buffer,n,s))},wasm_on_headers_complete:(e,t,s,n)=>(r(te.ptr===e),te.onHeadersComplete(t,1===s,1===n)),wasm_on_body:(e,t,s)=>{r(te.ptr===e);const n=t-ne+se.byteOffset;return te.onBody(new j(se.buffer,n,s))},wasm_on_message_complete:e=>(r(te.ptr===e),te.onMessageComplete())}})}()),t.errored)throw t.errored;if(t.destroyed)throw new g("destroyed");return t[b]=!1,t[S]=!1,t[B]=!1,t[f]=!1,t[p]=new Ae(e,t,ee),n.addListener(t,"error",oe),n.addListener(t,"readable",ae),n.addListener(t,"end",ce),n.addListener(t,"close",le),t[$]=!1,t.on("close",he),{version:"h1",defaultPipelining:1,write:t=>function(e,t){const{method:i,path:a,host:l,upgrade:h,blocking:g,reset:u}=t;let{body:E,headers:I,contentLength:C}=t;const Q="PUT"===i||"POST"===i||"PATCH"===i||"QUERY"===i||"PROPFIND"===i||"PROPPATCH"===i;if(n.isFormDataLike(E)){K||(K=s(2530).extractBody);const[e,r]=K(E);null==t.contentType&&I.push("content-type",r),E=e.stream,C=e.length}else n.isBlobLike(E)&&null==t.contentType&&E.type&&I.push("content-type",E.type);E&&"function"==typeof E.read&&E.read(0);const p=n.bodyLength(E);C=p??C,null===C&&(C=t.contentLength);0!==C||Q||(C=null);if(function(e){return"GET"!==e&&"HEAD"!==e&&"OPTIONS"!==e&&"TRACE"!==e&&"CONNECT"!==e}(i)&&C>0&&null!==t.contentLength&&t.contentLength!==C){if(e[V])return n.errorRequest(e,t,new o),!1;process.emitWarning(new o)}const y=e[M],w=s=>{t.aborted||t.completed||(n.errorRequest(e,t,s||new c),n.destroy(E),n.destroy(y,new d("aborted")))};try{t.onConnect(w)}catch(s){n.errorRequest(e,t,s)}if(t.aborted)return!1;"HEAD"===i&&(y[B]=!0);(h||"CONNECT"===i)&&(y[B]=!0);null!=u&&(y[B]=u);e[O]&&y[G]++>=e[O]&&(y[B]=!0);g&&(y[f]=!0);let D=`${i} ${a} HTTP/1.1\r\n`;D+="string"==typeof l?`host: ${l}\r\n`:e[R];h?D+=`connection: upgrade\r\nupgrade: ${h}\r\n`:e[F]&&!y[B]?D+="connection: keep-alive\r\n":D+="connection: close\r\n";if(Array.isArray(I))for(let e=0;e<I.length;e+=2){const t=I[e+0],s=I[e+1];if(Array.isArray(s))for(let e=0;e<s.length;e++)D+=`${t}: ${s[e]}\r\n`;else D+=`${t}: ${s}\r\n`}A.sendHeaders.hasSubscribers&&A.sendHeaders.publish({request:t,headers:D,socket:y});E&&0!==p?n.isBuffer(E)?ge(w,E,e,t,y,C,D,Q):n.isBlobLike(E)?"function"==typeof E.stream?de(w,E.stream(),e,t,y,C,D,Q):async function(e,t,s,n,A,i,a,c){r(i===t.size,"blob body must have content length");try{if(null!=i&&i!==t.size)throw new o;const e=Buffer.from(await t.arrayBuffer());A.cork(),A.write(`${a}content-length: ${i}\r\n\r\n`,"latin1"),A.write(e),A.uncork(),n.onBodySent(e),n.onRequestSent(),c||!1===n.reset||(A[B]=!0),s[_]()}catch(t){e(t)}}(w,E,e,t,y,C,D,Q):n.isStream(E)?function(e,t,s,A,i,o,a,l){r(0!==o||0===s[m],"stream body cannot be pipelined");let h=!1;const g=new ue({abort:e,socket:i,request:A,contentLength:o,client:s,expectsPayload:l,header:a}),d=function(e){if(!h)try{!g.write(e)&&this.pause&&this.pause()}catch(e){n.destroy(this,e)}},u=function(){h||t.resume&&t.resume()},E=function(){if(queueMicrotask((()=>{t.removeListener("error",I)})),!h){const e=new c;queueMicrotask((()=>I(e)))}},I=function(e){if(!h){if(h=!0,r(i.destroyed||i[S]&&s[m]<=1),i.off("drain",u).off("error",I),t.removeListener("data",d).removeListener("end",I).removeListener("close",E),!e)try{g.end()}catch(t){e=t}g.destroy(e),!e||"UND_ERR_INFO"===e.code&&"reset"===e.message?n.destroy(t):n.destroy(t,e)}};t.on("data",d).on("end",I).on("error",I).on("close",E),t.resume&&t.resume();i.on("drain",u).on("error",I),t.errorEmitted??t.errored?setImmediate(I,t.errored):(t.endEmitted??t.readableEnded)&&setImmediate(I,null);(t.closeEmitted??t.closed)&&setImmediate(E)}(w,E,e,t,y,C,D,Q):n.isIterable(E)?de(w,E,e,t,y,C,D,Q):r(!1):ge(w,null,e,t,y,C,D,Q);return!0}(e,t),resume(){!function(e){const t=e[M];if(t&&!t.destroyed)if(0===e[w]?!t[b]&&t.unref&&(t.unref(),t[b]=!0):t[b]&&t.ref&&(t.ref(),t[b]=!1),0===e[w])8!==t[p].timeoutType&&t[p].setTimeout(e[U],8);else if(e[m]>0&&t[p].statusCode<200&&3!==t[p].timeoutType){const s=e[D][e[k]],r=null!=s.headersTimeout?s.headersTimeout:e[x];t[p].setTimeout(r,3)}}(e)},destroy(e,s){t[$]?queueMicrotask(s):(t.on("close",s),t.destroy(e))},get destroyed(){return t.destroyed},busy(s){if(t[S]||t[B]||t[f])return!0;if(s){if(e[m]>0&&!s.idempotent)return!0;if(e[m]>0&&(s.upgrade||"CONNECT"===s.method))return!0;if(e[m]>0&&0!==n.bodyLength(s.body)&&(n.isStream(s.body)||n.isAsyncIterable(s.body)||n.isFormDataLike(s.body)))return!0}return!1}}}},8142:(e,t,s)=>{"use strict";const r=s(4589),{pipeline:n}=s(7075),A=s(2858),{RequestContentLengthMismatchError:i,RequestAbortedError:o,SocketError:a,InformationalError:c}=s(4465),{kUrl:l,kReset:h,kClient:g,kRunning:d,kPending:u,kQueue:E,kPendingIdx:I,kRunningIdx:C,kError:B,kSocket:Q,kStrictContentLength:p,kOnError:f,kMaxConcurrentStreams:m,kHTTP2Session:y,kResume:w,kSize:S,kHTTPContext:D,kClosed:b,kBodyTimeout:v}=s(257),{channels:R}=s(772),N=Symbol("open streams");let k,T;try{T=s(2467)}catch{T={constants:{}}}const{constants:{HTTP2_HEADER_AUTHORITY:F,HTTP2_HEADER_METHOD:M,HTTP2_HEADER_PATH:U,HTTP2_HEADER_SCHEME:L,HTTP2_HEADER_CONTENT_LENGTH:H,HTTP2_HEADER_EXPECT:P,HTTP2_HEADER_STATUS:x}}=T;function Y(e){r("ERR_TLS_CERT_ALTNAME_INVALID"!==e.code),this[Q][B]=e,this[g][f](e)}function V(e,t,s){if(0===s){const s=new c(`HTTP/2: "frameError" received - type ${e}, code ${t}`);this[Q][B]=s,this[g][f](s)}}function O(){const e=new a("other side closed",A.getSocketInfo(this[Q]));this.destroy(e),A.destroy(this[Q],e)}function G(e){const t=this[B]||new a(`HTTP/2: "GOAWAY" frame received with code ${e}`,A.getSocketInfo(this[Q])),s=this[g];if(s[Q]=null,s[D]=null,this.close(),this[y]=null,A.destroy(this[Q],t),s[C]<s[E].length){const e=s[E][s[C]];s[E][s[C]++]=null,A.errorRequest(s,e,t),s[I]=s[C]}r(0===s[d]),s.emit("disconnect",s[l],[s],t),s.emit("connectionError",s[l],[s],t),s[w]()}function J(){const{[g]:e}=this,{[Q]:t}=e,s=this[Q][B]||this[B]||new a("closed",A.getSocketInfo(t));if(e[Q]=null,e[D]=null,e.destroyed){r(0===e[u]);const t=e[E].splice(e[C]);for(let r=0;r<t.length;r++){const n=t[r];A.errorRequest(e,n,s)}}}function W(){const e=this[B]||new a("closed",A.getSocketInfo(this)),t=this[y][g];t[Q]=null,t[D]=null,null!==this[y]&&this[y].destroy(e),t[I]=t[C],r(0===t[d]),t.emit("disconnect",t[l],[t],e),t[w]()}function _(e){r("ERR_TLS_CERT_ALTNAME_INVALID"!==e.code),this[B]=e,this[g][f](e)}function q(){A.destroy(this,new a("other side closed",A.getSocketInfo(this)))}function $(){this[b]=!0}function z(e,t,s,n,i,o,a,c){try{null!=s&&A.isBuffer(s)&&(r(a===s.byteLength,"buffer body must have content length"),t.cork(),t.write(s),t.uncork(),t.end(),i.onBodySent(s)),c||(o[h]=!0),i.onRequestSent(),n[w]()}catch(t){e(t)}}async function X(e,t,s,n,A,i,o,a){r(0!==o||0===n[d],"iterator body cannot be pipelined");let c=null;function l(){if(c){const e=c;c=null,e()}}t.on("close",l).on("drain",l);try{for await(const e of s){if(i[B])throw i[B];const s=t.write(e);A.onBodySent(e),s||await new Promise(((e,t)=>{r(null===c),i[B]?t(i[B]):c=e}))}t.end(),A.onRequestSent(),a||(i[h]=!0),n[w]()}catch(t){e(t)}finally{t.off("close",l).off("drain",l)}}e.exports=function(e,t){e[Q]=t;const a=T.connect(e[l],{createConnection:()=>t,peerMaxConcurrentStreams:e[m],settings:{enablePush:!1}});return a[N]=0,a[g]=e,a[Q]=t,a[y]=null,A.addListener(a,"error",Y),A.addListener(a,"frameError",V),A.addListener(a,"end",O),A.addListener(a,"goaway",G),A.addListener(a,"close",J),a.unref(),e[y]=a,t[y]=a,A.addListener(t,"error",_),A.addListener(t,"end",q),A.addListener(t,"close",W),t[b]=!1,t.on("close",$),{version:"h2",defaultPipelining:1/0,write:t=>function(e,t){const a=t.bodyTimeout??e[v],g=e[y],{method:u,path:B,host:m,upgrade:S,expectContinue:D,signal:b,protocol:T,headers:Y}=t;let{body:V}=t;if(S)return A.errorRequest(e,t,new Error("Upgrade not supported for H2")),!1;const O={};for(let e=0;e<Y.length;e+=2){const t=Y[e+0],s=Y[e+1];if("cookie"!==t)if(Array.isArray(s))for(let e=0;e<s.length;e++)O[t]?O[t]+=`, ${s[e]}`:O[t]=s[e];else O[t]?O[t]+=`, ${s}`:O[t]=s;else null!=O[t]?O[t]=Array.isArray(O[t])?(O[t].push(s),O[t]):[O[t],s]:O[t]=s}let G=null;const{hostname:J,port:W}=e[l];O[F]=m||`${J}${W?`:${W}`:""}`,O[M]=u;const _=s=>{t.aborted||t.completed||(s=s||new o,A.errorRequest(e,t,s),null!=G&&(G.removeAllListeners("data"),G.close(),e[f](s),e[w]()),A.destroy(V,s))};try{t.onConnect(_)}catch(s){A.errorRequest(e,t,s)}if(t.aborted)return!1;if("CONNECT"===u)return g.ref(),G=g.request(O,{endStream:!1,signal:b}),G.pending?G.once("ready",(()=>{t.onUpgrade(null,null,G),++g[N],e[E][e[C]++]=null})):(t.onUpgrade(null,null,G),++g[N],e[E][e[C]++]=null),G.once("close",(()=>{g[N]-=1,0===g[N]&&g.unref()})),G.setTimeout(a),!0;O[U]=B,O[L]="http:"===T?"http":"https";const q="PUT"===u||"POST"===u||"PATCH"===u;V&&"function"==typeof V.read&&V.read(0);let $=A.bodyLength(V);if(A.isFormDataLike(V)){k??=s(2530).extractBody;const[e,t]=k(V);O["content-type"]=t,V=e.stream,$=e.length}null==$&&($=t.contentLength);0!==$&&q||($=null);if(function(e){return"GET"!==e&&"HEAD"!==e&&"OPTIONS"!==e&&"TRACE"!==e&&"CONNECT"!==e}(u)&&$>0&&null!=t.contentLength&&t.contentLength!==$){if(e[p])return A.errorRequest(e,t,new i),!1;process.emitWarning(new i)}null!=$&&(r(V,"no body must not have content length"),O[H]=`${$}`);if(g.ref(),R.sendHeaders.hasSubscribers){let e="";for(const t in O)e+=`${t}: ${O[t]}\r\n`;R.sendHeaders.publish({request:t,headers:e,socket:g[Q]})}const j="GET"===u||"HEAD"===u||null===V;D?(O[P]="100-continue",G=g.request(O,{endStream:j,signal:b}),G.once("continue",Z)):(G=g.request(O,{endStream:j,signal:b}),Z());return++g[N],G.setTimeout(a),G.once("response",(e=>{const{[x]:s,...r}=e;t.onResponseStarted(),t.aborted?G.removeAllListeners("data"):!1===t.onHeaders(Number(s),function(e){const t=[];for(const[s,r]of Object.entries(e))if(Array.isArray(r))for(const e of r)t.push(Buffer.from(s),Buffer.from(e));else t.push(Buffer.from(s),Buffer.from(r));return t}(r),G.resume.bind(G),"")&&G.pause()})),G.on("data",(e=>{!1===t.onData(e)&&G.pause()})),G.once("end",(s=>{G.removeAllListeners("data"),null==G.state?.state||G.state.state<6?(t.aborted||t.completed||t.onComplete({}),e[E][e[C]++]=null,e[w]()):(--g[N],0===g[N]&&g.unref(),_(s??new c("HTTP/2: stream half-closed (remote)")),e[E][e[C]++]=null,e[I]=e[C],e[w]())})),G.once("close",(()=>{G.removeAllListeners("data"),g[N]-=1,0===g[N]&&g.unref()})),G.once("error",(function(e){G.removeAllListeners("data"),_(e)})),G.once("frameError",((e,t)=>{G.removeAllListeners("data"),_(new c(`HTTP/2: "frameError" received - type ${e}, code ${t}`))})),G.on("aborted",(()=>{G.removeAllListeners("data")})),G.on("timeout",(()=>{const e=new c(`HTTP/2: "stream timeout after ${a}"`);G.removeAllListeners("data"),g[N]-=1,0===g[N]&&g.unref(),_(e)})),G.once("trailers",(e=>{t.aborted||t.completed||t.onComplete(e)})),!0;function Z(){V&&0!==$?A.isBuffer(V)?z(_,G,V,e,t,e[Q],$,q):A.isBlobLike(V)?"function"==typeof V.stream?X(_,G,V.stream(),e,t,e[Q],$,q):async function(e,t,s,n,A,o,a,c){r(a===s.size,"blob body must have content length");try{if(null!=a&&a!==s.size)throw new i;const e=Buffer.from(await s.arrayBuffer());t.cork(),t.write(e),t.uncork(),t.end(),A.onBodySent(e),A.onRequestSent(),c||(o[h]=!0),n[w]()}catch(t){e(t)}}(_,G,V,e,t,e[Q],$,q):A.isStream(V)?function(e,t,s,i,o,a,c,l){r(0!==l||0===a[d],"stream body cannot be pipelined");const g=n(o,i,(r=>{r?(A.destroy(g,r),e(r)):(A.removeAllListeners(g),c.onRequestSent(),s||(t[h]=!0),a[w]())}));function u(e){c.onBodySent(e)}A.addListener(g,"data",u)}(_,e[Q],q,G,V,e,t,$):A.isIterable(V)?X(_,G,V,e,t,e[Q],$,q):r(!1):z(_,G,null,e,t,e[Q],$,q)}}(e,t),resume(){!function(e){const t=e[Q];!1===t?.destroyed&&(0===e[S]||0===e[m]?(t.unref(),e[y].unref()):(t.ref(),e[y].ref()))}(e)},destroy(e,s){t[b]?queueMicrotask(s):t.destroy(e).on("close",s)},get destroyed(){return t.destroyed},busy:()=>!1}}},1167:(e,t,s)=>{"use strict";const r=s(4589),n=s(7030),A=s(7067),i=s(2858),{ClientStats:o}=s(4304),{channels:a}=s(772),c=s(5837),l=s(7779),{InvalidArgumentError:h,InformationalError:g,ClientDestroyedError:d}=s(4465),u=s(1986),{kUrl:E,kServerName:I,kClient:C,kBusy:B,kConnect:Q,kResuming:p,kRunning:f,kPending:m,kSize:y,kQueue:w,kConnected:S,kConnecting:D,kNeedDrain:b,kKeepAliveDefaultTimeout:v,kHostHeader:R,kPendingIdx:N,kRunningIdx:k,kError:T,kPipelining:F,kKeepAliveTimeoutValue:M,kMaxHeadersSize:U,kKeepAliveMaxTimeout:L,kKeepAliveTimeoutThreshold:H,kHeadersTimeout:P,kBodyTimeout:x,kStrictContentLength:Y,kConnector:V,kMaxRequests:O,kCounter:G,kClose:J,kDestroy:W,kDispatch:_,kLocalAddress:q,kMaxResponseSize:$,kOnError:z,kHTTPContext:X,kMaxConcurrentStreams:j,kResume:Z}=s(257),K=s(9355),ee=s(8142),te=Symbol("kClosedResolve"),se=A&&A.maxHeaderSize&&Number.isInteger(A.maxHeaderSize)&&A.maxHeaderSize>0?()=>A.maxHeaderSize:()=>{throw new h("http module not available or http.maxHeaderSize invalid")},re=()=>{};function ne(e){return e[F]??e[X]?.defaultPipelining??1}function Ae(e,t){if(0===e[f]&&"UND_ERR_INFO"!==t.code&&"UND_ERR_SOCKET"!==t.code){r(e[N]===e[k]);const s=e[w].splice(e[k]);for(let r=0;r<s.length;r++){const n=s[r];i.errorRequest(e,n,t)}r(0===e[y])}}function ie(e){r(!e[D]),r(!e[X]);let{host:t,hostname:s,protocol:A,port:o}=e[E];if("["===s[0]){const e=s.indexOf("]");r(-1!==e);const t=s.substring(1,e);r(n.isIPv6(t)),s=t}e[D]=!0,a.beforeConnect.hasSubscribers&&a.beforeConnect.publish({connectParams:{host:t,hostname:s,protocol:A,port:o,version:e[X]?.version,servername:e[I],localAddress:e[q]},connector:e[V]}),e[V]({host:t,hostname:s,protocol:A,port:o,servername:e[I],localAddress:e[q]},((n,c)=>{if(n)return oe(e,n,{host:t,hostname:s,protocol:A,port:o}),void e[Z]();if(e.destroyed)return i.destroy(c.on("error",re),new d),void e[Z]();r(c);try{e[X]="h2"===c.alpnProtocol?ee(e,c):K(e,c)}catch(n){return c.destroy().on("error",re),oe(e,n,{host:t,hostname:s,protocol:A,port:o}),void e[Z]()}e[D]=!1,c[G]=0,c[O]=e[O],c[C]=e,c[T]=null,a.connected.hasSubscribers&&a.connected.publish({connectParams:{host:t,hostname:s,protocol:A,port:o,version:e[X]?.version,servername:e[I],localAddress:e[q]},connector:e[V],socket:c}),e.emit("connect",e[E],[e]),e[Z]()}))}function oe(e,t,{host:s,hostname:n,protocol:A,port:o}){if(!e.destroyed){if(e[D]=!1,a.connectError.hasSubscribers&&a.connectError.publish({connectParams:{host:s,hostname:n,protocol:A,port:o,version:e[X]?.version,servername:e[I],localAddress:e[q]},connector:e[V],error:t}),"ERR_TLS_CERT_ALTNAME_INVALID"===t.code)for(r(0===e[f]);e[m]>0&&e[w][e[N]].servername===e[I];){const s=e[w][e[N]++];i.errorRequest(e,s,t)}else Ae(e,t);e.emit("connectionError",e[E],[e],t)}}function ae(e){e[b]=0,e.emit("drain",e[E],[e])}function ce(e,t){2!==e[p]&&(e[p]=2,function(e,t){for(;;){if(e.destroyed)return void r(0===e[m]);if(e[te]&&!e[y])return e[te](),void(e[te]=null);if(e[X]&&e[X].resume(),e[B])e[b]=2;else if(2===e[b]){t?(e[b]=1,queueMicrotask((()=>ae(e)))):ae(e);continue}if(0===e[m])return;if(e[f]>=(ne(e)||1))return;const s=e[w][e[N]];if("https:"===e[E].protocol&&e[I]!==s.servername){if(e[f]>0)return;e[I]=s.servername,e[X]?.destroy(new g("servername changed"),(()=>{e[X]=null,ce(e)}))}if(e[D])return;if(!e[X])return void ie(e);if(e[X].destroyed)return;if(e[X].busy(s))return;!s.aborted&&e[X].write(s)?e[N]++:e[w].splice(e[N],1)}}(e,t),e[p]=0,e[k]>256&&(e[w].splice(0,e[k]),e[N]-=e[k],e[k]=0))}e.exports=class extends l{constructor(e,{maxHeaderSize:t,headersTimeout:s,socketTimeout:r,requestTimeout:A,connectTimeout:o,bodyTimeout:a,idleTimeout:c,keepAlive:l,keepAliveTimeout:g,maxKeepAliveTimeout:d,keepAliveMaxTimeout:C,keepAliveTimeoutThreshold:B,socketPath:Q,pipelining:f,tls:m,strictContentLength:y,maxCachedSessions:S,connect:D,maxRequestsPerClient:T,localAddress:G,maxResponseSize:J,autoSelectFamily:W,autoSelectFamilyAttemptTimeout:_,maxConcurrentStreams:K,allowH2:ee}={}){if(void 0!==l)throw new h("unsupported keepAlive, use pipelining=0 instead");if(void 0!==r)throw new h("unsupported socketTimeout, use headersTimeout & bodyTimeout instead");if(void 0!==A)throw new h("unsupported requestTimeout, use headersTimeout & bodyTimeout instead");if(void 0!==c)throw new h("unsupported idleTimeout, use keepAliveTimeout instead");if(void 0!==d)throw new h("unsupported maxKeepAliveTimeout, use keepAliveMaxTimeout instead");if(null!=t){if(!Number.isInteger(t)||t<1)throw new h("invalid maxHeaderSize")}else t=se();if(null!=Q&&"string"!=typeof Q)throw new h("invalid socketPath");if(null!=o&&(!Number.isFinite(o)||o<0))throw new h("invalid connectTimeout");if(null!=g&&(!Number.isFinite(g)||g<=0))throw new h("invalid keepAliveTimeout");if(null!=C&&(!Number.isFinite(C)||C<=0))throw new h("invalid keepAliveMaxTimeout");if(null!=B&&!Number.isFinite(B))throw new h("invalid keepAliveTimeoutThreshold");if(null!=s&&(!Number.isInteger(s)||s<0))throw new h("headersTimeout must be a positive integer or zero");if(null!=a&&(!Number.isInteger(a)||a<0))throw new h("bodyTimeout must be a positive integer or zero");if(null!=D&&"function"!=typeof D&&"object"!=typeof D)throw new h("connect must be a function or an object");if(null!=T&&(!Number.isInteger(T)||T<0))throw new h("maxRequestsPerClient must be a positive number");if(null!=G&&("string"!=typeof G||0===n.isIP(G)))throw new h("localAddress must be valid string IP address");if(null!=J&&(!Number.isInteger(J)||J<-1))throw new h("maxResponseSize must be a positive number");if(null!=_&&(!Number.isInteger(_)||_<-1))throw new h("autoSelectFamilyAttemptTimeout must be a positive number");if(null!=ee&&"boolean"!=typeof ee)throw new h("allowH2 must be a valid boolean value");if(null!=K&&("number"!=typeof K||K<1))throw new h("maxConcurrentStreams must be a positive integer, greater than 0");super(),"function"!=typeof D&&(D=u({...m,maxCachedSessions:S,allowH2:ee,socketPath:Q,timeout:o,..."boolean"==typeof W?{autoSelectFamily:W,autoSelectFamilyAttemptTimeout:_}:void 0,...D})),this[E]=i.parseOrigin(e),this[V]=D,this[F]=null!=f?f:1,this[U]=t,this[v]=null==g?4e3:g,this[L]=null==C?6e5:C,this[H]=null==B?2e3:B,this[M]=this[v],this[I]=null,this[q]=null!=G?G:null,this[p]=0,this[b]=0,this[R]=`host: ${this[E].hostname}${this[E].port?`:${this[E].port}`:""}\r\n`,this[x]=null!=a?a:3e5,this[P]=null!=s?s:3e5,this[Y]=null==y||y,this[O]=T,this[te]=null,this[$]=J>-1?J:-1,this[j]=null!=K?K:100,this[X]=null,this[w]=[],this[k]=0,this[N]=0,this[Z]=e=>ce(this,e),this[z]=e=>Ae(this,e)}get pipelining(){return this[F]}set pipelining(e){this[F]=e,this[Z](!0)}get stats(){return new o(this)}get[m](){return this[w].length-this[N]}get[f](){return this[N]-this[k]}get[y](){return this[w].length-this[k]}get[S](){return!!this[X]&&!this[D]&&!this[X].destroyed}get[B](){return Boolean(this[X]?.busy(null)||this[y]>=(ne(this)||1)||this[m]>0)}[Q](e){ie(this),this.once("connect",e)}[_](e,t){const s=new c(this[E].origin,e,t);return this[w].push(s),this[p]||(null==i.bodyLength(s.body)&&i.isIterable(s.body)?(this[p]=1,queueMicrotask((()=>ce(this)))):this[Z](!0)),this[p]&&2!==this[b]&&this[B]&&(this[b]=2),this[b]<2}[J](){return new Promise((e=>{this[y]?this[te]=e:e(null)}))}[W](e){return new Promise((t=>{const s=this[w].splice(this[N]);for(let t=0;t<s.length;t++){const r=s[t];i.errorRequest(this,r,e)}const r=()=>{this[te]&&(this[te](),this[te]=null),t(null)};this[X]?(this[X].destroy(e,r),this[X]=null):queueMicrotask(r),this[Z]()}))}}},7779:(e,t,s)=>{"use strict";const r=s(5497),n=s(4555),{ClientDestroyedError:A,ClientClosedError:i,InvalidArgumentError:o}=s(4465),{kDestroy:a,kClose:c,kClosed:l,kDestroyed:h,kDispatch:g}=s(257),d=Symbol("onDestroyed"),u=Symbol("onClosed");e.exports=class extends r{[h]=!1;[d]=null;[l]=!1;[u]=[];get destroyed(){return this[h]}get closed(){return this[l]}close(e){if(void 0===e)return new Promise(((e,t)=>{this.close(((s,r)=>s?t(s):e(r)))}));if("function"!=typeof e)throw new o("invalid callback");if(this[h])return void queueMicrotask((()=>e(new A,null)));if(this[l])return void(this[u]?this[u].push(e):queueMicrotask((()=>e(null,null))));this[l]=!0,this[u].push(e);const t=()=>{const e=this[u];this[u]=null;for(let t=0;t<e.length;t++)e[t](null,null)};this[c]().then((()=>this.destroy())).then((()=>{queueMicrotask(t)}))}destroy(e,t){if("function"==typeof e&&(t=e,e=null),void 0===t)return new Promise(((t,s)=>{this.destroy(e,((e,r)=>e?s(e):t(r)))}));if("function"!=typeof t)throw new o("invalid callback");if(this[h])return void(this[d]?this[d].push(t):queueMicrotask((()=>t(null,null))));e||(e=new A),this[h]=!0,this[d]=this[d]||[],this[d].push(t);const s=()=>{const e=this[d];this[d]=null;for(let t=0;t<e.length;t++)e[t](null,null)};this[a](e).then((()=>{queueMicrotask(s)}))}dispatch(e,t){if(!t||"object"!=typeof t)throw new o("handler must be an object");t=n.unwrap(t);try{if(!e||"object"!=typeof e)throw new o("opts must be an object.");if(this[h]||this[d])throw new A;if(this[l])throw new i;return this[g](e,t)}catch(e){if("function"!=typeof t.onError)throw e;return t.onError(e),!1}}}},5497:(e,t,s)=>{"use strict";const r=s(8474),n=s(832),A=e=>(t,s)=>e(t,n.wrap(s));e.exports=class extends r{dispatch(){throw new Error("not implemented")}close(){throw new Error("not implemented")}destroy(){throw new Error("not implemented")}compose(...e){const t=Array.isArray(e[0])?e[0]:e;let s=this.dispatch.bind(this);for(const e of t)if(null!=e){if("function"!=typeof e)throw new TypeError("invalid interceptor, expected function received "+typeof e);if(s=e(s),s=A(s),null==s||"function"!=typeof s||2!==s.length)throw new TypeError("invalid interceptor")}return new Proxy(this,{get:(e,t)=>"dispatch"===t?s:e[t]})}}},4667:(e,t,s)=>{"use strict";const r=s(7779),{kClose:n,kDestroy:A,kClosed:i,kDestroyed:o,kDispatch:a,kNoProxyAgent:c,kHttpProxyAgent:l,kHttpsProxyAgent:h}=s(257),g=s(9246),d=s(3315),u={"http:":80,"https:":443};e.exports=class extends r{#B=null;#Q=null;#p=null;constructor(e={}){super(),this.#p=e;const{httpProxy:t,httpsProxy:s,noProxy:r,...n}=e;this[c]=new d(n);const A=t??process.env.http_proxy??process.env.HTTP_PROXY;this[l]=A?new g({...n,uri:A}):this[c];const i=s??process.env.https_proxy??process.env.HTTPS_PROXY;this[h]=i?new g({...n,uri:i}):this[l],this.#f()}[a](e,t){const s=new URL(e.origin);return this.#m(s).dispatch(e,t)}[n](){return Promise.all([this[c].close(),!this[l][i]&&this[l].close(),!this[h][i]&&this[h].close()])}[A](e){return Promise.all([this[c].destroy(e),!this[l][o]&&this[l].destroy(e),!this[h][o]&&this[h].destroy(e)])}#m(e){let{protocol:t,host:s,port:r}=e;return s=s.replace(/:\d*$/,"").toLowerCase(),r=Number.parseInt(r,10)||u[t]||0,this.#y(s,r)?"https:"===t?this[h]:this[l]:this[c]}#y(e,t){if(this.#w&&this.#f(),0===this.#Q.length)return!0;if("*"===this.#B)return!1;for(let s=0;s<this.#Q.length;s++){const r=this.#Q[s];if(!r.port||r.port===t)if(/^[.*]/.test(r.hostname)){if(e.endsWith(r.hostname.replace(/^\*/,"")))return!1}else if(e===r.hostname)return!1}return!0}#f(){const e=this.#p.noProxy??this.#S,t=e.split(/[,\s]/),s=[];for(let e=0;e<t.length;e++){const r=t[e];if(!r)continue;const n=r.match(/^(.+):(\d+)$/);s.push({hostname:(n?n[1]:r).toLowerCase(),port:n?Number.parseInt(n[2],10):0})}this.#B=e,this.#Q=s}get#w(){return void 0===this.#p.noProxy&&this.#B!==this.#S}get#S(){return process.env.no_proxy??process.env.NO_PROXY??""}}},1726:e=>{"use strict";const t=2047;class s{bottom=0;top=0;list=new Array(2048).fill(void 0);next=null;isEmpty(){return this.top===this.bottom}isFull(){return(this.top+1&t)===this.bottom}push(e){this.list[this.top]=e,this.top=this.top+1&t}shift(){const e=this.list[this.bottom];return void 0===e?null:(this.list[this.bottom]=void 0,this.bottom=this.bottom+1&t,e)}}e.exports=class{constructor(){this.head=this.tail=new s}isEmpty(){return this.head.isEmpty()}push(e){this.head.isFull()&&(this.head=this.head.next=new s),this.head.push(e)}shift(){const e=this.tail,t=e.shift();return e.isEmpty()&&null!==e.next&&(this.tail=e.next,e.next=null),t}}},8297:(e,t,s)=>{"use strict";const{connect:r}=s(7030),{kClose:n,kDestroy:A}=s(257),{InvalidArgumentError:i}=s(4465),o=s(2858),a=s(1167),c=s(7779);e.exports=class extends c{#D=null;constructor(e,t){if("string"==typeof e&&(e=new URL(e)),"http:"!==e.protocol)throw new i("h2c-client: Only h2c protocol is supported");const{connect:s,maxConcurrentStreams:r,pipelining:n,...A}=t??{};let o=100,c=100;if(null!=r&&Number.isInteger(r)&&r>0&&(o=r),null!=n&&Number.isInteger(n)&&n>0&&(c=n),c>o)throw new i("h2c-client: pipelining cannot be greater than maxConcurrentStreams");super(),this.#D=new a(e,{...A,connect:this.#b(s),maxConcurrentStreams:o,pipelining:c,allowH2:!0})}#b(e){return(t,s)=>{const n=e?.connectOpts??1e4,{hostname:A,port:i,pathname:a}=t,c=r({...t,host:A,port:i,pathname:a});if(null==t.keepAlive||t.keepAlive){const e=null==t.keepAliveInitialDelay?6e4:t.keepAliveInitialDelay;c.setKeepAlive(!0,e)}c.alpnProtocol="h2";const l=o.setupConnectTimeout(new WeakRef(c),{timeout:n,hostname:A,port:i});return c.setNoDelay(!0).once("connect",(function(){if(queueMicrotask(l),s){const e=s;s=null,e(null,this)}})).on("error",(function(e){if(queueMicrotask(l),s){const t=s;s=null,t(e)}})),c}}dispatch(e,t){return this.#D.dispatch(e,t)}[n](){return this.#D.close()}[A](){return this.#D.destroy()}}},1694:(e,t,s)=>{"use strict";const{PoolStats:r}=s(4304),n=s(7779),A=s(1726),{kConnected:i,kSize:o,kRunning:a,kPending:c,kQueued:l,kBusy:h,kFree:g,kUrl:d,kClose:u,kDestroy:E,kDispatch:I}=s(257),C=Symbol("clients"),B=Symbol("needDrain"),Q=Symbol("queue"),p=Symbol("closed resolve"),f=Symbol("onDrain"),m=Symbol("onConnect"),y=Symbol("onDisconnect"),w=Symbol("onConnectionError"),S=Symbol("get dispatcher"),D=Symbol("add client"),b=Symbol("remove client");e.exports={PoolBase:class extends n{[Q]=new A;[l]=0;[C]=[];[B]=!1;[f](e,t,s){const r=this[Q];let n=!1;for(;!n;){const t=r.shift();if(!t)break;this[l]--,n=!e.dispatch(t.opts,t.handler)}if(e[B]=n,!n&&this[B]&&(this[B]=!1,this.emit("drain",t,[this,...s])),this[p]&&r.isEmpty()){const e=new Array(this[C].length);for(let t=0;t<this[C].length;t++)e[t]=this[C][t].close();Promise.all(e).then(this[p])}}[m]=(e,t)=>{this.emit("connect",e,[this,...t])};[y]=(e,t,s)=>{this.emit("disconnect",e,[this,...t],s)};[w]=(e,t,s)=>{this.emit("connectionError",e,[this,...t],s)};get[h](){return this[B]}get[i](){let e=0;for(const{[i]:t}of this[C])e+=t;return e}get[g](){let e=0;for(const{[i]:t,[B]:s}of this[C])e+=t&&!s;return e}get[c](){let e=this[l];for(const{[c]:t}of this[C])e+=t;return e}get[a](){let e=0;for(const{[a]:t}of this[C])e+=t;return e}get[o](){let e=this[l];for(const{[o]:t}of this[C])e+=t;return e}get stats(){return new r(this)}[u](){if(this[Q].isEmpty()){const e=new Array(this[C].length);for(let t=0;t<this[C].length;t++)e[t]=this[C][t].close();return Promise.all(e)}return new Promise((e=>{this[p]=e}))}[E](e){for(;;){const t=this[Q].shift();if(!t)break;t.handler.onError(e)}const t=new Array(this[C].length);for(let s=0;s<this[C].length;s++)t[s]=this[C][s].destroy(e);return Promise.all(t)}[I](e,t){const s=this[S]();return s?s.dispatch(e,t)||(s[B]=!0,this[B]=!this[S]()):(this[B]=!0,this[Q].push({opts:e,handler:t}),this[l]++),!this[B]}[D](e){return e.on("drain",this[f].bind(this,e)).on("connect",this[m]).on("disconnect",this[y]).on("connectionError",this[w]),this[C].push(e),this[B]&&queueMicrotask((()=>{this[B]&&this[f](e,e[d],[e,this])})),this}[b](e){e.close((()=>{const t=this[C].indexOf(e);-1!==t&&this[C].splice(t,1)})),this[B]=this[C].some((e=>!e[B]&&!0!==e.closed&&!0!==e.destroyed))}},kClients:C,kNeedDrain:B,kAddClient:D,kRemoveClient:b,kGetDispatcher:S}},8542:(e,t,s)=>{"use strict";const{PoolBase:r,kClients:n,kNeedDrain:A,kAddClient:i,kGetDispatcher:o,kRemoveClient:a}=s(1694),c=s(1167),{InvalidArgumentError:l}=s(4465),h=s(2858),{kUrl:g}=s(257),d=s(1986),u=Symbol("options"),E=Symbol("connections"),I=Symbol("factory");function C(e,t){return new c(e,t)}e.exports=class extends r{constructor(e,{connections:t,factory:s=C,connect:r,connectTimeout:A,tls:i,maxCachedSessions:o,socketPath:a,autoSelectFamily:c,autoSelectFamilyAttemptTimeout:B,allowH2:Q,clientTtl:p,...f}={}){if(null!=t&&(!Number.isFinite(t)||t<0))throw new l("invalid connections");if("function"!=typeof s)throw new l("factory must be a function.");if(null!=r&&"function"!=typeof r&&"object"!=typeof r)throw new l("connect must be a function or an object");"function"!=typeof r&&(r=d({...i,maxCachedSessions:o,allowH2:Q,socketPath:a,timeout:A,..."boolean"==typeof c?{autoSelectFamily:c,autoSelectFamilyAttemptTimeout:B}:void 0,...r})),super(),this[E]=t||null,this[g]=h.parseOrigin(e),this[u]={...h.deepClone(f),connect:r,allowH2:Q,clientTtl:p},this[u].interceptors=f.interceptors?{...f.interceptors}:void 0,this[I]=s,this.on("connect",((e,t)=>{if(null!=p&&p>0)for(const e of t)Object.assign(e,{ttl:Date.now()})})),this.on("connectionError",((e,t,s)=>{for(const e of t){const t=this[n].indexOf(e);-1!==t&&this[n].splice(t,1)}}))}[o](){const e=this[u].clientTtl;for(const t of this[n])if(null!=e&&e>0&&t.ttl&&Date.now()-t.ttl>e)this[a](t);else if(!t[A])return t;if(!this[E]||this[n].length<this[E]){const e=this[I](this[g],this[u]);return this[i](e),e}}}},9246:(e,t,s)=>{"use strict";const{kProxy:r,kClose:n,kDestroy:A,kDispatch:i}=s(257),o=s(3315),a=s(8542),c=s(7779),{InvalidArgumentError:l,RequestAbortedError:h,SecureProxyConnectionError:g}=s(4465),d=s(1986),u=s(1167),E=Symbol("proxy agent"),I=Symbol("proxy client"),C=Symbol("proxy headers"),B=Symbol("request tls settings"),Q=Symbol("proxy tls settings"),p=Symbol("connect endpoint function"),f=Symbol("tunnel proxy");function m(e,t){return new a(e,t)}const y=()=>{};function w(e,t){return 1===t.connections?new u(e,t):new a(e,t)}class S extends c{#D;constructor(e,{headers:t={},connect:s,factory:r}){if(!e)throw new l("Proxy URL is mandatory");super(),this[C]=t,this.#D=r?r(e,{connect:s}):new u(e,{connect:s})}[i](e,t){const s=t.onHeaders;t.onHeaders=function(e,r,n){407!==e?s&&s.call(this,e,r,n):"function"==typeof t.onError&&t.onError(new l("Proxy Authentication Required (407)"))};const{origin:r,path:n="/",headers:A={}}=e;if(e.path=r+n,!("host"in A)&&!("Host"in A)){const{host:e}=new URL(r);A.host=e}return e.headers={...this[C],...A},this.#D[i](e,t)}[n](){return this.#D.close()}[A](e){return this.#D.destroy(e)}}e.exports=class extends c{constructor(e){if(!e||"object"==typeof e&&!(e instanceof URL)&&!e.uri)throw new l("Proxy uri is mandatory");const{clientFactory:t=m}=e;if("function"!=typeof t)throw new l("Proxy opts.clientFactory must be a function.");const{proxyTunnel:s=!0}=e;super();const n=this.#v(e),{href:A,origin:i,port:a,protocol:c,username:u,password:D,hostname:b}=n;if(this[r]={uri:A,protocol:c},this[B]=e.requestTls,this[Q]=e.proxyTls,this[C]=e.headers||{},this[f]=s,e.auth&&e.token)throw new l("opts.auth cannot be used in combination with opts.token");e.auth?this[C]["proxy-authorization"]=`Basic ${e.auth}`:e.token?this[C]["proxy-authorization"]=e.token:u&&D&&(this[C]["proxy-authorization"]=`Basic ${Buffer.from(`${decodeURIComponent(u)}:${decodeURIComponent(D)}`).toString("base64")}`);const v=d({...e.proxyTls});this[p]=d({...e.requestTls});const R=e.factory||w;this[I]=t(n,{connect:v}),this[E]=new o({...e,factory:(e,t)=>{const{protocol:s}=new URL(e);return this[f]||"http:"!==s||"http:"!==this[r].protocol?R(e,t):new S(this[r].uri,{headers:this[C],connect:v,factory:R})},connect:async(e,t)=>{let s=e.host;e.port||(s+=`:${function(e){return"https:"===e?443:80}(e.protocol)}`);try{const{socket:r,statusCode:n}=await this[I].connect({origin:i,port:a,path:s,signal:e.signal,headers:{...this[C],host:e.host,...null==e.connections||e.connections>0?{"proxy-connection":"keep-alive"}:{}},servername:this[Q]?.servername||b});if(200!==n&&(r.on("error",y).destroy(),t(new h(`Proxy response (${n}) !== 200 when HTTP Tunneling`))),"https:"!==e.protocol)return void t(null,r);let A;A=this[B]?this[B].servername:e.servername,this[p]({...e,servername:A,httpSocket:r},t)}catch(e){"ERR_TLS_CERT_ALTNAME_INVALID"===e.code?t(new g(e)):t(e)}}})}dispatch(e,t){const s=function(e){if(Array.isArray(e)){const t={};for(let s=0;s<e.length;s+=2)t[e[s]]=e[s+1];return t}return e}(e.headers);if(function(e){const t=e&&Object.keys(e).find((e=>"proxy-authorization"===e.toLowerCase()));if(t)throw new l("Proxy-Authorization should be sent in ProxyAgent constructor")}(s),s&&!("host"in s)&&!("Host"in s)){const{host:t}=new URL(e.origin);s.host=t}return this[E].dispatch({...e,headers:s},t)}#v(e){return"string"==typeof e?new URL(e):e instanceof URL?e:new URL(e.uri)}[n](){return Promise.all([this[E].close(),this[I].close()])}[A](){return Promise.all([this[E].destroy(),this[I].destroy()])}}},8712:(e,t,s)=>{"use strict";const r=s(5497),n=s(6294);e.exports=class extends r{#R=null;#N=null;constructor(e,t={}){super(t),this.#R=e,this.#N=t}dispatch(e,t){const s=new n({...e,retryOptions:this.#N},{dispatch:this.#R.dispatch.bind(this.#R),handler:t});return this.#R.dispatch(e,s)}close(){return this.#R.close()}destroy(){return this.#R.destroy()}}},9879:(e,t,s)=>{"use strict";const r=Symbol.for("undici.globalDispatcher.1"),{InvalidArgumentError:n}=s(4465),A=s(3315);function i(e){if(!e||"function"!=typeof e.dispatch)throw new n("Argument agent must implement Agent");Object.defineProperty(globalThis,r,{value:e,writable:!0,enumerable:!1,configurable:!1})}function o(){return globalThis[r]}void 0===o()&&i(new A);e.exports={setGlobalDispatcher:i,getGlobalDispatcher:o,installedExports:["fetch","Headers","Response","Request","FormData","WebSocket","CloseEvent","ErrorEvent","MessageEvent","EventSource"]}},8358:(e,t,s)=>{"use strict";const r=s(2858),{parseCacheControlHeader:n,parseVaryHeader:A,isEtagUsable:i}=s(9453),{parseHttpDate:o}=s(8851);function a(){}const c=[200,203,204,206,300,301,308,404,405,410,414,501],l=[206,304];e.exports=class{#k;#T;#F;#M;#U;#L;constructor({store:e,type:t,cacheByDefault:s},r,n){this.#M=e,this.#T=t,this.#F=s,this.#k=r,this.#U=n}onRequestStart(e,t){this.#L?.destroy(),this.#L=void 0,this.#U.onRequestStart?.(e,t)}onRequestUpgrade(e,t,s,r){this.#U.onRequestUpgrade?.(e,t,s,r)}onResponseStart(e,t,s,h){const g=()=>this.#U.onResponseStart?.(e,t,s,h);if(!r.safeHTTPMethods.includes(this.#k.method)&&t>=200&&t<=399){try{this.#M.delete(this.#k)?.catch?.(a)}catch{}return g()}const d=s["cache-control"],u=s["last-modified"]&&c.includes(t);if(!(d||s.expires||u||this.#F))return g();const E=d?n(d):{};if(!function(e,t,s,r){if(t<200||l.includes(t))return!1;if(!(c.includes(t)||s.expires||r.public||void 0!==r["max-age"]||r.private&&"private"===e||void 0!==r["s-maxage"]&&"shared"===e))return!1;if(r["no-store"])return!1;if("shared"===e&&!0===r.private)return!1;if(s.vary?.includes("*"))return!1;if(s.authorization){if(!r.public||"string"!=typeof s.authorization)return!1;if(Array.isArray(r["no-cache"])&&r["no-cache"].includes("authorization"))return!1;if(Array.isArray(r.private)&&r.private.includes("authorization"))return!1}return!0}(this.#T,t,s,E))return g();const I=Date.now(),C=s.age?function(e){const t=parseInt(Array.isArray(e)?e[0]:e);return isNaN(t)?void 0:1e3*t}(s.age):void 0;if(C&&C>=2147483647e3)return g();const B="string"==typeof s.date?o(s.date):void 0,Q=function(e,t,s,r,n,A){if("shared"===e){const e=A["s-maxage"];if(void 0!==e)return e>0?1e3*e:void 0}const i=A["max-age"];if(void 0!==i)return i>0?1e3*i:void 0;if("string"==typeof r.expires){const e=o(r.expires);if(e){if(t>=e.getTime())return;if(n){if(n>=e)return;if(void 0!==s&&s>e-n)return}return e.getTime()-t}}if("string"==typeof r["last-modified"]){const e=new Date(r["last-modified"]);if((a=e)instanceof Date&&Number.isFinite(a.valueOf())){if(e.getTime()>=t)return;return.1*(t-e.getTime())}}var a;if(A.immutable)return 31536e3;return}(this.#T,I,C,s,B,E)??this.#F;if(void 0===Q||C&&C>Q)return g();const p=B?B.getTime():I,f=Q+p;if(I>=f)return g();let m;if(this.#k.headers&&s.vary&&(m=A(s.vary,this.#k.headers),!m))return g();const y=function(e,t,s){let r=-1/0,n=-1/0,A=-1/0;t["stale-while-revalidate"]&&(r=s+1e3*t["stale-while-revalidate"]);t["stale-if-error"]&&(n=s+1e3*t["stale-if-error"]);r===-1/0&&n===-1/0&&(A=e+31536e6);return Math.max(s,r,n,A)}(p,E,f),w=function(e,t){const s=["connection","proxy-authenticate","proxy-authentication-info","proxy-authorization","proxy-connection","te","transfer-encoding","upgrade","age"];e.connection&&(Array.isArray(e.connection)?s.push(...e.connection.map((e=>e.trim()))):s.push(...e.connection.split(",").map((e=>e.trim()))));Array.isArray(t["no-cache"])&&s.push(...t["no-cache"]);Array.isArray(t.private)&&s.push(...t.private);let r;for(const t of s)e[t]&&(r??={...e},delete r[t]);return r??e}(s,E),S={statusCode:t,statusMessage:h,headers:w,vary:m,cacheControlDirectives:E,cachedAt:C?I-C:I,staleAt:f,deleteAt:y};if("string"==typeof s.etag&&i(s.etag)&&(S.etag=s.etag),this.#L=this.#M.createWriteStream(this.#k,S),!this.#L)return g();const D=this;return this.#L.on("drain",(()=>e.resume())).on("error",(function(){D.#L=void 0,D.#M.delete(D.#k)})).on("close",(function(){D.#L===this&&(D.#L=void 0),e.resume()})),g()}onResponseData(e,t){!1===this.#L?.write(t)&&e.pause(),this.#U.onResponseData?.(e,t)}onResponseEnd(e,t){this.#L?.end(),this.#U.onResponseEnd?.(e,t)}onResponseError(e,t){this.#L?.destroy(t),this.#L=void 0,this.#U.onResponseError?.(e,t)}}},6607:(e,t,s)=>{"use strict";const r=s(4589);e.exports=class{#H=!1;#P;#U;#x;#Y;constructor(e,t,s){if("function"!=typeof e)throw new TypeError("callback must be a function");this.#P=e,this.#U=t,this.#Y=s}onRequestStart(e,t){this.#H=!1,this.#x=t}onRequestUpgrade(e,t,s,r){this.#U.onRequestUpgrade?.(e,t,s,r)}onResponseStart(e,t,s,n){if(r(null!=this.#P),this.#H=304===t||this.#Y&&t>=500&&t<=504,this.#P(this.#H,this.#x),this.#P=null,this.#H)return!0;this.#U.onRequestStart?.(e,this.#x),this.#U.onResponseStart?.(e,t,s,n)}onResponseData(e,t){if(!this.#H)return this.#U.onResponseData?.(e,t)}onResponseEnd(e,t){this.#H||this.#U.onResponseEnd?.(e,t)}onResponseError(e,t){if(!this.#H){if(this.#P&&(this.#P(!1),this.#P=null),"function"!=typeof this.#U.onResponseError)throw t;this.#U.onResponseError(e,t)}}}},6917:(e,t,s)=>{"use strict";const r=s(4589),n=s(832);e.exports=class{#U;#V=!1;#O=!1;#G=!1;constructor(e){if("object"!=typeof e||null===e)throw new TypeError("handler must be an object");this.#U=n.wrap(e)}onRequestStart(...e){this.#U.onRequestStart?.(...e)}onRequestUpgrade(...e){return r(!this.#V),r(!this.#O),this.#U.onRequestUpgrade?.(...e)}onResponseStart(...e){return r(!this.#V),r(!this.#O),r(!this.#G),this.#G=!0,this.#U.onResponseStart?.(...e)}onResponseData(...e){return r(!this.#V),r(!this.#O),this.#U.onResponseData?.(...e)}onResponseEnd(...e){return r(!this.#V),r(!this.#O),this.#V=!0,this.#U.onResponseEnd?.(...e)}onResponseError(...e){return this.#O=!0,this.#U.onResponseError?.(...e)}onBodySent(){}}},8064:(e,t,s)=>{"use strict";const r=s(2858),{kBodyUsed:n}=s(257),A=s(4589),{InvalidArgumentError:i}=s(4465),o=s(8474),a=[300,301,302,303,307,308],c=Symbol("body"),l=()=>{};class h{constructor(e){this[c]=e,this[n]=!1}async*[Symbol.asyncIterator](){A(!this[n],"disturbed"),this[n]=!0,yield*this[c]}}class g{static buildDispatch(e,t){if(null!=t&&(!Number.isInteger(t)||t<0))throw new i("maxRedirections must be a positive number");const s=e.dispatch.bind(e);return(e,r)=>s(e,new g(s,t,e,r))}constructor(e,t,s,a){if(null!=t&&(!Number.isInteger(t)||t<0))throw new i("maxRedirections must be a positive number");this.dispatch=e,this.location=null;const{maxRedirections:c,...l}=s;this.opts=l,this.maxRedirections=t,this.handler=a,this.history=[],r.isStream(this.opts.body)?(0===r.bodyLength(this.opts.body)&&this.opts.body.on("data",(function(){A(!1)})),"boolean"!=typeof this.opts.body.readableDidRead&&(this.opts.body[n]=!1,o.prototype.on.call(this.opts.body,"data",(function(){this[n]=!0})))):(this.opts.body&&"function"==typeof this.opts.body.pipeTo||this.opts.body&&"string"!=typeof this.opts.body&&!ArrayBuffer.isView(this.opts.body)&&r.isIterable(this.opts.body)&&!r.isFormDataLike(this.opts.body))&&(this.opts.body=new h(this.opts.body))}onRequestStart(e,t){this.handler.onRequestStart?.(e,{...t,history:this.history})}onRequestUpgrade(e,t,s,r){this.handler.onRequestUpgrade?.(e,t,s,r)}onResponseStart(e,t,s,n){if(this.opts.throwOnMaxRedirect&&this.history.length>=this.maxRedirections)throw new Error("max redirects");if(301!==t&&302!==t||"POST"!==this.opts.method||(this.opts.method="GET",r.isStream(this.opts.body)&&r.destroy(this.opts.body.on("error",l)),this.opts.body=null),303===t&&"HEAD"!==this.opts.method&&(this.opts.method="GET",r.isStream(this.opts.body)&&r.destroy(this.opts.body.on("error",l)),this.opts.body=null),this.location=this.history.length>=this.maxRedirections||r.isDisturbed(this.opts.body)||-1===a.indexOf(t)?null:s.location,this.opts.origin&&this.history.push(new URL(this.opts.path,this.opts.origin)),!this.location)return void this.handler.onResponseStart?.(e,t,s,n);const{origin:o,pathname:c,search:h}=r.parseURL(new URL(this.location,this.opts.origin&&new URL(this.opts.path,this.opts.origin))),g=h?`${c}${h}`:c,u=`${o}${g}`;for(const e of this.history)if(e.toString()===u)throw new i(`Redirect loop detected. Cannot redirect to ${o}. This typically happens when using a Client or Pool with cross-origin redirects. Use an Agent for cross-origin redirects.`);this.opts.headers=function(e,t,s){const r=[];if(Array.isArray(e))for(let n=0;n<e.length;n+=2)d(e[n],t,s)||r.push(e[n],e[n+1]);else if(e&&"object"==typeof e){const n="function"==typeof e[Symbol.iterator]?e:Object.entries(e);for(const[e,A]of n)d(e,t,s)||r.push(e,A)}else A(null==e,"headers must be an object or an array");return r}(this.opts.headers,303===t,this.opts.origin!==o),this.opts.path=g,this.opts.origin=o,this.opts.query=null}onResponseData(e,t){this.location||this.handler.onResponseData?.(e,t)}onResponseEnd(e,t){this.location?this.dispatch(this.opts,this):this.handler.onResponseEnd(e,t)}onResponseError(e,t){this.handler.onResponseError?.(e,t)}}function d(e,t,s){if(4===e.length)return"host"===r.headerNameToString(e);if(t&&r.headerNameToString(e).startsWith("content-"))return!0;if(s&&(13===e.length||6===e.length||19===e.length)){const t=r.headerNameToString(e);return"authorization"===t||"cookie"===t||"proxy-authorization"===t}return!1}e.exports=g},6294:(e,t,s)=>{"use strict";const r=s(4589),{kRetryHandlerDefaultRetry:n}=s(257),{RequestRetryError:A}=s(4465),i=s(832),{isDisturbed:o,parseRangeHeader:a,wrapRequestBody:c}=s(2858);class l{constructor(e,{dispatch:t,handler:s}){const{retryOptions:r,...A}=e,{retry:o,maxRetries:a,maxTimeout:h,minTimeout:g,timeoutFactor:d,methods:u,errorCodes:E,retryAfter:I,statusCodes:C,throwOnError:B}=r??{};this.error=null,this.dispatch=t,this.handler=i.wrap(s),this.opts={...A,body:c(e.body)},this.retryOpts={throwOnError:B??!0,retry:o??l[n],retryAfter:I??!0,maxTimeout:h??3e4,minTimeout:g??500,timeoutFactor:d??2,maxRetries:a??5,methods:u??["GET","HEAD","OPTIONS","PUT","DELETE","TRACE"],statusCodes:C??[500,502,503,504,429],errorCodes:E??["ECONNRESET","ECONNREFUSED","ENOTFOUND","ENETDOWN","ENETUNREACH","EHOSTDOWN","EHOSTUNREACH","EPIPE","UND_ERR_SOCKET"]},this.retryCount=0,this.retryCountCheckpoint=0,this.headersSent=!1,this.start=0,this.end=null,this.etag=null}onResponseStartWithRetry(e,t,s,r,n){if(this.retryOpts.throwOnError)!1===this.retryOpts.statusCodes.includes(t)?(this.headersSent=!0,this.handler.onResponseStart?.(e,t,s,r)):this.error=n;else{if(o(this.opts.body))return this.headersSent=!0,void this.handler.onResponseStart?.(e,t,s,r);e.pause(),this.retryOpts.retry(n,{state:{counter:this.retryCount},opts:{retryOptions:this.retryOpts,...this.opts}},function(A){if(A)return this.headersSent=!0,this.headersSent=!0,this.handler.onResponseStart?.(e,t,s,r),void e.resume();this.error=n,e.resume()}.bind(this))}}onRequestStart(e,t){this.headersSent||this.handler.onRequestStart?.(e,t)}onRequestUpgrade(e,t,s,r){this.handler.onRequestUpgrade?.(e,t,s,r)}static[n](e,{state:t,opts:s},r){const{statusCode:n,code:A,headers:i}=e,{method:o,retryOptions:a}=s,{maxRetries:c,minTimeout:l,maxTimeout:h,timeoutFactor:g,statusCodes:d,errorCodes:u,methods:E}=a,{counter:I}=t;if(A&&"UND_ERR_REQ_RETRY"!==A&&!u.includes(A))return void r(e);if(Array.isArray(E)&&!E.includes(o))return void r(e);if(null!=n&&Array.isArray(d)&&!d.includes(n))return void r(e);if(I>c)return void r(e);let C=i?.["retry-after"];C&&(C=Number(C),C=Number.isNaN(C)?function(e){const t=new Date(e).getTime();return isNaN(t)?0:t-Date.now()}(i["retry-after"]):1e3*C);const B=C>0?Math.min(C,h):Math.min(l*g**(I-1),h);setTimeout((()=>r(null)),B)}onResponseStart(e,t,s,n){if(this.error=null,this.retryCount+=1,t>=300){const r=new A("Request failed",t,{headers:s,data:{count:this.retryCount}});this.onResponseStartWithRetry(e,t,s,n,r)}else{if(this.headersSent){if(206!==t&&(this.start>0||200!==t))throw new A("server does not support the range header and the payload was partially consumed",t,{headers:s,data:{count:this.retryCount}});const e=a(s["content-range"]);if(!e)throw new A("Content-Range mismatch",t,{headers:s,data:{count:this.retryCount}});if(null!=this.etag&&this.etag!==s.etag)throw new A("ETag mismatch",t,{headers:s,data:{count:this.retryCount}});const{start:n,size:i,end:o=(i?i-1:null)}=e;return r(this.start===n,"content-range mismatch"),void r(null==this.end||this.end===o,"content-range mismatch")}if(null!=this.end)throw new A("Request failed",t,{headers:s,data:{count:this.retryCount}});if(206===t){const A=a(s["content-range"]);if(null==A)return this.headersSent=!0,void this.handler.onResponseStart?.(e,t,s,n);const{start:i,size:o,end:c=(o?o-1:null)}=A;r(null!=i&&Number.isFinite(i),"content-range mismatch"),r(null!=c&&Number.isFinite(c),"invalid content-length"),this.start=i,this.end=c}if(null==this.end){const e=s["content-length"];this.end=null!=e?Number(e)-1:null}r(Number.isFinite(this.start)),r(null==this.end||Number.isFinite(this.end),"invalid content-length"),this.resume=!0,this.etag=null!=s.etag?s.etag:null,null!=this.etag&&"W"===this.etag[0]&&"/"===this.etag[1]&&(this.etag=null),this.headersSent=!0,this.handler.onResponseStart?.(e,t,s,n)}}onResponseData(e,t){this.error||(this.start+=t.length,this.handler.onResponseData?.(e,t))}onResponseEnd(e,t){if(this.error&&this.retryOpts.throwOnError)throw this.error;if(!this.error)return this.retryCount=0,this.handler.onResponseEnd?.(e,t);this.retry(e)}retry(e){if(0!==this.start){const e={range:`bytes=${this.start}-${this.end??""}`};null!=this.etag&&(e["if-match"]=this.etag),this.opts={...this.opts,headers:{...this.opts.headers,...e}}}try{this.retryCountCheckpoint=this.retryCount,this.dispatch(this.opts,this)}catch(t){this.handler.onResponseError?.(e,t)}}onResponseError(e,t){e?.aborted||o(this.opts.body)?this.handler.onResponseError?.(e,t):(this.retryCount-this.retryCountCheckpoint>0?this.retryCount=this.retryCountCheckpoint+(this.retryCount-this.retryCountCheckpoint):this.retryCount+=1,this.retryOpts.retry(t,{state:{counter:this.retryCount},opts:{retryOptions:this.retryOpts,...this.opts}},function(t){t?this.handler?.onResponseError?.(e,t):this.retry(e)}.bind(this)))}}e.exports=l},4555:(e,t,s)=>{"use strict";const{parseHeaders:r}=s(2858),{InvalidArgumentError:n}=s(4465),A=Symbol("resume");class i{#J=!1;#W=null;#_=!1;#q;[A]=null;constructor(e){this.#q=e}pause(){this.#J=!0}resume(){this.#J&&(this.#J=!1,this[A]?.())}abort(e){this.#_||(this.#_=!0,this.#W=e,this.#q(e))}get aborted(){return this.#_}get reason(){return this.#W}get paused(){return this.#J}}e.exports=class e{#U;#$;constructor(e){this.#U=e}static unwrap(t){return t.onRequestStart?new e(t):t}onConnect(e,t){this.#$=new i(e),this.#U.onRequestStart?.(this.#$,t)}onUpgrade(e,t,s){this.#U.onRequestUpgrade?.(this.#$,e,r(t),s)}onHeaders(e,t,s,n){return this.#$[A]=s,this.#U.onResponseStart?.(this.#$,e,r(t),n),!this.#$.paused}onData(e){return this.#U.onResponseData?.(this.#$,e),!this.#$.paused}onComplete(e){this.#U.onResponseEnd?.(this.#$,r(e))}onError(e){if(!this.#U.onResponseError)throw new n("invalid onError method");this.#U.onResponseError?.(this.#$,e)}}},832:(e,t,s)=>{"use strict";const{InvalidArgumentError:r}=s(4465);e.exports=class e{#U;constructor(e){this.#U=e}static wrap(t){return t.onRequestStart?t:new e(t)}onConnect(e,t){return this.#U.onConnect?.(e,t)}onHeaders(e,t,s,r){return this.#U.onHeaders?.(e,t,s,r)}onUpgrade(e,t,s){return this.#U.onUpgrade?.(e,t,s)}onData(e){return this.#U.onData?.(e)}onComplete(e){return this.#U.onComplete?.(e)}onError(e){if(!this.#U.onError)throw e;return this.#U.onError?.(e)}onRequestStart(e,t){this.#U.onConnect?.((t=>e.abort(t)),t)}onRequestUpgrade(e,t,s,r){const n=[];for(const[e,t]of Object.entries(s))n.push(Buffer.from(e),Array.isArray(t)?t.map((e=>Buffer.from(e))):Buffer.from(t));this.#U.onUpgrade?.(t,n,r)}onResponseStart(e,t,s,r){const n=[];for(const[e,t]of Object.entries(s))n.push(Buffer.from(e),Array.isArray(t)?t.map((e=>Buffer.from(e))):Buffer.from(t));!1===this.#U.onHeaders?.(t,n,(()=>e.resume()),r)&&e.pause()}onResponseData(e,t){!1===this.#U.onData?.(t)&&e.pause()}onResponseEnd(e,t){const s=[];for(const[e,r]of Object.entries(t))s.push(Buffer.from(e),Array.isArray(r)?r.map((e=>Buffer.from(e))):Buffer.from(r));this.#U.onComplete?.(s)}onResponseError(e,t){if(!this.#U.onError)throw new r("invalid onError method");this.#U.onError?.(t)}}},5752:(e,t,s)=>{"use strict";const r=s(4589),{Readable:n}=s(7075),A=s(2858),i=s(8358),o=s(9903),a=s(6607),{assertCacheStore:c,assertCacheMethods:l,makeCacheKey:h,normalizeHeaders:g,parseCacheControlHeader:d}=s(9453),{AbortError:u}=s(4465);function E(e,t,s,i,o,a){const c=A.isStream(s.body)?s.body:n.from(s.body??[]);r(!c.destroyed,"stream should not be destroyed"),r(!c.readableDidRead,"stream should not be readableDidRead");const l={resume(){c.resume()},pause(){c.pause()},get paused(){return c.isPaused()},get aborted(){return c.destroyed},get reason(){return c.errored},abort(e){c.destroy(e??new u)}};if(c.on("error",(function(t){if(!this.readableEnded){if("function"!=typeof e.onResponseError)throw t;e.onResponseError(l,t)}})).on("close",(function(){this.errored||e.onResponseEnd?.(l,{})})),e.onRequestStart?.(l,o),c.destroyed)return;const h={...s.headers,age:String(i)};a&&(h.warning='110 - "response is stale"'),e.onResponseStart?.(l,s.statusCode,h,s.statusMessage),"HEAD"===t.method?c.destroy():c.on("data",(function(t){e.onResponseData?.(l,t)}))}function I(e,t,s,r,n,o,c){if(!c)return function(e,t,s,r,n,A){if(A?.["only-if-cached"]){let e=!1;try{if("function"==typeof r.onConnect&&(r.onConnect((()=>{e=!0})),e))return;if("function"==typeof r.onHeaders&&(r.onHeaders(504,[],(()=>{}),"Gateway Timeout"),e))return;"function"==typeof r.onComplete&&r.onComplete([])}catch(e){"function"==typeof r.onError&&r.onError(e)}return!0}return e(n,new i(t,s,r))}(e,t,s,r,n,o);const l=Date.now();if(l>c.deleteAt)return e(n,new i(t,s,r));const h=Math.round((l-c.cachedAt)/1e3);if(o?.["max-age"]&&h>=o["max-age"])return e(n,r);if(function(e,t){if(t?.["no-cache"])return!0;if(e.cacheControlDirectives?.["no-cache"]&&!Array.isArray(e.cacheControlDirectives["no-cache"]))return!0;const s=Date.now();if(s>e.staleAt)return!t?.["max-stale"]||s>e.staleAt+1e3*t["max-stale"];if(t?.["min-fresh"])return e.staleAt-s<=1e3*t["min-fresh"];return!1}(c,o)){if(A.isStream(n.body)&&0!==A.bodyLength(n.body))return e(n,new i(t,s,r));if(function(e){const t=e.cacheControlDirectives?.["stale-while-revalidate"];return!!t&&Date.now()<=e.staleAt+1e3*t}(c))return E(r,n,c,h,null,!0),queueMicrotask((()=>{let r={...n.headers,"if-modified-since":new Date(c.cachedAt).toUTCString()};c.etag&&(r["if-none-match"]=c.etag),c.vary&&(r={...r,...c.vary}),e({...n,headers:r},new i(t,s,{onRequestStart(){},onRequestUpgrade(){},onResponseStart(){},onResponseData(){},onResponseEnd(){},onResponseError(){}}))})),!0;let g=!1;const d=c.cacheControlDirectives["stale-if-error"]??o?.["stale-if-error"];d&&(g=l<c.staleAt+1e3*d);let u={...n.headers,"if-modified-since":new Date(c.cachedAt).toUTCString()};return c.etag&&(u["if-none-match"]=c.etag),c.vary&&(u={...u,...c.vary}),e({...n,headers:u},new a(((e,t)=>{e?E(r,n,c,h,t,!0):A.isStream(c.body)&&c.body.on("error",(()=>{})).destroy()}),new i(t,s,r),g))}A.isStream(n.body)&&n.body.on("error",(()=>{})).destroy(),E(r,n,c,h,null,!1)}e.exports=(e={})=>{const{store:t=new o,methods:s=["GET"],cacheByDefault:r,type:n="shared"}=e;if("object"!=typeof e||null===e)throw new TypeError("expected type of opts to be an Object, got "+(null===e?"null":typeof e));if(c(t,"opts.store"),l(s,"opts.methods"),"undefined"!=typeof r&&"number"!=typeof r)throw new TypeError("expected opts.cacheByDefault to be number or undefined, got "+typeof r);if("undefined"!=typeof n&&"shared"!==n&&"private"!==n)throw new TypeError("expected opts.type to be shared, private, or undefined, got "+typeof n);const i={store:t,methods:s,cacheByDefault:r,type:n},a=A.safeHTTPMethods.filter((e=>!1===s.includes(e)));return e=>(s,r)=>{if(!s.origin||a.includes(s.method))return e(s,r);s={...s,headers:g(s)};const n=s.headers?.["cache-control"]?d(s.headers["cache-control"]):void 0;if(n?.["no-store"])return e(s,r);const A=h(s),o=t.get(A);return o&&"function"==typeof o.then?o.then((t=>{I(e,i,A,r,s,n,t)})):I(e,i,A,r,s,n,o),!0}}},4951:(e,t,s)=>{"use strict";const{createInflate:r,createGunzip:n,createBrotliDecompress:A,createZstdDecompress:i}=s(8522),{pipeline:o}=s(7075),a=s(6917),c={gzip:n,"x-gzip":n,br:A,deflate:r,compress:r,"x-compress":r,...i?{zstd:i}:{}},l=[204,304];let h=!1;class g extends a{#z=[];#X;#j;#Z;constructor(e,{skipStatusCodes:t=l,skipErrorResponses:s=!0}={}){super(e),this.#j=t,this.#Z=s}#K(e,t){return!e||t<200||(!!this.#j.includes(t)||!!(this.#Z&&t>=400))}#ee(e){const t=e.split(","),s=[];for(let e=t.length-1;e>=0;e--){const r=t[e].trim();if(r){if(!c[r])return s.length=0,s;s.push(c[r]())}}return s}#te(e,t){e.on("readable",(()=>{let s;for(;null!==(s=e.read());){if(!1===super.onResponseData(t,s))break}})),e.on("error",(e=>{super.onResponseError(t,e)}))}#se(e){const t=this.#z[0];this.#te(t,e),t.on("end",(()=>{super.onResponseEnd(e,{})}))}#re(e){const t=this.#z[this.#z.length-1];this.#te(t,e),this.#X=o(this.#z,(t=>{t?super.onResponseError(e,t):super.onResponseEnd(e,{})}))}#ne(){this.#z.length=0,this.#X=null}onResponseStart(e,t,s,r){const n=s["content-encoding"];if(this.#K(n,t))return super.onResponseStart(e,t,s,r);const A=this.#ee(n.toLowerCase());if(0===A.length)return this.#ne(),super.onResponseStart(e,t,s,r);this.#z=A;const{"content-encoding":i,"content-length":o,...a}=s;1===this.#z.length?this.#se(e):this.#re(e),super.onResponseStart(e,t,a,r)}onResponseData(e,t){this.#z.length>0?this.#z[0].write(t):super.onResponseData(e,t)}onResponseEnd(e,t){if(this.#z.length>0)return this.#z[0].end(),void this.#ne();super.onResponseEnd(e,t)}onResponseError(e,t){if(this.#z.length>0){for(const e of this.#z)e.destroy(t);this.#ne()}super.onResponseError(e,t)}}e.exports=function(e={}){return h||(process.emitWarning("DecompressInterceptor is experimental and subject to change","ExperimentalWarning"),h=!0),t=>(s,r)=>{const n=new g(r,e);return t(s,n)}}},6677:(e,t,s)=>{"use strict";const{isIP:r}=s(7030),{lookup:n}=s(610),A=s(6917),{InvalidArgumentError:i,InformationalError:o}=s(4465),a=Math.pow(2,31)-1;class c{#Ae=0;#ie=0;#oe=new Map;dualStack=!0;affinity=null;lookup=null;pick=null;constructor(e){this.#Ae=e.maxTTL,this.#ie=e.maxItems,this.dualStack=e.dualStack,this.affinity=e.affinity,this.lookup=e.lookup??this.#ae,this.pick=e.pick??this.#ce}get full(){return this.#oe.size===this.#ie}runLookup(e,t,s){const r=this.#oe.get(e.hostname);if(null==r&&this.full)return void s(null,e);const n={affinity:this.affinity,dualStack:this.dualStack,lookup:this.lookup,pick:this.pick,...t.dns,maxTTL:this.#Ae,maxItems:this.#ie};if(null==r)this.lookup(e,n,((t,r)=>{if(t||null==r||0===r.length)return void s(t??new o("No DNS entries found"));this.setRecords(e,r);const A=this.#oe.get(e.hostname),i=this.pick(e,A,n.affinity);let a;a="number"==typeof i.port?`:${i.port}`:""!==e.port?`:${e.port}`:"",s(null,new URL(`${e.protocol}//${6===i.family?`[${i.address}]`:i.address}${a}`))}));else{const A=this.pick(e,r,n.affinity);if(null==A)return this.#oe.delete(e.hostname),void this.runLookup(e,t,s);let i;i="number"==typeof A.port?`:${A.port}`:""!==e.port?`:${e.port}`:"",s(null,new URL(`${e.protocol}//${6===A.family?`[${A.address}]`:A.address}${i}`))}}#ae(e,t,s){n(e.hostname,{all:!0,family:!1===this.dualStack?this.affinity:0,order:"ipv4first"},((e,t)=>{if(e)return s(e);const r=new Map;for(const e of t)r.set(`${e.address}:${e.family}`,e);s(null,r.values())}))}#ce(e,t,s){let r=null;const{records:n,offset:A}=t;let i;if(this.dualStack?(null==s&&(null==A||A===a?(t.offset=0,s=4):(t.offset++,s=1&~t.offset?4:6)),i=null!=n[s]&&n[s].ips.length>0?n[s]:n[4===s?6:4]):i=n[s],null==i||0===i.ips.length)return r;null==i.offset||i.offset===a?i.offset=0:i.offset++;const o=i.offset%i.ips.length;return r=i.ips[o]??null,null==r?r:Date.now()-r.timestamp>r.ttl?(i.ips.splice(o,1),this.pick(e,t,s)):r}pickFamily(e,t){const s=this.#oe.get(e.hostname)?.records;if(!s)return null;const r=s[t];if(!r)return null;null==r.offset||r.offset===a?r.offset=0:r.offset++;const n=r.offset%r.ips.length,A=r.ips[n]??null;return null==A||Date.now()-A.timestamp>A.ttl&&r.ips.splice(n,1),A}setRecords(e,t){const s=Date.now(),r={records:{4:null,6:null}};for(const e of t){e.timestamp=s,"number"==typeof e.ttl?e.ttl=Math.min(e.ttl,this.#Ae):e.ttl=this.#Ae;const t=r.records[e.family]??{ips:[]};t.ips.push(e),r.records[e.family]=t}this.#oe.set(e.hostname,r)}deleteRecords(e){this.#oe.delete(e.hostname)}getHandler(e,t){return new l(this,e,t)}}class l extends A{#le=null;#p=null;#he=null;#ge=null;#$=null;#de=null;#ue=!0;constructor(e,{origin:t,handler:s,dispatch:r,newOrigin:n},A){super(s),this.#ge=t,this.#de=n,this.#p={...A},this.#le=e,this.#he=r}onResponseError(e,t){switch(t.code){case"ETIMEDOUT":case"ECONNREFUSED":if(this.#le.dualStack){if(!this.#ue)return void super.onResponseError(e,t);this.#ue=!1;const s="["===this.#de.hostname[0]?4:6,r=this.#le.pickFamily(this.#ge,s);if(null==r)return void super.onResponseError(e,t);let n;n="number"==typeof r.port?`:${r.port}`:""!==this.#ge.port?`:${this.#ge.port}`:"";const A={...this.#p,origin:`${this.#ge.protocol}//${6===r.family?`[${r.address}]`:r.address}${n}`};return void this.#he(A,this)}super.onResponseError(e,t);break;case"ENOTFOUND":this.#le.deleteRecords(this.#ge),super.onResponseError(e,t);break;default:super.onResponseError(e,t)}}}e.exports=e=>{if(null!=e?.maxTTL&&("number"!=typeof e?.maxTTL||e?.maxTTL<0))throw new i("Invalid maxTTL. Must be a positive number");if(null!=e?.maxItems&&("number"!=typeof e?.maxItems||e?.maxItems<1))throw new i("Invalid maxItems. Must be a positive number and greater than zero");if(null!=e?.affinity&&4!==e?.affinity&&6!==e?.affinity)throw new i("Invalid affinity. Must be either 4 or 6");if(null!=e?.dualStack&&"boolean"!=typeof e?.dualStack)throw new i("Invalid dualStack. Must be a boolean");if(null!=e?.lookup&&"function"!=typeof e?.lookup)throw new i("Invalid lookup. Must be a function");if(null!=e?.pick&&"function"!=typeof e?.pick)throw new i("Invalid pick. Must be a function");const t=e?.dualStack??!0;let s;s=t?e?.affinity??null:e?.affinity??4;const n=new c({maxTTL:e?.maxTTL??1e4,lookup:e?.lookup??null,pick:e?.pick??null,dualStack:t,affinity:s,maxItems:e?.maxItems??1/0});return e=>function(t,s){const A=t.origin.constructor===URL?t.origin:new URL(t.origin);return 0!==r(A.hostname)?e(t,s):(n.runLookup(A,t,((r,i)=>{if(r)return s.onResponseError(null,r);const o={...t,servername:A.hostname,origin:i.origin,headers:{host:A.host,...t.headers}};e(o,n.getHandler({origin:A,dispatch:e,handler:s,newOrigin:i},t))})),!0)}}},3562:(e,t,s)=>{"use strict";const{InvalidArgumentError:r,RequestAbortedError:n}=s(4465),A=s(6917);class i extends A{#t=1048576;#Ee=!1;#r=0;#$=null;aborted=!1;reason=!1;constructor({maxSize:e,signal:t},s){if(null!=e&&(!Number.isFinite(e)||e<1))throw new r("maxSize must be a number greater than 0");super(s),this.#t=e??this.#t}#q(e){this.aborted=!0,this.reason=e}onRequestStart(e,t){return e.abort=this.#q.bind(this),this.#$=e,super.onRequestStart(e,t)}onResponseStart(e,t,s,r){const A=s["content-length"];if(null!=A&&A>this.#t)throw new n(`Response size (${A}) larger than maxSize (${this.#t})`);return!0===this.aborted||super.onResponseStart(e,t,s,r)}onResponseError(e,t){this.#Ee||(t=this.#$?.reason??t,super.onResponseError(e,t))}onResponseData(e,t){return this.#r=this.#r+t.length,this.#r>=this.#t&&(this.#Ee=!0,!0===this.aborted?super.onResponseError(e,this.reason):super.onResponseEnd(e,{})),!0}onResponseEnd(e,t){this.#Ee||(!0!==this.#$.aborted?super.onResponseEnd(e,t):super.onResponseError(e,this.reason))}}e.exports=function({maxSize:e}={maxSize:1048576}){return t=>function(s,r){const{dumpMaxSize:n=e}=s,A=new i({maxSize:n,signal:s.signal},r);return t(s,A)}}},5132:(e,t,s)=>{"use strict";const r=s(8064);e.exports=function({maxRedirections:e}={}){return t=>function(s,n){const{maxRedirections:A=e,...i}=s;if(null==A||0===A)return t(s,n);const o={...i},a=new r(t,A,o,n);return t(o,a)}}},2936:(e,t,s)=>{"use strict";const r=s(6917),{ResponseError:n}=s(4465);class A extends r{#Ie;#Ce;#Be;#Qe;#pe;constructor(e,{handler:t}){super(t)}#fe(e){return 0===(this.#Ce??"").indexOf(e)}onRequestStart(e,t){return this.#Ie=0,this.#Ce=null,this.#Be=null,this.#Qe=null,this.#pe="",super.onRequestStart(e,t)}onResponseStart(e,t,s,r){if(this.#Ie=t,this.#Qe=s,this.#Ce=s["content-type"],this.#Ie<400)return super.onResponseStart(e,t,s,r);(this.#fe("application/json")||this.#fe("text/plain"))&&(this.#Be=new TextDecoder("utf-8"))}onResponseData(e,t){if(this.#Ie<400)return super.onResponseData(e,t);this.#pe+=this.#Be?.decode(t,{stream:!0})??""}onResponseEnd(e,t){if(this.#Ie>=400){if(this.#pe+=this.#Be?.decode(void 0,{stream:!1})??"",this.#fe("application/json"))try{this.#pe=JSON.parse(this.#pe)}catch{}let t;const s=Error.stackTraceLimit;Error.stackTraceLimit=0;try{t=new n("Response Error",this.#Ie,{body:this.#pe,headers:this.#Qe})}finally{Error.stackTraceLimit=s}super.onResponseError(e,t)}else super.onResponseEnd(e,t)}onResponseError(e,t){super.onResponseError(e,t)}}e.exports=()=>e=>function(t,s){return e(t,new A(t,{handler:s}))}},532:(e,t,s)=>{"use strict";const r=s(6294);e.exports=e=>t=>function(s,n){return t(s,new r({...s,retryOptions:{...e,...s.retryOptions}},{handler:n,dispatch:t}))}},4178:(e,t,s)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.SPECIAL_HEADERS=t.MINOR=t.MAJOR=t.HTAB_SP_VCHAR_OBS_TEXT=t.QUOTED_STRING=t.CONNECTION_TOKEN_CHARS=t.HEADER_CHARS=t.TOKEN=t.HEX=t.URL_CHAR=t.USERINFO_CHARS=t.MARK=t.ALPHANUM=t.NUM=t.HEX_MAP=t.NUM_MAP=t.ALPHA=t.STATUSES_HTTP=t.H_METHOD_MAP=t.METHOD_MAP=t.METHODS_RTSP=t.METHODS_ICE=t.METHODS_HTTP=t.HEADER_STATE=t.FINISH=t.STATUSES=t.METHODS=t.LENIENT_FLAGS=t.FLAGS=t.TYPE=t.ERROR=void 0;const r=s(3530);t.ERROR={OK:0,INTERNAL:1,STRICT:2,CR_EXPECTED:25,LF_EXPECTED:3,UNEXPECTED_CONTENT_LENGTH:4,UNEXPECTED_SPACE:30,CLOSED_CONNECTION:5,INVALID_METHOD:6,INVALID_URL:7,INVALID_CONSTANT:8,INVALID_VERSION:9,INVALID_HEADER_TOKEN:10,INVALID_CONTENT_LENGTH:11,INVALID_CHUNK_SIZE:12,INVALID_STATUS:13,INVALID_EOF_STATE:14,INVALID_TRANSFER_ENCODING:15,CB_MESSAGE_BEGIN:16,CB_HEADERS_COMPLETE:17,CB_MESSAGE_COMPLETE:18,CB_CHUNK_HEADER:19,CB_CHUNK_COMPLETE:20,PAUSED:21,PAUSED_UPGRADE:22,PAUSED_H2_UPGRADE:23,USER:24,CB_URL_COMPLETE:26,CB_STATUS_COMPLETE:27,CB_METHOD_COMPLETE:32,CB_VERSION_COMPLETE:33,CB_HEADER_FIELD_COMPLETE:28,CB_HEADER_VALUE_COMPLETE:29,CB_CHUNK_EXTENSION_NAME_COMPLETE:34,CB_CHUNK_EXTENSION_VALUE_COMPLETE:35,CB_RESET:31,CB_PROTOCOL_COMPLETE:38},t.TYPE={BOTH:0,REQUEST:1,RESPONSE:2},t.FLAGS={CONNECTION_KEEP_ALIVE:1,CONNECTION_CLOSE:2,CONNECTION_UPGRADE:4,CHUNKED:8,UPGRADE:16,CONTENT_LENGTH:32,SKIPBODY:64,TRAILING:128,TRANSFER_ENCODING:512},t.LENIENT_FLAGS={HEADERS:1,CHUNKED_LENGTH:2,KEEP_ALIVE:4,TRANSFER_ENCODING:8,VERSION:16,DATA_AFTER_CLOSE:32,OPTIONAL_LF_AFTER_CR:64,OPTIONAL_CRLF_AFTER_CHUNK:128,OPTIONAL_CR_BEFORE_LF:256,SPACES_AFTER_CHUNK_SIZE:512},t.METHODS={DELETE:0,GET:1,HEAD:2,POST:3,PUT:4,CONNECT:5,OPTIONS:6,TRACE:7,COPY:8,LOCK:9,MKCOL:10,MOVE:11,PROPFIND:12,PROPPATCH:13,SEARCH:14,UNLOCK:15,BIND:16,REBIND:17,UNBIND:18,ACL:19,REPORT:20,MKACTIVITY:21,CHECKOUT:22,MERGE:23,"M-SEARCH":24,NOTIFY:25,SUBSCRIBE:26,UNSUBSCRIBE:27,PATCH:28,PURGE:29,MKCALENDAR:30,LINK:31,UNLINK:32,SOURCE:33,PRI:34,DESCRIBE:35,ANNOUNCE:36,SETUP:37,PLAY:38,PAUSE:39,TEARDOWN:40,GET_PARAMETER:41,SET_PARAMETER:42,REDIRECT:43,RECORD:44,FLUSH:45,QUERY:46},t.STATUSES={CONTINUE:100,SWITCHING_PROTOCOLS:101,PROCESSING:102,EARLY_HINTS:103,RESPONSE_IS_STALE:110,REVALIDATION_FAILED:111,DISCONNECTED_OPERATION:112,HEURISTIC_EXPIRATION:113,MISCELLANEOUS_WARNING:199,OK:200,CREATED:201,ACCEPTED:202,NON_AUTHORITATIVE_INFORMATION:203,NO_CONTENT:204,RESET_CONTENT:205,PARTIAL_CONTENT:206,MULTI_STATUS:207,ALREADY_REPORTED:208,TRANSFORMATION_APPLIED:214,IM_USED:226,MISCELLANEOUS_PERSISTENT_WARNING:299,MULTIPLE_CHOICES:300,MOVED_PERMANENTLY:301,FOUND:302,SEE_OTHER:303,NOT_MODIFIED:304,USE_PROXY:305,SWITCH_PROXY:306,TEMPORARY_REDIRECT:307,PERMANENT_REDIRECT:308,BAD_REQUEST:400,UNAUTHORIZED:401,PAYMENT_REQUIRED:402,FORBIDDEN:403,NOT_FOUND:404,METHOD_NOT_ALLOWED:405,NOT_ACCEPTABLE:406,PROXY_AUTHENTICATION_REQUIRED:407,REQUEST_TIMEOUT:408,CONFLICT:409,GONE:410,LENGTH_REQUIRED:411,PRECONDITION_FAILED:412,PAYLOAD_TOO_LARGE:413,URI_TOO_LONG:414,UNSUPPORTED_MEDIA_TYPE:415,RANGE_NOT_SATISFIABLE:416,EXPECTATION_FAILED:417,IM_A_TEAPOT:418,PAGE_EXPIRED:419,ENHANCE_YOUR_CALM:420,MISDIRECTED_REQUEST:421,UNPROCESSABLE_ENTITY:422,LOCKED:423,FAILED_DEPENDENCY:424,TOO_EARLY:425,UPGRADE_REQUIRED:426,PRECONDITION_REQUIRED:428,TOO_MANY_REQUESTS:429,REQUEST_HEADER_FIELDS_TOO_LARGE_UNOFFICIAL:430,REQUEST_HEADER_FIELDS_TOO_LARGE:431,LOGIN_TIMEOUT:440,NO_RESPONSE:444,RETRY_WITH:449,BLOCKED_BY_PARENTAL_CONTROL:450,UNAVAILABLE_FOR_LEGAL_REASONS:451,CLIENT_CLOSED_LOAD_BALANCED_REQUEST:460,INVALID_X_FORWARDED_FOR:463,REQUEST_HEADER_TOO_LARGE:494,SSL_CERTIFICATE_ERROR:495,SSL_CERTIFICATE_REQUIRED:496,HTTP_REQUEST_SENT_TO_HTTPS_PORT:497,INVALID_TOKEN:498,CLIENT_CLOSED_REQUEST:499,INTERNAL_SERVER_ERROR:500,NOT_IMPLEMENTED:501,BAD_GATEWAY:502,SERVICE_UNAVAILABLE:503,GATEWAY_TIMEOUT:504,HTTP_VERSION_NOT_SUPPORTED:505,VARIANT_ALSO_NEGOTIATES:506,INSUFFICIENT_STORAGE:507,LOOP_DETECTED:508,BANDWIDTH_LIMIT_EXCEEDED:509,NOT_EXTENDED:510,NETWORK_AUTHENTICATION_REQUIRED:511,WEB_SERVER_UNKNOWN_ERROR:520,WEB_SERVER_IS_DOWN:521,CONNECTION_TIMEOUT:522,ORIGIN_IS_UNREACHABLE:523,TIMEOUT_OCCURED:524,SSL_HANDSHAKE_FAILED:525,INVALID_SSL_CERTIFICATE:526,RAILGUN_ERROR:527,SITE_IS_OVERLOADED:529,SITE_IS_FROZEN:530,IDENTITY_PROVIDER_AUTHENTICATION_ERROR:561,NETWORK_READ_TIMEOUT:598,NETWORK_CONNECT_TIMEOUT:599},t.FINISH={SAFE:0,SAFE_WITH_CB:1,UNSAFE:2},t.HEADER_STATE={GENERAL:0,CONNECTION:1,CONTENT_LENGTH:2,TRANSFER_ENCODING:3,UPGRADE:4,CONNECTION_KEEP_ALIVE:5,CONNECTION_CLOSE:6,CONNECTION_UPGRADE:7,TRANSFER_ENCODING_CHUNKED:8},t.METHODS_HTTP=[t.METHODS.DELETE,t.METHODS.GET,t.METHODS.HEAD,t.METHODS.POST,t.METHODS.PUT,t.METHODS.CONNECT,t.METHODS.OPTIONS,t.METHODS.TRACE,t.METHODS.COPY,t.METHODS.LOCK,t.METHODS.MKCOL,t.METHODS.MOVE,t.METHODS.PROPFIND,t.METHODS.PROPPATCH,t.METHODS.SEARCH,t.METHODS.UNLOCK,t.METHODS.BIND,t.METHODS.REBIND,t.METHODS.UNBIND,t.METHODS.ACL,t.METHODS.REPORT,t.METHODS.MKACTIVITY,t.METHODS.CHECKOUT,t.METHODS.MERGE,t.METHODS["M-SEARCH"],t.METHODS.NOTIFY,t.METHODS.SUBSCRIBE,t.METHODS.UNSUBSCRIBE,t.METHODS.PATCH,t.METHODS.PURGE,t.METHODS.MKCALENDAR,t.METHODS.LINK,t.METHODS.UNLINK,t.METHODS.PRI,t.METHODS.SOURCE,t.METHODS.QUERY],t.METHODS_ICE=[t.METHODS.SOURCE],t.METHODS_RTSP=[t.METHODS.OPTIONS,t.METHODS.DESCRIBE,t.METHODS.ANNOUNCE,t.METHODS.SETUP,t.METHODS.PLAY,t.METHODS.PAUSE,t.METHODS.TEARDOWN,t.METHODS.GET_PARAMETER,t.METHODS.SET_PARAMETER,t.METHODS.REDIRECT,t.METHODS.RECORD,t.METHODS.FLUSH,t.METHODS.GET,t.METHODS.POST],t.METHOD_MAP=(0,r.enumToMap)(t.METHODS),t.H_METHOD_MAP=Object.fromEntries(Object.entries(t.METHODS).filter((([e])=>e.startsWith("H")))),t.STATUSES_HTTP=[t.STATUSES.CONTINUE,t.STATUSES.SWITCHING_PROTOCOLS,t.STATUSES.PROCESSING,t.STATUSES.EARLY_HINTS,t.STATUSES.RESPONSE_IS_STALE,t.STATUSES.REVALIDATION_FAILED,t.STATUSES.DISCONNECTED_OPERATION,t.STATUSES.HEURISTIC_EXPIRATION,t.STATUSES.MISCELLANEOUS_WARNING,t.STATUSES.OK,t.STATUSES.CREATED,t.STATUSES.ACCEPTED,t.STATUSES.NON_AUTHORITATIVE_INFORMATION,t.STATUSES.NO_CONTENT,t.STATUSES.RESET_CONTENT,t.STATUSES.PARTIAL_CONTENT,t.STATUSES.MULTI_STATUS,t.STATUSES.ALREADY_REPORTED,t.STATUSES.TRANSFORMATION_APPLIED,t.STATUSES.IM_USED,t.STATUSES.MISCELLANEOUS_PERSISTENT_WARNING,t.STATUSES.MULTIPLE_CHOICES,t.STATUSES.MOVED_PERMANENTLY,t.STATUSES.FOUND,t.STATUSES.SEE_OTHER,t.STATUSES.NOT_MODIFIED,t.STATUSES.USE_PROXY,t.STATUSES.SWITCH_PROXY,t.STATUSES.TEMPORARY_REDIRECT,t.STATUSES.PERMANENT_REDIRECT,t.STATUSES.BAD_REQUEST,t.STATUSES.UNAUTHORIZED,t.STATUSES.PAYMENT_REQUIRED,t.STATUSES.FORBIDDEN,t.STATUSES.NOT_FOUND,t.STATUSES.METHOD_NOT_ALLOWED,t.STATUSES.NOT_ACCEPTABLE,t.STATUSES.PROXY_AUTHENTICATION_REQUIRED,t.STATUSES.REQUEST_TIMEOUT,t.STATUSES.CONFLICT,t.STATUSES.GONE,t.STATUSES.LENGTH_REQUIRED,t.STATUSES.PRECONDITION_FAILED,t.STATUSES.PAYLOAD_TOO_LARGE,t.STATUSES.URI_TOO_LONG,t.STATUSES.UNSUPPORTED_MEDIA_TYPE,t.STATUSES.RANGE_NOT_SATISFIABLE,t.STATUSES.EXPECTATION_FAILED,t.STATUSES.IM_A_TEAPOT,t.STATUSES.PAGE_EXPIRED,t.STATUSES.ENHANCE_YOUR_CALM,t.STATUSES.MISDIRECTED_REQUEST,t.STATUSES.UNPROCESSABLE_ENTITY,t.STATUSES.LOCKED,t.STATUSES.FAILED_DEPENDENCY,t.STATUSES.TOO_EARLY,t.STATUSES.UPGRADE_REQUIRED,t.STATUSES.PRECONDITION_REQUIRED,t.STATUSES.TOO_MANY_REQUESTS,t.STATUSES.REQUEST_HEADER_FIELDS_TOO_LARGE_UNOFFICIAL,t.STATUSES.REQUEST_HEADER_FIELDS_TOO_LARGE,t.STATUSES.LOGIN_TIMEOUT,t.STATUSES.NO_RESPONSE,t.STATUSES.RETRY_WITH,t.STATUSES.BLOCKED_BY_PARENTAL_CONTROL,t.STATUSES.UNAVAILABLE_FOR_LEGAL_REASONS,t.STATUSES.CLIENT_CLOSED_LOAD_BALANCED_REQUEST,t.STATUSES.INVALID_X_FORWARDED_FOR,t.STATUSES.REQUEST_HEADER_TOO_LARGE,t.STATUSES.SSL_CERTIFICATE_ERROR,t.STATUSES.SSL_CERTIFICATE_REQUIRED,t.STATUSES.HTTP_REQUEST_SENT_TO_HTTPS_PORT,t.STATUSES.INVALID_TOKEN,t.STATUSES.CLIENT_CLOSED_REQUEST,t.STATUSES.INTERNAL_SERVER_ERROR,t.STATUSES.NOT_IMPLEMENTED,t.STATUSES.BAD_GATEWAY,t.STATUSES.SERVICE_UNAVAILABLE,t.STATUSES.GATEWAY_TIMEOUT,t.STATUSES.HTTP_VERSION_NOT_SUPPORTED,t.STATUSES.VARIANT_ALSO_NEGOTIATES,t.STATUSES.INSUFFICIENT_STORAGE,t.STATUSES.LOOP_DETECTED,t.STATUSES.BANDWIDTH_LIMIT_EXCEEDED,t.STATUSES.NOT_EXTENDED,t.STATUSES.NETWORK_AUTHENTICATION_REQUIRED,t.STATUSES.WEB_SERVER_UNKNOWN_ERROR,t.STATUSES.WEB_SERVER_IS_DOWN,t.STATUSES.CONNECTION_TIMEOUT,t.STATUSES.ORIGIN_IS_UNREACHABLE,t.STATUSES.TIMEOUT_OCCURED,t.STATUSES.SSL_HANDSHAKE_FAILED,t.STATUSES.INVALID_SSL_CERTIFICATE,t.STATUSES.RAILGUN_ERROR,t.STATUSES.SITE_IS_OVERLOADED,t.STATUSES.SITE_IS_FROZEN,t.STATUSES.IDENTITY_PROVIDER_AUTHENTICATION_ERROR,t.STATUSES.NETWORK_READ_TIMEOUT,t.STATUSES.NETWORK_CONNECT_TIMEOUT],t.ALPHA=[];for(let e="A".charCodeAt(0);e<="Z".charCodeAt(0);e++)t.ALPHA.push(String.fromCharCode(e)),t.ALPHA.push(String.fromCharCode(e+32));t.NUM_MAP={0:0,1:1,2:2,3:3,4:4,5:5,6:6,7:7,8:8,9:9},t.HEX_MAP={0:0,1:1,2:2,3:3,4:4,5:5,6:6,7:7,8:8,9:9,A:10,B:11,C:12,D:13,E:14,F:15,a:10,b:11,c:12,d:13,e:14,f:15},t.NUM=["0","1","2","3","4","5","6","7","8","9"],t.ALPHANUM=t.ALPHA.concat(t.NUM),t.MARK=["-","_",".","!","~","*","'","(",")"],t.USERINFO_CHARS=t.ALPHANUM.concat(t.MARK).concat(["%",";",":","&","=","+","$",","]),t.URL_CHAR=["!",'"',"$","%","&","'","(",")","*","+",",","-",".","/",":",";","<","=",">","@","[","\\","]","^","_","`","{","|","}","~"].concat(t.ALPHANUM),t.HEX=t.NUM.concat(["a","b","c","d","e","f","A","B","C","D","E","F"]),t.TOKEN=["!","#","$","%","&","'","*","+","-",".","^","_","`","|","~"].concat(t.ALPHANUM),t.HEADER_CHARS=["\t"];for(let e=32;e<=255;e++)127!==e&&t.HEADER_CHARS.push(e);t.CONNECTION_TOKEN_CHARS=t.HEADER_CHARS.filter((e=>44!==e)),t.QUOTED_STRING=["\t"," "];for(let e=33;e<=255;e++)34!==e&&92!==e&&t.QUOTED_STRING.push(e);t.HTAB_SP_VCHAR_OBS_TEXT=["\t"," "];for(let e=33;e<=126;e++)t.HTAB_SP_VCHAR_OBS_TEXT.push(e);for(let e=128;e<=255;e++)t.HTAB_SP_VCHAR_OBS_TEXT.push(e);t.MAJOR=t.NUM_MAP,t.MINOR=t.MAJOR,t.SPECIAL_HEADERS={connection:t.HEADER_STATE.CONNECTION,"content-length":t.HEADER_STATE.CONTENT_LENGTH,"proxy-connection":t.HEADER_STATE.CONNECTION,"transfer-encoding":t.HEADER_STATE.TRANSFER_ENCODING,upgrade:t.HEADER_STATE.UPGRADE},t.default={ERROR:t.ERROR,TYPE:t.TYPE,FLAGS:t.FLAGS,LENIENT_FLAGS:t.LENIENT_FLAGS,METHODS:t.METHODS,STATUSES:t.STATUSES,FINISH:t.FINISH,HEADER_STATE:t.HEADER_STATE,ALPHA:t.ALPHA,NUM_MAP:t.NUM_MAP,HEX_MAP:t.HEX_MAP,NUM:t.NUM,ALPHANUM:t.ALPHANUM,MARK:t.MARK,USERINFO_CHARS:t.USERINFO_CHARS,URL_CHAR:t.URL_CHAR,HEX:t.HEX,TOKEN:t.TOKEN,HEADER_CHARS:t.HEADER_CHARS,CONNECTION_TOKEN_CHARS:t.CONNECTION_TOKEN_CHARS,QUOTED_STRING:t.QUOTED_STRING,HTAB_SP_VCHAR_OBS_TEXT:t.HTAB_SP_VCHAR_OBS_TEXT,MAJOR:t.MAJOR,MINOR:t.MINOR,SPECIAL_HEADERS:t.SPECIAL_HEADERS,METHODS_HTTP:t.METHODS_HTTP,METHODS_ICE:t.METHODS_ICE,METHODS_RTSP:t.METHODS_RTSP,METHOD_MAP:t.METHOD_MAP,H_METHOD_MAP:t.H_METHOD_MAP,STATUSES_HTTP:t.STATUSES_HTTP}},4744:(e,t,s)=>{"use strict";e=s.nmd(e);const{Buffer:r}=s(4573);let n;Object.defineProperty(e,"exports",{get:()=>n||(n=r.from("AGFzbQEAAAABJwdgAX8Bf2AD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AgACACNgIQIAIgADYCGAsgBUEUaigCACICRQ0AIABBFGogAjYCACACIAA2AhgLIAEgBGogBDYCACABIARBAXI2AgQgAUHY1QAoAgBHDQBBzNUAIAQ2AgAMAQsgBEH/AU0EQCAEQXhxQezVAGohAAJ/QcTVACgCACICQQEgBEEDdnQiA3FFBEBBxNUAIAIgA3I2AgAgAAwBCyAAKAIICyICIAE2AgwgACABNgIIIAEgADYCDCABIAI2AggMAQtBHyECIARB////B00EQCAEQSYgBEEIdmciAGt2QQFxIABBAXRrQT5qIQILIAEgAjYCHCABQgA3AhAgAkECdEH01wBqIQACQEHI1QAoAgAiA0EBIAJ0IgdxRQRAIAAgATYCAEHI1QAgAyAHcjYCACABIAA2AhggASABNgIIIAEgATYCDAwBCyAEQRkgAkEBdmtBACACQR9HG3QhAiAAKAIAIQACQANAIAAiAygCBEF4cSAERg0BIAJBHXYhACACQQF0IQIgAyAAQQRxakEQaiIHKAIAIgANAAsgByABNgIAIAEgAzYCGCABIAE2AgwgASABNgIIDAELIAMoAggiACABNgIMIAMgATYCCCABQQA2AhggASADNgIMIAEgADYCCAtB5NUAQeTVACgCAEEBayIAQX8gABs2AgALCwcAIAAtACgLBwAgAC0AKgsHACAALQArCwcAIAAtACkLBwAgAC8BNAsHACAALQAwC0ABBH8gACgCGCEBIAAvAS4hAiAALQAoIQMgACgCOCEEIAAQOCAAIAQ2AjggACADOgAoIAAgAjsBLiAAIAE2AhgL5YUCAgd/A34gASACaiEEAkAgACIDKAIMIgANACADKAIEBEAgAyABNgIECyMAQRBrIgkkAAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAn8CQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQ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AkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAIAMCfwJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACfwJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkAgAg7jAQABAgMEBQYHCAkKCwwNDg8QERITFBUWFxgZGhscHR4fICEjJCUnKCmeA5sDmgORA4oDgwOAA/0C+wL4AvIC8QLvAu0C6ALnAuYC5QLkAtwC2wLaAtkC2ALXAtYC1QLPAs4CzALLAsoCyQLIAscCxgLEAsMCvgK8AroCuQK4ArcCtgK1ArQCswKyArECsAKuAq0CqQKoAqcCpgKlAqQCowKiAqECoAKfApgCkAKMAosCigKBAv4B/QH8AfsB+gH5AfgB9wH1AfMB8AHrAekB6AHnAeYB5QHkAeMB4gHhAeAB3wHeAd0B3AHaAdkB2AHXAdYB1QHUAdMB0gHRAdABzwHOAc0BzAHLAcoByQHIAccBxgHFAcQBwwHCAcEBwAG/Ab4BvQG8AbsBugG5AbgBtwG2AbUBtAGzAbIBsQGwAa8BrgGtAaw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QhAEEAIQIgA0EANgIEIAMgACABEDQiAEUEQCABQQFqIQEMHQsgA0EZNgIcIAMgADYCDCADIAFBAWo2AhQM9gILIAMoAgQhAEEAIQIgA0EANgIEIAMgACABEDQiAEUEQCABQQFqIQEM7wILIANBGjYCHCADIAA2AgwgAyABQQFqNgIUDPUCCyAAQRVGDR9BACECIANBADYCHCADIAE2AhQgA0HQDzYCECADQSI2AgwM9AILIAMoAgQhACADQQA2AgQgAyAAIAEQMyIARQRAIAFBAWohAQwbCyADQRw2AhwgAyAANgIMIAMgAUEBajYCFEEAIQIM8wILIAMoAgQhACADQQA2AgQgAyAAIAEQMyIARQRAIAFBAWohAQzrAgsgA0EdNgIcIAMgADYCDCADIAFBAWo2AhRBACECDPICCyAAQTtHDQEgAUEBaiEBC0EmIQIM1wILQQAhAiADQQA2AhwgAyABNgIUIANBnxU2AhAgA0EMNgIMDO8CCyABIARHBEADQCABLQAAQSBHDYQCIAQgAUEBaiIBRw0AC0EsIQIM7wILQSwhAgzuAgsgASAERgRAQTQhAgzuAgsCQAJAA0ACQCABLQAAQQprDgQCAAADAAsgBCABQQFqIgFHDQALQTQhAgzvAgsgAygCBCEAIANBADYCBCADIAAgARAxIgBFDZ8CIANBMjYCHCADIAE2AhQgAyAANgIMQQAhAgzuAgsgAygCBCEAIANBADYCBCADIAAgARAxIgBFBEAgAUEBaiEBDJ8CCyADQTI2AhwgAyAANgIMIAMgAUEBajYCFEEAIQIM7QILIAEgBEcEQAJAA0AgAS0AAEEwayIAQf8BcUEKTwRAQTohAgzXAgsgAykDICILQpmz5syZs+bMGVYNASADIAtCCn4iCjcDICAKIACtQv8BgyILQn+FVg0BIAMgCiALfDcDICAEIAFBAWoiAUcNAAtBwAAhAgzuAgsgAygCBCEAIANBADYCBCADIAAgAUEBaiIBEDEiAA0XDOICC0HAACECDOwCCyABIARGBEBByQAhAgzsAgsCQANAAkAgAS0AAEEJaw4YAAKiAqICqQKiAqICogKiAqICogKiAqICogKiAqICogKiAqICogKiAqICogIAogILIAQgAUEBaiIBRw0AC0HJACECDOwCCyABQQFqIQEgA0Evai0AAEEBcQ2lAiADQQA2AhwgAyABNgIUIANBlxA2AhAgA0EKNgIMQQAhAgzrAgsgASAERwRAA0AgAS0AAEEgRw0VIAQgAUEBaiIBRw0AC0H4ACECDOsCC0H4ACECDOoCCyADQQI6ACgMOAtBACECIANBADYCHCADQb8LNgIQIANBAjYCDCADIAFBAWo2AhQM6AILQQAhAgzOAgtBDSECDM0CC0ETIQIMzAILQRUhAgzLAgtBFiECDMoCC0EYIQIMyQILQRkhAgzIAgtBGiECDMcCC0EbIQIMxgILQRwhAgzFAgtBHSECDMQCC0EeIQIMwwILQR8hAgzCAgtBICECDMECC0EiIQIMwAILQSMhAgy/AgtBJSECDL4CC0HlACECDL0CCyADQT02AhwgAyABNgIUIAMgADYCDEEAIQIM1QILIANBGzYCHCADIAE2AhQgA0GkHDYCECADQRU2AgxBACECDNQCCyADQSA2AhwgAyABNgIUIANBmBo2AhAgA0EVNgIMQQAhAgzTAgsgA0ETNgIcIAMgATYCFCADQZgaNgIQIANBFTYCDEEAIQIM0gILIANBCzYCHCADIAE2AhQgA0GYGjYCECADQRU2AgxBACECDNECCyADQRA2AhwgAyABNgIUIANBmBo2AhAgA0EVNgIMQQAhAgzQAgsgA0EgNgIcIAMgATYCFCADQaQcNgIQIANBFTYCDEEAIQIMzwILIANBCzYCHCADIAE2AhQgA0GkHDYCECADQRU2AgxBACECDM4CCyADQQw2AhwgAyABNgIUIANBpBw2AhAgA0EVNgIMQQAhAgzNAgtBACECIANBADYCHCADIAE2AhQgA0HdDjYCECADQRI2AgwMzAILAkADQAJAIAEtAABBCmsOBAACAgACCyAEIAFBAWoiAUcNAAtB/QEhAgzMAgsCQAJAIAMtADZBAUcNAEEAIQACQCADKAI4IgJFDQAgAigCYCICRQ0AIAMgAhEAACEACyAARQ0AIABBFUcNASADQfwBNgIcIAMgATYCFCADQdwZNgIQIANBFTYCDEEAIQIMzQILQdwBIQIMswILIANBADYCHCADIAE2AhQgA0H5CzYCECADQR82AgxBACECDMsCCwJAAkAgAy0AKEEBaw4CBAEAC0HbASECDLICC0HUASECDLECCyADQQI6ADFBACEAAkAgAygCOCICRQ0AIAIoAgAiAkUNACADIAIRAAAhAAsgAEUEQEHdASECDLECCyAAQRVHBEAgA0EANgIcIAMgATYCFCADQbQMNgIQIANBEDYCDEEAIQIMygILIANB+wE2AhwgAyABNgIUIANBgRo2AhAgA0EVNgIMQQAhAgzJAgsgASAERgRAQfoBIQIMyQILIAEtAABByABGDQEgA0EBOgAoC0HAASECDK4CC0HaASECDK0CCyABIARHBEAgA0EMNgIIIAMgATYCBEHZASECDK0CC0H5ASECDMUCCyABIARGBEBB+AEhAgzFAgsgAS0AAEHIAEcNBCABQQFqIQFB2AEhAgyrAgsgASAERgRAQfcBIQIMxAILAkACQCABLQAAQcUAaw4QAAUFBQUFBQUFBQUFBQUFAQULIAFBAWohAUHWASECDKsCCyABQQFqIQFB1wEhAgyqAgtB9gEhAiABIARGDcICIAMoAgAiACAEIAFraiEFIAEgAGtBAmohBgJAA0AgAS0AACAAQbrVAGotAABHDQMgAEECRg0BIABBAWohACAEIAFBAWoiAUcNAAsgAyAFNgIADMMCCyADKAIEIQAgA0IANwMAIAMgACAGQQFqIgEQLiIARQRAQeMBIQIMqgILIANB9QE2AhwgAyABNgIUIAMgADYCDEEAIQIMwgILQfQBIQIgASAERg3BAiADKAIAIgAgBCABa2ohBSABIABrQQFqIQYCQANAIAEtAAAgAEG41QBqLQAARw0CIABBAUYNASAAQQFqIQAgBCABQQFqIgFHDQALIAMgBTYCAAzCAgsgA0GBBDsBKCADKAIEIQAgA0IANwMAIAMgACAGQQFqIgEQLiIADQMMAgsgA0EANgIAC0EAIQIgA0EANgIcIAMgATYCFCADQeUfNgIQIANBCDYCDAy/AgtB1QEhAgylAgsgA0HzATYCHCADIAE2AhQgAyAANgIMQQAhAgy9AgtBACEAAkAgAygCOCICRQ0AIAIoAkAiAkUNACADIAIRAAAhAAsgAEUNbiAAQRVHBEAgA0EANgIcIAMgATYCFCADQYIPNgIQIANBIDYCDEEAIQIMvQILIANBjwE2AhwgAyABNgIUIANB7Bs2AhAgA0EVNgIMQQAhAgy8AgsgASAERwRAIANBDTYCCCADIAE2AgRB0wEhAgyjAgtB8gEhAgy7AgsgASAERgRAQfEBIQIMuwILAkACQAJAIAEtAABByABrDgsAAQgICAgICAgIAggLIAFBAWohAUHQASECDKMCCyABQQFqIQFB0QEhAgyiAgsgAUEBaiEBQdIBIQIMoQILQfABIQIgASAERg25AiADKAIAIgAgBCABa2ohBiABIABrQQJqIQUDQCABLQAAIABBtdUAai0AAEcNBCAAQQJGDQMgAEEBaiEAIAQgAUEBaiIBRw0ACyADIAY2AgAMuQILQe8BIQIgASAERg24AiADKAIAIgAgBCABa2ohBiABIABrQQFqIQUDQCABLQAAIABBs9UAai0AAEcNAyAAQQFGDQIgAEEBaiEAIAQgAUEBaiIBRw0ACyADIAY2AgAMuAILQe4BIQIgASAERg23AiADKAIAIgAgBCABa2ohBiABIABrQQJqIQUDQCABLQAAIABBsNUAai0AAEcNAiAAQQJGDQEgAEEBaiEAIAQgAUEBaiIBRw0ACyADIAY2AgAMtwILIAMoAgQhACADQgA3AwAgAyAAIAVBAWoiARArIgBFDQIgA0HsATYCHCADIAE2AhQgAyAANgIMQQAhAgy2AgsgA0EANgIACyADKAIEIQAgA0EANgIEIAMgACABECsiAEUNnAIgA0HtATYCHCADIAE2AhQgAyAANgIMQQAhAgy0AgtBzwEhAgyaAgtBACEAAkAgAygCOCICRQ0AIAIoAjQiAkUNACADIAIRAAAhAAsCQCAABEAgAEEVRg0BIANBADYCHCADIAE2AhQgA0HqDTYCECADQSY2AgxBACECDLQCC0HOASECDJoCCyADQesBNgIcIAMgATYCFCADQYAbNgIQIANBFTYCDEEAIQIMsgILIAEgBEYEQEHrASECDLICCyABLQAAQS9GBEAgAUEBaiEBDAELIANBADYCHCADIAE2AhQgA0GyODYCECADQQg2AgxBACECDLECC0HNASECDJcCCyABIARHBEAgA0EONgIIIAMgATYCBEHMASECDJcCC0HqASECDK8CCyABIARGBEBB6QEhAgyvAgsgAS0AAEEwayIAQf8BcUEKSQRAIAMgADoAKiABQQFqIQFBywEhAgyWAgsgAygCBCEAIANBADYCBCADIAAgARAvIgBFDZcCIANB6AE2AhwgAyABNgIUIAMgADYCDEEAIQIMrgILIAEgBEYEQEHnASECDK4CCwJAIAEtAABBLkYEQCABQQFqIQEMAQsgAygCBCEAIANBADYCBCADIAAgARAvIgBFDZgCIANB5gE2AhwgAyABNgIUIAMgADYCDEEAIQIMrgILQcoBIQIMlAILIAEgBEYEQEHlASECDK0CC0EAIQBBASEFQQEhB0EAIQICQAJAAkACQAJAAn8CQAJAAkACQAJAAkACQCABLQAAQTBrDgoKCQABAgMEBQYICwtBAgwGC0EDDAULQQQMBAtBBQwDC0EGDAILQQcMAQtBCAshAkEAIQVBACEHDAILQQkhAkEBIQBBACEFQQAhBwwBC0EAIQVBASECCyADIAI6ACsgAUEBaiEBAkACQCADLQAuQRBxDQACQAJAAkAgAy0AKg4DAQACBAsgB0UNAwwCCyAADQEMAgsgBUUNAQsgAygCBCEAIANBADYCBCADIAAgARAvIgBFDQIgA0HiATYCHCADIAE2AhQgAyAANgIMQQAhAgyvAgsgAygCBCEAIANBADYCBCADIAAgARAvIgBFDZoCIANB4wE2AhwgAyABNgIUIAMgADYCDEEAIQIMrgILIAMoAgQhACADQQA2AgQgAyAAIAEQLyIARQ2YAiADQeQBNgIcIAMgATYCFCADIAA2AgwMrQILQckBIQIMkwILQQAhAAJAIAMoAjgiAkUNACACKAJEIgJFDQAgAyACEQAAIQALAkAgAARAIABBFUYNASADQQA2AhwgAyABNgIUIANBpA02AhAgA0EhNgIMQQAhAgytAgtByAEhAgyTAgsgA0HhATYCHCADIAE2AhQgA0HQGjYCECADQRU2AgxBACECDKsCCyABIARGBEBB4QEhAgyrAgsCQCABLQAAQSBGBEAgA0EAOwE0IAFBAWohAQwBCyADQ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AUcNAAtB2wEhAgymAgsgAygCBCEAIANBADYCBCADIAAgARAtIgBFBEAgAUEBaiEBDAQLIANB2gE2AhwgAyAANgIMIAMgAUEBajYCFEEAIQIMpQILIAMoAgQhACADQQA2AgQgAyAAIAEQLSIADQEgAUEBagshAUHBASECDIoCCyADQdkBNgIcIAMgADYCDCADIAFBAWo2AhRBACECDKICC0HCASECDIgCCyADQS9qLQAAQQFxDQEgA0EANgIcIAMgATYCFCADQeQcNgIQIANBGTYCDEEAIQIMoAILIAEgBEYEQEHZASECDKACCwJAAkACQCABLQAAQQprDgQBAgIAAgsgAUEBaiEBDAILIAFBAWohAQwBCyADLQAuQcAAcUUNAQtBACEAAkAgAygCOCICRQ0AIAIoAjwiAkUNACADIAIRAAAhAAsgAEUNoAEgAEEVRgRAIANB2QA2AhwgAyABNgIUIANBtxo2AhAgA0EVNgIMQQAhAgyfAgsgA0EANgIcIAMgATYCFCADQYANNgIQIANBGzYCDEEAIQIMngILIANBADYCHCADIAE2AhQgA0HcKDYCECADQQI2AgxBACECDJ0CCyABIARHBEAgA0EMNgIIIAMgATYCBEG/ASECDIQCC0HYASECDJwCCyABIARGBEBB1wEhAgycAgsCQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAIAEtAABBwQBrDhUAAQIDWgQFBlpaWgcICQoLDA0ODxBaCyABQQFqIQFB+wAhAgySAgsgAUEBaiEBQfwAIQIMkQILIAFBAWohAUGBASECDJACCyABQQFqIQFBhQEhAgyPAgsgAUEBaiEBQYYBIQIMjgILIAFBAWohAUGJASECDI0CCyABQQFqIQFBigEhAgyMAgsgAUEBaiEBQY0BIQIMiwILIAFBAWohAUGWASECDIoCCyABQQFqIQFBlwEhAgyJAgsgAUEBaiEBQZgBIQIMiAILIAFBAWohAUGlASECDIcCCyABQQFqIQFBpgEhAgyGAgsgAUEBaiEBQawBIQIMhQILIAFBAWohAUG0ASECDIQCCyABQQFqIQFBtwEhAgyDAgsgAUEBaiEBQb4BIQIMggILIAE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1ABqLQAARw0eIABBAUYNASAAQQFqIQAgBCABQQFqIgFHDQALIAMgBTYCAAzyAQsgA0EANgIAIAZBAWohAUELDB4LIAEgBEYEQEGsASECDPEBCwJAAkAgAS0AAEHBAGsOAwAgASALIAFBAWohAUGQASECDNgBCyABQQFqIQFBkwEhAgzXAQsgASAERgRAQasBIQIM8AELAkACQCABLQAAQcEAaw4PAB8fHx8fHx8fHx8fHx8BHwsgAUEBaiEBQZEBIQIM1wELIAFBAWohAUGSASECDNYBCyABIARGBEBBqgEhAgzvAQsgAS0AAEHMAEcNHCABQQFqIQFBCgwbC0GpASECIAEgBEYN7QEgAygCACIAIAQgAWtqIQUgASAAa0EFaiEGAkADQCABLQAAIABB0dQAai0AAEcNGiAAQQVGDQEgAEEBaiEAIAQgAUEBaiIBRw0ACyADIAU2AgAM7gELIANBADYCACAGQQFqIQFBHgwaC0GoASECIAEgBEYN7AEgAygCACIAIAQgAWtqIQUgASAAa0EGaiEGAkADQCABLQAAIABBytQAai0AAEcNGSAAQQZGDQEgAEEBaiEAIAQgAUEBaiIBRw0ACyADIAU2AgAM7QELIANBADYCACAGQQFqIQFBFQwZC0GnASECIAEgBEYN6wEgAygCACIAIAQgAWtqIQUgASAAa0ECaiEGAkADQCABLQAAIABBx9QAai0AAEcNGCAAQQJGDQEgAEEBaiEAIAQgAUEBaiIBRw0ACyADIAU2AgAM7AELIANBADYCACAGQQFqIQFBFwwYC0GmASECIAEgBEYN6gEgAygCACIAIAQgAWtqIQUgASAAa0EFaiEGAkADQCABLQAAIABBwdQAai0AAEcNFyAAQQVGDQEgAEEBaiEAIAQgAUEBaiIBRw0ACyADIAU2AgAM6wELIANBADYCACAGQQFqIQFBGAwXCyABIARGBEBBpQEhAgzqAQsCQAJAIAEtAABByQBrDgcAGRkZGRkBGQsgAUEBaiEBQYsBIQIM0QELIAFBAWohAUGMASECDNABC0GkASECIAEgBEYN6AEgAygCACIAIAQgAWtqIQUgASAAa0EBaiEGAkADQCABLQAAIABBptUA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gAGtBBWohBgJAA0AgAS0AACAAQaDUAGotAABHDQIgAEEFRg0BIABBAWohACAEIAFBAWoiAUcNAAsgAyAFNgIADNYBCyADQQA2AgAgBkEBaiEBQSQMAgsgA0EANgIADAILIAEgBEYEQEGRASECDNQBCyABLQAAQcwARw0BIAFBAWohAUETCzoAKSADKAIEIQAgA0EANgIEIAMgACABEC4iAA0CDAELQQAhAiADQQA2AhwgAyABNgIUIANB/h82AhAgA0EGNgIMDNEBC0H4ACECDLcBCyADQZABNgIcIAMgATYCFCADIAA2AgxBACECDM8BC0EAIQACQCADKAI4IgJFDQAgAigCQCICRQ0AIAMgAhEAACEACyAARQ0AIABBFUYNASADQQA2AhwgAyABNgIUIANBgg82AhAgA0EgNgIMQQAhAgzOAQtB9wAhAgy0AQsgA0GPATYCHCADIAE2AhQgA0HsGzYCECADQRU2AgxBACECDMwBCyABIARGBEBBjwEhAgzMAQsCQCABLQAAQSBGBEAgAUEBaiEBDAELIANBADYCHCADIAE2AhQgA0GbHzYCECADQQY2AgxBACECDMwBC0ECIQIMsgELA0AgAS0AAEEgRw0CIAQgAUEBaiIBRw0AC0GOASECDMoBCyABIARGBEBBjQEhAgzKAQsCQCABLQAAQQlrDgRKAABKAAtB9QAhAgywAQsgAy0AKUEFRgRAQfYAIQIMsAELQfQAIQIMrwELIAEgBEYEQEGMASECDMgBCyADQRA2AgggAyABNgIEDAoLIAEgBEYEQEGLASECDMcBCwJAIAEtAABBCWsOBEcAAEcAC0HzACECDK0BCyABIARHBEAgA0EQNgIIIAMgATYCBEHxACECDK0BC0GKASECDMUBCwJAIAEgBEcEQANAIAEtAABBoNAAai0AACIAQQNHBEACQCAAQQFrDgJJAAQLQfAAIQIMrwELIAQgAUEBaiIBRw0AC0GIASECDMYBC0GIASECDMUBCyADQQA2AhwgAyABNgIUIANB2yA2AhAgA0EHNgIMQQAhAgzEAQsgASAERgRAQYkBIQIMxAELAkACQAJAIAEtAABBoNIAai0AAEEBaw4DRgIAAQtB8gAhAgys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EANgIcIAMgATYCFCADQfkPNgIQIANBBzYCDEEAIQIMtgELQewAIQIMnAELIAEgBEYEQEGCASECDLUBCyABQQFqDAILIAEgBEYEQEGBASECDLQBCyABQQFqDAELIAEgBEYNASABQQFqCyEBQQQhAgyYAQtBgAEhAgywAQsDQCABLQAAQaDMAGotAAAiAEECRwRAIABBAUcEQEHpACECDJkBCwwxCyAEIAFBAWoiAUcNAAtB/wAhAgyvAQsgASAERgRAQf4AIQIMrwELAkAgAS0AAEEJaw43LwMGLwQGBgYGBgYGBgYGBgYGBgYGBgYFBgYCBgYGBgYGBgYGBgYGBgYGBgYGBgYGBgYGBgYGAAYLIAFBAWoLIQFBBSECDJQBCyABQQFqDAYLIAMoAgQhACADQQA2AgQgAyAAIAEQLCIARQ0IIANB2wA2AhwgAyABNgIUIAMgADYCDEEAIQIMqwELIAMoAgQhACADQQA2AgQgAyAAIAEQLCIARQ0IIANB3QA2AhwgAyABNgIUIAMgADYCDEEAIQIMqgELIAMoAgQhACADQQA2AgQgAyAAIAEQLCIARQ0IIANB+gA2AhwgAyABNgIUIAMgADYCDEEAIQIMqQELIANBADYCHCADIAE2AhQgA0GNFDYCECADQQc2AgxBACECDKgBCwJAAkACQAJAA0AgAS0AAEGgygBqLQAAIgBBBUcEQAJAIABBAWsOBi4DBAUGAAYLQegAIQIMlAELIAQgAUEBaiIBRw0AC0H9ACECDKsBCyADKAIEIQAgA0EANgIEIAMgACABECwiAEUNByADQdsANgIcIAMgATYCFCADIAA2AgxBACECDKoBCyADKAIEIQAgA0EANgIEIAMgACABECwiAEUNByADQd0ANgIcIAMgATYCFCADIAA2AgxBACECDKkBCyADKAIEIQAgA0EANgIEIAMgACABECwiAEUNByADQfoANgIcIAMgATYCFCADIAA2AgxBACECDKgBCyADQQA2AhwgAyABNgIUIANB5Ag2AhAgA0EHNgIMQQAhAgynAQsgASAERg0BIAFBAWoLIQFBBiECDIwBC0H8ACECDKQBCwJAAkACQAJAA0AgAS0AAEGgyABqLQAAIgB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BIANBADYCHCADIAE2AhQgA0HqDTYCECADQSY2AgxBACECDJwBC0HhACECDIIBCyADQfMANgIcIAMgATYCFCADQYAbNgIQIANBFTYCDEEAIQIMmgELIAMtACkiAEEja0ELSQ0JAkAgAEEGSw0AQQEgAHRBygBxRQ0ADAoLQQAhAiADQQA2AhwgAyABNgIUIANB7Qk2AhAgA0EINgIMDJkBC0HyACECIAEgBEYNmAEgAygCACIAIAQgAWtqIQUgASAAa0EBaiEGAkADQCABLQAAIABBs9UAai0AAEcNBSAAQQFGDQEgAEEBaiEAIAQgAUEBaiIBRw0ACyADIAU2AgAMmQELIAMoAgQhACADQgA3AwAgAyAAIAZBAWoiARArIgAEQCADQfEANgIcIAMgATYCFCADIAA2AgxBACECDJkBC0HfACECDH8LQQAhAAJAIAMoAjgiAkUNACACKAI0IgJFDQAgAyACEQAAIQALAkAgAARAIABBFUYNASADQQA2AhwgAyABNgIUIANB6g02AhAgA0EmNgIMQQAhAgyZAQtB3gAhAgx/CyADQfAANgIcIAMgATYCFCADQYAbNgIQIANBFTYCDEEAIQIMlwELIAMtAClBIUYNBiADQQA2AhwgAyABNgIUIANBkQo2AhAgA0EINgIMQQAhAgyWAQtB7wAhAiABIARGDZUBIAMoAgAiACAEIAFraiEFIAEgAGtBAmohBgJAA0AgAS0AACAAQbDVAGotAABHDQIgAEECRg0BIABBAWohACAEIAFBAWoiAUcNAAsgAyAFNgIADJYBCyADKAIEIQAgA0IANwMAIAMgACAGQQFqIgEQKyIARQ0CIANB7QA2AhwgAyABNgIUIAMgADYCDEEAIQIMlQELIANBADYCAAsgAygCBCEAIANBADYCBCADIAAgARArIgBFDYABIANB7gA2AhwgAyABNgIUIAMgADYCDEEAIQIMkwELQdwAIQIMeQtBACEAAkAgAygCOCICRQ0AIAIoAjQiAkUNACADIAIRAAAhAAsCQCAABEAgAEEVRg0BIANBADYCHCADIAE2AhQgA0HqDTYCECADQSY2AgxBACECDJMBC0HbACECDHkLIANB7AA2AhwgAyABNgIUIANBgBs2AhAgA0EVNgIMQQAhAgyRAQsgAy0AKSIAQSNJDQAgAEEuRg0AIANBADYCHCADIAE2AhQgA0HJCTYCECADQQg2AgxBACECDJABC0HaACECDHYLIAEgBEYEQEHrACECDI8BCwJAIAEtAABBL0YEQCABQQFqIQEMAQsgA0EANgIcIAMgATYCFCADQbI4NgIQIANBCDYCDEEAIQIMjwELQdkAIQIMdQsgASAERwRAIANBDjYCCCADIAE2AgRB2AAhAgx1C0HqACECDI0BCyABIARGBEBB6QAhAgyNAQsgAS0AAEEwayIAQf8BcUEKSQRAIAMgADoAKiABQQFqIQFB1wAhAgx0CyADKAIEIQAgA0EANgIEIAMgACABEC8iAEUNeiADQegANgIcIAMgATYCFCADIAA2AgxBACECDIwBCyABIARGBEBB5wAhAgyMAQsCQCABLQAAQS5GBEAgAUEBaiEBDAELIAMoAgQhACADQQA2AgQgAyAAIAEQLyIARQ17IANB5gA2AhwgAyABNgIUIAMgADYCDEEAIQIMjAELQdYAIQIMcgsgASAERgRAQeUAIQIMiwELQQAhAEEBIQVBASEHQQAhAgJAAkACQAJAAkACfwJAAkACQAJAAkACQAJAIAEtAABBMGsOCgoJAAECAwQFBggLC0ECDAYLQQMMBQtBBAwEC0EFDAMLQQYMAgtBBwwBC0EICyECQQAhBUEAIQcMAgtBCSECQQEhAEEAIQVBACEHDAELQQAhBUEBIQILIAMgAjoAKyABQQFqIQECQAJAIAMtAC5BEHENAAJAAkACQCADLQAqDgMBAAIECyAHRQ0DDAILIAANAQwCCyAFRQ0BCyADKAIEIQAgA0EANgIEIAMgACABEC8iAEUNAiADQeIANgIcIAMgATYCFCADIAA2AgxBACECDI0BCyADKAIEIQAgA0EANgIEIAMgACABEC8iAEUNfSADQeMANgIcIAMgATYCFCADIAA2AgxBACECDIwBCyADKAIEIQAgA0EANgIEIAMgACABEC8iAEUNeyADQeQANgIcIAMgATYCFCADIAA2AgwMiwELQdQAIQIMcQsgAy0AKUEiRg2GAUHTACECDHALQQAhAAJAIAMoAjgiAkUNACACKAJEIgJFDQAgAyACEQAAIQALIABFBEBB1QAhAgxwCyAAQRVHBEAgA0EANgIcIAMgATYCFCADQaQNNgIQIANBITYCDEEAIQIMiQELIANB4QA2AhwgAyABNgIUIANB0Bo2AhAgA0EVNgIMQQAhAgyIAQsgASAERgRAQeAAIQIMiAELAkACQAJAAkACQCABLQAAQQprDgQBBAQABAsgAUEBaiEBDAELIAFBAWohASADQS9qLQAAQQFxRQ0BC0HSACECDHALIANBADYCHCADIAE2AhQgA0G2ETYCECADQQk2AgxBACECDIgBCyADQQA2AhwgAyABNgIUIANBthE2AhAgA0EJNgIMQQAhAgyHAQsgASAERgRAQd8AIQIMhwELIAEtAABBCkYEQCABQQFqIQEMCQsgAy0ALkHAAHENCCADQQA2AhwgAyABNgIUIANBthE2AhAgA0ECNgIMQQAhAgyGAQsgASAERgRAQd0AIQIMhgELIAEtAAAiAkENRgRAIAFBAWohAUHQACECDG0LIAEhACACQQlrDgQFAQEFAQsgBCABIgBGBEBB3AAhAgyFAQsgAC0AAEEKRw0AIABBAWoMAgtBACECIANBADYCHCADIAA2AhQgA0HKLTYCECADQQc2AgwMgwELIAEgBEYEQEHbACECDIMBCwJAIAEtAABBCWsOBAMAAAMACyABQQFqCyEBQc4AIQIMaAsgASAERgRAQdoAIQIMgQELIAEtAABBCWsOBAABAQABC0EAIQIgA0EANgIcIANBmhI2AhAgA0EHNgIMIAMgAUEBajYCFAx/CyADQYASOwEqQQAhAAJAIAMoAjgiAkUNACACKAI4IgJFDQAgAyACEQAAIQALIABFDQAgAEEVRw0BIANB2QA2AhwgAyABNgIUIANB6ho2AhAgA0EVNgIMQQAhAgx+C0HNACECDGQLIANBADYCHCADIAE2AhQgA0HJDTYCECADQRo2AgxBACECDHwLIAEgBEYEQEHZACECDHwLIAEtAABBIEcNPSABQQFqIQEgAy0ALkEBcQ09IANBADYCHCADIAE2AhQgA0HCHDYCECADQR42AgxBACECDHsLIAEgBEYEQEHYACECDHsLAkACQAJAAkACQCABL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AgAiAWohBiAAIAFrQQNqIQcCQANAIAFBsMEAai0AACAALQAAIgVBIHIgBSAFQcEAa0H/AXFBGkkbQf8BcUcNASABQQNGBEBBBiEBDD0LIAFBAWohASAEIABBAWoiAEcNAAsgAyAGNgIADFcLIANBADYCACAAIQEMAwsCQANAIAEtAAAiAEEgRwRAIABBCmsOBAcEBAcCCyAEIAFBAWoiAUcNAAtBOCECDFYLIABBLEcNASABQQFqIQBBASEBAkACQAJAAkACQCADLQAsQQVrDgQDAQIEAAsgACEBDAQLQQIhAQwBC0EEIQELIANBAToALCADIAMvATIgAXI7ATIgACEBDAELIAMgAy8BMkEIcjsBMiAAIQELQT4hAgw7CyADQQA6ACwLQTkhAgw5CyABIARGBEBBNiECDFILAkACQAJAAkACQCABLQAAQQprDgQAAgIBAgsgAygCBCEAIANBADYCBCADIAAgARAxIgBFDQIgA0EzNgIcIAMgATYCFCADIAA2AgxBACECDFULIAMoAgQhACADQQA2AgQgAyAAIAEQMSIARQRAIAFBAWohAQwGCyADQTI2AhwgAyAANgIMIAMgAUEBajYCFEEAIQIMVAsgAy0ALkEBcQRAQd8BIQIMOwsgAygCBCEAIANBADYCBCADIAAgARAxIgANAQxJC0E0IQIMOQsgA0E1NgIcIAMgATYCFCADIAA2AgxBACECDFELQTUhAgw3CyADQS9qLQAAQQFxDQAgA0EANgIcIAMgATYCFCADQesWNgIQIANBGTYCDEEAIQIMTwtBMyECDDULIAEgBEYEQEEyIQIMTgsCQCABLQAAQQpGBEAgAUEBaiEBDAELIANBADYCHCADIAE2AhQgA0GSFzYCECADQQM2AgxBACECDE4LQTIhAgw0CyABIARGBEBBMSECDE0LAkAgAS0AACIAQQlGDQAgAEEgRg0AQQEhAgJAIAMtACxBBWsOBAYEBQANCyADIAMvATJBCHI7ATIMDAsgAy0ALkEBcUUNASADLQAsQQhHDQAgA0EAOgAsC0E9IQIMMgsgA0EANgIcIAMgATYCFCADQcIWNgIQIANBCjYCDEEAIQIMSgtBAiECDAELQQQhAgsgA0EBOgAsIAMgAy8BMiACcjsBMgwGCyABIARGBEBBMCECDEcLIAEtAABBCkYEQCABQQFqIQEMAQsgAy0ALkEBcQ0AIANBADYCHCADIAE2AhQgA0HcKDYCECADQQI2AgxBACECDEYLQTAhAgwsCyABQQFqIQFBMSECDCsLIAEgBEYEQEEvIQIMRAsgAS0AACIAQQlHIABBIEdxRQRAIAFBAWohASADLQAuQQFxDQEgA0EANgIcIAMgATYCFCADQZcQNgIQIANBCjYCDEEAIQIMRAtBASECAkACQAJAAkACQAJAIAMtACxBAmsOBwUEBAMBAgAECyADIAMvATJBCHI7ATIMAwtBAiECDAELQQQhAgsgA0EBOgAsIAMgAy8BMiACcjsBMgtBLyECDCsLIANBADYCHCADIAE2AhQgA0GEEzYCECADQQs2AgxBACECDEMLQeEBIQIMKQsgASAERgRAQS4hAgxCCyADQQA2AgQgA0ESNgIIIAMgASABEDEiAA0BC0EuIQIMJwsgA0EtNgIcIAMgATYCFCADIAA2AgxBACECDD8LQQAhAAJAIAMoAjgiAkUNACACKAJMIgJFDQAgAyACEQAAIQALIABFDQAgAEEVRw0BIANB2AA2AhwgAyABNgIUIANBsxs2AhAgA0EVNgIMQQAhAgw+C0HMACECDCQLIANBADYCHCADIAE2AhQgA0GzDjYCECADQR02AgxBACECDDwLIAEgBEYEQEHOACECDDwLIAEtAAAiAEEgRg0CIABBOkYNAQsgA0EAOgAsQQkhAgwhCyADKAIEIQAgA0EANgIEIAMgACABEDAiAA0BDAILIAMtAC5BAXEEQEHeASECDCALIAMoAgQhACADQQA2AgQgAyAAIAEQMCIARQ0CIANBKjYCHCADIAA2AgwgAyABQQFqNgIUQQAhAgw4CyADQcsANgIcIAMgADYCDCADIAFBAWo2AhRBACECDDcLIAFBAWohAUHAACECDB0LIAFBAWohAQwsCyABIARGBEBBKyECDDULAkAgAS0AAEEKRgRAIAFBAWohAQwBCyADLQAuQcAAcUUNBgsgAy0AMkGAAXEEQEEAIQACQCADKAI4IgJFDQAgAigCXCICRQ0A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NRVRFUlVSQ0VCU0NSSUJFQVJET1dOQUNFSU5ETktDS1VCU0NSSUJFVFRQQ0VUU1BBRFRQLw==","base64"))})},7136:(e,t,s)=>{"use strict";e=s.nmd(e);const{Buffer:r}=s(4573);let n;Object.defineProperty(e,"exports",{get:()=>n||(n=r.from("AGFzbQEAAAABJwdgAX8Bf2ADf39/AX9gAn9/AGABfwBgBH9/f38Bf2AAAGADf39/AALLAQgDZW52GHdhc21fb25faGVhZGVyc19jb21wbGV0ZQAEA2VudhV3YXNtX29uX21lc3NhZ2VfYmVnaW4AAANlbnYLd2FzbV9vbl91cmwAAQNlbnYOd2FzbV9vbl9zdGF0dXMAAQNlbnYUd2FzbV9vbl9oZWFkZXJfZmllbGQAAQNlbnYUd2FzbV9vbl9oZWFkZXJfdmFsdWUAAQNlbnYMd2FzbV9vbl9ib2R5AAEDZW52GHdhc21fb25fbWVzc2FnZV9jb21wbGV0ZQAAAzU0BQYAAAMAAAAAAAADAQMAAwMDAAACAAAAAAICAgICAgICAgIBAQEBAQEBAQEBAwAAAwAAAAQFAXABExMFAwEAAgYIAX8BQcDZBAsHxQcoBm1lbW9yeQIAC19pbml0aWFsaXplAAgZX19pbmRpcmVjdF9mdW5jdGlvbl90YWJsZQEAC2xsaHR0cF9pbml0AAkYbGxodHRwX3Nob3VsZF9rZWVwX2FsaXZlADcMbGxodHRwX2FsbG9jAAsGbWFsbG9jADkLbGxodHRwX2ZyZWUADARmcmVlAAwPbGxodHRwX2dldF90eXBlAA0VbGxodHRwX2dldF9odHRwX21ham9yAA4VbGxodHRwX2dldF9odHRwX21pbm9yAA8RbGxodHRwX2dldF9tZXRob2QAEBZsbGh0dHBfZ2V0X3N0YXR1c19jb2RlABESbGxodHRwX2dldF91cGdyYWRlABIMbGxodHRwX3Jlc2V0ABMObGxodHRwX2V4ZWN1dGUAFBRsbGh0dHBfc2V0dGluZ3NfaW5pdAAVDWxsaHR0cF9maW5pc2gAFgxsbGh0dHBfcGF1c2UAFw1sbGh0d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BSAAQX5xNgIEIAEgBGogBDYCACABIARBAXI2AgQMAwtBACEACyAGRQ0AAkAgBSgCHCICQQJ0QfTXAGoiAygCACAFRgRAIAMgADYCACAADQFByNUAQcjVACgCAEF+IAJ3cTYCAAwCCyAGQRBBFCAGKAIQIAVGG2ogADYCACAARQ0BCyAAIAY2AhggBSgCECICBEAgACACNgIQIAIgADYCGAsgBUEUaigCACICRQ0AIABBFGogAjYCACACIAA2AhgLIAEgBGogBDYCACABIARBAXI2AgQgAUHY1QAoAgBHDQBBzNUAIAQ2AgAMAQsgBEH/AU0EQCAEQXhxQezVAGohAAJ/QcTVACgCACICQQEgBEEDdnQiA3FFBEBBxNUAIAIgA3I2AgAgAAwBCyAAKAIICyICIAE2AgwgACABNgIIIAEgADYCDCABIAI2AggMAQtBHyECIARB////B00EQCAEQSYgBEEIdmciAGt2QQFxIABBAXRrQT5qIQILIAEgAjYCHCABQgA3AhAgAkECdEH01wBqIQACQEHI1QAoAgAiA0EBIAJ0IgdxRQRAIAAgATYCAEHI1QAgAyAHcjYCACABIAA2AhggASABNgIIIAEgATYCDAwBCyAEQRkgAkEBdmtBACACQR9HG3QhAiAAKAIAIQACQANAIAAiAygCBEF4cSAERg0BIAJBHXYhACACQQF0IQIgAyAAQQRxakEQaiIHKAIAIgANAAsgByABNgIAIAEgAzYCGCABIAE2AgwgASABNgIIDAELIAMoAggiACABNgIMIAMgATYCCCABQQA2AhggASADNgIMIAEgADYCCAtB5NUAQeTVACgCAEEBayIAQX8gABs2AgALCwcAIAAtACgLBwAgAC0AKgsHACAALQArCwcAIAAtACkLBwAgAC8BNAsHACAALQAwC0ABBH8gACgCGCEBIAAvAS4hAiAALQAoIQMgACgCOCEEIAAQOCAAIAQ2AjggACADOgAoIAAgAjsBLiAAIAE2AhgLhocCAwd/A34BeyABIAJqIQQCQCAAIgMoAgwiAA0AIAMoAgQEQCADIAE2AgQLIwBBEGsiCSQAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQ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AAkACQAJAAkACfwJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACfwJAAkACQAJAAkACQAJAAn8CQAJAAkACfwJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkAgAwJ/AkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJ/AkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQCACDuMBAAECAwQFBgcICQoLDA0ODxAREhMUFRYXGBkaGxwdHh8gISMkJScoKZ4DmwOaA5EDigODA4AD/QL7AvgC8gLxAu8C7QLoAucC5gLlAuQC3ALbAtoC2QLYAtcC1gLVAs8CzgLMAssCygLJAsgCxwLGAsQCwwK+ArwCugK5ArgCtwK2ArUCtAKzArICsQKwAq4CrQKpAqgCpwKmAqUCpAKjAqICoQKgAp8CmAKQAowCiwKKAoEC/gH9AfwB+wH6AfkB+AH3AfUB8wHwAesB6QH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AUEBaiIBRw0AC0HAACECDO4CCyADKAIEIQAgA0EANgIEIAMgACABQQFqIgEQMSIADRcM4gILQcAAIQIM7AILIAEgBEYEQEHJACECDOwCCwJAA0ACQCABLQAAQQlrDhgAAqICogKpAqICogKiAqICogKiAqICogKiAqICogKiAqICogKiAqICogKiAgCiAgsgBCABQQFqIgFHDQALQckAIQIM7AILIAFBAWohASADQS9qLQAAQQFxDaUCIANBADYCHCADIAE2AhQgA0GXEDYCECADQQo2AgxBACECDOsCCyABIARHBEADQCABLQAAQSBHDRUgBCABQQFqIgFHDQALQfgAIQIM6wILQfgAIQIM6gILIANBAjoAKAw4C0EAIQIgA0EANgIcIANBvws2AhAgA0ECNgIMIAMgAUEBajYCFAzoAgtBACECDM4CC0ENIQIMzQILQRMhAgzMAgtBFSECDMsCC0EWIQIMygILQRghAgzJAgtBGSECDMgCC0EaIQIMxwILQRshAgzGAgtBHCECDMUCC0EdIQIMxAILQR4hAgzDAgtBHyECDMICC0EgIQIMwQILQSIhAgzAAgtBIyECDL8CC0ElIQIMvgILQeUAIQIMvQILIANBPTYCHCADIAE2AhQgAyAANgIMQQAhAgzVAgsgA0EbNgIcIAMgATYCFCADQaQcNgIQIANBFTYCDEEAIQIM1AILIANBIDYCHCADIAE2AhQgA0GYGjYCECADQRU2AgxBACECDNMCCyADQRM2AhwgAyABNgIUIANBmBo2AhAgA0EVNgIMQQAhAgzSAgsgA0ELNgIcIAMgATYCFCADQZgaNgIQIANBFTYCDEEAIQIM0QILIANBEDYCHCADIAE2AhQgA0GYGjYCECADQRU2AgxBACECDNACCyADQSA2AhwgAyABNgIUIANBpBw2AhAgA0EVNgIMQQAhAgzPAgsgA0ELNgIcIAMgATYCFCADQaQcNgIQIANBFTYCDEEAIQIMzgILIANBDDYCHCADIAE2AhQgA0GkHDYCECADQRU2AgxBACECDM0CC0EAIQIgA0EANgIcIAMgATYCFCADQd0ONgIQIANBEjYCDAzMAgsCQANAAkAgAS0AAEEKaw4EAAICAAILIAQgAU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3AwAgAyAAIAZBAWoiARAuIgANAwwCCyADQQA2AgALQQAhAiADQQA2AhwgAyABNgIUIANB5R82AhAgA0EINgIMDL8CC0HVASECDKUCCyADQfMBNgIcIAMgATYCFCADIAA2AgxBACECDL0CC0EAIQACQCADKAI4IgJFDQAgAigCQCICRQ0AIAMgAhEAACEACyAARQ1uIABBFUcEQCADQQA2AhwgAyABNgIUIANBgg82AhAgA0EgNgIMQQAhAgy9AgsgA0GPATYCHCADIAE2AhQgA0HsGzYCECADQRU2AgxBACECDLwCCyABIARHBEAgA0ENNgIIIAMgATYCBEHTASECDKMCC0HyASECDLsCCyABIARGBEBB8QEhAgy7AgsCQAJAAkAgAS0AAEHIAGsOCwABCAgICAgICAgCCAsgAUEBaiEBQdABIQIMowILIAFBAWohAUHRASECDKICCyABQQFqIQFB0gEhAgyhAgtB8AEhAiABIARGDbkCIAMoAgAiACAEIAFraiEGIAEgAGtBAmohBQNAIAEtAAAgAEG11QBqLQAARw0EIABBAkYNAyAAQQFqIQAgBCABQQFqIgFHDQALIAMgBjYCAAy5AgtB7wEhAiABIARGDbgCIAMoAgAiACAEIAFraiEGIAEgAGtBAWohBQNAIAEtAAAgAEGz1QBqLQAARw0DIABBAUYNAiAAQQFqIQAgBCABQQFqIgFHDQALIAMgBjYCAAy4AgtB7gEhAiABIARGDbcCIAMoAgAiACAEIAFraiEGIAEgAGtBAmohBQNAIAEtAAAgAEGw1QBqLQAARw0CIABBAkYNASAAQQFqIQAgBCABQQFqIgFHDQALIAMgBjYCAAy3AgsgAygCBCEAIANCADcDACADIAAgBUEBaiIBECsiAEUNAiADQewBNgIcIAMgATYCFCADIAA2AgxBACECDLYCCyADQQA2AgALIAMoAgQhACADQQA2AgQgAyAAIAEQKyIARQ2cAiADQe0BNgIcIAMgATYCFCADIAA2AgxBACECDLQCC0HPASECDJoCC0EAIQACQCADKAI4IgJFDQAgAigCNCICRQ0AIAMgAhEAACEACwJAIAAEQCAAQRVGDQEgA0EANgIcIAMgATYCFCADQeoNNgIQIANBJjYCDEEAIQIMtAILQc4BIQIMmgILIANB6wE2AhwgAyABNgIUIANBgBs2AhAgA0EVNgIMQQAhAgyyAgsgASAERgRAQesBIQIMsgILIAEtAABBL0YEQCABQQFqIQEMAQsgA0EANgIcIAMgATYCFCADQbI4NgIQIANBCDYCDEEAIQIMsQILQc0BIQIMlwILIAEgBEcEQCADQQ42AgggAyABNgIEQcwBIQIMlwILQeoBIQIMrwILIAEgBEYEQEHpASECDK8CCyABLQAAQTBrIgBB/wFxQQpJBEAgAyAAOgAqIAFBAWohAUHLASECDJYCCyADKAIEIQAgA0EANgIEIAMgACABEC8iAEUNlwIgA0HoATYCHCADIAE2AhQgAyAANgIMQQAhAgyuAgsgASAERgRAQecBIQIMrgILAkAgAS0AAEEuRgRAIAFBAWohAQwBCyADKAIEIQAgA0EANgIEIAMgACABEC8iAEUNmAIgA0HmATYCHCADIAE2AhQgAyAANgIMQQAhAgyuAgtBygEhAgyUAgsgASAERgRAQeUBIQIMrQILQQAhAEEBIQVBASEHQQAhAgJAAkACQAJAAkACfwJAAkACQAJAAkACQAJAIAEtAABBMGsOCgoJAAECAwQFBggLC0ECDAYLQQMMBQtBBAwEC0EFDAMLQQYMAgtBBwwBC0EICyECQQAhBUEAIQcMAgtBCSECQQEhAEEAIQVBACEHDAELQQAhBUEBIQILIAMgAjoAKyABQQFqIQECQAJAIAMtAC5BEHENAAJAAkACQCADLQAqDgMBAAIECyAHRQ0DDAILIAANAQwCCyAFRQ0BCyADKAIEIQAgA0EANgIEIAMgACABEC8iAEUNAiADQeIBNgIcIAMgATYCFCADIAA2AgxBACECDK8CCyADKAIEIQAgA0EANgIEIAMgACABEC8iAEUNmgIgA0HjATYCHCADIAE2AhQgAyAANgIMQQAhAgyuAgsgAygCBCEAIANBADYCBCADIAAgARAvIgBFDZgCIANB5AE2AhwgAyABNgIUIAMgADYCDAytAgtByQEhAgyTAgtBACEAAkAgAygCOCICRQ0AIAIoAkQiAkUNACADIAIRAAAhAAsCQCAABEAgAEEVRg0BIANBADYCHCADIAE2AhQgA0GkDTYCECADQSE2AgxBACECDK0CC0HIASECDJMCCyADQeEBNgIcIAMgATYCFCADQdAaNgIQIANBFTYCDEEAIQIMqwILIAEgBEYEQEHhASECDKsCCwJAIAEtAABBIEYEQCADQQA7ATQgAUEBaiEBDAELIANBADYCHCADIAE2AhQgA0GZETYCECADQQk2AgxBACECDKsCC0HHASECDJECCyABIARGBEBB4AEhAgyqAgsCQCABLQAAQTBrQf8BcSICQQpJBEAgAUEBaiEBAkAgAy8BNCIAQZkzSw0AIAMgAEEKbCIAOwE0IABB/v8DcSACQf//A3NLDQAgAyAAIAJqOwE0DAILQQAhAiADQQA2AhwgAyABNgIUIANBlR42AhAgA0ENNgIMDKsCCyADQQA2AhwgAyABNgIUIANBlR42AhAgA0ENNgIMQQAhAgyqAgtBxgEhAgyQAgsgASAERgRAQd8BIQIMqQILAkAgAS0AAEEwa0H/AXEiAkEKSQRAIAFBAWohAQJAIAMvATQiAEGZM0sNACADIABBCmwiADsBNCAAQf7/A3EgAkH//wNzSw0AIAMgACACajsBNAwCC0EAIQIgA0EANgIcIAMgATYCFCADQZUeNgIQIANBDTYCDAyqAgsgA0EANgIcIAMgATYCFCADQZUeNgIQIANBDTYCDEEAIQIMqQILQcUBIQIMjwILIAEgBEYEQEHeASECDKgCCwJAIAEtAABBMGtB/wFxIgJBCkkEQCABQQFqIQECQCADLwE0IgBBmTNLDQAgAyAAQQpsIgA7ATQgAEH+/wNxIAJB//8Dc0sNACADIAAgAmo7ATQMAgtBACECIANBADYCHCADIAE2AhQgA0GVHjYCECADQQ02AgwMqQILIANBADYCHCADIAE2AhQgA0GVHjYCECADQQ02AgxBACECDKgCC0HEASECDI4CCyABIARGBEBB3QEhAgynAgsCQAJAAkACQCABLQAAQQprDhcCAwMAAwMDAwMDAwMDAwMDAwMDAwMDAQMLIAFBAWoMBQsgAUEBaiEBQcMBIQIMjwILIAFBAWohASADQS9qLQAAQQFxDQggA0EANgIcIAMgATYCFCADQY0LNgIQIANBDTYCDEEAIQIMpwILIANBADYCHCADIAE2AhQgA0GNCzYCECADQQ02AgxBACECDKYCCyABIARHBEAgA0EPNgIIIAMgATYCBEEBIQIMjQILQdwBIQIMpQILAkACQANAAkAgAS0AAEEKaw4EAgAAAwALIAQgAUEBaiIBRw0AC0HbASECDKYCCyADKAIEIQAgA0EANgIEIAMgACABEC0iAEUEQCABQQFqIQEMBAsgA0HaATYCHCADIAA2AgwgAyABQQFqNgIUQQAhAgylAgsgAygCBCEAIANBADYCBCADIAAgARAtIgANASABQQFqCyEBQcEBIQIMigILIANB2QE2AhwgAyAANgIMIAMgAUEBajYCFEEAIQIMogILQcIBIQIMiAILIANBL2otAABBAXENASADQQA2AhwgAyABNgIUIANB5Bw2AhAgA0EZNgIMQQAhAgygAgsgASAERgRAQdkBIQIMoAILAkACQAJAIAEtAABBCmsOBAECAgACCyABQQFqIQEMAgsgAUEBaiEBDAELIAMtAC5BwABxRQ0BC0EAIQACQCADKAI4IgJFDQAgAigCPCICRQ0AIAMgAhEAACEACyAARQ2gASAAQRVGBEAgA0HZADYCHCADIAE2AhQgA0G3GjYCECADQRU2AgxBACECDJ8CCyADQQA2AhwgAyABNgIUIANBgA02AhAgA0EbNgIMQQAhAgyeAgsgA0EANgIcIAMgATYCFCADQdwoNgIQIANBAjYCDEEAIQIMnQILIAEgBEcEQCADQQw2AgggAyABNgIEQb8BIQIMhAILQdgBIQIMnAILIAEgBEYEQEHXASECDJwCCwJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkAgAS0AAEHBAGsOFQABAgNaBAUGWlpaBwgJCgsMDQ4PEFoLIAFBAWohAUH7ACECDJICCyABQQFqIQFB/AAhAgyRAgsgAUEBaiEBQYEBIQIMkAILIAFBAWohAUGFASECDI8CCyABQQFqIQFBhgEhAgyOAgsgAUEBaiEBQYkBIQIMjQILIAFBAWohAUGKASECDIwCCyABQQFqIQFBjQEhAgyLAgsgAUEBaiEBQ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QAARw04IABBCEYNASAAQQFqIQAgBCABQQFqIgFHDQALIAMgBTYCAAyMAgsgA0EANgIAIAZBAWohAUEqDDgLIAEgBEYEQEHGASECDIsCCyABLQAAQdAARw04IAFBAWohAUElDDcLQcUBIQIgASAERg2JAiADKAIAIgAgBCABa2ohBSABIABrQQJqIQYCQANAIAEtAAAgAEGB1QBqLQAARw02IABBAkYNASAAQQFqIQAgBCABQQFqIgFHDQALIAMgBTYCAAyKAgsgA0EANgIAIAZBAWohAUEODDYLIAEgBEYEQEHEASECDIkCCyABLQAAQcUARw02IAFBAWohAUGrASECDO8BCyABIARGBEBBwwEhAgyIAgsCQAJAAkACQCABLQAAQcIAaw4PAAECOTk5OTk5OTk5OTkDOQsgAUEBaiEBQacBIQIM8QELIAFBAWohAUGoASECDPABCyABQQFqIQFBqQEhAgzvAQsgAUEBaiEBQaoBIQIM7gELQcIBIQIgASAERg2GAiADKAIAIgAgBCABa2ohBSABIABrQQJqIQYCQANAIAEtAAAgAEH+1ABqLQAARw0zIABBAkYNASAAQQFqIQAgBCABQQFqIgFHDQALIAMgBTYCAAyHAgsgA0EANgIAIAZBAWohAUEUDDMLQcEBIQIgASAERg2FAiADKAIAIgAgBCABa2ohBSABIABrQQRqIQYCQANAIAEtAAAgAEH51ABqLQAARw0yIABBBEYNASAAQQFqIQAgBCABQQFqIgFHDQALIAMgBTYCAAyGAgsgA0EANgIAIAZBAWohAUErDDILQcABIQIgASAERg2EAiADKAIAIgAgBCABa2ohBSABIABrQQJqIQYCQANAIAEtAAAgAEH21ABqLQAARw0xIABBAkYNASAAQQFqIQAgBCABQQFqIgFHDQALIAMgBTYCAAyFAgsgA0EANgIAIAZBAWohAUEsDDELQb8BIQIgASAERg2DAiADKAIAIgAgBCABa2ohBSABIABrQQJqIQYCQANAIAEtAAAgAEGh1QBqLQAARw0wIABBAkYNASAAQQFqIQAgBCABQQFqIgFHDQALIAMgBTYCAAyEAgsgA0EANgIAIAZBAWohAUERDDALQb4BIQIgASAERg2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CQkJCQkJCQkASQkJCQkAiQkJAMkCyABQQFqIQFBjgEhAgzcAQsgAUEBaiEBQY8BIQIM2wELIAFBAWohAUGUASECDNoBCyABQQFqIQFBlQEhAgzZAQtBrQEhAiABIARGDfEBIAMoAgAiACAEIAFraiEFIAEgAGtBAWohBgJAA0AgAS0AACAAQdfUAGotAABHDR4gAEEBRg0BIABBAWohACAEIAFBAWoiAUcNAAsgAyAFNgIADPIBCyADQQA2AgAgBkEBaiEBQQsMHgsgASAERgRAQawBIQIM8QELAkACQCABLQAAQcEAaw4DACABIAsgAUEBaiEBQZABIQIM2AELIAFBAWohAUGTASECDNcBCyABIARGBEBBqwEhAgzwAQsCQAJAIAEtAABBwQBrDg8AHx8fHx8fHx8fHx8fHwEfCyABQQFqIQFBkQEhAgzXAQsgAUEBaiEBQZIBIQIM1gELIAEgBEYEQEGqASECDO8BCyABLQAAQcwARw0cIAFBAWohAUEKDBsLQakBIQIgASAERg3tASADKAIAIgAgBCABa2ohBSABIABrQQVqIQYCQANAIAEtAAAgAEHR1ABqLQAARw0aIABBBUYNASAAQQFqIQAgBCABQQFqIgFHDQALIAMgBTYCAAzuAQsgA0EANgIAIAZBAWohAUEeDBoLQagBIQIgASAERg3sASADKAIAIgAgBCABa2ohBSABIABrQQZqIQYCQANAIAEtAAAgAEHK1ABqLQAARw0ZIABBBkYNASAAQQFqIQAgBCABQQFqIgFHDQALIAMgBTYCAAztAQsgA0EANgIAIAZBAWohAUEVDBkLQacBIQIgASAERg3rASADKAIAIgAgBCABa2ohBSABIABrQQJqIQYCQANAIAEtAAAgAEHH1ABqLQAARw0YIABBAkYNASAAQQFqIQAgBCABQQFqIgFHDQALIAMgBTYCAAzsAQsgA0EANgIAIAZBAWohAUEXDBgLQaYBIQIgASAERg3qASADKAIAIgAgBCABa2ohBSABIABrQQVqIQYCQANAIAEtAAAgAEHB1ABqLQAARw0XIABBBUYNASAAQQFqIQAgBCABQQFqIgFHDQALIAMgBTYCAAzrAQsgA0EANgIAIAZBAWohAUEYDBcLIAEgBEYEQEGlASECDOoBCwJAAkAgAS0AAEHJAGsOBwAZGRkZGQEZCyABQQFqIQFBiwEhAgzRAQsgAUEBaiEBQYwBIQIM0AELQaQBIQIgASAERg3oASADKAIAIgAgBCABa2ohBSABIABrQQFqIQYCQANAIAEtAAAgAEGm1QBqLQAARw0VIABBAUYNASAAQQFqIQAgBCABQQFqIgFHDQALIAMgBTYCAAzpAQsgA0EANgIAIAZBAWohAUEJDBULQaMBIQIgASAERg3nASADKAIAIgAgBCABa2ohBSABIABrQQFqIQYCQANAIAEtAAAgAEGk1QBqLQAARw0UIABBAUYNASAAQQFqIQAgBCABQQFqIgFHDQALIAMgBTYCAAzoAQsgA0EANgIAIAZBAWohAUEfDBQLQaIBIQIgASAERg3mASADKAIAIgAgBCABa2ohBSABIABrQQJqIQYCQANAIAEtAAAgAEG+1ABqLQAARw0TIABBAkYNASAAQQFqIQAgBCABQQFqIgFHDQALIAMgBTYCAAznAQsgA0EANgIAIAZBAWohAUECDBMLQaEBIQIgASAERg3lASADKAIAIgAgBCABa2ohBSABIABrQQFqIQYDQCABLQAAIABBvNQAai0AAEcNESAAQQFGDQIgAEEBaiEAIAQgAUEBaiIBRw0ACyADIAU2AgAM5QELIAEgBEYEQEGgASECDOUBC0EBIAEtAABB3wBHDREaIAFBAWohAUGHASECDMsBCyADQQA2AgAgBkEBaiEBQYgBIQIMygELQZ8BIQIgASAERg3iASADKAIAIgAgBCABa2ohBSABIABrQQhqIQYCQANAIAEtAAAgAEGE1QBqLQAARw0PIABBCEYNASAAQQFqIQAgBCABQQFqIgFHDQALIAMgBTYCAAzjAQsgA0EANgIAIAZBAWohAUEpDA8LQZ4BIQIgASAERg3hASADKAIAIgAgBCABa2ohBSABIABrQQNqIQYCQANAIAEtAAAgAEG41ABqLQAARw0OIABBA0YNASAAQQFqIQAgBCABQQFqIgFHDQALIAMgBTYCAAziAQsgA0EANgIAIAZBAWohAUEtDA4LIAEgBEYEQEGdASECDOEBCy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CyADQQA2AgAgBkEBaiEBQRAMBAsgASAERgRAQZMBIQIM1wELAkACQCABLQAAQcMAaw4MAAYGBgYGBgYGBgYBBgsgAUEBaiEBQfkAIQIMvgELIAFBAWohAUH6ACECDL0BC0GSASECIAEgBEYN1QEgAygCACIAIAQgAWtqIQUgASAAa0EFaiEGAkADQCABLQAAIABBoNQAai0AAEcNAiAAQQVGDQEgAEEBaiEAIAQgAUEBaiIBRw0ACyADIAU2AgAM1gELIANBADYCACAGQQFqIQFBJAwCCyADQQA2AgAMAgsgASAERgRAQZEBIQIM1AELIAEtAABBzABHDQEgAUEBaiEBQRMLOgApIAMoAgQhACADQQA2AgQgAyAAIAEQLiIADQIMAQtBACECIANBADYCHCADIAE2AhQgA0H+HzYCECADQQY2AgwM0QELQfgAIQIMtwELIANBkAE2AhwgAyABNgIUIAMgADYCDEEAIQIMzwELQQAhAAJAIAMoAjgiAkUNACACKAJAIgJFDQAgAyACEQAAIQALIABFDQAgAEEVRg0BIANBADYCHCADIAE2AhQgA0GCDzYCECADQSA2AgxBACECDM4BC0H3ACECDLQBCyADQY8BNgIcIAMgATYCFCADQewbNgIQIANBFTYCDEEAIQIMzAELIAEgBEYEQEGPASECDMwBCwJAIAEtAABBIEYEQCABQQFqIQEMAQsgA0EANgIcIAMgATYCFCADQZsfNgIQIANBBjYCDEEAIQIMzAELQQIhAgyyAQsDQCABLQAAQSBHDQIgBCABQQFqIgFHDQALQY4BIQIMygELIAEgBEYEQEGNASECDMoBCwJAIAEtAABBCWsOBEoAAEoAC0H1ACECDLABCyADLQApQQVGBEBB9gAhAgywAQtB9AAhAgyvAQsgASAERgRAQYwBIQIMyAELIANBEDYCCCADIAE2AgQMCgsgASAERgRAQYsBIQIMxwELAkAgAS0AAEEJaw4ERwAARwALQfMAIQIMrQELIAEgBEcEQCADQRA2AgggAyABNgIEQfEAIQIMrQELQYoBIQIMxQELAkAgASAERwRAA0AgAS0AAEGg0ABqLQAAIgBBA0cEQAJAIABBAWsOAkkABAtB8AAhAgyvAQsgBCABQQFqIgFHDQALQYgBIQIMxgELQYgBIQIMxQELIANBADYCHCADIAE2AhQgA0HbIDYCECADQQc2AgxBACECDMQBCyABIARGBEBBiQEhAgzEAQsCQAJAAkAgAS0AAEGg0gBqLQAAQQFrDgNGAgABC0HyACECDKwBCyADQQA2AhwgAyABNgIUIANBtBI2AhAgA0EHNgIMQQAhAgzEAQtB6gAhAgyqAQsgASAERwRAIAFBAWohAUHvACECDKoBC0GHASECDMIBCyAEIAEiAEYEQEGGASECDMIBCyAALQAAIgFBL0YEQCAAQQFqIQFB7gAhAgypAQsgAUEJayICQRdLDQEgACEBQQEgAnRBm4CABHENQQwBCyAEIAEiAEYEQEGFASECDMEBCyAALQAAQS9HDQAgAEEBaiEBDAMLQQAhAiADQQA2AhwgAyAANgIUIANB2yA2AhAgA0EHNgIMDL8BCwJAAkACQAJAAkADQCABLQAAQaDOAGotAAAiAEEFRwRAAkACQCAAQQFrDghHBQYHCAAEAQgLQesAIQIMrQELIAFBAWohAUHtACECDKwBCyAEIAFBAWoiAUcNAAtBhAEhAgzDAQsgAUEBagwUCyADKAIEIQAgA0EANgIEIAMgACABECwiAEUNHiADQdsANgIcIAMgATYCFCADIAA2AgxBACECDMEBCyADKAIEIQAgA0EANgIEIAMgACABECwiAEUNHiADQd0ANgIcIAMgATYCFCADIAA2AgxBACECDMABCyADKAIEIQAgA0EANgIEIAMgACABECwiAEUNHiADQfoANgIcIAMgATYCFCADIAA2AgxBACECDL8BCyADQQA2AhwgAyABNgIUIANB+Q82AhAgA0EHNgIMQQAhAgy+AQsgASAERgRAQYMBIQIMvgELAkAgAS0AAEGgzgBqLQAAQQFrDgg+BAUGAAgCAwcLIAFBAWohAQtBAyECDKMBCyABQQFqDA0LQQAhAiADQQA2AhwgA0HREjYCECADQQc2AgwgAyABQQFqNgIUDLoBCyADKAIEIQAgA0EANgIEIAMgACABECwiAEUNFiADQdsANgIcIAMgATYCFCADIAA2AgxBACECDLkBCyADKAIEIQAgA0EANgIEIAMgACABECwiAEUNFiADQd0ANgIcIAMgATYCFCADIAA2AgxBACECDLgBCyADKAIEIQAgA0EANgIEIAMgACABECwiAEUNFiADQfoANgIcIAMgATYCFCADIAA2AgxBACECDLcBCyADQQA2AhwgAyABNgIUIANB+Q82AhAgA0EHNgIMQQAhAgy2AQtB7AAhAgycAQsgASAERgRAQYIBIQIMtQELIAFBAWoMAgsgASAERgRAQYEBIQIMtAELIAFBAWoMAQsgASAERg0BIAFBAWoLIQFBBCECDJgBC0GAASECDLABCwNAIAEtAABBoMwAai0AACIAQQJHBEAgAEEBRwRAQekAIQIMmQELDDELIAQgAUEBaiIBRw0AC0H/ACECDK8BCyABIARGBEBB/gAhAgyvAQsCQCABLQAAQQlrDjcvAwYvBAYGBgYGBgYGBgYGBgYGBgYGBgUGBgIGBgYGBgYGBgYGBgYGBgYGBgYGBgYGBgYGBgYABgsgAUEBagshAUEFIQIMlAELIAFBAWoMBgsgAygCBCEAIANBADYCBCADIAAgARAsIgBFDQggA0HbADYCHCADIAE2AhQgAyAANgIMQQAhAgyrAQsgAygCBCEAIANBADYCBCADIAAgARAsIgBFDQggA0HdADYCHCADIAE2AhQgAyAANgIMQQAhAgyqAQsgAygCBCEAIANBADYCBCADIAAgARAsIgBFDQggA0H6ADYCHCADIAE2AhQgAyAANgIMQQAhAgypAQsgA0EANgIcIAMgATYCFCADQY0UNgIQIANBBzYCDEEAIQIMqAELAkACQAJAAkADQCABLQAAQaDKAGotAAAiAEEFRwRAAkAgAEEBaw4GLgMEBQYABgtB6AAhAgyUAQsgBCABQQFqIgFHDQALQf0AIQIMqwELIAMoAgQhACADQQA2AgQgAyAAIAEQLCIARQ0HIANB2wA2AhwgAyABNgIUIAMgADYCDEEAIQIMqgELIAMoAgQhACADQQA2AgQgAyAAIAEQLCIARQ0HIANB3QA2AhwgAyABNgIUIAMgADYCDEEAIQIMqQELIAMoAgQhACADQQA2AgQgAyAAIAEQLCIARQ0HIANB+gA2AhwgAyABNgIUIAMgADYCDEEAIQIMqAELIANBADYCHCADIAE2AhQgA0HkCDYCECADQQc2AgxBACECDKcBCyABIARGDQEgAUEBagshAUEGIQIMjAELQfwAIQIMpAELAkACQAJAAkADQCABLQAAQaDIAGotAAAiAEEFRwRAIABBAWsOBCkCAwQFCyAEIAFBAWoiAUcNAAtB+wAhAgynAQsgAygCBCEAIANBADYCBCADIAAgARAsIgBFDQMgA0HbADYCHCADIAE2AhQgAyAANgIMQQAhAgymAQsgAygCBCEAIANBADYCBCADIAAgARAsIgBFDQMgA0HdADYCHCADIAE2AhQgAyAANgIMQQAhAgylAQsgAygCBCEAIANBADYCBCADIAAgARAsIgBFDQMgA0H6ADYCHCADIAE2AhQgAyAANgIMQQAhAgykAQsgA0EANgIcIAMgATYCFCADQbwKNgIQIANBBzYCDEEAIQIMowELQc8AIQIMiQELQdEAIQIMiAELQecAIQIMhwELIAEgBEYEQEH6ACECDKABCwJAIAEtAABBCWsOBCAAACAACyABQQFqIQFB5gAhAgyGAQsgASAERgRAQfkAIQIMnwELAkAgAS0AAEEJaw4EHwAAHwALQQAhAAJAIAMoAjgiAkUNACACKAI4IgJFDQAgAyACEQAAIQALIABFBEBB4gEhAgyGAQsgAEEVRwRAIANBADYCHCADIAE2AhQgA0HJDTYCECADQRo2AgxBACECDJ8BCyADQfgANgIcIAMgATYCFCADQeoaNgIQIANBFTYCDEEAIQIMngELIAEgBEcEQCADQQ02AgggAyABNgIEQeQAIQIMhQELQfcAIQIMnQELIAEgBEYEQEH2ACECDJ0BCwJAAkACQCABLQAAQcgAaw4LAAELCwsLCwsLCwILCyABQQFqIQFB3QAhAgyFAQsgAUEBaiEBQeAAIQIMhAELIAFBAWohAUHjACECDIMBC0H1ACECIAEgBEYNmwEgAygCACIAIAQgAWtqIQUgASAAa0ECaiEGAkADQCABLQAAIABBtdUAai0AAEcNCCAAQQJGDQEgAEEBaiEAIAQgAUEBaiIBRw0ACyADIAU2AgAMnAELIAMoAgQhACADQgA3AwAgAyAAIAZBAWoiARArIgAEQCADQfQANgIcIAMgATYCFCADIAA2AgxBACECDJwBC0HiACECDIIBC0EAIQACQCADKAI4IgJFDQAgAigCNCICRQ0AIAMgAhEAACEACwJAIAAEQCAAQRVGDQEgA0EANgIcIAMgATYCFCADQeoNNgIQIANBJjYCDEEAIQIMnAELQeEAIQIMggELIANB8wA2AhwgAyABNgIUIANBgBs2AhAgA0EVNgIMQQAhAgyaAQsgAy0AKSIAQSNrQQtJDQkCQCAAQQZLDQBBASAAdEHKAHFFDQAMCgtBACECIANBADYCHCADIAE2AhQgA0HtCTYCECADQQg2AgwMmQELQfIAIQIgASAERg2YASADKAIAIgAgBCABa2ohBSABIABrQQFqIQYCQANAIAEtAAAgAEGz1QBqLQAARw0FIABBAUYNASAAQQFqIQAgBCABQQFqIgFHDQALIAMgBTYCAAyZAQsgAygCBCEAIANCADcDACADIAAgBkEBaiIBECsiAARAIANB8QA2AhwgAyABNgIUIAMgADYCDEEAIQIMmQELQd8AIQIMfwtBACEAAkAgAygCOCICRQ0AIAIoAjQiAkUNACADIAIRAAAhAAsCQCAABEAgAEEVRg0BIANBADYCHCADIAE2AhQgA0HqDTYCECADQSY2AgxBACECDJkBC0HeACECDH8LIANB8AA2AhwgAyABNgIUIANBgBs2AhAgA0EVNgIMQQAhAgyXAQsgAy0AKUEhRg0GIANBADYCHCADIAE2AhQgA0GRCjYCECADQQg2AgxBACECDJYBC0HvACECIAEgBEYNlQEgAygCACIAIAQgAWtqIQUgASAAa0ECaiEGAkADQCABLQAAIABBsNUAai0AAEcNAiAAQQJGDQEgAEEBaiEAIAQgAUEBaiIBRw0ACyADIAU2AgAMlgELIAMoAgQhACADQgA3AwAgAyAAIAZBAWoiARArIgBFDQIgA0HtADYCHCADIAE2AhQgAyAANgIMQQAhAgyVAQsgA0EANgIACyADKAIEIQAgA0EANgIEIAMgACABECsiAEUNgAEgA0HuADYCHCADIAE2AhQgAyAANgIMQQAhAgyTAQtB3AAhAgx5C0EAIQACQCADKAI4IgJF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aiIBQQFrQQA6AAAgAEEAOgACIABBADoAASABQQNrQQA6AAAgAUECa0EAOgAAIABBADoAAyABQQRrQQA6AABBACAAa0EDcSIBIABqIgBBADYCAEHkACABa0F8cSICIABqIgFBBGtBADYCAAJAIAJBCUkNACAAQQA2AgggAEEANgIEIAFBCGtBADYCACABQQxrQQA2AgAgAkEZSQ0AIABBADYCGCAAQQA2AhQgAEEANgIQIABBADYCDCABQRBrQQA2AgAgAUEUa0EANgIAIAFBGGtBADYCACABQRxrQQA2AgAgAiAAQQRxQRhyIgJrIgFBIEkNACAAIAJqIQADQCAAQgA3AxggAEIANwMQIABCADcDCCAAQgA3AwAgAEEgaiEAIAFBIGsiAUEfSw0ACwsLVgEBfwJAIAAoAgwNAAJAAkACQAJAIAAtADEOAwEAAwILIAAoAjgiAUUNACABKAIwIgFFDQAgACABEQAAIgENAwtBAA8LAAsgAEHKGTYCEEEOIQELIAELGgAgACgCDEUEQCAAQd4fNgIQIABBFTYCDAsLFAAgACgCDEEVRgRAIABBADYCDAsLFAAgACgCDEEWRgRAIABBADYCDAsLBwAgACgCDAsHACAAKAIQCwkAIAAgATYCEAsHACAAKAIUCysAAkAgAEEnTw0AQv//////CSAArYhCAYNQDQAgAEECdEHQOGooAgAPCwALFwAgAEEvTwRAAAsgAEECdEHsOWooAgALvwkBAX9B9C0hAQJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAIABB5ABrDvQDY2IAAWFhYWFhYQIDBAVhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWF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BQUFBQUFBQUFBQUFBQUFBQUAAAAFAEGp0AALBQEBAAEBAEHA0AALAQEAQdrQAAtBAgAAAAAAAAMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAAAAAAAAAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMAQanSAAsFAQEAAQEAQcDSAAsBAQBBytIACwYCAAAAAAIAQeHSAAs6AwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMAAAAAAAADAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwBBoNQAC50BTk9VTkNFRUNLT1VUTkVDVEVURUNSSUJFTFVTSEVURUFEU0VBUkNIUkdFQ1RJVklUWUxFTkRBUlZFT1RJRllQVElPTlNDSFNFQVlTVEFUQ0hHRVVFUllPUkRJUkVDVE9SVFJDSFBBUkFNRVRFUlVSQ0VCU0NSSUJFQVJET1dOQUNFSU5ETktDS1VCU0NSSUJFVFRQQ0VUU1BBRFRQLw==","base64"))})},3530:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.enumToMap=function(e,t=[],s=[]){const r=0===(t?.length??0),n=0===(s?.length??0);return Object.fromEntries(Object.entries(e).filter((([,e])=>"number"==typeof e&&(r||t.includes(e))&&(n||!s.includes(e)))))}},7467:(e,t,s)=>{"use strict";const{kClients:r}=s(257),n=s(3315),{kAgent:A,kMockAgentSet:i,kMockAgentGet:o,kDispatches:a,kIsMockActive:c,kNetConnect:l,kGetNetConnect:h,kOptions:g,kFactory:d,kMockAgentRegisterCallHistory:u,kMockAgentIsCallHistoryEnabled:E,kMockAgentAddCallHistoryLog:I,kMockAgentMockCallHistoryInstance:C,kMockAgentAcceptsNonStandardSearchParameters:B,kMockCallHistoryAddLog:Q,kIgnoreTrailingSlash:p}=s(3435),f=s(615),m=s(5846),{matchValue:y,normalizeSearchParams:w,buildAndValidateMockOptions:S}=s(991),{InvalidArgumentError:D,UndiciError:b}=s(4465),v=s(5497),R=s(164),{MockCallHistory:N}=s(4969);e.exports=class extends v{constructor(e={}){super(e);const t=S(e);if(this[l]=!0,this[c]=!0,this[E]=t.enableCallHistory??!1,this[B]=t.acceptNonStandardSearchParameters??!1,this[p]=t.ignoreTrailingSlash??!1,e?.agent&&"function"!=typeof e.agent.dispatch)throw new D("Argument opts.agent must implement Agent");const s=e?.agent?e.agent:new n(e);this[A]=s,this[r]=s[r],this[g]=t,this[E]&&this[u]()}get(e){const t=this[p]?e.replace(/\/$/,""):e;let s=this[o](t);return s||(s=this[d](t),this[i](t,s)),s}dispatch(e,t){this.get(e.origin),this[I](e);const s=this[B],r={...e};if(s&&r.path){const[e,t]=r.path.split("?"),n=w(t,s);r.path=`${e}?${n}`}return this[A].dispatch(r,t)}async close(){this.clearCallHistory(),await this[A].close(),this[r].clear()}deactivate(){this[c]=!1}activate(){this[c]=!0}enableNetConnect(e){if("string"==typeof e||"function"==typeof e||e instanceof RegExp)Array.isArray(this[l])?this[l].push(e):this[l]=[e];else{if("undefined"!=typeof e)throw new D("Unsupported matcher. Must be one of String|Function|RegExp.");this[l]=!0}}disableNetConnect(){this[l]=!1}enableCallHistory(){return this[E]=!0,this}disableCallHistory(){return this[E]=!1,this}getCallHistory(){return this[C]}clearCallHistory(){void 0!==this[C]&&this[C].clear()}get isMockActive(){return this[c]}[u](){void 0===this[C]&&(this[C]=new N)}[I](e){this[E]&&(this[u](),this[C][Q](e))}[i](e,t){this[r].set(e,{count:0,dispatcher:t})}[d](e){const t=Object.assign({agent:this},this[g]);return this[g]&&1===this[g].connections?new f(e,t):new m(e,t)}[o](e){const t=this[r].get(e);if(t?.dispatcher)return t.dispatcher;if("string"!=typeof e){const t=this[d]("http://localhost:9999");return this[i](e,t),t}for(const[t,s]of Array.from(this[r]))if(s&&"string"!=typeof t&&y(t,e)){const t=this[d](e);return this[i](e,t),t[a]=s.dispatcher[a],t}}[h](){return this[l]}pendingInterceptors(){const e=this[r];return Array.from(e.entries()).flatMap((([e,t])=>t.dispatcher[a].map((t=>({...t,origin:e}))))).filter((({pending:e})=>e))}assertNoPendingInterceptors({pendingInterceptorsFormatter:e=new R}={}){const t=this.pendingInterceptors();if(0!==t.length)throw new b(1===t.length?`1 interceptor is pending:\n\n${e.format(t)}`.trim():`${t.length} interceptors are pending:\n\n${e.format(t)}`.trim())}}},4969:(e,t,s)=>{"use strict";const{kMockCallHistoryAddLog:r}=s(3435),{InvalidArgumentError:n}=s(4465);function A(e,t,s,r){switch(t.operator){case"OR":return r.push(...s(e)),r;case"AND":return s.call({logs:r},e);default:throw new n("options.operator must to be a case insensitive string equal to 'OR' or 'AND'")}}function i(e={}){const t={};if("operator"in e){if("string"!=typeof e.operator||"OR"!==e.operator.toUpperCase()&&"AND"!==e.operator.toUpperCase())throw new n("options.operator must to be a case insensitive string equal to 'OR' or 'AND'");return{...t,operator:e.operator.toUpperCase()}}return t}function o(e){return t=>{if("string"==typeof t||null==t)return this.logs.filter((s=>s[e]===t));if(t instanceof RegExp)return this.logs.filter((s=>t.test(s[e])));throw new n(`${e} parameter should be one of string, regexp, undefined or null`)}}class a{constructor(e={}){this.body=e.body,this.headers=e.headers,this.method=e.method;const t=function(e){try{const t=new URL(e.path,e.origin);return 0!==t.search.length||(t.search=new URLSearchParams(e.query).toString()),t}catch(e){throw new n("An error occurred when computing MockCallHistoryLog.url",{cause:e})}}(e);this.fullUrl=t.toString(),this.origin=t.origin,this.path=t.pathname,this.searchParams=Object.fromEntries(t.searchParams),this.protocol=t.protocol,this.host=t.host,this.port=t.port,this.hash=t.hash}toMap(){return new Map([["protocol",this.protocol],["host",this.host],["port",this.port],["origin",this.origin],["path",this.path],["hash",this.hash],["searchParams",this.searchParams],["fullUrl",this.fullUrl],["method",this.method],["body",this.body],["headers",this.headers]])}toString(){const e="->",t="|";let s="";return this.toMap().forEach(((r,n)=>{"string"!=typeof r&&null!=r||(s=`${s}${n}${e}${r}${t}`),("object"==typeof r&&null!==r||Array.isArray(r))&&(s=`${s}${n}${e}${JSON.stringify(r)}${t}`)})),s.slice(0,-1)}}class c{logs=[];calls(){return this.logs}firstCall(){return this.logs.at(0)}lastCall(){return this.logs.at(-1)}nthCall(e){if("number"!=typeof e)throw new n("nthCall must be called with a number");if(!Number.isInteger(e))throw new n("nthCall must be called with an integer");if(1!==Math.sign(e))throw new n("nthCall must be called with a positive value. use firstCall or lastCall instead");return this.logs.at(e-1)}filterCalls(e,t){if(0===this.logs.length)return this.logs;if("function"==typeof e)return this.logs.filter(e);if(e instanceof RegExp)return this.logs.filter((t=>e.test(t.toString())));if("object"==typeof e&&null!==e){if(0===Object.keys(e).length)return this.logs;const s={operator:"OR",...i(t)};let r=[];"protocol"in e&&(r=A(e.protocol,s,this.filterCallsByProtocol,r)),"host"in e&&(r=A(e.host,s,this.filterCallsByHost,r)),"port"in e&&(r=A(e.port,s,this.filterCallsByPort,r)),"origin"in e&&(r=A(e.origin,s,this.filterCallsByOrigin,r)),"path"in e&&(r=A(e.path,s,this.filterCallsByPath,r)),"hash"in e&&(r=A(e.hash,s,this.filterCallsByHash,r)),"fullUrl"in e&&(r=A(e.fullUrl,s,this.filterCallsByFullUrl,r)),"method"in e&&(r=A(e.method,s,this.filterCallsByMethod,r));return[...new Set(r)]}throw new n("criteria parameter should be one of function, regexp, or object")}filterCallsByProtocol=o.call(this,"protocol");filterCallsByHost=o.call(this,"host");filterCallsByPort=o.call(this,"port");filterCallsByOrigin=o.call(this,"origin");filterCallsByPath=o.call(this,"path");filterCallsByHash=o.call(this,"hash");filterCallsByFullUrl=o.call(this,"fullUrl");filterCallsByMethod=o.call(this,"method");clear(){this.logs=[]}[r](e){const t=new a(e);return this.logs.push(t),t}*[Symbol.iterator](){for(const e of this.calls())yield e}}e.exports.MockCallHistory=c,e.exports.MockCallHistoryLog=a},615:(e,t,s)=>{"use strict";const{promisify:r}=s(7975),n=s(1167),{buildMockDispatch:A}=s(991),{kDispatches:i,kMockAgent:o,kClose:a,kOriginalClose:c,kOrigin:l,kOriginalDispatch:h,kConnected:g,kIgnoreTrailingSlash:d}=s(3435),{MockInterceptor:u}=s(193),E=s(257),{InvalidArgumentError:I}=s(4465);class C extends n{constructor(e,t){if(!t||!t.agent||"function"!=typeof t.agent.dispatch)throw new I("Argument opts.agent must implement Agent");super(e,t),this[o]=t.agent,this[l]=e,this[d]=t.ignoreTrailingSlash??!1,this[i]=[],this[g]=1,this[h]=this.dispatch,this[c]=this.close.bind(this),this.dispatch=A.call(this),this.close=this[a]}get[E.kConnected](){return this[g]}intercept(e){return new u(e&&{ignoreTrailingSlash:this[d],...e},this[i])}cleanMocks(){this[i]=[]}async[a](){await r(this[c])(),this[g]=0,this[o][E.kClients].delete(this[l])}}e.exports=C},3123:(e,t,s)=>{"use strict";const{UndiciError:r}=s(4465),n=Symbol.for("undici.error.UND_MOCK_ERR_MOCK_NOT_MATCHED");class A extends r{constructor(e){super(e),this.name="MockNotMatchedError",this.message=e||"The request does not match any registered mock dispatches",this.code="UND_MOCK_ERR_MOCK_NOT_MATCHED"}static[Symbol.hasInstance](e){return e&&!0===e[n]}get[n](){return!0}}e.exports={MockNotMatchedError:A}},193:(e,t,s)=>{"use strict";const{getResponseData:r,buildKey:n,addMockDispatch:A}=s(991),{kDispatches:i,kDispatchKey:o,kDefaultHeaders:a,kDefaultTrailers:c,kContentLength:l,kMockDispatch:h,kIgnoreTrailingSlash:g}=s(3435),{InvalidArgumentError:d}=s(4465),{serializePathWithQuery:u}=s(2858);class E{constructor(e){this[h]=e}delay(e){if("number"!=typeof e||!Number.isInteger(e)||e<=0)throw new d("waitInMs must be a valid integer > 0");return this[h].delay=e,this}persist(){return this[h].persist=!0,this}times(e){if("number"!=typeof e||!Number.isInteger(e)||e<=0)throw new d("repeatTimes must be a valid integer > 0");return this[h].times=e,this}}e.exports.MockInterceptor=class{constructor(e,t){if("object"!=typeof e)throw new d("opts must be an object");if("undefined"==typeof e.path)throw new d("opts.path must be defined");if("undefined"==typeof e.method&&(e.method="GET"),"string"==typeof e.path)if(e.query)e.path=u(e.path,e.query);else{const t=new URL(e.path,"data://");e.path=t.pathname+t.search}"string"==typeof e.method&&(e.method=e.method.toUpperCase()),this[o]=n(e),this[i]=t,this[g]=e.ignoreTrailingSlash??!1,this[a]={},this[c]={},this[l]=!1}createMockScopeDispatchData({statusCode:e,data:t,responseOptions:s}){const n=r(t),A=this[l]?{"content-length":n.length}:{};return{statusCode:e,data:t,headers:{...this[a],...A,...s.headers},trailers:{...this[c],...s.trailers}}}validateReplyParameters(e){if("undefined"==typeof e.statusCode)throw new d("statusCode must be defined");if("object"!=typeof e.responseOptions||null===e.responseOptions)throw new d("responseOptions must be an object")}reply(e){if("function"==typeof e){const t=t=>{const s=e(t);if("object"!=typeof s||null===s)throw new d("reply options callback must return an object");const r={data:"",responseOptions:{},...s};return this.validateReplyParameters(r),{...this.createMockScopeDispatchData(r)}},s=A(this[i],this[o],t,{ignoreTrailingSlash:this[g]});return new E(s)}const t={statusCode:e,data:void 0===arguments[1]?"":arguments[1],responseOptions:void 0===arguments[2]?{}:arguments[2]};this.validateReplyParameters(t);const s=this.createMockScopeDispatchData(t),r=A(this[i],this[o],s,{ignoreTrailingSlash:this[g]});return new E(r)}replyWithError(e){if("undefined"==typeof e)throw new d("error must be defined");const t=A(this[i],this[o],{error:e},{ignoreTrailingSlash:this[g]});return new E(t)}defaultReplyHeaders(e){if("undefined"==typeof e)throw new d("headers must be defined");return this[a]=e,this}defaultReplyTrailers(e){if("undefined"==typeof e)throw new d("trailers must be defined");return this[c]=e,this}replyContentLength(){return this[l]=!0,this}},e.exports.MockScope=E},5846:(e,t,s)=>{"use strict";const{promisify:r}=s(7975),n=s(8542),{buildMockDispatch:A}=s(991),{kDispatches:i,kMockAgent:o,kClose:a,kOriginalClose:c,kOrigin:l,kOriginalDispatch:h,kConnected:g,kIgnoreTrailingSlash:d}=s(3435),{MockInterceptor:u}=s(193),E=s(257),{InvalidArgumentError:I}=s(4465);class C extends n{constructor(e,t){if(!t||!t.agent||"function"!=typeof t.agent.dispatch)throw new I("Argument opts.agent must implement Agent");super(e,t),this[o]=t.agent,this[l]=e,this[d]=t.ignoreTrailingSlash??!1,this[i]=[],this[g]=1,this[h]=this.dispatch,this[c]=this.close.bind(this),this.dispatch=A.call(this),this.close=this[a]}get[E.kConnected](){return this[g]}intercept(e){return new u(e&&{ignoreTrailingSlash:this[d],...e},this[i])}cleanMocks(){this[i]=[]}async[a](){await r(this[c])(),this[g]=0,this[o][E.kClients].delete(this[l])}}e.exports=C},3435:e=>{"use strict";e.exports={kAgent:Symbol("agent"),kOptions:Symbol("options"),kFactory:Symbol("factory"),kDispatches:Symbol("dispatches"),kDispatchKey:Symbol("dispatch key"),kDefaultHeaders:Symbol("default headers"),kDefaultTrailers:Symbol("default trailers"),kContentLength:Symbol("content length"),kMockAgent:Symbol("mock agent"),kMockAgentSet:Symbol("mock agent set"),kMockAgentGet:Symbol("mock agent get"),kMockDispatch:Symbol("mock dispatch"),kClose:Symbol("close"),kOriginalClose:Symbol("original agent close"),kOriginalDispatch:Symbol("original dispatch"),kOrigin:Symbol("origin"),kIsMockActive:Symbol("is mock active"),kNetConnect:Symbol("net connect"),kGetNetConnect:Symbol("get net connect"),kConnected:Symbol("connected"),kIgnoreTrailingSlash:Symbol("ignore trailing slash"),kMockAgentMockCallHistoryInstance:Symbol("mock agent mock call history name"),kMockAgentRegisterCallHistory:Symbol("mock agent register mock call history"),kMockAgentAddCallHistoryLog:Symbol("mock agent add call history log"),kMockAgentIsCallHistoryEnabled:Symbol("mock agent is call history enabled"),kMockAgentAcceptsNonStandardSearchParameters:Symbol("mock agent accepts non standard search parameters"),kMockCallHistoryAddLog:Symbol("mock call history add log")}},991:(e,t,s)=>{"use strict";const{MockNotMatchedError:r}=s(3123),{kDispatches:n,kMockAgent:A,kOriginalDispatch:i,kOrigin:o,kGetNetConnect:a}=s(3435),{serializePathWithQuery:c}=s(2858),{STATUS_CODES:l}=s(7067),{types:{isPromise:h}}=s(7975),{InvalidArgumentError:g}=s(4465);function d(e,t){return"string"==typeof e?e===t:e instanceof RegExp?e.test(t):"function"==typeof e&&!0===e(t)}function u(e){return Object.fromEntries(Object.entries(e).map((([e,t])=>[e.toLocaleLowerCase(),t])))}function E(e,t){if(!Array.isArray(e))return"function"==typeof e.get?e.get(t):u(e)[t.toLocaleLowerCase()];for(let s=0;s<e.length;s+=2)if(e[s].toLocaleLowerCase()===t.toLocaleLowerCase())return e[s+1]}function I(e){const t=e.slice(),s=[];for(let e=0;e<t.length;e+=2)s.push([t[e],t[e+1]]);return Object.fromEntries(s)}function C(e,t){if("function"==typeof e.headers)return Array.isArray(t)&&(t=I(t)),e.headers(t?u(t):{});if("undefined"==typeof e.headers)return!0;if("object"!=typeof t||"object"!=typeof e.headers)return!1;for(const[s,r]of Object.entries(e.headers)){if(!d(r,E(t,s)))return!1}return!0}function B(e){if("string"!=typeof e)return e;const t=e.split("?",3);if(2!==t.length)return e;const s=new URLSearchParams(t.pop());return s.sort(),[...t,s.toString()].join("?")}function Q(e){return Buffer.isBuffer(e)||e instanceof Uint8Array||e instanceof ArrayBuffer?e:"object"==typeof e?JSON.stringify(e):e?e.toString():""}function p(e,t){const s=t.query?c(t.path,t.query):t.path,n="string"==typeof s?B(s):s,A=m(n);let i=e.filter((({consumed:e})=>!e)).filter((({path:e,ignoreTrailingSlash:t})=>t?d(m(B(e)),A):d(B(e),n)));if(0===i.length)throw new r(`Mock dispatch not matched for path '${n}'`);if(i=i.filter((({method:e})=>d(e,t.method))),0===i.length)throw new r(`Mock dispatch not matched for method '${t.method}' on path '${n}'`);if(i=i.filter((({body:e})=>"undefined"==typeof e||d(e,t.body))),0===i.length)throw new r(`Mock dispatch not matched for body '${t.body}' on path '${n}'`);if(i=i.filter((e=>C(e,t.headers))),0===i.length){const e="object"==typeof t.headers?JSON.stringify(t.headers):t.headers;throw new r(`Mock dispatch not matched for headers '${e}' on path '${n}'`)}return i[0]}function f(e,t){const s=e.findIndex((e=>!!e.consumed&&function(e,{path:t,method:s,body:r,headers:n}){const A=d(e.path,t),i=d(e.method,s),o="undefined"==typeof e.body||d(e.body,r),a=C(e,n);return A&&i&&o&&a}(e,t)));-1!==s&&e.splice(s,1)}function m(e){for(;e.endsWith("/");)e=e.slice(0,-1);return 0===e.length&&(e="/"),e}function y(e){const{path:t,method:s,body:r,headers:n,query:A}=e;return{path:t,method:s,body:r,headers:n,query:A}}function w(e){const t=Object.keys(e),s=[];for(let r=0;r<t.length;++r){const n=t[r],A=e[n],i=Buffer.from(`${n}`);if(Array.isArray(A))for(let e=0;e<A.length;++e)s.push(i,Buffer.from(`${A[e]}`));else s.push(i,Buffer.from(`${A}`))}return s}function S(e){return l[e]||"unknown"}function D(e,t){const s=y(e),r=p(this[n],s);r.timesInvoked++,r.data.callback&&(r.data={...r.data,...r.data.callback(e)});const{data:{statusCode:A,data:i,headers:o,trailers:a,error:c},delay:l,persist:g}=r,{timesInvoked:d,times:u}=r;if(r.consumed=!g&&d>=u,r.pending=d<u,null!==c)return f(this[n],s),t.onError(c),!0;function E(r,n=i){const c=Array.isArray(e.headers)?I(e.headers):e.headers,l="function"==typeof n?n({...e,headers:c}):n;if(h(l))return void l.then((e=>E(r,e)));const g=Q(l),d=w(o),u=w(a);t.onConnect?.((e=>t.onError(e)),null),t.onHeaders?.(A,d,C,S(A)),t.onData?.(Buffer.from(g)),t.onComplete?.(u),f(r,s)}function C(){}return"number"==typeof l&&l>0?setTimeout((()=>{E(this[n])}),l):E(this[n]),!0}function b(e,t){const s=new URL(t);return!0===e||!(!Array.isArray(e)||!e.some((e=>d(e,s.host))))}e.exports={getResponseData:Q,getMockDispatch:p,addMockDispatch:function(e,t,s,r){const n={...{timesInvoked:0,times:1,persist:!1,consumed:!1,...r},...t,pending:!0,data:{error:null,..."function"==typeof s?{callback:s}:{...s}}};return e.push(n),n},deleteMockDispatch:f,buildKey:y,generateKeyValues:w,matchValue:d,getResponse:async function(e){const t=[];for await(const s of e)t.push(s);return Buffer.concat(t).toString("utf8")},getStatusText:S,mockDispatch:D,buildMockDispatch:function(){const e=this[A],t=this[o],s=this[i];return function(n,A){if(e.isMockActive)try{D.call(this,n,A)}catch(i){if("UND_MOCK_ERR_MOCK_NOT_MATCHED"!==i.code)throw i;{const o=e[a]();if(!1===o)throw new r(`${i.message}: subsequent request to origin ${t} was not allowed (net.connect disabled)`);if(!b(o,t))throw new r(`${i.message}: subsequent request to origin ${t} was not allowed (net.connect is not enabled for this origin)`);s.call(this,n,A)}}else s.call(this,n,A)}},checkNetConnect:b,buildAndValidateMockOptions:function(e){const{agent:t,...s}=e;if("enableCallHistory"in s&&"boolean"!=typeof s.enableCallHistory)throw new g("options.enableCallHistory must to be a boolean");if("acceptNonStandardSearchParameters"in s&&"boolean"!=typeof s.acceptNonStandardSearchParameters)throw new g("options.acceptNonStandardSearchParameters must to be a boolean");if("ignoreTrailingSlash"in s&&"boolean"!=typeof s.ignoreTrailingSlash)throw new g("options.ignoreTrailingSlash must to be a boolean");return s},getHeaderByName:E,buildHeadersFromArray:I,normalizeSearchParams:function(e){if("string"!=typeof e)return e;const t=new URLSearchParams(e),s=new URLSearchParams;for(let[e,r]of t.entries()){e=e.replace("[]","");if(/^(['"]).*\1$/.test(r))s.append(e,r);else if(r.includes(",")){const t=r.split(",");for(const r of t)s.append(e,r)}else s.append(e,r)}return s}}},164:(e,t,s)=>{"use strict";const{Transform:r}=s(7075),{Console:n}=s(7540),A=process.versions.icu?"✅":"Y ",i=process.versions.icu?"❌":"N ";e.exports=class{constructor({disableColors:e}={}){this.transform=new r({transform(e,t,s){s(null,e)}}),this.logger=new n({stdout:this.transform,inspectOptions:{colors:!e&&!process.env.CI}})}format(e){const t=e.map((({method:e,path:t,data:{statusCode:s},persist:r,times:n,timesInvoked:o,origin:a})=>({Method:e,Origin:a,Path:t,"Status code":s,Persistent:r?A:i,Invocations:o,Remaining:r?1/0:n-o})));return this.logger.table(t),this.transform.read().toString()}}},1313:(e,t,s)=>{"use strict";const r=s(3315),n=s(7467),{SnapshotRecorder:A}=s(6632),i=s(832),{InvalidArgumentError:o,UndiciError:a}=s(4465),{validateSnapshotMode:c}=s(5505),l=Symbol("kSnapshotRecorder"),h=Symbol("kSnapshotMode"),g=Symbol("kSnapshotPath"),d=Symbol("kSnapshotLoaded"),u=Symbol("kRealAgent");let E=!1;e.exports=class extends n{constructor(e={}){E||(process.emitWarning("SnapshotAgent is experimental and subject to change","ExperimentalWarning"),E=!0);const{mode:t="record",snapshotPath:s=null,...n}=e;if(super(n),c(t),("playback"===t||"update"===t)&&!s)throw new o(`snapshotPath is required when mode is '${t}'`);this[h]=t,this[g]=s,this[l]=new A({snapshotPath:this[g],mode:this[h],maxSnapshots:e.maxSnapshots,autoFlush:e.autoFlush,flushInterval:e.flushInterval,matchHeaders:e.matchHeaders,ignoreHeaders:e.ignoreHeaders,excludeHeaders:e.excludeHeaders,matchBody:e.matchBody,matchQuery:e.matchQuery,caseSensitive:e.caseSensitive,shouldRecord:e.shouldRecord,shouldPlayback:e.shouldPlayback,excludeUrls:e.excludeUrls}),this[d]=!1,"record"!==this[h]&&"update"!==this[h]||(this[u]=new r(e)),"playback"!==this[h]&&"update"!==this[h]||!this[g]||this.loadSnapshots().catch((()=>{}))}dispatch(e,t){t=i.wrap(t);const s=this[h];if("playback"===s||"update"===s){if(!this[d])return this.#me(e,t);const r=this[l].findSnapshot(e);if(r)return this.#ye(r,t);if("update"===s)return this.#we(e,t);{const s=new a(`No snapshot found for ${e.method||"GET"} ${e.path}`);if(t.onError)return void t.onError(s);throw s}}if("record"===s)return this.#we(e,t)}async#me(e,t){return await this.loadSnapshots(),this.dispatch(e,t)}#we(e,t){const s={statusCode:null,headers:{},trailers:{},body:[]},r=this,n={onRequestStart(e,s){return t.onRequestStart(e,{...s,history:this.history})},onRequestUpgrade:(e,s,r,n)=>t.onRequestUpgrade(e,s,r,n),onResponseStart:(e,r,n,A)=>(s.statusCode=r,s.headers=n,t.onResponseStart(e,r,n,A)),onResponseData:(e,r)=>(s.body.push(r),t.onResponseData(e,r)),onResponseEnd(n,A){s.trailers=A;const i=Buffer.concat(s.body);r[l].record(e,{statusCode:s.statusCode,headers:s.headers,body:i,trailers:s.trailers}).then((()=>{t.onResponseEnd(n,A)})).catch((e=>{t.onResponseError(n,e)}))}};return this[u].dispatch(e,n)}#ye(e,t){try{const{response:s}=e,r={pause(){},resume(){},abort(e){this.aborted=!0,this.reason=e},aborted:!1,paused:!1};t.onRequestStart(r),t.onResponseStart(r,s.statusCode,s.headers);const n=Buffer.from(s.body,"base64");t.onResponseData(r,n),t.onResponseEnd(r,s.trailers)}catch(e){t.onError?.(e)}}async loadSnapshots(e){await this[l].loadSnapshots(e||this[g]),this[d]=!0,"playback"===this[h]&&this.#Se()}async saveSnapshots(e){return this[l].saveSnapshots(e||this[g])}#Se(){for(const e of this[l].getSnapshots()){const{request:t,responses:s,response:r}=e,n=new URL(t.url),A=this.get(n.origin),i=s?s[0]:r;i&&A.intercept({path:n.pathname+n.search,method:t.method,headers:t.headers,body:t.body}).reply(i.statusCode,i.body,{headers:i.headers,trailers:i.trailers}).persist()}}getRecorder(){return this[l]}getMode(){return this[h]}clearSnapshots(){this[l].clear()}resetCallCounts(){this[l].resetCallCounts()}deleteSnapshot(e){return this[l].deleteSnapshot(e)}getSnapshotInfo(e){return this[l].getSnapshotInfo(e)}replaceSnapshots(e){this[l].replaceSnapshots(e)}async close(){await this[l].close(),await(this[u]?.close()),await super.close()}}},6632:(e,t,s)=>{"use strict";const{writeFile:r,readFile:n,mkdir:A}=s(1455),{dirname:i,resolve:o}=s(6760),{setTimeout:a,clearTimeout:c}=s(7997),{InvalidArgumentError:l,UndiciError:h}=s(4465),{hashId:g,isUrlExcludedFactory:d,normalizeHeaders:u,createHeaderFilters:E}=s(5505);function I(e,t,s={}){const r=new URL(e.path,e.origin),n=e._normalizedHeaders||u(e.headers);return e._normalizedHeaders||(e._normalizedHeaders=n),{method:e.method||"GET",url:!1!==s.matchQuery?r.toString():`${r.origin}${r.pathname}`,headers:C(n,t,s),body:!1!==s.matchBody&&e.body?String(e.body):""}}function C(e,t,s={}){if(!e||"object"!=typeof e)return{};const{caseSensitive:r=!1}=s,n={},{ignore:A,exclude:i,match:o}=t;for(const[t,s]of Object.entries(e)){const e=r?t:t.toLowerCase();i.has(e)||(A.has(e)||(0===o.size||o.has(e))&&(n[e]=s))}return n}function B(e,t,s={}){if(!e||"object"!=typeof e)return{};const{caseSensitive:r=!1}=s,n={},{exclude:A}=t;for(const[t,s]of Object.entries(e)){const e=r?t:t.toLowerCase();A.has(e)||(n[e]=s)}return n}function Q(e){const t=[e.method,e.url];if(e.headers&&"object"==typeof e.headers){const s=Object.keys(e.headers).sort();for(const r of s){const s=Array.isArray(e.headers[r])?e.headers[r]:[e.headers[r]];t.push(r);for(const e of s.sort())t.push(String(e))}}t.push(e.body);const s=t.join("|");return g(s)}e.exports={SnapshotRecorder:class{#De;#be;#ve=new Map;#Re;#Ne=1/0;#ke=!1;#Te;constructor(e={}){this.#Re=e.snapshotPath,this.#Ne=e.maxSnapshots||1/0,this.#ke=e.autoFlush||!1,this.flushInterval=e.flushInterval||3e4,this._flushTimer=null,this.matchOptions={matchHeaders:e.matchHeaders||[],ignoreHeaders:e.ignoreHeaders||[],excludeHeaders:e.excludeHeaders||[],matchBody:!1!==e.matchBody,matchQuery:!1!==e.matchQuery,caseSensitive:e.caseSensitive||!1},this.#Te=E(this.matchOptions),this.shouldRecord=e.shouldRecord||(()=>!0),this.shouldPlayback=e.shouldPlayback||(()=>!0),this.#be=d(e.excludeUrls),this.#ke&&this.#Re&&this.#Fe()}async record(e,t){if(!this.shouldRecord(e))return;const s=new URL(e.path,e.origin).toString();if(this.#be(s))return;const r=I(e,this.#Te,this.matchOptions),n=Q(r),A=u(t.headers),i={statusCode:t.statusCode,headers:B(A,this.#Te,this.matchOptions),body:Buffer.isBuffer(t.body)?t.body.toString("base64"):Buffer.from(String(t.body||"")).toString("base64"),trailers:t.trailers};if(this.#ve.size>=this.#Ne&&!this.#ve.has(n)){const e=this.#ve.keys().next().value;this.#ve.delete(e)}const o=this.#ve.get(n);o&&o.responses?(o.responses.push(i),o.timestamp=(new Date).toISOString()):this.#ve.set(n,{request:r,responses:[i],callCount:0,timestamp:(new Date).toISOString()}),this.#ke&&this.#Re&&this.#Me()}findSnapshot(e){if(!this.shouldPlayback(e))return;const t=new URL(e.path,e.origin).toString();if(this.#be(t))return;const s=Q(I(e,this.#Te,this.matchOptions)),r=this.#ve.get(s);if(!r)return;const n=r.callCount||0,A=Math.min(n,r.responses.length-1);return r.callCount=n+1,{...r,response:r.responses[A]}}async loadSnapshots(e){const t=e||this.#Re;if(!t)throw new l("Snapshot path is required");try{const e=await n(o(t),"utf8"),s=JSON.parse(e);if(Array.isArray(s)){this.#ve.clear();for(const{hash:e,snapshot:t}of s)this.#ve.set(e,t)}else this.#ve=new Map(Object.entries(s))}catch(e){if("ENOENT"!==e.code)throw new h(`Failed to load snapshots from ${t}`,{cause:e});this.#ve.clear()}}async saveSnapshots(e){const t=e||this.#Re;if(!t)throw new l("Snapshot path is required");const s=o(t);await A(i(s),{recursive:!0});const n=Array.from(this.#ve.entries()).map((([e,t])=>({hash:e,snapshot:t})));await r(s,JSON.stringify(n,null,2),{flush:!0})}clear(){this.#ve.clear()}getSnapshots(){return Array.from(this.#ve.values())}size(){return this.#ve.size}resetCallCounts(){for(const e of this.#ve.values())e.callCount=0}deleteSnapshot(e){const t=Q(I(e,this.#Te,this.matchOptions));return this.#ve.delete(t)}getSnapshotInfo(e){const t=Q(I(e,this.#Te,this.matchOptions)),s=this.#ve.get(t);return s?{hash:t,request:s.request,responseCount:s.responses?s.responses.length:s.response?1:0,callCount:s.callCount||0,timestamp:s.timestamp}:null}replaceSnapshots(e){if(this.#ve.clear(),Array.isArray(e))for(const{hash:t,snapshot:s}of e)this.#ve.set(t,s);else e&&"object"==typeof e&&(this.#ve=new Map(Object.entries(e)))}#Fe(){return this.#Me()}#Ue(){this.#De&&(c(this.#De),this.saveSnapshots().catch((()=>{})),this.#De=null)}#Me(){this.#De=a((()=>{this.saveSnapshots().catch((()=>{})),this.#ke?this.#De?.refresh():this.#De=null}),1e3)}destroy(){this.#Ue(),this.#De&&(c(this.#De),this.#De=null)}async close(){this.#Re&&0!==this.#ve.size&&await this.saveSnapshots(),this.destroy()}},formatRequestKey:I,createRequestHash:Q,filterHeadersForMatching:C,filterHeadersForStorage:B,createHeaderFilters:E}},5505:(e,t,s)=>{"use strict";const{InvalidArgumentError:r}=s(4465);let n;try{n=s(7598)}catch{}const A=n?.hash?e=>n.hash("sha256",e,"base64url"):e=>Buffer.from(e).toString("base64url");function i(e){return Array.isArray(e)&&!(1&e.length)}const o=["record","playback","update"];e.exports={createHeaderFilters:function(e={}){const{ignoreHeaders:t=[],excludeHeaders:s=[],matchHeaders:r=[],caseSensitive:n=!1}=e;return{ignore:new Set(t.map((e=>n?e:e.toLowerCase()))),exclude:new Set(s.map((e=>n?e:e.toLowerCase()))),match:new Set(r.map((e=>n?e:e.toLowerCase())))}},hashId:A,isUndiciHeaders:i,normalizeHeaders:function(e){const t={};if(!e)return t;if(i(e)){for(let s=0;s<e.length;s+=2){const r=e[s],n=e[s+1];if(r&&void 0!==n){const e=Buffer.isBuffer(r)?r.toString():r,s=Buffer.isBuffer(n)?n.toString():n;t[e.toLowerCase()]=s}}return t}if(e&&"object"==typeof e)for(const[s,r]of Object.entries(e))s&&"string"==typeof s&&(t[s.toLowerCase()]=Array.isArray(r)?r.join(", "):String(r));return t},isUrlExcludedFactory:function(e=[]){return 0===e.length?()=>!1:function(t){let s;for(const r of e)if("string"==typeof r){if(s||(s=t.toLowerCase()),s.includes(r.toLowerCase()))return!0}else if(r instanceof RegExp&&r.test(t))return!0;return!1}},validateSnapshotMode:function(e){if(!o.includes(e))throw new r(`Invalid snapshot mode: ${e}. Must be one of: ${o.join(", ")}`)}}},9453:(e,t,s)=>{"use strict";const{safeHTTPMethods:r,pathHasQueryOrFragment:n}=s(2858),{serializePathWithQuery:A}=s(2858);e.exports={makeCacheKey:function(e){if(!e.origin)throw new Error("opts.origin is undefined");let t=e.path||"/";return e.query&&!n(e.path)&&(t=A(t,e.query)),{origin:e.origin.toString(),method:e.method,path:t,headers:e.headers}},normalizeHeaders:function(e){let t;if(null==e.headers)t={};else if("function"==typeof e.headers[Symbol.iterator]){t={};for(const s of e.headers){if(!Array.isArray(s))throw new Error("opts.headers is not a valid header map");const[e,r]=s;if("string"!=typeof e||"string"!=typeof r)throw new Error("opts.headers is not a valid header map");t[e.toLowerCase()]=r}}else{if("object"!=typeof e.headers)throw new Error("opts.headers is not an object");t={};for(const s of Object.keys(e.headers))t[s.toLowerCase()]=e.headers[s]}return t},assertCacheKey:function(e){if("object"!=typeof e)throw new TypeError("expected key to be object, got "+typeof e);for(const t of["origin","method","path"])if("string"!=typeof e[t])throw new TypeError(`expected key.${t} to be string, got ${typeof e[t]}`);if(void 0!==e.headers&&"object"!=typeof e.headers)throw new TypeError("expected headers to be object, got "+typeof e)},assertCacheValue:function(e){if("object"!=typeof e)throw new TypeError("expected value to be object, got "+typeof e);for(const t of["statusCode","cachedAt","staleAt","deleteAt"])if("number"!=typeof e[t])throw new TypeError(`expected value.${t} to be number, got ${typeof e[t]}`);if("string"!=typeof e.statusMessage)throw new TypeError("expected value.statusMessage to be string, got "+typeof e.statusMessage);if(null!=e.headers&&"object"!=typeof e.headers)throw new TypeError("expected value.rawHeaders to be object, got "+typeof e.headers);if(void 0!==e.vary&&"object"!=typeof e.vary)throw new TypeError("expected value.vary to be object, got "+typeof e.vary);if(void 0!==e.etag&&"string"!=typeof e.etag)throw new TypeError("expected value.etag to be string, got "+typeof e.etag)},parseCacheControlHeader:function(e){const t={};let s;if(Array.isArray(e)){s=[];for(const t of e)s.push(...t.split(","))}else s=e.split(",");for(let e=0;e<s.length;e++){const r=s[e].toLowerCase(),n=r.indexOf("=");let A,i;switch(-1!==n?(A=r.substring(0,n).trimStart(),i=r.substring(n+1)):A=r.trim(),A){case"min-fresh":case"max-stale":case"max-age":case"s-maxage":case"stale-while-revalidate":case"stale-if-error":{if(void 0===i||" "===i[0])continue;i.length>=2&&'"'===i[0]&&'"'===i[i.length-1]&&(i=i.substring(1,i.length-1));const e=parseInt(i,10);if(e!=e)continue;if("max-age"===A&&A in t&&t[A]>=e)continue;t[A]=e;break}case"private":case"no-cache":if(i){if('"'===i[0]){const r=[i.substring(1)];let n='"'===i[i.length-1];if(!n)for(let t=e+1;t<s.length;t++){const e=s[t],A=e.length;if(r.push(e.trim()),0!==A&&'"'===e[A-1]){n=!0;break}}if(n){let e=r[r.length-1];'"'===e[e.length-1]&&(e=e.substring(0,e.length-1),r[r.length-1]=e),t[A]=A in t?t[A].concat(r):r}}else t[A]=A in t?t[A].concat(i):[i];break}case"public":case"no-store":case"must-revalidate":case"proxy-revalidate":case"immutable":case"no-transform":case"must-understand":case"only-if-cached":if(i)continue;t[A]=!0;break;default:continue}}return t},parseVaryHeader:function(e,t){if("string"==typeof e&&e.includes("*"))return t;const s={},r="string"==typeof e?e.split(","):e;for(const e of r){const r=e.trim().toLowerCase();s[r]=t[r]??null}return s},isEtagUsable:function(e){return!(e.length<=2)&&('"'===e[0]&&'"'===e[e.length-1]?!('"'===e[1]||e.startsWith('"W/')):!(!e.startsWith('W/"')||'"'!==e[e.length-1])&&4!==e.length)},assertCacheMethods:function(e,t="CacheMethods"){if(!Array.isArray(e))throw new TypeError(`expected type of ${t} needs to be an array, got ${null===e?"null":typeof e}`);if(0===e.length)throw new TypeError(`${t} needs to have at least one method`);for(const s of e)if(!r.includes(s))throw new TypeError(`element of ${t}-array needs to be one of following values: ${r.join(", ")}, got ${s}`)},assertCacheStore:function(e,t="CacheStore"){if("object"!=typeof e||null===e)throw new TypeError(`expected type of ${t} to be a CacheStore, got ${null===e?"null":typeof e}`);for(const s of["get","createWriteStream","delete"])if("function"!=typeof e[s])throw new TypeError(`${t} needs to have a \`${s}()\` function`)}}},8851:e=>{"use strict";e.exports={parseHttpDate:function(e){switch(e[3]){case",":return function(e){if(29!==e.length||" "!==e[4]||" "!==e[7]||" "!==e[11]||" "!==e[16]||":"!==e[19]||":"!==e[22]||" "!==e[25]||"G"!==e[26]||"M"!==e[27]||"T"!==e[28])return;let t=-1;if("S"===e[0]&&"u"===e[1]&&"n"===e[2])t=0;else if("M"===e[0]&&"o"===e[1]&&"n"===e[2])t=1;else if("T"===e[0]&&"u"===e[1]&&"e"===e[2])t=2;else if("W"===e[0]&&"e"===e[1]&&"d"===e[2])t=3;else if("T"===e[0]&&"h"===e[1]&&"u"===e[2])t=4;else if("F"===e[0]&&"r"===e[1]&&"i"===e[2])t=5;else{if("S"!==e[0]||"a"!==e[1]||"t"!==e[2])return;t=6}let s=0;if("0"===e[5]){const t=e.charCodeAt(6);if(t<49||t>57)return;s=t-48}else{const t=e.charCodeAt(5);if(t<49||t>51)return;const r=e.charCodeAt(6);if(r<48||r>57)return;s=10*(t-48)+(r-48)}let r=-1;if("J"===e[8]&&"a"===e[9]&&"n"===e[10])r=0;else if("F"===e[8]&&"e"===e[9]&&"b"===e[10])r=1;else if("M"===e[8]&&"a"===e[9])if("r"===e[10])r=2;else{if("y"!==e[10])return;r=4}else if("J"===e[8])if("a"===e[9]&&"n"===e[10])r=0;else{if("u"!==e[9])return;if("n"===e[10])r=5;else{if("l"!==e[10])return;r=6}}else if("A"===e[8])if("p"===e[9]&&"r"===e[10])r=3;else{if("u"!==e[9]||"g"!==e[10])return;r=7}else if("S"===e[8]&&"e"===e[9]&&"p"===e[10])r=8;else if("O"===e[8]&&"c"===e[9]&&"t"===e[10])r=9;else if("N"===e[8]&&"o"===e[9]&&"v"===e[10])r=10;else{if("D"!==e[8]||"e"!==e[9]||"c"!==e[10])return;r=11}const n=e.charCodeAt(12);if(n<48||n>57)return;const A=e.charCodeAt(13);if(A<48||A>57)return;const i=e.charCodeAt(14);if(i<48||i>57)return;const o=e.charCodeAt(15);if(o<48||o>57)return;const a=1e3*(n-48)+100*(A-48)+10*(i-48)+(o-48);let c=0;if("0"===e[17]){const t=e.charCodeAt(18);if(t<48||t>57)return;c=t-48}else{const t=e.charCodeAt(17);if(t<48||t>50)return;const s=e.charCodeAt(18);if(s<48||s>57)return;if(50===t&&s>51)return;c=10*(t-48)+(s-48)}let l=0;if("0"===e[20]){const t=e.charCodeAt(21);if(t<48||t>57)return;l=t-48}else{const t=e.charCodeAt(20);if(t<48||t>53)return;const s=e.charCodeAt(21);if(s<48||s>57)return;l=10*(t-48)+(s-48)}let h=0;if("0"===e[23]){const t=e.charCodeAt(24);if(t<48||t>57)return;h=t-48}else{const t=e.charCodeAt(23);if(t<48||t>53)return;const s=e.charCodeAt(24);if(s<48||s>57)return;h=10*(t-48)+(s-48)}const g=new Date(Date.UTC(a,r,s,c,l,h));return g.getUTCDay()===t?g:void 0}(e);case" ":return function(e){if(24!==e.length||" "!==e[7]||" "!==e[10]||" "!==e[19])return;let t=-1;if("S"===e[0]&&"u"===e[1]&&"n"===e[2])t=0;else if("M"===e[0]&&"o"===e[1]&&"n"===e[2])t=1;else if("T"===e[0]&&"u"===e[1]&&"e"===e[2])t=2;else if("W"===e[0]&&"e"===e[1]&&"d"===e[2])t=3;else if("T"===e[0]&&"h"===e[1]&&"u"===e[2])t=4;else if("F"===e[0]&&"r"===e[1]&&"i"===e[2])t=5;else{if("S"!==e[0]||"a"!==e[1]||"t"!==e[2])return;t=6}let s=-1;if("J"===e[4]&&"a"===e[5]&&"n"===e[6])s=0;else if("F"===e[4]&&"e"===e[5]&&"b"===e[6])s=1;else if("M"===e[4]&&"a"===e[5])if("r"===e[6])s=2;else{if("y"!==e[6])return;s=4}else if("J"===e[4])if("a"===e[5]&&"n"===e[6])s=0;else{if("u"!==e[5])return;if("n"===e[6])s=5;else{if("l"!==e[6])return;s=6}}else if("A"===e[4])if("p"===e[5]&&"r"===e[6])s=3;else{if("u"!==e[5]||"g"!==e[6])return;s=7}else if("S"===e[4]&&"e"===e[5]&&"p"===e[6])s=8;else if("O"===e[4]&&"c"===e[5]&&"t"===e[6])s=9;else if("N"===e[4]&&"o"===e[5]&&"v"===e[6])s=10;else{if("D"!==e[4]||"e"!==e[5]||"c"!==e[6])return;s=11}let r=0;if(" "===e[8]){const t=e.charCodeAt(9);if(t<49||t>57)return;r=t-48}else{const t=e.charCodeAt(8);if(t<49||t>51)return;const s=e.charCodeAt(9);if(s<48||s>57)return;r=10*(t-48)+(s-48)}let n=0;if("0"===e[11]){const t=e.charCodeAt(12);if(t<48||t>57)return;n=t-48}else{const t=e.charCodeAt(11);if(t<48||t>50)return;const s=e.charCodeAt(12);if(s<48||s>57)return;if(50===t&&s>51)return;n=10*(t-48)+(s-48)}let A=0;if("0"===e[14]){const t=e.charCodeAt(15);if(t<48||t>57)return;A=t-48}else{const t=e.charCodeAt(14);if(t<48||t>53)return;const s=e.charCodeAt(15);if(s<48||s>57)return;A=10*(t-48)+(s-48)}let i=0;if("0"===e[17]){const t=e.charCodeAt(18);if(t<48||t>57)return;i=t-48}else{const t=e.charCodeAt(17);if(t<48||t>53)return;const s=e.charCodeAt(18);if(s<48||s>57)return;i=10*(t-48)+(s-48)}const o=e.charCodeAt(20);if(o<48||o>57)return;const a=e.charCodeAt(21);if(a<48||a>57)return;const c=e.charCodeAt(22);if(c<48||c>57)return;const l=e.charCodeAt(23);if(l<48||l>57)return;const h=1e3*(o-48)+100*(a-48)+10*(c-48)+(l-48),g=new Date(Date.UTC(h,s,r,n,A,i));return g.getUTCDay()===t?g:void 0}(e);default:return function(e){let t=-1,s=-1;if("S"===e[0])"u"===e[1]&&"n"===e[2]&&"d"===e[3]&&"a"===e[4]&&"y"===e[5]?(s=0,t=6):"a"===e[1]&&"t"===e[2]&&"u"===e[3]&&"r"===e[4]&&"d"===e[5]&&"a"===e[6]&&"y"===e[7]&&(s=6,t=8);else if("M"===e[0]&&"o"===e[1]&&"n"===e[2]&&"d"===e[3]&&"a"===e[4]&&"y"===e[5])s=1,t=6;else if("T"===e[0])"u"===e[1]&&"e"===e[2]&&"s"===e[3]&&"d"===e[4]&&"a"===e[5]&&"y"===e[6]?(s=2,t=7):"h"===e[1]&&"u"===e[2]&&"r"===e[3]&&"s"===e[4]&&"d"===e[5]&&"a"===e[6]&&"y"===e[7]&&(s=4,t=8);else if("W"===e[0]&&"e"===e[1]&&"d"===e[2]&&"n"===e[3]&&"e"===e[4]&&"s"===e[5]&&"d"===e[6]&&"a"===e[7]&&"y"===e[8])s=3,t=9;else{if("F"!==e[0]||"r"!==e[1]||"i"!==e[2]||"d"!==e[3]||"a"!==e[4]||"y"!==e[5])return;s=5,t=6}if(","!==e[t]||e.length-t-1!=23||" "!==e[t+1]||"-"!==e[t+4]||"-"!==e[t+8]||" "!==e[t+11]||":"!==e[t+14]||":"!==e[t+17]||" "!==e[t+20]||"G"!==e[t+21]||"M"!==e[t+22]||"T"!==e[t+23])return;let r=0;if("0"===e[t+2]){const s=e.charCodeAt(t+3);if(s<49||s>57)return;r=s-48}else{const s=e.charCodeAt(t+2);if(s<49||s>51)return;const n=e.charCodeAt(t+3);if(n<48||n>57)return;r=10*(s-48)+(n-48)}let n=-1;if("J"===e[t+5]&&"a"===e[t+6]&&"n"===e[t+7])n=0;else if("F"===e[t+5]&&"e"===e[t+6]&&"b"===e[t+7])n=1;else if("M"===e[t+5]&&"a"===e[t+6]&&"r"===e[t+7])n=2;else if("A"===e[t+5]&&"p"===e[t+6]&&"r"===e[t+7])n=3;else if("M"===e[t+5]&&"a"===e[t+6]&&"y"===e[t+7])n=4;else if("J"===e[t+5]&&"u"===e[t+6]&&"n"===e[t+7])n=5;else if("J"===e[t+5]&&"u"===e[t+6]&&"l"===e[t+7])n=6;else if("A"===e[t+5]&&"u"===e[t+6]&&"g"===e[t+7])n=7;else if("S"===e[t+5]&&"e"===e[t+6]&&"p"===e[t+7])n=8;else if("O"===e[t+5]&&"c"===e[t+6]&&"t"===e[t+7])n=9;else if("N"===e[t+5]&&"o"===e[t+6]&&"v"===e[t+7])n=10;else{if("D"!==e[t+5]||"e"!==e[t+6]||"c"!==e[t+7])return;n=11}const A=e.charCodeAt(t+9);if(A<48||A>57)return;const i=e.charCodeAt(t+10);if(i<48||i>57)return;let o=10*(A-48)+(i-48);o+=o<70?2e3:1900;let a=0;if("0"===e[t+12]){const s=e.charCodeAt(t+13);if(s<48||s>57)return;a=s-48}else{const s=e.charCodeAt(t+12);if(s<48||s>50)return;const r=e.charCodeAt(t+13);if(r<48||r>57)return;if(50===s&&r>51)return;a=10*(s-48)+(r-48)}let c=0;if("0"===e[t+15]){const s=e.charCodeAt(t+16);if(s<48||s>57)return;c=s-48}else{const s=e.charCodeAt(t+15);if(s<48||s>53)return;const r=e.charCodeAt(t+16);if(r<48||r>57)return;c=10*(s-48)+(r-48)}let l=0;if("0"===e[t+18]){const s=e.charCodeAt(t+19);if(s<48||s>57)return;l=s-48}else{const s=e.charCodeAt(t+18);if(s<48||s>53)return;const r=e.charCodeAt(t+19);if(r<48||r>57)return;l=10*(s-48)+(r-48)}const h=new Date(Date.UTC(o,n,r,a,c,l));return h.getUTCDay()===s?h:void 0}(e)}}}},9250:e=>{"use strict";e.exports={createDeferredPromise:function(){let e,t;return{promise:new Promise(((s,r)=>{e=s,t=r})),resolve:e,reject:t}}}},4304:(e,t,s)=>{"use strict";const{kConnected:r,kPending:n,kRunning:A,kSize:i,kFree:o,kQueued:a}=s(257);e.exports={ClientStats:class{constructor(e){this.connected=e[r],this.pending=e[n],this.running=e[A],this.size=e[i]}},PoolStats:class{constructor(e){this.connected=e[r],this.free=e[o],this.pending=e[n],this.queued=e[a],this.running=e[A],this.size=e[i]}}}},3801:e=>{"use strict";let t=0;const s=1e3;let r;const n=Symbol("kFastTimer"),A=[];function i(){t+=499;let e=0,s=A.length;for(;e<s;){const r=A[e];0===r._state?(r._idleStart=t-499,r._state=1):1===r._state&&t>=r._idleStart+r._idleTimeout&&(r._state=-1,r._idleStart=-1,r._onTimeout(r._timerArg)),-1===r._state?(r._state=-2,0!=--s&&(A[e]=A[s])):++e}A.length=s,0!==A.length&&o()}function o(){r?.refresh?r.refresh():(clearTimeout(r),r=setTimeout(i,499),r?.unref())}class a{[n]=!0;_state=-2;_idleTimeout=-1;_idleStart=-1;_onTimeout;_timerArg;constructor(e,t,s){this._onTimeout=e,this._idleTimeout=t,this._timerArg=s,this.refresh()}refresh(){-2===this._state&&A.push(this),r&&1!==A.length||o(),this._state=0}clear(){this._state=-1,this._idleStart=-1}}e.exports={setTimeout:(e,t,r)=>t<=s?setTimeout(e,t,r):new a(e,t,r),clearTimeout(e){e[n]?e.clear():clearTimeout(e)},setFastTimeout:(e,t,s)=>new a(e,t,s),clearFastTimeout(e){e.clear()},now:()=>t,tick(e=0){t+=e-s+1,i(),i()},reset(){t=0,A.length=0,clearTimeout(r),r=null},kFastTimer:n}},4420:(e,t,s)=>{"use strict";const r=s(4589),{kConstruct:n}=s(257),{urlEquals:A,getFieldValues:i}=s(3932),{kEnumerableProperty:o,isDisturbed:a}=s(2858),{webidl:c}=s(6097),{cloneResponse:l,fromInnerResponse:h,getResponseState:g}=s(4821),{Request:d,fromInnerRequest:u,getRequestState:E}=s(4609),{fetching:I}=s(7388),{urlIsHttpHttpsScheme:C,readAllBytes:B}=s(6686),{createDeferredPromise:Q}=s(9250);class p{#Le;constructor(){arguments[0]!==n&&c.illegalConstructor(),c.util.markAsUncloneable(this),this.#Le=arguments[1]}async match(e,t={}){c.brandCheck(this,p);const s="Cache.match";c.argumentLengthCheck(arguments,1,s),e=c.converters.RequestInfo(e),t=c.converters.CacheQueryOptions(t,s,"options");const r=this.#He(e,t,1);if(0!==r.length)return r[0]}async matchAll(e=void 0,t={}){c.brandCheck(this,p);return void 0!==e&&(e=c.converters.RequestInfo(e)),t=c.converters.CacheQueryOptions(t,"Cache.matchAll","options"),this.#He(e,t)}async add(e){c.brandCheck(this,p);c.argumentLengthCheck(arguments,1,"Cache.add");const t=[e=c.converters.RequestInfo(e)],s=this.addAll(t);return await s}async addAll(e){c.brandCheck(this,p);const t="Cache.addAll";c.argumentLengthCheck(arguments,1,t);const s=[],r=[];for(let s of e){if(void 0===s)throw c.errors.conversionFailed({prefix:t,argument:"Argument 1",types:["undefined is not allowed"]});if(s=c.converters.RequestInfo(s),"string"==typeof s)continue;const e=E(s);if(!C(e.url)||"GET"!==e.method)throw c.errors.exception({header:t,message:"Expected http/s scheme when method is not GET."})}const n=[];for(const A of e){const e=E(new d(A));if(!C(e.url))throw c.errors.exception({header:t,message:"Expected http/s scheme."});e.initiator="fetch",e.destination="subresource",r.push(e);const o=Q();n.push(I({request:e,processResponse(e){if("error"===e.type||206===e.status||e.status<200||e.status>299)o.reject(c.errors.exception({header:"Cache.addAll",message:"Received an invalid status code or the request failed."}));else if(e.headersList.contains("vary")){const t=i(e.headersList.get("vary"));for(const e of t)if("*"===e){o.reject(c.errors.exception({header:"Cache.addAll",message:"invalid vary field value"}));for(const e of n)e.abort();return}}},processResponseEndOfBody(e){e.aborted?o.reject(new DOMException("aborted","AbortError")):o.resolve(e)}})),s.push(o.promise)}const A=Promise.all(s),o=await A,a=[];let l=0;for(const e of o){const t={type:"put",request:r[l],response:e};a.push(t),l++}const h=Q();let g=null;try{this.#Pe(a)}catch(e){g=e}return queueMicrotask((()=>{null===g?h.resolve(void 0):h.reject(g)})),h.promise}async put(e,t){c.brandCheck(this,p);const s="Cache.put";c.argumentLengthCheck(arguments,2,s),e=c.converters.RequestInfo(e),t=c.converters.Response(t,s,"response");let r=null;if(r=c.is.Request(e)?E(e):E(new d(e)),!C(r.url)||"GET"!==r.method)throw c.errors.exception({header:s,message:"Expected an http/s scheme when method is not GET"});const n=g(t);if(206===n.status)throw c.errors.exception({header:s,message:"Got 206 status"});if(n.headersList.contains("vary")){const e=i(n.headersList.get("vary"));for(const t of e)if("*"===t)throw c.errors.exception({header:s,message:"Got * vary field value"})}if(n.body&&(a(n.body.stream)||n.body.stream.locked))throw c.errors.exception({header:s,message:"Response body is locked or disturbed"});const A=l(n),o=Q();if(null!=n.body){const e=n.body.stream.getReader();B(e,o.resolve,o.reject)}else o.resolve(void 0);const h=[],u={type:"put",request:r,response:A};h.push(u);const I=await o.promise;null!=A.body&&(A.body.source=I);const f=Q();let m=null;try{this.#Pe(h)}catch(e){m=e}return queueMicrotask((()=>{null===m?f.resolve():f.reject(m)})),f.promise}async delete(e,t={}){c.brandCheck(this,p);const s="Cache.delete";c.argumentLengthCheck(arguments,1,s),e=c.converters.RequestInfo(e),t=c.converters.CacheQueryOptions(t,s,"options");let n=null;if(c.is.Request(e)){if(n=E(e),"GET"!==n.method&&!t.ignoreMethod)return!1}else r("string"==typeof e),n=E(new d(e));const A=[],i={type:"delete",request:n,options:t};A.push(i);const o=Q();let a,l=null;try{a=this.#Pe(A)}catch(e){l=e}return queueMicrotask((()=>{null===l?o.resolve(!!a?.length):o.reject(l)})),o.promise}async keys(e=void 0,t={}){c.brandCheck(this,p);void 0!==e&&(e=c.converters.RequestInfo(e)),t=c.converters.CacheQueryOptions(t,"Cache.keys","options");let s=null;if(void 0!==e)if(c.is.Request(e)){if(s=E(e),"GET"!==s.method&&!t.ignoreMethod)return[]}else"string"==typeof e&&(s=E(new d(e)));const r=Q(),n=[];if(void 0===e)for(const e of this.#Le)n.push(e[0]);else{const e=this.#xe(s,t);for(const t of e)n.push(t[0])}return queueMicrotask((()=>{const e=[];for(const t of n){const s=u(t,void 0,(new AbortController).signal,"immutable");e.push(s)}r.resolve(Object.freeze(e))})),r.promise}#Pe(e){const t=this.#Le,s=[...t],n=[],A=[];try{for(const s of e){if("delete"!==s.type&&"put"!==s.type)throw c.errors.exception({header:"Cache.#batchCacheOperations",message:'operation type does not match "delete" or "put"'});if("delete"===s.type&&null!=s.response)throw c.errors.exception({header:"Cache.#batchCacheOperations",message:"delete operation should not have an associated response"});if(this.#xe(s.request,s.options,n).length)throw new DOMException("???","InvalidStateError");let e;if("delete"===s.type){if(e=this.#xe(s.request,s.options),0===e.length)return[];for(const s of e){const e=t.indexOf(s);r(-1!==e),t.splice(e,1)}}else if("put"===s.type){if(null==s.response)throw c.errors.exception({header:"Cache.#batchCacheOperations",message:"put operation should have an associated response"});const A=s.request;if(!C(A.url))throw c.errors.exception({header:"Cache.#batchCacheOperations",message:"expected http or https scheme"});if("GET"!==A.method)throw c.errors.exception({header:"Cache.#batchCacheOperations",message:"not get method"});if(null!=s.options)throw c.errors.exception({header:"Cache.#batchCacheOperations",message:"options must not be defined"});e=this.#xe(s.request);for(const s of e){const e=t.indexOf(s);r(-1!==e),t.splice(e,1)}t.push([s.request,s.response]),n.push([s.request,s.response])}A.push([s.request,s.response])}return A}catch(e){throw this.#Le.length=0,this.#Le=s,e}}#xe(e,t,s){const r=[],n=s??this.#Le;for(const s of n){const[n,A]=s;this.#Ye(e,n,A,t)&&r.push(s)}return r}#Ye(e,t,s=null,r){const n=new URL(e.url),o=new URL(t.url);if(r?.ignoreSearch&&(o.search="",n.search=""),!A(n,o,!0))return!1;if(null==s||r?.ignoreVary||!s.headersList.contains("vary"))return!0;const a=i(s.headersList.get("vary"));for(const s of a){if("*"===s)return!1;if(t.headersList.get(s)!==e.headersList.get(s))return!1}return!0}#He(e,t,s=1/0){let r=null;if(void 0!==e)if(c.is.Request(e)){if(r=E(e),"GET"!==r.method&&!t.ignoreMethod)return[]}else"string"==typeof e&&(r=E(new d(e)));const n=[];if(void 0===e)for(const e of this.#Le)n.push(e[1]);else{const e=this.#xe(r,t);for(const t of e)n.push(t[1])}const A=[];for(const e of n){const t=h(e,"immutable");if(A.push(t.clone()),A.length>=s)break}return Object.freeze(A)}}Object.defineProperties(p.prototype,{[Symbol.toStringTag]:{value:"Cache",configurable:!0},match:o,matchAll:o,add:o,addAll:o,put:o,delete:o,keys:o});const f=[{key:"ignoreSearch",converter:c.converters.boolean,defaultValue:()=>!1},{key:"ignoreMethod",converter:c.converters.boolean,defaultValue:()=>!1},{key:"ignoreVary",converter:c.converters.boolean,defaultValue:()=>!1}];c.converters.CacheQueryOptions=c.dictionaryConverter(f),c.converters.MultiCacheQueryOptions=c.dictionaryConverter([...f,{key:"cacheName",converter:c.converters.DOMString}]),c.converters.Response=c.interfaceConverter(c.is.Response,"Response"),c.converters["sequence<RequestInfo>"]=c.sequenceConverter(c.converters.RequestInfo),e.exports={Cache:p}},6939:(e,t,s)=>{"use strict";const{Cache:r}=s(4420),{webidl:n}=s(6097),{kEnumerableProperty:A}=s(2858),{kConstruct:i}=s(257);class o{#Ve=new Map;constructor(){arguments[0]!==i&&n.illegalConstructor(),n.util.markAsUncloneable(this)}async match(e,t={}){if(n.brandCheck(this,o),n.argumentLengthCheck(arguments,1,"CacheStorage.match"),e=n.converters.RequestInfo(e),null!=(t=n.converters.MultiCacheQueryOptions(t)).cacheName){if(this.#Ve.has(t.cacheName)){const s=this.#Ve.get(t.cacheName),n=new r(i,s);return await n.match(e,t)}}else for(const s of this.#Ve.values()){const n=new r(i,s),A=await n.match(e,t);if(void 0!==A)return A}}async has(e){n.brandCheck(this,o);const t="CacheStorage.has";return n.argumentLengthCheck(arguments,1,t),e=n.converters.DOMString(e,t,"cacheName"),this.#Ve.has(e)}async open(e){n.brandCheck(this,o);const t="CacheStorage.open";if(n.argumentLengthCheck(arguments,1,t),e=n.converters.DOMString(e,t,"cacheName"),this.#Ve.has(e)){const t=this.#Ve.get(e);return new r(i,t)}const s=[];return this.#Ve.set(e,s),new r(i,s)}async delete(e){n.brandCheck(this,o);const t="CacheStorage.delete";return n.argumentLengthCheck(arguments,1,t),e=n.converters.DOMString(e,t,"cacheName"),this.#Ve.delete(e)}async keys(){n.brandCheck(this,o);return[...this.#Ve.keys()]}}Object.defineProperties(o.prototype,{[Symbol.toStringTag]:{value:"CacheStorage",configurable:!0},match:A,has:A,open:A,delete:A,keys:A}),e.exports={CacheStorage:o}},3932:(e,t,s)=>{"use strict";const r=s(4589),{URLSerializer:n}=s(9934),{isValidHeaderName:A}=s(6686);e.exports={urlEquals:function(e,t,s=!1){return n(e,s)===n(t,s)},getFieldValues:function(e){r(null!==e);const t=[];for(let s of e.split(","))s=s.trim(),A(s)&&t.push(s);return t}}},3042:e=>{"use strict";e.exports={maxAttributeValueSize:1024,maxNameValuePairSize:4096}},9391:(e,t,s)=>{"use strict";const{parseSetCookie:r}=s(6712),{stringify:n}=s(9871),{webidl:A}=s(6097),{Headers:i}=s(6558),o=A.brandCheckMultiple([i,globalThis.Headers].filter(Boolean));function a(e,t){A.argumentLengthCheck(arguments,2,"setCookie"),o(e),t=A.converters.Cookie(t);const s=n(t);s&&e.append("set-cookie",s,!0)}A.converters.DeleteCookieAttributes=A.dictionaryConverter([{converter:A.nullableConverter(A.converters.DOMString),key:"path",defaultValue:()=>null},{converter:A.nullableConverter(A.converters.DOMString),key:"domain",defaultValue:()=>null}]),A.converters.Cookie=A.dictionaryConverter([{converter:A.converters.DOMString,key:"name"},{converter:A.converters.DOMString,key:"value"},{converter:A.nullableConverter((e=>"number"==typeof e?A.converters["unsigned long long"](e):new Date(e))),key:"expires",defaultValue:()=>null},{converter:A.nullableConverter(A.converters["long long"]),key:"maxAge",defaultValue:()=>null},{converter:A.nullableConverter(A.converters.DOMString),key:"domain",defaultValue:()=>null},{converter:A.nullableConverter(A.converters.DOMString),key:"path",defaultValue:()=>null},{converter:A.nullableConverter(A.converters.boolean),key:"secure",defaultValue:()=>null},{converter:A.nullableConverter(A.converters.boolean),key:"httpOnly",defaultValue:()=>null},{converter:A.converters.USVString,key:"sameSite",allowedValues:["Strict","Lax","None"]},{converter:A.sequenceConverter(A.converters.DOMString),key:"unparsed",defaultValue:()=>[]}]),e.exports={getCookies:function(e){A.argumentLengthCheck(arguments,1,"getCookies"),o(e);const t=e.get("cookie"),s={};if(!t)return s;for(const e of t.split(";")){const[t,...r]=e.split("=");s[t.trim()]=r.join("=")}return s},deleteCookie:function(e,t,s){o(e);const r="deleteCookie";A.argumentLengthCheck(arguments,2,r),t=A.converters.DOMString(t,r,"name"),s=A.converters.DeleteCookieAttributes(s),a(e,{name:t,value:"",expires:new Date(0),...s})},getSetCookies:function(e){A.argumentLengthCheck(arguments,1,"getSetCookies"),o(e);const t=e.getSetCookie();return t?t.map((e=>r(e))):[]},setCookie:a,parseCookie:function(e){return e=A.converters.DOMString(e),r(e)}}},6712:(e,t,s)=>{"use strict";const{maxNameValuePairSize:r,maxAttributeValueSize:n}=s(3042),{isCTLExcludingHtab:A}=s(9871),{collectASequenceOfCodePointsFast:i}=s(9934),o=s(4589),{unescape:a}=s(1792);function c(e,t={}){if(0===e.length)return t;o(";"===e[0]);let s="";(e=e.slice(1)).includes(";")?(s=i(";",e,{position:0}),e=e.slice(s.length)):(s=e,e="");let r="",A="";if(s.includes("=")){const e={position:0};r=i("=",s,e),A=s.slice(e.position+1)}else r=s;if(r=r.trim(),A=A.trim(),A.length>n)return c(e,t);const a=r.toLowerCase();if("expires"===a){const e=new Date(A);t.expires=e}else if("max-age"===a){const s=A.charCodeAt(0);if((s<48||s>57)&&"-"!==A[0])return c(e,t);if(!/^\d+$/.test(A))return c(e,t);const r=Number(A);t.maxAge=r}else if("domain"===a){let e=A;"."===e[0]&&(e=e.slice(1)),e=e.toLowerCase(),t.domain=e}else if("path"===a){let e="";e=0===A.length||"/"!==A[0]?"/":A,t.path=e}else if("secure"===a)t.secure=!0;else if("httponly"===a)t.httpOnly=!0;else if("samesite"===a){let e="Default";const s=A.toLowerCase();s.includes("none")&&(e="None"),s.includes("strict")&&(e="Strict"),s.includes("lax")&&(e="Lax"),t.sameSite=e}else t.unparsed??=[],t.unparsed.push(`${r}=${A}`);return c(e,t)}e.exports={parseSetCookie:function(e){if(A(e))return null;let t="",s="",n="",o="";if(e.includes(";")){const r={position:0};t=i(";",e,r),s=e.slice(r.position)}else t=e;if(t.includes("=")){const e={position:0};n=i("=",t,e),o=t.slice(e.position+1)}else o=t;return n=n.trim(),o=o.trim(),n.length+o.length>r?null:{name:n,value:a(o),...c(s)}},parseUnparsedAttributes:c}},9871:e=>{"use strict";function t(e){for(let t=0;t<e.length;++t){const s=e.charCodeAt(t);if(s<33||s>126||34===s||40===s||41===s||60===s||62===s||64===s||44===s||59===s||58===s||92===s||47===s||91===s||93===s||63===s||61===s||123===s||125===s)throw new Error("Invalid cookie name")}}function s(e){let t=e.length,s=0;if('"'===e[0]){if(1===t||'"'!==e[t-1])throw new Error("Invalid cookie value");--t,++s}for(;s<t;){const t=e.charCodeAt(s++);if(t<33||t>126||34===t||44===t||59===t||92===t)throw new Error("Invalid cookie value")}}function r(e){for(let t=0;t<e.length;++t){const s=e.charCodeAt(t);if(s<32||127===s||59===s)throw new Error("Invalid cookie path")}}const n=["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],A=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],i=Array(61).fill(0).map(((e,t)=>t.toString().padStart(2,"0")));function o(e){return"number"==typeof e&&(e=new Date(e)),`${n[e.getUTCDay()]}, ${i[e.getUTCDate()]} ${A[e.getUTCMonth()]} ${e.getUTCFullYear()} ${i[e.getUTCHours()]}:${i[e.getUTCMinutes()]}:${i[e.getUTCSeconds()]} GMT`}e.exports={isCTLExcludingHtab:function(e){for(let t=0;t<e.length;++t){const s=e.charCodeAt(t);if(s>=0&&s<=8||s>=10&&s<=31||127===s)return!0}return!1},validateCookieName:t,validateCookiePath:r,validateCookieValue:s,toIMFDate:o,stringify:function(e){if(0===e.name.length)return null;t(e.name),s(e.value);const n=[`${e.name}=${e.value}`];e.name.startsWith("__Secure-")&&(e.secure=!0),e.name.startsWith("__Host-")&&(e.secure=!0,e.domain=null,e.path="/"),e.secure&&n.push("Secure"),e.httpOnly&&n.push("HttpOnly"),"number"==typeof e.maxAge&&(!function(e){if(e<0)throw new Error("Invalid cookie max-age")}(e.maxAge),n.push(`Max-Age=${e.maxAge}`)),e.domain&&(!function(e){if(e.startsWith("-")||e.endsWith(".")||e.endsWith("-"))throw new Error("Invalid cookie domain")}(e.domain),n.push(`Domain=${e.domain}`)),e.path&&(r(e.path),n.push(`Path=${e.path}`)),e.expires&&"Invalid Date"!==e.expires.toString()&&n.push(`Expires=${o(e.expires)}`),e.sameSite&&n.push(`SameSite=${e.sameSite}`);for(const t of e.unparsed){if(!t.includes("="))throw new Error("Invalid unparsed");const[e,...s]=t.split("=");n.push(`${e.trim()}=${s.join("=")}`)}return n.join("; ")}}},8813:(e,t,s)=>{"use strict";const{Transform:r}=s(7075),{isASCIINumber:n,isValidLastEventId:A}=s(4689),i=[239,187,191];e.exports={EventSourceStream:class extends r{state;checkBOM=!0;crlfCheck=!1;eventEndCheck=!1;buffer=null;pos=0;event={data:void 0,event:void 0,id:void 0,retry:void 0};constructor(e={}){e.readableObjectMode=!0,super(e),this.state=e.eventSourceSettings||{},e.push&&(this.push=e.push)}_transform(e,t,s){if(0!==e.length){if(this.buffer?this.buffer=Buffer.concat([this.buffer,e]):this.buffer=e,this.checkBOM)switch(this.buffer.length){case 1:return this.buffer[0]===i[0]||(this.checkBOM=!1),void s();case 2:if(this.buffer[0]===i[0]&&this.buffer[1]===i[1])return void s();this.checkBOM=!1;break;case 3:if(this.buffer[0]===i[0]&&this.buffer[1]===i[1]&&this.buffer[2]===i[2])return this.buffer=Buffer.alloc(0),this.checkBOM=!1,void s();this.checkBOM=!1;break;default:this.buffer[0]===i[0]&&this.buffer[1]===i[1]&&this.buffer[2]===i[2]&&(this.buffer=this.buffer.subarray(3)),this.checkBOM=!1}for(;this.pos<this.buffer.length;)if(this.eventEndCheck){if(this.crlfCheck){if(10===this.buffer[this.pos]){this.buffer=this.buffer.subarray(this.pos+1),this.pos=0,this.crlfCheck=!1;continue}this.crlfCheck=!1}if(10===this.buffer[this.pos]||13===this.buffer[this.pos]){13===this.buffer[this.pos]&&(this.crlfCheck=!0),this.buffer=this.buffer.subarray(this.pos+1),this.pos=0,(void 0!==this.event.data||this.event.event||void 0!==this.event.id||this.event.retry)&&this.processEvent(this.event),this.clearEvent();continue}this.eventEndCheck=!1}else 10!==this.buffer[this.pos]&&13!==this.buffer[this.pos]?this.pos++:(13===this.buffer[this.pos]&&(this.crlfCheck=!0),this.parseLine(this.buffer.subarray(0,this.pos),this.event),this.buffer=this.buffer.subarray(this.pos+1),this.pos=0,this.eventEndCheck=!0);s()}else s()}parseLine(e,t){if(0===e.length)return;const s=e.indexOf(58);if(0===s)return;let r="",i="";if(-1!==s){r=e.subarray(0,s).toString("utf8");let t=s+1;32===e[t]&&++t,i=e.subarray(t).toString("utf8")}else r=e.toString("utf8"),i="";switch(r){case"data":void 0===t[r]?t[r]=i:t[r]+=`\n${i}`;break;case"retry":n(i)&&(t[r]=i);break;case"id":A(i)&&(t[r]=i);break;case"event":i.length>0&&(t[r]=i)}}processEvent(e){e.retry&&n(e.retry)&&(this.state.reconnectionTime=parseInt(e.retry,10)),void 0!==e.id&&A(e.id)&&(this.state.lastEventId=e.id),void 0!==e.data&&this.push({type:e.event||"message",options:{data:e.data,lastEventId:this.state.lastEventId,origin:this.state.origin}})}clearEvent(){this.event={data:void 0,event:void 0,id:void 0,retry:void 0}}}}},7928:(e,t,s)=>{"use strict";const{pipeline:r}=s(7075),{fetching:n}=s(7388),{makeRequest:A}=s(4609),{webidl:i}=s(6097),{EventSourceStream:o}=s(8813),{parseMIMEType:a}=s(9934),{createFastMessageEvent:c}=s(878),{isNetworkError:l}=s(4821),{kEnumerableProperty:h}=s(2858),{environmentSettingsObject:g}=s(6686);let d=!1;class u extends EventTarget{#Oe={open:null,error:null,message:null};#Ge;#Je=!1;#We=0;#_e=null;#$=null;#qe;#le;constructor(e,t={}){super(),i.util.markAsUncloneable(this);const s="EventSource constructor";i.argumentLengthCheck(arguments,1,s),d||(d=!0,process.emitWarning("EventSource is experimental, expect them to change at any time.",{code:"UNDICI-ES"})),e=i.converters.USVString(e),t=i.converters.EventSourceInitDict(t,s,"eventSourceInitDict"),this.#qe=t.node.dispatcher||t.dispatcher,this.#le={lastEventId:"",reconnectionTime:t.node.reconnectionTime};const r=g;let n;try{n=new URL(e,r.settingsObject.baseUrl),this.#le.origin=n.origin}catch(e){throw new DOMException(e,"SyntaxError")}this.#Ge=n.href;let o="anonymous";!0===t.withCredentials&&(o="use-credentials",this.#Je=!0);const a={redirect:"follow",keepalive:!0,mode:"cors",credentials:"anonymous"===o?"same-origin":"omit",referrer:"no-referrer"};a.client=g.settingsObject,a.headersList=[["accept",{name:"accept",value:"text/event-stream"}]],a.cache="no-store",a.initiator="other",a.urlList=[new URL(this.#Ge)],this.#_e=A(a),this.#$e()}get readyState(){return this.#We}get url(){return this.#Ge}get withCredentials(){return this.#Je}#$e(){if(2===this.#We)return;this.#We=0;const e={request:this.#_e,dispatcher:this.#qe};e.processResponseEndOfBody=e=>{if(!l(e))return this.#ze()},e.processResponse=e=>{if(l(e))return e.aborted?(this.close(),void this.dispatchEvent(new Event("error"))):void this.#ze();const t=e.headersList.get("content-type",!0),s=null!==t?a(t):"failure",n="failure"!==s&&"text/event-stream"===s.essence;if(200!==e.status||!1===n)return this.close(),void this.dispatchEvent(new Event("error"));this.#We=1,this.dispatchEvent(new Event("open")),this.#le.origin=e.urlList[e.urlList.length-1].origin;const A=new o({eventSourceSettings:this.#le,push:e=>{this.dispatchEvent(c(e.type,e.options))}});r(e.body.stream,A,(e=>{!1===e?.aborted&&(this.close(),this.dispatchEvent(new Event("error")))}))},this.#$=n(e)}#ze(){2!==this.#We&&(this.#We=0,this.dispatchEvent(new Event("error")),setTimeout((()=>{0===this.#We&&(this.#le.lastEventId.length&&this.#_e.headersList.set("last-event-id",this.#le.lastEventId,!0),this.#$e())}),this.#le.reconnectionTime)?.unref())}close(){i.brandCheck(this,u),2!==this.#We&&(this.#We=2,this.#$.abort(),this.#_e=null)}get onopen(){return this.#Oe.open}set onopen(e){this.#Oe.open&&this.removeEventListener("open",this.#Oe.open);const t=i.converters.EventHandlerNonNull(e);null!==t?(this.addEventListener("open",t),this.#Oe.open=e):this.#Oe.open=null}get onmessage(){return this.#Oe.message}set onmessage(e){this.#Oe.message&&this.removeEventListener("message",this.#Oe.message);const t=i.converters.EventHandlerNonNull(e);null!==t?(this.addEventListener("message",t),this.#Oe.message=e):this.#Oe.message=null}get onerror(){return this.#Oe.error}set onerror(e){this.#Oe.error&&this.removeEventListener("error",this.#Oe.error);const t=i.converters.EventHandlerNonNull(e);null!==t?(this.addEventListener("error",t),this.#Oe.error=e):this.#Oe.error=null}}const E={CONNECTING:{__proto__:null,configurable:!1,enumerable:!0,value:0,writable:!1},OPEN:{__proto__:null,configurable:!1,enumerable:!0,value:1,writable:!1},CLOSED:{__proto__:null,configurable:!1,enumerable:!0,value:2,writable:!1}};Object.defineProperties(u,E),Object.defineProperties(u.prototype,E),Object.defineProperties(u.prototype,{close:h,onerror:h,onmessage:h,onopen:h,readyState:h,url:h,withCredentials:h}),i.converters.EventSourceInitDict=i.dictionaryConverter([{key:"withCredentials",converter:i.converters.boolean,defaultValue:()=>!1},{key:"dispatcher",converter:i.converters.any},{key:"node",converter:i.dictionaryConverter([{key:"reconnectionTime",converter:i.converters["unsigned long"],defaultValue:()=>3e3},{key:"dispatcher",converter:i.converters.any}]),defaultValue:()=>({})}]),e.exports={EventSource:u,defaultReconnectionTime:3e3}},4689:e=>{"use strict";e.exports={isValidLastEventId:function(e){return-1===e.indexOf("\0")},isASCIINumber:function(e){if(0===e.length)return!1;for(let t=0;t<e.length;t++)if(e.charCodeAt(t)<48||e.charCodeAt(t)>57)return!1;return!0}}},2530:(e,t,s)=>{"use strict";const r=s(2858),{ReadableStreamFrom:n,readableStreamClose:A,fullyReadBody:i,extractMimeType:o,utf8DecodeBytes:a}=s(6686),{FormData:c,setFormDataState:l}=s(3944),{webidl:h}=s(6097),g=s(4589),{isErrored:d,isDisturbed:u}=s(7075),{isArrayBuffer:E}=s(3429),{serializeAMimeType:I}=s(9934),{multipartFormDataParser:C}=s(4614),{createDeferredPromise:B}=s(9250);let Q;try{const e=s(7598);Q=t=>e.randomInt(0,t)}catch{Q=e=>Math.floor(Math.random()*e)}const p=new TextEncoder;function f(){}const m=new FinalizationRegistry((e=>{const t=e.deref();!t||t.locked||u(t)||d(t)||t.cancel("Response object has been garbage collected").catch(f)}));function y(e,t=!1){let s=null;s=h.is.ReadableStream(e)?e:h.is.Blob(e)?e.stream():new ReadableStream({pull(e){const t="string"==typeof o?p.encode(o):o;t.byteLength&&e.enqueue(t),queueMicrotask((()=>A(e)))},start(){},type:"bytes"}),g(h.is.ReadableStream(s));let i=null,o=null,a=null,c=null;if("string"==typeof e)o=e,c="text/plain;charset=UTF-8";else if(h.is.URLSearchParams(e))o=e.toString(),c="application/x-www-form-urlencoded;charset=UTF-8";else if(h.is.BufferSource(e))o=E(e)?new Uint8Array(e.slice()):new Uint8Array(e.buffer.slice(e.byteOffset,e.byteOffset+e.byteLength));else if(h.is.FormData(e)){const t=`----formdata-undici-0${`${Q(1e11)}`.padStart(11,"0")}`,s=`--${t}\r\nContent-Disposition: form-data`,r=e=>e.replace(/\n/g,"%0A").replace(/\r/g,"%0D").replace(/"/g,"%22"),n=e=>e.replace(/\r?\n|\r/g,"\r\n"),A=[],l=new Uint8Array([13,10]);a=0;let h=!1;for(const[t,i]of e)if("string"==typeof i){const e=p.encode(s+`; name="${r(n(t))}"`+`\r\n\r\n${n(i)}\r\n`);A.push(e),a+=e.byteLength}else{const e=p.encode(`${s}; name="${r(n(t))}"`+(i.name?`; filename="${r(i.name)}"`:"")+"\r\n"+`Content-Type: ${i.type||"application/octet-stream"}\r\n\r\n`);A.push(e,i,l),"number"==typeof i.size?a+=e.byteLength+i.size+l.byteLength:h=!0}const g=p.encode(`--${t}--\r\n`);A.push(g),a+=g.byteLength,h&&(a=null),o=e,i=async function*(){for(const e of A)e.stream?yield*e.stream():yield e},c=`multipart/form-data; boundary=${t}`}else if(h.is.Blob(e))o=e,a=e.size,e.type&&(c=e.type);else if("function"==typeof e[Symbol.asyncIterator]){if(t)throw new TypeError("keepalive");if(r.isDisturbed(e)||e.locked)throw new TypeError("Response body object should not be disturbed or locked");s=h.is.ReadableStream(e)?e:n(e)}if(("string"==typeof o||r.isBuffer(o))&&(a=Buffer.byteLength(o)),null!=i){let t;s=new ReadableStream({async start(){t=i(e)[Symbol.asyncIterator]()},async pull(e){const{value:r,done:n}=await t.next();if(n)queueMicrotask((()=>{e.close(),e.byobRequest?.respond(0)}));else if(!d(s)){const t=new Uint8Array(r);t.byteLength&&e.enqueue(t)}return e.desiredSize>0},async cancel(e){await t.return()},type:"bytes"})}return[{stream:s,source:o,length:a},c]}function w(e,t,s,r){try{h.brandCheck(e,s)}catch(e){return Promise.reject(e)}const n=r(e);if(S(n))return Promise.reject(new TypeError("Body is unusable: Body has already been read"));if(n.aborted)return Promise.reject(new DOMException("The operation was aborted.","AbortError"));const A=B(),o=A.reject,a=e=>{try{A.resolve(t(e))}catch(e){o(e)}};return null==n.body?(a(Buffer.allocUnsafe(0)),A.promise):(i(n.body,a,o),A.promise)}function S(e){const t=e.body;return null!=t&&(t.stream.locked||r.isDisturbed(t.stream))}function D(e){return JSON.parse(a(e))}function b(e){const t=e.headersList,s=o(t);return"failure"===s?null:s}e.exports={extractBody:y,safelyExtractBody:function(e,t=!1){return h.is.ReadableStream(e)&&(g(!r.isDisturbed(e),"The body has already been consumed."),g(!e.locked,"The stream is locked.")),y(e,t)},cloneBody:function(e){const{0:t,1:s}=e.stream.tee();return e.stream=t,{stream:s,length:e.length,source:e.source}},mixinBody:function(e,t){Object.assign(e.prototype,function(e,t){return{blob(){return w(this,(e=>{let s=b(t(this));return null===s?s="":s&&(s=I(s)),new Blob([e],{type:s})}),e,t)},arrayBuffer(){return w(this,(e=>new Uint8Array(e).buffer),e,t)},text(){return w(this,a,e,t)},json(){return w(this,D,e,t)},formData(){return w(this,(e=>{const s=b(t(this));if(null!==s)switch(s.essence){case"multipart/form-data":{const t=C(e,s),r=new c;return l(r,t),r}case"application/x-www-form-urlencoded":{const t=new URLSearchParams(e.toString()),s=new c;for(const[e,r]of t)s.append(e,r);return s}}throw new TypeError('Content-Type was not one of "multipart/form-data" or "application/x-www-form-urlencoded".')}),e,t)},bytes(){return w(this,(e=>new Uint8Array(e)),e,t)}}}(e,t))},streamRegistry:m,bodyUnusable:S}},9441:e=>{"use strict";const t=["GET","HEAD","POST"],s=new Set(t),r=[301,302,303,307,308],n=new Set(r),A=["1","7","9","11","13","15","17","19","20","21","22","23","25","37","42","43","53","69","77","79","87","95","101","102","103","104","109","110","111","113","115","117","119","123","135","137","139","143","161","179","389","427","465","512","513","514","515","526","530","531","532","540","548","554","556","563","587","601","636","989","990","993","995","1719","1720","1723","2049","3659","4045","4190","5060","5061","6000","6566","6665","6666","6667","6668","6669","6679","6697","10080"],i=new Set(A),o=["no-referrer","no-referrer-when-downgrade","same-origin","origin","strict-origin","origin-when-cross-origin","strict-origin-when-cross-origin","unsafe-url"],a=["",...o],c=new Set(o),l=["GET","HEAD","OPTIONS","TRACE"],h=new Set(l),g=["CONNECT","TRACE","TRACK"],d=new Set(g),u=["audio","audioworklet","font","image","manifest","paintworklet","script","style","track","video","xslt",""],E=new Set(u);e.exports={subresource:u,forbiddenMethods:g,requestBodyHeader:["content-encoding","content-language","content-location","content-type","content-length"],referrerPolicy:a,requestRedirect:["follow","manual","error"],requestMode:["navigate","same-origin","no-cors","cors"],requestCredentials:["omit","same-origin","include"],requestCache:["default","no-store","reload","no-cache","force-cache","only-if-cached"],redirectStatus:r,corsSafeListedMethods:t,nullBodyStatus:[101,204,205,304],safeMethods:l,badPorts:A,requestDuplex:["half"],subresourceSet:E,badPortsSet:i,redirectStatusSet:n,corsSafeListedMethodsSet:s,safeMethodsSet:h,forbiddenMethodsSet:d,referrerPolicyTokens:c}},9934:(e,t,s)=>{"use strict";const r=s(4589),n=new TextEncoder,A=/^[!#$%&'*+\-.^_|~A-Za-z0-9]+$/,i=/[\u000A\u000D\u0009\u0020]/,o=/[\u0009\u000A\u000C\u000D\u0020]/g,a=/^[\u0009\u0020-\u007E\u0080-\u00FF]+$/;function c(e,t=!1){if(!t)return e.href;const s=e.href,r=e.hash.length,n=0===r?s:s.substring(0,s.length-r);return!r&&s.endsWith("#")?n.slice(0,-1):n}function l(e,t,s){let r="";for(;s.position<t.length&&e(t[s.position]);)r+=t[s.position],s.position++;return r}function h(e,t,s){const r=t.indexOf(e,s.position),n=s.position;return-1===r?(s.position=t.length,t.slice(n)):(s.position=r,t.slice(n,s.position))}function g(e){return function(e){const t=e.length,s=new Uint8Array(t);let r=0;for(let n=0;n<t;++n){const t=e[n];37!==t?s[r++]=t:37!==t||d(e[n+1])&&d(e[n+2])?(s[r++]=u(e[n+1])<<4|u(e[n+2]),n+=2):s[r++]=37}return t===r?s:s.subarray(0,r)}(n.encode(e))}function d(e){return e>=48&&e<=57||e>=65&&e<=70||e>=97&&e<=102}function u(e){return e>=48&&e<=57?e-48:(223&e)-55}function E(e){const t={position:0},s=h("/",e=B(e,!0,!0),t);if(0===s.length||!A.test(s))return"failure";if(t.position>=e.length)return"failure";t.position++;let r=h(";",e,t);if(r=B(r,!1,!0),0===r.length||!A.test(r))return"failure";const n=s.toLowerCase(),o=r.toLowerCase(),c={type:n,subtype:o,parameters:new Map,essence:`${n}/${o}`};for(;t.position<e.length;){t.position++,l((e=>i.test(e)),e,t);let s=l((e=>";"!==e&&"="!==e),e,t);if(s=s.toLowerCase(),t.position<e.length){if(";"===e[t.position])continue;t.position++}if(t.position>=e.length)break;let r=null;if('"'===e[t.position])r=I(e,t,!0),h(";",e,t);else if(r=h(";",e,t),r=B(r,!1,!0),0===r.length)continue;0===s.length||!A.test(s)||0!==r.length&&!a.test(r)||c.parameters.has(s)||c.parameters.set(s,r)}return c}function I(e,t,s=!1){const n=t.position;let A="";for(r('"'===e[t.position]),t.position++;A+=l((e=>'"'!==e&&"\\"!==e),e,t),!(t.position>=e.length);){const s=e[t.position];if(t.position++,"\\"!==s){r('"'===s);break}if(t.position>=e.length){A+="\\";break}A+=e[t.position],t.position++}return s?A:e.slice(n,t.position)}function C(e){return 13===e||10===e||9===e||32===e}function B(e,t=!0,s=!0){return p(e,t,s,C)}function Q(e){return 13===e||10===e||9===e||12===e||32===e}function p(e,t,s,r){let n=0,A=e.length-1;if(t)for(;n<e.length&&r(e.charCodeAt(n));)n++;if(s)for(;A>0&&r(e.charCodeAt(A));)A--;return 0===n&&A===e.length-1?e:e.slice(n,A+1)}function f(e){const t=e.length;if(65535>t)return String.fromCharCode.apply(null,e);let s="",r=0,n=65535;for(;r<t;)r+n>t&&(n=t-r),s+=String.fromCharCode.apply(null,e.subarray(r,r+=n));return s}e.exports={dataURLProcessor:function(e){r("data:"===e.protocol);let t=c(e,!0);t=t.slice(5);const s={position:0};let n=h(",",t,s);const A=n.length;if(n=function(e,t=!0,s=!0){return p(e,t,s,Q)}(n,!0,!0),s.position>=t.length)return"failure";s.position++;let i=g(t.slice(A+1));if(/;(\u0020){0,}base64$/i.test(n)){if(i=function(e){let t=(e=e.replace(o,"")).length;t%4==0&&61===e.charCodeAt(t-1)&&(--t,61===e.charCodeAt(t-1)&&--t);if(t%4==1)return"failure";if(/[^+/0-9A-Za-z]/.test(e.length===t?e:e.substring(0,t)))return"failure";const s=Buffer.from(e,"base64");return new Uint8Array(s.buffer,s.byteOffset,s.byteLength)}(f(i)),"failure"===i)return"failure";n=n.slice(0,-6),n=n.replace(/(\u0020)+$/,""),n=n.slice(0,-1)}n.startsWith(";")&&(n="text/plain"+n);let a=E(n);return"failure"===a&&(a=E("text/plain;charset=US-ASCII")),{mimeType:a,body:i}},URLSerializer:c,collectASequenceOfCodePoints:l,collectASequenceOfCodePointsFast:h,stringPercentDecode:g,parseMIMEType:E,collectAnHTTPQuotedString:I,serializeAMimeType:function(e){r("failure"!==e);const{parameters:t,essence:s}=e;let n=s;for(let[e,s]of t.entries())n+=";",n+=e,n+="=",A.test(s)||(s=s.replace(/(\\|")/g,"\\$1"),s='"'+s,s+='"'),n+=s;return n},removeChars:p,removeHTTPWhitespace:B,minimizeSupportedMimeType:function(e){switch(e.essence){case"application/ecmascript":case"application/javascript":case"application/x-ecmascript":case"application/x-javascript":case"text/ecmascript":case"text/javascript":case"text/javascript1.0":case"text/javascript1.1":case"text/javascript1.2":case"text/javascript1.3":case"text/javascript1.4":case"text/javascript1.5":case"text/jscript":case"text/livescript":case"text/x-ecmascript":case"text/x-javascript":return"text/javascript";case"application/json":case"text/json":return"application/json";case"image/svg+xml":return"image/svg+xml";case"text/xml":case"application/xml":return"application/xml"}return e.subtype.endsWith("+json")?"application/json":e.subtype.endsWith("+xml")?"application/xml":""},HTTP_TOKEN_CODEPOINTS:A,isomorphicDecode:f}},4614:(e,t,s)=>{"use strict";const{bufferToLowerCasedHeaderName:r}=s(2858),{utf8DecodeBytes:n}=s(6686),{HTTP_TOKEN_CODEPOINTS:A,isomorphicDecode:i}=s(9934),{makeEntry:o}=s(3944),{webidl:a}=s(6097),c=s(4589),l=Buffer.from('form-data; name="'),h=Buffer.from("filename"),g=Buffer.from("--"),d=Buffer.from("--\r\n");function u(e){for(let t=0;t<e.length;++t)if(-128&e.charCodeAt(t))return!1;return!0}function E(e,t){let s=null,n=null,o=null,a=null;for(;;){if(13===e[t.position]&&10===e[t.position+1]){if(null===s)throw p("header name is null");return{name:s,filename:n,contentType:o,encoding:a}}let c=C((e=>10!==e&&13!==e&&58!==e),e,t);if(c=B(c,!0,!0,(e=>9===e||32===e)),!A.test(c.toString()))throw p("header name does not match the field-name token production");if(58!==e[t.position])throw p("expected :");switch(t.position++,C((e=>32===e||9===e),e,t),r(c)){case"content-disposition":if(s=n=null,!Q(e,l,t))throw p('expected form-data; name=" for content-disposition header');if(t.position+=17,s=I(e,t),59===e[t.position]&&32===e[t.position+1]){const s={position:t.position+2};if(Q(e,h,s))if(42===e[s.position+8]){s.position+=10,C((e=>32===e||9===e),e,s);const r=C((e=>32!==e&&13!==e&&10!==e),e,s);if(117!==r[0]&&85!==r[0]||116!==r[1]&&84!==r[1]||102!==r[2]&&70!==r[2]||45!==r[3]||56!==r[4])throw p("unknown encoding, expected utf-8''");n=decodeURIComponent((new TextDecoder).decode(r.subarray(7))),t.position=s.position}else t.position+=11,C((e=>32===e||9===e),e,t),t.position++,n=I(e,t)}break;case"content-type":{let s=C((e=>10!==e&&13!==e),e,t);s=B(s,!1,!0,(e=>9===e||32===e)),o=i(s);break}case"content-transfer-encoding":{let s=C((e=>10!==e&&13!==e),e,t);s=B(s,!1,!0,(e=>9===e||32===e)),a=i(s);break}default:C((e=>10!==e&&13!==e),e,t)}if(13!==e[t.position]&&10!==e[t.position+1])throw p("expected CRLF");t.position+=2}}function I(e,t){c(34===e[t.position-1]);let s=C((e=>10!==e&&13!==e&&34!==e),e,t);if(34!==e[t.position])throw p('expected "');return t.position++,s=(new TextDecoder).decode(s).replace(/%0A/gi,"\n").replace(/%0D/gi,"\r").replace(/%22/g,'"'),s}function C(e,t,s){let r=s.position;for(;r<t.length&&e(t[r]);)++r;return t.subarray(s.position,s.position=r)}function B(e,t,s,r){let n=0,A=e.length-1;if(t)for(;n<e.length&&r(e[n]);)n++;if(s)for(;A>0&&r(e[A]);)A--;return 0===n&&A===e.length-1?e:e.subarray(n,A+1)}function Q(e,t,s){if(e.length<t.length)return!1;for(let r=0;r<t.length;r++)if(t[r]!==e[s.position+r])return!1;return!0}function p(e){return new TypeError("Failed to parse body as FormData.",{cause:new TypeError(e)})}e.exports={multipartFormDataParser:function(e,t){c("failure"!==t&&"multipart/form-data"===t.essence);const s=t.parameters.get("boundary");if(void 0===s)throw p("missing boundary in content-type header");const r=Buffer.from(`--${s}`,"utf8"),A=[],i={position:0};for(;13===e[i.position]&&10===e[i.position+1];)i.position+=2;let l=e.length;for(;10===e[l-1]&&13===e[l-2];)l-=2;for(l!==e.length&&(e=e.subarray(0,l));;){if(!e.subarray(i.position,i.position+r.length).equals(r))throw p("expected a value starting with -- and the boundary");if(i.position+=r.length,i.position===e.length-2&&Q(e,g,i)||i.position===e.length-4&&Q(e,d,i))return A;if(13!==e[i.position]||10!==e[i.position+1])throw p("expected CRLF");i.position+=2;const t=E(e,i);let s,l,{name:h,filename:I,contentType:C,encoding:B}=t;i.position+=2;{const t=e.indexOf(r.subarray(2),i.position);if(-1===t)throw p("expected boundary after body");s=e.subarray(i.position,t-4),i.position+=s.length,"base64"===B&&(s=Buffer.from(s.toString(),"base64"))}if(13!==e[i.position]||10!==e[i.position+1])throw p("expected CRLF");i.position+=2,null!==I?(C??="text/plain",u(C)||(C=""),l=new File([s],I,{type:C})):l=n(Buffer.from(s)),c(a.is.USVString(h)),c("string"==typeof l&&a.is.USVString(l)||a.is.File(l)),A.push(o(h,l,I))}},validateBoundary:function(e){const t=e.length;if(t<27||t>70)return!1;for(let s=0;s<t;++s){const t=e.charCodeAt(s);if(!(t>=48&&t<=57||t>=65&&t<=90||t>=97&&t<=122||39===t||45===t||95===t))return!1}return!0}}},3944:(e,t,s)=>{"use strict";const{iteratorMixin:r}=s(6686),{kEnumerableProperty:n}=s(2858),{webidl:A}=s(6097),i=s(7975);class o{#le=[];constructor(e=void 0){if(A.util.markAsUncloneable(this),void 0!==e)throw A.errors.conversionFailed({prefix:"FormData constructor",argument:"Argument 1",types:["undefined"]})}append(e,t,s=void 0){A.brandCheck(this,o);const r="FormData.append";A.argumentLengthCheck(arguments,2,r),e=A.converters.USVString(e),3===arguments.length||A.is.Blob(t)?(t=A.converters.Blob(t,r,"value"),void 0!==s&&(s=A.converters.USVString(s))):t=A.converters.USVString(t);const n=l(e,t,s);this.#le.push(n)}delete(e){A.brandCheck(this,o);A.argumentLengthCheck(arguments,1,"FormData.delete"),e=A.converters.USVString(e),this.#le=this.#le.filter((t=>t.name!==e))}get(e){A.brandCheck(this,o);A.argumentLengthCheck(arguments,1,"FormData.get"),e=A.converters.USVString(e);const t=this.#le.findIndex((t=>t.name===e));return-1===t?null:this.#le[t].value}getAll(e){A.brandCheck(this,o);return A.argumentLengthCheck(arguments,1,"FormData.getAll"),e=A.converters.USVString(e),this.#le.filter((t=>t.name===e)).map((e=>e.value))}has(e){A.brandCheck(this,o);return A.argumentLengthCheck(arguments,1,"FormData.has"),e=A.converters.USVString(e),-1!==this.#le.findIndex((t=>t.name===e))}set(e,t,s=void 0){A.brandCheck(this,o);const r="FormData.set";A.argumentLengthCheck(arguments,2,r),e=A.converters.USVString(e),3===arguments.length||A.is.Blob(t)?(t=A.converters.Blob(t,r,"value"),void 0!==s&&(s=A.converters.USVString(s))):t=A.converters.USVString(t);const n=l(e,t,s),i=this.#le.findIndex((t=>t.name===e));-1!==i?this.#le=[...this.#le.slice(0,i),n,...this.#le.slice(i+1).filter((t=>t.name!==e))]:this.#le.push(n)}[i.inspect.custom](e,t){const s=this.#le.reduce(((e,t)=>(e[t.name]?Array.isArray(e[t.name])?e[t.name].push(t.value):e[t.name]=[e[t.name],t.value]:e[t.name]=t.value,e)),{__proto__:null});t.depth??=e,t.colors??=!0;const r=i.formatWithOptions(t,s);return`FormData ${r.slice(r.indexOf("]")+2)}`}static getFormDataState(e){return e.#le}static setFormDataState(e,t){e.#le=t}}const{getFormDataState:a,setFormDataState:c}=o;function l(e,t,s){if("string"==typeof t);else if(A.is.File(t)||(t=new File([t],"blob",{type:t.type})),void 0!==s){const e={type:t.type,lastModified:t.lastModified};t=new File([t],s,e)}return{name:e,value:t}}Reflect.deleteProperty(o,"getFormDataState"),Reflect.deleteProperty(o,"setFormDataState"),r("FormData",o,a,"name","value"),Object.defineProperties(o.prototype,{append:n,delete:n,get:n,getAll:n,has:n,set:n,[Symbol.toStringTag]:{value:"FormData",configurable:!0}}),A.is.FormData=A.util.MakeTypeAssertion(o),e.exports={FormData:o,makeEntry:l,setFormDataState:c}},2837:e=>{"use strict";const t=Symbol.for("undici.globalOrigin.1");e.exports={getGlobalOrigin:function(){return globalThis[t]},setGlobalOrigin:function(e){if(void 0===e)return void Object.defineProperty(globalThis,t,{value:void 0,writable:!0,enumerable:!1,configurable:!1});const s=new URL(e);if("http:"!==s.protocol&&"https:"!==s.protocol)throw new TypeError(`Only http & https urls are allowed, received ${s.protocol}`);Object.defineProperty(globalThis,t,{value:s,writable:!0,enumerable:!1,configurable:!1})}}},6558:(e,t,s)=>{"use strict";const{kConstruct:r}=s(257),{kEnumerableProperty:n}=s(2858),{iteratorMixin:A,isValidHeaderName:i,isValidHeaderValue:o}=s(6686),{webidl:a}=s(6097),c=s(4589),l=s(7975);function h(e){return 10===e||13===e||9===e||32===e}function g(e){let t=0,s=e.length;for(;s>t&&h(e.charCodeAt(s-1));)--s;for(;s>t&&h(e.charCodeAt(t));)++t;return 0===t&&s===e.length?e:e.substring(t,s)}function d(e,t){if(Array.isArray(t))for(let s=0;s<t.length;++s){const r=t[s];if(2!==r.length)throw a.errors.exception({header:"Headers constructor",message:`expected name/value pair to be length 2, found ${r.length}.`});u(e,r[0],r[1])}else{if("object"!=typeof t||null===t)throw a.errors.conversionFailed({prefix:"Headers constructor",argument:"Argument 1",types:["sequence<sequence<ByteString>>","record<ByteString, ByteString>"]});{const s=Object.keys(t);for(let r=0;r<s.length;++r)u(e,s[r],t[s[r]])}}}function u(e,t,s){if(s=g(s),!i(t))throw a.errors.invalidArgument({prefix:"Headers.append",value:t,type:"header name"});if(!o(s))throw a.errors.invalidArgument({prefix:"Headers.append",value:s,type:"header value"});if("immutable"===B(e))throw new TypeError("immutable");return p(e).append(t,s,!1)}function E(e,t){return e[0]<t[0]?-1:1}class I{cookies=null;sortedMap;headersMap;constructor(e){e instanceof I?(this.headersMap=new Map(e.headersMap),this.sortedMap=e.sortedMap,this.cookies=null===e.cookies?null:[...e.cookies]):(this.headersMap=new Map(e),this.sortedMap=null)}contains(e,t){return this.headersMap.has(t?e:e.toLowerCase())}clear(){this.headersMap.clear(),this.sortedMap=null,this.cookies=null}append(e,t,s){this.sortedMap=null;const r=s?e:e.toLowerCase(),n=this.headersMap.get(r);if(n){const e="cookie"===r?"; ":", ";this.headersMap.set(r,{name:n.name,value:`${n.value}${e}${t}`})}else this.headersMap.set(r,{name:e,value:t});"set-cookie"===r&&(this.cookies??=[]).push(t)}set(e,t,s){this.sortedMap=null;const r=s?e:e.toLowerCase();"set-cookie"===r&&(this.cookies=[t]),this.headersMap.set(r,{name:e,value:t})}delete(e,t){this.sortedMap=null,t||(e=e.toLowerCase()),"set-cookie"===e&&(this.cookies=null),this.headersMap.delete(e)}get(e,t){return this.headersMap.get(t?e:e.toLowerCase())?.value??null}*[Symbol.iterator](){for(const{0:e,1:{value:t}}of this.headersMap)yield[e,t]}get entries(){const e={};if(0!==this.headersMap.size)for(const{name:t,value:s}of this.headersMap.values())e[t]=s;return e}rawValues(){return this.headersMap.values()}get entriesList(){const e=[];if(0!==this.headersMap.size)for(const{0:t,1:{name:s,value:r}}of this.headersMap)if("set-cookie"===t)for(const t of this.cookies)e.push([s,t]);else e.push([s,r]);return e}toSortedArray(){const e=this.headersMap.size,t=new Array(e);if(e<=32){if(0===e)return t;const s=this.headersMap[Symbol.iterator](),r=s.next().value;t[0]=[r[0],r[1].value],c(null!==r[1].value);for(let r,n,A=1,i=0,o=0,a=0,l=0;A<e;++A){for(n=s.next().value,r=t[A]=[n[0],n[1].value],c(null!==r[1]),a=0,o=A;a<o;)l=a+(o-a>>1),t[l][0]<=r[0]?a=l+1:o=l;if(A!==l){for(i=A;i>a;)t[i]=t[--i];t[a]=r}}if(!s.next().done)throw new TypeError("Unreachable");return t}{let e=0;for(const{0:s,1:{value:r}}of this.headersMap)t[e++]=[s,r],c(null!==r);return t.sort(E)}}}class C{#Xe;#je;constructor(e=void 0){a.util.markAsUncloneable(this),e!==r&&(this.#je=new I,this.#Xe="none",void 0!==e&&d(this,e=a.converters.HeadersInit(e,"Headers constructor","init")))}append(e,t){a.brandCheck(this,C),a.argumentLengthCheck(arguments,2,"Headers.append");const s="Headers.append";return u(this,e=a.converters.ByteString(e,s,"name"),t=a.converters.ByteString(t,s,"value"))}delete(e){a.brandCheck(this,C),a.argumentLengthCheck(arguments,1,"Headers.delete");if(e=a.converters.ByteString(e,"Headers.delete","name"),!i(e))throw a.errors.invalidArgument({prefix:"Headers.delete",value:e,type:"header name"});if("immutable"===this.#Xe)throw new TypeError("immutable");this.#je.contains(e,!1)&&this.#je.delete(e,!1)}get(e){a.brandCheck(this,C),a.argumentLengthCheck(arguments,1,"Headers.get");const t="Headers.get";if(e=a.converters.ByteString(e,t,"name"),!i(e))throw a.errors.invalidArgument({prefix:t,value:e,type:"header name"});return this.#je.get(e,!1)}has(e){a.brandCheck(this,C),a.argumentLengthCheck(arguments,1,"Headers.has");const t="Headers.has";if(e=a.converters.ByteString(e,t,"name"),!i(e))throw a.errors.invalidArgument({prefix:t,value:e,type:"header name"});return this.#je.contains(e,!1)}set(e,t){a.brandCheck(this,C),a.argumentLengthCheck(arguments,2,"Headers.set");const s="Headers.set";if(e=a.converters.ByteString(e,s,"name"),t=g(t=a.converters.ByteString(t,s,"value")),!i(e))throw a.errors.invalidArgument({prefix:s,value:e,type:"header name"});if(!o(t))throw a.errors.invalidArgument({prefix:s,value:t,type:"header value"});if("immutable"===this.#Xe)throw new TypeError("immutable");this.#je.set(e,t,!1)}getSetCookie(){a.brandCheck(this,C);const e=this.#je.cookies;return e?[...e]:[]}[l.inspect.custom](e,t){return t.depth??=e,`Headers ${l.formatWithOptions(t,this.#je.entries)}`}static getHeadersGuard(e){return e.#Xe}static setHeadersGuard(e,t){e.#Xe=t}static getHeadersList(e){return e.#je}static setHeadersList(e,t){e.#je=t}}const{getHeadersGuard:B,setHeadersGuard:Q,getHeadersList:p,setHeadersList:f}=C;Reflect.deleteProperty(C,"getHeadersGuard"),Reflect.deleteProperty(C,"setHeadersGuard"),Reflect.deleteProperty(C,"getHeadersList"),Reflect.deleteProperty(C,"setHeadersList"),A("Headers",C,(function(e){const t=p(e);if(!t)return[];if(t.sortedMap)return t.sortedMap;const s=[],r=t.toSortedArray(),n=t.cookies;if(null===n||1===n.length)return t.sortedMap=r;for(let e=0;e<r.length;++e){const{0:t,1:A}=r[e];if("set-cookie"===t)for(let e=0;e<n.length;++e)s.push([t,n[e]]);else s.push([t,A])}return t.sortedMap=s}),0,1),Object.defineProperties(C.prototype,{append:n,delete:n,get:n,has:n,set:n,getSetCookie:n,[Symbol.toStringTag]:{value:"Headers",configurable:!0},[l.inspect.custom]:{enumerable:!1}}),a.converters.HeadersInit=function(e,t,s){if(a.util.Type(e)===a.util.Types.OBJECT){const r=Reflect.get(e,Symbol.iterator);if(!l.types.isProxy(e)&&r===C.prototype.entries)try{return p(e).entriesList}catch{}return"function"==typeof r?a.converters["sequence<sequence<ByteString>>"](e,t,s,r.bind(e)):a.converters["record<ByteString, ByteString>"](e,t,s)}throw a.errors.conversionFailed({prefix:"Headers constructor",argument:"Argument 1",types:["sequence<sequence<ByteString>>","record<ByteString, ByteString>"]})},e.exports={fill:d,compareHeaderName:E,Headers:C,HeadersList:I,getHeadersGuard:B,setHeadersGuard:Q,setHeadersList:f,getHeadersList:p}},7388:(e,t,s)=>{"use strict";const{makeNetworkError:r,makeAppropriateNetworkError:n,filterResponse:A,makeResponse:i,fromInnerResponse:o,getResponseState:a}=s(4821),{HeadersList:c}=s(6558),{Request:l,cloneRequest:h,getRequestDispatcher:g,getRequestState:d}=s(4609),u=s(8522),{makePolicyContainer:E,clonePolicyContainer:I,requestBadPort:C,TAOCheck:B,appendRequestOriginHeader:Q,responseLocationURL:p,requestCurrentURL:f,setRequestReferrerPolicyOnRedirect:m,tryUpgradeRequestToAPotentiallyTrustworthyURL:y,createOpaqueTimingInfo:w,appendFetchMetadata:S,corsCheck:D,crossOriginResourcePolicyCheck:b,determineRequestsReferrer:v,coarsenedSharedCurrentTime:R,sameOrigin:N,isCancelled:k,isAborted:T,isErrorLike:F,fullyReadBody:M,readableStreamClose:U,isomorphicEncode:L,urlIsLocal:H,urlIsHttpHttpsScheme:P,urlHasHttpsScheme:x,clampAndCoarsenConnectionTimingInfo:Y,simpleRangeHeaderValue:V,buildContentRange:O,createInflate:G,extractMimeType:J}=s(6686),W=s(4589),{safelyExtractBody:_,extractBody:q}=s(2530),{redirectStatusSet:$,nullBodyStatus:z,safeMethodsSet:X,requestBodyHeader:j,subresourceSet:Z}=s(9441),K=s(8474),{Readable:ee,pipeline:te,finished:se,isErrored:re,isReadable:ne}=s(7075),{addAbortListener:Ae,bufferToLowerCasedHeaderName:ie}=s(2858),{dataURLProcessor:oe,serializeAMimeType:ae,minimizeSupportedMimeType:ce}=s(9934),{getGlobalDispatcher:le}=s(9879),{webidl:he}=s(6097),{STATUS_CODES:ge}=s(7067),{bytesMatch:de}=s(7420),{createDeferredPromise:ue}=s(9250),Ee="function"==typeof u.createZstdDecompress,Ie=["GET","HEAD"],Ce="undefined"!=typeof __UNDICI_IS_NODE__||"undefined"!=typeof esbuildDetection?"node":"undici";let Be;class Qe extends K{constructor(e){super(),this.dispatcher=e,this.connection=null,this.dump=!1,this.state="ongoing"}terminate(e){"ongoing"===this.state&&(this.state="terminated",this.connection?.destroy(e),this.emit("terminated",e))}abort(e){"ongoing"===this.state&&(this.state="aborted",e||(e=new DOMException("The operation was aborted.","AbortError")),this.serializedAbortReason=e,this.connection?.destroy(e),this.emit("terminated",e))}}function pe(e){fe(e,"fetch")}function fe(e,t="other"){if("error"===e.type&&e.aborted)return;if(!e.urlList?.length)return;const s=e.urlList[0];let r=e.timingInfo,n=e.cacheState;P(s)&&null!==r&&(e.timingAllowPassed||(r=w({startTime:r.startTime}),n=""),r.endTime=R(),e.timingInfo=r,me(r,s.href,t,globalThis,n,"",e.status))}const me=performance.markResourceTiming;function ye(e,t,s,r){if(e&&e.reject(r),null!=t.body?.stream&&ne(t.body.stream)&&t.body.stream.cancel(r).catch((e=>{if("ERR_INVALID_STATE"!==e.code)throw e})),null==s)return;const n=a(s);null!=n.body?.stream&&ne(n.body.stream)&&n.body.stream.cancel(r).catch((e=>{if("ERR_INVALID_STATE"!==e.code)throw e}))}function we({request:e,processRequestBodyChunkLength:t,processRequestEndOfBody:s,processResponse:r,processResponseEndOfBody:n,processResponseConsumeBody:A,useParallelQueue:i=!1,dispatcher:o=le()}){W(o);let a=null,c=!1;null!=e.client&&(a=e.client.globalObject,c=e.client.crossOriginIsolatedCapability);const l=R(c),h=w({startTime:l}),g={controller:new Qe(o),request:e,timingInfo:h,processRequestBodyChunkLength:t,processRequestEndOfBody:s,processResponse:r,processResponseConsumeBody:A,processResponseEndOfBody:n,taskDestination:a,crossOriginIsolatedCapability:c};if(W(!e.body||e.body.stream),"client"===e.window&&(e.window="Window"===e.client?.globalObject?.constructor?.name?e.client:"no-window"),"client"===e.origin&&(e.origin=e.client.origin),"client"===e.policyContainer&&(null!=e.client?e.policyContainer=I(e.client.policyContainer):e.policyContainer=E()),!e.headersList.contains("accept",!0)){const t="*/*";e.headersList.append("accept",t,!0)}return e.headersList.contains("accept-language",!0)||e.headersList.append("accept-language","*",!0),e.priority,Z.has(e.destination),Se(g,!1),g.controller}async function Se(e,t){try{const s=e.request;let n=null;if(s.localURLsOnly&&!H(f(s))&&(n=r("local URLs only")),y(s),"blocked"===C(s)&&(n=r("bad port")),""===s.referrerPolicy&&(s.referrerPolicy=s.policyContainer.referrerPolicy),"no-referrer"!==s.referrer&&(s.referrer=v(s)),null===n){const t=f(s);N(t,s.url)&&"basic"===s.responseTainting||"data:"===t.protocol||"navigate"===s.mode||"websocket"===s.mode?(s.responseTainting="basic",n=await De(e)):"same-origin"===s.mode?n=r('request mode cannot be "same-origin"'):"no-cors"===s.mode?"follow"!==s.redirect?n=r('redirect mode cannot be "follow" for "no-cors" request'):(s.responseTainting="opaque",n=await De(e)):P(f(s))?(s.responseTainting="cors",n=await Re(e)):n=r("URL scheme must be a HTTP(S) scheme")}if(t)return n;0===n.status||n.internalResponse||(s.responseTainting,"basic"===s.responseTainting?n=A(n,"basic"):"cors"===s.responseTainting?n=A(n,"cors"):"opaque"===s.responseTainting?n=A(n,"opaque"):W(!1));let i=0===n.status?n:n.internalResponse;if(0===i.urlList.length&&i.urlList.push(...s.urlList),s.timingAllowFailed||(n.timingAllowPassed=!0),"opaque"===n.type&&206===i.status&&i.rangeRequested&&!s.headers.contains("range",!0)&&(n=i=r()),0===n.status||"HEAD"!==s.method&&"CONNECT"!==s.method&&!z.includes(i.status)||(i.body=null,e.controller.dump=!0),s.integrity){const t=t=>ve(e,r(t));if("opaque"===s.responseTainting||null==n.body)return void t(n.error);const A=r=>{de(r,s.integrity)?(n.body=_(r)[0],ve(e,n)):t("integrity mismatch")};M(n.body,A,t)}else ve(e,n)}catch(t){e.controller.terminate(t)}}function De(e){if(k(e)&&0===e.request.redirectCount)return Promise.resolve(n(e));const{request:t}=e,{protocol:A}=f(t);switch(A){case"about:":return Promise.resolve(r("about scheme is not supported"));case"blob:":{Be||(Be=s(4573).resolveObjectURL);const e=f(t);if(0!==e.search.length)return Promise.resolve(r("NetworkError when attempting to fetch resource."));const n=Be(e.toString());if("GET"!==t.method||!he.is.Blob(n))return Promise.resolve(r("invalid method"));const A=i(),o=n.size,a=L(`${o}`),c=n.type;if(t.headersList.contains("range",!0)){A.rangeRequested=!0;const e=t.headersList.get("range",!0),s=V(e,!0);if("failure"===s)return Promise.resolve(r("failed to fetch the data URL"));let{rangeStartValue:i,rangeEndValue:a}=s;if(null===i)i=o-a,a=i+a-1;else{if(i>=o)return Promise.resolve(r("Range start is greater than the blob's size."));(null===a||a>=o)&&(a=o-1)}const l=n.slice(i,a,c),h=q(l);A.body=h[0];const g=L(`${l.size}`),d=O(i,a,o);A.status=206,A.statusText="Partial Content",A.headersList.set("content-length",g,!0),A.headersList.set("content-type",c,!0),A.headersList.set("content-range",d,!0)}else{const e=q(n);A.statusText="OK",A.body=e[0],A.headersList.set("content-length",a,!0),A.headersList.set("content-type",c,!0)}return Promise.resolve(A)}case"data:":{const e=f(t),s=oe(e);if("failure"===s)return Promise.resolve(r("failed to fetch the data URL"));const n=ae(s.mimeType);return Promise.resolve(i({statusText:"OK",headersList:[["content-type",{name:"Content-Type",value:n}]],body:_(s.body)[0]}))}case"file:":return Promise.resolve(r("not implemented... yet..."));case"http:":case"https:":return Re(e).catch((e=>r(e)));default:return Promise.resolve(r("unknown scheme"))}}function be(e,t){e.request.done=!0,null!=e.processResponseDone&&queueMicrotask((()=>e.processResponseDone(t)))}function ve(e,t){let s=e.timingInfo;const r=()=>{const r=Date.now();"document"===e.request.destination&&(e.controller.fullTimingInfo=s),e.controller.reportTimingSteps=()=>{if(!P(e.request.url))return;s.endTime=r;let n=t.cacheState;const A=t.bodyInfo;t.timingAllowPassed||(s=w(s),n="");let i=0;if("navigator"!==e.request.mode||!t.hasCrossOriginRedirects){i=t.status;const e=J(t.headersList);"failure"!==e&&(A.contentType=ce(e))}null!=e.request.initiatorType&&me(s,e.request.url.href,e.request.initiatorType,globalThis,n,A,i)};queueMicrotask((()=>(e.request.done=!0,null!=e.processResponseEndOfBody&&queueMicrotask((()=>e.processResponseEndOfBody(t))),void(null!=e.request.initiatorType&&e.controller.reportTimingSteps()))))};null!=e.processResponse&&queueMicrotask((()=>{e.processResponse(t),e.processResponse=null}));const n="error"===t.type?t:t.internalResponse??t;null==n.body?r():se(n.body.stream,(()=>{r()}))}async function Re(e){const t=e.request;let s=null,n=null;const A=e.timingInfo;if(t.serviceWorkers,null===s){if("follow"===t.redirect&&(t.serviceWorkers="none"),n=s=await Ne(e),"cors"===t.responseTainting&&"failure"===D(t,s))return r("cors failure");"failure"===B(t,s)&&(t.timingAllowFailed=!0)}return"opaque"!==t.responseTainting&&"opaque"!==s.type||"blocked"!==b(t.origin,t.client,t.destination,n)?($.has(n.status)&&("manual"!==t.redirect&&e.controller.connection.destroy(void 0,!1),"error"===t.redirect?s=r("unexpected redirect"):"manual"===t.redirect?s=n:"follow"===t.redirect?s=await function(e,t){const s=e.request,n=t.internalResponse?t.internalResponse:t;let A;try{if(A=p(n,f(s).hash),null==A)return t}catch(e){return Promise.resolve(r(e))}if(!P(A))return Promise.resolve(r("URL scheme must be a HTTP(S) scheme"));if(20===s.redirectCount)return Promise.resolve(r("redirect count exceeded"));if(s.redirectCount+=1,"cors"===s.mode&&(A.username||A.password)&&!N(s,A))return Promise.resolve(r('cross origin not allowed for request mode "cors"'));if("cors"===s.responseTainting&&(A.username||A.password))return Promise.resolve(r('URL cannot contain credentials for request mode "cors"'));if(303!==n.status&&null!=s.body&&null==s.body.source)return Promise.resolve(r());if([301,302].includes(n.status)&&"POST"===s.method||303===n.status&&!Ie.includes(s.method)){s.method="GET",s.body=null;for(const e of j)s.headersList.delete(e)}N(f(s),A)||(s.headersList.delete("authorization",!0),s.headersList.delete("proxy-authorization",!0),s.headersList.delete("cookie",!0),s.headersList.delete("host",!0));null!=s.body&&(W(null!=s.body.source),s.body=_(s.body.source)[0]);const i=e.timingInfo;i.redirectEndTime=i.postRedirectStartTime=R(e.crossOriginIsolatedCapability),0===i.redirectStartTime&&(i.redirectStartTime=i.startTime);return s.urlList.push(A),m(s,n),Se(e,!0)}(e,s):W(!1)),s.timingInfo=A,s):r("blocked")}async function Ne(e,t=!1,s=!1){const A=e.request;let o=null,a=null,l=null;"no-window"===A.window&&"error"===A.redirect?(o=e,a=A):(a=h(A),o={...e},o.request=a);const g="include"===A.credentials||"same-origin"===A.credentials&&"basic"===A.responseTainting,d=a.body?a.body.length:null;let E=null;if(null==a.body&&["POST","PUT"].includes(a.method)&&(E="0"),null!=d&&(E=L(`${d}`)),null!=E&&a.headersList.append("content-length",E,!0),null!=d&&a.keepalive,he.is.URL(a.referrer)&&a.headersList.append("referer",L(a.referrer.href),!0),Q(a),S(a),a.headersList.contains("user-agent",!0)||a.headersList.append("user-agent",Ce,!0),"default"===a.cache&&(a.headersList.contains("if-modified-since",!0)||a.headersList.contains("if-none-match",!0)||a.headersList.contains("if-unmodified-since",!0)||a.headersList.contains("if-match",!0)||a.headersList.contains("if-range",!0))&&(a.cache="no-store"),"no-cache"!==a.cache||a.preventNoCacheCacheControlHeaderModification||a.headersList.contains("cache-control",!0)||a.headersList.append("cache-control","max-age=0",!0),"no-store"!==a.cache&&"reload"!==a.cache||(a.headersList.contains("pragma",!0)||a.headersList.append("pragma","no-cache",!0),a.headersList.contains("cache-control",!0)||a.headersList.append("cache-control","no-cache",!0)),a.headersList.contains("range",!0)&&a.headersList.append("accept-encoding","identity",!0),a.headersList.contains("accept-encoding",!0)||(x(f(a))?a.headersList.append("accept-encoding","br, gzip, deflate",!0):a.headersList.append("accept-encoding","gzip, deflate",!0)),a.headersList.delete("host",!0),a.cache="no-store","no-store"!==a.cache&&a.cache,null==l){if("only-if-cached"===a.cache)return r("only if cached");const e=await async function(e){W(!e.controller.connection||e.controller.connection.destroyed),e.controller.connection={abort:null,destroyed:!1,destroy(e,t=!0){this.destroyed||(this.destroyed=!0,t&&this.abort?.(e??new DOMException("The operation was aborted.","AbortError")))}};const t=e.request;let s=null;const A=e.timingInfo,o=null;null==o&&(t.cache="no-store");t.mode;let a=null;if(null==t.body&&e.processRequestEndOfBody)queueMicrotask((()=>e.processRequestEndOfBody()));else if(null!=t.body){const s=async function*(t){k(e)||(yield t,e.processRequestBodyChunkLength?.(t.byteLength))},r=()=>{k(e)||e.processRequestEndOfBody&&e.processRequestEndOfBody()},n=t=>{k(e)||("AbortError"===t.name?e.controller.abort():e.controller.terminate(t))};a=async function*(){try{for await(const e of t.body.stream)yield*s(e);r()}catch(e){n(e)}}()}try{const{body:t,status:r,statusText:n,headersList:A,socket:o}=await E({body:a});if(o)s=i({status:r,statusText:n,headersList:A,socket:o});else{const o=t[Symbol.asyncIterator]();e.controller.next=()=>o.next(),s=i({status:r,statusText:n,headersList:A})}}catch(t){return"AbortError"===t.name?(e.controller.connection.destroy(),n(e,t)):r(t)}const l=()=>e.controller.resume(),h=t=>{k(e)||e.controller.abort(t)},g=new ReadableStream({start(t){e.controller.controller=t},pull:l,cancel:h,type:"bytes"});s.body={stream:g,source:null,length:null},e.controller.resume||e.controller.on("terminated",d);function d(t){T(e)?(s.aborted=!0,ne(g)&&e.controller.controller.error(e.controller.serializedAbortReason)):ne(g)&&e.controller.controller.error(new TypeError("terminated",{cause:F(t)?t:void 0})),e.controller.connection.destroy()}return e.controller.resume=async()=>{for(;;){let t,r;try{const{done:s,value:r}=await e.controller.next();if(T(e))break;t=s?void 0:r}catch(s){e.controller.ended&&!A.encodedBodySize?t=void 0:(t=s,r=!0)}if(void 0===t)return U(e.controller.controller),void be(e,s);if(A.decodedBodySize+=t?.byteLength??0,r)return void e.controller.terminate(t);const n=new Uint8Array(t);if(n.byteLength&&e.controller.controller.enqueue(n),re(g))return void e.controller.terminate();if(e.controller.controller.desiredSize<=0)return}},s;function E({body:s}){const r=f(t),n=e.controller.dispatcher;return new Promise(((i,o)=>n.dispatch({path:r.pathname+r.search,origin:r.origin,method:t.method,body:n.isMockActive?t.body&&(t.body.source||t.body.stream):s,headers:t.headersList.entries,maxRedirections:0,upgrade:"websocket"===t.mode?"websocket":void 0},{body:null,abort:null,onConnect(t){const{connection:s}=e.controller;A.finalConnectionTimingInfo=Y(void 0,A.postRedirectStartTime,e.crossOriginIsolatedCapability),s.destroyed?t(new DOMException("The operation was aborted.","AbortError")):(e.controller.on("terminated",t),this.abort=s.abort=t),A.finalNetworkRequestStartTime=R(e.crossOriginIsolatedCapability)},onResponseStarted(){A.finalNetworkResponseStartTime=R(e.crossOriginIsolatedCapability)},onHeaders(e,s,r,n){if(e<200)return!1;const A=new c;for(let e=0;e<s.length;e+=2)A.append(ie(s[e]),s[e+1].toString("latin1"),!0);const o=A.get("location",!0);this.body=new ee({read:r});const a=o&&"follow"===t.redirect&&$.has(e),l=[];if("HEAD"!==t.method&&"CONNECT"!==t.method&&!z.includes(e)&&!a){const e=A.get("content-encoding",!0),t=e?e.toLowerCase().split(","):[];for(let e=t.length-1;e>=0;--e){const s=t[e].trim();if("x-gzip"===s||"gzip"===s)l.push(u.createGunzip({flush:u.constants.Z_SYNC_FLUSH,finishFlush:u.constants.Z_SYNC_FLUSH}));else if("deflate"===s)l.push(G({flush:u.constants.Z_SYNC_FLUSH,finishFlush:u.constants.Z_SYNC_FLUSH}));else if("br"===s)l.push(u.createBrotliDecompress({flush:u.constants.BROTLI_OPERATION_FLUSH,finishFlush:u.constants.BROTLI_OPERATION_FLUSH}));else{if("zstd"!==s||!Ee){l.length=0;break}l.push(u.createZstdDecompress({flush:u.constants.ZSTD_e_continue,finishFlush:u.constants.ZSTD_e_end}))}}}const h=this.onError.bind(this);return i({status:e,statusText:n,headersList:A,body:l.length?te(this.body,...l,(e=>{e&&this.onError(e)})).on("error",h):this.body.on("error",h)}),!0},onData(t){if(e.controller.dump)return;const s=t;return A.encodedBodySize+=s.byteLength,this.body.push(s)},onComplete(){this.abort&&e.controller.off("terminated",this.abort),e.controller.ended=!0,this.body.push(null)},onError(t){this.abort&&e.controller.off("terminated",this.abort),this.body?.destroy(t),e.controller.terminate(t),o(t)},onUpgrade(e,t,s){if(101!==e)return;const r=new c;for(let e=0;e<t.length;e+=2)r.append(ie(t[e]),t[e+1].toString("latin1"),!0);return i({status:e,statusText:ge[e],headersList:r,socket:s}),!0}})))}}(o,g,s);!X.has(a.method)&&e.status>=200&&e.status,null==l&&(l=e)}if(l.urlList=[...a.urlList],a.headersList.contains("range",!0)&&(l.rangeRequested=!0),l.requestIncludesCredentials=g,407===l.status)return"no-window"===A.window?r():k(e)?n(e):r("proxy authentication required");if(421===l.status&&!s&&(null==A.body||null!=A.body.source)){if(k(e))return n(e);e.controller.connection.destroy(),l=await Ne(e,t,!0)}return l}e.exports={fetch:function(e,t=void 0){he.argumentLengthCheck(arguments,1,"globalThis.fetch");let s,r=ue();try{s=new l(e,t)}catch(e){return r.reject(e),r.promise}const n=d(s);if(s.signal.aborted)return ye(r,n,null,s.signal.reason),r.promise;const A=n.client.globalObject;"ServiceWorkerGlobalScope"===A?.constructor?.name&&(n.serviceWorkers="none");let i=null,a=!1,c=null;return Ae(s.signal,(()=>{a=!0,W(null!=c),c.abort(s.signal.reason);const e=i?.deref();ye(r,n,e,s.signal.reason)})),c=we({request:n,processResponseEndOfBody:pe,processResponse:e=>{a||(e.aborted?ye(r,n,i,c.serializedAbortReason):"error"!==e.type?(i=new WeakRef(o(e,"immutable")),r.resolve(i.deref()),r=null):r.reject(new TypeError("fetch failed",{cause:e.error})))},dispatcher:g(s)}),r.promise},Fetch:Qe,fetching:we,finalizeAndReportTiming:fe}},4609:(e,t,s)=>{"use strict";const{extractBody:r,mixinBody:n,cloneBody:A,bodyUnusable:i}=s(2530),{Headers:o,fill:a,HeadersList:c,setHeadersGuard:l,getHeadersGuard:h,setHeadersList:g,getHeadersList:d}=s(6558),u=s(2858),E=s(7975),{isValidHTTPToken:I,sameOrigin:C,environmentSettingsObject:B}=s(6686),{forbiddenMethodsSet:Q,corsSafeListedMethodsSet:p,referrerPolicy:f,requestRedirect:m,requestMode:y,requestCredentials:w,requestCache:S,requestDuplex:D}=s(9441),{kEnumerableProperty:b,normalizedMethodRecordsBase:v,normalizedMethodRecords:R}=u,{webidl:N}=s(6097),{URLSerializer:k}=s(9934),{kConstruct:T}=s(257),F=s(4589),{getMaxListeners:M,setMaxListeners:U,defaultMaxListeners:L}=s(8474),H=Symbol("abortController"),P=new FinalizationRegistry((({signal:e,abort:t})=>{e.removeEventListener("abort",t)})),x=new WeakMap;let Y;try{Y=M((new AbortController).signal)>0}catch{Y=!1}function V(e){return function t(){const s=e.deref();if(void 0!==s){P.unregister(t),this.removeEventListener("abort",t),s.abort(this.reason);const e=x.get(s.signal);if(void 0!==e){if(0!==e.size){for(const t of e){const e=t.deref();void 0!==e&&e.abort(this.reason)}e.clear()}x.delete(s.signal)}}}}let O=!1;class G{#Ze;#qe;#Qe;#le;constructor(e,t=void 0){if(N.util.markAsUncloneable(this),e===T)return;N.argumentLengthCheck(arguments,1,"Request constructor"),e=N.converters.RequestInfo(e),t=N.converters.RequestInit(t);let s=null,n=null;const A=B.settingsObject.baseUrl;let h=null;if("string"==typeof e){let r;this.#qe=t.dispatcher;try{r=new URL(e,A)}catch(t){throw new TypeError("Failed to parse URL from "+e,{cause:t})}if(r.username||r.password)throw new TypeError("Request cannot be constructed from a URL that includes credentials: "+e);s=X({urlList:[r]}),n="cors"}else F(N.is.Request(e)),s=e.#le,h=e.#Ze,this.#qe=t.dispatcher||e.#qe;const E=B.settingsObject.origin;let f="client";if("EnvironmentSettingsObject"===s.window?.constructor?.name&&C(s.window,E)&&(f=s.window),null!=t.window)throw new TypeError(`'window' option '${f}' must be null`);"window"in t&&(f="no-window"),s=X({method:s.method,headersList:s.headersList,unsafeRequest:s.unsafeRequest,client:B.settingsObject,window:f,priority:s.priority,origin:s.origin,referrer:s.referrer,referrerPolicy:s.referrerPolicy,mode:s.mode,credentials:s.credentials,cache:s.cache,redirect:s.redirect,integrity:s.integrity,keepalive:s.keepalive,reloadNavigation:s.reloadNavigation,historyNavigation:s.historyNavigation,urlList:[...s.urlList]});const m=0!==Object.keys(t).length;if(m&&("navigate"===s.mode&&(s.mode="same-origin"),s.reloadNavigation=!1,s.historyNavigation=!1,s.origin="client",s.referrer="client",s.referrerPolicy="",s.url=s.urlList[s.urlList.length-1],s.urlList=[s.url]),void 0!==t.referrer){const e=t.referrer;if(""===e)s.referrer="no-referrer";else{let t;try{t=new URL(e,A)}catch(t){throw new TypeError(`Referrer "${e}" is not a valid URL.`,{cause:t})}"about:"===t.protocol&&"client"===t.hostname||E&&!C(t,B.settingsObject.baseUrl)?s.referrer="client":s.referrer=t}}let y;if(void 0!==t.referrerPolicy&&(s.referrerPolicy=t.referrerPolicy),y=void 0!==t.mode?t.mode:n,"navigate"===y)throw N.errors.exception({header:"Request constructor",message:"invalid request mode navigate."});if(null!=y&&(s.mode=y),void 0!==t.credentials&&(s.credentials=t.credentials),void 0!==t.cache&&(s.cache=t.cache),"only-if-cached"===s.cache&&"same-origin"!==s.mode)throw new TypeError("'only-if-cached' can be set only with 'same-origin' mode");if(void 0!==t.redirect&&(s.redirect=t.redirect),null!=t.integrity&&(s.integrity=String(t.integrity)),void 0!==t.keepalive&&(s.keepalive=Boolean(t.keepalive)),void 0!==t.method){let e=t.method;const r=R[e];if(void 0!==r)s.method=r;else{if(!I(e))throw new TypeError(`'${e}' is not a valid HTTP method.`);const t=e.toUpperCase();if(Q.has(t))throw new TypeError(`'${e}' HTTP method is unsupported.`);e=v[t]??e,s.method=e}O||"patch"!==s.method||(process.emitWarning("Using `patch` is highly likely to result in a `405 Method Not Allowed`. `PATCH` is much more likely to succeed.",{code:"UNDICI-FETCH-patch"}),O=!0)}void 0!==t.signal&&(h=t.signal),this.#le=s;const w=new AbortController;if(this.#Ze=w.signal,null!=h)if(h.aborted)w.abort(h.reason);else{this[H]=w;const e=V(new WeakRef(w));Y&&M(h)===L&&U(1500,h),u.addAbortListener(h,e),P.register(w,{signal:h,abort:e},e)}if(this.#Qe=new o(T),g(this.#Qe,s.headersList),l(this.#Qe,"request"),"no-cors"===y){if(!p.has(s.method))throw new TypeError(`'${s.method} is unsupported in no-cors mode.`);l(this.#Qe,"request-no-cors")}if(m){const e=d(this.#Qe),s=void 0!==t.headers?t.headers:new c(e);if(e.clear(),s instanceof c){for(const{name:t,value:r}of s.rawValues())e.append(t,r,!1);e.cookies=s.cookies}else a(this.#Qe,s)}const S=N.is.Request(e)?e.#le.body:null;if(!(null==t.body&&null==S||"GET"!==s.method&&"HEAD"!==s.method))throw new TypeError("Request with GET/HEAD method cannot have body.");let D=null;if(null!=t.body){const[e,n]=r(t.body,s.keepalive);D=e,n&&!d(this.#Qe).contains("content-type",!0)&&this.#Qe.append("content-type",n,!0)}const b=D??S;if(null!=b&&null==b.source){if(null!=D&&null==t.duplex)throw new TypeError("RequestInit: duplex option is required when sending a body.");if("same-origin"!==s.mode&&"cors"!==s.mode)throw new TypeError('If request is made from ReadableStream, mode should be "same-origin" or "cors"');s.useCORSPreflightFlag=!0}let k=b;if(null==D&&null!=S){if(i(e.#le))throw new TypeError("Cannot construct a Request with a Request object that has already been used.");const t=new TransformStream;S.stream.pipeThrough(t),k={source:S.source,length:S.length,stream:t.readable}}this.#le.body=k}get method(){return N.brandCheck(this,G),this.#le.method}get url(){return N.brandCheck(this,G),k(this.#le.url)}get headers(){return N.brandCheck(this,G),this.#Qe}get destination(){return N.brandCheck(this,G),this.#le.destination}get referrer(){return N.brandCheck(this,G),"no-referrer"===this.#le.referrer?"":"client"===this.#le.referrer?"about:client":this.#le.referrer.toString()}get referrerPolicy(){return N.brandCheck(this,G),this.#le.referrerPolicy}get mode(){return N.brandCheck(this,G),this.#le.mode}get credentials(){return N.brandCheck(this,G),this.#le.credentials}get cache(){return N.brandCheck(this,G),this.#le.cache}get redirect(){return N.brandCheck(this,G),this.#le.redirect}get integrity(){return N.brandCheck(this,G),this.#le.integrity}get keepalive(){return N.brandCheck(this,G),this.#le.keepalive}get isReloadNavigation(){return N.brandCheck(this,G),this.#le.reloadNavigation}get isHistoryNavigation(){return N.brandCheck(this,G),this.#le.historyNavigation}get signal(){return N.brandCheck(this,G),this.#Ze}get body(){return N.brandCheck(this,G),this.#le.body?this.#le.body.stream:null}get bodyUsed(){return N.brandCheck(this,G),!!this.#le.body&&u.isDisturbed(this.#le.body.stream)}get duplex(){return N.brandCheck(this,G),"half"}clone(){if(N.brandCheck(this,G),i(this.#le))throw new TypeError("unusable");const e=j(this.#le),t=new AbortController;if(this.signal.aborted)t.abort(this.signal.reason);else{let e=x.get(this.signal);void 0===e&&(e=new Set,x.set(this.signal,e));const s=new WeakRef(t);e.add(s),u.addAbortListener(t.signal,V(s))}return Z(e,this.#qe,t.signal,h(this.#Qe))}[E.inspect.custom](e,t){null===t.depth&&(t.depth=2),t.colors??=!0;const s={method:this.method,url:this.url,headers:this.headers,destination:this.destination,referrer:this.referrer,referrerPolicy:this.referrerPolicy,mode:this.mode,credentials:this.credentials,cache:this.cache,redirect:this.redirect,integrity:this.integrity,keepalive:this.keepalive,isReloadNavigation:this.isReloadNavigation,isHistoryNavigation:this.isHistoryNavigation,signal:this.signal};return`Request ${E.formatWithOptions(t,s)}`}static setRequestSignal(e,t){return e.#Ze=t,e}static getRequestDispatcher(e){return e.#qe}static setRequestDispatcher(e,t){e.#qe=t}static setRequestHeaders(e,t){e.#Qe=t}static getRequestState(e){return e.#le}static setRequestState(e,t){e.#le=t}}const{setRequestSignal:J,getRequestDispatcher:W,setRequestDispatcher:_,setRequestHeaders:q,getRequestState:$,setRequestState:z}=G;function X(e){return{method:e.method??"GET",localURLsOnly:e.localURLsOnly??!1,unsafeRequest:e.unsafeRequest??!1,body:e.body??null,client:e.client??null,reservedClient:e.reservedClient??null,replacesClientId:e.replacesClientId??"",window:e.window??"client",keepalive:e.keepalive??!1,serviceWorkers:e.serviceWorkers??"all",initiator:e.initiator??"",destination:e.destination??"",priority:e.priority??null,origin:e.origin??"client",policyContainer:e.policyContainer??"client",referrer:e.referrer??"client",referrerPolicy:e.referrerPolicy??"",mode:e.mode??"no-cors",useCORSPreflightFlag:e.useCORSPreflightFlag??!1,credentials:e.credentials??"same-origin",useCredentials:e.useCredentials??!1,cache:e.cache??"default",redirect:e.redirect??"follow",integrity:e.integrity??"",cryptoGraphicsNonceMetadata:e.cryptoGraphicsNonceMetadata??"",parserMetadata:e.parserMetadata??"",reloadNavigation:e.reloadNavigation??!1,historyNavigation:e.historyNavigation??!1,userActivation:e.userActivation??!1,taintedOrigin:e.taintedOrigin??!1,redirectCount:e.redirectCount??0,responseTainting:e.responseTainting??"basic",preventNoCacheCacheControlHeaderModification:e.preventNoCacheCacheControlHeaderModification??!1,done:e.done??!1,timingAllowFailed:e.timingAllowFailed??!1,urlList:e.urlList,url:e.urlList[0],headersList:e.headersList?new c(e.headersList):new c}}function j(e){const t=X({...e,body:null});return null!=e.body&&(t.body=A(e.body)),t}function Z(e,t,s,r){const n=new G(T);z(n,e),_(n,t),J(n,s);const A=new o(T);return q(n,A),g(A,e.headersList),l(A,r),n}Reflect.deleteProperty(G,"setRequestSignal"),Reflect.deleteProperty(G,"getRequestDispatcher"),Reflect.deleteProperty(G,"setRequestDispatcher"),Reflect.deleteProperty(G,"setRequestHeaders"),Reflect.deleteProperty(G,"getRequestState"),Reflect.deleteProperty(G,"setRequestState"),n(G,$),Object.defineProperties(G.prototype,{method:b,url:b,headers:b,redirect:b,clone:b,signal:b,duplex:b,destination:b,body:b,bodyUsed:b,isHistoryNavigation:b,isReloadNavigation:b,keepalive:b,integrity:b,cache:b,credentials:b,attribute:b,referrerPolicy:b,referrer:b,mode:b,[Symbol.toStringTag]:{value:"Request",configurable:!0}}),N.is.Request=N.util.MakeTypeAssertion(G),N.converters.RequestInfo=function(e){return"string"==typeof e?N.converters.USVString(e):N.is.Request(e)?e:N.converters.USVString(e)},N.converters.RequestInit=N.dictionaryConverter([{key:"method",converter:N.converters.ByteString},{key:"headers",converter:N.converters.HeadersInit},{key:"body",converter:N.nullableConverter(N.converters.BodyInit)},{key:"referrer",converter:N.converters.USVString},{key:"referrerPolicy",converter:N.converters.DOMString,allowedValues:f},{key:"mode",converter:N.converters.DOMString,allowedValues:y},{key:"credentials",converter:N.converters.DOMString,allowedValues:w},{key:"cache",converter:N.converters.DOMString,allowedValues:S},{key:"redirect",converter:N.converters.DOMString,allowedValues:m},{key:"integrity",converter:N.converters.DOMString},{key:"keepalive",converter:N.converters.boolean},{key:"signal",converter:N.nullableConverter((e=>N.converters.AbortSignal(e,"RequestInit","signal")))},{key:"window",converter:N.converters.any},{key:"duplex",converter:N.converters.DOMString,allowedValues:D},{key:"dispatcher",converter:N.converters.any}]),e.exports={Request:G,makeRequest:X,fromInnerRequest:Z,cloneRequest:j,getRequestDispatcher:W,getRequestState:$}},4821:(e,t,s)=>{"use strict";const{Headers:r,HeadersList:n,fill:A,getHeadersGuard:i,setHeadersGuard:o,setHeadersList:a}=s(6558),{extractBody:c,cloneBody:l,mixinBody:h,streamRegistry:g,bodyUnusable:d}=s(2530),u=s(2858),E=s(7975),{kEnumerableProperty:I}=u,{isValidReasonPhrase:C,isCancelled:B,isAborted:Q,serializeJavascriptValueToJSONString:p,isErrorLike:f,isomorphicEncode:m,environmentSettingsObject:y}=s(6686),{redirectStatusSet:w,nullBodyStatus:S}=s(9441),{webidl:D}=s(6097),{URLSerializer:b}=s(9934),{kConstruct:v}=s(257),R=s(4589),N=new TextEncoder("utf-8");class k{#Qe;#le;static error(){return O(P(),"immutable")}static json(e,t=void 0){D.argumentLengthCheck(arguments,1,"Response.json"),null!==t&&(t=D.converters.ResponseInit(t));const s=N.encode(p(e)),r=c(s),n=O(H({}),"response");return V(n,t,{body:r[0],type:"application/json"}),n}static redirect(e,t=302){let s;D.argumentLengthCheck(arguments,1,"Response.redirect"),e=D.converters.USVString(e),t=D.converters["unsigned short"](t);try{s=new URL(e,y.settingsObject.baseUrl)}catch(t){throw new TypeError(`Failed to parse URL from ${e}`,{cause:t})}if(!w.has(t))throw new RangeError(`Invalid status code ${t}`);const r=O(H({}),"immutable");r.#le.status=t;const n=m(b(s));return r.#le.headersList.append("location",n,!0),r}constructor(e=null,t=void 0){if(D.util.markAsUncloneable(this),e===v)return;null!==e&&(e=D.converters.BodyInit(e,"Response","body")),t=D.converters.ResponseInit(t),this.#le=H({}),this.#Qe=new r(v),o(this.#Qe,"response"),a(this.#Qe,this.#le.headersList);let s=null;if(null!=e){const[t,r]=c(e);s={body:t,type:r}}V(this,t,s)}get type(){return D.brandCheck(this,k),this.#le.type}get url(){D.brandCheck(this,k);const e=this.#le.urlList,t=e[e.length-1]??null;return null===t?"":b(t,!0)}get redirected(){return D.brandCheck(this,k),this.#le.urlList.length>1}get status(){return D.brandCheck(this,k),this.#le.status}get ok(){return D.brandCheck(this,k),this.#le.status>=200&&this.#le.status<=299}get statusText(){return D.brandCheck(this,k),this.#le.statusText}get headers(){return D.brandCheck(this,k),this.#Qe}get body(){return D.brandCheck(this,k),this.#le.body?this.#le.body.stream:null}get bodyUsed(){return D.brandCheck(this,k),!!this.#le.body&&u.isDisturbed(this.#le.body.stream)}clone(){if(D.brandCheck(this,k),d(this.#le))throw D.errors.exception({header:"Response.clone",message:"Body has already been consumed."});const e=L(this.#le);return this.#le.body?.stream&&g.register(this,new WeakRef(this.#le.body.stream)),O(e,i(this.#Qe))}[E.inspect.custom](e,t){null===t.depth&&(t.depth=2),t.colors??=!0;const s={status:this.status,statusText:this.statusText,headers:this.headers,body:this.body,bodyUsed:this.bodyUsed,ok:this.ok,redirected:this.redirected,type:this.type,url:this.url};return`Response ${E.formatWithOptions(t,s)}`}static getResponseHeaders(e){return e.#Qe}static setResponseHeaders(e,t){e.#Qe=t}static getResponseState(e){return e.#le}static setResponseState(e,t){e.#le=t}}const{getResponseHeaders:T,setResponseHeaders:F,getResponseState:M,setResponseState:U}=k;function L(e){if(e.internalResponse)return Y(L(e.internalResponse),e.type);const t=H({...e,body:null});return null!=e.body&&(t.body=l(e.body)),t}function H(e){return{aborted:!1,rangeRequested:!1,timingAllowPassed:!1,requestIncludesCredentials:!1,type:"default",status:200,timingInfo:null,cacheState:"",statusText:"",...e,headersList:e?.headersList?new n(e?.headersList):new n,urlList:e?.urlList?[...e.urlList]:[]}}function P(e){return H({type:"error",status:0,error:f(e)?e:new Error(e?String(e):e),aborted:e&&"AbortError"===e.name})}function x(e,t){return t={internalResponse:e,...t},new Proxy(e,{get:(e,s)=>s in t?t[s]:e[s],set:(e,s,r)=>(R(!(s in t)),e[s]=r,!0)})}function Y(e,t){return"basic"===t?x(e,{type:"basic",headersList:e.headersList}):"cors"===t?x(e,{type:"cors",headersList:e.headersList}):"opaque"===t?x(e,{type:"opaque",urlList:Object.freeze([]),status:0,statusText:"",body:null}):"opaqueredirect"===t?x(e,{type:"opaqueredirect",status:0,statusText:"",headersList:[],body:null}):void R(!1)}function V(e,t,s){if(null!==t.status&&(t.status<200||t.status>599))throw new RangeError('init["status"] must be in the range of 200 to 599, inclusive.');if("statusText"in t&&null!=t.statusText&&!C(String(t.statusText)))throw new TypeError("Invalid statusText");if("status"in t&&null!=t.status&&(M(e).status=t.status),"statusText"in t&&null!=t.statusText&&(M(e).statusText=t.statusText),"headers"in t&&null!=t.headers&&A(T(e),t.headers),s){if(S.includes(e.status))throw D.errors.exception({header:"Response constructor",message:`Invalid response status code ${e.status}`});M(e).body=s.body,null==s.type||M(e).headersList.contains("content-type",!0)||M(e).headersList.append("content-type",s.type,!0)}}function O(e,t){const s=new k(v);U(s,e);const n=new r(v);return F(s,n),a(n,e.headersList),o(n,t),e.body?.stream&&g.register(s,new WeakRef(e.body.stream)),s}Reflect.deleteProperty(k,"getResponseHeaders"),Reflect.deleteProperty(k,"setResponseHeaders"),Reflect.deleteProperty(k,"getResponseState"),Reflect.deleteProperty(k,"setResponseState"),h(k,M),Object.defineProperties(k.prototype,{type:I,url:I,status:I,ok:I,redirected:I,statusText:I,headers:I,clone:I,body:I,bodyUsed:I,[Symbol.toStringTag]:{value:"Response",configurable:!0}}),Object.defineProperties(k,{json:I,redirect:I,error:I}),D.converters.XMLHttpRequestBodyInit=function(e,t,s){return"string"==typeof e?D.converters.USVString(e,t,s):D.is.Blob(e)||D.is.BufferSource(e)||D.is.FormData(e)||D.is.URLSearchParams(e)?e:D.converters.DOMString(e,t,s)},D.converters.BodyInit=function(e,t,s){return D.is.ReadableStream(e)||e?.[Symbol.asyncIterator]?e:D.converters.XMLHttpRequestBodyInit(e,t,s)},D.converters.ResponseInit=D.dictionaryConverter([{key:"status",converter:D.converters["unsigned short"],defaultValue:()=>200},{key:"statusText",converter:D.converters.ByteString,defaultValue:()=>""},{key:"headers",converter:D.converters.HeadersInit}]),D.is.Response=D.util.MakeTypeAssertion(k),e.exports={isNetworkError:function(e){return"error"===e.type&&0===e.status},makeNetworkError:P,makeResponse:H,makeAppropriateNetworkError:function(e,t=null){return R(B(e)),Q(e)?P(Object.assign(new DOMException("The operation was aborted.","AbortError"),{cause:t})):P(Object.assign(new DOMException("Request was cancelled."),{cause:t}))},filterResponse:Y,Response:k,cloneResponse:L,fromInnerResponse:O,getResponseState:M}},6686:(e,t,s)=>{"use strict";const{Transform:r}=s(7075),n=s(8522),{redirectStatusSet:A,referrerPolicyTokens:i,badPortsSet:o}=s(9441),{getGlobalOrigin:a}=s(2837),{collectASequenceOfCodePoints:c,collectAnHTTPQuotedString:l,removeChars:h,parseMIMEType:g}=s(9934),{performance:d}=s(643),{ReadableStreamFrom:u,isValidHTTPToken:E,normalizedMethodRecordsBase:I}=s(2858),C=s(4589),{isUint8Array:B}=s(3429),{webidl:Q}=s(6097);function p(e){const t=e.urlList,s=t.length;return 0===s?null:t[s-1].toString()}function f(e){for(let t=0;t<e.length;++t){const s=e.charCodeAt(t);if(s>126||s<32)return!1}return!0}function m(e){return e.urlList[e.urlList.length-1]}const y=E;function w(e){return!1===("\t"===e[0]||" "===e[0]||"\t"===e[e.length-1]||" "===e[e.length-1]||e.includes("\n")||e.includes("\r")||e.includes("\0"))}function S(e,t){return e}function D(){return{referrerPolicy:"strict-origin-when-cross-origin"}}function b(e,t=!1){return C(Q.is.URL(e)),P(e=new URL(e))?"no-referrer":(e.username="",e.password="",e.hash="",!0===t&&(e.pathname="",e.search=""),e)}const v=RegExp.prototype.test.bind(/^127\.(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]\d|\d)\.){2}(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]\d|\d)$/),R=RegExp.prototype.test.bind(/^(?:(?:0{1,4}:){7}|(?:0{1,4}:){1,6}:|::)0{0,3}1$/);function N(e){return e.includes(":")?("["===e[0]&&"]"===e[e.length-1]&&(e=e.slice(1,-1)),R(e)):v(e)}function k(e){return!!Q.is.URL(e)&&("about:blank"===e.href||"about:srcdoc"===e.href||("data:"===e.protocol||("blob:"===e.protocol||!(null==(t=e.origin)||"null"===t||"https:"!==(t=new URL(t)).protocol&&"wss:"!==t.protocol&&!N(t.hostname)&&"localhost"!==t.hostname&&"localhost."!==t.hostname&&!t.hostname.endsWith(".localhost")&&!t.hostname.endsWith(".localhost.")&&"file:"!==t.protocol))));var t}function T(e,t){return e.origin===t.origin&&"null"===e.origin||e.protocol===t.protocol&&e.hostname===t.hostname&&e.port===t.port}const F=Object.getPrototypeOf(Object.getPrototypeOf([][Symbol.iterator]()));function M(e,t,s=0,r=1){class n{#Ke;#et;#tt;constructor(e,t){this.#Ke=e,this.#et=t,this.#tt=0}next(){if("object"!=typeof this||null===this||!(#Ke in this))throw new TypeError(`'next' called on an object that does not implement interface ${e} Iterator.`);const n=this.#tt,A=t(this.#Ke);if(n>=A.length)return{value:void 0,done:!0};const{[s]:i,[r]:o}=A[n];let a;switch(this.#tt=n+1,this.#et){case"key":a=i;break;case"value":a=o;break;case"key+value":a=[i,o]}return{value:a,done:!1}}}return delete n.prototype.constructor,Object.setPrototypeOf(n.prototype,F),Object.defineProperties(n.prototype,{[Symbol.toStringTag]:{writable:!1,enumerable:!1,configurable:!0,value:`${e} Iterator`},next:{writable:!0,enumerable:!0,configurable:!0}}),function(e,t){return new n(e,t)}}const U=/[^\x00-\xFF]/;function L(e){return C(!U.test(e)),e}async function H(e,t,s){try{const r=[];let n=0;for(;;){const{done:A,value:i}=await e.read();if(A)return void t(Buffer.concat(r,n));if(!B(i))return void s(new TypeError("Received non-Uint8Array chunk"));r.push(i),n+=i.length}}catch(e){s(e)}}function P(e){C("protocol"in e);const t=e.protocol;return"about:"===t||"blob:"===t||"data:"===t}function x(e){return"string"==typeof e&&":"===e[5]&&"h"===e[0]&&"t"===e[1]&&"t"===e[2]&&"p"===e[3]&&"s"===e[4]||"https:"===e.protocol}function Y(e){C("protocol"in e);const t=e.protocol;return"http:"===t||"https:"===t}class V extends r{#st;constructor(e){super(),this.#st=e}_transform(e,t,s){if(!this._inflateStream){if(0===e.length)return void s();this._inflateStream=8==(15&e[0])?n.createInflate(this.#st):n.createInflateRaw(this.#st),this._inflateStream.on("data",this.push.bind(this)),this._inflateStream.on("end",(()=>this.push(null))),this._inflateStream.on("error",(e=>this.destroy(e)))}this._inflateStream.write(e,t,s)}_final(e){this._inflateStream&&(this._inflateStream.end(),this._inflateStream=null),e()}}function O(e,t){const s=t.get(e,!0);return null===s?null:function(e){const t=e,s={position:0},r=[];let n="";for(;s.position<t.length;){if(n+=c((e=>'"'!==e&&","!==e),t,s),s.position<t.length)if(34===t.charCodeAt(s.position)){if(n+=l(t,s),s.position<t.length)continue}else C(44===t.charCodeAt(s.position)),s.position++;n=h(n,!0,!0,(e=>9===e||32===e)),r.push(n),n=""}return r}(s)}const G=new TextDecoder;class J{get baseUrl(){return a()}get origin(){return this.baseUrl?.origin}policyContainer={referrerPolicy:"strict-origin-when-cross-origin"}}const W=new class{settingsObject=new J};e.exports={isAborted:function(e){return"aborted"===e.controller.state},isCancelled:function(e){return"aborted"===e.controller.state||"terminated"===e.controller.state},isValidEncodedURL:f,ReadableStreamFrom:u,tryUpgradeRequestToAPotentiallyTrustworthyURL:function(e){},clampAndCoarsenConnectionTimingInfo:function(e,t,s){return!e?.startTime||e.startTime<t?{domainLookupStartTime:t,domainLookupEndTime:t,connectionStartTime:t,connectionEndTime:t,secureConnectionStartTime:t,ALPNNegotiatedProtocol:e?.ALPNNegotiatedProtocol}:{domainLookupStartTime:S(e.domainLookupStartTime),domainLookupEndTime:S(e.domainLookupEndTime),connectionStartTime:S(e.connectionStartTime),connectionEndTime:S(e.connectionEndTime),secureConnectionStartTime:S(e.secureConnectionStartTime),ALPNNegotiatedProtocol:e.ALPNNegotiatedProtocol}},coarsenedSharedCurrentTime:function(e){return S(d.now())},determineRequestsReferrer:function(e){const t=e.referrerPolicy;C(t);let s=null;if("client"===e.referrer){const e=a();if(!e||"null"===e.origin)return"no-referrer";s=new URL(e)}else Q.is.URL(e.referrer)&&(s=e.referrer);let r=b(s);const n=b(s,!0);switch(r.toString().length>4096&&(r=n),t){case"no-referrer":return"no-referrer";case"origin":return null!=n?n:b(s,!0);case"unsafe-url":return r;case"strict-origin":{const t=m(e);return k(r)&&!k(t)?"no-referrer":n}case"strict-origin-when-cross-origin":{const t=m(e);return T(r,t)?r:k(r)&&!k(t)?"no-referrer":n}case"same-origin":return T(e,r)?r:"no-referrer";case"origin-when-cross-origin":return T(e,r)?r:n;case"no-referrer-when-downgrade":{const t=m(e);return k(r)&&!k(t)?"no-referrer":r}}},makePolicyContainer:D,clonePolicyContainer:function(e){return{referrerPolicy:e.referrerPolicy}},appendFetchMetadata:function(e){let t=null;t=e.mode,e.headersList.set("sec-fetch-mode",t,!0)},appendRequestOriginHeader:function(e){let t=e.origin;if("client"!==t&&void 0!==t)if("cors"===e.responseTainting||"websocket"===e.mode)e.headersList.append("origin",t,!0);else if("GET"!==e.method&&"HEAD"!==e.method){switch(e.referrerPolicy){case"no-referrer":t=null;break;case"no-referrer-when-downgrade":case"strict-origin":case"strict-origin-when-cross-origin":e.origin&&x(e.origin)&&!x(m(e))&&(t=null);break;case"same-origin":T(e,m(e))||(t=null)}e.headersList.append("origin",t,!0)}},TAOCheck:function(){return"success"},corsCheck:function(){return"success"},crossOriginResourcePolicyCheck:function(){return"allowed"},createOpaqueTimingInfo:function(e){return{startTime:e.startTime??0,redirectStartTime:0,redirectEndTime:0,postRedirectStartTime:e.startTime??0,finalServiceWorkerStartTime:0,finalNetworkResponseStartTime:0,finalNetworkRequestStartTime:0,endTime:0,encodedBodySize:0,decodedBodySize:0,finalConnectionTimingInfo:null}},setRequestReferrerPolicyOnRedirect:function(e,t){const s=function(e){const t=(e.headersList.get("referrer-policy",!0)??"").split(",");let s="";if(t.length)for(let e=t.length;0!==e;e--){const r=t[e-1].trim();if(i.has(r)){s=r;break}}return s}(t);""!==s&&(e.referrerPolicy=s)},isValidHTTPToken:E,requestBadPort:function(e){const t=m(e);return Y(t)&&o.has(t.port)?"blocked":"allowed"},requestCurrentURL:m,responseURL:p,responseLocationURL:function(e,t){if(!A.has(e.status))return null;let s=e.headersList.get("location",!0);var r;return null!==s&&w(s)&&(f(s)||(r=s,s=Buffer.from(r,"binary").toString("utf8")),s=new URL(s,p(e))),s&&!s.hash&&(s.hash=t),s},isURLPotentiallyTrustworthy:k,isValidReasonPhrase:function(e){for(let t=0;t<e.length;++t){const s=e.charCodeAt(t);if(!(9===s||s>=32&&s<=126||s>=128&&s<=255))return!1}return!0},sameOrigin:T,normalizeMethod:function(e){return I[e.toLowerCase()]??e},serializeJavascriptValueToJSONString:function(e){const t=JSON.stringify(e);if(void 0===t)throw new TypeError("Value is not JSON serializable");return C("string"==typeof t),t},iteratorMixin:function(e,t,s,r=0,n=1){const A=M(e,s,r,n),i={keys:{writable:!0,enumerable:!0,configurable:!0,value:function(){return Q.brandCheck(this,t),A(this,"key")}},values:{writable:!0,enumerable:!0,configurable:!0,value:function(){return Q.brandCheck(this,t),A(this,"value")}},entries:{writable:!0,enumerable:!0,configurable:!0,value:function(){return Q.brandCheck(this,t),A(this,"key+value")}},forEach:{writable:!0,enumerable:!0,configurable:!0,value:function(s,r=globalThis){if(Q.brandCheck(this,t),Q.argumentLengthCheck(arguments,1,`${e}.forEach`),"function"!=typeof s)throw new TypeError(`Failed to execute 'forEach' on '${e}': parameter 1 is not of type 'Function'.`);for(const{0:e,1:t}of A(this,"key+value"))s.call(r,t,e,this)}}};return Object.defineProperties(t.prototype,{...i,[Symbol.iterator]:{writable:!0,enumerable:!1,configurable:!0,value:i.entries.value}})},createIterator:M,isValidHeaderName:y,isValidHeaderValue:w,isErrorLike:function(e){return e instanceof Error||"Error"===e?.constructor?.name||"DOMException"===e?.constructor?.name},fullyReadBody:function(e,t,s){const r=t,n=s;try{H(e.stream.getReader(),r,n)}catch(e){n(e)}},readableStreamClose:function(e){try{e.close(),e.byobRequest?.respond(0)}catch(e){if(!e.message.includes("Controller is already closed")&&!e.message.includes("ReadableStream is already closed"))throw e}},isomorphicEncode:L,urlIsLocal:P,urlHasHttpsScheme:x,urlIsHttpHttpsScheme:Y,readAllBytes:H,simpleRangeHeaderValue:function(e,t){const s=e;if(!s.startsWith("bytes"))return"failure";const r={position:5};if(t&&c((e=>"\t"===e||" "===e),s,r),61!==s.charCodeAt(r.position))return"failure";r.position++,t&&c((e=>"\t"===e||" "===e),s,r);const n=c((e=>{const t=e.charCodeAt(0);return t>=48&&t<=57}),s,r),A=n.length?Number(n):null;if(t&&c((e=>"\t"===e||" "===e),s,r),45!==s.charCodeAt(r.position))return"failure";r.position++,t&&c((e=>"\t"===e||" "===e),s,r);const i=c((e=>{const t=e.charCodeAt(0);return t>=48&&t<=57}),s,r),o=i.length?Number(i):null;return r.position<s.length||null===o&&null===A||A>o?"failure":{rangeStartValue:A,rangeEndValue:o}},buildContentRange:function(e,t,s){let r="bytes ";return r+=L(`${e}`),r+="-",r+=L(`${t}`),r+="/",r+=L(`${s}`),r},createInflate:function(e){return new V(e)},extractMimeType:function(e){let t=null,s=null,r=null;const n=O("content-type",e);if(null===n)return"failure";for(const e of n){const n=g(e);"failure"!==n&&"*/*"!==n.essence&&(r=n,r.essence!==s?(t=null,r.parameters.has("charset")&&(t=r.parameters.get("charset")),s=r.essence):r.parameters.has("charset")||null===t||r.parameters.set("charset",t))}return null==r?"failure":r},getDecodeSplit:O,utf8DecodeBytes:function(e){return 0===e.length?"":(239===e[0]&&187===e[1]&&191===e[2]&&(e=e.subarray(3)),G.decode(e))},environmentSettingsObject:W,isOriginIPPotentiallyTrustworthy:N}},7420:(e,t,s)=>{"use strict";const r=s(4589),n=new Map([["sha256",0],["sha384",1],["sha512",2]]);let A;try{A=s(7598);const e=A.getHashes();0===e.length&&n.clear();for(const t of n.keys())!1===e.includes(t)&&n.delete(t)}catch{n.clear()}const i=Map.prototype.get.bind(n),o=Map.prototype.has.bind(n),a=void 0===A||0===n.size?()=>!0:(e,t)=>{const s=l(t);if(0===s.length)return!0;const r=c(s);for(const t of r){const s=t.alg,r=t.val;if(g(h(s,e),r))return!0}return!1};function c(e){const t=[];let s=null;for(const n of e){if(r(o(n.alg),"Invalid SRI hash algorithm token"),0===t.length){t.push(n),s=n;continue}const e=s.alg,A=i(e),a=n.alg,c=i(a);c<A||(c>A?(s=n,t[0]=n,t.length=1):t.push(n))}return t}function l(e){const t=[];for(const s of e.split(" ")){const e=s.split("?",1)[0];let r="";const n=[e.slice(0,6),e.slice(7)],A=n[0];if(!o(A))continue;n[1]&&(r=n[1]);const i={alg:A,val:r};t.push(i)}return t}const h=(e,t)=>A.hash(e,t,"base64");function g(e,t){let s=e.length;0!==s&&"="===e[s-1]&&(s-=1),0!==s&&"="===e[s-1]&&(s-=1);let r=t.length;if(0!==r&&"="===t[r-1]&&(r-=1),0!==r&&"="===t[r-1]&&(r-=1),s!==r)return!1;for(let r=0;r<s;++r)if(!(e[r]===t[r]||"+"===e[r]&&"-"===t[r]||"/"===e[r]&&"_"===t[r]))return!1;return!0}e.exports={applyAlgorithmToBytes:h,bytesMatch:a,caseSensitiveMatch:g,isValidSRIHashAlgorithm:o,getStrongestMetadata:c,parseMetadata:l}},6097:(e,t,s)=>{"use strict";const{types:r,inspect:n}=s(7975),{markAsUncloneable:A}=s(5919),i=Function.call.bind(Function.prototype[Symbol.hasInstance]),o={converters:{},util:{},errors:{},is:{}};o.errors.exception=function(e){return new TypeError(`${e.header}: ${e.message}`)},o.errors.conversionFailed=function(e){const t=1===e.types.length?"":" one of",s=`${e.argument} could not be converted to${t}: ${e.types.join(", ")}.`;return o.errors.exception({header:e.prefix,message:s})},o.errors.invalidArgument=function(e){return o.errors.exception({header:e.prefix,message:`"${e.value}" is an invalid ${e.type}.`})},o.brandCheck=function(e,t){if(!i(t,e)){const e=new TypeError("Illegal invocation");throw e.code="ERR_INVALID_THIS",e}},o.brandCheckMultiple=function(e){const t=e.map((e=>o.util.MakeTypeAssertion(e)));return e=>{if(t.every((t=>!t(e)))){const e=new TypeError("Illegal invocation");throw e.code="ERR_INVALID_THIS",e}}},o.argumentLengthCheck=function({length:e},t,s){if(e<t)throw o.errors.exception({message:`${t} argument${1!==t?"s":""} required, but${e?" only":""} ${e} found.`,header:s})},o.illegalConstructor=function(){throw o.errors.exception({header:"TypeError",message:"Illegal constructor"})},o.util.MakeTypeAssertion=function(e){return t=>i(e,t)},o.util.Type=function(e){switch(typeof e){case"undefined":return 1;case"boolean":return 2;case"string":return 3;case"symbol":return 4;case"number":return 5;case"bigint":return 6;case"function":case"object":return null===e?7:8}},o.util.Types={UNDEFINED:1,BOOLEAN:2,STRING:3,SYMBOL:4,NUMBER:5,BIGINT:6,NULL:7,OBJECT:8},o.util.TypeValueToString=function(e){switch(o.util.Type(e)){case 1:return"Undefined";case 2:return"Boolean";case 3:return"String";case 4:return"Symbol";case 5:return"Number";case 6:return"BigInt";case 7:return"Null";case 8:return"Object"}},o.util.markAsUncloneable=A||(()=>{}),o.util.ConvertToInt=function(e,t,s,r){let n,A;64===t?(n=Math.pow(2,53)-1,A="unsigned"===s?0:Math.pow(-2,53)+1):"unsigned"===s?(A=0,n=Math.pow(2,t)-1):(A=Math.pow(-2,t)-1,n=Math.pow(2,t-1)-1);let i=Number(e);if(0===i&&(i=0),o.util.HasFlag(r,o.attributes.EnforceRange)){if(Number.isNaN(i)||i===Number.POSITIVE_INFINITY||i===Number.NEGATIVE_INFINITY)throw o.errors.exception({header:"Integer conversion",message:`Could not convert ${o.util.Stringify(e)} to an integer.`});if(i=o.util.IntegerPart(i),i<A||i>n)throw o.errors.exception({header:"Integer conversion",message:`Value must be between ${A}-${n}, got ${i}.`});return i}return!Number.isNaN(i)&&o.util.HasFlag(r,o.attributes.Clamp)?(i=Math.min(Math.max(i,A),n),i=Math.floor(i)%2==0?Math.floor(i):Math.ceil(i),i):Number.isNaN(i)||0===i&&Object.is(0,i)||i===Number.POSITIVE_INFINITY||i===Number.NEGATIVE_INFINITY?0:(i=o.util.IntegerPart(i),i%=Math.pow(2,t),"signed"===s&&i>=Math.pow(2,t)-1?i-Math.pow(2,t):i)},o.util.IntegerPart=function(e){const t=Math.floor(Math.abs(e));return e<0?-1*t:t},o.util.Stringify=function(e){switch(o.util.Type(e)){case 4:return`Symbol(${e.description})`;case 8:return n(e);case 3:return`"${e}"`;case 6:return`${e}n`;default:return`${e}`}},o.util.IsResizableArrayBuffer=function(e){if(r.isArrayBuffer(e))return e.resizable;if(r.isSharedArrayBuffer(e))return e.growable;throw o.errors.exception({header:"IsResizableArrayBuffer",message:`"${o.util.Stringify(e)}" is not an array buffer.`})},o.util.HasFlag=function(e,t){return"number"==typeof e&&(e&t)===t},o.sequenceConverter=function(e){return(t,s,r,n)=>{if(8!==o.util.Type(t))throw o.errors.exception({header:s,message:`${r} (${o.util.Stringify(t)}) is not iterable.`});const A="function"==typeof n?n():t?.[Symbol.iterator]?.(),i=[];let a=0;if(void 0===A||"function"!=typeof A.next)throw o.errors.exception({header:s,message:`${r} is not iterable.`});for(;;){const{done:t,value:n}=A.next();if(t)break;i.push(e(n,s,`${r}[${a++}]`))}return i}},o.recordConverter=function(e,t){return(s,n,A)=>{if(8!==o.util.Type(s))throw o.errors.exception({header:n,message:`${A} ("${o.util.TypeValueToString(s)}") is not an Object.`});const i={};if(!r.isProxy(s)){const r=[...Object.getOwnPropertyNames(s),...Object.getOwnPropertySymbols(s)];for(const a of r){const r=o.util.Stringify(a),c=e(a,n,`Key ${r} in ${A}`),l=t(s[a],n,`${A}[${r}]`);i[c]=l}return i}const a=Reflect.ownKeys(s);for(const r of a){const o=Reflect.getOwnPropertyDescriptor(s,r);if(o?.enumerable){const o=e(r,n,A),a=t(s[r],n,A);i[o]=a}}return i}},o.interfaceConverter=function(e,t){return(s,r,n)=>{if(!e(s))throw o.errors.exception({header:r,message:`Expected ${n} ("${o.util.Stringify(s)}") to be an instance of ${t}.`});return s}},o.dictionaryConverter=function(e){return(t,s,r)=>{const n={};if(null!=t&&8!==o.util.Type(t))throw o.errors.exception({header:s,message:`Expected ${t} to be one of: Null, Undefined, Object.`});for(const A of e){const{key:e,defaultValue:i,required:a,converter:c}=A;if(!0===a&&(null==t||!Object.hasOwn(t,e)))throw o.errors.exception({header:s,message:`Missing required key "${e}".`});let l=t?.[e];const h=void 0!==i;if(h&&void 0===l&&(l=i()),a||h||void 0!==l){if(l=c(l,s,`${r}.${e}`),A.allowedValues&&!A.allowedValues.includes(l))throw o.errors.exception({header:s,message:`${l} is not an accepted type. Expected one of ${A.allowedValues.join(", ")}.`});n[e]=l}}return n}},o.nullableConverter=function(e){return(t,s,r)=>null===t?t:e(t,s,r)},o.is.USVString=function(e){return"string"==typeof e&&e.isWellFormed()},o.is.ReadableStream=o.util.MakeTypeAssertion(ReadableStream),o.is.Blob=o.util.MakeTypeAssertion(Blob),o.is.URLSearchParams=o.util.MakeTypeAssertion(URLSearchParams),o.is.File=o.util.MakeTypeAssertion(File),o.is.URL=o.util.MakeTypeAssertion(URL),o.is.AbortSignal=o.util.MakeTypeAssertion(AbortSignal),o.is.MessagePort=o.util.MakeTypeAssertion(MessagePort),o.is.BufferSource=function(e){return r.isArrayBuffer(e)||ArrayBuffer.isView(e)&&r.isArrayBuffer(e.buffer)},o.converters.DOMString=function(e,t,s,r){if(null===e&&o.util.HasFlag(r,o.attributes.LegacyNullToEmptyString))return"";if("symbol"==typeof e)throw o.errors.exception({header:t,message:`${s} is a symbol, which cannot be converted to a DOMString.`});return String(e)},o.converters.ByteString=function(e,t,s){if("symbol"==typeof e)throw o.errors.exception({header:t,message:`${s} is a symbol, which cannot be converted to a ByteString.`});const r=String(e);for(let e=0;e<r.length;e++)if(r.charCodeAt(e)>255)throw new TypeError(`Cannot convert argument to a ByteString because the character at index ${e} has a value of ${r.charCodeAt(e)} which is greater than 255.`);return r},o.converters.USVString=function(e){return"string"==typeof e?e.toWellFormed():`${e}`.toWellFormed()},o.converters.boolean=function(e){return Boolean(e)},o.converters.any=function(e){return e},o.converters["long long"]=function(e,t,s){return o.util.ConvertToInt(e,64,"signed",0,t,s)},o.converters["unsigned long long"]=function(e,t,s){return o.util.ConvertToInt(e,64,"unsigned",0,t,s)},o.converters["unsigned long"]=function(e,t,s){return o.util.ConvertToInt(e,32,"unsigned",0,t,s)},o.converters["unsigned short"]=function(e,t,s,r){return o.util.ConvertToInt(e,16,"unsigned",r,t,s)},o.converters.ArrayBuffer=function(e,t,s,n){if(8!==o.util.Type(e)||!r.isArrayBuffer(e))throw o.errors.conversionFailed({prefix:t,argument:`${s} ("${o.util.Stringify(e)}")`,types:["ArrayBuffer"]});if(!o.util.HasFlag(n,o.attributes.AllowResizable)&&o.util.IsResizableArrayBuffer(e))throw o.errors.exception({header:t,message:`${s} cannot be a resizable ArrayBuffer.`});return e},o.converters.SharedArrayBuffer=function(e,t,s,n){if(8!==o.util.Type(e)||!r.isSharedArrayBuffer(e))throw o.errors.conversionFailed({prefix:t,argument:`${s} ("${o.util.Stringify(e)}")`,types:["SharedArrayBuffer"]});if(!o.util.HasFlag(n,o.attributes.AllowResizable)&&o.util.IsResizableArrayBuffer(e))throw o.errors.exception({header:t,message:`${s} cannot be a resizable SharedArrayBuffer.`});return e},o.converters.TypedArray=function(e,t,s,n,A){if(8!==o.util.Type(e)||!r.isTypedArray(e)||e.constructor.name!==t.name)throw o.errors.conversionFailed({prefix:s,argument:`${n} ("${o.util.Stringify(e)}")`,types:[t.name]});if(!o.util.HasFlag(A,o.attributes.AllowShared)&&r.isSharedArrayBuffer(e.buffer))throw o.errors.exception({header:s,message:`${n} cannot be a view on a shared array buffer.`});if(!o.util.HasFlag(A,o.attributes.AllowResizable)&&o.util.IsResizableArrayBuffer(e.buffer))throw o.errors.exception({header:s,message:`${n} cannot be a view on a resizable array buffer.`});return e},o.converters.DataView=function(e,t,s,n){if(8!==o.util.Type(e)||!r.isDataView(e))throw o.errors.conversionFailed({prefix:t,argument:`${s} ("${o.util.Stringify(e)}")`,types:["DataView"]});if(!o.util.HasFlag(n,o.attributes.AllowShared)&&r.isSharedArrayBuffer(e.buffer))throw o.errors.exception({header:t,message:`${s} cannot be a view on a shared array buffer.`});if(!o.util.HasFlag(n,o.attributes.AllowResizable)&&o.util.IsResizableArrayBuffer(e.buffer))throw o.errors.exception({header:t,message:`${s} cannot be a view on a resizable array buffer.`});return e},o.converters.ArrayBufferView=function(e,t,s,n){if(8!==o.util.Type(e)||!r.isArrayBufferView(e))throw o.errors.conversionFailed({prefix:t,argument:`${s} ("${o.util.Stringify(e)}")`,types:["ArrayBufferView"]});if(!o.util.HasFlag(n,o.attributes.AllowShared)&&r.isSharedArrayBuffer(e.buffer))throw o.errors.exception({header:t,message:`${s} cannot be a view on a shared array buffer.`});if(!o.util.HasFlag(n,o.attributes.AllowResizable)&&o.util.IsResizableArrayBuffer(e.buffer))throw o.errors.exception({header:t,message:`${s} cannot be a view on a resizable array buffer.`});return e},o.converters.BufferSource=function(e,t,s,n){if(r.isArrayBuffer(e))return o.converters.ArrayBuffer(e,t,s,n);if(r.isArrayBufferView(e))return n&=~o.attributes.AllowShared,o.converters.ArrayBufferView(e,t,s,n);if(r.isSharedArrayBuffer(e))throw o.errors.exception({header:t,message:`${s} cannot be a SharedArrayBuffer.`});throw o.errors.conversionFailed({prefix:t,argument:`${s} ("${o.util.Stringify(e)}")`,types:["ArrayBuffer","ArrayBufferView"]})},o.converters.AllowSharedBufferSource=function(e,t,s,n){if(r.isArrayBuffer(e))return o.converters.ArrayBuffer(e,t,s,n);if(r.isSharedArrayBuffer(e))return o.converters.SharedArrayBuffer(e,t,s,n);if(r.isArrayBufferView(e))return n|=o.attributes.AllowShared,o.converters.ArrayBufferView(e,t,s,n);throw o.errors.conversionFailed({prefix:t,argument:`${s} ("${o.util.Stringify(e)}")`,types:["ArrayBuffer","SharedArrayBuffer","ArrayBufferView"]})},o.converters["sequence<ByteString>"]=o.sequenceConverter(o.converters.ByteString),o.converters["sequence<sequence<ByteString>>"]=o.sequenceConverter(o.converters["sequence<ByteString>"]),o.converters["record<ByteString, ByteString>"]=o.recordConverter(o.converters.ByteString,o.converters.ByteString),o.converters.Blob=o.interfaceConverter(o.is.Blob,"Blob"),o.converters.AbortSignal=o.interfaceConverter(o.is.AbortSignal,"AbortSignal"),o.converters.EventHandlerNonNull=function(e){return 8!==o.util.Type(e)?null:"function"==typeof e?e:()=>{}},o.attributes={Clamp:1,EnforceRange:2,AllowShared:4,AllowResizable:8,LegacyNullToEmptyString:16},e.exports={webidl:o}},8251:(e,t,s)=>{"use strict";const{uid:r,states:n,sentCloseFrameState:A,emptyBuffer:i,opcodes:o}=s(6490),{parseExtensions:a,isClosed:c,isClosing:l,isEstablished:h,validateCloseCodeAndReason:g}=s(8983),{makeRequest:d}=s(4609),{fetching:u}=s(7388),{Headers:E,getHeadersList:I}=s(6558),{getDecodeSplit:C}=s(6686),{WebsocketFrameSend:B}=s(6834),Q=s(4589);let p;try{p=s(7598)}catch{}function f(e,t,s,r=!1){if(t??=null,s??="",r&&g(t,s),c(e.readyState)||l(e.readyState));else if(h(e.readyState))if(e.closeState.has(A.SENT)||e.closeState.has(A.RECEIVED))e.readyState=n.CLOSING;else{const r=new B;0!==s.length&&null===t&&(t=1e3),Q(null===t||Number.isInteger(t)),null===t&&0===s.length?r.frameData=i:null!==t&&null===s?(r.frameData=Buffer.allocUnsafe(2),r.frameData.writeUInt16BE(t,0)):null!==t&&null!==s?(r.frameData=Buffer.allocUnsafe(2+Buffer.byteLength(s)),r.frameData.writeUInt16BE(t,0),r.frameData.write(s,2,"utf-8")):r.frameData=i,e.socket.write(r.createFrame(o.CLOSE)),e.closeState.add(A.SENT),e.readyState=n.CLOSING}else m(e),e.readyState=n.CLOSING}function m(e,t,s,r){h(e.readyState)&&f(e,t,s,!1),e.controller.abort(),e.socket?!1===e.socket.destroyed&&e.socket.destroy():e.onSocketClose()}e.exports={establishWebSocketConnection:function(e,t,s,A,i){const o=e;o.protocol="ws:"===e.protocol?"http:":"https:";const c=d({urlList:[o],client:s,serviceWorkers:"none",referrer:"no-referrer",mode:"websocket",credentials:"include",cache:"no-store",redirect:"error"});if(i.headers){const e=I(new E(i.headers));c.headersList=e}const l=p.randomBytes(16).toString("base64");c.headersList.append("sec-websocket-key",l,!0),c.headersList.append("sec-websocket-version","13",!0);for(const e of t)c.headersList.append("sec-websocket-protocol",e,!0);return c.headersList.append("sec-websocket-extensions","permessage-deflate; client_max_window_bits",!0),u({request:c,useParallelQueue:!0,dispatcher:i.dispatcher,processResponse(e){if("error"===e.type&&(A.readyState=n.CLOSED),"error"===e.type||101!==e.status)return void m(A,1002,"Received network error or non-101 status code.",e.error);if(0!==t.length&&!e.headersList.get("Sec-WebSocket-Protocol"))return void m(A,1002,"Server did not respond with sent protocols.");if("websocket"!==e.headersList.get("Upgrade")?.toLowerCase())return void m(A,1002,'Server did not set Upgrade header to "websocket".');if("upgrade"!==e.headersList.get("Connection")?.toLowerCase())return void m(A,1002,'Server did not set Connection header to "upgrade".');if(e.headersList.get("Sec-WebSocket-Accept")!==p.createHash("sha1").update(l+r).digest("base64"))return void m(A,1002,"Incorrect hash received in Sec-WebSocket-Accept header.");const s=e.headersList.get("Sec-WebSocket-Extensions");let i;if(null!==s&&(i=a(s),!i.has("permessage-deflate")))return void m(A,1002,"Sec-WebSocket-Extensions header does not match.");const o=e.headersList.get("Sec-WebSocket-Protocol");if(null!==o){if(!C("sec-websocket-protocol",c.headersList).includes(o))return void m(A,1002,"Protocol was not set in the opening handshake.")}e.socket.on("data",A.onSocketData),e.socket.on("close",A.onSocketClose),e.socket.on("error",A.onSocketError),A.wasEverConnected=!0,A.onConnectionEstablished(e,i)}})},failWebsocketConnection:m,closeWebSocketConnection:f}},6490:e=>{"use strict";const t=Buffer.allocUnsafe(0);e.exports={uid:"258EAFA5-E914-47DA-95CA-C5AB0DC85B11",sentCloseFrameState:{SENT:1,RECEIVED:2},staticPropertyDescriptors:{enumerable:!0,writable:!1,configurable:!1},states:{CONNECTING:0,OPEN:1,CLOSING:2,CLOSED:3},opcodes:{CONTINUATION:0,TEXT:1,BINARY:2,CLOSE:8,PING:9,PONG:10},maxUnsigned16Bit:65535,parserStates:{INFO:0,PAYLOADLENGTH_16:2,PAYLOADLENGTH_64:3,READ_DATA:4},emptyBuffer:t,sendHints:{text:1,typedArray:2,arrayBuffer:3,blob:4}}},878:(e,t,s)=>{"use strict";const{webidl:r}=s(6097),{kEnumerableProperty:n}=s(2858),{kConstruct:A}=s(257);class i extends Event{#rt;constructor(e,t={}){if(e===A)return super(arguments[1],arguments[2]),void r.util.markAsUncloneable(this);const s="MessageEvent constructor";r.argumentLengthCheck(arguments,1,s),super(e=r.converters.DOMString(e,s,"type"),t=r.converters.MessageEventInit(t,s,"eventInitDict")),this.#rt=t,r.util.markAsUncloneable(this)}get data(){return r.brandCheck(this,i),this.#rt.data}get origin(){return r.brandCheck(this,i),this.#rt.origin}get lastEventId(){return r.brandCheck(this,i),this.#rt.lastEventId}get source(){return r.brandCheck(this,i),this.#rt.source}get ports(){return r.brandCheck(this,i),Object.isFrozen(this.#rt.ports)||Object.freeze(this.#rt.ports),this.#rt.ports}initMessageEvent(e,t=!1,s=!1,n=null,A="",o="",a=null,c=[]){return r.brandCheck(this,i),r.argumentLengthCheck(arguments,1,"MessageEvent.initMessageEvent"),new i(e,{bubbles:t,cancelable:s,data:n,origin:A,lastEventId:o,source:a,ports:c})}static createFastMessageEvent(e,t){const s=new i(A,e,t);return s.#rt=t,s.#rt.data??=null,s.#rt.origin??="",s.#rt.lastEventId??="",s.#rt.source??=null,s.#rt.ports??=[],s}}const{createFastMessageEvent:o}=i;delete i.createFastMessageEvent;class a extends Event{#rt;constructor(e,t={}){const s="CloseEvent constructor";r.argumentLengthCheck(arguments,1,s),super(e=r.converters.DOMString(e,s,"type"),t=r.converters.CloseEventInit(t)),this.#rt=t,r.util.markAsUncloneable(this)}get wasClean(){return r.brandCheck(this,a),this.#rt.wasClean}get code(){return r.brandCheck(this,a),this.#rt.code}get reason(){return r.brandCheck(this,a),this.#rt.reason}}class c extends Event{#rt;constructor(e,t){const s="ErrorEvent constructor";r.argumentLengthCheck(arguments,1,s),super(e,t),r.util.markAsUncloneable(this),e=r.converters.DOMString(e,s,"type"),t=r.converters.ErrorEventInit(t??{}),this.#rt=t}get message(){return r.brandCheck(this,c),this.#rt.message}get filename(){return r.brandCheck(this,c),this.#rt.filename}get lineno(){return r.brandCheck(this,c),this.#rt.lineno}get colno(){return r.brandCheck(this,c),this.#rt.colno}get error(){return r.brandCheck(this,c),this.#rt.error}}Object.defineProperties(i.prototype,{[Symbol.toStringTag]:{value:"MessageEvent",configurable:!0},data:n,origin:n,lastEventId:n,source:n,ports:n,initMessageEvent:n}),Object.defineProperties(a.prototype,{[Symbol.toStringTag]:{value:"CloseEvent",configurable:!0},reason:n,code:n,wasClean:n}),Object.defineProperties(c.prototype,{[Symbol.toStringTag]:{value:"ErrorEvent",configurable:!0},message:n,filename:n,lineno:n,colno:n,error:n}),r.converters.MessagePort=r.interfaceConverter(r.is.MessagePort,"MessagePort"),r.converters["sequence<MessagePort>"]=r.sequenceConverter(r.converters.MessagePort);const l=[{key:"bubbles",converter:r.converters.boolean,defaultValue:()=>!1},{key:"cancelable",converter:r.converters.boolean,defaultValue:()=>!1},{key:"composed",converter:r.converters.boolean,defaultValue:()=>!1}];r.converters.MessageEventInit=r.dictionaryConverter([...l,{key:"data",converter:r.converters.any,defaultValue:()=>null},{key:"origin",converter:r.converters.USVString,defaultValue:()=>""},{key:"lastEventId",converter:r.converters.DOMString,defaultValue:()=>""},{key:"source",converter:r.nullableConverter(r.converters.MessagePort),defaultValue:()=>null},{key:"ports",converter:r.converters["sequence<MessagePort>"],defaultValue:()=>[]}]),r.converters.CloseEventInit=r.dictionaryConverter([...l,{key:"wasClean",converter:r.converters.boolean,defaultValue:()=>!1},{key:"code",converter:r.converters["unsigned short"],defaultValue:()=>0},{key:"reason",converter:r.converters.USVString,defaultValue:()=>""}]),r.converters.ErrorEventInit=r.dictionaryConverter([...l,{key:"message",converter:r.converters.DOMString,defaultValue:()=>""},{key:"filename",converter:r.converters.USVString,defaultValue:()=>""},{key:"lineno",converter:r.converters["unsigned long"],defaultValue:()=>0},{key:"colno",converter:r.converters["unsigned long"],defaultValue:()=>0},{key:"error",converter:r.converters.any}]),e.exports={MessageEvent:i,CloseEvent:a,ErrorEvent:c,createFastMessageEvent:o}},6834:(e,t,s)=>{"use strict";const{maxUnsigned16Bit:r,opcodes:n}=s(6490),A=8192;let i,o=null,a=A;try{i=s(7598)}catch{i={randomFillSync:function(e,t,s){for(let t=0;t<e.length;++t)e[t]=255*Math.random()|0;return e}}}function c(){return a===A&&(a=0,i.randomFillSync(o??=Buffer.allocUnsafeSlow(A),0,A)),[o[a++],o[a++],o[a++],o[a++]]}e.exports={WebsocketFrameSend:class{constructor(e){this.frameData=e}createFrame(e){const t=this.frameData,s=c(),n=t?.byteLength??0;let A=n,i=6;n>r?(i+=8,A=127):n>125&&(i+=2,A=126);const o=Buffer.allocUnsafe(n+i);o[0]=o[1]=0,o[0]|=128,o[0]=(240&o[0])+e,o[i-4]=s[0],o[i-3]=s[1],o[i-2]=s[2],o[i-1]=s[3],o[1]=A,126===A?o.writeUInt16BE(n,2):127===A&&(o[2]=o[3]=0,o.writeUIntBE(n,4,6)),o[1]|=128;for(let e=0;e<n;++e)o[i+e]=t[e]^s[3&e];return o}static createFastTextFrame(e){const t=c(),s=e.length;for(let r=0;r<s;++r)e[r]^=t[3&r];let A=s,i=6;s>r?(i+=8,A=127):s>125&&(i+=2,A=126);const o=Buffer.allocUnsafeSlow(i);return o[0]=128|n.TEXT,o[1]=128|A,o[i-4]=t[0],o[i-3]=t[1],o[i-2]=t[2],o[i-1]=t[3],126===A?o.writeUInt16BE(s,2):127===A&&(o[2]=o[3]=0,o.writeUIntBE(s,4,6)),[o,e]}},generateMask:c}},8975:(e,t,s)=>{"use strict";const{createInflateRaw:r,Z_DEFAULT_WINDOWBITS:n}=s(8522),{isValidClientWindowBits:A}=s(8983),i=Buffer.from([0,0,255,255]),o=Symbol("kBuffer"),a=Symbol("kLength");e.exports={PerMessageDeflate:class{#nt;#N={};constructor(e){this.#N.serverNoContextTakeover=e.has("server_no_context_takeover"),this.#N.serverMaxWindowBits=e.get("server_max_window_bits")}decompress(e,t,s){if(!this.#nt){let e=n;if(this.#N.serverMaxWindowBits){if(!A(this.#N.serverMaxWindowBits))return void s(new Error("Invalid server_max_window_bits"));e=Number.parseInt(this.#N.serverMaxWindowBits)}this.#nt=r({windowBits:e}),this.#nt[o]=[],this.#nt[a]=0,this.#nt.on("data",(e=>{this.#nt[o].push(e),this.#nt[a]+=e.length})),this.#nt.on("error",(e=>{this.#nt=null,s(e)}))}this.#nt.write(e),t&&this.#nt.write(i),this.#nt.flush((()=>{const e=Buffer.concat(this.#nt[o],this.#nt[a]);this.#nt[o].length=0,this.#nt[a]=0,s(null,e)}))}}}},834:(e,t,s)=>{"use strict";const{Writable:r}=s(7075),n=s(4589),{parserStates:A,opcodes:i,states:o,emptyBuffer:a,sentCloseFrameState:c}=s(6490),{isValidStatusCode:l,isValidOpcode:h,websocketMessageReceived:g,utf8Decode:d,isControlFrame:u,isTextBinaryFrame:E,isContinuationFrame:I}=s(8983),{failWebsocketConnection:C}=s(8251),{WebsocketFrameSend:B}=s(6834),{PerMessageDeflate:Q}=s(8975);e.exports={ByteParser:class extends r{#At=[];#it=0;#ot=0;#at=!1;#le=A.INFO;#ct={};#lt=[];#ht;#U;constructor(e,t){super(),this.#U=e,this.#ht=null==t?new Map:t,this.#ht.has("permessage-deflate")&&this.#ht.set("permessage-deflate",new Q(t))}_write(e,t,s){this.#At.push(e),this.#ot+=e.length,this.#at=!0,this.run(s)}run(e){for(;this.#at;)if(this.#le===A.INFO){if(this.#ot<2)return e();const t=this.consume(2),s=!!(128&t[0]),r=15&t[0],n=!(128&~t[1]),o=!s&&r!==i.CONTINUATION,a=127&t[1],c=64&t[0],l=32&t[0],g=16&t[0];if(!h(r))return C(this.#U,1002,"Invalid opcode received"),e();if(n)return C(this.#U,1002,"Frame cannot be masked"),e();if(0!==c&&!this.#ht.has("permessage-deflate"))return void C(this.#U,1002,"Expected RSV1 to be clear.");if(0!==l||0!==g)return void C(this.#U,1002,"RSV1, RSV2, RSV3 must be clear");if(o&&!E(r))return void C(this.#U,1002,"Invalid frame type was fragmented.");if(E(r)&&this.#lt.length>0)return void C(this.#U,1002,"Expected continuation frame");if(this.#ct.fragmented&&o)return void C(this.#U,1002,"Fragmented frame exceeded 125 bytes.");if((a>125||o)&&u(r))return void C(this.#U,1002,"Control frame either too large or fragmented");if(I(r)&&0===this.#lt.length&&!this.#ct.compressed)return void C(this.#U,1002,"Unexpected continuation frame");a<=125?(this.#ct.payloadLength=a,this.#le=A.READ_DATA):126===a?this.#le=A.PAYLOADLENGTH_16:127===a&&(this.#le=A.PAYLOADLENGTH_64),E(r)&&(this.#ct.binaryType=r,this.#ct.compressed=0!==c),this.#ct.opcode=r,this.#ct.masked=n,this.#ct.fin=s,this.#ct.fragmented=o}else if(this.#le===A.PAYLOADLENGTH_16){if(this.#ot<2)return e();const t=this.consume(2);this.#ct.payloadLength=t.readUInt16BE(0),this.#le=A.READ_DATA}else if(this.#le===A.PAYLOADLENGTH_64){if(this.#ot<8)return e();const t=this.consume(8),s=t.readUInt32BE(0);if(s>2**31-1)return void C(this.#U,1009,"Received payload length > 2^31 bytes.");const r=t.readUInt32BE(4);this.#ct.payloadLength=(s<<8)+r,this.#le=A.READ_DATA}else if(this.#le===A.READ_DATA){if(this.#ot<this.#ct.payloadLength)return e();const t=this.consume(this.#ct.payloadLength);if(u(this.#ct.opcode))this.#at=this.parseControlFrame(t),this.#le=A.INFO;else{if(this.#ct.compressed){this.#ht.get("permessage-deflate").decompress(t,this.#ct.fin,((t,s)=>{if(t)C(this.#U,1007,t.message);else{if(this.writeFragments(s),!this.#ct.fin)return this.#le=A.INFO,this.#at=!0,void this.run(e);g(this.#U,this.#ct.binaryType,this.consumeFragments()),this.#at=!0,this.#le=A.INFO,this.run(e)}})),this.#at=!1;break}this.writeFragments(t),!this.#ct.fragmented&&this.#ct.fin&&g(this.#U,this.#ct.binaryType,this.consumeFragments()),this.#le=A.INFO}}}consume(e){if(e>this.#ot)throw new Error("Called consume() before buffers satiated.");if(0===e)return a;this.#ot-=e;const t=this.#At[0];if(t.length>e)return this.#At[0]=t.subarray(e,t.length),t.subarray(0,e);if(t.length===e)return this.#At.shift();{let t=0;const s=Buffer.allocUnsafeSlow(e);for(;t!==e;){const r=this.#At[0],n=r.length;if(n+t===e){s.set(this.#At.shift(),t);break}if(n+t>e){s.set(r.subarray(0,e-t),t),this.#At[0]=r.subarray(e-t);break}s.set(this.#At.shift(),t),t+=n}return s}}writeFragments(e){this.#it+=e.length,this.#lt.push(e)}consumeFragments(){const e=this.#lt;if(1===e.length)return this.#it=0,e.shift();let t=0;const s=Buffer.allocUnsafeSlow(this.#it);for(let r=0;r<e.length;++r){const n=e[r];s.set(n,t),t+=n.length}return this.#lt=[],this.#it=0,s}parseCloseBody(e){let t;if(n(1!==e.length),e.length>=2&&(t=e.readUInt16BE(0)),void 0!==t&&!l(t))return{code:1002,reason:"Invalid status code",error:!0};let s=e.subarray(2);239===s[0]&&187===s[1]&&191===s[2]&&(s=s.subarray(3));try{s=d(s)}catch{return{code:1007,reason:"Invalid UTF-8",error:!0}}return{code:t,reason:s,error:!1}}parseControlFrame(e){const{opcode:t,payloadLength:s}=this.#ct;if(t===i.CLOSE){if(1===s)return C(this.#U,1002,"Received close frame with a 1-byte body."),!1;if(this.#ct.closeInfo=this.parseCloseBody(e),this.#ct.closeInfo.error){const{code:e,reason:t}=this.#ct.closeInfo;return C(this.#U,e,t),!1}if(!this.#U.closeState.has(c.SENT)&&!this.#U.closeState.has(c.RECEIVED)){let e=a;this.#ct.closeInfo.code&&(e=Buffer.allocUnsafe(2),e.writeUInt16BE(this.#ct.closeInfo.code,0));const t=new B(e);this.#U.socket.write(t.createFrame(i.CLOSE)),this.#U.closeState.add(c.SENT)}return this.#U.readyState=o.CLOSING,this.#U.closeState.add(c.RECEIVED),!1}if(t===i.PING){if(!this.#U.closeState.has(c.RECEIVED)){const t=new B(e);this.#U.socket.write(t.createFrame(i.PONG)),this.#U.onPing(e)}}else t===i.PONG&&this.#U.onPong(e);return!0}get closingInfo(){return this.#ct.closeInfo}}}},2534:(e,t,s)=>{"use strict";const{WebsocketFrameSend:r}=s(6834),{opcodes:n,sendHints:A}=s(6490),i=s(1726);function o(e,t){return new r(function(e,t){switch(t){case A.text:case A.typedArray:return new Uint8Array(e.buffer,e.byteOffset,e.byteLength);case A.arrayBuffer:case A.blob:return new Uint8Array(e)}}(e,t)).createFrame(t===A.text?n.TEXT:n.BINARY)}e.exports={SendQueue:class{#gt=new i;#dt=!1;#ut;constructor(e){this.#ut=e}add(e,t,s){if(s!==A.blob){if(this.#dt){const r={promise:null,callback:t,frame:o(e,s)};this.#gt.push(r)}else if(s===A.text){const{0:s,1:n}=r.createFastTextFrame(e);this.#ut.cork(),this.#ut.write(s),this.#ut.write(n,t),this.#ut.uncork()}else this.#ut.write(o(e,s),t);return}const n={promise:e.arrayBuffer().then((e=>{n.promise=null,n.frame=o(e,s)})),callback:t,frame:null};this.#gt.push(n),this.#dt||this.#Et()}async#Et(){this.#dt=!0;const e=this.#gt;for(;!e.isEmpty();){const t=e.shift();null!==t.promise&&await t.promise,this.#ut.write(t.frame,t.callback),t.callback=t.frame=null}this.#dt=!1}}}},7053:(e,t,s)=>{"use strict";const{webidl:r}=s(6097),{validateCloseCodeAndReason:n}=s(8983),{kConstruct:A}=s(257),{kEnumerableProperty:i}=s(2858);class o extends(function(){class e extends DOMException{get reason(){return""}}return void 0!==(new e).reason?DOMException:new Proxy(DOMException,{construct(e,t,s){const r=Reflect.construct(e,t,e);return Object.setPrototypeOf(r,s.prototype),r}})}()){#It;#W;constructor(e="",t=void 0){if(super(e=r.converters.DOMString(e,"WebSocketError","message"),"WebSocketError"),t===A)return;null!==t&&(t=r.converters.WebSocketCloseInfo(t));let s=t.closeCode??null;const i=t.reason??"";n(s,i),0!==i.length&&null===s&&(s=1e3),this.#It=s,this.#W=i}get closeCode(){return this.#It}get reason(){return this.#W}static createUnvalidatedWebSocketError(e,t,s){const r=new o(e,A);return r.#It=t,r.#W=s,r}}const{createUnvalidatedWebSocketError:a}=o;delete o.createUnvalidatedWebSocketError,Object.defineProperties(o.prototype,{closeCode:i,reason:i,[Symbol.toStringTag]:{value:"WebSocketError",writable:!1,enumerable:!1,configurable:!0}}),r.is.WebSocketError=r.util.MakeTypeAssertion(o),e.exports={WebSocketError:o,createUnvalidatedWebSocketError:a}},27:(e,t,s)=>{"use strict";const{createDeferredPromise:r}=s(9250),{environmentSettingsObject:n}=s(6686),{states:A,opcodes:i,sentCloseFrameState:o}=s(6490),{webidl:a}=s(6097),{getURLRecord:c,isValidSubprotocol:l,isEstablished:h,utf8Decode:g}=s(8983),{establishWebSocketConnection:d,failWebsocketConnection:u,closeWebSocketConnection:E}=s(8251),{channels:I}=s(772),{WebsocketFrameSend:C}=s(6834),{ByteParser:B}=s(834),{WebSocketError:Q,createUnvalidatedWebSocketError:p}=s(7053),{utf8DecodeBytes:f}=s(6686),{kEnumerableProperty:m}=s(2858);let y=!1;class w{#Ge;#Ct;#Bt;#Qt;#pt;#ft;#mt=!1;#U={onConnectionEstablished:(e,t)=>this.#yt(e,t),onMessage:(e,t)=>this.#wt(e,t),onParserError:e=>u(this.#U,null,e.message),onParserDrain:()=>this.#U.socket.resume(),onSocketData:e=>{this.#St.write(e)||this.#U.socket.pause()},onSocketError:e=>{this.#U.readyState=A.CLOSING,I.socketError.hasSubscribers&&I.socketError.publish(e),this.#U.socket.destroy()},onSocketClose:()=>this.#Dt(),onPing:()=>{},onPong:()=>{},readyState:A.CONNECTING,socket:null,closeState:new Set,controller:null,wasEverConnected:!1};#St;constructor(e,t=void 0){y||(process.emitWarning("WebSocketStream is experimental! Expect it to change at any time.",{code:"UNDICI-WSS"}),y=!0),a.argumentLengthCheck(arguments,1,"WebSocket"),e=a.converters.USVString(e),null!==t&&(t=a.converters.WebSocketStreamOptions(t));const s=n.settingsObject.baseUrl,i=c(e,s),o=t.protocols;if(o.length!==new Set(o.map((e=>e.toLowerCase()))).size)throw new DOMException("Invalid Sec-WebSocket-Protocol value","SyntaxError");if(o.length>0&&!o.every((e=>l(e))))throw new DOMException("Invalid Sec-WebSocket-Protocol value","SyntaxError");if(this.#Ge=i.toString(),this.#Ct=r(),this.#Bt=r(),null!=t.signal){const e=t.signal;if(e.aborted)return this.#Ct.reject(e.reason),void this.#Bt.reject(e.reason);e.addEventListener("abort",(()=>{h(this.#U.readyState)||(u(this.#U),this.#U.readyState=A.CLOSING,this.#Ct.reject(e.reason),this.#Bt.reject(e.reason),this.#mt=!0)}),{once:!0})}const g=n.settingsObject;this.#U.controller=d(i,o,g,this.#U,t)}get url(){return this.#Ge.toString()}get opened(){return this.#Ct.promise}get closed(){return this.#Bt.promise}close(e=void 0){null!==e&&(e=a.converters.WebSocketCloseInfo(e));const t=e.closeCode??null,s=e.reason;E(this.#U,t,s,!0)}#bt(e){e=a.converters.WebSocketStreamWrite(e);const t=r();let s=null,n=null;if(a.is.BufferSource(e))s=new Uint8Array(ArrayBuffer.isView(e)?new Uint8Array(e.buffer,e.byteOffset,e.byteLength):e.slice()),n=i.BINARY;else{let r;try{r=a.converters.DOMString(e)}catch(e){return t.reject(e),t.promise}s=(new TextEncoder).encode(r),n=i.TEXT}if(!this.#U.closeState.has(o.SENT)&&!this.#U.closeState.has(o.RECEIVED)){const e=new C(s);this.#U.socket.write(e.createFrame(n),(()=>{t.resolve(void 0)}))}return t.promise}#yt(e,t){this.#U.socket=e.socket;const s=new B(this.#U,t);s.on("drain",(()=>this.#U.onParserDrain())),s.on("error",(e=>this.#U.onParserError(e))),this.#St=s,this.#U.readyState=A.OPEN;const r=t??"",n=e.headersList.get("sec-websocket-protocol")??"",i=new ReadableStream({start:e=>{this.#pt=e},pull(t){let s;for(;t.desiredSize>0&&null!==(s=e.socket.read());)t.enqueue(s)},cancel:e=>this.#vt(e)}),o=new WritableStream({write:e=>this.#bt(e),close:()=>E(this.#U,null,null),abort:e=>this.#Rt(e)});this.#Qt=i,this.#ft=o,this.#Ct.resolve({extensions:r,protocol:n,readable:i,writable:o})}#wt(e,t){if(this.#U.readyState!==A.OPEN)return;let s;if(e===i.TEXT)try{s=g(t)}catch{return void u(this.#U,"Received invalid UTF-8 in text frame.")}else e===i.BINARY&&(s=new Uint8Array(t.buffer,t.byteOffset,t.byteLength));this.#pt.enqueue(s)}#Dt(){const e=this.#U.closeState.has(o.SENT)&&this.#U.closeState.has(o.RECEIVED);if(this.#U.readyState=A.CLOSED,this.#mt)return;this.#U.wasEverConnected||this.#Ct.reject(new Q("Socket never opened"));const t=this.#St.closingInfo;let s=t?.code??1005;this.#U.closeState.has(o.SENT)||this.#U.closeState.has(o.RECEIVED)||(s=1006);const r=null==t?.reason?"":f(Buffer.from(t.reason));if(e)this.#pt.close(),this.#ft.locked||this.#ft.abort(new DOMException("A closed WebSocketStream cannot be written to","InvalidStateError")),this.#Bt.resolve({closeCode:s,reason:r});else{const e=p("unclean close",s,r);this.#pt.error(e),this.#ft.abort(e),this.#Bt.reject(e)}}#Rt(e){let t=null,s="";a.is.WebSocketError(e)&&(t=e.closeCode,s=e.reason),E(this.#U,t,s)}#vt(e){this.#Rt(e)}}Object.defineProperties(w.prototype,{url:m,opened:m,closed:m,close:m,[Symbol.toStringTag]:{value:"WebSocketStream",writable:!1,enumerable:!1,configurable:!0}}),a.converters.WebSocketStreamOptions=a.dictionaryConverter([{key:"protocols",converter:a.sequenceConverter(a.converters.USVString),defaultValue:()=>[]},{key:"signal",converter:a.nullableConverter(a.converters.AbortSignal),defaultValue:()=>null}]),a.converters.WebSocketCloseInfo=a.dictionaryConverter([{key:"closeCode",converter:e=>a.converters["unsigned short"](e,a.attributes.EnforceRange)},{key:"reason",converter:a.converters.USVString,defaultValue:()=>""}]),a.converters.WebSocketStreamWrite=function(e){return"string"==typeof e?a.converters.USVString(e):a.converters.BufferSource(e)},e.exports={WebSocketStream:w}},8983:(e,t,s)=>{"use strict";const{states:r,opcodes:n}=s(6490),{isUtf8:A}=s(4573),{collectASequenceOfCodePointsFast:i,removeHTTPWhitespace:o}=s(9934);function a(e){return e===n.CLOSE||e===n.PING||e===n.PONG}function c(e){return e===n.CONTINUATION}function l(e){return e===n.TEXT||e===n.BINARY}const h=(()=>{if("string"==typeof process.versions.icu){const e=new TextDecoder("utf-8",{fatal:!0});return e.decode.bind(e)}return function(e){if(A(e))return e.toString("utf-8");throw new TypeError("Invalid utf-8 received.")}})();e.exports={isConnecting:function(e){return e===r.CONNECTING},isEstablished:function(e){return e===r.OPEN},isClosing:function(e){return e===r.CLOSING},isClosed:function(e){return e===r.CLOSED},fireEvent:function(e,t,s=(e,t)=>new Event(e,t),r={}){const n=s(e,r);t.dispatchEvent(n)},isValidSubprotocol:function(e){if(0===e.length)return!1;for(let t=0;t<e.length;++t){const s=e.charCodeAt(t);if(s<33||s>126||34===s||40===s||41===s||44===s||47===s||58===s||59===s||60===s||61===s||62===s||63===s||64===s||91===s||92===s||93===s||123===s||125===s)return!1}return!0},isValidStatusCode:function(e){return e>=1e3&&e<1015?1004!==e&&1005!==e&&1006!==e:e>=3e3&&e<=4999},websocketMessageReceived:function(e,t,s){e.onMessage(t,s)},utf8Decode:h,isControlFrame:a,isContinuationFrame:c,isTextBinaryFrame:l,isValidOpcode:function(e){return l(e)||c(e)||a(e)},parseExtensions:function(e){const t={position:0},s=new Map;for(;t.position<e.length;){const r=i(";",e,t),[n,A=""]=r.split("=",2);s.set(o(n,!0,!1),o(A,!1,!0)),t.position++}return s},isValidClientWindowBits:function(e){for(let t=0;t<e.length;t++){const s=e.charCodeAt(t);if(s<48||s>57)return!1}return!0},toArrayBuffer:function(e){return e.byteLength===e.buffer.byteLength?e.buffer:new Uint8Array(e).buffer},getURLRecord:function(e,t){let s;try{s=new URL(e,t)}catch(e){throw new DOMException(e,"SyntaxError")}if("http:"===s.protocol?s.protocol="ws:":"https:"===s.protocol&&(s.protocol="wss:"),"ws:"!==s.protocol&&"wss:"!==s.protocol)throw new DOMException("expected a ws: or wss: url","SyntaxError");if(s.hash.length||s.href.endsWith("#"))throw new DOMException("hash","SyntaxError");return s},validateCloseCodeAndReason:function(e,t){if(null!==e&&1e3!==e&&(e<3e3||e>4999))throw new DOMException("invalid code","InvalidAccessError");if(null!==t){const e=Buffer.byteLength(t);if(e>123)throw new DOMException(`Reason must be less than 123 bytes; received ${e}`,"SyntaxError")}}}},2984:(e,t,s)=>{"use strict";const{isArrayBuffer:r}=s(3429),{webidl:n}=s(6097),{URLSerializer:A}=s(9934),{environmentSettingsObject:i}=s(6686),{staticPropertyDescriptors:o,states:a,sentCloseFrameState:c,sendHints:l,opcodes:h}=s(6490),{isConnecting:g,isEstablished:d,isClosing:u,isClosed:E,isValidSubprotocol:I,fireEvent:C,utf8Decode:B,toArrayBuffer:Q,getURLRecord:p}=s(8983),{establishWebSocketConnection:f,closeWebSocketConnection:m,failWebsocketConnection:y}=s(8251),{ByteParser:w}=s(834),{kEnumerableProperty:S}=s(2858),{getGlobalDispatcher:D}=s(9879),{ErrorEvent:b,CloseEvent:v,createFastMessageEvent:R}=s(878),{SendQueue:N}=s(2534),{WebsocketFrameSend:k}=s(6834),{channels:T}=s(772);class F extends EventTarget{#Oe={open:null,error:null,close:null,message:null};#Nt=0;#kt="";#ht="";#Tt;#U={onConnectionEstablished:(e,t)=>this.#yt(e,t),onMessage:(e,t)=>this.#wt(e,t),onParserError:e=>y(this.#U,null,e.message),onParserDrain:()=>this.#Ft(),onSocketData:e=>{this.#St.write(e)||this.#U.socket.pause()},onSocketError:e=>{this.#U.readyState=a.CLOSING,T.socketError.hasSubscribers&&T.socketError.publish(e),this.#U.socket.destroy()},onSocketClose:()=>this.#Dt(),onPing:e=>{T.ping.hasSubscribers&&T.ping.publish({payload:e,websocket:this})},onPong:e=>{T.pong.hasSubscribers&&T.pong.publish({payload:e,websocket:this})},readyState:a.CONNECTING,socket:null,closeState:new Set,controller:null,wasEverConnected:!1};#Ge;#Mt;#St;constructor(e,t=[]){super(),n.util.markAsUncloneable(this);const s="WebSocket constructor";n.argumentLengthCheck(arguments,1,s);const r=n.converters["DOMString or sequence<DOMString> or WebSocketInit"](t,s,"options");e=n.converters.USVString(e),t=r.protocols;const A=i.settingsObject.baseUrl,o=p(e,A);if("string"==typeof t&&(t=[t]),t.length!==new Set(t.map((e=>e.toLowerCase()))).size)throw new DOMException("Invalid Sec-WebSocket-Protocol value","SyntaxError");if(t.length>0&&!t.every((e=>I(e))))throw new DOMException("Invalid Sec-WebSocket-Protocol value","SyntaxError");this.#Ge=new URL(o.href);const a=i.settingsObject;this.#U.controller=f(o,t,a,this.#U,r),this.#U.readyState=F.CONNECTING,this.#Mt="blob"}close(e=void 0,t=void 0){n.brandCheck(this,F);void 0!==e&&(e=n.converters["unsigned short"](e,"WebSocket.close","code",n.attributes.Clamp)),void 0!==t&&(t=n.converters.USVString(t)),e??=null,t??="",m(this.#U,e,t,!0)}send(e){n.brandCheck(this,F);const t="WebSocket.send";if(n.argumentLengthCheck(arguments,1,t),e=n.converters.WebSocketSendData(e,t,"data"),g(this.#U.readyState))throw new DOMException("Sent before connected.","InvalidStateError");if(d(this.#U.readyState)&&!u(this.#U.readyState))if("string"==typeof e){const t=Buffer.from(e);this.#Nt+=t.byteLength,this.#Tt.add(t,(()=>{this.#Nt-=t.byteLength}),l.text)}else r(e)?(this.#Nt+=e.byteLength,this.#Tt.add(e,(()=>{this.#Nt-=e.byteLength}),l.arrayBuffer)):ArrayBuffer.isView(e)?(this.#Nt+=e.byteLength,this.#Tt.add(e,(()=>{this.#Nt-=e.byteLength}),l.typedArray)):n.is.Blob(e)&&(this.#Nt+=e.size,this.#Tt.add(e,(()=>{this.#Nt-=e.size}),l.blob))}get readyState(){return n.brandCheck(this,F),this.#U.readyState}get bufferedAmount(){return n.brandCheck(this,F),this.#Nt}get url(){return n.brandCheck(this,F),A(this.#Ge)}get extensions(){return n.brandCheck(this,F),this.#ht}get protocol(){return n.brandCheck(this,F),this.#kt}get onopen(){return n.brandCheck(this,F),this.#Oe.open}set onopen(e){n.brandCheck(this,F),this.#Oe.open&&this.removeEventListener("open",this.#Oe.open);const t=n.converters.EventHandlerNonNull(e);null!==t?(this.addEventListener("open",t),this.#Oe.open=e):this.#Oe.open=null}get onerror(){return n.brandCheck(this,F),this.#Oe.error}set onerror(e){n.brandCheck(this,F),this.#Oe.error&&this.removeEventListener("error",this.#Oe.error);const t=n.converters.EventHandlerNonNull(e);null!==t?(this.addEventListener("error",t),this.#Oe.error=e):this.#Oe.error=null}get onclose(){return n.brandCheck(this,F),this.#Oe.close}set onclose(e){n.brandCheck(this,F),this.#Oe.close&&this.removeEventListener("close",this.#Oe.close);const t=n.converters.EventHandlerNonNull(e);null!==t?(this.addEventListener("close",t),this.#Oe.close=e):this.#Oe.close=null}get onmessage(){return n.brandCheck(this,F),this.#Oe.message}set onmessage(e){n.brandCheck(this,F),this.#Oe.message&&this.removeEventListener("message",this.#Oe.message);const t=n.converters.EventHandlerNonNull(e);null!==t?(this.addEventListener("message",t),this.#Oe.message=e):this.#Oe.message=null}get binaryType(){return n.brandCheck(this,F),this.#Mt}set binaryType(e){n.brandCheck(this,F),this.#Mt="blob"!==e&&"arraybuffer"!==e?"blob":e}#yt(e,t){this.#U.socket=e.socket;const s=new w(this.#U,t);s.on("drain",(()=>this.#U.onParserDrain())),s.on("error",(e=>this.#U.onParserError(e))),this.#St=s,this.#Tt=new N(e.socket),this.#U.readyState=a.OPEN;const r=e.headersList.get("sec-websocket-extensions");null!==r&&(this.#ht=r);const n=e.headersList.get("sec-websocket-protocol");if(null!==n&&(this.#kt=n),C("open",this),T.open.hasSubscribers){const t=e.headersList.entries;T.open.publish({address:e.socket.address(),protocol:this.#kt,extensions:this.#ht,websocket:this,handshakeResponse:{status:e.status,statusText:e.statusText,headers:t}})}}#wt(e,t){if(this.#U.readyState!==a.OPEN)return;let s;if(e===h.TEXT)try{s=B(t)}catch{return void y(this.#U,1007,"Received invalid UTF-8 in text frame.")}else e===h.BINARY&&(s="blob"===this.#Mt?new Blob([t]):Q(t));C("message",this,R,{origin:this.#Ge.origin,data:s})}#Ft(){this.#U.socket.resume()}#Dt(){const e=this.#U.closeState.has(c.SENT)&&this.#U.closeState.has(c.RECEIVED);let t=1005,s="";const r=this.#St?.closingInfo;r&&!r.error&&(t=r.code??1005,s=r.reason),this.#U.readyState=a.CLOSED,this.#U.closeState.has(c.RECEIVED)||(t=1006,C("error",this,((e,t)=>new b(e,t)),{error:new TypeError(s)})),C("close",this,((e,t)=>new v(e,t)),{wasClean:e,code:t,reason:s}),T.close.hasSubscribers&&T.close.publish({websocket:this,code:t,reason:s})}static ping(e,t){if(Buffer.isBuffer(t)){if(t.length>125)throw new TypeError("A PING frame cannot have a body larger than 125 bytes.")}else if(void 0!==t)throw new TypeError("Expected buffer payload");const s=e.#U.readyState;if(d(s)&&!u(s)&&!E(s)){const s=new k(t);e.#U.socket.write(s.createFrame(h.PING))}}}const{ping:M}=F;Reflect.deleteProperty(F,"ping"),F.CONNECTING=F.prototype.CONNECTING=a.CONNECTING,F.OPEN=F.prototype.OPEN=a.OPEN,F.CLOSING=F.prototype.CLOSING=a.CLOSING,F.CLOSED=F.prototype.CLOSED=a.CLOSED,Object.defineProperties(F.prototype,{CONNECTING:o,OPEN:o,CLOSING:o,CLOSED:o,url:S,readyState:S,bufferedAmount:S,onopen:S,onerror:S,onclose:S,close:S,onmessage:S,binaryType:S,send:S,extensions:S,protocol:S,[Symbol.toStringTag]:{value:"WebSocket",writable:!1,enumerable:!1,configurable:!0}}),Object.defineProperties(F,{CONNECTING:o,OPEN:o,CLOSING:o,CLOSED:o}),n.converters["sequence<DOMString>"]=n.sequenceConverter(n.converters.DOMString),n.converters["DOMString or sequence<DOMString>"]=function(e,t,s){return n.util.Type(e)===n.util.Types.OBJECT&&Symbol.iterator in e?n.converters["sequence<DOMString>"](e):n.converters.DOMString(e,t,s)},n.converters.WebSocketInit=n.dictionaryConverter([{key:"protocols",converter:n.converters["DOMString or sequence<DOMString>"],defaultValue:()=>[]},{key:"dispatcher",converter:n.converters.any,defaultValue:()=>D()},{key:"headers",converter:n.nullableConverter(n.converters.HeadersInit)}]),n.converters["DOMString or sequence<DOMString> or WebSocketInit"]=function(e){return n.util.Type(e)!==n.util.Types.OBJECT||Symbol.iterator in e?{protocols:n.converters["DOMString or sequence<DOMString>"](e)}:n.converters.WebSocketInit(e)},n.converters.WebSocketSendData=function(e){if(n.util.Type(e)===n.util.Types.OBJECT){if(n.is.Blob(e))return e;if(n.is.BufferSource(e))return e}return n.converters.USVString(e)},e.exports={WebSocket:F,ping:M}},6822:(e,t,s)=>{var r=s(9896),n=s(2203).Transform,A=s(2203).PassThrough,i=s(3106),o=s(9023),a=s(4434).EventEmitter,c=s(4434).errorMonitor,l=s(5537);function h(){this.outputStream=new A,this.entries=[],this.outputStreamCursor=0,this.ended=!1,this.allDone=!1,this.forceZip64Eocd=!1,this.errored=!1,this.on(c,(function(){this.errored=!0}))}t.u=h,o.inherits(h,a),h.prototype.addFile=function(e,t,s){var n=this;if(t=p(t,!1),null==s&&(s={}),!I(n)){var A=new m(t,!1,s);n.entries.push(A),r.stat(e,(function(t,i){return t?n.emit("error",t):i.isFile()?(A.uncompressedSize=i.size,null==s.mtime&&A.setLastModDate(i.mtime),null==s.mode&&A.setFileAttributesMode(i.mode),A.setFileDataPumpFunction((function(){var t=r.createReadStream(e);A.state=m.FILE_DATA_IN_PROGRESS,t.on("error",(function(e){n.emit("error",e)})),u(n,A,t)})),void E(n)):n.emit("error",new Error("not a file: "+e))}))}},h.prototype.addReadStream=function(e,t,s){this.addReadStreamLazy(t,s,(function(t){t(null,e)}))},h.prototype.addReadStreamLazy=function(e,t,s){var r=this;if("function"==typeof t&&(s=t,t=null),null==t&&(t={}),e=p(e,!1),!I(r)){var n=new m(e,!1,t);r.entries.push(n),n.setFileDataPumpFunction((function(){n.state=m.FILE_DATA_IN_PROGRESS,s((function(e,t){if(e)return r.emit("error",e);u(r,n,t)}))})),E(r)}},h.prototype.addBuffer=function(e,t,s){var r=this;if(t=p(t,!1),e.length>1073741823)throw new Error("buffer too large: "+e.length+" > 1073741823");if(null==s&&(s={}),null!=s.size)throw new Error("options.size not allowed");if(!I(r)){var n=new m(t,!1,s);n.uncompressedSize=e.length,n.crc32=l.unsigned(e),n.crcAndFileSizeKnown=!0,r.entries.push(n),0===n.compressionLevel?A(e):i.deflateRaw(e,{level:n.compressionLevel},(function(e,t){A(t)}))}function A(e){n.compressedSize=e.length,n.setFileDataPumpFunction((function(){d(r,e),d(r,n.getDataDescriptor()),n.state=m.FILE_DATA_DONE,setImmediate((function(){E(r)}))})),E(r)}},h.prototype.addEmptyDirectory=function(e,t){var s=this;if(e=p(e,!0),null==t&&(t={}),null!=t.size)throw new Error("options.size not allowed");if(null!=t.compress)throw new Error("options.compress not allowed");if(null!=t.compressionLevel)throw new Error("options.compressionLevel not allowed");if(!I(s)){var r=new m(e,!0,t);s.entries.push(r),r.setFileDataPumpFunction((function(){d(s,r.getDataDescriptor()),r.state=m.FILE_DATA_DONE,E(s)})),E(s)}};var g=Y([80,75,5,6]);function d(e,t){e.outputStream.write(t),e.outputStreamCursor+=t.length}function u(e,t,s){var r=new L,n=new U,o=0!==t.compressionLevel?new i.DeflateRaw({level:t.compressionLevel}):new A,a=new U;s.pipe(r).pipe(n).pipe(o).pipe(a).pipe(e.outputStream,{end:!1}),a.on("end",(function(){if(t.crc32=r.crc32,null==t.uncompressedSize)t.uncompressedSize=n.byteCount;else if(t.uncompressedSize!==n.byteCount)return e.emit("error",new Error("file data stream has unexpected number of bytes"));t.compressedSize=a.byteCount,e.outputStreamCursor+=t.compressedSize,d(e,t.getDataDescriptor()),t.state=m.FILE_DATA_DONE,E(e)}))}function E(e){if(!e.allDone&&!e.errored){if(e.ended&&null!=e.calculatedTotalSizeCallback){var t=function(e){for(var t=0,s=0,r=0;r<e.entries.length;r++){var n=e.entries[r];if(0!==n.compressionLevel)return-1;if(n.state>=m.READY_TO_PUMP_FILE_DATA){if(null==n.uncompressedSize)return-1}else if(null==n.uncompressedSize)return null;n.relativeOffsetOfLocalHeader=t;var A=n.useZip64Format();t+=y+n.utf8FileName.length,t+=n.uncompressedSize,n.crcAndFileSizeKnown||(t+=A?b:D),s+=v+n.utf8FileName.length+n.fileComment.length,n.forceDosTimestamp||(s+=R),A&&(s+=N)}var i=0;(e.forceZip64Eocd||e.entries.length>=65535||s>=65535||t>=4294967295)&&(i+=C+B);return i+=Q+e.comment.length,t+s+i}(e);null!=t&&(e.calculatedTotalSizeCallback(t),e.calculatedTotalSizeCallback=null)}var s=function(){for(var t=0;t<e.entries.length;t++){var s=e.entries[t];if(s.state<m.FILE_DATA_DONE)return s}return null}();if(null!=s){if(s.state<m.READY_TO_PUMP_FILE_DATA)return;if(s.state===m.FILE_DATA_IN_PROGRESS)return;s.relativeOffsetOfLocalHeader=e.outputStreamCursor;var r=s.getLocalFileHeader();d(e,r),s.doFileDataPump()}else e.ended&&(e.offsetOfStartOfCentralDirectory=e.outputStreamCursor,e.entries.forEach((function(t){var s=t.getCentralDirectoryRecord();d(e,s)})),d(e,function(e,t){var s=!1,r=e.entries.length;(e.forceZip64Eocd||e.entries.length>=65535)&&(r=65535,s=!0);var n=e.outputStreamCursor-e.offsetOfStartOfCentralDirectory,A=n;(e.forceZip64Eocd||n>=4294967295)&&(A=4294967295,s=!0);var i=e.offsetOfStartOfCentralDirectory;(e.forceZip64Eocd||e.offsetOfStartOfCentralDirectory>=4294967295)&&(i=4294967295,s=!0);if(t)return s?C+B+Q:Q;var o=x(Q+e.comment.length);if(o.writeUInt32LE(101010256,0),o.writeUInt16LE(0,4),o.writeUInt16LE(0,6),o.writeUInt16LE(r,8),o.writeUInt16LE(r,10),o.writeUInt32LE(A,12),o.writeUInt32LE(i,16),o.writeUInt16LE(e.comment.length,20),e.comment.copy(o,22),!s)return o;var a=x(C);a.writeUInt32LE(101075792,0),M(a,C-12,4),a.writeUInt16LE(S,12),a.writeUInt16LE(w,14),a.writeUInt32LE(0,16),a.writeUInt32LE(0,20),M(a,e.entries.length,24),M(a,e.entries.length,32),M(a,n,40),M(a,e.offsetOfStartOfCentralDirectory,48);var c=x(B);return c.writeUInt32LE(117853008,0),c.writeUInt32LE(0,4),M(c,e.outputStreamCursor,8),c.writeUInt32LE(1,16),Buffer.concat([a,c,o])}(e)),e.outputStream.end(),e.allDone=!0)}}function I(e){if(e.ended)throw new Error("cannot add entries after calling end()");return!!e.errored}h.prototype.end=function(e,t){if("function"==typeof e&&(t=e,e=null),null==e&&(e={}),!this.ended&&(this.ended=!0,!this.errored)){if(this.calculatedTotalSizeCallback=t,this.forceZip64Eocd=!!e.forceZip64Format,e.comment){if("string"==typeof e.comment?this.comment=function(e){if(/^[\x20-\x7e]*$/.test(e))return Y(e,"utf-8");if(null==P){P={};for(var t=0;t<H.length;t++)P[H[t]]=t}var s=x(e.length);for(t=0;t<e.length;t++){var r=P[e[t]];if(null==r)throw new Error("character not encodable in CP437: "+JSON.stringify(e[t]));s[t]=r}return s}(e.comment):this.comment=e.comment,this.comment.length>65535)throw new Error("comment is too large");if(V(this.comment,g))throw new Error("comment contains end of central directory record signature")}else this.comment=f;E(this)}};var C=56,B=20,Q=22;function p(e,t){if(""===e)throw new Error("empty metadataPath");if(e=e.replace(/\\/g,"/"),/^[a-zA-Z]:/.test(e)||/^\//.test(e))throw new Error("absolute path: "+e);if(-1!==e.split("/").indexOf(".."))throw new Error("invalid relative path: "+e);var s=/\/$/.test(e);if(t)s||(e+="/");else if(s)throw new Error("file path cannot end with '/': "+e);return e}var f=x(0);function m(e,t,s){if(this.utf8FileName=Y(e),this.utf8FileName.length>65535)throw new Error("utf8 file name too long. "+utf8FileName.length+" > 65535");if(this.isDirectory=t,this.state=m.WAITING_FOR_METADATA,this.setLastModDate(null!=s.mtime?s.mtime:new Date),this.forceDosTimestamp=!!s.forceDosTimestamp,null!=s.mode?this.setFileAttributesMode(s.mode):this.setFileAttributesMode(t?16893:33204),t?(this.crcAndFileSizeKnown=!0,this.crc32=0,this.uncompressedSize=0,this.compressedSize=0):(this.crcAndFileSizeKnown=!1,this.crc32=null,this.uncompressedSize=null,this.compressedSize=null,null!=s.size&&(this.uncompressedSize=s.size)),this.compressionLevel=t?0:function(e){if(null!=e.compress&&null!=e.compressionLevel&&!!e.compress!=!!e.compressionLevel)throw new Error("conflicting settings for compress and compressionLevel");return null!=e.compressionLevel?e.compressionLevel:!1===e.compress?0:6}(s),this.forceZip64Format=!!s.forceZip64Format,s.fileComment){if("string"==typeof s.fileComment?this.fileComment=Y(s.fileComment,"utf-8"):this.fileComment=s.fileComment,this.fileComment.length>65535)throw new Error("fileComment is too large")}else this.fileComment=f}m.WAITING_FOR_METADATA=0,m.READY_TO_PUMP_FILE_DATA=1,m.FILE_DATA_IN_PROGRESS=2,m.FILE_DATA_DONE=3,m.prototype.setLastModDate=function(e){this.mtime=e;var t=F(e);this.lastModFileTime=t.time,this.lastModFileDate=t.date},m.prototype.setFileAttributesMode=function(e){if((65535&e)!==e)throw new Error("invalid mode. expected: 0 <= "+e+" <= 65535");this.externalFileAttributes=e<<16>>>0},m.prototype.setFileDataPumpFunction=function(e){this.doFileDataPump=e,this.state=m.READY_TO_PUMP_FILE_DATA},m.prototype.useZip64Format=function(){return this.forceZip64Format||null!=this.uncompressedSize&&this.uncompressedSize>4294967294||null!=this.compressedSize&&this.compressedSize>4294967294||null!=this.relativeOffsetOfLocalHeader&&this.relativeOffsetOfLocalHeader>4294967294};var y=30,w=45,S=831;m.prototype.getLocalFileHeader=function(){var e=0,t=0,s=0;this.crcAndFileSizeKnown&&(e=this.crc32,t=this.compressedSize,s=this.uncompressedSize);var r=x(y),n=2048;return this.crcAndFileSizeKnown||(n|=8),r.writeUInt32LE(67324752,0),r.writeUInt16LE(20,4),r.writeUInt16LE(n,6),r.writeUInt16LE(this.getCompressionMethod(),8),r.writeUInt16LE(this.lastModFileTime,10),r.writeUInt16LE(this.lastModFileDate,12),r.writeUInt32LE(e,14),r.writeUInt32LE(t,18),r.writeUInt32LE(s,22),r.writeUInt16LE(this.utf8FileName.length,26),r.writeUInt16LE(0,28),Buffer.concat([r,this.utf8FileName])};var D=16,b=24;m.prototype.getDataDescriptor=function(){return this.crcAndFileSizeKnown?f:this.useZip64Format()?((e=x(b)).writeUInt32LE(134695760,0),e.writeUInt32LE(this.crc32,4),M(e,this.compressedSize,8),M(e,this.uncompressedSize,16),e):((e=x(D)).writeUInt32LE(134695760,0),e.writeUInt32LE(this.crc32,4),e.writeUInt32LE(this.compressedSize,8),e.writeUInt32LE(this.uncompressedSize,12),e);var e};var v=46,R=9,N=28;m.prototype.getCentralDirectoryRecord=function(){var e=x(v),t=2048;this.crcAndFileSizeKnown||(t|=8);var s=f;if(!this.forceDosTimestamp){(s=x(R)).writeUInt16LE(21589,0),s.writeUInt16LE(R-4,2);s.writeUInt8(3,4);var r=Math.floor(this.mtime.getTime()/1e3);r<-2147483648&&(r=-2147483648),r>2147483647&&(r=2147483647),s.writeUInt32LE(r,5)}var n=this.compressedSize,A=this.uncompressedSize,i=this.relativeOffsetOfLocalHeader,o=20,a=f;return this.useZip64Format()&&(n=4294967295,A=4294967295,i=4294967295,o=w,(a=x(N)).writeUInt16LE(1,0),a.writeUInt16LE(N-4,2),M(a,this.uncompressedSize,4),M(a,this.compressedSize,12),M(a,this.relativeOffsetOfLocalHeader,20)),e.writeUInt32LE(33639248,0),e.writeUInt16LE(S,4),e.writeUInt16LE(o,6),e.writeUInt16LE(t,8),e.writeUInt16LE(this.getCompressionMethod(),10),e.writeUInt16LE(this.lastModFileTime,12),e.writeUInt16LE(this.lastModFileDate,14),e.writeUInt32LE(this.crc32,16),e.writeUInt32LE(n,20),e.writeUInt32LE(A,24),e.writeUInt16LE(this.utf8FileName.length,28),e.writeUInt16LE(s.length+a.length,30),e.writeUInt16LE(this.fileComment.length,32),e.writeUInt16LE(0,34),e.writeUInt16LE(0,36),e.writeUInt32LE(this.externalFileAttributes,38),e.writeUInt32LE(i,42),Buffer.concat([e,this.utf8FileName,s,a,this.fileComment])},m.prototype.getCompressionMethod=function(){return 0===this.compressionLevel?0:8};var k=new Date(1980,0,1),T=new Date(2107,11,31,23,59,58);function F(e){e<k?e=k:e>T&&(e=T);var t=0;t|=31&e.getDate(),t|=(e.getMonth()+1&15)<<5,t|=(e.getFullYear()-1980&127)<<9;var s=0;return s|=Math.floor(e.getSeconds()/2),s|=(63&e.getMinutes())<<5,{date:t,time:s|=(31&e.getHours())<<11}}function M(e,t,s){var r=Math.floor(t/4294967296),n=t%4294967296;e.writeUInt32LE(n,s),e.writeUInt32LE(r,s+4)}function U(e){n.call(this,e),this.byteCount=0}function L(e){n.call(this,e),this.crc32=0}o.inherits(U,n),U.prototype._transform=function(e,t,s){this.byteCount+=e.length,s(null,e)},o.inherits(L,n),L.prototype._transform=function(e,t,s){this.crc32=l.unsigned(e,this.crc32),s(null,e)};var H="\0☺☻♥♦♣♠•◘○◙♂♀♪♫☼►◄↕‼¶§▬↨↑↓→←∟↔▲▼ !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~⌂ÇüéâäàåçêëèïîìÄÅÉæÆôöòûùÿÖÜ¢£¥₧ƒáíóúñѪº¿⌐¬½¼¡«»░▒▓│┤╡╢╖╕╣║╗╝╜╛┐└┴┬├─┼╞╟╚╔╩╦╠═╬╧╨╤╥╙╘╒╓╫╪┘┌█▄▌▐▀αßΓπΣσµτΦΘΩδ∞φε∩≡±≥≤⌠⌡÷≈°∙·√ⁿ²■ ";if(256!==H.length)throw new Error("assertion failure");var P=null;function x(e){x=function(e){return Buffer.allocUnsafe(e)};try{return x(e)}catch(t){return x=function(e){return new Buffer(e)},x(e)}}function Y(e,t){Y=function(e,t){return Buffer.from(e,t)};try{return Y(e,t)}catch(s){return Y=function(e,t){return new Buffer(e,t)},Y(e,t)}}function V(e,t){V=function(e,t){return e.includes(t)};try{return V(e,t)}catch(s){return V=function(e,t){for(var s=0;s<=e.length-t.length;s++)for(var r=0;;r++){if(r===t.length)return!0;if(e[s+r]!==t[r])break}return!1},V(e,t)}}},7562:function(e,t,s){"use strict";var r=this&&this.__createBinding||(Object.create?function(e,t,s,r){void 0===r&&(r=s);var n=Object.getOwnPropertyDescriptor(t,s);n&&!("get"in n?!t.__esModule:n.writable||n.configurable)||(n={enumerable:!0,get:function(){return t[s]}}),Object.defineProperty(e,r,n)}:function(e,t,s,r){void 0===r&&(r=s),e[r]=t[s]}),n=this&&this.__exportStar||function(e,t){for(var s in e)"default"===s||Object.prototype.hasOwnProperty.call(t,s)||r(t,e,s)};Object.defineProperty(t,"__esModule",{value:!0}),t.sdk=t.MixinDeviceBase=t.ScryptedDeviceBase=void 0,n(s(4192),t);const A=s(4192);s(3339);class i extends A.DeviceBase{constructor(e){super(),this.nativeId=e}get storage(){return this._storage||(this._storage=t.sdk.deviceManager.getDeviceStorage(this.nativeId)),this._storage}get log(){return this._log||(this._log=t.sdk.deviceManager.getDeviceLogger(this.nativeId)),this._log}get console(){return this._console||(this._console=t.sdk.deviceManager.getDeviceConsole(this.nativeId)),this._console}async createMediaObject(e,s){return t.sdk.mediaManager.createMediaObject(e,s,{sourceId:this.id})}getMediaObjectConsole(e){return"string"!=typeof e.sourceId?this.console:t.sdk.deviceManager.getMixinConsole(e.sourceId,this.nativeId)}_lazyLoadDeviceState(){this._deviceState||(this.nativeId?this._deviceState=t.sdk.deviceManager.getDeviceState(this.nativeId):this._deviceState=t.sdk.deviceManager.getDeviceState())}onDeviceEvent(e,s){return t.sdk.deviceManager.onDeviceEvent(this.nativeId,e,s)}}t.ScryptedDeviceBase=i;class o extends A.DeviceBase{constructor(e){super(),this._listeners=new Set,this.mixinDevice=e.mixinDevice,this.mixinDeviceInterfaces=e.mixinDeviceInterfaces,this.mixinStorageSuffix=e.mixinStorageSuffix,this._deviceState=e.mixinDeviceState,this.nativeId=t.sdk.systemManager.getDeviceById(this.id).nativeId,this.mixinProviderNativeId=e.mixinProviderNativeId,this._deviceState.__rpcproxy_traps_all_properties&&"string"==typeof this._deviceState.id&&(this._deviceState=t.sdk.deviceManager.createDeviceState(this._deviceState.id,this._deviceState.setState))}get storage(){if(!this._storage){const e=this.mixinStorageSuffix,s=this.id+(e?":"+e:"");this._storage=t.sdk.deviceManager.getMixinStorage(s,this.mixinProviderNativeId)}return this._storage}get console(){return this._console||(t.sdk.deviceManager.getMixinConsole?this._console=t.sdk.deviceManager.getMixinConsole(this.id,this.mixinProviderNativeId):this._console=t.sdk.deviceManager.getDeviceConsole(this.mixinProviderNativeId)),this._console}async createMediaObject(e,s){return t.sdk.mediaManager.createMediaObject(e,s,{sourceId:this.id})}getMediaObjectConsole(e){return"string"!=typeof e.sourceId?this.console:t.sdk.deviceManager.getMixinConsole(e.sourceId,this.mixinProviderNativeId)}onDeviceEvent(e,s){return t.sdk.deviceManager.onMixinEvent(this.id,this,e,s)}_lazyLoadDeviceState(){}manageListener(e){this._listeners.add(e)}release(){for(const e of this._listeners)e.removeListener()}}t.MixinDeviceBase=o,function(){function e(e){return function(){return this._lazyLoadDeviceState(),this._deviceState?.[e]}}function t(e){return function(t){this._lazyLoadDeviceState(),this._deviceState?this._deviceState[e]=t:console.warn("device state is unavailable. the device must be discovered with deviceManager.onDeviceDiscovered or deviceManager.onDevicesChanged before the state can be set.")}}for(const s of Object.values(A.ScryptedInterfaceProperty))s!==A.ScryptedInterfaceProperty.nativeId&&(Object.defineProperty(i.prototype,s,{set:t(s),get:e(s)}),Object.defineProperty(o.prototype,s,{set:t(s),get:e(s)}))}(),t.sdk={};try{let e=!1;try{process.env.SCRYPTED_SDK_ES_MODULE||process.env.SCRYPTED_SDK_MODULE;const r=process.env.SCRYPTED_SDK_CJS_MODULE||process.env.SCRYPTED_SDK_MODULE;if(r)if("undefined"!=typeof require){const s=require(process.env.SCRYPTED_SDK_MODULE);Object.assign(t.sdk,s.getScryptedStatic()),e=!0}else{const n=s(3891)(r);Object.assign(t.sdk,n.getScryptedStatic()),e=!0}}catch(e){throw console.warn("failed to load sdk module",e),e}if(!e){let e;try{e=pluginRuntimeAPI}catch(e){}Object.assign(t.sdk,{log:deviceManager.getDeviceLogger(void 0),deviceManager,endpointManager,mediaManager,systemManager,pluginHostAPI,...e})}try{t.sdk.systemManager.setScryptedInterfaceDescriptors?.(A.TYPES_VERSION,A.ScryptedInterfaceDescriptors)?.catch((()=>{}))}catch(e){}}catch(e){console.error("sdk initialization error, import @scrypted/types or use @scrypted/client instead",e)}t.default=t.sdk},6117:function(e,t,s){"use strict";var r=this&&this.__createBinding||(Object.create?function(e,t,s,r){void 0===r&&(r=s);var n=Object.getOwnPropertyDescriptor(t,s);n&&!("get"in n?!t.__esModule:n.writable||n.configurable)||(n={enumerable:!0,get:function(){return t[s]}}),Object.defineProperty(e,r,n)}:function(e,t,s,r){void 0===r&&(r=s),e[r]=t[s]}),n=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),A=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var s in e)"default"!==s&&Object.prototype.hasOwnProperty.call(e,s)&&r(t,e,s);return n(t,e),t};Object.defineProperty(t,"__esModule",{value:!0}),t.StorageSettings=void 0;const i=A(s(7562)),{systemManager:o}=i.default;t.StorageSettings=class{constructor(e,t){this.device=e,this.settings=t,this.values={},this.hasValue={};for(const e of Object.keys(t)){const s=t[e],r=()=>this.getItem(e);let n;n="clippath"!==s.type?r:()=>{try{return JSON.parse(r())}catch(e){}},Object.defineProperty(this.values,e,{get:n,set:t=>this.putSetting(e,t),enumerable:!0}),Object.defineProperty(this.hasValue,e,{get:()=>null!=this.device.storage.getItem(e),enumerable:!0})}}get keys(){const e={};for(const t of Object.keys(this.settings))e[t]=t;return e}async getSettings(){const e=await(this.options?.onGet?.()),t=[];for(const[s,r]of Object.entries(this.settings)){let n=Object.assign({},r);e?.[s]&&(n=Object.assign(n,e[s])),n.onGet&&(n=Object.assign(n,await n.onGet())),n.hide||await(this.options?.hide?.[s]?.())||(n.key=s,n.value=this.getItemInternal(s,n,!0),"function"==typeof n.deviceFilter&&(n.deviceFilter=n.deviceFilter.toString()),t.push(n),delete n.onPut,delete n.onGet,delete n.mapPut,delete n.mapGet)}return t}async putSetting(e,t){const s=this.settings[e];let r;return s&&(r=this.getItemInternal(e,s)),this.putSettingInternal(s,r,e,t)}putSettingInternal(e,t,s,r){e?.noStore||(e?.mapPut&&(r=e.mapPut(t,r)),null==r?this.device.storage.removeItem(s):"object"==typeof r?this.device.storage.setItem(s,JSON.stringify(r)):this.device.storage.setItem(s,r?.toString())),e?.onPut?.(t,r),e?.hide||this.device.onDeviceEvent(i.ScryptedInterface.Settings,void 0)}getItemInternal(e,t,s){if(!t)return this.device.storage.getItem(e);const r=function(e,t,s,r){if(null==e)return s();const n=t.multiple?"array":t.type;if("boolean"===n)return"true"===e||"false"!==e&&(s()||!1);if("number"===n){const t=parseFloat(e);return isNaN(t)?s()||0:t}if("integer"===n){const t=parseInt(e);return isNaN(t)?s()||0:t}if("array"===n){if(!e)return s()||[];try{return JSON.parse(e)}catch(e){return s()||[]}}if("device"===n)return r?e:o.getDeviceById(e)||o.getDeviceById(s());if(e&&t.json)try{return JSON.parse(e)}catch(e){return s()}return e||s()}(this.device.storage.getItem(e),t,(()=>null!=t.persistedDefaultValue?(this.putSettingInternal(t,void 0,e,t.persistedDefaultValue),t.persistedDefaultValue):t.defaultValue),s);return t.mapGet?t.mapGet(r):r}getItem(e){return this.getItemInternal(e,this.settings[e])}}},3891: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=3891,e.exports=t},4192:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ScryptedMimeTypes=t.ScryptedInterface=t.MediaPlayerState=t.SecuritySystemObstruction=t.SecuritySystemMode=t.AirQuality=t.AirPurifierMode=t.AirPurifierStatus=t.ChargeState=t.LockState=t.PanTiltZoomMovement=t.ThermostatMode=t.TemperatureUnit=t.FanMode=t.HumidityMode=t.ScryptedDeviceType=t.ScryptedInterfaceDescriptors=t.ScryptedInterfaceMethod=t.ScryptedInterfaceProperty=t.DeviceBase=t.TYPES_VERSION=void 0,t.TYPES_VERSION="0.3.108";var s,r,n,A,i,o,a,c,l,h,g,d,u,E,I,C,B,Q;t.DeviceBase=class{},function(e){e.id="id",e.info="info",e.interfaces="interfaces",e.mixins="mixins",e.name="name",e.nativeId="nativeId",e.pluginId="pluginId",e.providedInterfaces="providedInterfaces",e.providedName="providedName",e.providedRoom="providedRoom",e.providedType="providedType",e.providerId="providerId",e.room="room",e.type="type",e.scryptedRuntimeArguments="scryptedRuntimeArguments",e.on="on",e.brightness="brightness",e.colorTemperature="colorTemperature",e.rgb="rgb",e.hsv="hsv",e.buttons="buttons",e.sensors="sensors",e.running="running",e.paused="paused",e.docked="docked",e.temperatureSetting="temperatureSetting",e.temperature="temperature",e.temperatureUnit="temperatureUnit",e.humidity="humidity",e.audioVolumes="audioVolumes",e.recordingActive="recordingActive",e.ptzCapabilities="ptzCapabilities",e.lockState="lockState",e.entryOpen="entryOpen",e.batteryLevel="batteryLevel",e.chargeState="chargeState",e.online="online",e.fromMimeType="fromMimeType",e.toMimeType="toMimeType",e.converters="converters",e.binaryState="binaryState",e.tampered="tampered",e.sleeping="sleeping",e.powerDetected="powerDetected",e.audioDetected="audioDetected",e.motionDetected="motionDetected",e.ambientLight="ambientLight",e.occupied="occupied",e.flooded="flooded",e.ultraviolet="ultraviolet",e.luminance="luminance",e.position="position",e.securitySystemState="securitySystemState",e.pm10Density="pm10Density",e.pm25Density="pm25Density",e.vocDensity="vocDensity",e.noxDensity="noxDensity",e.co2ppm="co2ppm",e.airQuality="airQuality",e.airPurifierState="airPurifierState",e.filterChangeIndication="filterChangeIndication",e.filterLifeLevel="filterLifeLevel",e.humiditySetting="humiditySetting",e.fan="fan",e.applicationInfo="applicationInfo",e.systemDevice="systemDevice"}(s||(t.ScryptedInterfaceProperty=s={})),function(e){e.listen="listen",e.probe="probe",e.setMixins="setMixins",e.setName="setName",e.setRoom="setRoom",e.setType="setType",e.getPluginJson="getPluginJson",e.turnOff="turnOff",e.turnOn="turnOn",e.setBrightness="setBrightness",e.getTemperatureMaxK="getTemperatureMaxK",e.getTemperatureMinK="getTemperatureMinK",e.setColorTemperature="setColorTemperature",e.setRgb="setRgb",e.setHsv="setHsv",e.pressButton="pressButton",e.sendNotification="sendNotification",e.start="start",e.stop="stop",e.pause="pause",e.resume="resume",e.dock="dock",e.setTemperature="setTemperature",e.setTemperatureUnit="setTemperatureUnit",e.getPictureOptions="getPictureOptions",e.takePicture="takePicture",e.getAudioStream="getAudioStream",e.setAudioVolumes="setAudioVolumes",e.startDisplay="startDisplay",e.stopDisplay="stopDisplay",e.getVideoStream="getVideoStream",e.getVideoStreamOptions="getVideoStreamOptions",e.getPrivacyMasks="getPrivacyMasks",e.setPrivacyMasks="setPrivacyMasks",e.getVideoTextOverlays="getVideoTextOverlays",e.setVideoTextOverlay="setVideoTextOverlay",e.getRecordingStream="getRecordingStream",e.getRecordingStreamCurrentTime="getRecordingStreamCurrentTime",e.getRecordingStreamOptions="getRecordingStreamOptions",e.getRecordingStreamThumbnail="getRecordingStreamThumbnail",e.deleteRecordingStream="deleteRecordingStream",e.setRecordingActive="setRecordingActive",e.ptzCommand="ptzCommand",e.getRecordedEvents="getRecordedEvents",e.getVideoClip="getVideoClip",e.getVideoClips="getVideoClips",e.getVideoClipThumbnail="getVideoClipThumbnail",e.removeVideoClips="removeVideoClips",e.setVideoStreamOptions="setVideoStreamOptions",e.startIntercom="startIntercom",e.stopIntercom="stopIntercom",e.lock="lock",e.unlock="unlock",e.addPassword="addPassword",e.getPasswords="getPasswords",e.removePassword="removePassword",e.activate="activate",e.deactivate="deactivate",e.isReversible="isReversible",e.closeEntry="closeEntry",e.openEntry="openEntry",e.getDevice="getDevice",e.releaseDevice="releaseDevice",e.adoptDevice="adoptDevice",e.discoverDevices="discoverDevices",e.createDevice="createDevice",e.getCreateDeviceSettings="getCreateDeviceSettings",e.reboot="reboot",e.getRefreshFrequency="getRefreshFrequency",e.refresh="refresh",e.getMediaStatus="getMediaStatus",e.load="load",e.seek="seek",e.skipNext="skipNext",e.skipPrevious="skipPrevious",e.convert="convert",e.convertMedia="convertMedia",e.getSettings="getSettings",e.putSetting="putSetting",e.armSecuritySystem="armSecuritySystem",e.disarmSecuritySystem="disarmSecuritySystem",e.setAirPurifierState="setAirPurifierState",e.getReadmeMarkdown="getReadmeMarkdown",e.getOauthUrl="getOauthUrl",e.onOauthCallback="onOauthCallback",e.canMixin="canMixin",e.getMixin="getMixin",e.releaseMixin="releaseMixin",e.onRequest="onRequest",e.onConnection="onConnection",e.onPush="onPush",e.run="run",e.eval="eval",e.loadScripts="loadScripts",e.saveScript="saveScript",e.forkInterface="forkInterface",e.trackObjects="trackObjects",e.getDetectionInput="getDetectionInput",e.getObjectTypes="getObjectTypes",e.detectObjects="detectObjects",e.generateObjectDetections="generateObjectDetections",e.getDetectionModel="getDetectionModel",e.setHumidity="setHumidity",e.setFan="setFan",e.startRTCSignalingSession="startRTCSignalingSession",e.createRTCSignalingSession="createRTCSignalingSession",e.getScryptedUserAccessControl="getScryptedUserAccessControl",e.generateVideoFrames="generateVideoFrames",e.connectStream="connectStream",e.getTTYSettings="getTTYSettings"}(r||(t.ScryptedInterfaceMethod=r={})),t.ScryptedInterfaceDescriptors={ScryptedDevice:{name:"ScryptedDevice",methods:["listen","probe","setMixins","setName","setRoom","setType"],properties:["id","info","interfaces","mixins","name","nativeId","pluginId","providedInterfaces","providedName","providedRoom","providedType","providerId","room","type"]},ScryptedPlugin:{name:"ScryptedPlugin",methods:["getPluginJson"],properties:[]},ScryptedPluginRuntime:{name:"ScryptedPluginRuntime",methods:[],properties:["scryptedRuntimeArguments"]},OnOff:{name:"OnOff",methods:["turnOff","turnOn"],properties:["on"]},Brightness:{name:"Brightness",methods:["setBrightness"],properties:["brightness"]},ColorSettingTemperature:{name:"ColorSettingTemperature",methods:["getTemperatureMaxK","getTemperatureMinK","setColorTemperature"],properties:["colorTemperature"]},ColorSettingRgb:{name:"ColorSettingRgb",methods:["setRgb"],properties:["rgb"]},ColorSettingHsv:{name:"ColorSettingHsv",methods:["setHsv"],properties:["hsv"]},Buttons:{name:"Buttons",methods:[],properties:["buttons"]},PressButtons:{name:"PressButtons",methods:["pressButton"],properties:[]},Sensors:{name:"Sensors",methods:[],properties:["sensors"]},Notifier:{name:"Notifier",methods:["sendNotification"],properties:[]},StartStop:{name:"StartStop",methods:["start","stop"],properties:["running"]},Pause:{name:"Pause",methods:["pause","resume"],properties:["paused"]},Dock:{name:"Dock",methods:["dock"],properties:["docked"]},TemperatureSetting:{name:"TemperatureSetting",methods:["setTemperature"],properties:["temperatureSetting"]},Thermometer:{name:"Thermometer",methods:["setTemperatureUnit"],properties:["temperature","temperatureUnit"]},HumiditySensor:{name:"HumiditySensor",methods:[],properties:["humidity"]},Camera:{name:"Camera",methods:["getPictureOptions","takePicture"],properties:[]},Microphone:{name:"Microphone",methods:["getAudioStream"],properties:[]},AudioVolumeControl:{name:"AudioVolumeControl",methods:["setAudioVolumes"],properties:["audioVolumes"]},Display:{name:"Display",methods:["startDisplay","stopDisplay"],properties:[]},VideoCamera:{name:"VideoCamera",methods:["getVideoStream","getVideoStreamOptions"],properties:[]},VideoCameraMask:{name:"VideoCameraMask",methods:["getPrivacyMasks","setPrivacyMasks"],properties:[]},VideoTextOverlays:{name:"VideoTextOverlays",methods:["getVideoTextOverlays","setVideoTextOverlay"],properties:[]},VideoRecorder:{name:"VideoRecorder",methods:["getRecordingStream","getRecordingStreamCurrentTime","getRecordingStreamOptions","getRecordingStreamThumbnail"],properties:["recordingActive"]},VideoRecorderManagement:{name:"VideoRecorderManagement",methods:["deleteRecordingStream","setRecordingActive"],properties:[]},PanTiltZoom:{name:"PanTiltZoom",methods:["ptzCommand"],properties:["ptzCapabilities"]},EventRecorder:{name:"EventRecorder",methods:["getRecordedEvents"],properties:[]},VideoClips:{name:"VideoClips",methods:["getVideoClip","getVideoClips","getVideoClipThumbnail","removeVideoClips"],properties:[]},VideoCameraConfiguration:{name:"VideoCameraConfiguration",methods:["setVideoStreamOptions"],properties:[]},Intercom:{name:"Intercom",methods:["startIntercom","stopIntercom"],properties:[]},Lock:{name:"Lock",methods:["lock","unlock"],properties:["lockState"]},PasswordStore:{name:"PasswordStore",methods:["addPassword","getPasswords","removePassword"],properties:[]},Scene:{name:"Scene",methods:["activate","deactivate","isReversible"],properties:[]},Entry:{name:"Entry",methods:["closeEntry","openEntry"],properties:[]},EntrySensor:{name:"EntrySensor",methods:[],properties:["entryOpen"]},DeviceProvider:{name:"DeviceProvider",methods:["getDevice","releaseDevice"],properties:[]},DeviceDiscovery:{name:"DeviceDiscovery",methods:["adoptDevice","discoverDevices"],properties:[]},DeviceCreator:{name:"DeviceCreator",methods:["createDevice","getCreateDeviceSettings"],properties:[]},Battery:{name:"Battery",methods:[],properties:["batteryLevel"]},Charger:{name:"Charger",methods:[],properties:["chargeState"]},Reboot:{name:"Reboot",methods:["reboot"],properties:[]},Refresh:{name:"Refresh",methods:["getRefreshFrequency","refresh"],properties:[]},MediaPlayer:{name:"MediaPlayer",methods:["getMediaStatus","load","seek","skipNext","skipPrevious"],properties:[]},Online:{name:"Online",methods:[],properties:["online"]},BufferConverter:{name:"BufferConverter",methods:["convert"],properties:["fromMimeType","toMimeType"]},MediaConverter:{name:"MediaConverter",methods:["convertMedia"],properties:["converters"]},Settings:{name:"Settings",methods:["getSettings","putSetting"],properties:[]},BinarySensor:{name:"BinarySensor",methods:[],properties:["binaryState"]},TamperSensor:{name:"TamperSensor",methods:[],properties:["tampered"]},Sleep:{name:"Sleep",methods:[],properties:["sleeping"]},PowerSensor:{name:"PowerSensor",methods:[],properties:["powerDetected"]},AudioSensor:{name:"AudioSensor",methods:[],properties:["audioDetected"]},MotionSensor:{name:"MotionSensor",methods:[],properties:["motionDetected"]},AmbientLightSensor:{name:"AmbientLightSensor",methods:[],properties:["ambientLight"]},OccupancySensor:{name:"OccupancySensor",methods:[],properties:["occupied"]},FloodSensor:{name:"FloodSensor",methods:[],properties:["flooded"]},UltravioletSensor:{name:"UltravioletSensor",methods:[],properties:["ultraviolet"]},LuminanceSensor:{name:"LuminanceSensor",methods:[],properties:["luminance"]},PositionSensor:{name:"PositionSensor",methods:[],properties:["position"]},SecuritySystem:{name:"SecuritySystem",methods:["armSecuritySystem","disarmSecuritySystem"],properties:["securitySystemState"]},PM10Sensor:{name:"PM10Sensor",methods:[],properties:["pm10Density"]},PM25Sensor:{name:"PM25Sensor",methods:[],properties:["pm25Density"]},VOCSensor:{name:"VOCSensor",methods:[],properties:["vocDensity"]},NOXSensor:{name:"NOXSensor",methods:[],properties:["noxDensity"]},CO2Sensor:{name:"CO2Sensor",methods:[],properties:["co2ppm"]},AirQualitySensor:{name:"AirQualitySensor",methods:[],properties:["airQuality"]},AirPurifier:{name:"AirPurifier",methods:["setAirPurifierState"],properties:["airPurifierState"]},FilterMaintenance:{name:"FilterMaintenance",methods:[],properties:["filterChangeIndication","filterLifeLevel"]},Readme:{name:"Readme",methods:["getReadmeMarkdown"],properties:[]},OauthClient:{name:"OauthClient",methods:["getOauthUrl","onOauthCallback"],properties:[]},MixinProvider:{name:"MixinProvider",methods:["canMixin","getMixin","releaseMixin"],properties:[]},HttpRequestHandler:{name:"HttpRequestHandler",methods:["onRequest"],properties:[]},EngineIOHandler:{name:"EngineIOHandler",methods:["onConnection"],properties:[]},PushHandler:{name:"PushHandler",methods:["onPush"],properties:[]},Program:{name:"Program",methods:["run"],properties:[]},Scriptable:{name:"Scriptable",methods:["eval","loadScripts","saveScript"],properties:[]},ClusterForkInterface:{name:"ClusterForkInterface",methods:["forkInterface"],properties:[]},ObjectTracker:{name:"ObjectTracker",methods:["trackObjects"],properties:[]},ObjectDetector:{name:"ObjectDetector",methods:["getDetectionInput","getObjectTypes"],properties:[]},ObjectDetection:{name:"ObjectDetection",methods:["detectObjects","generateObjectDetections","getDetectionModel"],properties:[]},ObjectDetectionPreview:{name:"ObjectDetectionPreview",methods:[],properties:[]},ObjectDetectionGenerator:{name:"ObjectDetectionGenerator",methods:[],properties:[]},HumiditySetting:{name:"HumiditySetting",methods:["setHumidity"],properties:["humiditySetting"]},Fan:{name:"Fan",methods:["setFan"],properties:["fan"]},RTCSignalingChannel:{name:"RTCSignalingChannel",methods:["startRTCSignalingSession"],properties:[]},RTCSignalingClient:{name:"RTCSignalingClient",methods:["createRTCSignalingSession"],properties:[]},LauncherApplication:{name:"LauncherApplication",methods:[],properties:["applicationInfo"]},ScryptedUser:{name:"ScryptedUser",methods:["getScryptedUserAccessControl"],properties:[]},VideoFrameGenerator:{name:"VideoFrameGenerator",methods:["generateVideoFrames"],properties:[]},StreamService:{name:"StreamService",methods:["connectStream"],properties:[]},TTY:{name:"TTY",methods:[],properties:[]},TTYSettings:{name:"TTYSettings",methods:["getTTYSettings"],properties:[]},ScryptedSystemDevice:{name:"ScryptedSystemDevice",methods:[],properties:["systemDevice"]},ScryptedDeviceCreator:{name:"ScryptedDeviceCreator",methods:[],properties:[]},ScryptedSettings:{name:"ScryptedSettings",methods:[],properties:[]}},function(e){e.Builtin="Builtin",e.Camera="Camera",e.Fan="Fan",e.Light="Light",e.Switch="Switch",e.Outlet="Outlet",e.Sensor="Sensor",e.Scene="Scene",e.Program="Program",e.Automation="Automation",e.Vacuum="Vacuum",e.Notifier="Notifier",e.Thermostat="Thermostat",e.Lock="Lock",e.PasswordControl="PasswordControl",e.Display="Display",e.SmartDisplay="SmartDisplay",e.Speaker="Speaker",e.SmartSpeaker="SmartSpeaker",e.Event="Event",e.Entry="Entry",e.Garage="Garage",e.DeviceProvider="DeviceProvider",e.DataSource="DataSource",e.API="API",e.Doorbell="Doorbell",e.Irrigation="Irrigation",e.Valve="Valve",e.Person="Person",e.SecuritySystem="SecuritySystem",e.WindowCovering="WindowCovering",e.Siren="Siren",e.AirPurifier="AirPurifier",e.Unknown="Unknown"}(n||(t.ScryptedDeviceType=n={})),function(e){e.Humidify="Humidify",e.Dehumidify="Dehumidify",e.Auto="Auto",e.Off="Off"}(A||(t.HumidityMode=A={})),function(e){e.Auto="Auto",e.Manual="Manual"}(i||(t.FanMode=i={})),function(e){e.C="C",e.F="F"}(o||(t.TemperatureUnit=o={})),function(e){e.Off="Off",e.Cool="Cool",e.Heat="Heat",e.HeatCool="HeatCool",e.Auto="Auto",e.FanOnly="FanOnly",e.Purifier="Purifier",e.Eco="Eco",e.Dry="Dry",e.On="On"}(a||(t.ThermostatMode=a={})),function(e){e.Absolute="Absolute",e.Relative="Relative",e.Continuous="Continuous",e.Preset="Preset",e.Home="Home"}(c||(t.PanTiltZoomMovement=c={})),function(e){e.Locked="Locked",e.Unlocked="Unlocked",e.Jammed="Jammed"}(l||(t.LockState=l={})),function(e){e.Trickle="trickle",e.Charging="charging",e.NotCharging="not-charging"}(h||(t.ChargeState=h={})),function(e){e.Inactive="Inactive",e.Idle="Idle",e.Active="Active",e.ActiveNightMode="ActiveNightMode"}(g||(t.AirPurifierStatus=g={})),function(e){e.Manual="Manual",e.Automatic="Automatic"}(d||(t.AirPurifierMode=d={})),function(e){e.Unknown="Unknown",e.Excellent="Excellent",e.Good="Good",e.Fair="Fair",e.Inferior="Inferior",e.Poor="Poor"}(u||(t.AirQuality=u={})),function(e){e.Disarmed="Disarmed",e.HomeArmed="HomeArmed",e.AwayArmed="AwayArmed",e.NightArmed="NightArmed"}(E||(t.SecuritySystemMode=E={})),function(e){e.Sensor="Sensor",e.Occupied="Occupied",e.Time="Time",e.Error="Error"}(I||(t.SecuritySystemObstruction=I={})),function(e){e.Idle="Idle",e.Playing="Playing",e.Paused="Paused",e.Buffering="Buffering"}(C||(t.MediaPlayerState=C={})),function(e){e.ScryptedDevice="ScryptedDevice",e.ScryptedPlugin="ScryptedPlugin",e.ScryptedPluginRuntime="ScryptedPluginRuntime",e.OnOff="OnOff",e.Brightness="Brightness",e.ColorSettingTemperature="ColorSettingTemperature",e.ColorSettingRgb="ColorSettingRgb",e.ColorSettingHsv="ColorSettingHsv",e.Buttons="Buttons",e.PressButtons="PressButtons",e.Sensors="Sensors",e.Notifier="Notifier",e.StartStop="StartStop",e.Pause="Pause",e.Dock="Dock",e.TemperatureSetting="TemperatureSetting",e.Thermometer="Thermometer",e.HumiditySensor="HumiditySensor",e.Camera="Camera",e.Microphone="Microphone",e.AudioVolumeControl="AudioVolumeControl",e.Display="Display",e.VideoCamera="VideoCamera",e.VideoCameraMask="VideoCameraMask",e.VideoTextOverlays="VideoTextOverlays",e.VideoRecorder="VideoRecorder",e.VideoRecorderManagement="VideoRecorderManagement",e.PanTiltZoom="PanTiltZoom",e.EventRecorder="EventRecorder",e.VideoClips="VideoClips",e.VideoCameraConfiguration="VideoCameraConfiguration",e.Intercom="Intercom",e.Lock="Lock",e.PasswordStore="PasswordStore",e.Scene="Scene",e.Entry="Entry",e.EntrySensor="EntrySensor",e.DeviceProvider="DeviceProvider",e.DeviceDiscovery="DeviceDiscovery",e.DeviceCreator="DeviceCreator",e.Battery="Battery",e.Charger="Charger",e.Reboot="Reboot",e.Refresh="Refresh",e.MediaPlayer="MediaPlayer",e.Online="Online",e.BufferConverter="BufferConverter",e.MediaConverter="MediaConverter",e.Settings="Settings",e.BinarySensor="BinarySensor",e.TamperSensor="TamperSensor",e.Sleep="Sleep",e.PowerSensor="PowerSensor",e.AudioSensor="AudioSensor",e.MotionSensor="MotionSensor",e.AmbientLightSensor="AmbientLightSensor",e.OccupancySensor="OccupancySensor",e.FloodSensor="FloodSensor",e.UltravioletSensor="UltravioletSensor",e.LuminanceSensor="LuminanceSensor",e.PositionSensor="PositionSensor",e.SecuritySystem="SecuritySystem",e.PM10Sensor="PM10Sensor",e.PM25Sensor="PM25Sensor",e.VOCSensor="VOCSensor",e.NOXSensor="NOXSensor",e.CO2Sensor="CO2Sensor",e.AirQualitySensor="AirQualitySensor",e.AirPurifier="AirPurifier",e.FilterMaintenance="FilterMaintenance",e.Readme="Readme",e.OauthClient="OauthClient",e.MixinProvider="MixinProvider",e.HttpRequestHandler="HttpRequestHandler",e.EngineIOHandler="EngineIOHandler",e.PushHandler="PushHandler",e.Program="Program",e.Scriptable="Scriptable",e.ClusterForkInterface="ClusterForkInterface",e.ObjectTracker="ObjectTracker",e.ObjectDetector="ObjectDetector",e.ObjectDetection="ObjectDetection",e.ObjectDetectionPreview="ObjectDetectionPreview",e.ObjectDetectionGenerator="ObjectDetectionGenerator",e.HumiditySetting="HumiditySetting",e.Fan="Fan",e.RTCSignalingChannel="RTCSignalingChannel",e.RTCSignalingClient="RTCSignalingClient",e.LauncherApplication="LauncherApplication",e.ScryptedUser="ScryptedUser",e.VideoFrameGenerator="VideoFrameGenerator",e.StreamService="StreamService",e.TTY="TTY",e.TTYSettings="TTYSettings",e.ScryptedSystemDevice="ScryptedSystemDevice",e.ScryptedDeviceCreator="ScryptedDeviceCreator",e.ScryptedSettings="ScryptedSettings"}(B||(t.ScryptedInterface=B={})),function(e){e.Url="text/x-uri",e.InsecureLocalUrl="text/x-insecure-local-uri",e.LocalUrl="text/x-local-uri",e.ServerId="text/x-server-id",e.PushEndpoint="text/x-push-endpoint",e.SchemePrefix="x-scrypted/x-scrypted-scheme-",e.MediaStreamUrl="text/x-media-url",e.MediaObject="x-scrypted/x-scrypted-media-object",e.RequestMediaObject="x-scrypted/x-scrypted-request-media-object",e.RequestMediaStream="x-scrypted/x-scrypted-request-stream",e.MediaStreamFeedback="x-scrypted/x-media-stream-feedback",e.FFmpegInput="x-scrypted/x-ffmpeg-input",e.FFmpegTranscodeStream="x-scrypted/x-ffmpeg-transcode-stream",e.RTCSignalingChannel="x-scrypted/x-scrypted-rtc-signaling-channel",e.RTCSignalingSession="x-scrypted/x-scrypted-rtc-signaling-session",e.RTCConnectionManagement="x-scrypted/x-scrypted-rtc-connection-management",e.Image="x-scrypted/x-scrypted-image"}(Q||(t.ScryptedMimeTypes=Q={}))},7077:(e,t,s)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.BaseBaichuanClass=t.BaichuanLogger=void 0;const r=s(7562),n=s(5098);class A{constructor(e,t,s){this.baseLogger=e,this.deviceName=t,this.isDebugEnabledCallback=s}formatMessage(e,...t){const s=(new Date).toLocaleString();return`${`[${this.deviceName}] [${s}] [${e}]`} ${t.map((e=>"object"==typeof e?JSON.stringify(e):String(e))).join(" ")}`}log(...e){this.baseLogger.log(this.formatMessage("LOG",...e))}error(...e){this.baseLogger.error(this.formatMessage("ERROR",...e))}warn(...e){this.baseLogger.warn(this.formatMessage("WARN",...e))}debug(...e){this.isDebugEnabledCallback()&&this.baseLogger.debug(this.formatMessage("DEBUG",...e))}isDebugEnabled(){return this.isDebugEnabledCallback()}assert(e,...t){this.baseLogger.assert(e,...t)}clear(){this.baseLogger.clear()}count(e){this.baseLogger.count(e)}countReset(e){this.baseLogger.countReset(e)}dir(e,t){this.baseLogger.dir(e,t)}dirxml(...e){this.baseLogger.dirxml(...e)}group(...e){this.baseLogger.group(...e)}groupCollapsed(...e){this.baseLogger.groupCollapsed(...e)}groupEnd(){this.baseLogger.groupEnd()}info(...e){this.baseLogger.info(this.formatMessage("INFO",...e))}table(e,t){this.baseLogger.table(e,t)}time(e){this.baseLogger.time(e)}timeEnd(e){this.baseLogger.timeEnd(e)}timeLog(e,...t){this.baseLogger.timeLog(e,...t)}trace(...e){this.baseLogger.trace(...e)}get memory(){return this.baseLogger.memory}get Console(){return this.baseLogger.Console}profile(e){"function"==typeof this.baseLogger.profile&&this.baseLogger.profile(e)}profileEnd(e){"function"==typeof this.baseLogger.profileEnd&&this.baseLogger.profileEnd(e)}timeStamp(e){"function"==typeof this.baseLogger.timeStamp&&this.baseLogger.timeStamp(e)}context(...e){"function"==typeof this.baseLogger.context&&this.baseLogger.context(...e)}}t.BaichuanLogger=A;class i extends r.ScryptedDeviceBase{constructor(){super(...arguments),this.lastDisconnectTime=0,this.reconnectBackoffMs=2e3,this.eventSubscriptionActive=!1}getBaichuanLogger(){return new A(this.console,this.getDeviceName(),(()=>this.isDebugEnabled()))}async onBeforeCleanup(){}async ensureBaichuanClient(){if(this.baichuanApi&&this.baichuanApi.client.isSocketConnected()&&this.baichuanApi.client.loggedIn)return this.baichuanApi;if(this.ensureClientPromise)return await this.ensureClientPromise;if(this.lastDisconnectTime>0){const e=Date.now()-this.lastDisconnectTime;if(e<this.reconnectBackoffMs){const t=this.reconnectBackoffMs-e;this.getBaichuanLogger().log(`Waiting ${t}ms before reconnection (backoff)`),await new Promise((e=>setTimeout(e,t)))}}this.ensureClientPromise=(async()=>{const e=this.getConnectionConfig();this.baichuanApi&&await this.cleanupBaichuanApi();const t=this.getBaichuanLogger(),s=await(0,n.createBaichuanApi)({inputs:{host:e.host,username:e.username,password:e.password,uid:e.uid,logger:t,debugOptions:e.debugOptions},transport:e.transport,logger:t});if(await s.login(),!s.client.isSocketConnected())throw new Error("Socket not connected after login");return this.attachBaichuanListeners(s),this.baichuanApi=s,this.connectionTime=Date.now(),s})();try{return await this.ensureClientPromise}finally{this.ensureClientPromise=void 0}}attachBaichuanListeners(e){const t=this.getBaichuanLogger(),s=this.getConnectionCallbacks();this.errorListener=e=>{const r=e?.message||e?.toString?.()||String(e);if("string"==typeof r&&(r.includes("Baichuan socket closed")||r.includes("Baichuan UDP stream closed")||r.includes("Not running")))t.debug(`error (recoverable): ${r}`);else if(t.error(`error: ${r}`),s.onError)try{s.onError(e)}catch{}},this.closeListener=async()=>{try{const s=e.client.isSocketConnected(),r=e.client.loggedIn;t.log(`Connection state before close: connected=${s}, loggedIn=${r}`);const n=e.client;(n?.lastRx||n?.lastTx)&&t.debug(`Last message info: lastRx=${JSON.stringify(n.lastRx)}, lastTx=${JSON.stringify(n.lastTx)}`)}catch(e){t.debug(`Could not get connection state: ${e}`)}const r=Date.now(),n=r-this.lastDisconnectTime;if(this.lastDisconnectTime=r,t.log(`Socket closed, resetting client state for reconnection (last disconnect ${n}ms ago)`),await this.cleanupBaichuanApi(),s.onClose)try{await s.onClose()}catch{}},e.client.on("error",this.errorListener),e.client.on("close",this.closeListener)}async cleanupBaichuanApi(){if(!this.baichuanApi)return;const e=this.baichuanApi;if(await this.unsubscribeFromEvents(),await this.onBeforeCleanup(),this.closeListener){try{e.client.off("close",this.closeListener)}catch{}this.closeListener=void 0}if(this.errorListener){try{e.client.off("error",this.errorListener)}catch{}this.errorListener=void 0}try{e.client.isSocketConnected()&&await e.close()}catch{}this.baichuanApi=void 0,this.ensureClientPromise=void 0}async subscribeToEvents(){const e=this.getBaichuanLogger(),t=this.getConnectionCallbacks();if(!t.onSimpleEvent)return;if(this.eventSubscriptionActive&&this.baichuanApi){if(this.baichuanApi.client.isSocketConnected()&&this.baichuanApi.client.loggedIn)return void e.debug("Event subscription already active");this.eventSubscriptionActive=!1}await this.unsubscribeFromEvents();const s=await this.ensureBaichuanClient();if(s.client.isSocketConnected()&&s.client.loggedIn)if(!t.getEventSubscriptionEnabled||t.getEventSubscriptionEnabled())try{await s.onSimpleEvent(t.onSimpleEvent),this.eventSubscriptionActive=!0,e.log("Subscribed to Baichuan events")}catch(t){e.warn("Failed to subscribe to events",t),this.eventSubscriptionActive=!1}else e.debug("Event subscription disabled");else e.warn("Cannot subscribe to events: connection not ready")}async unsubscribeFromEvents(){const e=this.getBaichuanLogger(),t=this.getConnectionCallbacks();if(this.eventSubscriptionActive&&this.baichuanApi&&t.onSimpleEvent)try{this.baichuanApi.offSimpleEvent(t.onSimpleEvent),e.debug("Unsubscribed from Baichuan events")}catch(t){e.warn("Error unsubscribing from events",t)}this.eventSubscriptionActive=!1}}t.BaseBaichuanClass=i},6125:function(e,t,s){"use strict";var r=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.ReolinkNativeBatteryCamera=void 0;const n=r(s(7562)),A=s(8799),i=s(9560);class o extends A.CommonCameraMixin{isBatteryInfoLoggingEnabled(){return(this.storageSettings.values.debugLogs||[]).includes(i.DebugLogOption.BatteryInfo)}constructor(e,t,s){super(e,t,{type:"battery",nvrDevice:s}),this.plugin=t,this.motionDetected=!1,this.periodicStarted=!1,this.forceNewSnapshot=!1,this.batteryUpdateInProgress=!1}async takePicture(e){const t=this.getBaichuanLogger();if(!this.forceNewSnapshot&&this.lastPicture)return t.debug(`Returning cached snapshot, taken at ${new Date(this.lastPicture.atMs).toLocaleString()}`),this.lastPicture.mo;if(this.takePictureInFlight)return await this.takePictureInFlight;t.log(`Taking new snapshot from camera (forceNewSnapshot: ${this.forceNewSnapshot})`),this.forceNewSnapshot=!1,this.takePictureInFlight=(async()=>{const e=this.storageSettings.values.rtspChannel,s=await this.withBaichuanClient((async t=>await t.getSnapshot(e))),r=await n.default.mediaManager.createMediaObject(s,"image/jpeg");return this.lastPicture={mo:r,atMs:Date.now()},t.log(`Snapshot taken at ${new Date(this.lastPicture.atMs).toLocaleString()}`),r})();try{return await this.takePictureInFlight}finally{this.takePictureInFlight=void 0}}async getPictureOptions(){return[]}async init(){this.startPeriodicTasks(),await this.alignAuxDevicesState(),await this.updateBatteryInfo()}async release(){return this.stopPeriodicTasks(),this.resetBaichuanClient()}stopPeriodicTasks(){this.sleepCheckTimer&&(clearInterval(this.sleepCheckTimer),this.sleepCheckTimer=void 0),this.batteryUpdateTimer&&(clearInterval(this.batteryUpdateTimer),this.batteryUpdateTimer=void 0),this.periodicStarted=!1}startPeriodicTasks(){if(this.periodicStarted)return;const e=this.getBaichuanLogger();this.periodicStarted=!0,e.log("Starting periodic tasks for battery camera"),this.nvrDevice||(this.sleepCheckTimer=setInterval((async()=>{try{const t=this.baichuanApi,s=this.storageSettings.values.rtspChannel;if(!t)return void(this.sleeping||(e.log("Camera is sleeping: no active Baichuan client"),this.sleeping=!0));const r=t.getSleepStatus({channel:s});await this.updateSleepingState(r)}catch(t){e.warn("Error checking sleeping state:",t)}}),5e3));const{batteryUpdateIntervalMinutes:t=10}=this.storageSettings.values,s=6e4*t;this.batteryUpdateTimer=setInterval((()=>{this.updateBatteryAndSnapshot().catch((()=>{}))}),s),e.log(`Periodic tasks started: sleep check every 5s, battery update every ${t} minutes`)}async updateSleepingState(e){try{if(this.isBatteryInfoLoggingEnabled()&&this.getBaichuanLogger().debug("getSleepStatus result:",JSON.stringify(e)),"sleeping"===e.state)this.sleeping||(this.getBaichuanLogger().log(`Camera is sleeping: ${e.reason}`),this.sleeping=!0);else if("awake"===e.state){const t=this.sleeping;t&&(this.getBaichuanLogger().log(`Camera woke up: ${e.reason}`),this.sleeping=!1),t&&(this.alignAuxDevicesState().catch((()=>{})),this.forceNewSnapshot&&this.takePicture().catch((()=>{})))}else this.getBaichuanLogger().debug(`Sleep status unknown: ${e.reason}`)}catch(e){this.getBaichuanLogger().debug("Error in checkSleepingState:",e)}}async checkRecordingAction(e){const t=this.plugin.nvrDeviceId;if(t&&this.mixins.includes(t)){const t=this.getBaichuanLogger(),s=await this.thisDevice.getSettings(),r=!s.find((e=>"recording:privacyMode"===e.key))?.value,{lowThresholdBatteryRecording:n,highThresholdBatteryRecording:A}=this.storageSettings.values;r&&e<n?(t.log(`Recording is enabled, but battery level is below low threshold (${e}% < ${n}%), disabling recording`),await this.thisDevice.putSetting("recording:privacyMode",!0)):!r&&e>A&&(t.log(`Recording is disabled, but battery level is above high threshold (${e}% > ${A}%), enabling recording`),await this.thisDevice.putSetting("recording:privacyMode",!1))}}async updateBatteryInfo(){const e=await this.ensureClient(),t=this.storageSettings.values.rtspChannel,s=await e.getBatteryInfo(t);if(this.isBatteryInfoLoggingEnabled()&&this.getBaichuanLogger().debug("getBatteryInfo result:",JSON.stringify(s)),void 0!==s.batteryPercent){const e=this.lastBatteryLevel;this.batteryLevel=s.batteryPercent,this.lastBatteryLevel=s.batteryPercent;let t=!0;if(void 0!==e&&e!==s.batteryPercent)if(void 0!==s.chargeStatus){const t="0"===s.chargeStatus||"2"===s.chargeStatus;this.getBaichuanLogger().log(`Battery level changed: ${e}% → ${s.batteryPercent}% (charging: ${t})`)}else this.getBaichuanLogger().log(`Battery level changed: ${e}% → ${s.batteryPercent}%`);else if(void 0===e)if(void 0!==s.chargeStatus){const e="0"===s.chargeStatus||"2"===s.chargeStatus;this.getBaichuanLogger().log(`Battery level set: ${s.batteryPercent}% (charging: ${e})`)}else this.getBaichuanLogger().log(`Battery level set: ${s.batteryPercent}%`);else t=!1;t&&await this.checkRecordingAction(s.batteryPercent)}}async updateBatteryAndSnapshot(){if(this.batteryUpdateInProgress)this.getBaichuanLogger().debug("Battery update already in progress, skipping");else{this.batteryUpdateInProgress=!0;try{const e=this.storageSettings.values.rtspChannel,t=this.storageSettings.values.batteryUpdateIntervalMinutes??10;this.getBaichuanLogger().log(`Force battery update interval started (every ${t} minutes)`);const s=await this.ensureClient();if(!s)return void this.getBaichuanLogger().warn("Failed to ensure client connection for battery update");let r=s.getSleepStatus({channel:e});if("sleeping"===r.state){this.getBaichuanLogger().log("Camera is sleeping, waking up for periodic update...");try{await s.wakeUp(e,{waitAfterWakeMs:2e3}),this.getBaichuanLogger().log("Wake command sent, waiting for camera to wake up...")}catch(e){return void this.getBaichuanLogger().warn("Failed to wake up camera:",e)}const t=3e4,n=Date.now();let A=!1;for(;Date.now()-n<t;)if(await new Promise((e=>setTimeout(e,1e3))),r=s.getSleepStatus({channel:e}),"awake"===r.state){A=!0,this.getBaichuanLogger().log("Camera is now awake"),this.sleeping=!1;break}if(!A)return void this.getBaichuanLogger().warn("Camera did not wake up within timeout, skipping update")}else"awake"===r.state&&(this.sleeping=!1);try{await this.updateBatteryInfo()}catch(e){this.getBaichuanLogger().warn("Failed to get battery info during periodic update:",e)}try{await this.alignAuxDevicesState()}catch(e){this.getBaichuanLogger().warn("Failed to align auxiliary devices state:",e)}try{this.forceNewSnapshot=!0,await this.takePicture(),this.getBaichuanLogger().log("Snapshot updated during periodic update")}catch(e){this.getBaichuanLogger().warn("Failed to update snapshot during periodic update:",e)}}catch(e){this.getBaichuanLogger().warn("Failed to update battery and snapshot",e)}finally{this.batteryUpdateInProgress=!1}}}async resetBaichuanClient(e){try{if(this.unsubscribedToEvents?.(),this.streamManager){const t=e?.message||e?.toString?.()||"connection reset";await this.streamManager.closeAllStreams(t)}await(this.baichuanApi?.close())}catch(e){this.getBaichuanLogger().warn("Error closing Baichuan client during reset",e)}finally{this.baichuanApi=void 0,this.connectionTime=void 0,this.ensureClientPromise=void 0,this.sleepCheckTimer&&(clearInterval(this.sleepCheckTimer),this.sleepCheckTimer=void 0),this.batteryUpdateTimer&&(clearInterval(this.batteryUpdateTimer),this.batteryUpdateTimer=void 0)}if(e){const t=e?.message||e?.toString?.()||e;this.getBaichuanLogger().warn(`Baichuan client reset requested: ${t}`)}}async withBaichuanRetry(e){return await e()}async withBaichuanClient(e){return e(await this.ensureClient())}async createStreamClient(){return await this.ensureClient()}}t.ReolinkNativeBatteryCamera=o},4417:function(e,t,s){"use strict";var r,n=this&&this.__createBinding||(Object.create?function(e,t,s,r){void 0===r&&(r=s);var n=Object.getOwnPropertyDescriptor(t,s);n&&!("get"in n?!t.__esModule:n.writable||n.configurable)||(n={enumerable:!0,get:function(){return t[s]}}),Object.defineProperty(e,r,n)}:function(e,t,s,r){void 0===r&&(r=s),e[r]=t[s]}),A=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),i=this&&this.__importStar||(r=function(e){return r=Object.getOwnPropertyNames||function(e){var t=[];for(var s in e)Object.prototype.hasOwnProperty.call(e,s)&&(t[t.length]=s);return t},r(e)},function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var s=r(e),i=0;i<s.length;i++)"default"!==s[i]&&n(t,e,s[i]);return A(t,e),t});Object.defineProperty(t,"__esModule",{value:!0}),t.ReolinkNativeCamera=t.b64ToMo=t.moToB64=void 0;const o=i(s(7562)),a=s(8799),c=s(5098);t.moToB64=async e=>{const t=await o.default.mediaManager.convertMediaObjectToBuffer(e,"image/jpeg");return t?.toString("base64")};t.b64ToMo=async e=>{const t=Buffer.from(e,"base64");return await o.default.mediaManager.createMediaObject(t,"image/jpeg")};class l extends a.CommonCameraMixin{constructor(e,t,s){super(e,t,{type:"regular",nvrDevice:s}),this.plugin=t,this.initComplete=!1,this.periodicStarted=!1}async resetBaichuanClient(e){try{this.unsubscribedToEvents?.(),await(this.baichuanApi?.close())}catch(e){this.getBaichuanLogger().warn("Error closing Baichuan client during reset",e)}finally{this.baichuanApi=void 0,this.connectionTime=void 0,this.ensureClientPromise=void 0,this.passiveRefreshTimer&&(clearTimeout(this.passiveRefreshTimer),this.passiveRefreshTimer=void 0)}if(e){const t=e?.message||e?.toString?.()||e;this.getBaichuanLogger().warn(`Baichuan client reset requested: ${t}`)}}async withBaichuanRetry(e){try{return await e()}catch(t){if(!this.isRecoverableBaichuanError(t))throw t;await this.resetBaichuanClient(t),this.cachedNetPort=void 0;try{return await e()}catch(e){if(this.isRecoverableBaichuanError(e))throw e;throw e}}}async init(){this.startPeriodicTasks(),await this.alignAuxDevicesState()}async createStreamClient(){const{ipAddress:e,username:t,password:s}=this.storageSettings.values,r=this.getBaichuanDebugOptions(),n=await(0,c.createBaichuanApi)({inputs:{host:e,username:t,password:s,logger:this.console,debugOptions:r},transport:"tcp",logger:this.console});return await n.login(),n}getClient(){return this.baichuanApi}async release(){return this.statusPollTimer&&clearInterval(this.statusPollTimer),this.passiveRefreshTimer&&(clearTimeout(this.passiveRefreshTimer),this.passiveRefreshTimer=void 0),this.resetBaichuanClient()}startPeriodicTasks(){this.periodicStarted||(this.periodicStarted=!0,this.getBaichuanLogger().log("Starting periodic tasks for regular camera"),this.statusPollTimer=setInterval((()=>{this.periodic10sTick().catch((()=>{}))}),1e4),this.getBaichuanLogger().log("Periodic tasks started: status poll every 10s"))}async periodic10sTick(){await this.ensureClient(),await this.alignAuxDevicesState()}async getDetectionInput(e,t){return null}async processEvents(e){const t=this.getBaichuanLogger();if(this.isEventDispatchEnabled()&&(this.storageSettings.values.dispatchEvents.includes("eventLogs")&&t.debug(`Events received: ${JSON.stringify(e)}`),this.shouldDispatchMotion()&&e.motion!==this.motionDetected&&(e.motion?(this.motionDetected=!0,this.motionTimeout&&clearTimeout(this.motionTimeout),this.motionTimeout=setTimeout((()=>this.motionDetected=!1),1e3*this.storageSettings.values.motionTimeout)):(this.motionDetected=!1,this.motionTimeout&&clearTimeout(this.motionTimeout))),this.shouldDispatchObjects()&&e.objects?.length)){const t={timestamp:Date.now(),detections:[]};for(const s of e.objects)t.detections.push({className:s,score:1});o.default.deviceManager.onDeviceEvent(this.nativeId,o.ScryptedInterface.ObjectDetector,t)}}async withBaichuanClient(e){return e(await this.ensureClient())}async takePicture(e){try{return this.withBaichuanRetry((async()=>{const e=await this.ensureClient(),t=await e.getSnapshot(this.storageSettings.values.rtspChannel);return await this.createMediaObject(t,"image/jpeg")}))}catch(e){throw this.getBaichuanLogger().error("Error taking snapshot",e),e}}async getPictureOptions(){return[]}async getOtherSettings(){return await this.getSettings()}showRtspUrlOverride(){return!1}async startIntercom(e){await this.intercom.start(e)}stopIntercom(){return this.intercom.stop()}}t.ReolinkNativeCamera=l},8799:function(e,t,s){"use strict";var r,n=this&&this.__createBinding||(Object.create?function(e,t,s,r){void 0===r&&(r=s);var n=Object.getOwnPropertyDescriptor(t,s);n&&!("get"in n?!t.__esModule:n.writable||n.configurable)||(n={enumerable:!0,get:function(){return t[s]}}),Object.defineProperty(e,r,n)}:function(e,t,s,r){void 0===r&&(r=s),e[r]=t[s]}),A=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),i=this&&this.__importStar||(r=function(e){return r=Object.getOwnPropertyNames||function(e){var t=[];for(var s in e)Object.prototype.hasOwnProperty.call(e,s)&&(t[t.length]=s);return t},r(e)},function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var s=r(e),i=0;i<s.length;i++)"default"!==s[i]&&n(t,e,s[i]);return A(t,e),t}),o=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.CommonCameraMixin=void 0;const a=i(s(7562)),c=s(6117),l=s(7077),h=s(5098),g=s(9560),d=s(5741),u=s(840),E=s(5050),I=s(6185),C=o(s(6928));class B extends a.ScryptedDeviceBase{constructor(e,t){super(t),this.camera=e}async turnOff(){this.camera.getBaichuanLogger().log(`Siren toggle: turnOff (device=${this.nativeId})`),this.on=!1;try{await this.camera.setSirenEnabled(!1),this.camera.getBaichuanLogger().log(`Siren toggle: turnOff ok (device=${this.nativeId})`)}catch(e){throw this.camera.getBaichuanLogger().warn(`Siren toggle: turnOff failed (device=${this.nativeId})`,e),e}}async turnOn(){this.camera.getBaichuanLogger().log(`Siren toggle: turnOn (device=${this.nativeId})`),this.on=!0;try{await this.camera.setSirenEnabled(!0),this.camera.getBaichuanLogger().log(`Siren toggle: turnOn ok (device=${this.nativeId})`)}catch(e){throw this.camera.getBaichuanLogger().warn(`Siren toggle: turnOn failed (device=${this.nativeId})`,e),e}}}class Q extends a.ScryptedDeviceBase{constructor(e,t){super(t),this.camera=e}async setBrightness(e){this.camera.getBaichuanLogger().log(`Floodlight toggle: setBrightness (device=${this.nativeId} brightness=${e})`),this.brightness=e;try{await this.camera.setFloodlightState(void 0,e),this.camera.getBaichuanLogger().log(`Floodlight toggle: setBrightness ok (device=${this.nativeId} brightness=${e})`)}catch(t){throw this.camera.getBaichuanLogger().warn(`Floodlight toggle: setBrightness failed (device=${this.nativeId} brightness=${e})`,t),t}}async turnOff(){this.camera.getBaichuanLogger().log(`Floodlight toggle: turnOff (device=${this.nativeId})`),this.on=!1;try{await this.camera.setFloodlightState(!1),this.camera.getBaichuanLogger().log(`Floodlight toggle: turnOff ok (device=${this.nativeId})`)}catch(e){throw this.camera.getBaichuanLogger().warn(`Floodlight toggle: turnOff failed (device=${this.nativeId})`,e),e}}async turnOn(){this.camera.getBaichuanLogger().log(`Floodlight toggle: turnOn (device=${this.nativeId})`),this.on=!0;try{await this.camera.setFloodlightState(!0),this.camera.getBaichuanLogger().log(`Floodlight toggle: turnOn ok (device=${this.nativeId})`)}catch(e){throw this.camera.getBaichuanLogger().warn(`Floodlight toggle: turnOn failed (device=${this.nativeId})`,e),e}}}class p extends a.ScryptedDeviceBase{constructor(e,t){super(t),this.camera=e,this.storageSettings=new c.StorageSettings(this,{sensitive:{title:"PIR Sensitivity",description:"Detection sensitivity/threshold (higher = more sensitive)",type:"number",defaultValue:50,range:[0,100]},reduceAlarm:{title:"Reduce False Alarms",description:"Enable reduction of false alarm rate",type:"boolean",defaultValue:!1},interval:{title:"PIR Detection Interval",description:"Detection interval in seconds",type:"number",defaultValue:5,range:[1,60]}})}async getSettings(){return this.storageSettings.getSettings()}async putSetting(e,t){await this.storageSettings.putSetting(e,t);const s=this.camera.storageSettings.values.rtspChannel,r=this.on?1:0,n=this.storageSettings.values.sensitive,A=this.storageSettings.values.reduceAlarm?1:0,i=this.storageSettings.values.interval;await this.camera.withBaichuanRetry((async()=>{const e=await this.camera.ensureClient();await e.setPirInfo(s,{enable:r,sensitive:n,reduceAlarm:A,interval:i})}))}async turnOff(){this.on=!1,await this.updatePirSettings()}async turnOn(){this.on=!0,await this.updatePirSettings()}async updatePirSettings(){const e=this.camera.storageSettings.values.rtspChannel,t=this.on?1:0,s=this.storageSettings.values.sensitive,r=this.storageSettings.values.reduceAlarm?1:0,n=this.storageSettings.values.interval;await this.camera.withBaichuanRetry((async()=>{const A=await this.camera.ensureClient();await A.setPirInfo(e,{enable:t,sensitive:s,reduceAlarm:r,interval:n})}))}}class f extends l.BaseBaichuanClass{constructor(e,t,s){super(e),this.plugin=t,this.options=s,this.storageSettings=new c.StorageSettings(this,{ipAddress:{title:"IP Address",type:"string",onPut:async()=>{await this.credentialsChanged()}},username:{type:"string",title:"Username",onPut:async()=>{await this.credentialsChanged()}},password:{type:"password",title:"Password",onPut:async()=>{await this.credentialsChanged()}},rtspChannel:{type:"number",hide:!0,defaultValue:0},capabilities:{json:!0,hide:!0},uid:{title:"UID",description:"Reolink UID (required for battery cameras / BCUDP).",type:"string",hide:!0,onPut:async()=>{await this.credentialsChanged()}},isFromNvr:{type:"boolean",hide:!0,defaultValue:!1},mixinsSetup:{type:"boolean",hide:!0},dispatchEvents:{subgroup:"Advanced",title:"Dispatch Events",description:"Select which events to emit. Empty disables event subscription entirely.",multiple:!0,combobox:!0,immediate:!0,defaultValue:["motion","objects"],choices:["motion","objects"],onPut:async()=>{await this.subscribeToEvents()}},debugLogs:{subgroup:"Advanced",title:"Debug Logs",description:"Enable specific debug logs. Baichuan client logs require reconnect; event logs are immediate.",multiple:!0,combobox:!0,immediate:!0,defaultValue:[],choices:(0,g.getDebugLogChoices)(),onPut:async(e,t)=>{const s=(0,g.getApiRelevantDebugLogs)(e||[]),r=(0,g.getApiRelevantDebugLogs)(t||[]),n=new Set(s),A=new Set(r);(n.size!==A.size||Array.from(n).some((e=>!A.has(e))))&&this.resetBaichuanClient&&(this.debugLogsResetTimeout&&(clearTimeout(this.debugLogsResetTimeout),this.debugLogsResetTimeout=void 0),this.debugLogsResetTimeout=setTimeout((async()=>{this.debugLogsResetTimeout=void 0;try{await this.resetBaichuanClient("debugLogs changed"),this.baichuanApi=void 0,this.ensureClientPromise=void 0,await this.ensureClient()}catch(e){this.getBaichuanLogger().warn("Failed to reset client after debug logs change",e)}}),2e3))}},motionTimeout:{subgroup:"Advanced",title:"Motion Timeout",defaultValue:20,type:"number"},cachedOsd:{multiple:!0,hide:!0,json:!0,defaultValue:[]},intercomBlocksPerPayload:{subgroup:"Advanced",title:"Intercom Blocks Per Payload",description:"Lower reduces latency (more packets). Typical: 1-4. Requires restarting talk session to take effect.",type:"number",defaultValue:1},presets:{subgroup:"PTZ",title:"Presets to enable",description:'PTZ Presets in the format "id=name". Where id is the PTZ Preset identifier and name is a friendly name.',multiple:!0,defaultValue:[],combobox:!0,hide:!0,onPut:async(e,t)=>{const s={...this.ptzCapabilities||{},presets:{}};for(const e of t){const[t,r]=e.split("=");s.presets[t]=r}this.ptzCapabilities=s},mapGet:()=>{const e=this.ptzCapabilities?.presets||{};return Object.entries(e).map((([e,t])=>e+"="+t))}},ptzMoveDurationMs:{title:"PTZ Move Duration (ms)",description:"How long a PTZ command moves before sending stop. Higher = more movement per click.",type:"number",defaultValue:300,subgroup:"PTZ",hide:!0},ptzZoomStep:{subgroup:"PTZ",title:"PTZ Zoom Step",description:"How much to change zoom per zoom command (in zoom factor units, where 1.0 is normal).",type:"number",defaultValue:.1,hide:!0},ptzCreatePreset:{subgroup:"PTZ",title:"Create Preset",description:"Enter a name and press Save to create a new PTZ preset at the current position.",type:"string",placeholder:"e.g. Door",defaultValue:"",hide:!0,onPut:async(e,t)=>{const s=String(t??"").trim();if(!s)return void(""!==String(t??"")&&(this.storageSettings.values.ptzCreatePreset=""));const r=this.getBaichuanLogger();r.log(`PTZ presets: create preset requested (name=${s})`);const n=await this.withBaichuanRetry((async()=>{if(await this.ensureClient(),!this.ptzPresets)throw new Error("PTZ presets not available");return await this.ptzPresets.createPtzPreset(s)})),A=`${n.id}=${n.name}`;this.storageSettings.values.ptzSelectedPreset=A,this.storageSettings.values.ptzCreatePreset="",r.log(`PTZ presets: created preset id=${n.id} name=${n.name}`)}},ptzSelectedPreset:{subgroup:"PTZ",title:"Selected Preset",description:'Select the preset to update or delete. Format: "id=name".',type:"string",combobox:!1,immediate:!0,hide:!0},ptzUpdateSelectedPreset:{subgroup:"PTZ",title:"Update Selected Preset Position",description:"Overwrite the selected preset with the current PTZ position.",type:"button",immediate:!0,hide:!0,onPut:async()=>{const e=this.getSelectedPresetId();if(void 0===e)throw new Error("No preset selected");const t=this.getBaichuanLogger();t.log(`PTZ presets: update position requested (presetId=${e})`),await this.withBaichuanRetry((async()=>(await this.ensureClient(),await this.ptzPresets.updatePtzPresetToCurrentPosition(e)))),t.log(`PTZ presets: update position ok (presetId=${e})`)}},ptzDeleteSelectedPreset:{subgroup:"PTZ",title:"Delete Selected Preset",description:"Delete the selected preset (firmware dependent).",type:"button",immediate:!0,hide:!0,onPut:async()=>{const e=this.getSelectedPresetId();if(void 0===e)throw new Error("No preset selected");const t=this.getBaichuanLogger();t.log(`PTZ presets: delete requested (presetId=${e})`),await this.withBaichuanRetry((async()=>(await this.ensureClient(),await this.ptzPresets.deletePtzPreset(e)))),this.storageSettings.values.ptzSelectedPreset="",t.log(`PTZ presets: delete ok (presetId=${e})`)}},batteryUpdateIntervalMinutes:{title:"Battery Update Interval (minutes)",subgroup:"Advanced",description:"How often to wake up the camera and update battery status and snapshot (default: 60 minutes).",type:"number",defaultValue:60,hide:!0},lowThresholdBatteryRecording:{title:"Low Threshold Battery Recording (%)",subgroup:"Recording",description:"Battery level threshold below which recording is disabled (default: 15%).",type:"number",defaultValue:15,hide:!0},highThresholdBatteryRecording:{title:"High Threshold Battery Recording (%)",subgroup:"Recording",description:"Battery level threshold above which recording is enabled (default: 35%).",type:"number",defaultValue:35,hide:!0},diagnosticsOutputPath:{title:"Diagnostics Output Path",subgroup:"Diagnostics",description:"Directory where diagnostics files will be saved (default: plugin volume).",type:"string",defaultValue:C.default.join(process.env.SCRYPTED_PLUGIN_VOLUME,"diagnostics",this.name)},diagnosticsRun:{subgroup:"Diagnostics",title:"Run Diagnostics",description:"Run all diagnostics and save results to the output path.",type:"button",immediate:!0,onPut:async()=>{await this.runDiagnostics()}}}),this.ptzPresets=new u.ReolinkPtzPresets(this),this.refreshingState=!1,this.classes=[],this.presets=[],this.fetchingStreams=!1,this.lastNetPortCacheAttempt=0,this.netPortCacheBackoffMs=5e3,this.onSimpleEvent=e=>{try{const t=this.getBaichuanLogger();if(t.debug(`Baichuan event: ${JSON.stringify(e)}`),!this.isEventDispatchEnabled())return void t.debug("Event dispatch is disabled, ignoring event");const s=this.storageSettings.values.rtspChannel;if(void 0!==e?.channel&&e.channel!==s)return void t.error(`Event channel ${e.channel} does not match camera channel ${s}, ignoring`);const r=[];let n=!1;switch(e?.type){case"motion":n=!0;break;case"doorbell":this.handleDoorbellEvent(),n=!0;break;case"people":case"vehicle":case"animal":case"face":case"package":case"other":this.shouldDispatchObjects()&&r.push(e.type),n=!0;break;default:return void t.error(`Unknown event type: ${e?.type}`)}this.processEvents({motion:n,objects:r}).catch((e=>{t.warn("Error processing events",e)}))}catch(e){this.getBaichuanLogger().warn("Error in onSimpleEvent handler",e)}},this.protocol=s.nvrDevice||"battery"!==s.type?"tcp":"udp",this.nvrDevice=s.nvrDevice,this.thisDevice=a.default.systemManager.getDeviceById(this.id),setTimeout((async()=>{await this.parentInit()}),2e3)}getConnectionConfig(){const{ipAddress:e,username:t,password:s,uid:r}=this.storageSettings.values,n=this.getBaichuanDebugOptions(),A="udp"===this.protocol?(0,h.normalizeUid)(r):void 0;if("udp"===this.protocol&&!A)throw new Error("UID is required for battery cameras (BCUDP)");return{host:e,username:t,password:s,uid:A,transport:this.protocol,logger:this.console,debugOptions:n}}getConnectionCallbacks(){return{onError:void 0,onClose:async()=>{"battery"===this.options.type||setTimeout((async()=>{try{await this.subscribeToEvents()}catch(e){this.getBaichuanLogger().warn("Failed to resubscribe to events after reconnection",e)}}),1e3)},onSimpleEvent:this.onSimpleEvent,getEventSubscriptionEnabled:()=>this.isEventDispatchEnabled?.()??!1}}isDebugEnabled(){return this.isEventLogsEnabled()}getDeviceName(){return this.name||"Camera"}async runDiagnostics(){const e=this.getBaichuanLogger(),t=this.storageSettings.values.diagnosticsOutputPath||process.env.SCRYPTED_PLUGIN_VOLUME||"";if(!t)throw new Error("Diagnostics output path is required");const s=this.storageSettings.values.rtspChannel||0,r={kinds:["native"],profiles:["main","ext","sub"]};e.log(`Starting diagnostics with parameters: outDir=${t}, channel=${s}, durationSeconds=15, selection=${JSON.stringify(r)}`);try{const n=await this.ensureClient(),A=await n.runAllDiagnosticsConsecutively({outDir:t,channel:s,durationSeconds:15,selection:r});e.log(`Diagnostics completed successfully. Output directory: ${A.runDir}`),e.log(`Diagnostics file: ${A.diagnosticsPath}`),e.log(`Streams directory: ${A.streamsDir}`)}catch(t){throw e.error("Failed to run diagnostics",t),t}}async onBeforeCleanup(){if(this.onSimpleEvent&&this.baichuanApi)try{this.baichuanApi.offSimpleEvent(this.onSimpleEvent)}catch{}}createStreamClient(){throw new Error("Method not implemented.")}getAbilities(){return this.storageSettings.values.capabilities}getBaichuanDebugOptions(){const e=this.storageSettings.values.debugLogs||[];return(0,g.convertDebugLogsToApiOptions)(e)}isRecoverableBaichuanError(e){const t=e?.message||e?.toString?.()||"";return"string"==typeof t&&(t.includes("Baichuan socket closed")||t.includes("Baichuan UDP stream closed")||t.includes("Baichuan TCP socket is not connected")||t.includes("socket hang up")||t.includes("ECONNRESET")||t.includes("EPIPE"))}updatePtzCaps(){const{hasPan:e,hasTilt:t,hasZoom:s}=this.getAbilities();this.ptzCapabilities={...this.ptzCapabilities,pan:e,tilt:t,zoom:s}}unsubscribedToEvents(){this.unsubscribeFromEvents().catch((()=>{})),this.motionDetected&&(this.motionDetected=!1)}async subscribeToEvents(){if(this.nvrDevice)return;const e=this.getBaichuanLogger(),t=Array.from(this.getDispatchEventsSelection?.()??new Set).sort(),s=t.length>0;e.log(`subscribeToEvents called: enabled=${s}, selection=[${t.join(", ")}], protocol=${this.protocol}`),this.unsubscribedToEvents();if(t.includes("motion")||(this.motionTimeout&&clearTimeout(this.motionTimeout),this.motionDetected=!1),!s)return e.log("Event subscription disabled, unsubscribing"),this.doorbellBinaryTimeout&&(clearTimeout(this.doorbellBinaryTimeout),this.doorbellBinaryTimeout=void 0),void(this.binaryState=!1);const r=await this.ensureClient();try{await r.onSimpleEvent(this.onSimpleEvent),e.log(`Subscribed to events (${t.join(", ")}) on ${this.protocol} connection`)}catch(t){return void e.warn("Failed to attach Baichuan event handler",t)}}async getVideoTextOverlays(){const e=await this.ensureClient(),t=this.storageSettings.values.rtspChannel;let s=this.storageSettings.values.cachedOsd;return s?.length||(s=await e.getOsd(t),this.storageSettings.values.cachedOsd=s),{osdChannel:{text:s?.osdChannel?.enable?s.osdChannel.name:void 0},osdTime:{text:!!s?.osdTime?.enable,readonly:!0}}}async setVideoTextOverlay(e,t){const s=await this.ensureClient(),r=this.storageSettings.values.rtspChannel,n=await s.getOsd(r);if("osdChannel"===e){const e="string"==typeof t?.text?t.text.trim():"",s=!!e||!0===t?.text;n.osdChannel.enable=s?1:0,s&&(n.osdChannel.name=e||n.osdChannel.name||this.name||"Camera")}else{if("osdTime"!==e)throw new Error("unknown overlay: "+e);n.osdTime.enable=t?.text?1:0}await s.setOsd(r,n)}async ptzCommand(e){const t=await this.ensureClient();if(!t)return;const s=this.storageSettings.values.rtspChannel,r=e.preset;if(null!=r){const e=Number(r);return Number.isFinite(e)?void(this.ptzPresets?await this.ptzPresets.moveToPreset(e):this.getBaichuanLogger().warn("PTZ presets not available")):void this.getBaichuanLogger().warn(`Invalid PTZ preset id: ${r}`)}let n="start",A="Left";if(void 0!==e.pan)0===e.pan?(n="stop",A="Left"):(A=e.pan>0?"Right":"Left",n="start");else if(void 0!==e.tilt)0===e.tilt?(n="stop",A="Up"):(A=e.tilt>0?"Up":"Down",n="start");else if(void 0!==e.zoom){const r=Number(e.zoom);if(!Number.isFinite(r)||0===r)return;const n=Number(this.storageSettings.values.ptzZoomStep);if(!Number.isFinite(n)||n<=0)return void this.getBaichuanLogger().warn("Invalid PTZ zoom step, using default 0.1");const A=await t.getZoomFocus(s);if(!A?.zoom)return void this.getBaichuanLogger().warn("Zoom command requested but camera did not report zoom support.");const i=(A.zoom.curPos??1e3)/1e3,o=(A.zoom.minPos??1e3)/1e3,a=(A.zoom.maxPos??1e3)/1e3,c=n,l=r>0?1:-1,h=Math.min(a,Math.max(o,i+l*c));return void await t.zoomToFactor(s,h)}const i={action:n,command:A,speed:"number"==typeof e.speed?e.speed:32,autoStopMs:Number(this.storageSettings.values.ptzMoveDurationMs)||500};await t.ptz(s,i)}async getObjectTypes(){return{classes:this.classes}}async getDetectionInput(e,t){return null}getDispatchEventsSelection(){return new Set(this.storageSettings.values.dispatchEvents)}isEventDispatchEnabled(){return this.getDispatchEventsSelection().size>0}shouldDispatchMotion(){return this.getDispatchEventsSelection().has("motion")}shouldDispatchObjects(){return this.getDispatchEventsSelection().has("objects")}async processEvents(e){if(!(this.isEventDispatchEnabled?.()??!0))return;const t=this.getDispatchEventsSelection?.()??new Set(["motion","objects"]),s=t.has("motion"),r=t.has("objects");if(s&&void 0!==e.motion){const t=e.motion;if(t!==this.motionDetected)if(this.motionDetected=t,t){this.motionTimeout&&clearTimeout(this.motionTimeout);const e=1e3*(this.storageSettings.values.motionTimeout||30);this.motionTimeout=setTimeout((()=>{this.motionDetected=!1}),e)}else this.motionTimeout&&clearTimeout(this.motionTimeout)}if(r&&e.objects?.length){const t={timestamp:Date.now(),detections:[]};for(const s of e.objects)t.detections.push({className:s,score:1});this.nativeId&&a.default.deviceManager.onDeviceEvent(this.nativeId,a.ScryptedInterface.ObjectDetector,t)}}isEventLogsEnabled(){return(this.storageSettings.values.debugLogs||[]).includes(g.DebugLogDisplayNames[g.DebugLogOption.EventLogs])}handleDoorbellEvent(){this.doorbellBinaryTimeout||(this.binaryState=!0,this.doorbellBinaryTimeout=setTimeout((()=>{this.binaryState=!1,this.doorbellBinaryTimeout=void 0}),5e3))}clearDoorbellBinary(){this.doorbellBinaryTimeout&&(clearTimeout(this.doorbellBinaryTimeout),this.doorbellBinaryTimeout=void 0),this.binaryState=!1}async reportDevices(){if(!this.nativeId||!this.name)return;const{hasSiren:e,hasFloodlight:t,hasPir:s}=this.getAbilities(),r=[];if(e){const e=`${this.nativeId}-siren`;r.push({providerNativeId:this.plugin?.nativeId,name:`${this.name} Siren`,nativeId:e,info:{...this.info||{}},interfaces:[a.ScryptedInterface.OnOff,a.ScryptedInterface.Settings],type:a.ScryptedDeviceType.Siren})}if(t){const e=`${this.nativeId}-floodlight`;r.push({providerNativeId:this.plugin?.nativeId,name:`${this.name} Floodlight`,nativeId:e,info:{...this.info||{}},interfaces:[a.ScryptedInterface.OnOff,a.ScryptedInterface.Settings],type:a.ScryptedDeviceType.Light})}if(s){const e=`${this.nativeId}-pir`;r.push({providerNativeId:this.plugin?.nativeId,name:`${this.name} PIR`,nativeId:e,info:{...this.info||{}},interfaces:[a.ScryptedInterface.OnOff,a.ScryptedInterface.Settings],type:a.ScryptedDeviceType.Switch})}a.default.deviceManager.onDevicesChanged({providerNativeId:this.nativeId,devices:r})}async getSettings(){return await this.storageSettings.getSettings()}async putSetting(e,t){await this.storageSettings.putSetting(e,t)}async startIntercom(e){if(!this.intercom)throw new Error("Intercom not initialized");await this.intercom.start(e)}async stopIntercom(){if(this.intercom)return await this.intercom.stop();throw new Error("Intercom not initialized")}async updateDeviceInfo(){const{ipAddress:e,rtspChannel:t}=this.storageSettings.values;try{const s=await this.ensureClient(),r=await s.getInfo(this.nvrDevice?t:void 0);await(0,I.updateDeviceInfo)({device:this,ipAddress:e,deviceData:r})}catch(e){this.getBaichuanLogger().warn("Failed to fetch device info",e)}}async getDevice(e){return e.endsWith("-siren")?(this.siren||=new B(this,e),this.siren):e.endsWith("-floodlight")?(this.floodlight||=new Q(this,e),this.floodlight):e.endsWith("-pir")?(this.pirSensor||=new p(this,e),this.pirSensor):void 0}async releaseDevice(e,t){t.endsWith("-siren")?this.siren=void 0:t.endsWith("-floodlight")?this.floodlight=void 0:t.endsWith("-pir")&&(this.pirSensor=void 0)}async setSirenEnabled(e){const t=this.storageSettings.values.rtspChannel;await this.withBaichuanRetry((async()=>{const s=await this.ensureClient();return await s.setSiren(t,e)}))}async setFloodlightState(e,t){const s=this.storageSettings.values.rtspChannel;await this.withBaichuanRetry((async()=>{const r=await this.ensureClient();return await r.setWhiteLedState(s,e,t)}))}async setPirEnabled(e){const t=this.storageSettings.values.rtspChannel;let s,r,n;this.pirSensor&&(s=this.pirSensor.storageSettings.values.sensitive,r=this.pirSensor.storageSettings.values.reduceAlarm?1:0,n=this.pirSensor.storageSettings.values.interval),await this.withBaichuanRetry((async()=>{const A=await this.ensureClient();return await A.setPirInfo(t,{enable:e?1:0,...void 0!==s?{sensitive:s}:{},...void 0!==r?{reduceAlarm:r}:{},...void 0!==n?{interval:n}:{}})}))}async alignAuxDevicesState(){const e=this.baichuanApi;if(!e)return;const t=this.storageSettings.values.rtspChannel,{hasSiren:s,hasFloodlight:r,hasPir:n}=this.getAbilities();try{if(s&&this.siren)try{const s=await e.getSiren(t);this.siren.on=s.enabled}catch(e){this.getBaichuanLogger().debug("Failed to align siren state",e)}if(r&&this.floodlight)try{const s=await e.getWhiteLedState(t);this.floodlight.on=!!s.enabled,void 0!==s.brightness&&(this.floodlight.brightness=s.brightness)}catch(e){this.getBaichuanLogger().debug("Failed to align floodlight state",e)}if(n&&this.pirSensor)try{const s=await e.getPirInfo(t);this.pirSensor.on=s.enabled,s.state&&(void 0!==s.state.sensitive&&(this.pirSensor.storageSettings.values.sensitive=s.state.sensitive),void 0!==s.state.reduceAlarm&&(this.pirSensor.storageSettings.values.reduceAlarm=!!s.state.reduceAlarm),void 0!==s.state.interval&&(this.pirSensor.storageSettings.values.interval=s.state.interval))}catch(e){this.getBaichuanLogger().debug("Failed to align PIR state",e)}}catch(e){this.getBaichuanLogger().debug("Failed to align auxiliary devices state",e)}}addRtspCredentials(e){const{username:t,password:s}=this.storageSettings.values;if(!t)return e;try{const r=new URL(e);if("rtmp:"===r.protocol){const e=r.searchParams;e.set("user",t),e.set("password",s||"")}else r.username=t,r.password=s||"";return r.toString()}catch(t){return this.getBaichuanLogger().warn("Failed to parse URL for credentials",t),e}}getRtspAddress(){const{ipAddress:e}=this.storageSettings.values;return`${e}:${this.cachedNetPort?.rtsp?.port??554}`}getRtmpAddress(){const{ipAddress:e}=this.storageSettings.values;return`${e}:${this.cachedNetPort?.rtmp?.port??1935}`}async ensureNetPortCache(){if(this.cachedNetPort)return;const e=Date.now();if(e-this.lastNetPortCacheAttempt<this.netPortCacheBackoffMs)this.cachedNetPort={rtsp:{port:554,enable:1},rtmp:{port:1935,enable:1}};else{this.lastNetPortCacheAttempt=e;try{const e=await this.ensureClient();this.cachedNetPort=await e.getNetPort()}catch(e){this.isRecoverableBaichuanError?.(e)||this.getBaichuanLogger().warn("Failed to get net port, using defaults",e),this.cachedNetPort={rtsp:{port:554,enable:1},rtmp:{port:1935,enable:1}}}}}async getVideoStreamOptions(){const e=this.getBaichuanLogger();if(this.cachedVideoStreamOptions?.length)return this.cachedVideoStreamOptions;if(this.fetchingStreams)return[];this.fetchingStreams=!0;let t=[];const s=await this.ensureClient(),{ipAddress:r,rtspChannel:n}=this.storageSettings.values;try{await this.ensureNetPortCache()}catch(t){this.isRecoverableBaichuanError?.(t)||e.warn("Failed to ensure net port cache, falling back to Native",t)}try{t=await(0,E.buildVideoStreamOptions)({client:s,ipAddress:r,cachedNetPort:this.cachedNetPort,nvrDevice:this.nvrDevice,rtspChannel:n,logger:e})}catch(t){this.isRecoverableBaichuanError?.(t)||e.warn("Failed to build RTSP/RTMP stream options, falling back to Native",t),this.cachedNetPort=void 0}if(t.length)return this.getBaichuanLogger().log("Fetched video stream options",{streams:t,netPort:this.cachedNetPort}),this.cachedVideoStreamOptions=t,t;this.fetchingStreams=!1}async getVideoStream(e){if(!e)throw new Error("video streams not set up or no longer exists.");const t=await this.getVideoStreamOptions(),s=(0,E.selectStreamOption)(t,e);if(!(0,E.isNativeStreamId)(s.id)&&s.url&&("rtsp"===s.container||"rtmp"===s.container)){const e=this.addRtspCredentials(s.url),t={container:s.container,url:e,mediaStreamOptions:s};return await this.createMediaObject(t,a.ScryptedMimeTypes.MediaStreamUrl)}if(!this.streamManager)throw new Error("StreamManager not initialized");const r=(0,E.parseStreamProfileFromId)(s.id)||"main",n=this.storageSettings.values.rtspChannel,A=`${n}_${r}`,i=(0,E.expectedVideoTypeFromUrlMediaStreamOptions)(s);return await this.withBaichuanRetry((async()=>await(0,E.createRfc4571MediaObjectFromStreamManager)({streamManager:this.streamManager,channel:n,profile:r,streamKey:A,expectedVideoType:i,selected:s,sourceId:this.id,onDetectedCodec:e=>{const t=`native_${r}`,s=`Native ${r}`,n=(this.cachedVideoStreamOptions??[]).filter((e=>e.id!==t));n.push({name:s,id:t,container:"rtp",video:{codec:e},url:""}),this.cachedVideoStreamOptions=n}})))}async ensureClient(){return this.nvrDevice?await this.nvrDevice.ensureBaichuanClient():await this.ensureBaichuanClient()}async credentialsChanged(){this.cachedVideoStreamOptions=void 0,this.cachedNetPort=void 0}getSelectedPresetId(){const e=this.storageSettings.values.ptzSelectedPreset;if(!e)return;const t=e.includes("=")?e.split("=")[0]:e,s=Number(t);return Number.isFinite(s)?s:void 0}async refreshDeviceState(){if(this.refreshingState)return;this.refreshingState=!0;const e=this.getBaichuanLogger(),t=this.storageSettings.values.rtspChannel;try{const{capabilities:e,abilities:s,support:r,presets:n,objects:A}=await this.withBaichuanRetry((async()=>{const e=await this.ensureClient();return await e.getDeviceCapabilities(t)}));this.classes=A,this.presets=n,this.storageSettings.values.capabilities=e,this.ptzPresets.setCachedPtzPresets(n);try{const{interfaces:t,type:s}=(0,I.getDeviceInterfaces)({capabilities:e,logger:this.console}),r={nativeId:this.nativeId,providerNativeId:this.nvrDevice?.nativeId??this.plugin?.nativeId,name:this.name,interfaces:t,type:s,info:this.info};this.getBaichuanLogger().log(`Updating device interfaces: ${JSON.stringify(r)}`),await a.default.deviceManager.onDeviceDiscovered(r)}catch(e){this.getBaichuanLogger().error("Failed to update device interfaces",e)}this.getBaichuanLogger().log(`Refreshed device capabilities: ${JSON.stringify({capabilities:e,abilities:s,support:r,presets:n})}`)}catch(t){e.error("Failed to refresh abilities",t)}this.refreshingState=!1}async parentInit(){const e=this.getBaichuanLogger();try{await this.ensureClient(),await this.updateDeviceInfo()}catch(t){e.warn("Failed to update device info during init",t)}try{await this.refreshDeviceState()}catch(t){e.warn("Failed to connect/refresh during init",t)}try{await this.reportDevices()}catch(t){e.warn("Failed to report devices during init",t)}const{hasIntercom:t,hasPtz:s}=this.getAbilities();if(t&&(this.intercom=new d.ReolinkBaichuanIntercom(this)),s){const e=(this.presets||[]).map((e=>e.id+"="+e.name));this.storageSettings.settings.presets.choices=e,this.storageSettings.settings.ptzSelectedPreset.choices=e,this.storageSettings.settings.presets.hide=!1,this.storageSettings.settings.ptzMoveDurationMs.hide=!1,this.storageSettings.settings.ptzZoomStep.hide=!1,this.storageSettings.settings.ptzCreatePreset.hide=!1,this.storageSettings.settings.ptzSelectedPreset.hide=!1,this.storageSettings.settings.ptzUpdateSelectedPreset.hide=!1,this.storageSettings.settings.ptzDeleteSelectedPreset.hide=!1,this.updatePtzCaps()}const r="battery"===this.options.type,{username:n,password:A}=this.storageSettings.values;if(this.streamManager=new E.StreamManager({createStreamClient:()=>this.createStreamClient(),getLogger:()=>this.getBaichuanLogger(),credentials:{username:n,password:A},sharedConnection:r}),this.storageSettings.settings.uid.hide=!r,this.storageSettings.settings.batteryUpdateIntervalMinutes.hide=!r,this.storageSettings.settings.lowThresholdBatteryRecording.hide=!r,this.storageSettings.settings.highThresholdBatteryRecording.hide=!r,r&&!this.storageSettings.values.mixinsSetup)try{const t=a.default.systemManager.getDeviceById(this.id);t&&(e.log("Disabling prebuffer and snapshots from prebuffer"),await t.putSetting("prebuffer:enabledStreams","[]"),await t.putSetting("snapshot:snapshotsFromPrebuffer","Disabled"),this.storageSettings.values.mixinsSetup=!0)}catch(t){e.warn("Failed to setup mixins during init",t)}try{await this.subscribeToEvents()}catch(t){e.warn("Failed to subscribe to Baichuan events",t)}const{isFromNvr:i}=this.storageSettings.values;i&&this.nvrDevice&&(this.storageSettings.settings.username.hide=!0,this.storageSettings.settings.password.hide=!0,this.storageSettings.settings.ipAddress.hide=!0,this.storageSettings.settings.uid.hide=!0,this.storageSettings.settings.username.defaultValue=this.nvrDevice.storageSettings.values.username,this.storageSettings.settings.password.defaultValue=this.nvrDevice.storageSettings.values.password,this.storageSettings.settings.ipAddress.defaultValue=this.nvrDevice.storageSettings.values.ipAddress),await this.init(),this.initComplete=!0}}t.CommonCameraMixin=f},5098:(e,t,s)=>{"use strict";function r(e){const t=e?.trim();return t||void 0}function n(e){const t=e?.message||e?.toString?.()||"";return"string"==typeof t&&(t.includes("ECONNREFUSED")||t.includes("ETIMEDOUT")||t.includes("EHOSTUNREACH")||t.includes("ENETUNREACH")||t.includes("socket hang up")||t.includes("TCP connection timeout")||t.includes("Baichuan socket closed"))}async function A(e){const{inputs:t,transport:n,logger:A}=e,{ReolinkBaichuanApi:i}=await Promise.resolve().then(s.bind(s,2498)),o={host:t.host,username:t.username,password:t.password,logger:A,debugOptions:t.debugOptions??{}},a=e=>{try{e.client.on("error",(e=>{if(!A)return;const s=e?.message||e?.toString?.()||String(e);"string"==typeof s&&(s.includes("Baichuan socket closed")||s.includes("Baichuan UDP stream closed")||s.includes("Not running"))||A.error(`[BaichuanClient] error (${n}) ${t.host}: ${s}`)})),e.client.on("close",(()=>{}))}catch{}};if("tcp"===n){const e=new i({...o,transport:"tcp"});return a(e),e}const c=r(t.uid);if(!c)throw new Error("UID is required for battery cameras (BCUDP)");const l=new i({...o,transport:"udp",uid:c,idleDisconnect:!0});return a(l),l}Object.defineProperty(t,"__esModule",{value:!0}),t.normalizeUid=r,t.maskUid=function(e){const t=e.trim();return t.length<=8?t:`${t.slice(0,4)}…${t.slice(-4)}`},t.isTcpFailureThatShouldFallbackToUdp=n,t.createBaichuanApi=A,t.autoDetectDeviceType=async function(e,t){const{host:i,username:o,password:a,uid:c}=e;t.log(`[AutoDetect] Pinging ${i}...`);await async function(e,t=3e3){return new Promise((r=>{const{exec:n}=s(5317);n("win32"===process.platform?`ping -n 1 -w ${t} ${e}`:`ping -c 1 -W ${Math.floor(t/1e3)} ${e}`,(e=>{r(!e)}))}))}(i)?t.log(`[AutoDetect] Host ${i} is reachable`):t.warn(`[AutoDetect] Host ${i} is not reachable via ping, but continuing with connection attempt...`);let l;try{t.log(`[AutoDetect] Trying TCP connection to ${i}...`),l=await A({inputs:{host:i,username:o,password:a,logger:t},transport:"tcp",logger:t}),await l.login();const e=await l.getInfo(),{support:s}=await l.getDeviceCapabilities(0),r=s?.channelNum??1;return t.log(`[AutoDetect] TCP connection successful. channelNum=${r}`),r>1?(t.log(`[AutoDetect] Detected NVR (${r} channels)`),await l.close(),{type:"nvr",transport:"tcp",deviceInfo:e,channelNum:r}):(t.log("[AutoDetect] Detected regular camera (single channel)"),await l.close(),{type:"camera",transport:"tcp",deviceInfo:e,channelNum:1})}catch(e){if(l)try{await l.close()}catch{}if(!n(e))throw e;t.log("[AutoDetect] TCP failed, trying UDP (battery camera)...");const s=r(c);if(!s)throw new Error(`TCP connection failed and device likely requires UDP/BCUDP. UID is required for battery cameras (ip=${i}).`);try{const e=await A({inputs:{host:i,username:o,password:a,uid:s,logger:t},transport:"udp",logger:t});await e.login();const r=await e.getInfo();return t.log("[AutoDetect] UDP connection successful. Detected battery camera."),await e.close(),{type:"battery-cam",transport:"udp",uid:s,deviceInfo:r,channelNum:1}}catch(s){throw t.error(`[AutoDetect] Both TCP and UDP failed. TCP error: ${e}, UDP error: ${s}`),new Error(`Failed to connect via both TCP and UDP. TCP: ${e?.message||e}, UDP: ${s?.message||s}`)}}}},9560:(e,t)=>{"use strict";var s;function r(e){return{[s.General]:"general",[s.DebugRtsp]:"debugRtsp",[s.TraceStream]:"traceStream",[s.TraceTalk]:"traceTalk",[s.TraceEvents]:"traceEvents",[s.DebugH264]:"debugH264",[s.DebugParamSets]:"debugParamSets",[s.EventLogs]:null,[s.BatteryInfo]:null}[e]}Object.defineProperty(t,"__esModule",{value:!0}),t.DebugLogDisplayNames=t.DebugLogOption=void 0,t.mapDebugLogToApiOption=r,t.convertDebugLogsToApiOptions=function(e){const s={},n=new Set(e);for(const[e,A]of Object.entries(t.DebugLogDisplayNames))if(n.has(A)){const t=r(e);t&&(s[t]=!0)}return Object.keys(s).length>0?s:void 0},t.getApiRelevantDebugLogs=function(e){return e.filter((e=>null!==r(e)))},t.getDebugLogChoices=function(){return Object.values(s).map((e=>`${t.DebugLogDisplayNames[e]}`))},function(e){e.General="general",e.DebugRtsp="debugRtsp",e.TraceStream="traceStream",e.TraceTalk="traceTalk",e.TraceEvents="traceEvents",e.DebugH264="debugH264",e.DebugParamSets="debugParamSets",e.EventLogs="eventLogs",e.BatteryInfo="batteryInfo"}(s||(t.DebugLogOption=s={})),t.DebugLogDisplayNames={[s.General]:"General",[s.DebugRtsp]:"RTSP",[s.TraceStream]:"Trace stream",[s.TraceTalk]:"Trace talk",[s.TraceEvents]:"Trace events XML",[s.DebugH264]:"H264",[s.DebugParamSets]:"Video param sets",[s.EventLogs]:"Object detection events",[s.BatteryInfo]:"Battery info update"}},5741:function(e,t,s){"use strict";var r,n=this&&this.__createBinding||(Object.create?function(e,t,s,r){void 0===r&&(r=s);var n=Object.getOwnPropertyDescriptor(t,s);n&&!("get"in n?!t.__esModule:n.writable||n.configurable)||(n={enumerable:!0,get:function(){return t[s]}}),Object.defineProperty(e,r,n)}:function(e,t,s,r){void 0===r&&(r=s),e[r]=t[s]}),A=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),i=this&&this.__importStar||(r=function(e){return r=Object.getOwnPropertyNames||function(e){var t=[];for(var s in e)Object.prototype.hasOwnProperty.call(e,s)&&(t[t.length]=s);return t},r(e)},function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var s=r(e),i=0;i<s.length;i++)"default"!==s[i]&&n(t,e,s[i]);return A(t,e),t});Object.defineProperty(t,"__esModule",{value:!0}),t.ReolinkBaichuanIntercom=void 0;const o=i(s(7562)),a=s(1421);t.ReolinkBaichuanIntercom=class{constructor(e){this.camera=e,this.loggedCodecInfo=!1,this.maxBacklogMs=40,this.sendChain=Promise.resolve(),this.pcmBuffer=Buffer.alloc(0)}get blocksPerPayload(){return Math.max(1,Math.min(8,this.camera.storageSettings.values.intercomBlocksPerPayload??1))}async start(e){const t=this.camera.getBaichuanLogger(),s=await o.default.mediaManager.convertMediaObjectToJSON(e,o.ScryptedMimeTypes.FFmpegInput);await this.stop();const r=this.camera.storageSettings.values.rtspChannel;if(!this.loggedCodecInfo){this.loggedCodecInfo=!0;try{const e=await this.camera.ensureClient(),s=await e.getTalkAbility(r),n=s.audioConfigList?.map((e=>({audioType:e.audioType,sampleRate:e.sampleRate,samplePrecision:e.samplePrecision,lengthPerEncoder:e.lengthPerEncoder,soundTrack:e.soundTrack})));t.log("Intercom TalkAbility",{channel:r,duplexList:s.duplexList,audioStreamModeList:s.audioStreamModeList,audioConfigList:n})}catch(e){t.warn("Intercom: unable to fetch TalkAbility",e)}}const n=await this.camera.withBaichuanRetry((async()=>{const e=await this.camera.ensureClient();if("battery"===this.camera.options?.type)try{"sleeping"===e.getSleepStatus({channel:r}).state&&(t.log("Camera is sleeping, waking up for intercom..."),await e.wakeUp(r,{waitAfterWakeMs:2e3}),await new Promise((e=>setTimeout(e,1e3))))}catch(e){t.debug("Failed to check/wake camera for intercom, proceeding anyway",e)}return await e.createTalkSession(r,{blocksPerPayload:this.blocksPerPayload})}));this.session=n,this.pcmBuffer=Buffer.alloc(0),this.sendChain=Promise.resolve();const{audioConfig:A,blockSize:i,fullBlockSize:c}=n.info,l=A.sampleRate,h=2*i+1,g=2*h;if(this.maxBacklogBytes=Math.max(g,Math.floor(this.maxBacklogMs/1e3*l*1*2)),!Number.isFinite(l)||l<=0)throw await this.stop(),new Error(`Invalid talk sampleRate: ${l}`);if(!Number.isFinite(i)||i<=0||!Number.isFinite(c)||c!==i+4)throw await this.stop(),new Error(`Invalid talk block sizes: blockSize=${i} fullBlockSize=${c}`);t.log("Starting intercom (baichuan/native-api flow)",{channel:r,audioType:A.audioType,sampleRate:A.sampleRate,samplePrecision:A.samplePrecision,lengthPerEncoder:A.lengthPerEncoder,soundTrack:A.soundTrack,blockSize:i,fullBlockSize:c,samplesPerBlock:h,bytesNeeded:g,maxBacklogMs:this.maxBacklogMs,maxBacklogBytes:this.maxBacklogBytes,blocksPerPayload:this.blocksPerPayload});const d=this.buildFfmpegPcmArgs(s,{sampleRate:l,channels:1});t.log("Intercom ffmpeg decode args",d);const u=(0,a.spawn)("ffmpeg",d,{stdio:["ignore","pipe","pipe"]});if(this.session!==n){try{u.kill("SIGKILL")}catch{}return}this.ffmpeg=u,u.stdout.on("data",(e=>{this.session===n&&e?.length&&this.enqueuePcm(n,e,g,i)}));let E=0;u.stderr.on("data",(e=>{E++<12&&t.warn("Intercom ffmpeg",e.toString().trim())})),u.on("exit",((e,s)=>{t.warn(`Intercom ffmpeg exited code=${e} signal=${s}`),this.stop().catch((()=>{}))})),t.log("Intercom started (ffmpeg decode -> PCM -> IMA ADPCM)")}stop(){return this.stopping||(this.stopping=(async()=>{const e=this.camera.getBaichuanLogger(),t=this.ffmpeg;this.ffmpeg=void 0;const s=this.session;this.session=void 0,this.pcmBuffer=Buffer.alloc(0);const r=async e=>new Promise((t=>setTimeout(t,e)));if(t&&null==t.exitCode){try{t.kill("SIGKILL")}catch{}try{await Promise.race([new Promise((e=>t.once("exit",(()=>e())))),r(1e3)])}catch{}}try{await Promise.race([this.sendChain,r(250)])}catch{}if(this.sendChain=Promise.resolve(),s)try{await Promise.race([s.stop(),r(2e3)])}catch(t){e.warn("Intercom session stop error",t)}})().finally((()=>{this.stopping=void 0}))),this.stopping}clamp16(e){return e>32767?32767:e<-32768?-32768:0|e}enqueuePcm(e,t,s,r){const n=this.camera.getBaichuanLogger();this.sendChain=this.sendChain.then((async()=>{if(this.session!==e)return;this.pcmBuffer=this.pcmBuffer.length?Buffer.concat([this.pcmBuffer,t]):t;const n=this.maxBacklogBytes??s;if(this.pcmBuffer.length>n){const e=n-n%2;this.pcmBuffer=this.pcmBuffer.subarray(this.pcmBuffer.length-e)}for(;this.pcmBuffer.length>=s;){const t=this.pcmBuffer.subarray(0,s);this.pcmBuffer=this.pcmBuffer.subarray(s);const n=new Int16Array(t.buffer,t.byteOffset,t.length/2),A=this.encodeImaAdpcm(n,r);await e.sendAudio(A)}})).catch((e=>{n.warn("Intercom PCM->ADPCM pipeline error",e)}))}buildFfmpegPcmArgs(e,t){const s=e.inputArguments??[],r=[];let n;for(let e=0;e<s.length;e++){const t=s[e];if("-i"===t){const t=s[e+1];if("string"==typeof t){n||(n=t),e++;continue}}r.push(t)}const A=n??e.url;if(!A)throw new Error("FFmpegInput missing url/input");return[...r,"-i",A,"-map","0:a:0?","-fflags","nobuffer","-flags","low_delay","-flush_packets","1","-vn","-sn","-dn","-acodec","pcm_s16le","-ar",t.sampleRate.toString(),"-ac",t.channels.toString(),"-f","s16le","pipe:1"]}encodeImaAdpcm(e,t){const s=2*t+1,r=Math.ceil(e.length/s),n=[],A=Int8Array.from([-1,-1,-1,-1,2,4,6,8,-1,-1,-1,-1,2,4,6,8]),i=Int16Array.from([7,8,9,10,11,12,13,14,16,17,19,21,23,25,28,31,34,37,41,45,50,55,60,66,73,80,88,97,107,118,130,143,157,173,190,209,230,253,279,307,337,371,408,449,494,544,598,658,724,796,876,963,1060,1166,1282,1411,1552,1707,1878,2066,2272,2499,2749,3024,3327,3660,4026,4428,4871,5358,5894,6484,7132,7845,8630,9493,10442,11487,12635,13899,15289,16818,18500,20350,22385,24623,27086,29794,32767]);let o=0;for(let s=0;s<r;s++){const s=Buffer.alloc(4+t);let r=e[o]??0,a=0;s.writeInt16LE(r,0),s.writeUInt8(a,2),s.writeUInt8(0,3),o++;const c=new Uint8Array(2*t);for(let t=0;t<c.length;t++){const s=e[o]??r;o++;let n=s-r,l=0;n<0&&(l=8,n=-n);let h=i[a]??7,g=0,d=h>>3;n>=h&&(g|=4,n-=h,d+=h),h>>=1,n>=h&&(g|=2,n-=h,d+=h),h>>=1,n>=h&&(g|=1,d+=h),l?r-=d:r+=d,r=this.clamp16(r),a+=A[g]??0,a<0&&(a=0),a>88&&(a=88),c[t]=15&(g|l)}for(let e=0;e<t;e++){const t=c[2*e]??0,r=c[2*e+1]??0;s[4+e]=15&t|(15&r)<<4}n.push(s)}return Buffer.concat(n)}}},7927:function(e,t,s){"use strict";var r,n=this&&this.__createBinding||(Object.create?function(e,t,s,r){void 0===r&&(r=s);var n=Object.getOwnPropertyDescriptor(t,s);n&&!("get"in n?!t.__esModule:n.writable||n.configurable)||(n={enumerable:!0,get:function(){return t[s]}}),Object.defineProperty(e,r,n)}:function(e,t,s,r){void 0===r&&(r=s),e[r]=t[s]}),A=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),i=this&&this.__importStar||(r=function(e){return r=Object.getOwnPropertyNames||function(e){var t=[];for(var s in e)Object.prototype.hasOwnProperty.call(e,s)&&(t[t.length]=s);return t},r(e)},function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var s=r(e),i=0;i<s.length;i++)"default"!==s[i]&&n(t,e,s[i]);return A(t,e),t});Object.defineProperty(t,"__esModule",{value:!0});const o=i(s(7562)),a=s(4417),c=s(6125),l=s(5582),h=s(5098),g=s(6185);class d extends o.ScryptedDeviceBase{constructor(e){super(e),this.devices=new Map;const t=o.default.systemManager.getDeviceByName("Scrypted NVR");this.nvrDeviceId=t?.id}getScryptedDeviceCreator(){return"Reolink Native camera"}async getDevice(e){if(this.devices.has(e))return this.devices.get(e);const t=this.createCamera(e);return this.devices.set(e,t),t}async createDevice(e,t){const s=e.ip?.toString(),r=e.username?.toString(),n=e.password?.toString(),A=e.uid?.toString();if(!s||!r||!n)throw new Error("IP address, username, and password are required");this.console.log(`[AutoDetect] Starting device type detection for ${s}...`);const i=await(0,h.autoDetectDeviceType)({host:s,username:r,password:n,uid:A,logger:this.console},this.console);if(this.console.log(`[AutoDetect] Detected device type: ${i.type} (transport: ${i.transport})`),"nvr"===i.type){const A=i.deviceInfo||{},a=A?.name||"Reolink NVR";t=`${A?.serialNumber||A?.itemNo||`nvr-${Date.now()}`}-nvr`,e.newCamera||=a,await o.default.deviceManager.onDeviceDiscovered({nativeId:t,name:a,interfaces:[o.ScryptedInterface.Settings,o.ScryptedInterface.DeviceDiscovery,o.ScryptedInterface.DeviceProvider,o.ScryptedInterface.Reboot],type:o.ScryptedDeviceType.DeviceProvider,providerNativeId:this.nativeId});const c=await this.getDevice(t);if(!(c instanceof l.ReolinkNativeNvrDevice))throw new Error("Expected NVR device but got different type");return c.storageSettings.values.ipAddress=s,c.storageSettings.values.username=r,c.storageSettings.values.password=n,t}const a=i.deviceInfo||{},c=a?.name||"Reolink Camera",d=a?.serialNumber||a?.itemNo||`unknown-${Date.now()}`;t="battery-cam"===i.type?`${d}-battery-cam`:`${d}-cam`,e.newCamera||=c;const u=await(0,h.createBaichuanApi)({inputs:{host:s,username:r,password:n,uid:i.uid,logger:this.console},transport:i.transport,logger:this.console});try{await u.login();const e=0,{abilities:A,capabilities:h,objects:d,presets:E}=await u.getDeviceCapabilities(e);this.console.log(JSON.stringify({abilities:A,capabilities:h,deviceInfo:a}));const{interfaces:I,type:C}=(0,g.getDeviceInterfaces)({capabilities:h,logger:this.console});await o.default.deviceManager.onDeviceDiscovered({nativeId:t,name:c,interfaces:I,type:C,providerNativeId:this.nativeId});const B=await this.getDevice(t);if(B instanceof l.ReolinkNativeNvrDevice)throw new Error("NVR device should not reach this code path");return B.info=a,B.classes=d,B.presets=E,B.storageSettings.values.username=r,B.storageSettings.values.password=n,B.storageSettings.values.rtspChannel=e,B.storageSettings.values.ipAddress=s,B.storageSettings.values.capabilities=h,B.storageSettings.values.uid=i.uid,t}catch(e){throw this.console.error("Error adding Reolink device",e),e}finally{await u.close()}}async releaseDevice(e,t){if(this.devices.has(t)){const e=this.devices.get(t);e&&"release"in e&&"function"==typeof e.release&&await e.release(),this.devices.delete(t)}}async getCreateDeviceSettings(){return[{key:"ip",title:"IP Address",placeholder:"192.168.2.222"},{key:"username",title:"Username"},{key:"password",title:"Password",type:"password"},{key:"uid",title:"UID",description:"Reolink UID (optional, required for battery cameras if TCP connection fails)"}]}createCamera(e){return e.endsWith("-battery-cam")?new c.ReolinkNativeBatteryCamera(e,this):e.endsWith("-nvr")?new l.ReolinkNativeNvrDevice(e,this):new a.ReolinkNativeCamera(e,this)}}t.default=d},5582:function(e,t,s){"use strict";var r,n=this&&this.__createBinding||(Object.create?function(e,t,s,r){void 0===r&&(r=s);var n=Object.getOwnPropertyDescriptor(t,s);n&&!("get"in n?!t.__esModule:n.writable||n.configurable)||(n={enumerable:!0,get:function(){return t[s]}}),Object.defineProperty(e,r,n)}:function(e,t,s,r){void 0===r&&(r=s),e[r]=t[s]}),A=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),i=this&&this.__importStar||(r=function(e){return r=Object.getOwnPropertyNames||function(e){var t=[];for(var s in e)Object.prototype.hasOwnProperty.call(e,s)&&(t[t.length]=s);return t},r(e)},function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var s=r(e),i=0;i<s.length;i++)"default"!==s[i]&&n(t,e,s[i]);return A(t,e),t});Object.defineProperty(t,"__esModule",{value:!0}),t.ReolinkNativeNvrDevice=void 0;const o=i(s(7562)),a=s(6117),c=s(7077),l=s(4417),h=s(6125),g=s(5098),d=s(6185);class u extends c.BaseBaichuanClass{constructor(e,t){super(e),this.storageSettings=new a.StorageSettings(this,{debugEvents:{title:"Debug Events",type:"boolean",immediate:!0},eventSource:{title:"Event Source",description:"Select the source for camera events: Native (Baichuan) or CGI (HTTP polling)",type:"string",choices:["Native","CGI"],defaultValue:"Native",immediate:!0,onPut:async()=>{await this.reinitEventSubscriptions()}},ipAddress:{title:"IP address",type:"string",onPut:async()=>await this.reinit()},username:{title:"Username",placeholder:"admin",defaultValue:"admin",type:"string",onPut:async()=>await this.reinit()},password:{title:"Password",type:"password",onPut:async()=>await this.reinit()}}),this.discoveredDevices=new Map,this.cameraNativeMap=new Map,this.channelToNativeIdMap=new Map,this.processing=!1,this.plugin=t,setTimeout((async()=>{await this.init()}),5e3)}async reboot(){const e=await this.ensureClient();await e.Reboot()}getConnectionConfig(){const{ipAddress:e,username:t,password:s}=this.storageSettings.values;if(!e||!t||!s)throw new Error("Missing NVR credentials");return{host:e,username:t,password:s,transport:"tcp",logger:this.console}}getConnectionCallbacks(){return{onError:void 0,onClose:async()=>{await this.reinit()},onSimpleEvent:e=>this.forwardNativeEvent(e),getEventSubscriptionEnabled:()=>"Native"===(this.storageSettings.values.eventSource||"Native")}}isDebugEnabled(){return this.storageSettings.values.debugEvents||!1}getDeviceName(){return this.name||"NVR"}async onBeforeCleanup(){await this.unsubscribeFromAllEvents()}async reinit(){if(this.nvrApi)try{await this.nvrApi.logout()}catch{}this.nvrApi=void 0,await super.cleanupBaichuanApi()}async ensureClient(){if(this.nvrApi)return this.nvrApi;const{ipAddress:e,username:t,password:r}=this.storageSettings.values;if(!e||!t||!r)throw new Error("Missing NVR credentials");const{ReolinkCgiApi:n}=await Promise.resolve().then(s.bind(s,2498));return this.nvrApi=new n({host:e,username:t,password:r}),await this.nvrApi.login(),this.nvrApi}forwardNativeEvent(e){const t=this.getBaichuanLogger();if("Native"===(this.storageSettings.values.eventSource||"Native"))try{t.debug(`Baichuan event: ${JSON.stringify(e)}`);const s=e?.channel;if(void 0===s)return void t.debug("Event has no channel, ignoring");const r=this.channelToNativeIdMap.get(s),n=r?this.cameraNativeMap.get(r):void 0;if(!n)return void t.debug(`No camera found for channel ${s}, ignoring event`);const A=[];let i=!1;switch(e?.type){case"motion":i=!0;break;case"doorbell":try{"function"==typeof n.handleDoorbellEvent&&n.handleDoorbellEvent()}catch(e){t.warn(`Error handling doorbell event for camera channel ${s}`,e)}i=!0;break;case"people":case"vehicle":case"animal":case"face":case"package":case"other":A.push(e.type),i=!0;break;default:return void t.debug(`Unknown event type: ${e?.type}`)}n.processEvents({motion:i,objects:A}).catch((e=>{t.warn(`Error processing events for camera channel ${s}`,e)}))}catch(e){t.warn("Error in NVR Native event forwarder",e)}}async ensureBaichuanClient(){return await super.ensureBaichuanClient()}async subscribeToAllEvents(){const e=this.getBaichuanLogger();"Native"===(this.storageSettings.values.eventSource||"Native")?(await super.subscribeToEvents(),e.log("Subscribed to all events for NVR cameras")):await this.unsubscribeFromAllEvents()}async unsubscribeFromAllEvents(){await super.unsubscribeFromEvents()}async reinitEventSubscriptions(){const e=this.getBaichuanLogger(),{eventSource:t}=this.storageSettings.values;"Native"!==t?await this.unsubscribeFromAllEvents():this.subscribeToAllEvents().catch((t=>{e.warn("Failed to subscribe to Native events",t)})),e.log(`Event source set to: ${t}`)}forwardCgiEvents(e){this.getBaichuanLogger().debug(`CGI Events call result: ${JSON.stringify(e)}`);for(const[t,s]of this.channelToNativeIdMap.entries()){const r=s?this.cameraNativeMap.get(s):void 0,n=e[t];n&&r&&r.processEvents(n)}}async init(){const e=await this.ensureClient(),t=this.getBaichuanLogger();await this.updateDeviceInfo(),await this.reinitEventSubscriptions(),setInterval((async()=>{if(!this.processing&&e){this.processing=!0;try{const s=Date.now();if((!this.lastErrorsCheck||s-this.lastErrorsCheck>6e4)&&(this.lastErrorsCheck=s),!this.lastHubInfoCheck||s-this.lastHubInfoCheck>3e5){t.log("Starting Hub info data fetch"),this.lastHubInfoCheck=s;const{hubData:r}=await e.getHubInfo(),{devicesData:n,channelsResponse:A,response:i}=await e.getDevicesInfo();t.log("Hub info data fetched"),t.debug(`${JSON.stringify({hubData:r,devicesData:n,channelsResponse:A,response:i})}`),await this.discoverDevices(!0)}const{eventSource:r}=this.storageSettings.values;if("CGI"===r){const t=await e.getAllChannelsEvents();this.forwardCgiEvents(t.parsed)}const{batteryInfoData:n,response:A}=await e.getAllChannelsBatteryInfo();t.debug(`Battery info call result: ${JSON.stringify({batteryInfoData:n,response:A})}`),this.cameraNativeMap.forEach((e=>{if(e){const t=e.storageSettings.values.rtspChannel,s=n[t];s&&e.updateSleepingState({reason:"NVR",state:s.sleeping?"sleeping":"awake",idleMs:0,lastRxAtMs:0}).catch((()=>{}))}}))}catch(e){t.error("Error on events flow",e)}finally{this.processing=!1}}}),1e3)}async updateDeviceInfo(){const{ipAddress:e}=this.storageSettings.values;try{const t=await this.ensureClient(),s=await t.getInfo();await(0,d.updateDeviceInfo)({device:this,ipAddress:e,deviceData:s})}catch(e){this.getBaichuanLogger().warn("Failed to fetch device info",e)}}async getSettings(){return await this.storageSettings.getSettings()}async putSetting(e,t){return this.storageSettings.putSetting(e,t)}async releaseDevice(e,t){this.cameraNativeMap.delete(t)}async getDevice(e){let t=this.cameraNativeMap.get(e);return t||(t=e.endsWith("-battery-cam")?new h.ReolinkNativeBatteryCamera(e,this.plugin,this):new l.ReolinkNativeCamera(e,this.plugin,this),this.cameraNativeMap.set(e,t)),t}buildNativeId(e,t,s){const r=s?"-battery-cam":"-cam";return t?`${this.nativeId}-ch${e}-${t}${r}`:`${this.nativeId}-ch${e}${r}`}getCameraInterfaces(){return[o.ScryptedInterface.VideoCameraConfiguration,o.ScryptedInterface.Camera,o.ScryptedInterface.MotionSensor,o.ScryptedInterface.VideoTextOverlays,o.ScryptedInterface.VideoCamera,o.ScryptedInterface.Settings,o.ScryptedInterface.ObjectDetector]}async syncEntitiesFromRemote(){const e=await this.ensureClient(),t=this.getBaichuanLogger();t.log("Starting channels discovery using getDevicesInfo...");const{devicesData:s,channels:r}=await e.getDevicesInfo();t.log(`getDevicesInfo completed. Found ${r.length} channels.`);for(const e of r)try{const{channelStatus:r,channelInfo:n,abilities:A}=s[e],i=r?.name,a=r?.uid,c=!!A?.battery?.ver,l=this.buildNativeId(e,a,c),h=[o.ScryptedInterface.VideoCamera];c&&h.push(o.ScryptedInterface.Battery);const g=A.supportDoorbellLight?o.ScryptedDeviceType.Doorbell:o.ScryptedDeviceType.Camera,d={nativeId:l,name:i,providerNativeId:this.nativeId,interfaces:h,type:g,info:{manufacturer:"Reolink",model:n?.typeInfo,serialNumber:a}};if(this.channelToNativeIdMap.set(e,l),o.default.deviceManager.getNativeIds().includes(l))continue;if(this.discoveredDevices.has(l))continue;this.discoveredDevices.set(l,{device:d,description:`${i} (Channel ${e})`,rtspChannel:e,deviceData:s[e]}),t.debug(`Discovered channel ${e}: ${i}`)}catch(s){t.debug(`Error processing channel ${e}: ${s?.message||String(s)}`)}t.log(`Channel discovery completed. Found ${this.discoveredDevices.size} devices.`)}async discoverDevices(e){return e&&await this.syncEntitiesFromRemote(),[...this.discoveredDevices.values()].map((e=>({...e.device,description:e.description})))}async adoptDevice(e){const t=this.discoveredDevices.get(e.nativeId);if(!t)throw new Error("device not found");await this.onDeviceEvent(o.ScryptedInterface.DeviceDiscovery,await this.discoverDevices());const r=t.device.interfaces.includes(o.ScryptedInterface.Battery),{channelStatus:n}=t.deviceData,{ReolinkBaichuanApi:A}=await Promise.resolve().then(s.bind(s,2498)),i=n?.uid,a=r&&i?(0,g.normalizeUid)(i):void 0,c=new A({host:this.storageSettings.values.ipAddress,username:this.storageSettings.values.username,password:this.storageSettings.values.password,transport:"tcp",channel:t.rtspChannel,...a?{uid:a}:{}});await c.login();const{capabilities:l,objects:h,presets:u}=await c.getDeviceCapabilities(t.rtspChannel),{interfaces:E,type:I}=(0,d.getDeviceInterfaces)({capabilities:l,logger:this.console}),C={...t.device,interfaces:E,type:I};await o.default.deviceManager.onDeviceDiscovered(C);const B=await this.getDevice(e.nativeId);this.getBaichuanLogger().debug("Adopted device",t,B?.name);const{username:Q,password:p,ipAddress:f}=this.storageSettings.values;return B.storageSettings.values.rtspChannel=t.rtspChannel,B.classes=h,B.presets=u,B.storageSettings.values.username=Q,B.storageSettings.values.password=p,B.storageSettings.values.rtspChannel=t.rtspChannel,B.storageSettings.values.ipAddress=f,B.storageSettings.values.capabilities=l,B.storageSettings.values.uid=t.deviceData.channelStatus.uid,B.storageSettings.values.isFromNvr=!0,this.discoveredDevices.delete(e.nativeId),B?.id}}t.ReolinkNativeNvrDevice=u},840:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ReolinkPtzPresets=void 0;t.ReolinkPtzPresets=class{constructor(e){this.camera=e}get storageSettings(){return this.camera.storageSettings}getPtzCapabilitiesStore(){return this.camera.ptzCapabilities}setPtzCapabilitiesStore(e){this.camera.ptzCapabilities=e}parsePresetIdFromSettingValue(e){const t=String(e??"").trim();if(!t)return;const s=t.includes("=")?t.split("=")[0]:t,r=Number(s);return Number.isFinite(r)?r:void 0}syncEnabledPresetsSettingAndCaps(e){const t=this.storageSettings.values.presets??[];if(!t.length)return;const s=new Map(e.map((e=>[e.id,e.name]))),r={};for(const e of t){const t=this.parsePresetIdFromSettingValue(e);if(void 0===t)continue;const n=(e.includes("=")?e.substring(e.indexOf("=")+1).trim():"")||s.get(t);n&&(r[String(t)]=n)}this.setPtzCapabilitiesStore({...this.getPtzCapabilitiesStore()??{},presets:r})}setCachedPtzPresets(e){const t=Array.isArray(e)?e:[];this.camera.presets=t;const s={};for(const e of t)s[String(e.id)]=e.name;this.setPtzCapabilitiesStore({...this.getPtzCapabilitiesStore()??{},presets:s})}getCachedPtzPresets(){const e=this.camera.presets;return Array.isArray(e)?e:[]}nextFreePresetId(e){const t=new Set(e.map((e=>e.id)));for(let e=1;e<=255;e++)if(!t.has(e))return e;throw new Error("No free PTZ preset id available (1..255)")}async refreshPtzPresets(){const e=await this.camera.ensureClient(),t=this.camera.storageSettings.values.rtspChannel,s=await e.getPtzPresets(t);return this.setCachedPtzPresets(s),this.syncEnabledPresetsSettingAndCaps(s),s}async moveToPreset(e){const t=await this.camera.ensureClient(),s=this.camera.storageSettings.values.rtspChannel;await t.moveToPtzPreset(s,e)}async createPtzPreset(e,t){const s=await this.camera.ensureClient(),r=this.camera.storageSettings.values.rtspChannel,n=String(e??"").trim();if(!n)throw new Error("Preset name is required");const A=await s.getPtzPresets(r),i=new Set(A.map((e=>e.id))),o=t??this.nextFreePresetId(A);if(void 0===t&&i.has(o))throw new Error(`PTZ preset id already in use: ${o}`);await s.setPtzPreset(r,o,n);const a=await s.getPtzPresets(r),c=a.some((e=>e.id===o));if(this.setCachedPtzPresets(a),!c)throw this.syncEnabledPresetsSettingAndCaps(a),new Error("PTZ preset save did not persist (camera returned an empty/unchanged preset list). Try again.");const l=this.storageSettings.values.presets??[];if(l.length){l.some((e=>this.parsePresetIdFromSettingValue(e)===o))||(l.push(`${o}=${n}`),this.storageSettings.values.presets=l)}return this.syncEnabledPresetsSettingAndCaps(a),{id:o,name:n}}async updatePtzPresetToCurrentPosition(e){const t=await this.camera.ensureClient(),s=this.camera.storageSettings.values.rtspChannel,r=this.getCachedPtzPresets().find((t=>t.id===e)),n=r?.name??`Preset ${e}`;await t.setPtzPreset(s,e,n),await this.refreshPtzPresets()}async deletePtzPreset(e){const t=await this.camera.ensureClient(),s=this.camera.storageSettings.values.rtspChannel;await t.deletePtzPreset(s,e);const r=this.storageSettings.values.presets;if(Array.isArray(r)&&r.length){const t=r.filter((e=>"string"==typeof e)).filter((t=>this.parsePresetIdFromSettingValue(t)!==e));this.storageSettings.values.presets=t}await this.refreshPtzPresets()}async renamePtzPreset(e,t){const s=await this.camera.ensureClient(),r=this.camera.storageSettings.values.rtspChannel,n=String(t??"").trim();if(!n)throw new Error("Preset name is required");await s.moveToPtzPreset(r,e),await s.setPtzPreset(r,e,n),await this.refreshPtzPresets()}}},5050:function(e,t,s){"use strict";var r=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.StreamManager=void 0,t.parseStreamProfileFromId=function(e){if(!e)return;if(e.startsWith("native_")){return e.replace("native_","")}if(e.endsWith(".bcs")){return e.replace(".bcs","")}if(e.startsWith("h264Preview_")){if(e.endsWith("_main"))return"main";if(e.endsWith("_sub"))return"sub"}return},t.isNativeStreamId=function(e){return e?.startsWith("native_")??!1},t.fetchVideoStreamOptionsFromApi=A,t.buildVideoStreamOptions=async function(e){const{client:t,ipAddress:s,cachedNetPort:r,rtspChannel:n,logger:i,nvrDevice:o}=e,a=[],c=[],l=r||await t.getNetPort(),h=1===l.rtsp?.enable,g=1===l.rtmp?.enable,d=l.rtsp?.port??554,u=l.rtmp?.port??1935,E=await t.getStreamMetadata(n),I=E?.streams||[];for(const e of I){const t=e.profile,r=String(e.videoEncType||"").includes("264")?"h264":String(e.videoEncType||"").includes("265")?"h265":String(e.videoEncType||"").toLowerCase();if(h&&"ext"!==t){const A=String(n+1).padStart(2,"0"),i="main"===t?"main":"sub",o=`/h264Preview_${A}_${i}`,c=`h264Preview_${A}_${i}`;a.push({name:`RTSP ${c}`,id:c,container:"rtsp",video:{codec:r,width:e.width,height:e.height},url:`rtsp://${s}:${d}${o}`})}if(g){const A="main"===t?"main":"sub"===t?"sub":"ext",i="sub"===t?1:0,o=`${A}.bcs`,a=new URL(`rtmp://${s}:${u}${`/bcs/channel${n}_${A}.bcs`}`),l=a.searchParams;l.set("channel",n.toString()),l.set("stream",i.toString()),c.push({name:`RTMP ${o}`,id:o,container:"rtmp",video:{codec:r,width:e.width,height:e.height},url:a.toString()})}}const C=await A(t,n,i);let B=[];B=o&&"HOMEHUB"===o.info.model?[...C,...a,...c]:[...a,...c,...C];return B},t.selectStreamOption=function(e,t){if(!t)throw new Error("video streams not set up or no longer exists.");const s=e?.find((e=>e.id===t.id))||e?.[0];if(!s)throw new Error("No stream options available");return s},t.expectedVideoTypeFromUrlMediaStreamOptions=function(e){const t=e?.video?.codec;return"string"!=typeof t?void 0:t.includes("265")?"H265":t.includes("264")?"H264":void 0},t.createRfc4571MediaObjectFromStreamManager=async function(e){const{streamManager:t,channel:s,profile:r,streamKey:A,expectedVideoType:i,selected:o,sourceId:a,onDetectedCodec:c}=e,{host:l,port:h,sdp:g,audio:d,username:u,password:E}=await t.getRfcStream(s,r,A,i);try{const e=/a=rtpmap:\d+\s+(H26[45])\//.exec(g)?.[1];if(e){const t="H265"===e?"h265":"h264";c?.(t)}}catch{}const{url:I,...C}=o;C.container="rtp",d&&(C.audio||={},C.audio.codec=d.codec,C.audio.sampleRate=d.sampleRate,C.audio.channels=d.channels);const B=encodeURIComponent(u||""),Q=encodeURIComponent(E||""),p={url:`tcp://${B}:${Q}@${l}:${h}`,sdp:g,mediaStreamOptions:C};return await n.default.mediaManager.createMediaObject(Buffer.from(JSON.stringify(p)),"x-scrypted/x-rfc4571",{sourceId:a})};const n=r(s(7562));async function A(e,t,s){const r=await e.getStreamMetadata(t),n=[],A=r?.streams||[];for(const e of A){const t=e.profile,s=String(e.videoEncType||"").includes("264")?"h264":String(e.videoEncType||"").includes("265")?"h265":String(e.videoEncType||"").toLowerCase();n.push({name:`Native ${t}`,id:`native_${t}`,container:"rtp",video:{codec:s,width:e.width,height:e.height},url:""})}return n}t.StreamManager=class{constructor(e){this.opts=e,this.nativeRfcServers=new Map,this.nativeRfcServerCreatePromises=new Map}getLogger(){return this.opts.getLogger()}async ensureNativeRfcServer(e,t,r,n){const A=this.nativeRfcServerCreatePromises.get(e);if(A)return await A;const i=(async()=>{const A=this.nativeRfcServers.get(e);if(A?.server?.listening){if(!n||A.videoType===n)return{host:A.host,port:A.port,sdp:A.sdp,audio:A.audio,username:A.username||this.opts.credentials.username,password:A.password||this.opts.credentials.password};this.getLogger().warn(`Native RFC cache codec mismatch for ${e}: cached=${A.videoType} expected=${n}; recreating server.`)}if(A){try{await A.close("recreate")}catch{}this.nativeRfcServers.delete(e)}const i=await this.opts.createStreamClient(),{createScryptedRfc4571TcpServer:o}=await Promise.resolve().then(s.bind(s,2498)),{username:a,password:c}=this.opts.credentials,l=!this.opts.sharedConnection,h=await o({api:i,channel:t,profile:r,logger:this.getLogger(),expectedVideoType:n,closeApiOnTeardown:l,username:a,password:c});return this.nativeRfcServers.set(e,h),h.server.once("close",(()=>{const t=this.nativeRfcServers.get(e);t?.server===h.server&&this.nativeRfcServers.delete(e)})),{host:h.host,port:h.port,sdp:h.sdp,audio:h.audio,username:h.username||this.opts.credentials.username,password:h.password||this.opts.credentials.password}})();this.nativeRfcServerCreatePromises.set(e,i);try{return await i}finally{this.nativeRfcServerCreatePromises.delete(e)}}async getRfcStream(e,t,s,r){return await this.ensureNativeRfcServer(s,e,t,r)}async closeAllStreams(e){const t=Array.from(this.nativeRfcServers.values());this.nativeRfcServers.clear(),await Promise.allSettled(t.map((async t=>{try{await t.close(e||"connection reset")}catch(e){this.getLogger().debug("Error closing stream server",e)}})))}}},6185:(e,t,s)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.updateDeviceInfo=t.getDeviceInterfaces=void 0;const r=s(7562);t.getDeviceInterfaces=e=>{const{capabilities:t,logger:s}=e,n=[r.ScryptedInterface.VideoCamera,r.ScryptedInterface.Settings,r.ScryptedInterface.Reboot,r.ScryptedInterface.VideoCameraConfiguration,r.ScryptedInterface.Camera,r.ScryptedInterface.AudioSensor,r.ScryptedInterface.MotionSensor,r.ScryptedInterface.VideoTextOverlays];try{const{hasPtz:e,hasSiren:s,hasFloodlight:A,hasPir:i,hasBattery:o,hasIntercom:a,isDoorbell:c}=t;e&&n.push(r.ScryptedInterface.PanTiltZoom),n.push(r.ScryptedInterface.ObjectDetector),(s||A||i)&&n.push(r.ScryptedInterface.DeviceProvider),o&&n.push(r.ScryptedInterface.Battery,r.ScryptedInterface.Sleep),a&&n.push(r.ScryptedInterface.Intercom),c&&n.push(r.ScryptedInterface.BinarySensor)}catch(e){s.error("Error getting device interfaces",e)}return{interfaces:n,type:t.isDoorbell?r.ScryptedDeviceType.Doorbell:r.ScryptedDeviceType.Camera}};t.updateDeviceInfo=async e=>{const{device:t,ipAddress:s,deviceData:r}=e;try{const e=t.info||{};e.ip=s,e.serialNumber=r?.serialNumber||r?.itemNo,e.firmware=r?.firmwareVersion,e.version=r?.hardwareVersion,e.model=r?.type,e.manufacturer="Reolink",e.managementUrl=`http://${s}`,t.info=e}catch(e){const r=t.info||{};throw r.ip=s,r.manufacturer="Reolink native",r.managementUrl=`http://${s}`,t.info=r,e}}},5317:e=>{"use strict";e.exports=require("child_process")},4434:e=>{"use strict";e.exports=require("events")},9896:e=>{"use strict";e.exports=require("fs")},3339:e=>{"use strict";e.exports=require("module")},4589:e=>{"use strict";e.exports=require("node:assert")},6698:e=>{"use strict";e.exports=require("node:async_hooks")},4573:e=>{"use strict";e.exports=require("node:buffer")},1421:e=>{"use strict";e.exports=require("node:child_process")},7540:e=>{"use strict";e.exports=require("node:console")},7598:e=>{"use strict";e.exports=require("node:crypto")},3053:e=>{"use strict";e.exports=require("node:diagnostics_channel")},610:e=>{"use strict";e.exports=require("node:dns")},8474:e=>{"use strict";e.exports=require("node:events")},1455:e=>{"use strict";e.exports=require("node:fs/promises")},7067:e=>{"use strict";e.exports=require("node:http")},2467:e=>{"use strict";e.exports=require("node:http2")},7030:e=>{"use strict";e.exports=require("node:net")},6760:e=>{"use strict";e.exports=require("node:path")},643:e=>{"use strict";e.exports=require("node:perf_hooks")},1792:e=>{"use strict";e.exports=require("node:querystring")},99:e=>{"use strict";e.exports=require("node:sqlite")},7075:e=>{"use strict";e.exports=require("node:stream")},7997:e=>{"use strict";e.exports=require("node:timers")},1692:e=>{"use strict";e.exports=require("node:tls")},7975:e=>{"use strict";e.exports=require("node:util")},3429:e=>{"use strict";e.exports=require("node:util/types")},5919:e=>{"use strict";e.exports=require("node:worker_threads")},8522:e=>{"use strict";e.exports=require("node:zlib")},6928:e=>{"use strict";e.exports=require("path")},2203:e=>{"use strict";e.exports=require("stream")},9023:e=>{"use strict";e.exports=require("util")},3106:e=>{"use strict";e.exports=require("zlib")},5537:e=>{"use strict";function t(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}const s=new Int32Array([0,1996959894,3993919788,2567524794,124634137,1886057615,3915621685,2657392035,249268274,2044508324,3772115230,2547177864,162941995,2125561021,3887607047,2428444049,498536548,1789927666,4089016648,2227061214,450548861,1843258603,4107580753,2211677639,325883990,1684777152,4251122042,2321926636,335633487,1661365465,4195302755,2366115317,997073096,1281953886,3579855332,2724688242,1006888145,1258607687,3524101629,2768942443,901097722,1119000684,3686517206,2898065728,853044451,1172266101,3705015759,2882616665,651767980,1373503546,3369554304,3218104598,565507253,1454621731,3485111705,3099436303,671266974,1594198024,3322730930,2970347812,795835527,1483230225,3244367275,3060149565,1994146192,31158534,2563907772,4023717930,1907459465,112637215,2680153253,3904427059,2013776290,251722036,2517215374,3775830040,2137656763,141376813,2439277719,3865271297,1802195444,476864866,2238001368,4066508878,1812370925,453092731,2181625025,4111451223,1706088902,314042704,2344532202,4240017532,1658658271,366619977,2362670323,4224994405,1303535960,984961486,2747007092,3569037538,1256170817,1037604311,2765210733,3554079995,1131014506,879679996,2909243462,3663771856,1141124467,855842277,2852801631,3708648649,1342533948,654459306,3188396048,3373015174,1466479909,544179635,3110523913,3462522015,1591671054,702138776,2966460450,3352799412,1504918807,783551873,3082640443,3233442989,3988292384,2596254646,62317068,1957810842,3939845945,2647816111,81470997,1943803523,3814918930,2489596804,225274430,2053790376,3826175755,2466906013,167816743,2097651377,4027552580,2265490386,503444072,1762050814,4150417245,2154129355,426522225,1852507879,4275313526,2312317920,282753626,1742555852,4189708143,2394877945,397917763,1622183637,3604390888,2714866558,953729732,1340076626,3518719985,2797360999,1068828381,1219638859,3624741850,2936675148,906185462,1090812512,3747672003,2825379669,829329135,1181335161,3412177804,3160834842,628085408,1382605366,3423369109,3138078467,570562233,1426400815,3317316542,2998733608,733239954,1555261956,3268935591,3050360625,752459403,1541320221,2607071920,3965973030,1969922972,40735498,2617837225,3943577151,1913087877,83908371,2512341634,3803740692,2075208622,213261112,2463272603,3855990285,2094854071,198958881,2262029012,4057260610,1759359992,534414190,2176718541,4139329115,1873836001,414664567,2282248934,4279200368,1711684554,285281116,2405801727,4167216745,1634467795,376229701,2685067896,3608007406,1308918612,956543938,2808555105,3495958263,1231636301,1047427035,2932959818,3654703836,1088359270,936918e3,2847714899,3736837829,1202900863,817233897,3183342108,3401237130,1404277552,615818150,3134207493,3453421203,1423857449,601450431,3009837614,3294710456,1567103746,711928724,3020668471,3272380065,1510334235,755167117]);function r(e){if(Buffer.isBuffer(e))return e;if("number"==typeof e)return Buffer.alloc(e);if("string"==typeof e)return Buffer.from(e);throw new Error("input must be buffer, number, or string, received "+typeof e)}function n(e,t){e=r(e),Buffer.isBuffer(t)&&(t=t.readUInt32BE(0));let n=~t;for(var A=0;A<e.length;A++)n=s[255&(n^e[A])]^n>>>8;return~n}function A(){return function(e){const t=r(4);return t.writeInt32BE(e,0),t}(n.apply(null,arguments))}A.signed=function(){return n.apply(null,arguments)},A.unsigned=function(){return n.apply(null,arguments)>>>0};const i=t(A);e.exports=i},2498:(e,t,s)=>{"use strict";s.d(t,{ReolinkBaichuanApi:()=>Wt,ReolinkCgiApi:()=>ue,createScryptedRfc4571TcpServer:()=>rs});const r=require("crypto");var n=s(4434);const A=require("net"),i=require("dgram"),o=require("timers");var a=s(9896),c=s(6928),l=s(9038),h=s(5317);const g=require("fs/promises");var d=s(6822);const u=require("http");var E=9e3,I=Buffer.from([240,222,188,10]),C=Buffer.from([160,203,237,15]),B=Uint8Array.from([31,45,60,75,90,105,120,255]),Q=Buffer.from("0123456789abcdef","utf8"),p=25620,f=25730;function m(e){return e===p||0===e||e===f}var y=253,w=234,S=289;function D(e){return function(e){return(0,r.createHash)("md5").update(e,"utf8").digest("hex").toUpperCase()}(e).slice(0,31)}function b(e,t){const s=D(`${e}-${t}`).slice(0,16);return Buffer.from(s,"utf8")}function v(e,t){const s=255&t,r=Buffer.allocUnsafe(e.length);for(let t=0;t<e.length;t++){const n=B[(s+t)%B.length];r[t]=e[t]^n^s}return r}function R(e,t){return v(e,t)}function N(e,t){if(0===e.length)return Buffer.alloc(0);const s=(0,r.createCipheriv)("aes-128-cfb",t,Q);return s.setAutoPadding(!1),Buffer.concat([s.update(e),s.final()])}function k(e,t){if(0===e.length)return Buffer.alloc(0);const s=(0,r.createDecipheriv)("aes-128-cfb",t,Q);return s.setAutoPadding(!1),Buffer.concat([s.update(e),s.final()])}function T(e){const t=m(e.messageClass),s=t?24:20,r=Buffer.alloc(s),n=e.magic??I;if(4!==n.length)throw new Error("magic must be 4 bytes");return n.copy(r,0),r.writeUInt32LE(e.cmdId>>>0,4),r.writeUInt32LE(e.bodyLen>>>0,8),r.writeUInt8(255&e.channelId,12),r.writeUInt8(255&e.streamType,13),r.writeUInt16LE(65535&e.msgNum,14),r.writeUInt16LE(65535&e.responseCode,16),r.writeUInt16LE(65535&e.messageClass,18),t&&r.writeUInt32LE((e.payloadOffset??0)>>>0,20),r}function F(e){if(e.length<20)throw new Error("not enough data for Baichuan header");const t=e.subarray(0,4);if(!t.equals(I)&&!t.equals(C))throw new Error(`invalid Baichuan magic: ${t.toString("hex")}`);const s=e.readUInt32LE(4),r=e.readUInt32LE(8),n=e.readUInt8(12),A=e.readUInt8(13),i=e.readUInt16LE(14),o=e.readUInt16LE(16),a=e.readUInt16LE(18),c=m(a)?24:20;if(e.length<c)throw new Error("not enough data for Baichuan header (needs 24 bytes)");const l=e.readUInt32LE(12),h={magic:Buffer.from(t),cmdId:s,bodyLen:r,channelId:n,streamType:A,msgNum:i,responseCode:o,messageClass:a};return 24===c&&(h.payloadOffset=e.readUInt32LE(20)),{header:h,headerLen:c,messageKey:l}}var M=class{buffer=Buffer.alloc(0);push(e){if(0===e.length)return[];const t=e;this.buffer=0===this.buffer.length?t:Buffer.concat([this.buffer,t]);const s=[];for(;!(this.buffer.length<4);){if(!this.buffer.subarray(0,4).equals(I)&&!this.buffer.subarray(0,4).equals(C)){const e=this.buffer.indexOf(I),t=this.buffer.indexOf(C),s=-1===e?t:-1===t?e:Math.min(e,t);if(-1===s){this.buffer=this.buffer.subarray(Math.max(0,this.buffer.length-3));break}if(this.buffer=this.buffer.subarray(s),this.buffer.length<20)break}if(this.buffer.length<20)break;let e;try{e=F(this.buffer)}catch{break}const{header:t,headerLen:r,messageKey:n}=e,A=r+t.bodyLen;if(this.buffer.length<A)break;const i=this.buffer.subarray(0,A),o=i.subarray(r);let a=0;if(24===r){const e=t.payloadOffset??0;a=e>0?Math.min(e,t.bodyLen):0}const c=o.subarray(0,a),l=o.subarray(a);s.push({header:t,body:o,extension:c,payload:l,messageKey:n,raw:i}),this.buffer=this.buffer.subarray(A)}return s}};function U(e){if(null==e||"string"!=typeof e){throw new Error(`xmlEscape: expected string but got ${typeof e}: ${e}`)}return e.replaceAll("&","&amp;").replaceAll("<","&lt;").replaceAll(">","&gt;").replaceAll('"',"&quot;").replaceAll("'","&apos;")}function L(e){return null==e?'<?xml version="1.0" encoding="UTF-8" ?><Extension version="1.1"></Extension>':`<?xml version="1.0" encoding="UTF-8" ?>\n<Extension version="1.1">\n<channelId>${e}</channelId>\n</Extension>`}function H(e){return null==e?'<?xml version="1.0" encoding="UTF-8" ?><Extension version="1.1"><binaryData>1</binaryData></Extension>':`<?xml version="1.0" encoding="UTF-8" ?>\n<Extension version="1.1">\n<binaryData>1</binaryData>\n<channelId>${e}</channelId>\n</Extension>`}function P(e,t){const s=new RegExp(`<${t}>([^<]*)</${t}>`).exec(e);return s?.[1]}function x(e,t,s,r){let n="";const A=r?.name;"setPos"===s&&void 0!==A&&(n=`<name>${U(A)}</name>`);let i="";return void 0!==r?.enable&&(i=`<enable>${r.enable}</enable>`),`<?xml version="1.0" encoding="UTF-8" ?>\n<body>\n<PtzPreset version="1.1">\n<channelId>${e}</channelId>\n<presetList>\n<preset>\n<id>${t}</id>\n<command>${s}</command>\n${n}\n${i}\n</preset>\n</presetList>\n</PtzPreset>\n</body>`}function Y(e,t){return`<?xml version="1.0" encoding="UTF-8" ?>\n<body>\n<audioPlayInfo version="1.1">\n${void 0!==e?`<channelId>${e}</channelId>`:""}\n<playMode>2</playMode>\n<playDuration>10</playDuration>\n<playTimes>1</playTimes>\n<onOff>${t}</onOff>\n</audioPlayInfo>\n</body>`}function V(e,t){return`<?xml version="1.0" encoding="UTF-8" ?>\n<body>\n<audioPlayInfo version="1.1">\n${void 0!==e?`<channelId>${e}</channelId>`:""}\n<playMode>0</playMode>\n<playDuration>10</playDuration>\n<playTimes>${t}</playTimes>\n<onOff>1</onOff>\n</audioPlayInfo>\n</body>`}function O(e,t,s=180){return`<?xml version="1.0" encoding="UTF-8" ?>\n<body>\n<FloodlightManual version="1.1">\n<channelId>${e}</channelId>\n<status>${t}</status>\n<duration>${s}</duration>\n</FloodlightManual>\n</body>`}var G,J=713543482,W=713543456,_=713543440;function q(e){const t=function(){if(G)return G;const e=new Uint32Array(256);for(let t=0;t<256;t++){let s=t;for(let e=0;e<8;e++)s=1&s?3988292384^s>>>1:s>>>1;e[t]=s>>>0}return G=e,e}();let s=0;for(let r=0;r<e.length;r++){s=(t[255&(s^e[r])]^s>>>8)>>>0}return s>>>0}var $=Uint32Array.from([523058251,1517059981,941043275,2188469082,2252282411,2781280216,2205278644,401789861]);function z(e,t){const s=Buffer.allocUnsafe(t.length),r=function*(e){let t=0;for(;;){const s=$[t%$.length]+(e>>>0)>>>0;yield 255&s,yield s>>>8&255,yield s>>>16&255,yield s>>>24&255,t++}}(e>>>0);for(let e=0;e<t.length;e++)s[e]=t[e]^r.next().value;return s}function X(e,t){return e.readInt32LE(t)}function j(e,t){const s=z(e,Buffer.from(t,"utf8")),r=q(s),n=Buffer.alloc(20);return n.writeUInt32LE(J,0),n.writeUInt32LE(s.length>>>0,4),n.writeUInt32LE(1,8),n.writeUInt32LE(e>>>0,12),n.writeUInt32LE(r>>>0,16),Buffer.concat([n,s])}function Z(e){const t=Buffer.alloc(20);return t.writeUInt32LE(_,0),t.writeInt32LE(0|e.connectionId,4),t.writeUInt32LE(0,8),t.writeUInt32LE(e.packetId>>>0,12),t.writeUInt32LE(e.payload.length>>>0,16),Buffer.concat([t,e.payload])}function K(e){if(e.length<4)throw new Error("BCUDP packet too short");const t=e.readUInt32LE(0);if(t===J){if(e.length<20)throw new Error("BCUDP discovery header too short");const t=e.readUInt32LE(4),s=e.readUInt32LE(8);if(1!==s)throw new Error(`BCUDP discovery unknownA expected 1, got ${s}`);const r=e.readUInt32LE(12),n=e.readUInt32LE(16),A=e.subarray(20);if(A.length<t)throw new Error("BCUDP discovery payload truncated");const i=A.subarray(0,t);if(n>>>0!=q(i)>>>0)throw new Error("BCUDP discovery CRC mismatch");const o=function(e,t){return z(e,t)}(r,i);return{kind:"discovery",tid:r,xml:o.toString("utf8")}}if(t===W){if(e.length<28)throw new Error("BCUDP ack header too short");const t=X(e,4),s=e.readUInt32LE(8);if(0!==s)throw new Error(`BCUDP ack unknownA expected 0, got ${s}`);const r=e.readUInt32LE(12),n=e.readUInt32LE(16),A=e.readUInt32LE(20),i=e.readUInt32LE(24),o=e.subarray(28);if(o.length<i)throw new Error("BCUDP ack payload truncated");return{kind:"ack",connectionId:t,groupId:r,packetId:n,maybeLatency:A,payload:o.subarray(0,i)}}if(t===_){if(e.length<20)throw new Error("BCUDP data header too short");const t=X(e,4),s=e.readUInt32LE(8);if(0!==s)throw new Error(`BCUDP data unknownA expected 0, got ${s}`);const r=e.readUInt32LE(12),n=e.readUInt32LE(16),A=e.subarray(20);if(A.length<n)throw new Error("BCUDP data payload truncated");return{kind:"data",connectionId:t,packetId:r,payload:A.subarray(0,n)}}throw new Error(`Unknown BCUDP magic 0x${t.toString(16)}`)}function ee(e){return`<P2P>${e}</P2P>`}function te(e){const t=e.conn??"local";return ee(`<C2D_A><sid>${e.sid}</sid><conn>${U(t)}</conn><cid>${e.cid}</cid><did>${e.did}</did><mtu>${e.mtu}</mtu></C2D_A>`)}function se(e){const t=/<D2C_CFM>([\s\S]*?)<\/D2C_CFM>/.exec(e);if(!t)return;const s=t[1]??"",r=/<sid>(-?\d+)<\/sid>/.exec(s)?.[1];if(null==r)return;const n=/<conn>([^<]+)<\/conn>/.exec(s)?.[1],A=/<rsp>(-?\d+)<\/rsp>/.exec(s)?.[1],i=/<cid>(-?\d+)<\/cid>/.exec(s)?.[1],o=/<did>(-?\d+)<\/did>/.exec(s)?.[1];return{sid:Number(r),...null!=n?{conn:n}:{},...null!=A?{rsp:Number(A)}:{},...null!=i?{cid:Number(i)}:{},...null!=o?{did:Number(o)}:{}}}function re(e){const t=/<D2C_T>([\s\S]*?)<\/D2C_T>/.exec(e);if(!t)return;const s=t[1]??"",r=/<sid>(-?\d+)<\/sid>/.exec(s)?.[1],n=/<cid>(-?\d+)<\/cid>/.exec(s)?.[1],A=/<did>(-?\d+)<\/did>/.exec(s)?.[1];if(null==r||null==n||null==A)return;const i=/<conn>([^<]+)<\/conn>/.exec(s)?.[1];return{sid:Number(r),cid:Number(n),did:Number(A),...null!=i?{conn:i}:{}}}var ne=class{currentValues=[];lastReceiveTime=null;displayValue=0;lastDisplayTime=null;getValue(){return this.displayValue}feed(){const e=performance.now();if(null!==this.lastReceiveTime){const t=1e3*(e-this.lastReceiveTime);this.currentValues.push(t)}if(this.lastReceiveTime=e,null!==this.lastDisplayTime){if(e-this.lastDisplayTime>1e3){this.lastDisplayTime=e;const t=this.currentValues.length;if(t>0){const e=this.currentValues.reduce(((e,t)=>e+t),0);this.displayValue=Math.floor(e/t)}else this.displayValue=0;this.currentValues=[]}}else this.lastDisplayTime=e,this.displayValue=0}},Ae=class extends n.EventEmitter{opts;sock;remote;mtu;clientId;cameraId;sid;sendPacketId=0;packetsWant=0;received=new Map;sent=new Map;ackTimer;resendTimer;hbTimer;discoveryTid;acceptSent=!1;lastAcceptAtMs;ackScheduled=!1;ackLatency=new ne;lastAckPacket=Buffer.alloc(0);ackSentCount=0;pendingData=[];pendingDataOffset=0;drainScheduled=!1;getKeepAliveTid(){return null!=this.discoveryTid?this.discoveryTid:(0|Math.floor(255*Math.random()))>>>0}constructor(e){super(),this.opts=e,this.mtu=1350}isConnected(){return!!this.sock&&!!this.remote&&null!=this.cameraId}async connect(){if(this.sock)return;const e=i.createSocket("udp4");this.sock=e;try{e.setRecvBufferSize(4194304),e.setSendBufferSize(4194304)}catch(e){}e.on("message",((e,t)=>{try{const s=K(e);this.handlePacket(s,t.address,t.port)}catch(e){this.emit("error",e instanceof Error?e:new Error(String(e)))}})),e.on("error",(e=>this.emit("error",e))),e.on("close",(()=>this.emit("close"))),await new Promise((t=>e.bind(0,"0.0.0.0",(()=>t())))),"direct"===this.opts.mode?(this.remote={host:this.opts.host,port:this.opts.port},this.clientId=this.opts.clientId,this.cameraId=this.opts.cameraId):await this.discoveryUid(e),this.startTimers()}async discoveryUid(e){if("uid"!==this.opts.mode)throw new Error("Internal: discoveryUid called for non-uid mode");const t=[2015,2018],s="255.255.255.255";e.setBroadcast(!0);const r=e.address(),n="string"==typeof r?0:r.port,A=0|Math.floor(2147483647*Math.random())||82e3,i=function(e){const t=e.os??"MAC";return ee(`<C2D_C><uid>${U(e.uid)}</uid><cli><port>${e.clientPort}</port></cli><cid>${e.cid}</cid><mtu>${e.mtu}</mtu><debug>false</debug><p>${U(t)}</p></C2D_C>`)}({uid:this.opts.uid,clientPort:n,cid:A,mtu:this.mtu}),a=await new Promise(((r,n)=>{const A=setTimeout((()=>{a&&clearInterval(a),e.off("message",p),n(new Error("BCUDP discovery timeout after 30000ms (camera may be sleeping or unreachable)"))}),3e4);let a,c,l,h,g,d=0,u=!1,E=!1,I=!1;const C=t=>{h&&(g||(g=setTimeout((()=>{const s=h,n=c,i=l;s&&(e.off("message",p),clearTimeout(A),a&&clearInterval(a),this.emit("debug","discovery_finalize",{reason:t,...null!=n?{sid:n}:{},...s}),r({...s,...null!=n?{sid:n}:{},...null!=i?{tid:i}:{}}))}),250)))},B=(t,s)=>{if(!u&&h&&null!=c)try{const r=(0|Math.floor(2147483647*Math.random()))>>>0,n=j(r,function(e){const t=e.conn??"local";return ee("<C2D_T>"+(null!=e.sid?`<sid>${e.sid}</sid>`:"")+`<conn>${U(t)}</conn><cid>${e.cid}</cid><mtu>${e.mtu}</mtu></C2D_T>`)}({...null!=c?{sid:c}:{},cid:h.cid,mtu:this.mtu,conn:"local"}));e.send(n,s,t),u=!0,this.emit("debug","discovery_t_send",{sid:c,cid:h.cid,did:h.did,rhost:t,rport:s})}catch(e){this.emit("debug","discovery_t_send_error",e)}},Q=(t,s,r,n)=>{if(!I)try{const A=j(t,te({sid:n.sid,conn:n.conn??"local",cid:n.cid,did:n.did,mtu:this.mtu}));e.send(A,r,s),I=!0,this.emit("debug","discovery_a_send",{sid:n.sid,cid:n.cid,did:n.did,rhost:s,rport:r})}catch(e){this.emit("debug","discovery_a_send_error",e)}},p=(e,t)=>{try{const s=K(e);if("discovery"!==s.kind)return;this.emit("debug","discovery_rx",{tid:s.tid,rhost:t.address,rport:t.port,xmlPreview:s.xml.slice(0,120)});const r=se(s.xml);r&&(c=r.sid,h||null==r.cid||null==r.did||(h={cid:r.cid,did:r.did,rhost:t.address,rport:t.port}),h&&(B(t.address,t.port),C("cfm")));const n=re(s.xml);if(n)return E=!0,c=n.sid,h||(h={cid:n.cid,did:n.did,rhost:t.address,rport:t.port}),this.emit("debug","discovery_t_rx",{sid:n.sid,cid:n.cid,did:n.did,rhost:t.address,rport:t.port}),Q(s.tid,t.address,t.port,n),void C("t_a");const A=function(e){const t=/<D2C_C_R>([\s\S]*?)<\/D2C_C_R>/.exec(e);if(!t)return;const s=t[1]??"",r=/<rsp>(-?\d+)<\/rsp>/.exec(s)?.[1],n=/<cid>(-?\d+)<\/cid>/.exec(s)?.[1],A=/<did>(-?\d+)<\/did>/.exec(s)?.[1];if(null==r||null==n||null==A)return;const i=/<sid>(-?\d+)<\/sid>/.exec(s)?.[1],o=/<timer>([\s\S]*?)<\/timer>/.exec(s)?.[1],a=o?/<def>(-?\d+)<\/def>/.exec(o)?.[1]:void 0,c=o?/<hb>(-?\d+)<\/hb>/.exec(o)?.[1]:void 0,l=o?/<hbt>(-?\d+)<\/hbt>/.exec(o)?.[1]:void 0,h=null!=a||null!=c||null!=l?{...null!=a?{def:Number(a)}:{},...null!=c?{hb:Number(c)}:{},...null!=l?{hbt:Number(l)}:{}}:void 0;return{rsp:Number(r),cid:Number(n),did:Number(A),...null!=i?{sid:Number(i)}:{},...h?{timer:h}:{}}}(s.xml);if(!A)return;if(0!==A.rsp)return;return this.emit("debug","discovery_success",{retryCount:d,rhost:t.address,rport:t.port,sid:A.sid??c,timer:A.timer}),l=s.tid,h={cid:A.cid,did:A.did,rhost:t.address,rport:t.port},null!=A.sid&&(c=A.sid),B(t.address,t.port),void(E||I?C("cr_t"):null!=c?(g&&clearTimeout(g),g=setTimeout((()=>{C("cr_timeout")}),1500)):C("cr_no_sid"))}catch{}};e.on("message",p);const f=()=>{const r=j((0|Math.floor(255*Math.random()))>>>0,i);for(const n of t)try{e.send(r,n,s),d++,this.emit("debug","discovery_send",{retryCount:d,host:s,port:n})}catch(e){this.emit("error",e instanceof Error?e:new Error(String(e)))}};f(),a=(0,o.setInterval)((()=>{f()}),500)}));this.clientId=a.cid,this.cameraId=a.did,this.sid=a.sid,this.discoveryTid=a.tid,this.remote={host:a.rhost,port:a.rport}}startTimers(){if(!this.sock||!this.remote||null==this.clientId||null==this.cameraId)throw new Error("BCUDP not ready");this.updateAckPacket(),this.sendHeartbeat(),this.ackTimer=(0,o.setInterval)((()=>{try{this.sendAckFast()}catch(e){this.emit("error",e instanceof Error?e:new Error(String(e)))}}),10),this.resendTimer=(0,o.setInterval)((()=>{try{this.resendOutstanding()}catch(e){this.emit("error",e instanceof Error?e:new Error(String(e)))}}),500),this.hbTimer=(0,o.setInterval)((()=>{try{this.sendHeartbeat()}catch(e){this.emit("error",e instanceof Error?e:new Error(String(e)))}}),1e3)}sendHeartbeat(){if(!this.sock||!this.remote||null==this.clientId||null==this.cameraId)return;const e=this.getKeepAliveTid();let t;var s;t=ee(`<C2D_HB><cid>${(s={cid:this.clientId,did:this.cameraId}).cid}</cid><did>${s.did}</did></C2D_HB>`);const r=j(e,t);this.emit("debug","udp_hb_send",{tid:e,xml:t,host:this.remote.host,port:this.remote.port}),this.sock.send(r,this.remote.port,this.remote.host)}buildAckPayload(){if(0===this.packetsWant)return{packetId:4294967295,payload:Buffer.alloc(0)};let e=this.packetsWant;for(;this.received.has(e);)e++;let t=e-1;for(const e of this.received.keys())e>t&&(t=e);const s=e+200-1;if(t>s&&(t=s),t<e)return{packetId:e-1>>>0,payload:Buffer.alloc(0)};const r=t-e+1,n=Buffer.allocUnsafe(r);for(let t=0;t<r;t++)n[t]=this.received.has(e+t)?1:0;return{packetId:e-1>>>0,payload:n}}updateAckPacket(){if(null==this.cameraId)return;const{packetId:e,payload:t}=this.buildAckPayload();this.lastAckPacket=function(e){const t=e.payload??Buffer.alloc(0),s=Buffer.alloc(28);return s.writeUInt32LE(W,0),s.writeInt32LE(0|e.connectionId,4),s.writeUInt32LE(0,8),s.writeUInt32LE(e.groupId>>>0,12),s.writeUInt32LE(e.packetId>>>0,16),s.writeUInt32LE((e.maybeLatency??0)>>>0,20),s.writeUInt32LE(t.length>>>0,24),Buffer.concat([s,t])}({connectionId:this.cameraId,groupId:4294967295===e&&0===t.length?4294967295:0,packetId:e,maybeLatency:this.ackLatency.getValue(),payload:t})}sendAckFast(){this.sock&&this.remote&&0!==this.lastAckPacket.length&&(this.sock.send(this.lastAckPacket,this.remote.port,this.remote.host),this.ackSentCount++,this.ackSentCount%100==0&&this.emit("debug","ack_sent_100",{latency:this.ackLatency.getValue()}))}scheduleAck(e="data"){if("manual"===e){if(this.ackScheduled)return;this.ackScheduled=!0,setImmediate((()=>{this.ackScheduled=!1;try{this.sendAckFast()}catch(e){this.emit("error",e instanceof Error?e:new Error(String(e)))}})),this.emit("debug","ack_scheduled",{reason:e})}}resendOutstanding(){if(this.sock&&this.remote)for(const[,e]of this.sent)this.sock.send(e.buf,this.remote.port,this.remote.host)}handleAckFromCamera(e,t){if(4294967295!==e){for(const t of this.sent.keys())t<=e&&this.sent.delete(t);for(let s=0;s<t.length;s++){if((t[s]??0)>0){const t=e+1+s>>>0;this.sent.delete(t)}}}this.ackLatency.feed()}scheduleDrain(){this.drainScheduled||(this.drainScheduled=!0,setImmediate((()=>{this.drainScheduled=!1;try{for(;this.pendingDataOffset<this.pendingData.length;this.pendingDataOffset++)this.emit("data",this.pendingData[this.pendingDataOffset])}catch(e){this.emit("error",e instanceof Error?e:new Error(String(e)))}finally{this.pendingDataOffset>=this.pendingData.length&&(this.pendingData=[],this.pendingDataOffset=0)}})))}flushReceived(){for(;this.received.has(this.packetsWant);){const e=this.received.get(this.packetsWant);this.received.delete(this.packetsWant),this.packetsWant++,this.pendingData.push(e)}this.pendingData.length>this.pendingDataOffset&&this.scheduleDrain()}handlePacket(e,t,s){const r=e=>{this.remote&&this.remote.host===t&&this.remote.port===s||(this.remote={host:t,port:s},this.emit("debug","remote_update",{reason:e,host:t,port:s}))};if(this.remote||r("first_packet"),"ack"!==e.kind)if("data"!==e.kind){if("discovery"===e.kind){this.emit("debug","discovery_rx_connected",{tid:e.tid,xml:e.xml});const n=function(e){const t=/<D2C_HB>([\s\S]*?)<\/D2C_HB>/.exec(e);if(!t)return;const s=t[1]??"",r=/<cid>(-?\d+)<\/cid>/.exec(s)?.[1],n=/<did>(-?\d+)<\/did>/.exec(s)?.[1];return null!=r&&null!=n?{cid:Number(r),did:Number(n)}:void 0}(e.xml);if(n&&null!=this.clientId&&null!=this.cameraId&&n.cid===this.clientId&&n.did===this.cameraId){this.emit("debug","discovery_hb_rx_connected",{...n,rhost:t,rport:s});try{r("d2c_hb"),this.sendHeartbeat()}catch(e){this.emit("debug","discovery_hb_reply_error",e)}return}const A=re(e.xml);if(A&&null!=this.clientId&&null!=this.cameraId&&A.cid===this.clientId&&A.did===this.cameraId){try{r("d2c_t"),this.sid=A.sid,this.emit("debug","discovery_t_rx_connected",{sid:A.sid,cid:A.cid,did:A.did,rhost:t,rport:s});const n=Date.now(),i=750;if(null==this.lastAcceptAtMs||n-this.lastAcceptAtMs>=i){const r=te({sid:A.sid,conn:A.conn??"local",cid:A.cid,did:A.did,mtu:this.mtu}),i=j(e.tid,r);this.sock?.send(i,s,t),this.acceptSent=!0,this.lastAcceptAtMs=n,this.emit("debug","discovery_a_send_connected",{sid:A.sid,cid:A.cid,did:A.did,rhost:t,rport:s})}else this.emit("debug","discovery_a_skip_throttle",{sinceMs:n-this.lastAcceptAtMs,throttleMs:i,sid:A.sid,cid:A.cid,did:A.did,rhost:t,rport:s})}catch(e){this.emit("debug","discovery_a_send_connected_error",e)}return}const i=se(e.xml);if(i&&null!=this.clientId&&null!=this.cameraId&&i.cid===this.clientId&&i.did===this.cameraId)return this.sid=i.sid,void this.emit("debug","discovery_cfm_rx_connected",i);const o=function(e){const t=/<D2C_DISC>([\s\S]*?)<\/D2C_DISC>/.exec(e);if(!t)return;const s=t[1]??"",r=/<cid>(-?\d+)<\/cid>/.exec(s)?.[1],n=/<did>(-?\d+)<\/did>/.exec(s)?.[1];return null!=r&&null!=n?{cid:Number(r),did:Number(n)}:void 0}(e.xml);if(o&&null!=this.clientId&&null!=this.cameraId&&o.cid===this.clientId&&o.did===this.cameraId)return this.emit("debug","discovery_disc_rx_connected",{...o,rhost:t,rport:s}),this.emit("error",new Error("BCUDP disconnected by camera (D2C_DISC)")),void this.close()}}else null!=this.clientId&&e.connectionId===this.clientId&&(r("data"),e.packetId>=this.packetsWant&&(this.received.set(e.packetId,e.payload),this.flushReceived(),this.updateAckPacket(),this.packetsWant%100==0&&this.emit("debug","udp_progress",{packetsWant:this.packetsWant})));else null!=this.clientId&&e.connectionId===this.clientId&&(r("ack"),this.handleAckFromCamera(e.packetId,e.payload))}write(e){if(!this.sock||!this.remote||null==this.cameraId)throw new Error("BCUDP stream is not connected");const t=this.mtu-20;for(let s=0;s<e.length;s+=t){const r=e.subarray(s,Math.min(e.length,s+t)),n=this.sendPacketId>>>0;this.sendPacketId=this.sendPacketId+1>>>0;const A=Z({connectionId:this.cameraId,packetId:n,payload:Buffer.from(r)});this.sent.set(n,{packetId:n,buf:A,ts:Date.now()}),this.sock.send(A,this.remote.port,this.remote.host)}}async close(){this.ackTimer&&clearInterval(this.ackTimer),this.resendTimer&&clearInterval(this.resendTimer),this.hbTimer&&clearInterval(this.hbTimer),this.ackTimer=void 0,this.resendTimer=void 0,this.hbTimer=void 0;const e=this.sock;this.sock=void 0,e&&await new Promise((t=>e.close((()=>t()))))}};function ie(e){e.dumpEnabled&&a.mkdirSync(e.dumpDir,{recursive:!0})}function oe(e,t,s,r){e.general&&t.debug(`[${s}] ${r}`)}function ae(e,t,s,r){e.traceStream&&t.debug(`[${s}] ${r}`)}function ce(e,t,s,r){e.traceTalk&&t.debug(`[${s}] ${r}`)}function le(e,t,s,r){e.traceEvents&&t.debug(`[${s}] ${r}`)}function he(e){return 10===e||11===e||201===e||202===e}var ge=class e extends n.EventEmitter{static streamingRegistry=new Map;opts;debugCfg;logger;tcpSocket;udpSocket;transport="tcp";parser=new M;pending=new Map;socketClosed=!1;pendingCloseInfo;lastDisconnectInfo;msgNum=0;loggedIn=!1;subscribed=!1;keepAliveTimer;keepAlivePingInFlight=!1;idleDisconnectTimer;lastUserActivityAtMs;permitSeq=1;permits=new Map;lastRxAtMs;lastTxAtMs;lastRxInfo;lastTxInfo;rxHistory=[];txHistory=[];enc={kind:"none"};nonce;videoSubscriptions=new Map;contributesToGlobalStreamingRegistry=!1;streamTraceStats=new Map;rxCmdTraceStats=new Map;constructor(e){super(),this.opts=e,this.logger=e.logger??console,this.debugCfg=function(e){const t=!0===e?.general,s=!0===e?.debugRtsp,r=!0===e?.traceStream,n=!0===e?.traceTalk,A=!0===e?.traceEvents,i=!0===e?.debugH264,o=!0===e?.debugParamSets,a=!0===e?.dump?.enabled;return{general:t,debugRtsp:s,traceStream:r,traceTalk:n,traceEvents:A,debugH264:i,debugParamSets:o,dumpEnabled:a,dumpDir:e?.dump?.dir&&e.dump.dir.trim()||c.join(process.cwd(),"test","frames-debug"),dumpBcMedia:e?.dump?.bcmedia??a,dumpNals:e?.dump?.nals??a}}(e.debugOptions)}logFixed(e,t){const s=`[BaichuanClient] ${e}`,r=this.logger;"function"!=typeof r.info?"function"!=typeof r.log?"function"==typeof r.warn&&r.warn(s,t):r.log(s,t):r.info(s,t)}getIdleDisconnectTimeoutMs(){const e=this.opts.idleDisconnectTimeoutMs;return"number"==typeof e&&Number.isFinite(e)&&e>0?e:3e4}isIdleDisconnectEnabled(){return!0===this.opts.idleDisconnect}clearIdleDisconnectTimer(){this.idleDisconnectTimer&&(clearTimeout(this.idleDisconnectTimer),this.idleDisconnectTimer=void 0)}touchUserActivity(e){this.lastUserActivityAtMs=Date.now(),this.logDebug("user_activity",{reason:e,atMs:this.lastUserActivityAtMs})}isIdleDisconnectEligibleNow(){return!!this.isIdleDisconnectEnabled()&&(!!this.isSocketConnected()&&(!(this.pending.size>0)&&(!this.hasActiveVideoSubscriptionsInternal()&&!(this.permits.size>0))))}kickIdleDisconnectTimer(){if(!this.isIdleDisconnectEnabled())return;if(this.clearIdleDisconnectTimer(),!this.isIdleDisconnectEligibleNow())return;if(null==this.lastUserActivityAtMs)return;const e=this.getIdleDisconnectTimeoutMs(),t=Date.now()-this.lastUserActivityAtMs,s=Math.max(0,e-t);this.idleDisconnectTimer=setTimeout((()=>{try{if(!this.isIdleDisconnectEligibleNow())return;if(null==this.lastUserActivityAtMs)return;const t=Date.now()-this.lastUserActivityAtMs;if(t<e)return void this.kickIdleDisconnectTimer();this.logDebug("idle_disconnect",{elapsedMs:t,timeoutMs:e,transport:this.transport}),this.logFixed("idle_disconnect",{elapsedMs:t,timeoutMs:e,transport:this.transport,host:this.opts.host}),this.close({reason:"idle_disconnect"})}catch(e){this.logDebug("idle_disconnect_error",e)}}),s),this.idleDisconnectTimer.unref?.()}getLastDisconnectInfo(){return this.lastDisconnectInfo}acquirePermit(e=this.getIdleDisconnectTimeoutMs(),t){const s=Math.max(0,Math.floor(e)),r=this.permitSeq++,n=Date.now()+s;let A;return s>0&&(A=setTimeout((()=>this.releasePermit(r,"timeout")),s),A.unref?.()),this.permits.set(r,{timer:A,untilMs:n,reason:t}),this.logDebug("permit_acquired",{id:r,holdMs:s,untilMs:n,reason:t,permits:this.permits.size}),this.clearIdleDisconnectTimer(),()=>this.releasePermit(r,"manual")}releasePermit(e,t){const s=this.permits.get(e);s&&(s.timer&&clearTimeout(s.timer),this.permits.delete(e),this.logDebug("permit_released",{id:e,how:t,permits:this.permits.size}),this.kickIdleDisconnectTimer())}getDeviceRegistryKey(){const e=(this.opts.uid??"").trim().toUpperCase();return`${(this.opts.host??"").trim()}|${e}|${this.opts.channel??0}`}recomputeGlobalStreamingContribution(){const t=this.hasActiveVideoSubscriptionsInternal();if(t===this.contributesToGlobalStreamingRegistry)return;const s=this.getDeviceRegistryKey(),r=e.streamingRegistry.get(s)??{activeStreamClients:0},n=Math.max(0,r.activeStreamClients+(t?1:-1));0===n?e.streamingRegistry.delete(s):e.streamingRegistry.set(s,{activeStreamClients:n}),this.contributesToGlobalStreamingRegistry=t}isDeviceStreamingActive(){if(this.hasActiveVideoSubscriptionsInternal())return!0;const t=this.getDeviceRegistryKey(),s=e.streamingRegistry.get(t);return(s?.activeStreamClients??0)>0}logDebug(e,t){this.debugCfg.general&&(this.logger.debug(`[BaichuanClient] ${e}`,t),this.emit("debug",e,t))}getTransport(){return this.transport}getConfiguredChannel(){return this.opts.channel??0}refreshKeepAlive(){this.stopKeepAlive(),this.isSocketConnected()&&this.startKeepAlive()}getLastRxAtMs(){return this.lastRxAtMs}getLastRxInfo(){return this.lastRxInfo}getRxHistory(){return this.rxHistory}getLastTxAtMs(){return this.lastTxAtMs}getLastTxInfo(){return this.lastTxInfo}getTxHistory(){return this.txHistory}recordTx(e){const t=Date.now();this.lastTxAtMs=t,this.lastTxInfo={atMs:t,...e},this.txHistory.push(this.lastTxInfo),this.txHistory.length>32&&this.txHistory.shift()}isProbablySleeping(e=15e3){return"udp"===this.transport&&(this.isIdleDisconnectEnabled()?!this.isSocketConnected():!this.isSocketConnected()||!this.isDeviceStreamingActive()&&(null!=this.lastRxAtMs&&Date.now()-this.lastRxAtMs>=e))}getDebugConfig(){return this.debugCfg}isSocketConnected(){return"tcp"===this.transport?void 0!==this.tcpSocket&&!this.tcpSocket.destroyed:"udp"===this.transport&&(void 0!==this.udpSocket&&(this.udpSocket.isConnected?.()??!0))}get username(){return this.opts.username}startKeepAlive(){if(this.keepAliveTimer)return;let e=3e4;if("udp"===this.transport){if(!this.shouldSendUdpKeepAlive())return;e=2500}e<=0||(this.keepAliveTimer=setInterval((()=>{if("udp"!==this.transport)this.keepAlivePingInFlight||(this.keepAlivePingInFlight=!0,(async()=>{try{await this.sendPing()}catch(e){this.logDebug("keepalive_ping_error",e)}finally{this.keepAlivePingInFlight=!1}})());else try{this.sendUdpKeepAlive()}catch(e){this.logDebug("udp_keepalive_ping_error",e)}}),e),this.keepAliveTimer.unref?.())}hasActiveVideoSubscriptionsInternal(){for(const e of this.videoSubscriptions.values())if(e.size>0)return!0;return!1}hasActiveVideoSubscriptions(){return this.hasActiveVideoSubscriptionsInternal()}shouldSendUdpKeepAlive(){return"udp"===this.transport&&(!!this.udpSocket&&(!!this.loggedIn&&!!this.hasActiveVideoSubscriptionsInternal()))}sendUdpKeepAlive(){if("udp"!==this.transport)return;if(!this.udpSocket)return;if(!this.loggedIn)return;const e=this.nextMsgNum(),t=T({cmdId:w,bodyLen:0,channelId:0,streamType:0,msgNum:e,responseCode:0,messageClass:p,payloadOffset:0});this.logDebug("udp_keepalive_ping_tx",{msgNum:e,channelId:0,streamType:0}),this.recordTx({cmdId:w,responseCode:0,msgNum:e,channelId:0,streamType:0}),this.writeWire(t)}stopKeepAlive(){this.keepAliveTimer&&(clearInterval(this.keepAliveTimer),this.keepAliveTimer=void 0),this.keepAlivePingInFlight=!1}async sendPing(){if((this.tcpSocket||this.udpSocket)&&this.loggedIn)try{await this.sendFrame({cmdId:93,channel:this.opts.channel??0,channelIdOverride:0,messageClass:p,streamType:0,extensionXml:"",internal:!0})}catch(e){this.logDebug("keepalive_ping_failed",e)}}async connect(){const e=this.opts.transport??"tcp";if("tcp"!==e)if("udp"!==e)try{await Promise.race([this.connectTcp(),new Promise(((e,t)=>setTimeout((()=>t(new Error("TCP connection timeout (falling back to UDP)"))),4e3)))])}catch(e){if(this.logDebug("auto:tcp_failed",e),!this.opts.uid)throw new Error("TCP connection failed and UDP fallback requires `options.uid` (BCUDP discovery UID).");await this.connectUdp()}else await this.connectUdp();else await this.connectTcp()}async connectTcp(){if(this.tcpSocket&&!this.tcpSocket.destroyed)return void(this.transport="tcp");const e=this.opts.port??E,t=A.createConnection({host:this.opts.host,port:e});this.tcpSocket=t,this.transport="tcp",this.socketClosed=!1;try{t.setKeepAlive(!0,3e4)}catch(e){this.logDebug("tcp_setKeepAlive_failed",e)}t.on("data",(e=>{const t=this.parser.push(e);for(const e of t)this.handleFrame(e)})),t.on("close",(()=>{this.stopKeepAlive(),this.socketClosed=!0;const e=this.pendingCloseInfo;this.pendingCloseInfo=void 0,this.lastDisconnectInfo={atMs:Date.now(),transport:"tcp",voluntary:null!=e,reason:e?.reason??"socket_closed"},this.logFixed("disconnected",JSON.stringify({transport:"tcp",host:this.opts.host,port:this.opts.port??E,lastRx:this.lastRxInfo?.cmdId,lastTx:this.lastTxInfo?.cmdId})),this.emit("close");const t=Array.from(this.pending.entries());this.pending.clear();for(const[,e]of t)setImmediate((()=>{try{e.reject(new Error("Baichuan socket closed"))}catch(e){}}))})),t.on("error",(e=>this.emit("error",e))),await new Promise(((e,s)=>{t.once("connect",(()=>e())),t.once("error",(e=>s(e)))})),this.logFixed("connected",{transport:"tcp",host:this.opts.host,port:this.opts.port??E}),this.startKeepAlive(),this.kickIdleDisconnectTimer()}async connectUdp(){if(this.udpSocket){if(this.udpSocket.isConnected?.())return void(this.transport="udp");try{await this.udpSocket.close()}catch{}this.udpSocket=void 0}if(!this.opts.uid)throw new Error("Baichuan UDP requested but `options.uid` is not set (required for BCUDP discovery).");const e=new Ae({mode:"uid",uid:this.opts.uid});this.udpSocket=e,this.transport="udp",this.socketClosed=!1,e.on("data",(e=>{const t=this.parser.push(e);for(const e of t)this.handleFrame(e)})),e.on("close",(()=>{this.stopKeepAlive(),this.socketClosed=!0;const t=this.pendingCloseInfo;this.pendingCloseInfo=void 0,this.lastDisconnectInfo={atMs:Date.now(),transport:"udp",voluntary:null!=t,reason:t?.reason??"socket_closed"},this.logFixed("disconnected",{transport:"udp",host:this.opts.host,uid:this.opts.uid,lastRx:this.lastRxInfo,lastTx:this.lastTxInfo}),this.loggedIn=!1,this.subscribed=!1,this.contributesToGlobalStreamingRegistry&&(this.videoSubscriptions.clear(),this.recomputeGlobalStreamingContribution()),this.udpSocket===e&&(this.udpSocket=void 0),this.emit("close");const s=Array.from(this.pending.entries());this.pending.clear();for(const[,e]of s)setImmediate((()=>{try{e.reject(new Error("Baichuan UDP stream closed"))}catch(e){}}))})),e.on("error",(e=>{e?.message?.includes("D2C_DISC")&&(this.stopKeepAlive(),this.loggedIn=!1,this.subscribed=!1,this.contributesToGlobalStreamingRegistry&&(this.videoSubscriptions.clear(),this.recomputeGlobalStreamingContribution())),this.emit("error",e)})),e.on("debug",((e,t)=>{this.logDebug(`udp_${e}`,t)})),await e.connect(),this.logFixed("connected",{transport:"udp",host:this.opts.host,uid:this.opts.uid}),this.startKeepAlive(),this.kickIdleDisconnectTimer()}async close(e){Boolean(this.tcpSocket&&!this.tcpSocket.destroyed||this.udpSocket)&&(this.pendingCloseInfo={atMs:Date.now(),reason:(e?.reason??"manual_close").trim()||"manual_close"}),this.stopKeepAlive(),this.clearIdleDisconnectTimer();for(const e of Array.from(this.permits.keys()))this.releasePermit(e,"close");this.contributesToGlobalStreamingRegistry&&(this.videoSubscriptions.clear(),this.recomputeGlobalStreamingContribution());const t=this.tcpSocket;this.tcpSocket=void 0,t&&await new Promise((e=>{t.once("close",(()=>e())),t.destroy()}));const s=this.udpSocket;this.udpSocket=void 0,s&&await s.close()}handleFrame(e){const t=Date.now();if(this.lastRxAtMs=t,this.lastRxInfo={atMs:t,cmdId:e.header.cmdId,responseCode:e.header.responseCode,msgNum:e.header.msgNum,channelId:e.header.channelId,streamType:e.header.streamType},this.rxHistory.push(this.lastRxInfo),this.rxHistory.length>32&&this.rxHistory.shift(),this.debugCfg.general)if(3===e.header.cmdId){const s=this.rxCmdTraceStats.get(3)??{lastLogMs:t,frames:0};s.frames++,t-s.lastLogMs>=1e3&&(oe(this.debugCfg,this.logger,"BaichuanRx",`rx cmdId=3 frames=${s.frames} lastMsgNum=${e.header.msgNum} lastResponseCode=${e.header.responseCode} lastChannelId=${e.header.channelId} lastStreamType=${e.header.streamType} lastBodyLen=${e.body.length} lastPayloadLen=${e.payload.length}`),s.lastLogMs=t,s.frames=0),this.rxCmdTraceStats.set(3,s)}else oe(this.debugCfg,this.logger,"BaichuanRx",`rx cmdId=${e.header.cmdId} msgNum=${e.header.msgNum} responseCode=${e.header.responseCode} channelId=${e.header.channelId} streamType=${e.header.streamType} bodyLen=${e.body.length} payloadLen=${e.payload.length} payloadOffset=${e.header.payloadOffset??0}`);if("udp"===this.transport&&e.header.cmdId===w){try{const t=T({cmdId:e.header.cmdId,bodyLen:0,channelId:e.header.channelId,streamType:e.header.streamType,msgNum:e.header.msgNum,responseCode:200,messageClass:e.header.messageClass,payloadOffset:0});this.logDebug("udp_keepalive_rx",{msgNum:e.header.msgNum,channelId:e.header.channelId,streamType:e.header.streamType,responseCode:e.header.responseCode}),this.recordTx({cmdId:e.header.cmdId,responseCode:200,msgNum:e.header.msgNum,channelId:e.header.channelId,streamType:e.header.streamType}),this.writeWire(t),this.logDebug("udp_keepalive_tx",{msgNum:e.header.msgNum,channelId:e.header.channelId,streamType:e.header.streamType})}catch(e){this.logDebug("udp_keepalive_error",e)}return}this.debugCfg.traceTalk&&he(e.header.cmdId)&&ce(this.debugCfg,this.logger,"BaichuanTalk",`rx cmdId=${e.header.cmdId} msgNum=${e.header.msgNum} responseCode=${e.header.responseCode} channelId=${e.header.channelId} bodyLen=${e.body.length} payloadLen=${e.payload.length} payloadOffset=${e.header.payloadOffset??0}`),this.emit("frame",e);const s=`${e.header.cmdId}:${e.header.msgNum}`,r=this.pending.get(s);if(r)return this.pending.delete(s),void r.resolve(e);const n=this.videoSubscriptions.get(e.header.cmdId);if(n&&n.size>0){if(n.has(e.header.msgNum)){if(this.debugCfg.traceStream&&3===e.header.cmdId){const t=Date.now(),s=e.header.msgNum,r=this.streamTraceStats.get(s)??{lastLogMs:t,frames:0};r.frames++,t-r.lastLogMs>=500&&(ae(this.debugCfg,this.logger,"BaichuanTrace",`rx stream frames cmdId=3 msgNum=${e.header.msgNum} frames=${r.frames} lastChannelId=${e.header.channelId} lastBodyLen=${e.body.length} lastPayloadLen=${e.payload.length} lastPayloadOffset=${e.header.payloadOffset??0}`),r.lastLogMs=t,r.frames=0),this.streamTraceStats.set(s,r)}this.emit("push",e)}}else if(this.emit("push",e),33===e.header.cmdId)try{const t=this.parseEvents(e);for(const s of t)le(this.debugCfg,this.logger,"BaichuanEvent",`dispatch cmdId=33 msgNum=${e.header.msgNum} channelId=${e.header.channelId} type=${s.type} eventChannel=${s.channel}`+("ai"===s.type?` aiType=${s.ai?.type??"unknown"} detected=${s.ai?.detected??""}`:"")+("motion"===s.type?` source=${s.motion?.source??""}`:"")),this.emit("event",s)}catch(e){this.logDebug("event_parse_error",e)}}subscribeVideoStream(e,t){this.videoSubscriptions.has(e)||this.videoSubscriptions.set(e,new Set),this.videoSubscriptions.get(e).add(t),3!==e||this.streamTraceStats.has(t)||this.streamTraceStats.set(t,{lastLogMs:Date.now(),frames:0}),"udp"===this.transport&&this.refreshKeepAlive(),this.recomputeGlobalStreamingContribution(),this.kickIdleDisconnectTimer()}unsubscribeVideoStream(e,t){const s=this.videoSubscriptions.get(e);s&&(void 0!==t?(s.delete(t),0===s.size&&this.videoSubscriptions.delete(e),3===e&&this.streamTraceStats.delete(t)):(this.videoSubscriptions.delete(e),3===e&&this.streamTraceStats.clear()),"udp"===this.transport&&this.refreshKeepAlive(),this.recomputeGlobalStreamingContribution(),this.kickIdleDisconnectTimer())}parseEvents(e){const t=e.body;if(0===t.length)return[];const s=this.tryDecryptXml(t,e.header.channelId,this.enc);if(!s||!s.startsWith("<?xml"))return[];if(this.debugCfg.traceEvents){const t=s.length>500?`${s.slice(0,500)}...`:s;le(this.debugCfg,this.logger,"BaichuanEventRaw",`rx cmdId=${e.header.cmdId} msgNum=${e.header.msgNum} responseCode=${e.header.responseCode} channelId=${e.header.channelId} xml=${JSON.stringify(t)}`)}const r=e.header.channelId,n=250===r?0:Math.max(0,r-1),A=Date.now();if(s.includes("<AlarmEventList")){const e=[],t=s.matchAll(/<AlarmEvent\b[^>]*>([\s\S]*?)<\/AlarmEvent>/g);for(const s of t){const t=s[1]??"",r=P(t,"channelId"),i=void 0!==r?Number(r):n,o=(P(t,"status")??"").trim(),a=o.toUpperCase(),c=(P(t,"AItype")??P(t,"aiType")??P(t,"aitype")??"").trim();this.debugCfg.traceEvents&&le(this.debugCfg,this.logger,"BaichuanEventRaw",`AlarmEvent channel=${i} status=${JSON.stringify(o)} aiType=${JSON.stringify(c)}`);const l=o.toLowerCase(),h=l.length>0&&"none"!==l,g=c.trim().length>0&&"none"!==c.trim().toLowerCase();if(h||g){const t=a.includes("MD")?"md":a.includes("PIR")||a.includes("OTHER")?"pir":"unknown";e.push({channel:i,type:"motion",motion:{channel:i,state:!0,timestamp:A,source:t},timestamp:A})}const d=c?c.split(",").map((e=>e.trim())).find((e=>e.length>0&&"none"!==e.toLowerCase())):void 0;if(d){const t=d.toLowerCase(),s={people:"people",person:"people",human:"people",vehicle:"vehicle",car:"vehicle",dog_cat:"dog_cat",dog:"dog_cat",cat:"dog_cat",pet:"dog_cat",face:"face",package:"package"};e.push({channel:i,type:"ai",ai:{channel:i,type:s[t]??"other",detected:!0,timestamp:A},timestamp:A})}else a.includes("AI")&&e.push({channel:i,type:"ai",ai:{channel:i,type:"other",detected:!0,timestamp:A},timestamp:A});a.includes("VIS")&&e.push({channel:i,type:"visitor",timestamp:A}),a.includes("DN")&&e.push({channel:i,type:"daynight",timestamp:A})}return e}const i=s.match(/<Event\b[^>]*>([\s\S]*?)<\/Event>/);if(!i)return[];const o=i[1]??"",a=(P(o,"status")??"").trim(),c=a.toUpperCase(),l=(P(o,"AItype")??P(o,"aiType")??P(o,"aitype")??"").trim(),h=[],g=a.toLowerCase(),d=g.length>0&&"none"!==g,u=l.trim().length>0&&"none"!==l.trim().toLowerCase();if(d||u){const e=c.includes("MD")?"md":c.includes("PIR")||c.includes("OTHER")?"pir":"unknown";h.push({channel:n,type:"motion",motion:{channel:n,state:!0,timestamp:A,source:e},timestamp:A})}const E=l?l.split(",").map((e=>e.trim())).find((e=>e.length>0&&"none"!==e.toLowerCase())):void 0;if(E){const e=E.toLowerCase(),t={people:"people",person:"people",human:"people",vehicle:"vehicle",car:"vehicle",dog_cat:"dog_cat",dog:"dog_cat",cat:"dog_cat",pet:"dog_cat",face:"face",package:"package"};h.push({channel:n,type:"ai",ai:{channel:n,type:t[e]??"other",detected:!0,timestamp:A},timestamp:A})}else c.includes("AI")&&h.push({channel:n,type:"ai",ai:{channel:n,type:"other",detected:!0,timestamp:A},timestamp:A});return c.includes("VIS")&&h.push({channel:n,type:"visitor",timestamp:A}),c.includes("DN")&&h.push({channel:n,type:"daynight",timestamp:A}),h}nextMsgNum(){return this.msgNum=this.msgNum+1&65535,this.msgNum}peekNextMsgNum(){return this.msgNum+1&65535}requireSocket(){if("tcp"!==this.transport)throw new Error("Internal: requireSocket called while not using TCP");if(!this.tcpSocket||this.tcpSocket.destroyed)throw new Error("Baichuan TCP socket is not connected");return this.tcpSocket}writeWire(e){if(this.lastTxAtMs=Date.now(),"tcp"!==this.transport){if(!this.udpSocket)throw new Error("Baichuan UDP stream is not connected");this.udpSocket.write(e)}else this.requireSocket().write(e)}encodeBodyXml(e,t,s,r){const n=Buffer.from(e,"utf8"),A=Buffer.from(t,"utf8");return"none"===r.kind?Buffer.concat([n,A]):"bc"===r.kind?Buffer.concat([v(n,s),v(A,s)]):"aes"===r.kind||"full_aes"===r.kind?Buffer.concat([N(n,r.key),N(A,r.key)]):Buffer.concat([n,A])}encodeBodyBinary(e,t,s,r){const n=Buffer.from(e,"utf8");return"none"===r.kind?Buffer.concat([n,t]):"bc"===r.kind?Buffer.concat([v(n,s),t]):"aes"===r.kind||"full_aes"===r.kind?Buffer.concat([N(n,r.key),t]):Buffer.concat([n,t])}async sendBinaryPayloadNoReply(e){const t=!0===e.internal;t||this.touchUserActivity(`sendBinaryPayloadNoReply cmdId=${e.cmdId}`),await this.connect(),t||this.kickIdleDisconnectTimer();const s=e.channel??this.opts.channel??0,r=e.channelIdOverride??(null==e.channel?250:s+1),n=this.nextMsgNum(),A=e.cmdId,i=e.extensionXml??H(s),o=Buffer.byteLength(i,"utf8"),a=o+e.payload.length,c=e.messageClass??p,l=T({cmdId:A,bodyLen:a,channelId:r,streamType:e.streamType??0,msgNum:n,responseCode:0,messageClass:c,payloadOffset:o}),h=e.encryption??this.enc,g=this.encodeBodyBinary(i,e.payload,r,h),d=Buffer.concat([l,g]);this.logDebug("tx",{cmdId:A,msgNum:n,channelId:r,messageClass:c,bodyLen:a,binaryPayload:!0}),this.debugCfg.traceTalk&&he(A)&&ce(this.debugCfg,this.logger,"BaichuanTalk",`tx cmdId=${A} msgNum=${n} channelId=${r} streamType=${e.streamType??0} class=0x${c.toString(16)} bodyLen=${a} payloadOffset=${o} binaryPayloadLen=${e.payload.length}`),this.recordTx({cmdId:A,responseCode:0,msgNum:n,channelId:r,streamType:e.streamType??0}),this.writeWire(d),t||this.kickIdleDisconnectTimer()}tryDecryptXml(e,t,s){const r=e=>e.toString("utf8"),n=s=>{let n;try{n="none"===s.kind?e:"bc"===s.kind?R(e,t):k(e,s.key)}catch{return}const A=r(n);return A.startsWith("<?xml")?A:void 0};return n(s)??("bc"!==s.kind?n({kind:"bc"}):void 0)??n({kind:"none"})??r(e)}async sendXml(e){const t=!0===e.internal;t||this.touchUserActivity(`sendXml cmdId=${e.cmdId}`),await this.connect(),t||this.kickIdleDisconnectTimer();const s=e.channel??this.opts.channel??0,r=e.channelIdOverride??(null==e.channel?250:s+1),n=this.nextMsgNum(),A=e.cmdId,i=e.extensionXml??(null!=e.channel?L(s):""),o=e.payloadXml??"",a=e.messageClass??p,c=Buffer.byteLength(i,"utf8"),l=c+Buffer.byteLength(o,"utf8"),h=T({cmdId:A,bodyLen:l,channelId:r,streamType:e.streamType??0,msgNum:n,responseCode:0,messageClass:a,payloadOffset:c}),g=`${A}:${n}`,d=e.encryption??this.enc,u=this.encodeBodyXml(i,o,r,d),E=Buffer.concat([h,u]),I=e.timeoutMs??1e4;let C;const B=new Promise(((e,t)=>{C=t;const s=setTimeout((()=>{this.pending.delete(g),t(new Error(`Baichuan timeout cmdId=${A} msgNum=${n}`))}),I);this.pending.set(g,{resolve:t=>{clearTimeout(s),e(t)},reject:e=>{clearTimeout(s),t(e)}})}));B.catch((()=>{})),this.logDebug("tx",{cmdId:A,msgNum:n,channelId:r,messageClass:a,bodyLen:l}),!this.debugCfg.traceStream||3!==A&&4!==A||ae(this.debugCfg,this.logger,"BaichuanTrace",`tx cmdId=${A} msgNum=${n} channelId=${r} streamType=${e.streamType??0} class=0x${a.toString(16)} bodyLen=${l} payloadOffset=${c}`),this.debugCfg.traceTalk&&he(A)&&ce(this.debugCfg,this.logger,"BaichuanTalk",`tx cmdId=${A} msgNum=${n} channelId=${r} streamType=${e.streamType??0} class=0x${a.toString(16)} bodyLen=${l} payloadOffset=${c}`),this.recordTx({cmdId:A,responseCode:0,msgNum:n,channelId:r,streamType:e.streamType??0}),this.writeWire(E);const Q=await B;if(this.logDebug("rx",{cmdId:Q.header.cmdId,responseCode:Q.header.responseCode,msgNum:Q.header.msgNum}),!this.debugCfg.traceStream||3!==A&&4!==A||ae(this.debugCfg,this.logger,"BaichuanTrace",`rx cmdId=${Q.header.cmdId} msgNum=${Q.header.msgNum} responseCode=${Q.header.responseCode} channelId=${Q.header.channelId} bodyLen=${Q.body.length} payloadLen=${Q.payload.length} payloadOffset=${Q.header.payloadOffset??0}`),this.debugCfg.traceTalk&&he(A)&&ce(this.debugCfg,this.logger,"BaichuanTalk",`rx cmdId=${Q.header.cmdId} msgNum=${Q.header.msgNum} responseCode=${Q.header.responseCode} channelId=${Q.header.channelId} bodyLen=${Q.body.length} payloadLen=${Q.payload.length} payloadOffset=${Q.header.payloadOffset??0}`),400===Q.header.responseCode){if(0===Q.body.length)throw new Error("Baichuan authentication failed (responseCode 400, empty body) - check username/password")}const f=Q.body;if(0===f.length)return t||this.kickIdleDisconnectTimer(),"";const m=this.tryDecryptXml(f,Q.header.channelId,d);return t||this.kickIdleDisconnectTimer(),m}async sendFrame(e){const t=!0===e.internal;t||this.touchUserActivity(`sendFrame cmdId=${e.cmdId}`),await this.connect(),t||this.kickIdleDisconnectTimer();const s=e.channel??this.opts.channel??0,r=e.channelIdOverride??(null==e.channel?250:s+1),n=e.msgNumOverride??this.nextMsgNum(),A=e.cmdId,i=e.extensionXml??(null!=e.channel?L(s):""),o=e.payloadXml??"",a=e.messageClass??p,c=Buffer.byteLength(i,"utf8"),l=c+Buffer.byteLength(o,"utf8"),h=T({cmdId:A,bodyLen:l,channelId:r,streamType:e.streamType??0,msgNum:n,responseCode:0,messageClass:a,payloadOffset:c}),g=`${A}:${n}`,d=e.encryption??this.enc,u=this.encodeBodyXml(i,o,r,d),E=Buffer.concat([h,u]),I=e.timeoutMs??1e4;let C;const B=new Promise(((e,t)=>{C=t;const s=setTimeout((()=>{this.pending.delete(g),t(new Error(`Baichuan timeout cmdId=${A} msgNum=${n}`))}),I);this.pending.set(g,{resolve:t=>{clearTimeout(s),e(t)},reject:e=>{clearTimeout(s),t(e)}})}));B.catch((()=>{})),this.logDebug("tx",{cmdId:A,msgNum:n,channelId:r,messageClass:a,bodyLen:l}),!this.debugCfg.traceStream||3!==A&&4!==A||ae(this.debugCfg,this.logger,"BaichuanTrace",`tx cmdId=${A} msgNum=${n} channelId=${r} streamType=${e.streamType??0} class=0x${a.toString(16)} bodyLen=${l} payloadOffset=${c}`),this.debugCfg.traceTalk&&he(A)&&ce(this.debugCfg,this.logger,"BaichuanTalk",`tx cmdId=${A} msgNum=${n} channelId=${r} streamType=${e.streamType??0} class=0x${a.toString(16)} bodyLen=${l} payloadOffset=${c}`),this.recordTx({cmdId:A,responseCode:0,msgNum:n,channelId:r,streamType:e.streamType??0}),this.writeWire(E);const Q=await B;return this.logDebug("rx",{cmdId:Q.header.cmdId,responseCode:Q.header.responseCode,msgNum:Q.header.msgNum}),!this.debugCfg.traceStream||3!==A&&4!==A||ae(this.debugCfg,this.logger,"BaichuanTrace",`rx cmdId=${Q.header.cmdId} msgNum=${Q.header.msgNum} responseCode=${Q.header.responseCode} channelId=${Q.header.channelId} bodyLen=${Q.body.length} payloadLen=${Q.payload.length} payloadOffset=${Q.header.payloadOffset??0}`),this.debugCfg.traceTalk&&he(A)&&ce(this.debugCfg,this.logger,"BaichuanTalk",`rx cmdId=${Q.header.cmdId} msgNum=${Q.header.msgNum} responseCode=${Q.header.responseCode} channelId=${Q.header.channelId} bodyLen=${Q.body.length} payloadLen=${Q.payload.length} payloadOffset=${Q.header.payloadOffset??0}`),t||this.kickIdleDisconnectTimer(),Q}async sendBinary(e){const t=!0===e.internal;if(t||this.touchUserActivity(`sendBinary cmdId=${e.cmdId}`),109===e.cmdId){const s=await this.sendBinarySnapshot109(e);return t||this.kickIdleDisconnectTimer(),s}if((e.messageClass??p)===f){const s=await this.sendBinaryFileDownload6482(e);return t||this.kickIdleDisconnectTimer(),s}await this.connect(),t||this.kickIdleDisconnectTimer();const s=e.channel??this.opts.channel??0,r=e.channelIdOverride??(null==e.channel?250:s+1),n=this.nextMsgNum(),A=e.cmdId,i=e.extensionXml??(null!=e.channel?H(s):H(void 0)),o=e.payloadXml??"",a=e.messageClass??p,c=Buffer.byteLength(i,"utf8"),l=c+Buffer.byteLength(o,"utf8"),h=T({cmdId:A,bodyLen:l,channelId:r,streamType:0,msgNum:n,responseCode:0,messageClass:a,payloadOffset:c}),g=`${A}:${n}`,d=e.encryption??this.enc,u=this.encodeBodyXml(i,o,r,d),E=Buffer.concat([h,u]),I=e.timeoutMs??1e4;let C;const B=new Promise(((e,t)=>{C=t;const s=setTimeout((()=>{this.pending.delete(g),t(new Error(`Baichuan timeout cmdId=${A} msgNum=${n}`))}),I);this.pending.set(g,{resolve:t=>{clearTimeout(s),e(t)},reject:e=>{clearTimeout(s),t(e)}})}));B.catch((()=>{})),this.logDebug("tx",{cmdId:A,msgNum:n,channelId:r,messageClass:a,bodyLen:l,binary:!0}),this.recordTx({cmdId:A,responseCode:0,msgNum:n,channelId:r,streamType:0}),this.writeWire(E);const Q=await B;if(this.logDebug("rx",{cmdId:Q.header.cmdId,responseCode:Q.header.responseCode,msgNum:Q.header.msgNum,binary:!0}),400===Q.header.responseCode){if(0===Q.body.length)throw new Error("Baichuan binary request failed (responseCode 400, empty body)")}const m=Q.payload;if(0===m.length)return Buffer.alloc(0);const y=this.tryDecryptBinary(m,Q.header.channelId,d);return t||this.kickIdleDisconnectTimer(),y}async sendBinaryFileDownload6482(e){await this.connect();const t=e.channel??this.opts.channel??0,s=e.channelIdOverride??(null==e.channel?250:t+1),r=this.nextMsgNum(),n=e.cmdId,A=e.extensionXml??H(t),i=e.payloadXml??"",o=e.messageClass??f,a=Buffer.byteLength(A,"utf8"),c=a+Buffer.byteLength(i,"utf8"),l=T({cmdId:n,bodyLen:c,channelId:s,streamType:e.streamType??0,msgNum:r,responseCode:0,messageClass:o,payloadOffset:a}),h=e.encryption??this.enc,g=this.encodeBodyXml(A,i,s,h),d=Buffer.concat([l,g]),u=e.timeoutMs??6e4,E=[];let I=0,C=0;return await new Promise(((t,A)=>{let i,a=!1;const l=()=>{this.off("frame",B),i&&clearTimeout(i)},g=e=>{a||(a=!0,l(),A(e instanceof Error?e:new Error(String(e))))},B=e=>{var s;if(e.header.cmdId===n)if(e.header.msgNum===r&&e.header.responseCode>=400)g(new Error(`Baichuan file download request rejected (cmdId=${n} msgNum=${r} responseCode=${e.header.responseCode})`));else try{let A=!1;if(e.extension.length>0)try{this.tryDecryptXml(e.extension,e.header.channelId,h).includes("<binaryData>1</binaryData>")&&(A=!0)}catch{}const i=this.tryDecryptBinary(e.payload,e.header.channelId,h);if(0===i.length)return;if(!A&&(e=>{let t=0;for(;t<e.length&&(0===e[t]||9===e[t]||10===e[t]||13===e[t]||32===e[t]);)t++;return!(t>=e.length)&&60===e[t]})(i))return;E.push(i),I+=i.length;const o=Date.now();this.debugCfg.general&&o-C>=2e3&&(C=o,this.logDebug("file_download_progress",{cmdId:n,msgNum:r,bytes:I})),201===e.header.responseCode&&(s=Buffer.concat(E),a||(a=!0,l(),t(s)))}catch(e){g(e)}};i=setTimeout((()=>{g(new Error(`Baichuan timeout waiting file download chunks cmdId=${n} msgNum=${r}`))}),u),this.on("frame",B);try{this.logDebug("tx",{cmdId:n,msgNum:r,channelId:s,messageClass:o,bodyLen:c,binary:!0,fileDownload:!0}),this.recordTx({cmdId:n,responseCode:0,msgNum:r,channelId:s,streamType:e.streamType??0}),this.writeWire(d)}catch(e){g(e)}}))}async sendBinarySnapshot109(e){await this.connect();const t=e.channel??this.opts.channel??0,s=e.channelIdOverride??(null==e.channel?250:t+1),r=this.nextMsgNum(),n=e.cmdId,A=e.extensionXml??(null!=e.channel?L(t):""),i=e.payloadXml??"",o=e.messageClass??p,a=Buffer.byteLength(A,"utf8"),c=a+Buffer.byteLength(i,"utf8"),l=T({cmdId:n,bodyLen:c,channelId:s,streamType:e.streamType??0,msgNum:r,responseCode:0,messageClass:o,payloadOffset:a}),h=e.encryption??this.enc,g=this.encodeBodyXml(A,i,s,h),d=Buffer.concat([l,g]),u=e.timeoutMs??15e3,E=[];let I=!1;return await new Promise(((t,A)=>{let i,a=!1;const l=()=>{this.off("frame",B),i&&clearTimeout(i)},g=e=>{a||(a=!0,l(),t(e))},C=e=>{a||(a=!0,l(),A(e instanceof Error?e:new Error(String(e))))},B=e=>{if(e.header.cmdId===n)if(e.header.msgNum===r&&e.header.responseCode>=400)C(new Error(`Baichuan snapshot request rejected (cmdId=${n} msgNum=${r} responseCode=${e.header.responseCode})`));else try{let t=!1;if(e.extension.length>0){this.tryDecryptXml(e.extension,e.header.channelId,h).includes("<binaryData>1</binaryData>")&&(t=!0)}const s=this.tryDecryptBinary(e.payload,e.header.channelId,h);if(0===s.length)return;const r=s.subarray(0,Math.min(16,s.length)).toString("utf8"),n=r.startsWith("<?xml")||r.trimStart().startsWith("<");if(!t&&n)return;let A=s;if(!I){const r=(e=>{for(let t=0;t+1<e.length;t++)if(255===e[t]&&216===e[t+1])return t;return-1})(s);if(-1===r){if(!t)return;A=s,E.push(A);const r=Buffer.concat(E);return void(201===e.header.responseCode&&g(r))}I=!0,A=s.subarray(r)}E.push(A);const i=Buffer.concat(E);if((e=>{for(let t=0;t+1<e.length;t++)if(255===e[t]&&217===e[t+1])return!0;return!1})(i)||201===e.header.responseCode){const e=i.indexOf(Buffer.from([255,217]));if(-1!==e)return void g(i.subarray(0,e+2));g(i)}}catch(e){C(e)}};i=setTimeout((()=>{C(new Error(`Baichuan timeout waiting snapshot push cmdId=${n} msgNum=${r}`))}),u),this.on("frame",B);try{this.logDebug("tx",{cmdId:n,msgNum:r,channelId:s,messageClass:o,bodyLen:c,binary:!0,snapshot:!0}),this.recordTx({cmdId:n,responseCode:0,msgNum:r,channelId:s,streamType:e.streamType??0}),this.writeWire(d)}catch(e){C(e)}}))}tryDecryptBinary(e,t,s){if(0===e.length)return e;const r=s=>{try{return"none"===s.kind?e:"bc"===s.kind?R(e,t):"aes"===s.kind||"full_aes"===s.kind?k(e,s.key):null}catch{return null}};return r(s)??("bc"===s.kind||"none"===this.enc.kind||"aes"!==this.enc.kind&&"full_aes"!==this.enc.kind?null:r(this.enc))??("bc"!==s.kind?r({kind:"bc"}):null)??r({kind:"none"})??e}async login(e="full_aes"){if(this.loggedIn)return;let t,s=e;const r=e=>new Promise((t=>setTimeout(t,e)));for(let e=1;e<=3;e++)try{const e="none"===s?56320:"bc"===s?56321:56338;await this.connect();const t=this.nextMsgNum(),r=1,A=T({cmdId:r,bodyLen:0,channelId:250,streamType:0,msgNum:t,responseCode:e,messageClass:25876}),i=`${r}:${t}`,o=new Promise(((e,t)=>{const s=setTimeout((()=>{this.pending.delete(i),t(new Error("Baichuan timeout waiting for nonce"))}),1e4);this.pending.set(i,{resolve:t=>{clearTimeout(s),e(t)},reject:e=>{clearTimeout(s),t(e)}})}));o.catch((()=>{})),this.writeWire(A);const a=await o,c=a.header.responseCode;if(c>>>8!=221)throw new Error(`Baichuan login: expected encryption info (0xDDxx), got 0x${c.toString(16)}`);const l=255&c,h=P(this.tryDecryptXml(a.body,a.header.channelId,0===l?{kind:"none"}:{kind:"bc"}),"nonce");if(!h)throw new Error("Baichuan login: nonce not found in XML");if(this.nonce=h,0===l)this.enc={kind:"none"};else if(1===l)this.enc={kind:"bc"};else if(2===l)this.enc={kind:"aes",key:b(h,this.opts.password)};else{if(18!==l)throw new Error(`Baichuan login: unknown encType=0x${l.toString(16)}`);this.enc={kind:"full_aes",key:b(h,this.opts.password)}}const g=D(`${this.opts.username}${h}`),d=D(`${this.opts.password}${h}`),u=(n=d,`<?xml version="1.0" encoding="UTF-8" ?>\n<body>\n<LoginUser version="1.1">\n<userName>${U(g)}</userName>\n<password>${U(n)}</password>\n<userVer>1</userVer>\n</LoginUser>\n<LoginNet version="1.1">\n<type>LAN</type>\n<udpPort>0</udpPort>\n</LoginNet>\n</body>`);this.logDebug("login_hash",{username:this.opts.username,nonce:h,userHash:g,passHashLength:d.length,loginXmlLength:u.length,loginXmlPreview:u.substring(0,200)});const E=await this.sendFrame({cmdId:1,payloadXml:u,extensionXml:"",messageClass:p,encryption:{kind:"bc"},timeoutMs:1e4}),I=this.tryDecryptXml(E.body,E.header.channelId,{kind:"bc"});if(this.logDebug("login_reply",{replyLength:I.length,replyPreview:I.substring(0,200),startsWithXml:I.startsWith("<?xml")}),0===I.length)throw new Error("Baichuan login failed: empty reply (camera may be sleeping/waking, session may be stale, or username/password may be invalid)");if(!I.startsWith("<?xml")){const e=I.length>0?I.substring(0,100):"(empty)";throw new Error(`Baichuan login: unexpected non-XML reply (length: ${I.length}, preview: ${e})`)}return void(this.loggedIn=!0)}catch(n){t=n,this.loggedIn=!1;const A=String(n&&"object"==typeof n&&"message"in n?n.message:n);(A.includes("timeout waiting for nonce")||A.includes("expected encryption info")||A.includes("Baichuan socket closed")||A.includes("ECONNRESET")||A.includes("EPIPE"))&&("full_aes"===s||"aes"===s?s="bc":"bc"===s&&(s="none"));try{await this.close()}catch{}if(e<3){await r(1500);continue}throw n}var n;throw t instanceof Error?t:new Error(String(t))}},de=class e{static sessionPool=new Map;host;username;password;port;useHttps;insecureTLS;timeoutMs;token;tokenExpiresAt;httpsAgent;constructor(e){this.host=e.host,this.username=e.username,this.password=e.password,this.port=e.port,this.useHttps=e.useHttps,this.insecureTLS=e.insecureTLS??!0,this.timeoutMs=e.timeoutMs??3e4,this.insecureTLS&&(this.httpsAgent=new l.g6({connect:{rejectUnauthorized:!1}}))}getUsername(){return this.username}getToken(){return this.token}clearToken(){this.token=void 0,this.tokenExpiresAt=void 0}sessionKey(){const e=this.useHttps?"https":"http",t=this.port??(this.useHttps?443:80);return`${e}://${this.host}:${t}|${this.username}`}getSharedSession(){const t=this.sessionKey(),s=e.sessionPool.get(t);if(s)return s;const r={};return e.sessionPool.set(t,r),r}baseUrl(){const e=this.useHttps?"https":"http",t=this.port??(this.useHttps?443:80);return`${e}://${this.host}:${t}`}apiUrl(e){const t=new URLSearchParams;for(const[s,r]of Object.entries(e))null!=r&&t.set(s,String(r));return`${this.baseUrl()}/cgi-bin/api.cgi?${t.toString()}`}isTokenValid(){return!(!this.token||!this.tokenExpiresAt)&&Date.now()+1e4<this.tokenExpiresAt}isSharedTokenValid(e){return!(!e.token||!e.tokenExpiresAt)&&Date.now()+1e4<e.tokenExpiresAt}async performLogin(){const e=[{cmd:"Login",action:0,param:{User:{userName:this.username,password:this.password}}}],t=await this.sendJson(e,{cmd:"Login"},{includeToken:!1}),s=t[0];if(!s||0!==s.code||!s.value?.Token?.name)throw new Error(`Login failed: ${JSON.stringify(t)}`);const r=Number(s.value.Token.leaseTime),n=s.value.Token.name,A=Date.now()+(Number.isFinite(r)?1e3*r:0);this.token=n,this.tokenExpiresAt=A;const i=this.getSharedSession();i.token=n,i.tokenExpiresAt=A}async login(){if(this.isTokenValid())return;const e=this.getSharedSession();return this.isSharedTokenValid(e)?(this.token=e.token,void(this.tokenExpiresAt=e.tokenExpiresAt)):e.loginInFlight?(await e.loginInFlight,void(this.isSharedTokenValid(e)&&(this.token=e.token,this.tokenExpiresAt=e.tokenExpiresAt))):(e.loginInFlight=(async()=>{try{await this.performLogin()}finally{delete e.loginInFlight}})(),void await e.loginInFlight)}async logout(){if(this.token)try{await this.call("Logout",{action:0,param:{}})}finally{this.clearToken();const e=this.getSharedSession();delete e.token,delete e.tokenExpiresAt}}async call(e,t){await this.login();const s=[{cmd:e,action:t?.action??0,...t&&"param"in t&&void 0!==t.param?{param:t.param}:{}}];return await this.sendJson(s,{cmd:e,token:this.token},{includeToken:!0})}async callMany(e){return await this.login(),await this.sendJson(e,{token:this.token},{includeToken:!0})}async sendJson(e,t,s){const r=this.apiUrl(t),n=new AbortController,A=setTimeout((()=>n.abort()),this.timeoutMs);try{const t={method:"POST",body:JSON.stringify(e),headers:{"Content-Type":"application/json"},signal:n.signal};this.useHttps&&this.httpsAgent&&(t.dispatcher=this.httpsAgent);const s=await fetch(r,t),A=await s.text();if(!s.ok)throw new Error(`HTTP ${s.status}: ${A}`);return JSON.parse(A)}finally{clearTimeout(A)}}async snap(e,t){if(await this.login(),!this.token)throw new Error("Missing token after login");const s=t?.rs??Date.now().toString(),r=this.apiUrl({cmd:"Snap",channel:e,rs:s,token:this.token}),n=new AbortController,A=setTimeout((()=>n.abort()),t?.timeoutMs??this.timeoutMs);try{const e={method:"GET",signal:n.signal};this.useHttps&&this.httpsAgent&&(e.dispatcher=this.httpsAgent);const t=await fetch(r,e);if(!t.ok){const e=await t.text().catch((()=>""));throw new Error(`HTTP ${t.status}: ${e}`)}const s=await t.arrayBuffer();return Buffer.from(s)}finally{clearTimeout(A)}}async downloadVod(e,t,s){if(await this.login(),!this.token)throw new Error("Missing token after login");const r=this.useHttps?"https":"http",n=this.port??(this.useHttps?443:80),A=e.replaceAll(" ","%20"),i=t?encodeURIComponent(t):void 0,o=s?encodeURIComponent(s):void 0,a=encodeURIComponent(this.token),c=`${r}://${this.host}:${n}/cgi-bin/api.cgi?cmd=Download&source=${A}${i?`&output=${i}`:""}${o?`&start=${o}`:""}&token=${a}`,l=new AbortController,h=setTimeout((()=>l.abort()),this.timeoutMs);try{const e={method:"POST",body:"[{}]",headers:{"Content-Type":"application/json"},signal:l.signal};this.useHttps&&this.httpsAgent&&(e.dispatcher=this.httpsAgent);const t=await fetch(c,e);if(!t.ok){const e=await t.text().catch((()=>""));throw new Error(`HTTP ${t.status}: ${e}`)}const s=await t.arrayBuffer();return Buffer.from(s)}finally{clearTimeout(h)}}},ue=class{client;constructor(e){this.client=new de(e)}async login(){await this.client.login()}async logout(){await this.client.logout()}async call(e,t,s=0){return void 0===t?await this.client.call(e,{action:s}):await this.client.call(e,{action:s,param:t})}async callMany(e){return await this.client.callMany(e)}async GetDevInfo(e){const t=null==e?{}:{channel:e};return await this.call("GetDevInfo",t)}async getInfo(e,t){const s=await this.GetDevInfo(e),r=s?.[0]?.value?.DevInfo,n={},A=r?.type??r?.model??r?.exactType,i=r?.exactType??r?.model??r?.detail;"string"==typeof A&&(n.type=A),"string"==typeof r?.hardVer&&(n.hardwareVersion=r.hardVer),"string"==typeof r?.firmVer&&(n.firmwareVersion=r.firmVer),"string"==typeof i&&(n.itemNo=i),"string"==typeof r?.serial&&(n.serialNumber=r.serial),"string"==typeof r?.name&&(n.name=r.name);const o=t?.tags?.length?t.tags:["type","hardwareVersion","firmwareVersion","itemNo","serialNumber","name"],a={};for(const e of o){const t=n[e];"string"==typeof t&&(a[e]=t)}return a}async GetChnTypeInfo(e){const t=null==e?{}:{channel:e};return await this.call("GetChnTypeInfo",t)}async GetChannelstatus(){return await this.call("GetChannelstatus",void 0,0)}async GetLocalLink(e){const t=null==e?{}:{channel:e};return await this.call("GetLocalLink",t)}async GetWifiSignal(e){const t=null==e?{}:{channel:e};return await this.call("GetWifiSignal",t)}async GetOsd(e){const t=null==e?{}:{channel:e};return await this.call("GetOsd",t,1)}async SetOsd(e){return await this.call("SetOsd",e,0)}async GetEnc(e){const t=null==e?{}:{channel:e};return await this.call("GetEnc",t,1)}async GetAiState(e){const t=null==e?{}:{channel:e};return await this.call("GetAiState",t,0)}async GetMdState(e){const t=null==e?{}:{channel:e};return await this.call("GetMdState",t,0)}async GetEvents(e){const t=null==e?{}:{channel:e};return await this.call("GetEvents",t,0)}async GetBatteryInfo(e){const t=null==e?{}:{channel:e};return await this.call("GetBatteryInfo",t,0)}async GetWhiteLed(e){const t=null==e?{}:{channel:e};return await this.call("GetWhiteLed",t,0)}async SetWhiteLed(e){return await this.call("SetWhiteLed",e,0)}async GetPirInfo(e){const t=null==e?{}:{channel:e};return await this.call("GetPirInfo",t,0)}async SetPirInfo(e){return await this.call("SetPirInfo",e,0)}async GetPtzPreset(e){const t=null==e?{}:{channel:e};return await this.call("GetPtzPreset",t,1)}async GetAudioAlarmV20(e){const t=null==e?{}:{channel:e};return await this.call("GetAudioAlarmV20",t,0)}async AudioAlarmPlay(e){return await this.call("AudioAlarmPlay",e,0)}async GetNetPort(){return await this.call("GetNetPort",{})}async SetNetPort(e){return await this.call("SetNetPort",{NetPort:e})}async Reboot(e){const t=null==e?{}:{channel:e};return await this.call("Reboot",t)}async GetAbility(){const e=this.client.getUsername();return await this.call("GetAbility",{User:{userName:e}})}async getChannels(){const e=await this.GetChannelstatus(),t=e?.[0]?.value?.status;return{channels:(t??[]).filter((e=>!!e?.uid)).map((e=>Number(e?.channel))).filter((e=>Number.isFinite(e))),channelsResponse:e}}async getHubInfo(){const e=[{cmd:"GetAbility",action:0,param:{User:{userName:this.client.getUsername()}}},{cmd:"GetDevInfo",action:0,param:{}}],t=await this.callMany(e),s=t.find((e=>"GetAbility"===e?.cmd))?.value,r=t.find((e=>"GetDevInfo"===e?.cmd))?.value,n=r?.DevInfo;return{abilities:s,hubData:r,devInfo:n,response:t}}async getDevicesInfo(){const{channels:e,channelsResponse:t}=await this.getChannels(),s=this.client.getUsername(),r=[];r.push({cmd:"GetAbility",action:0,param:{User:{userName:s}}});for(const t of e)r.push({cmd:"GetChnTypeInfo",action:0,param:{channel:t}},{cmd:"GetAiState",action:0,param:{channel:t}},{cmd:"GetEnc",action:1,param:{channel:t}});const n=await this.callMany(r),A=n[0]?.value,i=A?.Ability?.abilityChn,o={};for(let s=0;s<e.length;s++){const r=e[s],A=1+3*s,a=n[A],c=n[A+1],l=n[A+2],h=t?.[0]?.value?.status?.find((e=>e?.channel===r)),g={entries:[a,c,l]};h&&(g.channelStatus=h);const d=i?.[r];d&&(g.abilities=d),a?.error||(g.channelInfo=a?.value),c?.error||(g.ai=c?.value),l?.error||(g.enc=l?.value),o[r]=g}return{devicesData:o,response:n,channels:e,channelsResponse:t,requestBody:r}}async getAllChannelsEvents(){const{channels:e,channelsResponse:t}=await this.getChannels(),s=[],r={};for(const t of e)r[t]={},s.push({cmd:"GetEvents",action:0,param:{channel:t}}),r[t].events=s.length-1,s.push({cmd:"GetMdState",action:0,param:{channel:t}}),r[t].motion=s.length-1,s.push({cmd:"GetAiState",action:0,param:{channel:t}}),r[t].ai=s.length-1;const n=await this.callMany(s),A=e=>{const t=[];for(const s of Object.keys(e??{})){if("channel"===s)continue;const r=e?.[s]?.alarm_state;r&&t.push(s)}return t},i={};for(const t of e){const{events:e,motion:s,ai:o}=r[t]??{},a=null!=e?n[e]:void 0,c=null!=s?n[s]:void 0,l=null!=o?n[o]:void 0,h=new Set;for(const e of A(l?.value))h.add(e);for(const e of A(a?.value?.ai??a?.value))h.add(e);const g=Array.from(h),d=g.filter((e=>"other"!==e)),u=!!c?.value?.state||g.length>0;i[t]={motion:u,objects:d,entries:[a,c,l]}}return{parsed:i,response:n,channels:e,channelsResponse:t,requestBody:s}}async getAllChannelsBatteryInfo(){const{channels:e,channelsResponse:t}=await this.getChannels(),s=[{cmd:"GetChannelstatus"}],r={};for(const t of e)s.push({cmd:"GetBatteryInfo",action:0,param:{channel:t}}),r[t]=s.length-1;const n=await this.callMany(s),A=n[0],i={};for(const t of e){const e=n[r[t]]?.value?.Battery??void 0,s=A?.value?.status?.find((e=>e?.channel===t));i[t]={entries:[e,s],batteryLevel:Number(e?.batteryPercent??0),sleeping:1===s?.sleep}}return{batteryInfoData:i,response:n,channels:e,channelsResponse:t,requestBody:s}}async getStatusInfo(e){const t=[],s={};for(const[r,n]of e.entries())s[r]={},n.sleeping||(t.push({cmd:"GetOsd",action:1,param:{channel:r}}),s[r].osd=t.length-1,n.hasFloodlight&&(t.push({cmd:"GetWhiteLed",action:0,param:{channel:r}}),s[r].floodlight=t.length-1),n.hasPirEvents&&(t.push({cmd:"GetPirInfo",action:0,param:{channel:r}}),s[r].pir=t.length-1),n.hasPtz&&(t.push({cmd:"GetPtzPreset",action:1,param:{channel:r}}),s[r].presets=t.length-1));const r=await this.callMany(t),n={};for(const[t,A]of e.entries()){const{osd:e,floodlight:i,pir:o,presets:a}=s[t]??{};if(n[t]={entries:[]},null!=e){const s=r[e];n[t].osd=s,n[t].entries.push(s)}if(A.hasFloodlight&&null!=i){const e=r[i];n[t].floodlightEnabled=1===e?.value?.WhiteLed?.state,n[t].entries.push(e)}if(A.hasPirEvents&&null!=o){const e=r[o];n[t].pirEnabled=1===e?.value?.pirInfo?.enable,n[t].entries.push(e)}if(A.hasPtz&&null!=a){const e=r[a],s=e?.value?.PtzPreset;n[t].ptzPresets=Array.isArray(s)?s.filter((e=>1===e?.enable)):[],n[t].entries.push(e)}}return{deviceStatusData:n,response:r}}async getOsd(e){const t=await this.GetOsd(e);return t?.[0]}async setOsd(e,t){const s=t?.value?.Osd??t?.Osd,r={Osd:{channel:e,osdChannel:s?.osdChannel??t?.osdChannel,osdTime:s?.osdTime??t?.osdTime}};await this.call("SetOsd",r,0)}async getEncoderConfiguration(e){const t=await this.GetEnc(e);return t?.[0]?.value?.Enc}async jpegSnapshot(e,t=1e4){return await this.client.snap(e,{timeoutMs:t})}async getSiren(e){const t=await this.GetAudioAlarmV20(e);return{enabled:1===t?.[0]?.value?.Audio?.enable}}async setSiren(e,t,s){const r=s?{channel:e,alarm_mode:"times",times:s}:{channel:e,alarm_mode:"manul",manual_switch:t?1:0},n=await this.AudioAlarmPlay(r);return{value:n?.[0]?.value??n?.value,data:n}}async setWhiteLedState(e,t,s){const r={channel:e};void 0!==t&&(r.state=t?1:0),void 0!==s&&(r.bright=s),await this.SetWhiteLed({WhiteLed:r})}async getPirState(e){const t=await this.GetPirInfo(e),s=t?.[0]?.value?.pirInfo;return{enabled:1===s?.enable,state:s}}async setPirState(e,t){const s=await this.getPirState(e),r=t?1:0,n=s?.state?.enable;if(n===r)return;const A={...s?.state&&"object"==typeof s.state?s.state:{},channel:e,enable:r};await this.SetPirInfo({pirInfo:A})}async getLocalLink(e){const t=[{cmd:"GetLocalLink",action:0,param:{}},{cmd:"GetWifiSignal",action:0,param:{channel:e}}],s=await this.callMany(t),r=s.find((e=>"GetLocalLink"===e?.cmd))?.value?.LocalLink?.activeLink,n=s.find((e=>"GetWifiSignal"===e?.cmd))?.value?.wifiSignal;let A=!1;return void 0!==n&&(A=n>=0&&n<=4),!A&&r&&(A="LAN"!==r),{activeLink:r,wifiSignal:n,isWifi:A}}};function Ee(e){const t=e.port??554,s=function(e,t){let s;return s="main"===t?"main":"sub"===t?"sub":"ext",`/h264Preview_${String(e+1).padStart(2,"0")}_${s}`}(e.channel,e.stream);return`rtsp://${encodeURIComponent(e.username)}:${encodeURIComponent(e.password)}@${e.host}:${t}${s}`}function Ie(e){if(e.length<4)return null;const t=e.readUInt32LE(0);return 825241649===t?function(e){if(e.length<32)return null;const t=e.readUInt32LE(4);if(32!==t)return null;const s={type:"InfoV1",videoWidth:e.readUInt32LE(8),videoHeight:e.readUInt32LE(12),fps:e.readUInt8(17),startYear:e.readUInt8(18),startMonth:e.readUInt8(19),startDay:e.readUInt8(20),startHour:e.readUInt8(21),startMin:e.readUInt8(22),startSeconds:e.readUInt8(23),endYear:e.readUInt8(24),endMonth:e.readUInt8(25),endDay:e.readUInt8(26),endHour:e.readUInt8(27),endMin:e.readUInt8(28),endSeconds:e.readUInt8(29)};return{media:s,consumed:32}}(e):842018865===t?function(e){if(e.length<32)return null;const t=e.readUInt32LE(4);if(32!==t)return null;const s={type:"InfoV2",videoWidth:e.readUInt32LE(8),videoHeight:e.readUInt32LE(12),fps:e.readUInt8(17),startYear:e.readUInt8(18),startMonth:e.readUInt8(19),startDay:e.readUInt8(20),startHour:e.readUInt8(21),startMin:e.readUInt8(22),startSeconds:e.readUInt8(23),endYear:e.readUInt8(24),endMonth:e.readUInt8(25),endDay:e.readUInt8(26),endHour:e.readUInt8(27),endMin:e.readUInt8(28),endSeconds:e.readUInt8(29)};return{media:s,consumed:32}}(e):t>=1667510320&&t<=1667510329?function(e){if(e.length<20)return null;const t=e.toString("utf8",4,8);if("H264"!==t&&"H265"!==t)return null;const s=t,r=e.readUInt32LE(8),n=e.readUInt32LE(12),A=e.readUInt32LE(16);let i=20;const o=e.readUInt32LE(i);let a;if(i+=4,e.length<i+n)return null;const c=e.subarray(i,i+n);n>=4&&(a=c.readUInt32LE(0));if(i+=n,e.length<i+r)return null;const l=e.subarray(i,i+r);i+=r;const h=r%8==0?0:8-r%8;if(e.length<i+h)return null;i+=h;return{media:{type:"Iframe",videoType:s,microseconds:A,...void 0!==a?{time:a}:{},additionalHeader:c,additionalHeaderSize:n,unknown:o,data:l},consumed:i}}(e):t>=1667510576&&t<=1667510585?function(e){if(e.length<20)return null;const t=e.toString("utf8",4,8);if("H264"!==t&&"H265"!==t)return null;const s=t,r=e.readUInt32LE(8),n=e.readUInt32LE(12),A=e.readUInt32LE(16);let i=20;const o=e.readUInt32LE(i);if(i+=4,e.length<i+n)return null;const a=e.subarray(i,i+n);if(i+=n,e.length<i+r)return null;const c=e.subarray(i,i+r);i+=r;const l=r%8==0?0:8-r%8;if(e.length<i+l)return null;i+=l;return{media:{type:"Pframe",videoType:s,microseconds:A,additionalHeader:a,additionalHeaderSize:n,unknown:o,data:c},consumed:i}}(e):1651979568===t?function(e){if(e.length<12)return null;const t=e.readUInt16LE(4),s=e.readUInt16LE(6);if(t!==s)return null;const r=8,n=r+t+(t%8==0?0:8-t%8);if(e.length<n)return null;const A=e.subarray(r,r+t);return{media:{type:"Aac",data:A},consumed:n}}(e):1651978544===t?function(e){if(e.length<12)return null;const t=e.readUInt16LE(4),s=e.readUInt16LE(6);if(t!==s)return null;const r=e.readUInt16LE(8);if(256!==r)return null;e.readUInt16LE(10);const n=4;if(t<n)return null;const A=t-n,i=12,o=i+A+(t%8==0?0:8-t%8);if(e.length<o)return null;const a=e.subarray(i,i+A);return{media:{type:"Adpcm",data:a},consumed:o}}(e):null}var Ce=class{buffer=Buffer.alloc(0);strict;amountSkipped=0;logger;constructor(e=!1,t){this.strict=e,this.logger=t}decode(e){this.buffer=0===this.buffer.length?e:Buffer.concat([this.buffer,e]);const t=[];for(;this.buffer.length>=4;){const e=Ie(this.buffer);if(!e){const e=this.buffer.readUInt32LE(0);if(825241649===e||842018865===e||e>=1667510320&&e<=1667510329||e>=1667510576&&e<=1667510585||1651979568===e||1651978544===e)break;if(this.strict)throw new Error(`[BcMediaCodec] Invalid data in stream (no valid magic at buffer start, len=${this.buffer.length})`);0===this.amountSkipped&&this.logger?.warn("[BcMediaCodec] Error in stream, attempting to recover..."),this.amountSkipped+=this.buffer.length,this.buffer=Buffer.alloc(0);break}this.amountSkipped>0&&(this.strict,this.logger?.warn(`[BcMediaCodec] Recovered stream after skipping ${this.amountSkipped} bytes`),this.amountSkipped=0),t.push(e.media),this.buffer=this.buffer.subarray(e.consumed)}return t}getRemainingBuffer(){return this.buffer}clear(){this.buffer=Buffer.alloc(0),this.amountSkipped=0}},Be=Buffer.from([0,0,0,1]),Qe=Buffer.from([0,0,1]);function pe(e){return!(e.length<4)&&(!!e.subarray(0,4).equals(Be)||!!e.subarray(0,3).equals(Qe))}function fe(e,t){const s=[];let r=0,n=0;for(;r<e.length;){if(r+4>e.length)return null;const A=t(e,r);if(r+=4,A<=0)return null;if(A>e.length-r)return null;s.push(Be),s.push(e.subarray(r,r+A)),r+=A,n++}return 0===n?null:Buffer.concat(s)}function me(e,t){const s=[];let r=0,n=0;for(;r<e.length;){if(r+2>e.length)return null;const A=t(e,r);if(r+=2,A<=0)return null;if(A>e.length-r)return null;s.push(Be),s.push(e.subarray(r,r+A)),r+=A,n++}return 0===n?null:Buffer.concat(s)}function ye(e,t){const s=[];let r=0,n=0;const A=(e,s)=>{if(s+3>e.length)return 0;const r=e[s],n=e[s+1],A=e[s+2];return"be"===t?(r<<16|n<<8|A)>>>0:(A<<16|n<<8|r)>>>0};for(;r<e.length;){if(r+3>e.length)return null;const t=A(e,r);if(r+=3,t<=0)return null;if(t>e.length-r)return null;s.push(Be),s.push(e.subarray(r,r+t)),r+=t,n++}return 0===n?null:Buffer.concat(s)}function we(e){if(pe(e))return e;const t=Buffer.from([0,0,0,1]),s=Buffer.from([0,0,1]),r=Math.min(64,e.length),n=e.subarray(0,r).indexOf(t);if(n>0)return e.subarray(n);const A=e.subarray(0,r).indexOf(s);if(A>0)return e.subarray(A);const i=fe(e,((e,t)=>e.readUInt32BE(t)));if(i)return i;const o=fe(e,((e,t)=>e.readUInt32LE(t)));if(o)return o;const a=ye(e,"be");if(a)return a;const c=ye(e,"le");if(c)return c;const l=me(e,((e,t)=>e.readUInt16BE(t)));if(l)return l;const h=me(e,((e,t)=>e.readUInt16LE(t)));if(h)return h;const g=function(e){if(e.length<1)return null;const t=31&e[0],s=[],r=e=>{0!==e.length&&s.push(Be,e)};if(24===t){let t=1;for(;t+2<=e.length;){const s=e.readUInt16BE(t);if(t+=2,s<=0||t+s>e.length)return null;r(e.subarray(t,t+s)),t+=s}return s.length?Buffer.concat(s):null}if(25===t){let t=3;if(t>e.length)return null;for(;t+2<=e.length;){const s=e.readUInt16BE(t);if(t+=2,s<=0||t+s>e.length)return null;r(e.subarray(t,t+s)),t+=s}return s.length?Buffer.concat(s):null}if(26===t){let t=3;if(t>e.length)return null;for(;t+2<=e.length;){const s=e.readUInt16BE(t);if(t+=2,t+1+2>e.length)return null;if(t+=1,t+=2,s<=0||t+s>e.length)return null;r(e.subarray(t,t+s)),t+=s}return s.length?Buffer.concat(s):null}if(27===t){let t=3;if(t>e.length)return null;for(;t+2<=e.length;){const s=e.readUInt16BE(t);if(t+=2,t+1+3>e.length)return null;if(t+=1,t+=3,s<=0||t+s>e.length)return null;r(e.subarray(t,t+s)),t+=s}return s.length?Buffer.concat(s):null}return null}(e);return g||(function(e){if(e.length<1)return!1;const t=e[0];if(void 0===t)return!1;if(128&t)return!1;const s=31&t;return s>=1&&s<=23}(e)?Buffer.concat([Be,e]):e)}function Se(e){const t=[];for(let s=0;s<e.length-3;s++)0===e[s]&&0===e[s+1]&&(1===e[s+2]?(t.push({idx:s,len:3}),s+=2):0===e[s+2]&&1===e[s+3]&&(t.push({idx:s,len:4}),s+=3));if(0===t.length)return[];const s=[];for(let r=0;r<t.length;r++){const n=t[r],A=n.idx+n.len,i=t[r+1]?t[r+1].idx:e.length;i>A&&s.push(e.subarray(A,i))}return s}function De(e){if(!pe(e))return!1;const t=Se(e);if(0===t.length)return!1;for(const e of t){if(e.length<1)return!1;const t=e[0];if(void 0===t)return!1;if(128&t)return!1;const s=31&t;if(0===s||s>=24)return!1}return!0}function be(e){const t=Se(e);let s=!1,r=!1,n=!1;for(const e of t){const t=31&(e[0]??0);7===t&&(s=!0),8===t&&(r=!0),5===t&&(n=!0)}return n&&s&&r}var ve=class e{fuNalHeader=null;fuParts=[];static parseRtpPayload(e){if(!e||e.length<12)return null;if(2!==(e[0]>>6&3))return null;const t=!!(32&e[0]),s=!!(16&e[0]);let r=12+4*(15&e[0]);if(r>e.length)return null;if(s){if(r+4>e.length)return null;if(r+=4+4*e.readUInt16BE(r+2),r>e.length)return null}let n=e.length;if(t){const t=e[e.length-1];if(t<=0||t>e.length)return null;if(n=e.length-t,n<r)return null}return n<=r?null:e.subarray(r,n)}reset(){this.fuNalHeader=null,this.fuParts=[]}push(t){if(0===t.length)return[];const s=e.parseRtpPayload(t);if(s&&(t=s),pe(t))return[t];const r=t[0];if(128&r)return[];const n=31&r;if(n>=1&&n<=23)return[Buffer.concat([Be,t])];if(24===n){if(t.length<3)return[];let e=1;const s=[];for(;e+2<=t.length;){const r=t.readUInt16BE(e);if(e+=2,r<=0||e+r>t.length)return[];const n=t.subarray(e,e+r);if(e+=r,n.length<1)return[];if(128&n[0])return[];const A=31&n[0];if(0===A||A>=24)return[];s.push(Buffer.concat([Be,n]))}return s}if(28===n||29===n){if(t.length<2)return[];const e=t[0],s=t[1],r=!!(128&s),A=!!(64&s),i=224&e|31&s;let o=2;if(29===n){if(t.length<o+2)return[];o+=2}const a=t.subarray(o);if(r)this.fuNalHeader=i,this.fuParts=[a];else{if(null==this.fuNalHeader)return[];this.fuParts.push(a)}if(A&&null!=this.fuNalHeader){const e=Buffer.concat([Buffer.from([this.fuNalHeader]),...this.fuParts]);return this.reset(),[Buffer.concat([Be,e])]}return[]}return[]}};var Re=Buffer.from([0,0,0,1]),Ne=Buffer.from([0,0,1]);function ke(e){return!(e.length<4)&&(!!e.subarray(0,4).equals(Re)||!!e.subarray(0,3).equals(Ne))}function Te(e,t){const s=[];let r=0,n=0;for(;r<e.length;){if(r+4>e.length)return null;const A=t(e,r);if(r+=4,A<=0)return null;if(A>e.length-r)return null;s.push(Re),s.push(e.subarray(r,r+A)),r+=A,n++}return 0===n?null:Buffer.concat(s)}function Fe(e,t){const s=[];let r=0,n=0;for(;r<e.length;){if(r+2>e.length)return null;const A=t(e,r);if(r+=2,A<=0)return null;if(A>e.length-r)return null;s.push(Re),s.push(e.subarray(r,r+A)),r+=A,n++}return 0===n?null:Buffer.concat(s)}function Me(e,t){const s=[];let r=0,n=0;const A=(e,s)=>{if(s+3>e.length)return 0;const r=e[s],n=e[s+1],A=e[s+2];return"be"===t?(r<<16|n<<8|A)>>>0:(A<<16|n<<8|r)>>>0};for(;r<e.length;){if(r+3>e.length)return null;const t=A(e,r);if(r+=3,t<=0)return null;if(t>e.length-r)return null;s.push(Re),s.push(e.subarray(r,r+t)),r+=t,n++}return 0===n?null:Buffer.concat(s)}function Ue(e){if(ke(e))return e;const t=Buffer.from([0,0,0,1]),s=Buffer.from([0,0,1]),r=Math.min(64,e.length),n=e.subarray(0,r).indexOf(t);if(n>0)return e.subarray(n);const A=e.subarray(0,r).indexOf(s);if(A>0)return e.subarray(A);const i=Te(e,((e,t)=>e.readUInt32BE(t)));if(i)return i;const o=Te(e,((e,t)=>e.readUInt32LE(t)));if(o)return o;const a=Me(e,"be");if(a)return a;const c=Me(e,"le");if(c)return c;const l=Fe(e,((e,t)=>e.readUInt16BE(t)));if(l)return l;const h=Fe(e,((e,t)=>e.readUInt16LE(t)));return h||(function(e){if(e.length<2)return!1;const t=e[0],s=e[1];return void 0!==t&&void 0!==s&&(!(128&t)&&(t>>1&63)<=40)}(e)?Buffer.concat([Re,e]):e)}var Le=class e{fuParts=null;reset(){this.fuParts=null}static parseRtpPayload(e){if(!e||e.length<12)return null;if(2!==(e[0]>>6&3))return null;const t=!!(32&e[0]),s=!!(16&e[0]);let r=12+4*(15&e[0]);if(r>e.length)return null;if(s){if(r+4>e.length)return null;if(r+=4+4*e.readUInt16BE(r+2),r>e.length)return null}let n=e.length;if(t){const t=e[e.length-1];if(t<=0||t>e.length)return null;if(n=e.length-t,n<r)return null}return n<=r?null:e.subarray(r,n)}push(t){if(!t||t.length<2)return[];const s=e.parseRtpPayload(t);s&&(t=s);const r=t[0],n=t[1];if(128&r)return[];const A=r>>1&63;if(48===A){let e=2;const s=[];for(;e+2<=t.length;){const r=t.readUInt16BE(e);if(e+=2,r<=0||e+r>t.length)return[];const n=t.subarray(e,e+r);e+=r,n.length&&s.push(Re,n)}return s.length?[Buffer.concat(s)]:[]}if(49===A){if(t.length<3)return[];const e=t[2],s=!!(128&e),A=!!(64&e),i=129&r|(63&(63&e))<<1,o=n,a=t.subarray(3);if(s)this.fuParts=[Re,Buffer.from([i,o]),a];else{if(!this.fuParts)return[];this.fuParts.push(a)}if(A){if(!this.fuParts)return[];const e=Buffer.concat(this.fuParts);return this.fuParts=null,[e]}return[]}return[Buffer.concat([Re,t])]}};function He(e){const t=[];for(let s=0;s<e.length-3;s++)0===e[s]&&0===e[s+1]&&(1===e[s+2]?(t.push({idx:s,len:3}),s+=2):0===e[s+2]&&1===e[s+3]&&(t.push({idx:s,len:4}),s+=3));if(0===t.length)return[];const s=[];for(let r=0;r<t.length;r++){const n=t[r],A=n.idx+n.len,i=t[r+1]?t[r+1].idx:e.length;i>A&&s.push(e.subarray(A,i))}return s}function Pe(e){if(e.length<1)return null;const t=e[0];return void 0===t||128&t?null:t>>1&63}function xe(e){return e>=16&&e<=23}function Ye(e){if(!ke(e))return!1;const t=He(e);if(0===t.length)return!1;for(const e of t){if(e.length<2)return!1;const t=e[0];if(void 0===t)return!1;if(128&t)return!1;const s=Pe(e);if(null===s)return!1;if(s>40)return!1}return!0}function Ve(e){const t=He(e);let s=!1,r=!1,n=!1,A=!1;for(const e of t){const t=Pe(e);null!==t&&(32===t&&(s=!0),33===t&&(r=!0),34===t&&(n=!0),xe(t)&&(A=!0))}return A&&s&&r&&n}function Oe(e){const t=He(e);for(const e of t){if(32===Pe(e))return e}return null}function Ge(e){const t=He(e);for(const e of t){if(33===Pe(e))return e}return null}function Je(e){const t=He(e);for(const e of t){if(34===Pe(e))return e}return null}var We=Buffer.from([0,0,0,1]),_e=class{running=!1;queue=[];maxQueueSize;constructor(e){this.maxQueueSize=e}enqueue(e){this.queue.length>=this.maxQueueSize||(this.queue.push(e),this.pump())}pump(){this.running||(this.running=!0,this.run())}async run(){try{for(;this.queue.length>0;){const e=this.queue.shift();if(e)try{await e()}catch{}}}finally{this.running=!1}}};function qe(e){const t=[];for(let s=0;s<e.length;s++)s>=2&&3===e[s]&&0===e[s-1]&&0===e[s-2]||t.push(e[s]);return Buffer.from(t)}var $e=class{b;bitPos=0;constructor(e){this.b=e}readBits(e){if(e<=0)return 0;let t=0;for(let s=0;s<e;s++){const e=this.bitPos>>3;if(e>=this.b.length)return null;const s=7-(7&this.bitPos);t=t<<1|this.b[e]>>s&1,this.bitPos++}return t>>>0}readUE(){let e=0;for(;;){const t=this.readBits(1);if(null==t)return null;if(0!==t)break;if(e++,e>31)return null}const t=e?this.readBits(e):0;return null==t?null:(1<<e)-1+t>>>0}};function ze(e){if(7!=(31&(e[0]??0)))return null;const t=qe(e.subarray(1)),s=new $e(t);return null==s.readBits(8)||null==s.readBits(8)||null==s.readBits(8)?null:s.readUE()}function Xe(e){if(8!=(31&(e[0]??0)))return null;const t=qe(e.subarray(1)),s=new $e(t),r=s.readUE(),n=s.readUE();return null==r||null==n?null:{ppsId:r,spsId:n}}function je(e){const t=31&(e[0]??0);if(1!==t&&5!==t)return null;const s=qe(e.subarray(1)),r=new $e(s);return null==r.readUE()||null==r.readUE()?null:r.readUE()}var Ze=class e extends n.EventEmitter{client;api;channel;profile;logger;active=!1;videoFrameHandler;expectedStreamType;activeMsgNum;bcMediaCodec;debugH264LogsLeft;debugSavedSamples;warnedNonAnnexBOnce=!1;depacketizer=new ve;depacketizerH265=new Le;dumpChunkIdx=0;dumpNalLines=0;dumpIo=new _e(200);spsById=new Map;ppsById=new Map;lastSps=null;lastPps=null;lastPrependedPpsId=null;lastVps=null;lastSpsH265=null;lastPpsH265=null;lastPrependedParamSetsH265=!1;lastMediaAtMs=0;watchdogTimer;restarting=!1;restartWindowStartMs=0;restartCountInWindow=0;idleRestartMs;static scoreBcMediaLike(e){if(e.length<4)return{score:-1,first:-1};const t=Math.min(65536,e.length-4);let s=0,r=-1;for(let n=0;n<=t;n++){const t=e.readUInt32LE(n);if((825241649===t||842018865===t||t>=1667510320&&t<=1667510329||t>=1667510576&&t<=1667510585||1651979568===t||1651978544===t)&&(s++,r<0&&(r=n),s>32&&0===r))break}return{score:1e3*s-(r<0?5e4:r),first:r}}chooseDecryptedOrRawCandidate(t){const{raw:s,enc:r,channelId:n,allowResync:A}=t,i=e.scoreBcMediaLike(s),o="aes"===this.client.enc.kind||"full_aes"===this.client.enc.kind||"bc"===this.client.enc.kind?this.client.tryDecryptBinary(s,n,r):s,a=e.scoreBcMediaLike(o).score>i.score?o:s;if(!A)return a;const c=e.scoreBcMediaLike(a);return c.first>0?a.subarray(c.first):a}constructor(e){super(),this.client=e.client,this.api=e.api,this.channel=e.channel,this.profile=e.profile,this.logger=e.logger,this.expectedStreamType="sub"===this.profile?1:0,this.bcMediaCodec=new Ce(!1,this.logger);const t=this.client.getDebugConfig();this.debugH264LogsLeft=t.debugH264?200:0,this.debugSavedSamples=!1,this.dumpChunkIdx=0,this.spsById=new Map,this.ppsById=new Map,this.lastSps=null,this.lastPps=null,this.lastPrependedPpsId=null,this.lastVps=null,this.lastSpsH265=null,this.lastPpsH265=null,this.lastPrependedParamSetsH265=!1;const s=this.client.getTransport?.();this.idleRestartMs="udp"===s?6e3:15e3}noteMediaActivity(){this.lastMediaAtMs=Date.now()}startWatchdog(){this.api&&(this.watchdogTimer||(this.restartWindowStartMs=Date.now(),this.restartCountInWindow=0,this.watchdogTimer=setInterval((()=>{this.watchdogTick()}),1e3)))}stopWatchdog(){this.watchdogTimer&&clearInterval(this.watchdogTimer),this.watchdogTimer=void 0}async watchdogTick(){if(!this.active)return;if(!this.api)return;if(this.restarting)return;if(this.lastMediaAtMs<=0)return;const e=Date.now(),t=e-this.lastMediaAtMs;t<this.idleRestartMs||(e-this.restartWindowStartMs>6e4&&(this.restartWindowStartMs=e,this.restartCountInWindow=0),this.restartCountInWindow++,this.restartNativeStream({reason:`idle ${t}ms`}))}async restartNativeStream(e){if(this.api&&this.active&&!this.restarting){this.restarting=!0;try{const t=this.client.getTransport?.()??"unknown",s=this.activeMsgNum??"unknown";this.logger?.warn(`[BaichuanVideoStream] Watchdog restarting native stream (channel=${this.channel} profile=${this.profile} streamType=${this.expectedStreamType} msgNum=${s} transport=${t} reason=${e.reason})`),this.depacketizer.reset(),this.depacketizerH265.reset(),this.bcMediaCodec.clear(),this.activeMsgNum=void 0,this.lastPrependedPpsId=null,this.lastPrependedParamSetsH265=!1;try{await this.api.stopVideoStream(this.channel,this.profile)}catch{}await this.api.startVideoStream(this.channel,this.profile);try{const e=this.api.getActiveVideoMsgNum;this.activeMsgNum="function"==typeof e?e(this.channel,this.profile):void 0}catch{this.activeMsgNum=void 0}this.lastMediaAtMs=Date.now()}catch(e){const t=e instanceof Error?e:new Error(String(e));this.emit("error",t)}finally{this.restarting=!1}}}async start(){if(this.active)throw new Error("Video stream already active");if(this.depacketizer.reset(),this.depacketizerH265.reset(),this.api)try{await this.api.startVideoStream(this.channel,this.profile);try{const e=this.api.getActiveVideoMsgNum;this.activeMsgNum="function"==typeof e?e(this.channel,this.profile):void 0}catch{this.activeMsgNum=void 0}}catch(e){const t=e instanceof Error?e:new Error(String(e));if("udp"===this.client.getTransport?.())throw t;this.emit("error",t)}let e=0,t=0;this.videoFrameHandler=s=>{if(3!==s.header.cmdId)return;if(s.header.streamType!==this.expectedStreamType)return;if(void 0!==this.activeMsgNum&&s.header.msgNum!==this.activeMsgNum)return;e++;const r=this.client.getDebugConfig(),n=r.debugRtsp;1===e&&n&&this.logger?.log(`[BaichuanVideoStream] First cmd_id=3 frame received (bodyLen: ${s.body.length}, channelId: ${s.header.channelId})`),(e%10==0||e<=5)&&n&&this.logger?.log(`[BaichuanVideoStream] Received ${e} Baichuan frames (cmd_id=3)`);const A=this.client.enc,i=s.payload.length>0?s.payload:s.body;let o=i;if(0===s.payload.length){let e=0;const t=i.indexOf(Buffer.from("</Extension>")),s=i.indexOf(Buffer.from("</body>"));-1!==t?e=t+Buffer.from("</Extension>").length:-1!==s&&(e=s+Buffer.from("</body>").length),o=i.subarray(e)}const l=this.chooseDecryptedOrRawCandidate({raw:o,enc:A,channelId:s.header.channelId,allowResync:0===s.payload.length});if(1===e&&n&&this.logger?.log(`[BaichuanVideoStream] Data after XML: ${l.length} bytes, first 32 bytes: ${l.subarray(0,Math.min(32,l.length)).toString("hex")}`),r.dumpEnabled&&ie(r),r.dumpBcMedia&&this.dumpChunkIdx<200){const e=r.dumpDir,t=String(this.dumpChunkIdx).padStart(4,"0"),s=c.join(e,`bcmedia_chunk_${t}.bin`),n=c.join(e,"bcmedia_info.json"),A=Buffer.from(l),i=0===this.dumpChunkIdx,o=i?JSON.stringify({note:"Chunks fed into the BcMedia decoder (after XML stripping/alignment).",profile:this.profile,channel:this.channel,encKind:this.client.enc.kind},null,2):"";this.dumpIo.enqueue((async()=>{await a.promises.writeFile(s,A),i&&await a.promises.writeFile(n,o)})),this.dumpChunkIdx++}const h=this.bcMediaCodec.decode(l);t+=h.length;const g=new Map;for(const e of h)g.set(e.type,(g.get(e.type)||0)+1);if(e<=10||e%20==0){const s=this.bcMediaCodec.getRemainingBuffer(),r=Array.from(g.entries()).map((([e,t])=>`${e}:${t}`)).join(", ");n&&this.logger?.log(`[BaichuanVideoStream] Frame #${e}: dataToParse=${l.length} bytes, parsed ${h.length} BcMedia packets (${r||"none"}), total: ${t}, remaining buffer: ${s.length} bytes`)}let d=0,u=0;for(const t of h){const s=(e,t,s)=>{if("H264"===s){const t=Se(e);for(const e of t){const t=31&(e[0]??0);if(7===t){const t=ze(e);if(null!=t){if(!o(e))continue;this.spsById.set(t,e),r.debugParamSets&&this.logger?.warn(`[BaichuanVideoStream] Cached H.264 SPS id=${t} len=${e.length}`)}o(e)&&(this.lastSps=e)}if(8===t){const t=Xe(e);if(t){const s=this.spsById.get(t.spsId);if(s&&!o(s))continue;this.ppsById.set(t.ppsId,{nal:e,spsId:t.spsId}),r.debugParamSets&&this.logger?.warn(`[BaichuanVideoStream] Cached H.264 PPS id=${t.ppsId} (spsId=${t.spsId}) len=${e.length}`)}this.lastPps=e}}}else if("H265"===s){const t=Oe(e);t&&(this.lastVps=t,r.debugParamSets&&this.logger?.warn(`[BaichuanVideoStream] Cached H.265 VPS len=${t.length}`));const s=Ge(e);s&&(this.lastSpsH265=s,r.debugParamSets&&this.logger?.warn(`[BaichuanVideoStream] Cached H.265 SPS len=${s.length}`));const n=Je(e);n&&(this.lastPpsH265=n,r.debugParamSets&&this.logger?.warn(`[BaichuanVideoStream] Cached H.265 PPS len=${n.length}`))}},A=(e,t)=>{if("H264"===t){const t=Se(e);if(0===t.length)return e;const s=t.map((e=>31&(e[0]??0)));if(s.includes(7)&&s.includes(8))return e;if(!s.some((e=>1===e||5===e||19===e||20===e)))return e;let n=null;for(const e of t){const t=31&(e[0]??0);if(1===t||5===t){n=je(e);break}}if(r.debugParamSets&&this.logger?.warn(`[BaichuanVideoStream] Slice references ppsId=${n??"?"} lastPrepended=${this.lastPrependedPpsId??"?"}`),null==n||n>255)return null!=this.lastPrependedPpsId?e:this.lastSps&&this.lastPps?(this.lastPrependedPpsId=-1,Buffer.concat([We,this.lastSps,We,this.lastPps,e])):e;if(this.lastPrependedPpsId===n)return e;const A=this.ppsById.get(n);if(A){const t=this.spsById.get(A.spsId);if(t)return this.lastPrependedPpsId=n,Buffer.concat([We,t,We,A.nal,e])}return Buffer.alloc(0)}if("H265"===t){const t=He(e);if(0===t.length)return e;const s=t.map((e=>Pe(e))).filter((e=>null!==e));if(s.includes(32)&&s.includes(33)&&s.includes(34))return e;return s.some((e=>e>=0&&e<=9||e>=16&&e<=23))?this.lastPrependedParamSetsH265?e:this.lastVps&&this.lastSpsH265&&this.lastPpsH265?(this.lastPrependedParamSetsH265=!0,r.debugParamSets&&this.logger?.warn("[BaichuanVideoStream] Prepending H.265 VPS/SPS/PPS to frame"),Buffer.concat([We,this.lastVps,We,this.lastSpsH265,We,this.lastPpsH265,e])):e:e}return e},i=(e,t,s)=>{if(r.dumpNals)try{r.dumpEnabled&&ie(r);const n=r.dumpDir,A=Se(e),i=A.map((e=>31&(e[0]??0)));let o=null;const l=[],h=[];for(const e of A){const t=31&(e[0]??0);if(1!==t&&5!==t||null!=o||(o=je(e)),7===t){const t=ze(e);null!=t&&l.push(t)}if(8===t){const t=Xe(e);t&&h.push(t.ppsId)}}if(this.dumpNalLines>=2e4)return;const g=JSON.stringify({label:t,microseconds:s,len:e.length,nalTypes:i,slicePpsId:o,auSpsIds:l,auPpsIds:h,cachedSps:this.spsById.size,cachedPps:this.ppsById.size,lastPrependedPpsId:this.lastPrependedPpsId})+"\n";this.dumpNalLines++;const d=c.join(n,"nal_dump.ndjson");this.dumpIo.enqueue((async()=>{await a.promises.appendFile(d,g)}))}catch{}},o=e=>{if(e.length<4)return!1;if(7!=(31&(e[0]??0)))return!1;const t=e[1]??0,s=e[3]??0;return!!new Set([66,77,88,100,110,122,244]).has(t)&&!(0===s||s>255)};if("Iframe"===t.type){const o="H265"===t.videoType?Ue(t.data):we(t.data),l=!0;s(o,"Iframe",t.videoType);const h=A(o,t.videoType);if(0===h.length)continue;if(i(h,"Iframe",t.microseconds),"H264"===t.videoType){if(!De(h)||!be(h)){r.debugH264&&this.logger?.warn(`[BaichuanVideoStream] Dropping invalid H.264 Iframe (Annex-B) len=${h.length}`);continue}}else if("H265"===t.videoType){if(!Ye(h)){r.debugH264&&this.logger?.warn(`[BaichuanVideoStream] Dropping invalid H.265 Iframe (Annex-B) len=${h.length}`);continue}Ve(h)||r.debugH264&&this.logger?.warn(`[BaichuanVideoStream] H.265 Iframe missing VPS/SPS/PPS or IRAP, but continuing len=${h.length}`)}if(r.debugH264&&!this.debugSavedSamples)try{const e=r.dumpDir;a.mkdirSync(e,{recursive:!0}),"Iframe"===t.type&&pe(o)&&a.writeFileSync(c.join(e,"iframe_annexb.bin"),o)}catch{}if(!this.warnedNonAnnexBOnce&&!pe(o)){this.warnedNonAnnexBOnce=!0;const e=t.data,s=e.subarray(0,Math.min(24,e.length)).toString("hex"),r=o.subarray(0,Math.min(24,o.length)).toString("hex");this.logger?.warn(`[BaichuanVideoStream] WARNING: non-AnnexB frame after conversion (${t.type} ${t.videoType}) len=${e.length} head=${s} convertedLen=${o.length} convertedHead=${r}`)}if(this.emit("videoFrame",h),this.emit("videoAccessUnit",{data:h,isKeyframe:l,videoType:t.videoType,microseconds:t.microseconds,..."Iframe"===t.type&&"time"in t&&void 0!==t.time?{time:t.time}:{}}),d++,e<=5||d<=5){const e=pe(o)?"yes":"no";n&&this.logger?.log(`[BaichuanVideoStream] Emitted ${t.type} (${t.videoType}) ${t.data.length} bytes -> ${o.length} bytes (Annex-B, startCode:${e})`)}}else if("Pframe"===t.type){const e=t.data,n=pe(e)?e:"H265"===t.videoType?Ue(e):we(e),o=pe(n)?[n]:"H265"===t.videoType?this.depacketizerH265.push(e):this.depacketizer.push(e);if(0===o.length)continue;for(const e of o){s(e,"Pframe",t.videoType);const n=A(e,t.videoType);if(0===n.length)continue;const o=n;i(o,"Pframe",t.microseconds);if("H265"===t.videoType?Ye(o):De(o))this.emit("videoFrame",o),this.emit("videoAccessUnit",{data:o,isKeyframe:!1,videoType:t.videoType,microseconds:t.microseconds}),d++;else if(r.debugH264&&this.debugH264LogsLeft>0){this.debugH264LogsLeft--;const e=o.subarray(0,Math.min(24,o.length)).toString("hex");this.logger?.warn(`[BaichuanVideoStream] Dropping invalid Pframe (${t.videoType}): len=${o.length} head=${e}`)}}}"Aac"!==t.type&&"Adpcm"!==t.type||(u++,this.emit("audioFrame",t.data)),"InfoV1"===t.type||t.type}if((e<=10||e%20==0&&(d>0||u>0))&&n&&this.logger?.log(`[BaichuanVideoStream] Frame #${e}: emitted ${d} video frames, ${u} audio frames`),(d>0||u>0)&&this.noteMediaActivity(),d>0&&(e<=10||e%50==0)){}},this.client.on("push",this.videoFrameHandler),this.active=!0,this.lastMediaAtMs=Date.now(),this.startWatchdog()}async stop(){if(this.active){if(this.stopWatchdog(),this.depacketizer.reset(),this.depacketizerH265.reset(),this.videoFrameHandler&&this.client.removeListener("push",this.videoFrameHandler),this.videoFrameHandler=void 0,this.bcMediaCodec.clear(),this.activeMsgNum=void 0,this.api)try{await this.api.stopVideoStream(this.channel,this.profile)}catch(e){this.emit("error",e instanceof Error?e:new Error(String(e)))}this.active=!1,this.emit("close")}}isActive(){return this.active}};async function*Ke(e,t,s){const r=new Ze({client:e.client,api:e,channel:t,profile:s,logger:e.logger});let n=null,A=null,i=null,o=!1,a=!1;const c=e=>{a=!0},l=()=>{a=!0};try{await r.start(),r.on("error",c),r.on("close",l);const e=new Promise((e=>{const t=s=>{s.isKeyframe&&!n&&(n={sps:null,pps:null},r.removeListener("videoAccessUnit",t),e(n))};r.on("videoAccessUnit",t),setTimeout((()=>{n||(n={sps:null,pps:null},r.removeListener("videoAccessUnit",t),e(n))}),5e3)}));await Promise.race([e,new Promise((e=>setTimeout(e,5e3)))]);const t=[],s=200;let h=null;for(r.on("videoAccessUnit",(e=>{a||(t.push({audio:!1,data:e.data,codec:null,sampleRate:null,microseconds:e.microseconds,videoType:e.videoType}),t.length>s&&t.splice(0,t.length-s),h&&(h(),h=null))})),r.on("audioFrame",(e=>{a||(A||(A="aac",i=8e3),t.push({audio:!0,data:e,codec:A,sampleRate:i,microseconds:null}),t.length>s&&t.splice(0,t.length-s),h&&(h(),h=null))})),o=!0;!a;)if(t.length>0){const e=t.shift();yield e}else await new Promise((e=>{h=e,setTimeout((()=>{h===e&&(h=null,e())}),1e3)}))}finally{a=!0;try{await r.stop()}catch{}r.removeListener("error",c),r.removeListener("close",l)}}var et=class{key;transport;videoType;keepAliveTimer;constructor(e,t){this.transport=e,this.videoType=t,this.key=function(e,t){return`${e}-${"H264"===t?"h264":"h265"}`}(e,t)}async startKeepAlive(e){this.stopKeepAlive(),e.client.getTransport()}stopKeepAlive(){this.keepAliveTimer&&(clearInterval(this.keepAliveTimer),this.keepAliveTimer=void 0)}},tt=Buffer.from([0,0,0,1]);function st(...e){const t=e.filter((e=>!!e&&e.length>0));if(0===t.length)return null;const s=[];for(const e of t)s.push(tt,e);return Buffer.concat(s)}var rt=class extends et{ffmpegFormat="h264";sdpCodec="H264";sps=null;pps=null;constructor(e){super(e,"H264")}extractParameterSets(e){const t=Se(e);for(const e of t){if(e.length<1)continue;const t=31&(e[0]??0);if(7!==t||this.sps||(this.sps=e),8!==t||this.pps||(this.pps=e),this.sps&&this.pps)break}}getFmtp(){let e="packetization-mode=1";if(this.sps&&this.sps.length>=4){e+=`;profile-level-id=${Buffer.from([this.sps[1],this.sps[2],this.sps[3]]).toString("hex")}`}return this.sps&&this.pps?(e+=`;sprop-parameter-sets=${this.sps.toString("base64")},${this.pps.toString("base64")}`,{fmtp:e,hasParamSets:!0}):{fmtp:e,hasParamSets:!1}}getParameterSetsAnnexB(){return st(this.sps,this.pps)}},nt=class extends et{ffmpegFormat="hevc";sdpCodec="H265";vps=null;sps=null;pps=null;constructor(e){super(e,"H265")}extractParameterSets(e){const t=Oe(e),s=Ge(e),r=Je(e);t&&!this.vps&&(this.vps=t),s&&!this.sps&&(this.sps=s),r&&!this.pps&&(this.pps=r)}getFmtp(){let e="";return this.vps&&this.sps&&this.pps?(e=`sprop-vps=${this.vps.toString("base64")};sprop-sps=${this.sps.toString("base64")};sprop-pps=${this.pps.toString("base64")}`,{fmtp:e,hasParamSets:!0}):{fmtp:e,hasParamSets:!1}}getParameterSetsAnnexB(){return st(this.vps,this.sps,this.pps)}};function At(e,t){return"H264"===t?new rt(e):new nt(e)}var it=class{maxItems;queue=[];waiting;closed=!1;constructor(e){this.maxItems=Math.max(1,0|e)}push(e){if(!this.closed){if(this.waiting){const{resolve:t}=this.waiting;return this.waiting=void 0,void t({value:e,done:!1})}this.queue.push(e),this.queue.length>this.maxItems&&this.queue.splice(0,this.queue.length-this.maxItems)}}close(){if(!this.closed&&(this.closed=!0,this.waiting)){const{resolve:e}=this.waiting;this.waiting=void 0,e({value:void 0,done:!0})}}async next(){if(this.closed)return{value:void 0,done:!0};const e=this.queue.shift();return void 0!==e?{value:e,done:!1}:await new Promise((e=>{this.waiting={resolve:e}}))}},ot=class{opts;queues=new Map;source=null;running=!1;pumpPromise=null;constructor(e){this.opts=e}start(){this.running||(this.running=!0,this.source=this.opts.createSource(),this.pumpPromise=(async()=>{try{for await(const e of this.source){try{this.opts.onFrame?.(e)}catch{}for(const t of this.queues.values())t.push(e)}}catch(e){this.opts.onError?.(e)}finally{for(const e of this.queues.values())e.close();this.queues.clear()}})())}subscribe(e){const t=new it(this.opts.maxQueueItems);this.queues.set(e,t);const s=this;return async function*(){try{for(;;){const e=await t.next();if(e.done)return;yield e.value}}finally{t.close(),s.queues.delete(e)}}()}async stop(){if(!this.running)return;this.running=!1;const e=this.source;this.source=null;for(const e of this.queues.values())e.close();this.queues.clear();try{await(e?.return(void 0))}catch{}try{await this.pumpPromise}catch{}this.pumpPromise=null}};var at=class e extends n.EventEmitter{api;channel;profile;listenHost;listenPort;path;logger;tcpRtpFraming;active=!1;flow;connectedClients=new Set;nativeStreamActive=!1;clientConnectionServer;streamMetadata=null;clientResources=new Map;isRtspDebugEnabled(){return this.api.client.getDebugConfig().debugRtsp||function(e,t){if(null==e)return t;const s=e.trim().toLowerCase();return"1"===s||"true"===s||"yes"===s||"on"===s||"0"!==s&&"false"!==s&&"no"!==s&&"off"!==s&&t}(process.env.BAICHUAN_DEBUG_RTSP,!1)}rtspDebugLog(e){this.isRtspDebugEnabled()&&this.logger.debug(`[BaichuanRtspServer] ${e}`)}firstFramePromise=null;firstFrameResolve=null;firstFrameReceived=!1;firstAudioPromise=null;firstAudioResolve=null;firstAudioDetected=!1;hasAudio=!1;audioInfo=null;audioPrimingFrame=null;tempStreamGenerator=null;nativeFanout=null;noClientAutoStopTimer;static isAdtsAacFrame(e){return e.length>=2&&255===e[0]&&!(240&~e[1])}static parseAdtsSamplingInfo(t){if(t.length<7)return null;if(!e.isAdtsAacFrame(t))return null;const s=t[2]>>2&15,r=[96e3,88200,64e3,48e3,44100,32e3,24e3,22050,16e3,12e3,11025,8e3,7350][s]??null;if(!r)return null;const n=(1&t[2])<<2|t[3]>>6&3,A=0===n?1:n,i=(t[2]>>6&3)+1<<11|s<<7|n<<3;return{sampleRate:r,channels:A,configHex:Buffer.from([i>>8&255,255&i]).toString("hex")}}static parseInterleavedChannels(e){const t=e.match(/interleaved\s*=\s*(\d+)\s*-\s*(\d+)/i);if(!t)return null;const s=Number.parseInt(t[1],10),r=Number.parseInt(t[2],10);return Number.isFinite(s)&&Number.isFinite(r)?{rtp:s,rtcp:r}:null}static splitAnnexBNals(e){const t=[],s=e.length,r=t=>{if(t+3<=s&&0===e[t]&&0===e[t+1]){if(1===e[t+2])return 3;if(t+4<=s&&0===e[t+2]&&1===e[t+3])return 4}return 0};let n=0;for(;n<s;){if(r(n))break;n++}for(;n<s;){const A=r(n);if(!A){n++;continue}const i=n+A;let o=i;for(;o<s;){if(r(o))break;o++}if(i<o){const s=e.subarray(i,o);s.length>0&&t.push(s)}n=o}return t}static stripAdtsHeader(t){if(!e.isAdtsAacFrame(t))return null;if(t.length<7)return null;const s=!(1&~t[1])?7:9;return t.length<=s?null:t.subarray(s)}constructor(e){super(),this.api=e.api,this.channel=e.channel,this.profile=e.profile,this.listenHost=e.listenHost??"127.0.0.1",this.listenPort=e.listenPort??8554,this.path=e.path??`/stream/${this.profile}`,this.logger=e.logger??console,this.tcpRtpFraming=e.tcpRtpFraming??"rfc4571";const t=this.api.client.getTransport();this.flow=At(t,"H264")}clearNoClientAutoStopTimer(){this.noClientAutoStopTimer&&(clearTimeout(this.noClientAutoStopTimer),this.noClientAutoStopTimer=void 0)}setFlowVideoType(e,t){if(this.flow.videoType===e)return;const s=this.api.client.getTransport();this.flow.stopKeepAlive(),this.flow=At(s,e),this.rtspDebugLog(`Using RTSP flow ${this.flow.key} (${t})`)}async start(){if(this.active)throw new Error("RTSP server is already active");try{const e=(await this.api.getStreamMetadata(this.channel)).streams.find((e=>e.profile===this.profile));if(e){this.streamMetadata={frameRate:e.frameRate||25,width:e.width,height:e.height};const t=String(e.videoEncType??"").trim().toLowerCase(),s=t.includes("265")||t.includes("hevc")?"H265":"H264";this.setFlowVideoType(s,"metadata")}}catch(e){this.logger.warn(`[BaichuanRtspServer] Could not get stream metadata: ${e}`),this.streamMetadata={frameRate:25,width:1920,height:1080},this.setFlowVideoType("H264","metadata unavailable")}this.clientConnectionServer=A.createServer((e=>{this.handleRtspConnection(e)})),await new Promise(((e,t)=>{this.clientConnectionServer.listen(this.listenPort,this.listenHost,(()=>{const t=this.clientConnectionServer.address();t&&"object"==typeof t&&"port"in t&&(this.listenPort=t.port),e()})),this.clientConnectionServer.on("error",(e=>{t(e)}))})),this.active=!0,this.logger.info(`[BaichuanRtspServer] RTSP server started on ${this.listenHost}:${this.listenPort}, path: ${this.path}`)}handleRtspConnection(t){const s=`${t.remoteAddress}:${t.remotePort}`;this.logger.info(`[BaichuanRtspServer] RTSP client connected: ${s}`);let r,n="",A=Buffer.alloc(0),i=!1,o=null,a=null;const c=()=>{this.removeClient(s);const e=this.clientResources.get(s);if(e){if(e.ffmpeg)try{e.ffmpeg.stdin?.end(),e.ffmpeg.kill("SIGTERM"),setTimeout((()=>{try{e.ffmpeg?.kill("SIGKILL")}catch{}}),1e3)}catch{}if(e.udpSocket)try{e.udpSocket.close()}catch{}if(e.udpSocketAudio)try{e.udpSocketAudio.close()}catch{}if(e.rtspSocket&&!e.rtspSocket.destroyed)try{e.rtspSocket.destroy()}catch{}this.clientResources.delete(s)}if(r){try{r.stdin?.end(),r.kill("SIGTERM"),setTimeout((()=>{try{r?.kill("SIGKILL")}catch{}}),1e3)}catch{}r=void 0}if(o){try{o.close()}catch{}o=null}if(a){try{a.close()}catch{}a=null}};t.on("close",c),t.on("error",(e=>{e&&"object"==typeof e&&"code"in e&&"EPIPE"!==e.code&&this.logger.error("[BaichuanRtspServer] RTSP client error:",e),c()})),t.on("data",(async l=>{for(A=Buffer.concat([A,l]);A.includes("\r\n\r\n");){const l=A.indexOf("\r\n\r\n"),h=A.subarray(0,l).toString();if(A=A.subarray(l+4),!h.trim())continue;const g=h.split("\r\n"),d=g[0]?.split(" ");if(!d||d.length<3)continue;const u=d[0],E=d[1],I=d[2],C=h.match(/CSeq:\s*(\d+)/i),B=C?parseInt(C[1]??"0",10):0,Q=(e,s,r={},n)=>{let A=`${I} ${e} ${s}\r\n`;A+=`CSeq: ${B}\r\n`;for(const[e,t]of Object.entries(r))A+=`${e}: ${t}\r\n`;n&&(A+=`Content-Length: ${Buffer.byteLength(n,"utf8")}\r\n`),A+="\r\n",n&&(A+=n),t.write(A)};if(this.rtspDebugLog(`RTSP ${u} ${E}`),"OPTIONS"===u)Q(200,"OK",{Public:"DESCRIBE, SETUP, TEARDOWN, PLAY, PAUSE, OPTIONS"});else if("DESCRIBE"===u){if(!this.firstFrameReceived&&0===this.connectedClients.size){try{this.nativeStreamActive||await this.startNativeStream()}catch(e){this.logger.warn(`[BaichuanRtspServer] Failed to start native stream for SDP priming: ${e}`)}const{hasParamSets:e}=this.flow.getFmtp();if(!e){const e="udp"===this.api.client.getTransport()?4e3:1500;try{await Promise.race([this.firstFramePromise||Promise.resolve(),new Promise((t=>setTimeout(t,e)))])}catch{}}}{const{fmtp:e,hasParamSets:t}=this.flow.getFmtp(),r=e.length>160?`${e.slice(0,160)}...`:e;this.logger.info(`[BaichuanRtspServer] DESCRIBE SDP for ${s} path=${this.path} codec=${this.flow.sdpCodec} hasParamSets=${t} fmtp=${r}`),t||this.rtspDebugLog(`DESCRIBE responding without parameter sets yet (client=${s}, path=${this.path}, flow=${this.flow.key})`)}const e=this.generateSdp();Q(200,"OK",{"Content-Type":"application/sdp","Content-Base":`rtsp://${this.listenHost}:${this.listenPort}${this.path}/`},e)}else if("SETUP"===u){const A=E?.includes("track0"),c=E?.includes("track1");if(!A&&!c){Q(404,"Not Found",{Session:n||`session_${Date.now()}_${Math.random().toString(36).substring(7)}`});continue}if(c&&!this.hasAudio){Q(404,"Not Found",{Session:n||`session_${Date.now()}_${Math.random().toString(36).substring(7)}`});continue}this.connectedClients.add(s),this.emit("client",s),this.clearNoClientAutoStopTimer(),1!==this.connectedClients.size||this.nativeStreamActive||await this.startNativeStream();const l=h.match(/Transport:\s*([^\r\n]+)/i),g=(l?.[1]??"").trim();i=!g||(g.includes("TCP")||g.includes("tcp")),n||(n=`session_${Date.now()}_${Math.random().toString(36).substring(7)}`);const d=this.clientResources.get(s);if(d?d.rtspSocket=t:this.clientResources.set(s,{ffmpeg:void 0,udpSocket:null,udpSocketAudio:null,rtspSocket:t,pipelineStarted:!1,seenFirstVideoKeyframe:!1,setupTrack0:!1,setupTrack1:!1,isPlaying:!1}),i){const t=this.clientResources.get(s),r=e.parseInterleavedChannels(g);if(t)if(c){const e=r??{rtp:2,rtcp:3};t.track1RtpChannel=e.rtp,t.track1RtcpChannel=e.rtcp}else{const e=r??{rtp:0,rtcp:1};t.track0RtpChannel=e.rtp,t.track0RtcpChannel=e.rtcp}}{const e=this.clientResources.get(s);e&&!e.pipelineStarted&&(e.pipelineStarted=!0,await this.startClientFfmpeg(s,t,i,((e,t,n)=>{r=e,o=t,a=n;const A=this.clientResources.get(s);A&&(A.ffmpeg=e,A.udpSocket=t,A.udpSocketAudio=n)})))}{const e=this.clientResources.get(s);e&&(c?e.setupTrack1=!0:e.setupTrack0=!0,this.rtspDebugLog(`SETUP done for ${s}: track0=${!!e.setupTrack0} track1=${!!e.setupTrack1} playing=${!!e.isPlaying}`))}if(i){const e=this.clientResources.get(s),t=c?{rtp:2,rtcp:3}:{rtp:0,rtcp:1};Q(200,"OK",{Transport:`RTP/AVP/TCP;unicast;interleaved=${`${c?e?.track1RtpChannel??t.rtp:e?.track0RtpChannel??t.rtp}-${c?e?.track1RtcpChannel??t.rtcp:e?.track0RtcpChannel??t.rtcp}`}`,Session:n})}else Q(200,"OK",{Transport:"RTP/AVP/UDP;unicast;client_port=5004-5005;server_port=5004-5005",Session:n})}else if("PLAY"===u){{const e=this.clientResources.get(s);e&&(e.isPlaying=!0,this.rtspDebugLog(`PLAY for ${s}: track0=${!!e.setupTrack0} track1=${!!e.setupTrack1} playing=${!!e.isPlaying}`))}Q(200,"OK",{Session:n,Range:"npt=0.000-"})}else"TEARDOWN"===u?(c(),Q(200,"OK",{Session:n}),t.end()):Q(501,"Not Implemented")}}))}generateSdp(){const e=this.flow.sdpCodec;let t="v=0\r\n";t+=`o=- ${Date.now()} ${Date.now()} IN IP4 ${this.listenHost}\r\n`,t+="s=Baichuan Stream\r\n",t+=`c=IN IP4 ${this.listenHost}\r\n`,t+="t=0 0\r\n",t+="m=video 0 RTP/AVP 96\r\n",t+=`a=rtpmap:96 ${e}/90000\r\n`,this.streamMetadata?.frameRate&&(t+=`a=framerate:${this.streamMetadata.frameRate}\r\n`),this.streamMetadata?.width&&this.streamMetadata?.height&&(t+=`a=framesize:96 ${this.streamMetadata.width}-${this.streamMetadata.height}\r\n`),t+="a=control:track0\r\n";const{fmtp:s,hasParamSets:r}=this.flow.getFmtp();if(r||this.logger.warn(`[BaichuanRtspServer] SDP missing parameter sets for flow ${this.flow.key}`),s&&(t+=`a=fmtp:96 ${s}\r\n`),this.hasAudio){t+="m=audio 0 RTP/AVP 97\r\n";const e=this.audioInfo,s=e?.sampleRate??8e3,r=e?.channels??1,n=e?.configHex??"";t+=`a=rtpmap:97 mpeg4-generic/${s}/${r}\r\n`,n&&(t+=`a=fmtp:97 streamtype=5; profile-level-id=15; mode=AAC-hbr; config=${n}; SizeLength=13; IndexLength=3; IndexDeltaLength=3;\r\n`),t+="a=control:track1\r\n"}return t+="a=setup:passive\r\n",t+="a=connection:new\r\n",t}async startClientFfmpeg(t,s,r,n){let A=this.streamMetadata;if(!A||!A.frameRate)try{const e=(await this.api.getStreamMetadata(this.channel)).streams.find((e=>e.profile===this.profile));e&&(A={frameRate:e.frameRate||25,width:e.width,height:e.height},this.rtspDebugLog(`Fetched metadata for profile ${this.profile}: ${A.frameRate} fps`))}catch(e){this.logger.warn(`[BaichuanRtspServer] Could not fetch stream metadata: ${e}`),A={frameRate:25,width:1920,height:1080}}const o=this.flow.ffmpegFormat;let a=0,c=0,l=null,g=null;const d=r,u=(e,t)=>{if("rfc4571"===(r?"rtsp-interleaved":this.tcpRtpFraming)){const e=Buffer.alloc(2);return e.writeUInt16BE(65535&t.length,0),Buffer.concat([e,t])}const s=Buffer.alloc(4);return s[0]=36,s[1]=255&e,s[2]=t.length>>8&255,s[3]=255&t.length,Buffer.concat([s,t])};if(r&&!d){a=5e4+Math.floor(1e4*Math.random()),l=i.createSocket("udp4"),await new Promise(((e,t)=>{l.once("listening",(()=>e())),l.once("error",t),l.bind(a,"127.0.0.1")}));const e=(e,r)=>{if(!s||s.destroyed||!s.writable)return!1;if(r.length<12)return!1;if(2!==(r[0]>>6&3))return!1;const n=this.clientResources.get(t);if(!n?.isPlaying)return!1;const A=n?.track0RtpChannel??0,i=n?.track1RtpChannel??2;if(e===A&&!n?.setupTrack0)return!1;if(e===i&&!n?.setupTrack1)return!1;try{return s.write(u(e,r))}catch(e){if(e&&"object"==typeof e&&"code"in e&&"EPIPE"===e.code)return!1}return!1};if(l){const s=this.clientResources.get(t),r=s?.track0RtpChannel??0;let n=0,A=!1,i=!1;l.on("message",(s=>{A||(A=!0,this.rtspDebugLog(`First video RTP packet received from ffmpeg for client ${t} (len=${s.length})`));e(r,s)&&!i&&(i=!0,this.rtspDebugLog(`First video RTP packet forwarded via TCP interleaved for client ${t}`)),n++,n%1e3==0&&this.rtspDebugLog(`Forwarded ${n} RTP packets to client ${t} via TCP interleaved`)}))}if(this.hasAudio){c=a+2+2*Math.floor(1e3*Math.random()),g=i.createSocket("udp4"),await new Promise(((e,t)=>{g.once("listening",(()=>e())),g.once("error",t),g.bind(c,"127.0.0.1")}));let s=0,r=!1,n=!1;g.on("message",(A=>{const i=this.clientResources.get(t),o=i?.track1RtpChannel??2;s++,r||(r=!0,this.rtspDebugLog(`First audio RTP packet received from ffmpeg for client ${t} (len=${A.length})`));e(o,A)&&!n&&(n=!0,this.rtspDebugLog(`First audio RTP packet forwarded via TCP interleaved for client ${t}`)),s%1e3==0&&this.rtspDebugLog(`Forwarded ${s} audio RTP packets to client ${t} via TCP interleaved`)}))}}const E=this.clientResources.get(t),I=this.isRtspDebugEnabled(),C=e=>this.rtspDebugLog(e),B=(e,t)=>{if(!s||s.destroyed||!s.writable)return!1;try{return s.write(u(e,t))}catch(e){if(e&&"object"==typeof e&&"code"in e&&"EPIPE"===e.code)return!1}return!1},Q=(e,t,s,r,n)=>{const A=Buffer.alloc(12);return A[0]=128,A[1]=(t?128:0)|127&e,A.writeUInt16BE(65535&s,2),A.writeUInt32BE(r>>>0,4),A.writeUInt32BE(n>>>0,8),A},p=(e,t,s)=>{const r=e?97:96;if(E?.isPlaying&&(!e||E?.setupTrack1)&&(e||E?.setupTrack0))if(e){void 0===E.rtpAudioSeq&&(E.rtpAudioSeq=Math.floor(65536*Math.random())),void 0===E.rtpAudioTimestamp&&(E.rtpAudioTimestamp=0),void 0===E.rtpAudioSsrc&&(E.rtpAudioSsrc=4294967295*Math.random()>>>0);const e=Q(r,s,E.rtpAudioSeq,E.rtpAudioTimestamp,E.rtpAudioSsrc);E.rtpAudioSeq=E.rtpAudioSeq+1&65535,B(E?.track1RtpChannel??2,Buffer.concat([e,t]))}else{void 0===E.rtpVideoSeq&&(E.rtpVideoSeq=Math.floor(65536*Math.random())),void 0===E.rtpVideoTimestamp&&(E.rtpVideoTimestamp=0),void 0===E.rtpVideoSsrc&&(E.rtpVideoSsrc=4294967295*Math.random()>>>0);const e=Q(r,s,E.rtpVideoSeq,E.rtpVideoTimestamp,E.rtpVideoSsrc);E.rtpVideoSeq=E.rtpVideoSeq+1&65535,B(E?.track0RtpChannel??0,Buffer.concat([e,t]))}},f=1200,m=t=>{const s=e.splitAnnexBNals(t);for(const e of s){if(e.length<1)continue;if(5===(31&(e[0]??0)))return!0}return!1},y=(e,t)=>{if(e.length<=f)return void p(!1,e,t);const s=e[0],r=31&s,n=224&s|28,A=e.subarray(1);let i=0;for(;i<A.length;){const e=A.length-i,s=Math.min(e,1198),o=0===i,a=i+s>=A.length,c=(o?128:0)|(a?64:0)|r,l=A.subarray(i,i+s),h=Buffer.concat([Buffer.from([n,c]),l]);p(!1,h,t&&a),i+=s}},w=(e,t)=>{if(e.length<=f)return void p(!1,e,t);if(e.length<3)return;const s=e[0],r=s>>1&63,n=129&s|98,A=e[1],i=e.subarray(2);let o=0;for(;o<i.length;){const e=i.length-o,s=Math.min(e,1197),a=0===o,c=o+s>=i.length,l=(a?128:0)|(c?64:0)|63&r,h=i.subarray(o,o+s),g=Buffer.concat([Buffer.from([n,A,l]),h]);p(!1,g,t&&c),o+=s}},S=A?.frameRate&&A.frameRate>0?A.frameRate:25,D=Math.max(1,Math.round(9e4/S)),b=e=>{if(!E)return;if(null==e)return;if(!Number.isFinite(e))return;if(void 0===E.rtpVideoTimestamp&&(E.rtpVideoTimestamp=0),void 0===E.rtpVideoBaseTimestamp&&(E.rtpVideoBaseTimestamp=E.rtpVideoTimestamp),void 0===E.rtpVideoBaseMicroseconds)return E.rtpVideoBaseMicroseconds=e>>>0,void(E.rtpVideoLastTimestamp=E.rtpVideoTimestamp);const t=(e>>>0)-(E.rtpVideoBaseMicroseconds>>>0)>>>0;let s=((E.rtpVideoBaseTimestamp??0)>>>0)+Math.round(9e4*t/1e6)>>>0;const r=E.rtpVideoLastTimestamp;void 0!==r&&s<=r>>>0&&(s=1+(r>>>0)>>>0),E.rtpVideoTimestamp=s,E.rtpVideoLastTimestamp=s},v=(t,s,r=!0)=>{const n=e.splitAnnexBNals(s);if(0!==n.length){for(let e=0;e<n.length;e++){const s=n[e],r=e===n.length-1;"H265"===t?w(s,r):y(s,r)}r&&void 0!==E?.rtpVideoTimestamp&&void 0===E?.rtpVideoBaseMicroseconds&&(E.rtpVideoTimestamp=E.rtpVideoTimestamp+D>>>0)}},R=t=>{const s=e.stripAdtsHeader(t);if(!s)return;const r=Buffer.from([0,16]),n=8191&s.length,A=Buffer.alloc(2);A[0]=n>>5&255,A[1]=(31&n)<<3;const i=Buffer.concat([r,A,s]);p(!0,i,!0),void 0!==E?.rtpAudioTimestamp&&(E.rtpAudioTimestamp=E.rtpAudioTimestamp+1024>>>0)},N=e=>{const t=He(e);for(const e of t){if(e.length<2)continue;const t=e[0];if(void 0===t)continue;if(128&t)continue;if(xe(t>>1&63))return!0}return!1};let k,T;if(d&&n(void 0,null,null),!d){const e=["-hide_banner","-loglevel","error","-fflags","+genpts+igndts"],s=A?.frameRate||25;if(s>0&&(e.push("-r",s.toString()),this.rtspDebugLog(`Using frame rate ${s} fps for client ${t}`)),e.push("-f",o,"-i","pipe:0"),this.hasAudio&&e.push("-f","aac","-i","pipe:3"),r){if(e.push("-map","0:v:0","-c:v","copy","-vsync","cfr","-avoid_negative_ts","make_zero","-f","rtp","-payload_type","96",`rtp://127.0.0.1:${a}?pkt_size=1300`),this.hasAudio&&g&&c){const t=this.audioInfo,s=t?.sampleRate??8e3,r=t?.channels??1;e.push("-map","1:a:0","-c:a","aac","-profile:a","aac_low","-ar",String(s),"-ac",String(r),"-flags:a","+global_header","-f","rtp","-payload_type","97",`rtp://127.0.0.1:${c}?pkt_size=1300`)}}else e.push("-map","0:v:0","-c:v","copy","-vsync","cfr","-avoid_negative_ts","make_zero","-f","rtp","-payload_type","96","rtp://127.0.0.1:5004?pkt_size=1300");const i=["pipe","ignore","pipe"];this.hasAudio&&i.push("pipe"),this.rtspDebugLog(`Spawning ffmpeg for client ${t}: ffmpeg ${e.join(" ")}`),k=(0,h.spawn)("ffmpeg",e,{stdio:i});try{const e=this.flow.getParameterSetsAnnexB();e&&e.length>0&&k?.stdin&&(k.stdin.write(e),this.rtspDebugLog(`Wrote video parameter sets to ffmpeg stdin for client ${t} (len=${e.length})`))}catch(e){this.logger.warn(`[BaichuanRtspServer] Failed to write video parameter sets to ffmpeg for client ${t}: ${e}`)}if(k.on("error",(e=>{this.logger.error(`[BaichuanRtspServer] Failed to spawn ffmpeg for client ${t}:`,e)})),k.on("close",((e,s)=>{this.rtspDebugLog(`ffmpeg exited for client ${t} (code=${e}, signal=${s})`)})),n(k,l,g),k.stdin?.on("error",(e=>{const s=e?.code;"EPIPE"!==s&&"ERR_STREAM_WRITE_AFTER_END"!==s?this.logger.error(`[BaichuanRtspServer] FFmpeg stdin error for client ${t}:`,e):this.rtspDebugLog(`FFmpeg stdin error (${s}) for client ${t}`)})),T=this.hasAudio?k.stdio?.[3]:void 0,T?.on?.("error",(e=>{const s=e?.code;"EPIPE"!==s&&"ERR_STREAM_WRITE_AFTER_END"!==s?this.logger.error(`[BaichuanRtspServer] FFmpeg audio pipe error for client ${t}:`,e):this.rtspDebugLog(`FFmpeg audio pipe error (${s}) for client ${t}`)})),T&&this.audioPrimingFrame)try{T.write(this.audioPrimingFrame)}catch{}}this.rtspDebugLog(`Creating native stream iterator for client ${t}`);const F=this.nativeFanout?this.nativeFanout.subscribe(t):Ke(this.api,this.channel,this.profile);this.tempStreamGenerator=null;let M=0,U=Date.now();const L=A&&A.frameRate>0?1e3/A.frameRate:40;(async()=>{try{this.rtspDebugLog(`Starting to feed frames to client ${t} (target FPS: ${A?.frameRate||25}, interval: ${L}ms)`);let s=0,r=!1,n=!1,i=!1,o=!1,a=!1;for await(const A of F){if(!this.connectedClients.has(t)){this.rtspDebugLog(`Client ${t} disconnected, stopping frame feed`);break}const c=k?.stdin;if(!d&&(!c||c.destroyed||c.writableEnded||c.writableFinished)){this.rtspDebugLog(`FFmpeg stdin closed for client ${t}`);break}if(0===A.data.length)continue;if(!A.audio&&!i&&(i=!0,I)){const e=A.data.subarray(0,16).toString("hex");C(`First video frame received from generator for client ${t} (len=${A.data.length}, videoType=${String(A.videoType??this.flow.videoType)}, head=${e})`)}if(A.audio){if(s++,1===s&&this.rtspDebugLog(`Audio frames detected (codec: ${A.codec||"unknown"}, sampleRate: ${A.sampleRate||"unknown"})`),s%100==0&&this.rtspDebugLog(`Received ${s} audio frames (not sent to RTSP yet)`),d){if(!E?.seenFirstVideoKeyframe)continue;if(this.hasAudio&&e.isAdtsAacFrame(A.data)){if(I&&!n){n=!0;const e=A.data.subarray(0,16).toString("hex");C(`First audio ADTS frame packetized to RTP for client ${t} (len=${A.data.length}, head=${e})`)}R(A.data)}continue}if(this.hasAudio&&T&&!T.writableEnded&&!T.writableFinished){const s=T;if(!s)continue;if(e.isAdtsAacFrame(A.data))try{if(!n){n=!0;const e=A.data.subarray(0,16).toString("hex");this.rtspDebugLog(`First audio frame written to ffmpeg pipe for client ${t} (len=${A.data.length}, head=${e})`)}s.write(A.data)||await new Promise((e=>s.once("drain",(()=>e()))))}catch{}}continue}if("H264"===A.videoType||"H265"===A.videoType){const e="H264"===A.videoType?we(A.data):Ue(A.data);0===M&&this.setFlowVideoType(A.videoType,"first video frame");if(this.flow.getFmtp().hasParamSets)this.firstFrameReceived||this.markFirstFrameReceived();else{this.flow.extractParameterSets(e);this.flow.getFmtp().hasParamSets&&this.markFirstFrameReceived()}}M++,M%100==0&&this.rtspDebugLog(`Sent ${M} frames to client ${t} (frame size: ${A.data.length} bytes)`);const l=Date.now(),h=L-(l-U);if(h>0&&await new Promise((e=>setTimeout(e,Math.min(h,2*L)))),U=Date.now(),d){const e=A.videoType??this.flow.videoType,s="H264"===e?we(A.data):Ue(A.data);if(!E?.seenFirstVideoKeyframe)if("H265"===e){const{hasParamSets:r}=this.flow.getFmtp();if(!r){I&&!o&&(o=!0,C(`H265 gating: waiting for VPS/SPS/PPS before sending RTP to client ${t}`));continue}if(!E?.rtpSentVideoConfig){const t=this.flow.getParameterSetsAnnexB();t&&t.length>0&&(v(e,t,!1),E.rtpSentVideoConfig=!0)}E.h265WaitStartMs||(E.h265WaitStartMs=Date.now());const n=N(s),A=Date.now()-E.h265WaitStartMs;if(!n&&A<2e3){I&&!a&&(a=!0,C(`H265 gating: waiting for IRAP (or timeout) for client ${t}`));continue}E.seenFirstVideoKeyframe=!0}else{const{hasParamSets:r}=this.flow.getFmtp();if(!r){I&&!o&&(o=!0,C(`H264 gating: waiting for SPS/PPS before sending RTP to client ${t}`));continue}if(!E?.rtpSentVideoConfig){const t=this.flow.getParameterSetsAnnexB();t&&t.length>0&&(v(e,t,!1),E.rtpSentVideoConfig=!0)}if(!m(s))continue;E.seenFirstVideoKeyframe=!0}const n=A.microseconds;if(b(n),!E?.rtpSentVideoConfig){const t=this.flow.getParameterSetsAnnexB();t&&t.length>0&&(v(e,t,!1),E.rtpSentVideoConfig=!0)}if(!r&&(r=!0,I)){const e=A.data.subarray(0,16).toString("hex");C(`First video access unit packetized to RTP for client ${t} (len=${A.data.length}, head=${e})`)}v(e,s,!0)}else try{if(c&&!c.destroyed&&!c.writableEnded&&!c.writableFinished){if(!r){r=!0;const e=A.data.subarray(0,16).toString("hex");this.rtspDebugLog(`First video frame written to ffmpeg stdin for client ${t} (len=${A.data.length}, head=${e})`)}c.write("H264"===A.videoType?we(A.data):A.data)||await new Promise((e=>{c?c.once("drain",(()=>e())):e()}))}}catch(e){const s=e?.code;if("EPIPE"===s||"ERR_STREAM_WRITE_AFTER_END"===s){this.rtspDebugLog(`EPIPE writing to ffmpeg for client ${t}`);break}this.logger.error(`[BaichuanRtspServer] Error writing frame to ffmpeg for client ${t}:`,e)}}this.rtspDebugLog(`Finished feeding frames to client ${t} (total: ${M} frames)`)}catch(e){this.logger.error(`[BaichuanRtspServer] Error in feedFrames for client ${t}:`,e)}})().catch((e=>{this.logger.error(`[BaichuanRtspServer] Error feeding frames to client ${t}:`,e)})),k?.stderr?.on("data",(e=>{const s=e.toString();(s.includes("error")||s.includes("Error"))&&this.logger.error(`[BaichuanRtspServer] FFmpeg error for client ${t}: ${s}`)}))}async startNativeStream(){this.nativeStreamActive||(this.nativeStreamActive=!0,this.firstFrameReceived=!1,this.firstAudioDetected=!1,this.hasAudio=!1,this.audioInfo=null,this.audioPrimingFrame=null,this.firstFramePromise=new Promise((e=>{this.firstFrameResolve=e})),this.firstAudioPromise=new Promise((e=>{this.firstAudioResolve=e})),this.rtspDebugLog(`Starting native stream for profile ${this.profile} (waiting for camera to start transmitting...)`),await this.flow.startKeepAlive(this.api),this.nativeFanout=new ot({maxQueueItems:200,createSource:()=>Ke(this.api,this.channel,this.profile),onFrame:t=>{if(t.audio){if(!this.hasAudio&&"tcp"===this.api.client.getTransport()&&e.isAdtsAacFrame(t.data)){const s=e.parseAdtsSamplingInfo(t.data);s&&(this.hasAudio=!0,this.audioInfo={codec:"aac-adts",sampleRate:s.sampleRate,channels:s.channels,configHex:s.configHex},this.audioPrimingFrame=Buffer.from(t.data),this.markFirstAudioDetected(),this.rtspDebugLog(`Audio detected (AAC/ADTS ${s.sampleRate}Hz ch=${s.channels}); advertising RTSP track1 as mpeg4-generic`))}return}if(0===t.data.length)return;"H264"!==t.videoType&&"H265"!==t.videoType||this.setFlowVideoType(t.videoType,"native stream"),this.flow.extractParameterSets(t.data);const{hasParamSets:s}=this.flow.getFmtp();s&&this.markFirstFrameReceived()},onError:e=>{this.logger.warn(`[BaichuanRtspServer] Shared native stream error: ${e}`)}}),this.nativeFanout.start(),this.clearNoClientAutoStopTimer(),this.noClientAutoStopTimer=setTimeout((()=>{0===this.connectedClients.size&&(this.rtspDebugLog("Auto-stopping primed native stream (no clients connected)"),this.stopNativeStream())}),15e3),this.noClientAutoStopTimer?.unref?.())}markFirstFrameReceived(){!this.firstFrameReceived&&this.firstFrameResolve&&(this.firstFrameReceived=!0,this.rtspDebugLog(`First frame received from camera for profile ${this.profile}`),this.firstFrameResolve(),this.firstFrameResolve=null)}markFirstAudioDetected(){!this.firstAudioDetected&&this.firstAudioResolve&&(this.firstAudioDetected=!0,this.firstAudioResolve(),this.firstAudioResolve=null)}async stopNativeStream(){if(this.nativeStreamActive){if(this.rtspDebugLog("Stopping native stream"),this.flow.stopKeepAlive(),this.clearNoClientAutoStopTimer(),this.nativeStreamActive=!1,this.firstFrameReceived=!1,this.firstFramePromise=null,this.firstFrameResolve&&(this.firstFrameResolve=null),this.firstAudioDetected=!1,this.firstAudioPromise=null,this.firstAudioResolve&&(this.firstAudioResolve=null),this.nativeFanout){const e=this.nativeFanout;this.nativeFanout=null,await e.stop()}if(this.tempStreamGenerator){try{await this.tempStreamGenerator.return(void 0)}catch{}this.tempStreamGenerator=null}}}removeClient(e){this.connectedClients.has(e)&&(this.connectedClients.delete(e),this.emit("clientDisconnected",e),this.logger.info(`[BaichuanRtspServer] RTSP client disconnected: ${e}`),0===this.connectedClients.size&&this.stopNativeStream())}async waitUntilReady(e=3e4){return new Promise(((t,s)=>{if(!this.clientConnectionServer)return void s(new Error("RTSP server not started"));const r=setTimeout((()=>{s(new Error(`Timeout waiting for RTSP server to be ready (${e}ms). Camera may be sleeping or not responding.`))}),e),n=()=>{const e=new A.Socket;e.setTimeout(1e3),e.on("connect",(()=>{e.destroy(),this.nativeStreamActive&&this.firstFramePromise?(this.rtspDebugLog("Port is listening, waiting for camera to start transmitting frames..."),this.firstFramePromise.then((()=>{clearTimeout(r),t()})).catch((e=>{clearTimeout(r),s(e)}))):(clearTimeout(r),t())})),e.on("timeout",(()=>{e.destroy(),setTimeout(n,500)})),e.on("error",(()=>{e.destroy(),setTimeout(n,500)})),e.connect(this.listenPort,this.listenHost)};n()}))}async stop(){if(!this.active)return;this.logger.info(`[BaichuanRtspServer] Stopping RTSP server on ${this.listenHost}:${this.listenPort}...`),await this.stopNativeStream();const e=Array.from(this.connectedClients);for(const t of e){const e=this.clientResources.get(t);if(e){if(e.ffmpeg)try{e.ffmpeg.stdin?.end(),e.ffmpeg.kill("SIGTERM"),setTimeout((()=>{try{e.ffmpeg?.kill("SIGKILL")}catch{}}),1e3)}catch{}if(e.udpSocket)try{e.udpSocket.close()}catch{}if(e.rtspSocket&&!e.rtspSocket.destroyed)try{e.rtspSocket.destroy()}catch{}}}this.clientResources.clear(),this.clientConnectionServer&&(await new Promise((e=>{this.clientConnectionServer?.close((()=>{e()}))})),this.clientConnectionServer=void 0),this.active=!1,this.connectedClients.clear(),this.emit("close"),this.logger.info("[BaichuanRtspServer] RTSP server stopped")}getRtspUrl(){return`rtsp://${this.listenHost}:${this.listenPort}${this.path}`}isActive(){return this.active}getClientCount(){return this.connectedClients.size}};function ct(e){if(e instanceof Error)return e.stack||e.message;try{return JSON.stringify(e)}catch{return String(e)}}async function lt(e){try{return{ok:!0,value:await e()}}catch(e){return{ok:!1,error:ct(e)}}}function ht(e){a.mkdirSync(e,{recursive:!0})}function gt(e,t){ht(c.dirname(e)),a.writeFileSync(e,JSON.stringify(t,null,2))}function dt(e,t){ht(c.dirname(e)),a.appendFileSync(e,JSON.stringify(t)+"\n")}function ut(e){return new Promise((t=>setTimeout(t,e)))}function Et(){return(new Date).toISOString().replace(/[:.]/g,"-")}function It(e,t){if("H264"===e){return Se(t).map((e=>31&(e[0]??0)))}return He(t).map((e=>Pe(e))).filter((e=>"number"==typeof e))}async function Ct(e){const t=e.outDir;ht(t);const[s,r]=await Promise.all([e.native?lt((()=>async function(e){const{api:t}=e,s=e.channel??0,r={kind:"native",channel:s,transport:t.client.getTransport?.(),encKind:t.client.enc?.kind,collectedAt:(new Date).toISOString()},[n,A,i,o,a,c,l]=await Promise.all([lt((()=>t.getInfo(s))),lt((()=>t.getPorts())),lt((()=>t.getStreamMetadata(s))),lt((()=>t.getAbilityInfo())),lt((()=>t.getDeviceCapabilities(s,{probe:!1}))),lt((()=>t.getTalkAbility(s))),lt((()=>t.getTwoWayAudioConfig(s)))]);if(r.info=n,r.ports=A,r.streamMetadata=i,r.abilityInfo=o,r.deviceCapabilities=a,r.talkAbility=c,r.twoWayAudio=l,c?.ok&&c.value){const e=c.value,t={duplex:Array.isArray(e.duplexList)?e.duplexList[0]:void 0,audioStreamMode:Array.isArray(e.audioStreamModeList)?e.audioStreamModeList[0]:void 0,audioConfig:Array.isArray(e.audioConfigList)?e.audioConfigList[0]:void 0};r.intercomRecommended=t}return r}(e.native))):Promise.resolve(void 0),e.cgi?lt((()=>async function(e){const{cgi:t}=e,s=e.channel??0,r={kind:"cgi",channel:s,collectedAt:(new Date).toISOString()},[n,A,i,o,a,c,l]=await Promise.all([lt((()=>t.getInfo(s))),lt((()=>t.GetNetPort())),lt((()=>t.GetAbility())),lt((()=>t.GetEnc(s))),lt((()=>t.GetChannelstatus())),lt((()=>t.GetChnTypeInfo(s))),lt((()=>t.GetAiState(s)))]);return r.info=n,r.netPort=A,r.ability=i,r.enc=o,r.channelStatus=a,r.channelTypeInfo=c,r.aiState=l,r.devicesInfo=await lt((()=>t.getDevicesInfo())),r}(e.cgi))):Promise.resolve(void 0)]),n={createdAt:(new Date).toISOString(),native:s,cgi:r,...e.extra?{extra:e.extra}:{}},A=c.join(t,"diagnostics.json");return gt(A,n),{outDir:t,diagnosticsPath:A}}function Bt(e,t){return new Promise((s=>{ht(c.dirname(t));const r=a.createWriteStream(t,{flags:"a"}),n=(0,h.spawn)("ffmpeg",e,{stdio:["ignore","ignore","pipe"]});n.on("error",(e=>{r.write(`ffmpeg spawn error: ${e instanceof Error?e.message:String(e)}\n`),r.end(),s({ok:!1,error:e instanceof Error?e.message:String(e)})}));let A="";n.stderr.on("data",(e=>{const t=e.toString();A+=t,r.write(t)})),n.on("close",(e=>{r.end(),s(0!==e?{ok:!1,error:`ffmpeg exited with code ${e}\n${A.slice(-4e3)}`}:{ok:!0})}))}))}async function Qt(e){const t=["-hide_banner","-loglevel","warning","-stats",..."rtsp"===e.kind?["-rtsp_transport","tcp"]:[],"-i",e.url,"-t",String(e.durationSeconds),"-c","copy","-y",e.outputMp4];return await Bt(t,e.logPath)}async function pt(e){const t=`fps=1/${Math.max(.25,e.snapshotIntervalSeconds)}`,s=["-hide_banner","-loglevel","warning","-stats",..."rtsp"===e.kind?["-rtsp_transport","tcp"]:[],"-i",e.url,"-t",String(e.durationSeconds),"-vf",t,"-q:v","2","-y",e.snapshotsPattern];return await Bt(s,e.logPath)}async function ft(e){const t=["-hide_banner","-loglevel","warning","-stats","-f","H265"===e.videoType?"hevc":"h264","-i",e.snapshotAnnexBPath,"-frames:v","1","-q:v","2","-y",e.outputJpegPath];await Bt(t,e.logPath)}async function mt(e,t){const s=await a.promises.readdir(t,{withFileTypes:!0}),r=[];for(const n of s){const s=c.join(t,n.name),A=c.relative(e,s).replace(/\\/g,"/");n.isDirectory()?(r.push({absPath:s,relPath:A,isDir:!0}),r.push(...await mt(e,s))):n.isFile()&&r.push({absPath:s,relPath:A,isDir:!1})}return r}async function yt(e){const{sourceDir:t,zipPath:s}=e;await a.promises.mkdir(c.dirname(s),{recursive:!0});const r=new d.u,n=await mt(t,t),A=n.filter((e=>e.isDir)),i=n.filter((e=>!e.isDir));for(const e of A){const t=e.relPath.endsWith("/")?e.relPath:e.relPath+"/";r.addEmptyDirectory(t)}for(const e of i)r.addFile(e.absPath,e.relPath);const o=a.createWriteStream(s);await new Promise(((e,t)=>{o.on("error",t),r.outputStream.on("error",t),o.on("close",e),r.outputStream.pipe(o),r.end()}))}var wt={resolution_index:[0,7],tv_system:[7,1],framerate:[8,7],audio_index:[15,2],ai_pd:[17,1],ai_fd:[18,1],ai_vd:[19,1],ai_ad:[20,1],encoder_type_index:[21,2],is_schedule_record:[23,1],is_motion_record:[24,1],is_rf_record:[25,1],is_doorbell_record:[26,1],ai_other:[27,1]},St={resolution_index:[0,7],tv_system:[7,1],framerate:[8,7],audio_index:[15,2],ai_pd:[17,1],ai_fd:[18,1],ai_vd:[19,1],ai_ad:[20,1],encoder_type_index:[21,2],is_schedule_record:[23,1],is_motion_record:[24,1],is_rf_record:[25,1],is_doorbell_record:[26,1],is_ai_other_record:[27,1],picture_layout_index:[28,7],package_delivered:[35,1],package_takenaway:[36,1]},Dt={cam:{2:wt,3:wt,4:wt,7:wt,9:wt,10:wt},hub:{0:St,1:{...St,package_event:[37,1]},2:{resolution_index:[0,7],tv_system:[7,1],framerate:[8,7],audio_index:[15,2],ai_pd:[17,1],ai_fd:[18,1],ai_vd:[19,1],ai_ad:[20,1],ai_other:[21,2],encoder_type_index:[23,1],is_schedule_record:[24,1],is_motion_record:[25,1],is_rf_record:[26,1],is_doorbell_record:[27,1],picture_layout_index:[28,7],package_delivered:[35,1],package_takenaway:[36,1],package_event:[37,1],upload_flag:[38,1]}}};function bt(e,t,s){const r=Dt[e],n=r[t]??r[Math.max(...Object.keys(r).map((e=>Number(e))))];if(!n)return;const A=function(e,t){if(!e)return;if(!/^[0-9a-fA-F]+$/.test(e))return;const s=4*e.length,r=BigInt(`0x${e}`).toString(2).padStart(s,"0").split("").reverse().join(""),n=BigInt(`0b${r}`),A={};for(const[e,[s,r]]of Object.entries(t)){const t=BigInt(s),i=((n&(1n<<BigInt(r))-1n<<t)>>t).toString(2).padStart(r,"0").split("").reverse().join("");A[e]=Number.parseInt(i,2)}return A}(s,n);if(!A)return;return{raw:A,flags:{aiPerson:1===A.ai_pd,aiVehicle:1===A.ai_vd,aiAnimal:1===A.ai_ad,aiFace:1===A.ai_fd,aiOther:1===A.is_ai_other_record||1===A.ai_other||(A.ai_other??0)>0,schedule:1===A.is_schedule_record,motion:1===A.is_motion_record,rf:1===A.is_rf_record,doorbell:1===A.is_doorbell_record,package:1===A.package_event||1===A.package_delivered||1===A.package_takenaway}}}function vt(e,t){if(!/^\d{8}$/.test(e))return;if(!/^\d{6}$/.test(t))return;const s=Number.parseInt(e.slice(0,4),10),r=Number.parseInt(e.slice(4,6),10),n=Number.parseInt(e.slice(6,8),10),A=Number.parseInt(t.slice(0,2),10),i=Number.parseInt(t.slice(2,4),10),o=Number.parseInt(t.slice(4,6),10);return[s,r,n,A,i,o].every(Number.isFinite)?new Date(s,r-1,n,A,i,o):void 0}function Rt(e){const t=e.lastIndexOf(".");if(t<=0||t===e.length-1)return;const s=e.slice(t+1),r=e.slice(0,t).split("/").filter(Boolean).at(-1);if(!r)return;const n=r.split("_"),A=n[0]??"";if(!A.startsWith("Rec")||6!==A.length)return;const i=A[3],o="M"===i?"main":"S"===i?"sub":"unknown",a=Number.parseInt(A.slice(4,6),16);if(!Number.isFinite(a))return;let c,l,h,g="cam",d="",u="",E="",I="";if(6===n.length)d=n[1]??"",u=n[2]??"",E=n[3]??"",I=n[4]??"";else if(7===n.length)d=n[1]??"",u=n[2]??"",E=n[3]??"",c=n[4],I=n[5]??"";else{if(9!==n.length)return;g="hub",d=n[1]??"",u=n[2]??"",E=n[3]??"",c=n[4],l=n[5],h=n[6],I=n[7]??""}d=d.toLowerCase().replace("dst","");const C=vt(d,u);if(!C)return;const B="000000"===E?C:vt(d,E);if(!B)return;const Q=Math.max(0,B.getTime()-C.getTime()),p={baseName:r,ext:s,streamHint:o,version:a,devType:g,start:C,end:B,durationMs:Q},f=bt(g,a,I);return f&&(p.flags=f.flags,p.rawFlags=f.raw),null!=c&&(p.animalTypeRaw=c),null!=l&&(p.widthRaw=l),null!=h&&(p.heightRaw=h),p}function Nt(e){if(null==e)return;const t=Number(e);return Number.isFinite(t)?t:void 0}function kt(e){if("number"==typeof e)return e>0;if("string"==typeof e){const t=Number(e);return Number.isFinite(t)?t>0:e.length>0&&"0"!==e}return Boolean(e)}function Tt(e,t){if(!e||"object"!=typeof e)return;const s=e,r=s[t],n=s.Host,A={...n&&"object"==typeof n?n:{},...r&&"object"==typeof r?r:{}};return Object.keys(A).length?A:void 0}function Ft(e,t){if(!e)return!1;for(const[s,r]of Object.entries(e))if(t.test(s)&&kt(r))return!0;return!1}function Mt(e){if(!e)return;const t=e.match(/<Support[^>]*>([\s\S]*?)<\/Support>/i);if(!t)return;const s=t[1]??"",r=s.match(/<ptzMode>([^<]*)<\/ptzMode>/i)?.[1],n=[];for(const e of s.matchAll(/<item[^>]*>([\s\S]*?)<\/item>/gi)){const t=e[1]??"",s={chnID:Nt(t.match(/<chnID>([^<]*)<\/chnID>/i)?.[1])??0};for(const e of t.matchAll(/<([A-Za-z0-9_]+)>([^<]*)<\/\1>/g)){const t=e[1],r=e[2];if(!t)continue;if("chnID"===t)continue;const n=Nt(r);s[t]=n??r}n.push(s)}const A={items:n};void 0!==r&&(A.ptzMode=r);const i=(e,t)=>{const r=(e=>{const t=s.match(new RegExp(`<${e}>([^<]*)<\\/${e}>`,"i"));return Nt(t?.[1])})(t);void 0!==r&&(A[e]=r)};i("IOInputPortNum","IOInputPortNum"),i("IOOutputPortNum","IOOutputPortNum"),i("diskNum","diskNum"),i("channelNum","channelNum"),i("audioNum","audioNum"),i("ptzCfg","ptzCfg"),i("B485","B485"),i("autoUpdate","autoUpdate"),i("pushAlarm","pushAlarm"),i("ftp","ftp"),i("ftpTest","ftpTest"),i("email","email"),i("wifi","wifi"),i("record","record"),i("wifiTest","wifiTest"),i("rtsp","rtsp"),i("onvif","onvif"),i("audioTalk","audioTalk");const o=(e=>{const t=s.match(new RegExp(`<${e}>([^<]*)<\\/${e}>`,"i"));return t?.[1]})("subVersion");return void 0!==o&&(A.subVersion=o),A}function Ut(e){const{channel:t}=e,s=Tt(e.abilities,t),r=function(e,t){if(!e?.items?.length)return;const s=e=>{const t=e;let s=0;null==t.name&&(s+=2);const r=["ptzType","ptzControl","ptzPreset","ledCtrl","lightType","battery","audioVersion","motion","encCtrl","newIspCfg","remoteAbility"];for(const e of r)void 0!==t[e]&&(s+=3);return s+=Math.min(10,Math.max(0,Object.keys(t).length-1)),s};return(t=>{const r=e.items.filter((e=>e.chnID===t));if(r.length)return r.slice().sort(((e,t)=>s(t)-s(e)))[0]})(t)}(e.support,t),n=e.support?.ptzMode,A="string"==typeof n?n.toLowerCase():void 0,i=r?r.ptzType:void 0,o=r?r.ptzControl:void 0,a=kt(i)||kt(o)||kt(r?.ptzPreset),c=("none"===A||"0"===A)&&!a,l=!!r&&kt(r.battery),h=!!r&&kt(r.ptzPreset),g=r?r.doorbellVersion:void 0,d=Number.isFinite(Number(g))?Number(g)>0:kt(g),u=r?r.lightType:void 0,E="number"==typeof u?u:"string"==typeof u?Number(u):void 0,I=a||!!A&&("none"!==A&&"0"!==A),C=!!A&&(A.includes("pt")||"pt"===A||"ptz"===A),B=!!A&&A.includes("z"),Q=Ft(s,/battery/i),p=Ft(s,/white\s*led|whiteLed|flood\s*light|floodlight/i),f=Ft(s,/audio\s*alarm|audioAlarm|siren|pushAlarn|audioPlay/i),m=kt(e.support?.audioTalk)||!!r&&kt(r.ipcAudioTalk),y=Ft(s,/ptz/i),w=Ft(s,/zoom|zoomFocus|StartZoomFocus/i),S=Ft(s,/preset/i),D=Ft(s,/(^|_)pir/i)||Ft(s,/rfAlarm/i)||Ft(s,/mdWithPir/i),b=!!r&&(kt(r.rfCfg)||kt(r.newRfCfg)||kt(r.rfVersion)||kt(r.battery)),v=!c&&(C||y),R=!c&&(C||y),N=!c&&(B||w),k=!c&&(h||S),T={channel:t,hasPan:v,hasTilt:R,hasZoom:N,hasPresets:k,hasPtz:!c&&(I||v||R||N||k),hasBattery:l||Q,hasIntercom:m,hasSiren:f,hasFloodlight:Number.isFinite(E)?E>0:p,hasPir:D||b,isDoorbell:d};return void 0!==A&&(T.ptzMode=A),T}function Lt(e){if(null!=e){if("boolean"==typeof e)return e;if("number"==typeof e)return 1===e;if("string"==typeof e){const t=e.trim().toLowerCase();if("1"===t||"true"===t||"yes"===t||"on"===t)return!0;if("0"===t||"false"===t||"no"===t||"off"===t)return!1}}}function Ht(e){const t=function(e){if(!e||0===e.length)return[];const t=e[0]?.value;if(!t)return[];let s=t?.status??t?.Channelstatus??t?.ChannelStatus??t?.channelStatus??t?.channelstatus;if(!Array.isArray(s))if(Array.isArray(t))s=t;else if(s=t?.channels??t?.Channels??t?.channel??t?.Channel,!Array.isArray(s)){const e=Object.keys(t).filter((e=>/^channel\d+$/i.test(e)||/^ch\d+$/i.test(e)));e.length>0&&(s=e.map((e=>{const s=t[e];return"object"==typeof s&&null!==s?s:{channel:parseInt(e.replace(/\D/g,""),10)}})))}return Array.isArray(s)?s:[]}(e);if(!t.length)return[];const s=[];for(const e of t){if("object"!=typeof e||null===e)continue;const t=e?.channel??e?.id??e?.channelId??e?.Channel??e?.ID??e?.ChannelId;if("number"!=typeof t||!Number.isFinite(t))continue;const r="string"==typeof e?.name?e.name:void 0,n="string"==typeof e?.uid?e.uid:void 0,A="string"==typeof e?.typeInfo?e.typeInfo:void 0,i=Lt(e?.online),o=Lt(e?.sleep);s.push({channel:t,...void 0!==i?{online:i}:{},...void 0!==o?{sleep:o}:{},...r?{name:r}:{},...n?{uid:n}:{},...A?{typeInfo:A}:{}})}return s.sort(((e,t)=>e.channel-t.channel)),s}function Pt(e){return new Promise((t=>setTimeout(t,e)))}function xt(e,t){const s=new RegExp(`<${t}\\b[^>]*>([\\s\\S]*?)<\\/${t}>`,"g"),r=[];let n;for(;n=s.exec(e);)r.push(n[1]??"");return r}function Yt(e){const t=Number.parseInt(P(e,"year")??"",10),s=Number.parseInt(P(e,"month")??"",10),r=Number.parseInt(P(e,"day")??"",10),n=Number.parseInt(P(e,"hour")??"",10),A=Number.parseInt(P(e,"minute")??"",10),i=Number.parseInt(P(e,"second")??"",10);if([t,s,r,n,A,i].every(Number.isFinite))return new Date(t,s-1,r,n,A,i)}function Vt(e,t){return`<${e}><year>${t.getFullYear()}</year><month>${t.getMonth()+1}</month><day>${t.getDate()}</day><hour>${t.getHours()}</hour><minute>${t.getMinutes()}</minute><second>${t.getSeconds()}</second></${e}>`}function Ot(e){const t=[],s=xt(e,"FileInfo");for(const e of s){const s=P(e,"Id")??P(e,"ID")??P(e,"id"),r=P(e,"name")??P(e,"fileName"),n=(s??r)?.trim();if(!n)continue;const A={fileName:n};null!=r&&r.trim()&&(A.name=r.trim()),null!=s&&s.trim()&&(A.id=s.trim());const i=P(e,"type")??P(e,"recordType")??P(e,"alarmType");null!=i&&(A.recordType=i);const o=P(e,"size")??P(e,"fileSize"),a=o?Number.parseInt(o,10):void 0;null!=a&&Number.isFinite(a)&&(A.sizeBytes=a);const c=xt(e,"startTime")[0],l=xt(e,"endTime")[0],h=c?Yt(c):void 0,g=l?Yt(l):void 0;h&&(A.startTime=h),g&&(A.endTime=g);const d=Rt(A.name??A.fileName);d&&(A.parsedFileName=d,A.startTime||(A.startTime=d.start),A.endTime||(A.endTime=d.end)),t.push(A)}const r=xt(e,"File");for(const e of r){const s=P(e,"fileName")??P(e,"name");if(!s)continue;const r=P(e,"size")??P(e,"fileSize"),n=r?Number.parseInt(r,10):void 0,A=P(e,"type")??P(e,"recordType")??P(e,"alarmType"),i=xt(e,"startTime")[0],o=xt(e,"endTime")[0],a={fileName:s};null!=n&&Number.isFinite(n)&&(a.sizeBytes=n),null!=A&&(a.recordType=A);const c=i?Yt(i):void 0,l=o?Yt(o):void 0;c&&(a.startTime=c),l&&(a.endTime=l);const h=Rt(a.fileName);h&&(a.parsedFileName=h,a.startTime||(a.startTime=h.start),a.endTime||(a.endTime=h.end)),t.push(a)}if(0===t.length){const s=/<fileName>([\s\S]*?)<\/fileName>/g;let r;for(;r=s.exec(e);){const e=(r[1]??"").trim();if(!e)continue;const s={fileName:e},n=Rt(e);n&&(s.parsedFileName=n,s.startTime=n.start,s.endTime=n.end),t.push(s)}}if(0===t.length){const s=xt(e,"alarmVideo");for(const e of s){const s=P(e,"fileName")??P(e,"name");if(!s)continue;const r={fileName:s},n=P(e,"alarmType");null!=n&&(r.recordType=n);const A=xt(e,"startTime")[0],i=xt(e,"endTime")[0],o=A?Yt(A):void 0,a=i?Yt(i):void 0;o&&(r.startTime=o),a&&(r.endTime=a);const c=Rt(r.fileName);c&&(r.parsedFileName=c,r.startTime||(r.startTime=c.start),r.endTime||(r.endTime=c.end)),t.push(r)}}const n=new Set;return t.filter((e=>!n.has(e.fileName)&&(n.add(e.fileName),!0)))}function Gt(e){const t=P(e,"audioType"),s=Number.parseInt(P(e,"sampleRate")??"",10),r=Number.parseInt(P(e,"samplePrecision")??"",10),n=Number.parseInt(P(e,"lengthPerEncoder")??"",10),A=P(e,"soundTrack"),i=P(e,"priority");if(!(t&&Number.isFinite(s)&&Number.isFinite(r)&&Number.isFinite(n)&&A))return null;const o={audioType:t,sampleRate:s,samplePrecision:r,lengthPerEncoder:n,soundTrack:A};if(void 0!==i){const e=Number.parseInt(i,10);Number.isFinite(e)&&(o.priority=e)}return o}function Jt(e,t){const s=4+e.length,r=s%8==0?0:8-s%8,n=12+e.length+r,A=Buffer.alloc(n);return A.writeUInt32LE(1651978544,0),A.writeUInt16LE(s,4),A.writeUInt16LE(s,6),A.writeUInt16LE(256,8),A.writeUInt16LE(t,10),e.copy(A,12),A}var Wt=class{client;logger;httpClient;host;username;password;rebootAfterDisconnectionsPerMinute;disconnectStormVoluntaryAtMs=[];disconnectStormRebootInFlight;disconnectStormLastRebootAtMs;simpleEventListeners=new Set;simpleEventSubscribed=!1;simpleEventSubscribeInFlight;simpleEventUnsubscribeInFlight;simpleEventResubscribeTimer;simpleEventResubscribeInFlight;simpleEventResubscribeIntervalMs=3e5;statePollingInterval;lastMotionState;lastAiState;aiStatePollingDisabled=!1;aiStatePollingDisabledLogged=!1;rtspServers=new Set;activeVideoMsgNums=new Map;lastSleepProbe;constructor(e){this.logger=e.logger??console,this.client=new ge(e),this.host=e.host,this.username=e.username,this.password=e.password,this.httpClient=new de({host:e.host,username:e.username,password:e.password,timeoutMs:6e5}),this.client.on("event",(e=>{const t=function(e){const t=e.timestamp??Date.now();if("motion"===e.type)return{type:"motion",channel:e.channel,timestamp:t};if("visitor"===e.type)return{type:"doorbell",channel:e.channel,timestamp:t};if("daynight"===e.type)return{type:"daynight",channel:e.channel,timestamp:t};if("ai"===e.type){const s=e.ai,r=s?.type;return{type:r?{people:"people",vehicle:"vehicle",dog_cat:"animal",face:"face",package:"package",other:"other"}[r]:"other",channel:e.channel,timestamp:t}}return null}(e);if(t)for(const e of this.simpleEventListeners)try{e(t)}catch(e){(this.logger.warn??this.logger.error).call(this.logger,"[ReolinkBaichuanApi] onSimpleEvent handler error",e)}}));const t=e.rebootAfterDisconnectionsPerMinute;"number"==typeof t&&Number.isFinite(t)&&t>0&&(this.rebootAfterDisconnectionsPerMinute=Math.floor(t),this.client.on("close",(()=>{try{this.maybeRebootOnDisconnectStorm()}catch{}})))}async runAllDiagnosticsConsecutively(e){const t=e.channel??0,s=e.outDir,r=(new Date).toISOString().replace(/[:.]/g,"-"),n=(0,c.join)(s,r);(this.logger.log??console.log).call(this.logger,"[Diagnostics] starting run",{outDir:s,runDir:n,channel:t,durationSeconds:e.durationSeconds,selection:e.selection});const A=!0===e.cgi||"object"==typeof e.cgi&&null!=e.cgi,i=A?new ue({host:("object"==typeof e.cgi?e.cgi.host:void 0)??this.host,username:("object"==typeof e.cgi?e.cgi.username:void 0)??this.username,password:("object"==typeof e.cgi?e.cgi.password:void 0)??this.password,..."object"==typeof e.cgi&&null!=e.cgi.port?{port:e.cgi.port}:{},..."object"==typeof e.cgi&&null!=e.cgi.useHttps?{useHttps:e.cgi.useHttps}:{},..."object"==typeof e.cgi&&null!=e.cgi.insecureTLS?{insecureTLS:e.cgi.insecureTLS}:{},..."object"==typeof e.cgi&&null!=e.cgi.timeoutMs?{timeoutMs:e.cgi.timeoutMs}:{}}):void 0,o=await Ct({outDir:n,native:{api:this,channel:t},...i?{cgi:{cgi:i,channel:t}}:{},...e.extra?{extra:e.extra}:{}});(this.logger.log??console.log).call(this.logger,"[Diagnostics] diagnostics bundle collected",{diagnosticsPath:o.diagnosticsPath,runDir:o.outDir,cgiEnabled:A});const l=(0,c.join)(n,"streams"),h=!0===e.rtsp||"object"==typeof e.rtsp&&null!=e.rtsp?{host:("object"==typeof e.rtsp?e.rtsp.host:void 0)??this.host,username:("object"==typeof e.rtsp?e.rtsp.username:void 0)??this.username,password:("object"==typeof e.rtsp?e.rtsp.password:void 0)??this.password,..."object"==typeof e.rtsp&&null!=e.rtsp.port?{port:e.rtsp.port}:{}}:void 0;await async function(e){const t=e.channel??0,s=Math.max(250,Math.round(1e3*e.durationSeconds)),r=e.snapshotIntervalSeconds??2,n=e.logger,A=(e,t,s)=>{const r=n?.[e]??n?.log;r&&(void 0!==s?r.call(n,t,s):r.call(n,t))},i=function(e){const t=[];for(const s of e??[])"main"!==s&&"sub"!==s&&"ext"!==s||t.includes(s)||t.push(s);return t}(e.selection.profiles),o=i.length?i:["main","sub","ext"],l=e.outDir;ht(l),A("log","[Diagnostics] stream sampling start",{outDir:l,channel:t,durationSeconds:e.durationSeconds,snapshotIntervalSeconds:r,selection:e.selection});const h=c.join(l,"events.ndjson");dt(h,{t:Date.now(),type:"sampling_start",channel:t,durationSeconds:e.durationSeconds,snapshotIntervalSeconds:r,selection:e.selection});for(const n of o)for(const i of e.selection.kinds){const o=`${i}_${n}`,g=c.join(l,o);if(ht(g),dt(h,{t:Date.now(),type:"stream_begin",kind:i,profile:n,channel:t}),A("log","[Diagnostics] stream begin",{kind:i,profile:n,channel:t}),"native"!==i)if("rtsp"!==i)if("rtmp"!==i);else{const s=e.rtmp?.urlsByProfile?.[n];if(!s){dt(h,{t:Date.now(),type:"stream_skip",kind:i,profile:n,reason:"rtmp url missing"}),A("warn","[Diagnostics] stream skip (rtmp url missing)",{kind:i,profile:n,channel:t});continue}const o=c.join(g,`clip_${Et()}.mp4`),a=c.join(g,"ffmpeg_record.log"),l=c.join(g,"snapshots");ht(l);const d=c.join(l,"snap_%05d.jpg");dt(h,{t:Date.now(),type:"rtmp_url",kind:i,profile:n,url:s});const[u,E]=await Promise.all([Qt({kind:"rtmp",url:s,outputMp4:o,durationSeconds:e.durationSeconds,logPath:a}),pt({kind:"rtmp",url:s,snapshotsPattern:d,durationSeconds:e.durationSeconds,snapshotIntervalSeconds:r,logPath:c.join(g,"ffmpeg_snapshots.log")})]);dt(h,{t:Date.now(),type:"rtmp_done",kind:i,profile:n,mp4Path:o,record:u,snapshots:E}),A("log","[Diagnostics] stream done",{kind:i,profile:n,channel:t,mp4Path:o,record:u,snapshots:E})}else{if(!e.rtsp){dt(h,{t:Date.now(),type:"stream_skip",kind:i,profile:n,reason:"rtsp config missing"}),A("warn","[Diagnostics] stream skip (rtsp config missing)",{kind:i,profile:n,channel:t});continue}const s=Ee({host:e.rtsp.host,username:e.rtsp.username,password:e.rtsp.password,channel:t,stream:n,...null!=e.rtsp.port?{port:e.rtsp.port}:{}}),o=c.join(g,`clip_${Et()}.mp4`),a=c.join(g,"ffmpeg_record.log"),l=c.join(g,"snapshots");ht(l);const d=c.join(l,"snap_%05d.jpg");dt(h,{t:Date.now(),type:"rtsp_url",kind:i,profile:n,url:s});const[u,E]=await Promise.all([Qt({kind:"rtsp",url:s,outputMp4:o,durationSeconds:e.durationSeconds,logPath:a}),pt({kind:"rtsp",url:s,snapshotsPattern:d,durationSeconds:e.durationSeconds,snapshotIntervalSeconds:r,logPath:c.join(g,"ffmpeg_snapshots.log")})]);dt(h,{t:Date.now(),type:"rtsp_done",kind:i,profile:n,mp4Path:o,record:u,snapshots:E}),A("log","[Diagnostics] stream done",{kind:i,profile:n,channel:t,mp4Path:o,record:u,snapshots:E})}else{const o=e.native?.api;if(!o){dt(h,{t:Date.now(),type:"stream_skip",kind:i,profile:n,reason:"native api missing"}),A("warn","[Diagnostics] stream skip (native api missing)",{kind:i,profile:n,channel:t});continue}const l=c.join(g,"raw_frames"),d=c.join(g,"snapshots");ht(l),ht(d);const u=e.limits?.maxNativeRawFrames??400,E=e.limits?.maxNativeRawBytes??52428800;let I=0,C=0;const B="sub"===n?1:0,Q=e=>{if(!e?.header)return;if(3!==e.header.cmdId)return;if(e.header.streamType!==B)return;if(I>=u)return;const t=Buffer.isBuffer(e.payload)&&e.payload.length?e.payload:e.body;if(!Buffer.isBuffer(t)||0===t.length)return;if(C+t.length>E)return;I++,C+=t.length;const s=String(I).padStart(6,"0"),r=c.join(l,`frame_${s}.bin`);try{a.writeFileSync(r,t)}catch{}dt(h,{t:Date.now(),type:"native_raw_frame",kind:i,profile:n,idx:I,bytes:t.length,header:e.header,bodyLen:e.body?.length??0,payloadLen:e.payload?.length??0})};o.client.on("frame",Q);const p=new Ze({client:o.client,api:o,channel:t,profile:n}),f=c.join(g,`clip_${Et()}`),m=f+".annexb",y=f+".audio.bin",w=f+".json",S=a.createWriteStream(m,{flags:"w"}),D=a.createWriteStream(y,{flags:"w"});let b,v=null,R=0,N=0,k=0,T=null;const F=e=>{if(!e||!Buffer.isBuffer(e.data))return;b||(b=e.videoType),R++;try{S.write(e.data)}catch{}e.isKeyframe&&null==v&&(v=Date.now());const t=It(e.videoType,e.data);dt(h,{t:Date.now(),type:"native_access_unit",kind:i,profile:n,isKeyframe:!!e.isKeyframe,videoType:e.videoType,microseconds:e.microseconds,bytes:e.data.length,nalTypes:t});const s=Date.now();if(e.isKeyframe&&s-k>=1e3*r){k=s;const t=Et(),r=c.join(d,`snap_${t}.${"H265"===e.videoType?"h265":"h264"}`);try{a.writeFileSync(r,e.data),dt(h,{t:Date.now(),type:"native_snapshot_saved",kind:i,profile:n,path:r});const s=c.join(d,`snap_${t}.jpg`);ft({videoType:e.videoType,snapshotAnnexBPath:r,outputJpegPath:s,logPath:c.join(g,"ffmpeg_snapshot.log")})}catch{}}},M=e=>{if(Buffer.isBuffer(e)&&0!==e.length){N++;try{D.write(e)}catch{}dt(h,{t:Date.now(),type:"native_audio",kind:i,profile:n,bytes:e.length})}};p.on("videoAccessUnit",F),p.on("audioFrame",M),p.on("error",(e=>{dt(h,{t:Date.now(),type:"native_error",kind:i,profile:n,error:ct(e)})}));try{for(await p.start(),dt(h,{t:Date.now(),type:"native_started",kind:i,profile:n}),T=Date.now();Date.now()-T<s;)await ut(200)}finally{try{await p.stop()}catch{}o.client.removeListener("frame",Q);try{S.end()}catch{}try{D.end()}catch{}const s={kind:i,profile:n,channel:t,durationSeconds:e.durationSeconds,videoAccessUnits:R,audioFrames:N,videoType:b,firstKeyframeLatencyMs:null==v||null==T?null:Math.max(0,v-T),rawFrames:I,rawBytes:C};gt(w,s),dt(h,{t:Date.now(),type:"native_done",...s}),A("log","[Diagnostics] stream done",s)}}}dt(h,{t:Date.now(),type:"sampling_done"})}({outDir:l,durationSeconds:e.durationSeconds,...null!=e.snapshotIntervalSeconds?{snapshotIntervalSeconds:e.snapshotIntervalSeconds}:{},channel:t,selection:e.selection,...h?{rtsp:h}:{},...e.rtmp?{rtmp:e.rtmp}:{},native:{api:this},...e.limits?{limits:e.limits}:{},logger:this.logger}),(this.logger.log??console.log).call(this.logger,"[Diagnostics] stream sampling completed",{streamsDir:l});const g=(0,c.join)(s,`${r}.zip`);return(this.logger.log??console.log).call(this.logger,"[Diagnostics] creating zip bundle",{zipPath:g}),await yt({sourceDir:n,zipPath:g}),(this.logger.log??console.log).call(this.logger,"[Diagnostics] zip bundle created",{zipPath:g}),{runDir:o.outDir,zipPath:g,diagnosticsPath:o.diagnosticsPath,streamsDir:l}}async maybeRebootOnDisconnectStorm(){const e=this.rebootAfterDisconnectionsPerMinute;if(null==e)return;const t=this.client.getLastDisconnectInfo?.();if(!t?.voluntary)return;const s=Date.now(),r=s-6e4;for(;this.disconnectStormVoluntaryAtMs.length&&this.disconnectStormVoluntaryAtMs[0]<r;)this.disconnectStormVoluntaryAtMs.shift();if(this.disconnectStormVoluntaryAtMs.push(s),this.disconnectStormVoluntaryAtMs.length<e)return;if(this.disconnectStormRebootInFlight)return;const n=6e5;null!=this.disconnectStormLastRebootAtMs&&s-this.disconnectStormLastRebootAtMs<n||(this.disconnectStormLastRebootAtMs=s,(this.logger.warn??this.logger.error).call(this.logger,"[ReolinkBaichuanApi] disconnect storm detected; rebooting device",{transport:t.transport,reason:t.reason,voluntaryDisconnectsInWindow:this.disconnectStormVoluntaryAtMs.length,windowMs:6e4,threshold:e,cooldownMs:n,method:"auto"}),this.disconnectStormRebootInFlight=this.rebootFromDisconnectStorm("auto").catch((e=>{(this.logger.warn??this.logger.error).call(this.logger,"[ReolinkBaichuanApi] disconnect-storm reboot failed",e)})).finally((()=>{this.disconnectStormRebootInFlight=void 0})))}async rebootFromDisconnectStorm(e){let t;if("auto"===e||"baichuan"===e)try{return void await this.reboot()}catch(s){if(t=s,"baichuan"===e)throw s}if("auto"===e||"cgi"===e){const e=new ue({host:this.host,username:this.username,password:this.password,timeoutMs:6e4});try{return await e.login(),void await e.Reboot()}catch(e){throw t=e,e}finally{try{await e.logout()}catch{}}}throw t instanceof Error?t:new Error(String(t??"disconnect-storm reboot failed"))}async onSimpleEvent(e){this.simpleEventListeners.add(e),await this.ensureSimpleEventSubscribed(),this.startSimpleEventResubscribeTimer()}async offSimpleEvent(e){if(e?this.simpleEventListeners.delete(e):this.simpleEventListeners.clear(),0===this.simpleEventListeners.size)this.stopSimpleEventResubscribeTimer(),await this.ensureSimpleEventUnsubscribed();else{"udp"===this.client.getTransport?.()||this.startStatePolling()}}startSimpleEventResubscribeTimer(){this.simpleEventResubscribeTimer||0!==this.simpleEventListeners.size&&(this.simpleEventResubscribeTimer=setInterval((()=>{this.renewSimpleEventSubscription()}),this.simpleEventResubscribeIntervalMs))}stopSimpleEventResubscribeTimer(){this.simpleEventResubscribeTimer&&(clearInterval(this.simpleEventResubscribeTimer),this.simpleEventResubscribeTimer=void 0)}async renewSimpleEventSubscription(){if(0!==this.simpleEventListeners.size)return this.simpleEventResubscribeInFlight||(this.simpleEventResubscribeInFlight=(async()=>{try{await this.subscribeEvents(),this.simpleEventSubscribed=!0,(this.logger.debug??this.logger.log).call(this.logger,"[ReolinkBaichuanApi] renewed simple event subscription",{intervalMs:this.simpleEventResubscribeIntervalMs})}catch(e){(this.logger.debug??this.logger.log).call(this.logger,"[ReolinkBaichuanApi] failed to renew event subscription",e)}})().finally((()=>{this.simpleEventResubscribeInFlight=void 0}))),await this.simpleEventResubscribeInFlight}async ensureSimpleEventSubscribed(){if(0!==this.simpleEventListeners.size&&!this.simpleEventSubscribed)return this.simpleEventSubscribeInFlight||(this.simpleEventSubscribeInFlight=(async()=>{this.client.subscribed||await this.subscribeEvents(),this.simpleEventSubscribed=!0;if(!("udp"===this.client.getTransport?.())){const e=this.client.getConfiguredChannel?.()??0;await this.checkAndDispatchCurrentState(e),this.startStatePolling()}})().finally((()=>{this.simpleEventSubscribeInFlight=void 0}))),await this.simpleEventSubscribeInFlight}async ensureSimpleEventUnsubscribed(){if(this.simpleEventSubscribed||this.client.subscribed){if(this.simpleEventUnsubscribeInFlight)return await this.simpleEventUnsubscribeInFlight;if(this.simpleEventSubscribeInFlight)try{await this.simpleEventSubscribeInFlight}catch{}return this.simpleEventUnsubscribeInFlight=(async()=>{await this.unsubscribeEvents(),this.simpleEventSubscribed=!1,this.stopSimpleEventResubscribeTimer(),this.stopStatePolling()})().finally((()=>{this.simpleEventUnsubscribeInFlight=void 0})),await this.simpleEventUnsubscribeInFlight}}normalizeChannel(e){return null==e?0:e}async login(e){await this.client.login(e)}async close(){this.stopStatePolling(),await this.cleanup(),await this.client.close()}async cleanup(){const e=Array.from(this.rtspServers);this.rtspServers.clear(),await Promise.allSettled(e.map((async e=>{try{await e.stop()}catch(e){this.logger.error("[ReolinkBaichuanApi] Error stopping RTSP server during cleanup:",e)}}))),e.length>0&&this.logger.info(`[ReolinkBaichuanApi] Cleaned up ${e.length} RTSP server(s)`)}async sendXml(e,t=3){this.client.loggedIn||await this.client.login();try{const s=await this.client.sendFrame(e);if(400===s.header.responseCode){if(t>0){if(0===s.body.length)try{this.client.loggedIn=!1,await this.client.login()}catch{}const r=1500;return await new Promise((e=>setTimeout(e,r))),await this.sendXml(e,t-1)}if(0===s.body.length)throw new Error("Baichuan request failed (responseCode 400, empty body). Possible causes: camera sleeping/waking (battery), expired session, or invalid username/password.")}if(0===s.body.length)return"";return this.client.tryDecryptXml(s.body,s.header.channelId,this.client.enc)}catch(e){throw e}}async getTalkAbility(e){return function(e){const t=xt(e,"TalkAbility")[0];if(!t)throw new Error("TalkAbility XML not found in response");return{duplexList:xt(t,"duplexList").map((e=>P(e,"duplex"))).filter((e=>!!e)),audioStreamModeList:xt(t,"audioStreamModeList").map((e=>P(e,"audioStreamMode"))).filter((e=>!!e)),audioConfigList:xt(t,"audioConfig").map(Gt).filter((e=>!!e))}}(await this.sendXml({cmdId:10,...void 0!==e?{channel:e}:{}}))}async createTalkSession(e=0,t){this.client.loggedIn||await this.client.login();const s="udp"===this.client.getTransport?.()?e:void 0,r=await this.getTalkAbility(e),n=r.audioConfigList.find((e=>"adpcm"===e.audioType.toLowerCase()))??r.audioConfigList[0];if(!n)throw new Error(`Talk not supported on channel ${e} (no audioConfig in TalkAbility)`);const A=r.duplexList[0]??"FDX",i=r.audioStreamModeList[0]??"followVideoStream",o={channel:e,duplex:A,audioStreamMode:i,audioConfig:n},a=Math.floor(n.lengthPerEncoder/2),c=a+4;if(a<=0||c<=4)throw new Error(`Invalid talk audio config: lengthPerEncoder=${n.lengthPerEncoder}`);const l=function(e){const t=e.audioConfig;return`<?xml version="1.0" encoding="UTF-8" ?>\n<body>\n<TalkConfig version="1.1">\n<channelId>${e.channel}</channelId>\n<duplex>${U(e.duplex)}</duplex>\n<audioStreamMode>${U(e.audioStreamMode)}</audioStreamMode>\n<audioConfig>\n<audioType>${U(t.audioType)}</audioType>\n<sampleRate>${t.sampleRate}</sampleRate>\n<samplePrecision>${t.samplePrecision}</samplePrecision>\n<lengthPerEncoder>${t.lengthPerEncoder}</lengthPerEncoder>\n<soundTrack>${U(t.soundTrack)}</soundTrack>\n</audioConfig>\n</TalkConfig>\n</body>`}(o);await(async()=>{const t=await this.client.sendFrame({cmdId:201,channel:e,...null!=s?{channelIdOverride:s}:{},payloadXml:l,messageClass:p});if(422!==t.header.responseCode){if(200!==t.header.responseCode)throw new Error(`TalkConfig rejected (responseCode ${t.header.responseCode})`)}else{await this.client.sendFrame({cmdId:11,channel:e,...null!=s?{channelIdOverride:s}:{},payloadXml:"",messageClass:p});const t=await this.client.sendFrame({cmdId:201,channel:e,...null!=s?{channelIdOverride:s}:{},payloadXml:l,messageClass:p});if(200!==t.header.responseCode)throw new Error(`TalkConfig rejected after reset (responseCode ${t.header.responseCode})`)}})();const h={channel:e,audioConfig:n,blockSize:a,fullBlockSize:c};let g=Buffer.alloc(0),d=!1,u=!1,E=Date.now();const I=Math.max(1,Math.min(8,Math.floor(t?.blocksPerPayload??1))),C=async t=>{if(0===t.length)return;if(t.length>I)throw new Error(`Internal error: too many blocks in payload (${t.length})`);const r=[];let A=0;for(const e of t)r.push(Jt(e,a)),A+=Math.max(0,2*(e.length-4)+1);await this.client.sendBinaryPayloadNoReply({cmdId:202,channel:e,...null!=s?{channelIdOverride:s}:{},extensionXml:H(e),payload:Buffer.concat(r),messageClass:p});const i=A/n.sampleRate*1e3,o=Date.now();o>E?E=o+i:E+=i;const c=E-Date.now();c>0&&await Pt(c)},B=async()=>{if(!u){u=!0;try{for(;;){if(!(g.length>=c)){if(d){if(g.length>0){const e=Buffer.alloc(c,255);g.copy(e,0),g=Buffer.alloc(0),await C([e])}break}break}{const e=[];for(;e.length<I&&g.length>=c;)e.push(g.subarray(0,c)),g=g.subarray(c);await C(e)}}}finally{u=!1}}};return{info:h,sendAudio:async e=>{if(d)throw new Error("Talk session is closed");0!==e.length&&(g=0===g.length?e:Buffer.concat([g,e]),await B())},stop:async()=>{if(d)return;d=!0,await B();const t=E-Date.now();t>0?await Pt(t+100):await Pt(100);const r=await this.client.sendFrame({cmdId:11,channel:e,...null!=s?{channelIdOverride:s}:{},payloadXml:"",messageClass:p});if(200!==r.header.responseCode)throw new Error(`TalkReset rejected (responseCode ${r.header.responseCode})`)}}}async sendBinary(e){return await this.client.login(),await this.client.sendBinary(e)}async getNetPort(){const e={},t=(await this.sendXml({cmdId:37})).matchAll(/<([A-Za-z]+)Port[^>]*>([\s\S]*?)<\/\1Port>/g);for(const s of t){const t=(s[1]??"").toLowerCase(),r=s[2]??"",n={};for(const e of r.matchAll(/<([A-Za-z]+)>(-?\d+)<\/\1>/g)){const t=(e[1]??"").toLowerCase(),s=Number(e[2]);Number.isFinite(s)&&(n[t]=s)}Object.keys(n).length&&(e[t]=n)}return e}async getPorts(){return this.getNetPort()}async setPortEnabled(e){const t=`${e.port[0].toUpperCase()}${e.port.slice(1)}Port`,s=`<?xml version="1.0" encoding="UTF-8" ?><body><${t} version="1.1"><enable>${e.enable?1:0}</enable></${t}></body>`;await this.sendXml({cmdId:36,payloadXml:s})}async getInfo(e,t){const s={cmdId:null==e?80:318};void 0!==e&&(s.channel=e),null!=t?.timeoutMs&&(s.timeoutMs=t.timeoutMs);return function(e,t){const s={};for(const r of t){const t=P(e,r);void 0!==t&&(s[r]=t)}return s}(await this.sendXml(s),t?.tags?.length?t.tags:["type","hardwareVersion","firmwareVersion","itemNo","serialNumber","name"])}async getChannelIdentity(e,t){const s=await this.getInfo(e,{...null!=t?.timeoutMs?{timeoutMs:t.timeoutMs}:{},tags:["type","name"]});return{channel:e,model:(s.type??"").trim(),name:(s.name??"").trim()}}async getNvrChannelsInfo(e){const t=e?.source??"cgi",s=e?.timeoutMs??3500,r=e?.maxChannels??16,n=e?.cgiTimeoutMs??3e4;if("cgi"===t){const e=new ue({host:this.host,username:this.username,password:this.password,timeoutMs:n});try{await e.login();const t=Number.isFinite(r)&&r>0?r:16,s=[{cmd:"GetChannelstatus",action:0},...Array.from({length:t},((e,t)=>({cmd:"GetChnTypeInfo",action:0,param:{channel:t}})))],n=await e.callMany(s),A=Ht(n.length?[n[0]]:[]),i=new Map;for(const e of A)i.set(e.channel,e);const o=A.map((e=>e.channel)),a=o.length?[...new Set(o)].sort(((e,t)=>e-t)):Array.from({length:t},((e,t)=>t)),c=[];for(const e of a){const s=i.get(e);let r,A,o;if(e>=0&&e<t){const t=n[1+e],s=t?.value;s&&"object"==typeof s&&("string"==typeof s.typeInfo&&s.typeInfo.trim()&&(r=s.typeInfo.trim()),"string"==typeof s.firmVer&&s.firmVer.trim()&&(A=s.firmVer.trim()),"string"==typeof s.boardInfo&&s.boardInfo.trim()&&(o=s.boardInfo.trim()))}const a=s?.name?.trim(),l=(r??s?.typeInfo)?.trim(),h=s?.uid?.trim();c.push({channel:e,...l?{model:l}:{},...a?{name:a}:{},...h?{uid:h}:{},...void 0!==s?.online?{online:s.online}:{},...void 0!==s?.sleep?{sleep:s.sleep}:{},...A?{firmwareVersion:A}:{},...o?{boardInfo:o}:{},source:"cgi"})}return c}finally{}}let A=[];try{const e=await this.getAbilityInfo();A=Object.keys(e??{}).filter((e=>"Host"!==e)).map((e=>Number(e))).filter((e=>Number.isFinite(e))).sort(((e,t)=>e-t))}catch{}if(0===A.length){const e=Number.isFinite(r)&&r>0?r:16;A=Array.from({length:e},((e,t)=>t))}const i=[];for(const e of A)try{const t=await this.getInfo(e,{timeoutMs:s,tags:["type","name","firmwareVersion"]}),r=(t.type??"").trim(),n=(t.name??"").trim(),A=(t.firmwareVersion??"").trim();if(!!!(r||n||A))continue;i.push({channel:e,...r?{model:r}:{},...n?{name:n}:{},...A?{firmwareVersion:A}:{},source:"baichuan"})}catch{}return i.sort(((e,t)=>e.channel-t.channel))}async getEncXml(e,t){const s=this.normalizeChannel(e);return await this.sendXml({cmdId:56,channel:s,...null!=t?.timeoutMs?{timeoutMs:t.timeoutMs}:{}})}async getStreamMetadata(e){const t=this.normalizeChannel(e),s=await this.getEncXml(t),r=[];let n=!0;const A=this.client.getDebugConfig?.(),i=!0===A?.debugParamSets,o=e=>e.width>0&&e.height>0&&(e.frameRate>0||e.bitRate>0),a=(e,s)=>{if(!i)return;if(!s)return void(this.logger.warn??this.logger.log).call(this.logger,`[ReolinkBaichuanApi] getStreamMetadata(debugParamSets): channel=${t} tag=<${e}> missing`);const r=s,n=P(r,"width")??P(r,"Width"),A=P(r,"height")??P(r,"Height"),a=P(r,"frame")??P(r,"Frame"),c=P(r,"bitRate")??P(r,"BitRate"),l=P(r,"videoEncType")??P(r,"VideoEncType"),h=P(r,"audio")??P(r,"Audio"),g=P(r,"enable")??P(r,"Enable"),d=Number(n??"0"),u=Number(A??"0"),E=Number(a??"0"),I=Number(c??"0"),C=Number(h??"0"),B=void 0===g||"1"===g||"true"===g,Q=B&&o({width:d,height:u,frameRate:E,bitRate:I}),p=1400,f=r.length<=p?r:r.slice(0,p)+`\n...truncated (+${r.length-p} chars)`;(this.logger.warn??this.logger.log).call(this.logger,`[ReolinkBaichuanApi] getStreamMetadata(debugParamSets): channel=${t} tag=<${e}> enabled=${B} plausible=${Q} width=${d} height=${u} frame=${E} bitRate=${I} audio=${C} videoEncType=${l??"?"} rawFields=${JSON.stringify({widthText:n,heightText:A,frameText:a,bitRateText:c,videoEncTypeText:l,audioText:h,enableText:g})} blockXml=${JSON.stringify(f)}`)};if(i){const e=1600,r=s.length<=e?s:s.slice(0,e)+`\n...truncated (+${s.length-e} chars)`,n={mainStream:/<mainStream\b/.test(s),subStream:/<subStream\b/.test(s),extStream:/<extStream\b/.test(s),thirdStream:/<thirdStream\b/.test(s),externStream:/<externStream\b/.test(s),extraStream:/<extraStream\b/.test(s)};(this.logger.warn??this.logger.log).call(this.logger,`[ReolinkBaichuanApi] getStreamMetadata(debugParamSets): channel=${t} xmlLen=${s.length} tagsPresent=${JSON.stringify(n)} xmlHead=${JSON.stringify(r)}`)}const c={0:"H.264",1:"H.265",2:"MJPEG",3:"MPEG4"},l=s.match(/<mainStream[^>]*>([\s\S]*?)<\/mainStream>/);if(l){const e=l[1]??"";a("mainStream",e);const t=Number(P(e,"width")??"0"),s=Number(P(e,"height")??"0"),A=Number(P(e,"videoEncType")??"0"),i=Number(P(e,"frame")??"0"),h=Number(P(e,"bitRate")??"0"),g=Number(P(e,"audio")??"0"),d=P(e,"enable");(void 0===d||"1"===d||"true"===d)&&o({width:t,height:s,frameRate:i,bitRate:h})&&(r.push({profile:"main",audio:g,width:t,height:s,videoEncType:c[A]??`Unknown(${A})`,videoEncTypeInt:A,frameRate:i,bitRate:h}),n=n&&1===g)}const h=s.match(/<subStream[^>]*>([\s\S]*?)<\/subStream>/);if(h){const e=h[1]??"";a("subStream",e);const t=Number(P(e,"width")??"0"),s=Number(P(e,"height")??"0"),A=Number(P(e,"videoEncType")??"0"),i=Number(P(e,"frame")??"0"),l=Number(P(e,"bitRate")??"0"),g=Number(P(e,"audio")??"0"),d=P(e,"enable");(void 0===d||"1"===d||"true"===d)&&o({width:t,height:s,frameRate:i,bitRate:l})&&(r.push({profile:"sub",audio:g,width:t,height:s,videoEncType:c[A]??`Unknown(${A})`,videoEncTypeInt:A,frameRate:i,bitRate:l}),n=n&&1===g)}const g=["extStream","thirdStream","externStream","extraStream"];for(const e of g){const t=s.match(new RegExp(`<${e}[^>]*>([\\s\\S]*?)<\\/${e}>`));if(!t)continue;const A=t[1]??"";a(e,A);const i=Number(P(A,"width")??"0"),l=Number(P(A,"height")??"0"),h=Number(P(A,"videoEncType")??"0"),g=Number(P(A,"frame")??"0"),d=Number(P(A,"bitRate")??"0"),u=Number(P(A,"audio")??"0"),E=P(A,"enable");(void 0===E||"1"===E||"true"===E)&&o({width:i,height:l,frameRate:g,bitRate:d})&&(r.push({profile:"ext",audio:u,width:i,height:l,videoEncType:c[h]??`Unknown(${h})`,videoEncTypeInt:h,frameRate:g,bitRate:d}),n=n&&1===u);break}return{channel:t,streams:r,audioEnabled:n}}async setEncXml(e,t){const s="number"==typeof e?this.normalizeChannel(e):0,r="number"==typeof e?t:e;await this.sendXml({cmdId:57,channel:s,payloadXml:r})}async setStreamVideoCodec(e,t,s){const r="number"==typeof e?this.normalizeChannel(e):this.normalizeChannel(s),n="number"==typeof e?t:e,A="H.265"===("number"==typeof e?s:t)?1:0,i="main"===n?["mainStream"]:"sub"===n?["subStream"]:["extStream","thirdStream","externStream","extraStream"],o=await this.getEncXml(r);let a=null;for(const e of i){const t=new RegExp(`(<${e}[^>]*>[\\s\\S]*?<videoEncType>)(\\d+)(</videoEncType>)`);if(!t.test(o))continue;const s=o.replace(t,`$1${A}$3`);if(s!==o){a=s;break}}if(!a)throw new Error(`Could not find <videoEncType> for profile=${n} (tags=${i.join(",")}) in GetEnc XML (channel=${r}).`);await this.setEncXml(r,a)}async setNetPort(e){null!=e.onvifEnable&&await this.setPortEnabled({port:"onvif",enable:1===e.onvifEnable}),null!=e.rtmpEnable&&await this.setPortEnabled({port:"rtmp",enable:1===e.rtmpEnable}),null!=e.rtspEnable&&await this.setPortEnabled({port:"rtsp",enable:1===e.rtspEnable})}async reboot(e){const t={cmdId:23};void 0!==e&&(t.channel=e),await this.sendXml(t)}async ping(){await this.sendXml({cmdId:93})}async getGeneralXml(e){const t={cmdId:104};return void 0!==e&&(t.channel=e),await this.sendXml(t)}async setGeneralXml(e,t){const s="number"==typeof e||void 0===e?e:void 0,r="string"==typeof e?e:t;await this.sendXml({cmdId:105,...void 0===s?{}:{channel:s},payloadXml:r})}static buildChannelExtensionXml(e){return`<?xml version="1.0" encoding="UTF-8" ?><Extension version="1.1"><channelId>${U(String(e))}</channelId></Extension>`}async getMotionState(e){const t=P(await this.sendXml({cmdId:46,...void 0!==e?{channel:e}:{}}),"enable");return"1"===t||"true"===t}async getOsd(e){const t=this.normalizeChannel(e),s=await this.sendXml({cmdId:26,channel:t});return{channel:t,osdChannel:{enable:Number(P(s,"enable")??"0"),name:P(s,"name")??"",pos:P(s,"pos")??""},osdTime:{enable:Number(P(s,"timeEnable")??"0"),pos:P(s,"timePos")??""},watermark:Number(P(s,"watermark")??"0")}}async setOsd(e,t){const s="number"==typeof e?this.normalizeChannel(e):this.normalizeChannel(t),r="number"==typeof e?t:e,n=`<?xml version="1.0" encoding="UTF-8" ?><body><Osd version="1.1"><channel>${s}</channel><osdChannel><enable>${r.osdChannel.enable}</enable><name>${U(r.osdChannel.name)}</name><pos>${U(r.osdChannel.pos)}</pos></osdChannel><osdTime><enable>${r.osdTime.enable}</enable><pos>${U(r.osdTime.pos)}</pos></osdTime><watermark>${r.watermark}</watermark></Osd></body>`;await this.sendXml({cmdId:25,channel:s,payloadXml:n})}async getAiState(e){const t=this.normalizeChannel(e),s=["people","vehicle","dog_cat","face","package"];let r;const n=async(e,s)=>{const r=`<?xml version="1.0" encoding="UTF-8" ?><body><AiDetectCfg version="1.1"><chn>${t}</chn><type>${U(e)}</type></AiDetectCfg></body>`;return await this.sendXml({cmdId:342,channel:t,payloadXml:r,...null!=s?{channelIdOverride:s}:{}},0)};for(const e of s)try{const s=await n(e,t);if(s)return{channel:t,alarm_state:Number(P(s,"alarm_state")??"0"),support:Number(P(s,"support")??"0")}}catch(e){r=e}for(const e of s)try{const s=await n(e,void 0);if(s)return{channel:t,alarm_state:Number(P(s,"alarm_state")??"0"),support:Number(P(s,"support")??"0")}}catch(e){r=e}throw r instanceof Error?r:new Error(String(r??"getAiState failed"))}async getSnapshot(e=0){const t=`<body><Snap version="1.1"><channelId>${e}</channelId><logicChannel>${e}</logicChannel><time>0</time><fullFrame>0</fullFrame><streamType>main</streamType></Snap></body>`;return await this.client.login(),await this.client.sendBinary({cmdId:109,channel:e,payloadXml:t,extensionXml:L(e),timeoutMs:15e3})}async listRecordings(e){await this.client.login();const t=this.normalizeChannel(e.channel),s=e.uid,r=e.streamType??"mainStream",n=e.recordType??"manual, sched, io, md, people, face, vehicle, dog_cat, visitor, other, package",A=e.maxIterations??50,i=e.fallbackToAlarmVideo??!0,o=`<?xml version="1.0" encoding="UTF-8" ?>\n<body>\n<FileInfoList version="1.1">\n<FileInfo>\n<uid>${U(s)}</uid>\n<searchAITrack>1</searchAITrack>\n<channelId>${t}</channelId>\n<logicChnBitmap>255</logicChnBitmap>\n<streamType>${U(r)}</streamType>\n<recordType>${U(n)}</recordType>\n${Vt("startTime",e.start)}\n${Vt("endTime",e.end)}\n</FileInfo>\n</FileInfoList>\n</body>`,a=P(await this.sendXml({cmdId:14,channel:t,payloadXml:o}),"handle");if(!a)throw new Error("FileInfoList open did not return <handle>");const c=Number.parseInt(a,10);if(!Number.isFinite(c))throw new Error(`FileInfoList open returned invalid handle: ${a}`);const l=`<?xml version="1.0" encoding="UTF-8" ?>\n<body>\n<FileInfoList version="1.1">\n<FileInfo>\n<channelId>${t}</channelId>\n<uid>${U(s)}</uid>\n<searchAITrack>1</searchAITrack>\n<handle>${c}</handle>\n</FileInfo>\n</FileInfoList>\n</body>`,h=[];try{let e=!1;for(let s=0;s<A&&!e;s++){const s=await this.sendXml({cmdId:15,channel:t,payloadXml:l});h.push(...Ot(s));const r=P(s,"bFinished")??P(s,"finished");e=null==r||"1"===r.trim()}}finally{try{await this.sendXml({cmdId:16,channel:t,payloadXml:l})}catch{}}const g=new Set,d=h.filter((e=>!g.has(e.fileName)&&(g.add(e.fileName),!0)));if(d.length>0||!i)return d;const u=s.split("_")[0]??s,E="subStream"===r?1:0,I=e=>`<?xml version="1.0" encoding="UTF-8" ?>\n<body>\n<findAlarmVideo version="1.1">\n<channelId>${t}</channelId>\n<fileHandle>${U(e)}</fileHandle>\n</findAlarmVideo>\n</body>`,C=[];let B=e.start;for(let s=0;s<A;s++){const s=await this.sendXml({cmdId:272,channel:t,payloadXml:(Q=B,p=e.end,`<?xml version="1.0" encoding="UTF-8" ?>\n<body>\n<findAlarmVideo version="1.1">\n<channelId>${t}</channelId>\n<uid>${U(u)}</uid>\n<logicChnBitmap>255</logicChnBitmap>\n<streamType>${E}</streamType>\n<notSearchVideo>0</notSearchVideo>\n${Vt("startTime",Q)}\n${Vt("endTime",p)}\n<alarmType>md, pir, io, people, face, vehicle, dog_cat, visitor, other, package, cry, crossline, intrusion, loitering, legacy, loss</alarmType>\n</findAlarmVideo>\n</body>`)}),r=P(s,"fileHandle")?.trim();if(!r)break;const n=I(r);try{const e=await this.sendXml({cmdId:273,channel:t,payloadXml:n}),s=Ot(e);C.push(...s);const r=P(e,"bFinished")?.trim();if("1"===r)break;const A=[...s].reverse().find((e=>null!=e.startTime));if(!A?.startTime)break;B=A.startTime}finally{try{await this.sendXml({cmdId:274,channel:t,payloadXml:n})}catch{}}}var Q,p;const f=new Set;return C.filter((e=>!f.has(e.fileName)&&(f.add(e.fileName),!0)))}async listRecordingFileNames(e){return(await this.listRecordings(e)).map((e=>e.fileName))}async getVodRtmpUrl(e){await this.client.login();const t=this.normalizeChannel(e.channel),s=e.streamType??"mainStream",r=e.ensureEnabled??!0;let n=e.rtmpPort;try{const e=(await this.getNetPort()).rtmp,t="number"==typeof e?.enable?e.enable:void 0,s="number"==typeof e?.port?e.port:void 0;null==n&&null!=s&&Number.isFinite(s)&&s>0&&(n=s),r&&0===t&&await this.setPortEnabled({port:"rtmp",enable:!0})}catch{}null==n&&(n=1935);const A="subStream"===s?1:0;let i=e.fileName.trim();const o=i.indexOf("Mp4Record/");o>=0&&(i=i.slice(o)),i=i.replace(/^\/+/,"");const a=i.replace(/\//g,"%20").replace(/ /g,"%20"),c=encodeURIComponent(this.username),l=encodeURIComponent(this.password);return`rtmp://${this.host}:${n}/vod/${a}?channel=${t}&stream=${A}&user=${c}&password=${l}`}async predownloadRecordingMp4(e){await this.client.login();const t=this.normalizeChannel(e.channel),s=e.streamType??"mainStream",r=e.ensureAwake??!1,n=e.ffmpegPath??"ffmpeg",A=e.overwrite??!0;await(0,g.mkdir)((0,c.dirname)(e.outputPath),{recursive:!0});const i=async()=>{r&&await this.wakeUp(t,{waitAfterWakeMs:1500,attempts:3});const i=await this.getVodRtmpUrl({channel:t,fileName:e.fileName,streamType:s,ensureEnabled:!0});await new Promise(((t,s)=>{const r=(0,h.spawn)(n,["-hide_banner","-loglevel","error",...A?["-y"]:[],"-rtmp_live","live","-i",i,"-c","copy","-movflags","frag_keyframe+empty_moov","-f","mp4",e.outputPath]);let o="";r.stderr.on("data",(e=>{o+=String(e)})),r.on("close",(e=>{if(0===e)return t();s(new Error(`ffmpeg exited with code ${e}\n${o}`))})),r.on("error",s)}))};try{await i()}catch(e){if(r)try{await this.wakeUp(t,{waitAfterWakeMs:3e3,attempts:3,reconnect:!0})}catch{}await i()}}async generateMp4Screenshot(e){const t=e.ffmpegPath??"ffmpeg",s=Number.isFinite(e.atSeconds)&&e.atSeconds>=0?e.atSeconds:0;await(0,g.mkdir)((0,c.dirname)(e.outputPath),{recursive:!0}),await new Promise(((r,n)=>{const A=(0,h.spawn)(t,["-hide_banner","-loglevel","error","-y","-ss",String(s),"-i",e.inputPath,"-frames:v","1","-q:v","2",e.outputPath]);let i="";A.stderr.on("data",(e=>{i+=String(e)})),A.on("close",(e=>{if(0===e)return r();n(new Error(`ffmpeg screenshot exited with code ${e}\n${i}`))})),A.on("error",n)}))}async downloadRecording(e){await this.client.login();const t=this.normalizeChannel(e.channel),s=e.uid,r=e.fileName,n=r.includes("/")?r.split("/").filter(Boolean).at(-1)??r:r,A=`<?xml version="1.0" encoding="UTF-8" ?>\n<body>\n<FileInfoList version="1.1">\n<FileInfo>\n<channelId>${t}</channelId>\n<uid>${U(s)}</uid>\n<fileName>${U(r)}</fileName>\n<name>${U(n)}</name>\n<Id>${U(r)}</Id>\n</FileInfo>\n</FileInfoList>\n</body>`,i=e.fallbackToHttp??!1;try{return await this.client.sendBinary({cmdId:13,channel:t,messageClass:f,extensionXml:H(t),payloadXml:A,timeoutMs:e.timeoutMs??12e4})}catch(e){if(!i)throw e;const t=r.replaceAll("/","_").replaceAll("\\","_");try{const e=/Rec(\w{3})(?:_|_DST)(\d{8})_(\d{6})_.*/.exec(r),s=e?`${e[2]}${e[3]}`:void 0,n=[],A=e=>{const t=e?.trim();t&&(n.includes(t)||n.push(t))};let i;A(r),A(r.replace(/^\/mnt\/[a-zA-Z0-9]+\//,"")),A(r.replace(/^\//,""));for(const e of n)try{return await this.httpClient.downloadVod(e,t,s)}catch(e){i=e;if((e instanceof Error?e.message:String(e)).startsWith("HTTP 404"))continue;throw e}throw i instanceof Error?i:new Error(String(i))}catch(t){const s=e instanceof Error?e.message:String(e),r=t instanceof Error?t.message:String(t);throw new Error(`downloadRecording failed (baichuan then http). baichuanErr=${s}; httpErr=${r}`)}}}async subscribeEvents(){await this.client.login();const e=this.client.getConfiguredChannel?.()??0,t=[{label:`neolink-style channelId=${e} bodyLen=0`,params:{cmdId:31,channelIdOverride:e,messageClass:p}},{label:"reolink_aio-style push channelId=251 bodyLen=0",params:{cmdId:31,channelIdOverride:251,messageClass:p}},{label:"host channelId=250 bodyLen=0",params:{cmdId:31,channelIdOverride:250,messageClass:p}},{label:"legacy Extension channelId=251",params:{cmdId:31,channelIdOverride:250,messageClass:p,extensionXml:'<?xml version="1.0" encoding="UTF-8" ?><Extension version="1.1"><channelId>251</channelId></Extension>'}}];let s;for(const e of t){const t=await this.client.sendFrame({...e.params,timeoutMs:1e4});if(s=t.header.responseCode,200===t.header.responseCode)return this.client.subscribed=!0,void this.client.refreshKeepAlive?.();(this.logger.debug??this.logger.log).call(this.logger,`[ReolinkBaichuanApi] subscribeEvents rejected (${e.label}) responseCode=${t.header.responseCode}`)}throw this.client.subscribed=!1,this.client.refreshKeepAlive?.(),new Error(`subscribeEvents failed: camera rejected cmdId=31 (last responseCode=${s??"unknown"})`)}async subscribeToAllEvents(e){await this.client.login();const t=e?.preferCgi??!0,s=e?.maxChannels??16,r=e?.timeoutMs??1e4;let n=[];try{const e=await this.getNvrChannelsInfo({source:t?"cgi":"baichuan",maxChannels:s}),r=e.filter((e=>Boolean((e.uid??"").trim())||Boolean((e.name??"").trim())||!0===e.online||!0===e.sleep)).map((e=>e.channel)).filter((e=>Number.isInteger(e)&&e>=0));n=(r.length?r:e.map((e=>e.channel))).filter((e=>Number.isInteger(e)&&e>=0)).slice(0,s)}catch{}if(!n.length){n=[this.client.getConfiguredChannel?.()??0]}n=[...new Set(n)].sort(((e,t)=>e-t));let A,i=0;for(const e of n){const t=await this.client.sendFrame({cmdId:31,channelIdOverride:e,messageClass:p,timeoutMs:r});A=t.header.responseCode,200===t.header.responseCode?i++:(this.logger.debug??this.logger.log).call(this.logger,`[ReolinkBaichuanApi] subscribeToAllEvents rejected (channel=${e}) responseCode=${t.header.responseCode}`)}if(i>0)return this.client.subscribed=!0,void this.client.refreshKeepAlive?.();try{return void await this.subscribeEvents()}catch{}throw this.client.subscribed=!1,this.client.refreshKeepAlive?.(),new Error(`subscribeToAllEvents failed: camera rejected cmdId=31 for all channels (last responseCode=${A??"unknown"})`)}async unsubscribeEvents(){this.client.subscribed=!1,this.client.refreshKeepAlive?.()}async checkAndDispatchCurrentState(e=0){try{const t=await this.getMotionState(e);if(t!==this.lastMotionState&&(this.lastMotionState=t,t)){const t={type:"motion",channel:e,timestamp:Date.now()};this.dispatchSimpleEvent(t)}if(!this.aiStatePollingDisabled)try{const t=await this.getAiState(e);if(t&&void 0!==t.alarm_state){if((!this.lastAiState||this.lastAiState.alarm_state!==t.alarm_state||this.lastAiState.support!==t.support)&&(this.lastAiState=t,1===t.alarm_state)){const t={type:"other",channel:e,timestamp:Date.now()};this.dispatchSimpleEvent(t)}}}catch(e){this.aiStatePollingDisabled=!0;const t=String(e&&"object"==typeof e&&"message"in e?e.message:e);t.includes("not supported")||t.includes("unsupported")||(this.logger.debug??this.logger.log)?.call(this.logger,"[ReolinkBaichuanApi] getAiState failed; disabling AI polling",e),this.aiStatePollingDisabledLogged||(this.aiStatePollingDisabledLogged=!0,this.logger.debug?.("[ReolinkBaichuanApi] AI polling disabled after getAiState failure",e))}}catch(e){(this.logger.warn??this.logger.error)?.call(this.logger,"[ReolinkBaichuanApi] Error checking current state",e)}}dispatchSimpleEvent(e){for(const t of this.simpleEventListeners)try{t(e)}catch(e){(this.logger.warn??this.logger.error)?.call(this.logger,"[ReolinkBaichuanApi] onSimpleEvent handler error",e)}}startStatePolling(){if(0===this.simpleEventListeners.size)return;"udp"===this.client.getTransport?.()||this.statePollingInterval||(this.statePollingInterval=setInterval((async()=>{try{if(0===this.simpleEventListeners.size)return void this.stopStatePolling();const e=this.client.getConfiguredChannel?.()??0;await this.checkAndDispatchCurrentState(e)}catch(e){this.logger.debug?.("[ReolinkBaichuanApi] state polling tick failed",e)}}),5e3))}stopStatePolling(){this.statePollingInterval&&(clearInterval(this.statePollingInterval),this.statePollingInterval=void 0)}async getEvents(e){const t=await this.sendXml({cmdId:33,...void 0!==e?{channel:e}:{}}),s=this.normalizeChannel(e),r=Date.now(),n={channel:s};if(t.includes("<AlarmEventList")){const e=t.matchAll(/<AlarmEvent\b[^>]*>([\s\S]*?)<\/AlarmEvent>/g);for(const t of e){const e=t[1]??"",A=P(e,"channelId");if((void 0!==A?Number(A):s)!==s)continue;const i=(P(e,"status")??"").trim().toUpperCase(),o=(P(e,"AItype")??P(e,"aiType")??P(e,"aitype")??"").trim();i.includes("MD")&&(n.motion={state:1,timestamp:r,source:"md"}),i.includes("PIR")&&(n.motion={state:1,timestamp:r,source:"pir"});const a=o?o.split(",").map((e=>e.trim())).find((e=>e.length>0&&"none"!==e.toLowerCase())):void 0;(a||i.includes("AI"))&&(n.ai={channel:s,alarm_state:1,type:a}),i.includes("VIS")&&(n.visitor={detected:!0,timestamp:r})}return n}const A=(P(t,"status")??"").trim().toUpperCase(),i=(P(t,"AItype")??P(t,"aiType")??P(t,"aitype")??"").trim();return A.includes("MD")&&(n.motion={state:1,timestamp:r,source:"md"}),A.includes("PIR")&&(n.motion={state:1,timestamp:r,source:"pir"}),(i||A.includes("AI"))&&(n.ai={channel:s,alarm_state:1,type:i||void 0}),A.includes("VIS")&&(n.visitor={detected:!0,timestamp:r}),n}async getTwoWayAudioConfig(e){const t=P(await this.sendXml({cmdId:10,...void 0!==e?{channel:e}:{}}),"audioStreamMode"),s={channel:e??0,enabled:"mixAudioStream"===t||"followVideoStream"===t};return t&&(s.mode=t),s}async startTwoWayAudio(e){await this.sendXml({cmdId:10,...void 0!==e?{channel:e}:{}})}async sendAudioData(e,t){const s={cmdId:10,payloadXml:""};void 0!==t&&(s.channel=t),await this.client.sendBinary(s)}async stopTwoWayAudio(e){}async startVideoStream(e,t="sub"){const s=this.normalizeChannel(e),r=s,n={main:{handle:0,streamType:0,streamName:"mainStream"},sub:{handle:256,streamType:1,streamName:"subStream"},ext:{handle:1024,streamType:0,streamName:"externStream"}}[t];if(!n)throw new Error(`Invalid stream profile: ${t}`);if(!n.streamName)throw new Error(`Stream name not found for profile: ${t}, config: ${JSON.stringify(n)}`);const A=n.streamName;if("string"!=typeof A)throw new Error(`streamName is not a string: ${typeof A}, value: ${A}, config: ${JSON.stringify(n)}`);const i=function(e,t,s){if(!t||"string"!=typeof t)throw new Error(`buildPreviewXml: streamType is required (string) but got: ${typeof t} = ${t}`);return`<?xml version="1.0" encoding="UTF-8" ?>\n<body>\n<Preview version="1.0">\n${void 0!==s?`<channelId>${s}</channelId>\n`:""}<handle>${e}</handle>\n<streamType>${U(t)}</streamType>\n</Preview>\n</body>`}(n.handle,A,r),o="udp"===this.client.getTransport?.()?3:1;let a;for(let e=1;e<=o;e++){const A=this.client.peekNextMsgNum();this.client.subscribeVideoStream(3,A);try{const e={cmdId:3,channel:s,channelIdOverride:r,extensionXml:L(r),payloadXml:i,messageClass:p,streamType:n.streamType},A=await this.client.sendFrame(e);if(200!==A.header.responseCode)throw new Error(`Video stream request rejected (response_code ${A.header.responseCode}). Neolink expects response_code 200, camera returned ${A.header.responseCode}`);return void this.activeVideoMsgNums.set(`${s}:${t}`,A.header.msgNum)}catch(t){a=t;try{this.client.unsubscribeVideoStream(3,A)}catch{}if(e<o){await new Promise((e=>setTimeout(e,250)));continue}}}throw a instanceof Error?a:new Error(String(a))}getActiveVideoMsgNum(e,t="sub"){const s=this.normalizeChannel(e);return this.activeVideoMsgNums.get(`${s}:${t}`)}async stopVideoStream(e,t="sub"){const s=this.normalizeChannel(e),r=s,n={main:{handle:0,streamType:0},sub:{handle:256,streamType:1},ext:{handle:1024,streamType:0}}[t],A=function(e,t){return`<?xml version="1.0" encoding="UTF-8" ?>\n<body>\n<Preview version="1.0">\n${void 0!==t?`<channelId>${t}</channelId>\n`:""}<handle>${e}</handle>\n</Preview>\n</body>`}(n.handle,r),i=`${s}:${t}`,o=this.activeVideoMsgNums.get(i);this.activeVideoMsgNums.delete(i);try{await this.client.sendFrame({cmdId:4,channel:s,channelIdOverride:r,extensionXml:L(r),payloadXml:A,messageClass:p,streamType:n.streamType,...void 0!==o?{msgNumOverride:o}:{},timeoutMs:2e3})}catch{}finally{try{void 0!==o&&this.client.unsubscribeVideoStream(3,o)}catch{}}}async getPtzPresets(e){const t=this.normalizeChannel(e),s=t,r=await this.sendXml({cmdId:190,channel:t,channelIdOverride:s,extensionXml:L(s),messageClass:p,streamType:0});return this.parsePtzPresetList(r).filter((e=>void 0===e.enable||"1"===e.enable)).filter((e=>void 0===e.name||""!==String(e.name).trim())).map((e=>({id:e.id,name:e.name??`Preset ${e.id}`})))}parsePtzPresetList(e){const t=[],s=e.matchAll(/<preset\b[^>]*>([\s\S]*?)<\/preset>/gi);for(const e of s){const s=e[1]??"",r=/<id>([^<]*)<\/id>/i.exec(s)?.[1];if(!r)continue;const n=Number(r);if(!Number.isFinite(n))continue;const A=/<name>([^<]*)<\/name>/i.exec(s),i=/<enable>([^<]*)<\/enable>/i.exec(s),o={id:n},a=A?.[1],c=i?.[1];void 0!==a&&(o.name=a),void 0!==c&&(o.enable=c),t.push(o)}return t}async getPtzPresetsRaw(e){const t=this.normalizeChannel(e),s=t,r=await this.sendXml({cmdId:190,channel:t,channelIdOverride:s,extensionXml:L(s),messageClass:p,streamType:0});return this.parsePtzPresetList(r)}async ptz(e,t){const s="number"==typeof e?this.normalizeChannel(e):0,r="number"==typeof e?t:e,n=s;let A,i;if("stop"===r.action)A="stop";else{const e={Left:"left",Right:"right",Up:"up",Down:"down"}[r.command];if(!e)throw new Error(`Unsupported PTZ command for MSG_ID_PTZ_CONTROL: ${r.command}`);A=e}if("stop"===A)i=0;else{const e=r.speed;i=void 0===e?32:e>0&&e<=1?Math.max(1,64*e):e}const o=function(e,t,s){return`<?xml version="1.0" encoding="UTF-8" ?>\n<body>\n<PtzControl version="1.1">\n<channelId>${e}</channelId>\n<command>${U(t)}</command>\n<speed>${s}</speed>\n</PtzControl>\n</body>`}(n,A,i),a=L(n),c=await this.client.sendFrame({cmdId:18,channel:s,channelIdOverride:n,extensionXml:a,payloadXml:o,messageClass:p,streamType:0});if(200!==c.header.responseCode){let e="";if(c.body.length>0)try{const t=this.client.tryDecryptXml;if(t){const s=t.call(this.client,c.body,c.header.channelId,this.client.enc);s&&(e=` - Error details: ${s.substring(0,200)}`)}}catch{}throw new Error(`PTZ control rejected (response_code ${c.header.responseCode})${e}`)}if("start"===r.action&&"stop"!==A){const e=r.autoStopMs??500;e>0&&setTimeout((()=>{this.ptz(s,{action:"stop",command:r.command}).catch((()=>{}))}),e)}}async moveToPtzPreset(e,t){const s=void 0===t?this.normalizeChannel(void 0):this.normalizeChannel(e),r=s,n=function(e,t,s,r){return x(e,t,s,void 0===r?void 0:{name:r})}(r,void 0===t?e:t,"toPos"),A=L(r),i=await this.client.sendFrame({cmdId:19,channel:s,channelIdOverride:r,extensionXml:A,payloadXml:n,messageClass:p,streamType:0});if(200!==i.header.responseCode)throw new Error(`PTZ preset move rejected (response_code ${i.header.responseCode})`)}async setPtzPreset(e,t,s){const r="string"==typeof t?this.normalizeChannel(s):this.normalizeChannel(e),n=r,A=x(n,"string"==typeof t?e:t,"setPos",{name:"string"==typeof t?t:s,enable:1}),i=L(n),o=await this.client.sendFrame({cmdId:19,channel:r,channelIdOverride:n,extensionXml:i,payloadXml:A,messageClass:p,streamType:0});if(200!==o.header.responseCode)throw new Error(`PTZ preset save rejected (response_code ${o.header.responseCode})`)}async deletePtzPreset(e,t){const s=void 0===t?this.normalizeChannel(void 0):this.normalizeChannel(e),r=void 0===t?e:t,n=s,A=L(n);let i;try{const e=await this.getPtzPresetsRaw(s);i=e.find((e=>e.id===r))?.name}catch{}const o=[{label:"command=delPos",payloadXml:x(n,r,"delPos")},{label:"enable=0 (no name)",payloadXml:x(n,r,"setPos",{enable:0})},{label:"name='' (no enable)",payloadXml:x(n,r,"setPos",{name:""})},{label:"enable=0 name=''",payloadXml:x(n,r,"setPos",{name:"",enable:0})},...i?[{label:"enable=0 name=current",payloadXml:x(n,r,"setPos",{name:i,enable:0})}]:[],{label:"enable=0 name='Preset N'",payloadXml:x(n,r,"setPos",{name:`Preset ${r}`,enable:0})}];let a,c=!1;for(const e of o)try{const t=await this.client.sendFrame({cmdId:19,channel:s,channelIdOverride:n,extensionXml:A,payloadXml:e.payloadXml,messageClass:p,streamType:0});if(200!==t.header.responseCode)throw new Error(`PTZ preset delete rejected (response_code ${t.header.responseCode})`);c=!0;try{const e=(await this.getPtzPresetsRaw(s)).find((e=>e.id===r));if(!e)return;const t=void 0!==e.name&&""===String(e.name).trim(),n=void 0!==e.enable&&"0"===String(e.enable).trim();if(t||n)return}catch(e){a=e}}catch(e){a=e}if(!c)throw a instanceof Error?a:new Error("PTZ preset delete failed");this.logger.warn("PTZ presets (baichuan): deletePtzPreset did not take effect (firmware ignored request)",{channel:s,channelId:n,presetId:r})}async getPtzPosition(e){const t=this.normalizeChannel(e),s=await this.sendXml({cmdId:433,channel:t}),r=P(s,"pPos"),n=P(s,"tPos"),A={};return void 0!==r&&(A.pan=Number(r)),void 0!==n&&(A.tilt=Number(n)),A}async getZoomFocus(e){const t=this.normalizeChannel(e),s=t,r=await this.sendXml({cmdId:294,channel:t,channelIdOverride:s,extensionXml:L(s),messageClass:p,streamType:0}),n=e=>{const t=new RegExp(`<${e}>([\\s\\S]*?)</${e}>`).exec(r),s=t?.[1];if(!s)return;const n=P(s,"maxPos"),A=P(s,"minPos"),i=P(s,"curPos");return void 0!==n&&void 0!==A&&void 0!==i?{maxPos:Number(n),minPos:Number(A),curPos:Number(i)}:void 0},A={},i=n("zoom"),o=n("focus");return i&&(A.zoom=i),o&&(A.focus=o),A}async zoomToFactor(e,t){const s=void 0===t?0:this.normalizeChannel(e),r=void 0===t?e:t,n=s,A=(await this.getZoomFocus(s)).zoom;if(!A)throw new Error("Camera did not return <zoom> info (zoom may be unsupported)");const i=Math.round(1e3*r),o=function(e,t){return`<?xml version="1.0" encoding="UTF-8" ?>\n<body>\n<StartZoomFocus version="1.1">\n<channelId>${e}</channelId>\n<command>zoomPos</command>\n<movePos>${Math.trunc(t)}</movePos>\n</StartZoomFocus>\n</body>`}(n,Math.min(A.maxPos,Math.max(A.minPos,i))),a=L(n),c=await this.client.sendFrame({cmdId:295,channel:s,channelIdOverride:n,extensionXml:a,payloadXml:o,messageClass:p,streamType:0});if(200!==c.header.responseCode)throw new Error(`Zoom rejected (response_code ${c.header.responseCode})`)}parseBatteryInfoXml(e,t){const s=e=>{if(void 0===e)return;const t=Number(e);return Number.isFinite(t)?t:void 0},r=xt(e,"BatteryInfo"),n=r.find((e=>P(e,"channelId")===String(t)))??r[0]??e,A={},i=s(P(n,"batteryPercent"));void 0!==i&&(A.batteryPercent=i);const o=P(n,"chargeStatus");void 0!==o&&(A.chargeStatus=o);const a=P(n,"adapterStatus");void 0!==a&&(A.adapterStatus=a);const c=s(P(n,"voltage"));void 0!==c&&(A.voltage=c);const l=s(P(n,"current"));void 0!==l&&(A.current=l);const h=s(P(n,"temperature"));void 0!==h&&(A.temperature=h);const g=s(P(n,"lowPower"));void 0!==g&&(A.lowPower=g);const d=s(P(n,"batteryVersion"));return void 0!==d&&(A.batteryVersion=d),A}getSleepStatus(e){const t=e?.windowMs??e?.idleMs??1e4,s=new Set(e?.nonWakingCmdIds??e?.ignoreCmdIds??[w,252,y,291]),r=this.client.getTransport?.();if("udp"!==r)return{state:"unknown",reason:"sleep inference supported only for UDP/battery"};if(this.activeVideoMsgNums.size>0||this.rtspServers.size>0||this.client.isDeviceStreamingActive?.())return{state:"awake",reason:"active streaming"};const n=this.client.isSocketConnected?.()??!1,A=Date.now(),i=A-t,o=(this.client.getRxHistory?.()??[]).filter((e=>e.atMs>=i)),a=(this.client.getTxHistory?.()??[]).filter((e=>e.atMs>=i));if(0===o.length&&0===a.length)return{state:"sleeping",reason:`no rx/tx activity in last ${t}ms${n?"":" (socket disconnected)"}`,idleMs:t};const c=o.find((e=>!s.has(e.cmdId)));if(c)return{state:"awake",reason:`waking rx cmdId=${c.cmdId} responseCode=${c.responseCode} seen ${A-c.atMs}ms ago`,lastRxAtMs:c.atMs,idleMs:A-c.atMs};const l=a.find((e=>!s.has(e.cmdId)));return l?{state:"awake",reason:`waking tx cmdId=${l.cmdId} seen ${A-l.atMs}ms ago`,idleMs:A-l.atMs}:{state:"sleeping",reason:`only non-waking cmdIds observed in last ${t}ms (non-waking: ${Array.from(s).join(",")})`,idleMs:t}}async probeSleepStatus(e){const t=this.client.getTransport?.();if("udp"!==t)return{state:"unknown",reason:"sleep probe supported only for UDP/battery"};if(this.activeVideoMsgNums.size>0||this.rtspServers.size>0||this.client.isDeviceStreamingActive?.())return{state:"awake",reason:"active streaming"};const s=Date.now(),r=e?.minIntervalMs??5e3;if(this.lastSleepProbe&&s-this.lastSleepProbe.atMs<r)return{...this.lastSleepProbe.status,reason:`${this.lastSleepProbe.status.reason} (cached)`};if(!this.client.isSocketConnected()){const e={state:"unknown",reason:"udp socket not connected"};return this.lastSleepProbe={atMs:s,status:e},e}if(!this.client.loggedIn){const e={state:"unknown",reason:"not logged in"};return this.lastSleepProbe={atMs:s,status:e},e}const n=this.normalizeChannel(e?.channel),A=e?.timeoutMs??700,i=Math.max(1,e?.attempts??1),o=e?.cmdId??y;for(let e=0;e<i;e++)try{const e=await this.client.sendFrame({cmdId:o,channel:n,timeoutMs:A}),t={state:200===e.header.responseCode?"awake":"unknown",reason:`probe cmdId=${o} responseCode=${e.header.responseCode}`};return this.lastSleepProbe={atMs:Date.now(),status:t},t}catch(t){const s=t instanceof Error?t.message:String(t);if(s.includes("Baichuan timeout")||s.toLowerCase().includes("timeout")){const e={state:"sleeping",reason:`probe timeout cmdId=${o} timeoutMs=${A}`};return this.lastSleepProbe={atMs:Date.now(),status:e},e}if(e===i-1){const e={state:"unknown",reason:`probe error cmdId=${o}: ${s}`};return this.lastSleepProbe={atMs:Date.now(),status:e},e}}const a={state:"unknown",reason:"probe exhausted"};return this.lastSleepProbe={atMs:Date.now(),status:a},a}async getBatteryStatus(e){const t=this.normalizeChannel(e);if("sleeping"===this.getSleepStatus({channel:t}).state)return{channel:t,sleeping:!0};try{const e=await Promise.race([this.sendXml({cmdId:y,channel:t}),new Promise(((e,t)=>setTimeout((()=>t(new Error("Timeout"))),5e3)))]),s={channel:t,sleeping:!1};return Object.assign(s,this.parseBatteryInfoXml(e,t)),s}catch(e){const s={channel:t};return"sleeping"===this.getSleepStatus({channel:t}).state&&(s.sleeping=!0),e instanceof Error&&"Timeout"===e.message&&null==s.sleeping&&(s.sleeping=!0),s}}async getBatteryInfo(e){const t=this.normalizeChannel(e),s=this.client.getTransport?.();if(!("udp"!==s||this.client.isSocketConnected?.()&&this.client.loggedIn))return{channel:t,sleeping:!0};const r=await this.client.sendXml({cmdId:y,channel:t}),n={channel:t};return Object.assign(n,this.parseBatteryInfoXml(r,t)),n}async wakeUp(e,t){const s=this.normalizeChannel(e),r="number"==typeof t?{waitAfterWakeMs:t}:t??{},n=r.timeoutMs??2e4,A=r.attempts??3,i=r.waitAfterWakeMs??1500,o=r.backoffMs??1500,a="udp"===this.client.getTransport?.(),c=r.reconnect??a;let l;for(let e=1;e<=A;e++)try{return await this.getEncXml(s,{timeoutMs:n}),void(i>0&&await new Promise((e=>setTimeout(e,i))))}catch(t){l=t;const s=t instanceof Error?t.message:String(t),r=s.includes("Baichuan timeout"),n=s.toLowerCase().includes("socket closed")||s.toLowerCase().includes("stream closed");if(e<A){if(c&&(r||n))try{this.client.loggedIn=!1,await this.client.close()}catch{}o>0&&await new Promise((e=>setTimeout(e,o)));continue}}throw l instanceof Error?l:new Error(String(l))}async isSleeping(e){const t=this.normalizeChannel(e);try{return await Promise.race([this.getBatteryInfo(t),new Promise(((e,t)=>setTimeout((()=>t(new Error("Timeout"))),5e3)))]),!1}catch(e){return!0}}async getPirInfo(e){const t=this.normalizeChannel(e),s=await this.sendXml({cmdId:212,channel:t}),r=e=>{if(void 0===e)return;const t=e.trim().toLowerCase();if("true"===t)return 1;if("false"===t)return 0;const s=Number(t);return Number.isFinite(s)?s:void 0},n=P(s,"enable"),A=P(s,"sensiValue"),i=P(s,"reduceFalseAlarm"),o=P(s,"interval"),a=P(s,"intervalSecMax"),c={channel:t};if(void 0!==n){const e=r(n);void 0!==e&&(c.enable=e)}if(void 0!==A&&(c.sensitive=Number(A)),void 0!==i){const e=r(i);void 0!==e&&(c.reduceAlarm=e)}if(void 0!==o){const e=r(o);void 0!==e&&(c.interval=e)}if(void 0!==a){const e=r(a);void 0!==e&&(c.intervalMax=e)}return{enabled:(e=>{if(void 0===e)return!1;const t=e.trim().toLowerCase();return"1"===t||"true"===t})(n),state:c}}async setPirInfo(e,t){const s="number"==typeof e?e:t,r="number"==typeof e?t:e,n=this.normalizeChannel(s);let A=await this.sendXml({cmdId:212,channel:n});if(void 0!==r.enable&&(A=A.replace(/<enable>[^<]*<\/enable>/,`<enable>${r.enable}</enable>`)),void 0!==r.sensitive){const e=(i=r.sensitive,Math.trunc(101-i));A=A.replace(/<sensiValue>[^<]*<\/sensiValue>/,`<sensiValue>${e}</sensiValue>`)}var i;if(void 0!==r.reduceAlarm){const e=(e=>{if(null==e)return;if("boolean"==typeof e)return e?1:0;const t=Number(e);return Number.isFinite(t)?t:void 0})(r.reduceAlarm);void 0!==e&&(A=A.replace(/<reduceFalseAlarm>[^<]*<\/reduceFalseAlarm>/,`<reduceFalseAlarm>${e}</reduceFalseAlarm>`))}void 0!==r.interval&&(A=A.replace(/<interval>[^<]*<\/interval>/,`<interval>${r.interval}</interval>`)),await this.sendXml({cmdId:213,channel:n,payloadXml:A})}async setMotionDetection(e,t,s){const r="number"==typeof e?e:s,n="number"==typeof e?t:e,A="number"==typeof e?s:t,i=this.normalizeChannel(r);let o=await this.sendXml({cmdId:46,channel:i});void 0!==n&&(o=o.replace(/<enable>[^<]*<\/enable>/,`<enable>${n?"1":"0"}</enable>`)),void 0!==A&&(o=o.replace(/<sensitivityDefault>[^<]*<\/sensitivityDefault>/,`<sensitivityDefault>${A}</sensitivityDefault>`)),await this.sendXml({cmdId:47,channel:i,payloadXml:o})}async setAiDetection(e,t,s,r){const n="number"==typeof e?e:r,A="number"==typeof e?t:e,i="number"==typeof e?s:t,o="number"==typeof e?r:s,a=this.normalizeChannel(n),c=`<?xml version="1.0" encoding="UTF-8" ?>\n <body>\n <AiDetectCfg version="1.1">\n <chn>${a}</chn>\n <type>${U(A)}</type>\n </AiDetectCfg>\n </body>`;let l=await this.sendXml({cmdId:342,channel:a,payloadXml:c});void 0!==i&&(l=l.replace(/<sensitivity>[^<]*<\/sensitivity>/,`<sensitivity>${i}</sensitivity>`)),void 0!==o&&(l=l.replace(/<stayTime>[^<]*<\/stayTime>/,`<stayTime>${o}</stayTime>`)),await this.sendXml({cmdId:343,channel:a,payloadXml:l})}async getSiren(e){try{const t=await this.sendXml({cmdId:547,...void 0!==e?{channel:e}:{}});return{enabled:"1"===P(t,"status")}}catch{return{enabled:!1}}}async setSiren(e,t,s){const r="boolean"==typeof e?s??0:e,n="boolean"==typeof e?e:t,A="boolean"==typeof e?t:s,i=void 0!==r?r+1:void 0;let o;if(void 0!==A)o=V(i,A);else{o=Y(i,n?1:0)}try{await this.sendXml({cmdId:263,...void 0!==r?{channel:r}:{},payloadXml:o})}catch(e){if(!0!==n||void 0!==A)throw e;o=V(i,2),await this.sendXml({cmdId:263,...void 0!==r?{channel:r}:{},payloadXml:o})}}async getWhiteLedState(e){const t=this.normalizeChannel(e),s=await this.sendXml({cmdId:S,channel:t}),r=P(s,"enable"),n=P(s,"state"),A=P(s,"status"),i=P(s,"brightness_cur"),o={enabled:"1"===r||"1"===n||"1"===A};return void 0!==i&&(o.brightness=Number(i)),o}async setWhiteLedState(e,t,s){const r="number"==typeof e?e:s??0,n="number"==typeof e?t:e,A="number"==typeof e?s:t,i=this.normalizeChannel(r);if(void 0!==n)try{const e=O(i,n?1:0,n?180:0);await this.sendXml({cmdId:288,channel:i,payloadXml:e})}catch(e){let t=await this.sendXml({cmdId:S,channel:i});/<enable>[^<]*<\/enable>/i.test(t)&&(t=t.replace(/<enable>[^<]*<\/enable>/i,`<enable>${n?1:0}</enable>`)),/<state>[^<]*<\/state>/i.test(t)&&(t=t.replace(/<state>[^<]*<\/state>/i,`<state>${n?1:0}</state>`)),/<status>[^<]*<\/status>/i.test(t)&&(t=t.replace(/<status>[^<]*<\/status>/i,`<status>${n?1:0}</status>`)),await this.sendXml({cmdId:290,channel:i,payloadXml:t})}if(void 0!==A){let e=await this.sendXml({cmdId:S,channel:i});/<brightness_cur>[^<]*<\/brightness_cur>/i.test(e)&&(e=e.replace(/<brightness_cur>[^<]*<\/brightness_cur>/i,`<brightness_cur>${A}</brightness_cur>`)),/<enable>[^<]*<\/enable>/i.test(e)&&(e=e.replace(/<enable>[^<]*<\/enable>/i,"<enable>1</enable>")),await this.sendXml({cmdId:290,channel:i,payloadXml:e})}}async getAbilityInfo(){const e=this.client.username,t=`<?xml version="1.0" encoding="UTF-8" ?>\n<Extension version="1.1">\n<userName>${U(e)}</userName>\n<token>system, streaming, PTZ, IO, security, replay, disk, network, alarm, record, video, image</token>\n</Extension>`;const s=await this.sendXml({cmdId:151,extensionXml:t}),r={},n=["system","streaming","PTZ","IO","security","replay","disk","network","alarm","record","video","image"];for(const e of n){const t=new RegExp(`<${e}[^>]*>([\\s\\S]*?)<\\/${e}>`,"i"),n=s.match(t);if(n){const e=(n[1]??"").matchAll(/<subModule[^>]*>([\s\S]*?)<\/subModule>/g);for(const t of e){const e=t[1]??"",s=P(e,"channelId")||P(e,"chnID"),n=P(e,"abilityValue");if(n){const e=s?Number(s):"Host";r[e]||(r[e]={});const t=n.split(",").map((e=>e.trim())).filter(Boolean);for(const s of t)r[e][s]=1}}}}const A=s.match(/<AbilityInfo[^>]*>([\s\S]*?)<\/AbilityInfo>/);if(A){const e=(A[1]??"").matchAll(/<([A-Za-z]+)[^>]*>([^<]*)<\/\1>/g);r.Host||(r.Host={});for(const t of e){const e=t[1],s=t[2];if(e&&void 0!==s&&!["image","video","subModule"].includes(e)&&"channelId"!==e&&"abilityValue"!==e){const t=Number(s);r.Host[e]=Number.isNaN(t)?s:t}}}return r.Host&&0===Object.keys(r.Host).length&&delete r.Host,r}async getAbilityVersion(e,t){const s=(await this.getAbilityInfo())[null!=t?t:"Host"];if(!s)return 0;const r=s[e];if("number"==typeof r)return r;if("string"==typeof r){const e=Number(r);return Number.isNaN(e)?0:e}return 0}async getSupportInfo(){return Mt(await this.sendXml({cmdId:199}))}async getDeviceCapabilities(e,t){const s=null!=e,r=this.normalizeChannel(e),n=t?.probe??!0,A=t?.probeSiren??!0,i=t?.probeFloodlight??!0,[o,a]=await Promise.allSettled([this.getAbilityInfo(),this.getSupportInfo()]),c="fulfilled"===o.status?o.value:void 0,l="fulfilled"===a.status?a.value:void 0,h=c?s?{..."object"==typeof c.Host?{Host:c.Host}:{},..."object"==typeof c[r]?{[r]:c[r]}:{}}:c:void 0,g=l?s?{...l,items:(l.items??[]).filter((e=>e.chnID===r))}:l:void 0,d={channel:r};h&&(d.abilities=h),g&&(d.support=g);const u=Ut(d),E=Tt(h,r),I=e=>{if("number"==typeof e)return e>0;if("string"==typeof e){const t=Number(e);return Number.isFinite(t)?t>0:e.length>0&&"0"!==e}return Boolean(e)},C=g?{rtsp:I(g.rtsp),onvif:I(g.onvif),wifi:I(g.wifi),record:I(g.record),ftp:I(g.ftp),email:I(g.email),pushAlarm:I(g.pushAlarm),audioTalk:I(g.audioTalk)}:void 0;if(n&&A&&!u.hasSiren){const e=async()=>{try{return await this.sendXml({cmdId:547,channel:r,timeoutMs:1e3}),!0}catch{return!1}},t=async()=>{try{const e=Y(r+1,0);return await this.sendXml({cmdId:263,channel:r,payloadXml:e,timeoutMs:1e3}),!0}catch{return!1}};(await e()||await t())&&(u.hasSiren=!0)}if(n&&i&&!u.hasFloodlight){const e=(g?.items??[]).filter((e=>e.chnID===r||e.chnID===r+1)),t=e=>{const t=e?.lightType;if("number"==typeof t)return t;if("string"==typeof t){const e=Number(t);return Number.isFinite(e)?e:void 0}},s=e.map((e=>t(e))).filter((e=>Number.isFinite(e)));if(s.some((e=>0===e)));else if(s.some((e=>e>0)))u.hasFloodlight=!0;else try{const e=await this.sendXml({cmdId:S,channel:r,timeoutMs:1e3});/(<FloodlightTask\b|<FloodlightManual\b|<FloodlightStatusList\b|<WhiteLed\b)/i.test(e)&&(u.hasFloodlight=!0)}catch{}}let B,Q;try{const e=(P(await this.sendXml({cmdId:299,channel:r,timeoutMs:1500}),"detectType")??"").trim();if(e){const t=e.split(",").map((e=>e.trim())).filter(Boolean);t.length>0&&(B=t)}}catch{}if(u.hasPresets){const e=(await Promise.allSettled([this.getPtzPresets(r)]))[0];"fulfilled"===e?.status&&(Q=e.value,u.hasPresets=Q.length>0)}const p={channel:r,channelId1Based:r+1,transport:this.client.getTransport(),encryptionKind:this.client.enc.kind,loggedIn:this.client.loggedIn,subscribed:this.client.subscribed,abilitiesAvailable:Boolean(h),supportAvailable:Boolean(g)};E&&(p.abilityMergedKeyCount=Object.keys(E).length),g?.items&&(p.supportItemCount=g.items.length);const f={capabilities:u,debug:p};return h&&(f.abilities=h),g&&(f.support=g),Q&&(f.presets=Q),B&&(f.objects=B),C&&(f.features=C),f}async createRtspStream(e,t,s){const r="number"==typeof e?this.normalizeChannel(e):0,n="number"==typeof e?t:e,A="number"==typeof e?s:t;let i;try{const e=await this.getStreamMetadata(r);if(Array.isArray(e)){const t=e.find((e=>e.profile===n));t?.videoEncType&&(i=t.videoEncType)}else if(e&&"object"==typeof e&&"streams"in e){const t=e.streams;if(Array.isArray(t)){const e=t.find((e=>e?.profile===n));e?.videoEncType&&(i=e.videoEncType)}}}catch(e){this.logger.warn(`[ReolinkBaichuanApi] Could not fetch stream metadata, will auto-detect codec: ${e instanceof Error?e.message:e}`)}const o={api:this,channel:r,profile:n,...void 0!==A?.listenHost?{listenHost:A.listenHost}:{},...void 0!==A?.listenPort?{listenPort:A.listenPort}:{},...void 0!==A?.path?{path:A.path}:{},logger:this.logger},a=new at(o);return await a.start(),this.rtspServers.add(a),a.once("close",(()=>{this.rtspServers.delete(a)})),a}};function _t(e,t,s){const r=[];let n=0;const A=(e,r)=>{if(4===t)return"be"===s?e.readUInt32BE(r):e.readUInt32LE(r);if(2===t)return"be"===s?e.readUInt16BE(r):e.readUInt16LE(r);if(3===t){const t=e[r],n=e[r+1],A=e[r+2];return"be"===s?(t<<16|n<<8|A)>>>0:(A<<16|n<<8|t)>>>0}return e.readUInt8(r)};for(;n+t<=e.length;){const s=A(e,n);if(n+=t,!s)return[];if(n+s>e.length)return[];const i=e.subarray(n,n+s);n+=s,i.length&&r.push(i)}return n!==e.length?[]:r}function qt(e,t){if(!t.length)return Number.POSITIVE_INFINITY;let s=0;for(const r of t)if(r.length){if(128&r[0])s+=10;else if("H264"===e){const e=31&r[0];(e<1||e>23)&&s++}else if("H265"===e){if(r.length<2){s++;continue}const e=r[0]>>1&63;e>=0&&e<=29||e>=32&&e<=40||e>=48&&e<=50||s++}}else s++;return s}function $t(e,t){if(!e?.length)return[];const s=[],r=function(e,t=64){if(!e?.length)return-1;const s=Math.min(e.length,Math.max(0,t));for(let t=0;t+3<s;t++)if(0===e[t]&&0===e[t+1]){if(1===e[t+2])return t;if(0===e[t+2]&&1===e[t+3])return t}return-1}(e,64);if(r>=0){const t=function(e){const t=[],s=e.length,r=t=>{if(t+3<=s&&0===e[t]&&0===e[t+1]){if(1===e[t+2])return 3;if(t+4<=s&&0===e[t+2]&&1===e[t+3])return 4}return 0};let n=0;for(;n<s&&!r(n);)n++;for(;n<s;){const A=r(n);if(!A){n++;continue}const i=n+A;let o=i;for(;o<s&&!r(o);)o++;if(i<o){const s=e.subarray(i,o);s.length>0&&t.push(s)}n=o}return t}(0===r?e:e.subarray(r));t.length&&s.push(t)}s.push(_t(e,4,"be")),s.push(_t(e,4,"le")),s.push(_t(e,3,"be")),s.push(_t(e,3,"le")),s.push(_t(e,2,"be")),s.push(_t(e,2,"le")),s.push(_t(e,1,"be"));const n=function(e){if(e.length>=4&&0===e[0]&&0===e[1]){if(1===e[2])return e.subarray(3);if(0===e[2]&&1===e[3])return e.subarray(4)}return e}(e);n.length&&s.push([n]);let A=[],i=Number.POSITIVE_INFINITY;for(const e of s){if(!e.length)continue;const s=qt(t,e);if(s<i&&(i=s,A=e,0===i))break}return A}function zt(e){const t=$t(e,"H264");let s,r,n;for(const e of t){if(e.length<1)continue;const t=31&e[0];if(7===t){if(s=e,e.length>=4){n=Buffer.from([e[1],e[2],e[3]]).toString("hex")}}else 8===t&&(r=e)}const A={};return s&&(A.sps=s),r&&(A.pps=r),n&&(A.profileLevelId=n),A}function Xt(e){const t=$t(e,"H265");let s,r,n;for(const e of t){if(e.length<2)continue;const t=e[0]>>1&63;32===t?s=e:33===t?r=e:34===t&&(n=e)}const A={};return s&&(A.vps=s),r&&(A.sps=r),n&&(A.pps=n),A}var jt=[96e3,88200,64e3,48e3,44100,32e3,24e3,22050,16e3,12e3,11025,8e3,7350];function Zt(e){if(e.length<7)return null;if(255!==e[0]||240&~e[1])return null;const t=!(1&~e[1]),s=((192&e[2])>>6)+1,r=(60&e[2])>>2,n=jt[r]??0,A=(1&e[2])<<2|(192&e[3])>>6;if(!n||!A)return null;const i=t?7:9;if(e.length<i)return null;return{headerLength:i,sampleRate:n,channels:A,configHex:((31&s)<<11|(15&r)<<7|(15&A)<<3).toString(16).padStart(4,"0")}}var Kt=class{constructor(e){this.payloadType=e,this.seq=r.randomBytes(2).readUInt16BE(0)}seq=0;timestamp=0;ssrc=r.randomBytes(4).readUInt32BE(0);setTimestamp(e){this.timestamp=e>>>0}getTimestamp(){return this.timestamp>>>0}advanceTimestamp(e){this.timestamp=this.timestamp+(e>>>0)>>>0}writePacket(e,t){const s=Buffer.alloc(12);return s[0]=128,s[1]=(t?128:0)|127&this.payloadType,s.writeUInt16BE(65535&this.seq,2),s.writeUInt32BE(this.timestamp>>>0,4),s.writeUInt32BE(this.ssrc>>>0,8),this.seq=this.seq+1&65535,Buffer.concat([s,e])}};function es(e,t,s,r,n){const A=s.maxRtpPayload,i=[];if(e.length<=A)return i.push(t.writePacket(e,r&&n)),i;const o=e[0],a=31&o,c=128&o|96&o|28,l=e.subarray(1);let h=0;for(;h<l.length;){const e=l.length-h,s=Math.min(e,A-2),o=0===h,g=h+s>=l.length,d=(o?128:0)|(g?64:0)|31&a,u=Buffer.concat([Buffer.from([c,d]),l.subarray(h,h+s)]);i.push(t.writePacket(u,r&&n&&g)),h+=s}return i}function ts(e,t,s,r,n){const A=s.maxRtpPayload,i=[];if(e.length<=A)return i.push(t.writePacket(e,r&&n)),i;if(e.length<3)return i;const o=e[0],a=o>>1&63,c=129&o|98,l=e[1],h=e.subarray(2);let g=0;for(;g<h.length;){const e=h.length-g,s=Math.min(e,A-3),o=0===g,d=g+s>=h.length,u=(o?128:0)|(d?64:0)|63&a,E=Buffer.concat([Buffer.from([c,l,u]),h.subarray(g,g+s)]);i.push(t.writePacket(E,r&&n&&d)),g+=s}return i}var ss=class e{constructor(e,t,s,r=25,n=1200){this.logger=e,this.videoPayloadType=t,this.maxRtpPayload=n,this.videoRtp=new Kt(t),void 0!==s&&(this.audioRtp=new Kt(s)),this.fallbackVideoIncrement=Math.max(1,Math.round(this.videoClockRate/Math.max(1,r))),this.fallbackVideoDeltaUs=Math.max(1,Math.round(1e6*this.fallbackVideoIncrement/this.videoClockRate))}clients=new Set;closed=!1;videoRtp;audioRtp;videoLastUsRaw;videoUsWrapOffset=0;videoLastAbsUs;videoAvgDeltaUs;videoClockRate=9e4;fallbackVideoIncrement;fallbackVideoDeltaUs;maxTrustedDeltaUs=5e5;emaAlpha=.1;videoTimingLogState={lastUntrustedDeltaLogMs:0,lastWrapLogMs:0,lastResetLogMs:0,untrustedDeltaCount:0,wrapCount:0,resetCount:0};cachedH264ParamSetsAnnexB;cachedH265ParamSetsAnnexB;addClient(e){if(this.closed)return void e.destroy();const t={socket:e,needsKeyframe:!0,sentVideoConfig:!1};this.clients.add(t);const s=()=>{this.clients.delete(t);try{e.destroy()}catch{}};e.on("error",s),e.on("close",s)}static ANNEXB_START_CODE=Buffer.from([0,0,0,1]);static joinAnnexBNals(...t){const s=t.filter((e=>!!e&&e.length>0));if(!s.length)return;const r=[];for(const t of s)r.push(e.ANNEXB_START_CODE,t);return Buffer.concat(r)}updateVideoParamSetsFromAccessUnit(t,s){if(!s?.length)return;if("H264"===t){const{sps:t,pps:r}=zt(s);return void(t&&r&&(this.cachedH264ParamSetsAnnexB=e.joinAnnexBNals(t,r)))}const{vps:r,sps:n,pps:A}=Xt(s);r&&n&&A&&(this.cachedH265ParamSetsAnnexB=e.joinAnnexBNals(r,n,A))}sendCachedVideoConfigToClient(e,t){if(this.closed)return;if(t.sentVideoConfig)return;const s="H265"===e?this.cachedH265ParamSetsAnnexB:this.cachedH264ParamSetsAnnexB;if(!s?.length)return;const r=$t(s,e);if(!r.length)return;const n={maxRtpPayload:this.maxRtpPayload};for(let s=0;s<r.length;s++){const A=r[s],i=s===r.length-1,o="H265"===e?ts(A,this.videoRtp,n,!1,i):es(A,this.videoRtp,n,!1,i);for(const e of o)this.writeRtpPacketToClient(t,e)}t.sentVideoConfig=!0}close(){if(!this.closed){this.closed=!0;for(const e of Array.from(this.clients))try{e.socket.destroy()}catch{}this.clients.clear()}}writeRtpPacketToClient(e,t){if(e.socket.destroyed||!e.socket.writable)return;const s=Buffer.alloc(2);s.writeUInt16BE(65535&t.length,0);const r=Buffer.concat([s,t]);try{e.socket.write(r)}catch{try{e.socket.destroy()}catch{}}}writeRtpPacketToClients(e,t){for(const s of this.clients)t(s)&&this.writeRtpPacketToClient(s,e)}resetVideoTimestampMapping(){this.videoLastUsRaw=void 0,this.videoUsWrapOffset=0,this.videoLastAbsUs=void 0,this.videoAvgDeltaUs=void 0}logVideoTiming(e,t){const s=Date.now(),r=5e3,n=this.videoTimingLogState;if("untrusted-delta"===e){if(n.untrustedDeltaCount++,s-n.lastUntrustedDeltaLogMs<r)return;return n.lastUntrustedDeltaLogMs=s,void this.logger.warn(`[rfc4571] video timing: ${t} (untrustedDeltaCount=${n.untrustedDeltaCount})`)}if("wrap"===e){if(n.wrapCount++,s-n.lastWrapLogMs<r)return;return n.lastWrapLogMs=s,void this.logger.warn(`[rfc4571] video timing: ${t} (wrapCount=${n.wrapCount})`)}n.resetCount++,s-n.lastResetLogMs<r||(n.lastResetLogMs=s,this.logger.warn(`[rfc4571] video timing: ${t} (resetCount=${n.resetCount})`))}advanceVideoTimestampFallback(){this.videoRtp.advanceTimestamp(this.fallbackVideoIncrement)}setVideoTimestampFromMicroseconds(e){if(null==e)return void this.advanceVideoTimestampFallback();if(!Number.isFinite(e))return void this.advanceVideoTimestampFallback();const t=e>>>0;if(void 0!==this.videoLastUsRaw){const e=this.videoLastUsRaw;if(t<e){e>4026531840&&t<268435455?(this.videoUsWrapOffset+=4294967296,this.logVideoTiming("wrap",`detected u32 wrap (lastUsRaw=${e} curUsRaw=${t} wrapOffset=${this.videoUsWrapOffset})`)):(this.logVideoTiming("reset",`detected backwards jump; resetting mapping (lastUsRaw=${e} curUsRaw=${t})`),this.resetVideoTimestampMapping())}}this.videoLastUsRaw=t;const s=this.videoUsWrapOffset+t;if(void 0===this.videoLastAbsUs)return this.videoLastAbsUs=s,void(void 0===this.videoAvgDeltaUs&&(this.videoAvgDeltaUs=this.fallbackVideoDeltaUs));const r=s-this.videoLastAbsUs;this.videoLastAbsUs=s;let n;if(Number.isFinite(r)&&r>0&&r<=this.maxTrustedDeltaUs){const e=this.videoAvgDeltaUs??r;this.videoAvgDeltaUs=e+(r-e)*this.emaAlpha,n=r}else this.logVideoTiming("untrusted-delta",`discarded deltaUs=${r} (absUs=${s} lastAbsUs=${this.videoLastAbsUs} avgDeltaUs=${this.videoAvgDeltaUs??"n/a"}); using fallback`),n=this.videoAvgDeltaUs??this.fallbackVideoDeltaUs;const A=Math.max(1,Math.round(n*this.videoClockRate/1e6));this.videoRtp.advanceTimestamp(A)}sendVideoAccessUnit(e,t,s,r){if(this.closed)return;this.updateVideoParamSetsFromAccessUnit(e,t);const n=$t(t,e);if(!n.length)return;let A=!1;if("H264"===e)for(const e of n){if(5===(31&e[0])){A=!0;break}}else for(const e of n){if(e.length<2)continue;const t=e[0]>>1&63;if(t>=16&&t<=23){A=!0;break}}const i=s||A,o=e=>!!i||!e.needsKeyframe;let a=!1;for(const e of this.clients)if(o(e)){a=!0;break}if(!a){for(const t of this.clients)t.needsKeyframe&&this.sendCachedVideoConfigToClient(e,t);return}this.setVideoTimestampFromMicroseconds(r);for(const t of this.clients)t.needsKeyframe&&this.sendCachedVideoConfigToClient(e,t);const c={maxRtpPayload:this.maxRtpPayload};for(let t=0;t<n.length;t++){const s=n[t],r=t===n.length-1,A="H265"===e?ts(s,this.videoRtp,c,!0,r):es(s,this.videoRtp,c,!0,r);for(const e of A)this.writeRtpPacketToClients(e,o)}if(i)for(const e of this.clients)e.needsKeyframe=!1}sendAudioAdtsFrame(e){if(this.closed)return{};if(!this.audioRtp)return{};const{packets:t,config:s}=function(e,t){const s=Zt(e);if(!s)return{packets:[]};const r=e.subarray(s.headerLength);if(!r.length)return{packets:[]};const n=Buffer.from([0,16]),A=8191&r.length,i=Buffer.alloc(2);i[0]=A>>5&255,i[1]=(31&A)<<3;const o=Buffer.concat([n,i,r]);return{packets:[t.writePacket(o,!0)],config:{sampleRate:s.sampleRate,channels:s.channels,configHex:s.configHex}}}(e,this.audioRtp);for(const e of t)this.writeRtpPacketToClients(e,(e=>!e.needsKeyframe));return t.length&&this.audioRtp.advanceTimestamp(1024),s?{parsed:s}:{}}sendAudioRtpPacket(e){if(this.closed)return;if(!e||e.length<12)return;2===(e[0]>>6&3)&&this.writeRtpPacketToClients(e,(e=>!e.needsKeyframe))}static parseRtpPayload(e){if(!e||e.length<12)return;if(2!==(e[0]>>6&3))return;const t=!!(32&e[0]),s=!!(16&e[0]);let r=12+4*(15&e[0]);if(r>e.length)return;if(s){if(r+4>e.length)return;if(r+=4+4*e.readUInt16BE(r+2),r>e.length)return}let n=e.length;if(t){const t=e[e.length-1];if(t<=0||t>e.length)return;if(n=e.length-t,n<r)return}return n<=r?void 0:e.subarray(r,n)}static isH264KeyframeLikeRtpPacket(t){const s=e.parseRtpPayload(t);if(!s||s.length<1)return!1;const r=31&s[0];if(r>=1&&r<=23)return 5===r||7===r||8===r;if(24===r){let e=1;for(;e+2<=s.length;){const t=s.readUInt16BE(e);if(e+=2,!t||e+t>s.length)break;const r=31&s[e];if(5===r||7===r||8===r)return!0;e+=t}return!1}if(28===r&&s.length>=2){const e=s[1],t=31&e;return!!!!(128&e)&&(5===t||7===t||8===t)}return!1}static isH265KeyframeLikeRtpPacket(t){const s=e.parseRtpPayload(t);if(!s||s.length<2)return!1;const r=s[0]>>1&63,n=e=>e>=16&&e<=21||(32===e||33===e||34===e);if(49===r&&s.length>=3){const e=s[2];return!!!!(128&e)&&n(63&e)}return n(r)}sendVideoRtpPacket(t,s){if(this.closed)return;if(!s||s.length<12)return;if(2!==(s[0]>>6&3))return;const r="H265"===t?e.isH265KeyframeLikeRtpPacket(s):e.isH264KeyframeLikeRtpPacket(s);if(this.writeRtpPacketToClients(s,(e=>!!r||!e.needsKeyframe)),r)for(const e of this.clients)e.needsKeyframe=!1}};async function rs(e){const{api:t,channel:s,profile:r,logger:n,expectedVideoType:i,host:o="127.0.0.1",videoPayloadType:a=96,audioPayloadType:c=97,keyframeTimeoutMs:l=5e3,uptimeRestartMs:h=1e4,idleTeardownMs:g=2500,closeApiOnTeardown:d=!0,username:u,password:E,requireAuth:I=!1}=e,C=`[native-rfc4571 ch=${s} profile=${r}]`,B=e=>n.warn(`${C} ${e}`);B(`starting (host=${o} videoPT=${a} audioPT=${c} expectedVideoType=${i??"n/a"} keyframeTimeoutMs=${l} uptimeRestartMs=${h} idleTeardownMs=${g})`);const Q=new Ze({client:t.client,api:t,channel:s,profile:r,logger:n});await Q.start(),B("baichuan stream started; waiting for keyframe to extract parameter sets");const p=await(async()=>await new Promise(((e,t)=>{const n=setTimeout((()=>{o(),t(new Error(`Timeout waiting for keyframe on native stream channel=${s} profile=${r}`))}),l),A=e=>{o(),t(e instanceof Error?e:new Error(String(e)))},i=t=>{if(!t?.isKeyframe)return;const s=t.videoType,r=t.data;if("H264"===s){const{sps:t,pps:n,profileLevelId:A}=zt(r);if(!t||!n)return;return o(),void e({videoType:s,accessUnit:r,...A?{profileLevelId:A}:{},h264:{sps:t,pps:n}})}const{vps:n,sps:A,pps:i}=Xt(r);n&&A&&i&&(o(),e({videoType:s,accessUnit:r,h265:{vps:n,sps:A,pps:i}}))},o=()=>{clearTimeout(n),Q.removeListener("error",A),Q.removeListener("videoAccessUnit",i)};Q.on("error",A),Q.on("videoAccessUnit",i)})))();i&&p.videoType!==i&&B(`expectedVideoType mismatch (expected=${i} actual=${p.videoType})`),B(`video detected: codec=${p.videoType} (primed via keyframe)`);let f,m=25;try{const e=await t.getStreamMetadata(s),n=(Array.isArray(e)?e:Array.isArray(e?.streams)?e.streams:[]).find((e=>e?.profile===r)),A=Number(n?.frameRate);Number.isFinite(A)&&A>0&&(m=A)}catch{}B(`video framerate hint: ${m} fps`);f=await(async()=>await new Promise((e=>{let t=!1,s=3;const r=setTimeout((()=>{i(),t&&n.warn("Native audio frames seen but not ADTS AAC; cannot advertise audio track."),e(void 0)}),5e3),A=r=>{t=!0;const A=Zt(r);if(A)i(),e({sampleRate:A.sampleRate,channels:A.channels,configHex:A.configHex});else if(s-- >0){const e=r.subarray(0,Math.min(16,r.length)).toString("hex");n.warn(`Native audioFrame not ADTS: len=${r.length} head=${e}`)}},i=()=>{clearTimeout(r),Q.removeListener("audioFrame",A)};Q.on("audioFrame",A)})))(),B(f?`audio detected: codec=aac sampleRate=${f.sampleRate} channels=${f.channels}`:"audio not detected/advertised (no ADTS AAC config within timeout)");const y={videoType:p.videoType,payloadType:a,..."H264"===p.videoType?{h264:{sps:p.h264.sps,pps:p.h264.pps,...p.profileLevelId?{profileLevelId:p.profileLevelId}:{}}}:{h265:{vps:p.h265.vps,sps:p.h265.sps,pps:p.h265.pps}}},w=f?{codec:"aac",payloadType:c,sampleRate:f.sampleRate,channels:f.channels,configHex:f.configHex}:void 0,S=function(e,t){let s="v=0\r\n";if(s+="o=- 0 0 IN IP4 0.0.0.0\r\n",s+="s=No Name\r\n",s+="t=0 0\r\n",s+=`m=video 0 RTP/AVP ${e.payloadType}\r\n`,s+="c=IN IP4 0.0.0.0\r\n",s+=`a=rtpmap:${e.payloadType} ${e.videoType}/90000\r\n`,"H264"===e.videoType&&e.h264){const t=e.h264.sps.toString("base64"),r=e.h264.pps.toString("base64"),n=e.h264.profileLevelId?`profile-level-id=${e.h264.profileLevelId};`:"";s+=`a=fmtp:${e.payloadType} packetization-mode=1;${n}sprop-parameter-sets=${t},${r}\r\n`}if("H265"===e.videoType&&e.h265){const t=e.h265.vps.toString("base64"),r=e.h265.sps.toString("base64"),n=e.h265.pps.toString("base64");s+=`a=fmtp:${e.payloadType} sprop-vps=${t};sprop-sps=${r};sprop-pps=${n}\r\n`}return"aac"===t?.codec&&(s+=`m=audio 0 RTP/AVP ${t.payloadType}\r\n`,s+="c=IN IP4 0.0.0.0\r\n",s+="b=AS:128\r\n",s+=`a=rtpmap:${t.payloadType} MPEG4-GENERIC/${t.sampleRate}/${t.channels}\r\n`,s+=`a=fmtp:${t.payloadType} profile-level-id=1; mode=AAC-hbr; sizelength=13; indexlength=3; indexdeltalength=3; config=${t.configHex}\r\n`),"opus"===t?.codec&&(s+=`m=audio 0 RTP/AVP ${t.payloadType}\r\n`,s+="c=IN IP4 0.0.0.0\r\n",s+="b=AS:128\r\n",s+=`a=rtpmap:${t.payloadType} opus/${t.sampleRate}/${t.channels}\r\n`),s}(y,w),D=()=>new ss(n,a,w?c:void 0,m);let b=D();B(`SDP ready (video=${p.videoType}/90000 pt=${a}${w?`, audio=aac/${w.sampleRate}/${w.channels} pt=${c}`:", audio=none"})`);let v=0;const R=new Set;let N,k=!1,T=!1,F=Date.now();const M=()=>{F=Date.now()},U=()=>{N&&(clearTimeout(N),N=void 0)};let L;const H=e=>{g&&(N||(N=setTimeout((()=>{N=void 0,0===v&&e(new Error("No RFC4571 clients (idle)")).catch((()=>{}))}),g)))},P=A.createServer(),x=async e=>{if(k)return;if(T)return;T=!0,M(),U();const t=e?.message||e?.toString?.()||e,s=P.address(),r=s&&"string"!=typeof s?`${s.address}:${s.port}`:"unbound";B(t?`uptime watchdog: restarting (addr=${r} clients=${v} reason=${t})`:`uptime watchdog: restarting (addr=${r} clients=${v})`);for(const e of Array.from(R))try{e.destroy()}catch{}R.clear();try{b.close()}catch{}b=D();try{await Q.stop()}catch{}try{await Q.start()}catch(e){return T=!1,void Y(e).catch((()=>{}))}T=!1,M(),B("uptime watchdog: restart complete"),0===v&&H(Y)},Y=async e=>{if(k)return;k=!0,L&&(clearInterval(L),L=void 0),U();const s=e?.message||e?.toString?.()||e,r=P.address(),n=r&&"string"!=typeof r?`${r.address}:${r.port}`:"unbound";B(s?`teardown requested (addr=${n} clients=${v} reason=${s})`:`teardown requested (addr=${n} clients=${v})`),b.close();try{await Q.stop()}catch{}if(d)try{await t.close()}catch{}try{P.close()}catch{}B("teardown complete")};P.on("connection",(e=>{M();const t=`${e.remoteAddress??"unknown"}:${e.remotePort??"unknown"}`;B(`client connecting (remote=${t} requireAuth=${I})`);const s=()=>{v++,U(),R.add(e),e.on("data",(()=>M()));try{const t=e.write.bind(e);e.write=(...e)=>(M(),t(...e))}catch{}b.addClient(e),B(`client connected (remote=${t} clients=${v})`)};if(I){let r=!1,n=Buffer.alloc(0);const A=setTimeout((()=>{r||(B(`client authentication timeout (remote=${t})`),e.destroy())}),5e3),i=o=>{if(M(),!r){n=Buffer.concat([n,o]);const a=n.toString("utf8").match(/^([^:]+):([^\n]+)\n/);if(a){const[,o,c]=a;if(o!==u||c!==E)return B(`client authentication failed (remote=${t})`),void e.destroy();{r=!0,clearTimeout(A),s();const t=a[0].length,o=n.subarray(t);e.removeListener("data",i),e.on("data",(()=>M())),o.length>0&&e.emit("data",o)}}else if(n.length>1024)return B(`client authentication buffer overflow (remote=${t})`),void e.destroy()}};e.on("data",i)}else s();let r=!0;const n=()=>{r&&(r=!1,v=Math.max(0,v-1),R.delete(e),B(`client disconnected (remote=${t} clients=${v})`),0===v&&H(Y))};e.once("close",n),e.once("error",n)})),Q.on("videoAccessUnit",(e=>{M();try{b.sendVideoAccessUnit(e.videoType,e.data,e.isKeyframe,e.microseconds)}catch(e){Y(e).catch((()=>{}))}})),w&&Q.on("audioFrame",(e=>{M();try{b.sendAudioAdtsFrame(e)}catch(e){Y(e).catch((()=>{}))}})),Q.on("error",(e=>{T||Y(e).catch((()=>{}))})),Q.on("close",(e=>{T||Y(e).catch((()=>{}))})),await new Promise(((e,t)=>{P.once("error",t),P.listen(0,o,(()=>e()))}));const V=P.address();if(!V||"string"==typeof V)throw new Error("Failed to bind RFC TCP server");const O=V.port;if(!O)throw new Error("Failed to bind RFC TCP server");B(`listening (addr=${o}:${O})`);const G=w?{codec:"aac",sampleRate:w.sampleRate,channels:w.channels}:void 0;return H(Y),(()=>{if(!h||h<=0)return;if(L)return;const e=Math.max(250,Math.min(1e3,Math.floor(h/2)));L=setInterval((()=>{if(k||T)return;const e=Date.now()-F;e<h||x(new Error(`No stream activity for ${e}ms (threshold=${h}ms)`)).catch((()=>{}))}),e)})(),{host:o,port:O,sdp:S,videoType:p.videoType,...G?{audio:G}:{},username:u,password:E,server:P,videoStream:Q,close:Y}}var ns=Buffer.from([0,0,0,1]),As=Buffer.from([0,0,1]);function is(e){const t=[];for(let s=0;s<e.length-3;s++)0===e[s]&&0===e[s+1]&&(1===e[s+2]?(t.push({idx:s,len:3}),s+=2):0===e[s+2]&&1===e[s+3]&&(t.push({idx:s,len:4}),s+=3));if(0===t.length)return[];const s=[];for(let r=0;r<t.length;r++){const n=t[r],A=n.idx+n.len,i=t[r+1],o=i?i.idx:e.length;o>A&&s.push(e.subarray(A,o))}return s}function os(e){if(e.length<1)return null;const t=e[0];return void 0===t?null:31&t}n.EventEmitter}},t={};function s(r){var n=t[r];if(void 0!==n)return n.exports;var A=t[r]={id:r,loaded:!1,exports:{}};return e[r].call(A.exports,A,A.exports,s),A.loaded=!0,A.exports}s.d=(e,t)=>{for(var r in t)s.o(t,r)&&!s.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},s.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),s.nmd=e=>(e.paths=[],e.children||(e.children=[]),e);var r=s(7927),n=exports="undefined"==typeof exports?{}:exports;for(var A in r)n[A]=r[A];r.__esModule&&Object.defineProperty(n,"__esModule",{value:!0})})();
2
+ (()=>{var e={9038:(e,t,s)=>{"use strict";const r=s(1167),n=s(5497),A=s(8542),i=s(8055),o=s(3315),a=s(9246),c=s(4667),l=s(8712),h=s(8297),g=s(4465),d=s(2858),{InvalidArgumentError:u}=g,E=s(9713),I=s(1986),C=s(615),{MockCallHistory:B,MockCallHistoryLog:Q}=s(4969),p=s(7467),f=s(5846),m=s(1313),y=s(3123),w=s(6294),{getGlobalDispatcher:S,setGlobalDispatcher:D}=s(9879),b=s(6917),v=s(8064);Object.assign(n.prototype,E),e.exports.g6=o,s(5132),s(2936),s(532),s(3562),s(6677),s(5752),s(4951),s(9903);function N(e){return(t,s,r)=>{if("function"==typeof s&&(r=s,s=null),!t||"string"!=typeof t&&"object"!=typeof t&&!(t instanceof URL))throw new u("invalid url");if(null!=s&&"object"!=typeof s)throw new u("invalid opts");if(s&&null!=s.path){if("string"!=typeof s.path)throw new u("invalid opts.path");let e=s.path;s.path.startsWith("/")||(e=`/${e}`),t=new URL(d.parseOrigin(t).origin+e)}else s||(s="object"==typeof t?t:{}),t=d.parseURL(t);const{agent:n,dispatcher:A=S()}=s;if(n)throw new u("unsupported opts.agent. Did you mean opts.client?");return e.call(A,{...s,origin:t.origin,path:t.search?`${t.pathname}${t.search}`:t.pathname,method:s.method||(s.body?"PUT":"GET")},r)}}s(2636),d.parseHeaders,d.headerNameToString;const R=s(7388).fetch;e.exports.hd=function(e,t=void 0){return R(e,t).catch((e=>{throw e&&"object"==typeof e&&Error.captureStackTrace(e),e}))},e.exports.Headers=s(6558).Headers,e.exports.Response=s(4821).Response,e.exports.Request=s(4609).Request,e.exports.FormData=s(3944).FormData;const{setGlobalOrigin:k,getGlobalOrigin:T}=s(2837);const{CacheStorage:F}=s(6939),{kConstruct:M}=s(257);new F(M);const{deleteCookie:U,getCookies:L,getSetCookies:H,setCookie:P,parseCookie:x}=s(9391);const{parseMIMEType:Y,serializeAMimeType:V}=s(9934);const{CloseEvent:O,ErrorEvent:G,MessageEvent:J}=s(878),{WebSocket:W,ping:_}=s(2984);e.exports.kb=W,e.exports.rd=O,e.exports.NN=G,e.exports.aM=J,s(27).WebSocketStream,s(7053).WebSocketError,N(E.request),N(E.stream),N(E.pipeline),N(E.connect),N(E.upgrade);const{EventSource:q}=s(7928);e.exports.GD=q},3904:(e,t,s)=>{"use strict";const{addAbortListener:r}=s(2858),{RequestAbortedError:n}=s(4465),A=Symbol("kListener"),i=Symbol("kSignal");function o(e){e.abort?e.abort(e[i]?.reason):e.reason=e[i]?.reason??new n,a(e)}function a(e){e[i]&&("removeEventListener"in e[i]?e[i].removeEventListener("abort",e[A]):e[i].removeListener("abort",e[A]),e[i]=null,e[A]=null)}e.exports={addSignal:function(e,t){e.reason=null,e[i]=null,e[A]=null,t&&(t.aborted?o(e):(e[i]=t,e[A]=()=>{o(e)},r(e[i],e[A])))},removeSignal:a}},3102:(e,t,s)=>{"use strict";const r=s(4589),{AsyncResource:n}=s(6698),{InvalidArgumentError:A,SocketError:i}=s(4465),o=s(2858),{addSignal:a,removeSignal:c}=s(3904);class l extends n{constructor(e,t){if(!e||"object"!=typeof e)throw new A("invalid opts");if("function"!=typeof t)throw new A("invalid callback");const{signal:s,opaque:r,responseHeaders:n}=e;if(s&&"function"!=typeof s.on&&"function"!=typeof s.addEventListener)throw new A("signal must be an EventEmitter or EventTarget");super("UNDICI_CONNECT"),this.opaque=r||null,this.responseHeaders=n||null,this.callback=t,this.abort=null,a(this,s)}onConnect(e,t){this.reason?e(this.reason):(r(this.callback),this.abort=e,this.context=t)}onHeaders(){throw new i("bad connect",null)}onUpgrade(e,t,s){const{callback:r,opaque:n,context:A}=this;c(this),this.callback=null;let i=t;null!=i&&(i="raw"===this.responseHeaders?o.parseRawHeaders(t):o.parseHeaders(t)),this.runInAsyncScope(r,null,null,{statusCode:e,headers:i,socket:s,opaque:n,context:A})}onError(e){const{callback:t,opaque:s}=this;c(this),t&&(this.callback=null,queueMicrotask((()=>{this.runInAsyncScope(t,null,e,{opaque:s})})))}}e.exports=function e(t,s){if(void 0===s)return new Promise(((s,r)=>{e.call(this,t,((e,t)=>e?r(e):s(t)))}));try{const e=new l(t,s),r={...t,method:"CONNECT"};this.dispatch(r,e)}catch(e){if("function"!=typeof s)throw e;const r=t?.opaque;queueMicrotask((()=>s(e,{opaque:r})))}}},8660:(e,t,s)=>{"use strict";const{Readable:r,Duplex:n,PassThrough:A}=s(7075),i=s(4589),{AsyncResource:o}=s(6698),{InvalidArgumentError:a,InvalidReturnValueError:c,RequestAbortedError:l}=s(4465),h=s(2858),{addSignal:g,removeSignal:d}=s(3904);function u(){}const E=Symbol("resume");class I extends r{constructor(){super({autoDestroy:!0}),this[E]=null}_read(){const{[E]:e}=this;e&&(this[E]=null,e())}_destroy(e,t){this._read(),t(e)}}class C extends r{constructor(e){super({autoDestroy:!0}),this[E]=e}_read(){this[E]()}_destroy(e,t){e||this._readableState.endEmitted||(e=new l),t(e)}}class B extends o{constructor(e,t){if(!e||"object"!=typeof e)throw new a("invalid opts");if("function"!=typeof t)throw new a("invalid handler");const{signal:s,method:r,opaque:A,onInfo:i,responseHeaders:o}=e;if(s&&"function"!=typeof s.on&&"function"!=typeof s.addEventListener)throw new a("signal must be an EventEmitter or EventTarget");if("CONNECT"===r)throw new a("invalid method");if(i&&"function"!=typeof i)throw new a("invalid onInfo callback");super("UNDICI_PIPELINE"),this.opaque=A||null,this.responseHeaders=o||null,this.handler=t,this.abort=null,this.context=null,this.onInfo=i||null,this.req=(new I).on("error",u),this.ret=new n({readableObjectMode:e.objectMode,autoDestroy:!0,read:()=>{const{body:e}=this;e?.resume&&e.resume()},write:(e,t,s)=>{const{req:r}=this;r.push(e,t)||r._readableState.destroyed?s():r[E]=s},destroy:(e,t)=>{const{body:s,req:r,res:n,ret:A,abort:i}=this;e||A._readableState.endEmitted||(e=new l),i&&e&&i(),h.destroy(s,e),h.destroy(r,e),h.destroy(n,e),d(this),t(e)}}).on("prefinish",(()=>{const{req:e}=this;e.push(null)})),this.res=null,g(this,s)}onConnect(e,t){const{res:s}=this;this.reason?e(this.reason):(i(!s,"pipeline cannot be retried"),this.abort=e,this.context=t)}onHeaders(e,t,s){const{opaque:r,handler:n,context:A}=this;if(e<200){if(this.onInfo){const s="raw"===this.responseHeaders?h.parseRawHeaders(t):h.parseHeaders(t);this.onInfo({statusCode:e,headers:s})}return}let i;this.res=new C(s);try{this.handler=null;const s="raw"===this.responseHeaders?h.parseRawHeaders(t):h.parseHeaders(t);i=this.runInAsyncScope(n,null,{statusCode:e,headers:s,opaque:r,body:this.res,context:A})}catch(e){throw this.res.on("error",u),e}if(!i||"function"!=typeof i.on)throw new c("expected Readable");i.on("data",(e=>{const{ret:t,body:s}=this;!t.push(e)&&s.pause&&s.pause()})).on("error",(e=>{const{ret:t}=this;h.destroy(t,e)})).on("end",(()=>{const{ret:e}=this;e.push(null)})).on("close",(()=>{const{ret:e}=this;e._readableState.ended||h.destroy(e,new l)})),this.body=i}onData(e){const{res:t}=this;return t.push(e)}onComplete(e){const{res:t}=this;t.push(null)}onError(e){const{ret:t}=this;this.handler=null,h.destroy(t,e)}}e.exports=function(e,t){try{const s=new B(e,t);return this.dispatch({...e,body:s.req},s),s.ret}catch(e){return(new A).destroy(e)}}},7745:(e,t,s)=>{"use strict";const r=s(4589),{AsyncResource:n}=s(6698),{Readable:A}=s(777),{InvalidArgumentError:i,RequestAbortedError:o}=s(4465),a=s(2858);function c(){}class l extends n{constructor(e,t){if(!e||"object"!=typeof e)throw new i("invalid opts");const{signal:s,method:r,opaque:n,body:A,onInfo:l,responseHeaders:h,highWaterMark:g}=e;try{if("function"!=typeof t)throw new i("invalid callback");if(g&&("number"!=typeof g||g<0))throw new i("invalid highWaterMark");if(s&&"function"!=typeof s.on&&"function"!=typeof s.addEventListener)throw new i("signal must be an EventEmitter or EventTarget");if("CONNECT"===r)throw new i("invalid method");if(l&&"function"!=typeof l)throw new i("invalid onInfo callback");super("UNDICI_REQUEST")}catch(e){throw a.isStream(A)&&a.destroy(A.on("error",c),e),e}this.method=r,this.responseHeaders=h||null,this.opaque=n||null,this.callback=t,this.res=null,this.abort=null,this.body=A,this.trailers={},this.context=null,this.onInfo=l||null,this.highWaterMark=g,this.reason=null,this.removeAbortListener=null,s?.aborted?this.reason=s.reason??new o:s&&(this.removeAbortListener=a.addAbortListener(s,(()=>{this.reason=s.reason??new o,this.res?a.destroy(this.res.on("error",c),this.reason):this.abort&&this.abort(this.reason)})))}onConnect(e,t){this.reason?e(this.reason):(r(this.callback),this.abort=e,this.context=t)}onHeaders(e,t,s,r){const{callback:n,opaque:i,abort:o,context:l,responseHeaders:h,highWaterMark:g}=this,d="raw"===h?a.parseRawHeaders(t):a.parseHeaders(t);if(e<200)return void(this.onInfo&&this.onInfo({statusCode:e,headers:d}));const u="raw"===h?a.parseHeaders(t):d,E=u["content-type"],I=u["content-length"],C=new A({resume:s,abort:o,contentType:E,contentLength:"HEAD"!==this.method&&I?Number(I):null,highWaterMark:g});if(this.removeAbortListener&&(C.on("close",this.removeAbortListener),this.removeAbortListener=null),this.callback=null,this.res=C,null!==n)try{this.runInAsyncScope(n,null,null,{statusCode:e,headers:d,trailers:this.trailers,opaque:i,body:C,context:l})}catch(e){this.res=null,a.destroy(C.on("error",c),e),queueMicrotask((()=>{throw e}))}}onData(e){return this.res.push(e)}onComplete(e){a.parseHeaders(e,this.trailers),this.res.push(null)}onError(e){const{res:t,callback:s,body:r,opaque:n}=this;s&&(this.callback=null,queueMicrotask((()=>{this.runInAsyncScope(s,null,e,{opaque:n})}))),t&&(this.res=null,queueMicrotask((()=>{a.destroy(t.on("error",c),e)}))),r&&(this.body=null,a.isStream(r)&&(r.on("error",c),a.destroy(r,e))),this.removeAbortListener&&(this.removeAbortListener(),this.removeAbortListener=null)}}e.exports=function e(t,s){if(void 0===s)return new Promise(((s,r)=>{e.call(this,t,((e,t)=>e?r(e):s(t)))}));try{const e=new l(t,s);this.dispatch(t,e)}catch(e){if("function"!=typeof s)throw e;const r=t?.opaque;queueMicrotask((()=>s(e,{opaque:r})))}},e.exports.RequestHandler=l},322:(e,t,s)=>{"use strict";const r=s(4589),{finished:n}=s(7075),{AsyncResource:A}=s(6698),{InvalidArgumentError:i,InvalidReturnValueError:o}=s(4465),a=s(2858),{addSignal:c,removeSignal:l}=s(3904);function h(){}class g extends A{constructor(e,t,s){if(!e||"object"!=typeof e)throw new i("invalid opts");const{signal:r,method:n,opaque:A,body:o,onInfo:l,responseHeaders:g}=e;try{if("function"!=typeof s)throw new i("invalid callback");if("function"!=typeof t)throw new i("invalid factory");if(r&&"function"!=typeof r.on&&"function"!=typeof r.addEventListener)throw new i("signal must be an EventEmitter or EventTarget");if("CONNECT"===n)throw new i("invalid method");if(l&&"function"!=typeof l)throw new i("invalid onInfo callback");super("UNDICI_STREAM")}catch(e){throw a.isStream(o)&&a.destroy(o.on("error",h),e),e}this.responseHeaders=g||null,this.opaque=A||null,this.factory=t,this.callback=s,this.res=null,this.abort=null,this.context=null,this.trailers=null,this.body=o,this.onInfo=l||null,a.isStream(o)&&o.on("error",(e=>{this.onError(e)})),c(this,r)}onConnect(e,t){this.reason?e(this.reason):(r(this.callback),this.abort=e,this.context=t)}onHeaders(e,t,s,r){const{factory:A,opaque:i,context:c,responseHeaders:l}=this,h="raw"===l?a.parseRawHeaders(t):a.parseHeaders(t);if(e<200)return void(this.onInfo&&this.onInfo({statusCode:e,headers:h}));if(this.factory=null,null===A)return;const g=this.runInAsyncScope(A,null,{statusCode:e,headers:h,opaque:i,context:c});if(!g||"function"!=typeof g.write||"function"!=typeof g.end||"function"!=typeof g.on)throw new o("expected Writable");n(g,{readable:!1},(e=>{const{callback:t,res:s,opaque:r,trailers:n,abort:A}=this;this.res=null,!e&&s?.readable||a.destroy(s,e),this.callback=null,this.runInAsyncScope(t,null,e||null,{opaque:r,trailers:n}),e&&A()})),g.on("drain",s),this.res=g;return!0!==(void 0!==g.writableNeedDrain?g.writableNeedDrain:g._writableState?.needDrain)}onData(e){const{res:t}=this;return!t||t.write(e)}onComplete(e){const{res:t}=this;l(this),t&&(this.trailers=a.parseHeaders(e),t.end())}onError(e){const{res:t,callback:s,opaque:r,body:n}=this;l(this),this.factory=null,t?(this.res=null,a.destroy(t,e)):s&&(this.callback=null,queueMicrotask((()=>{this.runInAsyncScope(s,null,e,{opaque:r})}))),n&&(this.body=null,a.destroy(n,e))}}e.exports=function e(t,s,r){if(void 0===r)return new Promise(((r,n)=>{e.call(this,t,s,((e,t)=>e?n(e):r(t)))}));try{const e=new g(t,s,r);this.dispatch(t,e)}catch(e){if("function"!=typeof r)throw e;const s=t?.opaque;queueMicrotask((()=>r(e,{opaque:s})))}}},3936:(e,t,s)=>{"use strict";const{InvalidArgumentError:r,SocketError:n}=s(4465),{AsyncResource:A}=s(6698),i=s(4589),o=s(2858),{addSignal:a,removeSignal:c}=s(3904);class l extends A{constructor(e,t){if(!e||"object"!=typeof e)throw new r("invalid opts");if("function"!=typeof t)throw new r("invalid callback");const{signal:s,opaque:n,responseHeaders:A}=e;if(s&&"function"!=typeof s.on&&"function"!=typeof s.addEventListener)throw new r("signal must be an EventEmitter or EventTarget");super("UNDICI_UPGRADE"),this.responseHeaders=A||null,this.opaque=n||null,this.callback=t,this.abort=null,this.context=null,a(this,s)}onConnect(e,t){this.reason?e(this.reason):(i(this.callback),this.abort=e,this.context=null)}onHeaders(){throw new n("bad upgrade",null)}onUpgrade(e,t,s){i(101===e);const{callback:r,opaque:n,context:A}=this;c(this),this.callback=null;const a="raw"===this.responseHeaders?o.parseRawHeaders(t):o.parseHeaders(t);this.runInAsyncScope(r,null,null,{headers:a,socket:s,opaque:n,context:A})}onError(e){const{callback:t,opaque:s}=this;c(this),t&&(this.callback=null,queueMicrotask((()=>{this.runInAsyncScope(t,null,e,{opaque:s})})))}}e.exports=function e(t,s){if(void 0===s)return new Promise(((s,r)=>{e.call(this,t,((e,t)=>e?r(e):s(t)))}));try{const e=new l(t,s),r={...t,method:t.method||"GET",upgrade:t.protocol||"Websocket"};this.dispatch(r,e)}catch(e){if("function"!=typeof s)throw e;const r=t?.opaque;queueMicrotask((()=>s(e,{opaque:r})))}}},9713:(e,t,s)=>{"use strict";e.exports.request=s(7745),e.exports.stream=s(322),e.exports.pipeline=s(8660),e.exports.upgrade=s(3936),e.exports.connect=s(3102)},777:(e,t,s)=>{"use strict";const r=s(4589),{Readable:n}=s(7075),{RequestAbortedError:A,NotSupportedError:i,InvalidArgumentError:o,AbortError:a}=s(4465),c=s(2858),{ReadableStreamFrom:l}=s(2858),h=Symbol("kConsume"),g=Symbol("kReading"),d=Symbol("kBody"),u=Symbol("kAbort"),E=Symbol("kContentType"),I=Symbol("kContentLength"),C=Symbol("kUsed"),B=Symbol("kBytesRead"),Q=()=>{};function p(e){return c.isDisturbed(e)||function(e){return!0===e[d]?.locked||null!==e[h]}(e)}function f(e,t){return r(!e[h]),new Promise(((s,r)=>{if(p(e)){const t=e._readableState;t.destroyed&&!1===t.closeEmitted?e.on("error",r).on("close",(()=>{r(new TypeError("unusable"))})):r(t.errored??new TypeError("unusable"))}else queueMicrotask((()=>{e[h]={type:t,stream:e,resolve:s,reject:r,length:0,body:[]},e.on("error",(function(e){D(this[h],e)})).on("close",(function(){null!==this[h].body&&D(this[h],new A)})),function(e){if(null===e.body)return;const{_readableState:t}=e.stream;if(t.bufferIndex){const s=t.bufferIndex,r=t.buffer.length;for(let n=s;n<r;n++)S(e,t.buffer[n])}else for(const s of t.buffer)S(e,s);t.endEmitted?w(this[h],this._readableState.encoding):e.stream.on("end",(function(){w(this[h],this._readableState.encoding)}));e.stream.resume();for(;null!=e.stream.read(););}(e[h])}))}))}function m(e,t,s){if(0===e.length||0===t)return"";const r=1===e.length?e[0]:Buffer.concat(e,t),n=r.length,A=n>2&&239===r[0]&&187===r[1]&&191===r[2]?3:0;return s&&"utf8"!==s&&"utf-8"!==s?r.subarray(A,n).toString(s):r.utf8Slice(A,n)}function y(e,t){if(0===e.length||0===t)return new Uint8Array(0);if(1===e.length)return new Uint8Array(e[0]);const s=new Uint8Array(Buffer.allocUnsafeSlow(t).buffer);let r=0;for(let t=0;t<e.length;++t){const n=e[t];s.set(n,r),r+=n.length}return s}function w(e,t){const{type:s,body:r,resolve:n,stream:A,length:i}=e;try{"text"===s?n(m(r,i,t)):"json"===s?n(JSON.parse(m(r,i,t))):"arrayBuffer"===s?n(y(r,i).buffer):"blob"===s?n(new Blob(r,{type:A[E]})):"bytes"===s&&n(y(r,i)),D(e)}catch(e){A.destroy(e)}}function S(e,t){e.length+=t.length,e.body.push(t)}function D(e,t){null!==e.body&&(t?e.reject(t):e.resolve(),e.type=null,e.stream=null,e.resolve=null,e.reject=null,e.length=0,e.body=null)}e.exports={Readable:class extends n{constructor({resume:e,abort:t,contentType:s="",contentLength:r,highWaterMark:n=65536}){super({autoDestroy:!0,read:e,highWaterMark:n}),this._readableState.dataEmitted=!1,this[u]=t,this[h]=null,this[B]=0,this[d]=null,this[C]=!1,this[E]=s,this[I]=Number.isFinite(r)?r:null,this[g]=!1}_destroy(e,t){e||this._readableState.endEmitted||(e=new A),e&&this[u](),this[C]?t(e):setImmediate(t,e)}on(e,t){return"data"!==e&&"readable"!==e||(this[g]=!0,this[C]=!0),super.on(e,t)}addListener(e,t){return this.on(e,t)}off(e,t){const s=super.off(e,t);return"data"!==e&&"readable"!==e||(this[g]=this.listenerCount("data")>0||this.listenerCount("readable")>0),s}removeListener(e,t){return this.off(e,t)}push(e){return e&&(this[B]+=e.length,this[h])?(S(this[h],e),!this[g]||super.push(e)):super.push(e)}text(){return f(this,"text")}json(){return f(this,"json")}blob(){return f(this,"blob")}bytes(){return f(this,"bytes")}arrayBuffer(){return f(this,"arrayBuffer")}async formData(){throw new i}get bodyUsed(){return c.isDisturbed(this)}get body(){return this[d]||(this[d]=l(this),this[h]&&(this[d].getReader(),r(this[d].locked))),this[d]}dump(e){const t=e?.signal;if(null!=t&&("object"!=typeof t||!("aborted"in t)))return Promise.reject(new o("signal must be an AbortSignal"));const s=e?.limit&&Number.isFinite(e.limit)?e.limit:131072;return t?.aborted?Promise.reject(t.reason??new a):this._readableState.closeEmitted?Promise.resolve(null):new Promise(((e,r)=>{if((this[I]&&this[I]>s||this[B]>s)&&this.destroy(new a),t){const s=()=>{this.destroy(t.reason??new a)};t.addEventListener("abort",s),this.on("close",(function(){t.removeEventListener("abort",s),t.aborted?r(t.reason??new a):e(null)}))}else this.on("close",e);this.on("error",Q).on("data",(()=>{this[B]>s&&this.destroy()})).resume()}))}setEncoding(e){return Buffer.isEncoding(e)&&(this._readableState.encoding=e),this}},chunksDecode:m}},9903:(e,t,s)=>{"use strict";const{Writable:r}=s(7075),{EventEmitter:n}=s(8474),{assertCacheKey:A,assertCacheValue:i}=s(9453);function o(e,t,s){return t.find((t=>t.deleteAt>s&&t.method===e.method&&(null==t.vary||Object.keys(t.vary).every((s=>null===t.vary[s]?void 0===e.headers[s]:t.vary[s]===e.headers[s])))))}e.exports=class extends n{#e=1024;#t=104857600;#s=5242880;#r=0;#n=0;#A=new Map;#i=!1;constructor(e){if(super(),e){if("object"!=typeof e)throw new TypeError("MemoryCacheStore options must be an object");if(void 0!==e.maxCount){if("number"!=typeof e.maxCount||!Number.isInteger(e.maxCount)||e.maxCount<0)throw new TypeError("MemoryCacheStore options.maxCount must be a non-negative integer");this.#e=e.maxCount}if(void 0!==e.maxSize){if("number"!=typeof e.maxSize||!Number.isInteger(e.maxSize)||e.maxSize<0)throw new TypeError("MemoryCacheStore options.maxSize must be a non-negative integer");this.#t=e.maxSize}if(void 0!==e.maxEntrySize){if("number"!=typeof e.maxEntrySize||!Number.isInteger(e.maxEntrySize)||e.maxEntrySize<0)throw new TypeError("MemoryCacheStore options.maxEntrySize must be a non-negative integer");this.#s=e.maxEntrySize}}}get size(){return this.#r}isFull(){return this.#r>=this.#t||this.#n>=this.#e}get(e){A(e);const t=`${e.origin}:${e.path}`,s=Date.now(),r=this.#A.get(t),n=r?o(e,r,s):null;return null==n?void 0:{statusMessage:n.statusMessage,statusCode:n.statusCode,headers:n.headers,body:n.body,vary:n.vary?n.vary:void 0,etag:n.etag,cacheControlDirectives:n.cacheControlDirectives,cachedAt:n.cachedAt,staleAt:n.staleAt,deleteAt:n.deleteAt}}createWriteStream(e,t){A(e),i(t);const s=`${e.origin}:${e.path}`,n=this,a={...e,...t,body:[],size:0};return new r({write(e,t,s){"string"==typeof e&&(e=Buffer.from(e,t)),a.size+=e.byteLength,a.size>=n.#s?this.destroy():a.body.push(e),s(null)},final(t){let r=n.#A.get(s);r||(r=[],n.#A.set(s,r));const A=o(e,r,Date.now());if(A){const e=r.indexOf(A);r.splice(e,1,a),n.#r-=A.size}else r.push(a),n.#n+=1;if(n.#r+=a.size,n.#r>n.#t||n.#n>n.#e){n.#i||(n.emit("maxSizeExceeded",{size:n.#r,maxSize:n.#t,count:n.#n,maxCount:n.#e}),n.#i=!0);for(const[e,t]of n.#A){for(const e of t.splice(0,t.length/2))n.#r-=e.size,n.#n-=1;0===t.length&&n.#A.delete(e)}n.#r<n.#t&&n.#n<n.#e&&(n.#i=!1)}t(null)}})}delete(e){if("object"!=typeof e)throw new TypeError("expected key to be object, got "+typeof e);const t=`${e.origin}:${e.path}`;for(const e of this.#A.get(t)??[])this.#r-=e.size,this.#n-=1;this.#A.delete(t)}}},2636:(e,t,s)=>{"use strict";const{Writable:r}=s(7075),{assertCacheKey:n,assertCacheValue:A}=s(9453);let i;const o=2e9;function a(e,t){return null==e&&null==t||!(null==e&&null!=t||null!=e&&null==t)&&(Array.isArray(e)&&Array.isArray(t)?e.length===t.length&&e.every(((e,s)=>e===t[s])):e===t)}e.exports=class{#s=o;#e=1/0;#o;#a;#c;#l;#h;#g;#d;#u;constructor(e){if(e){if("object"!=typeof e)throw new TypeError("SqliteCacheStore options must be an object");if(void 0!==e.maxEntrySize){if("number"!=typeof e.maxEntrySize||!Number.isInteger(e.maxEntrySize)||e.maxEntrySize<0)throw new TypeError("SqliteCacheStore options.maxEntrySize must be a non-negative integer");if(e.maxEntrySize>o)throw new TypeError("SqliteCacheStore options.maxEntrySize must be less than 2gb");this.#s=e.maxEntrySize}if(void 0!==e.maxCount){if("number"!=typeof e.maxCount||!Number.isInteger(e.maxCount)||e.maxCount<0)throw new TypeError("SqliteCacheStore options.maxCount must be a non-negative integer");this.#e=e.maxCount}}i||(i=s(99).DatabaseSync),this.#o=new i(e?.location??":memory:"),this.#o.exec("\n PRAGMA journal_mode = WAL;\n PRAGMA synchronous = NORMAL;\n PRAGMA temp_store = memory;\n PRAGMA optimize;\n\n CREATE TABLE IF NOT EXISTS cacheInterceptorV3 (\n -- Data specific to us\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n url TEXT NOT NULL,\n method TEXT NOT NULL,\n\n -- Data returned to the interceptor\n body BUF NULL,\n deleteAt INTEGER NOT NULL,\n statusCode INTEGER NOT NULL,\n statusMessage TEXT NOT NULL,\n headers TEXT NULL,\n cacheControlDirectives TEXT NULL,\n etag TEXT NULL,\n vary TEXT NULL,\n cachedAt INTEGER NOT NULL,\n staleAt INTEGER NOT NULL\n );\n\n CREATE INDEX IF NOT EXISTS idx_cacheInterceptorV3_getValuesQuery ON cacheInterceptorV3(url, method, deleteAt);\n CREATE INDEX IF NOT EXISTS idx_cacheInterceptorV3_deleteByUrlQuery ON cacheInterceptorV3(deleteAt);\n "),this.#a=this.#o.prepare("\n SELECT\n id,\n body,\n deleteAt,\n statusCode,\n statusMessage,\n headers,\n etag,\n cacheControlDirectives,\n vary,\n cachedAt,\n staleAt\n FROM cacheInterceptorV3\n WHERE\n url = ?\n AND method = ?\n ORDER BY\n deleteAt ASC\n "),this.#c=this.#o.prepare("\n UPDATE cacheInterceptorV3 SET\n body = ?,\n deleteAt = ?,\n statusCode = ?,\n statusMessage = ?,\n headers = ?,\n etag = ?,\n cacheControlDirectives = ?,\n cachedAt = ?,\n staleAt = ?\n WHERE\n id = ?\n "),this.#l=this.#o.prepare("\n INSERT INTO cacheInterceptorV3 (\n url,\n method,\n body,\n deleteAt,\n statusCode,\n statusMessage,\n headers,\n etag,\n cacheControlDirectives,\n vary,\n cachedAt,\n staleAt\n ) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)\n "),this.#g=this.#o.prepare("DELETE FROM cacheInterceptorV3 WHERE url = ?"),this.#d=this.#o.prepare("SELECT COUNT(*) AS total FROM cacheInterceptorV3"),this.#h=this.#o.prepare("DELETE FROM cacheInterceptorV3 WHERE deleteAt <= ?"),this.#u=this.#e===1/0?null:this.#o.prepare("\n DELETE FROM cacheInterceptorV3\n WHERE id IN (\n SELECT\n id\n FROM cacheInterceptorV3\n ORDER BY cachedAt DESC\n LIMIT ?\n )\n ")}close(){this.#o.close()}get(e){n(e);const t=this.#E(e);return t?{body:t.body?Buffer.from(t.body.buffer,t.body.byteOffset,t.body.byteLength):void 0,statusCode:t.statusCode,statusMessage:t.statusMessage,headers:t.headers?JSON.parse(t.headers):void 0,etag:t.etag?t.etag:void 0,vary:t.vary?JSON.parse(t.vary):void 0,cacheControlDirectives:t.cacheControlDirectives?JSON.parse(t.cacheControlDirectives):void 0,cachedAt:t.cachedAt,staleAt:t.staleAt,deleteAt:t.deleteAt}:void 0}set(e,t){n(e);const s=this.#I(e),r=Array.isArray(t.body)?Buffer.concat(t.body):t.body,A=r?.byteLength;if(A&&A>this.#s)return;const i=this.#E(e,!0);i?this.#c.run(r,t.deleteAt,t.statusCode,t.statusMessage,t.headers?JSON.stringify(t.headers):null,t.etag?t.etag:null,t.cacheControlDirectives?JSON.stringify(t.cacheControlDirectives):null,t.cachedAt,t.staleAt,i.id):(this.#C(),this.#l.run(s,e.method,r,t.deleteAt,t.statusCode,t.statusMessage,t.headers?JSON.stringify(t.headers):null,t.etag?t.etag:null,t.cacheControlDirectives?JSON.stringify(t.cacheControlDirectives):null,t.vary?JSON.stringify(t.vary):null,t.cachedAt,t.staleAt))}createWriteStream(e,t){n(e),A(t);let s=0;const i=[],o=this;return new r({decodeStrings:!0,write(e,t,r){s+=e.byteLength,s<o.#s?i.push(e):this.destroy(),r()},final(s){o.set(e,{...t,body:i}),s()}})}delete(e){if("object"!=typeof e)throw new TypeError("expected key to be object, got "+typeof e);this.#g.run(this.#I(e))}#C(){if(Number.isFinite(this.#e)&&this.size<=this.#e)return 0;{const e=this.#h.run(Date.now()).changes;if(e)return e}{const e=this.#u?.run(Math.max(Math.floor(.1*this.#e),1)).changes;if(e)return e}return 0}get size(){const{total:e}=this.#d.get();return e}#I(e){return`${e.origin}/${e.path}`}#E(e,t=!1){const s=this.#I(e),{headers:r,method:n}=e,A=this.#a.all(s,n);if(0===A.length)return;const i=Date.now();for(const e of A){if(i>=e.deleteAt&&!t)return;let s=!0;if(e.vary){const t=JSON.parse(e.vary);for(const e in t)if(!a(r[e],t[e])){s=!1;break}}if(s)return e}}}},1986:(e,t,s)=>{"use strict";const r=s(7030),n=s(4589),A=s(2858),{InvalidArgumentError:i}=s(4465);let o;const a=class{constructor(e){this._maxCachedSessions=e,this._sessionCache=new Map,this._sessionRegistry=new FinalizationRegistry((e=>{if(this._sessionCache.size<this._maxCachedSessions)return;const t=this._sessionCache.get(e);void 0!==t&&void 0===t.deref()&&this._sessionCache.delete(e)}))}get(e){const t=this._sessionCache.get(e);return t?t.deref():null}set(e,t){0!==this._maxCachedSessions&&(this._sessionCache.set(e,new WeakRef(t)),this._sessionRegistry.register(t,e))}};e.exports=function({allowH2:e,maxCachedSessions:t,socketPath:c,timeout:l,session:h,...g}){if(null!=t&&(!Number.isInteger(t)||t<0))throw new i("maxCachedSessions must be a positive integer or zero");const d={path:c,...g},u=new a(null==t?100:t);return l=null==l?1e4:l,e=null!=e&&e,function({hostname:t,host:i,protocol:a,port:c,servername:g,localAddress:E,httpSocket:I},C){let B;if("https:"===a){o||(o=s(1692));const r=(g=g||d.servername||A.getServerName(i)||null)||t;n(r);const a=h||u.get(r)||null;c=c||443,B=o.connect({highWaterMark:16384,...d,servername:g,session:a,localAddress:E,ALPNProtocols:e?["http/1.1","h2"]:["http/1.1"],socket:I,port:c,host:t}),B.on("session",(function(e){u.set(r,e)}))}else n(!I,"httpSocket can only be sent on TLS update"),c=c||80,B=r.connect({highWaterMark:65536,...d,localAddress:E,port:c,host:t});if(null==d.keepAlive||d.keepAlive){const e=void 0===d.keepAliveInitialDelay?6e4:d.keepAliveInitialDelay;B.setKeepAlive(!0,e)}const Q=A.setupConnectTimeout(new WeakRef(B),{timeout:l,hostname:t,port:c});return B.setNoDelay(!0).once("https:"===a?"secureConnect":"connect",(function(){if(queueMicrotask(Q),C){const e=C;C=null,e(null,this)}})).on("error",(function(e){if(queueMicrotask(Q),C){const t=C;C=null,t(e)}})),B}}},9605:e=>{"use strict";const t=["Accept","Accept-Encoding","Accept-Language","Accept-Ranges","Access-Control-Allow-Credentials","Access-Control-Allow-Headers","Access-Control-Allow-Methods","Access-Control-Allow-Origin","Access-Control-Expose-Headers","Access-Control-Max-Age","Access-Control-Request-Headers","Access-Control-Request-Method","Age","Allow","Alt-Svc","Alt-Used","Authorization","Cache-Control","Clear-Site-Data","Connection","Content-Disposition","Content-Encoding","Content-Language","Content-Length","Content-Location","Content-Range","Content-Security-Policy","Content-Security-Policy-Report-Only","Content-Type","Cookie","Cross-Origin-Embedder-Policy","Cross-Origin-Opener-Policy","Cross-Origin-Resource-Policy","Date","Device-Memory","Downlink","ECT","ETag","Expect","Expect-CT","Expires","Forwarded","From","Host","If-Match","If-Modified-Since","If-None-Match","If-Range","If-Unmodified-Since","Keep-Alive","Last-Modified","Link","Location","Max-Forwards","Origin","Permissions-Policy","Pragma","Proxy-Authenticate","Proxy-Authorization","RTT","Range","Referer","Referrer-Policy","Refresh","Retry-After","Sec-WebSocket-Accept","Sec-WebSocket-Extensions","Sec-WebSocket-Key","Sec-WebSocket-Protocol","Sec-WebSocket-Version","Server","Server-Timing","Service-Worker-Allowed","Service-Worker-Navigation-Preload","Set-Cookie","SourceMap","Strict-Transport-Security","Supports-Loading-Mode","TE","Timing-Allow-Origin","Trailer","Transfer-Encoding","Upgrade","Upgrade-Insecure-Requests","User-Agent","Vary","Via","WWW-Authenticate","X-Content-Type-Options","X-DNS-Prefetch-Control","X-Frame-Options","X-Permitted-Cross-Domain-Policies","X-Powered-By","X-Requested-With","X-XSS-Protection"],s={};Object.setPrototypeOf(s,null);const r={};Object.setPrototypeOf(r,null);for(let e=0;e<t.length;++e){const r=t[e],n=r.toLowerCase();s[r]=s[n]=n}e.exports={wellknownHeaderNames:t,headerNameLowerCasedRecord:s,getHeaderNameAsBuffer:function(e){let t=r[e];return void 0===t&&(t=Buffer.from(e)),t}}},772:(e,t,s)=>{"use strict";const r=s(3053),n=s(7975),A=n.debuglog("undici"),i=n.debuglog("fetch"),o=n.debuglog("websocket"),a={beforeConnect:r.channel("undici:client:beforeConnect"),connected:r.channel("undici:client:connected"),connectError:r.channel("undici:client:connectError"),sendHeaders:r.channel("undici:client:sendHeaders"),create:r.channel("undici:request:create"),bodySent:r.channel("undici:request:bodySent"),bodyChunkSent:r.channel("undici:request:bodyChunkSent"),bodyChunkReceived:r.channel("undici:request:bodyChunkReceived"),headers:r.channel("undici:request:headers"),trailers:r.channel("undici:request:trailers"),error:r.channel("undici:request:error"),open:r.channel("undici:websocket:open"),close:r.channel("undici:websocket:close"),socketError:r.channel("undici:websocket:socket_error"),ping:r.channel("undici:websocket:ping"),pong:r.channel("undici:websocket:pong")};let c=!1;function l(e=A){c||(c=!0,r.subscribe("undici:client:beforeConnect",(t=>{const{connectParams:{version:s,protocol:r,port:n,host:A}}=t;e("connecting to %s%s using %s%s",A,n?`:${n}`:"",r,s)})),r.subscribe("undici:client:connected",(t=>{const{connectParams:{version:s,protocol:r,port:n,host:A}}=t;e("connected to %s%s using %s%s",A,n?`:${n}`:"",r,s)})),r.subscribe("undici:client:connectError",(t=>{const{connectParams:{version:s,protocol:r,port:n,host:A},error:i}=t;e("connection to %s%s using %s%s errored - %s",A,n?`:${n}`:"",r,s,i.message)})),r.subscribe("undici:client:sendHeaders",(t=>{const{request:{method:s,path:r,origin:n}}=t;e("sending request to %s %s%s",s,n,r)})))}let h=!1;let g=!1;(A.enabled||i.enabled)&&(l(i.enabled?i:A),function(e=A){h||(h=!0,r.subscribe("undici:request:headers",(t=>{const{request:{method:s,path:r,origin:n},response:{statusCode:A}}=t;e("received response to %s %s%s - HTTP %d",s,n,r,A)})),r.subscribe("undici:request:trailers",(t=>{const{request:{method:s,path:r,origin:n}}=t;e("trailers received from %s %s%s",s,n,r)})),r.subscribe("undici:request:error",(t=>{const{request:{method:s,path:r,origin:n},error:A}=t;e("request to %s %s%s errored - %s",s,n,r,A.message)})))}(i.enabled?i:A)),o.enabled&&(l(A.enabled?A:o),function(e=o){g||(g=!0,r.subscribe("undici:websocket:open",(t=>{const{address:{address:s,port:r}}=t;e("connection opened %s%s",s,r?`:${r}`:"")})),r.subscribe("undici:websocket:close",(t=>{const{websocket:s,code:r,reason:n}=t;e("closed connection to %s - %s %s",s.url,r,n)})),r.subscribe("undici:websocket:socket_error",(t=>{e("connection errored - %s",t.message)})),r.subscribe("undici:websocket:ping",(t=>{e("ping received")})),r.subscribe("undici:websocket:pong",(t=>{e("pong received")})))}(o)),e.exports={channels:a}},4465:e=>{"use strict";const t=Symbol.for("undici.error.UND_ERR");class s extends Error{constructor(e,t){super(e,t),this.name="UndiciError",this.code="UND_ERR"}static[Symbol.hasInstance](e){return e&&!0===e[t]}get[t](){return!0}}const r=Symbol.for("undici.error.UND_ERR_CONNECT_TIMEOUT");class n extends s{constructor(e){super(e),this.name="ConnectTimeoutError",this.message=e||"Connect Timeout Error",this.code="UND_ERR_CONNECT_TIMEOUT"}static[Symbol.hasInstance](e){return e&&!0===e[r]}get[r](){return!0}}const A=Symbol.for("undici.error.UND_ERR_HEADERS_TIMEOUT");class i extends s{constructor(e){super(e),this.name="HeadersTimeoutError",this.message=e||"Headers Timeout Error",this.code="UND_ERR_HEADERS_TIMEOUT"}static[Symbol.hasInstance](e){return e&&!0===e[A]}get[A](){return!0}}const o=Symbol.for("undici.error.UND_ERR_HEADERS_OVERFLOW");class a extends s{constructor(e){super(e),this.name="HeadersOverflowError",this.message=e||"Headers Overflow Error",this.code="UND_ERR_HEADERS_OVERFLOW"}static[Symbol.hasInstance](e){return e&&!0===e[o]}get[o](){return!0}}const c=Symbol.for("undici.error.UND_ERR_BODY_TIMEOUT");class l extends s{constructor(e){super(e),this.name="BodyTimeoutError",this.message=e||"Body Timeout Error",this.code="UND_ERR_BODY_TIMEOUT"}static[Symbol.hasInstance](e){return e&&!0===e[c]}get[c](){return!0}}const h=Symbol.for("undici.error.UND_ERR_INVALID_ARG");class g extends s{constructor(e){super(e),this.name="InvalidArgumentError",this.message=e||"Invalid Argument Error",this.code="UND_ERR_INVALID_ARG"}static[Symbol.hasInstance](e){return e&&!0===e[h]}get[h](){return!0}}const d=Symbol.for("undici.error.UND_ERR_INVALID_RETURN_VALUE");class u extends s{constructor(e){super(e),this.name="InvalidReturnValueError",this.message=e||"Invalid Return Value Error",this.code="UND_ERR_INVALID_RETURN_VALUE"}static[Symbol.hasInstance](e){return e&&!0===e[d]}get[d](){return!0}}const E=Symbol.for("undici.error.UND_ERR_ABORT");class I extends s{constructor(e){super(e),this.name="AbortError",this.message=e||"The operation was aborted",this.code="UND_ERR_ABORT"}static[Symbol.hasInstance](e){return e&&!0===e[E]}get[E](){return!0}}const C=Symbol.for("undici.error.UND_ERR_ABORTED");class B extends I{constructor(e){super(e),this.name="AbortError",this.message=e||"Request aborted",this.code="UND_ERR_ABORTED"}static[Symbol.hasInstance](e){return e&&!0===e[C]}get[C](){return!0}}const Q=Symbol.for("undici.error.UND_ERR_INFO");class p extends s{constructor(e){super(e),this.name="InformationalError",this.message=e||"Request information",this.code="UND_ERR_INFO"}static[Symbol.hasInstance](e){return e&&!0===e[Q]}get[Q](){return!0}}const f=Symbol.for("undici.error.UND_ERR_REQ_CONTENT_LENGTH_MISMATCH");class m extends s{constructor(e){super(e),this.name="RequestContentLengthMismatchError",this.message=e||"Request body length does not match content-length header",this.code="UND_ERR_REQ_CONTENT_LENGTH_MISMATCH"}static[Symbol.hasInstance](e){return e&&!0===e[f]}get[f](){return!0}}const y=Symbol.for("undici.error.UND_ERR_RES_CONTENT_LENGTH_MISMATCH");class w extends s{constructor(e){super(e),this.name="ResponseContentLengthMismatchError",this.message=e||"Response body length does not match content-length header",this.code="UND_ERR_RES_CONTENT_LENGTH_MISMATCH"}static[Symbol.hasInstance](e){return e&&!0===e[y]}get[y](){return!0}}const S=Symbol.for("undici.error.UND_ERR_DESTROYED");class D extends s{constructor(e){super(e),this.name="ClientDestroyedError",this.message=e||"The client is destroyed",this.code="UND_ERR_DESTROYED"}static[Symbol.hasInstance](e){return e&&!0===e[S]}get[S](){return!0}}const b=Symbol.for("undici.error.UND_ERR_CLOSED");class v extends s{constructor(e){super(e),this.name="ClientClosedError",this.message=e||"The client is closed",this.code="UND_ERR_CLOSED"}static[Symbol.hasInstance](e){return e&&!0===e[b]}get[b](){return!0}}const N=Symbol.for("undici.error.UND_ERR_SOCKET");class R extends s{constructor(e,t){super(e),this.name="SocketError",this.message=e||"Socket error",this.code="UND_ERR_SOCKET",this.socket=t}static[Symbol.hasInstance](e){return e&&!0===e[N]}get[N](){return!0}}const k=Symbol.for("undici.error.UND_ERR_NOT_SUPPORTED");class T extends s{constructor(e){super(e),this.name="NotSupportedError",this.message=e||"Not supported error",this.code="UND_ERR_NOT_SUPPORTED"}static[Symbol.hasInstance](e){return e&&!0===e[k]}get[k](){return!0}}const F=Symbol.for("undici.error.UND_ERR_BPL_MISSING_UPSTREAM");class M extends s{constructor(e){super(e),this.name="MissingUpstreamError",this.message=e||"No upstream has been added to the BalancedPool",this.code="UND_ERR_BPL_MISSING_UPSTREAM"}static[Symbol.hasInstance](e){return e&&!0===e[F]}get[F](){return!0}}const U=Symbol.for("undici.error.UND_ERR_HTTP_PARSER");class L extends Error{constructor(e,t,s){super(e),this.name="HTTPParserError",this.code=t?`HPE_${t}`:void 0,this.data=s?s.toString():void 0}static[Symbol.hasInstance](e){return e&&!0===e[U]}get[U](){return!0}}const H=Symbol.for("undici.error.UND_ERR_RES_EXCEEDED_MAX_SIZE");class P extends s{constructor(e){super(e),this.name="ResponseExceededMaxSizeError",this.message=e||"Response content exceeded max size",this.code="UND_ERR_RES_EXCEEDED_MAX_SIZE"}static[Symbol.hasInstance](e){return e&&!0===e[H]}get[H](){return!0}}const x=Symbol.for("undici.error.UND_ERR_REQ_RETRY");class Y extends s{constructor(e,t,{headers:s,data:r}){super(e),this.name="RequestRetryError",this.message=e||"Request retry error",this.code="UND_ERR_REQ_RETRY",this.statusCode=t,this.data=r,this.headers=s}static[Symbol.hasInstance](e){return e&&!0===e[x]}get[x](){return!0}}const V=Symbol.for("undici.error.UND_ERR_RESPONSE");class O extends s{constructor(e,t,{headers:s,body:r}){super(e),this.name="ResponseError",this.message=e||"Response error",this.code="UND_ERR_RESPONSE",this.statusCode=t,this.body=r,this.headers=s}static[Symbol.hasInstance](e){return e&&!0===e[V]}get[V](){return!0}}const G=Symbol.for("undici.error.UND_ERR_PRX_TLS");class J extends s{constructor(e,t,s={}){super(t,{cause:e,...s}),this.name="SecureProxyConnectionError",this.message=t||"Secure Proxy Connection failed",this.code="UND_ERR_PRX_TLS",this.cause=e}static[Symbol.hasInstance](e){return e&&!0===e[G]}get[G](){return!0}}const W=Symbol.for("undici.error.UND_ERR_MAX_ORIGINS_REACHED");class _ extends s{constructor(e){super(e),this.name="MaxOriginsReachedError",this.message=e||"Maximum allowed origins reached",this.code="UND_ERR_MAX_ORIGINS_REACHED"}static[Symbol.hasInstance](e){return e&&!0===e[W]}get[W](){return!0}}e.exports={AbortError:I,HTTPParserError:L,UndiciError:s,HeadersTimeoutError:i,HeadersOverflowError:a,BodyTimeoutError:l,RequestContentLengthMismatchError:m,ConnectTimeoutError:n,InvalidArgumentError:g,InvalidReturnValueError:u,RequestAbortedError:B,ClientDestroyedError:D,ClientClosedError:v,InformationalError:p,SocketError:R,NotSupportedError:T,ResponseContentLengthMismatchError:w,BalancedPoolMissingUpstreamError:M,ResponseExceededMaxSizeError:P,RequestRetryError:Y,ResponseError:O,SecureProxyConnectionError:J,MaxOriginsReachedError:_}},5837:(e,t,s)=>{"use strict";const{InvalidArgumentError:r,NotSupportedError:n}=s(4465),A=s(4589),{isValidHTTPToken:i,isValidHeaderValue:o,isStream:a,destroy:c,isBuffer:l,isFormDataLike:h,isIterable:g,isBlobLike:d,serializePathWithQuery:u,assertRequestHandler:E,getServerName:I,normalizedMethodRecords:C,getProtocolFromUrlString:B}=s(2858),{channels:Q}=s(772),{headerNameLowerCasedRecord:p}=s(9605),f=/[^\u0021-\u00ff]/,m=Symbol("handler");function y(e,t,s){if(s&&"object"==typeof s&&!Array.isArray(s))throw new r(`invalid ${t} header`);if(void 0===s)return;let A=p[t];if(void 0===A&&(A=t.toLowerCase(),void 0===p[A]&&!i(A)))throw new r("invalid header key");if(Array.isArray(s)){const e=[];for(let n=0;n<s.length;n++)if("string"==typeof s[n]){if(!o(s[n]))throw new r(`invalid ${t} header`);e.push(s[n])}else if(null===s[n])e.push("");else{if("object"==typeof s[n])throw new r(`invalid ${t} header`);e.push(`${s[n]}`)}s=e}else if("string"==typeof s){if(!o(s))throw new r(`invalid ${t} header`)}else s=null===s?"":`${s}`;if(null===e.host&&"host"===A){if("string"!=typeof s)throw new r("invalid host header");e.host=s}else if(null===e.contentLength&&"content-length"===A){if(e.contentLength=parseInt(s,10),!Number.isFinite(e.contentLength))throw new r("invalid content-length header")}else if(null===e.contentType&&"content-type"===A)e.contentType=s,e.headers.push(t,s);else{if("transfer-encoding"===A||"keep-alive"===A||"upgrade"===A)throw new r(`invalid ${A} header`);if("connection"===A){const t="string"==typeof s?s.toLowerCase():null;if("close"!==t&&"keep-alive"!==t)throw new r("invalid connection header");"close"===t&&(e.reset=!0)}else{if("expect"===A)throw new n("expect header not supported");e.headers.push(t,s)}}}e.exports=class{constructor(e,{path:t,method:s,body:n,headers:A,query:o,idempotent:p,blocking:w,upgrade:S,headersTimeout:D,bodyTimeout:b,reset:v,expectContinue:N,servername:R,throwOnError:k,maxRedirections:T},F){if("string"!=typeof t)throw new r("path must be a string");if("/"!==t[0]&&!t.startsWith("http://")&&!t.startsWith("https://")&&"CONNECT"!==s)throw new r("path must be an absolute URL or start with a slash");if(f.test(t))throw new r("invalid request path");if("string"!=typeof s)throw new r("method must be a string");if(void 0===C[s]&&!i(s))throw new r("invalid request method");if(S&&"string"!=typeof S)throw new r("upgrade must be a string");if(null!=D&&(!Number.isFinite(D)||D<0))throw new r("invalid headersTimeout");if(null!=b&&(!Number.isFinite(b)||b<0))throw new r("invalid bodyTimeout");if(null!=v&&"boolean"!=typeof v)throw new r("invalid reset");if(null!=N&&"boolean"!=typeof N)throw new r("invalid expectContinue");if(null!=k)throw new r("invalid throwOnError");if(null!=T&&0!==T)throw new r("maxRedirections is not supported, use the redirect interceptor");if(this.headersTimeout=D,this.bodyTimeout=b,this.method=s,this.abort=null,null==n)this.body=null;else if(a(n)){this.body=n;const e=this.body._readableState;e&&e.autoDestroy||(this.endHandler=function(){c(this)},this.body.on("end",this.endHandler)),this.errorHandler=e=>{this.abort?this.abort(e):this.error=e},this.body.on("error",this.errorHandler)}else if(l(n))this.body=n.byteLength?n:null;else if(ArrayBuffer.isView(n))this.body=n.buffer.byteLength?Buffer.from(n.buffer,n.byteOffset,n.byteLength):null;else if(n instanceof ArrayBuffer)this.body=n.byteLength?Buffer.from(n):null;else if("string"==typeof n)this.body=n.length?Buffer.from(n):null;else{if(!(h(n)||g(n)||d(n)))throw new r("body must be a string, a Buffer, a Readable stream, an iterable, or an async iterable");this.body=n}if(this.completed=!1,this.aborted=!1,this.upgrade=S||null,this.path=o?u(t,o):t,this.origin=e,this.protocol=B(e),this.idempotent=null==p?"HEAD"===s||"GET"===s:p,this.blocking=w??"HEAD"!==this.method,this.reset=null==v?null:v,this.host=null,this.contentLength=null,this.contentType=null,this.headers=[],this.expectContinue=null!=N&&N,Array.isArray(A)){if(A.length%2!=0)throw new r("headers array must be even");for(let e=0;e<A.length;e+=2)y(this,A[e],A[e+1])}else if(A&&"object"==typeof A)if(A[Symbol.iterator])for(const e of A){if(!Array.isArray(e)||2!==e.length)throw new r("headers must be in key-value pair format");y(this,e[0],e[1])}else{const e=Object.keys(A);for(let t=0;t<e.length;++t)y(this,e[t],A[e[t]])}else if(null!=A)throw new r("headers must be an object or an array");E(F,s,S),this.servername=R||I(this.host)||null,this[m]=F,Q.create.hasSubscribers&&Q.create.publish({request:this})}onBodySent(e){if(Q.bodyChunkSent.hasSubscribers&&Q.bodyChunkSent.publish({request:this,chunk:e}),this[m].onBodySent)try{return this[m].onBodySent(e)}catch(e){this.abort(e)}}onRequestSent(){if(Q.bodySent.hasSubscribers&&Q.bodySent.publish({request:this}),this[m].onRequestSent)try{return this[m].onRequestSent()}catch(e){this.abort(e)}}onConnect(e){if(A(!this.aborted),A(!this.completed),!this.error)return this.abort=e,this[m].onConnect(e);e(this.error)}onResponseStarted(){return this[m].onResponseStarted?.()}onHeaders(e,t,s,r){A(!this.aborted),A(!this.completed),Q.headers.hasSubscribers&&Q.headers.publish({request:this,response:{statusCode:e,headers:t,statusText:r}});try{return this[m].onHeaders(e,t,s,r)}catch(e){this.abort(e)}}onData(e){A(!this.aborted),A(!this.completed),Q.bodyChunkReceived.hasSubscribers&&Q.bodyChunkReceived.publish({request:this,chunk:e});try{return this[m].onData(e)}catch(e){return this.abort(e),!1}}onUpgrade(e,t,s){return A(!this.aborted),A(!this.completed),this[m].onUpgrade(e,t,s)}onComplete(e){this.onFinally(),A(!this.aborted),A(!this.completed),this.completed=!0,Q.trailers.hasSubscribers&&Q.trailers.publish({request:this,trailers:e});try{return this[m].onComplete(e)}catch(e){this.onError(e)}}onError(e){if(this.onFinally(),Q.error.hasSubscribers&&Q.error.publish({request:this,error:e}),!this.aborted)return this.aborted=!0,this[m].onError(e)}onFinally(){this.errorHandler&&(this.body.off("error",this.errorHandler),this.errorHandler=null),this.endHandler&&(this.body.off("end",this.endHandler),this.endHandler=null)}addHeader(e,t){return y(this,e,t),this}}},257:e=>{"use strict";e.exports={kClose:Symbol("close"),kDestroy:Symbol("destroy"),kDispatch:Symbol("dispatch"),kUrl:Symbol("url"),kWriting:Symbol("writing"),kResuming:Symbol("resuming"),kQueue:Symbol("queue"),kConnect:Symbol("connect"),kConnecting:Symbol("connecting"),kKeepAliveDefaultTimeout:Symbol("default keep alive timeout"),kKeepAliveMaxTimeout:Symbol("max keep alive timeout"),kKeepAliveTimeoutThreshold:Symbol("keep alive timeout threshold"),kKeepAliveTimeoutValue:Symbol("keep alive timeout"),kKeepAlive:Symbol("keep alive"),kHeadersTimeout:Symbol("headers timeout"),kBodyTimeout:Symbol("body timeout"),kServerName:Symbol("server name"),kLocalAddress:Symbol("local address"),kHost:Symbol("host"),kNoRef:Symbol("no ref"),kBodyUsed:Symbol("used"),kBody:Symbol("abstracted request body"),kRunning:Symbol("running"),kBlocking:Symbol("blocking"),kPending:Symbol("pending"),kSize:Symbol("size"),kBusy:Symbol("busy"),kQueued:Symbol("queued"),kFree:Symbol("free"),kConnected:Symbol("connected"),kClosed:Symbol("closed"),kNeedDrain:Symbol("need drain"),kReset:Symbol("reset"),kDestroyed:Symbol.for("nodejs.stream.destroyed"),kResume:Symbol("resume"),kOnError:Symbol("on error"),kMaxHeadersSize:Symbol("max headers size"),kRunningIdx:Symbol("running index"),kPendingIdx:Symbol("pending index"),kError:Symbol("error"),kClients:Symbol("clients"),kClient:Symbol("client"),kParser:Symbol("parser"),kOnDestroyed:Symbol("destroy callbacks"),kPipelining:Symbol("pipelining"),kSocket:Symbol("socket"),kHostHeader:Symbol("host header"),kConnector:Symbol("connector"),kStrictContentLength:Symbol("strict content length"),kMaxRedirections:Symbol("maxRedirections"),kMaxRequests:Symbol("maxRequestsPerClient"),kProxy:Symbol("proxy agent options"),kCounter:Symbol("socket request counter"),kMaxResponseSize:Symbol("max response size"),kHTTP2Session:Symbol("http2Session"),kHTTP2SessionState:Symbol("http2Session state"),kRetryHandlerDefaultRetry:Symbol("retry agent default retry"),kConstruct:Symbol("constructable"),kListeners:Symbol("listeners"),kHTTPContext:Symbol("http context"),kMaxConcurrentStreams:Symbol("max concurrent streams"),kNoProxyAgent:Symbol("no proxy agent"),kHttpProxyAgent:Symbol("http proxy agent"),kHttpsProxyAgent:Symbol("https proxy agent")}},1310:(e,t,s)=>{"use strict";const{wellknownHeaderNames:r,headerNameLowerCasedRecord:n}=s(9605);class A{value=null;left=null;middle=null;right=null;code;constructor(e,t,s){if(void 0===s||s>=e.length)throw new TypeError("Unreachable");if((this.code=e.charCodeAt(s))>127)throw new TypeError("key must be ascii string");e.length!==++s?this.middle=new A(e,t,s):this.value=t}add(e,t){const s=e.length;if(0===s)throw new TypeError("Unreachable");let r=0,n=this;for(;;){const i=e.charCodeAt(r);if(i>127)throw new TypeError("key must be ascii string");if(n.code===i){if(s===++r){n.value=t;break}if(null===n.middle){n.middle=new A(e,t,r);break}n=n.middle}else if(n.code<i){if(null===n.left){n.left=new A(e,t,r);break}n=n.left}else{if(null===n.right){n.right=new A(e,t,r);break}n=n.right}}}search(e){const t=e.length;let s=0,r=this;for(;null!==r&&s<t;){let n=e[s];for(n<=90&&n>=65&&(n|=32);null!==r;){if(n===r.code){if(t===++s)return r;r=r.middle;break}r=r.code<n?r.left:r.right}}return null}}class i{node=null;insert(e,t){null===this.node?this.node=new A(e,t,0):this.node.add(e,t)}lookup(e){return this.node?.search(e)?.value??null}}const o=new i;for(let e=0;e<r.length;++e){const t=n[r[e]];o.insert(t,t)}e.exports={TernarySearchTree:i,tree:o}},2858:(e,t,s)=>{"use strict";const r=s(4589),{kDestroyed:n,kBodyUsed:A,kListeners:i,kBody:o}=s(257),{IncomingMessage:a}=s(7067),c=s(7075),l=s(7030),{stringify:h}=s(1792),{EventEmitter:g}=s(8474),d=s(3801),{InvalidArgumentError:u,ConnectTimeoutError:E}=s(4465),{headerNameLowerCasedRecord:I}=s(9605),{tree:C}=s(1310),[B,Q]=process.versions.node.split(".",2).map((e=>Number(e)));class p{constructor(e){this[o]=e,this[A]=!1}async*[Symbol.asyncIterator](){r(!this[A],"disturbed"),this[A]=!0,yield*this[o]}}function f(){}function m(e){return e&&"object"==typeof e&&"function"==typeof e.pipe&&"function"==typeof e.on}function y(e){if(null===e)return!1;if(e instanceof Blob)return!0;if("object"!=typeof e)return!1;{const t=e[Symbol.toStringTag];return("Blob"===t||"File"===t)&&("stream"in e&&"function"==typeof e.stream||"arrayBuffer"in e&&"function"==typeof e.arrayBuffer)}}function w(e){return e.includes("?")||e.includes("#")}function S(e){const t=parseInt(e,10);return t===Number(e)&&t>=0&&t<=65535}function D(e){return null!=e&&"h"===e[0]&&"t"===e[1]&&"t"===e[2]&&"p"===e[3]&&(":"===e[4]||"s"===e[4]&&":"===e[5])}function b(e){if("string"==typeof e){if(!D((e=new URL(e)).origin||e.protocol))throw new u("Invalid URL protocol: the URL must start with `http:` or `https:`.");return e}if(!e||"object"!=typeof e)throw new u("Invalid URL: The URL argument must be a non-null object.");if(!(e instanceof URL)){if(null!=e.port&&""!==e.port&&!1===S(e.port))throw new u("Invalid URL: port must be a valid integer or a string representation of an integer.");if(null!=e.path&&"string"!=typeof e.path)throw new u("Invalid URL path: the path must be a string or null/undefined.");if(null!=e.pathname&&"string"!=typeof e.pathname)throw new u("Invalid URL pathname: the pathname must be a string or null/undefined.");if(null!=e.hostname&&"string"!=typeof e.hostname)throw new u("Invalid URL hostname: the hostname must be a string or null/undefined.");if(null!=e.origin&&"string"!=typeof e.origin)throw new u("Invalid URL origin: the origin must be a string or null/undefined.");if(!D(e.origin||e.protocol))throw new u("Invalid URL protocol: the URL must start with `http:` or `https:`.");const t=null!=e.port?e.port:"https:"===e.protocol?443:80;let s=null!=e.origin?e.origin:`${e.protocol||""}//${e.hostname||""}:${t}`,r=null!=e.path?e.path:`${e.pathname||""}${e.search||""}`;return"/"===s[s.length-1]&&(s=s.slice(0,s.length-1)),r&&"/"!==r[0]&&(r=`/${r}`),new URL(`${s}${r}`)}if(!D(e.origin||e.protocol))throw new u("Invalid URL protocol: the URL must start with `http:` or `https:`.");return e}function v(e){return!(null==e||"function"!=typeof e[Symbol.iterator]&&"function"!=typeof e[Symbol.asyncIterator])}function N(e){if(null==e)return 0;if(m(e)){const t=e._readableState;return t&&!1===t.objectMode&&!0===t.ended&&Number.isFinite(t.length)?t.length:null}return y(e)?null!=e.size?e.size:null:M(e)?e.byteLength:null}function R(e){return e&&!!(e.destroyed||e[n]||c.isDestroyed?.(e))}function k(e,t){null!=e&&m(e)&&!R(e)&&("function"==typeof e.destroy?(Object.getPrototypeOf(e).constructor===a&&(e.socket=null),e.destroy(t)):t&&queueMicrotask((()=>{e.emit("error",t)})),!0!==e.destroyed&&(e[n]=!0))}const T=/timeout=(\d+)/;function F(e){return"string"==typeof e?I[e]??e.toLowerCase():C.lookup(e)??e.toString("latin1").toLowerCase()}function M(e){return e instanceof Uint8Array||Buffer.isBuffer(e)}function U(e){switch(e){case 34:case 40:case 41:case 44:case 47:case 58:case 59:case 60:case 61:case 62:case 63:case 64:case 91:case 92:case 93:case 123:case 125:return!1;default:return e>=33&&e<=126}}const L=/[^\t\x20-\x7e\x80-\xff]/;const H=/^bytes (\d+)-(\d+)\/(\d+)?$/;const P="win32"===process.platform?(e,t)=>{if(!t.timeout)return f;let s=null,r=null;const n=d.setFastTimeout((()=>{s=setImmediate((()=>{r=setImmediate((()=>x(e.deref(),t)))}))}),t.timeout);return()=>{d.clearFastTimeout(n),clearImmediate(s),clearImmediate(r)}}:(e,t)=>{if(!t.timeout)return f;let s=null;const r=d.setFastTimeout((()=>{s=setImmediate((()=>{x(e.deref(),t)}))}),t.timeout);return()=>{d.clearFastTimeout(r),clearImmediate(s)}};function x(e,t){if(null==e)return;let s="Connect Timeout Error";Array.isArray(e.autoSelectFamilyAttemptedAddresses)?s+=` (attempted addresses: ${e.autoSelectFamilyAttemptedAddresses.join(", ")},`:s+=` (attempted address: ${t.hostname}:${t.port},`,s+=` timeout: ${t.timeout}ms)`,k(e,new E(s))}const Y=Object.create(null);Y.enumerable=!0;const V={delete:"DELETE",DELETE:"DELETE",get:"GET",GET:"GET",head:"HEAD",HEAD:"HEAD",options:"OPTIONS",OPTIONS:"OPTIONS",post:"POST",POST:"POST",put:"PUT",PUT:"PUT"},O={...V,patch:"patch",PATCH:"PATCH"};Object.setPrototypeOf(V,null),Object.setPrototypeOf(O,null),e.exports={kEnumerableProperty:Y,isDisturbed:function(e){return!(!e||!c.isDisturbed(e)&&!e[A])},isBlobLike:y,parseOrigin:function(e){if("/"!==(e=b(e)).pathname||e.search||e.hash)throw new u("invalid url");return e},parseURL:b,getServerName:function(e){if(!e)return null;r("string"==typeof e);const t=function(e){if("["===e[0]){const t=e.indexOf("]");return r(-1!==t),e.substring(1,t)}const t=e.indexOf(":");return-1===t?e:e.substring(0,t)}(e);return l.isIP(t)?"":t},isStream:m,isIterable:v,isAsyncIterable:function(e){return!(null==e||"function"!=typeof e[Symbol.asyncIterator])},isDestroyed:R,headerNameToString:F,bufferToLowerCasedHeaderName:function(e){return C.lookup(e)??e.toString("latin1").toLowerCase()},addListener:function(e,t,s){return(e[i]??=[]).push([t,s]),e.on(t,s),e},removeAllListeners:function(e){if(null!=e[i]){for(const[t,s]of e[i])e.removeListener(t,s);e[i]=null}return e},errorRequest:function(e,t,s){try{t.onError(s),r(t.aborted)}catch(s){e.emit("error",s)}},parseRawHeaders:function(e){const t=e.length,s=new Array(t);let r,n,A=!1,i=-1,o=0;for(let a=0;a<t;a+=2)r=e[a],n=e[a+1],"string"!=typeof r&&(r=r.toString()),"string"!=typeof n&&(n=n.toString("utf8")),o=r.length,14!==o||"-"!==r[7]||"content-length"!==r&&"content-length"!==r.toLowerCase()?19!==o||"-"!==r[7]||"content-disposition"!==r&&"content-disposition"!==r.toLowerCase()||(i=a+1):A=!0,s[a]=r,s[a+1]=n;return A&&-1!==i&&(s[i]=Buffer.from(s[i]).toString("latin1")),s},encodeRawHeaders:function(e){if(!Array.isArray(e))throw new TypeError("expected headers to be an array");return e.map((e=>Buffer.from(e)))},parseHeaders:function(e,t){void 0===t&&(t={});for(let s=0;s<e.length;s+=2){const r=F(e[s]);let n=t[r];if(n)"string"==typeof n&&(n=[n],t[r]=n),n.push(e[s+1].toString("utf8"));else{const n=e[s+1];t[r]="string"==typeof n?n:Array.isArray(n)?n.map((e=>e.toString("utf8"))):n.toString("utf8")}}return"content-length"in t&&"content-disposition"in t&&(t["content-disposition"]=Buffer.from(t["content-disposition"]).toString("latin1")),t},parseKeepAliveTimeout:function(e){const t=e.match(T);return t?1e3*parseInt(t[1],10):null},destroy:k,bodyLength:N,deepClone:function(e){return JSON.parse(JSON.stringify(e))},ReadableStreamFrom:function(e){let t;return new ReadableStream({start(){t=e[Symbol.asyncIterator]()},pull(e){return t.next().then((({done:t,value:s})=>{if(t)queueMicrotask((()=>{e.close(),e.byobRequest?.respond(0)}));else{const t=Buffer.isBuffer(s)?s:Buffer.from(s);if(!t.byteLength)return this.pull(e);e.enqueue(new Uint8Array(t))}}))},cancel:()=>t.return(),type:"bytes"})},isBuffer:M,assertRequestHandler:function(e,t,s){if(!e||"object"!=typeof e)throw new u("handler must be an object");if("function"!=typeof e.onRequestStart){if("function"!=typeof e.onConnect)throw new u("invalid onConnect method");if("function"!=typeof e.onError)throw new u("invalid onError method");if("function"!=typeof e.onBodySent&&void 0!==e.onBodySent)throw new u("invalid onBodySent method");if(s||"CONNECT"===t){if("function"!=typeof e.onUpgrade)throw new u("invalid onUpgrade method")}else{if("function"!=typeof e.onHeaders)throw new u("invalid onHeaders method");if("function"!=typeof e.onData)throw new u("invalid onData method");if("function"!=typeof e.onComplete)throw new u("invalid onComplete method")}}},getSocketInfo:function(e){return{localAddress:e.localAddress,localPort:e.localPort,remoteAddress:e.remoteAddress,remotePort:e.remotePort,remoteFamily:e.remoteFamily,timeout:e.timeout,bytesWritten:e.bytesWritten,bytesRead:e.bytesRead}},isFormDataLike:function(e){return e&&"object"==typeof e&&"function"==typeof e.append&&"function"==typeof e.delete&&"function"==typeof e.get&&"function"==typeof e.getAll&&"function"==typeof e.has&&"function"==typeof e.set&&"FormData"===e[Symbol.toStringTag]},pathHasQueryOrFragment:w,serializePathWithQuery:function(e,t){if(w(e))throw new Error('Query params cannot be passed when url already contains "?" or "#".');const s=h(t);return s&&(e+="?"+s),e},addAbortListener:function(e,t){return"addEventListener"in e?(e.addEventListener("abort",t,{once:!0}),()=>e.removeEventListener("abort",t)):(e.once("abort",t),()=>e.removeListener("abort",t))},isValidHTTPToken:function(e){if(0===e.length)return!1;for(let t=0;t<e.length;++t)if(!U(e.charCodeAt(t)))return!1;return!0},isValidHeaderValue:function(e){return!L.test(e)},isTokenCharCode:U,parseRangeHeader:function(e){if(null==e||""===e)return{start:0,end:null,size:null};const t=e?e.match(H):null;return t?{start:parseInt(t[1]),end:t[2]?parseInt(t[2]):null,size:t[3]?parseInt(t[3]):null}:null},normalizedMethodRecordsBase:V,normalizedMethodRecords:O,isValidPort:S,isHttpOrHttpsPrefixed:D,nodeMajor:B,nodeMinor:Q,safeHTTPMethods:Object.freeze(["GET","HEAD","OPTIONS","TRACE"]),wrapRequestBody:function(e){return m(e)?(0===N(e)&&e.on("data",(function(){r(!1)})),"boolean"!=typeof e.readableDidRead&&(e[A]=!1,g.prototype.on.call(e,"data",(function(){this[A]=!0}))),e):e&&"function"==typeof e.pipeTo||e&&"string"!=typeof e&&!ArrayBuffer.isView(e)&&v(e)?new p(e):e},setupConnectTimeout:P,getProtocolFromUrlString:function(e){if("h"===e[0]&&"t"===e[1]&&"t"===e[2]&&"p"===e[3])switch(e[4]){case":":return"http:";case"s":if(":"===e[5])return"https:"}return e.slice(0,e.indexOf(":")+1)}}},3315:(e,t,s)=>{"use strict";const{InvalidArgumentError:r,MaxOriginsReachedError:n}=s(4465),{kClients:A,kRunning:i,kClose:o,kDestroy:a,kDispatch:c,kUrl:l}=s(257),h=s(7779),g=s(8542),d=s(1167),u=s(2858),E=Symbol("onConnect"),I=Symbol("onDisconnect"),C=Symbol("onConnectionError"),B=Symbol("onDrain"),Q=Symbol("factory"),p=Symbol("options"),f=Symbol("origins");function m(e,t){return t&&1===t.connections?new d(e,t):new g(e,t)}e.exports=class extends h{constructor({factory:e=m,maxOrigins:t=1/0,connect:s,...n}={}){if("function"!=typeof e)throw new r("factory must be a function.");if(null!=s&&"function"!=typeof s&&"object"!=typeof s)throw new r("connect must be a function or an object");if("number"!=typeof t||Number.isNaN(t)||t<=0)throw new r("maxOrigins must be a number greater than 0");super(),s&&"function"!=typeof s&&(s={...s}),this[p]={...u.deepClone(n),maxOrigins:t,connect:s},this[Q]=e,this[A]=new Map,this[f]=new Set,this[B]=(e,t)=>{this.emit("drain",e,[this,...t])},this[E]=(e,t)=>{this.emit("connect",e,[this,...t])},this[I]=(e,t,s)=>{this.emit("disconnect",e,[this,...t],s)},this[C]=(e,t,s)=>{this.emit("connectionError",e,[this,...t],s)}}get[i](){let e=0;for(const{dispatcher:t}of this[A].values())e+=t[i];return e}[c](e,t){let s;if(!e.origin||!("string"==typeof e.origin||e.origin instanceof URL))throw new r("opts.origin must be a non-empty string or URL.");if(s=String(e.origin),this[f].size>=this[p].maxOrigins&&!this[f].has(s))throw new n;const i=this[A].get(s);let o=i&&i.dispatcher;if(!o){const t=e=>{const t=this[A].get(s);t&&(e&&(t.count-=1),t.count<=0&&(this[A].delete(s),t.dispatcher.close()),this[f].delete(s))};o=this[Q](e.origin,this[p]).on("drain",this[B]).on("connect",((e,t)=>{const r=this[A].get(s);r&&(r.count+=1),this[E](e,t)})).on("disconnect",((e,s,r)=>{t(!0),this[I](e,s,r)})).on("connectionError",((e,s,r)=>{t(!1),this[C](e,s,r)})),this[A].set(s,{count:0,dispatcher:o}),this[f].add(s)}return o.dispatch(e,t)}[o](){const e=[];for(const{dispatcher:t}of this[A].values())e.push(t.close());return this[A].clear(),Promise.all(e)}[a](e){const t=[];for(const{dispatcher:s}of this[A].values())t.push(s.destroy(e));return this[A].clear(),Promise.all(t)}get stats(){const e={};for(const{dispatcher:t}of this[A].values())t.stats&&(e[t[l].origin]=t.stats);return e}}},8055:(e,t,s)=>{"use strict";const{BalancedPoolMissingUpstreamError:r,InvalidArgumentError:n}=s(4465),{PoolBase:A,kClients:i,kNeedDrain:o,kAddClient:a,kRemoveClient:c,kGetDispatcher:l}=s(1694),h=s(8542),{kUrl:g}=s(257),{parseOrigin:d}=s(2858),u=Symbol("factory"),E=Symbol("options"),I=Symbol("kGreatestCommonDivisor"),C=Symbol("kCurrentWeight"),B=Symbol("kIndex"),Q=Symbol("kWeight"),p=Symbol("kMaxWeightPerServer"),f=Symbol("kErrorPenalty");function m(e,t){if(0===e)return t;for(;0!==t;){const s=t;t=e%t,e=s}return e}function y(e,t){return new h(e,t)}e.exports=class extends A{constructor(e=[],{factory:t=y,...s}={}){if("function"!=typeof t)throw new n("factory must be a function.");super(),this[E]=s,this[B]=-1,this[C]=0,this[p]=this[E].maxWeightPerServer||100,this[f]=this[E].errorPenalty||15,Array.isArray(e)||(e=[e]),this[u]=t;for(const t of e)this.addUpstream(t);this._updateBalancedPoolStats()}addUpstream(e){const t=d(e).origin;if(this[i].find((e=>e[g].origin===t&&!0!==e.closed&&!0!==e.destroyed)))return this;const s=this[u](t,Object.assign({},this[E]));this[a](s),s.on("connect",(()=>{s[Q]=Math.min(this[p],s[Q]+this[f])})),s.on("connectionError",(()=>{s[Q]=Math.max(1,s[Q]-this[f]),this._updateBalancedPoolStats()})),s.on("disconnect",((...e)=>{const t=e[2];t&&"UND_ERR_SOCKET"===t.code&&(s[Q]=Math.max(1,s[Q]-this[f]),this._updateBalancedPoolStats())}));for(const e of this[i])e[Q]=this[p];return this._updateBalancedPoolStats(),this}_updateBalancedPoolStats(){let e=0;for(let t=0;t<this[i].length;t++)e=m(this[i][t][Q],e);this[I]=e}removeUpstream(e){const t=d(e).origin,s=this[i].find((e=>e[g].origin===t&&!0!==e.closed&&!0!==e.destroyed));return s&&this[c](s),this}get upstreams(){return this[i].filter((e=>!0!==e.closed&&!0!==e.destroyed)).map((e=>e[g].origin))}[l](){if(0===this[i].length)throw new r;if(!this[i].find((e=>!e[o]&&!0!==e.closed&&!0!==e.destroyed)))return;if(this[i].map((e=>e[o])).reduce(((e,t)=>e&&t),!0))return;let e=0,t=this[i].findIndex((e=>!e[o]));for(;e++<this[i].length;){this[B]=(this[B]+1)%this[i].length;const e=this[i][this[B]];if(e[Q]>this[i][t][Q]&&!e[o]&&(t=this[B]),0===this[B]&&(this[C]=this[C]-this[I],this[C]<=0&&(this[C]=this[p])),e[Q]>=this[C]&&!e[o])return e}return this[C]=this[i][t][Q],this[B]=t,this[i][t]}}},9355:(e,t,s)=>{"use strict";const r=s(4589),n=s(2858),{channels:A}=s(772),i=s(3801),{RequestContentLengthMismatchError:o,ResponseContentLengthMismatchError:a,RequestAbortedError:c,HeadersTimeoutError:l,HeadersOverflowError:h,SocketError:g,InformationalError:d,BodyTimeoutError:u,HTTPParserError:E,ResponseExceededMaxSizeError:I}=s(4465),{kUrl:C,kReset:B,kClient:Q,kParser:p,kBlocking:f,kRunning:m,kPending:y,kSize:w,kWriting:S,kQueue:D,kNoRef:b,kKeepAliveDefaultTimeout:v,kHostHeader:N,kPendingIdx:R,kRunningIdx:k,kError:T,kPipelining:F,kSocket:M,kKeepAliveTimeoutValue:U,kMaxHeadersSize:L,kKeepAliveMaxTimeout:H,kKeepAliveTimeoutThreshold:P,kHeadersTimeout:x,kBodyTimeout:Y,kStrictContentLength:V,kMaxRequests:O,kCounter:G,kMaxResponseSize:J,kOnError:W,kResume:_,kHTTPContext:q,kClosed:$}=s(257),z=s(4178),X=Buffer.alloc(0),j=Buffer[Symbol.species],Z=n.removeAllListeners;let K;let ee=null,te=null,se=null,re=0,ne=null;class Ae{constructor(e,t,{exports:s}){this.llhttp=s,this.ptr=this.llhttp.llhttp_alloc(z.TYPE.RESPONSE),this.client=e,this.socket=t,this.timeout=null,this.timeoutValue=null,this.timeoutType=null,this.statusCode=0,this.statusText="",this.upgrade=!1,this.headers=[],this.headersSize=0,this.headersMaxSize=e[L],this.shouldKeepAlive=!1,this.paused=!1,this.resume=this.resume.bind(this),this.bytesRead=0,this.keepAlive="",this.contentLength="",this.connection="",this.maxResponseSize=e[J]}setTimeout(e,t){e!==this.timeoutValue||1&t^1&this.timeoutType?(this.timeout&&(i.clearTimeout(this.timeout),this.timeout=null),e&&(1&t?this.timeout=i.setFastTimeout(ie,e,new WeakRef(this)):(this.timeout=setTimeout(ie,e,new WeakRef(this)),this.timeout?.unref())),this.timeoutValue=e):this.timeout&&this.timeout.refresh&&this.timeout.refresh(),this.timeoutType=t}resume(){!this.socket.destroyed&&this.paused&&(r(null!=this.ptr),r(null===te),this.llhttp.llhttp_resume(this.ptr),r(5===this.timeoutType),this.timeout&&this.timeout.refresh&&this.timeout.refresh(),this.paused=!1,this.execute(this.socket.read()||X),this.readMore())}readMore(){for(;!this.paused&&this.ptr;){const e=this.socket.read();if(null===e)break;this.execute(e)}}execute(e){r(null===te),r(null!=this.ptr),r(!this.paused);const{socket:t,llhttp:s}=this;e.length>re&&(ne&&s.free(ne),re=4096*Math.ceil(e.length/4096),ne=s.malloc(re)),new Uint8Array(s.memory.buffer,ne,re).set(e);try{let r;try{se=e,te=this,r=s.llhttp_execute(this.ptr,ne,e.length)}finally{te=null,se=null}if(r!==z.ERROR.OK){const n=e.subarray(s.llhttp_get_error_pos(this.ptr)-ne);if(r===z.ERROR.PAUSED_UPGRADE)this.onUpgrade(n);else{if(r!==z.ERROR.PAUSED){const e=s.llhttp_get_error_reason(this.ptr);let t="";if(e){const r=new Uint8Array(s.memory.buffer,e).indexOf(0);t="Response does not match the HTTP/1.1 protocol ("+Buffer.from(s.memory.buffer,e,r).toString()+")"}throw new E(t,z.ERROR[r],n)}this.paused=!0,t.unshift(n)}}}catch(e){n.destroy(t,e)}}destroy(){r(null===te),r(null!=this.ptr),this.llhttp.llhttp_free(this.ptr),this.ptr=null,this.timeout&&i.clearTimeout(this.timeout),this.timeout=null,this.timeoutValue=null,this.timeoutType=null,this.paused=!1}onStatus(e){return this.statusText=e.toString(),0}onMessageBegin(){const{socket:e,client:t}=this;if(e.destroyed)return-1;const s=t[D][t[k]];return s?(s.onResponseStarted(),0):-1}onHeaderField(e){const t=this.headers.length;return 1&t?this.headers[t-1]=Buffer.concat([this.headers[t-1],e]):this.headers.push(e),this.trackHeader(e.length),0}onHeaderValue(e){let t=this.headers.length;1&~t?this.headers[t-1]=Buffer.concat([this.headers[t-1],e]):(this.headers.push(e),t+=1);const s=this.headers[t-2];if(10===s.length){const t=n.bufferToLowerCasedHeaderName(s);"keep-alive"===t?this.keepAlive+=e.toString():"connection"===t&&(this.connection+=e.toString())}else 14===s.length&&"content-length"===n.bufferToLowerCasedHeaderName(s)&&(this.contentLength+=e.toString());return this.trackHeader(e.length),0}trackHeader(e){this.headersSize+=e,this.headersSize>=this.headersMaxSize&&n.destroy(this.socket,new h)}onUpgrade(e){const{upgrade:t,client:s,socket:A,headers:i,statusCode:o}=this;r(t),r(s[M]===A),r(!A.destroyed),r(!this.paused),r(!(1&i.length));const a=s[D][s[k]];r(a),r(a.upgrade||"CONNECT"===a.method),this.statusCode=0,this.statusText="",this.shouldKeepAlive=!1,this.headers=[],this.headersSize=0,A.unshift(e),A[p].destroy(),A[p]=null,A[Q]=null,A[T]=null,Z(A),s[M]=null,s[q]=null,s[D][s[k]++]=null,s.emit("disconnect",s[C],[s],new d("upgrade"));try{a.onUpgrade(o,i,A)}catch(e){n.destroy(A,e)}s[_]()}onHeadersComplete(e,t,s){const{client:A,socket:i,headers:o,statusText:a}=this;if(i.destroyed)return-1;const c=A[D][A[k]];if(!c)return-1;if(r(!this.upgrade),r(this.statusCode<200),100===e)return n.destroy(i,new g("bad response",n.getSocketInfo(i))),-1;if(t&&!c.upgrade)return n.destroy(i,new g("bad upgrade",n.getSocketInfo(i))),-1;if(r(3===this.timeoutType),this.statusCode=e,this.shouldKeepAlive=s||"HEAD"===c.method&&!i[B]&&"keep-alive"===this.connection.toLowerCase(),this.statusCode>=200){const e=null!=c.bodyTimeout?c.bodyTimeout:A[Y];this.setTimeout(e,5)}else this.timeout&&this.timeout.refresh&&this.timeout.refresh();if("CONNECT"===c.method)return r(1===A[m]),this.upgrade=!0,2;if(t)return r(1===A[m]),this.upgrade=!0,2;if(r(!(1&this.headers.length)),this.headers=[],this.headersSize=0,this.shouldKeepAlive&&A[F]){const e=this.keepAlive?n.parseKeepAliveTimeout(this.keepAlive):null;if(null!=e){const t=Math.min(e-A[P],A[H]);t<=0?i[B]=!0:A[U]=t}else A[U]=A[v]}else i[B]=!0;const l=!1===c.onHeaders(e,o,this.resume,a);return c.aborted?-1:"HEAD"===c.method||e<200?1:(i[f]&&(i[f]=!1,A[_]()),l?z.ERROR.PAUSED:0)}onBody(e){const{client:t,socket:s,statusCode:A,maxResponseSize:i}=this;if(s.destroyed)return-1;const o=t[D][t[k]];return r(o),r(5===this.timeoutType),this.timeout&&this.timeout.refresh&&this.timeout.refresh(),r(A>=200),i>-1&&this.bytesRead+e.length>i?(n.destroy(s,new I),-1):(this.bytesRead+=e.length,!1===o.onData(e)?z.ERROR.PAUSED:0)}onMessageComplete(){const{client:e,socket:t,statusCode:s,upgrade:A,headers:i,contentLength:o,bytesRead:c,shouldKeepAlive:l}=this;if(t.destroyed&&(!s||l))return-1;if(A)return 0;r(s>=100),r(!(1&this.headers.length));const h=e[D][e[k]];return r(h),this.statusCode=0,this.statusText="",this.bytesRead=0,this.contentLength="",this.keepAlive="",this.connection="",this.headers=[],this.headersSize=0,s<200?0:"HEAD"!==h.method&&o&&c!==parseInt(o,10)?(n.destroy(t,new a),-1):(h.onComplete(i),e[D][e[k]++]=null,t[S]?(r(0===e[m]),n.destroy(t,new d("reset")),z.ERROR.PAUSED):l?t[B]&&0===e[m]?(n.destroy(t,new d("reset")),z.ERROR.PAUSED):(null==e[F]||1===e[F]?setImmediate(e[_]):e[_](),0):(n.destroy(t,new d("reset")),z.ERROR.PAUSED))}}function ie(e){const{socket:t,timeoutType:s,client:A,paused:i}=e.deref();3===s?(!t[S]||t.writableNeedDrain||A[m]>1)&&(r(!i,"cannot be paused while waiting for headers"),n.destroy(t,new l)):5===s?i||n.destroy(t,new u):8===s&&(r(0===A[m]&&A[U]),n.destroy(t,new d("socket idle timeout")))}function oe(e){r("ERR_TLS_CERT_ALTNAME_INVALID"!==e.code);const t=this[p];"ECONNRESET"!==e.code||!t.statusCode||t.shouldKeepAlive?(this[T]=e,this[Q][W](e)):t.onMessageComplete()}function ae(){this[p]?.readMore()}function ce(){const e=this[p];!e.statusCode||e.shouldKeepAlive?n.destroy(this,new g("other side closed",n.getSocketInfo(this))):e.onMessageComplete()}function le(){const e=this[p];e&&(this[T]||!e.statusCode||e.shouldKeepAlive||e.onMessageComplete(),this[p].destroy(),this[p]=null);const t=this[T]||new g("closed",n.getSocketInfo(this)),s=this[Q];if(s[M]=null,s[q]=null,s.destroyed){r(0===s[y]);const e=s[D].splice(s[k]);for(let r=0;r<e.length;r++){const A=e[r];n.errorRequest(s,A,t)}}else if(s[m]>0&&"UND_ERR_INFO"!==t.code){const e=s[D][s[k]];s[D][s[k]++]=null,n.errorRequest(s,e,t)}s[R]=s[k],r(0===s[m]),s.emit("disconnect",s[C],[s],t),s[_]()}function he(){this[$]=!0}function ge(e,t,s,A,i,o,a,c){try{t?n.isBuffer(t)&&(r(o===t.byteLength,"buffer body must have content length"),i.cork(),i.write(`${a}content-length: ${o}\r\n\r\n`,"latin1"),i.write(t),i.uncork(),A.onBodySent(t),c||!1===A.reset||(i[B]=!0)):0===o?i.write(`${a}content-length: 0\r\n\r\n`,"latin1"):(r(null===o,"no body must not have content length"),i.write(`${a}\r\n`,"latin1")),A.onRequestSent(),s[_]()}catch(t){e(t)}}async function de(e,t,s,n,A,i,o,a){r(0!==i||0===s[m],"iterator body cannot be pipelined");let c=null;function l(){if(c){const e=c;c=null,e()}}A.on("close",l).on("drain",l);const h=new ue({abort:e,socket:A,request:n,contentLength:i,client:s,expectsPayload:a,header:o});try{for await(const e of t){if(A[T])throw A[T];h.write(e)||await new Promise(((e,t)=>{r(null===c),A[T]?t(A[T]):c=e}))}h.end()}catch(e){h.destroy(e)}finally{A.off("close",l).off("drain",l)}}class ue{constructor({abort:e,socket:t,request:s,contentLength:r,client:n,expectsPayload:A,header:i}){this.socket=t,this.request=s,this.contentLength=r,this.client=n,this.bytesWritten=0,this.expectsPayload=A,this.header=i,this.abort=e,t[S]=!0}write(e){const{socket:t,request:s,contentLength:r,client:n,bytesWritten:A,expectsPayload:i,header:a}=this;if(t[T])throw t[T];if(t.destroyed)return!1;const c=Buffer.byteLength(e);if(!c)return!0;if(null!==r&&A+c>r){if(n[V])throw new o;process.emitWarning(new o)}t.cork(),0===A&&(i||!1===s.reset||(t[B]=!0),null===r?t.write(`${a}transfer-encoding: chunked\r\n`,"latin1"):t.write(`${a}content-length: ${r}\r\n\r\n`,"latin1")),null===r&&t.write(`\r\n${c.toString(16)}\r\n`,"latin1"),this.bytesWritten+=c;const l=t.write(e);return t.uncork(),s.onBodySent(e),l||t[p].timeout&&3===t[p].timeoutType&&t[p].timeout.refresh&&t[p].timeout.refresh(),l}end(){const{socket:e,contentLength:t,client:s,bytesWritten:r,expectsPayload:n,header:A,request:i}=this;if(i.onRequestSent(),e[S]=!1,e[T])throw e[T];if(!e.destroyed){if(0===r?n?e.write(`${A}content-length: 0\r\n\r\n`,"latin1"):e.write(`${A}\r\n`,"latin1"):null===t&&e.write("\r\n0\r\n\r\n","latin1"),null!==t&&r!==t){if(s[V])throw new o;process.emitWarning(new o)}e[p].timeout&&3===e[p].timeoutType&&e[p].timeout.refresh&&e[p].timeout.refresh(),s[_]()}}destroy(e){const{socket:t,client:s,abort:n}=this;t[S]=!1,e&&(r(s[m]<=1,"pipeline should only contain this request"),n(e))}}e.exports=function(e,t){if(e[M]=t,ee||(ee=function(){const e=process.env.JEST_WORKER_ID?s(4744):void 0;let t,n="ppc64"!==process.arch;if("1"===process.env.UNDICI_NO_WASM_SIMD?n=!0:"0"===process.env.UNDICI_NO_WASM_SIMD&&(n=!1),n)try{t=new WebAssembly.Module(s(7136))}catch{}return t||(t=new WebAssembly.Module(e||s(4744))),new WebAssembly.Instance(t,{env:{wasm_on_url:(e,t,s)=>0,wasm_on_status:(e,t,s)=>{r(te.ptr===e);const n=t-ne+se.byteOffset;return te.onStatus(new j(se.buffer,n,s))},wasm_on_message_begin:e=>(r(te.ptr===e),te.onMessageBegin()),wasm_on_header_field:(e,t,s)=>{r(te.ptr===e);const n=t-ne+se.byteOffset;return te.onHeaderField(new j(se.buffer,n,s))},wasm_on_header_value:(e,t,s)=>{r(te.ptr===e);const n=t-ne+se.byteOffset;return te.onHeaderValue(new j(se.buffer,n,s))},wasm_on_headers_complete:(e,t,s,n)=>(r(te.ptr===e),te.onHeadersComplete(t,1===s,1===n)),wasm_on_body:(e,t,s)=>{r(te.ptr===e);const n=t-ne+se.byteOffset;return te.onBody(new j(se.buffer,n,s))},wasm_on_message_complete:e=>(r(te.ptr===e),te.onMessageComplete())}})}()),t.errored)throw t.errored;if(t.destroyed)throw new g("destroyed");return t[b]=!1,t[S]=!1,t[B]=!1,t[f]=!1,t[p]=new Ae(e,t,ee),n.addListener(t,"error",oe),n.addListener(t,"readable",ae),n.addListener(t,"end",ce),n.addListener(t,"close",le),t[$]=!1,t.on("close",he),{version:"h1",defaultPipelining:1,write:t=>function(e,t){const{method:i,path:a,host:l,upgrade:h,blocking:g,reset:u}=t;let{body:E,headers:I,contentLength:C}=t;const Q="PUT"===i||"POST"===i||"PATCH"===i||"QUERY"===i||"PROPFIND"===i||"PROPPATCH"===i;if(n.isFormDataLike(E)){K||(K=s(2530).extractBody);const[e,r]=K(E);null==t.contentType&&I.push("content-type",r),E=e.stream,C=e.length}else n.isBlobLike(E)&&null==t.contentType&&E.type&&I.push("content-type",E.type);E&&"function"==typeof E.read&&E.read(0);const p=n.bodyLength(E);C=p??C,null===C&&(C=t.contentLength);0!==C||Q||(C=null);if(function(e){return"GET"!==e&&"HEAD"!==e&&"OPTIONS"!==e&&"TRACE"!==e&&"CONNECT"!==e}(i)&&C>0&&null!==t.contentLength&&t.contentLength!==C){if(e[V])return n.errorRequest(e,t,new o),!1;process.emitWarning(new o)}const y=e[M],w=s=>{t.aborted||t.completed||(n.errorRequest(e,t,s||new c),n.destroy(E),n.destroy(y,new d("aborted")))};try{t.onConnect(w)}catch(s){n.errorRequest(e,t,s)}if(t.aborted)return!1;"HEAD"===i&&(y[B]=!0);(h||"CONNECT"===i)&&(y[B]=!0);null!=u&&(y[B]=u);e[O]&&y[G]++>=e[O]&&(y[B]=!0);g&&(y[f]=!0);let D=`${i} ${a} HTTP/1.1\r\n`;D+="string"==typeof l?`host: ${l}\r\n`:e[N];h?D+=`connection: upgrade\r\nupgrade: ${h}\r\n`:e[F]&&!y[B]?D+="connection: keep-alive\r\n":D+="connection: close\r\n";if(Array.isArray(I))for(let e=0;e<I.length;e+=2){const t=I[e+0],s=I[e+1];if(Array.isArray(s))for(let e=0;e<s.length;e++)D+=`${t}: ${s[e]}\r\n`;else D+=`${t}: ${s}\r\n`}A.sendHeaders.hasSubscribers&&A.sendHeaders.publish({request:t,headers:D,socket:y});E&&0!==p?n.isBuffer(E)?ge(w,E,e,t,y,C,D,Q):n.isBlobLike(E)?"function"==typeof E.stream?de(w,E.stream(),e,t,y,C,D,Q):async function(e,t,s,n,A,i,a,c){r(i===t.size,"blob body must have content length");try{if(null!=i&&i!==t.size)throw new o;const e=Buffer.from(await t.arrayBuffer());A.cork(),A.write(`${a}content-length: ${i}\r\n\r\n`,"latin1"),A.write(e),A.uncork(),n.onBodySent(e),n.onRequestSent(),c||!1===n.reset||(A[B]=!0),s[_]()}catch(t){e(t)}}(w,E,e,t,y,C,D,Q):n.isStream(E)?function(e,t,s,A,i,o,a,l){r(0!==o||0===s[m],"stream body cannot be pipelined");let h=!1;const g=new ue({abort:e,socket:i,request:A,contentLength:o,client:s,expectsPayload:l,header:a}),d=function(e){if(!h)try{!g.write(e)&&this.pause&&this.pause()}catch(e){n.destroy(this,e)}},u=function(){h||t.resume&&t.resume()},E=function(){if(queueMicrotask((()=>{t.removeListener("error",I)})),!h){const e=new c;queueMicrotask((()=>I(e)))}},I=function(e){if(!h){if(h=!0,r(i.destroyed||i[S]&&s[m]<=1),i.off("drain",u).off("error",I),t.removeListener("data",d).removeListener("end",I).removeListener("close",E),!e)try{g.end()}catch(t){e=t}g.destroy(e),!e||"UND_ERR_INFO"===e.code&&"reset"===e.message?n.destroy(t):n.destroy(t,e)}};t.on("data",d).on("end",I).on("error",I).on("close",E),t.resume&&t.resume();i.on("drain",u).on("error",I),t.errorEmitted??t.errored?setImmediate(I,t.errored):(t.endEmitted??t.readableEnded)&&setImmediate(I,null);(t.closeEmitted??t.closed)&&setImmediate(E)}(w,E,e,t,y,C,D,Q):n.isIterable(E)?de(w,E,e,t,y,C,D,Q):r(!1):ge(w,null,e,t,y,C,D,Q);return!0}(e,t),resume(){!function(e){const t=e[M];if(t&&!t.destroyed)if(0===e[w]?!t[b]&&t.unref&&(t.unref(),t[b]=!0):t[b]&&t.ref&&(t.ref(),t[b]=!1),0===e[w])8!==t[p].timeoutType&&t[p].setTimeout(e[U],8);else if(e[m]>0&&t[p].statusCode<200&&3!==t[p].timeoutType){const s=e[D][e[k]],r=null!=s.headersTimeout?s.headersTimeout:e[x];t[p].setTimeout(r,3)}}(e)},destroy(e,s){t[$]?queueMicrotask(s):(t.on("close",s),t.destroy(e))},get destroyed(){return t.destroyed},busy(s){if(t[S]||t[B]||t[f])return!0;if(s){if(e[m]>0&&!s.idempotent)return!0;if(e[m]>0&&(s.upgrade||"CONNECT"===s.method))return!0;if(e[m]>0&&0!==n.bodyLength(s.body)&&(n.isStream(s.body)||n.isAsyncIterable(s.body)||n.isFormDataLike(s.body)))return!0}return!1}}}},8142:(e,t,s)=>{"use strict";const r=s(4589),{pipeline:n}=s(7075),A=s(2858),{RequestContentLengthMismatchError:i,RequestAbortedError:o,SocketError:a,InformationalError:c}=s(4465),{kUrl:l,kReset:h,kClient:g,kRunning:d,kPending:u,kQueue:E,kPendingIdx:I,kRunningIdx:C,kError:B,kSocket:Q,kStrictContentLength:p,kOnError:f,kMaxConcurrentStreams:m,kHTTP2Session:y,kResume:w,kSize:S,kHTTPContext:D,kClosed:b,kBodyTimeout:v}=s(257),{channels:N}=s(772),R=Symbol("open streams");let k,T;try{T=s(2467)}catch{T={constants:{}}}const{constants:{HTTP2_HEADER_AUTHORITY:F,HTTP2_HEADER_METHOD:M,HTTP2_HEADER_PATH:U,HTTP2_HEADER_SCHEME:L,HTTP2_HEADER_CONTENT_LENGTH:H,HTTP2_HEADER_EXPECT:P,HTTP2_HEADER_STATUS:x}}=T;function Y(e){r("ERR_TLS_CERT_ALTNAME_INVALID"!==e.code),this[Q][B]=e,this[g][f](e)}function V(e,t,s){if(0===s){const s=new c(`HTTP/2: "frameError" received - type ${e}, code ${t}`);this[Q][B]=s,this[g][f](s)}}function O(){const e=new a("other side closed",A.getSocketInfo(this[Q]));this.destroy(e),A.destroy(this[Q],e)}function G(e){const t=this[B]||new a(`HTTP/2: "GOAWAY" frame received with code ${e}`,A.getSocketInfo(this[Q])),s=this[g];if(s[Q]=null,s[D]=null,this.close(),this[y]=null,A.destroy(this[Q],t),s[C]<s[E].length){const e=s[E][s[C]];s[E][s[C]++]=null,A.errorRequest(s,e,t),s[I]=s[C]}r(0===s[d]),s.emit("disconnect",s[l],[s],t),s.emit("connectionError",s[l],[s],t),s[w]()}function J(){const{[g]:e}=this,{[Q]:t}=e,s=this[Q][B]||this[B]||new a("closed",A.getSocketInfo(t));if(e[Q]=null,e[D]=null,e.destroyed){r(0===e[u]);const t=e[E].splice(e[C]);for(let r=0;r<t.length;r++){const n=t[r];A.errorRequest(e,n,s)}}}function W(){const e=this[B]||new a("closed",A.getSocketInfo(this)),t=this[y][g];t[Q]=null,t[D]=null,null!==this[y]&&this[y].destroy(e),t[I]=t[C],r(0===t[d]),t.emit("disconnect",t[l],[t],e),t[w]()}function _(e){r("ERR_TLS_CERT_ALTNAME_INVALID"!==e.code),this[B]=e,this[g][f](e)}function q(){A.destroy(this,new a("other side closed",A.getSocketInfo(this)))}function $(){this[b]=!0}function z(e,t,s,n,i,o,a,c){try{null!=s&&A.isBuffer(s)&&(r(a===s.byteLength,"buffer body must have content length"),t.cork(),t.write(s),t.uncork(),t.end(),i.onBodySent(s)),c||(o[h]=!0),i.onRequestSent(),n[w]()}catch(t){e(t)}}async function X(e,t,s,n,A,i,o,a){r(0!==o||0===n[d],"iterator body cannot be pipelined");let c=null;function l(){if(c){const e=c;c=null,e()}}t.on("close",l).on("drain",l);try{for await(const e of s){if(i[B])throw i[B];const s=t.write(e);A.onBodySent(e),s||await new Promise(((e,t)=>{r(null===c),i[B]?t(i[B]):c=e}))}t.end(),A.onRequestSent(),a||(i[h]=!0),n[w]()}catch(t){e(t)}finally{t.off("close",l).off("drain",l)}}e.exports=function(e,t){e[Q]=t;const a=T.connect(e[l],{createConnection:()=>t,peerMaxConcurrentStreams:e[m],settings:{enablePush:!1}});return a[R]=0,a[g]=e,a[Q]=t,a[y]=null,A.addListener(a,"error",Y),A.addListener(a,"frameError",V),A.addListener(a,"end",O),A.addListener(a,"goaway",G),A.addListener(a,"close",J),a.unref(),e[y]=a,t[y]=a,A.addListener(t,"error",_),A.addListener(t,"end",q),A.addListener(t,"close",W),t[b]=!1,t.on("close",$),{version:"h2",defaultPipelining:1/0,write:t=>function(e,t){const a=t.bodyTimeout??e[v],g=e[y],{method:u,path:B,host:m,upgrade:S,expectContinue:D,signal:b,protocol:T,headers:Y}=t;let{body:V}=t;if(S)return A.errorRequest(e,t,new Error("Upgrade not supported for H2")),!1;const O={};for(let e=0;e<Y.length;e+=2){const t=Y[e+0],s=Y[e+1];if("cookie"!==t)if(Array.isArray(s))for(let e=0;e<s.length;e++)O[t]?O[t]+=`, ${s[e]}`:O[t]=s[e];else O[t]?O[t]+=`, ${s}`:O[t]=s;else null!=O[t]?O[t]=Array.isArray(O[t])?(O[t].push(s),O[t]):[O[t],s]:O[t]=s}let G=null;const{hostname:J,port:W}=e[l];O[F]=m||`${J}${W?`:${W}`:""}`,O[M]=u;const _=s=>{t.aborted||t.completed||(s=s||new o,A.errorRequest(e,t,s),null!=G&&(G.removeAllListeners("data"),G.close(),e[f](s),e[w]()),A.destroy(V,s))};try{t.onConnect(_)}catch(s){A.errorRequest(e,t,s)}if(t.aborted)return!1;if("CONNECT"===u)return g.ref(),G=g.request(O,{endStream:!1,signal:b}),G.pending?G.once("ready",(()=>{t.onUpgrade(null,null,G),++g[R],e[E][e[C]++]=null})):(t.onUpgrade(null,null,G),++g[R],e[E][e[C]++]=null),G.once("close",(()=>{g[R]-=1,0===g[R]&&g.unref()})),G.setTimeout(a),!0;O[U]=B,O[L]="http:"===T?"http":"https";const q="PUT"===u||"POST"===u||"PATCH"===u;V&&"function"==typeof V.read&&V.read(0);let $=A.bodyLength(V);if(A.isFormDataLike(V)){k??=s(2530).extractBody;const[e,t]=k(V);O["content-type"]=t,V=e.stream,$=e.length}null==$&&($=t.contentLength);0!==$&&q||($=null);if(function(e){return"GET"!==e&&"HEAD"!==e&&"OPTIONS"!==e&&"TRACE"!==e&&"CONNECT"!==e}(u)&&$>0&&null!=t.contentLength&&t.contentLength!==$){if(e[p])return A.errorRequest(e,t,new i),!1;process.emitWarning(new i)}null!=$&&(r(V,"no body must not have content length"),O[H]=`${$}`);if(g.ref(),N.sendHeaders.hasSubscribers){let e="";for(const t in O)e+=`${t}: ${O[t]}\r\n`;N.sendHeaders.publish({request:t,headers:e,socket:g[Q]})}const j="GET"===u||"HEAD"===u||null===V;D?(O[P]="100-continue",G=g.request(O,{endStream:j,signal:b}),G.once("continue",Z)):(G=g.request(O,{endStream:j,signal:b}),Z());return++g[R],G.setTimeout(a),G.once("response",(e=>{const{[x]:s,...r}=e;t.onResponseStarted(),t.aborted?G.removeAllListeners("data"):!1===t.onHeaders(Number(s),function(e){const t=[];for(const[s,r]of Object.entries(e))if(Array.isArray(r))for(const e of r)t.push(Buffer.from(s),Buffer.from(e));else t.push(Buffer.from(s),Buffer.from(r));return t}(r),G.resume.bind(G),"")&&G.pause()})),G.on("data",(e=>{!1===t.onData(e)&&G.pause()})),G.once("end",(s=>{G.removeAllListeners("data"),null==G.state?.state||G.state.state<6?(t.aborted||t.completed||t.onComplete({}),e[E][e[C]++]=null,e[w]()):(--g[R],0===g[R]&&g.unref(),_(s??new c("HTTP/2: stream half-closed (remote)")),e[E][e[C]++]=null,e[I]=e[C],e[w]())})),G.once("close",(()=>{G.removeAllListeners("data"),g[R]-=1,0===g[R]&&g.unref()})),G.once("error",(function(e){G.removeAllListeners("data"),_(e)})),G.once("frameError",((e,t)=>{G.removeAllListeners("data"),_(new c(`HTTP/2: "frameError" received - type ${e}, code ${t}`))})),G.on("aborted",(()=>{G.removeAllListeners("data")})),G.on("timeout",(()=>{const e=new c(`HTTP/2: "stream timeout after ${a}"`);G.removeAllListeners("data"),g[R]-=1,0===g[R]&&g.unref(),_(e)})),G.once("trailers",(e=>{t.aborted||t.completed||t.onComplete(e)})),!0;function Z(){V&&0!==$?A.isBuffer(V)?z(_,G,V,e,t,e[Q],$,q):A.isBlobLike(V)?"function"==typeof V.stream?X(_,G,V.stream(),e,t,e[Q],$,q):async function(e,t,s,n,A,o,a,c){r(a===s.size,"blob body must have content length");try{if(null!=a&&a!==s.size)throw new i;const e=Buffer.from(await s.arrayBuffer());t.cork(),t.write(e),t.uncork(),t.end(),A.onBodySent(e),A.onRequestSent(),c||(o[h]=!0),n[w]()}catch(t){e(t)}}(_,G,V,e,t,e[Q],$,q):A.isStream(V)?function(e,t,s,i,o,a,c,l){r(0!==l||0===a[d],"stream body cannot be pipelined");const g=n(o,i,(r=>{r?(A.destroy(g,r),e(r)):(A.removeAllListeners(g),c.onRequestSent(),s||(t[h]=!0),a[w]())}));function u(e){c.onBodySent(e)}A.addListener(g,"data",u)}(_,e[Q],q,G,V,e,t,$):A.isIterable(V)?X(_,G,V,e,t,e[Q],$,q):r(!1):z(_,G,null,e,t,e[Q],$,q)}}(e,t),resume(){!function(e){const t=e[Q];!1===t?.destroyed&&(0===e[S]||0===e[m]?(t.unref(),e[y].unref()):(t.ref(),e[y].ref()))}(e)},destroy(e,s){t[b]?queueMicrotask(s):t.destroy(e).on("close",s)},get destroyed(){return t.destroyed},busy:()=>!1}}},1167:(e,t,s)=>{"use strict";const r=s(4589),n=s(7030),A=s(7067),i=s(2858),{ClientStats:o}=s(4304),{channels:a}=s(772),c=s(5837),l=s(7779),{InvalidArgumentError:h,InformationalError:g,ClientDestroyedError:d}=s(4465),u=s(1986),{kUrl:E,kServerName:I,kClient:C,kBusy:B,kConnect:Q,kResuming:p,kRunning:f,kPending:m,kSize:y,kQueue:w,kConnected:S,kConnecting:D,kNeedDrain:b,kKeepAliveDefaultTimeout:v,kHostHeader:N,kPendingIdx:R,kRunningIdx:k,kError:T,kPipelining:F,kKeepAliveTimeoutValue:M,kMaxHeadersSize:U,kKeepAliveMaxTimeout:L,kKeepAliveTimeoutThreshold:H,kHeadersTimeout:P,kBodyTimeout:x,kStrictContentLength:Y,kConnector:V,kMaxRequests:O,kCounter:G,kClose:J,kDestroy:W,kDispatch:_,kLocalAddress:q,kMaxResponseSize:$,kOnError:z,kHTTPContext:X,kMaxConcurrentStreams:j,kResume:Z}=s(257),K=s(9355),ee=s(8142),te=Symbol("kClosedResolve"),se=A&&A.maxHeaderSize&&Number.isInteger(A.maxHeaderSize)&&A.maxHeaderSize>0?()=>A.maxHeaderSize:()=>{throw new h("http module not available or http.maxHeaderSize invalid")},re=()=>{};function ne(e){return e[F]??e[X]?.defaultPipelining??1}function Ae(e,t){if(0===e[f]&&"UND_ERR_INFO"!==t.code&&"UND_ERR_SOCKET"!==t.code){r(e[R]===e[k]);const s=e[w].splice(e[k]);for(let r=0;r<s.length;r++){const n=s[r];i.errorRequest(e,n,t)}r(0===e[y])}}function ie(e){r(!e[D]),r(!e[X]);let{host:t,hostname:s,protocol:A,port:o}=e[E];if("["===s[0]){const e=s.indexOf("]");r(-1!==e);const t=s.substring(1,e);r(n.isIPv6(t)),s=t}e[D]=!0,a.beforeConnect.hasSubscribers&&a.beforeConnect.publish({connectParams:{host:t,hostname:s,protocol:A,port:o,version:e[X]?.version,servername:e[I],localAddress:e[q]},connector:e[V]}),e[V]({host:t,hostname:s,protocol:A,port:o,servername:e[I],localAddress:e[q]},((n,c)=>{if(n)return oe(e,n,{host:t,hostname:s,protocol:A,port:o}),void e[Z]();if(e.destroyed)return i.destroy(c.on("error",re),new d),void e[Z]();r(c);try{e[X]="h2"===c.alpnProtocol?ee(e,c):K(e,c)}catch(n){return c.destroy().on("error",re),oe(e,n,{host:t,hostname:s,protocol:A,port:o}),void e[Z]()}e[D]=!1,c[G]=0,c[O]=e[O],c[C]=e,c[T]=null,a.connected.hasSubscribers&&a.connected.publish({connectParams:{host:t,hostname:s,protocol:A,port:o,version:e[X]?.version,servername:e[I],localAddress:e[q]},connector:e[V],socket:c}),e.emit("connect",e[E],[e]),e[Z]()}))}function oe(e,t,{host:s,hostname:n,protocol:A,port:o}){if(!e.destroyed){if(e[D]=!1,a.connectError.hasSubscribers&&a.connectError.publish({connectParams:{host:s,hostname:n,protocol:A,port:o,version:e[X]?.version,servername:e[I],localAddress:e[q]},connector:e[V],error:t}),"ERR_TLS_CERT_ALTNAME_INVALID"===t.code)for(r(0===e[f]);e[m]>0&&e[w][e[R]].servername===e[I];){const s=e[w][e[R]++];i.errorRequest(e,s,t)}else Ae(e,t);e.emit("connectionError",e[E],[e],t)}}function ae(e){e[b]=0,e.emit("drain",e[E],[e])}function ce(e,t){2!==e[p]&&(e[p]=2,function(e,t){for(;;){if(e.destroyed)return void r(0===e[m]);if(e[te]&&!e[y])return e[te](),void(e[te]=null);if(e[X]&&e[X].resume(),e[B])e[b]=2;else if(2===e[b]){t?(e[b]=1,queueMicrotask((()=>ae(e)))):ae(e);continue}if(0===e[m])return;if(e[f]>=(ne(e)||1))return;const s=e[w][e[R]];if("https:"===e[E].protocol&&e[I]!==s.servername){if(e[f]>0)return;e[I]=s.servername,e[X]?.destroy(new g("servername changed"),(()=>{e[X]=null,ce(e)}))}if(e[D])return;if(!e[X])return void ie(e);if(e[X].destroyed)return;if(e[X].busy(s))return;!s.aborted&&e[X].write(s)?e[R]++:e[w].splice(e[R],1)}}(e,t),e[p]=0,e[k]>256&&(e[w].splice(0,e[k]),e[R]-=e[k],e[k]=0))}e.exports=class extends l{constructor(e,{maxHeaderSize:t,headersTimeout:s,socketTimeout:r,requestTimeout:A,connectTimeout:o,bodyTimeout:a,idleTimeout:c,keepAlive:l,keepAliveTimeout:g,maxKeepAliveTimeout:d,keepAliveMaxTimeout:C,keepAliveTimeoutThreshold:B,socketPath:Q,pipelining:f,tls:m,strictContentLength:y,maxCachedSessions:S,connect:D,maxRequestsPerClient:T,localAddress:G,maxResponseSize:J,autoSelectFamily:W,autoSelectFamilyAttemptTimeout:_,maxConcurrentStreams:K,allowH2:ee}={}){if(void 0!==l)throw new h("unsupported keepAlive, use pipelining=0 instead");if(void 0!==r)throw new h("unsupported socketTimeout, use headersTimeout & bodyTimeout instead");if(void 0!==A)throw new h("unsupported requestTimeout, use headersTimeout & bodyTimeout instead");if(void 0!==c)throw new h("unsupported idleTimeout, use keepAliveTimeout instead");if(void 0!==d)throw new h("unsupported maxKeepAliveTimeout, use keepAliveMaxTimeout instead");if(null!=t){if(!Number.isInteger(t)||t<1)throw new h("invalid maxHeaderSize")}else t=se();if(null!=Q&&"string"!=typeof Q)throw new h("invalid socketPath");if(null!=o&&(!Number.isFinite(o)||o<0))throw new h("invalid connectTimeout");if(null!=g&&(!Number.isFinite(g)||g<=0))throw new h("invalid keepAliveTimeout");if(null!=C&&(!Number.isFinite(C)||C<=0))throw new h("invalid keepAliveMaxTimeout");if(null!=B&&!Number.isFinite(B))throw new h("invalid keepAliveTimeoutThreshold");if(null!=s&&(!Number.isInteger(s)||s<0))throw new h("headersTimeout must be a positive integer or zero");if(null!=a&&(!Number.isInteger(a)||a<0))throw new h("bodyTimeout must be a positive integer or zero");if(null!=D&&"function"!=typeof D&&"object"!=typeof D)throw new h("connect must be a function or an object");if(null!=T&&(!Number.isInteger(T)||T<0))throw new h("maxRequestsPerClient must be a positive number");if(null!=G&&("string"!=typeof G||0===n.isIP(G)))throw new h("localAddress must be valid string IP address");if(null!=J&&(!Number.isInteger(J)||J<-1))throw new h("maxResponseSize must be a positive number");if(null!=_&&(!Number.isInteger(_)||_<-1))throw new h("autoSelectFamilyAttemptTimeout must be a positive number");if(null!=ee&&"boolean"!=typeof ee)throw new h("allowH2 must be a valid boolean value");if(null!=K&&("number"!=typeof K||K<1))throw new h("maxConcurrentStreams must be a positive integer, greater than 0");super(),"function"!=typeof D&&(D=u({...m,maxCachedSessions:S,allowH2:ee,socketPath:Q,timeout:o,..."boolean"==typeof W?{autoSelectFamily:W,autoSelectFamilyAttemptTimeout:_}:void 0,...D})),this[E]=i.parseOrigin(e),this[V]=D,this[F]=null!=f?f:1,this[U]=t,this[v]=null==g?4e3:g,this[L]=null==C?6e5:C,this[H]=null==B?2e3:B,this[M]=this[v],this[I]=null,this[q]=null!=G?G:null,this[p]=0,this[b]=0,this[N]=`host: ${this[E].hostname}${this[E].port?`:${this[E].port}`:""}\r\n`,this[x]=null!=a?a:3e5,this[P]=null!=s?s:3e5,this[Y]=null==y||y,this[O]=T,this[te]=null,this[$]=J>-1?J:-1,this[j]=null!=K?K:100,this[X]=null,this[w]=[],this[k]=0,this[R]=0,this[Z]=e=>ce(this,e),this[z]=e=>Ae(this,e)}get pipelining(){return this[F]}set pipelining(e){this[F]=e,this[Z](!0)}get stats(){return new o(this)}get[m](){return this[w].length-this[R]}get[f](){return this[R]-this[k]}get[y](){return this[w].length-this[k]}get[S](){return!!this[X]&&!this[D]&&!this[X].destroyed}get[B](){return Boolean(this[X]?.busy(null)||this[y]>=(ne(this)||1)||this[m]>0)}[Q](e){ie(this),this.once("connect",e)}[_](e,t){const s=new c(this[E].origin,e,t);return this[w].push(s),this[p]||(null==i.bodyLength(s.body)&&i.isIterable(s.body)?(this[p]=1,queueMicrotask((()=>ce(this)))):this[Z](!0)),this[p]&&2!==this[b]&&this[B]&&(this[b]=2),this[b]<2}[J](){return new Promise((e=>{this[y]?this[te]=e:e(null)}))}[W](e){return new Promise((t=>{const s=this[w].splice(this[R]);for(let t=0;t<s.length;t++){const r=s[t];i.errorRequest(this,r,e)}const r=()=>{this[te]&&(this[te](),this[te]=null),t(null)};this[X]?(this[X].destroy(e,r),this[X]=null):queueMicrotask(r),this[Z]()}))}}},7779:(e,t,s)=>{"use strict";const r=s(5497),n=s(4555),{ClientDestroyedError:A,ClientClosedError:i,InvalidArgumentError:o}=s(4465),{kDestroy:a,kClose:c,kClosed:l,kDestroyed:h,kDispatch:g}=s(257),d=Symbol("onDestroyed"),u=Symbol("onClosed");e.exports=class extends r{[h]=!1;[d]=null;[l]=!1;[u]=[];get destroyed(){return this[h]}get closed(){return this[l]}close(e){if(void 0===e)return new Promise(((e,t)=>{this.close(((s,r)=>s?t(s):e(r)))}));if("function"!=typeof e)throw new o("invalid callback");if(this[h])return void queueMicrotask((()=>e(new A,null)));if(this[l])return void(this[u]?this[u].push(e):queueMicrotask((()=>e(null,null))));this[l]=!0,this[u].push(e);const t=()=>{const e=this[u];this[u]=null;for(let t=0;t<e.length;t++)e[t](null,null)};this[c]().then((()=>this.destroy())).then((()=>{queueMicrotask(t)}))}destroy(e,t){if("function"==typeof e&&(t=e,e=null),void 0===t)return new Promise(((t,s)=>{this.destroy(e,((e,r)=>e?s(e):t(r)))}));if("function"!=typeof t)throw new o("invalid callback");if(this[h])return void(this[d]?this[d].push(t):queueMicrotask((()=>t(null,null))));e||(e=new A),this[h]=!0,this[d]=this[d]||[],this[d].push(t);const s=()=>{const e=this[d];this[d]=null;for(let t=0;t<e.length;t++)e[t](null,null)};this[a](e).then((()=>{queueMicrotask(s)}))}dispatch(e,t){if(!t||"object"!=typeof t)throw new o("handler must be an object");t=n.unwrap(t);try{if(!e||"object"!=typeof e)throw new o("opts must be an object.");if(this[h]||this[d])throw new A;if(this[l])throw new i;return this[g](e,t)}catch(e){if("function"!=typeof t.onError)throw e;return t.onError(e),!1}}}},5497:(e,t,s)=>{"use strict";const r=s(8474),n=s(832),A=e=>(t,s)=>e(t,n.wrap(s));e.exports=class extends r{dispatch(){throw new Error("not implemented")}close(){throw new Error("not implemented")}destroy(){throw new Error("not implemented")}compose(...e){const t=Array.isArray(e[0])?e[0]:e;let s=this.dispatch.bind(this);for(const e of t)if(null!=e){if("function"!=typeof e)throw new TypeError("invalid interceptor, expected function received "+typeof e);if(s=e(s),s=A(s),null==s||"function"!=typeof s||2!==s.length)throw new TypeError("invalid interceptor")}return new Proxy(this,{get:(e,t)=>"dispatch"===t?s:e[t]})}}},4667:(e,t,s)=>{"use strict";const r=s(7779),{kClose:n,kDestroy:A,kClosed:i,kDestroyed:o,kDispatch:a,kNoProxyAgent:c,kHttpProxyAgent:l,kHttpsProxyAgent:h}=s(257),g=s(9246),d=s(3315),u={"http:":80,"https:":443};e.exports=class extends r{#B=null;#Q=null;#p=null;constructor(e={}){super(),this.#p=e;const{httpProxy:t,httpsProxy:s,noProxy:r,...n}=e;this[c]=new d(n);const A=t??process.env.http_proxy??process.env.HTTP_PROXY;this[l]=A?new g({...n,uri:A}):this[c];const i=s??process.env.https_proxy??process.env.HTTPS_PROXY;this[h]=i?new g({...n,uri:i}):this[l],this.#f()}[a](e,t){const s=new URL(e.origin);return this.#m(s).dispatch(e,t)}[n](){return Promise.all([this[c].close(),!this[l][i]&&this[l].close(),!this[h][i]&&this[h].close()])}[A](e){return Promise.all([this[c].destroy(e),!this[l][o]&&this[l].destroy(e),!this[h][o]&&this[h].destroy(e)])}#m(e){let{protocol:t,host:s,port:r}=e;return s=s.replace(/:\d*$/,"").toLowerCase(),r=Number.parseInt(r,10)||u[t]||0,this.#y(s,r)?"https:"===t?this[h]:this[l]:this[c]}#y(e,t){if(this.#w&&this.#f(),0===this.#Q.length)return!0;if("*"===this.#B)return!1;for(let s=0;s<this.#Q.length;s++){const r=this.#Q[s];if(!r.port||r.port===t)if(/^[.*]/.test(r.hostname)){if(e.endsWith(r.hostname.replace(/^\*/,"")))return!1}else if(e===r.hostname)return!1}return!0}#f(){const e=this.#p.noProxy??this.#S,t=e.split(/[,\s]/),s=[];for(let e=0;e<t.length;e++){const r=t[e];if(!r)continue;const n=r.match(/^(.+):(\d+)$/);s.push({hostname:(n?n[1]:r).toLowerCase(),port:n?Number.parseInt(n[2],10):0})}this.#B=e,this.#Q=s}get#w(){return void 0===this.#p.noProxy&&this.#B!==this.#S}get#S(){return process.env.no_proxy??process.env.NO_PROXY??""}}},1726:e=>{"use strict";const t=2047;class s{bottom=0;top=0;list=new Array(2048).fill(void 0);next=null;isEmpty(){return this.top===this.bottom}isFull(){return(this.top+1&t)===this.bottom}push(e){this.list[this.top]=e,this.top=this.top+1&t}shift(){const e=this.list[this.bottom];return void 0===e?null:(this.list[this.bottom]=void 0,this.bottom=this.bottom+1&t,e)}}e.exports=class{constructor(){this.head=this.tail=new s}isEmpty(){return this.head.isEmpty()}push(e){this.head.isFull()&&(this.head=this.head.next=new s),this.head.push(e)}shift(){const e=this.tail,t=e.shift();return e.isEmpty()&&null!==e.next&&(this.tail=e.next,e.next=null),t}}},8297:(e,t,s)=>{"use strict";const{connect:r}=s(7030),{kClose:n,kDestroy:A}=s(257),{InvalidArgumentError:i}=s(4465),o=s(2858),a=s(1167),c=s(7779);e.exports=class extends c{#D=null;constructor(e,t){if("string"==typeof e&&(e=new URL(e)),"http:"!==e.protocol)throw new i("h2c-client: Only h2c protocol is supported");const{connect:s,maxConcurrentStreams:r,pipelining:n,...A}=t??{};let o=100,c=100;if(null!=r&&Number.isInteger(r)&&r>0&&(o=r),null!=n&&Number.isInteger(n)&&n>0&&(c=n),c>o)throw new i("h2c-client: pipelining cannot be greater than maxConcurrentStreams");super(),this.#D=new a(e,{...A,connect:this.#b(s),maxConcurrentStreams:o,pipelining:c,allowH2:!0})}#b(e){return(t,s)=>{const n=e?.connectOpts??1e4,{hostname:A,port:i,pathname:a}=t,c=r({...t,host:A,port:i,pathname:a});if(null==t.keepAlive||t.keepAlive){const e=null==t.keepAliveInitialDelay?6e4:t.keepAliveInitialDelay;c.setKeepAlive(!0,e)}c.alpnProtocol="h2";const l=o.setupConnectTimeout(new WeakRef(c),{timeout:n,hostname:A,port:i});return c.setNoDelay(!0).once("connect",(function(){if(queueMicrotask(l),s){const e=s;s=null,e(null,this)}})).on("error",(function(e){if(queueMicrotask(l),s){const t=s;s=null,t(e)}})),c}}dispatch(e,t){return this.#D.dispatch(e,t)}[n](){return this.#D.close()}[A](){return this.#D.destroy()}}},1694:(e,t,s)=>{"use strict";const{PoolStats:r}=s(4304),n=s(7779),A=s(1726),{kConnected:i,kSize:o,kRunning:a,kPending:c,kQueued:l,kBusy:h,kFree:g,kUrl:d,kClose:u,kDestroy:E,kDispatch:I}=s(257),C=Symbol("clients"),B=Symbol("needDrain"),Q=Symbol("queue"),p=Symbol("closed resolve"),f=Symbol("onDrain"),m=Symbol("onConnect"),y=Symbol("onDisconnect"),w=Symbol("onConnectionError"),S=Symbol("get dispatcher"),D=Symbol("add client"),b=Symbol("remove client");e.exports={PoolBase:class extends n{[Q]=new A;[l]=0;[C]=[];[B]=!1;[f](e,t,s){const r=this[Q];let n=!1;for(;!n;){const t=r.shift();if(!t)break;this[l]--,n=!e.dispatch(t.opts,t.handler)}if(e[B]=n,!n&&this[B]&&(this[B]=!1,this.emit("drain",t,[this,...s])),this[p]&&r.isEmpty()){const e=new Array(this[C].length);for(let t=0;t<this[C].length;t++)e[t]=this[C][t].close();Promise.all(e).then(this[p])}}[m]=(e,t)=>{this.emit("connect",e,[this,...t])};[y]=(e,t,s)=>{this.emit("disconnect",e,[this,...t],s)};[w]=(e,t,s)=>{this.emit("connectionError",e,[this,...t],s)};get[h](){return this[B]}get[i](){let e=0;for(const{[i]:t}of this[C])e+=t;return e}get[g](){let e=0;for(const{[i]:t,[B]:s}of this[C])e+=t&&!s;return e}get[c](){let e=this[l];for(const{[c]:t}of this[C])e+=t;return e}get[a](){let e=0;for(const{[a]:t}of this[C])e+=t;return e}get[o](){let e=this[l];for(const{[o]:t}of this[C])e+=t;return e}get stats(){return new r(this)}[u](){if(this[Q].isEmpty()){const e=new Array(this[C].length);for(let t=0;t<this[C].length;t++)e[t]=this[C][t].close();return Promise.all(e)}return new Promise((e=>{this[p]=e}))}[E](e){for(;;){const t=this[Q].shift();if(!t)break;t.handler.onError(e)}const t=new Array(this[C].length);for(let s=0;s<this[C].length;s++)t[s]=this[C][s].destroy(e);return Promise.all(t)}[I](e,t){const s=this[S]();return s?s.dispatch(e,t)||(s[B]=!0,this[B]=!this[S]()):(this[B]=!0,this[Q].push({opts:e,handler:t}),this[l]++),!this[B]}[D](e){return e.on("drain",this[f].bind(this,e)).on("connect",this[m]).on("disconnect",this[y]).on("connectionError",this[w]),this[C].push(e),this[B]&&queueMicrotask((()=>{this[B]&&this[f](e,e[d],[e,this])})),this}[b](e){e.close((()=>{const t=this[C].indexOf(e);-1!==t&&this[C].splice(t,1)})),this[B]=this[C].some((e=>!e[B]&&!0!==e.closed&&!0!==e.destroyed))}},kClients:C,kNeedDrain:B,kAddClient:D,kRemoveClient:b,kGetDispatcher:S}},8542:(e,t,s)=>{"use strict";const{PoolBase:r,kClients:n,kNeedDrain:A,kAddClient:i,kGetDispatcher:o,kRemoveClient:a}=s(1694),c=s(1167),{InvalidArgumentError:l}=s(4465),h=s(2858),{kUrl:g}=s(257),d=s(1986),u=Symbol("options"),E=Symbol("connections"),I=Symbol("factory");function C(e,t){return new c(e,t)}e.exports=class extends r{constructor(e,{connections:t,factory:s=C,connect:r,connectTimeout:A,tls:i,maxCachedSessions:o,socketPath:a,autoSelectFamily:c,autoSelectFamilyAttemptTimeout:B,allowH2:Q,clientTtl:p,...f}={}){if(null!=t&&(!Number.isFinite(t)||t<0))throw new l("invalid connections");if("function"!=typeof s)throw new l("factory must be a function.");if(null!=r&&"function"!=typeof r&&"object"!=typeof r)throw new l("connect must be a function or an object");"function"!=typeof r&&(r=d({...i,maxCachedSessions:o,allowH2:Q,socketPath:a,timeout:A,..."boolean"==typeof c?{autoSelectFamily:c,autoSelectFamilyAttemptTimeout:B}:void 0,...r})),super(),this[E]=t||null,this[g]=h.parseOrigin(e),this[u]={...h.deepClone(f),connect:r,allowH2:Q,clientTtl:p},this[u].interceptors=f.interceptors?{...f.interceptors}:void 0,this[I]=s,this.on("connect",((e,t)=>{if(null!=p&&p>0)for(const e of t)Object.assign(e,{ttl:Date.now()})})),this.on("connectionError",((e,t,s)=>{for(const e of t){const t=this[n].indexOf(e);-1!==t&&this[n].splice(t,1)}}))}[o](){const e=this[u].clientTtl;for(const t of this[n])if(null!=e&&e>0&&t.ttl&&Date.now()-t.ttl>e)this[a](t);else if(!t[A])return t;if(!this[E]||this[n].length<this[E]){const e=this[I](this[g],this[u]);return this[i](e),e}}}},9246:(e,t,s)=>{"use strict";const{kProxy:r,kClose:n,kDestroy:A,kDispatch:i}=s(257),o=s(3315),a=s(8542),c=s(7779),{InvalidArgumentError:l,RequestAbortedError:h,SecureProxyConnectionError:g}=s(4465),d=s(1986),u=s(1167),E=Symbol("proxy agent"),I=Symbol("proxy client"),C=Symbol("proxy headers"),B=Symbol("request tls settings"),Q=Symbol("proxy tls settings"),p=Symbol("connect endpoint function"),f=Symbol("tunnel proxy");function m(e,t){return new a(e,t)}const y=()=>{};function w(e,t){return 1===t.connections?new u(e,t):new a(e,t)}class S extends c{#D;constructor(e,{headers:t={},connect:s,factory:r}){if(!e)throw new l("Proxy URL is mandatory");super(),this[C]=t,this.#D=r?r(e,{connect:s}):new u(e,{connect:s})}[i](e,t){const s=t.onHeaders;t.onHeaders=function(e,r,n){407!==e?s&&s.call(this,e,r,n):"function"==typeof t.onError&&t.onError(new l("Proxy Authentication Required (407)"))};const{origin:r,path:n="/",headers:A={}}=e;if(e.path=r+n,!("host"in A)&&!("Host"in A)){const{host:e}=new URL(r);A.host=e}return e.headers={...this[C],...A},this.#D[i](e,t)}[n](){return this.#D.close()}[A](e){return this.#D.destroy(e)}}e.exports=class extends c{constructor(e){if(!e||"object"==typeof e&&!(e instanceof URL)&&!e.uri)throw new l("Proxy uri is mandatory");const{clientFactory:t=m}=e;if("function"!=typeof t)throw new l("Proxy opts.clientFactory must be a function.");const{proxyTunnel:s=!0}=e;super();const n=this.#v(e),{href:A,origin:i,port:a,protocol:c,username:u,password:D,hostname:b}=n;if(this[r]={uri:A,protocol:c},this[B]=e.requestTls,this[Q]=e.proxyTls,this[C]=e.headers||{},this[f]=s,e.auth&&e.token)throw new l("opts.auth cannot be used in combination with opts.token");e.auth?this[C]["proxy-authorization"]=`Basic ${e.auth}`:e.token?this[C]["proxy-authorization"]=e.token:u&&D&&(this[C]["proxy-authorization"]=`Basic ${Buffer.from(`${decodeURIComponent(u)}:${decodeURIComponent(D)}`).toString("base64")}`);const v=d({...e.proxyTls});this[p]=d({...e.requestTls});const N=e.factory||w;this[I]=t(n,{connect:v}),this[E]=new o({...e,factory:(e,t)=>{const{protocol:s}=new URL(e);return this[f]||"http:"!==s||"http:"!==this[r].protocol?N(e,t):new S(this[r].uri,{headers:this[C],connect:v,factory:N})},connect:async(e,t)=>{let s=e.host;e.port||(s+=`:${function(e){return"https:"===e?443:80}(e.protocol)}`);try{const{socket:r,statusCode:n}=await this[I].connect({origin:i,port:a,path:s,signal:e.signal,headers:{...this[C],host:e.host,...null==e.connections||e.connections>0?{"proxy-connection":"keep-alive"}:{}},servername:this[Q]?.servername||b});if(200!==n&&(r.on("error",y).destroy(),t(new h(`Proxy response (${n}) !== 200 when HTTP Tunneling`))),"https:"!==e.protocol)return void t(null,r);let A;A=this[B]?this[B].servername:e.servername,this[p]({...e,servername:A,httpSocket:r},t)}catch(e){"ERR_TLS_CERT_ALTNAME_INVALID"===e.code?t(new g(e)):t(e)}}})}dispatch(e,t){const s=function(e){if(Array.isArray(e)){const t={};for(let s=0;s<e.length;s+=2)t[e[s]]=e[s+1];return t}return e}(e.headers);if(function(e){const t=e&&Object.keys(e).find((e=>"proxy-authorization"===e.toLowerCase()));if(t)throw new l("Proxy-Authorization should be sent in ProxyAgent constructor")}(s),s&&!("host"in s)&&!("Host"in s)){const{host:t}=new URL(e.origin);s.host=t}return this[E].dispatch({...e,headers:s},t)}#v(e){return"string"==typeof e?new URL(e):e instanceof URL?e:new URL(e.uri)}[n](){return Promise.all([this[E].close(),this[I].close()])}[A](){return Promise.all([this[E].destroy(),this[I].destroy()])}}},8712:(e,t,s)=>{"use strict";const r=s(5497),n=s(6294);e.exports=class extends r{#N=null;#R=null;constructor(e,t={}){super(t),this.#N=e,this.#R=t}dispatch(e,t){const s=new n({...e,retryOptions:this.#R},{dispatch:this.#N.dispatch.bind(this.#N),handler:t});return this.#N.dispatch(e,s)}close(){return this.#N.close()}destroy(){return this.#N.destroy()}}},9879:(e,t,s)=>{"use strict";const r=Symbol.for("undici.globalDispatcher.1"),{InvalidArgumentError:n}=s(4465),A=s(3315);function i(e){if(!e||"function"!=typeof e.dispatch)throw new n("Argument agent must implement Agent");Object.defineProperty(globalThis,r,{value:e,writable:!0,enumerable:!1,configurable:!1})}function o(){return globalThis[r]}void 0===o()&&i(new A);e.exports={setGlobalDispatcher:i,getGlobalDispatcher:o,installedExports:["fetch","Headers","Response","Request","FormData","WebSocket","CloseEvent","ErrorEvent","MessageEvent","EventSource"]}},8358:(e,t,s)=>{"use strict";const r=s(2858),{parseCacheControlHeader:n,parseVaryHeader:A,isEtagUsable:i}=s(9453),{parseHttpDate:o}=s(8851);function a(){}const c=[200,203,204,206,300,301,308,404,405,410,414,501],l=[206,304];e.exports=class{#k;#T;#F;#M;#U;#L;constructor({store:e,type:t,cacheByDefault:s},r,n){this.#M=e,this.#T=t,this.#F=s,this.#k=r,this.#U=n}onRequestStart(e,t){this.#L?.destroy(),this.#L=void 0,this.#U.onRequestStart?.(e,t)}onRequestUpgrade(e,t,s,r){this.#U.onRequestUpgrade?.(e,t,s,r)}onResponseStart(e,t,s,h){const g=()=>this.#U.onResponseStart?.(e,t,s,h);if(!r.safeHTTPMethods.includes(this.#k.method)&&t>=200&&t<=399){try{this.#M.delete(this.#k)?.catch?.(a)}catch{}return g()}const d=s["cache-control"],u=s["last-modified"]&&c.includes(t);if(!(d||s.expires||u||this.#F))return g();const E=d?n(d):{};if(!function(e,t,s,r){if(t<200||l.includes(t))return!1;if(!(c.includes(t)||s.expires||r.public||void 0!==r["max-age"]||r.private&&"private"===e||void 0!==r["s-maxage"]&&"shared"===e))return!1;if(r["no-store"])return!1;if("shared"===e&&!0===r.private)return!1;if(s.vary?.includes("*"))return!1;if(s.authorization){if(!r.public||"string"!=typeof s.authorization)return!1;if(Array.isArray(r["no-cache"])&&r["no-cache"].includes("authorization"))return!1;if(Array.isArray(r.private)&&r.private.includes("authorization"))return!1}return!0}(this.#T,t,s,E))return g();const I=Date.now(),C=s.age?function(e){const t=parseInt(Array.isArray(e)?e[0]:e);return isNaN(t)?void 0:1e3*t}(s.age):void 0;if(C&&C>=2147483647e3)return g();const B="string"==typeof s.date?o(s.date):void 0,Q=function(e,t,s,r,n,A){if("shared"===e){const e=A["s-maxage"];if(void 0!==e)return e>0?1e3*e:void 0}const i=A["max-age"];if(void 0!==i)return i>0?1e3*i:void 0;if("string"==typeof r.expires){const e=o(r.expires);if(e){if(t>=e.getTime())return;if(n){if(n>=e)return;if(void 0!==s&&s>e-n)return}return e.getTime()-t}}if("string"==typeof r["last-modified"]){const e=new Date(r["last-modified"]);if((a=e)instanceof Date&&Number.isFinite(a.valueOf())){if(e.getTime()>=t)return;return.1*(t-e.getTime())}}var a;if(A.immutable)return 31536e3;return}(this.#T,I,C,s,B,E)??this.#F;if(void 0===Q||C&&C>Q)return g();const p=B?B.getTime():I,f=Q+p;if(I>=f)return g();let m;if(this.#k.headers&&s.vary&&(m=A(s.vary,this.#k.headers),!m))return g();const y=function(e,t,s){let r=-1/0,n=-1/0,A=-1/0;t["stale-while-revalidate"]&&(r=s+1e3*t["stale-while-revalidate"]);t["stale-if-error"]&&(n=s+1e3*t["stale-if-error"]);r===-1/0&&n===-1/0&&(A=e+31536e6);return Math.max(s,r,n,A)}(p,E,f),w=function(e,t){const s=["connection","proxy-authenticate","proxy-authentication-info","proxy-authorization","proxy-connection","te","transfer-encoding","upgrade","age"];e.connection&&(Array.isArray(e.connection)?s.push(...e.connection.map((e=>e.trim()))):s.push(...e.connection.split(",").map((e=>e.trim()))));Array.isArray(t["no-cache"])&&s.push(...t["no-cache"]);Array.isArray(t.private)&&s.push(...t.private);let r;for(const t of s)e[t]&&(r??={...e},delete r[t]);return r??e}(s,E),S={statusCode:t,statusMessage:h,headers:w,vary:m,cacheControlDirectives:E,cachedAt:C?I-C:I,staleAt:f,deleteAt:y};if("string"==typeof s.etag&&i(s.etag)&&(S.etag=s.etag),this.#L=this.#M.createWriteStream(this.#k,S),!this.#L)return g();const D=this;return this.#L.on("drain",(()=>e.resume())).on("error",(function(){D.#L=void 0,D.#M.delete(D.#k)})).on("close",(function(){D.#L===this&&(D.#L=void 0),e.resume()})),g()}onResponseData(e,t){!1===this.#L?.write(t)&&e.pause(),this.#U.onResponseData?.(e,t)}onResponseEnd(e,t){this.#L?.end(),this.#U.onResponseEnd?.(e,t)}onResponseError(e,t){this.#L?.destroy(t),this.#L=void 0,this.#U.onResponseError?.(e,t)}}},6607:(e,t,s)=>{"use strict";const r=s(4589);e.exports=class{#H=!1;#P;#U;#x;#Y;constructor(e,t,s){if("function"!=typeof e)throw new TypeError("callback must be a function");this.#P=e,this.#U=t,this.#Y=s}onRequestStart(e,t){this.#H=!1,this.#x=t}onRequestUpgrade(e,t,s,r){this.#U.onRequestUpgrade?.(e,t,s,r)}onResponseStart(e,t,s,n){if(r(null!=this.#P),this.#H=304===t||this.#Y&&t>=500&&t<=504,this.#P(this.#H,this.#x),this.#P=null,this.#H)return!0;this.#U.onRequestStart?.(e,this.#x),this.#U.onResponseStart?.(e,t,s,n)}onResponseData(e,t){if(!this.#H)return this.#U.onResponseData?.(e,t)}onResponseEnd(e,t){this.#H||this.#U.onResponseEnd?.(e,t)}onResponseError(e,t){if(!this.#H){if(this.#P&&(this.#P(!1),this.#P=null),"function"!=typeof this.#U.onResponseError)throw t;this.#U.onResponseError(e,t)}}}},6917:(e,t,s)=>{"use strict";const r=s(4589),n=s(832);e.exports=class{#U;#V=!1;#O=!1;#G=!1;constructor(e){if("object"!=typeof e||null===e)throw new TypeError("handler must be an object");this.#U=n.wrap(e)}onRequestStart(...e){this.#U.onRequestStart?.(...e)}onRequestUpgrade(...e){return r(!this.#V),r(!this.#O),this.#U.onRequestUpgrade?.(...e)}onResponseStart(...e){return r(!this.#V),r(!this.#O),r(!this.#G),this.#G=!0,this.#U.onResponseStart?.(...e)}onResponseData(...e){return r(!this.#V),r(!this.#O),this.#U.onResponseData?.(...e)}onResponseEnd(...e){return r(!this.#V),r(!this.#O),this.#V=!0,this.#U.onResponseEnd?.(...e)}onResponseError(...e){return this.#O=!0,this.#U.onResponseError?.(...e)}onBodySent(){}}},8064:(e,t,s)=>{"use strict";const r=s(2858),{kBodyUsed:n}=s(257),A=s(4589),{InvalidArgumentError:i}=s(4465),o=s(8474),a=[300,301,302,303,307,308],c=Symbol("body"),l=()=>{};class h{constructor(e){this[c]=e,this[n]=!1}async*[Symbol.asyncIterator](){A(!this[n],"disturbed"),this[n]=!0,yield*this[c]}}class g{static buildDispatch(e,t){if(null!=t&&(!Number.isInteger(t)||t<0))throw new i("maxRedirections must be a positive number");const s=e.dispatch.bind(e);return(e,r)=>s(e,new g(s,t,e,r))}constructor(e,t,s,a){if(null!=t&&(!Number.isInteger(t)||t<0))throw new i("maxRedirections must be a positive number");this.dispatch=e,this.location=null;const{maxRedirections:c,...l}=s;this.opts=l,this.maxRedirections=t,this.handler=a,this.history=[],r.isStream(this.opts.body)?(0===r.bodyLength(this.opts.body)&&this.opts.body.on("data",(function(){A(!1)})),"boolean"!=typeof this.opts.body.readableDidRead&&(this.opts.body[n]=!1,o.prototype.on.call(this.opts.body,"data",(function(){this[n]=!0})))):(this.opts.body&&"function"==typeof this.opts.body.pipeTo||this.opts.body&&"string"!=typeof this.opts.body&&!ArrayBuffer.isView(this.opts.body)&&r.isIterable(this.opts.body)&&!r.isFormDataLike(this.opts.body))&&(this.opts.body=new h(this.opts.body))}onRequestStart(e,t){this.handler.onRequestStart?.(e,{...t,history:this.history})}onRequestUpgrade(e,t,s,r){this.handler.onRequestUpgrade?.(e,t,s,r)}onResponseStart(e,t,s,n){if(this.opts.throwOnMaxRedirect&&this.history.length>=this.maxRedirections)throw new Error("max redirects");if(301!==t&&302!==t||"POST"!==this.opts.method||(this.opts.method="GET",r.isStream(this.opts.body)&&r.destroy(this.opts.body.on("error",l)),this.opts.body=null),303===t&&"HEAD"!==this.opts.method&&(this.opts.method="GET",r.isStream(this.opts.body)&&r.destroy(this.opts.body.on("error",l)),this.opts.body=null),this.location=this.history.length>=this.maxRedirections||r.isDisturbed(this.opts.body)||-1===a.indexOf(t)?null:s.location,this.opts.origin&&this.history.push(new URL(this.opts.path,this.opts.origin)),!this.location)return void this.handler.onResponseStart?.(e,t,s,n);const{origin:o,pathname:c,search:h}=r.parseURL(new URL(this.location,this.opts.origin&&new URL(this.opts.path,this.opts.origin))),g=h?`${c}${h}`:c,u=`${o}${g}`;for(const e of this.history)if(e.toString()===u)throw new i(`Redirect loop detected. Cannot redirect to ${o}. This typically happens when using a Client or Pool with cross-origin redirects. Use an Agent for cross-origin redirects.`);this.opts.headers=function(e,t,s){const r=[];if(Array.isArray(e))for(let n=0;n<e.length;n+=2)d(e[n],t,s)||r.push(e[n],e[n+1]);else if(e&&"object"==typeof e){const n="function"==typeof e[Symbol.iterator]?e:Object.entries(e);for(const[e,A]of n)d(e,t,s)||r.push(e,A)}else A(null==e,"headers must be an object or an array");return r}(this.opts.headers,303===t,this.opts.origin!==o),this.opts.path=g,this.opts.origin=o,this.opts.query=null}onResponseData(e,t){this.location||this.handler.onResponseData?.(e,t)}onResponseEnd(e,t){this.location?this.dispatch(this.opts,this):this.handler.onResponseEnd(e,t)}onResponseError(e,t){this.handler.onResponseError?.(e,t)}}function d(e,t,s){if(4===e.length)return"host"===r.headerNameToString(e);if(t&&r.headerNameToString(e).startsWith("content-"))return!0;if(s&&(13===e.length||6===e.length||19===e.length)){const t=r.headerNameToString(e);return"authorization"===t||"cookie"===t||"proxy-authorization"===t}return!1}e.exports=g},6294:(e,t,s)=>{"use strict";const r=s(4589),{kRetryHandlerDefaultRetry:n}=s(257),{RequestRetryError:A}=s(4465),i=s(832),{isDisturbed:o,parseRangeHeader:a,wrapRequestBody:c}=s(2858);class l{constructor(e,{dispatch:t,handler:s}){const{retryOptions:r,...A}=e,{retry:o,maxRetries:a,maxTimeout:h,minTimeout:g,timeoutFactor:d,methods:u,errorCodes:E,retryAfter:I,statusCodes:C,throwOnError:B}=r??{};this.error=null,this.dispatch=t,this.handler=i.wrap(s),this.opts={...A,body:c(e.body)},this.retryOpts={throwOnError:B??!0,retry:o??l[n],retryAfter:I??!0,maxTimeout:h??3e4,minTimeout:g??500,timeoutFactor:d??2,maxRetries:a??5,methods:u??["GET","HEAD","OPTIONS","PUT","DELETE","TRACE"],statusCodes:C??[500,502,503,504,429],errorCodes:E??["ECONNRESET","ECONNREFUSED","ENOTFOUND","ENETDOWN","ENETUNREACH","EHOSTDOWN","EHOSTUNREACH","EPIPE","UND_ERR_SOCKET"]},this.retryCount=0,this.retryCountCheckpoint=0,this.headersSent=!1,this.start=0,this.end=null,this.etag=null}onResponseStartWithRetry(e,t,s,r,n){if(this.retryOpts.throwOnError)!1===this.retryOpts.statusCodes.includes(t)?(this.headersSent=!0,this.handler.onResponseStart?.(e,t,s,r)):this.error=n;else{if(o(this.opts.body))return this.headersSent=!0,void this.handler.onResponseStart?.(e,t,s,r);e.pause(),this.retryOpts.retry(n,{state:{counter:this.retryCount},opts:{retryOptions:this.retryOpts,...this.opts}},function(A){if(A)return this.headersSent=!0,this.headersSent=!0,this.handler.onResponseStart?.(e,t,s,r),void e.resume();this.error=n,e.resume()}.bind(this))}}onRequestStart(e,t){this.headersSent||this.handler.onRequestStart?.(e,t)}onRequestUpgrade(e,t,s,r){this.handler.onRequestUpgrade?.(e,t,s,r)}static[n](e,{state:t,opts:s},r){const{statusCode:n,code:A,headers:i}=e,{method:o,retryOptions:a}=s,{maxRetries:c,minTimeout:l,maxTimeout:h,timeoutFactor:g,statusCodes:d,errorCodes:u,methods:E}=a,{counter:I}=t;if(A&&"UND_ERR_REQ_RETRY"!==A&&!u.includes(A))return void r(e);if(Array.isArray(E)&&!E.includes(o))return void r(e);if(null!=n&&Array.isArray(d)&&!d.includes(n))return void r(e);if(I>c)return void r(e);let C=i?.["retry-after"];C&&(C=Number(C),C=Number.isNaN(C)?function(e){const t=new Date(e).getTime();return isNaN(t)?0:t-Date.now()}(i["retry-after"]):1e3*C);const B=C>0?Math.min(C,h):Math.min(l*g**(I-1),h);setTimeout((()=>r(null)),B)}onResponseStart(e,t,s,n){if(this.error=null,this.retryCount+=1,t>=300){const r=new A("Request failed",t,{headers:s,data:{count:this.retryCount}});this.onResponseStartWithRetry(e,t,s,n,r)}else{if(this.headersSent){if(206!==t&&(this.start>0||200!==t))throw new A("server does not support the range header and the payload was partially consumed",t,{headers:s,data:{count:this.retryCount}});const e=a(s["content-range"]);if(!e)throw new A("Content-Range mismatch",t,{headers:s,data:{count:this.retryCount}});if(null!=this.etag&&this.etag!==s.etag)throw new A("ETag mismatch",t,{headers:s,data:{count:this.retryCount}});const{start:n,size:i,end:o=(i?i-1:null)}=e;return r(this.start===n,"content-range mismatch"),void r(null==this.end||this.end===o,"content-range mismatch")}if(null!=this.end)throw new A("Request failed",t,{headers:s,data:{count:this.retryCount}});if(206===t){const A=a(s["content-range"]);if(null==A)return this.headersSent=!0,void this.handler.onResponseStart?.(e,t,s,n);const{start:i,size:o,end:c=(o?o-1:null)}=A;r(null!=i&&Number.isFinite(i),"content-range mismatch"),r(null!=c&&Number.isFinite(c),"invalid content-length"),this.start=i,this.end=c}if(null==this.end){const e=s["content-length"];this.end=null!=e?Number(e)-1:null}r(Number.isFinite(this.start)),r(null==this.end||Number.isFinite(this.end),"invalid content-length"),this.resume=!0,this.etag=null!=s.etag?s.etag:null,null!=this.etag&&"W"===this.etag[0]&&"/"===this.etag[1]&&(this.etag=null),this.headersSent=!0,this.handler.onResponseStart?.(e,t,s,n)}}onResponseData(e,t){this.error||(this.start+=t.length,this.handler.onResponseData?.(e,t))}onResponseEnd(e,t){if(this.error&&this.retryOpts.throwOnError)throw this.error;if(!this.error)return this.retryCount=0,this.handler.onResponseEnd?.(e,t);this.retry(e)}retry(e){if(0!==this.start){const e={range:`bytes=${this.start}-${this.end??""}`};null!=this.etag&&(e["if-match"]=this.etag),this.opts={...this.opts,headers:{...this.opts.headers,...e}}}try{this.retryCountCheckpoint=this.retryCount,this.dispatch(this.opts,this)}catch(t){this.handler.onResponseError?.(e,t)}}onResponseError(e,t){e?.aborted||o(this.opts.body)?this.handler.onResponseError?.(e,t):(this.retryCount-this.retryCountCheckpoint>0?this.retryCount=this.retryCountCheckpoint+(this.retryCount-this.retryCountCheckpoint):this.retryCount+=1,this.retryOpts.retry(t,{state:{counter:this.retryCount},opts:{retryOptions:this.retryOpts,...this.opts}},function(t){t?this.handler?.onResponseError?.(e,t):this.retry(e)}.bind(this)))}}e.exports=l},4555:(e,t,s)=>{"use strict";const{parseHeaders:r}=s(2858),{InvalidArgumentError:n}=s(4465),A=Symbol("resume");class i{#J=!1;#W=null;#_=!1;#q;[A]=null;constructor(e){this.#q=e}pause(){this.#J=!0}resume(){this.#J&&(this.#J=!1,this[A]?.())}abort(e){this.#_||(this.#_=!0,this.#W=e,this.#q(e))}get aborted(){return this.#_}get reason(){return this.#W}get paused(){return this.#J}}e.exports=class e{#U;#$;constructor(e){this.#U=e}static unwrap(t){return t.onRequestStart?new e(t):t}onConnect(e,t){this.#$=new i(e),this.#U.onRequestStart?.(this.#$,t)}onUpgrade(e,t,s){this.#U.onRequestUpgrade?.(this.#$,e,r(t),s)}onHeaders(e,t,s,n){return this.#$[A]=s,this.#U.onResponseStart?.(this.#$,e,r(t),n),!this.#$.paused}onData(e){return this.#U.onResponseData?.(this.#$,e),!this.#$.paused}onComplete(e){this.#U.onResponseEnd?.(this.#$,r(e))}onError(e){if(!this.#U.onResponseError)throw new n("invalid onError method");this.#U.onResponseError?.(this.#$,e)}}},832:(e,t,s)=>{"use strict";const{InvalidArgumentError:r}=s(4465);e.exports=class e{#U;constructor(e){this.#U=e}static wrap(t){return t.onRequestStart?t:new e(t)}onConnect(e,t){return this.#U.onConnect?.(e,t)}onHeaders(e,t,s,r){return this.#U.onHeaders?.(e,t,s,r)}onUpgrade(e,t,s){return this.#U.onUpgrade?.(e,t,s)}onData(e){return this.#U.onData?.(e)}onComplete(e){return this.#U.onComplete?.(e)}onError(e){if(!this.#U.onError)throw e;return this.#U.onError?.(e)}onRequestStart(e,t){this.#U.onConnect?.((t=>e.abort(t)),t)}onRequestUpgrade(e,t,s,r){const n=[];for(const[e,t]of Object.entries(s))n.push(Buffer.from(e),Array.isArray(t)?t.map((e=>Buffer.from(e))):Buffer.from(t));this.#U.onUpgrade?.(t,n,r)}onResponseStart(e,t,s,r){const n=[];for(const[e,t]of Object.entries(s))n.push(Buffer.from(e),Array.isArray(t)?t.map((e=>Buffer.from(e))):Buffer.from(t));!1===this.#U.onHeaders?.(t,n,(()=>e.resume()),r)&&e.pause()}onResponseData(e,t){!1===this.#U.onData?.(t)&&e.pause()}onResponseEnd(e,t){const s=[];for(const[e,r]of Object.entries(t))s.push(Buffer.from(e),Array.isArray(r)?r.map((e=>Buffer.from(e))):Buffer.from(r));this.#U.onComplete?.(s)}onResponseError(e,t){if(!this.#U.onError)throw new r("invalid onError method");this.#U.onError?.(t)}}},5752:(e,t,s)=>{"use strict";const r=s(4589),{Readable:n}=s(7075),A=s(2858),i=s(8358),o=s(9903),a=s(6607),{assertCacheStore:c,assertCacheMethods:l,makeCacheKey:h,normalizeHeaders:g,parseCacheControlHeader:d}=s(9453),{AbortError:u}=s(4465);function E(e,t,s,i,o,a){const c=A.isStream(s.body)?s.body:n.from(s.body??[]);r(!c.destroyed,"stream should not be destroyed"),r(!c.readableDidRead,"stream should not be readableDidRead");const l={resume(){c.resume()},pause(){c.pause()},get paused(){return c.isPaused()},get aborted(){return c.destroyed},get reason(){return c.errored},abort(e){c.destroy(e??new u)}};if(c.on("error",(function(t){if(!this.readableEnded){if("function"!=typeof e.onResponseError)throw t;e.onResponseError(l,t)}})).on("close",(function(){this.errored||e.onResponseEnd?.(l,{})})),e.onRequestStart?.(l,o),c.destroyed)return;const h={...s.headers,age:String(i)};a&&(h.warning='110 - "response is stale"'),e.onResponseStart?.(l,s.statusCode,h,s.statusMessage),"HEAD"===t.method?c.destroy():c.on("data",(function(t){e.onResponseData?.(l,t)}))}function I(e,t,s,r,n,o,c){if(!c)return function(e,t,s,r,n,A){if(A?.["only-if-cached"]){let e=!1;try{if("function"==typeof r.onConnect&&(r.onConnect((()=>{e=!0})),e))return;if("function"==typeof r.onHeaders&&(r.onHeaders(504,[],(()=>{}),"Gateway Timeout"),e))return;"function"==typeof r.onComplete&&r.onComplete([])}catch(e){"function"==typeof r.onError&&r.onError(e)}return!0}return e(n,new i(t,s,r))}(e,t,s,r,n,o);const l=Date.now();if(l>c.deleteAt)return e(n,new i(t,s,r));const h=Math.round((l-c.cachedAt)/1e3);if(o?.["max-age"]&&h>=o["max-age"])return e(n,r);if(function(e,t){if(t?.["no-cache"])return!0;if(e.cacheControlDirectives?.["no-cache"]&&!Array.isArray(e.cacheControlDirectives["no-cache"]))return!0;const s=Date.now();if(s>e.staleAt)return!t?.["max-stale"]||s>e.staleAt+1e3*t["max-stale"];if(t?.["min-fresh"])return e.staleAt-s<=1e3*t["min-fresh"];return!1}(c,o)){if(A.isStream(n.body)&&0!==A.bodyLength(n.body))return e(n,new i(t,s,r));if(function(e){const t=e.cacheControlDirectives?.["stale-while-revalidate"];return!!t&&Date.now()<=e.staleAt+1e3*t}(c))return E(r,n,c,h,null,!0),queueMicrotask((()=>{let r={...n.headers,"if-modified-since":new Date(c.cachedAt).toUTCString()};c.etag&&(r["if-none-match"]=c.etag),c.vary&&(r={...r,...c.vary}),e({...n,headers:r},new i(t,s,{onRequestStart(){},onRequestUpgrade(){},onResponseStart(){},onResponseData(){},onResponseEnd(){},onResponseError(){}}))})),!0;let g=!1;const d=c.cacheControlDirectives["stale-if-error"]??o?.["stale-if-error"];d&&(g=l<c.staleAt+1e3*d);let u={...n.headers,"if-modified-since":new Date(c.cachedAt).toUTCString()};return c.etag&&(u["if-none-match"]=c.etag),c.vary&&(u={...u,...c.vary}),e({...n,headers:u},new a(((e,t)=>{e?E(r,n,c,h,t,!0):A.isStream(c.body)&&c.body.on("error",(()=>{})).destroy()}),new i(t,s,r),g))}A.isStream(n.body)&&n.body.on("error",(()=>{})).destroy(),E(r,n,c,h,null,!1)}e.exports=(e={})=>{const{store:t=new o,methods:s=["GET"],cacheByDefault:r,type:n="shared"}=e;if("object"!=typeof e||null===e)throw new TypeError("expected type of opts to be an Object, got "+(null===e?"null":typeof e));if(c(t,"opts.store"),l(s,"opts.methods"),"undefined"!=typeof r&&"number"!=typeof r)throw new TypeError("expected opts.cacheByDefault to be number or undefined, got "+typeof r);if("undefined"!=typeof n&&"shared"!==n&&"private"!==n)throw new TypeError("expected opts.type to be shared, private, or undefined, got "+typeof n);const i={store:t,methods:s,cacheByDefault:r,type:n},a=A.safeHTTPMethods.filter((e=>!1===s.includes(e)));return e=>(s,r)=>{if(!s.origin||a.includes(s.method))return e(s,r);s={...s,headers:g(s)};const n=s.headers?.["cache-control"]?d(s.headers["cache-control"]):void 0;if(n?.["no-store"])return e(s,r);const A=h(s),o=t.get(A);return o&&"function"==typeof o.then?o.then((t=>{I(e,i,A,r,s,n,t)})):I(e,i,A,r,s,n,o),!0}}},4951:(e,t,s)=>{"use strict";const{createInflate:r,createGunzip:n,createBrotliDecompress:A,createZstdDecompress:i}=s(8522),{pipeline:o}=s(7075),a=s(6917),c={gzip:n,"x-gzip":n,br:A,deflate:r,compress:r,"x-compress":r,...i?{zstd:i}:{}},l=[204,304];let h=!1;class g extends a{#z=[];#X;#j;#Z;constructor(e,{skipStatusCodes:t=l,skipErrorResponses:s=!0}={}){super(e),this.#j=t,this.#Z=s}#K(e,t){return!e||t<200||(!!this.#j.includes(t)||!!(this.#Z&&t>=400))}#ee(e){const t=e.split(","),s=[];for(let e=t.length-1;e>=0;e--){const r=t[e].trim();if(r){if(!c[r])return s.length=0,s;s.push(c[r]())}}return s}#te(e,t){e.on("readable",(()=>{let s;for(;null!==(s=e.read());){if(!1===super.onResponseData(t,s))break}})),e.on("error",(e=>{super.onResponseError(t,e)}))}#se(e){const t=this.#z[0];this.#te(t,e),t.on("end",(()=>{super.onResponseEnd(e,{})}))}#re(e){const t=this.#z[this.#z.length-1];this.#te(t,e),this.#X=o(this.#z,(t=>{t?super.onResponseError(e,t):super.onResponseEnd(e,{})}))}#ne(){this.#z.length=0,this.#X=null}onResponseStart(e,t,s,r){const n=s["content-encoding"];if(this.#K(n,t))return super.onResponseStart(e,t,s,r);const A=this.#ee(n.toLowerCase());if(0===A.length)return this.#ne(),super.onResponseStart(e,t,s,r);this.#z=A;const{"content-encoding":i,"content-length":o,...a}=s;1===this.#z.length?this.#se(e):this.#re(e),super.onResponseStart(e,t,a,r)}onResponseData(e,t){this.#z.length>0?this.#z[0].write(t):super.onResponseData(e,t)}onResponseEnd(e,t){if(this.#z.length>0)return this.#z[0].end(),void this.#ne();super.onResponseEnd(e,t)}onResponseError(e,t){if(this.#z.length>0){for(const e of this.#z)e.destroy(t);this.#ne()}super.onResponseError(e,t)}}e.exports=function(e={}){return h||(process.emitWarning("DecompressInterceptor is experimental and subject to change","ExperimentalWarning"),h=!0),t=>(s,r)=>{const n=new g(r,e);return t(s,n)}}},6677:(e,t,s)=>{"use strict";const{isIP:r}=s(7030),{lookup:n}=s(610),A=s(6917),{InvalidArgumentError:i,InformationalError:o}=s(4465),a=Math.pow(2,31)-1;class c{#Ae=0;#ie=0;#oe=new Map;dualStack=!0;affinity=null;lookup=null;pick=null;constructor(e){this.#Ae=e.maxTTL,this.#ie=e.maxItems,this.dualStack=e.dualStack,this.affinity=e.affinity,this.lookup=e.lookup??this.#ae,this.pick=e.pick??this.#ce}get full(){return this.#oe.size===this.#ie}runLookup(e,t,s){const r=this.#oe.get(e.hostname);if(null==r&&this.full)return void s(null,e);const n={affinity:this.affinity,dualStack:this.dualStack,lookup:this.lookup,pick:this.pick,...t.dns,maxTTL:this.#Ae,maxItems:this.#ie};if(null==r)this.lookup(e,n,((t,r)=>{if(t||null==r||0===r.length)return void s(t??new o("No DNS entries found"));this.setRecords(e,r);const A=this.#oe.get(e.hostname),i=this.pick(e,A,n.affinity);let a;a="number"==typeof i.port?`:${i.port}`:""!==e.port?`:${e.port}`:"",s(null,new URL(`${e.protocol}//${6===i.family?`[${i.address}]`:i.address}${a}`))}));else{const A=this.pick(e,r,n.affinity);if(null==A)return this.#oe.delete(e.hostname),void this.runLookup(e,t,s);let i;i="number"==typeof A.port?`:${A.port}`:""!==e.port?`:${e.port}`:"",s(null,new URL(`${e.protocol}//${6===A.family?`[${A.address}]`:A.address}${i}`))}}#ae(e,t,s){n(e.hostname,{all:!0,family:!1===this.dualStack?this.affinity:0,order:"ipv4first"},((e,t)=>{if(e)return s(e);const r=new Map;for(const e of t)r.set(`${e.address}:${e.family}`,e);s(null,r.values())}))}#ce(e,t,s){let r=null;const{records:n,offset:A}=t;let i;if(this.dualStack?(null==s&&(null==A||A===a?(t.offset=0,s=4):(t.offset++,s=1&~t.offset?4:6)),i=null!=n[s]&&n[s].ips.length>0?n[s]:n[4===s?6:4]):i=n[s],null==i||0===i.ips.length)return r;null==i.offset||i.offset===a?i.offset=0:i.offset++;const o=i.offset%i.ips.length;return r=i.ips[o]??null,null==r?r:Date.now()-r.timestamp>r.ttl?(i.ips.splice(o,1),this.pick(e,t,s)):r}pickFamily(e,t){const s=this.#oe.get(e.hostname)?.records;if(!s)return null;const r=s[t];if(!r)return null;null==r.offset||r.offset===a?r.offset=0:r.offset++;const n=r.offset%r.ips.length,A=r.ips[n]??null;return null==A||Date.now()-A.timestamp>A.ttl&&r.ips.splice(n,1),A}setRecords(e,t){const s=Date.now(),r={records:{4:null,6:null}};for(const e of t){e.timestamp=s,"number"==typeof e.ttl?e.ttl=Math.min(e.ttl,this.#Ae):e.ttl=this.#Ae;const t=r.records[e.family]??{ips:[]};t.ips.push(e),r.records[e.family]=t}this.#oe.set(e.hostname,r)}deleteRecords(e){this.#oe.delete(e.hostname)}getHandler(e,t){return new l(this,e,t)}}class l extends A{#le=null;#p=null;#he=null;#ge=null;#$=null;#de=null;#ue=!0;constructor(e,{origin:t,handler:s,dispatch:r,newOrigin:n},A){super(s),this.#ge=t,this.#de=n,this.#p={...A},this.#le=e,this.#he=r}onResponseError(e,t){switch(t.code){case"ETIMEDOUT":case"ECONNREFUSED":if(this.#le.dualStack){if(!this.#ue)return void super.onResponseError(e,t);this.#ue=!1;const s="["===this.#de.hostname[0]?4:6,r=this.#le.pickFamily(this.#ge,s);if(null==r)return void super.onResponseError(e,t);let n;n="number"==typeof r.port?`:${r.port}`:""!==this.#ge.port?`:${this.#ge.port}`:"";const A={...this.#p,origin:`${this.#ge.protocol}//${6===r.family?`[${r.address}]`:r.address}${n}`};return void this.#he(A,this)}super.onResponseError(e,t);break;case"ENOTFOUND":this.#le.deleteRecords(this.#ge),super.onResponseError(e,t);break;default:super.onResponseError(e,t)}}}e.exports=e=>{if(null!=e?.maxTTL&&("number"!=typeof e?.maxTTL||e?.maxTTL<0))throw new i("Invalid maxTTL. Must be a positive number");if(null!=e?.maxItems&&("number"!=typeof e?.maxItems||e?.maxItems<1))throw new i("Invalid maxItems. Must be a positive number and greater than zero");if(null!=e?.affinity&&4!==e?.affinity&&6!==e?.affinity)throw new i("Invalid affinity. Must be either 4 or 6");if(null!=e?.dualStack&&"boolean"!=typeof e?.dualStack)throw new i("Invalid dualStack. Must be a boolean");if(null!=e?.lookup&&"function"!=typeof e?.lookup)throw new i("Invalid lookup. Must be a function");if(null!=e?.pick&&"function"!=typeof e?.pick)throw new i("Invalid pick. Must be a function");const t=e?.dualStack??!0;let s;s=t?e?.affinity??null:e?.affinity??4;const n=new c({maxTTL:e?.maxTTL??1e4,lookup:e?.lookup??null,pick:e?.pick??null,dualStack:t,affinity:s,maxItems:e?.maxItems??1/0});return e=>function(t,s){const A=t.origin.constructor===URL?t.origin:new URL(t.origin);return 0!==r(A.hostname)?e(t,s):(n.runLookup(A,t,((r,i)=>{if(r)return s.onResponseError(null,r);const o={...t,servername:A.hostname,origin:i.origin,headers:{host:A.host,...t.headers}};e(o,n.getHandler({origin:A,dispatch:e,handler:s,newOrigin:i},t))})),!0)}}},3562:(e,t,s)=>{"use strict";const{InvalidArgumentError:r,RequestAbortedError:n}=s(4465),A=s(6917);class i extends A{#t=1048576;#Ee=!1;#r=0;#$=null;aborted=!1;reason=!1;constructor({maxSize:e,signal:t},s){if(null!=e&&(!Number.isFinite(e)||e<1))throw new r("maxSize must be a number greater than 0");super(s),this.#t=e??this.#t}#q(e){this.aborted=!0,this.reason=e}onRequestStart(e,t){return e.abort=this.#q.bind(this),this.#$=e,super.onRequestStart(e,t)}onResponseStart(e,t,s,r){const A=s["content-length"];if(null!=A&&A>this.#t)throw new n(`Response size (${A}) larger than maxSize (${this.#t})`);return!0===this.aborted||super.onResponseStart(e,t,s,r)}onResponseError(e,t){this.#Ee||(t=this.#$?.reason??t,super.onResponseError(e,t))}onResponseData(e,t){return this.#r=this.#r+t.length,this.#r>=this.#t&&(this.#Ee=!0,!0===this.aborted?super.onResponseError(e,this.reason):super.onResponseEnd(e,{})),!0}onResponseEnd(e,t){this.#Ee||(!0!==this.#$.aborted?super.onResponseEnd(e,t):super.onResponseError(e,this.reason))}}e.exports=function({maxSize:e}={maxSize:1048576}){return t=>function(s,r){const{dumpMaxSize:n=e}=s,A=new i({maxSize:n,signal:s.signal},r);return t(s,A)}}},5132:(e,t,s)=>{"use strict";const r=s(8064);e.exports=function({maxRedirections:e}={}){return t=>function(s,n){const{maxRedirections:A=e,...i}=s;if(null==A||0===A)return t(s,n);const o={...i},a=new r(t,A,o,n);return t(o,a)}}},2936:(e,t,s)=>{"use strict";const r=s(6917),{ResponseError:n}=s(4465);class A extends r{#Ie;#Ce;#Be;#Qe;#pe;constructor(e,{handler:t}){super(t)}#fe(e){return 0===(this.#Ce??"").indexOf(e)}onRequestStart(e,t){return this.#Ie=0,this.#Ce=null,this.#Be=null,this.#Qe=null,this.#pe="",super.onRequestStart(e,t)}onResponseStart(e,t,s,r){if(this.#Ie=t,this.#Qe=s,this.#Ce=s["content-type"],this.#Ie<400)return super.onResponseStart(e,t,s,r);(this.#fe("application/json")||this.#fe("text/plain"))&&(this.#Be=new TextDecoder("utf-8"))}onResponseData(e,t){if(this.#Ie<400)return super.onResponseData(e,t);this.#pe+=this.#Be?.decode(t,{stream:!0})??""}onResponseEnd(e,t){if(this.#Ie>=400){if(this.#pe+=this.#Be?.decode(void 0,{stream:!1})??"",this.#fe("application/json"))try{this.#pe=JSON.parse(this.#pe)}catch{}let t;const s=Error.stackTraceLimit;Error.stackTraceLimit=0;try{t=new n("Response Error",this.#Ie,{body:this.#pe,headers:this.#Qe})}finally{Error.stackTraceLimit=s}super.onResponseError(e,t)}else super.onResponseEnd(e,t)}onResponseError(e,t){super.onResponseError(e,t)}}e.exports=()=>e=>function(t,s){return e(t,new A(t,{handler:s}))}},532:(e,t,s)=>{"use strict";const r=s(6294);e.exports=e=>t=>function(s,n){return t(s,new r({...s,retryOptions:{...e,...s.retryOptions}},{handler:n,dispatch:t}))}},4178:(e,t,s)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.SPECIAL_HEADERS=t.MINOR=t.MAJOR=t.HTAB_SP_VCHAR_OBS_TEXT=t.QUOTED_STRING=t.CONNECTION_TOKEN_CHARS=t.HEADER_CHARS=t.TOKEN=t.HEX=t.URL_CHAR=t.USERINFO_CHARS=t.MARK=t.ALPHANUM=t.NUM=t.HEX_MAP=t.NUM_MAP=t.ALPHA=t.STATUSES_HTTP=t.H_METHOD_MAP=t.METHOD_MAP=t.METHODS_RTSP=t.METHODS_ICE=t.METHODS_HTTP=t.HEADER_STATE=t.FINISH=t.STATUSES=t.METHODS=t.LENIENT_FLAGS=t.FLAGS=t.TYPE=t.ERROR=void 0;const r=s(3530);t.ERROR={OK:0,INTERNAL:1,STRICT:2,CR_EXPECTED:25,LF_EXPECTED:3,UNEXPECTED_CONTENT_LENGTH:4,UNEXPECTED_SPACE:30,CLOSED_CONNECTION:5,INVALID_METHOD:6,INVALID_URL:7,INVALID_CONSTANT:8,INVALID_VERSION:9,INVALID_HEADER_TOKEN:10,INVALID_CONTENT_LENGTH:11,INVALID_CHUNK_SIZE:12,INVALID_STATUS:13,INVALID_EOF_STATE:14,INVALID_TRANSFER_ENCODING:15,CB_MESSAGE_BEGIN:16,CB_HEADERS_COMPLETE:17,CB_MESSAGE_COMPLETE:18,CB_CHUNK_HEADER:19,CB_CHUNK_COMPLETE:20,PAUSED:21,PAUSED_UPGRADE:22,PAUSED_H2_UPGRADE:23,USER:24,CB_URL_COMPLETE:26,CB_STATUS_COMPLETE:27,CB_METHOD_COMPLETE:32,CB_VERSION_COMPLETE:33,CB_HEADER_FIELD_COMPLETE:28,CB_HEADER_VALUE_COMPLETE:29,CB_CHUNK_EXTENSION_NAME_COMPLETE:34,CB_CHUNK_EXTENSION_VALUE_COMPLETE:35,CB_RESET:31,CB_PROTOCOL_COMPLETE:38},t.TYPE={BOTH:0,REQUEST:1,RESPONSE:2},t.FLAGS={CONNECTION_KEEP_ALIVE:1,CONNECTION_CLOSE:2,CONNECTION_UPGRADE:4,CHUNKED:8,UPGRADE:16,CONTENT_LENGTH:32,SKIPBODY:64,TRAILING:128,TRANSFER_ENCODING:512},t.LENIENT_FLAGS={HEADERS:1,CHUNKED_LENGTH:2,KEEP_ALIVE:4,TRANSFER_ENCODING:8,VERSION:16,DATA_AFTER_CLOSE:32,OPTIONAL_LF_AFTER_CR:64,OPTIONAL_CRLF_AFTER_CHUNK:128,OPTIONAL_CR_BEFORE_LF:256,SPACES_AFTER_CHUNK_SIZE:512},t.METHODS={DELETE:0,GET:1,HEAD:2,POST:3,PUT:4,CONNECT:5,OPTIONS:6,TRACE:7,COPY:8,LOCK:9,MKCOL:10,MOVE:11,PROPFIND:12,PROPPATCH:13,SEARCH:14,UNLOCK:15,BIND:16,REBIND:17,UNBIND:18,ACL:19,REPORT:20,MKACTIVITY:21,CHECKOUT:22,MERGE:23,"M-SEARCH":24,NOTIFY:25,SUBSCRIBE:26,UNSUBSCRIBE:27,PATCH:28,PURGE:29,MKCALENDAR:30,LINK:31,UNLINK:32,SOURCE:33,PRI:34,DESCRIBE:35,ANNOUNCE:36,SETUP:37,PLAY:38,PAUSE:39,TEARDOWN:40,GET_PARAMETER:41,SET_PARAMETER:42,REDIRECT:43,RECORD:44,FLUSH:45,QUERY:46},t.STATUSES={CONTINUE:100,SWITCHING_PROTOCOLS:101,PROCESSING:102,EARLY_HINTS:103,RESPONSE_IS_STALE:110,REVALIDATION_FAILED:111,DISCONNECTED_OPERATION:112,HEURISTIC_EXPIRATION:113,MISCELLANEOUS_WARNING:199,OK:200,CREATED:201,ACCEPTED:202,NON_AUTHORITATIVE_INFORMATION:203,NO_CONTENT:204,RESET_CONTENT:205,PARTIAL_CONTENT:206,MULTI_STATUS:207,ALREADY_REPORTED:208,TRANSFORMATION_APPLIED:214,IM_USED:226,MISCELLANEOUS_PERSISTENT_WARNING:299,MULTIPLE_CHOICES:300,MOVED_PERMANENTLY:301,FOUND:302,SEE_OTHER:303,NOT_MODIFIED:304,USE_PROXY:305,SWITCH_PROXY:306,TEMPORARY_REDIRECT:307,PERMANENT_REDIRECT:308,BAD_REQUEST:400,UNAUTHORIZED:401,PAYMENT_REQUIRED:402,FORBIDDEN:403,NOT_FOUND:404,METHOD_NOT_ALLOWED:405,NOT_ACCEPTABLE:406,PROXY_AUTHENTICATION_REQUIRED:407,REQUEST_TIMEOUT:408,CONFLICT:409,GONE:410,LENGTH_REQUIRED:411,PRECONDITION_FAILED:412,PAYLOAD_TOO_LARGE:413,URI_TOO_LONG:414,UNSUPPORTED_MEDIA_TYPE:415,RANGE_NOT_SATISFIABLE:416,EXPECTATION_FAILED:417,IM_A_TEAPOT:418,PAGE_EXPIRED:419,ENHANCE_YOUR_CALM:420,MISDIRECTED_REQUEST:421,UNPROCESSABLE_ENTITY:422,LOCKED:423,FAILED_DEPENDENCY:424,TOO_EARLY:425,UPGRADE_REQUIRED:426,PRECONDITION_REQUIRED:428,TOO_MANY_REQUESTS:429,REQUEST_HEADER_FIELDS_TOO_LARGE_UNOFFICIAL:430,REQUEST_HEADER_FIELDS_TOO_LARGE:431,LOGIN_TIMEOUT:440,NO_RESPONSE:444,RETRY_WITH:449,BLOCKED_BY_PARENTAL_CONTROL:450,UNAVAILABLE_FOR_LEGAL_REASONS:451,CLIENT_CLOSED_LOAD_BALANCED_REQUEST:460,INVALID_X_FORWARDED_FOR:463,REQUEST_HEADER_TOO_LARGE:494,SSL_CERTIFICATE_ERROR:495,SSL_CERTIFICATE_REQUIRED:496,HTTP_REQUEST_SENT_TO_HTTPS_PORT:497,INVALID_TOKEN:498,CLIENT_CLOSED_REQUEST:499,INTERNAL_SERVER_ERROR:500,NOT_IMPLEMENTED:501,BAD_GATEWAY:502,SERVICE_UNAVAILABLE:503,GATEWAY_TIMEOUT:504,HTTP_VERSION_NOT_SUPPORTED:505,VARIANT_ALSO_NEGOTIATES:506,INSUFFICIENT_STORAGE:507,LOOP_DETECTED:508,BANDWIDTH_LIMIT_EXCEEDED:509,NOT_EXTENDED:510,NETWORK_AUTHENTICATION_REQUIRED:511,WEB_SERVER_UNKNOWN_ERROR:520,WEB_SERVER_IS_DOWN:521,CONNECTION_TIMEOUT:522,ORIGIN_IS_UNREACHABLE:523,TIMEOUT_OCCURED:524,SSL_HANDSHAKE_FAILED:525,INVALID_SSL_CERTIFICATE:526,RAILGUN_ERROR:527,SITE_IS_OVERLOADED:529,SITE_IS_FROZEN:530,IDENTITY_PROVIDER_AUTHENTICATION_ERROR:561,NETWORK_READ_TIMEOUT:598,NETWORK_CONNECT_TIMEOUT:599},t.FINISH={SAFE:0,SAFE_WITH_CB:1,UNSAFE:2},t.HEADER_STATE={GENERAL:0,CONNECTION:1,CONTENT_LENGTH:2,TRANSFER_ENCODING:3,UPGRADE:4,CONNECTION_KEEP_ALIVE:5,CONNECTION_CLOSE:6,CONNECTION_UPGRADE:7,TRANSFER_ENCODING_CHUNKED:8},t.METHODS_HTTP=[t.METHODS.DELETE,t.METHODS.GET,t.METHODS.HEAD,t.METHODS.POST,t.METHODS.PUT,t.METHODS.CONNECT,t.METHODS.OPTIONS,t.METHODS.TRACE,t.METHODS.COPY,t.METHODS.LOCK,t.METHODS.MKCOL,t.METHODS.MOVE,t.METHODS.PROPFIND,t.METHODS.PROPPATCH,t.METHODS.SEARCH,t.METHODS.UNLOCK,t.METHODS.BIND,t.METHODS.REBIND,t.METHODS.UNBIND,t.METHODS.ACL,t.METHODS.REPORT,t.METHODS.MKACTIVITY,t.METHODS.CHECKOUT,t.METHODS.MERGE,t.METHODS["M-SEARCH"],t.METHODS.NOTIFY,t.METHODS.SUBSCRIBE,t.METHODS.UNSUBSCRIBE,t.METHODS.PATCH,t.METHODS.PURGE,t.METHODS.MKCALENDAR,t.METHODS.LINK,t.METHODS.UNLINK,t.METHODS.PRI,t.METHODS.SOURCE,t.METHODS.QUERY],t.METHODS_ICE=[t.METHODS.SOURCE],t.METHODS_RTSP=[t.METHODS.OPTIONS,t.METHODS.DESCRIBE,t.METHODS.ANNOUNCE,t.METHODS.SETUP,t.METHODS.PLAY,t.METHODS.PAUSE,t.METHODS.TEARDOWN,t.METHODS.GET_PARAMETER,t.METHODS.SET_PARAMETER,t.METHODS.REDIRECT,t.METHODS.RECORD,t.METHODS.FLUSH,t.METHODS.GET,t.METHODS.POST],t.METHOD_MAP=(0,r.enumToMap)(t.METHODS),t.H_METHOD_MAP=Object.fromEntries(Object.entries(t.METHODS).filter((([e])=>e.startsWith("H")))),t.STATUSES_HTTP=[t.STATUSES.CONTINUE,t.STATUSES.SWITCHING_PROTOCOLS,t.STATUSES.PROCESSING,t.STATUSES.EARLY_HINTS,t.STATUSES.RESPONSE_IS_STALE,t.STATUSES.REVALIDATION_FAILED,t.STATUSES.DISCONNECTED_OPERATION,t.STATUSES.HEURISTIC_EXPIRATION,t.STATUSES.MISCELLANEOUS_WARNING,t.STATUSES.OK,t.STATUSES.CREATED,t.STATUSES.ACCEPTED,t.STATUSES.NON_AUTHORITATIVE_INFORMATION,t.STATUSES.NO_CONTENT,t.STATUSES.RESET_CONTENT,t.STATUSES.PARTIAL_CONTENT,t.STATUSES.MULTI_STATUS,t.STATUSES.ALREADY_REPORTED,t.STATUSES.TRANSFORMATION_APPLIED,t.STATUSES.IM_USED,t.STATUSES.MISCELLANEOUS_PERSISTENT_WARNING,t.STATUSES.MULTIPLE_CHOICES,t.STATUSES.MOVED_PERMANENTLY,t.STATUSES.FOUND,t.STATUSES.SEE_OTHER,t.STATUSES.NOT_MODIFIED,t.STATUSES.USE_PROXY,t.STATUSES.SWITCH_PROXY,t.STATUSES.TEMPORARY_REDIRECT,t.STATUSES.PERMANENT_REDIRECT,t.STATUSES.BAD_REQUEST,t.STATUSES.UNAUTHORIZED,t.STATUSES.PAYMENT_REQUIRED,t.STATUSES.FORBIDDEN,t.STATUSES.NOT_FOUND,t.STATUSES.METHOD_NOT_ALLOWED,t.STATUSES.NOT_ACCEPTABLE,t.STATUSES.PROXY_AUTHENTICATION_REQUIRED,t.STATUSES.REQUEST_TIMEOUT,t.STATUSES.CONFLICT,t.STATUSES.GONE,t.STATUSES.LENGTH_REQUIRED,t.STATUSES.PRECONDITION_FAILED,t.STATUSES.PAYLOAD_TOO_LARGE,t.STATUSES.URI_TOO_LONG,t.STATUSES.UNSUPPORTED_MEDIA_TYPE,t.STATUSES.RANGE_NOT_SATISFIABLE,t.STATUSES.EXPECTATION_FAILED,t.STATUSES.IM_A_TEAPOT,t.STATUSES.PAGE_EXPIRED,t.STATUSES.ENHANCE_YOUR_CALM,t.STATUSES.MISDIRECTED_REQUEST,t.STATUSES.UNPROCESSABLE_ENTITY,t.STATUSES.LOCKED,t.STATUSES.FAILED_DEPENDENCY,t.STATUSES.TOO_EARLY,t.STATUSES.UPGRADE_REQUIRED,t.STATUSES.PRECONDITION_REQUIRED,t.STATUSES.TOO_MANY_REQUESTS,t.STATUSES.REQUEST_HEADER_FIELDS_TOO_LARGE_UNOFFICIAL,t.STATUSES.REQUEST_HEADER_FIELDS_TOO_LARGE,t.STATUSES.LOGIN_TIMEOUT,t.STATUSES.NO_RESPONSE,t.STATUSES.RETRY_WITH,t.STATUSES.BLOCKED_BY_PARENTAL_CONTROL,t.STATUSES.UNAVAILABLE_FOR_LEGAL_REASONS,t.STATUSES.CLIENT_CLOSED_LOAD_BALANCED_REQUEST,t.STATUSES.INVALID_X_FORWARDED_FOR,t.STATUSES.REQUEST_HEADER_TOO_LARGE,t.STATUSES.SSL_CERTIFICATE_ERROR,t.STATUSES.SSL_CERTIFICATE_REQUIRED,t.STATUSES.HTTP_REQUEST_SENT_TO_HTTPS_PORT,t.STATUSES.INVALID_TOKEN,t.STATUSES.CLIENT_CLOSED_REQUEST,t.STATUSES.INTERNAL_SERVER_ERROR,t.STATUSES.NOT_IMPLEMENTED,t.STATUSES.BAD_GATEWAY,t.STATUSES.SERVICE_UNAVAILABLE,t.STATUSES.GATEWAY_TIMEOUT,t.STATUSES.HTTP_VERSION_NOT_SUPPORTED,t.STATUSES.VARIANT_ALSO_NEGOTIATES,t.STATUSES.INSUFFICIENT_STORAGE,t.STATUSES.LOOP_DETECTED,t.STATUSES.BANDWIDTH_LIMIT_EXCEEDED,t.STATUSES.NOT_EXTENDED,t.STATUSES.NETWORK_AUTHENTICATION_REQUIRED,t.STATUSES.WEB_SERVER_UNKNOWN_ERROR,t.STATUSES.WEB_SERVER_IS_DOWN,t.STATUSES.CONNECTION_TIMEOUT,t.STATUSES.ORIGIN_IS_UNREACHABLE,t.STATUSES.TIMEOUT_OCCURED,t.STATUSES.SSL_HANDSHAKE_FAILED,t.STATUSES.INVALID_SSL_CERTIFICATE,t.STATUSES.RAILGUN_ERROR,t.STATUSES.SITE_IS_OVERLOADED,t.STATUSES.SITE_IS_FROZEN,t.STATUSES.IDENTITY_PROVIDER_AUTHENTICATION_ERROR,t.STATUSES.NETWORK_READ_TIMEOUT,t.STATUSES.NETWORK_CONNECT_TIMEOUT],t.ALPHA=[];for(let e="A".charCodeAt(0);e<="Z".charCodeAt(0);e++)t.ALPHA.push(String.fromCharCode(e)),t.ALPHA.push(String.fromCharCode(e+32));t.NUM_MAP={0:0,1:1,2:2,3:3,4:4,5:5,6:6,7:7,8:8,9:9},t.HEX_MAP={0:0,1:1,2:2,3:3,4:4,5:5,6:6,7:7,8:8,9:9,A:10,B:11,C:12,D:13,E:14,F:15,a:10,b:11,c:12,d:13,e:14,f:15},t.NUM=["0","1","2","3","4","5","6","7","8","9"],t.ALPHANUM=t.ALPHA.concat(t.NUM),t.MARK=["-","_",".","!","~","*","'","(",")"],t.USERINFO_CHARS=t.ALPHANUM.concat(t.MARK).concat(["%",";",":","&","=","+","$",","]),t.URL_CHAR=["!",'"',"$","%","&","'","(",")","*","+",",","-",".","/",":",";","<","=",">","@","[","\\","]","^","_","`","{","|","}","~"].concat(t.ALPHANUM),t.HEX=t.NUM.concat(["a","b","c","d","e","f","A","B","C","D","E","F"]),t.TOKEN=["!","#","$","%","&","'","*","+","-",".","^","_","`","|","~"].concat(t.ALPHANUM),t.HEADER_CHARS=["\t"];for(let e=32;e<=255;e++)127!==e&&t.HEADER_CHARS.push(e);t.CONNECTION_TOKEN_CHARS=t.HEADER_CHARS.filter((e=>44!==e)),t.QUOTED_STRING=["\t"," "];for(let e=33;e<=255;e++)34!==e&&92!==e&&t.QUOTED_STRING.push(e);t.HTAB_SP_VCHAR_OBS_TEXT=["\t"," "];for(let e=33;e<=126;e++)t.HTAB_SP_VCHAR_OBS_TEXT.push(e);for(let e=128;e<=255;e++)t.HTAB_SP_VCHAR_OBS_TEXT.push(e);t.MAJOR=t.NUM_MAP,t.MINOR=t.MAJOR,t.SPECIAL_HEADERS={connection:t.HEADER_STATE.CONNECTION,"content-length":t.HEADER_STATE.CONTENT_LENGTH,"proxy-connection":t.HEADER_STATE.CONNECTION,"transfer-encoding":t.HEADER_STATE.TRANSFER_ENCODING,upgrade:t.HEADER_STATE.UPGRADE},t.default={ERROR:t.ERROR,TYPE:t.TYPE,FLAGS:t.FLAGS,LENIENT_FLAGS:t.LENIENT_FLAGS,METHODS:t.METHODS,STATUSES:t.STATUSES,FINISH:t.FINISH,HEADER_STATE:t.HEADER_STATE,ALPHA:t.ALPHA,NUM_MAP:t.NUM_MAP,HEX_MAP:t.HEX_MAP,NUM:t.NUM,ALPHANUM:t.ALPHANUM,MARK:t.MARK,USERINFO_CHARS:t.USERINFO_CHARS,URL_CHAR:t.URL_CHAR,HEX:t.HEX,TOKEN:t.TOKEN,HEADER_CHARS:t.HEADER_CHARS,CONNECTION_TOKEN_CHARS:t.CONNECTION_TOKEN_CHARS,QUOTED_STRING:t.QUOTED_STRING,HTAB_SP_VCHAR_OBS_TEXT:t.HTAB_SP_VCHAR_OBS_TEXT,MAJOR:t.MAJOR,MINOR:t.MINOR,SPECIAL_HEADERS:t.SPECIAL_HEADERS,METHODS_HTTP:t.METHODS_HTTP,METHODS_ICE:t.METHODS_ICE,METHODS_RTSP:t.METHODS_RTSP,METHOD_MAP:t.METHOD_MAP,H_METHOD_MAP:t.H_METHOD_MAP,STATUSES_HTTP:t.STATUSES_HTTP}},4744:(e,t,s)=>{"use strict";e=s.nmd(e);const{Buffer:r}=s(4573);let n;Object.defineProperty(e,"exports",{get:()=>n||(n=r.from("AGFzbQEAAAABJwdgAX8Bf2ADf39/AX9gAn9/AGABfwBgBH9/f38Bf2AAAGADf39/AALLAQgDZW52GHdhc21fb25faGVhZGVyc19jb21wbGV0ZQAEA2VudhV3YXNtX29uX21lc3NhZ2VfYmVnaW4AAANlbnYLd2FzbV9vbl91cmwAAQNlbnYOd2FzbV9vbl9zdGF0dXMAAQNlbnYUd2FzbV9vbl9oZWFkZXJfZmllbGQAAQNlbnYUd2FzbV9vbl9oZWFkZXJfdmFsdWUAAQNlbnYMd2FzbV9vbl9ib2R5AAEDZW52GHdhc21fb25fbWVzc2FnZV9jb21wbGV0ZQAAAzU0BQYAAAMAAAAAAAADAQMAAwMDAAACAAAAAAICAgICAgICAgIBAQEBAQEBAQEBAwAAAwAAAAQFAXABExMFAwE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AEgATYCDAwBCyAEQRkgAkEBdmtBACACQR9HG3QhAiAAKAIAIQACQANAIAAiAygCBEF4cSAERg0BIAJBHXYhACACQQF0IQIgAyAAQQRxakEQaiIHKAIAIgANAAsgByABNgIAIAEgAzYCGCABIAE2AgwgASABNgIIDAELIAMoAggiACABNgIMIAMgATYCCCABQQA2AhggASADNgIMIAEgADYCCAtB5NUAQeTVACgCAEEBayIAQX8gABs2AgALCwcAIAAtACgLBwAgAC0AKgsHACAALQArCwcAIAAtACkLBwAgAC8BNAsHACAALQAwC0ABBH8gACgCGCEBIAAvAS4hAiAALQAoIQMgACgCOCEEIAAQOCAAIAQ2AjggACADOgAoIAAgAjsBLiAAIAE2AhgL5YUCAgd/A34gASACaiEEAkAgACIDKAIMIgANACADKAIEBEAgAyABNgIECyMAQRBrIgkkAAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAn8CQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkAgAygCHCICQ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tBwAEMHwtBwQEMHgtBwgEMHQtBAQwcC0HDAQwbC0HEAQwaC0HFAQwZC0HGAQwYC0HHAQwXC0HIAQwWC0HJAQwVC0HKAQwUC0HLAQwTC0HMAQwSC0HNAQwRC0HOAQwQC0HPAQwPC0HQAQwOC0HRAQwNC0HSAQwMC0HTAQwLC0HUAQwKC0HVAQwJC0HWAQwIC0HjAQwHC0HXAQwGC0HYAQwFC0HZAQwEC0HaAQwDC0HbAQwCC0HdAQwBC0HcAQshAgNAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQCADAn8CQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAn8CQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAn8CQAJAAkACQAJAAkACQAJ/AkACQAJAAn8CQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAIAMCfwJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACfwJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJ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5gIgAEEVRgRAIANBJDYCHCADIAE2AhQgA0GbGzYCECADQRU2AgxBACECDJQDC0EAIQIgA0EANgIcIAMgATYCFCADQZAONgIQIANBFDYCDAyTAwtBACECIANBADYCHCADIAE2AhQgA0G+IDYCECADQQI2AgwMkgMLIAMoAgQhAEEAIQIgA0EANgIEIAMgACABIAynaiIBEDIiAEUNKyADQQc2AhwgAyABNgIUIAMgADYCDAyRAwsgAy0ALkHAAHFFDQELQQAhAAJAIAMoAjgiAkUNACACKAJYIgJFDQAgAyACEQAAIQALIABFDSsgAEEVRgRAIANBCjYCHCADIAE2AhQgA0HrGTYCECADQRU2AgxBACECDJADC0EAIQIgA0EANgIcIAMgATYCFCADQZMMNgIQIANBEzYCDAyPAwtBACECIANBADYCHCADIAE2AhQgA0GCFTYCECADQQI2AgwMjgMLQQAhAiADQQA2AhwgAyABNgIUIANB3RQ2AhAgA0EZNgIMDI0DC0EAIQIgA0EANgIcIAMgATYCFCADQeYdNgIQIANBGTYCDAyMAwsgAEEVRg09QQAhAiADQQA2AhwgAyABNgIUIANB0A82AhAgA0EiNgIMDIsDCyADKAIEIQBBACECIANBADYCBCADIAAgARAzIgBFDSggA0ENNgIcIAMgATYCFCADIAA2AgwMigMLIABBFUYNOkEAIQIgA0EANgIcIAMgATYCFCADQdAPNgIQIANBIjYCDAyJAwsgAygCBCEAQQAhAiADQQA2AgQgAyAAIAEQMyIARQRAIAFBAWohAQwoCyADQQ42AhwgAyAANgIMIAMgAUEBajYCFAyIAwsgAEEVRg03QQAhAiADQQA2AhwgAyABNgIUIANB0A82AhAgA0EiNgIMDIcDCyADKAIEIQBBACECIANBADYCBCADIAAgARAzIgBFBEAgAUEBaiEBDCcLIANBDzYCHCADIAA2AgwgAyABQQFqNgIUDIYDC0EAIQIgA0EANgIcIAMgATYCFCADQeIXNgIQIANBGTYCDAyFAwsgAEEVRg0zQQAhAiADQQA2AhwgAyABNgIUIANB1gw2AhAgA0EjNgIMDIQDCyADKAIEIQBBACECIANBAD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ECDPICCyAAQTtHDQEgAUEBaiEBC0EmIQIM1wILQQAhAiADQQA2AhwgAyABNgIUIANBnxU2AhAgA0EMNgIMDO8CCyABIARHBEADQCABLQAAQSBHDYQCIAQgAUEBaiIBRw0AC0EsIQIM7wILQSwhAgzuAgsgASAERgRAQTQhAgzuAgsCQAJAA0ACQCABLQAAQQprDgQCAAADAAsgBCABQQFqIgFHDQALQTQhAgzvAgsgAygCBCEAIANBADYCBCADIAAgARAxIgBFDZ8CIANBMjYCHCADIAE2AhQgAyAANgIMQQAhAgzuAgsgAygCBCEAIANBADYCBCADIAAgARAxIgBFBEAgAUEBaiEBDJ8CCyADQTI2AhwgAyAANgIMIAMgAUEBajYCFEEAIQIM7QILIAEgBEcEQAJAA0AgAS0AAEEwayIAQf8BcUEKTwRAQTohAgzXAgsgAykDICILQpmz5syZs+bMGVYNASADIAtCCn4iCjcDICAKIACtQv8BgyILQn+FVg0BIAMgCiALfDcDICAEIAFBAWoiAUcNAAtBwAAhAgzuAgsgAygCBCEAIANBADYCBCADIAAgAUEBaiIBEDEiAA0XDOICC0HAACECDOwCCyABIARGBEBByQAhAgzsAgsCQANAAkAgAS0AAEEJaw4YAAKiAqICqQKiAqICogKiAqICogKiAqICogKiAqICogKiAqICogKiAqICogIAogILIAQgAUEBaiIBRw0AC0HJACECDOwCCyABQQFqIQEgA0Evai0AAEEBcQ2lAiADQQA2AhwgAyABNgIUIANBlxA2AhAgA0EKNgIMQQAhAgzrAgsgASAERwRAA0AgAS0AAEEgRw0VIAQgAUEBaiIBRw0AC0H4ACECDOsCC0H4ACECDOoCCyADQQI6ACgMOAtBACECIANBADYCHCADQb8LNgIQIANBAjYCDCADIAFBAWo2AhQM6AILQQAhAgzOAgtBDSECDM0CC0ETIQIMzAILQRUhAgzLAgtBFiECDMoCC0EYIQIMyQILQRkhAgzIAgtBGiECDMcCC0EbIQIMxgILQRwhAgzFAgtBHSECDMQCC0EeIQIMwwILQR8hAgzCAgtBICECDMECC0EiIQIMwAILQSMhAgy/AgtBJSECDL4CC0HlACECDL0CCyADQT02AhwgAyABNgIUIAMgADYCDEEAIQIM1QILIANBGzYCHCADIAE2AhQgA0GkHDYCECADQRU2AgxBACECDNQCCyADQSA2AhwgAyABNgIUIANBmBo2AhAgA0EVNgIMQQAhAgzTAgsgA0ETNgIcIAMgATYCFCADQZgaNgIQIANBFTYCDEEAIQIM0gILIANBCzYCHCADIAE2AhQgA0GYGjYCECADQRU2AgxBACECDNECCyADQRA2AhwgAyABNgIUIANBmBo2AhAgA0EVNgIMQQAhAgzQAgsgA0EgNgIcIAMgATYCFCADQaQcNgIQIANBFTYCDEEAIQIMzwILIANBCzYCHCADIAE2AhQgA0GkHDYCECADQRU2AgxBACECDM4CCyADQQw2AhwgAyABNgIUIANBpBw2AhAgA0EVNgIMQQAhAgzNAgtBACECIANBADYCHCADIAE2AhQgA0HdDjYCECADQRI2AgwMzAILAkADQAJAIAEtAABBCmsOBAACAgACCyAEIAFBAWoiAUcNAAtB/QEhAgzMAgsCQAJAIAMtADZBAUcNAEEAIQACQCADKAI4IgJFDQAgAigCYCICRQ0AIAMgAhEAACEACyAARQ0AIABBFUcNASADQfwBNgIcIAMgATYCFCADQdwZNgIQIANBFTYCDEEAIQIMzQILQdwBIQIMswILIANBADYCHCADIAE2AhQgA0H5CzYCECADQR82AgxBACECDMsCCwJAAkAgAy0AKEEBaw4CBAEAC0HbASECDLICC0HUASECDLECCyADQQI6ADFBACEAAkAgAygCOCICRQ0AIAIoAgAiAkUNACADIAIRAAAhAAsgAEUEQEHdASECDLECCyAAQRVHBEAgA0EANgIcIAMgATYCFCADQbQMNgIQIANBEDYCDEEAIQIMygILIANB+wE2AhwgAyABNgIUIANBgRo2AhAgA0EVNgIMQQAhAgzJAgsgASAERgRAQfoBIQIMyQILIAEtAABByABGDQEgA0EBOgAoC0HAASECDK4CC0HaASECDK0CCyABIARHBEAgA0EMNgIIIAMgATYCBEHZASECDK0CC0H5ASECDMUCCyABIARGBEBB+AEhAgzFA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ADIAY2AgAMuQILQe8BIQIgASAERg24AiADKAIAIgAgBCABa2ohBiABIABrQQFqIQUDQCABLQAAIABBs9UAai0AAEcNAyAAQQFGDQIgAEEBaiEAIAQgAUEBaiIBRw0ACyADIAY2AgAMuAILQe4BIQIgASAERg23AiADKAIAIgAgBCABa2ohBiABIABrQQJqIQUDQCABLQAAIABBsNUAai0AAEcNAiAAQQJGDQEgAEEBaiEAIAQgAUEBaiIBRw0ACyADIAY2AgAMtwILIAMoAgQhACADQgA3AwAgAyAAIAVBAWoiARArIgBFDQIgA0HsATYCHCADIAE2AhQgAyAANgIMQQAhAgy2AgsgA0EANgIACyADKAIEIQAgA0EANgIEIAMgACABECsiAEUNnAIgA0HtATYCHCADIAE2AhQgAyAANgIMQQAhAgy0AgtBzwEhAgyaAgtBACEAAkAgAygCOCICRQ0AIAIoAjQiAkUNACADIAIRAAAhAAsCQCAABEAgAEEVRg0BIANBADYCHCADIAE2AhQgA0HqDTYCECADQSY2AgxBACECDLQCC0HOASECDJoCCyADQesBNgIcIAMgATYCFCADQYAbNgIQIANBFTYCDEEAIQIMsgILIAEgBEYEQEHrASECDLICCyABLQAAQS9GBEAgAUEBaiEBDAELIANBADYCHCADIAE2AhQgA0GyODYCECADQQg2AgxBACECDLECC0HNASECDJcCCyABIARHBEAgA0EONgIIIAMgATYCBEHMASECDJcCC0HqASECDK8CCyABIARGBEBB6QEhAgyvAgsgAS0AAEEwayIAQf8BcUEKSQRAIAMgADoAKiABQQFqIQFBywEhAgyWAgsgAygCBCEAIANBADYCBCADIAAgARAvIgBFDZcCIANB6AE2AhwgAyABNgIUIAMgADYCDEEAIQIMrgILIAEgBEYEQEHnASECDK4CCwJAIAEtAABBLkYEQCABQQFqIQEMAQsgAygCBCEAIANBADYCBCADIAAgARAvIgBFDZgCIANB5gE2AhwgAyABNgIUIAMgADYCDEEAIQIMrgILQcoBIQIMlAILIAEgBEYEQEHlASECDK0CC0EAIQBBASEFQQEhB0EAIQICQAJAAkACQAJAAn8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B//8Dc0sNACADIAAgAmo7ATQMAgtBACECIANBADYCHCADIAE2AhQgA0GVHjYCECADQQ02AgwMqgILIANBADYCHCADIAE2AhQgA0GVHjYCECADQQ02AgxBACECDKkCC0HFASECDI8CCyABIARGBEBB3gEhAgyoAgsCQCABLQAAQTBrQf8BcSICQQpJBEAgAUEBaiEBAkAgAy8BNCIAQZkzSw0AIAMgAEEKbCIAOwE0IABB/v8DcSACQf//A3NLDQAgAyAAIAJqOwE0DAILQQAhAiADQQA2AhwgAyABNgIUIANBlR42AhAgA0ENNgIMDKkCCyADQQA2AhwgAyABNgIUIANBlR42AhAgA0ENNgIMQQAhAgyoAgtBxAEhAgyOAgsgASAERgRAQd0BIQIMpwILAkACQAJAAkAgAS0AAEEKaw4XAgMDAAMDAwMDAwMDAwMDAwMDAwMDAwEDCyABQQFqDAULIAFBAWohAUHDASECDI8CCyABQQFqIQEgA0Evai0AAEEBcQ0IIANBADYCHCADIAE2AhQgA0GNCzYCECADQQ02AgxBACECDKcCCyADQQA2AhwgAyABNgIUIANBjQs2AhAgA0ENNgIMQQAhAgymAgsgASAERwRAIANBDzYCCCADIAE2AgRBASECDI0CC0HcASECDKUCCwJAAkADQAJAIAEtAABBCmsOBAIAAAMACyAEIAFBAWoiAUcNAAtB2wEhAgymAgsgAygCBCEAIANBADYCBCADIAAgARAtIgBFBEAgAUEBaiEBDAQLIANB2gE2AhwgAyAANgIMIAMgAUEBajYCFEEAIQIMpQILIAMoAgQhACADQQA2AgQgAyAAIAEQLSIADQEgAUEBagshAUHBASECDIoCCyADQdkBNgIcIAMgADYCDCADIAFBAWo2AhRBACECDKICC0HCASECDIgCCyADQS9qLQAAQQFxDQEgA0EANgIcIAMgATYCFCADQeQcNgIQIANBGTYCDEEAIQIMoAILIAEgBEYEQEHZASECDKACCwJAAkACQCABLQAAQQprDgQBAgIAAgsgAUEBaiEBDAILIAFBAWohAQwBCyADLQAuQcAAcUUNAQtBACEAAkAgAygCOCICRQ0AIAIoAjwiAkUN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IQIgASAERg31ASADKAIAIgAgBCABa2ohBSABIABrQQFqIQYCQANAIAEtAAAgAEHk1ABqLQAARw0iIABBAUYNASAAQQFqIQAgBCABQQFqIgFHDQALIAMgBTYCAAz2AQsgA0EANgIAIAZBAWohAUEcDCILQbABIQIgASAERg30ASADKAIAIgAgBCABa2ohBSABIABrQQVqIQYCQANAIAEtAAAgAEHe1ABqLQAARw0hIABBBUYNASAAQQFqIQAgBCABQQFqIgFHDQALIAMgBTYCAAz1AQsgA0EANgIAIAZBAWohAUEGDCELQa8BIQIgASAERg3zASADKAIAIgAgBCABa2ohBSABIABrQQRqIQYCQANAIAEtAAAgAEHZ1ABqLQAARw0gIABBBEYNASAAQQFqIQAgBCABQQFqIgFHDQALIAMgBTYCAAz0AQsgA0EANgIAIAZBAWohAUEZDCALIAEgBEYEQEGuASECDPMBCwJAAkACQAJAIAEtAABBLWsOIwAkJCQkJCQkJCQkJCQkJCQkJCQkJCQkJAEkJCQkJAIkJCQDJAsgAUEBaiEBQY4BIQIM3AELIAFBAWohAUGPASECDNsBCyABQQFqIQFBlAEhAgzaAQsgAUEBaiEBQZUBIQIM2QELQa0BIQIgASAERg3xASADKAIAIgAgBCABa2ohBSABIABrQQFqIQYCQANAIAEtAAAgAEHX1ABqLQAARw0eIABBAUYNASAAQQFqIQAgBCABQQFqIgFHDQALIAMgBTYCAAzyAQsgA0EANgIAIAZBAWohAUELDB4LIAEgBEYEQEGsASECDPEBCwJAAkAgAS0AAEHBAGsOAwAgASALIAFBAWohAUGQASECDNgBCyABQQFqIQFBkwEhAgzXAQsgASAERgRAQasBIQIM8AELAkACQCABLQAAQcEAaw4PAB8fHx8fHx8fHx8fHx8BHwsgAUEBaiEBQZEBIQIM1wELIAFBAWohAUGSASECDNYBCyABIARGBEBBqgEhAgzvAQsgAS0AAEHMAEcNHCABQQFqIQFBCgwbC0GpASECIAEgBEYN7QEgAygCACIAIAQgAWtqIQUgASAAa0EFaiEGAkADQCABLQAAIABB0dQAai0AAEcN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ELCyABQQFqIQFB/gAhAgzDAQsgAUEBaiEBQf8AIQIMwgELIAEgBEYEQEGXASECDNsBCyABLQAAQdkARw0IIAFBAWohAUEIDAcLQZYBIQIgASAERg3ZASADKAIAIgAgBCABa2ohBSABIABrQQNqIQYCQANAIAEtAAAgAEGs1ABqLQAARw0GIABBA0YNASAAQQFqIQAgBCABQQFqIgFHDQALIAMgBTYCAAzaAQsgA0EANgIAIAZBAWohAUEFDAYLQZUBIQIgASAERg3YASADKAIAIgAgBCABa2ohBSABIABrQQVqIQYCQANAIAEtAAAgAEGm1ABqLQAARw0FIABBBUYNASAAQQFqIQAgBCABQQFqIgFHDQALIAMgBTYCAAzZAQsgA0EANgIAIAZBAWohAUEWDAULQZQBIQIgASAERg3XASADKAIAIgAgBCABa2ohBSABIABrQQJqIQYCQANAIAEtAAAgAEGh1QBqLQAARw0EIABBAkYNASAAQQFqIQAgBCABQQFqIgFHDQALIAMgBTYCAAzYAQsgA0EANgIAIAZBAWohAUEQDAQLIAEgBEYEQEGTASECDNcBCwJAAkAgAS0AAEHDAGsODAAGBgYGBgYGBgYGAQYLIAFBAWohAUH5ACECDL4BCyABQQFqIQFB+gAhAgy9AQtBkgEhAiABIARGDdUBIAMoAgAiACAEIAFraiEFIAEgAGtBBWohBgJAA0AgAS0AACAAQaDUAGotAABHDQIgAEEFRg0BIABBAWohACAEIAFBAWoiAUcNAAsgAyAFNgIADNYBCyADQQA2AgAgBkEBaiEBQSQMAgsgA0EANgIADAILIAEgBEYEQEGRASECDNQBCyABLQAAQcwARw0BIAFBAWohAUETCzoAKSADKAIEIQAgA0EANgIEIAMgACABEC4iAA0CDAELQQAhAiADQQA2AhwgAyABNgIUIANB/h82AhAgA0EGNgIMDNEBC0H4ACECDLcBCyADQZABNgIcIAMgATYCFCADIAA2AgxBACECDM8BC0EAIQACQCADKAI4IgJFDQAgAigCQCICRQ0AIAMgAhEAACEACyAARQ0AIABBFUYNASADQQA2AhwgAyABNgIUIANBgg82AhAgA0EgNg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AgQgAyAAIAEQLCIARQ0IIANB2wA2AhwgAyABNgIUIAMgADYCDEEAIQIMqwELIAMoAgQhACADQQA2AgQgAyAAIAEQLCIARQ0IIANB3QA2AhwgAyABNgIUIAMgADYCDEEAIQIMqgELIAMoAgQhACADQQA2AgQgAyAAIAEQLCIARQ0IIANB+gA2AhwgAyABNgIUIAMgADYCDEEAIQIMqQELIANBADYCHCADIAE2AhQgA0GNFDYCECADQQc2AgxBACECDKgBCwJAAkACQAJAA0AgAS0AAEGgygBqLQAAIgBBBUcEQAJAIABBAWsOBi4DBAUGAAYLQegAIQIMlAELIAQgAUEBaiIBRw0AC0H9ACECDKsBCyADKAIEIQAgA0EANgIEIAMgACABECwiAEUNByADQdsANgIcIAMgATYCFCADIAA2AgxBACECDKoBCyADKAIEIQAgA0EANgIEIAMgACABECwiAEUNByADQd0ANgIcIAMgATYCFCADIAA2AgxBACECDKkBCyADKAIEIQAgA0EANgIEIAMgACABECwiAEUNByADQfoANgIcIAMgATYCFCADIAA2AgxBACECDKgBCyADQQA2AhwgAyABNgIUIANB5Ag2AhAgA0EHNgIMQQAhAgynAQsgASAERg0BIAFBAWoLIQFBBiECDIwBC0H8ACECDKQBCwJAAkACQAJAA0AgAS0AAEGgyABqLQAAIgBBBUcEQCAAQQFrDgQpAgMEBQsgBCABQQFqIgFHDQALQfsAIQIMpwELIAMoAgQhACADQQA2AgQgAyAAIAEQLCIARQ0DIANB2wA2AhwgAyABNgIUIAMgADYCDEEAIQIMpgELIAMoAgQhACADQQA2AgQgAyAAIAEQLCIARQ0DIANB3QA2AhwgAyABNgIUIAMgADYCDEEAIQIMpQELIAMoAgQhACADQQA2AgQgAyAAIAEQLCIARQ0DIANB+gA2AhwgAyABNgIUIAMgADYCDEEAIQIMpAELIANBADYCHCADIAE2AhQgA0G8CjYCECADQQc2AgxBACECDKMBC0HPACECDIkBC0HRACECDIgBC0HnACECDIcBCyABIARGBEBB+gAhAgygAQsCQCABLQAAQQlrDgQgAAAgAAsgAUE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BACECDJkBC0HfACECDH8LQQAhAAJAIAMoAjgiAkUNACACKAI0IgJFDQAgAyACEQAAIQALAkAgAARAIABBFUYNASADQQA2AhwgAyABNgIUIANB6g02AhAgA0EmNgIMQQAhAgyZAQtB3gAhAgx/CyADQfAANgIcIAMgATYCFCADQYAbNgIQIANBFTYCDEEAIQIMlwELIAMtAClBIUYNBiADQQA2AhwgAyABNgIUIANBkQo2AhAgA0EINgIMQQAhAgyWAQtB7wAhAiABIARGDZUBIAMoAgAiACAEIAFraiEFIAEgAGtBAmohBgJAA0AgAS0AACAAQbDVAGotAABHDQIgAEECRg0BIABBAWohACAEIAFBAWoiAUcNAAsgAyAFNgIADJYBCyADKAIEIQAgA0IANwMAIAMgACAGQQFqIgEQKyIARQ0CIANB7QA2AhwgAyABNgIUIAMgADYCDEEAIQIMlQELIANBADYCAAsgAygCBCEAIANBADYCBCADIAAgARArIgBFDYABIANB7gA2AhwgAyABNgIUIAMgADYCDEEAIQIMkwELQdwAIQIMeQtBACEAAkAgAygCOCICRQ0AIAIoAjQiAkUNACADIAIRAAAhAAsCQCAABEAgAEEVRg0BIANBADYCHCADIAE2AhQgA0HqDTYCECADQSY2AgxBACECDJMBC0HbACECDHkLIANB7AA2AhwgAyABNgIUIANBgBs2AhAgA0EVNgIMQQAhAgyRAQsgAy0AKSIAQSNJDQAgAEEuRg0AIANBADYCHCADIAE2AhQgA0HJCTYCECADQQg2AgxBACECDJABC0HaACECDHYLIAEgBEYEQEHrACECDI8BCwJAIAEtAABBL0YEQCABQQFqIQEMAQsgA0EANgIcIAMgATYCFCADQbI4NgIQIANBCDYCDEEAIQIMjwELQdkAIQIMdQsgASAERwRAIANBDjYCCCADIAE2AgRB2AAhAgx1C0HqACECDI0BCyABIARGBEBB6QAhAgyNAQsgAS0AAEEwayIAQf8BcUEKSQRAIAMgADoAKiABQQFqIQFB1wAhAgx0CyADKAIEIQAgA0EANgIEIAMgACABEC8iAEUNeiADQegANgIcIAMgATYCFCADIAA2AgxBACECDIwBCyABIARGBEBB5wAhAgyMAQsCQCABLQAAQS5GBEAgAUEBaiEBDAELIAMoAgQhACADQQA2AgQgAyAAIAEQLyIARQ17IANB5gA2AhwgAyABNgIUIAMgADYCDEEAIQIMjAELQdYAIQIMcgsgASAERgRAQeUAIQIMiwELQQAhAEEBIQVBASEHQQAhAgJAAkACQAJAAkACfwJAAkACQAJAAkACQAJAIAEtAABBMGsOCgoJAAECAwQFBggLC0ECDAYLQQMMBQtBBAwEC0EFDAMLQQYMAgtBBwwBC0EICyECQQAhBUEAIQcMAgtBCSECQQEhAEEAIQVBACEHDAELQQAhBUEBIQILIAMgAjoAKyABQQFqIQECQAJAIAMtAC5BEHENAAJAAkACQCADLQAqDgMBAAIECyAHRQ0DDAILIAANAQwCCyAFRQ0BCyADKAIEIQAgA0EANgIEIAMgACABEC8iAEUNAiADQeIANgIcIAMgATYCFCADIAA2AgxBACECDI0BCyADKAIEIQAgA0EANgIEIAMgACABEC8iAEUNfSADQeMANgIcIAMgATYCFCADIAA2AgxBACECDIwBCyADKAIEIQAgA0EANgIEIAMgACABEC8iAEUNeyADQeQANgIcIAMgATYCFCADIAA2AgwMiwELQdQAIQIMcQsgAy0AKUEiRg2GAUHTACECDHALQQAhAAJAIAMoAjgiAkUNACACKAJEIgJFDQAgAyACEQAAIQALIABFBEBB1QAhAgxwCyAAQRVHBEAgA0EANgIcIAMgATYCFCADQaQNNgIQIANBITYCDEEAIQIMiQELIANB4QA2AhwgAyABNgIUIANB0Bo2AhAgA0EVNgIMQQAhAgyIAQsgASAERgRAQeAAIQIMiAELAkACQAJAAkACQCABLQAAQQprDgQBBAQABAsgAUEBaiEBDAELIAFBAWohASADQS9qLQAAQQFxRQ0BC0HSACECDHALIANBADYCHCADIAE2AhQgA0G2ETYCECADQQk2AgxBACECDIgBCyADQQA2AhwgAyABNgIUIANBthE2AhAgA0EJNgIMQQAhAgyHAQsgASAERgRAQd8AIQIMhwELIAEtAABBCkYEQCABQQFqIQEMCQsgAy0ALkHAAHENCCADQQA2AhwgAyABNgIUIANBthE2AhAgA0ECNgIMQQAhAgyGAQsgASAERgRAQd0AIQIMhgELIAEtAAAiAkENRgRAIAFBAWohAUHQACECDG0LIAEhACACQQlrDgQFAQEFAQsgBCABIgBGBEBB3AAhAgyFAQsgAC0AAEEKRw0AIABBAWoMAgtBACECIANBADYCHCADIAA2AhQgA0HKLTYCECADQQc2AgwMgwELIAEgBEYEQEHbACECDIMBCwJAIAEtAABBCWsOBAMAAAMACyABQQFqCyEBQc4AIQIMaAsgASAERgRAQdoAIQIMgQELIAEtAABBCWsOBAABAQABC0EAIQIgA0EANgIcIANBmhI2AhAgA0EHNgIMIAMgAUEBajYCFAx/CyADQYASOwEqQQAhAAJAIAMoAjgiAkUNACACKAI4IgJFDQAgAyACEQAAIQALIABFDQAgAEEVRw0BIANB2QA2AhwgAyABNgIUIANB6ho2AhAgA0EVNgIMQQAhAgx+C0HNACECDGQLIANBADYCHCADIAE2AhQgA0HJDTYCECADQRo2AgxBACECDHwLIAEgBEYEQEHZACECDHwLIAEtAABBIEcNPSABQQFqIQEgAy0ALkEBcQ09IANBADYCHCADIAE2AhQgA0HCHDYCECADQR42AgxBACECDHsLIAEgBEYEQEHYACECDHsLAkACQAJAAkACQCABLQAAIgBBCmsOBAIDAwABCyABQQFqIQFBLCECDGULIABBOkcNASADQQA2AhwgAyABNgIUIANB5xE2AhAgA0EKNgIMQQAhAgx9CyABQQFqIQEgA0Evai0AAEEBcUUNcyADLQAyQYABcUUEQCADQTJqIQIgAxA1QQAhAAJAIAMoAjgiBkUNACAGKAIoIgZFDQAgAyAGEQAAIQALAkACQCAADhZNTEsBAQEBAQEBAQEBAQEBAQEBAQEAAQsgA0EpNgIcIAMgATYCFCADQawZNgIQIANBFTYCDEEAIQIMfgsgA0EANgIcIAMgATYCFCADQeULNgIQIANBETYCDEEAIQIMfQtBACEAAkAgAygCOCICRQ0AIAIoAlwiAkUNACADIAIRAAAhAAsgAEUNWSAAQRVHDQEgA0E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DFILAkACQAJAAkACQCABLQAAQQprDgQAAgIBAgsgAygCBCEAIANBADYCBCADIAAgARAxIgBFDQIgA0EzNgIcIAMgATYCFCADIAA2AgxBACECDFULIAMoAgQhACADQQA2AgQgAyAAIAEQMSIARQRAIAFBAWohAQwGCyADQTI2AhwgAyAANgIMIAMgAUEBajYCFEEAIQIMVAsgAy0ALkEBcQRAQd8BIQIMOwsgAygCBCEAIANBADYCBCADIAAgARAxIgANAQxJC0E0IQIMOQsgA0E1NgIcIAMgATYCFCADIAA2AgxBACECDFELQTUhAgw3CyADQS9qLQAAQQFxDQAgA0EANgIcIAMgATYCFCADQesWNgIQIANBGTYCDEEAIQIMTwtBMyECDDULIAEgBEYEQEEyIQIMTgsCQCABLQAAQQpGBEAgAUEBaiEBDAELIANBADYCHCADIAE2AhQgA0GSFzYCECADQQM2AgxBACECDE4LQTIhAgw0CyABIARGBEBBMSECDE0LAkAgAS0AACIAQQlGDQAgAEEgRg0AQQEhAgJAIAMtACxBBWsOBAYEBQANCyADIAMvATJBCHI7ATIMDAsgAy0ALkEBcUUNASADLQAsQQhHDQAgA0EAOgAsC0E9IQIMMgsgA0EANgIcIAMgATYCFCADQcIWNgIQIANBCjYCDEEAIQIMSgtBAiECDAELQQQhAgsgA0EBOgAsIAMgAy8BMiACcjsBMgwGCyABIARGBEBBMCECDEcLIAEtAABBCkYEQCABQQFqIQEMAQsgAy0ALkEBcQ0AIANBADYCHCADIAE2AhQgA0HcKDYCECADQQI2AgxBACECDEYLQTAhAgwsCyABQQFqIQFBMSECDCsLIAEgBEYEQEEvIQIMRAsgAS0AACIAQQlHIABBIEdxRQRAIAFBAWohASADLQAuQQFxDQEgA0EANgIcIAMgATYCFCADQZcQNgIQIANBCjYCDEEAIQIMRAtBASECAkACQAJAAkACQAJAIAMtACxBAmsOBwUEBAMBAgAECyADIAMvATJBCHI7ATIMAwtBAiECDAELQQQhAgsgA0EBOgAsIAMgAy8BMiACcjsBMgtBLyECDCsLIANBADYCHCADIAE2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AAAQBBwcwAC14CAgACAgICAgICAgICAgICAgICAgICAgICAgICAgIAAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAEGpzgALBQECAAEDAEHAzgALXwQFAAAFBQUFBQUFBQUFBQYFBQUFBQUFBQUFBQUABQAHCAUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQAFAAUABQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUAAAAFAEGp0AALBQEBAAEBAEHA0AALAQEAQdrQAAtBAgAAAAAAAAMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAAAAAAAAAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMAQanSAAsFAQEAAQEAQcDSAAsBAQBBytIACwYCAAAAAAIAQeHSAAs6AwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMAAAAAAAADAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwBBoNQAC50BTk9VTkNFRUNLT1VUTkVDVEVURUNSSUJFTFVTSEVURUFEU0VBUkNIUkdFQ1RJVklUWUxFTkRBUlZFT1RJRllQVElPTlNDSFNFQVlTVEFUQ0hHRVVFUllPUkRJUkVDVE9SVFJDSFBBUkFNRVRFUlVSQ0VCU0NSSUJFQVJET1dOQUNFSU5ETktDS1VCU0NSSUJFVFRQQ0VUU1BBRFRQLw==","base64"))})},7136:(e,t,s)=>{"use strict";e=s.nmd(e);const{Buffer:r}=s(4573);let n;Object.defineProperty(e,"exports",{get:()=>n||(n=r.from("AGFzbQEAAAABJwdgAX8Bf2ADf39/AX9gAn9/AGABfwBgBH9/f38Bf2AAAGADf39/AALLAQgDZW52GHdhc21fb25faGVhZGVyc19jb21wbGV0ZQAEA2VudhV3YXNtX29uX21lc3NhZ2VfYmVnaW4AAANlbnYLd2FzbV9vbl91cmwAAQNlbnYOd2FzbV9vbl9zdGF0dXMAAQNlbnYUd2FzbV9vbl9oZWFkZXJfZmllbGQAAQ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AgwgACABNgIIIAEgADYCDCABIAI2AggMAQtBHyECIARB////B00EQCAEQSYgBEEIdmciAGt2QQFxIABBAXRrQT5qIQILIAEgAjYCHCABQgA3AhAgAkECdEH01wBqIQACQEHI1QAoAgAiA0EBIAJ0IgdxRQRAIAAgATYCAEHI1QAgAyAHcjYCACABIAA2AhggASABNgIIIAEgATYCDAwBCyAEQRkgAkEBdmtBACACQR9HG3QhAiAAKAIAIQACQANAIAAiAygCBEF4cSAERg0BIAJBHXYhACACQQF0IQIgAyAAQQRxakEQaiIHKAIAIgANAAsgByABNgIAIAEgAzYCGCABIAE2AgwgASABNgIIDAELIAMoAggiACABNgIMIAMgATYCCCABQQA2AhggASADNgIMIAEgADYCCAtB5NUAQeTVACgCAEEBayIAQX8gABs2AgALCwcAIAAtACgLBwAgAC0AKgsHACAALQArCwcAIAAtACkLBwAgAC8BNAsHACAALQAwC0ABBH8gACgCGCEBIAAvAS4hAiAALQAoIQMgACgCOCEEIAAQOCAAIAQ2AjggACADOgAoIAAgAjsBLiAAIAE2AhgLhocCAwd/A34BeyABIAJqIQQCQCAAIgMoAgwiAA0AIAMoAgQEQCADIAE2AgQLIwBBEGsiCSQAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACfwJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQ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sgAygCBCEAIANBADYCBCADIAAgARAzIgBFBEAgAUEBaiEBDBsLIANBHDYCHCADIAA2AgwgAyABQQFqNgIUQQAhAgzzAgsgAygCBCEAIANBADYCBCADIAAgARAzIgBFBEAgAUEBaiEBDOsCCyADQR02AhwgAyAANgIMIAMgAUEBajYCFEEAIQIM8gILIABBO0cNASABQQFqIQELQSYhAgzXAgtBACECIANBADYCHCADIAE2AhQgA0GfFTYCECADQQw2AgwM7wILIAEgBEcEQANAIAEtAABBIEcNhAIgBCABQQFqIgFHDQALQSwhAgzvAgtBLCECDO4CCyABIARGBEBBNCECDO4CCwJAAkADQAJAIAEtAABBCmsOBAIAAAMACyAEIAFBAWoiAUcNAAtBNCECDO8CCyADKAIEIQAgA0EANgIEIAMgACABEDEiAEUNnwIgA0EyNgIcIAMgATYCFCADIAA2AgxBACECDO4CCyADKAIEIQAgA0EANgIEIAMgACABEDEiAEUEQCABQQFqIQEMnwILIANBMjYCHCADIAA2AgwgAyABQQFqNgIUQQAhAgztAgsgASAERwRAAkADQCABLQAAQTBrIgBB/wFxQQpPBEBBOiECDNcCCyADKQMgIgtCmbPmzJmz5swZVg0BIAMgC0IKfiIKNwMgIAogAK1C/wGDIgtCf4VWDQEgAyAKIAt8NwMgIAQgAUEBaiIBRw0AC0HAACECDO4CCyADKAIEIQAgA0EANgIEIAMgACABQQFqIgEQMSIADRcM4gILQcAAIQIM7AILIAEgBEYEQEHJACECDOwCCwJAA0ACQCABLQAAQQlrDhgAAqICogKpAqICogKiAqICogKiAqICogKiAqICogKiAqICogKiAqICogKiAgCiAgsgBCABQQFqIgFHDQALQckAIQIM7AILIAFBAWohASADQS9qLQAAQQFxDaUCIANBADYCHCADIAE2AhQgA0GXEDYCECADQQo2AgxBACECDOsCCyABIARHBEADQCABLQAAQSBHDRUgBCABQQFqIgFHDQALQfgAIQIM6wILQfgAIQIM6gILIANBAjoAKAw4C0EAIQIgA0EANgIcIANBvws2AhAgA0ECNgIMIAMgAUEBajYCFAzoAgt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HCADIAE2AhQgA0GBGjYCECADQRU2AgxBACECDMkCCyABIARGBEBB+gEhAgzJAgsgAS0AAEHIAEYNASADQQE6ACgLQcABIQIMrgILQdoBIQIMrQILIAEgBEcEQCADQQw2AgggAyABNgIEQdkBIQIMrQILQfkBIQIMxQILIAEgBEYEQEH4ASECDMUCCyABLQAAQcgARw0EIAFBAWohAUHYASECDKsCCyABIARGBEBB9wEhAgzEAgsCQAJAIAEtAABBxQBrDhAABQUFBQUFBQUFBQUFBQUBBQsgAUEBaiEBQdYBIQIMqwILIAFBAWohAUHXASECDKoCC0H2ASECIAEgBEYNwgIgAygCACIAIAQgAWtqIQUgASAAa0ECaiEGAkADQCABLQAAIABButUAai0AAEcNAyAAQQJGDQEgAEEBaiEAIAQgAUEBaiIBRw0ACyADIAU2AgAMwwILIAMoAgQhACADQgA3AwAgAyAAIAZBAWoiARAuIgBFBEBB4wEhAgyqAgsgA0H1ATYCHCADIAE2AhQgAyAANgIMQQAhAgzCAgtB9AEhAiABIARGDcECIAMoAgAiACAEIAFraiEFIAEgAGtBAWohBgJAA0AgAS0AACAAQbjVAGotAABHDQIgAEEBRg0BIABBAWohACAEIAFBAWoiAUcNAAsgAyAFNgIADMICCyADQYEEOwEoIAMoAgQhACADQgA3AwAgAyAAIAZBAWoiARAuIgANAwwCCyADQQA2AgALQQAhAiADQQA2AhwgAyABNgIUIANB5R82AhAgA0EINgIMDL8CC0HVASECDKUCCyADQfMBNgIcIAMgATYCFCADIAA2AgxBACECDL0CC0EAIQACQCADKAI4IgJFDQAgAigCQCICRQ0AIAMgAhEAACEACyAARQ1uIABBFUcEQCADQQA2AhwgAyABNgIUIANBgg82AhAgA0EgNgIMQQAhAgy9AgsgA0GPATYCHCADIAE2AhQgA0HsGzYCECADQRU2AgxBACECDLwCCyABIARHBEAgA0ENNgIIIAMgATYCBEHTASECDKMCC0HyASECDLsCCyABIARGBEBB8QEhAgy7AgsCQAJAAkAgAS0AAEHIAGsOCwABCAgICAgICAgCCAsgAUEBaiEBQdABIQIMowILIAFBAWohAUHRASECDKICCyABQQFqIQFB0gEhAgyhAgtB8AEhAiABIARGDbkCIAMoAgAiACAEIAFraiEGIAEgAGtBAmohBQNAIAEtAAAgAEG11QBqLQAARw0EIABBAkYNAyAAQQFqIQAgBCABQQFqIgFHDQALIAMgBjYCAAy5AgtB7wEhAiABIARGDbgCIAMoAgAiACAEIAFraiEGIAEgAGtBAWohBQNAIAEtAAAgAEGz1QBqLQAARw0DIABBAUYNAiAAQQFqIQAgBCABQQFqIgFHDQALIAMgBjYCAAy4AgtB7gEhAiABIARGDbcCIAMoAgAiACAEIAFraiEGIAEgAGtBAmohBQNAIAEtAAAgAEGw1QBqLQAARw0CIABBAkYNASAAQQFqIQAgBCABQQFqIgFHDQALIAMgBjYCAAy3AgsgAygCBCEAIANCADcDACADIAAgBUEBaiIBECsiAEUNAiADQewBNgIcIAMgATYCFCADIAA2AgxBACECDLYCCyADQQA2AgALIAMoAgQhACADQQA2AgQgAyAAIAEQKyIARQ2cAiADQe0BNgIcIAMgATYCFCADIAA2AgxBACECDLQCC0HPASECDJoCC0EAIQACQCADKAI4IgJFDQAgAigCNCICRQ0AIAMgAhEAACEACwJAIAAEQCAAQRVGDQEgA0EANgIcIAMgATYCFCADQeoNNgIQIANBJjYCDEEAIQIMtAILQc4BIQIMmgILIANB6wE2AhwgAyABNgIUIANBgBs2AhAgA0EVNgIMQQAhAgyyAgsgASAERgRAQesBIQIMsgILIAEtAABBL0YEQCABQQFqIQEMAQsgA0EANgIcIAMgATYCFCADQbI4NgIQIANBCDYCDEEAIQIMsQILQc0BIQIMlwILIAEgBEcEQCADQQ42AgggAyABNgIEQcwBIQIMlwILQeoBIQIMrwILIAEgBEYEQEHpASECDK8CCyABLQAAQTBrIgBB/wFxQQpJBEAgAyAAOgAqIAFBAWohAUHLASECDJYCCyADKAIEIQAgA0EANgIEIAMgACABEC8iAEUNlwIgA0HoATYCHCADIAE2AhQgAyAANgIMQQAhAgyuAgsgASAERgRAQecBIQIMrgILAkAgAS0AAEEuRgRAIAFBAWohAQwBCyADKAIEIQAgA0EANgIEIAMgACABEC8iAEUNmAIgA0HmATYCHCADIAE2AhQgAyAANgIMQQAhAgyuAgtBygEhAgyUAgsgASAERgRAQeUBIQIMrQILQQAhAEEBIQVBASEHQQAhAgJAAkACQAJAAkACfwJAAkACQAJAAkACQAJAIAEtAABBMGsOCgoJAAECAwQFBggLC0ECDAYLQQMMBQtBBAwEC0EFDAMLQQYMAgtBBwwBC0EICyECQQAhBUEAIQcMAgtBCSECQQEhAEEAIQVBACEHDAELQQAhBUEBIQILIAMgAjoAKyABQQFqIQECQAJAIAMtAC5BEHENAAJAAkACQCADLQAqDgMBAAIECyAHRQ0DDAILIAANAQwCCyAFRQ0BCyADKAIEIQAgA0EANgIEIAMgACABEC8iAEUNAiADQeIBNgIcIAMgATYCFCADIAA2AgxBACECDK8CCyADKAIEIQAgA0EANgIEIAMgACABEC8iAEUNmgIgA0HjATYCHCADIAE2AhQgAyAANgIMQQAhAgyuAgsgAygCBCEAIANBADYCBCADIAAgARAvIgBFDZgCIANB5AE2AhwgAyABNgIUIAMgADYCDAytAgtByQEhAgyTAgtBACEAAkAgAygCOCICRQ0AIAIoAkQiAkUNACADIAIRAAAhAAsCQCAABEAgAEEVRg0BIANBADYCHCADIAE2AhQgA0GkDTYCECADQSE2AgxBACECDK0CC0HIASECDJMCCyADQeEBNgIcIAMgATYCFCADQdAaNgIQIANBFTYCDEEAIQIMqwILIAEgBEYEQEHhASECDKsCCwJAIAEtAABBIEYEQCADQQA7ATQgAUEBaiEBDAELIANBADYCHCADIAE2AhQgA0GZETYCECADQQk2AgxBACECDKsCC0HHASECDJECCyABIARGBEBB4AEhAgyqAgsCQCABLQAAQTBrQf8BcSICQQpJBEAgAUEBaiEBAkAgAy8BNCIAQZkzSw0AIAMgAEEKbCIAOwE0IABB/v8DcSACQf//A3NLDQAgAyAAIAJqOwE0DAILQQAhAiADQQA2AhwgAyABNgIUIANBlR42AhAgA0ENNgIMDKsCCyADQQA2AhwgAyABNgIUIANBlR42AhAgA0ENNgIMQQAhAgyqAgtBxgEhAgyQAgsgASAERgRAQd8BIQIMqQILAkAgAS0AAEEwa0H/AXEiAkEKSQRAIAFBAWohAQJAIAMvATQiAEGZM0sNACADIABBCmwiADsBNCAAQf7/A3EgAkH//wNzSw0AIAMgACACajsBNAwCC0EAIQIgA0EANgIcIAMgATYCFCADQZUeNgIQIANBDTYCDAyqAgsgA0EANgIcIAMgATYCFCADQZUeNgIQIANBDTYCDEEAIQIMqQILQcUBIQIMjwILIAEgBEYEQEHeASECDKgCCwJAIAEtAABBMGtB/wFxIgJBCkkEQCABQQFqIQECQCADLwE0IgBBmTNLDQAgAyAAQQpsIgA7ATQgAEH+/wNxIAJB//8Dc0sNACADIAAgAmo7ATQMAgtBACECIANBADYCHCADIAE2AhQgA0GVHjYCECADQQ02AgwMqQILIANBADYCHCADIAE2AhQgA0GVHjYCECADQQ02AgxBACECDKgCC0HEASECDI4CCyABIARGBEBB3QEhAgynAgsCQAJAAkACQCABLQAAQQprDhcCAwMAAwMDAwMDAwMDAwMDAwMDAwMDAQMLIAFBAWoMBQsgAUEBaiEBQcMBIQIMjwILIAFBAWohASADQS9qLQAAQQFxDQggA0EANgIcIAMgATYCFCADQY0LNgIQIANBDTYCDEEAIQIMpwILIANBADYCHCADIAE2AhQgA0GNCzYCECADQQ02AgxBACECDKYCCyABIARHBEAgA0EPNgIIIAMgATYCBEEBIQIMjQILQdwBIQIMpQILAkACQANAAkAgAS0AAEEKaw4EAgAAAwALIAQgAUEBaiIBRw0AC0HbASECDKYCCyADKAIEIQAgA0EANgIEIAMgACABEC0iAEUEQCABQQFqIQEMBAsgA0HaATYCHCADIAA2AgwgAyABQQFqNgIUQQAhAgylAgsgAygCBCEAIANBADYCBCADIAAgARAtIgANASABQQFqCyEBQcEBIQIMigILIANB2QE2AhwgAyAANgIMIAMgAUEBajYCFEEAIQIMogILQcIBIQIMiAILIANBL2otAABBAXEN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JAAkACQCABLQAAQcUAaw4RAEFBQUFBQUFBQQFBQUFBQQJBCyABQQFqIQFBsQEhAgz5AQsgAUEBaiEBQbIBIQIM+AELIAFBAWohAUGzASECDPcBC0HLASECIAEgBEYNjwIgAygCACIAIAQgAWtqIQUgASAAa0EGaiEGAkADQCABLQAAIABBkdUAai0AAEcNPCAAQQZGDQEgAEEBaiEAIAQgAUEBaiIBRw0ACyADIAU2AgAMkAILIANBADYCACAGQQFqIQFBGgw8C0HKASECIAEgBEYNjgIgAygCACIAIAQgAWtqIQUgASAAa0EDaiEGAkADQCABLQAAIABBjdUAai0AAEcNOyAAQQNGDQEgAEEBaiEAIAQgAUEBaiIBRw0ACyADIAU2AgAMjwILIANBADYCACAGQQFqIQFBIQw7CyABIARGBEBByQEhAgyOAgsCQAJAIAEtAABBwQBrDhQAPT09PT09PT09PT09PT09PT09AT0LIAFBAWohAUGtASECDPUBCyABQQFqIQFBsAEhAgz0AQsgASAERgRAQcgBIQIMjQILAkACQCABLQAAQdUAaw4LADw8PDw8PDw8PAE8CyABQQFqIQFBrgEhAgz0AQsgAUEBaiEBQa8BIQIM8wELQccBIQIgASAERg2LAiADKAIAIgAgBCABa2ohBSABIABrQQhqIQYCQANAIAEtAAAgAEGE1QBqLQAARw04IABBCEYNASAAQQFqIQAgBCABQQFqIgFHDQALIAMgBTYCAAyMAgsgA0EANgIAIAZBAWohAUEqDDgLIAEgBEYEQEHGASECDIsCCyABLQAAQdAARw04IAFBAWohAUElDDcLQcUBIQIgASAERg2JAiADKAIAIgAgBCABa2ohBSABIABrQQJqIQYCQANAIAEtAAAgAEGB1QBqLQAARw02IABBAkYNASAAQQFqIQAgBCABQQFqIgFHDQALIAMgBTYCAAyKAgsgA0EANgIAIAZBAWohAUEODDYLIAEgBEYEQEHEASECDIkCCyABLQAAQcUARw02IAFBAWohAUGrASECDO8BCyABIARGBEBBwwEhAgyIAgsCQAJAAkACQCABLQAAQcIAaw4PAAECOTk5OTk5OTk5OTkDOQsgAUE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fHx8fHwEfCyABQQFqIQFBkQEhAgzXAQsgAUEBaiEBQZIBIQIM1gELIAEgBEYEQEGqASECDO8BCyABLQAAQcwARw0cIAFBAWohAUEKDBsLQakBIQIgASAERg3tASADKAIAIgAgBCABa2ohBSABIABrQQVqIQYCQANAIAEtAAAgAEHR1ABqLQAARw0aIABBBUYNASAAQQFqIQAgBCABQQFqIgFHDQALIAMgBTYCAAzuAQsgA0EANgIAIAZBAWohAUEeDBoLQagBIQIgASAERg3sASADKAIAIgAgBCABa2ohBSABIABrQQZqIQYCQANAIAEtAAAgAEHK1ABqLQAARw0ZIABBBkYNASAAQQFqIQAgBCABQQFqIgFHDQALIAMgBTYCAAztAQsgA0EANgIAIAZBAWohAUEVDBkLQacBIQIgASAERg3rASADKAIAIgAgBCABa2ohBSABIABrQQJqIQYCQANAIAEtAAAgAEHH1ABqLQAARw0YIABBAkYNASAAQQFqIQAgBCABQQFqIgFHDQALIAMgBTYCAAzsAQsgA0EANgIAIAZBAWohAUEXDBgLQaYBIQIgASAERg3qASADKAIAIgAgBCABa2ohBSABIABrQQVqIQYCQANAIAEtAAAgAEHB1ABqLQAARw0XIABBBUYNASAAQQFqIQAgBCABQQFqIgFHDQALIAMgBTYCAAzrAQsgA0EANgIAIAZBAWohAUEYDBcLIAEgBEYEQEGlASECDOoBCwJAAkAgAS0AAEHJAGsOBwAZGRkZGQEZCyABQQFqIQFBiwEhAgzRAQsgAUEBaiEBQYwBIQIM0AELQaQBIQIgASAERg3oASADKAIAIgAgBCABa2ohBSABIABrQQFqIQYCQANAIAEtAAAgAEGm1QBqLQAARw0VIABBAUYNASAAQQFqIQAgBCABQQFqIgFHDQALIAMgBTYCAAzpAQsgA0EANgIAIAZBAWohAUEJDBULQaMBIQIgASAERg3nASADKAIAIgAgBCABa2ohBSABIABrQQFqIQYCQANAIAEtAAAgAEGk1QBqLQAARw0UIABBAUYNASAAQQFqIQAgBCABQQFqIgFHDQALIAMgBTYCAAzoAQsgA0EANgIAIAZBAWohAUEfDBQLQaIBIQIgASAERg3mASADKAIAIgAgBCABa2ohBSABIABrQQJqIQYCQANAIAEtAAAgAEG+1ABqLQAARw0TIABBAkYNASAAQQFqIQAgBCABQQFqIgFHDQALIAMgBTYCAAznAQsgA0EANgIAIAZBAWohAUECDBMLQaEBIQIgASAERg3lASADKAIAIgAgBCABa2ohBSABIABrQQFqIQYDQCABLQAAIABBvNQAai0AAEcNESAAQQFGDQIgAEEBaiEAIAQgAUEBaiIBRw0ACyADIAU2AgAM5QELIAEgBEYEQEGgASECDOUBC0EBIAEtAABB3wBHDREaIAFBAWohAUGHASECDMsBCyADQQA2AgAgBkEBaiEBQYgBIQIMygELQZ8BIQIgASAERg3iASADKAIAIgAgBCABa2ohBSABIABrQQhqIQYCQANAIAEtAAAgAEGE1QBqLQAARw0PIABBCEYNASAAQQFqIQAgBCABQQFqIgFHDQALIAMgBTYCAAzjAQsgA0EANgIAIAZBAWohAUEpDA8LQZ4BIQIgASAERg3hASADKAIAIgAgBCABa2ohBSABIABrQQNqIQYCQANAIAEtAAAgAEG41ABqLQAARw0OIABBA0YNASAAQQFqIQAgBCABQQFqIgFHDQALIAMgBTYCAAziAQsgA0EANgIAIAZBAWohAUEtDA4LIAEgBEYEQEGdASECDOEBCyABLQAAQcUARw0OIAFBAWohAUGEASECDMcBCyABIARGBEBBnAEhAgzgAQsCQAJAIAEtAABBzABrDggADw8PDw8PAQ8LIAFBAWohAUGCASECDMcBCyABQQFqIQFBgwEhAgzGAQtBmwEhAiABIARGDd4BIAMoAgAiACAEIAFraiEFIAEgAGtBBGohBgJAA0AgAS0AACAAQbPUAGotAABHDQsgAEEERg0BIABBAWohACAEIAFBAWoiAUcNAAsgAyAFNgIADN8BCyADQQA2AgAgBkEBaiEBQSMMCwtBmgEhAiABIARGDd0BIAMoAgAiACAEIAFraiEFIAEgAGtBAmohBgJAA0AgAS0AACAAQbDUAGotAABHDQogAEECRg0BIABBAWohACAEIAFBAWoiAUcNAAsgAyAFNgIADN4BCy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A0H+HzYCECADQQY2AgwM0QELQfgAIQIMtwELIANBkAE2AhwgAyABNgIUIAMgADYCDEEAIQIMzwELQQAhAAJAIAMoAjgiAkUNACACKAJAIgJFDQAgAyACEQAAIQALIABFDQAgAEEVRg0BIANBADYCHCADIAE2AhQgA0GCDzYCECADQSA2AgxBACECDM4BC0H3ACECDLQBCyADQY8BNgIcIAMgATYCFCADQewbNgIQIANBFTYCDEEAIQIMzAELIAEgBEYEQEGPASECDMwBCwJAIAEtAABBIEYEQCABQQFqIQEMAQsgA0EANgIcIAMgATYCFCADQZsfNgIQIANBBjYCDEEAIQIMzAELQQIhAgyyAQsDQCABLQAAQSBHDQIgBCABQQFqIgFHDQALQY4BIQIMygELIAEgBEYEQEGNASECDMoBCwJAIAEtAABBCWsOBEoAAEoAC0H1ACECDLABCyADLQApQQVGBEBB9gAhAgywAQtB9AAhAgyvAQsgASAERgRAQYwBIQIMyAELIANBEDYCCCADIAE2AgQMCgsgASAERgRAQYsBIQIMxwELAkAgAS0AAEEJaw4ERwAARwALQfMAIQIMrQELIAEgBEcEQCADQRA2AgggAyABNgIEQfEAIQIMrQELQYoBIQIMxQELAkAgASAERwRAA0AgAS0AAEGg0ABqLQAAIgBBA0cEQAJAIABBAWsOAkkABAtB8AAhAgyvAQsgBCABQQFqIgFHDQALQYgBIQIMxgELQYgBIQIMxQELIANBADYCHCADIAE2AhQgA0HbIDYCECADQQc2AgxBACECDMQBCyABIARGBEBBiQEhAgzEAQsCQAJAAkAgAS0AAEGg0gBqLQAAQQFrDgNGAgABC0HyACECDKwBCyADQQA2AhwgAyABNgIUIANBtBI2AhAgA0EHNgIMQQAhAgzEAQtB6gAhAgyqAQsgASAERwRAIAFBAWohAUHvACECDKoBC0GHASECDMIBCyAEIAEiAEYEQEGGASECDMIBCyAALQAAIgFBL0YEQCAAQQFqIQFB7gAhAgypAQsgAUEJayICQRdLDQEgACEBQQEgAnRBm4CABHENQQwBCyAEIAEiAEYEQEGFASECDMEBCyAALQAAQS9HDQAgAEEBaiEBDAMLQQAhAiADQQA2AhwgAyAANgIUIANB2yA2AhAgA0EHNgIMDL8BCwJAAkACQAJAAkADQCABLQAAQaDOAGotAAAiAEEFRwRAAkACQCAAQQFrDghHBQYHCAAEAQgLQesAIQIMrQELIAFBAWohAUHtACECDKwBCyAEIAFBAWoiAUcNAAtBhAEhAgzDAQsgAUEBagwUCyADKAIEIQAgA0EANgIEIAMgACABECwiAEUNHiADQdsANgIcIAMgATYCFCADIAA2AgxBACECDMEBCyADKAIEIQAgA0EANgIEIAMgACABECwiAEUNHiADQd0ANgIcIAMgATYCFCADIAA2AgxBACECDMABCyADKAIEIQAgA0EANgIEIAMgACABECwiAEUNHiADQfoANgIcIAMgATYCFCADIAA2AgxBACECDL8BCyADQQA2AhwgAyABNgIUIANB+Q82AhAgA0EHNgIMQQAhAgy+AQsgASAERgRAQYMBIQIMvgELAkAgAS0AAEGgzgBqLQAAQQFrDgg+BAUGAAgCAwcLIAFBAWohAQtBAyECDKMBCyABQQFqDA0LQQAhAiADQQA2AhwgA0HREjYCECADQQc2AgwgAyABQQFqNgIUDLoBCyADKAIEIQAgA0EANgIEIAMgACABECwiAEUNFiADQdsANgIcIAMgATYCFCADIAA2AgxBACECDLkBCyADKAIEIQAgA0EANgIEIAMgACABECwiAEUNFiADQd0ANgIcIAMgATYCFCADIAA2AgxBACECDLgBCyADKAIEIQAgA0EANgIEIAMgACABECwiAEUNFiADQfoANgIcIAMgATYCFCADIAA2AgxBACECDLcBCyADQQA2AhwgAyABNgIUIANB+Q82AhAgA0EHNgIMQQAhAgy2AQtB7AAhAgycAQsgASAERgRAQYIBIQIMtQELIAFBAWoMAgsgASAERgRAQYEBIQIMtAELIAFBAWoMAQsgASAERg0BIAFBAWoLIQFBBCECDJgBC0GAASECDLABCwNAIAEtAABBoMwAai0AACIAQQJHBEAgAEEBRwRAQekAIQIMmQELDDELIAQgAUEBaiIBRw0AC0H/ACECDK8BCyABIARGBEBB/gAhAgyvAQsCQCABLQAAQQlrDjcvAwYvBAYGBgYGBgYGBgYGBgYGBgYGBgUGBgIGBgYGBgYGBgYGBgYGBgYGBgYGBgYGBgYGBgYABgsgAUEBagshAUEFIQIMlAELIAFBAWoMBgsgAygCBCEAIANBADYCBCADIAAgARAsIgBFDQggA0HbADYCHCADIAE2AhQgAyAANgIMQQAhAgyrAQsgAygCBCEAIANBADYCBCADIAAgARAsIgBFDQggA0HdADYCHCADIAE2AhQgAyAANgIMQQAhAgyqAQsgAygCBCEAIANBADYCBCADIAAgARAsIgBFDQggA0H6ADYCHCADIAE2AhQgAyAANgIMQQAhAgypAQsgA0EANgIcIAMgATYCFCADQY0UNgIQIANBBzYCDEEAIQIMqAELAkACQAJAAkADQCABLQAAQaDKAGotAAAiAEEFRwRAAkAgAEEBaw4GLgMEBQYABgtB6AAhAgyUAQsgBCABQQFqIgFHDQALQf0AIQIMqwELIAMoAgQhACADQQA2AgQgAyAAIAEQLCIARQ0HIANB2wA2AhwgAyABNgIUIAMgADYCDEEAIQIMqgELIAMoAgQhACADQQA2AgQgAyAAIAEQLCIARQ0HIANB3QA2AhwgAyABNgIUIAMgADYCDEEAIQIMqQELIAMoAgQhACADQQA2AgQgAyAAIAEQLCIARQ0HIANB+gA2AhwgAyABNgIUIAMgADYCDEEAIQIMqAELIANBADYCHCADIAE2AhQgA0HkCDYCECADQQc2AgxBACECDKcBCyABIARGDQEgAUEBagshAUEGIQIMjAELQfwAIQIMpAELAkACQAJAAkADQCABLQAAQaDIAGotAAAiAEEFRwRAIABBAWsOBCkCAwQFCyAEIAFBAWoiAUcNAAtB+wAhAgynAQsgAygCBCEAIANBADYCBCADIAAgARAsIgBFDQMgA0HbADYCHCADIAE2AhQgAyAANgIMQQAhAgymAQsgAygCBCEAIANBADYCBCADIAAgARAsIgBFDQMgA0HdADYCHCADIAE2AhQgAyAANgIMQQAhAgylAQsgAygCBCEAIANBADYCBCADIAAgARAsIgBFDQMgA0H6ADYCHCADIAE2AhQgAyAANgIMQQAhAgykAQsgA0EANgIcIAMgATYCFCADQbwKNgIQIANBBzYCDEEAIQIMowELQc8AIQIMiQELQdEAIQIMiAELQecAIQIMhwELIAEgBEYEQEH6ACECDKABCwJAIAEtAABBCWsOBCAAACAACyABQQFqIQFB5gAhAgyGAQsgASAERgRAQfkAIQIMnwELAkAgAS0AAEEJaw4EHwAAHwALQQAhAAJAIAMoAjgiAkUNACACKAI4IgJFDQAgAyACEQAAIQALIABFBEBB4gEhAgyGAQsgAEEVRwRAIANBADYCHCADIAE2AhQgA0HJDTYCECADQRo2AgxBACECDJ8BCyADQfgANgIcIAMgATYCFCADQeoaNgIQIANBFTYCDEEAIQIMngELIAEgBEcEQCADQQ02AgggAyABNgIEQeQAIQIMhQELQfcAIQIMnQELIAEgBEYEQEH2ACECDJ0BCwJAAkACQCABLQAAQcgAaw4LAAELCwsLCwsLCwILCyABQQFqIQFB3QAhAgyFAQsgAUEBaiEBQeAAIQIMhAELIAFBAWohAUHjACECDIMBC0H1ACECIAEgBEYNmwEgAygCACIAIAQgAWtqIQUgASAAa0ECaiEGAkADQCABLQAAIABBtdUAai0AAEcNCCAAQQJGDQEgAEEBaiEAIAQgAUEBaiIBRw0ACyADIAU2AgAMnAELIAMoAgQhACADQgA3AwAgAyAAIAZBAWoiARArIgAEQCADQfQANgIcIAMgATYCFCADIAA2AgxBACECDJwBC0HiACECDIIBC0EAIQACQCADKAI4IgJFDQAgAigCNCICRQ0AIAMgAhEAACEACwJAIAAEQCAAQRVGDQEgA0EANgIcIAMgATYCFCADQeoNNgIQIANBJjYCDEEAIQIMnAELQeEAIQIMggELIANB8wA2AhwgAyABNgIUIANBgBs2AhAgA0EVNgIMQQAhAgyaAQsgAy0AKSIAQSNrQQtJDQkCQCAAQQZLDQBBASAAdEHKAHFFDQAMCgtBACECIANBADYCHCADIAE2AhQgA0HtCTYCECADQQg2AgwMmQELQfIAIQIgASAERg2YASADKAIAIgAgBCABa2ohBSABIABrQQFqIQYCQANAIAEtAAAgAEGz1QBqLQAARw0FIABBAUYNASAAQQFqIQAgBCABQQFqIgFHDQALIAMgBTYCAAyZAQsgAygCBCEAIANCADcDACADIAAgBkEBaiIBECsiAARAIANB8QA2AhwgAyABNgIUIAMgADYCDEEAIQIMmQELQd8AIQIMfwtBACEAAkAgAygCOCICRQ0AIAIoAjQiAkUNACADIAIRAAAhAAsCQCAABEAgAEEVRg0BIANBADYCHCADIAE2AhQgA0HqDTYCECADQSY2AgxBACECDJkBC0HeACECDH8LIANB8AA2AhwgAyABNgIUIANBgBs2AhAgA0EVNgIMQQAhAgyXAQsgAy0AKUEhRg0GIANBADYCHCADIAE2AhQgA0GRCjYCECADQQg2AgxBACECDJYBC0HvACECIAEgBEYNlQEgAygCACIAIAQgAWtqIQUgASAAa0ECaiEGAkADQCABLQAAIABBsNUAai0AAEcNAiAAQQJGDQEgAEEBaiEAIAQgAUEBaiIBRw0ACyADIAU2AgAMlgELIAMoAgQhACADQgA3AwAgAyAAIAZBAWoiARArIgBFDQIgA0HtADYCHCADIAE2AhQgAyAANgIMQQAhAgyVAQsgA0EANgIACyADKAIEIQAgA0EANgIEIAMgACABECsiAEUNgAEgA0HuADYCHCADIAE2AhQgAyAANgIMQQAhAgyTAQtB3AAhAgx5C0EAIQACQCADKAI4IgJFDQAgAigCNCICRQ0AIAMgAhEAACEACwJAIAAEQCAAQRVGDQEgA0EANgIcIAMgATYCFCADQeoNNgIQIANBJjYCDEEAIQIMkwELQdsAIQIMeQsgA0HsADYCHCADIAE2AhQgA0GAGzYCECADQRU2AgxBACECDJEBCyADLQApIgBBI0kNACAAQS5GDQAgA0EANgIcIAMgATYCFCADQckJNgIQIANBCDYCDEEAIQIMkAELQdoAIQIMdgsgASAERgRAQesAIQIMjwELAkAgAS0AAEEvRgRAIAFBAWohAQwBCyADQQA2AhwgAyABNgIUIANBsjg2AhAgA0EINgIMQQAhAgyPAQtB2QAhAgx1CyABIARHBEAgA0EONgIIIAMgATYCBEHYACECDHULQeoAIQIMjQELIAEgBEYEQEHpACEC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BADYCHCADIAE2AhQgA0GmDzYCECADQRw2AgxBACECDGgLIANBygA2AhwgAyABNgIUIANBhRw2AhAgA0EVNgIMQQAhAgxnCyABIARHBEAgASECA0AgBCACIgFrQRBOBEAgAUEQaiEC/Qz/////////////////////IAH9AAAAIg1BB/1sIA39DODg4ODg4ODg4ODg4ODg4OD9bv0MX19fX19fX19fX19fX19fX/0mIA39DAkJCQkJCQkJCQkJCQkJCQn9I/1Q/VL9ZEF/c2giAEEQRg0BIAAgAWohAQwYCyABIARGBEBBxAAhAgxpCyABLQAAQcDBAGotAABBAUcNFyAEIAFBAWoiAkcNAAtBxAAhAgxnC0HEACECDGYLIAEgBEcEQANAAkAgAS0AACIAQSByIAAgAEHBAGtB/wFxQRpJG0H/AXEiAEEJRg0AIABBIEYNAAJAAkACQAJAIABB4wBrDhMAAwMDAwMDAwEDAwMDAwMDAwMCAwsgAUEBaiEBQTYhAgxSCyABQQFqIQFBNyECDFELIAFBAWohAUE4IQIMUAsMFQsgBCABQQFqIgFHDQALQTwhAgxmC0E8IQIMZQsgASAERgRAQcgAIQIMZQsgA0ESNgIIIAMgATYCBAJAAkACQAJAAkAgAy0ALEEBaw4EFAABAgkLIAMtADJBIHENA0HgASECDE8LAkAgAy8BMiIAQQhxRQ0AIAMtAChBAUcNACADLQAuQQhxRQ0CCyADIABB9/sDcUGABHI7ATIMCwsgAyADLwEyQRByOwEyDAQLIANBADYCBCADIAEgARAxIgAEQCADQcEANgIcIAMgADYCDCADIAFBAWo2AhRBACECDGYLIAFBAWohAQxYCyADQQA2AhwgAyABNgIUIANB9BM2AhAgA0EENgIMQQAhAgxkC0HHACECIAEgBEYNYyADKAIAIgAgBCABa2ohBSABIABrQQZqIQYCQANAIABBwMUAai0AACABLQAAQSByRw0BIABBBkYNSiAAQQFqIQAgBCABQQFqIgFHDQALIAMgBTYCAAxkCyADQQA2AgAMBQsCQCABIARHBEADQCABLQAAQcDDAGotAAAiAEEBRwRAIABBAkcNAyABQQFqIQEMBQsg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VlTVEFUQ0hHRVVFUllPUkRJUkVDVE9SVFJDSFBBUkFNRVRFUlVSQ0VCU0NSSUJFQVJET1dOQUNFSU5ETktDS1VCU0NSSUJFVFRQQ0VUU1BBRFRQLw==","base64"))})},3530:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.enumToMap=function(e,t=[],s=[]){const r=0===(t?.length??0),n=0===(s?.length??0);return Object.fromEntries(Object.entries(e).filter((([,e])=>"number"==typeof e&&(r||t.includes(e))&&(n||!s.includes(e)))))}},7467:(e,t,s)=>{"use strict";const{kClients:r}=s(257),n=s(3315),{kAgent:A,kMockAgentSet:i,kMockAgentGet:o,kDispatches:a,kIsMockActive:c,kNetConnect:l,kGetNetConnect:h,kOptions:g,kFactory:d,kMockAgentRegisterCallHistory:u,kMockAgentIsCallHistoryEnabled:E,kMockAgentAddCallHistoryLog:I,kMockAgentMockCallHistoryInstance:C,kMockAgentAcceptsNonStandardSearchParameters:B,kMockCallHistoryAddLog:Q,kIgnoreTrailingSlash:p}=s(3435),f=s(615),m=s(5846),{matchValue:y,normalizeSearchParams:w,buildAndValidateMockOptions:S}=s(991),{InvalidArgumentError:D,UndiciError:b}=s(4465),v=s(5497),N=s(164),{MockCallHistory:R}=s(4969);e.exports=class extends v{constructor(e={}){super(e);const t=S(e);if(this[l]=!0,this[c]=!0,this[E]=t.enableCallHistory??!1,this[B]=t.acceptNonStandardSearchParameters??!1,this[p]=t.ignoreTrailingSlash??!1,e?.agent&&"function"!=typeof e.agent.dispatch)throw new D("Argument opts.agent must implement Agent");const s=e?.agent?e.agent:new n(e);this[A]=s,this[r]=s[r],this[g]=t,this[E]&&this[u]()}get(e){const t=this[p]?e.replace(/\/$/,""):e;let s=this[o](t);return s||(s=this[d](t),this[i](t,s)),s}dispatch(e,t){this.get(e.origin),this[I](e);const s=this[B],r={...e};if(s&&r.path){const[e,t]=r.path.split("?"),n=w(t,s);r.path=`${e}?${n}`}return this[A].dispatch(r,t)}async close(){this.clearCallHistory(),await this[A].close(),this[r].clear()}deactivate(){this[c]=!1}activate(){this[c]=!0}enableNetConnect(e){if("string"==typeof e||"function"==typeof e||e instanceof RegExp)Array.isArray(this[l])?this[l].push(e):this[l]=[e];else{if("undefined"!=typeof e)throw new D("Unsupported matcher. Must be one of String|Function|RegExp.");this[l]=!0}}disableNetConnect(){this[l]=!1}enableCallHistory(){return this[E]=!0,this}disableCallHistory(){return this[E]=!1,this}getCallHistory(){return this[C]}clearCallHistory(){void 0!==this[C]&&this[C].clear()}get isMockActive(){return this[c]}[u](){void 0===this[C]&&(this[C]=new R)}[I](e){this[E]&&(this[u](),this[C][Q](e))}[i](e,t){this[r].set(e,{count:0,dispatcher:t})}[d](e){const t=Object.assign({agent:this},this[g]);return this[g]&&1===this[g].connections?new f(e,t):new m(e,t)}[o](e){const t=this[r].get(e);if(t?.dispatcher)return t.dispatcher;if("string"!=typeof e){const t=this[d]("http://localhost:9999");return this[i](e,t),t}for(const[t,s]of Array.from(this[r]))if(s&&"string"!=typeof t&&y(t,e)){const t=this[d](e);return this[i](e,t),t[a]=s.dispatcher[a],t}}[h](){return this[l]}pendingInterceptors(){const e=this[r];return Array.from(e.entries()).flatMap((([e,t])=>t.dispatcher[a].map((t=>({...t,origin:e}))))).filter((({pending:e})=>e))}assertNoPendingInterceptors({pendingInterceptorsFormatter:e=new N}={}){const t=this.pendingInterceptors();if(0!==t.length)throw new b(1===t.length?`1 interceptor is pending:\n\n${e.format(t)}`.trim():`${t.length} interceptors are pending:\n\n${e.format(t)}`.trim())}}},4969:(e,t,s)=>{"use strict";const{kMockCallHistoryAddLog:r}=s(3435),{InvalidArgumentError:n}=s(4465);function A(e,t,s,r){switch(t.operator){case"OR":return r.push(...s(e)),r;case"AND":return s.call({logs:r},e);default:throw new n("options.operator must to be a case insensitive string equal to 'OR' or 'AND'")}}function i(e={}){const t={};if("operator"in e){if("string"!=typeof e.operator||"OR"!==e.operator.toUpperCase()&&"AND"!==e.operator.toUpperCase())throw new n("options.operator must to be a case insensitive string equal to 'OR' or 'AND'");return{...t,operator:e.operator.toUpperCase()}}return t}function o(e){return t=>{if("string"==typeof t||null==t)return this.logs.filter((s=>s[e]===t));if(t instanceof RegExp)return this.logs.filter((s=>t.test(s[e])));throw new n(`${e} parameter should be one of string, regexp, undefined or null`)}}class a{constructor(e={}){this.body=e.body,this.headers=e.headers,this.method=e.method;const t=function(e){try{const t=new URL(e.path,e.origin);return 0!==t.search.length||(t.search=new URLSearchParams(e.query).toString()),t}catch(e){throw new n("An error occurred when computing MockCallHistoryLog.url",{cause:e})}}(e);this.fullUrl=t.toString(),this.origin=t.origin,this.path=t.pathname,this.searchParams=Object.fromEntries(t.searchParams),this.protocol=t.protocol,this.host=t.host,this.port=t.port,this.hash=t.hash}toMap(){return new Map([["protocol",this.protocol],["host",this.host],["port",this.port],["origin",this.origin],["path",this.path],["hash",this.hash],["searchParams",this.searchParams],["fullUrl",this.fullUrl],["method",this.method],["body",this.body],["headers",this.headers]])}toString(){const e="->",t="|";let s="";return this.toMap().forEach(((r,n)=>{"string"!=typeof r&&null!=r||(s=`${s}${n}${e}${r}${t}`),("object"==typeof r&&null!==r||Array.isArray(r))&&(s=`${s}${n}${e}${JSON.stringify(r)}${t}`)})),s.slice(0,-1)}}class c{logs=[];calls(){return this.logs}firstCall(){return this.logs.at(0)}lastCall(){return this.logs.at(-1)}nthCall(e){if("number"!=typeof e)throw new n("nthCall must be called with a number");if(!Number.isInteger(e))throw new n("nthCall must be called with an integer");if(1!==Math.sign(e))throw new n("nthCall must be called with a positive value. use firstCall or lastCall instead");return this.logs.at(e-1)}filterCalls(e,t){if(0===this.logs.length)return this.logs;if("function"==typeof e)return this.logs.filter(e);if(e instanceof RegExp)return this.logs.filter((t=>e.test(t.toString())));if("object"==typeof e&&null!==e){if(0===Object.keys(e).length)return this.logs;const s={operator:"OR",...i(t)};let r=[];"protocol"in e&&(r=A(e.protocol,s,this.filterCallsByProtocol,r)),"host"in e&&(r=A(e.host,s,this.filterCallsByHost,r)),"port"in e&&(r=A(e.port,s,this.filterCallsByPort,r)),"origin"in e&&(r=A(e.origin,s,this.filterCallsByOrigin,r)),"path"in e&&(r=A(e.path,s,this.filterCallsByPath,r)),"hash"in e&&(r=A(e.hash,s,this.filterCallsByHash,r)),"fullUrl"in e&&(r=A(e.fullUrl,s,this.filterCallsByFullUrl,r)),"method"in e&&(r=A(e.method,s,this.filterCallsByMethod,r));return[...new Set(r)]}throw new n("criteria parameter should be one of function, regexp, or object")}filterCallsByProtocol=o.call(this,"protocol");filterCallsByHost=o.call(this,"host");filterCallsByPort=o.call(this,"port");filterCallsByOrigin=o.call(this,"origin");filterCallsByPath=o.call(this,"path");filterCallsByHash=o.call(this,"hash");filterCallsByFullUrl=o.call(this,"fullUrl");filterCallsByMethod=o.call(this,"method");clear(){this.logs=[]}[r](e){const t=new a(e);return this.logs.push(t),t}*[Symbol.iterator](){for(const e of this.calls())yield e}}e.exports.MockCallHistory=c,e.exports.MockCallHistoryLog=a},615:(e,t,s)=>{"use strict";const{promisify:r}=s(7975),n=s(1167),{buildMockDispatch:A}=s(991),{kDispatches:i,kMockAgent:o,kClose:a,kOriginalClose:c,kOrigin:l,kOriginalDispatch:h,kConnected:g,kIgnoreTrailingSlash:d}=s(3435),{MockInterceptor:u}=s(193),E=s(257),{InvalidArgumentError:I}=s(4465);class C extends n{constructor(e,t){if(!t||!t.agent||"function"!=typeof t.agent.dispatch)throw new I("Argument opts.agent must implement Agent");super(e,t),this[o]=t.agent,this[l]=e,this[d]=t.ignoreTrailingSlash??!1,this[i]=[],this[g]=1,this[h]=this.dispatch,this[c]=this.close.bind(this),this.dispatch=A.call(this),this.close=this[a]}get[E.kConnected](){return this[g]}intercept(e){return new u(e&&{ignoreTrailingSlash:this[d],...e},this[i])}cleanMocks(){this[i]=[]}async[a](){await r(this[c])(),this[g]=0,this[o][E.kClients].delete(this[l])}}e.exports=C},3123:(e,t,s)=>{"use strict";const{UndiciError:r}=s(4465),n=Symbol.for("undici.error.UND_MOCK_ERR_MOCK_NOT_MATCHED");class A extends r{constructor(e){super(e),this.name="MockNotMatchedError",this.message=e||"The request does not match any registered mock dispatches",this.code="UND_MOCK_ERR_MOCK_NOT_MATCHED"}static[Symbol.hasInstance](e){return e&&!0===e[n]}get[n](){return!0}}e.exports={MockNotMatchedError:A}},193:(e,t,s)=>{"use strict";const{getResponseData:r,buildKey:n,addMockDispatch:A}=s(991),{kDispatches:i,kDispatchKey:o,kDefaultHeaders:a,kDefaultTrailers:c,kContentLength:l,kMockDispatch:h,kIgnoreTrailingSlash:g}=s(3435),{InvalidArgumentError:d}=s(4465),{serializePathWithQuery:u}=s(2858);class E{constructor(e){this[h]=e}delay(e){if("number"!=typeof e||!Number.isInteger(e)||e<=0)throw new d("waitInMs must be a valid integer > 0");return this[h].delay=e,this}persist(){return this[h].persist=!0,this}times(e){if("number"!=typeof e||!Number.isInteger(e)||e<=0)throw new d("repeatTimes must be a valid integer > 0");return this[h].times=e,this}}e.exports.MockInterceptor=class{constructor(e,t){if("object"!=typeof e)throw new d("opts must be an object");if("undefined"==typeof e.path)throw new d("opts.path must be defined");if("undefined"==typeof e.method&&(e.method="GET"),"string"==typeof e.path)if(e.query)e.path=u(e.path,e.query);else{const t=new URL(e.path,"data://");e.path=t.pathname+t.search}"string"==typeof e.method&&(e.method=e.method.toUpperCase()),this[o]=n(e),this[i]=t,this[g]=e.ignoreTrailingSlash??!1,this[a]={},this[c]={},this[l]=!1}createMockScopeDispatchData({statusCode:e,data:t,responseOptions:s}){const n=r(t),A=this[l]?{"content-length":n.length}:{};return{statusCode:e,data:t,headers:{...this[a],...A,...s.headers},trailers:{...this[c],...s.trailers}}}validateReplyParameters(e){if("undefined"==typeof e.statusCode)throw new d("statusCode must be defined");if("object"!=typeof e.responseOptions||null===e.responseOptions)throw new d("responseOptions must be an object")}reply(e){if("function"==typeof e){const t=t=>{const s=e(t);if("object"!=typeof s||null===s)throw new d("reply options callback must return an object");const r={data:"",responseOptions:{},...s};return this.validateReplyParameters(r),{...this.createMockScopeDispatchData(r)}},s=A(this[i],this[o],t,{ignoreTrailingSlash:this[g]});return new E(s)}const t={statusCode:e,data:void 0===arguments[1]?"":arguments[1],responseOptions:void 0===arguments[2]?{}:arguments[2]};this.validateReplyParameters(t);const s=this.createMockScopeDispatchData(t),r=A(this[i],this[o],s,{ignoreTrailingSlash:this[g]});return new E(r)}replyWithError(e){if("undefined"==typeof e)throw new d("error must be defined");const t=A(this[i],this[o],{error:e},{ignoreTrailingSlash:this[g]});return new E(t)}defaultReplyHeaders(e){if("undefined"==typeof e)throw new d("headers must be defined");return this[a]=e,this}defaultReplyTrailers(e){if("undefined"==typeof e)throw new d("trailers must be defined");return this[c]=e,this}replyContentLength(){return this[l]=!0,this}},e.exports.MockScope=E},5846:(e,t,s)=>{"use strict";const{promisify:r}=s(7975),n=s(8542),{buildMockDispatch:A}=s(991),{kDispatches:i,kMockAgent:o,kClose:a,kOriginalClose:c,kOrigin:l,kOriginalDispatch:h,kConnected:g,kIgnoreTrailingSlash:d}=s(3435),{MockInterceptor:u}=s(193),E=s(257),{InvalidArgumentError:I}=s(4465);class C extends n{constructor(e,t){if(!t||!t.agent||"function"!=typeof t.agent.dispatch)throw new I("Argument opts.agent must implement Agent");super(e,t),this[o]=t.agent,this[l]=e,this[d]=t.ignoreTrailingSlash??!1,this[i]=[],this[g]=1,this[h]=this.dispatch,this[c]=this.close.bind(this),this.dispatch=A.call(this),this.close=this[a]}get[E.kConnected](){return this[g]}intercept(e){return new u(e&&{ignoreTrailingSlash:this[d],...e},this[i])}cleanMocks(){this[i]=[]}async[a](){await r(this[c])(),this[g]=0,this[o][E.kClients].delete(this[l])}}e.exports=C},3435:e=>{"use strict";e.exports={kAgent:Symbol("agent"),kOptions:Symbol("options"),kFactory:Symbol("factory"),kDispatches:Symbol("dispatches"),kDispatchKey:Symbol("dispatch key"),kDefaultHeaders:Symbol("default headers"),kDefaultTrailers:Symbol("default trailers"),kContentLength:Symbol("content length"),kMockAgent:Symbol("mock agent"),kMockAgentSet:Symbol("mock agent set"),kMockAgentGet:Symbol("mock agent get"),kMockDispatch:Symbol("mock dispatch"),kClose:Symbol("close"),kOriginalClose:Symbol("original agent close"),kOriginalDispatch:Symbol("original dispatch"),kOrigin:Symbol("origin"),kIsMockActive:Symbol("is mock active"),kNetConnect:Symbol("net connect"),kGetNetConnect:Symbol("get net connect"),kConnected:Symbol("connected"),kIgnoreTrailingSlash:Symbol("ignore trailing slash"),kMockAgentMockCallHistoryInstance:Symbol("mock agent mock call history name"),kMockAgentRegisterCallHistory:Symbol("mock agent register mock call history"),kMockAgentAddCallHistoryLog:Symbol("mock agent add call history log"),kMockAgentIsCallHistoryEnabled:Symbol("mock agent is call history enabled"),kMockAgentAcceptsNonStandardSearchParameters:Symbol("mock agent accepts non standard search parameters"),kMockCallHistoryAddLog:Symbol("mock call history add log")}},991:(e,t,s)=>{"use strict";const{MockNotMatchedError:r}=s(3123),{kDispatches:n,kMockAgent:A,kOriginalDispatch:i,kOrigin:o,kGetNetConnect:a}=s(3435),{serializePathWithQuery:c}=s(2858),{STATUS_CODES:l}=s(7067),{types:{isPromise:h}}=s(7975),{InvalidArgumentError:g}=s(4465);function d(e,t){return"string"==typeof e?e===t:e instanceof RegExp?e.test(t):"function"==typeof e&&!0===e(t)}function u(e){return Object.fromEntries(Object.entries(e).map((([e,t])=>[e.toLocaleLowerCase(),t])))}function E(e,t){if(!Array.isArray(e))return"function"==typeof e.get?e.get(t):u(e)[t.toLocaleLowerCase()];for(let s=0;s<e.length;s+=2)if(e[s].toLocaleLowerCase()===t.toLocaleLowerCase())return e[s+1]}function I(e){const t=e.slice(),s=[];for(let e=0;e<t.length;e+=2)s.push([t[e],t[e+1]]);return Object.fromEntries(s)}function C(e,t){if("function"==typeof e.headers)return Array.isArray(t)&&(t=I(t)),e.headers(t?u(t):{});if("undefined"==typeof e.headers)return!0;if("object"!=typeof t||"object"!=typeof e.headers)return!1;for(const[s,r]of Object.entries(e.headers)){if(!d(r,E(t,s)))return!1}return!0}function B(e){if("string"!=typeof e)return e;const t=e.split("?",3);if(2!==t.length)return e;const s=new URLSearchParams(t.pop());return s.sort(),[...t,s.toString()].join("?")}function Q(e){return Buffer.isBuffer(e)||e instanceof Uint8Array||e instanceof ArrayBuffer?e:"object"==typeof e?JSON.stringify(e):e?e.toString():""}function p(e,t){const s=t.query?c(t.path,t.query):t.path,n="string"==typeof s?B(s):s,A=m(n);let i=e.filter((({consumed:e})=>!e)).filter((({path:e,ignoreTrailingSlash:t})=>t?d(m(B(e)),A):d(B(e),n)));if(0===i.length)throw new r(`Mock dispatch not matched for path '${n}'`);if(i=i.filter((({method:e})=>d(e,t.method))),0===i.length)throw new r(`Mock dispatch not matched for method '${t.method}' on path '${n}'`);if(i=i.filter((({body:e})=>"undefined"==typeof e||d(e,t.body))),0===i.length)throw new r(`Mock dispatch not matched for body '${t.body}' on path '${n}'`);if(i=i.filter((e=>C(e,t.headers))),0===i.length){const e="object"==typeof t.headers?JSON.stringify(t.headers):t.headers;throw new r(`Mock dispatch not matched for headers '${e}' on path '${n}'`)}return i[0]}function f(e,t){const s=e.findIndex((e=>!!e.consumed&&function(e,{path:t,method:s,body:r,headers:n}){const A=d(e.path,t),i=d(e.method,s),o="undefined"==typeof e.body||d(e.body,r),a=C(e,n);return A&&i&&o&&a}(e,t)));-1!==s&&e.splice(s,1)}function m(e){for(;e.endsWith("/");)e=e.slice(0,-1);return 0===e.length&&(e="/"),e}function y(e){const{path:t,method:s,body:r,headers:n,query:A}=e;return{path:t,method:s,body:r,headers:n,query:A}}function w(e){const t=Object.keys(e),s=[];for(let r=0;r<t.length;++r){const n=t[r],A=e[n],i=Buffer.from(`${n}`);if(Array.isArray(A))for(let e=0;e<A.length;++e)s.push(i,Buffer.from(`${A[e]}`));else s.push(i,Buffer.from(`${A}`))}return s}function S(e){return l[e]||"unknown"}function D(e,t){const s=y(e),r=p(this[n],s);r.timesInvoked++,r.data.callback&&(r.data={...r.data,...r.data.callback(e)});const{data:{statusCode:A,data:i,headers:o,trailers:a,error:c},delay:l,persist:g}=r,{timesInvoked:d,times:u}=r;if(r.consumed=!g&&d>=u,r.pending=d<u,null!==c)return f(this[n],s),t.onError(c),!0;function E(r,n=i){const c=Array.isArray(e.headers)?I(e.headers):e.headers,l="function"==typeof n?n({...e,headers:c}):n;if(h(l))return void l.then((e=>E(r,e)));const g=Q(l),d=w(o),u=w(a);t.onConnect?.((e=>t.onError(e)),null),t.onHeaders?.(A,d,C,S(A)),t.onData?.(Buffer.from(g)),t.onComplete?.(u),f(r,s)}function C(){}return"number"==typeof l&&l>0?setTimeout((()=>{E(this[n])}),l):E(this[n]),!0}function b(e,t){const s=new URL(t);return!0===e||!(!Array.isArray(e)||!e.some((e=>d(e,s.host))))}e.exports={getResponseData:Q,getMockDispatch:p,addMockDispatch:function(e,t,s,r){const n={...{timesInvoked:0,times:1,persist:!1,consumed:!1,...r},...t,pending:!0,data:{error:null,..."function"==typeof s?{callback:s}:{...s}}};return e.push(n),n},deleteMockDispatch:f,buildKey:y,generateKeyValues:w,matchValue:d,getResponse:async function(e){const t=[];for await(const s of e)t.push(s);return Buffer.concat(t).toString("utf8")},getStatusText:S,mockDispatch:D,buildMockDispatch:function(){const e=this[A],t=this[o],s=this[i];return function(n,A){if(e.isMockActive)try{D.call(this,n,A)}catch(i){if("UND_MOCK_ERR_MOCK_NOT_MATCHED"!==i.code)throw i;{const o=e[a]();if(!1===o)throw new r(`${i.message}: subsequent request to origin ${t} was not allowed (net.connect disabled)`);if(!b(o,t))throw new r(`${i.message}: subsequent request to origin ${t} was not allowed (net.connect is not enabled for this origin)`);s.call(this,n,A)}}else s.call(this,n,A)}},checkNetConnect:b,buildAndValidateMockOptions:function(e){const{agent:t,...s}=e;if("enableCallHistory"in s&&"boolean"!=typeof s.enableCallHistory)throw new g("options.enableCallHistory must to be a boolean");if("acceptNonStandardSearchParameters"in s&&"boolean"!=typeof s.acceptNonStandardSearchParameters)throw new g("options.acceptNonStandardSearchParameters must to be a boolean");if("ignoreTrailingSlash"in s&&"boolean"!=typeof s.ignoreTrailingSlash)throw new g("options.ignoreTrailingSlash must to be a boolean");return s},getHeaderByName:E,buildHeadersFromArray:I,normalizeSearchParams:function(e){if("string"!=typeof e)return e;const t=new URLSearchParams(e),s=new URLSearchParams;for(let[e,r]of t.entries()){e=e.replace("[]","");if(/^(['"]).*\1$/.test(r))s.append(e,r);else if(r.includes(",")){const t=r.split(",");for(const r of t)s.append(e,r)}else s.append(e,r)}return s}}},164:(e,t,s)=>{"use strict";const{Transform:r}=s(7075),{Console:n}=s(7540),A=process.versions.icu?"✅":"Y ",i=process.versions.icu?"❌":"N ";e.exports=class{constructor({disableColors:e}={}){this.transform=new r({transform(e,t,s){s(null,e)}}),this.logger=new n({stdout:this.transform,inspectOptions:{colors:!e&&!process.env.CI}})}format(e){const t=e.map((({method:e,path:t,data:{statusCode:s},persist:r,times:n,timesInvoked:o,origin:a})=>({Method:e,Origin:a,Path:t,"Status code":s,Persistent:r?A:i,Invocations:o,Remaining:r?1/0:n-o})));return this.logger.table(t),this.transform.read().toString()}}},1313:(e,t,s)=>{"use strict";const r=s(3315),n=s(7467),{SnapshotRecorder:A}=s(6632),i=s(832),{InvalidArgumentError:o,UndiciError:a}=s(4465),{validateSnapshotMode:c}=s(5505),l=Symbol("kSnapshotRecorder"),h=Symbol("kSnapshotMode"),g=Symbol("kSnapshotPath"),d=Symbol("kSnapshotLoaded"),u=Symbol("kRealAgent");let E=!1;e.exports=class extends n{constructor(e={}){E||(process.emitWarning("SnapshotAgent is experimental and subject to change","ExperimentalWarning"),E=!0);const{mode:t="record",snapshotPath:s=null,...n}=e;if(super(n),c(t),("playback"===t||"update"===t)&&!s)throw new o(`snapshotPath is required when mode is '${t}'`);this[h]=t,this[g]=s,this[l]=new A({snapshotPath:this[g],mode:this[h],maxSnapshots:e.maxSnapshots,autoFlush:e.autoFlush,flushInterval:e.flushInterval,matchHeaders:e.matchHeaders,ignoreHeaders:e.ignoreHeaders,excludeHeaders:e.excludeHeaders,matchBody:e.matchBody,matchQuery:e.matchQuery,caseSensitive:e.caseSensitive,shouldRecord:e.shouldRecord,shouldPlayback:e.shouldPlayback,excludeUrls:e.excludeUrls}),this[d]=!1,"record"!==this[h]&&"update"!==this[h]||(this[u]=new r(e)),"playback"!==this[h]&&"update"!==this[h]||!this[g]||this.loadSnapshots().catch((()=>{}))}dispatch(e,t){t=i.wrap(t);const s=this[h];if("playback"===s||"update"===s){if(!this[d])return this.#me(e,t);const r=this[l].findSnapshot(e);if(r)return this.#ye(r,t);if("update"===s)return this.#we(e,t);{const s=new a(`No snapshot found for ${e.method||"GET"} ${e.path}`);if(t.onError)return void t.onError(s);throw s}}if("record"===s)return this.#we(e,t)}async#me(e,t){return await this.loadSnapshots(),this.dispatch(e,t)}#we(e,t){const s={statusCode:null,headers:{},trailers:{},body:[]},r=this,n={onRequestStart(e,s){return t.onRequestStart(e,{...s,history:this.history})},onRequestUpgrade:(e,s,r,n)=>t.onRequestUpgrade(e,s,r,n),onResponseStart:(e,r,n,A)=>(s.statusCode=r,s.headers=n,t.onResponseStart(e,r,n,A)),onResponseData:(e,r)=>(s.body.push(r),t.onResponseData(e,r)),onResponseEnd(n,A){s.trailers=A;const i=Buffer.concat(s.body);r[l].record(e,{statusCode:s.statusCode,headers:s.headers,body:i,trailers:s.trailers}).then((()=>{t.onResponseEnd(n,A)})).catch((e=>{t.onResponseError(n,e)}))}};return this[u].dispatch(e,n)}#ye(e,t){try{const{response:s}=e,r={pause(){},resume(){},abort(e){this.aborted=!0,this.reason=e},aborted:!1,paused:!1};t.onRequestStart(r),t.onResponseStart(r,s.statusCode,s.headers);const n=Buffer.from(s.body,"base64");t.onResponseData(r,n),t.onResponseEnd(r,s.trailers)}catch(e){t.onError?.(e)}}async loadSnapshots(e){await this[l].loadSnapshots(e||this[g]),this[d]=!0,"playback"===this[h]&&this.#Se()}async saveSnapshots(e){return this[l].saveSnapshots(e||this[g])}#Se(){for(const e of this[l].getSnapshots()){const{request:t,responses:s,response:r}=e,n=new URL(t.url),A=this.get(n.origin),i=s?s[0]:r;i&&A.intercept({path:n.pathname+n.search,method:t.method,headers:t.headers,body:t.body}).reply(i.statusCode,i.body,{headers:i.headers,trailers:i.trailers}).persist()}}getRecorder(){return this[l]}getMode(){return this[h]}clearSnapshots(){this[l].clear()}resetCallCounts(){this[l].resetCallCounts()}deleteSnapshot(e){return this[l].deleteSnapshot(e)}getSnapshotInfo(e){return this[l].getSnapshotInfo(e)}replaceSnapshots(e){this[l].replaceSnapshots(e)}async close(){await this[l].close(),await(this[u]?.close()),await super.close()}}},6632:(e,t,s)=>{"use strict";const{writeFile:r,readFile:n,mkdir:A}=s(1455),{dirname:i,resolve:o}=s(6760),{setTimeout:a,clearTimeout:c}=s(7997),{InvalidArgumentError:l,UndiciError:h}=s(4465),{hashId:g,isUrlExcludedFactory:d,normalizeHeaders:u,createHeaderFilters:E}=s(5505);function I(e,t,s={}){const r=new URL(e.path,e.origin),n=e._normalizedHeaders||u(e.headers);return e._normalizedHeaders||(e._normalizedHeaders=n),{method:e.method||"GET",url:!1!==s.matchQuery?r.toString():`${r.origin}${r.pathname}`,headers:C(n,t,s),body:!1!==s.matchBody&&e.body?String(e.body):""}}function C(e,t,s={}){if(!e||"object"!=typeof e)return{};const{caseSensitive:r=!1}=s,n={},{ignore:A,exclude:i,match:o}=t;for(const[t,s]of Object.entries(e)){const e=r?t:t.toLowerCase();i.has(e)||(A.has(e)||(0===o.size||o.has(e))&&(n[e]=s))}return n}function B(e,t,s={}){if(!e||"object"!=typeof e)return{};const{caseSensitive:r=!1}=s,n={},{exclude:A}=t;for(const[t,s]of Object.entries(e)){const e=r?t:t.toLowerCase();A.has(e)||(n[e]=s)}return n}function Q(e){const t=[e.method,e.url];if(e.headers&&"object"==typeof e.headers){const s=Object.keys(e.headers).sort();for(const r of s){const s=Array.isArray(e.headers[r])?e.headers[r]:[e.headers[r]];t.push(r);for(const e of s.sort())t.push(String(e))}}t.push(e.body);const s=t.join("|");return g(s)}e.exports={SnapshotRecorder:class{#De;#be;#ve=new Map;#Ne;#Re=1/0;#ke=!1;#Te;constructor(e={}){this.#Ne=e.snapshotPath,this.#Re=e.maxSnapshots||1/0,this.#ke=e.autoFlush||!1,this.flushInterval=e.flushInterval||3e4,this._flushTimer=null,this.matchOptions={matchHeaders:e.matchHeaders||[],ignoreHeaders:e.ignoreHeaders||[],excludeHeaders:e.excludeHeaders||[],matchBody:!1!==e.matchBody,matchQuery:!1!==e.matchQuery,caseSensitive:e.caseSensitive||!1},this.#Te=E(this.matchOptions),this.shouldRecord=e.shouldRecord||(()=>!0),this.shouldPlayback=e.shouldPlayback||(()=>!0),this.#be=d(e.excludeUrls),this.#ke&&this.#Ne&&this.#Fe()}async record(e,t){if(!this.shouldRecord(e))return;const s=new URL(e.path,e.origin).toString();if(this.#be(s))return;const r=I(e,this.#Te,this.matchOptions),n=Q(r),A=u(t.headers),i={statusCode:t.statusCode,headers:B(A,this.#Te,this.matchOptions),body:Buffer.isBuffer(t.body)?t.body.toString("base64"):Buffer.from(String(t.body||"")).toString("base64"),trailers:t.trailers};if(this.#ve.size>=this.#Re&&!this.#ve.has(n)){const e=this.#ve.keys().next().value;this.#ve.delete(e)}const o=this.#ve.get(n);o&&o.responses?(o.responses.push(i),o.timestamp=(new Date).toISOString()):this.#ve.set(n,{request:r,responses:[i],callCount:0,timestamp:(new Date).toISOString()}),this.#ke&&this.#Ne&&this.#Me()}findSnapshot(e){if(!this.shouldPlayback(e))return;const t=new URL(e.path,e.origin).toString();if(this.#be(t))return;const s=Q(I(e,this.#Te,this.matchOptions)),r=this.#ve.get(s);if(!r)return;const n=r.callCount||0,A=Math.min(n,r.responses.length-1);return r.callCount=n+1,{...r,response:r.responses[A]}}async loadSnapshots(e){const t=e||this.#Ne;if(!t)throw new l("Snapshot path is required");try{const e=await n(o(t),"utf8"),s=JSON.parse(e);if(Array.isArray(s)){this.#ve.clear();for(const{hash:e,snapshot:t}of s)this.#ve.set(e,t)}else this.#ve=new Map(Object.entries(s))}catch(e){if("ENOENT"!==e.code)throw new h(`Failed to load snapshots from ${t}`,{cause:e});this.#ve.clear()}}async saveSnapshots(e){const t=e||this.#Ne;if(!t)throw new l("Snapshot path is required");const s=o(t);await A(i(s),{recursive:!0});const n=Array.from(this.#ve.entries()).map((([e,t])=>({hash:e,snapshot:t})));await r(s,JSON.stringify(n,null,2),{flush:!0})}clear(){this.#ve.clear()}getSnapshots(){return Array.from(this.#ve.values())}size(){return this.#ve.size}resetCallCounts(){for(const e of this.#ve.values())e.callCount=0}deleteSnapshot(e){const t=Q(I(e,this.#Te,this.matchOptions));return this.#ve.delete(t)}getSnapshotInfo(e){const t=Q(I(e,this.#Te,this.matchOptions)),s=this.#ve.get(t);return s?{hash:t,request:s.request,responseCount:s.responses?s.responses.length:s.response?1:0,callCount:s.callCount||0,timestamp:s.timestamp}:null}replaceSnapshots(e){if(this.#ve.clear(),Array.isArray(e))for(const{hash:t,snapshot:s}of e)this.#ve.set(t,s);else e&&"object"==typeof e&&(this.#ve=new Map(Object.entries(e)))}#Fe(){return this.#Me()}#Ue(){this.#De&&(c(this.#De),this.saveSnapshots().catch((()=>{})),this.#De=null)}#Me(){this.#De=a((()=>{this.saveSnapshots().catch((()=>{})),this.#ke?this.#De?.refresh():this.#De=null}),1e3)}destroy(){this.#Ue(),this.#De&&(c(this.#De),this.#De=null)}async close(){this.#Ne&&0!==this.#ve.size&&await this.saveSnapshots(),this.destroy()}},formatRequestKey:I,createRequestHash:Q,filterHeadersForMatching:C,filterHeadersForStorage:B,createHeaderFilters:E}},5505:(e,t,s)=>{"use strict";const{InvalidArgumentError:r}=s(4465);let n;try{n=s(7598)}catch{}const A=n?.hash?e=>n.hash("sha256",e,"base64url"):e=>Buffer.from(e).toString("base64url");function i(e){return Array.isArray(e)&&!(1&e.length)}const o=["record","playback","update"];e.exports={createHeaderFilters:function(e={}){const{ignoreHeaders:t=[],excludeHeaders:s=[],matchHeaders:r=[],caseSensitive:n=!1}=e;return{ignore:new Set(t.map((e=>n?e:e.toLowerCase()))),exclude:new Set(s.map((e=>n?e:e.toLowerCase()))),match:new Set(r.map((e=>n?e:e.toLowerCase())))}},hashId:A,isUndiciHeaders:i,normalizeHeaders:function(e){const t={};if(!e)return t;if(i(e)){for(let s=0;s<e.length;s+=2){const r=e[s],n=e[s+1];if(r&&void 0!==n){const e=Buffer.isBuffer(r)?r.toString():r,s=Buffer.isBuffer(n)?n.toString():n;t[e.toLowerCase()]=s}}return t}if(e&&"object"==typeof e)for(const[s,r]of Object.entries(e))s&&"string"==typeof s&&(t[s.toLowerCase()]=Array.isArray(r)?r.join(", "):String(r));return t},isUrlExcludedFactory:function(e=[]){return 0===e.length?()=>!1:function(t){let s;for(const r of e)if("string"==typeof r){if(s||(s=t.toLowerCase()),s.includes(r.toLowerCase()))return!0}else if(r instanceof RegExp&&r.test(t))return!0;return!1}},validateSnapshotMode:function(e){if(!o.includes(e))throw new r(`Invalid snapshot mode: ${e}. Must be one of: ${o.join(", ")}`)}}},9453:(e,t,s)=>{"use strict";const{safeHTTPMethods:r,pathHasQueryOrFragment:n}=s(2858),{serializePathWithQuery:A}=s(2858);e.exports={makeCacheKey:function(e){if(!e.origin)throw new Error("opts.origin is undefined");let t=e.path||"/";return e.query&&!n(e.path)&&(t=A(t,e.query)),{origin:e.origin.toString(),method:e.method,path:t,headers:e.headers}},normalizeHeaders:function(e){let t;if(null==e.headers)t={};else if("function"==typeof e.headers[Symbol.iterator]){t={};for(const s of e.headers){if(!Array.isArray(s))throw new Error("opts.headers is not a valid header map");const[e,r]=s;if("string"!=typeof e||"string"!=typeof r)throw new Error("opts.headers is not a valid header map");t[e.toLowerCase()]=r}}else{if("object"!=typeof e.headers)throw new Error("opts.headers is not an object");t={};for(const s of Object.keys(e.headers))t[s.toLowerCase()]=e.headers[s]}return t},assertCacheKey:function(e){if("object"!=typeof e)throw new TypeError("expected key to be object, got "+typeof e);for(const t of["origin","method","path"])if("string"!=typeof e[t])throw new TypeError(`expected key.${t} to be string, got ${typeof e[t]}`);if(void 0!==e.headers&&"object"!=typeof e.headers)throw new TypeError("expected headers to be object, got "+typeof e)},assertCacheValue:function(e){if("object"!=typeof e)throw new TypeError("expected value to be object, got "+typeof e);for(const t of["statusCode","cachedAt","staleAt","deleteAt"])if("number"!=typeof e[t])throw new TypeError(`expected value.${t} to be number, got ${typeof e[t]}`);if("string"!=typeof e.statusMessage)throw new TypeError("expected value.statusMessage to be string, got "+typeof e.statusMessage);if(null!=e.headers&&"object"!=typeof e.headers)throw new TypeError("expected value.rawHeaders to be object, got "+typeof e.headers);if(void 0!==e.vary&&"object"!=typeof e.vary)throw new TypeError("expected value.vary to be object, got "+typeof e.vary);if(void 0!==e.etag&&"string"!=typeof e.etag)throw new TypeError("expected value.etag to be string, got "+typeof e.etag)},parseCacheControlHeader:function(e){const t={};let s;if(Array.isArray(e)){s=[];for(const t of e)s.push(...t.split(","))}else s=e.split(",");for(let e=0;e<s.length;e++){const r=s[e].toLowerCase(),n=r.indexOf("=");let A,i;switch(-1!==n?(A=r.substring(0,n).trimStart(),i=r.substring(n+1)):A=r.trim(),A){case"min-fresh":case"max-stale":case"max-age":case"s-maxage":case"stale-while-revalidate":case"stale-if-error":{if(void 0===i||" "===i[0])continue;i.length>=2&&'"'===i[0]&&'"'===i[i.length-1]&&(i=i.substring(1,i.length-1));const e=parseInt(i,10);if(e!=e)continue;if("max-age"===A&&A in t&&t[A]>=e)continue;t[A]=e;break}case"private":case"no-cache":if(i){if('"'===i[0]){const r=[i.substring(1)];let n='"'===i[i.length-1];if(!n)for(let t=e+1;t<s.length;t++){const e=s[t],A=e.length;if(r.push(e.trim()),0!==A&&'"'===e[A-1]){n=!0;break}}if(n){let e=r[r.length-1];'"'===e[e.length-1]&&(e=e.substring(0,e.length-1),r[r.length-1]=e),t[A]=A in t?t[A].concat(r):r}}else t[A]=A in t?t[A].concat(i):[i];break}case"public":case"no-store":case"must-revalidate":case"proxy-revalidate":case"immutable":case"no-transform":case"must-understand":case"only-if-cached":if(i)continue;t[A]=!0;break;default:continue}}return t},parseVaryHeader:function(e,t){if("string"==typeof e&&e.includes("*"))return t;const s={},r="string"==typeof e?e.split(","):e;for(const e of r){const r=e.trim().toLowerCase();s[r]=t[r]??null}return s},isEtagUsable:function(e){return!(e.length<=2)&&('"'===e[0]&&'"'===e[e.length-1]?!('"'===e[1]||e.startsWith('"W/')):!(!e.startsWith('W/"')||'"'!==e[e.length-1])&&4!==e.length)},assertCacheMethods:function(e,t="CacheMethods"){if(!Array.isArray(e))throw new TypeError(`expected type of ${t} needs to be an array, got ${null===e?"null":typeof e}`);if(0===e.length)throw new TypeError(`${t} needs to have at least one method`);for(const s of e)if(!r.includes(s))throw new TypeError(`element of ${t}-array needs to be one of following values: ${r.join(", ")}, got ${s}`)},assertCacheStore:function(e,t="CacheStore"){if("object"!=typeof e||null===e)throw new TypeError(`expected type of ${t} to be a CacheStore, got ${null===e?"null":typeof e}`);for(const s of["get","createWriteStream","delete"])if("function"!=typeof e[s])throw new TypeError(`${t} needs to have a \`${s}()\` function`)}}},8851:e=>{"use strict";e.exports={parseHttpDate:function(e){switch(e[3]){case",":return function(e){if(29!==e.length||" "!==e[4]||" "!==e[7]||" "!==e[11]||" "!==e[16]||":"!==e[19]||":"!==e[22]||" "!==e[25]||"G"!==e[26]||"M"!==e[27]||"T"!==e[28])return;let t=-1;if("S"===e[0]&&"u"===e[1]&&"n"===e[2])t=0;else if("M"===e[0]&&"o"===e[1]&&"n"===e[2])t=1;else if("T"===e[0]&&"u"===e[1]&&"e"===e[2])t=2;else if("W"===e[0]&&"e"===e[1]&&"d"===e[2])t=3;else if("T"===e[0]&&"h"===e[1]&&"u"===e[2])t=4;else if("F"===e[0]&&"r"===e[1]&&"i"===e[2])t=5;else{if("S"!==e[0]||"a"!==e[1]||"t"!==e[2])return;t=6}let s=0;if("0"===e[5]){const t=e.charCodeAt(6);if(t<49||t>57)return;s=t-48}else{const t=e.charCodeAt(5);if(t<49||t>51)return;const r=e.charCodeAt(6);if(r<48||r>57)return;s=10*(t-48)+(r-48)}let r=-1;if("J"===e[8]&&"a"===e[9]&&"n"===e[10])r=0;else if("F"===e[8]&&"e"===e[9]&&"b"===e[10])r=1;else if("M"===e[8]&&"a"===e[9])if("r"===e[10])r=2;else{if("y"!==e[10])return;r=4}else if("J"===e[8])if("a"===e[9]&&"n"===e[10])r=0;else{if("u"!==e[9])return;if("n"===e[10])r=5;else{if("l"!==e[10])return;r=6}}else if("A"===e[8])if("p"===e[9]&&"r"===e[10])r=3;else{if("u"!==e[9]||"g"!==e[10])return;r=7}else if("S"===e[8]&&"e"===e[9]&&"p"===e[10])r=8;else if("O"===e[8]&&"c"===e[9]&&"t"===e[10])r=9;else if("N"===e[8]&&"o"===e[9]&&"v"===e[10])r=10;else{if("D"!==e[8]||"e"!==e[9]||"c"!==e[10])return;r=11}const n=e.charCodeAt(12);if(n<48||n>57)return;const A=e.charCodeAt(13);if(A<48||A>57)return;const i=e.charCodeAt(14);if(i<48||i>57)return;const o=e.charCodeAt(15);if(o<48||o>57)return;const a=1e3*(n-48)+100*(A-48)+10*(i-48)+(o-48);let c=0;if("0"===e[17]){const t=e.charCodeAt(18);if(t<48||t>57)return;c=t-48}else{const t=e.charCodeAt(17);if(t<48||t>50)return;const s=e.charCodeAt(18);if(s<48||s>57)return;if(50===t&&s>51)return;c=10*(t-48)+(s-48)}let l=0;if("0"===e[20]){const t=e.charCodeAt(21);if(t<48||t>57)return;l=t-48}else{const t=e.charCodeAt(20);if(t<48||t>53)return;const s=e.charCodeAt(21);if(s<48||s>57)return;l=10*(t-48)+(s-48)}let h=0;if("0"===e[23]){const t=e.charCodeAt(24);if(t<48||t>57)return;h=t-48}else{const t=e.charCodeAt(23);if(t<48||t>53)return;const s=e.charCodeAt(24);if(s<48||s>57)return;h=10*(t-48)+(s-48)}const g=new Date(Date.UTC(a,r,s,c,l,h));return g.getUTCDay()===t?g:void 0}(e);case" ":return function(e){if(24!==e.length||" "!==e[7]||" "!==e[10]||" "!==e[19])return;let t=-1;if("S"===e[0]&&"u"===e[1]&&"n"===e[2])t=0;else if("M"===e[0]&&"o"===e[1]&&"n"===e[2])t=1;else if("T"===e[0]&&"u"===e[1]&&"e"===e[2])t=2;else if("W"===e[0]&&"e"===e[1]&&"d"===e[2])t=3;else if("T"===e[0]&&"h"===e[1]&&"u"===e[2])t=4;else if("F"===e[0]&&"r"===e[1]&&"i"===e[2])t=5;else{if("S"!==e[0]||"a"!==e[1]||"t"!==e[2])return;t=6}let s=-1;if("J"===e[4]&&"a"===e[5]&&"n"===e[6])s=0;else if("F"===e[4]&&"e"===e[5]&&"b"===e[6])s=1;else if("M"===e[4]&&"a"===e[5])if("r"===e[6])s=2;else{if("y"!==e[6])return;s=4}else if("J"===e[4])if("a"===e[5]&&"n"===e[6])s=0;else{if("u"!==e[5])return;if("n"===e[6])s=5;else{if("l"!==e[6])return;s=6}}else if("A"===e[4])if("p"===e[5]&&"r"===e[6])s=3;else{if("u"!==e[5]||"g"!==e[6])return;s=7}else if("S"===e[4]&&"e"===e[5]&&"p"===e[6])s=8;else if("O"===e[4]&&"c"===e[5]&&"t"===e[6])s=9;else if("N"===e[4]&&"o"===e[5]&&"v"===e[6])s=10;else{if("D"!==e[4]||"e"!==e[5]||"c"!==e[6])return;s=11}let r=0;if(" "===e[8]){const t=e.charCodeAt(9);if(t<49||t>57)return;r=t-48}else{const t=e.charCodeAt(8);if(t<49||t>51)return;const s=e.charCodeAt(9);if(s<48||s>57)return;r=10*(t-48)+(s-48)}let n=0;if("0"===e[11]){const t=e.charCodeAt(12);if(t<48||t>57)return;n=t-48}else{const t=e.charCodeAt(11);if(t<48||t>50)return;const s=e.charCodeAt(12);if(s<48||s>57)return;if(50===t&&s>51)return;n=10*(t-48)+(s-48)}let A=0;if("0"===e[14]){const t=e.charCodeAt(15);if(t<48||t>57)return;A=t-48}else{const t=e.charCodeAt(14);if(t<48||t>53)return;const s=e.charCodeAt(15);if(s<48||s>57)return;A=10*(t-48)+(s-48)}let i=0;if("0"===e[17]){const t=e.charCodeAt(18);if(t<48||t>57)return;i=t-48}else{const t=e.charCodeAt(17);if(t<48||t>53)return;const s=e.charCodeAt(18);if(s<48||s>57)return;i=10*(t-48)+(s-48)}const o=e.charCodeAt(20);if(o<48||o>57)return;const a=e.charCodeAt(21);if(a<48||a>57)return;const c=e.charCodeAt(22);if(c<48||c>57)return;const l=e.charCodeAt(23);if(l<48||l>57)return;const h=1e3*(o-48)+100*(a-48)+10*(c-48)+(l-48),g=new Date(Date.UTC(h,s,r,n,A,i));return g.getUTCDay()===t?g:void 0}(e);default:return function(e){let t=-1,s=-1;if("S"===e[0])"u"===e[1]&&"n"===e[2]&&"d"===e[3]&&"a"===e[4]&&"y"===e[5]?(s=0,t=6):"a"===e[1]&&"t"===e[2]&&"u"===e[3]&&"r"===e[4]&&"d"===e[5]&&"a"===e[6]&&"y"===e[7]&&(s=6,t=8);else if("M"===e[0]&&"o"===e[1]&&"n"===e[2]&&"d"===e[3]&&"a"===e[4]&&"y"===e[5])s=1,t=6;else if("T"===e[0])"u"===e[1]&&"e"===e[2]&&"s"===e[3]&&"d"===e[4]&&"a"===e[5]&&"y"===e[6]?(s=2,t=7):"h"===e[1]&&"u"===e[2]&&"r"===e[3]&&"s"===e[4]&&"d"===e[5]&&"a"===e[6]&&"y"===e[7]&&(s=4,t=8);else if("W"===e[0]&&"e"===e[1]&&"d"===e[2]&&"n"===e[3]&&"e"===e[4]&&"s"===e[5]&&"d"===e[6]&&"a"===e[7]&&"y"===e[8])s=3,t=9;else{if("F"!==e[0]||"r"!==e[1]||"i"!==e[2]||"d"!==e[3]||"a"!==e[4]||"y"!==e[5])return;s=5,t=6}if(","!==e[t]||e.length-t-1!=23||" "!==e[t+1]||"-"!==e[t+4]||"-"!==e[t+8]||" "!==e[t+11]||":"!==e[t+14]||":"!==e[t+17]||" "!==e[t+20]||"G"!==e[t+21]||"M"!==e[t+22]||"T"!==e[t+23])return;let r=0;if("0"===e[t+2]){const s=e.charCodeAt(t+3);if(s<49||s>57)return;r=s-48}else{const s=e.charCodeAt(t+2);if(s<49||s>51)return;const n=e.charCodeAt(t+3);if(n<48||n>57)return;r=10*(s-48)+(n-48)}let n=-1;if("J"===e[t+5]&&"a"===e[t+6]&&"n"===e[t+7])n=0;else if("F"===e[t+5]&&"e"===e[t+6]&&"b"===e[t+7])n=1;else if("M"===e[t+5]&&"a"===e[t+6]&&"r"===e[t+7])n=2;else if("A"===e[t+5]&&"p"===e[t+6]&&"r"===e[t+7])n=3;else if("M"===e[t+5]&&"a"===e[t+6]&&"y"===e[t+7])n=4;else if("J"===e[t+5]&&"u"===e[t+6]&&"n"===e[t+7])n=5;else if("J"===e[t+5]&&"u"===e[t+6]&&"l"===e[t+7])n=6;else if("A"===e[t+5]&&"u"===e[t+6]&&"g"===e[t+7])n=7;else if("S"===e[t+5]&&"e"===e[t+6]&&"p"===e[t+7])n=8;else if("O"===e[t+5]&&"c"===e[t+6]&&"t"===e[t+7])n=9;else if("N"===e[t+5]&&"o"===e[t+6]&&"v"===e[t+7])n=10;else{if("D"!==e[t+5]||"e"!==e[t+6]||"c"!==e[t+7])return;n=11}const A=e.charCodeAt(t+9);if(A<48||A>57)return;const i=e.charCodeAt(t+10);if(i<48||i>57)return;let o=10*(A-48)+(i-48);o+=o<70?2e3:1900;let a=0;if("0"===e[t+12]){const s=e.charCodeAt(t+13);if(s<48||s>57)return;a=s-48}else{const s=e.charCodeAt(t+12);if(s<48||s>50)return;const r=e.charCodeAt(t+13);if(r<48||r>57)return;if(50===s&&r>51)return;a=10*(s-48)+(r-48)}let c=0;if("0"===e[t+15]){const s=e.charCodeAt(t+16);if(s<48||s>57)return;c=s-48}else{const s=e.charCodeAt(t+15);if(s<48||s>53)return;const r=e.charCodeAt(t+16);if(r<48||r>57)return;c=10*(s-48)+(r-48)}let l=0;if("0"===e[t+18]){const s=e.charCodeAt(t+19);if(s<48||s>57)return;l=s-48}else{const s=e.charCodeAt(t+18);if(s<48||s>53)return;const r=e.charCodeAt(t+19);if(r<48||r>57)return;l=10*(s-48)+(r-48)}const h=new Date(Date.UTC(o,n,r,a,c,l));return h.getUTCDay()===s?h:void 0}(e)}}}},9250:e=>{"use strict";e.exports={createDeferredPromise:function(){let e,t;return{promise:new Promise(((s,r)=>{e=s,t=r})),resolve:e,reject:t}}}},4304:(e,t,s)=>{"use strict";const{kConnected:r,kPending:n,kRunning:A,kSize:i,kFree:o,kQueued:a}=s(257);e.exports={ClientStats:class{constructor(e){this.connected=e[r],this.pending=e[n],this.running=e[A],this.size=e[i]}},PoolStats:class{constructor(e){this.connected=e[r],this.free=e[o],this.pending=e[n],this.queued=e[a],this.running=e[A],this.size=e[i]}}}},3801:e=>{"use strict";let t=0;const s=1e3;let r;const n=Symbol("kFastTimer"),A=[];function i(){t+=499;let e=0,s=A.length;for(;e<s;){const r=A[e];0===r._state?(r._idleStart=t-499,r._state=1):1===r._state&&t>=r._idleStart+r._idleTimeout&&(r._state=-1,r._idleStart=-1,r._onTimeout(r._timerArg)),-1===r._state?(r._state=-2,0!=--s&&(A[e]=A[s])):++e}A.length=s,0!==A.length&&o()}function o(){r?.refresh?r.refresh():(clearTimeout(r),r=setTimeout(i,499),r?.unref())}class a{[n]=!0;_state=-2;_idleTimeout=-1;_idleStart=-1;_onTimeout;_timerArg;constructor(e,t,s){this._onTimeout=e,this._idleTimeout=t,this._timerArg=s,this.refresh()}refresh(){-2===this._state&&A.push(this),r&&1!==A.length||o(),this._state=0}clear(){this._state=-1,this._idleStart=-1}}e.exports={setTimeout:(e,t,r)=>t<=s?setTimeout(e,t,r):new a(e,t,r),clearTimeout(e){e[n]?e.clear():clearTimeout(e)},setFastTimeout:(e,t,s)=>new a(e,t,s),clearFastTimeout(e){e.clear()},now:()=>t,tick(e=0){t+=e-s+1,i(),i()},reset(){t=0,A.length=0,clearTimeout(r),r=null},kFastTimer:n}},4420:(e,t,s)=>{"use strict";const r=s(4589),{kConstruct:n}=s(257),{urlEquals:A,getFieldValues:i}=s(3932),{kEnumerableProperty:o,isDisturbed:a}=s(2858),{webidl:c}=s(6097),{cloneResponse:l,fromInnerResponse:h,getResponseState:g}=s(4821),{Request:d,fromInnerRequest:u,getRequestState:E}=s(4609),{fetching:I}=s(7388),{urlIsHttpHttpsScheme:C,readAllBytes:B}=s(6686),{createDeferredPromise:Q}=s(9250);class p{#Le;constructor(){arguments[0]!==n&&c.illegalConstructor(),c.util.markAsUncloneable(this),this.#Le=arguments[1]}async match(e,t={}){c.brandCheck(this,p);const s="Cache.match";c.argumentLengthCheck(arguments,1,s),e=c.converters.RequestInfo(e),t=c.converters.CacheQueryOptions(t,s,"options");const r=this.#He(e,t,1);if(0!==r.length)return r[0]}async matchAll(e=void 0,t={}){c.brandCheck(this,p);return void 0!==e&&(e=c.converters.RequestInfo(e)),t=c.converters.CacheQueryOptions(t,"Cache.matchAll","options"),this.#He(e,t)}async add(e){c.brandCheck(this,p);c.argumentLengthCheck(arguments,1,"Cache.add");const t=[e=c.converters.RequestInfo(e)],s=this.addAll(t);return await s}async addAll(e){c.brandCheck(this,p);const t="Cache.addAll";c.argumentLengthCheck(arguments,1,t);const s=[],r=[];for(let s of e){if(void 0===s)throw c.errors.conversionFailed({prefix:t,argument:"Argument 1",types:["undefined is not allowed"]});if(s=c.converters.RequestInfo(s),"string"==typeof s)continue;const e=E(s);if(!C(e.url)||"GET"!==e.method)throw c.errors.exception({header:t,message:"Expected http/s scheme when method is not GET."})}const n=[];for(const A of e){const e=E(new d(A));if(!C(e.url))throw c.errors.exception({header:t,message:"Expected http/s scheme."});e.initiator="fetch",e.destination="subresource",r.push(e);const o=Q();n.push(I({request:e,processResponse(e){if("error"===e.type||206===e.status||e.status<200||e.status>299)o.reject(c.errors.exception({header:"Cache.addAll",message:"Received an invalid status code or the request failed."}));else if(e.headersList.contains("vary")){const t=i(e.headersList.get("vary"));for(const e of t)if("*"===e){o.reject(c.errors.exception({header:"Cache.addAll",message:"invalid vary field value"}));for(const e of n)e.abort();return}}},processResponseEndOfBody(e){e.aborted?o.reject(new DOMException("aborted","AbortError")):o.resolve(e)}})),s.push(o.promise)}const A=Promise.all(s),o=await A,a=[];let l=0;for(const e of o){const t={type:"put",request:r[l],response:e};a.push(t),l++}const h=Q();let g=null;try{this.#Pe(a)}catch(e){g=e}return queueMicrotask((()=>{null===g?h.resolve(void 0):h.reject(g)})),h.promise}async put(e,t){c.brandCheck(this,p);const s="Cache.put";c.argumentLengthCheck(arguments,2,s),e=c.converters.RequestInfo(e),t=c.converters.Response(t,s,"response");let r=null;if(r=c.is.Request(e)?E(e):E(new d(e)),!C(r.url)||"GET"!==r.method)throw c.errors.exception({header:s,message:"Expected an http/s scheme when method is not GET"});const n=g(t);if(206===n.status)throw c.errors.exception({header:s,message:"Got 206 status"});if(n.headersList.contains("vary")){const e=i(n.headersList.get("vary"));for(const t of e)if("*"===t)throw c.errors.exception({header:s,message:"Got * vary field value"})}if(n.body&&(a(n.body.stream)||n.body.stream.locked))throw c.errors.exception({header:s,message:"Response body is locked or disturbed"});const A=l(n),o=Q();if(null!=n.body){const e=n.body.stream.getReader();B(e,o.resolve,o.reject)}else o.resolve(void 0);const h=[],u={type:"put",request:r,response:A};h.push(u);const I=await o.promise;null!=A.body&&(A.body.source=I);const f=Q();let m=null;try{this.#Pe(h)}catch(e){m=e}return queueMicrotask((()=>{null===m?f.resolve():f.reject(m)})),f.promise}async delete(e,t={}){c.brandCheck(this,p);const s="Cache.delete";c.argumentLengthCheck(arguments,1,s),e=c.converters.RequestInfo(e),t=c.converters.CacheQueryOptions(t,s,"options");let n=null;if(c.is.Request(e)){if(n=E(e),"GET"!==n.method&&!t.ignoreMethod)return!1}else r("string"==typeof e),n=E(new d(e));const A=[],i={type:"delete",request:n,options:t};A.push(i);const o=Q();let a,l=null;try{a=this.#Pe(A)}catch(e){l=e}return queueMicrotask((()=>{null===l?o.resolve(!!a?.length):o.reject(l)})),o.promise}async keys(e=void 0,t={}){c.brandCheck(this,p);void 0!==e&&(e=c.converters.RequestInfo(e)),t=c.converters.CacheQueryOptions(t,"Cache.keys","options");let s=null;if(void 0!==e)if(c.is.Request(e)){if(s=E(e),"GET"!==s.method&&!t.ignoreMethod)return[]}else"string"==typeof e&&(s=E(new d(e)));const r=Q(),n=[];if(void 0===e)for(const e of this.#Le)n.push(e[0]);else{const e=this.#xe(s,t);for(const t of e)n.push(t[0])}return queueMicrotask((()=>{const e=[];for(const t of n){const s=u(t,void 0,(new AbortController).signal,"immutable");e.push(s)}r.resolve(Object.freeze(e))})),r.promise}#Pe(e){const t=this.#Le,s=[...t],n=[],A=[];try{for(const s of e){if("delete"!==s.type&&"put"!==s.type)throw c.errors.exception({header:"Cache.#batchCacheOperations",message:'operation type does not match "delete" or "put"'});if("delete"===s.type&&null!=s.response)throw c.errors.exception({header:"Cache.#batchCacheOperations",message:"delete operation should not have an associated response"});if(this.#xe(s.request,s.options,n).length)throw new DOMException("???","InvalidStateError");let e;if("delete"===s.type){if(e=this.#xe(s.request,s.options),0===e.length)return[];for(const s of e){const e=t.indexOf(s);r(-1!==e),t.splice(e,1)}}else if("put"===s.type){if(null==s.response)throw c.errors.exception({header:"Cache.#batchCacheOperations",message:"put operation should have an associated response"});const A=s.request;if(!C(A.url))throw c.errors.exception({header:"Cache.#batchCacheOperations",message:"expected http or https scheme"});if("GET"!==A.method)throw c.errors.exception({header:"Cache.#batchCacheOperations",message:"not get method"});if(null!=s.options)throw c.errors.exception({header:"Cache.#batchCacheOperations",message:"options must not be defined"});e=this.#xe(s.request);for(const s of e){const e=t.indexOf(s);r(-1!==e),t.splice(e,1)}t.push([s.request,s.response]),n.push([s.request,s.response])}A.push([s.request,s.response])}return A}catch(e){throw this.#Le.length=0,this.#Le=s,e}}#xe(e,t,s){const r=[],n=s??this.#Le;for(const s of n){const[n,A]=s;this.#Ye(e,n,A,t)&&r.push(s)}return r}#Ye(e,t,s=null,r){const n=new URL(e.url),o=new URL(t.url);if(r?.ignoreSearch&&(o.search="",n.search=""),!A(n,o,!0))return!1;if(null==s||r?.ignoreVary||!s.headersList.contains("vary"))return!0;const a=i(s.headersList.get("vary"));for(const s of a){if("*"===s)return!1;if(t.headersList.get(s)!==e.headersList.get(s))return!1}return!0}#He(e,t,s=1/0){let r=null;if(void 0!==e)if(c.is.Request(e)){if(r=E(e),"GET"!==r.method&&!t.ignoreMethod)return[]}else"string"==typeof e&&(r=E(new d(e)));const n=[];if(void 0===e)for(const e of this.#Le)n.push(e[1]);else{const e=this.#xe(r,t);for(const t of e)n.push(t[1])}const A=[];for(const e of n){const t=h(e,"immutable");if(A.push(t.clone()),A.length>=s)break}return Object.freeze(A)}}Object.defineProperties(p.prototype,{[Symbol.toStringTag]:{value:"Cache",configurable:!0},match:o,matchAll:o,add:o,addAll:o,put:o,delete:o,keys:o});const f=[{key:"ignoreSearch",converter:c.converters.boolean,defaultValue:()=>!1},{key:"ignoreMethod",converter:c.converters.boolean,defaultValue:()=>!1},{key:"ignoreVary",converter:c.converters.boolean,defaultValue:()=>!1}];c.converters.CacheQueryOptions=c.dictionaryConverter(f),c.converters.MultiCacheQueryOptions=c.dictionaryConverter([...f,{key:"cacheName",converter:c.converters.DOMString}]),c.converters.Response=c.interfaceConverter(c.is.Response,"Response"),c.converters["sequence<RequestInfo>"]=c.sequenceConverter(c.converters.RequestInfo),e.exports={Cache:p}},6939:(e,t,s)=>{"use strict";const{Cache:r}=s(4420),{webidl:n}=s(6097),{kEnumerableProperty:A}=s(2858),{kConstruct:i}=s(257);class o{#Ve=new Map;constructor(){arguments[0]!==i&&n.illegalConstructor(),n.util.markAsUncloneable(this)}async match(e,t={}){if(n.brandCheck(this,o),n.argumentLengthCheck(arguments,1,"CacheStorage.match"),e=n.converters.RequestInfo(e),null!=(t=n.converters.MultiCacheQueryOptions(t)).cacheName){if(this.#Ve.has(t.cacheName)){const s=this.#Ve.get(t.cacheName),n=new r(i,s);return await n.match(e,t)}}else for(const s of this.#Ve.values()){const n=new r(i,s),A=await n.match(e,t);if(void 0!==A)return A}}async has(e){n.brandCheck(this,o);const t="CacheStorage.has";return n.argumentLengthCheck(arguments,1,t),e=n.converters.DOMString(e,t,"cacheName"),this.#Ve.has(e)}async open(e){n.brandCheck(this,o);const t="CacheStorage.open";if(n.argumentLengthCheck(arguments,1,t),e=n.converters.DOMString(e,t,"cacheName"),this.#Ve.has(e)){const t=this.#Ve.get(e);return new r(i,t)}const s=[];return this.#Ve.set(e,s),new r(i,s)}async delete(e){n.brandCheck(this,o);const t="CacheStorage.delete";return n.argumentLengthCheck(arguments,1,t),e=n.converters.DOMString(e,t,"cacheName"),this.#Ve.delete(e)}async keys(){n.brandCheck(this,o);return[...this.#Ve.keys()]}}Object.defineProperties(o.prototype,{[Symbol.toStringTag]:{value:"CacheStorage",configurable:!0},match:A,has:A,open:A,delete:A,keys:A}),e.exports={CacheStorage:o}},3932:(e,t,s)=>{"use strict";const r=s(4589),{URLSerializer:n}=s(9934),{isValidHeaderName:A}=s(6686);e.exports={urlEquals:function(e,t,s=!1){return n(e,s)===n(t,s)},getFieldValues:function(e){r(null!==e);const t=[];for(let s of e.split(","))s=s.trim(),A(s)&&t.push(s);return t}}},3042:e=>{"use strict";e.exports={maxAttributeValueSize:1024,maxNameValuePairSize:4096}},9391:(e,t,s)=>{"use strict";const{parseSetCookie:r}=s(6712),{stringify:n}=s(9871),{webidl:A}=s(6097),{Headers:i}=s(6558),o=A.brandCheckMultiple([i,globalThis.Headers].filter(Boolean));function a(e,t){A.argumentLengthCheck(arguments,2,"setCookie"),o(e),t=A.converters.Cookie(t);const s=n(t);s&&e.append("set-cookie",s,!0)}A.converters.DeleteCookieAttributes=A.dictionaryConverter([{converter:A.nullableConverter(A.converters.DOMString),key:"path",defaultValue:()=>null},{converter:A.nullableConverter(A.converters.DOMString),key:"domain",defaultValue:()=>null}]),A.converters.Cookie=A.dictionaryConverter([{converter:A.converters.DOMString,key:"name"},{converter:A.converters.DOMString,key:"value"},{converter:A.nullableConverter((e=>"number"==typeof e?A.converters["unsigned long long"](e):new Date(e))),key:"expires",defaultValue:()=>null},{converter:A.nullableConverter(A.converters["long long"]),key:"maxAge",defaultValue:()=>null},{converter:A.nullableConverter(A.converters.DOMString),key:"domain",defaultValue:()=>null},{converter:A.nullableConverter(A.converters.DOMString),key:"path",defaultValue:()=>null},{converter:A.nullableConverter(A.converters.boolean),key:"secure",defaultValue:()=>null},{converter:A.nullableConverter(A.converters.boolean),key:"httpOnly",defaultValue:()=>null},{converter:A.converters.USVString,key:"sameSite",allowedValues:["Strict","Lax","None"]},{converter:A.sequenceConverter(A.converters.DOMString),key:"unparsed",defaultValue:()=>[]}]),e.exports={getCookies:function(e){A.argumentLengthCheck(arguments,1,"getCookies"),o(e);const t=e.get("cookie"),s={};if(!t)return s;for(const e of t.split(";")){const[t,...r]=e.split("=");s[t.trim()]=r.join("=")}return s},deleteCookie:function(e,t,s){o(e);const r="deleteCookie";A.argumentLengthCheck(arguments,2,r),t=A.converters.DOMString(t,r,"name"),s=A.converters.DeleteCookieAttributes(s),a(e,{name:t,value:"",expires:new Date(0),...s})},getSetCookies:function(e){A.argumentLengthCheck(arguments,1,"getSetCookies"),o(e);const t=e.getSetCookie();return t?t.map((e=>r(e))):[]},setCookie:a,parseCookie:function(e){return e=A.converters.DOMString(e),r(e)}}},6712:(e,t,s)=>{"use strict";const{maxNameValuePairSize:r,maxAttributeValueSize:n}=s(3042),{isCTLExcludingHtab:A}=s(9871),{collectASequenceOfCodePointsFast:i}=s(9934),o=s(4589),{unescape:a}=s(1792);function c(e,t={}){if(0===e.length)return t;o(";"===e[0]);let s="";(e=e.slice(1)).includes(";")?(s=i(";",e,{position:0}),e=e.slice(s.length)):(s=e,e="");let r="",A="";if(s.includes("=")){const e={position:0};r=i("=",s,e),A=s.slice(e.position+1)}else r=s;if(r=r.trim(),A=A.trim(),A.length>n)return c(e,t);const a=r.toLowerCase();if("expires"===a){const e=new Date(A);t.expires=e}else if("max-age"===a){const s=A.charCodeAt(0);if((s<48||s>57)&&"-"!==A[0])return c(e,t);if(!/^\d+$/.test(A))return c(e,t);const r=Number(A);t.maxAge=r}else if("domain"===a){let e=A;"."===e[0]&&(e=e.slice(1)),e=e.toLowerCase(),t.domain=e}else if("path"===a){let e="";e=0===A.length||"/"!==A[0]?"/":A,t.path=e}else if("secure"===a)t.secure=!0;else if("httponly"===a)t.httpOnly=!0;else if("samesite"===a){let e="Default";const s=A.toLowerCase();s.includes("none")&&(e="None"),s.includes("strict")&&(e="Strict"),s.includes("lax")&&(e="Lax"),t.sameSite=e}else t.unparsed??=[],t.unparsed.push(`${r}=${A}`);return c(e,t)}e.exports={parseSetCookie:function(e){if(A(e))return null;let t="",s="",n="",o="";if(e.includes(";")){const r={position:0};t=i(";",e,r),s=e.slice(r.position)}else t=e;if(t.includes("=")){const e={position:0};n=i("=",t,e),o=t.slice(e.position+1)}else o=t;return n=n.trim(),o=o.trim(),n.length+o.length>r?null:{name:n,value:a(o),...c(s)}},parseUnparsedAttributes:c}},9871:e=>{"use strict";function t(e){for(let t=0;t<e.length;++t){const s=e.charCodeAt(t);if(s<33||s>126||34===s||40===s||41===s||60===s||62===s||64===s||44===s||59===s||58===s||92===s||47===s||91===s||93===s||63===s||61===s||123===s||125===s)throw new Error("Invalid cookie name")}}function s(e){let t=e.length,s=0;if('"'===e[0]){if(1===t||'"'!==e[t-1])throw new Error("Invalid cookie value");--t,++s}for(;s<t;){const t=e.charCodeAt(s++);if(t<33||t>126||34===t||44===t||59===t||92===t)throw new Error("Invalid cookie value")}}function r(e){for(let t=0;t<e.length;++t){const s=e.charCodeAt(t);if(s<32||127===s||59===s)throw new Error("Invalid cookie path")}}const n=["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],A=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],i=Array(61).fill(0).map(((e,t)=>t.toString().padStart(2,"0")));function o(e){return"number"==typeof e&&(e=new Date(e)),`${n[e.getUTCDay()]}, ${i[e.getUTCDate()]} ${A[e.getUTCMonth()]} ${e.getUTCFullYear()} ${i[e.getUTCHours()]}:${i[e.getUTCMinutes()]}:${i[e.getUTCSeconds()]} GMT`}e.exports={isCTLExcludingHtab:function(e){for(let t=0;t<e.length;++t){const s=e.charCodeAt(t);if(s>=0&&s<=8||s>=10&&s<=31||127===s)return!0}return!1},validateCookieName:t,validateCookiePath:r,validateCookieValue:s,toIMFDate:o,stringify:function(e){if(0===e.name.length)return null;t(e.name),s(e.value);const n=[`${e.name}=${e.value}`];e.name.startsWith("__Secure-")&&(e.secure=!0),e.name.startsWith("__Host-")&&(e.secure=!0,e.domain=null,e.path="/"),e.secure&&n.push("Secure"),e.httpOnly&&n.push("HttpOnly"),"number"==typeof e.maxAge&&(!function(e){if(e<0)throw new Error("Invalid cookie max-age")}(e.maxAge),n.push(`Max-Age=${e.maxAge}`)),e.domain&&(!function(e){if(e.startsWith("-")||e.endsWith(".")||e.endsWith("-"))throw new Error("Invalid cookie domain")}(e.domain),n.push(`Domain=${e.domain}`)),e.path&&(r(e.path),n.push(`Path=${e.path}`)),e.expires&&"Invalid Date"!==e.expires.toString()&&n.push(`Expires=${o(e.expires)}`),e.sameSite&&n.push(`SameSite=${e.sameSite}`);for(const t of e.unparsed){if(!t.includes("="))throw new Error("Invalid unparsed");const[e,...s]=t.split("=");n.push(`${e.trim()}=${s.join("=")}`)}return n.join("; ")}}},8813:(e,t,s)=>{"use strict";const{Transform:r}=s(7075),{isASCIINumber:n,isValidLastEventId:A}=s(4689),i=[239,187,191];e.exports={EventSourceStream:class extends r{state;checkBOM=!0;crlfCheck=!1;eventEndCheck=!1;buffer=null;pos=0;event={data:void 0,event:void 0,id:void 0,retry:void 0};constructor(e={}){e.readableObjectMode=!0,super(e),this.state=e.eventSourceSettings||{},e.push&&(this.push=e.push)}_transform(e,t,s){if(0!==e.length){if(this.buffer?this.buffer=Buffer.concat([this.buffer,e]):this.buffer=e,this.checkBOM)switch(this.buffer.length){case 1:return this.buffer[0]===i[0]||(this.checkBOM=!1),void s();case 2:if(this.buffer[0]===i[0]&&this.buffer[1]===i[1])return void s();this.checkBOM=!1;break;case 3:if(this.buffer[0]===i[0]&&this.buffer[1]===i[1]&&this.buffer[2]===i[2])return this.buffer=Buffer.alloc(0),this.checkBOM=!1,void s();this.checkBOM=!1;break;default:this.buffer[0]===i[0]&&this.buffer[1]===i[1]&&this.buffer[2]===i[2]&&(this.buffer=this.buffer.subarray(3)),this.checkBOM=!1}for(;this.pos<this.buffer.length;)if(this.eventEndCheck){if(this.crlfCheck){if(10===this.buffer[this.pos]){this.buffer=this.buffer.subarray(this.pos+1),this.pos=0,this.crlfCheck=!1;continue}this.crlfCheck=!1}if(10===this.buffer[this.pos]||13===this.buffer[this.pos]){13===this.buffer[this.pos]&&(this.crlfCheck=!0),this.buffer=this.buffer.subarray(this.pos+1),this.pos=0,(void 0!==this.event.data||this.event.event||void 0!==this.event.id||this.event.retry)&&this.processEvent(this.event),this.clearEvent();continue}this.eventEndCheck=!1}else 10!==this.buffer[this.pos]&&13!==this.buffer[this.pos]?this.pos++:(13===this.buffer[this.pos]&&(this.crlfCheck=!0),this.parseLine(this.buffer.subarray(0,this.pos),this.event),this.buffer=this.buffer.subarray(this.pos+1),this.pos=0,this.eventEndCheck=!0);s()}else s()}parseLine(e,t){if(0===e.length)return;const s=e.indexOf(58);if(0===s)return;let r="",i="";if(-1!==s){r=e.subarray(0,s).toString("utf8");let t=s+1;32===e[t]&&++t,i=e.subarray(t).toString("utf8")}else r=e.toString("utf8"),i="";switch(r){case"data":void 0===t[r]?t[r]=i:t[r]+=`\n${i}`;break;case"retry":n(i)&&(t[r]=i);break;case"id":A(i)&&(t[r]=i);break;case"event":i.length>0&&(t[r]=i)}}processEvent(e){e.retry&&n(e.retry)&&(this.state.reconnectionTime=parseInt(e.retry,10)),void 0!==e.id&&A(e.id)&&(this.state.lastEventId=e.id),void 0!==e.data&&this.push({type:e.event||"message",options:{data:e.data,lastEventId:this.state.lastEventId,origin:this.state.origin}})}clearEvent(){this.event={data:void 0,event:void 0,id:void 0,retry:void 0}}}}},7928:(e,t,s)=>{"use strict";const{pipeline:r}=s(7075),{fetching:n}=s(7388),{makeRequest:A}=s(4609),{webidl:i}=s(6097),{EventSourceStream:o}=s(8813),{parseMIMEType:a}=s(9934),{createFastMessageEvent:c}=s(878),{isNetworkError:l}=s(4821),{kEnumerableProperty:h}=s(2858),{environmentSettingsObject:g}=s(6686);let d=!1;class u extends EventTarget{#Oe={open:null,error:null,message:null};#Ge;#Je=!1;#We=0;#_e=null;#$=null;#qe;#le;constructor(e,t={}){super(),i.util.markAsUncloneable(this);const s="EventSource constructor";i.argumentLengthCheck(arguments,1,s),d||(d=!0,process.emitWarning("EventSource is experimental, expect them to change at any time.",{code:"UNDICI-ES"})),e=i.converters.USVString(e),t=i.converters.EventSourceInitDict(t,s,"eventSourceInitDict"),this.#qe=t.node.dispatcher||t.dispatcher,this.#le={lastEventId:"",reconnectionTime:t.node.reconnectionTime};const r=g;let n;try{n=new URL(e,r.settingsObject.baseUrl),this.#le.origin=n.origin}catch(e){throw new DOMException(e,"SyntaxError")}this.#Ge=n.href;let o="anonymous";!0===t.withCredentials&&(o="use-credentials",this.#Je=!0);const a={redirect:"follow",keepalive:!0,mode:"cors",credentials:"anonymous"===o?"same-origin":"omit",referrer:"no-referrer"};a.client=g.settingsObject,a.headersList=[["accept",{name:"accept",value:"text/event-stream"}]],a.cache="no-store",a.initiator="other",a.urlList=[new URL(this.#Ge)],this.#_e=A(a),this.#$e()}get readyState(){return this.#We}get url(){return this.#Ge}get withCredentials(){return this.#Je}#$e(){if(2===this.#We)return;this.#We=0;const e={request:this.#_e,dispatcher:this.#qe};e.processResponseEndOfBody=e=>{if(!l(e))return this.#ze()},e.processResponse=e=>{if(l(e))return e.aborted?(this.close(),void this.dispatchEvent(new Event("error"))):void this.#ze();const t=e.headersList.get("content-type",!0),s=null!==t?a(t):"failure",n="failure"!==s&&"text/event-stream"===s.essence;if(200!==e.status||!1===n)return this.close(),void this.dispatchEvent(new Event("error"));this.#We=1,this.dispatchEvent(new Event("open")),this.#le.origin=e.urlList[e.urlList.length-1].origin;const A=new o({eventSourceSettings:this.#le,push:e=>{this.dispatchEvent(c(e.type,e.options))}});r(e.body.stream,A,(e=>{!1===e?.aborted&&(this.close(),this.dispatchEvent(new Event("error")))}))},this.#$=n(e)}#ze(){2!==this.#We&&(this.#We=0,this.dispatchEvent(new Event("error")),setTimeout((()=>{0===this.#We&&(this.#le.lastEventId.length&&this.#_e.headersList.set("last-event-id",this.#le.lastEventId,!0),this.#$e())}),this.#le.reconnectionTime)?.unref())}close(){i.brandCheck(this,u),2!==this.#We&&(this.#We=2,this.#$.abort(),this.#_e=null)}get onopen(){return this.#Oe.open}set onopen(e){this.#Oe.open&&this.removeEventListener("open",this.#Oe.open);const t=i.converters.EventHandlerNonNull(e);null!==t?(this.addEventListener("open",t),this.#Oe.open=e):this.#Oe.open=null}get onmessage(){return this.#Oe.message}set onmessage(e){this.#Oe.message&&this.removeEventListener("message",this.#Oe.message);const t=i.converters.EventHandlerNonNull(e);null!==t?(this.addEventListener("message",t),this.#Oe.message=e):this.#Oe.message=null}get onerror(){return this.#Oe.error}set onerror(e){this.#Oe.error&&this.removeEventListener("error",this.#Oe.error);const t=i.converters.EventHandlerNonNull(e);null!==t?(this.addEventListener("error",t),this.#Oe.error=e):this.#Oe.error=null}}const E={CONNECTING:{__proto__:null,configurable:!1,enumerable:!0,value:0,writable:!1},OPEN:{__proto__:null,configurable:!1,enumerable:!0,value:1,writable:!1},CLOSED:{__proto__:null,configurable:!1,enumerable:!0,value:2,writable:!1}};Object.defineProperties(u,E),Object.defineProperties(u.prototype,E),Object.defineProperties(u.prototype,{close:h,onerror:h,onmessage:h,onopen:h,readyState:h,url:h,withCredentials:h}),i.converters.EventSourceInitDict=i.dictionaryConverter([{key:"withCredentials",converter:i.converters.boolean,defaultValue:()=>!1},{key:"dispatcher",converter:i.converters.any},{key:"node",converter:i.dictionaryConverter([{key:"reconnectionTime",converter:i.converters["unsigned long"],defaultValue:()=>3e3},{key:"dispatcher",converter:i.converters.any}]),defaultValue:()=>({})}]),e.exports={EventSource:u,defaultReconnectionTime:3e3}},4689:e=>{"use strict";e.exports={isValidLastEventId:function(e){return-1===e.indexOf("\0")},isASCIINumber:function(e){if(0===e.length)return!1;for(let t=0;t<e.length;t++)if(e.charCodeAt(t)<48||e.charCodeAt(t)>57)return!1;return!0}}},2530:(e,t,s)=>{"use strict";const r=s(2858),{ReadableStreamFrom:n,readableStreamClose:A,fullyReadBody:i,extractMimeType:o,utf8DecodeBytes:a}=s(6686),{FormData:c,setFormDataState:l}=s(3944),{webidl:h}=s(6097),g=s(4589),{isErrored:d,isDisturbed:u}=s(7075),{isArrayBuffer:E}=s(3429),{serializeAMimeType:I}=s(9934),{multipartFormDataParser:C}=s(4614),{createDeferredPromise:B}=s(9250);let Q;try{const e=s(7598);Q=t=>e.randomInt(0,t)}catch{Q=e=>Math.floor(Math.random()*e)}const p=new TextEncoder;function f(){}const m=new FinalizationRegistry((e=>{const t=e.deref();!t||t.locked||u(t)||d(t)||t.cancel("Response object has been garbage collected").catch(f)}));function y(e,t=!1){let s=null;s=h.is.ReadableStream(e)?e:h.is.Blob(e)?e.stream():new ReadableStream({pull(e){const t="string"==typeof o?p.encode(o):o;t.byteLength&&e.enqueue(t),queueMicrotask((()=>A(e)))},start(){},type:"bytes"}),g(h.is.ReadableStream(s));let i=null,o=null,a=null,c=null;if("string"==typeof e)o=e,c="text/plain;charset=UTF-8";else if(h.is.URLSearchParams(e))o=e.toString(),c="application/x-www-form-urlencoded;charset=UTF-8";else if(h.is.BufferSource(e))o=E(e)?new Uint8Array(e.slice()):new Uint8Array(e.buffer.slice(e.byteOffset,e.byteOffset+e.byteLength));else if(h.is.FormData(e)){const t=`----formdata-undici-0${`${Q(1e11)}`.padStart(11,"0")}`,s=`--${t}\r\nContent-Disposition: form-data`,r=e=>e.replace(/\n/g,"%0A").replace(/\r/g,"%0D").replace(/"/g,"%22"),n=e=>e.replace(/\r?\n|\r/g,"\r\n"),A=[],l=new Uint8Array([13,10]);a=0;let h=!1;for(const[t,i]of e)if("string"==typeof i){const e=p.encode(s+`; name="${r(n(t))}"`+`\r\n\r\n${n(i)}\r\n`);A.push(e),a+=e.byteLength}else{const e=p.encode(`${s}; name="${r(n(t))}"`+(i.name?`; filename="${r(i.name)}"`:"")+"\r\n"+`Content-Type: ${i.type||"application/octet-stream"}\r\n\r\n`);A.push(e,i,l),"number"==typeof i.size?a+=e.byteLength+i.size+l.byteLength:h=!0}const g=p.encode(`--${t}--\r\n`);A.push(g),a+=g.byteLength,h&&(a=null),o=e,i=async function*(){for(const e of A)e.stream?yield*e.stream():yield e},c=`multipart/form-data; boundary=${t}`}else if(h.is.Blob(e))o=e,a=e.size,e.type&&(c=e.type);else if("function"==typeof e[Symbol.asyncIterator]){if(t)throw new TypeError("keepalive");if(r.isDisturbed(e)||e.locked)throw new TypeError("Response body object should not be disturbed or locked");s=h.is.ReadableStream(e)?e:n(e)}if(("string"==typeof o||r.isBuffer(o))&&(a=Buffer.byteLength(o)),null!=i){let t;s=new ReadableStream({async start(){t=i(e)[Symbol.asyncIterator]()},async pull(e){const{value:r,done:n}=await t.next();if(n)queueMicrotask((()=>{e.close(),e.byobRequest?.respond(0)}));else if(!d(s)){const t=new Uint8Array(r);t.byteLength&&e.enqueue(t)}return e.desiredSize>0},async cancel(e){await t.return()},type:"bytes"})}return[{stream:s,source:o,length:a},c]}function w(e,t,s,r){try{h.brandCheck(e,s)}catch(e){return Promise.reject(e)}const n=r(e);if(S(n))return Promise.reject(new TypeError("Body is unusable: Body has already been read"));if(n.aborted)return Promise.reject(new DOMException("The operation was aborted.","AbortError"));const A=B(),o=A.reject,a=e=>{try{A.resolve(t(e))}catch(e){o(e)}};return null==n.body?(a(Buffer.allocUnsafe(0)),A.promise):(i(n.body,a,o),A.promise)}function S(e){const t=e.body;return null!=t&&(t.stream.locked||r.isDisturbed(t.stream))}function D(e){return JSON.parse(a(e))}function b(e){const t=e.headersList,s=o(t);return"failure"===s?null:s}e.exports={extractBody:y,safelyExtractBody:function(e,t=!1){return h.is.ReadableStream(e)&&(g(!r.isDisturbed(e),"The body has already been consumed."),g(!e.locked,"The stream is locked.")),y(e,t)},cloneBody:function(e){const{0:t,1:s}=e.stream.tee();return e.stream=t,{stream:s,length:e.length,source:e.source}},mixinBody:function(e,t){Object.assign(e.prototype,function(e,t){return{blob(){return w(this,(e=>{let s=b(t(this));return null===s?s="":s&&(s=I(s)),new Blob([e],{type:s})}),e,t)},arrayBuffer(){return w(this,(e=>new Uint8Array(e).buffer),e,t)},text(){return w(this,a,e,t)},json(){return w(this,D,e,t)},formData(){return w(this,(e=>{const s=b(t(this));if(null!==s)switch(s.essence){case"multipart/form-data":{const t=C(e,s),r=new c;return l(r,t),r}case"application/x-www-form-urlencoded":{const t=new URLSearchParams(e.toString()),s=new c;for(const[e,r]of t)s.append(e,r);return s}}throw new TypeError('Content-Type was not one of "multipart/form-data" or "application/x-www-form-urlencoded".')}),e,t)},bytes(){return w(this,(e=>new Uint8Array(e)),e,t)}}}(e,t))},streamRegistry:m,bodyUnusable:S}},9441:e=>{"use strict";const t=["GET","HEAD","POST"],s=new Set(t),r=[301,302,303,307,308],n=new Set(r),A=["1","7","9","11","13","15","17","19","20","21","22","23","25","37","42","43","53","69","77","79","87","95","101","102","103","104","109","110","111","113","115","117","119","123","135","137","139","143","161","179","389","427","465","512","513","514","515","526","530","531","532","540","548","554","556","563","587","601","636","989","990","993","995","1719","1720","1723","2049","3659","4045","4190","5060","5061","6000","6566","6665","6666","6667","6668","6669","6679","6697","10080"],i=new Set(A),o=["no-referrer","no-referrer-when-downgrade","same-origin","origin","strict-origin","origin-when-cross-origin","strict-origin-when-cross-origin","unsafe-url"],a=["",...o],c=new Set(o),l=["GET","HEAD","OPTIONS","TRACE"],h=new Set(l),g=["CONNECT","TRACE","TRACK"],d=new Set(g),u=["audio","audioworklet","font","image","manifest","paintworklet","script","style","track","video","xslt",""],E=new Set(u);e.exports={subresource:u,forbiddenMethods:g,requestBodyHeader:["content-encoding","content-language","content-location","content-type","content-length"],referrerPolicy:a,requestRedirect:["follow","manual","error"],requestMode:["navigate","same-origin","no-cors","cors"],requestCredentials:["omit","same-origin","include"],requestCache:["default","no-store","reload","no-cache","force-cache","only-if-cached"],redirectStatus:r,corsSafeListedMethods:t,nullBodyStatus:[101,204,205,304],safeMethods:l,badPorts:A,requestDuplex:["half"],subresourceSet:E,badPortsSet:i,redirectStatusSet:n,corsSafeListedMethodsSet:s,safeMethodsSet:h,forbiddenMethodsSet:d,referrerPolicyTokens:c}},9934:(e,t,s)=>{"use strict";const r=s(4589),n=new TextEncoder,A=/^[!#$%&'*+\-.^_|~A-Za-z0-9]+$/,i=/[\u000A\u000D\u0009\u0020]/,o=/[\u0009\u000A\u000C\u000D\u0020]/g,a=/^[\u0009\u0020-\u007E\u0080-\u00FF]+$/;function c(e,t=!1){if(!t)return e.href;const s=e.href,r=e.hash.length,n=0===r?s:s.substring(0,s.length-r);return!r&&s.endsWith("#")?n.slice(0,-1):n}function l(e,t,s){let r="";for(;s.position<t.length&&e(t[s.position]);)r+=t[s.position],s.position++;return r}function h(e,t,s){const r=t.indexOf(e,s.position),n=s.position;return-1===r?(s.position=t.length,t.slice(n)):(s.position=r,t.slice(n,s.position))}function g(e){return function(e){const t=e.length,s=new Uint8Array(t);let r=0;for(let n=0;n<t;++n){const t=e[n];37!==t?s[r++]=t:37!==t||d(e[n+1])&&d(e[n+2])?(s[r++]=u(e[n+1])<<4|u(e[n+2]),n+=2):s[r++]=37}return t===r?s:s.subarray(0,r)}(n.encode(e))}function d(e){return e>=48&&e<=57||e>=65&&e<=70||e>=97&&e<=102}function u(e){return e>=48&&e<=57?e-48:(223&e)-55}function E(e){const t={position:0},s=h("/",e=B(e,!0,!0),t);if(0===s.length||!A.test(s))return"failure";if(t.position>=e.length)return"failure";t.position++;let r=h(";",e,t);if(r=B(r,!1,!0),0===r.length||!A.test(r))return"failure";const n=s.toLowerCase(),o=r.toLowerCase(),c={type:n,subtype:o,parameters:new Map,essence:`${n}/${o}`};for(;t.position<e.length;){t.position++,l((e=>i.test(e)),e,t);let s=l((e=>";"!==e&&"="!==e),e,t);if(s=s.toLowerCase(),t.position<e.length){if(";"===e[t.position])continue;t.position++}if(t.position>=e.length)break;let r=null;if('"'===e[t.position])r=I(e,t,!0),h(";",e,t);else if(r=h(";",e,t),r=B(r,!1,!0),0===r.length)continue;0===s.length||!A.test(s)||0!==r.length&&!a.test(r)||c.parameters.has(s)||c.parameters.set(s,r)}return c}function I(e,t,s=!1){const n=t.position;let A="";for(r('"'===e[t.position]),t.position++;A+=l((e=>'"'!==e&&"\\"!==e),e,t),!(t.position>=e.length);){const s=e[t.position];if(t.position++,"\\"!==s){r('"'===s);break}if(t.position>=e.length){A+="\\";break}A+=e[t.position],t.position++}return s?A:e.slice(n,t.position)}function C(e){return 13===e||10===e||9===e||32===e}function B(e,t=!0,s=!0){return p(e,t,s,C)}function Q(e){return 13===e||10===e||9===e||12===e||32===e}function p(e,t,s,r){let n=0,A=e.length-1;if(t)for(;n<e.length&&r(e.charCodeAt(n));)n++;if(s)for(;A>0&&r(e.charCodeAt(A));)A--;return 0===n&&A===e.length-1?e:e.slice(n,A+1)}function f(e){const t=e.length;if(65535>t)return String.fromCharCode.apply(null,e);let s="",r=0,n=65535;for(;r<t;)r+n>t&&(n=t-r),s+=String.fromCharCode.apply(null,e.subarray(r,r+=n));return s}e.exports={dataURLProcessor:function(e){r("data:"===e.protocol);let t=c(e,!0);t=t.slice(5);const s={position:0};let n=h(",",t,s);const A=n.length;if(n=function(e,t=!0,s=!0){return p(e,t,s,Q)}(n,!0,!0),s.position>=t.length)return"failure";s.position++;let i=g(t.slice(A+1));if(/;(\u0020){0,}base64$/i.test(n)){if(i=function(e){let t=(e=e.replace(o,"")).length;t%4==0&&61===e.charCodeAt(t-1)&&(--t,61===e.charCodeAt(t-1)&&--t);if(t%4==1)return"failure";if(/[^+/0-9A-Za-z]/.test(e.length===t?e:e.substring(0,t)))return"failure";const s=Buffer.from(e,"base64");return new Uint8Array(s.buffer,s.byteOffset,s.byteLength)}(f(i)),"failure"===i)return"failure";n=n.slice(0,-6),n=n.replace(/(\u0020)+$/,""),n=n.slice(0,-1)}n.startsWith(";")&&(n="text/plain"+n);let a=E(n);return"failure"===a&&(a=E("text/plain;charset=US-ASCII")),{mimeType:a,body:i}},URLSerializer:c,collectASequenceOfCodePoints:l,collectASequenceOfCodePointsFast:h,stringPercentDecode:g,parseMIMEType:E,collectAnHTTPQuotedString:I,serializeAMimeType:function(e){r("failure"!==e);const{parameters:t,essence:s}=e;let n=s;for(let[e,s]of t.entries())n+=";",n+=e,n+="=",A.test(s)||(s=s.replace(/(\\|")/g,"\\$1"),s='"'+s,s+='"'),n+=s;return n},removeChars:p,removeHTTPWhitespace:B,minimizeSupportedMimeType:function(e){switch(e.essence){case"application/ecmascript":case"application/javascript":case"application/x-ecmascript":case"application/x-javascript":case"text/ecmascript":case"text/javascript":case"text/javascript1.0":case"text/javascript1.1":case"text/javascript1.2":case"text/javascript1.3":case"text/javascript1.4":case"text/javascript1.5":case"text/jscript":case"text/livescript":case"text/x-ecmascript":case"text/x-javascript":return"text/javascript";case"application/json":case"text/json":return"application/json";case"image/svg+xml":return"image/svg+xml";case"text/xml":case"application/xml":return"application/xml"}return e.subtype.endsWith("+json")?"application/json":e.subtype.endsWith("+xml")?"application/xml":""},HTTP_TOKEN_CODEPOINTS:A,isomorphicDecode:f}},4614:(e,t,s)=>{"use strict";const{bufferToLowerCasedHeaderName:r}=s(2858),{utf8DecodeBytes:n}=s(6686),{HTTP_TOKEN_CODEPOINTS:A,isomorphicDecode:i}=s(9934),{makeEntry:o}=s(3944),{webidl:a}=s(6097),c=s(4589),l=Buffer.from('form-data; name="'),h=Buffer.from("filename"),g=Buffer.from("--"),d=Buffer.from("--\r\n");function u(e){for(let t=0;t<e.length;++t)if(-128&e.charCodeAt(t))return!1;return!0}function E(e,t){let s=null,n=null,o=null,a=null;for(;;){if(13===e[t.position]&&10===e[t.position+1]){if(null===s)throw p("header name is null");return{name:s,filename:n,contentType:o,encoding:a}}let c=C((e=>10!==e&&13!==e&&58!==e),e,t);if(c=B(c,!0,!0,(e=>9===e||32===e)),!A.test(c.toString()))throw p("header name does not match the field-name token production");if(58!==e[t.position])throw p("expected :");switch(t.position++,C((e=>32===e||9===e),e,t),r(c)){case"content-disposition":if(s=n=null,!Q(e,l,t))throw p('expected form-data; name=" for content-disposition header');if(t.position+=17,s=I(e,t),59===e[t.position]&&32===e[t.position+1]){const s={position:t.position+2};if(Q(e,h,s))if(42===e[s.position+8]){s.position+=10,C((e=>32===e||9===e),e,s);const r=C((e=>32!==e&&13!==e&&10!==e),e,s);if(117!==r[0]&&85!==r[0]||116!==r[1]&&84!==r[1]||102!==r[2]&&70!==r[2]||45!==r[3]||56!==r[4])throw p("unknown encoding, expected utf-8''");n=decodeURIComponent((new TextDecoder).decode(r.subarray(7))),t.position=s.position}else t.position+=11,C((e=>32===e||9===e),e,t),t.position++,n=I(e,t)}break;case"content-type":{let s=C((e=>10!==e&&13!==e),e,t);s=B(s,!1,!0,(e=>9===e||32===e)),o=i(s);break}case"content-transfer-encoding":{let s=C((e=>10!==e&&13!==e),e,t);s=B(s,!1,!0,(e=>9===e||32===e)),a=i(s);break}default:C((e=>10!==e&&13!==e),e,t)}if(13!==e[t.position]&&10!==e[t.position+1])throw p("expected CRLF");t.position+=2}}function I(e,t){c(34===e[t.position-1]);let s=C((e=>10!==e&&13!==e&&34!==e),e,t);if(34!==e[t.position])throw p('expected "');return t.position++,s=(new TextDecoder).decode(s).replace(/%0A/gi,"\n").replace(/%0D/gi,"\r").replace(/%22/g,'"'),s}function C(e,t,s){let r=s.position;for(;r<t.length&&e(t[r]);)++r;return t.subarray(s.position,s.position=r)}function B(e,t,s,r){let n=0,A=e.length-1;if(t)for(;n<e.length&&r(e[n]);)n++;if(s)for(;A>0&&r(e[A]);)A--;return 0===n&&A===e.length-1?e:e.subarray(n,A+1)}function Q(e,t,s){if(e.length<t.length)return!1;for(let r=0;r<t.length;r++)if(t[r]!==e[s.position+r])return!1;return!0}function p(e){return new TypeError("Failed to parse body as FormData.",{cause:new TypeError(e)})}e.exports={multipartFormDataParser:function(e,t){c("failure"!==t&&"multipart/form-data"===t.essence);const s=t.parameters.get("boundary");if(void 0===s)throw p("missing boundary in content-type header");const r=Buffer.from(`--${s}`,"utf8"),A=[],i={position:0};for(;13===e[i.position]&&10===e[i.position+1];)i.position+=2;let l=e.length;for(;10===e[l-1]&&13===e[l-2];)l-=2;for(l!==e.length&&(e=e.subarray(0,l));;){if(!e.subarray(i.position,i.position+r.length).equals(r))throw p("expected a value starting with -- and the boundary");if(i.position+=r.length,i.position===e.length-2&&Q(e,g,i)||i.position===e.length-4&&Q(e,d,i))return A;if(13!==e[i.position]||10!==e[i.position+1])throw p("expected CRLF");i.position+=2;const t=E(e,i);let s,l,{name:h,filename:I,contentType:C,encoding:B}=t;i.position+=2;{const t=e.indexOf(r.subarray(2),i.position);if(-1===t)throw p("expected boundary after body");s=e.subarray(i.position,t-4),i.position+=s.length,"base64"===B&&(s=Buffer.from(s.toString(),"base64"))}if(13!==e[i.position]||10!==e[i.position+1])throw p("expected CRLF");i.position+=2,null!==I?(C??="text/plain",u(C)||(C=""),l=new File([s],I,{type:C})):l=n(Buffer.from(s)),c(a.is.USVString(h)),c("string"==typeof l&&a.is.USVString(l)||a.is.File(l)),A.push(o(h,l,I))}},validateBoundary:function(e){const t=e.length;if(t<27||t>70)return!1;for(let s=0;s<t;++s){const t=e.charCodeAt(s);if(!(t>=48&&t<=57||t>=65&&t<=90||t>=97&&t<=122||39===t||45===t||95===t))return!1}return!0}}},3944:(e,t,s)=>{"use strict";const{iteratorMixin:r}=s(6686),{kEnumerableProperty:n}=s(2858),{webidl:A}=s(6097),i=s(7975);class o{#le=[];constructor(e=void 0){if(A.util.markAsUncloneable(this),void 0!==e)throw A.errors.conversionFailed({prefix:"FormData constructor",argument:"Argument 1",types:["undefined"]})}append(e,t,s=void 0){A.brandCheck(this,o);const r="FormData.append";A.argumentLengthCheck(arguments,2,r),e=A.converters.USVString(e),3===arguments.length||A.is.Blob(t)?(t=A.converters.Blob(t,r,"value"),void 0!==s&&(s=A.converters.USVString(s))):t=A.converters.USVString(t);const n=l(e,t,s);this.#le.push(n)}delete(e){A.brandCheck(this,o);A.argumentLengthCheck(arguments,1,"FormData.delete"),e=A.converters.USVString(e),this.#le=this.#le.filter((t=>t.name!==e))}get(e){A.brandCheck(this,o);A.argumentLengthCheck(arguments,1,"FormData.get"),e=A.converters.USVString(e);const t=this.#le.findIndex((t=>t.name===e));return-1===t?null:this.#le[t].value}getAll(e){A.brandCheck(this,o);return A.argumentLengthCheck(arguments,1,"FormData.getAll"),e=A.converters.USVString(e),this.#le.filter((t=>t.name===e)).map((e=>e.value))}has(e){A.brandCheck(this,o);return A.argumentLengthCheck(arguments,1,"FormData.has"),e=A.converters.USVString(e),-1!==this.#le.findIndex((t=>t.name===e))}set(e,t,s=void 0){A.brandCheck(this,o);const r="FormData.set";A.argumentLengthCheck(arguments,2,r),e=A.converters.USVString(e),3===arguments.length||A.is.Blob(t)?(t=A.converters.Blob(t,r,"value"),void 0!==s&&(s=A.converters.USVString(s))):t=A.converters.USVString(t);const n=l(e,t,s),i=this.#le.findIndex((t=>t.name===e));-1!==i?this.#le=[...this.#le.slice(0,i),n,...this.#le.slice(i+1).filter((t=>t.name!==e))]:this.#le.push(n)}[i.inspect.custom](e,t){const s=this.#le.reduce(((e,t)=>(e[t.name]?Array.isArray(e[t.name])?e[t.name].push(t.value):e[t.name]=[e[t.name],t.value]:e[t.name]=t.value,e)),{__proto__:null});t.depth??=e,t.colors??=!0;const r=i.formatWithOptions(t,s);return`FormData ${r.slice(r.indexOf("]")+2)}`}static getFormDataState(e){return e.#le}static setFormDataState(e,t){e.#le=t}}const{getFormDataState:a,setFormDataState:c}=o;function l(e,t,s){if("string"==typeof t);else if(A.is.File(t)||(t=new File([t],"blob",{type:t.type})),void 0!==s){const e={type:t.type,lastModified:t.lastModified};t=new File([t],s,e)}return{name:e,value:t}}Reflect.deleteProperty(o,"getFormDataState"),Reflect.deleteProperty(o,"setFormDataState"),r("FormData",o,a,"name","value"),Object.defineProperties(o.prototype,{append:n,delete:n,get:n,getAll:n,has:n,set:n,[Symbol.toStringTag]:{value:"FormData",configurable:!0}}),A.is.FormData=A.util.MakeTypeAssertion(o),e.exports={FormData:o,makeEntry:l,setFormDataState:c}},2837:e=>{"use strict";const t=Symbol.for("undici.globalOrigin.1");e.exports={getGlobalOrigin:function(){return globalThis[t]},setGlobalOrigin:function(e){if(void 0===e)return void Object.defineProperty(globalThis,t,{value:void 0,writable:!0,enumerable:!1,configurable:!1});const s=new URL(e);if("http:"!==s.protocol&&"https:"!==s.protocol)throw new TypeError(`Only http & https urls are allowed, received ${s.protocol}`);Object.defineProperty(globalThis,t,{value:s,writable:!0,enumerable:!1,configurable:!1})}}},6558:(e,t,s)=>{"use strict";const{kConstruct:r}=s(257),{kEnumerableProperty:n}=s(2858),{iteratorMixin:A,isValidHeaderName:i,isValidHeaderValue:o}=s(6686),{webidl:a}=s(6097),c=s(4589),l=s(7975);function h(e){return 10===e||13===e||9===e||32===e}function g(e){let t=0,s=e.length;for(;s>t&&h(e.charCodeAt(s-1));)--s;for(;s>t&&h(e.charCodeAt(t));)++t;return 0===t&&s===e.length?e:e.substring(t,s)}function d(e,t){if(Array.isArray(t))for(let s=0;s<t.length;++s){const r=t[s];if(2!==r.length)throw a.errors.exception({header:"Headers constructor",message:`expected name/value pair to be length 2, found ${r.length}.`});u(e,r[0],r[1])}else{if("object"!=typeof t||null===t)throw a.errors.conversionFailed({prefix:"Headers constructor",argument:"Argument 1",types:["sequence<sequence<ByteString>>","record<ByteString, ByteString>"]});{const s=Object.keys(t);for(let r=0;r<s.length;++r)u(e,s[r],t[s[r]])}}}function u(e,t,s){if(s=g(s),!i(t))throw a.errors.invalidArgument({prefix:"Headers.append",value:t,type:"header name"});if(!o(s))throw a.errors.invalidArgument({prefix:"Headers.append",value:s,type:"header value"});if("immutable"===B(e))throw new TypeError("immutable");return p(e).append(t,s,!1)}function E(e,t){return e[0]<t[0]?-1:1}class I{cookies=null;sortedMap;headersMap;constructor(e){e instanceof I?(this.headersMap=new Map(e.headersMap),this.sortedMap=e.sortedMap,this.cookies=null===e.cookies?null:[...e.cookies]):(this.headersMap=new Map(e),this.sortedMap=null)}contains(e,t){return this.headersMap.has(t?e:e.toLowerCase())}clear(){this.headersMap.clear(),this.sortedMap=null,this.cookies=null}append(e,t,s){this.sortedMap=null;const r=s?e:e.toLowerCase(),n=this.headersMap.get(r);if(n){const e="cookie"===r?"; ":", ";this.headersMap.set(r,{name:n.name,value:`${n.value}${e}${t}`})}else this.headersMap.set(r,{name:e,value:t});"set-cookie"===r&&(this.cookies??=[]).push(t)}set(e,t,s){this.sortedMap=null;const r=s?e:e.toLowerCase();"set-cookie"===r&&(this.cookies=[t]),this.headersMap.set(r,{name:e,value:t})}delete(e,t){this.sortedMap=null,t||(e=e.toLowerCase()),"set-cookie"===e&&(this.cookies=null),this.headersMap.delete(e)}get(e,t){return this.headersMap.get(t?e:e.toLowerCase())?.value??null}*[Symbol.iterator](){for(const{0:e,1:{value:t}}of this.headersMap)yield[e,t]}get entries(){const e={};if(0!==this.headersMap.size)for(const{name:t,value:s}of this.headersMap.values())e[t]=s;return e}rawValues(){return this.headersMap.values()}get entriesList(){const e=[];if(0!==this.headersMap.size)for(const{0:t,1:{name:s,value:r}}of this.headersMap)if("set-cookie"===t)for(const t of this.cookies)e.push([s,t]);else e.push([s,r]);return e}toSortedArray(){const e=this.headersMap.size,t=new Array(e);if(e<=32){if(0===e)return t;const s=this.headersMap[Symbol.iterator](),r=s.next().value;t[0]=[r[0],r[1].value],c(null!==r[1].value);for(let r,n,A=1,i=0,o=0,a=0,l=0;A<e;++A){for(n=s.next().value,r=t[A]=[n[0],n[1].value],c(null!==r[1]),a=0,o=A;a<o;)l=a+(o-a>>1),t[l][0]<=r[0]?a=l+1:o=l;if(A!==l){for(i=A;i>a;)t[i]=t[--i];t[a]=r}}if(!s.next().done)throw new TypeError("Unreachable");return t}{let e=0;for(const{0:s,1:{value:r}}of this.headersMap)t[e++]=[s,r],c(null!==r);return t.sort(E)}}}class C{#Xe;#je;constructor(e=void 0){a.util.markAsUncloneable(this),e!==r&&(this.#je=new I,this.#Xe="none",void 0!==e&&d(this,e=a.converters.HeadersInit(e,"Headers constructor","init")))}append(e,t){a.brandCheck(this,C),a.argumentLengthCheck(arguments,2,"Headers.append");const s="Headers.append";return u(this,e=a.converters.ByteString(e,s,"name"),t=a.converters.ByteString(t,s,"value"))}delete(e){a.brandCheck(this,C),a.argumentLengthCheck(arguments,1,"Headers.delete");if(e=a.converters.ByteString(e,"Headers.delete","name"),!i(e))throw a.errors.invalidArgument({prefix:"Headers.delete",value:e,type:"header name"});if("immutable"===this.#Xe)throw new TypeError("immutable");this.#je.contains(e,!1)&&this.#je.delete(e,!1)}get(e){a.brandCheck(this,C),a.argumentLengthCheck(arguments,1,"Headers.get");const t="Headers.get";if(e=a.converters.ByteString(e,t,"name"),!i(e))throw a.errors.invalidArgument({prefix:t,value:e,type:"header name"});return this.#je.get(e,!1)}has(e){a.brandCheck(this,C),a.argumentLengthCheck(arguments,1,"Headers.has");const t="Headers.has";if(e=a.converters.ByteString(e,t,"name"),!i(e))throw a.errors.invalidArgument({prefix:t,value:e,type:"header name"});return this.#je.contains(e,!1)}set(e,t){a.brandCheck(this,C),a.argumentLengthCheck(arguments,2,"Headers.set");const s="Headers.set";if(e=a.converters.ByteString(e,s,"name"),t=g(t=a.converters.ByteString(t,s,"value")),!i(e))throw a.errors.invalidArgument({prefix:s,value:e,type:"header name"});if(!o(t))throw a.errors.invalidArgument({prefix:s,value:t,type:"header value"});if("immutable"===this.#Xe)throw new TypeError("immutable");this.#je.set(e,t,!1)}getSetCookie(){a.brandCheck(this,C);const e=this.#je.cookies;return e?[...e]:[]}[l.inspect.custom](e,t){return t.depth??=e,`Headers ${l.formatWithOptions(t,this.#je.entries)}`}static getHeadersGuard(e){return e.#Xe}static setHeadersGuard(e,t){e.#Xe=t}static getHeadersList(e){return e.#je}static setHeadersList(e,t){e.#je=t}}const{getHeadersGuard:B,setHeadersGuard:Q,getHeadersList:p,setHeadersList:f}=C;Reflect.deleteProperty(C,"getHeadersGuard"),Reflect.deleteProperty(C,"setHeadersGuard"),Reflect.deleteProperty(C,"getHeadersList"),Reflect.deleteProperty(C,"setHeadersList"),A("Headers",C,(function(e){const t=p(e);if(!t)return[];if(t.sortedMap)return t.sortedMap;const s=[],r=t.toSortedArray(),n=t.cookies;if(null===n||1===n.length)return t.sortedMap=r;for(let e=0;e<r.length;++e){const{0:t,1:A}=r[e];if("set-cookie"===t)for(let e=0;e<n.length;++e)s.push([t,n[e]]);else s.push([t,A])}return t.sortedMap=s}),0,1),Object.defineProperties(C.prototype,{append:n,delete:n,get:n,has:n,set:n,getSetCookie:n,[Symbol.toStringTag]:{value:"Headers",configurable:!0},[l.inspect.custom]:{enumerable:!1}}),a.converters.HeadersInit=function(e,t,s){if(a.util.Type(e)===a.util.Types.OBJECT){const r=Reflect.get(e,Symbol.iterator);if(!l.types.isProxy(e)&&r===C.prototype.entries)try{return p(e).entriesList}catch{}return"function"==typeof r?a.converters["sequence<sequence<ByteString>>"](e,t,s,r.bind(e)):a.converters["record<ByteString, ByteString>"](e,t,s)}throw a.errors.conversionFailed({prefix:"Headers constructor",argument:"Argument 1",types:["sequence<sequence<ByteString>>","record<ByteString, ByteString>"]})},e.exports={fill:d,compareHeaderName:E,Headers:C,HeadersList:I,getHeadersGuard:B,setHeadersGuard:Q,setHeadersList:f,getHeadersList:p}},7388:(e,t,s)=>{"use strict";const{makeNetworkError:r,makeAppropriateNetworkError:n,filterResponse:A,makeResponse:i,fromInnerResponse:o,getResponseState:a}=s(4821),{HeadersList:c}=s(6558),{Request:l,cloneRequest:h,getRequestDispatcher:g,getRequestState:d}=s(4609),u=s(8522),{makePolicyContainer:E,clonePolicyContainer:I,requestBadPort:C,TAOCheck:B,appendRequestOriginHeader:Q,responseLocationURL:p,requestCurrentURL:f,setRequestReferrerPolicyOnRedirect:m,tryUpgradeRequestToAPotentiallyTrustworthyURL:y,createOpaqueTimingInfo:w,appendFetchMetadata:S,corsCheck:D,crossOriginResourcePolicyCheck:b,determineRequestsReferrer:v,coarsenedSharedCurrentTime:N,sameOrigin:R,isCancelled:k,isAborted:T,isErrorLike:F,fullyReadBody:M,readableStreamClose:U,isomorphicEncode:L,urlIsLocal:H,urlIsHttpHttpsScheme:P,urlHasHttpsScheme:x,clampAndCoarsenConnectionTimingInfo:Y,simpleRangeHeaderValue:V,buildContentRange:O,createInflate:G,extractMimeType:J}=s(6686),W=s(4589),{safelyExtractBody:_,extractBody:q}=s(2530),{redirectStatusSet:$,nullBodyStatus:z,safeMethodsSet:X,requestBodyHeader:j,subresourceSet:Z}=s(9441),K=s(8474),{Readable:ee,pipeline:te,finished:se,isErrored:re,isReadable:ne}=s(7075),{addAbortListener:Ae,bufferToLowerCasedHeaderName:ie}=s(2858),{dataURLProcessor:oe,serializeAMimeType:ae,minimizeSupportedMimeType:ce}=s(9934),{getGlobalDispatcher:le}=s(9879),{webidl:he}=s(6097),{STATUS_CODES:ge}=s(7067),{bytesMatch:de}=s(7420),{createDeferredPromise:ue}=s(9250),Ee="function"==typeof u.createZstdDecompress,Ie=["GET","HEAD"],Ce="undefined"!=typeof __UNDICI_IS_NODE__||"undefined"!=typeof esbuildDetection?"node":"undici";let Be;class Qe extends K{constructor(e){super(),this.dispatcher=e,this.connection=null,this.dump=!1,this.state="ongoing"}terminate(e){"ongoing"===this.state&&(this.state="terminated",this.connection?.destroy(e),this.emit("terminated",e))}abort(e){"ongoing"===this.state&&(this.state="aborted",e||(e=new DOMException("The operation was aborted.","AbortError")),this.serializedAbortReason=e,this.connection?.destroy(e),this.emit("terminated",e))}}function pe(e){fe(e,"fetch")}function fe(e,t="other"){if("error"===e.type&&e.aborted)return;if(!e.urlList?.length)return;const s=e.urlList[0];let r=e.timingInfo,n=e.cacheState;P(s)&&null!==r&&(e.timingAllowPassed||(r=w({startTime:r.startTime}),n=""),r.endTime=N(),e.timingInfo=r,me(r,s.href,t,globalThis,n,"",e.status))}const me=performance.markResourceTiming;function ye(e,t,s,r){if(e&&e.reject(r),null!=t.body?.stream&&ne(t.body.stream)&&t.body.stream.cancel(r).catch((e=>{if("ERR_INVALID_STATE"!==e.code)throw e})),null==s)return;const n=a(s);null!=n.body?.stream&&ne(n.body.stream)&&n.body.stream.cancel(r).catch((e=>{if("ERR_INVALID_STATE"!==e.code)throw e}))}function we({request:e,processRequestBodyChunkLength:t,processRequestEndOfBody:s,processResponse:r,processResponseEndOfBody:n,processResponseConsumeBody:A,useParallelQueue:i=!1,dispatcher:o=le()}){W(o);let a=null,c=!1;null!=e.client&&(a=e.client.globalObject,c=e.client.crossOriginIsolatedCapability);const l=N(c),h=w({startTime:l}),g={controller:new Qe(o),request:e,timingInfo:h,processRequestBodyChunkLength:t,processRequestEndOfBody:s,processResponse:r,processResponseConsumeBody:A,processResponseEndOfBody:n,taskDestination:a,crossOriginIsolatedCapability:c};if(W(!e.body||e.body.stream),"client"===e.window&&(e.window="Window"===e.client?.globalObject?.constructor?.name?e.client:"no-window"),"client"===e.origin&&(e.origin=e.client.origin),"client"===e.policyContainer&&(null!=e.client?e.policyContainer=I(e.client.policyContainer):e.policyContainer=E()),!e.headersList.contains("accept",!0)){const t="*/*";e.headersList.append("accept",t,!0)}return e.headersList.contains("accept-language",!0)||e.headersList.append("accept-language","*",!0),e.priority,Z.has(e.destination),Se(g,!1),g.controller}async function Se(e,t){try{const s=e.request;let n=null;if(s.localURLsOnly&&!H(f(s))&&(n=r("local URLs only")),y(s),"blocked"===C(s)&&(n=r("bad port")),""===s.referrerPolicy&&(s.referrerPolicy=s.policyContainer.referrerPolicy),"no-referrer"!==s.referrer&&(s.referrer=v(s)),null===n){const t=f(s);R(t,s.url)&&"basic"===s.responseTainting||"data:"===t.protocol||"navigate"===s.mode||"websocket"===s.mode?(s.responseTainting="basic",n=await De(e)):"same-origin"===s.mode?n=r('request mode cannot be "same-origin"'):"no-cors"===s.mode?"follow"!==s.redirect?n=r('redirect mode cannot be "follow" for "no-cors" request'):(s.responseTainting="opaque",n=await De(e)):P(f(s))?(s.responseTainting="cors",n=await Ne(e)):n=r("URL scheme must be a HTTP(S) scheme")}if(t)return n;0===n.status||n.internalResponse||(s.responseTainting,"basic"===s.responseTainting?n=A(n,"basic"):"cors"===s.responseTainting?n=A(n,"cors"):"opaque"===s.responseTainting?n=A(n,"opaque"):W(!1));let i=0===n.status?n:n.internalResponse;if(0===i.urlList.length&&i.urlList.push(...s.urlList),s.timingAllowFailed||(n.timingAllowPassed=!0),"opaque"===n.type&&206===i.status&&i.rangeRequested&&!s.headers.contains("range",!0)&&(n=i=r()),0===n.status||"HEAD"!==s.method&&"CONNECT"!==s.method&&!z.includes(i.status)||(i.body=null,e.controller.dump=!0),s.integrity){const t=t=>ve(e,r(t));if("opaque"===s.responseTainting||null==n.body)return void t(n.error);const A=r=>{de(r,s.integrity)?(n.body=_(r)[0],ve(e,n)):t("integrity mismatch")};M(n.body,A,t)}else ve(e,n)}catch(t){e.controller.terminate(t)}}function De(e){if(k(e)&&0===e.request.redirectCount)return Promise.resolve(n(e));const{request:t}=e,{protocol:A}=f(t);switch(A){case"about:":return Promise.resolve(r("about scheme is not supported"));case"blob:":{Be||(Be=s(4573).resolveObjectURL);const e=f(t);if(0!==e.search.length)return Promise.resolve(r("NetworkError when attempting to fetch resource."));const n=Be(e.toString());if("GET"!==t.method||!he.is.Blob(n))return Promise.resolve(r("invalid method"));const A=i(),o=n.size,a=L(`${o}`),c=n.type;if(t.headersList.contains("range",!0)){A.rangeRequested=!0;const e=t.headersList.get("range",!0),s=V(e,!0);if("failure"===s)return Promise.resolve(r("failed to fetch the data URL"));let{rangeStartValue:i,rangeEndValue:a}=s;if(null===i)i=o-a,a=i+a-1;else{if(i>=o)return Promise.resolve(r("Range start is greater than the blob's size."));(null===a||a>=o)&&(a=o-1)}const l=n.slice(i,a,c),h=q(l);A.body=h[0];const g=L(`${l.size}`),d=O(i,a,o);A.status=206,A.statusText="Partial Content",A.headersList.set("content-length",g,!0),A.headersList.set("content-type",c,!0),A.headersList.set("content-range",d,!0)}else{const e=q(n);A.statusText="OK",A.body=e[0],A.headersList.set("content-length",a,!0),A.headersList.set("content-type",c,!0)}return Promise.resolve(A)}case"data:":{const e=f(t),s=oe(e);if("failure"===s)return Promise.resolve(r("failed to fetch the data URL"));const n=ae(s.mimeType);return Promise.resolve(i({statusText:"OK",headersList:[["content-type",{name:"Content-Type",value:n}]],body:_(s.body)[0]}))}case"file:":return Promise.resolve(r("not implemented... yet..."));case"http:":case"https:":return Ne(e).catch((e=>r(e)));default:return Promise.resolve(r("unknown scheme"))}}function be(e,t){e.request.done=!0,null!=e.processResponseDone&&queueMicrotask((()=>e.processResponseDone(t)))}function ve(e,t){let s=e.timingInfo;const r=()=>{const r=Date.now();"document"===e.request.destination&&(e.controller.fullTimingInfo=s),e.controller.reportTimingSteps=()=>{if(!P(e.request.url))return;s.endTime=r;let n=t.cacheState;const A=t.bodyInfo;t.timingAllowPassed||(s=w(s),n="");let i=0;if("navigator"!==e.request.mode||!t.hasCrossOriginRedirects){i=t.status;const e=J(t.headersList);"failure"!==e&&(A.contentType=ce(e))}null!=e.request.initiatorType&&me(s,e.request.url.href,e.request.initiatorType,globalThis,n,A,i)};queueMicrotask((()=>(e.request.done=!0,null!=e.processResponseEndOfBody&&queueMicrotask((()=>e.processResponseEndOfBody(t))),void(null!=e.request.initiatorType&&e.controller.reportTimingSteps()))))};null!=e.processResponse&&queueMicrotask((()=>{e.processResponse(t),e.processResponse=null}));const n="error"===t.type?t:t.internalResponse??t;null==n.body?r():se(n.body.stream,(()=>{r()}))}async function Ne(e){const t=e.request;let s=null,n=null;const A=e.timingInfo;if(t.serviceWorkers,null===s){if("follow"===t.redirect&&(t.serviceWorkers="none"),n=s=await Re(e),"cors"===t.responseTainting&&"failure"===D(t,s))return r("cors failure");"failure"===B(t,s)&&(t.timingAllowFailed=!0)}return"opaque"!==t.responseTainting&&"opaque"!==s.type||"blocked"!==b(t.origin,t.client,t.destination,n)?($.has(n.status)&&("manual"!==t.redirect&&e.controller.connection.destroy(void 0,!1),"error"===t.redirect?s=r("unexpected redirect"):"manual"===t.redirect?s=n:"follow"===t.redirect?s=await function(e,t){const s=e.request,n=t.internalResponse?t.internalResponse:t;let A;try{if(A=p(n,f(s).hash),null==A)return t}catch(e){return Promise.resolve(r(e))}if(!P(A))return Promise.resolve(r("URL scheme must be a HTTP(S) scheme"));if(20===s.redirectCount)return Promise.resolve(r("redirect count exceeded"));if(s.redirectCount+=1,"cors"===s.mode&&(A.username||A.password)&&!R(s,A))return Promise.resolve(r('cross origin not allowed for request mode "cors"'));if("cors"===s.responseTainting&&(A.username||A.password))return Promise.resolve(r('URL cannot contain credentials for request mode "cors"'));if(303!==n.status&&null!=s.body&&null==s.body.source)return Promise.resolve(r());if([301,302].includes(n.status)&&"POST"===s.method||303===n.status&&!Ie.includes(s.method)){s.method="GET",s.body=null;for(const e of j)s.headersList.delete(e)}R(f(s),A)||(s.headersList.delete("authorization",!0),s.headersList.delete("proxy-authorization",!0),s.headersList.delete("cookie",!0),s.headersList.delete("host",!0));null!=s.body&&(W(null!=s.body.source),s.body=_(s.body.source)[0]);const i=e.timingInfo;i.redirectEndTime=i.postRedirectStartTime=N(e.crossOriginIsolatedCapability),0===i.redirectStartTime&&(i.redirectStartTime=i.startTime);return s.urlList.push(A),m(s,n),Se(e,!0)}(e,s):W(!1)),s.timingInfo=A,s):r("blocked")}async function Re(e,t=!1,s=!1){const A=e.request;let o=null,a=null,l=null;"no-window"===A.window&&"error"===A.redirect?(o=e,a=A):(a=h(A),o={...e},o.request=a);const g="include"===A.credentials||"same-origin"===A.credentials&&"basic"===A.responseTainting,d=a.body?a.body.length:null;let E=null;if(null==a.body&&["POST","PUT"].includes(a.method)&&(E="0"),null!=d&&(E=L(`${d}`)),null!=E&&a.headersList.append("content-length",E,!0),null!=d&&a.keepalive,he.is.URL(a.referrer)&&a.headersList.append("referer",L(a.referrer.href),!0),Q(a),S(a),a.headersList.contains("user-agent",!0)||a.headersList.append("user-agent",Ce,!0),"default"===a.cache&&(a.headersList.contains("if-modified-since",!0)||a.headersList.contains("if-none-match",!0)||a.headersList.contains("if-unmodified-since",!0)||a.headersList.contains("if-match",!0)||a.headersList.contains("if-range",!0))&&(a.cache="no-store"),"no-cache"!==a.cache||a.preventNoCacheCacheControlHeaderModification||a.headersList.contains("cache-control",!0)||a.headersList.append("cache-control","max-age=0",!0),"no-store"!==a.cache&&"reload"!==a.cache||(a.headersList.contains("pragma",!0)||a.headersList.append("pragma","no-cache",!0),a.headersList.contains("cache-control",!0)||a.headersList.append("cache-control","no-cache",!0)),a.headersList.contains("range",!0)&&a.headersList.append("accept-encoding","identity",!0),a.headersList.contains("accept-encoding",!0)||(x(f(a))?a.headersList.append("accept-encoding","br, gzip, deflate",!0):a.headersList.append("accept-encoding","gzip, deflate",!0)),a.headersList.delete("host",!0),a.cache="no-store","no-store"!==a.cache&&a.cache,null==l){if("only-if-cached"===a.cache)return r("only if cached");const e=await async function(e){W(!e.controller.connection||e.controller.connection.destroyed),e.controller.connection={abort:null,destroyed:!1,destroy(e,t=!0){this.destroyed||(this.destroyed=!0,t&&this.abort?.(e??new DOMException("The operation was aborted.","AbortError")))}};const t=e.request;let s=null;const A=e.timingInfo,o=null;null==o&&(t.cache="no-store");t.mode;let a=null;if(null==t.body&&e.processRequestEndOfBody)queueMicrotask((()=>e.processRequestEndOfBody()));else if(null!=t.body){const s=async function*(t){k(e)||(yield t,e.processRequestBodyChunkLength?.(t.byteLength))},r=()=>{k(e)||e.processRequestEndOfBody&&e.processRequestEndOfBody()},n=t=>{k(e)||("AbortError"===t.name?e.controller.abort():e.controller.terminate(t))};a=async function*(){try{for await(const e of t.body.stream)yield*s(e);r()}catch(e){n(e)}}()}try{const{body:t,status:r,statusText:n,headersList:A,socket:o}=await E({body:a});if(o)s=i({status:r,statusText:n,headersList:A,socket:o});else{const o=t[Symbol.asyncIterator]();e.controller.next=()=>o.next(),s=i({status:r,statusText:n,headersList:A})}}catch(t){return"AbortError"===t.name?(e.controller.connection.destroy(),n(e,t)):r(t)}const l=()=>e.controller.resume(),h=t=>{k(e)||e.controller.abort(t)},g=new ReadableStream({start(t){e.controller.controller=t},pull:l,cancel:h,type:"bytes"});s.body={stream:g,source:null,length:null},e.controller.resume||e.controller.on("terminated",d);function d(t){T(e)?(s.aborted=!0,ne(g)&&e.controller.controller.error(e.controller.serializedAbortReason)):ne(g)&&e.controller.controller.error(new TypeError("terminated",{cause:F(t)?t:void 0})),e.controller.connection.destroy()}return e.controller.resume=async()=>{for(;;){let t,r;try{const{done:s,value:r}=await e.controller.next();if(T(e))break;t=s?void 0:r}catch(s){e.controller.ended&&!A.encodedBodySize?t=void 0:(t=s,r=!0)}if(void 0===t)return U(e.controller.controller),void be(e,s);if(A.decodedBodySize+=t?.byteLength??0,r)return void e.controller.terminate(t);const n=new Uint8Array(t);if(n.byteLength&&e.controller.controller.enqueue(n),re(g))return void e.controller.terminate();if(e.controller.controller.desiredSize<=0)return}},s;function E({body:s}){const r=f(t),n=e.controller.dispatcher;return new Promise(((i,o)=>n.dispatch({path:r.pathname+r.search,origin:r.origin,method:t.method,body:n.isMockActive?t.body&&(t.body.source||t.body.stream):s,headers:t.headersList.entries,maxRedirections:0,upgrade:"websocket"===t.mode?"websocket":void 0},{body:null,abort:null,onConnect(t){const{connection:s}=e.controller;A.finalConnectionTimingInfo=Y(void 0,A.postRedirectStartTime,e.crossOriginIsolatedCapability),s.destroyed?t(new DOMException("The operation was aborted.","AbortError")):(e.controller.on("terminated",t),this.abort=s.abort=t),A.finalNetworkRequestStartTime=N(e.crossOriginIsolatedCapability)},onResponseStarted(){A.finalNetworkResponseStartTime=N(e.crossOriginIsolatedCapability)},onHeaders(e,s,r,n){if(e<200)return!1;const A=new c;for(let e=0;e<s.length;e+=2)A.append(ie(s[e]),s[e+1].toString("latin1"),!0);const o=A.get("location",!0);this.body=new ee({read:r});const a=o&&"follow"===t.redirect&&$.has(e),l=[];if("HEAD"!==t.method&&"CONNECT"!==t.method&&!z.includes(e)&&!a){const e=A.get("content-encoding",!0),t=e?e.toLowerCase().split(","):[];for(let e=t.length-1;e>=0;--e){const s=t[e].trim();if("x-gzip"===s||"gzip"===s)l.push(u.createGunzip({flush:u.constants.Z_SYNC_FLUSH,finishFlush:u.constants.Z_SYNC_FLUSH}));else if("deflate"===s)l.push(G({flush:u.constants.Z_SYNC_FLUSH,finishFlush:u.constants.Z_SYNC_FLUSH}));else if("br"===s)l.push(u.createBrotliDecompress({flush:u.constants.BROTLI_OPERATION_FLUSH,finishFlush:u.constants.BROTLI_OPERATION_FLUSH}));else{if("zstd"!==s||!Ee){l.length=0;break}l.push(u.createZstdDecompress({flush:u.constants.ZSTD_e_continue,finishFlush:u.constants.ZSTD_e_end}))}}}const h=this.onError.bind(this);return i({status:e,statusText:n,headersList:A,body:l.length?te(this.body,...l,(e=>{e&&this.onError(e)})).on("error",h):this.body.on("error",h)}),!0},onData(t){if(e.controller.dump)return;const s=t;return A.encodedBodySize+=s.byteLength,this.body.push(s)},onComplete(){this.abort&&e.controller.off("terminated",this.abort),e.controller.ended=!0,this.body.push(null)},onError(t){this.abort&&e.controller.off("terminated",this.abort),this.body?.destroy(t),e.controller.terminate(t),o(t)},onUpgrade(e,t,s){if(101!==e)return;const r=new c;for(let e=0;e<t.length;e+=2)r.append(ie(t[e]),t[e+1].toString("latin1"),!0);return i({status:e,statusText:ge[e],headersList:r,socket:s}),!0}})))}}(o,g,s);!X.has(a.method)&&e.status>=200&&e.status,null==l&&(l=e)}if(l.urlList=[...a.urlList],a.headersList.contains("range",!0)&&(l.rangeRequested=!0),l.requestIncludesCredentials=g,407===l.status)return"no-window"===A.window?r():k(e)?n(e):r("proxy authentication required");if(421===l.status&&!s&&(null==A.body||null!=A.body.source)){if(k(e))return n(e);e.controller.connection.destroy(),l=await Re(e,t,!0)}return l}e.exports={fetch:function(e,t=void 0){he.argumentLengthCheck(arguments,1,"globalThis.fetch");let s,r=ue();try{s=new l(e,t)}catch(e){return r.reject(e),r.promise}const n=d(s);if(s.signal.aborted)return ye(r,n,null,s.signal.reason),r.promise;const A=n.client.globalObject;"ServiceWorkerGlobalScope"===A?.constructor?.name&&(n.serviceWorkers="none");let i=null,a=!1,c=null;return Ae(s.signal,(()=>{a=!0,W(null!=c),c.abort(s.signal.reason);const e=i?.deref();ye(r,n,e,s.signal.reason)})),c=we({request:n,processResponseEndOfBody:pe,processResponse:e=>{a||(e.aborted?ye(r,n,i,c.serializedAbortReason):"error"!==e.type?(i=new WeakRef(o(e,"immutable")),r.resolve(i.deref()),r=null):r.reject(new TypeError("fetch failed",{cause:e.error})))},dispatcher:g(s)}),r.promise},Fetch:Qe,fetching:we,finalizeAndReportTiming:fe}},4609:(e,t,s)=>{"use strict";const{extractBody:r,mixinBody:n,cloneBody:A,bodyUnusable:i}=s(2530),{Headers:o,fill:a,HeadersList:c,setHeadersGuard:l,getHeadersGuard:h,setHeadersList:g,getHeadersList:d}=s(6558),u=s(2858),E=s(7975),{isValidHTTPToken:I,sameOrigin:C,environmentSettingsObject:B}=s(6686),{forbiddenMethodsSet:Q,corsSafeListedMethodsSet:p,referrerPolicy:f,requestRedirect:m,requestMode:y,requestCredentials:w,requestCache:S,requestDuplex:D}=s(9441),{kEnumerableProperty:b,normalizedMethodRecordsBase:v,normalizedMethodRecords:N}=u,{webidl:R}=s(6097),{URLSerializer:k}=s(9934),{kConstruct:T}=s(257),F=s(4589),{getMaxListeners:M,setMaxListeners:U,defaultMaxListeners:L}=s(8474),H=Symbol("abortController"),P=new FinalizationRegistry((({signal:e,abort:t})=>{e.removeEventListener("abort",t)})),x=new WeakMap;let Y;try{Y=M((new AbortController).signal)>0}catch{Y=!1}function V(e){return function t(){const s=e.deref();if(void 0!==s){P.unregister(t),this.removeEventListener("abort",t),s.abort(this.reason);const e=x.get(s.signal);if(void 0!==e){if(0!==e.size){for(const t of e){const e=t.deref();void 0!==e&&e.abort(this.reason)}e.clear()}x.delete(s.signal)}}}}let O=!1;class G{#Ze;#qe;#Qe;#le;constructor(e,t=void 0){if(R.util.markAsUncloneable(this),e===T)return;R.argumentLengthCheck(arguments,1,"Request constructor"),e=R.converters.RequestInfo(e),t=R.converters.RequestInit(t);let s=null,n=null;const A=B.settingsObject.baseUrl;let h=null;if("string"==typeof e){let r;this.#qe=t.dispatcher;try{r=new URL(e,A)}catch(t){throw new TypeError("Failed to parse URL from "+e,{cause:t})}if(r.username||r.password)throw new TypeError("Request cannot be constructed from a URL that includes credentials: "+e);s=X({urlList:[r]}),n="cors"}else F(R.is.Request(e)),s=e.#le,h=e.#Ze,this.#qe=t.dispatcher||e.#qe;const E=B.settingsObject.origin;let f="client";if("EnvironmentSettingsObject"===s.window?.constructor?.name&&C(s.window,E)&&(f=s.window),null!=t.window)throw new TypeError(`'window' option '${f}' must be null`);"window"in t&&(f="no-window"),s=X({method:s.method,headersList:s.headersList,unsafeRequest:s.unsafeRequest,client:B.settingsObject,window:f,priority:s.priority,origin:s.origin,referrer:s.referrer,referrerPolicy:s.referrerPolicy,mode:s.mode,credentials:s.credentials,cache:s.cache,redirect:s.redirect,integrity:s.integrity,keepalive:s.keepalive,reloadNavigation:s.reloadNavigation,historyNavigation:s.historyNavigation,urlList:[...s.urlList]});const m=0!==Object.keys(t).length;if(m&&("navigate"===s.mode&&(s.mode="same-origin"),s.reloadNavigation=!1,s.historyNavigation=!1,s.origin="client",s.referrer="client",s.referrerPolicy="",s.url=s.urlList[s.urlList.length-1],s.urlList=[s.url]),void 0!==t.referrer){const e=t.referrer;if(""===e)s.referrer="no-referrer";else{let t;try{t=new URL(e,A)}catch(t){throw new TypeError(`Referrer "${e}" is not a valid URL.`,{cause:t})}"about:"===t.protocol&&"client"===t.hostname||E&&!C(t,B.settingsObject.baseUrl)?s.referrer="client":s.referrer=t}}let y;if(void 0!==t.referrerPolicy&&(s.referrerPolicy=t.referrerPolicy),y=void 0!==t.mode?t.mode:n,"navigate"===y)throw R.errors.exception({header:"Request constructor",message:"invalid request mode navigate."});if(null!=y&&(s.mode=y),void 0!==t.credentials&&(s.credentials=t.credentials),void 0!==t.cache&&(s.cache=t.cache),"only-if-cached"===s.cache&&"same-origin"!==s.mode)throw new TypeError("'only-if-cached' can be set only with 'same-origin' mode");if(void 0!==t.redirect&&(s.redirect=t.redirect),null!=t.integrity&&(s.integrity=String(t.integrity)),void 0!==t.keepalive&&(s.keepalive=Boolean(t.keepalive)),void 0!==t.method){let e=t.method;const r=N[e];if(void 0!==r)s.method=r;else{if(!I(e))throw new TypeError(`'${e}' is not a valid HTTP method.`);const t=e.toUpperCase();if(Q.has(t))throw new TypeError(`'${e}' HTTP method is unsupported.`);e=v[t]??e,s.method=e}O||"patch"!==s.method||(process.emitWarning("Using `patch` is highly likely to result in a `405 Method Not Allowed`. `PATCH` is much more likely to succeed.",{code:"UNDICI-FETCH-patch"}),O=!0)}void 0!==t.signal&&(h=t.signal),this.#le=s;const w=new AbortController;if(this.#Ze=w.signal,null!=h)if(h.aborted)w.abort(h.reason);else{this[H]=w;const e=V(new WeakRef(w));Y&&M(h)===L&&U(1500,h),u.addAbortListener(h,e),P.register(w,{signal:h,abort:e},e)}if(this.#Qe=new o(T),g(this.#Qe,s.headersList),l(this.#Qe,"request"),"no-cors"===y){if(!p.has(s.method))throw new TypeError(`'${s.method} is unsupported in no-cors mode.`);l(this.#Qe,"request-no-cors")}if(m){const e=d(this.#Qe),s=void 0!==t.headers?t.headers:new c(e);if(e.clear(),s instanceof c){for(const{name:t,value:r}of s.rawValues())e.append(t,r,!1);e.cookies=s.cookies}else a(this.#Qe,s)}const S=R.is.Request(e)?e.#le.body:null;if(!(null==t.body&&null==S||"GET"!==s.method&&"HEAD"!==s.method))throw new TypeError("Request with GET/HEAD method cannot have body.");let D=null;if(null!=t.body){const[e,n]=r(t.body,s.keepalive);D=e,n&&!d(this.#Qe).contains("content-type",!0)&&this.#Qe.append("content-type",n,!0)}const b=D??S;if(null!=b&&null==b.source){if(null!=D&&null==t.duplex)throw new TypeError("RequestInit: duplex option is required when sending a body.");if("same-origin"!==s.mode&&"cors"!==s.mode)throw new TypeError('If request is made from ReadableStream, mode should be "same-origin" or "cors"');s.useCORSPreflightFlag=!0}let k=b;if(null==D&&null!=S){if(i(e.#le))throw new TypeError("Cannot construct a Request with a Request object that has already been used.");const t=new TransformStream;S.stream.pipeThrough(t),k={source:S.source,length:S.length,stream:t.readable}}this.#le.body=k}get method(){return R.brandCheck(this,G),this.#le.method}get url(){return R.brandCheck(this,G),k(this.#le.url)}get headers(){return R.brandCheck(this,G),this.#Qe}get destination(){return R.brandCheck(this,G),this.#le.destination}get referrer(){return R.brandCheck(this,G),"no-referrer"===this.#le.referrer?"":"client"===this.#le.referrer?"about:client":this.#le.referrer.toString()}get referrerPolicy(){return R.brandCheck(this,G),this.#le.referrerPolicy}get mode(){return R.brandCheck(this,G),this.#le.mode}get credentials(){return R.brandCheck(this,G),this.#le.credentials}get cache(){return R.brandCheck(this,G),this.#le.cache}get redirect(){return R.brandCheck(this,G),this.#le.redirect}get integrity(){return R.brandCheck(this,G),this.#le.integrity}get keepalive(){return R.brandCheck(this,G),this.#le.keepalive}get isReloadNavigation(){return R.brandCheck(this,G),this.#le.reloadNavigation}get isHistoryNavigation(){return R.brandCheck(this,G),this.#le.historyNavigation}get signal(){return R.brandCheck(this,G),this.#Ze}get body(){return R.brandCheck(this,G),this.#le.body?this.#le.body.stream:null}get bodyUsed(){return R.brandCheck(this,G),!!this.#le.body&&u.isDisturbed(this.#le.body.stream)}get duplex(){return R.brandCheck(this,G),"half"}clone(){if(R.brandCheck(this,G),i(this.#le))throw new TypeError("unusable");const e=j(this.#le),t=new AbortController;if(this.signal.aborted)t.abort(this.signal.reason);else{let e=x.get(this.signal);void 0===e&&(e=new Set,x.set(this.signal,e));const s=new WeakRef(t);e.add(s),u.addAbortListener(t.signal,V(s))}return Z(e,this.#qe,t.signal,h(this.#Qe))}[E.inspect.custom](e,t){null===t.depth&&(t.depth=2),t.colors??=!0;const s={method:this.method,url:this.url,headers:this.headers,destination:this.destination,referrer:this.referrer,referrerPolicy:this.referrerPolicy,mode:this.mode,credentials:this.credentials,cache:this.cache,redirect:this.redirect,integrity:this.integrity,keepalive:this.keepalive,isReloadNavigation:this.isReloadNavigation,isHistoryNavigation:this.isHistoryNavigation,signal:this.signal};return`Request ${E.formatWithOptions(t,s)}`}static setRequestSignal(e,t){return e.#Ze=t,e}static getRequestDispatcher(e){return e.#qe}static setRequestDispatcher(e,t){e.#qe=t}static setRequestHeaders(e,t){e.#Qe=t}static getRequestState(e){return e.#le}static setRequestState(e,t){e.#le=t}}const{setRequestSignal:J,getRequestDispatcher:W,setRequestDispatcher:_,setRequestHeaders:q,getRequestState:$,setRequestState:z}=G;function X(e){return{method:e.method??"GET",localURLsOnly:e.localURLsOnly??!1,unsafeRequest:e.unsafeRequest??!1,body:e.body??null,client:e.client??null,reservedClient:e.reservedClient??null,replacesClientId:e.replacesClientId??"",window:e.window??"client",keepalive:e.keepalive??!1,serviceWorkers:e.serviceWorkers??"all",initiator:e.initiator??"",destination:e.destination??"",priority:e.priority??null,origin:e.origin??"client",policyContainer:e.policyContainer??"client",referrer:e.referrer??"client",referrerPolicy:e.referrerPolicy??"",mode:e.mode??"no-cors",useCORSPreflightFlag:e.useCORSPreflightFlag??!1,credentials:e.credentials??"same-origin",useCredentials:e.useCredentials??!1,cache:e.cache??"default",redirect:e.redirect??"follow",integrity:e.integrity??"",cryptoGraphicsNonceMetadata:e.cryptoGraphicsNonceMetadata??"",parserMetadata:e.parserMetadata??"",reloadNavigation:e.reloadNavigation??!1,historyNavigation:e.historyNavigation??!1,userActivation:e.userActivation??!1,taintedOrigin:e.taintedOrigin??!1,redirectCount:e.redirectCount??0,responseTainting:e.responseTainting??"basic",preventNoCacheCacheControlHeaderModification:e.preventNoCacheCacheControlHeaderModification??!1,done:e.done??!1,timingAllowFailed:e.timingAllowFailed??!1,urlList:e.urlList,url:e.urlList[0],headersList:e.headersList?new c(e.headersList):new c}}function j(e){const t=X({...e,body:null});return null!=e.body&&(t.body=A(e.body)),t}function Z(e,t,s,r){const n=new G(T);z(n,e),_(n,t),J(n,s);const A=new o(T);return q(n,A),g(A,e.headersList),l(A,r),n}Reflect.deleteProperty(G,"setRequestSignal"),Reflect.deleteProperty(G,"getRequestDispatcher"),Reflect.deleteProperty(G,"setRequestDispatcher"),Reflect.deleteProperty(G,"setRequestHeaders"),Reflect.deleteProperty(G,"getRequestState"),Reflect.deleteProperty(G,"setRequestState"),n(G,$),Object.defineProperties(G.prototype,{method:b,url:b,headers:b,redirect:b,clone:b,signal:b,duplex:b,destination:b,body:b,bodyUsed:b,isHistoryNavigation:b,isReloadNavigation:b,keepalive:b,integrity:b,cache:b,credentials:b,attribute:b,referrerPolicy:b,referrer:b,mode:b,[Symbol.toStringTag]:{value:"Request",configurable:!0}}),R.is.Request=R.util.MakeTypeAssertion(G),R.converters.RequestInfo=function(e){return"string"==typeof e?R.converters.USVString(e):R.is.Request(e)?e:R.converters.USVString(e)},R.converters.RequestInit=R.dictionaryConverter([{key:"method",converter:R.converters.ByteString},{key:"headers",converter:R.converters.HeadersInit},{key:"body",converter:R.nullableConverter(R.converters.BodyInit)},{key:"referrer",converter:R.converters.USVString},{key:"referrerPolicy",converter:R.converters.DOMString,allowedValues:f},{key:"mode",converter:R.converters.DOMString,allowedValues:y},{key:"credentials",converter:R.converters.DOMString,allowedValues:w},{key:"cache",converter:R.converters.DOMString,allowedValues:S},{key:"redirect",converter:R.converters.DOMString,allowedValues:m},{key:"integrity",converter:R.converters.DOMString},{key:"keepalive",converter:R.converters.boolean},{key:"signal",converter:R.nullableConverter((e=>R.converters.AbortSignal(e,"RequestInit","signal")))},{key:"window",converter:R.converters.any},{key:"duplex",converter:R.converters.DOMString,allowedValues:D},{key:"dispatcher",converter:R.converters.any}]),e.exports={Request:G,makeRequest:X,fromInnerRequest:Z,cloneRequest:j,getRequestDispatcher:W,getRequestState:$}},4821:(e,t,s)=>{"use strict";const{Headers:r,HeadersList:n,fill:A,getHeadersGuard:i,setHeadersGuard:o,setHeadersList:a}=s(6558),{extractBody:c,cloneBody:l,mixinBody:h,streamRegistry:g,bodyUnusable:d}=s(2530),u=s(2858),E=s(7975),{kEnumerableProperty:I}=u,{isValidReasonPhrase:C,isCancelled:B,isAborted:Q,serializeJavascriptValueToJSONString:p,isErrorLike:f,isomorphicEncode:m,environmentSettingsObject:y}=s(6686),{redirectStatusSet:w,nullBodyStatus:S}=s(9441),{webidl:D}=s(6097),{URLSerializer:b}=s(9934),{kConstruct:v}=s(257),N=s(4589),R=new TextEncoder("utf-8");class k{#Qe;#le;static error(){return O(P(),"immutable")}static json(e,t=void 0){D.argumentLengthCheck(arguments,1,"Response.json"),null!==t&&(t=D.converters.ResponseInit(t));const s=R.encode(p(e)),r=c(s),n=O(H({}),"response");return V(n,t,{body:r[0],type:"application/json"}),n}static redirect(e,t=302){let s;D.argumentLengthCheck(arguments,1,"Response.redirect"),e=D.converters.USVString(e),t=D.converters["unsigned short"](t);try{s=new URL(e,y.settingsObject.baseUrl)}catch(t){throw new TypeError(`Failed to parse URL from ${e}`,{cause:t})}if(!w.has(t))throw new RangeError(`Invalid status code ${t}`);const r=O(H({}),"immutable");r.#le.status=t;const n=m(b(s));return r.#le.headersList.append("location",n,!0),r}constructor(e=null,t=void 0){if(D.util.markAsUncloneable(this),e===v)return;null!==e&&(e=D.converters.BodyInit(e,"Response","body")),t=D.converters.ResponseInit(t),this.#le=H({}),this.#Qe=new r(v),o(this.#Qe,"response"),a(this.#Qe,this.#le.headersList);let s=null;if(null!=e){const[t,r]=c(e);s={body:t,type:r}}V(this,t,s)}get type(){return D.brandCheck(this,k),this.#le.type}get url(){D.brandCheck(this,k);const e=this.#le.urlList,t=e[e.length-1]??null;return null===t?"":b(t,!0)}get redirected(){return D.brandCheck(this,k),this.#le.urlList.length>1}get status(){return D.brandCheck(this,k),this.#le.status}get ok(){return D.brandCheck(this,k),this.#le.status>=200&&this.#le.status<=299}get statusText(){return D.brandCheck(this,k),this.#le.statusText}get headers(){return D.brandCheck(this,k),this.#Qe}get body(){return D.brandCheck(this,k),this.#le.body?this.#le.body.stream:null}get bodyUsed(){return D.brandCheck(this,k),!!this.#le.body&&u.isDisturbed(this.#le.body.stream)}clone(){if(D.brandCheck(this,k),d(this.#le))throw D.errors.exception({header:"Response.clone",message:"Body has already been consumed."});const e=L(this.#le);return this.#le.body?.stream&&g.register(this,new WeakRef(this.#le.body.stream)),O(e,i(this.#Qe))}[E.inspect.custom](e,t){null===t.depth&&(t.depth=2),t.colors??=!0;const s={status:this.status,statusText:this.statusText,headers:this.headers,body:this.body,bodyUsed:this.bodyUsed,ok:this.ok,redirected:this.redirected,type:this.type,url:this.url};return`Response ${E.formatWithOptions(t,s)}`}static getResponseHeaders(e){return e.#Qe}static setResponseHeaders(e,t){e.#Qe=t}static getResponseState(e){return e.#le}static setResponseState(e,t){e.#le=t}}const{getResponseHeaders:T,setResponseHeaders:F,getResponseState:M,setResponseState:U}=k;function L(e){if(e.internalResponse)return Y(L(e.internalResponse),e.type);const t=H({...e,body:null});return null!=e.body&&(t.body=l(e.body)),t}function H(e){return{aborted:!1,rangeRequested:!1,timingAllowPassed:!1,requestIncludesCredentials:!1,type:"default",status:200,timingInfo:null,cacheState:"",statusText:"",...e,headersList:e?.headersList?new n(e?.headersList):new n,urlList:e?.urlList?[...e.urlList]:[]}}function P(e){return H({type:"error",status:0,error:f(e)?e:new Error(e?String(e):e),aborted:e&&"AbortError"===e.name})}function x(e,t){return t={internalResponse:e,...t},new Proxy(e,{get:(e,s)=>s in t?t[s]:e[s],set:(e,s,r)=>(N(!(s in t)),e[s]=r,!0)})}function Y(e,t){return"basic"===t?x(e,{type:"basic",headersList:e.headersList}):"cors"===t?x(e,{type:"cors",headersList:e.headersList}):"opaque"===t?x(e,{type:"opaque",urlList:Object.freeze([]),status:0,statusText:"",body:null}):"opaqueredirect"===t?x(e,{type:"opaqueredirect",status:0,statusText:"",headersList:[],body:null}):void N(!1)}function V(e,t,s){if(null!==t.status&&(t.status<200||t.status>599))throw new RangeError('init["status"] must be in the range of 200 to 599, inclusive.');if("statusText"in t&&null!=t.statusText&&!C(String(t.statusText)))throw new TypeError("Invalid statusText");if("status"in t&&null!=t.status&&(M(e).status=t.status),"statusText"in t&&null!=t.statusText&&(M(e).statusText=t.statusText),"headers"in t&&null!=t.headers&&A(T(e),t.headers),s){if(S.includes(e.status))throw D.errors.exception({header:"Response constructor",message:`Invalid response status code ${e.status}`});M(e).body=s.body,null==s.type||M(e).headersList.contains("content-type",!0)||M(e).headersList.append("content-type",s.type,!0)}}function O(e,t){const s=new k(v);U(s,e);const n=new r(v);return F(s,n),a(n,e.headersList),o(n,t),e.body?.stream&&g.register(s,new WeakRef(e.body.stream)),s}Reflect.deleteProperty(k,"getResponseHeaders"),Reflect.deleteProperty(k,"setResponseHeaders"),Reflect.deleteProperty(k,"getResponseState"),Reflect.deleteProperty(k,"setResponseState"),h(k,M),Object.defineProperties(k.prototype,{type:I,url:I,status:I,ok:I,redirected:I,statusText:I,headers:I,clone:I,body:I,bodyUsed:I,[Symbol.toStringTag]:{value:"Response",configurable:!0}}),Object.defineProperties(k,{json:I,redirect:I,error:I}),D.converters.XMLHttpRequestBodyInit=function(e,t,s){return"string"==typeof e?D.converters.USVString(e,t,s):D.is.Blob(e)||D.is.BufferSource(e)||D.is.FormData(e)||D.is.URLSearchParams(e)?e:D.converters.DOMString(e,t,s)},D.converters.BodyInit=function(e,t,s){return D.is.ReadableStream(e)||e?.[Symbol.asyncIterator]?e:D.converters.XMLHttpRequestBodyInit(e,t,s)},D.converters.ResponseInit=D.dictionaryConverter([{key:"status",converter:D.converters["unsigned short"],defaultValue:()=>200},{key:"statusText",converter:D.converters.ByteString,defaultValue:()=>""},{key:"headers",converter:D.converters.HeadersInit}]),D.is.Response=D.util.MakeTypeAssertion(k),e.exports={isNetworkError:function(e){return"error"===e.type&&0===e.status},makeNetworkError:P,makeResponse:H,makeAppropriateNetworkError:function(e,t=null){return N(B(e)),Q(e)?P(Object.assign(new DOMException("The operation was aborted.","AbortError"),{cause:t})):P(Object.assign(new DOMException("Request was cancelled."),{cause:t}))},filterResponse:Y,Response:k,cloneResponse:L,fromInnerResponse:O,getResponseState:M}},6686:(e,t,s)=>{"use strict";const{Transform:r}=s(7075),n=s(8522),{redirectStatusSet:A,referrerPolicyTokens:i,badPortsSet:o}=s(9441),{getGlobalOrigin:a}=s(2837),{collectASequenceOfCodePoints:c,collectAnHTTPQuotedString:l,removeChars:h,parseMIMEType:g}=s(9934),{performance:d}=s(643),{ReadableStreamFrom:u,isValidHTTPToken:E,normalizedMethodRecordsBase:I}=s(2858),C=s(4589),{isUint8Array:B}=s(3429),{webidl:Q}=s(6097);function p(e){const t=e.urlList,s=t.length;return 0===s?null:t[s-1].toString()}function f(e){for(let t=0;t<e.length;++t){const s=e.charCodeAt(t);if(s>126||s<32)return!1}return!0}function m(e){return e.urlList[e.urlList.length-1]}const y=E;function w(e){return!1===("\t"===e[0]||" "===e[0]||"\t"===e[e.length-1]||" "===e[e.length-1]||e.includes("\n")||e.includes("\r")||e.includes("\0"))}function S(e,t){return e}function D(){return{referrerPolicy:"strict-origin-when-cross-origin"}}function b(e,t=!1){return C(Q.is.URL(e)),P(e=new URL(e))?"no-referrer":(e.username="",e.password="",e.hash="",!0===t&&(e.pathname="",e.search=""),e)}const v=RegExp.prototype.test.bind(/^127\.(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]\d|\d)\.){2}(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]\d|\d)$/),N=RegExp.prototype.test.bind(/^(?:(?:0{1,4}:){7}|(?:0{1,4}:){1,6}:|::)0{0,3}1$/);function R(e){return e.includes(":")?("["===e[0]&&"]"===e[e.length-1]&&(e=e.slice(1,-1)),N(e)):v(e)}function k(e){return!!Q.is.URL(e)&&("about:blank"===e.href||"about:srcdoc"===e.href||("data:"===e.protocol||("blob:"===e.protocol||!(null==(t=e.origin)||"null"===t||"https:"!==(t=new URL(t)).protocol&&"wss:"!==t.protocol&&!R(t.hostname)&&"localhost"!==t.hostname&&"localhost."!==t.hostname&&!t.hostname.endsWith(".localhost")&&!t.hostname.endsWith(".localhost.")&&"file:"!==t.protocol))));var t}function T(e,t){return e.origin===t.origin&&"null"===e.origin||e.protocol===t.protocol&&e.hostname===t.hostname&&e.port===t.port}const F=Object.getPrototypeOf(Object.getPrototypeOf([][Symbol.iterator]()));function M(e,t,s=0,r=1){class n{#Ke;#et;#tt;constructor(e,t){this.#Ke=e,this.#et=t,this.#tt=0}next(){if("object"!=typeof this||null===this||!(#Ke in this))throw new TypeError(`'next' called on an object that does not implement interface ${e} Iterator.`);const n=this.#tt,A=t(this.#Ke);if(n>=A.length)return{value:void 0,done:!0};const{[s]:i,[r]:o}=A[n];let a;switch(this.#tt=n+1,this.#et){case"key":a=i;break;case"value":a=o;break;case"key+value":a=[i,o]}return{value:a,done:!1}}}return delete n.prototype.constructor,Object.setPrototypeOf(n.prototype,F),Object.defineProperties(n.prototype,{[Symbol.toStringTag]:{writable:!1,enumerable:!1,configurable:!0,value:`${e} Iterator`},next:{writable:!0,enumerable:!0,configurable:!0}}),function(e,t){return new n(e,t)}}const U=/[^\x00-\xFF]/;function L(e){return C(!U.test(e)),e}async function H(e,t,s){try{const r=[];let n=0;for(;;){const{done:A,value:i}=await e.read();if(A)return void t(Buffer.concat(r,n));if(!B(i))return void s(new TypeError("Received non-Uint8Array chunk"));r.push(i),n+=i.length}}catch(e){s(e)}}function P(e){C("protocol"in e);const t=e.protocol;return"about:"===t||"blob:"===t||"data:"===t}function x(e){return"string"==typeof e&&":"===e[5]&&"h"===e[0]&&"t"===e[1]&&"t"===e[2]&&"p"===e[3]&&"s"===e[4]||"https:"===e.protocol}function Y(e){C("protocol"in e);const t=e.protocol;return"http:"===t||"https:"===t}class V extends r{#st;constructor(e){super(),this.#st=e}_transform(e,t,s){if(!this._inflateStream){if(0===e.length)return void s();this._inflateStream=8==(15&e[0])?n.createInflate(this.#st):n.createInflateRaw(this.#st),this._inflateStream.on("data",this.push.bind(this)),this._inflateStream.on("end",(()=>this.push(null))),this._inflateStream.on("error",(e=>this.destroy(e)))}this._inflateStream.write(e,t,s)}_final(e){this._inflateStream&&(this._inflateStream.end(),this._inflateStream=null),e()}}function O(e,t){const s=t.get(e,!0);return null===s?null:function(e){const t=e,s={position:0},r=[];let n="";for(;s.position<t.length;){if(n+=c((e=>'"'!==e&&","!==e),t,s),s.position<t.length)if(34===t.charCodeAt(s.position)){if(n+=l(t,s),s.position<t.length)continue}else C(44===t.charCodeAt(s.position)),s.position++;n=h(n,!0,!0,(e=>9===e||32===e)),r.push(n),n=""}return r}(s)}const G=new TextDecoder;class J{get baseUrl(){return a()}get origin(){return this.baseUrl?.origin}policyContainer={referrerPolicy:"strict-origin-when-cross-origin"}}const W=new class{settingsObject=new J};e.exports={isAborted:function(e){return"aborted"===e.controller.state},isCancelled:function(e){return"aborted"===e.controller.state||"terminated"===e.controller.state},isValidEncodedURL:f,ReadableStreamFrom:u,tryUpgradeRequestToAPotentiallyTrustworthyURL:function(e){},clampAndCoarsenConnectionTimingInfo:function(e,t,s){return!e?.startTime||e.startTime<t?{domainLookupStartTime:t,domainLookupEndTime:t,connectionStartTime:t,connectionEndTime:t,secureConnectionStartTime:t,ALPNNegotiatedProtocol:e?.ALPNNegotiatedProtocol}:{domainLookupStartTime:S(e.domainLookupStartTime),domainLookupEndTime:S(e.domainLookupEndTime),connectionStartTime:S(e.connectionStartTime),connectionEndTime:S(e.connectionEndTime),secureConnectionStartTime:S(e.secureConnectionStartTime),ALPNNegotiatedProtocol:e.ALPNNegotiatedProtocol}},coarsenedSharedCurrentTime:function(e){return S(d.now())},determineRequestsReferrer:function(e){const t=e.referrerPolicy;C(t);let s=null;if("client"===e.referrer){const e=a();if(!e||"null"===e.origin)return"no-referrer";s=new URL(e)}else Q.is.URL(e.referrer)&&(s=e.referrer);let r=b(s);const n=b(s,!0);switch(r.toString().length>4096&&(r=n),t){case"no-referrer":return"no-referrer";case"origin":return null!=n?n:b(s,!0);case"unsafe-url":return r;case"strict-origin":{const t=m(e);return k(r)&&!k(t)?"no-referrer":n}case"strict-origin-when-cross-origin":{const t=m(e);return T(r,t)?r:k(r)&&!k(t)?"no-referrer":n}case"same-origin":return T(e,r)?r:"no-referrer";case"origin-when-cross-origin":return T(e,r)?r:n;case"no-referrer-when-downgrade":{const t=m(e);return k(r)&&!k(t)?"no-referrer":r}}},makePolicyContainer:D,clonePolicyContainer:function(e){return{referrerPolicy:e.referrerPolicy}},appendFetchMetadata:function(e){let t=null;t=e.mode,e.headersList.set("sec-fetch-mode",t,!0)},appendRequestOriginHeader:function(e){let t=e.origin;if("client"!==t&&void 0!==t)if("cors"===e.responseTainting||"websocket"===e.mode)e.headersList.append("origin",t,!0);else if("GET"!==e.method&&"HEAD"!==e.method){switch(e.referrerPolicy){case"no-referrer":t=null;break;case"no-referrer-when-downgrade":case"strict-origin":case"strict-origin-when-cross-origin":e.origin&&x(e.origin)&&!x(m(e))&&(t=null);break;case"same-origin":T(e,m(e))||(t=null)}e.headersList.append("origin",t,!0)}},TAOCheck:function(){return"success"},corsCheck:function(){return"success"},crossOriginResourcePolicyCheck:function(){return"allowed"},createOpaqueTimingInfo:function(e){return{startTime:e.startTime??0,redirectStartTime:0,redirectEndTime:0,postRedirectStartTime:e.startTime??0,finalServiceWorkerStartTime:0,finalNetworkResponseStartTime:0,finalNetworkRequestStartTime:0,endTime:0,encodedBodySize:0,decodedBodySize:0,finalConnectionTimingInfo:null}},setRequestReferrerPolicyOnRedirect:function(e,t){const s=function(e){const t=(e.headersList.get("referrer-policy",!0)??"").split(",");let s="";if(t.length)for(let e=t.length;0!==e;e--){const r=t[e-1].trim();if(i.has(r)){s=r;break}}return s}(t);""!==s&&(e.referrerPolicy=s)},isValidHTTPToken:E,requestBadPort:function(e){const t=m(e);return Y(t)&&o.has(t.port)?"blocked":"allowed"},requestCurrentURL:m,responseURL:p,responseLocationURL:function(e,t){if(!A.has(e.status))return null;let s=e.headersList.get("location",!0);var r;return null!==s&&w(s)&&(f(s)||(r=s,s=Buffer.from(r,"binary").toString("utf8")),s=new URL(s,p(e))),s&&!s.hash&&(s.hash=t),s},isURLPotentiallyTrustworthy:k,isValidReasonPhrase:function(e){for(let t=0;t<e.length;++t){const s=e.charCodeAt(t);if(!(9===s||s>=32&&s<=126||s>=128&&s<=255))return!1}return!0},sameOrigin:T,normalizeMethod:function(e){return I[e.toLowerCase()]??e},serializeJavascriptValueToJSONString:function(e){const t=JSON.stringify(e);if(void 0===t)throw new TypeError("Value is not JSON serializable");return C("string"==typeof t),t},iteratorMixin:function(e,t,s,r=0,n=1){const A=M(e,s,r,n),i={keys:{writable:!0,enumerable:!0,configurable:!0,value:function(){return Q.brandCheck(this,t),A(this,"key")}},values:{writable:!0,enumerable:!0,configurable:!0,value:function(){return Q.brandCheck(this,t),A(this,"value")}},entries:{writable:!0,enumerable:!0,configurable:!0,value:function(){return Q.brandCheck(this,t),A(this,"key+value")}},forEach:{writable:!0,enumerable:!0,configurable:!0,value:function(s,r=globalThis){if(Q.brandCheck(this,t),Q.argumentLengthCheck(arguments,1,`${e}.forEach`),"function"!=typeof s)throw new TypeError(`Failed to execute 'forEach' on '${e}': parameter 1 is not of type 'Function'.`);for(const{0:e,1:t}of A(this,"key+value"))s.call(r,t,e,this)}}};return Object.defineProperties(t.prototype,{...i,[Symbol.iterator]:{writable:!0,enumerable:!1,configurable:!0,value:i.entries.value}})},createIterator:M,isValidHeaderName:y,isValidHeaderValue:w,isErrorLike:function(e){return e instanceof Error||"Error"===e?.constructor?.name||"DOMException"===e?.constructor?.name},fullyReadBody:function(e,t,s){const r=t,n=s;try{H(e.stream.getReader(),r,n)}catch(e){n(e)}},readableStreamClose:function(e){try{e.close(),e.byobRequest?.respond(0)}catch(e){if(!e.message.includes("Controller is already closed")&&!e.message.includes("ReadableStream is already closed"))throw e}},isomorphicEncode:L,urlIsLocal:P,urlHasHttpsScheme:x,urlIsHttpHttpsScheme:Y,readAllBytes:H,simpleRangeHeaderValue:function(e,t){const s=e;if(!s.startsWith("bytes"))return"failure";const r={position:5};if(t&&c((e=>"\t"===e||" "===e),s,r),61!==s.charCodeAt(r.position))return"failure";r.position++,t&&c((e=>"\t"===e||" "===e),s,r);const n=c((e=>{const t=e.charCodeAt(0);return t>=48&&t<=57}),s,r),A=n.length?Number(n):null;if(t&&c((e=>"\t"===e||" "===e),s,r),45!==s.charCodeAt(r.position))return"failure";r.position++,t&&c((e=>"\t"===e||" "===e),s,r);const i=c((e=>{const t=e.charCodeAt(0);return t>=48&&t<=57}),s,r),o=i.length?Number(i):null;return r.position<s.length||null===o&&null===A||A>o?"failure":{rangeStartValue:A,rangeEndValue:o}},buildContentRange:function(e,t,s){let r="bytes ";return r+=L(`${e}`),r+="-",r+=L(`${t}`),r+="/",r+=L(`${s}`),r},createInflate:function(e){return new V(e)},extractMimeType:function(e){let t=null,s=null,r=null;const n=O("content-type",e);if(null===n)return"failure";for(const e of n){const n=g(e);"failure"!==n&&"*/*"!==n.essence&&(r=n,r.essence!==s?(t=null,r.parameters.has("charset")&&(t=r.parameters.get("charset")),s=r.essence):r.parameters.has("charset")||null===t||r.parameters.set("charset",t))}return null==r?"failure":r},getDecodeSplit:O,utf8DecodeBytes:function(e){return 0===e.length?"":(239===e[0]&&187===e[1]&&191===e[2]&&(e=e.subarray(3)),G.decode(e))},environmentSettingsObject:W,isOriginIPPotentiallyTrustworthy:R}},7420:(e,t,s)=>{"use strict";const r=s(4589),n=new Map([["sha256",0],["sha384",1],["sha512",2]]);let A;try{A=s(7598);const e=A.getHashes();0===e.length&&n.clear();for(const t of n.keys())!1===e.includes(t)&&n.delete(t)}catch{n.clear()}const i=Map.prototype.get.bind(n),o=Map.prototype.has.bind(n),a=void 0===A||0===n.size?()=>!0:(e,t)=>{const s=l(t);if(0===s.length)return!0;const r=c(s);for(const t of r){const s=t.alg,r=t.val;if(g(h(s,e),r))return!0}return!1};function c(e){const t=[];let s=null;for(const n of e){if(r(o(n.alg),"Invalid SRI hash algorithm token"),0===t.length){t.push(n),s=n;continue}const e=s.alg,A=i(e),a=n.alg,c=i(a);c<A||(c>A?(s=n,t[0]=n,t.length=1):t.push(n))}return t}function l(e){const t=[];for(const s of e.split(" ")){const e=s.split("?",1)[0];let r="";const n=[e.slice(0,6),e.slice(7)],A=n[0];if(!o(A))continue;n[1]&&(r=n[1]);const i={alg:A,val:r};t.push(i)}return t}const h=(e,t)=>A.hash(e,t,"base64");function g(e,t){let s=e.length;0!==s&&"="===e[s-1]&&(s-=1),0!==s&&"="===e[s-1]&&(s-=1);let r=t.length;if(0!==r&&"="===t[r-1]&&(r-=1),0!==r&&"="===t[r-1]&&(r-=1),s!==r)return!1;for(let r=0;r<s;++r)if(!(e[r]===t[r]||"+"===e[r]&&"-"===t[r]||"/"===e[r]&&"_"===t[r]))return!1;return!0}e.exports={applyAlgorithmToBytes:h,bytesMatch:a,caseSensitiveMatch:g,isValidSRIHashAlgorithm:o,getStrongestMetadata:c,parseMetadata:l}},6097:(e,t,s)=>{"use strict";const{types:r,inspect:n}=s(7975),{markAsUncloneable:A}=s(5919),i=Function.call.bind(Function.prototype[Symbol.hasInstance]),o={converters:{},util:{},errors:{},is:{}};o.errors.exception=function(e){return new TypeError(`${e.header}: ${e.message}`)},o.errors.conversionFailed=function(e){const t=1===e.types.length?"":" one of",s=`${e.argument} could not be converted to${t}: ${e.types.join(", ")}.`;return o.errors.exception({header:e.prefix,message:s})},o.errors.invalidArgument=function(e){return o.errors.exception({header:e.prefix,message:`"${e.value}" is an invalid ${e.type}.`})},o.brandCheck=function(e,t){if(!i(t,e)){const e=new TypeError("Illegal invocation");throw e.code="ERR_INVALID_THIS",e}},o.brandCheckMultiple=function(e){const t=e.map((e=>o.util.MakeTypeAssertion(e)));return e=>{if(t.every((t=>!t(e)))){const e=new TypeError("Illegal invocation");throw e.code="ERR_INVALID_THIS",e}}},o.argumentLengthCheck=function({length:e},t,s){if(e<t)throw o.errors.exception({message:`${t} argument${1!==t?"s":""} required, but${e?" only":""} ${e} found.`,header:s})},o.illegalConstructor=function(){throw o.errors.exception({header:"TypeError",message:"Illegal constructor"})},o.util.MakeTypeAssertion=function(e){return t=>i(e,t)},o.util.Type=function(e){switch(typeof e){case"undefined":return 1;case"boolean":return 2;case"string":return 3;case"symbol":return 4;case"number":return 5;case"bigint":return 6;case"function":case"object":return null===e?7:8}},o.util.Types={UNDEFINED:1,BOOLEAN:2,STRING:3,SYMBOL:4,NUMBER:5,BIGINT:6,NULL:7,OBJECT:8},o.util.TypeValueToString=function(e){switch(o.util.Type(e)){case 1:return"Undefined";case 2:return"Boolean";case 3:return"String";case 4:return"Symbol";case 5:return"Number";case 6:return"BigInt";case 7:return"Null";case 8:return"Object"}},o.util.markAsUncloneable=A||(()=>{}),o.util.ConvertToInt=function(e,t,s,r){let n,A;64===t?(n=Math.pow(2,53)-1,A="unsigned"===s?0:Math.pow(-2,53)+1):"unsigned"===s?(A=0,n=Math.pow(2,t)-1):(A=Math.pow(-2,t)-1,n=Math.pow(2,t-1)-1);let i=Number(e);if(0===i&&(i=0),o.util.HasFlag(r,o.attributes.EnforceRange)){if(Number.isNaN(i)||i===Number.POSITIVE_INFINITY||i===Number.NEGATIVE_INFINITY)throw o.errors.exception({header:"Integer conversion",message:`Could not convert ${o.util.Stringify(e)} to an integer.`});if(i=o.util.IntegerPart(i),i<A||i>n)throw o.errors.exception({header:"Integer conversion",message:`Value must be between ${A}-${n}, got ${i}.`});return i}return!Number.isNaN(i)&&o.util.HasFlag(r,o.attributes.Clamp)?(i=Math.min(Math.max(i,A),n),i=Math.floor(i)%2==0?Math.floor(i):Math.ceil(i),i):Number.isNaN(i)||0===i&&Object.is(0,i)||i===Number.POSITIVE_INFINITY||i===Number.NEGATIVE_INFINITY?0:(i=o.util.IntegerPart(i),i%=Math.pow(2,t),"signed"===s&&i>=Math.pow(2,t)-1?i-Math.pow(2,t):i)},o.util.IntegerPart=function(e){const t=Math.floor(Math.abs(e));return e<0?-1*t:t},o.util.Stringify=function(e){switch(o.util.Type(e)){case 4:return`Symbol(${e.description})`;case 8:return n(e);case 3:return`"${e}"`;case 6:return`${e}n`;default:return`${e}`}},o.util.IsResizableArrayBuffer=function(e){if(r.isArrayBuffer(e))return e.resizable;if(r.isSharedArrayBuffer(e))return e.growable;throw o.errors.exception({header:"IsResizableArrayBuffer",message:`"${o.util.Stringify(e)}" is not an array buffer.`})},o.util.HasFlag=function(e,t){return"number"==typeof e&&(e&t)===t},o.sequenceConverter=function(e){return(t,s,r,n)=>{if(8!==o.util.Type(t))throw o.errors.exception({header:s,message:`${r} (${o.util.Stringify(t)}) is not iterable.`});const A="function"==typeof n?n():t?.[Symbol.iterator]?.(),i=[];let a=0;if(void 0===A||"function"!=typeof A.next)throw o.errors.exception({header:s,message:`${r} is not iterable.`});for(;;){const{done:t,value:n}=A.next();if(t)break;i.push(e(n,s,`${r}[${a++}]`))}return i}},o.recordConverter=function(e,t){return(s,n,A)=>{if(8!==o.util.Type(s))throw o.errors.exception({header:n,message:`${A} ("${o.util.TypeValueToString(s)}") is not an Object.`});const i={};if(!r.isProxy(s)){const r=[...Object.getOwnPropertyNames(s),...Object.getOwnPropertySymbols(s)];for(const a of r){const r=o.util.Stringify(a),c=e(a,n,`Key ${r} in ${A}`),l=t(s[a],n,`${A}[${r}]`);i[c]=l}return i}const a=Reflect.ownKeys(s);for(const r of a){const o=Reflect.getOwnPropertyDescriptor(s,r);if(o?.enumerable){const o=e(r,n,A),a=t(s[r],n,A);i[o]=a}}return i}},o.interfaceConverter=function(e,t){return(s,r,n)=>{if(!e(s))throw o.errors.exception({header:r,message:`Expected ${n} ("${o.util.Stringify(s)}") to be an instance of ${t}.`});return s}},o.dictionaryConverter=function(e){return(t,s,r)=>{const n={};if(null!=t&&8!==o.util.Type(t))throw o.errors.exception({header:s,message:`Expected ${t} to be one of: Null, Undefined, Object.`});for(const A of e){const{key:e,defaultValue:i,required:a,converter:c}=A;if(!0===a&&(null==t||!Object.hasOwn(t,e)))throw o.errors.exception({header:s,message:`Missing required key "${e}".`});let l=t?.[e];const h=void 0!==i;if(h&&void 0===l&&(l=i()),a||h||void 0!==l){if(l=c(l,s,`${r}.${e}`),A.allowedValues&&!A.allowedValues.includes(l))throw o.errors.exception({header:s,message:`${l} is not an accepted type. Expected one of ${A.allowedValues.join(", ")}.`});n[e]=l}}return n}},o.nullableConverter=function(e){return(t,s,r)=>null===t?t:e(t,s,r)},o.is.USVString=function(e){return"string"==typeof e&&e.isWellFormed()},o.is.ReadableStream=o.util.MakeTypeAssertion(ReadableStream),o.is.Blob=o.util.MakeTypeAssertion(Blob),o.is.URLSearchParams=o.util.MakeTypeAssertion(URLSearchParams),o.is.File=o.util.MakeTypeAssertion(File),o.is.URL=o.util.MakeTypeAssertion(URL),o.is.AbortSignal=o.util.MakeTypeAssertion(AbortSignal),o.is.MessagePort=o.util.MakeTypeAssertion(MessagePort),o.is.BufferSource=function(e){return r.isArrayBuffer(e)||ArrayBuffer.isView(e)&&r.isArrayBuffer(e.buffer)},o.converters.DOMString=function(e,t,s,r){if(null===e&&o.util.HasFlag(r,o.attributes.LegacyNullToEmptyString))return"";if("symbol"==typeof e)throw o.errors.exception({header:t,message:`${s} is a symbol, which cannot be converted to a DOMString.`});return String(e)},o.converters.ByteString=function(e,t,s){if("symbol"==typeof e)throw o.errors.exception({header:t,message:`${s} is a symbol, which cannot be converted to a ByteString.`});const r=String(e);for(let e=0;e<r.length;e++)if(r.charCodeAt(e)>255)throw new TypeError(`Cannot convert argument to a ByteString because the character at index ${e} has a value of ${r.charCodeAt(e)} which is greater than 255.`);return r},o.converters.USVString=function(e){return"string"==typeof e?e.toWellFormed():`${e}`.toWellFormed()},o.converters.boolean=function(e){return Boolean(e)},o.converters.any=function(e){return e},o.converters["long long"]=function(e,t,s){return o.util.ConvertToInt(e,64,"signed",0,t,s)},o.converters["unsigned long long"]=function(e,t,s){return o.util.ConvertToInt(e,64,"unsigned",0,t,s)},o.converters["unsigned long"]=function(e,t,s){return o.util.ConvertToInt(e,32,"unsigned",0,t,s)},o.converters["unsigned short"]=function(e,t,s,r){return o.util.ConvertToInt(e,16,"unsigned",r,t,s)},o.converters.ArrayBuffer=function(e,t,s,n){if(8!==o.util.Type(e)||!r.isArrayBuffer(e))throw o.errors.conversionFailed({prefix:t,argument:`${s} ("${o.util.Stringify(e)}")`,types:["ArrayBuffer"]});if(!o.util.HasFlag(n,o.attributes.AllowResizable)&&o.util.IsResizableArrayBuffer(e))throw o.errors.exception({header:t,message:`${s} cannot be a resizable ArrayBuffer.`});return e},o.converters.SharedArrayBuffer=function(e,t,s,n){if(8!==o.util.Type(e)||!r.isSharedArrayBuffer(e))throw o.errors.conversionFailed({prefix:t,argument:`${s} ("${o.util.Stringify(e)}")`,types:["SharedArrayBuffer"]});if(!o.util.HasFlag(n,o.attributes.AllowResizable)&&o.util.IsResizableArrayBuffer(e))throw o.errors.exception({header:t,message:`${s} cannot be a resizable SharedArrayBuffer.`});return e},o.converters.TypedArray=function(e,t,s,n,A){if(8!==o.util.Type(e)||!r.isTypedArray(e)||e.constructor.name!==t.name)throw o.errors.conversionFailed({prefix:s,argument:`${n} ("${o.util.Stringify(e)}")`,types:[t.name]});if(!o.util.HasFlag(A,o.attributes.AllowShared)&&r.isSharedArrayBuffer(e.buffer))throw o.errors.exception({header:s,message:`${n} cannot be a view on a shared array buffer.`});if(!o.util.HasFlag(A,o.attributes.AllowResizable)&&o.util.IsResizableArrayBuffer(e.buffer))throw o.errors.exception({header:s,message:`${n} cannot be a view on a resizable array buffer.`});return e},o.converters.DataView=function(e,t,s,n){if(8!==o.util.Type(e)||!r.isDataView(e))throw o.errors.conversionFailed({prefix:t,argument:`${s} ("${o.util.Stringify(e)}")`,types:["DataView"]});if(!o.util.HasFlag(n,o.attributes.AllowShared)&&r.isSharedArrayBuffer(e.buffer))throw o.errors.exception({header:t,message:`${s} cannot be a view on a shared array buffer.`});if(!o.util.HasFlag(n,o.attributes.AllowResizable)&&o.util.IsResizableArrayBuffer(e.buffer))throw o.errors.exception({header:t,message:`${s} cannot be a view on a resizable array buffer.`});return e},o.converters.ArrayBufferView=function(e,t,s,n){if(8!==o.util.Type(e)||!r.isArrayBufferView(e))throw o.errors.conversionFailed({prefix:t,argument:`${s} ("${o.util.Stringify(e)}")`,types:["ArrayBufferView"]});if(!o.util.HasFlag(n,o.attributes.AllowShared)&&r.isSharedArrayBuffer(e.buffer))throw o.errors.exception({header:t,message:`${s} cannot be a view on a shared array buffer.`});if(!o.util.HasFlag(n,o.attributes.AllowResizable)&&o.util.IsResizableArrayBuffer(e.buffer))throw o.errors.exception({header:t,message:`${s} cannot be a view on a resizable array buffer.`});return e},o.converters.BufferSource=function(e,t,s,n){if(r.isArrayBuffer(e))return o.converters.ArrayBuffer(e,t,s,n);if(r.isArrayBufferView(e))return n&=~o.attributes.AllowShared,o.converters.ArrayBufferView(e,t,s,n);if(r.isSharedArrayBuffer(e))throw o.errors.exception({header:t,message:`${s} cannot be a SharedArrayBuffer.`});throw o.errors.conversionFailed({prefix:t,argument:`${s} ("${o.util.Stringify(e)}")`,types:["ArrayBuffer","ArrayBufferView"]})},o.converters.AllowSharedBufferSource=function(e,t,s,n){if(r.isArrayBuffer(e))return o.converters.ArrayBuffer(e,t,s,n);if(r.isSharedArrayBuffer(e))return o.converters.SharedArrayBuffer(e,t,s,n);if(r.isArrayBufferView(e))return n|=o.attributes.AllowShared,o.converters.ArrayBufferView(e,t,s,n);throw o.errors.conversionFailed({prefix:t,argument:`${s} ("${o.util.Stringify(e)}")`,types:["ArrayBuffer","SharedArrayBuffer","ArrayBufferView"]})},o.converters["sequence<ByteString>"]=o.sequenceConverter(o.converters.ByteString),o.converters["sequence<sequence<ByteString>>"]=o.sequenceConverter(o.converters["sequence<ByteString>"]),o.converters["record<ByteString, ByteString>"]=o.recordConverter(o.converters.ByteString,o.converters.ByteString),o.converters.Blob=o.interfaceConverter(o.is.Blob,"Blob"),o.converters.AbortSignal=o.interfaceConverter(o.is.AbortSignal,"AbortSignal"),o.converters.EventHandlerNonNull=function(e){return 8!==o.util.Type(e)?null:"function"==typeof e?e:()=>{}},o.attributes={Clamp:1,EnforceRange:2,AllowShared:4,AllowResizable:8,LegacyNullToEmptyString:16},e.exports={webidl:o}},8251:(e,t,s)=>{"use strict";const{uid:r,states:n,sentCloseFrameState:A,emptyBuffer:i,opcodes:o}=s(6490),{parseExtensions:a,isClosed:c,isClosing:l,isEstablished:h,validateCloseCodeAndReason:g}=s(8983),{makeRequest:d}=s(4609),{fetching:u}=s(7388),{Headers:E,getHeadersList:I}=s(6558),{getDecodeSplit:C}=s(6686),{WebsocketFrameSend:B}=s(6834),Q=s(4589);let p;try{p=s(7598)}catch{}function f(e,t,s,r=!1){if(t??=null,s??="",r&&g(t,s),c(e.readyState)||l(e.readyState));else if(h(e.readyState))if(e.closeState.has(A.SENT)||e.closeState.has(A.RECEIVED))e.readyState=n.CLOSING;else{const r=new B;0!==s.length&&null===t&&(t=1e3),Q(null===t||Number.isInteger(t)),null===t&&0===s.length?r.frameData=i:null!==t&&null===s?(r.frameData=Buffer.allocUnsafe(2),r.frameData.writeUInt16BE(t,0)):null!==t&&null!==s?(r.frameData=Buffer.allocUnsafe(2+Buffer.byteLength(s)),r.frameData.writeUInt16BE(t,0),r.frameData.write(s,2,"utf-8")):r.frameData=i,e.socket.write(r.createFrame(o.CLOSE)),e.closeState.add(A.SENT),e.readyState=n.CLOSING}else m(e),e.readyState=n.CLOSING}function m(e,t,s,r){h(e.readyState)&&f(e,t,s,!1),e.controller.abort(),e.socket?!1===e.socket.destroyed&&e.socket.destroy():e.onSocketClose()}e.exports={establishWebSocketConnection:function(e,t,s,A,i){const o=e;o.protocol="ws:"===e.protocol?"http:":"https:";const c=d({urlList:[o],client:s,serviceWorkers:"none",referrer:"no-referrer",mode:"websocket",credentials:"include",cache:"no-store",redirect:"error"});if(i.headers){const e=I(new E(i.headers));c.headersList=e}const l=p.randomBytes(16).toString("base64");c.headersList.append("sec-websocket-key",l,!0),c.headersList.append("sec-websocket-version","13",!0);for(const e of t)c.headersList.append("sec-websocket-protocol",e,!0);return c.headersList.append("sec-websocket-extensions","permessage-deflate; client_max_window_bits",!0),u({request:c,useParallelQueue:!0,dispatcher:i.dispatcher,processResponse(e){if("error"===e.type&&(A.readyState=n.CLOSED),"error"===e.type||101!==e.status)return void m(A,1002,"Received network error or non-101 status code.",e.error);if(0!==t.length&&!e.headersList.get("Sec-WebSocket-Protocol"))return void m(A,1002,"Server did not respond with sent protocols.");if("websocket"!==e.headersList.get("Upgrade")?.toLowerCase())return void m(A,1002,'Server did not set Upgrade header to "websocket".');if("upgrade"!==e.headersList.get("Connection")?.toLowerCase())return void m(A,1002,'Server did not set Connection header to "upgrade".');if(e.headersList.get("Sec-WebSocket-Accept")!==p.createHash("sha1").update(l+r).digest("base64"))return void m(A,1002,"Incorrect hash received in Sec-WebSocket-Accept header.");const s=e.headersList.get("Sec-WebSocket-Extensions");let i;if(null!==s&&(i=a(s),!i.has("permessage-deflate")))return void m(A,1002,"Sec-WebSocket-Extensions header does not match.");const o=e.headersList.get("Sec-WebSocket-Protocol");if(null!==o){if(!C("sec-websocket-protocol",c.headersList).includes(o))return void m(A,1002,"Protocol was not set in the opening handshake.")}e.socket.on("data",A.onSocketData),e.socket.on("close",A.onSocketClose),e.socket.on("error",A.onSocketError),A.wasEverConnected=!0,A.onConnectionEstablished(e,i)}})},failWebsocketConnection:m,closeWebSocketConnection:f}},6490:e=>{"use strict";const t=Buffer.allocUnsafe(0);e.exports={uid:"258EAFA5-E914-47DA-95CA-C5AB0DC85B11",sentCloseFrameState:{SENT:1,RECEIVED:2},staticPropertyDescriptors:{enumerable:!0,writable:!1,configurable:!1},states:{CONNECTING:0,OPEN:1,CLOSING:2,CLOSED:3},opcodes:{CONTINUATION:0,TEXT:1,BINARY:2,CLOSE:8,PING:9,PONG:10},maxUnsigned16Bit:65535,parserStates:{INFO:0,PAYLOADLENGTH_16:2,PAYLOADLENGTH_64:3,READ_DATA:4},emptyBuffer:t,sendHints:{text:1,typedArray:2,arrayBuffer:3,blob:4}}},878:(e,t,s)=>{"use strict";const{webidl:r}=s(6097),{kEnumerableProperty:n}=s(2858),{kConstruct:A}=s(257);class i extends Event{#rt;constructor(e,t={}){if(e===A)return super(arguments[1],arguments[2]),void r.util.markAsUncloneable(this);const s="MessageEvent constructor";r.argumentLengthCheck(arguments,1,s),super(e=r.converters.DOMString(e,s,"type"),t=r.converters.MessageEventInit(t,s,"eventInitDict")),this.#rt=t,r.util.markAsUncloneable(this)}get data(){return r.brandCheck(this,i),this.#rt.data}get origin(){return r.brandCheck(this,i),this.#rt.origin}get lastEventId(){return r.brandCheck(this,i),this.#rt.lastEventId}get source(){return r.brandCheck(this,i),this.#rt.source}get ports(){return r.brandCheck(this,i),Object.isFrozen(this.#rt.ports)||Object.freeze(this.#rt.ports),this.#rt.ports}initMessageEvent(e,t=!1,s=!1,n=null,A="",o="",a=null,c=[]){return r.brandCheck(this,i),r.argumentLengthCheck(arguments,1,"MessageEvent.initMessageEvent"),new i(e,{bubbles:t,cancelable:s,data:n,origin:A,lastEventId:o,source:a,ports:c})}static createFastMessageEvent(e,t){const s=new i(A,e,t);return s.#rt=t,s.#rt.data??=null,s.#rt.origin??="",s.#rt.lastEventId??="",s.#rt.source??=null,s.#rt.ports??=[],s}}const{createFastMessageEvent:o}=i;delete i.createFastMessageEvent;class a extends Event{#rt;constructor(e,t={}){const s="CloseEvent constructor";r.argumentLengthCheck(arguments,1,s),super(e=r.converters.DOMString(e,s,"type"),t=r.converters.CloseEventInit(t)),this.#rt=t,r.util.markAsUncloneable(this)}get wasClean(){return r.brandCheck(this,a),this.#rt.wasClean}get code(){return r.brandCheck(this,a),this.#rt.code}get reason(){return r.brandCheck(this,a),this.#rt.reason}}class c extends Event{#rt;constructor(e,t){const s="ErrorEvent constructor";r.argumentLengthCheck(arguments,1,s),super(e,t),r.util.markAsUncloneable(this),e=r.converters.DOMString(e,s,"type"),t=r.converters.ErrorEventInit(t??{}),this.#rt=t}get message(){return r.brandCheck(this,c),this.#rt.message}get filename(){return r.brandCheck(this,c),this.#rt.filename}get lineno(){return r.brandCheck(this,c),this.#rt.lineno}get colno(){return r.brandCheck(this,c),this.#rt.colno}get error(){return r.brandCheck(this,c),this.#rt.error}}Object.defineProperties(i.prototype,{[Symbol.toStringTag]:{value:"MessageEvent",configurable:!0},data:n,origin:n,lastEventId:n,source:n,ports:n,initMessageEvent:n}),Object.defineProperties(a.prototype,{[Symbol.toStringTag]:{value:"CloseEvent",configurable:!0},reason:n,code:n,wasClean:n}),Object.defineProperties(c.prototype,{[Symbol.toStringTag]:{value:"ErrorEvent",configurable:!0},message:n,filename:n,lineno:n,colno:n,error:n}),r.converters.MessagePort=r.interfaceConverter(r.is.MessagePort,"MessagePort"),r.converters["sequence<MessagePort>"]=r.sequenceConverter(r.converters.MessagePort);const l=[{key:"bubbles",converter:r.converters.boolean,defaultValue:()=>!1},{key:"cancelable",converter:r.converters.boolean,defaultValue:()=>!1},{key:"composed",converter:r.converters.boolean,defaultValue:()=>!1}];r.converters.MessageEventInit=r.dictionaryConverter([...l,{key:"data",converter:r.converters.any,defaultValue:()=>null},{key:"origin",converter:r.converters.USVString,defaultValue:()=>""},{key:"lastEventId",converter:r.converters.DOMString,defaultValue:()=>""},{key:"source",converter:r.nullableConverter(r.converters.MessagePort),defaultValue:()=>null},{key:"ports",converter:r.converters["sequence<MessagePort>"],defaultValue:()=>[]}]),r.converters.CloseEventInit=r.dictionaryConverter([...l,{key:"wasClean",converter:r.converters.boolean,defaultValue:()=>!1},{key:"code",converter:r.converters["unsigned short"],defaultValue:()=>0},{key:"reason",converter:r.converters.USVString,defaultValue:()=>""}]),r.converters.ErrorEventInit=r.dictionaryConverter([...l,{key:"message",converter:r.converters.DOMString,defaultValue:()=>""},{key:"filename",converter:r.converters.USVString,defaultValue:()=>""},{key:"lineno",converter:r.converters["unsigned long"],defaultValue:()=>0},{key:"colno",converter:r.converters["unsigned long"],defaultValue:()=>0},{key:"error",converter:r.converters.any}]),e.exports={MessageEvent:i,CloseEvent:a,ErrorEvent:c,createFastMessageEvent:o}},6834:(e,t,s)=>{"use strict";const{maxUnsigned16Bit:r,opcodes:n}=s(6490),A=8192;let i,o=null,a=A;try{i=s(7598)}catch{i={randomFillSync:function(e,t,s){for(let t=0;t<e.length;++t)e[t]=255*Math.random()|0;return e}}}function c(){return a===A&&(a=0,i.randomFillSync(o??=Buffer.allocUnsafeSlow(A),0,A)),[o[a++],o[a++],o[a++],o[a++]]}e.exports={WebsocketFrameSend:class{constructor(e){this.frameData=e}createFrame(e){const t=this.frameData,s=c(),n=t?.byteLength??0;let A=n,i=6;n>r?(i+=8,A=127):n>125&&(i+=2,A=126);const o=Buffer.allocUnsafe(n+i);o[0]=o[1]=0,o[0]|=128,o[0]=(240&o[0])+e,o[i-4]=s[0],o[i-3]=s[1],o[i-2]=s[2],o[i-1]=s[3],o[1]=A,126===A?o.writeUInt16BE(n,2):127===A&&(o[2]=o[3]=0,o.writeUIntBE(n,4,6)),o[1]|=128;for(let e=0;e<n;++e)o[i+e]=t[e]^s[3&e];return o}static createFastTextFrame(e){const t=c(),s=e.length;for(let r=0;r<s;++r)e[r]^=t[3&r];let A=s,i=6;s>r?(i+=8,A=127):s>125&&(i+=2,A=126);const o=Buffer.allocUnsafeSlow(i);return o[0]=128|n.TEXT,o[1]=128|A,o[i-4]=t[0],o[i-3]=t[1],o[i-2]=t[2],o[i-1]=t[3],126===A?o.writeUInt16BE(s,2):127===A&&(o[2]=o[3]=0,o.writeUIntBE(s,4,6)),[o,e]}},generateMask:c}},8975:(e,t,s)=>{"use strict";const{createInflateRaw:r,Z_DEFAULT_WINDOWBITS:n}=s(8522),{isValidClientWindowBits:A}=s(8983),i=Buffer.from([0,0,255,255]),o=Symbol("kBuffer"),a=Symbol("kLength");e.exports={PerMessageDeflate:class{#nt;#R={};constructor(e){this.#R.serverNoContextTakeover=e.has("server_no_context_takeover"),this.#R.serverMaxWindowBits=e.get("server_max_window_bits")}decompress(e,t,s){if(!this.#nt){let e=n;if(this.#R.serverMaxWindowBits){if(!A(this.#R.serverMaxWindowBits))return void s(new Error("Invalid server_max_window_bits"));e=Number.parseInt(this.#R.serverMaxWindowBits)}this.#nt=r({windowBits:e}),this.#nt[o]=[],this.#nt[a]=0,this.#nt.on("data",(e=>{this.#nt[o].push(e),this.#nt[a]+=e.length})),this.#nt.on("error",(e=>{this.#nt=null,s(e)}))}this.#nt.write(e),t&&this.#nt.write(i),this.#nt.flush((()=>{const e=Buffer.concat(this.#nt[o],this.#nt[a]);this.#nt[o].length=0,this.#nt[a]=0,s(null,e)}))}}}},834:(e,t,s)=>{"use strict";const{Writable:r}=s(7075),n=s(4589),{parserStates:A,opcodes:i,states:o,emptyBuffer:a,sentCloseFrameState:c}=s(6490),{isValidStatusCode:l,isValidOpcode:h,websocketMessageReceived:g,utf8Decode:d,isControlFrame:u,isTextBinaryFrame:E,isContinuationFrame:I}=s(8983),{failWebsocketConnection:C}=s(8251),{WebsocketFrameSend:B}=s(6834),{PerMessageDeflate:Q}=s(8975);e.exports={ByteParser:class extends r{#At=[];#it=0;#ot=0;#at=!1;#le=A.INFO;#ct={};#lt=[];#ht;#U;constructor(e,t){super(),this.#U=e,this.#ht=null==t?new Map:t,this.#ht.has("permessage-deflate")&&this.#ht.set("permessage-deflate",new Q(t))}_write(e,t,s){this.#At.push(e),this.#ot+=e.length,this.#at=!0,this.run(s)}run(e){for(;this.#at;)if(this.#le===A.INFO){if(this.#ot<2)return e();const t=this.consume(2),s=!!(128&t[0]),r=15&t[0],n=!(128&~t[1]),o=!s&&r!==i.CONTINUATION,a=127&t[1],c=64&t[0],l=32&t[0],g=16&t[0];if(!h(r))return C(this.#U,1002,"Invalid opcode received"),e();if(n)return C(this.#U,1002,"Frame cannot be masked"),e();if(0!==c&&!this.#ht.has("permessage-deflate"))return void C(this.#U,1002,"Expected RSV1 to be clear.");if(0!==l||0!==g)return void C(this.#U,1002,"RSV1, RSV2, RSV3 must be clear");if(o&&!E(r))return void C(this.#U,1002,"Invalid frame type was fragmented.");if(E(r)&&this.#lt.length>0)return void C(this.#U,1002,"Expected continuation frame");if(this.#ct.fragmented&&o)return void C(this.#U,1002,"Fragmented frame exceeded 125 bytes.");if((a>125||o)&&u(r))return void C(this.#U,1002,"Control frame either too large or fragmented");if(I(r)&&0===this.#lt.length&&!this.#ct.compressed)return void C(this.#U,1002,"Unexpected continuation frame");a<=125?(this.#ct.payloadLength=a,this.#le=A.READ_DATA):126===a?this.#le=A.PAYLOADLENGTH_16:127===a&&(this.#le=A.PAYLOADLENGTH_64),E(r)&&(this.#ct.binaryType=r,this.#ct.compressed=0!==c),this.#ct.opcode=r,this.#ct.masked=n,this.#ct.fin=s,this.#ct.fragmented=o}else if(this.#le===A.PAYLOADLENGTH_16){if(this.#ot<2)return e();const t=this.consume(2);this.#ct.payloadLength=t.readUInt16BE(0),this.#le=A.READ_DATA}else if(this.#le===A.PAYLOADLENGTH_64){if(this.#ot<8)return e();const t=this.consume(8),s=t.readUInt32BE(0);if(s>2**31-1)return void C(this.#U,1009,"Received payload length > 2^31 bytes.");const r=t.readUInt32BE(4);this.#ct.payloadLength=(s<<8)+r,this.#le=A.READ_DATA}else if(this.#le===A.READ_DATA){if(this.#ot<this.#ct.payloadLength)return e();const t=this.consume(this.#ct.payloadLength);if(u(this.#ct.opcode))this.#at=this.parseControlFrame(t),this.#le=A.INFO;else{if(this.#ct.compressed){this.#ht.get("permessage-deflate").decompress(t,this.#ct.fin,((t,s)=>{if(t)C(this.#U,1007,t.message);else{if(this.writeFragments(s),!this.#ct.fin)return this.#le=A.INFO,this.#at=!0,void this.run(e);g(this.#U,this.#ct.binaryType,this.consumeFragments()),this.#at=!0,this.#le=A.INFO,this.run(e)}})),this.#at=!1;break}this.writeFragments(t),!this.#ct.fragmented&&this.#ct.fin&&g(this.#U,this.#ct.binaryType,this.consumeFragments()),this.#le=A.INFO}}}consume(e){if(e>this.#ot)throw new Error("Called consume() before buffers satiated.");if(0===e)return a;this.#ot-=e;const t=this.#At[0];if(t.length>e)return this.#At[0]=t.subarray(e,t.length),t.subarray(0,e);if(t.length===e)return this.#At.shift();{let t=0;const s=Buffer.allocUnsafeSlow(e);for(;t!==e;){const r=this.#At[0],n=r.length;if(n+t===e){s.set(this.#At.shift(),t);break}if(n+t>e){s.set(r.subarray(0,e-t),t),this.#At[0]=r.subarray(e-t);break}s.set(this.#At.shift(),t),t+=n}return s}}writeFragments(e){this.#it+=e.length,this.#lt.push(e)}consumeFragments(){const e=this.#lt;if(1===e.length)return this.#it=0,e.shift();let t=0;const s=Buffer.allocUnsafeSlow(this.#it);for(let r=0;r<e.length;++r){const n=e[r];s.set(n,t),t+=n.length}return this.#lt=[],this.#it=0,s}parseCloseBody(e){let t;if(n(1!==e.length),e.length>=2&&(t=e.readUInt16BE(0)),void 0!==t&&!l(t))return{code:1002,reason:"Invalid status code",error:!0};let s=e.subarray(2);239===s[0]&&187===s[1]&&191===s[2]&&(s=s.subarray(3));try{s=d(s)}catch{return{code:1007,reason:"Invalid UTF-8",error:!0}}return{code:t,reason:s,error:!1}}parseControlFrame(e){const{opcode:t,payloadLength:s}=this.#ct;if(t===i.CLOSE){if(1===s)return C(this.#U,1002,"Received close frame with a 1-byte body."),!1;if(this.#ct.closeInfo=this.parseCloseBody(e),this.#ct.closeInfo.error){const{code:e,reason:t}=this.#ct.closeInfo;return C(this.#U,e,t),!1}if(!this.#U.closeState.has(c.SENT)&&!this.#U.closeState.has(c.RECEIVED)){let e=a;this.#ct.closeInfo.code&&(e=Buffer.allocUnsafe(2),e.writeUInt16BE(this.#ct.closeInfo.code,0));const t=new B(e);this.#U.socket.write(t.createFrame(i.CLOSE)),this.#U.closeState.add(c.SENT)}return this.#U.readyState=o.CLOSING,this.#U.closeState.add(c.RECEIVED),!1}if(t===i.PING){if(!this.#U.closeState.has(c.RECEIVED)){const t=new B(e);this.#U.socket.write(t.createFrame(i.PONG)),this.#U.onPing(e)}}else t===i.PONG&&this.#U.onPong(e);return!0}get closingInfo(){return this.#ct.closeInfo}}}},2534:(e,t,s)=>{"use strict";const{WebsocketFrameSend:r}=s(6834),{opcodes:n,sendHints:A}=s(6490),i=s(1726);function o(e,t){return new r(function(e,t){switch(t){case A.text:case A.typedArray:return new Uint8Array(e.buffer,e.byteOffset,e.byteLength);case A.arrayBuffer:case A.blob:return new Uint8Array(e)}}(e,t)).createFrame(t===A.text?n.TEXT:n.BINARY)}e.exports={SendQueue:class{#gt=new i;#dt=!1;#ut;constructor(e){this.#ut=e}add(e,t,s){if(s!==A.blob){if(this.#dt){const r={promise:null,callback:t,frame:o(e,s)};this.#gt.push(r)}else if(s===A.text){const{0:s,1:n}=r.createFastTextFrame(e);this.#ut.cork(),this.#ut.write(s),this.#ut.write(n,t),this.#ut.uncork()}else this.#ut.write(o(e,s),t);return}const n={promise:e.arrayBuffer().then((e=>{n.promise=null,n.frame=o(e,s)})),callback:t,frame:null};this.#gt.push(n),this.#dt||this.#Et()}async#Et(){this.#dt=!0;const e=this.#gt;for(;!e.isEmpty();){const t=e.shift();null!==t.promise&&await t.promise,this.#ut.write(t.frame,t.callback),t.callback=t.frame=null}this.#dt=!1}}}},7053:(e,t,s)=>{"use strict";const{webidl:r}=s(6097),{validateCloseCodeAndReason:n}=s(8983),{kConstruct:A}=s(257),{kEnumerableProperty:i}=s(2858);class o extends(function(){class e extends DOMException{get reason(){return""}}return void 0!==(new e).reason?DOMException:new Proxy(DOMException,{construct(e,t,s){const r=Reflect.construct(e,t,e);return Object.setPrototypeOf(r,s.prototype),r}})}()){#It;#W;constructor(e="",t=void 0){if(super(e=r.converters.DOMString(e,"WebSocketError","message"),"WebSocketError"),t===A)return;null!==t&&(t=r.converters.WebSocketCloseInfo(t));let s=t.closeCode??null;const i=t.reason??"";n(s,i),0!==i.length&&null===s&&(s=1e3),this.#It=s,this.#W=i}get closeCode(){return this.#It}get reason(){return this.#W}static createUnvalidatedWebSocketError(e,t,s){const r=new o(e,A);return r.#It=t,r.#W=s,r}}const{createUnvalidatedWebSocketError:a}=o;delete o.createUnvalidatedWebSocketError,Object.defineProperties(o.prototype,{closeCode:i,reason:i,[Symbol.toStringTag]:{value:"WebSocketError",writable:!1,enumerable:!1,configurable:!0}}),r.is.WebSocketError=r.util.MakeTypeAssertion(o),e.exports={WebSocketError:o,createUnvalidatedWebSocketError:a}},27:(e,t,s)=>{"use strict";const{createDeferredPromise:r}=s(9250),{environmentSettingsObject:n}=s(6686),{states:A,opcodes:i,sentCloseFrameState:o}=s(6490),{webidl:a}=s(6097),{getURLRecord:c,isValidSubprotocol:l,isEstablished:h,utf8Decode:g}=s(8983),{establishWebSocketConnection:d,failWebsocketConnection:u,closeWebSocketConnection:E}=s(8251),{channels:I}=s(772),{WebsocketFrameSend:C}=s(6834),{ByteParser:B}=s(834),{WebSocketError:Q,createUnvalidatedWebSocketError:p}=s(7053),{utf8DecodeBytes:f}=s(6686),{kEnumerableProperty:m}=s(2858);let y=!1;class w{#Ge;#Ct;#Bt;#Qt;#pt;#ft;#mt=!1;#U={onConnectionEstablished:(e,t)=>this.#yt(e,t),onMessage:(e,t)=>this.#wt(e,t),onParserError:e=>u(this.#U,null,e.message),onParserDrain:()=>this.#U.socket.resume(),onSocketData:e=>{this.#St.write(e)||this.#U.socket.pause()},onSocketError:e=>{this.#U.readyState=A.CLOSING,I.socketError.hasSubscribers&&I.socketError.publish(e),this.#U.socket.destroy()},onSocketClose:()=>this.#Dt(),onPing:()=>{},onPong:()=>{},readyState:A.CONNECTING,socket:null,closeState:new Set,controller:null,wasEverConnected:!1};#St;constructor(e,t=void 0){y||(process.emitWarning("WebSocketStream is experimental! Expect it to change at any time.",{code:"UNDICI-WSS"}),y=!0),a.argumentLengthCheck(arguments,1,"WebSocket"),e=a.converters.USVString(e),null!==t&&(t=a.converters.WebSocketStreamOptions(t));const s=n.settingsObject.baseUrl,i=c(e,s),o=t.protocols;if(o.length!==new Set(o.map((e=>e.toLowerCase()))).size)throw new DOMException("Invalid Sec-WebSocket-Protocol value","SyntaxError");if(o.length>0&&!o.every((e=>l(e))))throw new DOMException("Invalid Sec-WebSocket-Protocol value","SyntaxError");if(this.#Ge=i.toString(),this.#Ct=r(),this.#Bt=r(),null!=t.signal){const e=t.signal;if(e.aborted)return this.#Ct.reject(e.reason),void this.#Bt.reject(e.reason);e.addEventListener("abort",(()=>{h(this.#U.readyState)||(u(this.#U),this.#U.readyState=A.CLOSING,this.#Ct.reject(e.reason),this.#Bt.reject(e.reason),this.#mt=!0)}),{once:!0})}const g=n.settingsObject;this.#U.controller=d(i,o,g,this.#U,t)}get url(){return this.#Ge.toString()}get opened(){return this.#Ct.promise}get closed(){return this.#Bt.promise}close(e=void 0){null!==e&&(e=a.converters.WebSocketCloseInfo(e));const t=e.closeCode??null,s=e.reason;E(this.#U,t,s,!0)}#bt(e){e=a.converters.WebSocketStreamWrite(e);const t=r();let s=null,n=null;if(a.is.BufferSource(e))s=new Uint8Array(ArrayBuffer.isView(e)?new Uint8Array(e.buffer,e.byteOffset,e.byteLength):e.slice()),n=i.BINARY;else{let r;try{r=a.converters.DOMString(e)}catch(e){return t.reject(e),t.promise}s=(new TextEncoder).encode(r),n=i.TEXT}if(!this.#U.closeState.has(o.SENT)&&!this.#U.closeState.has(o.RECEIVED)){const e=new C(s);this.#U.socket.write(e.createFrame(n),(()=>{t.resolve(void 0)}))}return t.promise}#yt(e,t){this.#U.socket=e.socket;const s=new B(this.#U,t);s.on("drain",(()=>this.#U.onParserDrain())),s.on("error",(e=>this.#U.onParserError(e))),this.#St=s,this.#U.readyState=A.OPEN;const r=t??"",n=e.headersList.get("sec-websocket-protocol")??"",i=new ReadableStream({start:e=>{this.#pt=e},pull(t){let s;for(;t.desiredSize>0&&null!==(s=e.socket.read());)t.enqueue(s)},cancel:e=>this.#vt(e)}),o=new WritableStream({write:e=>this.#bt(e),close:()=>E(this.#U,null,null),abort:e=>this.#Nt(e)});this.#Qt=i,this.#ft=o,this.#Ct.resolve({extensions:r,protocol:n,readable:i,writable:o})}#wt(e,t){if(this.#U.readyState!==A.OPEN)return;let s;if(e===i.TEXT)try{s=g(t)}catch{return void u(this.#U,"Received invalid UTF-8 in text frame.")}else e===i.BINARY&&(s=new Uint8Array(t.buffer,t.byteOffset,t.byteLength));this.#pt.enqueue(s)}#Dt(){const e=this.#U.closeState.has(o.SENT)&&this.#U.closeState.has(o.RECEIVED);if(this.#U.readyState=A.CLOSED,this.#mt)return;this.#U.wasEverConnected||this.#Ct.reject(new Q("Socket never opened"));const t=this.#St.closingInfo;let s=t?.code??1005;this.#U.closeState.has(o.SENT)||this.#U.closeState.has(o.RECEIVED)||(s=1006);const r=null==t?.reason?"":f(Buffer.from(t.reason));if(e)this.#pt.close(),this.#ft.locked||this.#ft.abort(new DOMException("A closed WebSocketStream cannot be written to","InvalidStateError")),this.#Bt.resolve({closeCode:s,reason:r});else{const e=p("unclean close",s,r);this.#pt.error(e),this.#ft.abort(e),this.#Bt.reject(e)}}#Nt(e){let t=null,s="";a.is.WebSocketError(e)&&(t=e.closeCode,s=e.reason),E(this.#U,t,s)}#vt(e){this.#Nt(e)}}Object.defineProperties(w.prototype,{url:m,opened:m,closed:m,close:m,[Symbol.toStringTag]:{value:"WebSocketStream",writable:!1,enumerable:!1,configurable:!0}}),a.converters.WebSocketStreamOptions=a.dictionaryConverter([{key:"protocols",converter:a.sequenceConverter(a.converters.USVString),defaultValue:()=>[]},{key:"signal",converter:a.nullableConverter(a.converters.AbortSignal),defaultValue:()=>null}]),a.converters.WebSocketCloseInfo=a.dictionaryConverter([{key:"closeCode",converter:e=>a.converters["unsigned short"](e,a.attributes.EnforceRange)},{key:"reason",converter:a.converters.USVString,defaultValue:()=>""}]),a.converters.WebSocketStreamWrite=function(e){return"string"==typeof e?a.converters.USVString(e):a.converters.BufferSource(e)},e.exports={WebSocketStream:w}},8983:(e,t,s)=>{"use strict";const{states:r,opcodes:n}=s(6490),{isUtf8:A}=s(4573),{collectASequenceOfCodePointsFast:i,removeHTTPWhitespace:o}=s(9934);function a(e){return e===n.CLOSE||e===n.PING||e===n.PONG}function c(e){return e===n.CONTINUATION}function l(e){return e===n.TEXT||e===n.BINARY}const h=(()=>{if("string"==typeof process.versions.icu){const e=new TextDecoder("utf-8",{fatal:!0});return e.decode.bind(e)}return function(e){if(A(e))return e.toString("utf-8");throw new TypeError("Invalid utf-8 received.")}})();e.exports={isConnecting:function(e){return e===r.CONNECTING},isEstablished:function(e){return e===r.OPEN},isClosing:function(e){return e===r.CLOSING},isClosed:function(e){return e===r.CLOSED},fireEvent:function(e,t,s=(e,t)=>new Event(e,t),r={}){const n=s(e,r);t.dispatchEvent(n)},isValidSubprotocol:function(e){if(0===e.length)return!1;for(let t=0;t<e.length;++t){const s=e.charCodeAt(t);if(s<33||s>126||34===s||40===s||41===s||44===s||47===s||58===s||59===s||60===s||61===s||62===s||63===s||64===s||91===s||92===s||93===s||123===s||125===s)return!1}return!0},isValidStatusCode:function(e){return e>=1e3&&e<1015?1004!==e&&1005!==e&&1006!==e:e>=3e3&&e<=4999},websocketMessageReceived:function(e,t,s){e.onMessage(t,s)},utf8Decode:h,isControlFrame:a,isContinuationFrame:c,isTextBinaryFrame:l,isValidOpcode:function(e){return l(e)||c(e)||a(e)},parseExtensions:function(e){const t={position:0},s=new Map;for(;t.position<e.length;){const r=i(";",e,t),[n,A=""]=r.split("=",2);s.set(o(n,!0,!1),o(A,!1,!0)),t.position++}return s},isValidClientWindowBits:function(e){for(let t=0;t<e.length;t++){const s=e.charCodeAt(t);if(s<48||s>57)return!1}return!0},toArrayBuffer:function(e){return e.byteLength===e.buffer.byteLength?e.buffer:new Uint8Array(e).buffer},getURLRecord:function(e,t){let s;try{s=new URL(e,t)}catch(e){throw new DOMException(e,"SyntaxError")}if("http:"===s.protocol?s.protocol="ws:":"https:"===s.protocol&&(s.protocol="wss:"),"ws:"!==s.protocol&&"wss:"!==s.protocol)throw new DOMException("expected a ws: or wss: url","SyntaxError");if(s.hash.length||s.href.endsWith("#"))throw new DOMException("hash","SyntaxError");return s},validateCloseCodeAndReason:function(e,t){if(null!==e&&1e3!==e&&(e<3e3||e>4999))throw new DOMException("invalid code","InvalidAccessError");if(null!==t){const e=Buffer.byteLength(t);if(e>123)throw new DOMException(`Reason must be less than 123 bytes; received ${e}`,"SyntaxError")}}}},2984:(e,t,s)=>{"use strict";const{isArrayBuffer:r}=s(3429),{webidl:n}=s(6097),{URLSerializer:A}=s(9934),{environmentSettingsObject:i}=s(6686),{staticPropertyDescriptors:o,states:a,sentCloseFrameState:c,sendHints:l,opcodes:h}=s(6490),{isConnecting:g,isEstablished:d,isClosing:u,isClosed:E,isValidSubprotocol:I,fireEvent:C,utf8Decode:B,toArrayBuffer:Q,getURLRecord:p}=s(8983),{establishWebSocketConnection:f,closeWebSocketConnection:m,failWebsocketConnection:y}=s(8251),{ByteParser:w}=s(834),{kEnumerableProperty:S}=s(2858),{getGlobalDispatcher:D}=s(9879),{ErrorEvent:b,CloseEvent:v,createFastMessageEvent:N}=s(878),{SendQueue:R}=s(2534),{WebsocketFrameSend:k}=s(6834),{channels:T}=s(772);class F extends EventTarget{#Oe={open:null,error:null,close:null,message:null};#Rt=0;#kt="";#ht="";#Tt;#U={onConnectionEstablished:(e,t)=>this.#yt(e,t),onMessage:(e,t)=>this.#wt(e,t),onParserError:e=>y(this.#U,null,e.message),onParserDrain:()=>this.#Ft(),onSocketData:e=>{this.#St.write(e)||this.#U.socket.pause()},onSocketError:e=>{this.#U.readyState=a.CLOSING,T.socketError.hasSubscribers&&T.socketError.publish(e),this.#U.socket.destroy()},onSocketClose:()=>this.#Dt(),onPing:e=>{T.ping.hasSubscribers&&T.ping.publish({payload:e,websocket:this})},onPong:e=>{T.pong.hasSubscribers&&T.pong.publish({payload:e,websocket:this})},readyState:a.CONNECTING,socket:null,closeState:new Set,controller:null,wasEverConnected:!1};#Ge;#Mt;#St;constructor(e,t=[]){super(),n.util.markAsUncloneable(this);const s="WebSocket constructor";n.argumentLengthCheck(arguments,1,s);const r=n.converters["DOMString or sequence<DOMString> or WebSocketInit"](t,s,"options");e=n.converters.USVString(e),t=r.protocols;const A=i.settingsObject.baseUrl,o=p(e,A);if("string"==typeof t&&(t=[t]),t.length!==new Set(t.map((e=>e.toLowerCase()))).size)throw new DOMException("Invalid Sec-WebSocket-Protocol value","SyntaxError");if(t.length>0&&!t.every((e=>I(e))))throw new DOMException("Invalid Sec-WebSocket-Protocol value","SyntaxError");this.#Ge=new URL(o.href);const a=i.settingsObject;this.#U.controller=f(o,t,a,this.#U,r),this.#U.readyState=F.CONNECTING,this.#Mt="blob"}close(e=void 0,t=void 0){n.brandCheck(this,F);void 0!==e&&(e=n.converters["unsigned short"](e,"WebSocket.close","code",n.attributes.Clamp)),void 0!==t&&(t=n.converters.USVString(t)),e??=null,t??="",m(this.#U,e,t,!0)}send(e){n.brandCheck(this,F);const t="WebSocket.send";if(n.argumentLengthCheck(arguments,1,t),e=n.converters.WebSocketSendData(e,t,"data"),g(this.#U.readyState))throw new DOMException("Sent before connected.","InvalidStateError");if(d(this.#U.readyState)&&!u(this.#U.readyState))if("string"==typeof e){const t=Buffer.from(e);this.#Rt+=t.byteLength,this.#Tt.add(t,(()=>{this.#Rt-=t.byteLength}),l.text)}else r(e)?(this.#Rt+=e.byteLength,this.#Tt.add(e,(()=>{this.#Rt-=e.byteLength}),l.arrayBuffer)):ArrayBuffer.isView(e)?(this.#Rt+=e.byteLength,this.#Tt.add(e,(()=>{this.#Rt-=e.byteLength}),l.typedArray)):n.is.Blob(e)&&(this.#Rt+=e.size,this.#Tt.add(e,(()=>{this.#Rt-=e.size}),l.blob))}get readyState(){return n.brandCheck(this,F),this.#U.readyState}get bufferedAmount(){return n.brandCheck(this,F),this.#Rt}get url(){return n.brandCheck(this,F),A(this.#Ge)}get extensions(){return n.brandCheck(this,F),this.#ht}get protocol(){return n.brandCheck(this,F),this.#kt}get onopen(){return n.brandCheck(this,F),this.#Oe.open}set onopen(e){n.brandCheck(this,F),this.#Oe.open&&this.removeEventListener("open",this.#Oe.open);const t=n.converters.EventHandlerNonNull(e);null!==t?(this.addEventListener("open",t),this.#Oe.open=e):this.#Oe.open=null}get onerror(){return n.brandCheck(this,F),this.#Oe.error}set onerror(e){n.brandCheck(this,F),this.#Oe.error&&this.removeEventListener("error",this.#Oe.error);const t=n.converters.EventHandlerNonNull(e);null!==t?(this.addEventListener("error",t),this.#Oe.error=e):this.#Oe.error=null}get onclose(){return n.brandCheck(this,F),this.#Oe.close}set onclose(e){n.brandCheck(this,F),this.#Oe.close&&this.removeEventListener("close",this.#Oe.close);const t=n.converters.EventHandlerNonNull(e);null!==t?(this.addEventListener("close",t),this.#Oe.close=e):this.#Oe.close=null}get onmessage(){return n.brandCheck(this,F),this.#Oe.message}set onmessage(e){n.brandCheck(this,F),this.#Oe.message&&this.removeEventListener("message",this.#Oe.message);const t=n.converters.EventHandlerNonNull(e);null!==t?(this.addEventListener("message",t),this.#Oe.message=e):this.#Oe.message=null}get binaryType(){return n.brandCheck(this,F),this.#Mt}set binaryType(e){n.brandCheck(this,F),this.#Mt="blob"!==e&&"arraybuffer"!==e?"blob":e}#yt(e,t){this.#U.socket=e.socket;const s=new w(this.#U,t);s.on("drain",(()=>this.#U.onParserDrain())),s.on("error",(e=>this.#U.onParserError(e))),this.#St=s,this.#Tt=new R(e.socket),this.#U.readyState=a.OPEN;const r=e.headersList.get("sec-websocket-extensions");null!==r&&(this.#ht=r);const n=e.headersList.get("sec-websocket-protocol");if(null!==n&&(this.#kt=n),C("open",this),T.open.hasSubscribers){const t=e.headersList.entries;T.open.publish({address:e.socket.address(),protocol:this.#kt,extensions:this.#ht,websocket:this,handshakeResponse:{status:e.status,statusText:e.statusText,headers:t}})}}#wt(e,t){if(this.#U.readyState!==a.OPEN)return;let s;if(e===h.TEXT)try{s=B(t)}catch{return void y(this.#U,1007,"Received invalid UTF-8 in text frame.")}else e===h.BINARY&&(s="blob"===this.#Mt?new Blob([t]):Q(t));C("message",this,N,{origin:this.#Ge.origin,data:s})}#Ft(){this.#U.socket.resume()}#Dt(){const e=this.#U.closeState.has(c.SENT)&&this.#U.closeState.has(c.RECEIVED);let t=1005,s="";const r=this.#St?.closingInfo;r&&!r.error&&(t=r.code??1005,s=r.reason),this.#U.readyState=a.CLOSED,this.#U.closeState.has(c.RECEIVED)||(t=1006,C("error",this,((e,t)=>new b(e,t)),{error:new TypeError(s)})),C("close",this,((e,t)=>new v(e,t)),{wasClean:e,code:t,reason:s}),T.close.hasSubscribers&&T.close.publish({websocket:this,code:t,reason:s})}static ping(e,t){if(Buffer.isBuffer(t)){if(t.length>125)throw new TypeError("A PING frame cannot have a body larger than 125 bytes.")}else if(void 0!==t)throw new TypeError("Expected buffer payload");const s=e.#U.readyState;if(d(s)&&!u(s)&&!E(s)){const s=new k(t);e.#U.socket.write(s.createFrame(h.PING))}}}const{ping:M}=F;Reflect.deleteProperty(F,"ping"),F.CONNECTING=F.prototype.CONNECTING=a.CONNECTING,F.OPEN=F.prototype.OPEN=a.OPEN,F.CLOSING=F.prototype.CLOSING=a.CLOSING,F.CLOSED=F.prototype.CLOSED=a.CLOSED,Object.defineProperties(F.prototype,{CONNECTING:o,OPEN:o,CLOSING:o,CLOSED:o,url:S,readyState:S,bufferedAmount:S,onopen:S,onerror:S,onclose:S,close:S,onmessage:S,binaryType:S,send:S,extensions:S,protocol:S,[Symbol.toStringTag]:{value:"WebSocket",writable:!1,enumerable:!1,configurable:!0}}),Object.defineProperties(F,{CONNECTING:o,OPEN:o,CLOSING:o,CLOSED:o}),n.converters["sequence<DOMString>"]=n.sequenceConverter(n.converters.DOMString),n.converters["DOMString or sequence<DOMString>"]=function(e,t,s){return n.util.Type(e)===n.util.Types.OBJECT&&Symbol.iterator in e?n.converters["sequence<DOMString>"](e):n.converters.DOMString(e,t,s)},n.converters.WebSocketInit=n.dictionaryConverter([{key:"protocols",converter:n.converters["DOMString or sequence<DOMString>"],defaultValue:()=>[]},{key:"dispatcher",converter:n.converters.any,defaultValue:()=>D()},{key:"headers",converter:n.nullableConverter(n.converters.HeadersInit)}]),n.converters["DOMString or sequence<DOMString> or WebSocketInit"]=function(e){return n.util.Type(e)!==n.util.Types.OBJECT||Symbol.iterator in e?{protocols:n.converters["DOMString or sequence<DOMString>"](e)}:n.converters.WebSocketInit(e)},n.converters.WebSocketSendData=function(e){if(n.util.Type(e)===n.util.Types.OBJECT){if(n.is.Blob(e))return e;if(n.is.BufferSource(e))return e}return n.converters.USVString(e)},e.exports={WebSocket:F,ping:M}},6822:(e,t,s)=>{var r=s(9896),n=s(2203).Transform,A=s(2203).PassThrough,i=s(3106),o=s(9023),a=s(4434).EventEmitter,c=s(4434).errorMonitor,l=s(5537);function h(){this.outputStream=new A,this.entries=[],this.outputStreamCursor=0,this.ended=!1,this.allDone=!1,this.forceZip64Eocd=!1,this.errored=!1,this.on(c,(function(){this.errored=!0}))}t.u=h,o.inherits(h,a),h.prototype.addFile=function(e,t,s){var n=this;if(t=p(t,!1),null==s&&(s={}),!I(n)){var A=new m(t,!1,s);n.entries.push(A),r.stat(e,(function(t,i){return t?n.emit("error",t):i.isFile()?(A.uncompressedSize=i.size,null==s.mtime&&A.setLastModDate(i.mtime),null==s.mode&&A.setFileAttributesMode(i.mode),A.setFileDataPumpFunction((function(){var t=r.createReadStream(e);A.state=m.FILE_DATA_IN_PROGRESS,t.on("error",(function(e){n.emit("error",e)})),u(n,A,t)})),void E(n)):n.emit("error",new Error("not a file: "+e))}))}},h.prototype.addReadStream=function(e,t,s){this.addReadStreamLazy(t,s,(function(t){t(null,e)}))},h.prototype.addReadStreamLazy=function(e,t,s){var r=this;if("function"==typeof t&&(s=t,t=null),null==t&&(t={}),e=p(e,!1),!I(r)){var n=new m(e,!1,t);r.entries.push(n),n.setFileDataPumpFunction((function(){n.state=m.FILE_DATA_IN_PROGRESS,s((function(e,t){if(e)return r.emit("error",e);u(r,n,t)}))})),E(r)}},h.prototype.addBuffer=function(e,t,s){var r=this;if(t=p(t,!1),e.length>1073741823)throw new Error("buffer too large: "+e.length+" > 1073741823");if(null==s&&(s={}),null!=s.size)throw new Error("options.size not allowed");if(!I(r)){var n=new m(t,!1,s);n.uncompressedSize=e.length,n.crc32=l.unsigned(e),n.crcAndFileSizeKnown=!0,r.entries.push(n),0===n.compressionLevel?A(e):i.deflateRaw(e,{level:n.compressionLevel},(function(e,t){A(t)}))}function A(e){n.compressedSize=e.length,n.setFileDataPumpFunction((function(){d(r,e),d(r,n.getDataDescriptor()),n.state=m.FILE_DATA_DONE,setImmediate((function(){E(r)}))})),E(r)}},h.prototype.addEmptyDirectory=function(e,t){var s=this;if(e=p(e,!0),null==t&&(t={}),null!=t.size)throw new Error("options.size not allowed");if(null!=t.compress)throw new Error("options.compress not allowed");if(null!=t.compressionLevel)throw new Error("options.compressionLevel not allowed");if(!I(s)){var r=new m(e,!0,t);s.entries.push(r),r.setFileDataPumpFunction((function(){d(s,r.getDataDescriptor()),r.state=m.FILE_DATA_DONE,E(s)})),E(s)}};var g=Y([80,75,5,6]);function d(e,t){e.outputStream.write(t),e.outputStreamCursor+=t.length}function u(e,t,s){var r=new L,n=new U,o=0!==t.compressionLevel?new i.DeflateRaw({level:t.compressionLevel}):new A,a=new U;s.pipe(r).pipe(n).pipe(o).pipe(a).pipe(e.outputStream,{end:!1}),a.on("end",(function(){if(t.crc32=r.crc32,null==t.uncompressedSize)t.uncompressedSize=n.byteCount;else if(t.uncompressedSize!==n.byteCount)return e.emit("error",new Error("file data stream has unexpected number of bytes"));t.compressedSize=a.byteCount,e.outputStreamCursor+=t.compressedSize,d(e,t.getDataDescriptor()),t.state=m.FILE_DATA_DONE,E(e)}))}function E(e){if(!e.allDone&&!e.errored){if(e.ended&&null!=e.calculatedTotalSizeCallback){var t=function(e){for(var t=0,s=0,r=0;r<e.entries.length;r++){var n=e.entries[r];if(0!==n.compressionLevel)return-1;if(n.state>=m.READY_TO_PUMP_FILE_DATA){if(null==n.uncompressedSize)return-1}else if(null==n.uncompressedSize)return null;n.relativeOffsetOfLocalHeader=t;var A=n.useZip64Format();t+=y+n.utf8FileName.length,t+=n.uncompressedSize,n.crcAndFileSizeKnown||(t+=A?b:D),s+=v+n.utf8FileName.length+n.fileComment.length,n.forceDosTimestamp||(s+=N),A&&(s+=R)}var i=0;(e.forceZip64Eocd||e.entries.length>=65535||s>=65535||t>=4294967295)&&(i+=C+B);return i+=Q+e.comment.length,t+s+i}(e);null!=t&&(e.calculatedTotalSizeCallback(t),e.calculatedTotalSizeCallback=null)}var s=function(){for(var t=0;t<e.entries.length;t++){var s=e.entries[t];if(s.state<m.FILE_DATA_DONE)return s}return null}();if(null!=s){if(s.state<m.READY_TO_PUMP_FILE_DATA)return;if(s.state===m.FILE_DATA_IN_PROGRESS)return;s.relativeOffsetOfLocalHeader=e.outputStreamCursor;var r=s.getLocalFileHeader();d(e,r),s.doFileDataPump()}else e.ended&&(e.offsetOfStartOfCentralDirectory=e.outputStreamCursor,e.entries.forEach((function(t){var s=t.getCentralDirectoryRecord();d(e,s)})),d(e,function(e,t){var s=!1,r=e.entries.length;(e.forceZip64Eocd||e.entries.length>=65535)&&(r=65535,s=!0);var n=e.outputStreamCursor-e.offsetOfStartOfCentralDirectory,A=n;(e.forceZip64Eocd||n>=4294967295)&&(A=4294967295,s=!0);var i=e.offsetOfStartOfCentralDirectory;(e.forceZip64Eocd||e.offsetOfStartOfCentralDirectory>=4294967295)&&(i=4294967295,s=!0);if(t)return s?C+B+Q:Q;var o=x(Q+e.comment.length);if(o.writeUInt32LE(101010256,0),o.writeUInt16LE(0,4),o.writeUInt16LE(0,6),o.writeUInt16LE(r,8),o.writeUInt16LE(r,10),o.writeUInt32LE(A,12),o.writeUInt32LE(i,16),o.writeUInt16LE(e.comment.length,20),e.comment.copy(o,22),!s)return o;var a=x(C);a.writeUInt32LE(101075792,0),M(a,C-12,4),a.writeUInt16LE(S,12),a.writeUInt16LE(w,14),a.writeUInt32LE(0,16),a.writeUInt32LE(0,20),M(a,e.entries.length,24),M(a,e.entries.length,32),M(a,n,40),M(a,e.offsetOfStartOfCentralDirectory,48);var c=x(B);return c.writeUInt32LE(117853008,0),c.writeUInt32LE(0,4),M(c,e.outputStreamCursor,8),c.writeUInt32LE(1,16),Buffer.concat([a,c,o])}(e)),e.outputStream.end(),e.allDone=!0)}}function I(e){if(e.ended)throw new Error("cannot add entries after calling end()");return!!e.errored}h.prototype.end=function(e,t){if("function"==typeof e&&(t=e,e=null),null==e&&(e={}),!this.ended&&(this.ended=!0,!this.errored)){if(this.calculatedTotalSizeCallback=t,this.forceZip64Eocd=!!e.forceZip64Format,e.comment){if("string"==typeof e.comment?this.comment=function(e){if(/^[\x20-\x7e]*$/.test(e))return Y(e,"utf-8");if(null==P){P={};for(var t=0;t<H.length;t++)P[H[t]]=t}var s=x(e.length);for(t=0;t<e.length;t++){var r=P[e[t]];if(null==r)throw new Error("character not encodable in CP437: "+JSON.stringify(e[t]));s[t]=r}return s}(e.comment):this.comment=e.comment,this.comment.length>65535)throw new Error("comment is too large");if(V(this.comment,g))throw new Error("comment contains end of central directory record signature")}else this.comment=f;E(this)}};var C=56,B=20,Q=22;function p(e,t){if(""===e)throw new Error("empty metadataPath");if(e=e.replace(/\\/g,"/"),/^[a-zA-Z]:/.test(e)||/^\//.test(e))throw new Error("absolute path: "+e);if(-1!==e.split("/").indexOf(".."))throw new Error("invalid relative path: "+e);var s=/\/$/.test(e);if(t)s||(e+="/");else if(s)throw new Error("file path cannot end with '/': "+e);return e}var f=x(0);function m(e,t,s){if(this.utf8FileName=Y(e),this.utf8FileName.length>65535)throw new Error("utf8 file name too long. "+utf8FileName.length+" > 65535");if(this.isDirectory=t,this.state=m.WAITING_FOR_METADATA,this.setLastModDate(null!=s.mtime?s.mtime:new Date),this.forceDosTimestamp=!!s.forceDosTimestamp,null!=s.mode?this.setFileAttributesMode(s.mode):this.setFileAttributesMode(t?16893:33204),t?(this.crcAndFileSizeKnown=!0,this.crc32=0,this.uncompressedSize=0,this.compressedSize=0):(this.crcAndFileSizeKnown=!1,this.crc32=null,this.uncompressedSize=null,this.compressedSize=null,null!=s.size&&(this.uncompressedSize=s.size)),this.compressionLevel=t?0:function(e){if(null!=e.compress&&null!=e.compressionLevel&&!!e.compress!=!!e.compressionLevel)throw new Error("conflicting settings for compress and compressionLevel");return null!=e.compressionLevel?e.compressionLevel:!1===e.compress?0:6}(s),this.forceZip64Format=!!s.forceZip64Format,s.fileComment){if("string"==typeof s.fileComment?this.fileComment=Y(s.fileComment,"utf-8"):this.fileComment=s.fileComment,this.fileComment.length>65535)throw new Error("fileComment is too large")}else this.fileComment=f}m.WAITING_FOR_METADATA=0,m.READY_TO_PUMP_FILE_DATA=1,m.FILE_DATA_IN_PROGRESS=2,m.FILE_DATA_DONE=3,m.prototype.setLastModDate=function(e){this.mtime=e;var t=F(e);this.lastModFileTime=t.time,this.lastModFileDate=t.date},m.prototype.setFileAttributesMode=function(e){if((65535&e)!==e)throw new Error("invalid mode. expected: 0 <= "+e+" <= 65535");this.externalFileAttributes=e<<16>>>0},m.prototype.setFileDataPumpFunction=function(e){this.doFileDataPump=e,this.state=m.READY_TO_PUMP_FILE_DATA},m.prototype.useZip64Format=function(){return this.forceZip64Format||null!=this.uncompressedSize&&this.uncompressedSize>4294967294||null!=this.compressedSize&&this.compressedSize>4294967294||null!=this.relativeOffsetOfLocalHeader&&this.relativeOffsetOfLocalHeader>4294967294};var y=30,w=45,S=831;m.prototype.getLocalFileHeader=function(){var e=0,t=0,s=0;this.crcAndFileSizeKnown&&(e=this.crc32,t=this.compressedSize,s=this.uncompressedSize);var r=x(y),n=2048;return this.crcAndFileSizeKnown||(n|=8),r.writeUInt32LE(67324752,0),r.writeUInt16LE(20,4),r.writeUInt16LE(n,6),r.writeUInt16LE(this.getCompressionMethod(),8),r.writeUInt16LE(this.lastModFileTime,10),r.writeUInt16LE(this.lastModFileDate,12),r.writeUInt32LE(e,14),r.writeUInt32LE(t,18),r.writeUInt32LE(s,22),r.writeUInt16LE(this.utf8FileName.length,26),r.writeUInt16LE(0,28),Buffer.concat([r,this.utf8FileName])};var D=16,b=24;m.prototype.getDataDescriptor=function(){return this.crcAndFileSizeKnown?f:this.useZip64Format()?((e=x(b)).writeUInt32LE(134695760,0),e.writeUInt32LE(this.crc32,4),M(e,this.compressedSize,8),M(e,this.uncompressedSize,16),e):((e=x(D)).writeUInt32LE(134695760,0),e.writeUInt32LE(this.crc32,4),e.writeUInt32LE(this.compressedSize,8),e.writeUInt32LE(this.uncompressedSize,12),e);var e};var v=46,N=9,R=28;m.prototype.getCentralDirectoryRecord=function(){var e=x(v),t=2048;this.crcAndFileSizeKnown||(t|=8);var s=f;if(!this.forceDosTimestamp){(s=x(N)).writeUInt16LE(21589,0),s.writeUInt16LE(N-4,2);s.writeUInt8(3,4);var r=Math.floor(this.mtime.getTime()/1e3);r<-2147483648&&(r=-2147483648),r>2147483647&&(r=2147483647),s.writeUInt32LE(r,5)}var n=this.compressedSize,A=this.uncompressedSize,i=this.relativeOffsetOfLocalHeader,o=20,a=f;return this.useZip64Format()&&(n=4294967295,A=4294967295,i=4294967295,o=w,(a=x(R)).writeUInt16LE(1,0),a.writeUInt16LE(R-4,2),M(a,this.uncompressedSize,4),M(a,this.compressedSize,12),M(a,this.relativeOffsetOfLocalHeader,20)),e.writeUInt32LE(33639248,0),e.writeUInt16LE(S,4),e.writeUInt16LE(o,6),e.writeUInt16LE(t,8),e.writeUInt16LE(this.getCompressionMethod(),10),e.writeUInt16LE(this.lastModFileTime,12),e.writeUInt16LE(this.lastModFileDate,14),e.writeUInt32LE(this.crc32,16),e.writeUInt32LE(n,20),e.writeUInt32LE(A,24),e.writeUInt16LE(this.utf8FileName.length,28),e.writeUInt16LE(s.length+a.length,30),e.writeUInt16LE(this.fileComment.length,32),e.writeUInt16LE(0,34),e.writeUInt16LE(0,36),e.writeUInt32LE(this.externalFileAttributes,38),e.writeUInt32LE(i,42),Buffer.concat([e,this.utf8FileName,s,a,this.fileComment])},m.prototype.getCompressionMethod=function(){return 0===this.compressionLevel?0:8};var k=new Date(1980,0,1),T=new Date(2107,11,31,23,59,58);function F(e){e<k?e=k:e>T&&(e=T);var t=0;t|=31&e.getDate(),t|=(e.getMonth()+1&15)<<5,t|=(e.getFullYear()-1980&127)<<9;var s=0;return s|=Math.floor(e.getSeconds()/2),s|=(63&e.getMinutes())<<5,{date:t,time:s|=(31&e.getHours())<<11}}function M(e,t,s){var r=Math.floor(t/4294967296),n=t%4294967296;e.writeUInt32LE(n,s),e.writeUInt32LE(r,s+4)}function U(e){n.call(this,e),this.byteCount=0}function L(e){n.call(this,e),this.crc32=0}o.inherits(U,n),U.prototype._transform=function(e,t,s){this.byteCount+=e.length,s(null,e)},o.inherits(L,n),L.prototype._transform=function(e,t,s){this.crc32=l.unsigned(e,this.crc32),s(null,e)};var H="\0☺☻♥♦♣♠•◘○◙♂♀♪♫☼►◄↕‼¶§▬↨↑↓→←∟↔▲▼ !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~⌂ÇüéâäàåçêëèïîìÄÅÉæÆôöòûùÿÖÜ¢£¥₧ƒáíóúñѪº¿⌐¬½¼¡«»░▒▓│┤╡╢╖╕╣║╗╝╜╛┐└┴┬├─┼╞╟╚╔╩╦╠═╬╧╨╤╥╙╘╒╓╫╪┘┌█▄▌▐▀αßΓπΣσµτΦΘΩδ∞φε∩≡±≥≤⌠⌡÷≈°∙·√ⁿ²■ ";if(256!==H.length)throw new Error("assertion failure");var P=null;function x(e){x=function(e){return Buffer.allocUnsafe(e)};try{return x(e)}catch(t){return x=function(e){return new Buffer(e)},x(e)}}function Y(e,t){Y=function(e,t){return Buffer.from(e,t)};try{return Y(e,t)}catch(s){return Y=function(e,t){return new Buffer(e,t)},Y(e,t)}}function V(e,t){V=function(e,t){return e.includes(t)};try{return V(e,t)}catch(s){return V=function(e,t){for(var s=0;s<=e.length-t.length;s++)for(var r=0;;r++){if(r===t.length)return!0;if(e[s+r]!==t[r])break}return!1},V(e,t)}}},7562:function(e,t,s){"use strict";var r=this&&this.__createBinding||(Object.create?function(e,t,s,r){void 0===r&&(r=s);var n=Object.getOwnPropertyDescriptor(t,s);n&&!("get"in n?!t.__esModule:n.writable||n.configurable)||(n={enumerable:!0,get:function(){return t[s]}}),Object.defineProperty(e,r,n)}:function(e,t,s,r){void 0===r&&(r=s),e[r]=t[s]}),n=this&&this.__exportStar||function(e,t){for(var s in e)"default"===s||Object.prototype.hasOwnProperty.call(t,s)||r(t,e,s)};Object.defineProperty(t,"__esModule",{value:!0}),t.sdk=t.MixinDeviceBase=t.ScryptedDeviceBase=void 0,n(s(4192),t);const A=s(4192);s(3339);class i extends A.DeviceBase{constructor(e){super(),this.nativeId=e}get storage(){return this._storage||(this._storage=t.sdk.deviceManager.getDeviceStorage(this.nativeId)),this._storage}get log(){return this._log||(this._log=t.sdk.deviceManager.getDeviceLogger(this.nativeId)),this._log}get console(){return this._console||(this._console=t.sdk.deviceManager.getDeviceConsole(this.nativeId)),this._console}async createMediaObject(e,s){return t.sdk.mediaManager.createMediaObject(e,s,{sourceId:this.id})}getMediaObjectConsole(e){return"string"!=typeof e.sourceId?this.console:t.sdk.deviceManager.getMixinConsole(e.sourceId,this.nativeId)}_lazyLoadDeviceState(){this._deviceState||(this.nativeId?this._deviceState=t.sdk.deviceManager.getDeviceState(this.nativeId):this._deviceState=t.sdk.deviceManager.getDeviceState())}onDeviceEvent(e,s){return t.sdk.deviceManager.onDeviceEvent(this.nativeId,e,s)}}t.ScryptedDeviceBase=i;class o extends A.DeviceBase{constructor(e){super(),this._listeners=new Set,this.mixinDevice=e.mixinDevice,this.mixinDeviceInterfaces=e.mixinDeviceInterfaces,this.mixinStorageSuffix=e.mixinStorageSuffix,this._deviceState=e.mixinDeviceState,this.nativeId=t.sdk.systemManager.getDeviceById(this.id).nativeId,this.mixinProviderNativeId=e.mixinProviderNativeId,this._deviceState.__rpcproxy_traps_all_properties&&"string"==typeof this._deviceState.id&&(this._deviceState=t.sdk.deviceManager.createDeviceState(this._deviceState.id,this._deviceState.setState))}get storage(){if(!this._storage){const e=this.mixinStorageSuffix,s=this.id+(e?":"+e:"");this._storage=t.sdk.deviceManager.getMixinStorage(s,this.mixinProviderNativeId)}return this._storage}get console(){return this._console||(t.sdk.deviceManager.getMixinConsole?this._console=t.sdk.deviceManager.getMixinConsole(this.id,this.mixinProviderNativeId):this._console=t.sdk.deviceManager.getDeviceConsole(this.mixinProviderNativeId)),this._console}async createMediaObject(e,s){return t.sdk.mediaManager.createMediaObject(e,s,{sourceId:this.id})}getMediaObjectConsole(e){return"string"!=typeof e.sourceId?this.console:t.sdk.deviceManager.getMixinConsole(e.sourceId,this.mixinProviderNativeId)}onDeviceEvent(e,s){return t.sdk.deviceManager.onMixinEvent(this.id,this,e,s)}_lazyLoadDeviceState(){}manageListener(e){this._listeners.add(e)}release(){for(const e of this._listeners)e.removeListener()}}t.MixinDeviceBase=o,function(){function e(e){return function(){return this._lazyLoadDeviceState(),this._deviceState?.[e]}}function t(e){return function(t){this._lazyLoadDeviceState(),this._deviceState?this._deviceState[e]=t:console.warn("device state is unavailable. the device must be discovered with deviceManager.onDeviceDiscovered or deviceManager.onDevicesChanged before the state can be set.")}}for(const s of Object.values(A.ScryptedInterfaceProperty))s!==A.ScryptedInterfaceProperty.nativeId&&(Object.defineProperty(i.prototype,s,{set:t(s),get:e(s)}),Object.defineProperty(o.prototype,s,{set:t(s),get:e(s)}))}(),t.sdk={};try{let e=!1;try{process.env.SCRYPTED_SDK_ES_MODULE||process.env.SCRYPTED_SDK_MODULE;const r=process.env.SCRYPTED_SDK_CJS_MODULE||process.env.SCRYPTED_SDK_MODULE;if(r)if("undefined"!=typeof require){const s=require(process.env.SCRYPTED_SDK_MODULE);Object.assign(t.sdk,s.getScryptedStatic()),e=!0}else{const n=s(3891)(r);Object.assign(t.sdk,n.getScryptedStatic()),e=!0}}catch(e){throw console.warn("failed to load sdk module",e),e}if(!e){let e;try{e=pluginRuntimeAPI}catch(e){}Object.assign(t.sdk,{log:deviceManager.getDeviceLogger(void 0),deviceManager,endpointManager,mediaManager,systemManager,pluginHostAPI,...e})}try{t.sdk.systemManager.setScryptedInterfaceDescriptors?.(A.TYPES_VERSION,A.ScryptedInterfaceDescriptors)?.catch((()=>{}))}catch(e){}}catch(e){console.error("sdk initialization error, import @scrypted/types or use @scrypted/client instead",e)}t.default=t.sdk},6117:function(e,t,s){"use strict";var r=this&&this.__createBinding||(Object.create?function(e,t,s,r){void 0===r&&(r=s);var n=Object.getOwnPropertyDescriptor(t,s);n&&!("get"in n?!t.__esModule:n.writable||n.configurable)||(n={enumerable:!0,get:function(){return t[s]}}),Object.defineProperty(e,r,n)}:function(e,t,s,r){void 0===r&&(r=s),e[r]=t[s]}),n=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),A=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var s in e)"default"!==s&&Object.prototype.hasOwnProperty.call(e,s)&&r(t,e,s);return n(t,e),t};Object.defineProperty(t,"__esModule",{value:!0}),t.StorageSettings=void 0;const i=A(s(7562)),{systemManager:o}=i.default;t.StorageSettings=class{constructor(e,t){this.device=e,this.settings=t,this.values={},this.hasValue={};for(const e of Object.keys(t)){const s=t[e],r=()=>this.getItem(e);let n;n="clippath"!==s.type?r:()=>{try{return JSON.parse(r())}catch(e){}},Object.defineProperty(this.values,e,{get:n,set:t=>this.putSetting(e,t),enumerable:!0}),Object.defineProperty(this.hasValue,e,{get:()=>null!=this.device.storage.getItem(e),enumerable:!0})}}get keys(){const e={};for(const t of Object.keys(this.settings))e[t]=t;return e}async getSettings(){const e=await(this.options?.onGet?.()),t=[];for(const[s,r]of Object.entries(this.settings)){let n=Object.assign({},r);e?.[s]&&(n=Object.assign(n,e[s])),n.onGet&&(n=Object.assign(n,await n.onGet())),n.hide||await(this.options?.hide?.[s]?.())||(n.key=s,n.value=this.getItemInternal(s,n,!0),"function"==typeof n.deviceFilter&&(n.deviceFilter=n.deviceFilter.toString()),t.push(n),delete n.onPut,delete n.onGet,delete n.mapPut,delete n.mapGet)}return t}async putSetting(e,t){const s=this.settings[e];let r;return s&&(r=this.getItemInternal(e,s)),this.putSettingInternal(s,r,e,t)}putSettingInternal(e,t,s,r){e?.noStore||(e?.mapPut&&(r=e.mapPut(t,r)),null==r?this.device.storage.removeItem(s):"object"==typeof r?this.device.storage.setItem(s,JSON.stringify(r)):this.device.storage.setItem(s,r?.toString())),e?.onPut?.(t,r),e?.hide||this.device.onDeviceEvent(i.ScryptedInterface.Settings,void 0)}getItemInternal(e,t,s){if(!t)return this.device.storage.getItem(e);const r=function(e,t,s,r){if(null==e)return s();const n=t.multiple?"array":t.type;if("boolean"===n)return"true"===e||"false"!==e&&(s()||!1);if("number"===n){const t=parseFloat(e);return isNaN(t)?s()||0:t}if("integer"===n){const t=parseInt(e);return isNaN(t)?s()||0:t}if("array"===n){if(!e)return s()||[];try{return JSON.parse(e)}catch(e){return s()||[]}}if("device"===n)return r?e:o.getDeviceById(e)||o.getDeviceById(s());if(e&&t.json)try{return JSON.parse(e)}catch(e){return s()}return e||s()}(this.device.storage.getItem(e),t,(()=>null!=t.persistedDefaultValue?(this.putSettingInternal(t,void 0,e,t.persistedDefaultValue),t.persistedDefaultValue):t.defaultValue),s);return t.mapGet?t.mapGet(r):r}getItem(e){return this.getItemInternal(e,this.settings[e])}}},3891: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=3891,e.exports=t},4192:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ScryptedMimeTypes=t.ScryptedInterface=t.MediaPlayerState=t.SecuritySystemObstruction=t.SecuritySystemMode=t.AirQuality=t.AirPurifierMode=t.AirPurifierStatus=t.ChargeState=t.LockState=t.PanTiltZoomMovement=t.ThermostatMode=t.TemperatureUnit=t.FanMode=t.HumidityMode=t.ScryptedDeviceType=t.ScryptedInterfaceDescriptors=t.ScryptedInterfaceMethod=t.ScryptedInterfaceProperty=t.DeviceBase=t.TYPES_VERSION=void 0,t.TYPES_VERSION="0.3.108";var s,r,n,A,i,o,a,c,l,h,g,d,u,E,I,C,B,Q;t.DeviceBase=class{},function(e){e.id="id",e.info="info",e.interfaces="interfaces",e.mixins="mixins",e.name="name",e.nativeId="nativeId",e.pluginId="pluginId",e.providedInterfaces="providedInterfaces",e.providedName="providedName",e.providedRoom="providedRoom",e.providedType="providedType",e.providerId="providerId",e.room="room",e.type="type",e.scryptedRuntimeArguments="scryptedRuntimeArguments",e.on="on",e.brightness="brightness",e.colorTemperature="colorTemperature",e.rgb="rgb",e.hsv="hsv",e.buttons="buttons",e.sensors="sensors",e.running="running",e.paused="paused",e.docked="docked",e.temperatureSetting="temperatureSetting",e.temperature="temperature",e.temperatureUnit="temperatureUnit",e.humidity="humidity",e.audioVolumes="audioVolumes",e.recordingActive="recordingActive",e.ptzCapabilities="ptzCapabilities",e.lockState="lockState",e.entryOpen="entryOpen",e.batteryLevel="batteryLevel",e.chargeState="chargeState",e.online="online",e.fromMimeType="fromMimeType",e.toMimeType="toMimeType",e.converters="converters",e.binaryState="binaryState",e.tampered="tampered",e.sleeping="sleeping",e.powerDetected="powerDetected",e.audioDetected="audioDetected",e.motionDetected="motionDetected",e.ambientLight="ambientLight",e.occupied="occupied",e.flooded="flooded",e.ultraviolet="ultraviolet",e.luminance="luminance",e.position="position",e.securitySystemState="securitySystemState",e.pm10Density="pm10Density",e.pm25Density="pm25Density",e.vocDensity="vocDensity",e.noxDensity="noxDensity",e.co2ppm="co2ppm",e.airQuality="airQuality",e.airPurifierState="airPurifierState",e.filterChangeIndication="filterChangeIndication",e.filterLifeLevel="filterLifeLevel",e.humiditySetting="humiditySetting",e.fan="fan",e.applicationInfo="applicationInfo",e.systemDevice="systemDevice"}(s||(t.ScryptedInterfaceProperty=s={})),function(e){e.listen="listen",e.probe="probe",e.setMixins="setMixins",e.setName="setName",e.setRoom="setRoom",e.setType="setType",e.getPluginJson="getPluginJson",e.turnOff="turnOff",e.turnOn="turnOn",e.setBrightness="setBrightness",e.getTemperatureMaxK="getTemperatureMaxK",e.getTemperatureMinK="getTemperatureMinK",e.setColorTemperature="setColorTemperature",e.setRgb="setRgb",e.setHsv="setHsv",e.pressButton="pressButton",e.sendNotification="sendNotification",e.start="start",e.stop="stop",e.pause="pause",e.resume="resume",e.dock="dock",e.setTemperature="setTemperature",e.setTemperatureUnit="setTemperatureUnit",e.getPictureOptions="getPictureOptions",e.takePicture="takePicture",e.getAudioStream="getAudioStream",e.setAudioVolumes="setAudioVolumes",e.startDisplay="startDisplay",e.stopDisplay="stopDisplay",e.getVideoStream="getVideoStream",e.getVideoStreamOptions="getVideoStreamOptions",e.getPrivacyMasks="getPrivacyMasks",e.setPrivacyMasks="setPrivacyMasks",e.getVideoTextOverlays="getVideoTextOverlays",e.setVideoTextOverlay="setVideoTextOverlay",e.getRecordingStream="getRecordingStream",e.getRecordingStreamCurrentTime="getRecordingStreamCurrentTime",e.getRecordingStreamOptions="getRecordingStreamOptions",e.getRecordingStreamThumbnail="getRecordingStreamThumbnail",e.deleteRecordingStream="deleteRecordingStream",e.setRecordingActive="setRecordingActive",e.ptzCommand="ptzCommand",e.getRecordedEvents="getRecordedEvents",e.getVideoClip="getVideoClip",e.getVideoClips="getVideoClips",e.getVideoClipThumbnail="getVideoClipThumbnail",e.removeVideoClips="removeVideoClips",e.setVideoStreamOptions="setVideoStreamOptions",e.startIntercom="startIntercom",e.stopIntercom="stopIntercom",e.lock="lock",e.unlock="unlock",e.addPassword="addPassword",e.getPasswords="getPasswords",e.removePassword="removePassword",e.activate="activate",e.deactivate="deactivate",e.isReversible="isReversible",e.closeEntry="closeEntry",e.openEntry="openEntry",e.getDevice="getDevice",e.releaseDevice="releaseDevice",e.adoptDevice="adoptDevice",e.discoverDevices="discoverDevices",e.createDevice="createDevice",e.getCreateDeviceSettings="getCreateDeviceSettings",e.reboot="reboot",e.getRefreshFrequency="getRefreshFrequency",e.refresh="refresh",e.getMediaStatus="getMediaStatus",e.load="load",e.seek="seek",e.skipNext="skipNext",e.skipPrevious="skipPrevious",e.convert="convert",e.convertMedia="convertMedia",e.getSettings="getSettings",e.putSetting="putSetting",e.armSecuritySystem="armSecuritySystem",e.disarmSecuritySystem="disarmSecuritySystem",e.setAirPurifierState="setAirPurifierState",e.getReadmeMarkdown="getReadmeMarkdown",e.getOauthUrl="getOauthUrl",e.onOauthCallback="onOauthCallback",e.canMixin="canMixin",e.getMixin="getMixin",e.releaseMixin="releaseMixin",e.onRequest="onRequest",e.onConnection="onConnection",e.onPush="onPush",e.run="run",e.eval="eval",e.loadScripts="loadScripts",e.saveScript="saveScript",e.forkInterface="forkInterface",e.trackObjects="trackObjects",e.getDetectionInput="getDetectionInput",e.getObjectTypes="getObjectTypes",e.detectObjects="detectObjects",e.generateObjectDetections="generateObjectDetections",e.getDetectionModel="getDetectionModel",e.setHumidity="setHumidity",e.setFan="setFan",e.startRTCSignalingSession="startRTCSignalingSession",e.createRTCSignalingSession="createRTCSignalingSession",e.getScryptedUserAccessControl="getScryptedUserAccessControl",e.generateVideoFrames="generateVideoFrames",e.connectStream="connectStream",e.getTTYSettings="getTTYSettings"}(r||(t.ScryptedInterfaceMethod=r={})),t.ScryptedInterfaceDescriptors={ScryptedDevice:{name:"ScryptedDevice",methods:["listen","probe","setMixins","setName","setRoom","setType"],properties:["id","info","interfaces","mixins","name","nativeId","pluginId","providedInterfaces","providedName","providedRoom","providedType","providerId","room","type"]},ScryptedPlugin:{name:"ScryptedPlugin",methods:["getPluginJson"],properties:[]},ScryptedPluginRuntime:{name:"ScryptedPluginRuntime",methods:[],properties:["scryptedRuntimeArguments"]},OnOff:{name:"OnOff",methods:["turnOff","turnOn"],properties:["on"]},Brightness:{name:"Brightness",methods:["setBrightness"],properties:["brightness"]},ColorSettingTemperature:{name:"ColorSettingTemperature",methods:["getTemperatureMaxK","getTemperatureMinK","setColorTemperature"],properties:["colorTemperature"]},ColorSettingRgb:{name:"ColorSettingRgb",methods:["setRgb"],properties:["rgb"]},ColorSettingHsv:{name:"ColorSettingHsv",methods:["setHsv"],properties:["hsv"]},Buttons:{name:"Buttons",methods:[],properties:["buttons"]},PressButtons:{name:"PressButtons",methods:["pressButton"],properties:[]},Sensors:{name:"Sensors",methods:[],properties:["sensors"]},Notifier:{name:"Notifier",methods:["sendNotification"],properties:[]},StartStop:{name:"StartStop",methods:["start","stop"],properties:["running"]},Pause:{name:"Pause",methods:["pause","resume"],properties:["paused"]},Dock:{name:"Dock",methods:["dock"],properties:["docked"]},TemperatureSetting:{name:"TemperatureSetting",methods:["setTemperature"],properties:["temperatureSetting"]},Thermometer:{name:"Thermometer",methods:["setTemperatureUnit"],properties:["temperature","temperatureUnit"]},HumiditySensor:{name:"HumiditySensor",methods:[],properties:["humidity"]},Camera:{name:"Camera",methods:["getPictureOptions","takePicture"],properties:[]},Microphone:{name:"Microphone",methods:["getAudioStream"],properties:[]},AudioVolumeControl:{name:"AudioVolumeControl",methods:["setAudioVolumes"],properties:["audioVolumes"]},Display:{name:"Display",methods:["startDisplay","stopDisplay"],properties:[]},VideoCamera:{name:"VideoCamera",methods:["getVideoStream","getVideoStreamOptions"],properties:[]},VideoCameraMask:{name:"VideoCameraMask",methods:["getPrivacyMasks","setPrivacyMasks"],properties:[]},VideoTextOverlays:{name:"VideoTextOverlays",methods:["getVideoTextOverlays","setVideoTextOverlay"],properties:[]},VideoRecorder:{name:"VideoRecorder",methods:["getRecordingStream","getRecordingStreamCurrentTime","getRecordingStreamOptions","getRecordingStreamThumbnail"],properties:["recordingActive"]},VideoRecorderManagement:{name:"VideoRecorderManagement",methods:["deleteRecordingStream","setRecordingActive"],properties:[]},PanTiltZoom:{name:"PanTiltZoom",methods:["ptzCommand"],properties:["ptzCapabilities"]},EventRecorder:{name:"EventRecorder",methods:["getRecordedEvents"],properties:[]},VideoClips:{name:"VideoClips",methods:["getVideoClip","getVideoClips","getVideoClipThumbnail","removeVideoClips"],properties:[]},VideoCameraConfiguration:{name:"VideoCameraConfiguration",methods:["setVideoStreamOptions"],properties:[]},Intercom:{name:"Intercom",methods:["startIntercom","stopIntercom"],properties:[]},Lock:{name:"Lock",methods:["lock","unlock"],properties:["lockState"]},PasswordStore:{name:"PasswordStore",methods:["addPassword","getPasswords","removePassword"],properties:[]},Scene:{name:"Scene",methods:["activate","deactivate","isReversible"],properties:[]},Entry:{name:"Entry",methods:["closeEntry","openEntry"],properties:[]},EntrySensor:{name:"EntrySensor",methods:[],properties:["entryOpen"]},DeviceProvider:{name:"DeviceProvider",methods:["getDevice","releaseDevice"],properties:[]},DeviceDiscovery:{name:"DeviceDiscovery",methods:["adoptDevice","discoverDevices"],properties:[]},DeviceCreator:{name:"DeviceCreator",methods:["createDevice","getCreateDeviceSettings"],properties:[]},Battery:{name:"Battery",methods:[],properties:["batteryLevel"]},Charger:{name:"Charger",methods:[],properties:["chargeState"]},Reboot:{name:"Reboot",methods:["reboot"],properties:[]},Refresh:{name:"Refresh",methods:["getRefreshFrequency","refresh"],properties:[]},MediaPlayer:{name:"MediaPlayer",methods:["getMediaStatus","load","seek","skipNext","skipPrevious"],properties:[]},Online:{name:"Online",methods:[],properties:["online"]},BufferConverter:{name:"BufferConverter",methods:["convert"],properties:["fromMimeType","toMimeType"]},MediaConverter:{name:"MediaConverter",methods:["convertMedia"],properties:["converters"]},Settings:{name:"Settings",methods:["getSettings","putSetting"],properties:[]},BinarySensor:{name:"BinarySensor",methods:[],properties:["binaryState"]},TamperSensor:{name:"TamperSensor",methods:[],properties:["tampered"]},Sleep:{name:"Sleep",methods:[],properties:["sleeping"]},PowerSensor:{name:"PowerSensor",methods:[],properties:["powerDetected"]},AudioSensor:{name:"AudioSensor",methods:[],properties:["audioDetected"]},MotionSensor:{name:"MotionSensor",methods:[],properties:["motionDetected"]},AmbientLightSensor:{name:"AmbientLightSensor",methods:[],properties:["ambientLight"]},OccupancySensor:{name:"OccupancySensor",methods:[],properties:["occupied"]},FloodSensor:{name:"FloodSensor",methods:[],properties:["flooded"]},UltravioletSensor:{name:"UltravioletSensor",methods:[],properties:["ultraviolet"]},LuminanceSensor:{name:"LuminanceSensor",methods:[],properties:["luminance"]},PositionSensor:{name:"PositionSensor",methods:[],properties:["position"]},SecuritySystem:{name:"SecuritySystem",methods:["armSecuritySystem","disarmSecuritySystem"],properties:["securitySystemState"]},PM10Sensor:{name:"PM10Sensor",methods:[],properties:["pm10Density"]},PM25Sensor:{name:"PM25Sensor",methods:[],properties:["pm25Density"]},VOCSensor:{name:"VOCSensor",methods:[],properties:["vocDensity"]},NOXSensor:{name:"NOXSensor",methods:[],properties:["noxDensity"]},CO2Sensor:{name:"CO2Sensor",methods:[],properties:["co2ppm"]},AirQualitySensor:{name:"AirQualitySensor",methods:[],properties:["airQuality"]},AirPurifier:{name:"AirPurifier",methods:["setAirPurifierState"],properties:["airPurifierState"]},FilterMaintenance:{name:"FilterMaintenance",methods:[],properties:["filterChangeIndication","filterLifeLevel"]},Readme:{name:"Readme",methods:["getReadmeMarkdown"],properties:[]},OauthClient:{name:"OauthClient",methods:["getOauthUrl","onOauthCallback"],properties:[]},MixinProvider:{name:"MixinProvider",methods:["canMixin","getMixin","releaseMixin"],properties:[]},HttpRequestHandler:{name:"HttpRequestHandler",methods:["onRequest"],properties:[]},EngineIOHandler:{name:"EngineIOHandler",methods:["onConnection"],properties:[]},PushHandler:{name:"PushHandler",methods:["onPush"],properties:[]},Program:{name:"Program",methods:["run"],properties:[]},Scriptable:{name:"Scriptable",methods:["eval","loadScripts","saveScript"],properties:[]},ClusterForkInterface:{name:"ClusterForkInterface",methods:["forkInterface"],properties:[]},ObjectTracker:{name:"ObjectTracker",methods:["trackObjects"],properties:[]},ObjectDetector:{name:"ObjectDetector",methods:["getDetectionInput","getObjectTypes"],properties:[]},ObjectDetection:{name:"ObjectDetection",methods:["detectObjects","generateObjectDetections","getDetectionModel"],properties:[]},ObjectDetectionPreview:{name:"ObjectDetectionPreview",methods:[],properties:[]},ObjectDetectionGenerator:{name:"ObjectDetectionGenerator",methods:[],properties:[]},HumiditySetting:{name:"HumiditySetting",methods:["setHumidity"],properties:["humiditySetting"]},Fan:{name:"Fan",methods:["setFan"],properties:["fan"]},RTCSignalingChannel:{name:"RTCSignalingChannel",methods:["startRTCSignalingSession"],properties:[]},RTCSignalingClient:{name:"RTCSignalingClient",methods:["createRTCSignalingSession"],properties:[]},LauncherApplication:{name:"LauncherApplication",methods:[],properties:["applicationInfo"]},ScryptedUser:{name:"ScryptedUser",methods:["getScryptedUserAccessControl"],properties:[]},VideoFrameGenerator:{name:"VideoFrameGenerator",methods:["generateVideoFrames"],properties:[]},StreamService:{name:"StreamService",methods:["connectStream"],properties:[]},TTY:{name:"TTY",methods:[],properties:[]},TTYSettings:{name:"TTYSettings",methods:["getTTYSettings"],properties:[]},ScryptedSystemDevice:{name:"ScryptedSystemDevice",methods:[],properties:["systemDevice"]},ScryptedDeviceCreator:{name:"ScryptedDeviceCreator",methods:[],properties:[]},ScryptedSettings:{name:"ScryptedSettings",methods:[],properties:[]}},function(e){e.Builtin="Builtin",e.Camera="Camera",e.Fan="Fan",e.Light="Light",e.Switch="Switch",e.Outlet="Outlet",e.Sensor="Sensor",e.Scene="Scene",e.Program="Program",e.Automation="Automation",e.Vacuum="Vacuum",e.Notifier="Notifier",e.Thermostat="Thermostat",e.Lock="Lock",e.PasswordControl="PasswordControl",e.Display="Display",e.SmartDisplay="SmartDisplay",e.Speaker="Speaker",e.SmartSpeaker="SmartSpeaker",e.Event="Event",e.Entry="Entry",e.Garage="Garage",e.DeviceProvider="DeviceProvider",e.DataSource="DataSource",e.API="API",e.Doorbell="Doorbell",e.Irrigation="Irrigation",e.Valve="Valve",e.Person="Person",e.SecuritySystem="SecuritySystem",e.WindowCovering="WindowCovering",e.Siren="Siren",e.AirPurifier="AirPurifier",e.Unknown="Unknown"}(n||(t.ScryptedDeviceType=n={})),function(e){e.Humidify="Humidify",e.Dehumidify="Dehumidify",e.Auto="Auto",e.Off="Off"}(A||(t.HumidityMode=A={})),function(e){e.Auto="Auto",e.Manual="Manual"}(i||(t.FanMode=i={})),function(e){e.C="C",e.F="F"}(o||(t.TemperatureUnit=o={})),function(e){e.Off="Off",e.Cool="Cool",e.Heat="Heat",e.HeatCool="HeatCool",e.Auto="Auto",e.FanOnly="FanOnly",e.Purifier="Purifier",e.Eco="Eco",e.Dry="Dry",e.On="On"}(a||(t.ThermostatMode=a={})),function(e){e.Absolute="Absolute",e.Relative="Relative",e.Continuous="Continuous",e.Preset="Preset",e.Home="Home"}(c||(t.PanTiltZoomMovement=c={})),function(e){e.Locked="Locked",e.Unlocked="Unlocked",e.Jammed="Jammed"}(l||(t.LockState=l={})),function(e){e.Trickle="trickle",e.Charging="charging",e.NotCharging="not-charging"}(h||(t.ChargeState=h={})),function(e){e.Inactive="Inactive",e.Idle="Idle",e.Active="Active",e.ActiveNightMode="ActiveNightMode"}(g||(t.AirPurifierStatus=g={})),function(e){e.Manual="Manual",e.Automatic="Automatic"}(d||(t.AirPurifierMode=d={})),function(e){e.Unknown="Unknown",e.Excellent="Excellent",e.Good="Good",e.Fair="Fair",e.Inferior="Inferior",e.Poor="Poor"}(u||(t.AirQuality=u={})),function(e){e.Disarmed="Disarmed",e.HomeArmed="HomeArmed",e.AwayArmed="AwayArmed",e.NightArmed="NightArmed"}(E||(t.SecuritySystemMode=E={})),function(e){e.Sensor="Sensor",e.Occupied="Occupied",e.Time="Time",e.Error="Error"}(I||(t.SecuritySystemObstruction=I={})),function(e){e.Idle="Idle",e.Playing="Playing",e.Paused="Paused",e.Buffering="Buffering"}(C||(t.MediaPlayerState=C={})),function(e){e.ScryptedDevice="ScryptedDevice",e.ScryptedPlugin="ScryptedPlugin",e.ScryptedPluginRuntime="ScryptedPluginRuntime",e.OnOff="OnOff",e.Brightness="Brightness",e.ColorSettingTemperature="ColorSettingTemperature",e.ColorSettingRgb="ColorSettingRgb",e.ColorSettingHsv="ColorSettingHsv",e.Buttons="Buttons",e.PressButtons="PressButtons",e.Sensors="Sensors",e.Notifier="Notifier",e.StartStop="StartStop",e.Pause="Pause",e.Dock="Dock",e.TemperatureSetting="TemperatureSetting",e.Thermometer="Thermometer",e.HumiditySensor="HumiditySensor",e.Camera="Camera",e.Microphone="Microphone",e.AudioVolumeControl="AudioVolumeControl",e.Display="Display",e.VideoCamera="VideoCamera",e.VideoCameraMask="VideoCameraMask",e.VideoTextOverlays="VideoTextOverlays",e.VideoRecorder="VideoRecorder",e.VideoRecorderManagement="VideoRecorderManagement",e.PanTiltZoom="PanTiltZoom",e.EventRecorder="EventRecorder",e.VideoClips="VideoClips",e.VideoCameraConfiguration="VideoCameraConfiguration",e.Intercom="Intercom",e.Lock="Lock",e.PasswordStore="PasswordStore",e.Scene="Scene",e.Entry="Entry",e.EntrySensor="EntrySensor",e.DeviceProvider="DeviceProvider",e.DeviceDiscovery="DeviceDiscovery",e.DeviceCreator="DeviceCreator",e.Battery="Battery",e.Charger="Charger",e.Reboot="Reboot",e.Refresh="Refresh",e.MediaPlayer="MediaPlayer",e.Online="Online",e.BufferConverter="BufferConverter",e.MediaConverter="MediaConverter",e.Settings="Settings",e.BinarySensor="BinarySensor",e.TamperSensor="TamperSensor",e.Sleep="Sleep",e.PowerSensor="PowerSensor",e.AudioSensor="AudioSensor",e.MotionSensor="MotionSensor",e.AmbientLightSensor="AmbientLightSensor",e.OccupancySensor="OccupancySensor",e.FloodSensor="FloodSensor",e.UltravioletSensor="UltravioletSensor",e.LuminanceSensor="LuminanceSensor",e.PositionSensor="PositionSensor",e.SecuritySystem="SecuritySystem",e.PM10Sensor="PM10Sensor",e.PM25Sensor="PM25Sensor",e.VOCSensor="VOCSensor",e.NOXSensor="NOXSensor",e.CO2Sensor="CO2Sensor",e.AirQualitySensor="AirQualitySensor",e.AirPurifier="AirPurifier",e.FilterMaintenance="FilterMaintenance",e.Readme="Readme",e.OauthClient="OauthClient",e.MixinProvider="MixinProvider",e.HttpRequestHandler="HttpRequestHandler",e.EngineIOHandler="EngineIOHandler",e.PushHandler="PushHandler",e.Program="Program",e.Scriptable="Scriptable",e.ClusterForkInterface="ClusterForkInterface",e.ObjectTracker="ObjectTracker",e.ObjectDetector="ObjectDetector",e.ObjectDetection="ObjectDetection",e.ObjectDetectionPreview="ObjectDetectionPreview",e.ObjectDetectionGenerator="ObjectDetectionGenerator",e.HumiditySetting="HumiditySetting",e.Fan="Fan",e.RTCSignalingChannel="RTCSignalingChannel",e.RTCSignalingClient="RTCSignalingClient",e.LauncherApplication="LauncherApplication",e.ScryptedUser="ScryptedUser",e.VideoFrameGenerator="VideoFrameGenerator",e.StreamService="StreamService",e.TTY="TTY",e.TTYSettings="TTYSettings",e.ScryptedSystemDevice="ScryptedSystemDevice",e.ScryptedDeviceCreator="ScryptedDeviceCreator",e.ScryptedSettings="ScryptedSettings"}(B||(t.ScryptedInterface=B={})),function(e){e.Url="text/x-uri",e.InsecureLocalUrl="text/x-insecure-local-uri",e.LocalUrl="text/x-local-uri",e.ServerId="text/x-server-id",e.PushEndpoint="text/x-push-endpoint",e.SchemePrefix="x-scrypted/x-scrypted-scheme-",e.MediaStreamUrl="text/x-media-url",e.MediaObject="x-scrypted/x-scrypted-media-object",e.RequestMediaObject="x-scrypted/x-scrypted-request-media-object",e.RequestMediaStream="x-scrypted/x-scrypted-request-stream",e.MediaStreamFeedback="x-scrypted/x-media-stream-feedback",e.FFmpegInput="x-scrypted/x-ffmpeg-input",e.FFmpegTranscodeStream="x-scrypted/x-ffmpeg-transcode-stream",e.RTCSignalingChannel="x-scrypted/x-scrypted-rtc-signaling-channel",e.RTCSignalingSession="x-scrypted/x-scrypted-rtc-signaling-session",e.RTCConnectionManagement="x-scrypted/x-scrypted-rtc-connection-management",e.Image="x-scrypted/x-scrypted-image"}(Q||(t.ScryptedMimeTypes=Q={}))},7077:(e,t,s)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.BaseBaichuanClass=t.BaichuanLogger=void 0;const r=s(7562),n=s(5098);class A{constructor(e,t,s){this.baseLogger=e,this.deviceName=t,this.isDebugEnabledCallback=s}formatMessage(e,...t){const s=(new Date).toLocaleString();return`${`[${this.deviceName}] [${s}] [${e}]`} ${t.map((e=>"object"==typeof e?JSON.stringify(e):String(e))).join(" ")}`}log(...e){this.baseLogger.log(this.formatMessage("LOG",...e))}error(...e){this.baseLogger.error(this.formatMessage("ERROR",...e))}warn(...e){this.baseLogger.warn(this.formatMessage("WARN",...e))}debug(...e){this.isDebugEnabledCallback()&&this.baseLogger.debug(this.formatMessage("DEBUG",...e))}isDebugEnabled(){return this.isDebugEnabledCallback()}assert(e,...t){this.baseLogger.assert(e,...t)}clear(){this.baseLogger.clear()}count(e){this.baseLogger.count(e)}countReset(e){this.baseLogger.countReset(e)}dir(e,t){this.baseLogger.dir(e,t)}dirxml(...e){this.baseLogger.dirxml(...e)}group(...e){this.baseLogger.group(...e)}groupCollapsed(...e){this.baseLogger.groupCollapsed(...e)}groupEnd(){this.baseLogger.groupEnd()}info(...e){this.baseLogger.info(this.formatMessage("INFO",...e))}table(e,t){this.baseLogger.table(e,t)}time(e){this.baseLogger.time(e)}timeEnd(e){this.baseLogger.timeEnd(e)}timeLog(e,...t){this.baseLogger.timeLog(e,...t)}trace(...e){this.baseLogger.trace(...e)}get memory(){return this.baseLogger.memory}get Console(){return this.baseLogger.Console}profile(e){"function"==typeof this.baseLogger.profile&&this.baseLogger.profile(e)}profileEnd(e){"function"==typeof this.baseLogger.profileEnd&&this.baseLogger.profileEnd(e)}timeStamp(e){"function"==typeof this.baseLogger.timeStamp&&this.baseLogger.timeStamp(e)}context(...e){"function"==typeof this.baseLogger.context&&this.baseLogger.context(...e)}}t.BaichuanLogger=A;class i extends r.ScryptedDeviceBase{constructor(){super(...arguments),this.lastDisconnectTime=0,this.reconnectBackoffMs=2e3,this.eventSubscriptionActive=!1}getBaichuanLogger(){return new A(this.console,this.getDeviceName(),(()=>this.isDebugEnabled()))}async onBeforeCleanup(){}async ensureBaichuanClient(){if(this.baichuanApi&&this.baichuanApi.client.isSocketConnected()&&this.baichuanApi.client.loggedIn)return this.baichuanApi;if(this.ensureClientPromise)return await this.ensureClientPromise;if(this.lastDisconnectTime>0){const e=Date.now()-this.lastDisconnectTime;if(e<this.reconnectBackoffMs){const t=this.reconnectBackoffMs-e;this.getBaichuanLogger().log(`Waiting ${t}ms before reconnection (backoff)`),await new Promise((e=>setTimeout(e,t)))}}this.ensureClientPromise=(async()=>{const e=this.getConnectionConfig();this.baichuanApi&&await this.cleanupBaichuanApi();const t=this.getBaichuanLogger(),s=await(0,n.createBaichuanApi)({inputs:{host:e.host,username:e.username,password:e.password,uid:e.uid,logger:t,debugOptions:e.debugOptions},transport:e.transport,logger:t});if(await s.login(),!s.client.isSocketConnected())throw new Error("Socket not connected after login");return this.attachBaichuanListeners(s),this.baichuanApi=s,this.connectionTime=Date.now(),s})();try{return await this.ensureClientPromise}finally{this.ensureClientPromise=void 0}}attachBaichuanListeners(e){const t=this.getBaichuanLogger(),s=this.getConnectionCallbacks();this.errorListener=e=>{const r=e?.message||e?.toString?.()||String(e);if("string"==typeof r&&(r.includes("Baichuan socket closed")||r.includes("Baichuan UDP stream closed")||r.includes("Not running")))t.debug(`error (recoverable): ${r}`);else if(t.error(`error: ${r}`),s.onError)try{s.onError(e)}catch{}},this.closeListener=async()=>{try{const s=e.client.isSocketConnected(),r=e.client.loggedIn;t.log(`Connection state before close: connected=${s}, loggedIn=${r}`);const n=e.client;(n?.lastRx||n?.lastTx)&&t.debug(`Last message info: lastRx=${JSON.stringify(n.lastRx)}, lastTx=${JSON.stringify(n.lastTx)}`)}catch(e){t.debug(`Could not get connection state: ${e}`)}const r=Date.now(),n=r-this.lastDisconnectTime;if(this.lastDisconnectTime=r,t.log(`Socket closed, resetting client state for reconnection (last disconnect ${n}ms ago)`),await this.cleanupBaichuanApi(),s.onClose)try{await s.onClose()}catch{}},e.client.on("error",this.errorListener),e.client.on("close",this.closeListener)}async cleanupBaichuanApi(){if(!this.baichuanApi)return;const e=this.baichuanApi;if(await this.unsubscribeFromEvents(),await this.onBeforeCleanup(),this.closeListener){try{e.client.off("close",this.closeListener)}catch{}this.closeListener=void 0}if(this.errorListener){try{e.client.off("error",this.errorListener)}catch{}this.errorListener=void 0}try{e.client.isSocketConnected()&&await e.close()}catch{}this.baichuanApi=void 0,this.ensureClientPromise=void 0}async subscribeToEvents(){const e=this.getBaichuanLogger(),t=this.getConnectionCallbacks();if(!t.onSimpleEvent)return;if(this.eventSubscriptionActive&&this.baichuanApi){if(this.baichuanApi.client.isSocketConnected()&&this.baichuanApi.client.loggedIn)return void e.debug("Event subscription already active");this.eventSubscriptionActive=!1}await this.unsubscribeFromEvents();const s=await this.ensureBaichuanClient();if(s.client.isSocketConnected()&&s.client.loggedIn)if(!t.getEventSubscriptionEnabled||t.getEventSubscriptionEnabled())try{await s.onSimpleEvent(t.onSimpleEvent),this.eventSubscriptionActive=!0,e.log("Subscribed to Baichuan events")}catch(t){e.warn("Failed to subscribe to events",t),this.eventSubscriptionActive=!1}else e.debug("Event subscription disabled");else e.warn("Cannot subscribe to events: connection not ready")}async unsubscribeFromEvents(){const e=this.getBaichuanLogger(),t=this.getConnectionCallbacks();if(this.eventSubscriptionActive&&this.baichuanApi&&t.onSimpleEvent)try{this.baichuanApi.offSimpleEvent(t.onSimpleEvent),e.debug("Unsubscribed from Baichuan events")}catch(t){e.warn("Error unsubscribing from events",t)}this.eventSubscriptionActive=!1}}t.BaseBaichuanClass=i},6125:function(e,t,s){"use strict";var r=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.ReolinkNativeBatteryCamera=void 0;const n=r(s(7562)),A=s(8799),i=s(9560);class o extends A.CommonCameraMixin{isBatteryInfoLoggingEnabled(){return(this.storageSettings.values.debugLogs||[]).includes(i.DebugLogOption.BatteryInfo)}constructor(e,t,s){super(e,t,{type:"battery",nvrDevice:s}),this.plugin=t,this.motionDetected=!1,this.periodicStarted=!1,this.forceNewSnapshot=!1,this.batteryUpdateInProgress=!1}async takePicture(e){const t=this.getBaichuanLogger();if(!this.forceNewSnapshot&&this.lastPicture)return t.debug(`Returning cached snapshot, taken at ${new Date(this.lastPicture.atMs).toLocaleString()}`),this.lastPicture.mo;if(this.takePictureInFlight)return await this.takePictureInFlight;t.log(`Taking new snapshot from camera (forceNewSnapshot: ${this.forceNewSnapshot})`),this.forceNewSnapshot=!1,this.takePictureInFlight=(async()=>{const e=this.storageSettings.values.rtspChannel,s=await this.withBaichuanClient((async t=>await t.getSnapshot(e))),r=await n.default.mediaManager.createMediaObject(s,"image/jpeg");return this.lastPicture={mo:r,atMs:Date.now()},t.log(`Snapshot taken at ${new Date(this.lastPicture.atMs).toLocaleString()}`),r})();try{return await this.takePictureInFlight}finally{this.takePictureInFlight=void 0}}async getPictureOptions(){return[]}async init(){this.startPeriodicTasks(),await this.alignAuxDevicesState(),await this.updateBatteryInfo()}async release(){return this.stopPeriodicTasks(),this.resetBaichuanClient()}stopPeriodicTasks(){this.sleepCheckTimer&&(clearInterval(this.sleepCheckTimer),this.sleepCheckTimer=void 0),this.batteryUpdateTimer&&(clearInterval(this.batteryUpdateTimer),this.batteryUpdateTimer=void 0),this.periodicStarted=!1}startPeriodicTasks(){if(this.periodicStarted)return;const e=this.getBaichuanLogger();this.periodicStarted=!0,e.log("Starting periodic tasks for battery camera"),this.nvrDevice||(this.sleepCheckTimer=setInterval((async()=>{try{const t=this.baichuanApi,s=this.storageSettings.values.rtspChannel;if(!t)return void(this.sleeping||(e.log("Camera is sleeping: no active Baichuan client"),this.sleeping=!0));const r=t.getSleepStatus({channel:s});await this.updateSleepingState(r)}catch(t){e.warn("Error checking sleeping state:",t)}}),5e3));const{batteryUpdateIntervalMinutes:t=10}=this.storageSettings.values,s=6e4*t;this.batteryUpdateTimer=setInterval((()=>{this.updateBatteryAndSnapshot().catch((()=>{}))}),s),e.log(`Periodic tasks started: sleep check every 5s, battery update every ${t} minutes`)}async updateSleepingState(e){try{if(this.isBatteryInfoLoggingEnabled()&&this.getBaichuanLogger().debug("getSleepStatus result:",JSON.stringify(e)),"sleeping"===e.state)this.sleeping||(this.getBaichuanLogger().log(`Camera is sleeping: ${e.reason}`),this.sleeping=!0);else if("awake"===e.state){const t=this.sleeping;t&&(this.getBaichuanLogger().log(`Camera woke up: ${e.reason}`),this.sleeping=!1),t&&(this.alignAuxDevicesState().catch((()=>{})),this.forceNewSnapshot&&this.takePicture().catch((()=>{})))}else this.getBaichuanLogger().debug(`Sleep status unknown: ${e.reason}`)}catch(e){this.getBaichuanLogger().debug("Error in checkSleepingState:",e)}}async checkRecordingAction(e){const t=this.plugin.nvrDeviceId;if(t&&this.mixins.includes(t)){const t=this.getBaichuanLogger(),s=await this.thisDevice.getSettings(),r=!s.find((e=>"recording:privacyMode"===e.key))?.value,{lowThresholdBatteryRecording:n,highThresholdBatteryRecording:A}=this.storageSettings.values;r&&e<n?(t.log(`Recording is enabled, but battery level is below low threshold (${e}% < ${n}%), disabling recording`),await this.thisDevice.putSetting("recording:privacyMode",!0)):!r&&e>A&&(t.log(`Recording is disabled, but battery level is above high threshold (${e}% > ${A}%), enabling recording`),await this.thisDevice.putSetting("recording:privacyMode",!1))}}async updateBatteryInfo(){const e=await this.ensureClient(),t=this.storageSettings.values.rtspChannel,s=await e.getBatteryInfo(t);if(this.isBatteryInfoLoggingEnabled()&&this.getBaichuanLogger().debug("getBatteryInfo result:",JSON.stringify(s)),void 0!==s.batteryPercent){const e=this.lastBatteryLevel;this.batteryLevel=s.batteryPercent,this.lastBatteryLevel=s.batteryPercent;let t=!0;if(void 0!==e&&e!==s.batteryPercent)if(void 0!==s.chargeStatus){const t="0"===s.chargeStatus||"2"===s.chargeStatus;this.getBaichuanLogger().log(`Battery level changed: ${e}% → ${s.batteryPercent}% (charging: ${t})`)}else this.getBaichuanLogger().log(`Battery level changed: ${e}% → ${s.batteryPercent}%`);else if(void 0===e)if(void 0!==s.chargeStatus){const e="0"===s.chargeStatus||"2"===s.chargeStatus;this.getBaichuanLogger().log(`Battery level set: ${s.batteryPercent}% (charging: ${e})`)}else this.getBaichuanLogger().log(`Battery level set: ${s.batteryPercent}%`);else t=!1;t&&await this.checkRecordingAction(s.batteryPercent)}}async updateBatteryAndSnapshot(){if(this.batteryUpdateInProgress)this.getBaichuanLogger().debug("Battery update already in progress, skipping");else{this.batteryUpdateInProgress=!0;try{const e=this.storageSettings.values.rtspChannel,t=this.storageSettings.values.batteryUpdateIntervalMinutes??10;this.getBaichuanLogger().log(`Force battery update interval started (every ${t} minutes)`);const s=await this.ensureClient();if(!s)return void this.getBaichuanLogger().warn("Failed to ensure client connection for battery update");let r=s.getSleepStatus({channel:e});if("sleeping"===r.state){this.getBaichuanLogger().log("Camera is sleeping, waking up for periodic update...");try{await s.wakeUp(e,{waitAfterWakeMs:2e3}),this.getBaichuanLogger().log("Wake command sent, waiting for camera to wake up...")}catch(e){return void this.getBaichuanLogger().warn("Failed to wake up camera:",e)}const t=3e4,n=Date.now();let A=!1;for(;Date.now()-n<t;)if(await new Promise((e=>setTimeout(e,1e3))),r=s.getSleepStatus({channel:e}),"awake"===r.state){A=!0,this.getBaichuanLogger().log("Camera is now awake"),this.sleeping=!1;break}if(!A)return void this.getBaichuanLogger().warn("Camera did not wake up within timeout, skipping update")}else"awake"===r.state&&(this.sleeping=!1);try{await this.updateBatteryInfo()}catch(e){this.getBaichuanLogger().warn("Failed to get battery info during periodic update:",e)}try{await this.alignAuxDevicesState()}catch(e){this.getBaichuanLogger().warn("Failed to align auxiliary devices state:",e)}try{this.forceNewSnapshot=!0,await this.takePicture(),this.getBaichuanLogger().log("Snapshot updated during periodic update")}catch(e){this.getBaichuanLogger().warn("Failed to update snapshot during periodic update:",e)}}catch(e){this.getBaichuanLogger().warn("Failed to update battery and snapshot",e)}finally{this.batteryUpdateInProgress=!1}}}async resetBaichuanClient(e){try{if(this.unsubscribedToEvents?.(),this.streamManager){const t=e?.message||e?.toString?.()||"connection reset";await this.streamManager.closeAllStreams(t)}await(this.baichuanApi?.close())}catch(e){this.getBaichuanLogger().warn("Error closing Baichuan client during reset",e)}finally{this.baichuanApi=void 0,this.connectionTime=void 0,this.ensureClientPromise=void 0,this.sleepCheckTimer&&(clearInterval(this.sleepCheckTimer),this.sleepCheckTimer=void 0),this.batteryUpdateTimer&&(clearInterval(this.batteryUpdateTimer),this.batteryUpdateTimer=void 0)}if(e){const t=e?.message||e?.toString?.()||e;this.getBaichuanLogger().warn(`Baichuan client reset requested: ${t}`)}}async withBaichuanRetry(e){return await e()}async withBaichuanClient(e){return e(await this.ensureClient())}async createStreamClient(){return await this.ensureClient()}}t.ReolinkNativeBatteryCamera=o},4417:function(e,t,s){"use strict";var r,n=this&&this.__createBinding||(Object.create?function(e,t,s,r){void 0===r&&(r=s);var n=Object.getOwnPropertyDescriptor(t,s);n&&!("get"in n?!t.__esModule:n.writable||n.configurable)||(n={enumerable:!0,get:function(){return t[s]}}),Object.defineProperty(e,r,n)}:function(e,t,s,r){void 0===r&&(r=s),e[r]=t[s]}),A=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),i=this&&this.__importStar||(r=function(e){return r=Object.getOwnPropertyNames||function(e){var t=[];for(var s in e)Object.prototype.hasOwnProperty.call(e,s)&&(t[t.length]=s);return t},r(e)},function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var s=r(e),i=0;i<s.length;i++)"default"!==s[i]&&n(t,e,s[i]);return A(t,e),t});Object.defineProperty(t,"__esModule",{value:!0}),t.ReolinkNativeCamera=t.b64ToMo=t.moToB64=void 0;const o=i(s(7562)),a=s(8799),c=s(5098);t.moToB64=async e=>{const t=await o.default.mediaManager.convertMediaObjectToBuffer(e,"image/jpeg");return t?.toString("base64")};t.b64ToMo=async e=>{const t=Buffer.from(e,"base64");return await o.default.mediaManager.createMediaObject(t,"image/jpeg")};class l extends a.CommonCameraMixin{constructor(e,t,s){super(e,t,{type:"regular",nvrDevice:s}),this.plugin=t,this.initComplete=!1,this.periodicStarted=!1}async resetBaichuanClient(e){try{this.unsubscribedToEvents?.(),await(this.baichuanApi?.close())}catch(e){this.getBaichuanLogger().warn("Error closing Baichuan client during reset",e)}finally{this.baichuanApi=void 0,this.connectionTime=void 0,this.ensureClientPromise=void 0,this.passiveRefreshTimer&&(clearTimeout(this.passiveRefreshTimer),this.passiveRefreshTimer=void 0)}if(e){const t=e?.message||e?.toString?.()||e;this.getBaichuanLogger().warn(`Baichuan client reset requested: ${t}`)}}async withBaichuanRetry(e){try{return await e()}catch(t){if(!this.isRecoverableBaichuanError(t))throw t;await this.resetBaichuanClient(t),this.cachedNetPort=void 0;try{return await e()}catch(e){if(this.isRecoverableBaichuanError(e))throw e;throw e}}}async init(){this.startPeriodicTasks(),await this.alignAuxDevicesState()}async createStreamClient(){const{ipAddress:e,username:t,password:s}=this.storageSettings.values,r=this.getBaichuanDebugOptions(),n=await(0,c.createBaichuanApi)({inputs:{host:e,username:t,password:s,logger:this.console,debugOptions:r},transport:"tcp",logger:this.console});return await n.login(),n}getClient(){return this.baichuanApi}async release(){return this.statusPollTimer&&clearInterval(this.statusPollTimer),this.passiveRefreshTimer&&(clearTimeout(this.passiveRefreshTimer),this.passiveRefreshTimer=void 0),this.resetBaichuanClient()}startPeriodicTasks(){this.periodicStarted||(this.periodicStarted=!0,this.getBaichuanLogger().log("Starting periodic tasks for regular camera"),this.statusPollTimer=setInterval((()=>{this.periodic10sTick().catch((()=>{}))}),1e4),this.getBaichuanLogger().log("Periodic tasks started: status poll every 10s"))}async periodic10sTick(){await this.ensureClient(),await this.alignAuxDevicesState()}async getDetectionInput(e,t){return null}async processEvents(e){const t=this.getBaichuanLogger();if(this.isEventDispatchEnabled()&&(this.storageSettings.values.dispatchEvents.includes("eventLogs")&&t.debug(`Events received: ${JSON.stringify(e)}`),this.shouldDispatchMotion()&&e.motion!==this.motionDetected&&(e.motion?(this.motionDetected=!0,this.motionTimeout&&clearTimeout(this.motionTimeout),this.motionTimeout=setTimeout((()=>this.motionDetected=!1),1e3*this.storageSettings.values.motionTimeout)):(this.motionDetected=!1,this.motionTimeout&&clearTimeout(this.motionTimeout))),this.shouldDispatchObjects()&&e.objects?.length)){const t={timestamp:Date.now(),detections:[]};for(const s of e.objects)t.detections.push({className:s,score:1});o.default.deviceManager.onDeviceEvent(this.nativeId,o.ScryptedInterface.ObjectDetector,t)}}async withBaichuanClient(e){return e(await this.ensureClient())}async takePicture(e){try{return this.withBaichuanRetry((async()=>{const e=await this.ensureClient(),t=await e.getSnapshot(this.storageSettings.values.rtspChannel);return await this.createMediaObject(t,"image/jpeg")}))}catch(e){throw this.getBaichuanLogger().error("Error taking snapshot",e),e}}async getPictureOptions(){return[]}async getOtherSettings(){return await this.getSettings()}showRtspUrlOverride(){return!1}async startIntercom(e){await this.intercom.start(e)}stopIntercom(){return this.intercom.stop()}}t.ReolinkNativeCamera=l},8799:function(e,t,s){"use strict";var r,n=this&&this.__createBinding||(Object.create?function(e,t,s,r){void 0===r&&(r=s);var n=Object.getOwnPropertyDescriptor(t,s);n&&!("get"in n?!t.__esModule:n.writable||n.configurable)||(n={enumerable:!0,get:function(){return t[s]}}),Object.defineProperty(e,r,n)}:function(e,t,s,r){void 0===r&&(r=s),e[r]=t[s]}),A=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),i=this&&this.__importStar||(r=function(e){return r=Object.getOwnPropertyNames||function(e){var t=[];for(var s in e)Object.prototype.hasOwnProperty.call(e,s)&&(t[t.length]=s);return t},r(e)},function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var s=r(e),i=0;i<s.length;i++)"default"!==s[i]&&n(t,e,s[i]);return A(t,e),t}),o=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.CommonCameraMixin=void 0;const a=i(s(7562)),c=s(6117),l=s(7077),h=s(5098),g=s(9560),d=s(5741),u=s(840),E=s(5050),I=s(6185),C=o(s(6928));class B extends a.ScryptedDeviceBase{constructor(e,t){super(t),this.camera=e}async turnOff(){this.camera.getBaichuanLogger().log(`Siren toggle: turnOff (device=${this.nativeId})`),this.on=!1;try{await this.camera.setSirenEnabled(!1),this.camera.getBaichuanLogger().log(`Siren toggle: turnOff ok (device=${this.nativeId})`)}catch(e){throw this.camera.getBaichuanLogger().warn(`Siren toggle: turnOff failed (device=${this.nativeId})`,e),e}}async turnOn(){this.camera.getBaichuanLogger().log(`Siren toggle: turnOn (device=${this.nativeId})`),this.on=!0;try{await this.camera.setSirenEnabled(!0),this.camera.getBaichuanLogger().log(`Siren toggle: turnOn ok (device=${this.nativeId})`)}catch(e){throw this.camera.getBaichuanLogger().warn(`Siren toggle: turnOn failed (device=${this.nativeId})`,e),e}}}class Q extends a.ScryptedDeviceBase{constructor(e,t){super(t),this.camera=e}async setBrightness(e){this.camera.getBaichuanLogger().log(`Floodlight toggle: setBrightness (device=${this.nativeId} brightness=${e})`),this.brightness=e;try{await this.camera.setFloodlightState(void 0,e),this.camera.getBaichuanLogger().log(`Floodlight toggle: setBrightness ok (device=${this.nativeId} brightness=${e})`)}catch(t){throw this.camera.getBaichuanLogger().warn(`Floodlight toggle: setBrightness failed (device=${this.nativeId} brightness=${e})`,t),t}}async turnOff(){this.camera.getBaichuanLogger().log(`Floodlight toggle: turnOff (device=${this.nativeId})`),this.on=!1;try{await this.camera.setFloodlightState(!1),this.camera.getBaichuanLogger().log(`Floodlight toggle: turnOff ok (device=${this.nativeId})`)}catch(e){throw this.camera.getBaichuanLogger().warn(`Floodlight toggle: turnOff failed (device=${this.nativeId})`,e),e}}async turnOn(){this.camera.getBaichuanLogger().log(`Floodlight toggle: turnOn (device=${this.nativeId})`),this.on=!0;try{await this.camera.setFloodlightState(!0),this.camera.getBaichuanLogger().log(`Floodlight toggle: turnOn ok (device=${this.nativeId})`)}catch(e){throw this.camera.getBaichuanLogger().warn(`Floodlight toggle: turnOn failed (device=${this.nativeId})`,e),e}}}class p extends a.ScryptedDeviceBase{constructor(e,t){super(t),this.camera=e,this.storageSettings=new c.StorageSettings(this,{sensitive:{title:"PIR Sensitivity",description:"Detection sensitivity/threshold (higher = more sensitive)",type:"number",defaultValue:50,range:[0,100]},reduceAlarm:{title:"Reduce False Alarms",description:"Enable reduction of false alarm rate",type:"boolean",defaultValue:!1},interval:{title:"PIR Detection Interval",description:"Detection interval in seconds",type:"number",defaultValue:5,range:[1,60]}})}async getSettings(){return this.storageSettings.getSettings()}async putSetting(e,t){await this.storageSettings.putSetting(e,t);const s=this.camera.storageSettings.values.rtspChannel,r=this.on?1:0,n=this.storageSettings.values.sensitive,A=this.storageSettings.values.reduceAlarm?1:0,i=this.storageSettings.values.interval;await this.camera.withBaichuanRetry((async()=>{const e=await this.camera.ensureClient();await e.setPirInfo(s,{enable:r,sensitive:n,reduceAlarm:A,interval:i})}))}async turnOff(){this.on=!1,await this.updatePirSettings()}async turnOn(){this.on=!0,await this.updatePirSettings()}async updatePirSettings(){const e=this.camera.storageSettings.values.rtspChannel,t=this.on?1:0,s=this.storageSettings.values.sensitive,r=this.storageSettings.values.reduceAlarm?1:0,n=this.storageSettings.values.interval;await this.camera.withBaichuanRetry((async()=>{const A=await this.camera.ensureClient();await A.setPirInfo(e,{enable:t,sensitive:s,reduceAlarm:r,interval:n})}))}}class f extends l.BaseBaichuanClass{constructor(e,t,s){super(e),this.plugin=t,this.options=s,this.storageSettings=new c.StorageSettings(this,{ipAddress:{title:"IP Address",type:"string",onPut:async()=>{await this.credentialsChanged()}},username:{type:"string",title:"Username",onPut:async()=>{await this.credentialsChanged()}},password:{type:"password",title:"Password",onPut:async()=>{await this.credentialsChanged()}},rtspChannel:{type:"number",hide:!0,defaultValue:0},capabilities:{json:!0,hide:!0},uid:{title:"UID",description:"Reolink UID (required for battery cameras / BCUDP).",type:"string",hide:!0,onPut:async()=>{await this.credentialsChanged()}},isFromNvr:{type:"boolean",hide:!0,defaultValue:!1},mixinsSetup:{type:"boolean",hide:!0},dispatchEvents:{subgroup:"Advanced",title:"Dispatch Events",description:"Select which events to emit. Empty disables event subscription entirely.",multiple:!0,combobox:!0,immediate:!0,defaultValue:["motion","objects"],choices:["motion","objects"],onPut:async()=>{await this.subscribeToEvents()}},debugLogs:{subgroup:"Advanced",title:"Debug Logs",description:"Enable specific debug logs. Baichuan client logs require reconnect; event logs are immediate.",multiple:!0,combobox:!0,immediate:!0,defaultValue:[],choices:(0,g.getDebugLogChoices)(),onPut:async(e,t)=>{const s=this.getBaichuanLogger(),r=(0,g.getApiRelevantDebugLogs)(e||[]),n=(0,g.getApiRelevantDebugLogs)(t||[]),A=new Set(r),i=new Set(n);(A.size!==i.size||Array.from(A).some((e=>!i.has(e))))&&this.resetBaichuanClient&&(this.debugLogsResetTimeout&&(clearTimeout(this.debugLogsResetTimeout),this.debugLogsResetTimeout=void 0),this.debugLogsResetTimeout=setTimeout((async()=>{this.debugLogsResetTimeout=void 0;try{await this.resetBaichuanClient("debugLogs changed"),this.baichuanApi=void 0,this.ensureClientPromise=void 0,await this.ensureClient()}catch(e){s.warn("Failed to reset client after debug logs change",e)}}),2e3))}},motionTimeout:{subgroup:"Advanced",title:"Motion Timeout",defaultValue:20,type:"number"},cachedOsd:{multiple:!0,hide:!0,json:!0,defaultValue:[]},intercomBlocksPerPayload:{subgroup:"Advanced",title:"Intercom Blocks Per Payload",description:"Lower reduces latency (more packets). Typical: 1-4. Requires restarting talk session to take effect.",type:"number",defaultValue:1},presets:{subgroup:"PTZ",title:"Presets to enable",description:'PTZ Presets in the format "id=name". Where id is the PTZ Preset identifier and name is a friendly name.',multiple:!0,defaultValue:[],combobox:!0,hide:!0,onPut:async(e,t)=>{const s={...this.ptzCapabilities||{},presets:{}};for(const e of t){const[t,r]=e.split("=");s.presets[t]=r}this.ptzCapabilities=s},mapGet:()=>{const e=this.ptzCapabilities?.presets||{};return Object.entries(e).map((([e,t])=>e+"="+t))}},ptzMoveDurationMs:{title:"PTZ Move Duration (ms)",description:"How long a PTZ command moves before sending stop. Higher = more movement per click.",type:"number",defaultValue:300,subgroup:"PTZ",hide:!0},ptzZoomStep:{subgroup:"PTZ",title:"PTZ Zoom Step",description:"How much to change zoom per zoom command (in zoom factor units, where 1.0 is normal).",type:"number",defaultValue:.1,hide:!0},ptzCreatePreset:{subgroup:"PTZ",title:"Create Preset",description:"Enter a name and press Save to create a new PTZ preset at the current position.",type:"string",placeholder:"e.g. Door",defaultValue:"",hide:!0,onPut:async(e,t)=>{const s=String(t??"").trim();if(!s)return void(""!==String(t??"")&&(this.storageSettings.values.ptzCreatePreset=""));const r=this.getBaichuanLogger();r.log(`PTZ presets: create preset requested (name=${s})`);const n=await this.withBaichuanRetry((async()=>{if(await this.ensureClient(),!this.ptzPresets)throw new Error("PTZ presets not available");return await this.ptzPresets.createPtzPreset(s)})),A=`${n.id}=${n.name}`;this.storageSettings.values.ptzSelectedPreset=A,this.storageSettings.values.ptzCreatePreset="",r.log(`PTZ presets: created preset id=${n.id} name=${n.name}`)}},ptzSelectedPreset:{subgroup:"PTZ",title:"Selected Preset",description:'Select the preset to update or delete. Format: "id=name".',type:"string",combobox:!1,immediate:!0,hide:!0},ptzUpdateSelectedPreset:{subgroup:"PTZ",title:"Update Selected Preset Position",description:"Overwrite the selected preset with the current PTZ position.",type:"button",immediate:!0,hide:!0,onPut:async()=>{const e=this.getSelectedPresetId();if(void 0===e)throw new Error("No preset selected");const t=this.getBaichuanLogger();t.log(`PTZ presets: update position requested (presetId=${e})`),await this.withBaichuanRetry((async()=>(await this.ensureClient(),await this.ptzPresets.updatePtzPresetToCurrentPosition(e)))),t.log(`PTZ presets: update position ok (presetId=${e})`)}},ptzDeleteSelectedPreset:{subgroup:"PTZ",title:"Delete Selected Preset",description:"Delete the selected preset (firmware dependent).",type:"button",immediate:!0,hide:!0,onPut:async()=>{const e=this.getSelectedPresetId();if(void 0===e)throw new Error("No preset selected");const t=this.getBaichuanLogger();t.log(`PTZ presets: delete requested (presetId=${e})`),await this.withBaichuanRetry((async()=>(await this.ensureClient(),await this.ptzPresets.deletePtzPreset(e)))),this.storageSettings.values.ptzSelectedPreset="",t.log(`PTZ presets: delete ok (presetId=${e})`)}},batteryUpdateIntervalMinutes:{title:"Battery Update Interval (minutes)",subgroup:"Advanced",description:"How often to wake up the camera and update battery status and snapshot (default: 60 minutes).",type:"number",defaultValue:60,hide:!0},lowThresholdBatteryRecording:{title:"Low Threshold Battery Recording (%)",subgroup:"Recording",description:"Battery level threshold below which recording is disabled (default: 15%).",type:"number",defaultValue:15,hide:!0},highThresholdBatteryRecording:{title:"High Threshold Battery Recording (%)",subgroup:"Recording",description:"Battery level threshold above which recording is enabled (default: 35%).",type:"number",defaultValue:35,hide:!0},diagnosticsOutputPath:{title:"Diagnostics Output Path",subgroup:"Diagnostics",description:"Directory where diagnostics files will be saved (default: plugin volume).",type:"string",defaultValue:C.default.join(process.env.SCRYPTED_PLUGIN_VOLUME,"diagnostics",this.name)},diagnosticsRun:{subgroup:"Diagnostics",title:"Run Diagnostics",description:"Run all diagnostics and save results to the output path.",type:"button",immediate:!0,onPut:async()=>{await this.runDiagnostics()}}}),this.ptzPresets=new u.ReolinkPtzPresets(this),this.refreshingState=!1,this.classes=[],this.presets=[],this.fetchingStreams=!1,this.lastNetPortCacheAttempt=0,this.netPortCacheBackoffMs=5e3,this.onSimpleEvent=e=>{const t=this.getBaichuanLogger();try{const t=this.getBaichuanLogger();if(t.debug(`Baichuan event: ${JSON.stringify(e)}`),!this.isEventDispatchEnabled())return void t.debug("Event dispatch is disabled, ignoring event");const s=this.storageSettings.values.rtspChannel;if(void 0!==e?.channel&&e.channel!==s)return void t.error(`Event channel ${e.channel} does not match camera channel ${s}, ignoring`);const r=[];let n=!1;switch(e?.type){case"motion":n=!0;break;case"doorbell":this.handleDoorbellEvent(),n=!0;break;case"people":case"vehicle":case"animal":case"face":case"package":case"other":this.shouldDispatchObjects()&&r.push(e.type),n=!0;break;default:return void t.error(`Unknown event type: ${e?.type}`)}this.processEvents({motion:n,objects:r}).catch((e=>{t.warn("Error processing events",e)}))}catch(e){t.warn("Error in onSimpleEvent handler",e)}},this.protocol=s.nvrDevice||"battery"!==s.type?"tcp":"udp",this.nvrDevice=s.nvrDevice,this.thisDevice=a.default.systemManager.getDeviceById(this.id),setTimeout((async()=>{await this.parentInit()}),2e3)}getConnectionConfig(){const{ipAddress:e,username:t,password:s,uid:r}=this.storageSettings.values,n=this.getBaichuanDebugOptions(),A="udp"===this.protocol?(0,h.normalizeUid)(r):void 0;if("udp"===this.protocol&&!A)throw new Error("UID is required for battery cameras (BCUDP)");return{host:e,username:t,password:s,uid:A,transport:this.protocol,logger:this.console,debugOptions:n}}getConnectionCallbacks(){return{onError:void 0,onClose:async()=>{"battery"===this.options.type||setTimeout((async()=>{try{await this.subscribeToEvents()}catch(e){this.getBaichuanLogger().warn("Failed to resubscribe to events after reconnection",e)}}),1e3)},onSimpleEvent:this.onSimpleEvent,getEventSubscriptionEnabled:()=>this.isEventDispatchEnabled?.()??!1}}isDebugEnabled(){return this.isEventLogsEnabled()}getDeviceName(){return this.name||"Camera"}async runDiagnostics(){const e=this.getBaichuanLogger(),t=this.storageSettings.values.diagnosticsOutputPath||process.env.SCRYPTED_PLUGIN_VOLUME||"";if(!t)throw new Error("Diagnostics output path is required");const s=this.storageSettings.values.rtspChannel||0,r={kinds:["native"],profiles:["main","ext","sub"]};e.log(`Starting diagnostics with parameters: outDir=${t}, channel=${s}, durationSeconds=15, selection=${JSON.stringify(r)}`);try{const n=await this.ensureClient(),A=await n.runAllDiagnosticsConsecutively({outDir:t,channel:s,durationSeconds:15,selection:r});e.log(`Diagnostics completed successfully. Output directory: ${A.runDir}`),e.log(`Diagnostics file: ${A.diagnosticsPath}`),e.log(`Streams directory: ${A.streamsDir}`)}catch(t){throw e.error("Failed to run diagnostics",t),t}}async onBeforeCleanup(){if(this.onSimpleEvent&&this.baichuanApi)try{this.baichuanApi.offSimpleEvent(this.onSimpleEvent)}catch{}}createStreamClient(){throw new Error("Method not implemented.")}getAbilities(){return this.storageSettings.values.capabilities}getBaichuanDebugOptions(){const e=this.storageSettings.values.debugLogs||[];return(0,g.convertDebugLogsToApiOptions)(e)}isRecoverableBaichuanError(e){const t=e?.message||e?.toString?.()||"";return"string"==typeof t&&(t.includes("Baichuan socket closed")||t.includes("Baichuan UDP stream closed")||t.includes("Baichuan TCP socket is not connected")||t.includes("socket hang up")||t.includes("ECONNRESET")||t.includes("EPIPE"))}updatePtzCaps(){const{hasPan:e,hasTilt:t,hasZoom:s}=this.getAbilities();this.ptzCapabilities={...this.ptzCapabilities,pan:e,tilt:t,zoom:s}}unsubscribedToEvents(){this.unsubscribeFromEvents().catch((()=>{})),this.motionDetected&&(this.motionDetected=!1)}async subscribeToEvents(){if(this.nvrDevice)return;const e=this.getBaichuanLogger(),t=Array.from(this.getDispatchEventsSelection?.()??new Set).sort(),s=t.length>0;e.log(`subscribeToEvents called: enabled=${s}, selection=[${t.join(", ")}], protocol=${this.protocol}`),this.unsubscribedToEvents();if(t.includes("motion")||(this.motionTimeout&&clearTimeout(this.motionTimeout),this.motionDetected=!1),!s)return e.log("Event subscription disabled, unsubscribing"),this.doorbellBinaryTimeout&&(clearTimeout(this.doorbellBinaryTimeout),this.doorbellBinaryTimeout=void 0),void(this.binaryState=!1);const r=await this.ensureClient();try{await r.onSimpleEvent(this.onSimpleEvent),e.log(`Subscribed to events (${t.join(", ")}) on ${this.protocol} connection`)}catch(t){return void e.warn("Failed to attach Baichuan event handler",t)}}async getVideoTextOverlays(){const e=await this.ensureClient(),t=this.storageSettings.values.rtspChannel;let s=this.storageSettings.values.cachedOsd;return s?.length||(s=await e.getOsd(t),this.storageSettings.values.cachedOsd=s),{osdChannel:{text:s?.osdChannel?.enable?s.osdChannel.name:void 0},osdTime:{text:!!s?.osdTime?.enable,readonly:!0}}}async setVideoTextOverlay(e,t){const s=await this.ensureClient(),r=this.storageSettings.values.rtspChannel,n=await s.getOsd(r);if("osdChannel"===e){const e="string"==typeof t?.text?t.text.trim():"",s=!!e||!0===t?.text;n.osdChannel.enable=s?1:0,s&&(n.osdChannel.name=e||n.osdChannel.name||this.name||"Camera")}else{if("osdTime"!==e)throw new Error("unknown overlay: "+e);n.osdTime.enable=t?.text?1:0}await s.setOsd(r,n)}async ptzCommand(e){const t=this.getBaichuanLogger(),s=await this.ensureClient();if(!s)return;const r=this.storageSettings.values.rtspChannel,n=e.preset;if(null!=n){const e=Number(n);return Number.isFinite(e)?void(this.ptzPresets?await this.ptzPresets.moveToPreset(e):t.warn("PTZ presets not available")):void t.warn(`Invalid PTZ preset id: ${n}`)}let A="start",i="Left";if(void 0!==e.pan)0===e.pan?(A="stop",i="Left"):(i=e.pan>0?"Right":"Left",A="start");else if(void 0!==e.tilt)0===e.tilt?(A="stop",i="Up"):(i=e.tilt>0?"Up":"Down",A="start");else if(void 0!==e.zoom){const n=Number(e.zoom);if(!Number.isFinite(n)||0===n)return;const A=Number(this.storageSettings.values.ptzZoomStep);if(!Number.isFinite(A)||A<=0)return void t.warn("Invalid PTZ zoom step, using default 0.1");const i=await s.getZoomFocus(r);if(!i?.zoom)return void t.warn("Zoom command requested but camera did not report zoom support.");const o=(i.zoom.curPos??1e3)/1e3,a=(i.zoom.minPos??1e3)/1e3,c=(i.zoom.maxPos??1e3)/1e3,l=A,h=n>0?1:-1,g=Math.min(c,Math.max(a,o+h*l));return void await s.zoomToFactor(r,g)}const o={action:A,command:i,speed:"number"==typeof e.speed?e.speed:32,autoStopMs:Number(this.storageSettings.values.ptzMoveDurationMs)||500};await s.ptz(r,o)}async getObjectTypes(){return{classes:this.classes}}async getDetectionInput(e,t){return null}getDispatchEventsSelection(){return new Set(this.storageSettings.values.dispatchEvents)}isEventDispatchEnabled(){return this.getDispatchEventsSelection().size>0}shouldDispatchMotion(){return this.getDispatchEventsSelection().has("motion")}shouldDispatchObjects(){return this.getDispatchEventsSelection().has("objects")}async processEvents(e){if(!(this.isEventDispatchEnabled?.()??!0))return;const t=this.getDispatchEventsSelection?.()??new Set(["motion","objects"]),s=t.has("motion"),r=t.has("objects");if(s&&void 0!==e.motion){const t=e.motion;if(t!==this.motionDetected)if(this.motionDetected=t,t){this.motionTimeout&&clearTimeout(this.motionTimeout);const e=1e3*(this.storageSettings.values.motionTimeout||30);this.motionTimeout=setTimeout((()=>{this.motionDetected=!1}),e)}else this.motionTimeout&&clearTimeout(this.motionTimeout)}if(r&&e.objects?.length){const t={timestamp:Date.now(),detections:[]};for(const s of e.objects)t.detections.push({className:s,score:1});this.nativeId&&a.default.deviceManager.onDeviceEvent(this.nativeId,a.ScryptedInterface.ObjectDetector,t)}}isEventLogsEnabled(){return(this.storageSettings.values.debugLogs||[]).includes(g.DebugLogDisplayNames[g.DebugLogOption.EventLogs])}handleDoorbellEvent(){this.doorbellBinaryTimeout||(this.binaryState=!0,this.doorbellBinaryTimeout=setTimeout((()=>{this.binaryState=!1,this.doorbellBinaryTimeout=void 0}),5e3))}clearDoorbellBinary(){this.doorbellBinaryTimeout&&(clearTimeout(this.doorbellBinaryTimeout),this.doorbellBinaryTimeout=void 0),this.binaryState=!1}async reportDevices(){if(!this.nativeId||!this.name)return;const{hasSiren:e,hasFloodlight:t,hasPir:s}=this.getAbilities(),r=[];if(e){const e=`${this.nativeId}-siren`;r.push({providerNativeId:this.plugin?.nativeId,name:`${this.name} Siren`,nativeId:e,info:{...this.info||{}},interfaces:[a.ScryptedInterface.OnOff,a.ScryptedInterface.Settings],type:a.ScryptedDeviceType.Siren})}if(t){const e=`${this.nativeId}-floodlight`;r.push({providerNativeId:this.plugin?.nativeId,name:`${this.name} Floodlight`,nativeId:e,info:{...this.info||{}},interfaces:[a.ScryptedInterface.OnOff,a.ScryptedInterface.Settings],type:a.ScryptedDeviceType.Light})}if(s){const e=`${this.nativeId}-pir`;r.push({providerNativeId:this.plugin?.nativeId,name:`${this.name} PIR`,nativeId:e,info:{...this.info||{}},interfaces:[a.ScryptedInterface.OnOff,a.ScryptedInterface.Settings],type:a.ScryptedDeviceType.Switch})}a.default.deviceManager.onDevicesChanged({providerNativeId:this.nativeId,devices:r})}async getSettings(){return await this.storageSettings.getSettings()}async putSetting(e,t){await this.storageSettings.putSetting(e,t)}async startIntercom(e){if(!this.intercom)throw new Error("Intercom not initialized");await this.intercom.start(e)}async stopIntercom(){if(this.intercom)return await this.intercom.stop();throw new Error("Intercom not initialized")}async updateDeviceInfo(){const e=this.getBaichuanLogger(),{ipAddress:t,rtspChannel:s}=this.storageSettings.values;try{const r=await this.ensureClient(),n=await r.getInfo(this.nvrDevice?s:void 0);await(0,I.updateDeviceInfo)({device:this,ipAddress:t,deviceData:n}),e.log(`Device info updated: ${JSON.stringify(n)}`)}catch(t){e.warn("Failed to fetch device info",t)}}async getDevice(e){return e.endsWith("-siren")?(this.siren||=new B(this,e),this.siren):e.endsWith("-floodlight")?(this.floodlight||=new Q(this,e),this.floodlight):e.endsWith("-pir")?(this.pirSensor||=new p(this,e),this.pirSensor):void 0}async releaseDevice(e,t){t.endsWith("-siren")?this.siren=void 0:t.endsWith("-floodlight")?this.floodlight=void 0:t.endsWith("-pir")&&(this.pirSensor=void 0)}async setSirenEnabled(e){const t=this.storageSettings.values.rtspChannel;await this.withBaichuanRetry((async()=>{const s=await this.ensureClient();return await s.setSiren(t,e)}))}async setFloodlightState(e,t){const s=this.storageSettings.values.rtspChannel;await this.withBaichuanRetry((async()=>{const r=await this.ensureClient();return await r.setWhiteLedState(s,e,t)}))}async setPirEnabled(e){const t=this.storageSettings.values.rtspChannel;let s,r,n;this.pirSensor&&(s=this.pirSensor.storageSettings.values.sensitive,r=this.pirSensor.storageSettings.values.reduceAlarm?1:0,n=this.pirSensor.storageSettings.values.interval),await this.withBaichuanRetry((async()=>{const A=await this.ensureClient();return await A.setPirInfo(t,{enable:e?1:0,...void 0!==s?{sensitive:s}:{},...void 0!==r?{reduceAlarm:r}:{},...void 0!==n?{interval:n}:{}})}))}async alignAuxDevicesState(){const e=this.getBaichuanLogger(),t=this.baichuanApi;if(!t)return;const s=this.storageSettings.values.rtspChannel,{hasSiren:r,hasFloodlight:n,hasPir:A}=this.getAbilities();try{if(r&&this.siren)try{const e=await t.getSiren(s);this.siren.on=e.enabled}catch(t){e.debug("Failed to align siren state",t)}if(n&&this.floodlight)try{const e=await t.getWhiteLedState(s);this.floodlight.on=!!e.enabled,void 0!==e.brightness&&(this.floodlight.brightness=e.brightness)}catch(t){e.debug("Failed to align floodlight state",t)}if(A&&this.pirSensor)try{const e=await t.getPirInfo(s);this.pirSensor.on=e.enabled,e.state&&(void 0!==e.state.sensitive&&(this.pirSensor.storageSettings.values.sensitive=e.state.sensitive),void 0!==e.state.reduceAlarm&&(this.pirSensor.storageSettings.values.reduceAlarm=!!e.state.reduceAlarm),void 0!==e.state.interval&&(this.pirSensor.storageSettings.values.interval=e.state.interval))}catch(t){e.debug("Failed to align PIR state",t)}}catch(t){e.debug("Failed to align auxiliary devices state",t)}}addRtspCredentials(e){const t=this.getBaichuanLogger(),{username:s,password:r}=this.storageSettings.values;if(!s)return e;try{const t=new URL(e);if("rtmp:"===t.protocol){const e=t.searchParams;e.set("user",s),e.set("password",r||"")}else t.username=s,t.password=r||"";return t.toString()}catch(s){return t.warn("Failed to parse URL for credentials",s),e}}getRtspAddress(){const{ipAddress:e}=this.storageSettings.values;return`${e}:${this.cachedNetPort?.rtsp?.port??554}`}getRtmpAddress(){const{ipAddress:e}=this.storageSettings.values;return`${e}:${this.cachedNetPort?.rtmp?.port??1935}`}async ensureNetPortCache(){const e=this.getBaichuanLogger();if(this.cachedNetPort)return;const t=Date.now();if(t-this.lastNetPortCacheAttempt<this.netPortCacheBackoffMs)this.cachedNetPort={rtsp:{port:554,enable:1},rtmp:{port:1935,enable:1}};else{this.lastNetPortCacheAttempt=t;try{const e=await this.ensureClient();this.cachedNetPort=await e.getNetPort()}catch(t){this.isRecoverableBaichuanError?.(t)||e.warn("Failed to get net port, using defaults",t),this.cachedNetPort={rtsp:{port:554,enable:1},rtmp:{port:1935,enable:1}}}}}async getVideoStreamOptions(){const e=this.getBaichuanLogger();if(this.cachedVideoStreamOptions?.length)return this.cachedVideoStreamOptions;if(this.fetchingStreams)return[];this.fetchingStreams=!0;let t=[];const s=await this.ensureClient(),{ipAddress:r,rtspChannel:n}=this.storageSettings.values;try{await this.ensureNetPortCache()}catch(t){this.isRecoverableBaichuanError?.(t)||e.warn("Failed to ensure net port cache, falling back to Native",t)}try{t=await(0,E.buildVideoStreamOptions)({client:s,ipAddress:r,cachedNetPort:this.cachedNetPort,nvrDevice:this.nvrDevice,rtspChannel:n,logger:e})}catch(t){this.isRecoverableBaichuanError?.(t)||e.warn("Failed to build RTSP/RTMP stream options, falling back to Native",t),this.cachedNetPort=void 0}if(t.length)return e.log("Fetched video stream options",{streams:t,netPort:this.cachedNetPort}),this.cachedVideoStreamOptions=t,t;this.fetchingStreams=!1}async getVideoStream(e){if(!e)throw new Error("video streams not set up or no longer exists.");const t=await this.getVideoStreamOptions(),s=(0,E.selectStreamOption)(t,e);if(!(0,E.isNativeStreamId)(s.id)&&s.url&&("rtsp"===s.container||"rtmp"===s.container)){const e=this.addRtspCredentials(s.url),t={container:s.container,url:e,mediaStreamOptions:s};return await this.createMediaObject(t,a.ScryptedMimeTypes.MediaStreamUrl)}if(!this.streamManager)throw new Error("StreamManager not initialized");const r=(0,E.parseStreamProfileFromId)(s.id)||"main",n=this.storageSettings.values.rtspChannel,A=`${n}_${r}`,i=(0,E.expectedVideoTypeFromUrlMediaStreamOptions)(s);return await this.withBaichuanRetry((async()=>await(0,E.createRfc4571MediaObjectFromStreamManager)({streamManager:this.streamManager,channel:n,profile:r,streamKey:A,expectedVideoType:i,selected:s,sourceId:this.id,onDetectedCodec:e=>{const t=`native_${r}`,s=`Native ${r}`,n=(this.cachedVideoStreamOptions??[]).filter((e=>e.id!==t));n.push({name:s,id:t,container:"rtp",video:{codec:e},url:""}),this.cachedVideoStreamOptions=n}})))}async ensureClient(){return this.nvrDevice?await this.nvrDevice.ensureBaichuanClient():await this.ensureBaichuanClient()}async credentialsChanged(){this.cachedVideoStreamOptions=void 0,this.cachedNetPort=void 0}getSelectedPresetId(){const e=this.storageSettings.values.ptzSelectedPreset;if(!e)return;const t=e.includes("=")?e.split("=")[0]:e,s=Number(t);return Number.isFinite(s)?s:void 0}async refreshDeviceState(){if(this.refreshingState)return;this.refreshingState=!0;const e=this.getBaichuanLogger(),t=this.storageSettings.values.rtspChannel;try{const{capabilities:s,abilities:r,support:n,presets:A,objects:i}=await this.withBaichuanRetry((async()=>{const e=await this.ensureClient();return await e.getDeviceCapabilities(t)}));this.classes=i,this.presets=A,this.storageSettings.values.capabilities=s,this.ptzPresets.setCachedPtzPresets(A);try{const{interfaces:t,type:r}=(0,I.getDeviceInterfaces)({capabilities:s,logger:this.console}),n={nativeId:this.nativeId,providerNativeId:this.nvrDevice?.nativeId??this.plugin?.nativeId,name:this.name,interfaces:t,type:r,info:this.info};e.log(`Updating device interfaces: ${JSON.stringify(n)}`),await a.default.deviceManager.onDeviceDiscovered(n)}catch(t){e.error("Failed to update device interfaces",t)}e.log(`Refreshed device capabilities: ${JSON.stringify({capabilities:s,abilities:r,support:n,presets:A})}`)}catch(t){e.error("Failed to refresh abilities",t)}this.refreshingState=!1}async parentInit(){const e=this.getBaichuanLogger();try{await this.ensureClient(),await this.updateDeviceInfo()}catch(t){e.warn("Failed to update device info during init",t)}try{await this.refreshDeviceState()}catch(t){e.warn("Failed to connect/refresh during init",t)}try{await this.reportDevices()}catch(t){e.warn("Failed to report devices during init",t)}const{hasIntercom:t,hasPtz:s}=this.getAbilities();if(t&&(this.intercom=new d.ReolinkBaichuanIntercom(this)),s){const e=(this.presets||[]).map((e=>e.id+"="+e.name));this.storageSettings.settings.presets.choices=e,this.storageSettings.settings.ptzSelectedPreset.choices=e,this.storageSettings.settings.presets.hide=!1,this.storageSettings.settings.ptzMoveDurationMs.hide=!1,this.storageSettings.settings.ptzZoomStep.hide=!1,this.storageSettings.settings.ptzCreatePreset.hide=!1,this.storageSettings.settings.ptzSelectedPreset.hide=!1,this.storageSettings.settings.ptzUpdateSelectedPreset.hide=!1,this.storageSettings.settings.ptzDeleteSelectedPreset.hide=!1,this.updatePtzCaps()}const r="battery"===this.options.type,{username:n,password:A}=this.storageSettings.values;if(this.streamManager=new E.StreamManager({createStreamClient:()=>this.createStreamClient(),getLogger:()=>e,credentials:{username:n,password:A},sharedConnection:r}),this.storageSettings.settings.uid.hide=!r,this.storageSettings.settings.batteryUpdateIntervalMinutes.hide=!r,this.storageSettings.settings.lowThresholdBatteryRecording.hide=!r,this.storageSettings.settings.highThresholdBatteryRecording.hide=!r,r&&!this.storageSettings.values.mixinsSetup)try{const t=a.default.systemManager.getDeviceById(this.id);t&&(e.log("Disabling prebuffer and snapshots from prebuffer"),await t.putSetting("prebuffer:enabledStreams","[]"),await t.putSetting("snapshot:snapshotsFromPrebuffer","Disabled"),this.storageSettings.values.mixinsSetup=!0)}catch(t){e.warn("Failed to setup mixins during init",t)}try{await this.subscribeToEvents()}catch(t){e.warn("Failed to subscribe to Baichuan events",t)}const{isFromNvr:i}=this.storageSettings.values;i&&this.nvrDevice&&(this.storageSettings.settings.username.hide=!0,this.storageSettings.settings.password.hide=!0,this.storageSettings.settings.ipAddress.hide=!0,this.storageSettings.settings.uid.hide=!0,this.storageSettings.settings.username.defaultValue=this.nvrDevice.storageSettings.values.username,this.storageSettings.settings.password.defaultValue=this.nvrDevice.storageSettings.values.password,this.storageSettings.settings.ipAddress.defaultValue=this.nvrDevice.storageSettings.values.ipAddress),await this.init(),this.initComplete=!0}}t.CommonCameraMixin=f},5098:(e,t,s)=>{"use strict";function r(e){const t=e?.trim();return t||void 0}function n(e){const t=e?.message||e?.toString?.()||"";return"string"==typeof t&&(t.includes("ECONNREFUSED")||t.includes("ETIMEDOUT")||t.includes("EHOSTUNREACH")||t.includes("ENETUNREACH")||t.includes("socket hang up")||t.includes("TCP connection timeout")||t.includes("Baichuan socket closed"))}async function A(e){const{inputs:t,transport:n,logger:A}=e,{ReolinkBaichuanApi:i}=await Promise.resolve().then(s.bind(s,2498)),o={host:t.host,username:t.username,password:t.password,logger:A,debugOptions:t.debugOptions??{}},a=e=>{try{e.client.on("error",(e=>{if(!A)return;const s=e?.message||e?.toString?.()||String(e);"string"==typeof s&&(s.includes("Baichuan socket closed")||s.includes("Baichuan UDP stream closed")||s.includes("Not running"))||A.error(`[BaichuanClient] error (${n}) ${t.host}: ${s}`)})),e.client.on("close",(()=>{}))}catch{}};if("tcp"===n){const e=new i({...o,transport:"tcp"});return a(e),e}const c=r(t.uid);if(!c)throw new Error("UID is required for battery cameras (BCUDP)");const l=new i({...o,transport:"udp",uid:c,idleDisconnect:!0});return a(l),l}Object.defineProperty(t,"__esModule",{value:!0}),t.normalizeUid=r,t.maskUid=function(e){const t=e.trim();return t.length<=8?t:`${t.slice(0,4)}…${t.slice(-4)}`},t.isTcpFailureThatShouldFallbackToUdp=n,t.createBaichuanApi=A,t.autoDetectDeviceType=async function(e,t){const{host:i,username:o,password:a,uid:c}=e;t.log(`[AutoDetect] Pinging ${i}...`);await async function(e,t=3e3){return new Promise((r=>{const{exec:n}=s(5317);n("win32"===process.platform?`ping -n 1 -w ${t} ${e}`:`ping -c 1 -W ${Math.floor(t/1e3)} ${e}`,(e=>{r(!e)}))}))}(i)?t.log(`[AutoDetect] Host ${i} is reachable`):t.warn(`[AutoDetect] Host ${i} is not reachable via ping, but continuing with connection attempt...`);let l;try{t.log(`[AutoDetect] Trying TCP connection to ${i}...`),l=await A({inputs:{host:i,username:o,password:a,logger:t},transport:"tcp",logger:t}),await l.login();const e=await l.getInfo(),{support:s}=await l.getDeviceCapabilities(0),r=s?.channelNum??1;return t.log(`[AutoDetect] TCP connection successful. channelNum=${r}`),r>1?(t.log(`[AutoDetect] Detected NVR (${r} channels)`),await l.close(),{type:"nvr",transport:"tcp",deviceInfo:e,channelNum:r}):(t.log("[AutoDetect] Detected regular camera (single channel)"),await l.close(),{type:"camera",transport:"tcp",deviceInfo:e,channelNum:1})}catch(e){if(l)try{await l.close()}catch{}if(!n(e))throw e;t.log("[AutoDetect] TCP failed, trying UDP (battery camera)...");const s=r(c);if(!s)throw new Error(`TCP connection failed and device likely requires UDP/BCUDP. UID is required for battery cameras (ip=${i}).`);try{const e=await A({inputs:{host:i,username:o,password:a,uid:s,logger:t},transport:"udp",logger:t});await e.login();const r=await e.getInfo();return t.log("[AutoDetect] UDP connection successful. Detected battery camera."),await e.close(),{type:"battery-cam",transport:"udp",uid:s,deviceInfo:r,channelNum:1}}catch(s){throw t.error(`[AutoDetect] Both TCP and UDP failed. TCP error: ${e}, UDP error: ${s}`),new Error(`Failed to connect via both TCP and UDP. TCP: ${e?.message||e}, UDP: ${s?.message||s}`)}}}},9560:(e,t)=>{"use strict";var s;function r(e){return{[s.General]:"general",[s.DebugRtsp]:"debugRtsp",[s.TraceStream]:"traceStream",[s.TraceTalk]:"traceTalk",[s.TraceEvents]:"traceEvents",[s.DebugH264]:"debugH264",[s.DebugParamSets]:"debugParamSets",[s.EventLogs]:null,[s.BatteryInfo]:null}[e]}Object.defineProperty(t,"__esModule",{value:!0}),t.DebugLogDisplayNames=t.DebugLogOption=void 0,t.mapDebugLogToApiOption=r,t.convertDebugLogsToApiOptions=function(e){const s={},n=new Set(e);for(const[e,A]of Object.entries(t.DebugLogDisplayNames))if(n.has(A)){const t=r(e);t&&(s[t]=!0)}return Object.keys(s).length>0?s:void 0},t.getApiRelevantDebugLogs=function(e){return e.filter((e=>null!==r(e)))},t.getDebugLogChoices=function(){return Object.values(s).map((e=>`${t.DebugLogDisplayNames[e]}`))},function(e){e.General="general",e.DebugRtsp="debugRtsp",e.TraceStream="traceStream",e.TraceTalk="traceTalk",e.TraceEvents="traceEvents",e.DebugH264="debugH264",e.DebugParamSets="debugParamSets",e.EventLogs="eventLogs",e.BatteryInfo="batteryInfo"}(s||(t.DebugLogOption=s={})),t.DebugLogDisplayNames={[s.General]:"General",[s.DebugRtsp]:"RTSP",[s.TraceStream]:"Trace stream",[s.TraceTalk]:"Trace talk",[s.TraceEvents]:"Trace events XML",[s.DebugH264]:"H264",[s.DebugParamSets]:"Video param sets",[s.EventLogs]:"Object detection events",[s.BatteryInfo]:"Battery info update"}},5741:function(e,t,s){"use strict";var r,n=this&&this.__createBinding||(Object.create?function(e,t,s,r){void 0===r&&(r=s);var n=Object.getOwnPropertyDescriptor(t,s);n&&!("get"in n?!t.__esModule:n.writable||n.configurable)||(n={enumerable:!0,get:function(){return t[s]}}),Object.defineProperty(e,r,n)}:function(e,t,s,r){void 0===r&&(r=s),e[r]=t[s]}),A=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),i=this&&this.__importStar||(r=function(e){return r=Object.getOwnPropertyNames||function(e){var t=[];for(var s in e)Object.prototype.hasOwnProperty.call(e,s)&&(t[t.length]=s);return t},r(e)},function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var s=r(e),i=0;i<s.length;i++)"default"!==s[i]&&n(t,e,s[i]);return A(t,e),t});Object.defineProperty(t,"__esModule",{value:!0}),t.ReolinkBaichuanIntercom=void 0;const o=i(s(7562)),a=s(1421);t.ReolinkBaichuanIntercom=class{constructor(e){this.camera=e,this.loggedCodecInfo=!1,this.maxBacklogMs=40,this.sendChain=Promise.resolve(),this.pcmBuffer=Buffer.alloc(0)}get blocksPerPayload(){return Math.max(1,Math.min(8,this.camera.storageSettings.values.intercomBlocksPerPayload??1))}async start(e){const t=this.camera.getBaichuanLogger(),s=await o.default.mediaManager.convertMediaObjectToJSON(e,o.ScryptedMimeTypes.FFmpegInput);await this.stop();const r=this.camera.storageSettings.values.rtspChannel;if(!this.loggedCodecInfo){this.loggedCodecInfo=!0;try{const e=await this.camera.ensureClient(),s=await e.getTalkAbility(r),n=s.audioConfigList?.map((e=>({audioType:e.audioType,sampleRate:e.sampleRate,samplePrecision:e.samplePrecision,lengthPerEncoder:e.lengthPerEncoder,soundTrack:e.soundTrack})));t.log("Intercom TalkAbility",{channel:r,duplexList:s.duplexList,audioStreamModeList:s.audioStreamModeList,audioConfigList:n})}catch(e){t.warn("Intercom: unable to fetch TalkAbility",e)}}const n=await this.camera.withBaichuanRetry((async()=>{const e=await this.camera.ensureClient();if("battery"===this.camera.options?.type)try{"sleeping"===e.getSleepStatus({channel:r}).state&&(t.log("Camera is sleeping, waking up for intercom..."),await e.wakeUp(r,{waitAfterWakeMs:2e3}),await new Promise((e=>setTimeout(e,1e3))))}catch(e){t.debug("Failed to check/wake camera for intercom, proceeding anyway",e)}return await e.createTalkSession(r,{blocksPerPayload:this.blocksPerPayload})}));this.session=n,this.pcmBuffer=Buffer.alloc(0),this.sendChain=Promise.resolve();const{audioConfig:A,blockSize:i,fullBlockSize:c}=n.info,l=A.sampleRate,h=2*i+1,g=2*h;if(this.maxBacklogBytes=Math.max(g,Math.floor(this.maxBacklogMs/1e3*l*1*2)),!Number.isFinite(l)||l<=0)throw await this.stop(),new Error(`Invalid talk sampleRate: ${l}`);if(!Number.isFinite(i)||i<=0||!Number.isFinite(c)||c!==i+4)throw await this.stop(),new Error(`Invalid talk block sizes: blockSize=${i} fullBlockSize=${c}`);t.log("Starting intercom (baichuan/native-api flow)",{channel:r,audioType:A.audioType,sampleRate:A.sampleRate,samplePrecision:A.samplePrecision,lengthPerEncoder:A.lengthPerEncoder,soundTrack:A.soundTrack,blockSize:i,fullBlockSize:c,samplesPerBlock:h,bytesNeeded:g,maxBacklogMs:this.maxBacklogMs,maxBacklogBytes:this.maxBacklogBytes,blocksPerPayload:this.blocksPerPayload});const d=this.buildFfmpegPcmArgs(s,{sampleRate:l,channels:1});t.log("Intercom ffmpeg decode args",d);const u=(0,a.spawn)("ffmpeg",d,{stdio:["ignore","pipe","pipe"]});if(this.session!==n){try{u.kill("SIGKILL")}catch{}return}this.ffmpeg=u,u.stdout.on("data",(e=>{this.session===n&&e?.length&&this.enqueuePcm(n,e,g,i)}));let E=0;u.stderr.on("data",(e=>{E++<12&&t.warn("Intercom ffmpeg",e.toString().trim())})),u.on("exit",((e,s)=>{t.warn(`Intercom ffmpeg exited code=${e} signal=${s}`),this.stop().catch((()=>{}))})),t.log("Intercom started (ffmpeg decode -> PCM -> IMA ADPCM)")}stop(){return this.stopping||(this.stopping=(async()=>{const e=this.camera.getBaichuanLogger(),t=this.ffmpeg;this.ffmpeg=void 0;const s=this.session;this.session=void 0,this.pcmBuffer=Buffer.alloc(0);const r=async e=>new Promise((t=>setTimeout(t,e)));if(t&&null==t.exitCode){try{t.kill("SIGKILL")}catch{}try{await Promise.race([new Promise((e=>t.once("exit",(()=>e())))),r(1e3)])}catch{}}try{await Promise.race([this.sendChain,r(250)])}catch{}if(this.sendChain=Promise.resolve(),s)try{await Promise.race([s.stop(),r(2e3)])}catch(t){e.warn("Intercom session stop error",t)}})().finally((()=>{this.stopping=void 0}))),this.stopping}clamp16(e){return e>32767?32767:e<-32768?-32768:0|e}enqueuePcm(e,t,s,r){const n=this.camera.getBaichuanLogger();this.sendChain=this.sendChain.then((async()=>{if(this.session!==e)return;this.pcmBuffer=this.pcmBuffer.length?Buffer.concat([this.pcmBuffer,t]):t;const n=this.maxBacklogBytes??s;if(this.pcmBuffer.length>n){const e=n-n%2;this.pcmBuffer=this.pcmBuffer.subarray(this.pcmBuffer.length-e)}for(;this.pcmBuffer.length>=s;){const t=this.pcmBuffer.subarray(0,s);this.pcmBuffer=this.pcmBuffer.subarray(s);const n=new Int16Array(t.buffer,t.byteOffset,t.length/2),A=this.encodeImaAdpcm(n,r);await e.sendAudio(A)}})).catch((e=>{n.warn("Intercom PCM->ADPCM pipeline error",e)}))}buildFfmpegPcmArgs(e,t){const s=e.inputArguments??[],r=[];let n;for(let e=0;e<s.length;e++){const t=s[e];if("-i"===t){const t=s[e+1];if("string"==typeof t){n||(n=t),e++;continue}}r.push(t)}const A=n??e.url;if(!A)throw new Error("FFmpegInput missing url/input");return[...r,"-i",A,"-map","0:a:0?","-fflags","nobuffer","-flags","low_delay","-flush_packets","1","-vn","-sn","-dn","-acodec","pcm_s16le","-ar",t.sampleRate.toString(),"-ac",t.channels.toString(),"-f","s16le","pipe:1"]}encodeImaAdpcm(e,t){const s=2*t+1,r=Math.ceil(e.length/s),n=[],A=Int8Array.from([-1,-1,-1,-1,2,4,6,8,-1,-1,-1,-1,2,4,6,8]),i=Int16Array.from([7,8,9,10,11,12,13,14,16,17,19,21,23,25,28,31,34,37,41,45,50,55,60,66,73,80,88,97,107,118,130,143,157,173,190,209,230,253,279,307,337,371,408,449,494,544,598,658,724,796,876,963,1060,1166,1282,1411,1552,1707,1878,2066,2272,2499,2749,3024,3327,3660,4026,4428,4871,5358,5894,6484,7132,7845,8630,9493,10442,11487,12635,13899,15289,16818,18500,20350,22385,24623,27086,29794,32767]);let o=0;for(let s=0;s<r;s++){const s=Buffer.alloc(4+t);let r=e[o]??0,a=0;s.writeInt16LE(r,0),s.writeUInt8(a,2),s.writeUInt8(0,3),o++;const c=new Uint8Array(2*t);for(let t=0;t<c.length;t++){const s=e[o]??r;o++;let n=s-r,l=0;n<0&&(l=8,n=-n);let h=i[a]??7,g=0,d=h>>3;n>=h&&(g|=4,n-=h,d+=h),h>>=1,n>=h&&(g|=2,n-=h,d+=h),h>>=1,n>=h&&(g|=1,d+=h),l?r-=d:r+=d,r=this.clamp16(r),a+=A[g]??0,a<0&&(a=0),a>88&&(a=88),c[t]=15&(g|l)}for(let e=0;e<t;e++){const t=c[2*e]??0,r=c[2*e+1]??0;s[4+e]=15&t|(15&r)<<4}n.push(s)}return Buffer.concat(n)}}},7927:function(e,t,s){"use strict";var r,n=this&&this.__createBinding||(Object.create?function(e,t,s,r){void 0===r&&(r=s);var n=Object.getOwnPropertyDescriptor(t,s);n&&!("get"in n?!t.__esModule:n.writable||n.configurable)||(n={enumerable:!0,get:function(){return t[s]}}),Object.defineProperty(e,r,n)}:function(e,t,s,r){void 0===r&&(r=s),e[r]=t[s]}),A=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),i=this&&this.__importStar||(r=function(e){return r=Object.getOwnPropertyNames||function(e){var t=[];for(var s in e)Object.prototype.hasOwnProperty.call(e,s)&&(t[t.length]=s);return t},r(e)},function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var s=r(e),i=0;i<s.length;i++)"default"!==s[i]&&n(t,e,s[i]);return A(t,e),t});Object.defineProperty(t,"__esModule",{value:!0});const o=i(s(7562)),a=s(4417),c=s(6125),l=s(5582),h=s(5098),g=s(6185);class d extends o.ScryptedDeviceBase{constructor(e){super(e),this.devices=new Map;const t=o.default.systemManager.getDeviceByName("Scrypted NVR");this.nvrDeviceId=t?.id}getScryptedDeviceCreator(){return"Reolink Native camera"}async getDevice(e){if(this.devices.has(e))return this.devices.get(e);const t=this.createCamera(e);return this.devices.set(e,t),t}async createDevice(e,t){const s=e.ip?.toString(),r=e.username?.toString(),n=e.password?.toString(),A=e.uid?.toString();if(!s||!r||!n)throw new Error("IP address, username, and password are required");this.console.log(`[AutoDetect] Starting device type detection for ${s}...`);const i=await(0,h.autoDetectDeviceType)({host:s,username:r,password:n,uid:A,logger:this.console},this.console);if(this.console.log(`[AutoDetect] Detected device type: ${i.type} (transport: ${i.transport})`),"nvr"===i.type){const A=i.deviceInfo||{},a=A?.name||"Reolink NVR";t=`${A?.serialNumber||A?.itemNo||`nvr-${Date.now()}`}-nvr`,e.newCamera||=a,await o.default.deviceManager.onDeviceDiscovered({nativeId:t,name:a,interfaces:[o.ScryptedInterface.Settings,o.ScryptedInterface.DeviceDiscovery,o.ScryptedInterface.DeviceProvider,o.ScryptedInterface.Reboot],type:o.ScryptedDeviceType.DeviceProvider,providerNativeId:this.nativeId});const c=await this.getDevice(t);if(!(c instanceof l.ReolinkNativeNvrDevice))throw new Error("Expected NVR device but got different type");return c.storageSettings.values.ipAddress=s,c.storageSettings.values.username=r,c.storageSettings.values.password=n,t}const a=i.deviceInfo||{},c=a?.name||"Reolink Camera",d=a?.serialNumber||a?.itemNo||`unknown-${Date.now()}`;t="battery-cam"===i.type?`${d}-battery-cam`:`${d}-cam`,e.newCamera||=c;const u=await(0,h.createBaichuanApi)({inputs:{host:s,username:r,password:n,uid:i.uid,logger:this.console},transport:i.transport,logger:this.console});try{await u.login();const e=0,{abilities:A,capabilities:h,objects:d,presets:E}=await u.getDeviceCapabilities(e);this.console.log(JSON.stringify({abilities:A,capabilities:h,deviceInfo:a}));const{interfaces:I,type:C}=(0,g.getDeviceInterfaces)({capabilities:h,logger:this.console});await o.default.deviceManager.onDeviceDiscovered({nativeId:t,name:c,interfaces:I,type:C,providerNativeId:this.nativeId});const B=await this.getDevice(t);if(B instanceof l.ReolinkNativeNvrDevice)throw new Error("NVR device should not reach this code path");return B.info=a,B.classes=d,B.presets=E,B.storageSettings.values.username=r,B.storageSettings.values.password=n,B.storageSettings.values.rtspChannel=e,B.storageSettings.values.ipAddress=s,B.storageSettings.values.capabilities=h,B.storageSettings.values.uid=i.uid,t}catch(e){throw this.console.error("Error adding Reolink device",e),e}finally{await u.close()}}async releaseDevice(e,t){if(this.devices.has(t)){const e=this.devices.get(t);e&&"release"in e&&"function"==typeof e.release&&await e.release(),this.devices.delete(t)}}async getCreateDeviceSettings(){return[{key:"ip",title:"IP Address",placeholder:"192.168.2.222"},{key:"username",title:"Username"},{key:"password",title:"Password",type:"password"},{key:"uid",title:"UID",description:"Reolink UID (optional, required for battery cameras if TCP connection fails)"}]}createCamera(e){return e.endsWith("-battery-cam")?new c.ReolinkNativeBatteryCamera(e,this):e.endsWith("-nvr")?new l.ReolinkNativeNvrDevice(e,this):new a.ReolinkNativeCamera(e,this)}}t.default=d},5582:function(e,t,s){"use strict";var r,n=this&&this.__createBinding||(Object.create?function(e,t,s,r){void 0===r&&(r=s);var n=Object.getOwnPropertyDescriptor(t,s);n&&!("get"in n?!t.__esModule:n.writable||n.configurable)||(n={enumerable:!0,get:function(){return t[s]}}),Object.defineProperty(e,r,n)}:function(e,t,s,r){void 0===r&&(r=s),e[r]=t[s]}),A=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),i=this&&this.__importStar||(r=function(e){return r=Object.getOwnPropertyNames||function(e){var t=[];for(var s in e)Object.prototype.hasOwnProperty.call(e,s)&&(t[t.length]=s);return t},r(e)},function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var s=r(e),i=0;i<s.length;i++)"default"!==s[i]&&n(t,e,s[i]);return A(t,e),t});Object.defineProperty(t,"__esModule",{value:!0}),t.ReolinkNativeNvrDevice=void 0;const o=i(s(7562)),a=s(6117),c=s(7077),l=s(4417),h=s(6125),g=s(5098),d=s(6185);class u extends c.BaseBaichuanClass{constructor(e,t){super(e),this.storageSettings=new a.StorageSettings(this,{debugEvents:{title:"Debug Events",type:"boolean",immediate:!0},eventSource:{title:"Event Source",description:"Select the source for camera events: Native (Baichuan) or CGI (HTTP polling)",type:"string",choices:["Native","CGI"],defaultValue:"Native",immediate:!0,onPut:async()=>{await this.reinitEventSubscriptions()}},ipAddress:{title:"IP address",type:"string",onPut:async()=>await this.reinit()},username:{title:"Username",placeholder:"admin",defaultValue:"admin",type:"string",onPut:async()=>await this.reinit()},password:{title:"Password",type:"password",onPut:async()=>await this.reinit()}}),this.discoveredDevices=new Map,this.cameraNativeMap=new Map,this.channelToNativeIdMap=new Map,this.processing=!1,this.plugin=t,setTimeout((async()=>{await this.init()}),5e3)}async reboot(){const e=await this.ensureClient();await e.Reboot()}getConnectionConfig(){const{ipAddress:e,username:t,password:s}=this.storageSettings.values;if(!e||!t||!s)throw new Error("Missing NVR credentials");return{host:e,username:t,password:s,transport:"tcp",logger:this.console}}getConnectionCallbacks(){return{onError:void 0,onClose:async()=>{await this.reinit()},onSimpleEvent:e=>this.forwardNativeEvent(e),getEventSubscriptionEnabled:()=>"Native"===(this.storageSettings.values.eventSource||"Native")}}isDebugEnabled(){return this.storageSettings.values.debugEvents||!1}getDeviceName(){return this.name||"NVR"}async onBeforeCleanup(){await this.unsubscribeFromAllEvents()}async reinit(){if(this.nvrApi)try{await this.nvrApi.logout()}catch{}this.nvrApi=void 0,await super.cleanupBaichuanApi()}async ensureClient(){if(this.nvrApi)return this.nvrApi;const{ipAddress:e,username:t,password:r}=this.storageSettings.values;if(!e||!t||!r)throw new Error("Missing NVR credentials");const{ReolinkCgiApi:n}=await Promise.resolve().then(s.bind(s,2498));return this.nvrApi=new n({host:e,username:t,password:r}),await this.nvrApi.login(),this.nvrApi}forwardNativeEvent(e){const t=this.getBaichuanLogger();if("Native"===(this.storageSettings.values.eventSource||"Native"))try{t.debug(`Baichuan event: ${JSON.stringify(e)}`);const s=e?.channel;if(void 0===s)return void t.error("Event has no channel, ignoring");const r=this.channelToNativeIdMap.get(s),n=r?this.cameraNativeMap.get(r):void 0;if(!n)return void t.error(`No camera found for channel ${s}, ignoring event`);const A=[];let i=!1;switch(e?.type){case"motion":i=!0;break;case"doorbell":try{"function"==typeof n.handleDoorbellEvent&&n.handleDoorbellEvent()}catch(e){t.warn(`Error handling doorbell event for camera channel ${s}`,e)}i=!0;break;case"people":case"vehicle":case"animal":case"face":case"package":case"other":A.push(e.type),i=!0;break;default:return void t.error(`Unknown event type: ${e?.type}`)}n.processEvents({motion:i,objects:A}).catch((e=>{t.warn(`Error processing events for camera channel ${s}`,e)}))}catch(e){t.warn("Error in NVR Native event forwarder",e)}}async ensureBaichuanClient(){return await super.ensureBaichuanClient()}async subscribeToAllEvents(){const e=this.getBaichuanLogger();"Native"===(this.storageSettings.values.eventSource||"Native")?(await super.subscribeToEvents(),e.log("Subscribed to all events for NVR cameras")):await this.unsubscribeFromAllEvents()}async unsubscribeFromAllEvents(){await super.unsubscribeFromEvents()}async reinitEventSubscriptions(){const e=this.getBaichuanLogger(),{eventSource:t}=this.storageSettings.values;"Native"!==t?await this.unsubscribeFromAllEvents():this.subscribeToAllEvents().catch((t=>{e.warn("Failed to subscribe to Native events",t)})),e.log(`Event source set to: ${t}`)}forwardCgiEvents(e){this.getBaichuanLogger().debug(`CGI Events call result: ${JSON.stringify(e)}`);for(const[t,s]of this.channelToNativeIdMap.entries()){const r=s?this.cameraNativeMap.get(s):void 0,n=e[t];n&&r&&r.processEvents(n)}}async init(){const e=await this.ensureClient(),t=this.getBaichuanLogger();await this.updateDeviceInfo(),await this.reinitEventSubscriptions(),setInterval((async()=>{if(!this.processing&&e){this.processing=!0;try{const s=Date.now();if((!this.lastErrorsCheck||s-this.lastErrorsCheck>6e4)&&(this.lastErrorsCheck=s),!this.lastNvrInfoCheck||s-this.lastNvrInfoCheck>3e5){t.log("Starting NVR info data fetch"),this.lastNvrInfoCheck=s;const{nvrData:r}=await e.getNvrInfo(),{devicesData:n,channelsResponse:A,response:i}=await e.getDevicesInfo();t.log(`NVR info data fetched: ${JSON.stringify({nvrData:r,devicesData:n,channelsResponse:A,response:i})}`),await this.discoverDevices(!0)}const{eventSource:r}=this.storageSettings.values;if("CGI"===r){const t=await e.getAllChannelsEvents();this.forwardCgiEvents(t.parsed)}const{batteryInfoData:n,response:A}=await e.getAllChannelsBatteryInfo();t.debug(`Battery info call result: ${JSON.stringify({batteryInfoData:n,response:A})}`),this.cameraNativeMap.forEach((e=>{if(e){const t=e.storageSettings.values.rtspChannel,s=n[t];s&&e.updateSleepingState({reason:"NVR",state:s.sleeping?"sleeping":"awake",idleMs:0,lastRxAtMs:0}).catch((()=>{}))}}))}catch(e){t.error("Error on events flow",e)}finally{this.processing=!1}}}),1e3)}async updateDeviceInfo(){const e=this.getBaichuanLogger(),{ipAddress:t}=this.storageSettings.values;try{const s=await this.ensureClient(),r=await s.getInfo();await(0,d.updateDeviceInfo)({device:this,ipAddress:t,deviceData:r}),e.log(`Device info updated: ${JSON.stringify(r)}`)}catch(t){e.warn("Failed to fetch device info",t)}}async getSettings(){return await this.storageSettings.getSettings()}async putSetting(e,t){return this.storageSettings.putSetting(e,t)}async releaseDevice(e,t){this.cameraNativeMap.delete(t)}async getDevice(e){let t=this.cameraNativeMap.get(e);return t||(t=e.endsWith("-battery-cam")?new h.ReolinkNativeBatteryCamera(e,this.plugin,this):new l.ReolinkNativeCamera(e,this.plugin,this),this.cameraNativeMap.set(e,t)),t}buildNativeId(e,t,s){const r=s?"-battery-cam":"-cam";return t?`${this.nativeId}-ch${e}-${t}${r}`:`${this.nativeId}-ch${e}${r}`}getCameraInterfaces(){return[o.ScryptedInterface.VideoCameraConfiguration,o.ScryptedInterface.Camera,o.ScryptedInterface.MotionSensor,o.ScryptedInterface.VideoTextOverlays,o.ScryptedInterface.VideoCamera,o.ScryptedInterface.Settings,o.ScryptedInterface.ObjectDetector]}async syncEntitiesFromRemote(){const e=await this.ensureClient(),t=this.getBaichuanLogger(),{devicesData:s,channels:r}=await e.getDevicesInfo();t.log(`Sync entities from remote for ${r.length} channels`);for(const e of r)try{const{channelStatus:r,channelInfo:n,abilities:A}=s[e],i=r?.name,a=r?.uid,c=!!A?.battery?.ver,l=this.buildNativeId(e,a,c),h=[o.ScryptedInterface.VideoCamera];c&&h.push(o.ScryptedInterface.Battery);const g=A.supportDoorbellLight?o.ScryptedDeviceType.Doorbell:o.ScryptedDeviceType.Camera,d={nativeId:l,name:i,providerNativeId:this.nativeId,interfaces:h,type:g,info:{manufacturer:"Reolink",model:n?.typeInfo,serialNumber:a}};if(this.channelToNativeIdMap.set(e,l),o.default.deviceManager.getNativeIds().includes(l))continue;if(this.discoveredDevices.has(l))continue;this.discoveredDevices.set(l,{device:d,description:`${i} (Channel ${e})`,rtspChannel:e,deviceData:s[e]}),t.debug(`Discovered channel ${e}: ${i}`)}catch(s){t.debug(`Error processing channel ${e}: ${s?.message||String(s)}`)}t.log(`Channel discovery completed. ${JSON.stringify({devicesData:s,channels:r})}`)}async discoverDevices(e){return e&&await this.syncEntitiesFromRemote(),[...this.discoveredDevices.values()].map((e=>({...e.device,description:e.description})))}async adoptDevice(e){const t=this.discoveredDevices.get(e.nativeId);if(!t)throw new Error("device not found");await this.onDeviceEvent(o.ScryptedInterface.DeviceDiscovery,await this.discoverDevices());const r=t.device.interfaces.includes(o.ScryptedInterface.Battery),{channelStatus:n}=t.deviceData,{ReolinkBaichuanApi:A}=await Promise.resolve().then(s.bind(s,2498)),i=n?.uid,a=r&&i?(0,g.normalizeUid)(i):void 0,c=new A({host:this.storageSettings.values.ipAddress,username:this.storageSettings.values.username,password:this.storageSettings.values.password,transport:"tcp",channel:t.rtspChannel,...a?{uid:a}:{}});await c.login();const{capabilities:l,objects:h,presets:u}=await c.getDeviceCapabilities(t.rtspChannel),{interfaces:E,type:I}=(0,d.getDeviceInterfaces)({capabilities:l,logger:this.console}),C={...t.device,interfaces:E,type:I};await o.default.deviceManager.onDeviceDiscovered(C);const B=await this.getDevice(e.nativeId);this.getBaichuanLogger().log("Adopted device",t,B?.name);const{username:Q,password:p,ipAddress:f}=this.storageSettings.values;return B.storageSettings.values.rtspChannel=t.rtspChannel,B.classes=h,B.presets=u,B.storageSettings.values.username=Q,B.storageSettings.values.password=p,B.storageSettings.values.rtspChannel=t.rtspChannel,B.storageSettings.values.ipAddress=f,B.storageSettings.values.capabilities=l,B.storageSettings.values.uid=t.deviceData.channelStatus.uid,B.storageSettings.values.isFromNvr=!0,this.discoveredDevices.delete(e.nativeId),B?.id}}t.ReolinkNativeNvrDevice=u},840:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ReolinkPtzPresets=void 0;t.ReolinkPtzPresets=class{constructor(e){this.camera=e}get storageSettings(){return this.camera.storageSettings}getPtzCapabilitiesStore(){return this.camera.ptzCapabilities}setPtzCapabilitiesStore(e){this.camera.ptzCapabilities=e}parsePresetIdFromSettingValue(e){const t=String(e??"").trim();if(!t)return;const s=t.includes("=")?t.split("=")[0]:t,r=Number(s);return Number.isFinite(r)?r:void 0}syncEnabledPresetsSettingAndCaps(e){const t=this.storageSettings.values.presets??[];if(!t.length)return;const s=new Map(e.map((e=>[e.id,e.name]))),r={};for(const e of t){const t=this.parsePresetIdFromSettingValue(e);if(void 0===t)continue;const n=(e.includes("=")?e.substring(e.indexOf("=")+1).trim():"")||s.get(t);n&&(r[String(t)]=n)}this.setPtzCapabilitiesStore({...this.getPtzCapabilitiesStore()??{},presets:r})}setCachedPtzPresets(e){const t=Array.isArray(e)?e:[];this.camera.presets=t;const s={};for(const e of t)s[String(e.id)]=e.name;this.setPtzCapabilitiesStore({...this.getPtzCapabilitiesStore()??{},presets:s})}getCachedPtzPresets(){const e=this.camera.presets;return Array.isArray(e)?e:[]}nextFreePresetId(e){const t=new Set(e.map((e=>e.id)));for(let e=1;e<=255;e++)if(!t.has(e))return e;throw new Error("No free PTZ preset id available (1..255)")}async refreshPtzPresets(){const e=await this.camera.ensureClient(),t=this.camera.storageSettings.values.rtspChannel,s=await e.getPtzPresets(t);return this.setCachedPtzPresets(s),this.syncEnabledPresetsSettingAndCaps(s),s}async moveToPreset(e){const t=await this.camera.ensureClient(),s=this.camera.storageSettings.values.rtspChannel;await t.moveToPtzPreset(s,e)}async createPtzPreset(e,t){const s=await this.camera.ensureClient(),r=this.camera.storageSettings.values.rtspChannel,n=String(e??"").trim();if(!n)throw new Error("Preset name is required");const A=await s.getPtzPresets(r),i=new Set(A.map((e=>e.id))),o=t??this.nextFreePresetId(A);if(void 0===t&&i.has(o))throw new Error(`PTZ preset id already in use: ${o}`);await s.setPtzPreset(r,o,n);const a=await s.getPtzPresets(r),c=a.some((e=>e.id===o));if(this.setCachedPtzPresets(a),!c)throw this.syncEnabledPresetsSettingAndCaps(a),new Error("PTZ preset save did not persist (camera returned an empty/unchanged preset list). Try again.");const l=this.storageSettings.values.presets??[];if(l.length){l.some((e=>this.parsePresetIdFromSettingValue(e)===o))||(l.push(`${o}=${n}`),this.storageSettings.values.presets=l)}return this.syncEnabledPresetsSettingAndCaps(a),{id:o,name:n}}async updatePtzPresetToCurrentPosition(e){const t=await this.camera.ensureClient(),s=this.camera.storageSettings.values.rtspChannel,r=this.getCachedPtzPresets().find((t=>t.id===e)),n=r?.name??`Preset ${e}`;await t.setPtzPreset(s,e,n),await this.refreshPtzPresets()}async deletePtzPreset(e){const t=await this.camera.ensureClient(),s=this.camera.storageSettings.values.rtspChannel;await t.deletePtzPreset(s,e);const r=this.storageSettings.values.presets;if(Array.isArray(r)&&r.length){const t=r.filter((e=>"string"==typeof e)).filter((t=>this.parsePresetIdFromSettingValue(t)!==e));this.storageSettings.values.presets=t}await this.refreshPtzPresets()}async renamePtzPreset(e,t){const s=await this.camera.ensureClient(),r=this.camera.storageSettings.values.rtspChannel,n=String(t??"").trim();if(!n)throw new Error("Preset name is required");await s.moveToPtzPreset(r,e),await s.setPtzPreset(r,e,n),await this.refreshPtzPresets()}}},5050:function(e,t,s){"use strict";var r=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.StreamManager=void 0,t.parseStreamProfileFromId=function(e){if(!e)return;if(e.startsWith("native_")){return e.replace("native_","")}if(e.endsWith(".bcs")){return e.replace(".bcs","")}if(e.startsWith("h264Preview_")){if(e.endsWith("_main"))return"main";if(e.endsWith("_sub"))return"sub"}return},t.isNativeStreamId=function(e){return e?.startsWith("native_")??!1},t.fetchVideoStreamOptionsFromApi=A,t.buildVideoStreamOptions=async function(e){const{client:t,ipAddress:s,cachedNetPort:r,rtspChannel:n,logger:i,nvrDevice:o}=e,a=[],c=[],l=r||await t.getNetPort(),h=1===l.rtsp?.enable,g=1===l.rtmp?.enable,d=l.rtsp?.port??554,u=l.rtmp?.port??1935,E=await t.getStreamMetadata(n),I=E?.streams||[];for(const e of I){const t=e.profile,r=String(e.videoEncType||"").includes("264")?"h264":String(e.videoEncType||"").includes("265")?"h265":String(e.videoEncType||"").toLowerCase();if(h&&"ext"!==t){const A=String(n+1).padStart(2,"0"),i="main"===t?"main":"sub",o=`/h264Preview_${A}_${i}`,c=`h264Preview_${A}_${i}`;a.push({name:`RTSP ${c}`,id:c,container:"rtsp",video:{codec:r,width:e.width,height:e.height},url:`rtsp://${s}:${d}${o}`})}if(g){const A="main"===t?"main":"sub"===t?"sub":"ext",i="sub"===t?1:0,o=`${A}.bcs`,a=new URL(`rtmp://${s}:${u}${`/bcs/channel${n}_${A}.bcs`}`),l=a.searchParams;l.set("channel",n.toString()),l.set("stream",i.toString()),c.push({name:`RTMP ${o}`,id:o,container:"rtmp",video:{codec:r,width:e.width,height:e.height},url:a.toString()})}}const C=await A(t,n,i);let B=[];B=o&&"HOMEHUB"===o.info.model?[...C,...a,...c]:[...a,...c,...C];return B},t.selectStreamOption=function(e,t){if(!t)throw new Error("video streams not set up or no longer exists.");const s=e?.find((e=>e.id===t.id))||e?.[0];if(!s)throw new Error("No stream options available");return s},t.expectedVideoTypeFromUrlMediaStreamOptions=function(e){const t=e?.video?.codec;return"string"!=typeof t?void 0:t.includes("265")?"H265":t.includes("264")?"H264":void 0},t.createRfc4571MediaObjectFromStreamManager=async function(e){const{streamManager:t,channel:s,profile:r,streamKey:A,expectedVideoType:i,selected:o,sourceId:a,onDetectedCodec:c}=e,{host:l,port:h,sdp:g,audio:d,username:u,password:E}=await t.getRfcStream(s,r,A,i);try{const e=/a=rtpmap:\d+\s+(H26[45])\//.exec(g)?.[1];if(e){const t="H265"===e?"h265":"h264";c?.(t)}}catch{}const{url:I,...C}=o;C.container="rtp",d&&(C.audio||={},C.audio.codec=d.codec,C.audio.sampleRate=d.sampleRate,C.audio.channels=d.channels);const B=encodeURIComponent(u||""),Q=encodeURIComponent(E||""),p={url:`tcp://${B}:${Q}@${l}:${h}`,sdp:g,mediaStreamOptions:C};return await n.default.mediaManager.createMediaObject(Buffer.from(JSON.stringify(p)),"x-scrypted/x-rfc4571",{sourceId:a})};const n=r(s(7562));async function A(e,t,s){const r=await e.getStreamMetadata(t),n=[],A=r?.streams||[];for(const e of A){const t=e.profile,s=String(e.videoEncType||"").includes("264")?"h264":String(e.videoEncType||"").includes("265")?"h265":String(e.videoEncType||"").toLowerCase();n.push({name:`Native ${t}`,id:`native_${t}`,container:"rtp",video:{codec:s,width:e.width,height:e.height},url:""})}return n}t.StreamManager=class{constructor(e){this.opts=e,this.nativeRfcServers=new Map,this.nativeRfcServerCreatePromises=new Map}getLogger(){return this.opts.getLogger()}async ensureNativeRfcServer(e,t,r,n){const A=this.nativeRfcServerCreatePromises.get(e);if(A)return await A;const i=(async()=>{const A=this.nativeRfcServers.get(e);if(A?.server?.listening){if(!n||A.videoType===n)return{host:A.host,port:A.port,sdp:A.sdp,audio:A.audio,username:A.username||this.opts.credentials.username,password:A.password||this.opts.credentials.password};this.getLogger().warn(`Native RFC cache codec mismatch for ${e}: cached=${A.videoType} expected=${n}; recreating server.`)}if(A){try{await A.close("recreate")}catch{}this.nativeRfcServers.delete(e)}const i=await this.opts.createStreamClient(),{createScryptedRfc4571TcpServer:o}=await Promise.resolve().then(s.bind(s,2498)),{username:a,password:c}=this.opts.credentials,l=!this.opts.sharedConnection,h=await o({api:i,channel:t,profile:r,logger:this.getLogger(),expectedVideoType:n,closeApiOnTeardown:l,username:a,password:c});return this.nativeRfcServers.set(e,h),h.server.once("close",(()=>{const t=this.nativeRfcServers.get(e);t?.server===h.server&&this.nativeRfcServers.delete(e)})),{host:h.host,port:h.port,sdp:h.sdp,audio:h.audio,username:h.username||this.opts.credentials.username,password:h.password||this.opts.credentials.password}})();this.nativeRfcServerCreatePromises.set(e,i);try{return await i}finally{this.nativeRfcServerCreatePromises.delete(e)}}async getRfcStream(e,t,s,r){return await this.ensureNativeRfcServer(s,e,t,r)}async closeAllStreams(e){const t=Array.from(this.nativeRfcServers.values());this.nativeRfcServers.clear(),await Promise.allSettled(t.map((async t=>{try{await t.close(e||"connection reset")}catch(e){this.getLogger().debug("Error closing stream server",e)}})))}}},6185:(e,t,s)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.updateDeviceInfo=t.getDeviceInterfaces=void 0;const r=s(7562);t.getDeviceInterfaces=e=>{const{capabilities:t,logger:s}=e,n=[r.ScryptedInterface.VideoCamera,r.ScryptedInterface.Settings,r.ScryptedInterface.Reboot,r.ScryptedInterface.VideoCameraConfiguration,r.ScryptedInterface.Camera,r.ScryptedInterface.AudioSensor,r.ScryptedInterface.MotionSensor,r.ScryptedInterface.VideoTextOverlays];try{const{hasPtz:e,hasSiren:s,hasFloodlight:A,hasPir:i,hasBattery:o,hasIntercom:a,isDoorbell:c}=t;e&&n.push(r.ScryptedInterface.PanTiltZoom),n.push(r.ScryptedInterface.ObjectDetector),(s||A||i)&&n.push(r.ScryptedInterface.DeviceProvider),o&&n.push(r.ScryptedInterface.Battery,r.ScryptedInterface.Sleep),a&&n.push(r.ScryptedInterface.Intercom),c&&n.push(r.ScryptedInterface.BinarySensor)}catch(e){s.error("Error getting device interfaces",e)}return{interfaces:n,type:t.isDoorbell?r.ScryptedDeviceType.Doorbell:r.ScryptedDeviceType.Camera}};t.updateDeviceInfo=async e=>{const{device:t,ipAddress:s,deviceData:r}=e;try{const e=t.info||{};e.ip=s,e.serialNumber=r?.serialNumber||r?.itemNo,e.firmware=r?.firmwareVersion,e.version=r?.hardwareVersion,e.model=r?.type,e.manufacturer="Reolink",e.managementUrl=`http://${s}`,t.info=e}catch(e){const r=t.info||{};throw r.ip=s,r.manufacturer="Reolink native",r.managementUrl=`http://${s}`,t.info=r,e}}},5317:e=>{"use strict";e.exports=require("child_process")},4434:e=>{"use strict";e.exports=require("events")},9896:e=>{"use strict";e.exports=require("fs")},3339:e=>{"use strict";e.exports=require("module")},4589:e=>{"use strict";e.exports=require("node:assert")},6698:e=>{"use strict";e.exports=require("node:async_hooks")},4573:e=>{"use strict";e.exports=require("node:buffer")},1421:e=>{"use strict";e.exports=require("node:child_process")},7540:e=>{"use strict";e.exports=require("node:console")},7598:e=>{"use strict";e.exports=require("node:crypto")},3053:e=>{"use strict";e.exports=require("node:diagnostics_channel")},610:e=>{"use strict";e.exports=require("node:dns")},8474:e=>{"use strict";e.exports=require("node:events")},1455:e=>{"use strict";e.exports=require("node:fs/promises")},7067:e=>{"use strict";e.exports=require("node:http")},2467:e=>{"use strict";e.exports=require("node:http2")},7030:e=>{"use strict";e.exports=require("node:net")},6760:e=>{"use strict";e.exports=require("node:path")},643:e=>{"use strict";e.exports=require("node:perf_hooks")},1792:e=>{"use strict";e.exports=require("node:querystring")},99:e=>{"use strict";e.exports=require("node:sqlite")},7075:e=>{"use strict";e.exports=require("node:stream")},7997:e=>{"use strict";e.exports=require("node:timers")},1692:e=>{"use strict";e.exports=require("node:tls")},7975:e=>{"use strict";e.exports=require("node:util")},3429:e=>{"use strict";e.exports=require("node:util/types")},5919:e=>{"use strict";e.exports=require("node:worker_threads")},8522:e=>{"use strict";e.exports=require("node:zlib")},6928:e=>{"use strict";e.exports=require("path")},2203:e=>{"use strict";e.exports=require("stream")},9023:e=>{"use strict";e.exports=require("util")},3106:e=>{"use strict";e.exports=require("zlib")},5537:e=>{"use strict";function t(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}const s=new Int32Array([0,1996959894,3993919788,2567524794,124634137,1886057615,3915621685,2657392035,249268274,2044508324,3772115230,2547177864,162941995,2125561021,3887607047,2428444049,498536548,1789927666,4089016648,2227061214,450548861,1843258603,4107580753,2211677639,325883990,1684777152,4251122042,2321926636,335633487,1661365465,4195302755,2366115317,997073096,1281953886,3579855332,2724688242,1006888145,1258607687,3524101629,2768942443,901097722,1119000684,3686517206,2898065728,853044451,1172266101,3705015759,2882616665,651767980,1373503546,3369554304,3218104598,565507253,1454621731,3485111705,3099436303,671266974,1594198024,3322730930,2970347812,795835527,1483230225,3244367275,3060149565,1994146192,31158534,2563907772,4023717930,1907459465,112637215,2680153253,3904427059,2013776290,251722036,2517215374,3775830040,2137656763,141376813,2439277719,3865271297,1802195444,476864866,2238001368,4066508878,1812370925,453092731,2181625025,4111451223,1706088902,314042704,2344532202,4240017532,1658658271,366619977,2362670323,4224994405,1303535960,984961486,2747007092,3569037538,1256170817,1037604311,2765210733,3554079995,1131014506,879679996,2909243462,3663771856,1141124467,855842277,2852801631,3708648649,1342533948,654459306,3188396048,3373015174,1466479909,544179635,3110523913,3462522015,1591671054,702138776,2966460450,3352799412,1504918807,783551873,3082640443,3233442989,3988292384,2596254646,62317068,1957810842,3939845945,2647816111,81470997,1943803523,3814918930,2489596804,225274430,2053790376,3826175755,2466906013,167816743,2097651377,4027552580,2265490386,503444072,1762050814,4150417245,2154129355,426522225,1852507879,4275313526,2312317920,282753626,1742555852,4189708143,2394877945,397917763,1622183637,3604390888,2714866558,953729732,1340076626,3518719985,2797360999,1068828381,1219638859,3624741850,2936675148,906185462,1090812512,3747672003,2825379669,829329135,1181335161,3412177804,3160834842,628085408,1382605366,3423369109,3138078467,570562233,1426400815,3317316542,2998733608,733239954,1555261956,3268935591,3050360625,752459403,1541320221,2607071920,3965973030,1969922972,40735498,2617837225,3943577151,1913087877,83908371,2512341634,3803740692,2075208622,213261112,2463272603,3855990285,2094854071,198958881,2262029012,4057260610,1759359992,534414190,2176718541,4139329115,1873836001,414664567,2282248934,4279200368,1711684554,285281116,2405801727,4167216745,1634467795,376229701,2685067896,3608007406,1308918612,956543938,2808555105,3495958263,1231636301,1047427035,2932959818,3654703836,1088359270,936918e3,2847714899,3736837829,1202900863,817233897,3183342108,3401237130,1404277552,615818150,3134207493,3453421203,1423857449,601450431,3009837614,3294710456,1567103746,711928724,3020668471,3272380065,1510334235,755167117]);function r(e){if(Buffer.isBuffer(e))return e;if("number"==typeof e)return Buffer.alloc(e);if("string"==typeof e)return Buffer.from(e);throw new Error("input must be buffer, number, or string, received "+typeof e)}function n(e,t){e=r(e),Buffer.isBuffer(t)&&(t=t.readUInt32BE(0));let n=~t;for(var A=0;A<e.length;A++)n=s[255&(n^e[A])]^n>>>8;return~n}function A(){return function(e){const t=r(4);return t.writeInt32BE(e,0),t}(n.apply(null,arguments))}A.signed=function(){return n.apply(null,arguments)},A.unsigned=function(){return n.apply(null,arguments)>>>0};const i=t(A);e.exports=i},2498:(e,t,s)=>{"use strict";s.d(t,{ReolinkBaichuanApi:()=>Wt,ReolinkCgiApi:()=>ue,createScryptedRfc4571TcpServer:()=>rs});const r=require("crypto");var n=s(4434);const A=require("net"),i=require("dgram"),o=require("timers");var a=s(9896),c=s(6928),l=s(9038),h=s(5317);const g=require("fs/promises");var d=s(6822);const u=require("http");var E=9e3,I=Buffer.from([240,222,188,10]),C=Buffer.from([160,203,237,15]),B=Uint8Array.from([31,45,60,75,90,105,120,255]),Q=Buffer.from("0123456789abcdef","utf8"),p=25620,f=25730;function m(e){return e===p||0===e||e===f}var y=253,w=234,S=289;function D(e){return function(e){return(0,r.createHash)("md5").update(e,"utf8").digest("hex").toUpperCase()}(e).slice(0,31)}function b(e,t){const s=D(`${e}-${t}`).slice(0,16);return Buffer.from(s,"utf8")}function v(e,t){const s=255&t,r=Buffer.allocUnsafe(e.length);for(let t=0;t<e.length;t++){const n=B[(s+t)%B.length];r[t]=e[t]^n^s}return r}function N(e,t){return v(e,t)}function R(e,t){if(0===e.length)return Buffer.alloc(0);const s=(0,r.createCipheriv)("aes-128-cfb",t,Q);return s.setAutoPadding(!1),Buffer.concat([s.update(e),s.final()])}function k(e,t){if(0===e.length)return Buffer.alloc(0);const s=(0,r.createDecipheriv)("aes-128-cfb",t,Q);return s.setAutoPadding(!1),Buffer.concat([s.update(e),s.final()])}function T(e){const t=m(e.messageClass),s=t?24:20,r=Buffer.alloc(s),n=e.magic??I;if(4!==n.length)throw new Error("magic must be 4 bytes");return n.copy(r,0),r.writeUInt32LE(e.cmdId>>>0,4),r.writeUInt32LE(e.bodyLen>>>0,8),r.writeUInt8(255&e.channelId,12),r.writeUInt8(255&e.streamType,13),r.writeUInt16LE(65535&e.msgNum,14),r.writeUInt16LE(65535&e.responseCode,16),r.writeUInt16LE(65535&e.messageClass,18),t&&r.writeUInt32LE((e.payloadOffset??0)>>>0,20),r}function F(e){if(e.length<20)throw new Error("not enough data for Baichuan header");const t=e.subarray(0,4);if(!t.equals(I)&&!t.equals(C))throw new Error(`invalid Baichuan magic: ${t.toString("hex")}`);const s=e.readUInt32LE(4),r=e.readUInt32LE(8),n=e.readUInt8(12),A=e.readUInt8(13),i=e.readUInt16LE(14),o=e.readUInt16LE(16),a=e.readUInt16LE(18),c=m(a)?24:20;if(e.length<c)throw new Error("not enough data for Baichuan header (needs 24 bytes)");const l=e.readUInt32LE(12),h={magic:Buffer.from(t),cmdId:s,bodyLen:r,channelId:n,streamType:A,msgNum:i,responseCode:o,messageClass:a};return 24===c&&(h.payloadOffset=e.readUInt32LE(20)),{header:h,headerLen:c,messageKey:l}}var M=class{buffer=Buffer.alloc(0);push(e){if(0===e.length)return[];const t=e;this.buffer=0===this.buffer.length?t:Buffer.concat([this.buffer,t]);const s=[];for(;!(this.buffer.length<4);){if(!this.buffer.subarray(0,4).equals(I)&&!this.buffer.subarray(0,4).equals(C)){const e=this.buffer.indexOf(I),t=this.buffer.indexOf(C),s=-1===e?t:-1===t?e:Math.min(e,t);if(-1===s){this.buffer=this.buffer.subarray(Math.max(0,this.buffer.length-3));break}if(this.buffer=this.buffer.subarray(s),this.buffer.length<20)break}if(this.buffer.length<20)break;let e;try{e=F(this.buffer)}catch{break}const{header:t,headerLen:r,messageKey:n}=e,A=r+t.bodyLen;if(this.buffer.length<A)break;const i=this.buffer.subarray(0,A),o=i.subarray(r);let a=0;if(24===r){const e=t.payloadOffset??0;a=e>0?Math.min(e,t.bodyLen):0}const c=o.subarray(0,a),l=o.subarray(a);s.push({header:t,body:o,extension:c,payload:l,messageKey:n,raw:i}),this.buffer=this.buffer.subarray(A)}return s}};function U(e){if(null==e||"string"!=typeof e){throw new Error(`xmlEscape: expected string but got ${typeof e}: ${e}`)}return e.replaceAll("&","&amp;").replaceAll("<","&lt;").replaceAll(">","&gt;").replaceAll('"',"&quot;").replaceAll("'","&apos;")}function L(e){return null==e?'<?xml version="1.0" encoding="UTF-8" ?><Extension version="1.1"></Extension>':`<?xml version="1.0" encoding="UTF-8" ?>\n<Extension version="1.1">\n<channelId>${e}</channelId>\n</Extension>`}function H(e){return null==e?'<?xml version="1.0" encoding="UTF-8" ?><Extension version="1.1"><binaryData>1</binaryData></Extension>':`<?xml version="1.0" encoding="UTF-8" ?>\n<Extension version="1.1">\n<binaryData>1</binaryData>\n<channelId>${e}</channelId>\n</Extension>`}function P(e,t){const s=new RegExp(`<${t}>([^<]*)</${t}>`).exec(e);return s?.[1]}function x(e,t,s,r){let n="";const A=r?.name;"setPos"===s&&void 0!==A&&(n=`<name>${U(A)}</name>`);let i="";return void 0!==r?.enable&&(i=`<enable>${r.enable}</enable>`),`<?xml version="1.0" encoding="UTF-8" ?>\n<body>\n<PtzPreset version="1.1">\n<channelId>${e}</channelId>\n<presetList>\n<preset>\n<id>${t}</id>\n<command>${s}</command>\n${n}\n${i}\n</preset>\n</presetList>\n</PtzPreset>\n</body>`}function Y(e,t){return`<?xml version="1.0" encoding="UTF-8" ?>\n<body>\n<audioPlayInfo version="1.1">\n${void 0!==e?`<channelId>${e}</channelId>`:""}\n<playMode>2</playMode>\n<playDuration>10</playDuration>\n<playTimes>1</playTimes>\n<onOff>${t}</onOff>\n</audioPlayInfo>\n</body>`}function V(e,t){return`<?xml version="1.0" encoding="UTF-8" ?>\n<body>\n<audioPlayInfo version="1.1">\n${void 0!==e?`<channelId>${e}</channelId>`:""}\n<playMode>0</playMode>\n<playDuration>10</playDuration>\n<playTimes>${t}</playTimes>\n<onOff>1</onOff>\n</audioPlayInfo>\n</body>`}function O(e,t,s=180){return`<?xml version="1.0" encoding="UTF-8" ?>\n<body>\n<FloodlightManual version="1.1">\n<channelId>${e}</channelId>\n<status>${t}</status>\n<duration>${s}</duration>\n</FloodlightManual>\n</body>`}var G,J=713543482,W=713543456,_=713543440;function q(e){const t=function(){if(G)return G;const e=new Uint32Array(256);for(let t=0;t<256;t++){let s=t;for(let e=0;e<8;e++)s=1&s?3988292384^s>>>1:s>>>1;e[t]=s>>>0}return G=e,e}();let s=0;for(let r=0;r<e.length;r++){s=(t[255&(s^e[r])]^s>>>8)>>>0}return s>>>0}var $=Uint32Array.from([523058251,1517059981,941043275,2188469082,2252282411,2781280216,2205278644,401789861]);function z(e,t){const s=Buffer.allocUnsafe(t.length),r=function*(e){let t=0;for(;;){const s=$[t%$.length]+(e>>>0)>>>0;yield 255&s,yield s>>>8&255,yield s>>>16&255,yield s>>>24&255,t++}}(e>>>0);for(let e=0;e<t.length;e++)s[e]=t[e]^r.next().value;return s}function X(e,t){return e.readInt32LE(t)}function j(e,t){const s=z(e,Buffer.from(t,"utf8")),r=q(s),n=Buffer.alloc(20);return n.writeUInt32LE(J,0),n.writeUInt32LE(s.length>>>0,4),n.writeUInt32LE(1,8),n.writeUInt32LE(e>>>0,12),n.writeUInt32LE(r>>>0,16),Buffer.concat([n,s])}function Z(e){const t=Buffer.alloc(20);return t.writeUInt32LE(_,0),t.writeInt32LE(0|e.connectionId,4),t.writeUInt32LE(0,8),t.writeUInt32LE(e.packetId>>>0,12),t.writeUInt32LE(e.payload.length>>>0,16),Buffer.concat([t,e.payload])}function K(e){if(e.length<4)throw new Error("BCUDP packet too short");const t=e.readUInt32LE(0);if(t===J){if(e.length<20)throw new Error("BCUDP discovery header too short");const t=e.readUInt32LE(4),s=e.readUInt32LE(8);if(1!==s)throw new Error(`BCUDP discovery unknownA expected 1, got ${s}`);const r=e.readUInt32LE(12),n=e.readUInt32LE(16),A=e.subarray(20);if(A.length<t)throw new Error("BCUDP discovery payload truncated");const i=A.subarray(0,t);if(n>>>0!=q(i)>>>0)throw new Error("BCUDP discovery CRC mismatch");const o=function(e,t){return z(e,t)}(r,i);return{kind:"discovery",tid:r,xml:o.toString("utf8")}}if(t===W){if(e.length<28)throw new Error("BCUDP ack header too short");const t=X(e,4),s=e.readUInt32LE(8);if(0!==s)throw new Error(`BCUDP ack unknownA expected 0, got ${s}`);const r=e.readUInt32LE(12),n=e.readUInt32LE(16),A=e.readUInt32LE(20),i=e.readUInt32LE(24),o=e.subarray(28);if(o.length<i)throw new Error("BCUDP ack payload truncated");return{kind:"ack",connectionId:t,groupId:r,packetId:n,maybeLatency:A,payload:o.subarray(0,i)}}if(t===_){if(e.length<20)throw new Error("BCUDP data header too short");const t=X(e,4),s=e.readUInt32LE(8);if(0!==s)throw new Error(`BCUDP data unknownA expected 0, got ${s}`);const r=e.readUInt32LE(12),n=e.readUInt32LE(16),A=e.subarray(20);if(A.length<n)throw new Error("BCUDP data payload truncated");return{kind:"data",connectionId:t,packetId:r,payload:A.subarray(0,n)}}throw new Error(`Unknown BCUDP magic 0x${t.toString(16)}`)}function ee(e){return`<P2P>${e}</P2P>`}function te(e){const t=e.conn??"local";return ee(`<C2D_A><sid>${e.sid}</sid><conn>${U(t)}</conn><cid>${e.cid}</cid><did>${e.did}</did><mtu>${e.mtu}</mtu></C2D_A>`)}function se(e){const t=/<D2C_CFM>([\s\S]*?)<\/D2C_CFM>/.exec(e);if(!t)return;const s=t[1]??"",r=/<sid>(-?\d+)<\/sid>/.exec(s)?.[1];if(null==r)return;const n=/<conn>([^<]+)<\/conn>/.exec(s)?.[1],A=/<rsp>(-?\d+)<\/rsp>/.exec(s)?.[1],i=/<cid>(-?\d+)<\/cid>/.exec(s)?.[1],o=/<did>(-?\d+)<\/did>/.exec(s)?.[1];return{sid:Number(r),...null!=n?{conn:n}:{},...null!=A?{rsp:Number(A)}:{},...null!=i?{cid:Number(i)}:{},...null!=o?{did:Number(o)}:{}}}function re(e){const t=/<D2C_T>([\s\S]*?)<\/D2C_T>/.exec(e);if(!t)return;const s=t[1]??"",r=/<sid>(-?\d+)<\/sid>/.exec(s)?.[1],n=/<cid>(-?\d+)<\/cid>/.exec(s)?.[1],A=/<did>(-?\d+)<\/did>/.exec(s)?.[1];if(null==r||null==n||null==A)return;const i=/<conn>([^<]+)<\/conn>/.exec(s)?.[1];return{sid:Number(r),cid:Number(n),did:Number(A),...null!=i?{conn:i}:{}}}var ne=class{currentValues=[];lastReceiveTime=null;displayValue=0;lastDisplayTime=null;getValue(){return this.displayValue}feed(){const e=performance.now();if(null!==this.lastReceiveTime){const t=1e3*(e-this.lastReceiveTime);this.currentValues.push(t)}if(this.lastReceiveTime=e,null!==this.lastDisplayTime){if(e-this.lastDisplayTime>1e3){this.lastDisplayTime=e;const t=this.currentValues.length;if(t>0){const e=this.currentValues.reduce(((e,t)=>e+t),0);this.displayValue=Math.floor(e/t)}else this.displayValue=0;this.currentValues=[]}}else this.lastDisplayTime=e,this.displayValue=0}},Ae=class extends n.EventEmitter{opts;sock;remote;mtu;clientId;cameraId;sid;sendPacketId=0;packetsWant=0;received=new Map;sent=new Map;ackTimer;resendTimer;hbTimer;discoveryTid;acceptSent=!1;lastAcceptAtMs;ackScheduled=!1;ackLatency=new ne;lastAckPacket=Buffer.alloc(0);ackSentCount=0;pendingData=[];pendingDataOffset=0;drainScheduled=!1;getKeepAliveTid(){return null!=this.discoveryTid?this.discoveryTid:(0|Math.floor(255*Math.random()))>>>0}constructor(e){super(),this.opts=e,this.mtu=1350}isConnected(){return!!this.sock&&!!this.remote&&null!=this.cameraId}async connect(){if(this.sock)return;const e=i.createSocket("udp4");this.sock=e;try{e.setRecvBufferSize(4194304),e.setSendBufferSize(4194304)}catch(e){}e.on("message",((e,t)=>{try{const s=K(e);this.handlePacket(s,t.address,t.port)}catch(e){this.emit("error",e instanceof Error?e:new Error(String(e)))}})),e.on("error",(e=>this.emit("error",e))),e.on("close",(()=>this.emit("close"))),await new Promise((t=>e.bind(0,"0.0.0.0",(()=>t())))),"direct"===this.opts.mode?(this.remote={host:this.opts.host,port:this.opts.port},this.clientId=this.opts.clientId,this.cameraId=this.opts.cameraId):await this.discoveryUid(e),this.startTimers()}async discoveryUid(e){if("uid"!==this.opts.mode)throw new Error("Internal: discoveryUid called for non-uid mode");const t=[2015,2018],s="255.255.255.255";e.setBroadcast(!0);const r=e.address(),n="string"==typeof r?0:r.port,A=0|Math.floor(2147483647*Math.random())||82e3,i=function(e){const t=e.os??"MAC";return ee(`<C2D_C><uid>${U(e.uid)}</uid><cli><port>${e.clientPort}</port></cli><cid>${e.cid}</cid><mtu>${e.mtu}</mtu><debug>false</debug><p>${U(t)}</p></C2D_C>`)}({uid:this.opts.uid,clientPort:n,cid:A,mtu:this.mtu}),a=await new Promise(((r,n)=>{const A=setTimeout((()=>{a&&clearInterval(a),e.off("message",p),n(new Error("BCUDP discovery timeout after 30000ms (camera may be sleeping or unreachable)"))}),3e4);let a,c,l,h,g,d=0,u=!1,E=!1,I=!1;const C=t=>{h&&(g||(g=setTimeout((()=>{const s=h,n=c,i=l;s&&(e.off("message",p),clearTimeout(A),a&&clearInterval(a),this.emit("debug","discovery_finalize",{reason:t,...null!=n?{sid:n}:{},...s}),r({...s,...null!=n?{sid:n}:{},...null!=i?{tid:i}:{}}))}),250)))},B=(t,s)=>{if(!u&&h&&null!=c)try{const r=(0|Math.floor(2147483647*Math.random()))>>>0,n=j(r,function(e){const t=e.conn??"local";return ee("<C2D_T>"+(null!=e.sid?`<sid>${e.sid}</sid>`:"")+`<conn>${U(t)}</conn><cid>${e.cid}</cid><mtu>${e.mtu}</mtu></C2D_T>`)}({...null!=c?{sid:c}:{},cid:h.cid,mtu:this.mtu,conn:"local"}));e.send(n,s,t),u=!0,this.emit("debug","discovery_t_send",{sid:c,cid:h.cid,did:h.did,rhost:t,rport:s})}catch(e){this.emit("debug","discovery_t_send_error",e)}},Q=(t,s,r,n)=>{if(!I)try{const A=j(t,te({sid:n.sid,conn:n.conn??"local",cid:n.cid,did:n.did,mtu:this.mtu}));e.send(A,r,s),I=!0,this.emit("debug","discovery_a_send",{sid:n.sid,cid:n.cid,did:n.did,rhost:s,rport:r})}catch(e){this.emit("debug","discovery_a_send_error",e)}},p=(e,t)=>{try{const s=K(e);if("discovery"!==s.kind)return;this.emit("debug","discovery_rx",{tid:s.tid,rhost:t.address,rport:t.port,xmlPreview:s.xml.slice(0,120)});const r=se(s.xml);r&&(c=r.sid,h||null==r.cid||null==r.did||(h={cid:r.cid,did:r.did,rhost:t.address,rport:t.port}),h&&(B(t.address,t.port),C("cfm")));const n=re(s.xml);if(n)return E=!0,c=n.sid,h||(h={cid:n.cid,did:n.did,rhost:t.address,rport:t.port}),this.emit("debug","discovery_t_rx",{sid:n.sid,cid:n.cid,did:n.did,rhost:t.address,rport:t.port}),Q(s.tid,t.address,t.port,n),void C("t_a");const A=function(e){const t=/<D2C_C_R>([\s\S]*?)<\/D2C_C_R>/.exec(e);if(!t)return;const s=t[1]??"",r=/<rsp>(-?\d+)<\/rsp>/.exec(s)?.[1],n=/<cid>(-?\d+)<\/cid>/.exec(s)?.[1],A=/<did>(-?\d+)<\/did>/.exec(s)?.[1];if(null==r||null==n||null==A)return;const i=/<sid>(-?\d+)<\/sid>/.exec(s)?.[1],o=/<timer>([\s\S]*?)<\/timer>/.exec(s)?.[1],a=o?/<def>(-?\d+)<\/def>/.exec(o)?.[1]:void 0,c=o?/<hb>(-?\d+)<\/hb>/.exec(o)?.[1]:void 0,l=o?/<hbt>(-?\d+)<\/hbt>/.exec(o)?.[1]:void 0,h=null!=a||null!=c||null!=l?{...null!=a?{def:Number(a)}:{},...null!=c?{hb:Number(c)}:{},...null!=l?{hbt:Number(l)}:{}}:void 0;return{rsp:Number(r),cid:Number(n),did:Number(A),...null!=i?{sid:Number(i)}:{},...h?{timer:h}:{}}}(s.xml);if(!A)return;if(0!==A.rsp)return;return this.emit("debug","discovery_success",{retryCount:d,rhost:t.address,rport:t.port,sid:A.sid??c,timer:A.timer}),l=s.tid,h={cid:A.cid,did:A.did,rhost:t.address,rport:t.port},null!=A.sid&&(c=A.sid),B(t.address,t.port),void(E||I?C("cr_t"):null!=c?(g&&clearTimeout(g),g=setTimeout((()=>{C("cr_timeout")}),1500)):C("cr_no_sid"))}catch{}};e.on("message",p);const f=()=>{const r=j((0|Math.floor(255*Math.random()))>>>0,i);for(const n of t)try{e.send(r,n,s),d++,this.emit("debug","discovery_send",{retryCount:d,host:s,port:n})}catch(e){this.emit("error",e instanceof Error?e:new Error(String(e)))}};f(),a=(0,o.setInterval)((()=>{f()}),500)}));this.clientId=a.cid,this.cameraId=a.did,this.sid=a.sid,this.discoveryTid=a.tid,this.remote={host:a.rhost,port:a.rport}}startTimers(){if(!this.sock||!this.remote||null==this.clientId||null==this.cameraId)throw new Error("BCUDP not ready");this.updateAckPacket(),this.sendHeartbeat(),this.ackTimer=(0,o.setInterval)((()=>{try{this.sendAckFast()}catch(e){this.emit("error",e instanceof Error?e:new Error(String(e)))}}),10),this.resendTimer=(0,o.setInterval)((()=>{try{this.resendOutstanding()}catch(e){this.emit("error",e instanceof Error?e:new Error(String(e)))}}),500),this.hbTimer=(0,o.setInterval)((()=>{try{this.sendHeartbeat()}catch(e){this.emit("error",e instanceof Error?e:new Error(String(e)))}}),1e3)}sendHeartbeat(){if(!this.sock||!this.remote||null==this.clientId||null==this.cameraId)return;const e=this.getKeepAliveTid();let t;var s;t=ee(`<C2D_HB><cid>${(s={cid:this.clientId,did:this.cameraId}).cid}</cid><did>${s.did}</did></C2D_HB>`);const r=j(e,t);this.emit("debug","udp_hb_send",{tid:e,xml:t,host:this.remote.host,port:this.remote.port}),this.sock.send(r,this.remote.port,this.remote.host)}buildAckPayload(){if(0===this.packetsWant)return{packetId:4294967295,payload:Buffer.alloc(0)};let e=this.packetsWant;for(;this.received.has(e);)e++;let t=e-1;for(const e of this.received.keys())e>t&&(t=e);const s=e+200-1;if(t>s&&(t=s),t<e)return{packetId:e-1>>>0,payload:Buffer.alloc(0)};const r=t-e+1,n=Buffer.allocUnsafe(r);for(let t=0;t<r;t++)n[t]=this.received.has(e+t)?1:0;return{packetId:e-1>>>0,payload:n}}updateAckPacket(){if(null==this.cameraId)return;const{packetId:e,payload:t}=this.buildAckPayload();this.lastAckPacket=function(e){const t=e.payload??Buffer.alloc(0),s=Buffer.alloc(28);return s.writeUInt32LE(W,0),s.writeInt32LE(0|e.connectionId,4),s.writeUInt32LE(0,8),s.writeUInt32LE(e.groupId>>>0,12),s.writeUInt32LE(e.packetId>>>0,16),s.writeUInt32LE((e.maybeLatency??0)>>>0,20),s.writeUInt32LE(t.length>>>0,24),Buffer.concat([s,t])}({connectionId:this.cameraId,groupId:4294967295===e&&0===t.length?4294967295:0,packetId:e,maybeLatency:this.ackLatency.getValue(),payload:t})}sendAckFast(){this.sock&&this.remote&&0!==this.lastAckPacket.length&&(this.sock.send(this.lastAckPacket,this.remote.port,this.remote.host),this.ackSentCount++,this.ackSentCount%100==0&&this.emit("debug","ack_sent_100",{latency:this.ackLatency.getValue()}))}scheduleAck(e="data"){if("manual"===e){if(this.ackScheduled)return;this.ackScheduled=!0,setImmediate((()=>{this.ackScheduled=!1;try{this.sendAckFast()}catch(e){this.emit("error",e instanceof Error?e:new Error(String(e)))}})),this.emit("debug","ack_scheduled",{reason:e})}}resendOutstanding(){if(this.sock&&this.remote)for(const[,e]of this.sent)this.sock.send(e.buf,this.remote.port,this.remote.host)}handleAckFromCamera(e,t){if(4294967295!==e){for(const t of this.sent.keys())t<=e&&this.sent.delete(t);for(let s=0;s<t.length;s++){if((t[s]??0)>0){const t=e+1+s>>>0;this.sent.delete(t)}}}this.ackLatency.feed()}scheduleDrain(){this.drainScheduled||(this.drainScheduled=!0,setImmediate((()=>{this.drainScheduled=!1;try{for(;this.pendingDataOffset<this.pendingData.length;this.pendingDataOffset++)this.emit("data",this.pendingData[this.pendingDataOffset])}catch(e){this.emit("error",e instanceof Error?e:new Error(String(e)))}finally{this.pendingDataOffset>=this.pendingData.length&&(this.pendingData=[],this.pendingDataOffset=0)}})))}flushReceived(){for(;this.received.has(this.packetsWant);){const e=this.received.get(this.packetsWant);this.received.delete(this.packetsWant),this.packetsWant++,this.pendingData.push(e)}this.pendingData.length>this.pendingDataOffset&&this.scheduleDrain()}handlePacket(e,t,s){const r=e=>{this.remote&&this.remote.host===t&&this.remote.port===s||(this.remote={host:t,port:s},this.emit("debug","remote_update",{reason:e,host:t,port:s}))};if(this.remote||r("first_packet"),"ack"!==e.kind)if("data"!==e.kind){if("discovery"===e.kind){this.emit("debug","discovery_rx_connected",{tid:e.tid,xml:e.xml});const n=function(e){const t=/<D2C_HB>([\s\S]*?)<\/D2C_HB>/.exec(e);if(!t)return;const s=t[1]??"",r=/<cid>(-?\d+)<\/cid>/.exec(s)?.[1],n=/<did>(-?\d+)<\/did>/.exec(s)?.[1];return null!=r&&null!=n?{cid:Number(r),did:Number(n)}:void 0}(e.xml);if(n&&null!=this.clientId&&null!=this.cameraId&&n.cid===this.clientId&&n.did===this.cameraId){this.emit("debug","discovery_hb_rx_connected",{...n,rhost:t,rport:s});try{r("d2c_hb"),this.sendHeartbeat()}catch(e){this.emit("debug","discovery_hb_reply_error",e)}return}const A=re(e.xml);if(A&&null!=this.clientId&&null!=this.cameraId&&A.cid===this.clientId&&A.did===this.cameraId){try{r("d2c_t"),this.sid=A.sid,this.emit("debug","discovery_t_rx_connected",{sid:A.sid,cid:A.cid,did:A.did,rhost:t,rport:s});const n=Date.now(),i=750;if(null==this.lastAcceptAtMs||n-this.lastAcceptAtMs>=i){const r=te({sid:A.sid,conn:A.conn??"local",cid:A.cid,did:A.did,mtu:this.mtu}),i=j(e.tid,r);this.sock?.send(i,s,t),this.acceptSent=!0,this.lastAcceptAtMs=n,this.emit("debug","discovery_a_send_connected",{sid:A.sid,cid:A.cid,did:A.did,rhost:t,rport:s})}else this.emit("debug","discovery_a_skip_throttle",{sinceMs:n-this.lastAcceptAtMs,throttleMs:i,sid:A.sid,cid:A.cid,did:A.did,rhost:t,rport:s})}catch(e){this.emit("debug","discovery_a_send_connected_error",e)}return}const i=se(e.xml);if(i&&null!=this.clientId&&null!=this.cameraId&&i.cid===this.clientId&&i.did===this.cameraId)return this.sid=i.sid,void this.emit("debug","discovery_cfm_rx_connected",i);const o=function(e){const t=/<D2C_DISC>([\s\S]*?)<\/D2C_DISC>/.exec(e);if(!t)return;const s=t[1]??"",r=/<cid>(-?\d+)<\/cid>/.exec(s)?.[1],n=/<did>(-?\d+)<\/did>/.exec(s)?.[1];return null!=r&&null!=n?{cid:Number(r),did:Number(n)}:void 0}(e.xml);if(o&&null!=this.clientId&&null!=this.cameraId&&o.cid===this.clientId&&o.did===this.cameraId)return this.emit("debug","discovery_disc_rx_connected",{...o,rhost:t,rport:s}),this.emit("error",new Error("BCUDP disconnected by camera (D2C_DISC)")),void this.close()}}else null!=this.clientId&&e.connectionId===this.clientId&&(r("data"),e.packetId>=this.packetsWant&&(this.received.set(e.packetId,e.payload),this.flushReceived(),this.updateAckPacket(),this.packetsWant%100==0&&this.emit("debug","udp_progress",{packetsWant:this.packetsWant})));else null!=this.clientId&&e.connectionId===this.clientId&&(r("ack"),this.handleAckFromCamera(e.packetId,e.payload))}write(e){if(!this.sock||!this.remote||null==this.cameraId)throw new Error("BCUDP stream is not connected");const t=this.mtu-20;for(let s=0;s<e.length;s+=t){const r=e.subarray(s,Math.min(e.length,s+t)),n=this.sendPacketId>>>0;this.sendPacketId=this.sendPacketId+1>>>0;const A=Z({connectionId:this.cameraId,packetId:n,payload:Buffer.from(r)});this.sent.set(n,{packetId:n,buf:A,ts:Date.now()}),this.sock.send(A,this.remote.port,this.remote.host)}}async close(){this.ackTimer&&clearInterval(this.ackTimer),this.resendTimer&&clearInterval(this.resendTimer),this.hbTimer&&clearInterval(this.hbTimer),this.ackTimer=void 0,this.resendTimer=void 0,this.hbTimer=void 0;const e=this.sock;this.sock=void 0,e&&await new Promise((t=>e.close((()=>t()))))}};function ie(e){e.dumpEnabled&&a.mkdirSync(e.dumpDir,{recursive:!0})}function oe(e,t,s,r){e.general&&t.debug(`[${s}] ${r}`)}function ae(e,t,s,r){e.traceStream&&t.debug(`[${s}] ${r}`)}function ce(e,t,s,r){e.traceTalk&&t.debug(`[${s}] ${r}`)}function le(e,t,s,r){e.traceEvents&&t.debug(`[${s}] ${r}`)}function he(e){return 10===e||11===e||201===e||202===e}var ge=class e extends n.EventEmitter{static streamingRegistry=new Map;opts;debugCfg;logger;tcpSocket;udpSocket;transport="tcp";parser=new M;pending=new Map;socketClosed=!1;pendingCloseInfo;lastDisconnectInfo;msgNum=0;loggedIn=!1;subscribed=!1;keepAliveTimer;keepAlivePingInFlight=!1;idleDisconnectTimer;lastUserActivityAtMs;permitSeq=1;permits=new Map;lastRxAtMs;lastTxAtMs;lastRxInfo;lastTxInfo;rxHistory=[];txHistory=[];enc={kind:"none"};nonce;videoSubscriptions=new Map;contributesToGlobalStreamingRegistry=!1;streamTraceStats=new Map;rxCmdTraceStats=new Map;constructor(e){super(),this.opts=e,this.logger=e.logger??console,this.debugCfg=function(e){const t=!0===e?.general,s=!0===e?.debugRtsp,r=!0===e?.traceStream,n=!0===e?.traceTalk,A=!0===e?.traceEvents,i=!0===e?.debugH264,o=!0===e?.debugParamSets,a=!0===e?.dump?.enabled;return{general:t,debugRtsp:s,traceStream:r,traceTalk:n,traceEvents:A,debugH264:i,debugParamSets:o,dumpEnabled:a,dumpDir:e?.dump?.dir&&e.dump.dir.trim()||c.join(process.cwd(),"test","frames-debug"),dumpBcMedia:e?.dump?.bcmedia??a,dumpNals:e?.dump?.nals??a}}(e.debugOptions)}logFixed(e,t){const s=`[BaichuanClient] ${e}`,r=this.logger;"function"!=typeof r.info?"function"!=typeof r.log?"function"==typeof r.warn&&r.warn(s,t):r.log(s,t):r.info(s,t)}getIdleDisconnectTimeoutMs(){const e=this.opts.idleDisconnectTimeoutMs;return"number"==typeof e&&Number.isFinite(e)&&e>0?e:3e4}isIdleDisconnectEnabled(){return!0===this.opts.idleDisconnect}clearIdleDisconnectTimer(){this.idleDisconnectTimer&&(clearTimeout(this.idleDisconnectTimer),this.idleDisconnectTimer=void 0)}touchUserActivity(e){this.lastUserActivityAtMs=Date.now(),this.logDebug("user_activity",{reason:e,atMs:this.lastUserActivityAtMs})}isIdleDisconnectEligibleNow(){return!!this.isIdleDisconnectEnabled()&&(!!this.isSocketConnected()&&(!(this.pending.size>0)&&(!this.hasActiveVideoSubscriptionsInternal()&&!(this.permits.size>0))))}kickIdleDisconnectTimer(){if(!this.isIdleDisconnectEnabled())return;if(this.clearIdleDisconnectTimer(),!this.isIdleDisconnectEligibleNow())return;if(null==this.lastUserActivityAtMs)return;const e=this.getIdleDisconnectTimeoutMs(),t=Date.now()-this.lastUserActivityAtMs,s=Math.max(0,e-t);this.idleDisconnectTimer=setTimeout((()=>{try{if(!this.isIdleDisconnectEligibleNow())return;if(null==this.lastUserActivityAtMs)return;const t=Date.now()-this.lastUserActivityAtMs;if(t<e)return void this.kickIdleDisconnectTimer();this.logDebug("idle_disconnect",{elapsedMs:t,timeoutMs:e,transport:this.transport}),this.logFixed("idle_disconnect",{elapsedMs:t,timeoutMs:e,transport:this.transport,host:this.opts.host}),this.close({reason:"idle_disconnect"})}catch(e){this.logDebug("idle_disconnect_error",e)}}),s),this.idleDisconnectTimer.unref?.()}getLastDisconnectInfo(){return this.lastDisconnectInfo}acquirePermit(e=this.getIdleDisconnectTimeoutMs(),t){const s=Math.max(0,Math.floor(e)),r=this.permitSeq++,n=Date.now()+s;let A;return s>0&&(A=setTimeout((()=>this.releasePermit(r,"timeout")),s),A.unref?.()),this.permits.set(r,{timer:A,untilMs:n,reason:t}),this.logDebug("permit_acquired",{id:r,holdMs:s,untilMs:n,reason:t,permits:this.permits.size}),this.clearIdleDisconnectTimer(),()=>this.releasePermit(r,"manual")}releasePermit(e,t){const s=this.permits.get(e);s&&(s.timer&&clearTimeout(s.timer),this.permits.delete(e),this.logDebug("permit_released",{id:e,how:t,permits:this.permits.size}),this.kickIdleDisconnectTimer())}getDeviceRegistryKey(){const e=(this.opts.uid??"").trim().toUpperCase();return`${(this.opts.host??"").trim()}|${e}|${this.opts.channel??0}`}recomputeGlobalStreamingContribution(){const t=this.hasActiveVideoSubscriptionsInternal();if(t===this.contributesToGlobalStreamingRegistry)return;const s=this.getDeviceRegistryKey(),r=e.streamingRegistry.get(s)??{activeStreamClients:0},n=Math.max(0,r.activeStreamClients+(t?1:-1));0===n?e.streamingRegistry.delete(s):e.streamingRegistry.set(s,{activeStreamClients:n}),this.contributesToGlobalStreamingRegistry=t}isDeviceStreamingActive(){if(this.hasActiveVideoSubscriptionsInternal())return!0;const t=this.getDeviceRegistryKey(),s=e.streamingRegistry.get(t);return(s?.activeStreamClients??0)>0}logDebug(e,t){this.debugCfg.general&&(this.logger.debug(`[BaichuanClient] ${e}`,t),this.emit("debug",e,t))}getTransport(){return this.transport}getConfiguredChannel(){return this.opts.channel??0}refreshKeepAlive(){this.stopKeepAlive(),this.isSocketConnected()&&this.startKeepAlive()}getLastRxAtMs(){return this.lastRxAtMs}getLastRxInfo(){return this.lastRxInfo}getRxHistory(){return this.rxHistory}getLastTxAtMs(){return this.lastTxAtMs}getLastTxInfo(){return this.lastTxInfo}getTxHistory(){return this.txHistory}recordTx(e){const t=Date.now();this.lastTxAtMs=t,this.lastTxInfo={atMs:t,...e},this.txHistory.push(this.lastTxInfo),this.txHistory.length>32&&this.txHistory.shift()}isProbablySleeping(e=15e3){return"udp"===this.transport&&(this.isIdleDisconnectEnabled()?!this.isSocketConnected():!this.isSocketConnected()||!this.isDeviceStreamingActive()&&(null!=this.lastRxAtMs&&Date.now()-this.lastRxAtMs>=e))}getDebugConfig(){return this.debugCfg}isSocketConnected(){return"tcp"===this.transport?void 0!==this.tcpSocket&&!this.tcpSocket.destroyed:"udp"===this.transport&&(void 0!==this.udpSocket&&(this.udpSocket.isConnected?.()??!0))}get username(){return this.opts.username}startKeepAlive(){if(this.keepAliveTimer)return;let e=3e4;if("udp"===this.transport){if(!this.shouldSendUdpKeepAlive())return;e=2500}e<=0||(this.keepAliveTimer=setInterval((()=>{if("udp"!==this.transport)this.keepAlivePingInFlight||(this.keepAlivePingInFlight=!0,(async()=>{try{await this.sendPing()}catch(e){this.logDebug("keepalive_ping_error",e)}finally{this.keepAlivePingInFlight=!1}})());else try{this.sendUdpKeepAlive()}catch(e){this.logDebug("udp_keepalive_ping_error",e)}}),e),this.keepAliveTimer.unref?.())}hasActiveVideoSubscriptionsInternal(){for(const e of this.videoSubscriptions.values())if(e.size>0)return!0;return!1}hasActiveVideoSubscriptions(){return this.hasActiveVideoSubscriptionsInternal()}shouldSendUdpKeepAlive(){return"udp"===this.transport&&(!!this.udpSocket&&(!!this.loggedIn&&!!this.hasActiveVideoSubscriptionsInternal()))}sendUdpKeepAlive(){if("udp"!==this.transport)return;if(!this.udpSocket)return;if(!this.loggedIn)return;const e=this.nextMsgNum(),t=T({cmdId:w,bodyLen:0,channelId:0,streamType:0,msgNum:e,responseCode:0,messageClass:p,payloadOffset:0});this.logDebug("udp_keepalive_ping_tx",{msgNum:e,channelId:0,streamType:0}),this.recordTx({cmdId:w,responseCode:0,msgNum:e,channelId:0,streamType:0}),this.writeWire(t)}stopKeepAlive(){this.keepAliveTimer&&(clearInterval(this.keepAliveTimer),this.keepAliveTimer=void 0),this.keepAlivePingInFlight=!1}async sendPing(){if((this.tcpSocket||this.udpSocket)&&this.loggedIn)try{await this.sendFrame({cmdId:93,channel:this.opts.channel??0,channelIdOverride:0,messageClass:p,streamType:0,extensionXml:"",internal:!0})}catch(e){this.logDebug("keepalive_ping_failed",e)}}async connect(){const e=this.opts.transport??"tcp";if("tcp"!==e)if("udp"!==e)try{await Promise.race([this.connectTcp(),new Promise(((e,t)=>setTimeout((()=>t(new Error("TCP connection timeout (falling back to UDP)"))),4e3)))])}catch(e){if(this.logDebug("auto:tcp_failed",e),!this.opts.uid)throw new Error("TCP connection failed and UDP fallback requires `options.uid` (BCUDP discovery UID).");await this.connectUdp()}else await this.connectUdp();else await this.connectTcp()}async connectTcp(){if(this.tcpSocket&&!this.tcpSocket.destroyed)return void(this.transport="tcp");const e=this.opts.port??E,t=A.createConnection({host:this.opts.host,port:e});this.tcpSocket=t,this.transport="tcp",this.socketClosed=!1;try{t.setKeepAlive(!0,3e4)}catch(e){this.logDebug("tcp_setKeepAlive_failed",e)}t.on("data",(e=>{const t=this.parser.push(e);for(const e of t)this.handleFrame(e)})),t.on("close",(()=>{this.stopKeepAlive(),this.socketClosed=!0;const e=this.pendingCloseInfo;this.pendingCloseInfo=void 0,this.lastDisconnectInfo={atMs:Date.now(),transport:"tcp",voluntary:null!=e,reason:e?.reason??"socket_closed"},this.logFixed("disconnected",JSON.stringify({transport:"tcp",host:this.opts.host,port:this.opts.port??E,lastRx:this.lastRxInfo?.cmdId,lastTx:this.lastTxInfo?.cmdId})),this.emit("close");const t=Array.from(this.pending.entries());this.pending.clear();for(const[,e]of t)setImmediate((()=>{try{e.reject(new Error("Baichuan socket closed"))}catch(e){}}))})),t.on("error",(e=>this.emit("error",e))),await new Promise(((e,s)=>{t.once("connect",(()=>e())),t.once("error",(e=>s(e)))})),this.logFixed("connected",{transport:"tcp",host:this.opts.host,port:this.opts.port??E}),this.startKeepAlive(),this.kickIdleDisconnectTimer()}async connectUdp(){if(this.udpSocket){if(this.udpSocket.isConnected?.())return void(this.transport="udp");try{await this.udpSocket.close()}catch{}this.udpSocket=void 0}if(!this.opts.uid)throw new Error("Baichuan UDP requested but `options.uid` is not set (required for BCUDP discovery).");const e=new Ae({mode:"uid",uid:this.opts.uid});this.udpSocket=e,this.transport="udp",this.socketClosed=!1,e.on("data",(e=>{const t=this.parser.push(e);for(const e of t)this.handleFrame(e)})),e.on("close",(()=>{this.stopKeepAlive(),this.socketClosed=!0;const t=this.pendingCloseInfo;this.pendingCloseInfo=void 0,this.lastDisconnectInfo={atMs:Date.now(),transport:"udp",voluntary:null!=t,reason:t?.reason??"socket_closed"},this.logFixed("disconnected",{transport:"udp",host:this.opts.host,uid:this.opts.uid,lastRx:this.lastRxInfo,lastTx:this.lastTxInfo}),this.loggedIn=!1,this.subscribed=!1,this.contributesToGlobalStreamingRegistry&&(this.videoSubscriptions.clear(),this.recomputeGlobalStreamingContribution()),this.udpSocket===e&&(this.udpSocket=void 0),this.emit("close");const s=Array.from(this.pending.entries());this.pending.clear();for(const[,e]of s)setImmediate((()=>{try{e.reject(new Error("Baichuan UDP stream closed"))}catch(e){}}))})),e.on("error",(e=>{e?.message?.includes("D2C_DISC")&&(this.stopKeepAlive(),this.loggedIn=!1,this.subscribed=!1,this.contributesToGlobalStreamingRegistry&&(this.videoSubscriptions.clear(),this.recomputeGlobalStreamingContribution())),this.emit("error",e)})),e.on("debug",((e,t)=>{this.logDebug(`udp_${e}`,t)})),await e.connect(),this.logFixed("connected",{transport:"udp",host:this.opts.host,uid:this.opts.uid}),this.startKeepAlive(),this.kickIdleDisconnectTimer()}async close(e){Boolean(this.tcpSocket&&!this.tcpSocket.destroyed||this.udpSocket)&&(this.pendingCloseInfo={atMs:Date.now(),reason:(e?.reason??"manual_close").trim()||"manual_close"}),this.stopKeepAlive(),this.clearIdleDisconnectTimer();for(const e of Array.from(this.permits.keys()))this.releasePermit(e,"close");this.contributesToGlobalStreamingRegistry&&(this.videoSubscriptions.clear(),this.recomputeGlobalStreamingContribution());const t=this.tcpSocket;this.tcpSocket=void 0,t&&await new Promise((e=>{t.once("close",(()=>e())),t.destroy()}));const s=this.udpSocket;this.udpSocket=void 0,s&&await s.close()}handleFrame(e){const t=Date.now();if(this.lastRxAtMs=t,this.lastRxInfo={atMs:t,cmdId:e.header.cmdId,responseCode:e.header.responseCode,msgNum:e.header.msgNum,channelId:e.header.channelId,streamType:e.header.streamType},this.rxHistory.push(this.lastRxInfo),this.rxHistory.length>32&&this.rxHistory.shift(),this.debugCfg.general)if(3===e.header.cmdId){const s=this.rxCmdTraceStats.get(3)??{lastLogMs:t,frames:0};s.frames++,t-s.lastLogMs>=1e3&&(oe(this.debugCfg,this.logger,"BaichuanRx",`rx cmdId=3 frames=${s.frames} lastMsgNum=${e.header.msgNum} lastResponseCode=${e.header.responseCode} lastChannelId=${e.header.channelId} lastStreamType=${e.header.streamType} lastBodyLen=${e.body.length} lastPayloadLen=${e.payload.length}`),s.lastLogMs=t,s.frames=0),this.rxCmdTraceStats.set(3,s)}else oe(this.debugCfg,this.logger,"BaichuanRx",`rx cmdId=${e.header.cmdId} msgNum=${e.header.msgNum} responseCode=${e.header.responseCode} channelId=${e.header.channelId} streamType=${e.header.streamType} bodyLen=${e.body.length} payloadLen=${e.payload.length} payloadOffset=${e.header.payloadOffset??0}`);if("udp"===this.transport&&e.header.cmdId===w){try{const t=T({cmdId:e.header.cmdId,bodyLen:0,channelId:e.header.channelId,streamType:e.header.streamType,msgNum:e.header.msgNum,responseCode:200,messageClass:e.header.messageClass,payloadOffset:0});this.logDebug("udp_keepalive_rx",{msgNum:e.header.msgNum,channelId:e.header.channelId,streamType:e.header.streamType,responseCode:e.header.responseCode}),this.recordTx({cmdId:e.header.cmdId,responseCode:200,msgNum:e.header.msgNum,channelId:e.header.channelId,streamType:e.header.streamType}),this.writeWire(t),this.logDebug("udp_keepalive_tx",{msgNum:e.header.msgNum,channelId:e.header.channelId,streamType:e.header.streamType})}catch(e){this.logDebug("udp_keepalive_error",e)}return}this.debugCfg.traceTalk&&he(e.header.cmdId)&&ce(this.debugCfg,this.logger,"BaichuanTalk",`rx cmdId=${e.header.cmdId} msgNum=${e.header.msgNum} responseCode=${e.header.responseCode} channelId=${e.header.channelId} bodyLen=${e.body.length} payloadLen=${e.payload.length} payloadOffset=${e.header.payloadOffset??0}`),this.emit("frame",e);const s=`${e.header.cmdId}:${e.header.msgNum}`,r=this.pending.get(s);if(r)return this.pending.delete(s),void r.resolve(e);const n=this.videoSubscriptions.get(e.header.cmdId);if(n&&n.size>0){if(n.has(e.header.msgNum)){if(this.debugCfg.traceStream&&3===e.header.cmdId){const t=Date.now(),s=e.header.msgNum,r=this.streamTraceStats.get(s)??{lastLogMs:t,frames:0};r.frames++,t-r.lastLogMs>=500&&(ae(this.debugCfg,this.logger,"BaichuanTrace",`rx stream frames cmdId=3 msgNum=${e.header.msgNum} frames=${r.frames} lastChannelId=${e.header.channelId} lastBodyLen=${e.body.length} lastPayloadLen=${e.payload.length} lastPayloadOffset=${e.header.payloadOffset??0}`),r.lastLogMs=t,r.frames=0),this.streamTraceStats.set(s,r)}this.emit("push",e)}}else if(this.emit("push",e),33===e.header.cmdId)try{const t=this.parseEvents(e);for(const s of t)le(this.debugCfg,this.logger,"BaichuanEvent",`dispatch cmdId=33 msgNum=${e.header.msgNum} channelId=${e.header.channelId} type=${s.type} eventChannel=${s.channel}`+("ai"===s.type?` aiType=${s.ai?.type??"unknown"} detected=${s.ai?.detected??""}`:"")+("motion"===s.type?` source=${s.motion?.source??""}`:"")),this.emit("event",s)}catch(e){this.logDebug("event_parse_error",e)}}subscribeVideoStream(e,t){this.videoSubscriptions.has(e)||this.videoSubscriptions.set(e,new Set),this.videoSubscriptions.get(e).add(t),3!==e||this.streamTraceStats.has(t)||this.streamTraceStats.set(t,{lastLogMs:Date.now(),frames:0}),"udp"===this.transport&&this.refreshKeepAlive(),this.recomputeGlobalStreamingContribution(),this.kickIdleDisconnectTimer()}unsubscribeVideoStream(e,t){const s=this.videoSubscriptions.get(e);s&&(void 0!==t?(s.delete(t),0===s.size&&this.videoSubscriptions.delete(e),3===e&&this.streamTraceStats.delete(t)):(this.videoSubscriptions.delete(e),3===e&&this.streamTraceStats.clear()),"udp"===this.transport&&this.refreshKeepAlive(),this.recomputeGlobalStreamingContribution(),this.kickIdleDisconnectTimer())}parseEvents(e){const t=e.body;if(0===t.length)return[];const s=this.tryDecryptXml(t,e.header.channelId,this.enc);if(!s||!s.startsWith("<?xml"))return[];if(this.debugCfg.traceEvents){const t=s.length>500?`${s.slice(0,500)}...`:s;le(this.debugCfg,this.logger,"BaichuanEventRaw",`rx cmdId=${e.header.cmdId} msgNum=${e.header.msgNum} responseCode=${e.header.responseCode} channelId=${e.header.channelId} xml=${JSON.stringify(t)}`)}const r=e.header.channelId,n=250===r?0:Math.max(0,r-1),A=Date.now();if(s.includes("<AlarmEventList")){const e=[],t=s.matchAll(/<AlarmEvent\b[^>]*>([\s\S]*?)<\/AlarmEvent>/g);for(const s of t){const t=s[1]??"",r=P(t,"channelId"),i=void 0!==r?Number(r):n,o=(P(t,"status")??"").trim(),a=o.toUpperCase(),c=(P(t,"AItype")??P(t,"aiType")??P(t,"aitype")??"").trim();this.debugCfg.traceEvents&&le(this.debugCfg,this.logger,"BaichuanEventRaw",`AlarmEvent channel=${i} status=${JSON.stringify(o)} aiType=${JSON.stringify(c)}`);const l=o.toLowerCase(),h=l.length>0&&"none"!==l,g=c.trim().length>0&&"none"!==c.trim().toLowerCase();if(h||g){const t=a.includes("MD")?"md":a.includes("PIR")||a.includes("OTHER")?"pir":"unknown";e.push({channel:i,type:"motion",motion:{channel:i,state:!0,timestamp:A,source:t},timestamp:A})}const d=c?c.split(",").map((e=>e.trim())).find((e=>e.length>0&&"none"!==e.toLowerCase())):void 0;if(d){const t=d.toLowerCase(),s={people:"people",person:"people",human:"people",vehicle:"vehicle",car:"vehicle",dog_cat:"dog_cat",dog:"dog_cat",cat:"dog_cat",pet:"dog_cat",face:"face",package:"package"};e.push({channel:i,type:"ai",ai:{channel:i,type:s[t]??"other",detected:!0,timestamp:A},timestamp:A})}else a.includes("AI")&&e.push({channel:i,type:"ai",ai:{channel:i,type:"other",detected:!0,timestamp:A},timestamp:A});a.includes("VIS")&&e.push({channel:i,type:"visitor",timestamp:A}),a.includes("DN")&&e.push({channel:i,type:"daynight",timestamp:A})}return e}const i=s.match(/<Event\b[^>]*>([\s\S]*?)<\/Event>/);if(!i)return[];const o=i[1]??"",a=(P(o,"status")??"").trim(),c=a.toUpperCase(),l=(P(o,"AItype")??P(o,"aiType")??P(o,"aitype")??"").trim(),h=[],g=a.toLowerCase(),d=g.length>0&&"none"!==g,u=l.trim().length>0&&"none"!==l.trim().toLowerCase();if(d||u){const e=c.includes("MD")?"md":c.includes("PIR")||c.includes("OTHER")?"pir":"unknown";h.push({channel:n,type:"motion",motion:{channel:n,state:!0,timestamp:A,source:e},timestamp:A})}const E=l?l.split(",").map((e=>e.trim())).find((e=>e.length>0&&"none"!==e.toLowerCase())):void 0;if(E){const e=E.toLowerCase(),t={people:"people",person:"people",human:"people",vehicle:"vehicle",car:"vehicle",dog_cat:"dog_cat",dog:"dog_cat",cat:"dog_cat",pet:"dog_cat",face:"face",package:"package"};h.push({channel:n,type:"ai",ai:{channel:n,type:t[e]??"other",detected:!0,timestamp:A},timestamp:A})}else c.includes("AI")&&h.push({channel:n,type:"ai",ai:{channel:n,type:"other",detected:!0,timestamp:A},timestamp:A});return c.includes("VIS")&&h.push({channel:n,type:"visitor",timestamp:A}),c.includes("DN")&&h.push({channel:n,type:"daynight",timestamp:A}),h}nextMsgNum(){return this.msgNum=this.msgNum+1&65535,this.msgNum}peekNextMsgNum(){return this.msgNum+1&65535}requireSocket(){if("tcp"!==this.transport)throw new Error("Internal: requireSocket called while not using TCP");if(!this.tcpSocket||this.tcpSocket.destroyed)throw new Error("Baichuan TCP socket is not connected");return this.tcpSocket}writeWire(e){if(this.lastTxAtMs=Date.now(),"tcp"!==this.transport){if(!this.udpSocket)throw new Error("Baichuan UDP stream is not connected");this.udpSocket.write(e)}else this.requireSocket().write(e)}encodeBodyXml(e,t,s,r){const n=Buffer.from(e,"utf8"),A=Buffer.from(t,"utf8");return"none"===r.kind?Buffer.concat([n,A]):"bc"===r.kind?Buffer.concat([v(n,s),v(A,s)]):"aes"===r.kind||"full_aes"===r.kind?Buffer.concat([R(n,r.key),R(A,r.key)]):Buffer.concat([n,A])}encodeBodyBinary(e,t,s,r){const n=Buffer.from(e,"utf8");return"none"===r.kind?Buffer.concat([n,t]):"bc"===r.kind?Buffer.concat([v(n,s),t]):"aes"===r.kind||"full_aes"===r.kind?Buffer.concat([R(n,r.key),t]):Buffer.concat([n,t])}async sendBinaryPayloadNoReply(e){const t=!0===e.internal;t||this.touchUserActivity(`sendBinaryPayloadNoReply cmdId=${e.cmdId}`),await this.connect(),t||this.kickIdleDisconnectTimer();const s=e.channel??this.opts.channel??0,r=e.channelIdOverride??(null==e.channel?250:s+1),n=this.nextMsgNum(),A=e.cmdId,i=e.extensionXml??H(s),o=Buffer.byteLength(i,"utf8"),a=o+e.payload.length,c=e.messageClass??p,l=T({cmdId:A,bodyLen:a,channelId:r,streamType:e.streamType??0,msgNum:n,responseCode:0,messageClass:c,payloadOffset:o}),h=e.encryption??this.enc,g=this.encodeBodyBinary(i,e.payload,r,h),d=Buffer.concat([l,g]);this.logDebug("tx",{cmdId:A,msgNum:n,channelId:r,messageClass:c,bodyLen:a,binaryPayload:!0}),this.debugCfg.traceTalk&&he(A)&&ce(this.debugCfg,this.logger,"BaichuanTalk",`tx cmdId=${A} msgNum=${n} channelId=${r} streamType=${e.streamType??0} class=0x${c.toString(16)} bodyLen=${a} payloadOffset=${o} binaryPayloadLen=${e.payload.length}`),this.recordTx({cmdId:A,responseCode:0,msgNum:n,channelId:r,streamType:e.streamType??0}),this.writeWire(d),t||this.kickIdleDisconnectTimer()}tryDecryptXml(e,t,s){const r=e=>e.toString("utf8"),n=s=>{let n;try{n="none"===s.kind?e:"bc"===s.kind?N(e,t):k(e,s.key)}catch{return}const A=r(n);return A.startsWith("<?xml")?A:void 0};return n(s)??("bc"!==s.kind?n({kind:"bc"}):void 0)??n({kind:"none"})??r(e)}async sendXml(e){const t=!0===e.internal;t||this.touchUserActivity(`sendXml cmdId=${e.cmdId}`),await this.connect(),t||this.kickIdleDisconnectTimer();const s=e.channel??this.opts.channel??0,r=e.channelIdOverride??(null==e.channel?250:s+1),n=this.nextMsgNum(),A=e.cmdId,i=e.extensionXml??(null!=e.channel?L(s):""),o=e.payloadXml??"",a=e.messageClass??p,c=Buffer.byteLength(i,"utf8"),l=c+Buffer.byteLength(o,"utf8"),h=T({cmdId:A,bodyLen:l,channelId:r,streamType:e.streamType??0,msgNum:n,responseCode:0,messageClass:a,payloadOffset:c}),g=`${A}:${n}`,d=e.encryption??this.enc,u=this.encodeBodyXml(i,o,r,d),E=Buffer.concat([h,u]),I=e.timeoutMs??1e4;let C;const B=new Promise(((e,t)=>{C=t;const s=setTimeout((()=>{this.pending.delete(g),t(new Error(`Baichuan timeout cmdId=${A} msgNum=${n}`))}),I);this.pending.set(g,{resolve:t=>{clearTimeout(s),e(t)},reject:e=>{clearTimeout(s),t(e)}})}));B.catch((()=>{})),this.logDebug("tx",{cmdId:A,msgNum:n,channelId:r,messageClass:a,bodyLen:l}),!this.debugCfg.traceStream||3!==A&&4!==A||ae(this.debugCfg,this.logger,"BaichuanTrace",`tx cmdId=${A} msgNum=${n} channelId=${r} streamType=${e.streamType??0} class=0x${a.toString(16)} bodyLen=${l} payloadOffset=${c}`),this.debugCfg.traceTalk&&he(A)&&ce(this.debugCfg,this.logger,"BaichuanTalk",`tx cmdId=${A} msgNum=${n} channelId=${r} streamType=${e.streamType??0} class=0x${a.toString(16)} bodyLen=${l} payloadOffset=${c}`),this.recordTx({cmdId:A,responseCode:0,msgNum:n,channelId:r,streamType:e.streamType??0}),this.writeWire(E);const Q=await B;if(this.logDebug("rx",{cmdId:Q.header.cmdId,responseCode:Q.header.responseCode,msgNum:Q.header.msgNum}),!this.debugCfg.traceStream||3!==A&&4!==A||ae(this.debugCfg,this.logger,"BaichuanTrace",`rx cmdId=${Q.header.cmdId} msgNum=${Q.header.msgNum} responseCode=${Q.header.responseCode} channelId=${Q.header.channelId} bodyLen=${Q.body.length} payloadLen=${Q.payload.length} payloadOffset=${Q.header.payloadOffset??0}`),this.debugCfg.traceTalk&&he(A)&&ce(this.debugCfg,this.logger,"BaichuanTalk",`rx cmdId=${Q.header.cmdId} msgNum=${Q.header.msgNum} responseCode=${Q.header.responseCode} channelId=${Q.header.channelId} bodyLen=${Q.body.length} payloadLen=${Q.payload.length} payloadOffset=${Q.header.payloadOffset??0}`),400===Q.header.responseCode){if(0===Q.body.length)throw new Error("Baichuan authentication failed (responseCode 400, empty body) - check username/password")}const f=Q.body;if(0===f.length)return t||this.kickIdleDisconnectTimer(),"";const m=this.tryDecryptXml(f,Q.header.channelId,d);return t||this.kickIdleDisconnectTimer(),m}async sendFrame(e){const t=!0===e.internal;t||this.touchUserActivity(`sendFrame cmdId=${e.cmdId}`),await this.connect(),t||this.kickIdleDisconnectTimer();const s=e.channel??this.opts.channel??0,r=e.channelIdOverride??(null==e.channel?250:s+1),n=e.msgNumOverride??this.nextMsgNum(),A=e.cmdId,i=e.extensionXml??(null!=e.channel?L(s):""),o=e.payloadXml??"",a=e.messageClass??p,c=Buffer.byteLength(i,"utf8"),l=c+Buffer.byteLength(o,"utf8"),h=T({cmdId:A,bodyLen:l,channelId:r,streamType:e.streamType??0,msgNum:n,responseCode:0,messageClass:a,payloadOffset:c}),g=`${A}:${n}`,d=e.encryption??this.enc,u=this.encodeBodyXml(i,o,r,d),E=Buffer.concat([h,u]),I=e.timeoutMs??1e4;let C;const B=new Promise(((e,t)=>{C=t;const s=setTimeout((()=>{this.pending.delete(g),t(new Error(`Baichuan timeout cmdId=${A} msgNum=${n}`))}),I);this.pending.set(g,{resolve:t=>{clearTimeout(s),e(t)},reject:e=>{clearTimeout(s),t(e)}})}));B.catch((()=>{})),this.logDebug("tx",{cmdId:A,msgNum:n,channelId:r,messageClass:a,bodyLen:l}),!this.debugCfg.traceStream||3!==A&&4!==A||ae(this.debugCfg,this.logger,"BaichuanTrace",`tx cmdId=${A} msgNum=${n} channelId=${r} streamType=${e.streamType??0} class=0x${a.toString(16)} bodyLen=${l} payloadOffset=${c}`),this.debugCfg.traceTalk&&he(A)&&ce(this.debugCfg,this.logger,"BaichuanTalk",`tx cmdId=${A} msgNum=${n} channelId=${r} streamType=${e.streamType??0} class=0x${a.toString(16)} bodyLen=${l} payloadOffset=${c}`),this.recordTx({cmdId:A,responseCode:0,msgNum:n,channelId:r,streamType:e.streamType??0}),this.writeWire(E);const Q=await B;return this.logDebug("rx",{cmdId:Q.header.cmdId,responseCode:Q.header.responseCode,msgNum:Q.header.msgNum}),!this.debugCfg.traceStream||3!==A&&4!==A||ae(this.debugCfg,this.logger,"BaichuanTrace",`rx cmdId=${Q.header.cmdId} msgNum=${Q.header.msgNum} responseCode=${Q.header.responseCode} channelId=${Q.header.channelId} bodyLen=${Q.body.length} payloadLen=${Q.payload.length} payloadOffset=${Q.header.payloadOffset??0}`),this.debugCfg.traceTalk&&he(A)&&ce(this.debugCfg,this.logger,"BaichuanTalk",`rx cmdId=${Q.header.cmdId} msgNum=${Q.header.msgNum} responseCode=${Q.header.responseCode} channelId=${Q.header.channelId} bodyLen=${Q.body.length} payloadLen=${Q.payload.length} payloadOffset=${Q.header.payloadOffset??0}`),t||this.kickIdleDisconnectTimer(),Q}async sendBinary(e){const t=!0===e.internal;if(t||this.touchUserActivity(`sendBinary cmdId=${e.cmdId}`),109===e.cmdId){const s=await this.sendBinarySnapshot109(e);return t||this.kickIdleDisconnectTimer(),s}if((e.messageClass??p)===f){const s=await this.sendBinaryFileDownload6482(e);return t||this.kickIdleDisconnectTimer(),s}await this.connect(),t||this.kickIdleDisconnectTimer();const s=e.channel??this.opts.channel??0,r=e.channelIdOverride??(null==e.channel?250:s+1),n=this.nextMsgNum(),A=e.cmdId,i=e.extensionXml??(null!=e.channel?H(s):H(void 0)),o=e.payloadXml??"",a=e.messageClass??p,c=Buffer.byteLength(i,"utf8"),l=c+Buffer.byteLength(o,"utf8"),h=T({cmdId:A,bodyLen:l,channelId:r,streamType:0,msgNum:n,responseCode:0,messageClass:a,payloadOffset:c}),g=`${A}:${n}`,d=e.encryption??this.enc,u=this.encodeBodyXml(i,o,r,d),E=Buffer.concat([h,u]),I=e.timeoutMs??1e4;let C;const B=new Promise(((e,t)=>{C=t;const s=setTimeout((()=>{this.pending.delete(g),t(new Error(`Baichuan timeout cmdId=${A} msgNum=${n}`))}),I);this.pending.set(g,{resolve:t=>{clearTimeout(s),e(t)},reject:e=>{clearTimeout(s),t(e)}})}));B.catch((()=>{})),this.logDebug("tx",{cmdId:A,msgNum:n,channelId:r,messageClass:a,bodyLen:l,binary:!0}),this.recordTx({cmdId:A,responseCode:0,msgNum:n,channelId:r,streamType:0}),this.writeWire(E);const Q=await B;if(this.logDebug("rx",{cmdId:Q.header.cmdId,responseCode:Q.header.responseCode,msgNum:Q.header.msgNum,binary:!0}),400===Q.header.responseCode){if(0===Q.body.length)throw new Error("Baichuan binary request failed (responseCode 400, empty body)")}const m=Q.payload;if(0===m.length)return Buffer.alloc(0);const y=this.tryDecryptBinary(m,Q.header.channelId,d);return t||this.kickIdleDisconnectTimer(),y}async sendBinaryFileDownload6482(e){await this.connect();const t=e.channel??this.opts.channel??0,s=e.channelIdOverride??(null==e.channel?250:t+1),r=this.nextMsgNum(),n=e.cmdId,A=e.extensionXml??H(t),i=e.payloadXml??"",o=e.messageClass??f,a=Buffer.byteLength(A,"utf8"),c=a+Buffer.byteLength(i,"utf8"),l=T({cmdId:n,bodyLen:c,channelId:s,streamType:e.streamType??0,msgNum:r,responseCode:0,messageClass:o,payloadOffset:a}),h=e.encryption??this.enc,g=this.encodeBodyXml(A,i,s,h),d=Buffer.concat([l,g]),u=e.timeoutMs??6e4,E=[];let I=0,C=0;return await new Promise(((t,A)=>{let i,a=!1;const l=()=>{this.off("frame",B),i&&clearTimeout(i)},g=e=>{a||(a=!0,l(),A(e instanceof Error?e:new Error(String(e))))},B=e=>{var s;if(e.header.cmdId===n)if(e.header.msgNum===r&&e.header.responseCode>=400)g(new Error(`Baichuan file download request rejected (cmdId=${n} msgNum=${r} responseCode=${e.header.responseCode})`));else try{let A=!1;if(e.extension.length>0)try{this.tryDecryptXml(e.extension,e.header.channelId,h).includes("<binaryData>1</binaryData>")&&(A=!0)}catch{}const i=this.tryDecryptBinary(e.payload,e.header.channelId,h);if(0===i.length)return;if(!A&&(e=>{let t=0;for(;t<e.length&&(0===e[t]||9===e[t]||10===e[t]||13===e[t]||32===e[t]);)t++;return!(t>=e.length)&&60===e[t]})(i))return;E.push(i),I+=i.length;const o=Date.now();this.debugCfg.general&&o-C>=2e3&&(C=o,this.logDebug("file_download_progress",{cmdId:n,msgNum:r,bytes:I})),201===e.header.responseCode&&(s=Buffer.concat(E),a||(a=!0,l(),t(s)))}catch(e){g(e)}};i=setTimeout((()=>{g(new Error(`Baichuan timeout waiting file download chunks cmdId=${n} msgNum=${r}`))}),u),this.on("frame",B);try{this.logDebug("tx",{cmdId:n,msgNum:r,channelId:s,messageClass:o,bodyLen:c,binary:!0,fileDownload:!0}),this.recordTx({cmdId:n,responseCode:0,msgNum:r,channelId:s,streamType:e.streamType??0}),this.writeWire(d)}catch(e){g(e)}}))}async sendBinarySnapshot109(e){await this.connect();const t=e.channel??this.opts.channel??0,s=e.channelIdOverride??(null==e.channel?250:t+1),r=this.nextMsgNum(),n=e.cmdId,A=e.extensionXml??(null!=e.channel?L(t):""),i=e.payloadXml??"",o=e.messageClass??p,a=Buffer.byteLength(A,"utf8"),c=a+Buffer.byteLength(i,"utf8"),l=T({cmdId:n,bodyLen:c,channelId:s,streamType:e.streamType??0,msgNum:r,responseCode:0,messageClass:o,payloadOffset:a}),h=e.encryption??this.enc,g=this.encodeBodyXml(A,i,s,h),d=Buffer.concat([l,g]),u=e.timeoutMs??15e3,E=[];let I=!1;return await new Promise(((t,A)=>{let i,a=!1;const l=()=>{this.off("frame",B),i&&clearTimeout(i)},g=e=>{a||(a=!0,l(),t(e))},C=e=>{a||(a=!0,l(),A(e instanceof Error?e:new Error(String(e))))},B=e=>{if(e.header.cmdId===n)if(e.header.msgNum===r&&e.header.responseCode>=400)C(new Error(`Baichuan snapshot request rejected (cmdId=${n} msgNum=${r} responseCode=${e.header.responseCode})`));else try{let t=!1;if(e.extension.length>0){this.tryDecryptXml(e.extension,e.header.channelId,h).includes("<binaryData>1</binaryData>")&&(t=!0)}const s=this.tryDecryptBinary(e.payload,e.header.channelId,h);if(0===s.length)return;const r=s.subarray(0,Math.min(16,s.length)).toString("utf8"),n=r.startsWith("<?xml")||r.trimStart().startsWith("<");if(!t&&n)return;let A=s;if(!I){const r=(e=>{for(let t=0;t+1<e.length;t++)if(255===e[t]&&216===e[t+1])return t;return-1})(s);if(-1===r){if(!t)return;A=s,E.push(A);const r=Buffer.concat(E);return void(201===e.header.responseCode&&g(r))}I=!0,A=s.subarray(r)}E.push(A);const i=Buffer.concat(E);if((e=>{for(let t=0;t+1<e.length;t++)if(255===e[t]&&217===e[t+1])return!0;return!1})(i)||201===e.header.responseCode){const e=i.indexOf(Buffer.from([255,217]));if(-1!==e)return void g(i.subarray(0,e+2));g(i)}}catch(e){C(e)}};i=setTimeout((()=>{C(new Error(`Baichuan timeout waiting snapshot push cmdId=${n} msgNum=${r}`))}),u),this.on("frame",B);try{this.logDebug("tx",{cmdId:n,msgNum:r,channelId:s,messageClass:o,bodyLen:c,binary:!0,snapshot:!0}),this.recordTx({cmdId:n,responseCode:0,msgNum:r,channelId:s,streamType:e.streamType??0}),this.writeWire(d)}catch(e){C(e)}}))}tryDecryptBinary(e,t,s){if(0===e.length)return e;const r=s=>{try{return"none"===s.kind?e:"bc"===s.kind?N(e,t):"aes"===s.kind||"full_aes"===s.kind?k(e,s.key):null}catch{return null}};return r(s)??("bc"===s.kind||"none"===this.enc.kind||"aes"!==this.enc.kind&&"full_aes"!==this.enc.kind?null:r(this.enc))??("bc"!==s.kind?r({kind:"bc"}):null)??r({kind:"none"})??e}async login(e="full_aes"){if(this.loggedIn)return;let t,s=e;const r=e=>new Promise((t=>setTimeout(t,e)));for(let e=1;e<=3;e++)try{const e="none"===s?56320:"bc"===s?56321:56338;await this.connect();const t=this.nextMsgNum(),r=1,A=T({cmdId:r,bodyLen:0,channelId:250,streamType:0,msgNum:t,responseCode:e,messageClass:25876}),i=`${r}:${t}`,o=new Promise(((e,t)=>{const s=setTimeout((()=>{this.pending.delete(i),t(new Error("Baichuan timeout waiting for nonce"))}),1e4);this.pending.set(i,{resolve:t=>{clearTimeout(s),e(t)},reject:e=>{clearTimeout(s),t(e)}})}));o.catch((()=>{})),this.writeWire(A);const a=await o,c=a.header.responseCode;if(c>>>8!=221)throw new Error(`Baichuan login: expected encryption info (0xDDxx), got 0x${c.toString(16)}`);const l=255&c,h=P(this.tryDecryptXml(a.body,a.header.channelId,0===l?{kind:"none"}:{kind:"bc"}),"nonce");if(!h)throw new Error("Baichuan login: nonce not found in XML");if(this.nonce=h,0===l)this.enc={kind:"none"};else if(1===l)this.enc={kind:"bc"};else if(2===l)this.enc={kind:"aes",key:b(h,this.opts.password)};else{if(18!==l)throw new Error(`Baichuan login: unknown encType=0x${l.toString(16)}`);this.enc={kind:"full_aes",key:b(h,this.opts.password)}}const g=D(`${this.opts.username}${h}`),d=D(`${this.opts.password}${h}`),u=(n=d,`<?xml version="1.0" encoding="UTF-8" ?>\n<body>\n<LoginUser version="1.1">\n<userName>${U(g)}</userName>\n<password>${U(n)}</password>\n<userVer>1</userVer>\n</LoginUser>\n<LoginNet version="1.1">\n<type>LAN</type>\n<udpPort>0</udpPort>\n</LoginNet>\n</body>`);this.logDebug("login_hash",{username:this.opts.username,nonce:h,userHash:g,passHashLength:d.length,loginXmlLength:u.length,loginXmlPreview:u.substring(0,200)});const E=await this.sendFrame({cmdId:1,payloadXml:u,extensionXml:"",messageClass:p,encryption:{kind:"bc"},timeoutMs:1e4}),I=this.tryDecryptXml(E.body,E.header.channelId,{kind:"bc"});if(this.logDebug("login_reply",{replyLength:I.length,replyPreview:I.substring(0,200),startsWithXml:I.startsWith("<?xml")}),0===I.length)throw new Error("Baichuan login failed: empty reply (camera may be sleeping/waking, session may be stale, or username/password may be invalid)");if(!I.startsWith("<?xml")){const e=I.length>0?I.substring(0,100):"(empty)";throw new Error(`Baichuan login: unexpected non-XML reply (length: ${I.length}, preview: ${e})`)}return void(this.loggedIn=!0)}catch(n){t=n,this.loggedIn=!1;const A=String(n&&"object"==typeof n&&"message"in n?n.message:n);(A.includes("timeout waiting for nonce")||A.includes("expected encryption info")||A.includes("Baichuan socket closed")||A.includes("ECONNRESET")||A.includes("EPIPE"))&&("full_aes"===s||"aes"===s?s="bc":"bc"===s&&(s="none"));try{await this.close()}catch{}if(e<3){await r(1500);continue}throw n}var n;throw t instanceof Error?t:new Error(String(t))}},de=class e{static sessionPool=new Map;host;username;password;port;useHttps;insecureTLS;timeoutMs;token;tokenExpiresAt;httpsAgent;constructor(e){this.host=e.host,this.username=e.username,this.password=e.password,this.port=e.port,this.useHttps=e.useHttps,this.insecureTLS=e.insecureTLS??!0,this.timeoutMs=e.timeoutMs??3e4,this.insecureTLS&&(this.httpsAgent=new l.g6({connect:{rejectUnauthorized:!1}}))}getUsername(){return this.username}getToken(){return this.token}clearToken(){this.token=void 0,this.tokenExpiresAt=void 0}sessionKey(){const e=this.useHttps?"https":"http",t=this.port??(this.useHttps?443:80);return`${e}://${this.host}:${t}|${this.username}`}getSharedSession(){const t=this.sessionKey(),s=e.sessionPool.get(t);if(s)return s;const r={};return e.sessionPool.set(t,r),r}baseUrl(){const e=this.useHttps?"https":"http",t=this.port??(this.useHttps?443:80);return`${e}://${this.host}:${t}`}apiUrl(e){const t=new URLSearchParams;for(const[s,r]of Object.entries(e))null!=r&&t.set(s,String(r));return`${this.baseUrl()}/cgi-bin/api.cgi?${t.toString()}`}isTokenValid(){return!(!this.token||!this.tokenExpiresAt)&&Date.now()+1e4<this.tokenExpiresAt}isSharedTokenValid(e){return!(!e.token||!e.tokenExpiresAt)&&Date.now()+1e4<e.tokenExpiresAt}async performLogin(){const e=[{cmd:"Login",action:0,param:{User:{userName:this.username,password:this.password}}}],t=await this.sendJson(e,{cmd:"Login"},{includeToken:!1}),s=t[0];if(!s||0!==s.code||!s.value?.Token?.name)throw new Error(`Login failed: ${JSON.stringify(t)}`);const r=Number(s.value.Token.leaseTime),n=s.value.Token.name,A=Date.now()+(Number.isFinite(r)?1e3*r:0);this.token=n,this.tokenExpiresAt=A;const i=this.getSharedSession();i.token=n,i.tokenExpiresAt=A}async login(){if(this.isTokenValid())return;const e=this.getSharedSession();return this.isSharedTokenValid(e)?(this.token=e.token,void(this.tokenExpiresAt=e.tokenExpiresAt)):e.loginInFlight?(await e.loginInFlight,void(this.isSharedTokenValid(e)&&(this.token=e.token,this.tokenExpiresAt=e.tokenExpiresAt))):(e.loginInFlight=(async()=>{try{await this.performLogin()}finally{delete e.loginInFlight}})(),void await e.loginInFlight)}async logout(){if(this.token)try{await this.call("Logout",{action:0,param:{}})}finally{this.clearToken();const e=this.getSharedSession();delete e.token,delete e.tokenExpiresAt}}async call(e,t){await this.login();const s=[{cmd:e,action:t?.action??0,...t&&"param"in t&&void 0!==t.param?{param:t.param}:{}}];return await this.sendJson(s,{cmd:e,token:this.token},{includeToken:!0})}async callMany(e){return await this.login(),await this.sendJson(e,{token:this.token},{includeToken:!0})}async sendJson(e,t,s){const r=this.apiUrl(t),n=new AbortController,A=setTimeout((()=>n.abort()),this.timeoutMs);try{const t={method:"POST",body:JSON.stringify(e),headers:{"Content-Type":"application/json"},signal:n.signal};this.useHttps&&this.httpsAgent&&(t.dispatcher=this.httpsAgent);const s=await fetch(r,t),A=await s.text();if(!s.ok)throw new Error(`HTTP ${s.status}: ${A}`);return JSON.parse(A)}finally{clearTimeout(A)}}async snap(e,t){if(await this.login(),!this.token)throw new Error("Missing token after login");const s=t?.rs??Date.now().toString(),r=this.apiUrl({cmd:"Snap",channel:e,rs:s,token:this.token}),n=new AbortController,A=setTimeout((()=>n.abort()),t?.timeoutMs??this.timeoutMs);try{const e={method:"GET",signal:n.signal};this.useHttps&&this.httpsAgent&&(e.dispatcher=this.httpsAgent);const t=await fetch(r,e);if(!t.ok){const e=await t.text().catch((()=>""));throw new Error(`HTTP ${t.status}: ${e}`)}const s=await t.arrayBuffer();return Buffer.from(s)}finally{clearTimeout(A)}}async downloadVod(e,t,s){if(await this.login(),!this.token)throw new Error("Missing token after login");const r=this.useHttps?"https":"http",n=this.port??(this.useHttps?443:80),A=e.replaceAll(" ","%20"),i=t?encodeURIComponent(t):void 0,o=s?encodeURIComponent(s):void 0,a=encodeURIComponent(this.token),c=`${r}://${this.host}:${n}/cgi-bin/api.cgi?cmd=Download&source=${A}${i?`&output=${i}`:""}${o?`&start=${o}`:""}&token=${a}`,l=new AbortController,h=setTimeout((()=>l.abort()),this.timeoutMs);try{const e={method:"POST",body:"[{}]",headers:{"Content-Type":"application/json"},signal:l.signal};this.useHttps&&this.httpsAgent&&(e.dispatcher=this.httpsAgent);const t=await fetch(c,e);if(!t.ok){const e=await t.text().catch((()=>""));throw new Error(`HTTP ${t.status}: ${e}`)}const s=await t.arrayBuffer();return Buffer.from(s)}finally{clearTimeout(h)}}},ue=class{client;constructor(e){this.client=new de(e)}async login(){await this.client.login()}async logout(){await this.client.logout()}async call(e,t,s=0){return void 0===t?await this.client.call(e,{action:s}):await this.client.call(e,{action:s,param:t})}async callMany(e){return await this.client.callMany(e)}async GetDevInfo(e){const t=null==e?{}:{channel:e};return await this.call("GetDevInfo",t)}async getInfo(e,t){const s=await this.GetDevInfo(e),r=s?.[0]?.value?.DevInfo,n={},A=r?.type??r?.model??r?.exactType,i=r?.exactType??r?.model??r?.detail;"string"==typeof A&&(n.type=A),"string"==typeof r?.hardVer&&(n.hardwareVersion=r.hardVer),"string"==typeof r?.firmVer&&(n.firmwareVersion=r.firmVer),"string"==typeof i&&(n.itemNo=i),"string"==typeof r?.serial&&(n.serialNumber=r.serial),"string"==typeof r?.name&&(n.name=r.name);const o=t?.tags?.length?t.tags:["type","hardwareVersion","firmwareVersion","itemNo","serialNumber","name"],a={};for(const e of o){const t=n[e];"string"==typeof t&&(a[e]=t)}return a}async GetChnTypeInfo(e){const t=null==e?{}:{channel:e};return await this.call("GetChnTypeInfo",t)}async GetChannelstatus(){return await this.call("GetChannelstatus",void 0,0)}async GetLocalLink(e){const t=null==e?{}:{channel:e};return await this.call("GetLocalLink",t)}async GetWifiSignal(e){const t=null==e?{}:{channel:e};return await this.call("GetWifiSignal",t)}async GetOsd(e){const t=null==e?{}:{channel:e};return await this.call("GetOsd",t,1)}async SetOsd(e){return await this.call("SetOsd",e,0)}async GetEnc(e){const t=null==e?{}:{channel:e};return await this.call("GetEnc",t,1)}async GetAiState(e){const t=null==e?{}:{channel:e};return await this.call("GetAiState",t,0)}async GetMdState(e){const t=null==e?{}:{channel:e};return await this.call("GetMdState",t,0)}async GetEvents(e){const t=null==e?{}:{channel:e};return await this.call("GetEvents",t,0)}async GetBatteryInfo(e){const t=null==e?{}:{channel:e};return await this.call("GetBatteryInfo",t,0)}async GetWhiteLed(e){const t=null==e?{}:{channel:e};return await this.call("GetWhiteLed",t,0)}async SetWhiteLed(e){return await this.call("SetWhiteLed",e,0)}async GetPirInfo(e){const t=null==e?{}:{channel:e};return await this.call("GetPirInfo",t,0)}async SetPirInfo(e){return await this.call("SetPirInfo",e,0)}async GetPtzPreset(e){const t=null==e?{}:{channel:e};return await this.call("GetPtzPreset",t,1)}async GetAudioAlarmV20(e){const t=null==e?{}:{channel:e};return await this.call("GetAudioAlarmV20",t,0)}async AudioAlarmPlay(e){return await this.call("AudioAlarmPlay",e,0)}async GetNetPort(){return await this.call("GetNetPort",{})}async SetNetPort(e){return await this.call("SetNetPort",{NetPort:e})}async Reboot(e){const t=null==e?{}:{channel:e};return await this.call("Reboot",t)}async GetAbility(){const e=this.client.getUsername();return await this.call("GetAbility",{User:{userName:e}})}async getChannels(){const e=await this.GetChannelstatus(),t=e?.[0]?.value?.status;return{channels:(t??[]).filter((e=>!!e?.uid)).map((e=>Number(e?.channel))).filter((e=>Number.isFinite(e))),channelsResponse:e}}async getNvrInfo(){const e=[{cmd:"GetAbility",action:0,param:{User:{userName:this.client.getUsername()}}},{cmd:"GetDevInfo",action:0,param:{}}],t=await this.callMany(e),s=t.find((e=>"GetAbility"===e?.cmd))?.value,r=t.find((e=>"GetDevInfo"===e?.cmd))?.value,n=r?.DevInfo;return{abilities:s,nvrData:r,devInfo:n,response:t}}async getDevicesInfo(){const{channels:e,channelsResponse:t}=await this.getChannels(),s=this.client.getUsername(),r=[];r.push({cmd:"GetAbility",action:0,param:{User:{userName:s}}});for(const t of e)r.push({cmd:"GetChnTypeInfo",action:0,param:{channel:t}},{cmd:"GetAiState",action:0,param:{channel:t}},{cmd:"GetEnc",action:1,param:{channel:t}});const n=await this.callMany(r),A=n[0]?.value,i=A?.Ability?.abilityChn,o={};for(let s=0;s<e.length;s++){const r=e[s],A=1+3*s,a=n[A],c=n[A+1],l=n[A+2],h=t?.[0]?.value?.status?.find((e=>e?.channel===r)),g={entries:[a,c,l]};h&&(g.channelStatus=h);const d=i?.[r];d&&(g.abilities=d),a?.error||(g.channelInfo=a?.value),c?.error||(g.ai=c?.value),l?.error||(g.enc=l?.value),o[r]=g}return{devicesData:o,response:n,channels:e,channelsResponse:t,requestBody:r}}async getAllChannelsEvents(){const{channels:e,channelsResponse:t}=await this.getChannels(),s=[],r={};for(const t of e)r[t]={},s.push({cmd:"GetEvents",action:0,param:{channel:t}}),r[t].events=s.length-1,s.push({cmd:"GetMdState",action:0,param:{channel:t}}),r[t].motion=s.length-1,s.push({cmd:"GetAiState",action:0,param:{channel:t}}),r[t].ai=s.length-1;const n=await this.callMany(s),A=e=>{const t=[];for(const s of Object.keys(e??{})){if("channel"===s)continue;const r=e?.[s]?.alarm_state;r&&t.push(s)}return t},i={};for(const t of e){const{events:e,motion:s,ai:o}=r[t]??{},a=null!=e?n[e]:void 0,c=null!=s?n[s]:void 0,l=null!=o?n[o]:void 0,h=new Set;for(const e of A(l?.value))h.add(e);for(const e of A(a?.value?.ai??a?.value))h.add(e);const g=Array.from(h),d=g.filter((e=>"other"!==e)),u=!!c?.value?.state||g.length>0;i[t]={motion:u,objects:d,entries:[a,c,l]}}return{parsed:i,response:n,channels:e,channelsResponse:t,requestBody:s}}async getAllChannelsBatteryInfo(){const{channels:e,channelsResponse:t}=await this.getChannels(),s=[{cmd:"GetChannelstatus"}],r={};for(const t of e)s.push({cmd:"GetBatteryInfo",action:0,param:{channel:t}}),r[t]=s.length-1;const n=await this.callMany(s),A=n[0],i={};for(const t of e){const e=n[r[t]]?.value?.Battery??void 0,s=A?.value?.status?.find((e=>e?.channel===t));i[t]={entries:[e,s],batteryLevel:Number(e?.batteryPercent??0),sleeping:1===s?.sleep}}return{batteryInfoData:i,response:n,channels:e,channelsResponse:t,requestBody:s}}async getStatusInfo(e){const t=[],s={};for(const[r,n]of e.entries())s[r]={},n.sleeping||(t.push({cmd:"GetOsd",action:1,param:{channel:r}}),s[r].osd=t.length-1,n.hasFloodlight&&(t.push({cmd:"GetWhiteLed",action:0,param:{channel:r}}),s[r].floodlight=t.length-1),n.hasPirEvents&&(t.push({cmd:"GetPirInfo",action:0,param:{channel:r}}),s[r].pir=t.length-1),n.hasPtz&&(t.push({cmd:"GetPtzPreset",action:1,param:{channel:r}}),s[r].presets=t.length-1));const r=await this.callMany(t),n={};for(const[t,A]of e.entries()){const{osd:e,floodlight:i,pir:o,presets:a}=s[t]??{};if(n[t]={entries:[]},null!=e){const s=r[e];n[t].osd=s,n[t].entries.push(s)}if(A.hasFloodlight&&null!=i){const e=r[i];n[t].floodlightEnabled=1===e?.value?.WhiteLed?.state,n[t].entries.push(e)}if(A.hasPirEvents&&null!=o){const e=r[o];n[t].pirEnabled=1===e?.value?.pirInfo?.enable,n[t].entries.push(e)}if(A.hasPtz&&null!=a){const e=r[a],s=e?.value?.PtzPreset;n[t].ptzPresets=Array.isArray(s)?s.filter((e=>1===e?.enable)):[],n[t].entries.push(e)}}return{deviceStatusData:n,response:r}}async getOsd(e){const t=await this.GetOsd(e);return t?.[0]}async setOsd(e,t){const s=t?.value?.Osd??t?.Osd,r={Osd:{channel:e,osdChannel:s?.osdChannel??t?.osdChannel,osdTime:s?.osdTime??t?.osdTime}};await this.call("SetOsd",r,0)}async getEncoderConfiguration(e){const t=await this.GetEnc(e);return t?.[0]?.value?.Enc}async jpegSnapshot(e,t=1e4){return await this.client.snap(e,{timeoutMs:t})}async getSiren(e){const t=await this.GetAudioAlarmV20(e);return{enabled:1===t?.[0]?.value?.Audio?.enable}}async setSiren(e,t,s){const r=s?{channel:e,alarm_mode:"times",times:s}:{channel:e,alarm_mode:"manul",manual_switch:t?1:0},n=await this.AudioAlarmPlay(r);return{value:n?.[0]?.value??n?.value,data:n}}async setWhiteLedState(e,t,s){const r={channel:e};void 0!==t&&(r.state=t?1:0),void 0!==s&&(r.bright=s),await this.SetWhiteLed({WhiteLed:r})}async getPirState(e){const t=await this.GetPirInfo(e),s=t?.[0]?.value?.pirInfo;return{enabled:1===s?.enable,state:s}}async setPirState(e,t){const s=await this.getPirState(e),r=t?1:0,n=s?.state?.enable;if(n===r)return;const A={...s?.state&&"object"==typeof s.state?s.state:{},channel:e,enable:r};await this.SetPirInfo({pirInfo:A})}async getLocalLink(e){const t=[{cmd:"GetLocalLink",action:0,param:{}},{cmd:"GetWifiSignal",action:0,param:{channel:e}}],s=await this.callMany(t),r=s.find((e=>"GetLocalLink"===e?.cmd))?.value?.LocalLink?.activeLink,n=s.find((e=>"GetWifiSignal"===e?.cmd))?.value?.wifiSignal;let A=!1;return void 0!==n&&(A=n>=0&&n<=4),!A&&r&&(A="LAN"!==r),{activeLink:r,wifiSignal:n,isWifi:A}}};function Ee(e){const t=e.port??554,s=function(e,t){let s;return s="main"===t?"main":"sub"===t?"sub":"ext",`/h264Preview_${String(e+1).padStart(2,"0")}_${s}`}(e.channel,e.stream);return`rtsp://${encodeURIComponent(e.username)}:${encodeURIComponent(e.password)}@${e.host}:${t}${s}`}function Ie(e){if(e.length<4)return null;const t=e.readUInt32LE(0);return 825241649===t?function(e){if(e.length<32)return null;const t=e.readUInt32LE(4);if(32!==t)return null;const s={type:"InfoV1",videoWidth:e.readUInt32LE(8),videoHeight:e.readUInt32LE(12),fps:e.readUInt8(17),startYear:e.readUInt8(18),startMonth:e.readUInt8(19),startDay:e.readUInt8(20),startHour:e.readUInt8(21),startMin:e.readUInt8(22),startSeconds:e.readUInt8(23),endYear:e.readUInt8(24),endMonth:e.readUInt8(25),endDay:e.readUInt8(26),endHour:e.readUInt8(27),endMin:e.readUInt8(28),endSeconds:e.readUInt8(29)};return{media:s,consumed:32}}(e):842018865===t?function(e){if(e.length<32)return null;const t=e.readUInt32LE(4);if(32!==t)return null;const s={type:"InfoV2",videoWidth:e.readUInt32LE(8),videoHeight:e.readUInt32LE(12),fps:e.readUInt8(17),startYear:e.readUInt8(18),startMonth:e.readUInt8(19),startDay:e.readUInt8(20),startHour:e.readUInt8(21),startMin:e.readUInt8(22),startSeconds:e.readUInt8(23),endYear:e.readUInt8(24),endMonth:e.readUInt8(25),endDay:e.readUInt8(26),endHour:e.readUInt8(27),endMin:e.readUInt8(28),endSeconds:e.readUInt8(29)};return{media:s,consumed:32}}(e):t>=1667510320&&t<=1667510329?function(e){if(e.length<20)return null;const t=e.toString("utf8",4,8);if("H264"!==t&&"H265"!==t)return null;const s=t,r=e.readUInt32LE(8),n=e.readUInt32LE(12),A=e.readUInt32LE(16);let i=20;const o=e.readUInt32LE(i);let a;if(i+=4,e.length<i+n)return null;const c=e.subarray(i,i+n);n>=4&&(a=c.readUInt32LE(0));if(i+=n,e.length<i+r)return null;const l=e.subarray(i,i+r);i+=r;const h=r%8==0?0:8-r%8;if(e.length<i+h)return null;i+=h;return{media:{type:"Iframe",videoType:s,microseconds:A,...void 0!==a?{time:a}:{},additionalHeader:c,additionalHeaderSize:n,unknown:o,data:l},consumed:i}}(e):t>=1667510576&&t<=1667510585?function(e){if(e.length<20)return null;const t=e.toString("utf8",4,8);if("H264"!==t&&"H265"!==t)return null;const s=t,r=e.readUInt32LE(8),n=e.readUInt32LE(12),A=e.readUInt32LE(16);let i=20;const o=e.readUInt32LE(i);if(i+=4,e.length<i+n)return null;const a=e.subarray(i,i+n);if(i+=n,e.length<i+r)return null;const c=e.subarray(i,i+r);i+=r;const l=r%8==0?0:8-r%8;if(e.length<i+l)return null;i+=l;return{media:{type:"Pframe",videoType:s,microseconds:A,additionalHeader:a,additionalHeaderSize:n,unknown:o,data:c},consumed:i}}(e):1651979568===t?function(e){if(e.length<12)return null;const t=e.readUInt16LE(4),s=e.readUInt16LE(6);if(t!==s)return null;const r=8,n=r+t+(t%8==0?0:8-t%8);if(e.length<n)return null;const A=e.subarray(r,r+t);return{media:{type:"Aac",data:A},consumed:n}}(e):1651978544===t?function(e){if(e.length<12)return null;const t=e.readUInt16LE(4),s=e.readUInt16LE(6);if(t!==s)return null;const r=e.readUInt16LE(8);if(256!==r)return null;e.readUInt16LE(10);const n=4;if(t<n)return null;const A=t-n,i=12,o=i+A+(t%8==0?0:8-t%8);if(e.length<o)return null;const a=e.subarray(i,i+A);return{media:{type:"Adpcm",data:a},consumed:o}}(e):null}var Ce=class{buffer=Buffer.alloc(0);strict;amountSkipped=0;logger;constructor(e=!1,t){this.strict=e,this.logger=t}decode(e){this.buffer=0===this.buffer.length?e:Buffer.concat([this.buffer,e]);const t=[];for(;this.buffer.length>=4;){const e=Ie(this.buffer);if(!e){const e=this.buffer.readUInt32LE(0);if(825241649===e||842018865===e||e>=1667510320&&e<=1667510329||e>=1667510576&&e<=1667510585||1651979568===e||1651978544===e)break;if(this.strict)throw new Error(`[BcMediaCodec] Invalid data in stream (no valid magic at buffer start, len=${this.buffer.length})`);0===this.amountSkipped&&this.logger?.warn("[BcMediaCodec] Error in stream, attempting to recover..."),this.amountSkipped+=this.buffer.length,this.buffer=Buffer.alloc(0);break}this.amountSkipped>0&&(this.strict,this.logger?.warn(`[BcMediaCodec] Recovered stream after skipping ${this.amountSkipped} bytes`),this.amountSkipped=0),t.push(e.media),this.buffer=this.buffer.subarray(e.consumed)}return t}getRemainingBuffer(){return this.buffer}clear(){this.buffer=Buffer.alloc(0),this.amountSkipped=0}},Be=Buffer.from([0,0,0,1]),Qe=Buffer.from([0,0,1]);function pe(e){return!(e.length<4)&&(!!e.subarray(0,4).equals(Be)||!!e.subarray(0,3).equals(Qe))}function fe(e,t){const s=[];let r=0,n=0;for(;r<e.length;){if(r+4>e.length)return null;const A=t(e,r);if(r+=4,A<=0)return null;if(A>e.length-r)return null;s.push(Be),s.push(e.subarray(r,r+A)),r+=A,n++}return 0===n?null:Buffer.concat(s)}function me(e,t){const s=[];let r=0,n=0;for(;r<e.length;){if(r+2>e.length)return null;const A=t(e,r);if(r+=2,A<=0)return null;if(A>e.length-r)return null;s.push(Be),s.push(e.subarray(r,r+A)),r+=A,n++}return 0===n?null:Buffer.concat(s)}function ye(e,t){const s=[];let r=0,n=0;const A=(e,s)=>{if(s+3>e.length)return 0;const r=e[s],n=e[s+1],A=e[s+2];return"be"===t?(r<<16|n<<8|A)>>>0:(A<<16|n<<8|r)>>>0};for(;r<e.length;){if(r+3>e.length)return null;const t=A(e,r);if(r+=3,t<=0)return null;if(t>e.length-r)return null;s.push(Be),s.push(e.subarray(r,r+t)),r+=t,n++}return 0===n?null:Buffer.concat(s)}function we(e){if(pe(e))return e;const t=Buffer.from([0,0,0,1]),s=Buffer.from([0,0,1]),r=Math.min(64,e.length),n=e.subarray(0,r).indexOf(t);if(n>0)return e.subarray(n);const A=e.subarray(0,r).indexOf(s);if(A>0)return e.subarray(A);const i=fe(e,((e,t)=>e.readUInt32BE(t)));if(i)return i;const o=fe(e,((e,t)=>e.readUInt32LE(t)));if(o)return o;const a=ye(e,"be");if(a)return a;const c=ye(e,"le");if(c)return c;const l=me(e,((e,t)=>e.readUInt16BE(t)));if(l)return l;const h=me(e,((e,t)=>e.readUInt16LE(t)));if(h)return h;const g=function(e){if(e.length<1)return null;const t=31&e[0],s=[],r=e=>{0!==e.length&&s.push(Be,e)};if(24===t){let t=1;for(;t+2<=e.length;){const s=e.readUInt16BE(t);if(t+=2,s<=0||t+s>e.length)return null;r(e.subarray(t,t+s)),t+=s}return s.length?Buffer.concat(s):null}if(25===t){let t=3;if(t>e.length)return null;for(;t+2<=e.length;){const s=e.readUInt16BE(t);if(t+=2,s<=0||t+s>e.length)return null;r(e.subarray(t,t+s)),t+=s}return s.length?Buffer.concat(s):null}if(26===t){let t=3;if(t>e.length)return null;for(;t+2<=e.length;){const s=e.readUInt16BE(t);if(t+=2,t+1+2>e.length)return null;if(t+=1,t+=2,s<=0||t+s>e.length)return null;r(e.subarray(t,t+s)),t+=s}return s.length?Buffer.concat(s):null}if(27===t){let t=3;if(t>e.length)return null;for(;t+2<=e.length;){const s=e.readUInt16BE(t);if(t+=2,t+1+3>e.length)return null;if(t+=1,t+=3,s<=0||t+s>e.length)return null;r(e.subarray(t,t+s)),t+=s}return s.length?Buffer.concat(s):null}return null}(e);return g||(function(e){if(e.length<1)return!1;const t=e[0];if(void 0===t)return!1;if(128&t)return!1;const s=31&t;return s>=1&&s<=23}(e)?Buffer.concat([Be,e]):e)}function Se(e){const t=[];for(let s=0;s<e.length-3;s++)0===e[s]&&0===e[s+1]&&(1===e[s+2]?(t.push({idx:s,len:3}),s+=2):0===e[s+2]&&1===e[s+3]&&(t.push({idx:s,len:4}),s+=3));if(0===t.length)return[];const s=[];for(let r=0;r<t.length;r++){const n=t[r],A=n.idx+n.len,i=t[r+1]?t[r+1].idx:e.length;i>A&&s.push(e.subarray(A,i))}return s}function De(e){if(!pe(e))return!1;const t=Se(e);if(0===t.length)return!1;for(const e of t){if(e.length<1)return!1;const t=e[0];if(void 0===t)return!1;if(128&t)return!1;const s=31&t;if(0===s||s>=24)return!1}return!0}function be(e){const t=Se(e);let s=!1,r=!1,n=!1;for(const e of t){const t=31&(e[0]??0);7===t&&(s=!0),8===t&&(r=!0),5===t&&(n=!0)}return n&&s&&r}var ve=class e{fuNalHeader=null;fuParts=[];static parseRtpPayload(e){if(!e||e.length<12)return null;if(2!==(e[0]>>6&3))return null;const t=!!(32&e[0]),s=!!(16&e[0]);let r=12+4*(15&e[0]);if(r>e.length)return null;if(s){if(r+4>e.length)return null;if(r+=4+4*e.readUInt16BE(r+2),r>e.length)return null}let n=e.length;if(t){const t=e[e.length-1];if(t<=0||t>e.length)return null;if(n=e.length-t,n<r)return null}return n<=r?null:e.subarray(r,n)}reset(){this.fuNalHeader=null,this.fuParts=[]}push(t){if(0===t.length)return[];const s=e.parseRtpPayload(t);if(s&&(t=s),pe(t))return[t];const r=t[0];if(128&r)return[];const n=31&r;if(n>=1&&n<=23)return[Buffer.concat([Be,t])];if(24===n){if(t.length<3)return[];let e=1;const s=[];for(;e+2<=t.length;){const r=t.readUInt16BE(e);if(e+=2,r<=0||e+r>t.length)return[];const n=t.subarray(e,e+r);if(e+=r,n.length<1)return[];if(128&n[0])return[];const A=31&n[0];if(0===A||A>=24)return[];s.push(Buffer.concat([Be,n]))}return s}if(28===n||29===n){if(t.length<2)return[];const e=t[0],s=t[1],r=!!(128&s),A=!!(64&s),i=224&e|31&s;let o=2;if(29===n){if(t.length<o+2)return[];o+=2}const a=t.subarray(o);if(r)this.fuNalHeader=i,this.fuParts=[a];else{if(null==this.fuNalHeader)return[];this.fuParts.push(a)}if(A&&null!=this.fuNalHeader){const e=Buffer.concat([Buffer.from([this.fuNalHeader]),...this.fuParts]);return this.reset(),[Buffer.concat([Be,e])]}return[]}return[]}};var Ne=Buffer.from([0,0,0,1]),Re=Buffer.from([0,0,1]);function ke(e){return!(e.length<4)&&(!!e.subarray(0,4).equals(Ne)||!!e.subarray(0,3).equals(Re))}function Te(e,t){const s=[];let r=0,n=0;for(;r<e.length;){if(r+4>e.length)return null;const A=t(e,r);if(r+=4,A<=0)return null;if(A>e.length-r)return null;s.push(Ne),s.push(e.subarray(r,r+A)),r+=A,n++}return 0===n?null:Buffer.concat(s)}function Fe(e,t){const s=[];let r=0,n=0;for(;r<e.length;){if(r+2>e.length)return null;const A=t(e,r);if(r+=2,A<=0)return null;if(A>e.length-r)return null;s.push(Ne),s.push(e.subarray(r,r+A)),r+=A,n++}return 0===n?null:Buffer.concat(s)}function Me(e,t){const s=[];let r=0,n=0;const A=(e,s)=>{if(s+3>e.length)return 0;const r=e[s],n=e[s+1],A=e[s+2];return"be"===t?(r<<16|n<<8|A)>>>0:(A<<16|n<<8|r)>>>0};for(;r<e.length;){if(r+3>e.length)return null;const t=A(e,r);if(r+=3,t<=0)return null;if(t>e.length-r)return null;s.push(Ne),s.push(e.subarray(r,r+t)),r+=t,n++}return 0===n?null:Buffer.concat(s)}function Ue(e){if(ke(e))return e;const t=Buffer.from([0,0,0,1]),s=Buffer.from([0,0,1]),r=Math.min(64,e.length),n=e.subarray(0,r).indexOf(t);if(n>0)return e.subarray(n);const A=e.subarray(0,r).indexOf(s);if(A>0)return e.subarray(A);const i=Te(e,((e,t)=>e.readUInt32BE(t)));if(i)return i;const o=Te(e,((e,t)=>e.readUInt32LE(t)));if(o)return o;const a=Me(e,"be");if(a)return a;const c=Me(e,"le");if(c)return c;const l=Fe(e,((e,t)=>e.readUInt16BE(t)));if(l)return l;const h=Fe(e,((e,t)=>e.readUInt16LE(t)));return h||(function(e){if(e.length<2)return!1;const t=e[0],s=e[1];return void 0!==t&&void 0!==s&&(!(128&t)&&(t>>1&63)<=40)}(e)?Buffer.concat([Ne,e]):e)}var Le=class e{fuParts=null;reset(){this.fuParts=null}static parseRtpPayload(e){if(!e||e.length<12)return null;if(2!==(e[0]>>6&3))return null;const t=!!(32&e[0]),s=!!(16&e[0]);let r=12+4*(15&e[0]);if(r>e.length)return null;if(s){if(r+4>e.length)return null;if(r+=4+4*e.readUInt16BE(r+2),r>e.length)return null}let n=e.length;if(t){const t=e[e.length-1];if(t<=0||t>e.length)return null;if(n=e.length-t,n<r)return null}return n<=r?null:e.subarray(r,n)}push(t){if(!t||t.length<2)return[];const s=e.parseRtpPayload(t);s&&(t=s);const r=t[0],n=t[1];if(128&r)return[];const A=r>>1&63;if(48===A){let e=2;const s=[];for(;e+2<=t.length;){const r=t.readUInt16BE(e);if(e+=2,r<=0||e+r>t.length)return[];const n=t.subarray(e,e+r);e+=r,n.length&&s.push(Ne,n)}return s.length?[Buffer.concat(s)]:[]}if(49===A){if(t.length<3)return[];const e=t[2],s=!!(128&e),A=!!(64&e),i=129&r|(63&(63&e))<<1,o=n,a=t.subarray(3);if(s)this.fuParts=[Ne,Buffer.from([i,o]),a];else{if(!this.fuParts)return[];this.fuParts.push(a)}if(A){if(!this.fuParts)return[];const e=Buffer.concat(this.fuParts);return this.fuParts=null,[e]}return[]}return[Buffer.concat([Ne,t])]}};function He(e){const t=[];for(let s=0;s<e.length-3;s++)0===e[s]&&0===e[s+1]&&(1===e[s+2]?(t.push({idx:s,len:3}),s+=2):0===e[s+2]&&1===e[s+3]&&(t.push({idx:s,len:4}),s+=3));if(0===t.length)return[];const s=[];for(let r=0;r<t.length;r++){const n=t[r],A=n.idx+n.len,i=t[r+1]?t[r+1].idx:e.length;i>A&&s.push(e.subarray(A,i))}return s}function Pe(e){if(e.length<1)return null;const t=e[0];return void 0===t||128&t?null:t>>1&63}function xe(e){return e>=16&&e<=23}function Ye(e){if(!ke(e))return!1;const t=He(e);if(0===t.length)return!1;for(const e of t){if(e.length<2)return!1;const t=e[0];if(void 0===t)return!1;if(128&t)return!1;const s=Pe(e);if(null===s)return!1;if(s>40)return!1}return!0}function Ve(e){const t=He(e);let s=!1,r=!1,n=!1,A=!1;for(const e of t){const t=Pe(e);null!==t&&(32===t&&(s=!0),33===t&&(r=!0),34===t&&(n=!0),xe(t)&&(A=!0))}return A&&s&&r&&n}function Oe(e){const t=He(e);for(const e of t){if(32===Pe(e))return e}return null}function Ge(e){const t=He(e);for(const e of t){if(33===Pe(e))return e}return null}function Je(e){const t=He(e);for(const e of t){if(34===Pe(e))return e}return null}var We=Buffer.from([0,0,0,1]),_e=class{running=!1;queue=[];maxQueueSize;constructor(e){this.maxQueueSize=e}enqueue(e){this.queue.length>=this.maxQueueSize||(this.queue.push(e),this.pump())}pump(){this.running||(this.running=!0,this.run())}async run(){try{for(;this.queue.length>0;){const e=this.queue.shift();if(e)try{await e()}catch{}}}finally{this.running=!1}}};function qe(e){const t=[];for(let s=0;s<e.length;s++)s>=2&&3===e[s]&&0===e[s-1]&&0===e[s-2]||t.push(e[s]);return Buffer.from(t)}var $e=class{b;bitPos=0;constructor(e){this.b=e}readBits(e){if(e<=0)return 0;let t=0;for(let s=0;s<e;s++){const e=this.bitPos>>3;if(e>=this.b.length)return null;const s=7-(7&this.bitPos);t=t<<1|this.b[e]>>s&1,this.bitPos++}return t>>>0}readUE(){let e=0;for(;;){const t=this.readBits(1);if(null==t)return null;if(0!==t)break;if(e++,e>31)return null}const t=e?this.readBits(e):0;return null==t?null:(1<<e)-1+t>>>0}};function ze(e){if(7!=(31&(e[0]??0)))return null;const t=qe(e.subarray(1)),s=new $e(t);return null==s.readBits(8)||null==s.readBits(8)||null==s.readBits(8)?null:s.readUE()}function Xe(e){if(8!=(31&(e[0]??0)))return null;const t=qe(e.subarray(1)),s=new $e(t),r=s.readUE(),n=s.readUE();return null==r||null==n?null:{ppsId:r,spsId:n}}function je(e){const t=31&(e[0]??0);if(1!==t&&5!==t)return null;const s=qe(e.subarray(1)),r=new $e(s);return null==r.readUE()||null==r.readUE()?null:r.readUE()}var Ze=class e extends n.EventEmitter{client;api;channel;profile;logger;active=!1;videoFrameHandler;expectedStreamType;activeMsgNum;bcMediaCodec;debugH264LogsLeft;debugSavedSamples;warnedNonAnnexBOnce=!1;depacketizer=new ve;depacketizerH265=new Le;dumpChunkIdx=0;dumpNalLines=0;dumpIo=new _e(200);spsById=new Map;ppsById=new Map;lastSps=null;lastPps=null;lastPrependedPpsId=null;lastVps=null;lastSpsH265=null;lastPpsH265=null;lastPrependedParamSetsH265=!1;lastMediaAtMs=0;watchdogTimer;restarting=!1;restartWindowStartMs=0;restartCountInWindow=0;idleRestartMs;static scoreBcMediaLike(e){if(e.length<4)return{score:-1,first:-1};const t=Math.min(65536,e.length-4);let s=0,r=-1;for(let n=0;n<=t;n++){const t=e.readUInt32LE(n);if((825241649===t||842018865===t||t>=1667510320&&t<=1667510329||t>=1667510576&&t<=1667510585||1651979568===t||1651978544===t)&&(s++,r<0&&(r=n),s>32&&0===r))break}return{score:1e3*s-(r<0?5e4:r),first:r}}chooseDecryptedOrRawCandidate(t){const{raw:s,enc:r,channelId:n,allowResync:A}=t,i=e.scoreBcMediaLike(s),o="aes"===this.client.enc.kind||"full_aes"===this.client.enc.kind||"bc"===this.client.enc.kind?this.client.tryDecryptBinary(s,n,r):s,a=e.scoreBcMediaLike(o).score>i.score?o:s;if(!A)return a;const c=e.scoreBcMediaLike(a);return c.first>0?a.subarray(c.first):a}constructor(e){super(),this.client=e.client,this.api=e.api,this.channel=e.channel,this.profile=e.profile,this.logger=e.logger,this.expectedStreamType="sub"===this.profile?1:0,this.bcMediaCodec=new Ce(!1,this.logger);const t=this.client.getDebugConfig();this.debugH264LogsLeft=t.debugH264?200:0,this.debugSavedSamples=!1,this.dumpChunkIdx=0,this.spsById=new Map,this.ppsById=new Map,this.lastSps=null,this.lastPps=null,this.lastPrependedPpsId=null,this.lastVps=null,this.lastSpsH265=null,this.lastPpsH265=null,this.lastPrependedParamSetsH265=!1;const s=this.client.getTransport?.();this.idleRestartMs="udp"===s?6e3:15e3}noteMediaActivity(){this.lastMediaAtMs=Date.now()}startWatchdog(){this.api&&(this.watchdogTimer||(this.restartWindowStartMs=Date.now(),this.restartCountInWindow=0,this.watchdogTimer=setInterval((()=>{this.watchdogTick()}),1e3)))}stopWatchdog(){this.watchdogTimer&&clearInterval(this.watchdogTimer),this.watchdogTimer=void 0}async watchdogTick(){if(!this.active)return;if(!this.api)return;if(this.restarting)return;if(this.lastMediaAtMs<=0)return;const e=Date.now(),t=e-this.lastMediaAtMs;t<this.idleRestartMs||(e-this.restartWindowStartMs>6e4&&(this.restartWindowStartMs=e,this.restartCountInWindow=0),this.restartCountInWindow++,this.restartNativeStream({reason:`idle ${t}ms`}))}async restartNativeStream(e){if(this.api&&this.active&&!this.restarting){this.restarting=!0;try{const t=this.client.getTransport?.()??"unknown",s=this.activeMsgNum??"unknown";this.logger?.warn(`[BaichuanVideoStream] Watchdog restarting native stream (channel=${this.channel} profile=${this.profile} streamType=${this.expectedStreamType} msgNum=${s} transport=${t} reason=${e.reason})`),this.depacketizer.reset(),this.depacketizerH265.reset(),this.bcMediaCodec.clear(),this.activeMsgNum=void 0,this.lastPrependedPpsId=null,this.lastPrependedParamSetsH265=!1;try{await this.api.stopVideoStream(this.channel,this.profile)}catch{}await this.api.startVideoStream(this.channel,this.profile);try{const e=this.api.getActiveVideoMsgNum;this.activeMsgNum="function"==typeof e?e(this.channel,this.profile):void 0}catch{this.activeMsgNum=void 0}this.lastMediaAtMs=Date.now()}catch(e){const t=e instanceof Error?e:new Error(String(e));this.emit("error",t)}finally{this.restarting=!1}}}async start(){if(this.active)throw new Error("Video stream already active");if(this.depacketizer.reset(),this.depacketizerH265.reset(),this.api)try{await this.api.startVideoStream(this.channel,this.profile);try{const e=this.api.getActiveVideoMsgNum;this.activeMsgNum="function"==typeof e?e(this.channel,this.profile):void 0}catch{this.activeMsgNum=void 0}}catch(e){const t=e instanceof Error?e:new Error(String(e));if("udp"===this.client.getTransport?.())throw t;this.emit("error",t)}let e=0,t=0;this.videoFrameHandler=s=>{if(3!==s.header.cmdId)return;if(s.header.streamType!==this.expectedStreamType)return;if(void 0!==this.activeMsgNum&&s.header.msgNum!==this.activeMsgNum)return;e++;const r=this.client.getDebugConfig(),n=r.debugRtsp;1===e&&n&&this.logger?.log(`[BaichuanVideoStream] First cmd_id=3 frame received (bodyLen: ${s.body.length}, channelId: ${s.header.channelId})`),(e%10==0||e<=5)&&n&&this.logger?.log(`[BaichuanVideoStream] Received ${e} Baichuan frames (cmd_id=3)`);const A=this.client.enc,i=s.payload.length>0?s.payload:s.body;let o=i;if(0===s.payload.length){let e=0;const t=i.indexOf(Buffer.from("</Extension>")),s=i.indexOf(Buffer.from("</body>"));-1!==t?e=t+Buffer.from("</Extension>").length:-1!==s&&(e=s+Buffer.from("</body>").length),o=i.subarray(e)}const l=this.chooseDecryptedOrRawCandidate({raw:o,enc:A,channelId:s.header.channelId,allowResync:0===s.payload.length});if(1===e&&n&&this.logger?.log(`[BaichuanVideoStream] Data after XML: ${l.length} bytes, first 32 bytes: ${l.subarray(0,Math.min(32,l.length)).toString("hex")}`),r.dumpEnabled&&ie(r),r.dumpBcMedia&&this.dumpChunkIdx<200){const e=r.dumpDir,t=String(this.dumpChunkIdx).padStart(4,"0"),s=c.join(e,`bcmedia_chunk_${t}.bin`),n=c.join(e,"bcmedia_info.json"),A=Buffer.from(l),i=0===this.dumpChunkIdx,o=i?JSON.stringify({note:"Chunks fed into the BcMedia decoder (after XML stripping/alignment).",profile:this.profile,channel:this.channel,encKind:this.client.enc.kind},null,2):"";this.dumpIo.enqueue((async()=>{await a.promises.writeFile(s,A),i&&await a.promises.writeFile(n,o)})),this.dumpChunkIdx++}const h=this.bcMediaCodec.decode(l);t+=h.length;const g=new Map;for(const e of h)g.set(e.type,(g.get(e.type)||0)+1);if(e<=10||e%20==0){const s=this.bcMediaCodec.getRemainingBuffer(),r=Array.from(g.entries()).map((([e,t])=>`${e}:${t}`)).join(", ");n&&this.logger?.log(`[BaichuanVideoStream] Frame #${e}: dataToParse=${l.length} bytes, parsed ${h.length} BcMedia packets (${r||"none"}), total: ${t}, remaining buffer: ${s.length} bytes`)}let d=0,u=0;for(const t of h){const s=(e,t,s)=>{if("H264"===s){const t=Se(e);for(const e of t){const t=31&(e[0]??0);if(7===t){const t=ze(e);if(null!=t){if(!o(e))continue;this.spsById.set(t,e),r.debugParamSets&&this.logger?.warn(`[BaichuanVideoStream] Cached H.264 SPS id=${t} len=${e.length}`)}o(e)&&(this.lastSps=e)}if(8===t){const t=Xe(e);if(t){const s=this.spsById.get(t.spsId);if(s&&!o(s))continue;this.ppsById.set(t.ppsId,{nal:e,spsId:t.spsId}),r.debugParamSets&&this.logger?.warn(`[BaichuanVideoStream] Cached H.264 PPS id=${t.ppsId} (spsId=${t.spsId}) len=${e.length}`)}this.lastPps=e}}}else if("H265"===s){const t=Oe(e);t&&(this.lastVps=t,r.debugParamSets&&this.logger?.warn(`[BaichuanVideoStream] Cached H.265 VPS len=${t.length}`));const s=Ge(e);s&&(this.lastSpsH265=s,r.debugParamSets&&this.logger?.warn(`[BaichuanVideoStream] Cached H.265 SPS len=${s.length}`));const n=Je(e);n&&(this.lastPpsH265=n,r.debugParamSets&&this.logger?.warn(`[BaichuanVideoStream] Cached H.265 PPS len=${n.length}`))}},A=(e,t)=>{if("H264"===t){const t=Se(e);if(0===t.length)return e;const s=t.map((e=>31&(e[0]??0)));if(s.includes(7)&&s.includes(8))return e;if(!s.some((e=>1===e||5===e||19===e||20===e)))return e;let n=null;for(const e of t){const t=31&(e[0]??0);if(1===t||5===t){n=je(e);break}}if(r.debugParamSets&&this.logger?.warn(`[BaichuanVideoStream] Slice references ppsId=${n??"?"} lastPrepended=${this.lastPrependedPpsId??"?"}`),null==n||n>255)return null!=this.lastPrependedPpsId?e:this.lastSps&&this.lastPps?(this.lastPrependedPpsId=-1,Buffer.concat([We,this.lastSps,We,this.lastPps,e])):e;if(this.lastPrependedPpsId===n)return e;const A=this.ppsById.get(n);if(A){const t=this.spsById.get(A.spsId);if(t)return this.lastPrependedPpsId=n,Buffer.concat([We,t,We,A.nal,e])}return Buffer.alloc(0)}if("H265"===t){const t=He(e);if(0===t.length)return e;const s=t.map((e=>Pe(e))).filter((e=>null!==e));if(s.includes(32)&&s.includes(33)&&s.includes(34))return e;return s.some((e=>e>=0&&e<=9||e>=16&&e<=23))?this.lastPrependedParamSetsH265?e:this.lastVps&&this.lastSpsH265&&this.lastPpsH265?(this.lastPrependedParamSetsH265=!0,r.debugParamSets&&this.logger?.warn("[BaichuanVideoStream] Prepending H.265 VPS/SPS/PPS to frame"),Buffer.concat([We,this.lastVps,We,this.lastSpsH265,We,this.lastPpsH265,e])):e:e}return e},i=(e,t,s)=>{if(r.dumpNals)try{r.dumpEnabled&&ie(r);const n=r.dumpDir,A=Se(e),i=A.map((e=>31&(e[0]??0)));let o=null;const l=[],h=[];for(const e of A){const t=31&(e[0]??0);if(1!==t&&5!==t||null!=o||(o=je(e)),7===t){const t=ze(e);null!=t&&l.push(t)}if(8===t){const t=Xe(e);t&&h.push(t.ppsId)}}if(this.dumpNalLines>=2e4)return;const g=JSON.stringify({label:t,microseconds:s,len:e.length,nalTypes:i,slicePpsId:o,auSpsIds:l,auPpsIds:h,cachedSps:this.spsById.size,cachedPps:this.ppsById.size,lastPrependedPpsId:this.lastPrependedPpsId})+"\n";this.dumpNalLines++;const d=c.join(n,"nal_dump.ndjson");this.dumpIo.enqueue((async()=>{await a.promises.appendFile(d,g)}))}catch{}},o=e=>{if(e.length<4)return!1;if(7!=(31&(e[0]??0)))return!1;const t=e[1]??0,s=e[3]??0;return!!new Set([66,77,88,100,110,122,244]).has(t)&&!(0===s||s>255)};if("Iframe"===t.type){const o="H265"===t.videoType?Ue(t.data):we(t.data),l=!0;s(o,"Iframe",t.videoType);const h=A(o,t.videoType);if(0===h.length)continue;if(i(h,"Iframe",t.microseconds),"H264"===t.videoType){if(!De(h)||!be(h)){r.debugH264&&this.logger?.warn(`[BaichuanVideoStream] Dropping invalid H.264 Iframe (Annex-B) len=${h.length}`);continue}}else if("H265"===t.videoType){if(!Ye(h)){r.debugH264&&this.logger?.warn(`[BaichuanVideoStream] Dropping invalid H.265 Iframe (Annex-B) len=${h.length}`);continue}Ve(h)||r.debugH264&&this.logger?.warn(`[BaichuanVideoStream] H.265 Iframe missing VPS/SPS/PPS or IRAP, but continuing len=${h.length}`)}if(r.debugH264&&!this.debugSavedSamples)try{const e=r.dumpDir;a.mkdirSync(e,{recursive:!0}),"Iframe"===t.type&&pe(o)&&a.writeFileSync(c.join(e,"iframe_annexb.bin"),o)}catch{}if(!this.warnedNonAnnexBOnce&&!pe(o)){this.warnedNonAnnexBOnce=!0;const e=t.data,s=e.subarray(0,Math.min(24,e.length)).toString("hex"),r=o.subarray(0,Math.min(24,o.length)).toString("hex");this.logger?.warn(`[BaichuanVideoStream] WARNING: non-AnnexB frame after conversion (${t.type} ${t.videoType}) len=${e.length} head=${s} convertedLen=${o.length} convertedHead=${r}`)}if(this.emit("videoFrame",h),this.emit("videoAccessUnit",{data:h,isKeyframe:l,videoType:t.videoType,microseconds:t.microseconds,..."Iframe"===t.type&&"time"in t&&void 0!==t.time?{time:t.time}:{}}),d++,e<=5||d<=5){const e=pe(o)?"yes":"no";n&&this.logger?.log(`[BaichuanVideoStream] Emitted ${t.type} (${t.videoType}) ${t.data.length} bytes -> ${o.length} bytes (Annex-B, startCode:${e})`)}}else if("Pframe"===t.type){const e=t.data,n=pe(e)?e:"H265"===t.videoType?Ue(e):we(e),o=pe(n)?[n]:"H265"===t.videoType?this.depacketizerH265.push(e):this.depacketizer.push(e);if(0===o.length)continue;for(const e of o){s(e,"Pframe",t.videoType);const n=A(e,t.videoType);if(0===n.length)continue;const o=n;i(o,"Pframe",t.microseconds);if("H265"===t.videoType?Ye(o):De(o))this.emit("videoFrame",o),this.emit("videoAccessUnit",{data:o,isKeyframe:!1,videoType:t.videoType,microseconds:t.microseconds}),d++;else if(r.debugH264&&this.debugH264LogsLeft>0){this.debugH264LogsLeft--;const e=o.subarray(0,Math.min(24,o.length)).toString("hex");this.logger?.warn(`[BaichuanVideoStream] Dropping invalid Pframe (${t.videoType}): len=${o.length} head=${e}`)}}}"Aac"!==t.type&&"Adpcm"!==t.type||(u++,this.emit("audioFrame",t.data)),"InfoV1"===t.type||t.type}if((e<=10||e%20==0&&(d>0||u>0))&&n&&this.logger?.log(`[BaichuanVideoStream] Frame #${e}: emitted ${d} video frames, ${u} audio frames`),(d>0||u>0)&&this.noteMediaActivity(),d>0&&(e<=10||e%50==0)){}},this.client.on("push",this.videoFrameHandler),this.active=!0,this.lastMediaAtMs=Date.now(),this.startWatchdog()}async stop(){if(this.active){if(this.stopWatchdog(),this.depacketizer.reset(),this.depacketizerH265.reset(),this.videoFrameHandler&&this.client.removeListener("push",this.videoFrameHandler),this.videoFrameHandler=void 0,this.bcMediaCodec.clear(),this.activeMsgNum=void 0,this.api)try{await this.api.stopVideoStream(this.channel,this.profile)}catch(e){this.emit("error",e instanceof Error?e:new Error(String(e)))}this.active=!1,this.emit("close")}}isActive(){return this.active}};async function*Ke(e,t,s){const r=new Ze({client:e.client,api:e,channel:t,profile:s,logger:e.logger});let n=null,A=null,i=null,o=!1,a=!1;const c=e=>{a=!0},l=()=>{a=!0};try{await r.start(),r.on("error",c),r.on("close",l);const e=new Promise((e=>{const t=s=>{s.isKeyframe&&!n&&(n={sps:null,pps:null},r.removeListener("videoAccessUnit",t),e(n))};r.on("videoAccessUnit",t),setTimeout((()=>{n||(n={sps:null,pps:null},r.removeListener("videoAccessUnit",t),e(n))}),5e3)}));await Promise.race([e,new Promise((e=>setTimeout(e,5e3)))]);const t=[],s=200;let h=null;for(r.on("videoAccessUnit",(e=>{a||(t.push({audio:!1,data:e.data,codec:null,sampleRate:null,microseconds:e.microseconds,videoType:e.videoType}),t.length>s&&t.splice(0,t.length-s),h&&(h(),h=null))})),r.on("audioFrame",(e=>{a||(A||(A="aac",i=8e3),t.push({audio:!0,data:e,codec:A,sampleRate:i,microseconds:null}),t.length>s&&t.splice(0,t.length-s),h&&(h(),h=null))})),o=!0;!a;)if(t.length>0){const e=t.shift();yield e}else await new Promise((e=>{h=e,setTimeout((()=>{h===e&&(h=null,e())}),1e3)}))}finally{a=!0;try{await r.stop()}catch{}r.removeListener("error",c),r.removeListener("close",l)}}var et=class{key;transport;videoType;keepAliveTimer;constructor(e,t){this.transport=e,this.videoType=t,this.key=function(e,t){return`${e}-${"H264"===t?"h264":"h265"}`}(e,t)}async startKeepAlive(e){this.stopKeepAlive(),e.client.getTransport()}stopKeepAlive(){this.keepAliveTimer&&(clearInterval(this.keepAliveTimer),this.keepAliveTimer=void 0)}},tt=Buffer.from([0,0,0,1]);function st(...e){const t=e.filter((e=>!!e&&e.length>0));if(0===t.length)return null;const s=[];for(const e of t)s.push(tt,e);return Buffer.concat(s)}var rt=class extends et{ffmpegFormat="h264";sdpCodec="H264";sps=null;pps=null;constructor(e){super(e,"H264")}extractParameterSets(e){const t=Se(e);for(const e of t){if(e.length<1)continue;const t=31&(e[0]??0);if(7!==t||this.sps||(this.sps=e),8!==t||this.pps||(this.pps=e),this.sps&&this.pps)break}}getFmtp(){let e="packetization-mode=1";if(this.sps&&this.sps.length>=4){e+=`;profile-level-id=${Buffer.from([this.sps[1],this.sps[2],this.sps[3]]).toString("hex")}`}return this.sps&&this.pps?(e+=`;sprop-parameter-sets=${this.sps.toString("base64")},${this.pps.toString("base64")}`,{fmtp:e,hasParamSets:!0}):{fmtp:e,hasParamSets:!1}}getParameterSetsAnnexB(){return st(this.sps,this.pps)}},nt=class extends et{ffmpegFormat="hevc";sdpCodec="H265";vps=null;sps=null;pps=null;constructor(e){super(e,"H265")}extractParameterSets(e){const t=Oe(e),s=Ge(e),r=Je(e);t&&!this.vps&&(this.vps=t),s&&!this.sps&&(this.sps=s),r&&!this.pps&&(this.pps=r)}getFmtp(){let e="";return this.vps&&this.sps&&this.pps?(e=`sprop-vps=${this.vps.toString("base64")};sprop-sps=${this.sps.toString("base64")};sprop-pps=${this.pps.toString("base64")}`,{fmtp:e,hasParamSets:!0}):{fmtp:e,hasParamSets:!1}}getParameterSetsAnnexB(){return st(this.vps,this.sps,this.pps)}};function At(e,t){return"H264"===t?new rt(e):new nt(e)}var it=class{maxItems;queue=[];waiting;closed=!1;constructor(e){this.maxItems=Math.max(1,0|e)}push(e){if(!this.closed){if(this.waiting){const{resolve:t}=this.waiting;return this.waiting=void 0,void t({value:e,done:!1})}this.queue.push(e),this.queue.length>this.maxItems&&this.queue.splice(0,this.queue.length-this.maxItems)}}close(){if(!this.closed&&(this.closed=!0,this.waiting)){const{resolve:e}=this.waiting;this.waiting=void 0,e({value:void 0,done:!0})}}async next(){if(this.closed)return{value:void 0,done:!0};const e=this.queue.shift();return void 0!==e?{value:e,done:!1}:await new Promise((e=>{this.waiting={resolve:e}}))}},ot=class{opts;queues=new Map;source=null;running=!1;pumpPromise=null;constructor(e){this.opts=e}start(){this.running||(this.running=!0,this.source=this.opts.createSource(),this.pumpPromise=(async()=>{try{for await(const e of this.source){try{this.opts.onFrame?.(e)}catch{}for(const t of this.queues.values())t.push(e)}}catch(e){this.opts.onError?.(e)}finally{for(const e of this.queues.values())e.close();this.queues.clear()}})())}subscribe(e){const t=new it(this.opts.maxQueueItems);this.queues.set(e,t);const s=this;return async function*(){try{for(;;){const e=await t.next();if(e.done)return;yield e.value}}finally{t.close(),s.queues.delete(e)}}()}async stop(){if(!this.running)return;this.running=!1;const e=this.source;this.source=null;for(const e of this.queues.values())e.close();this.queues.clear();try{await(e?.return(void 0))}catch{}try{await this.pumpPromise}catch{}this.pumpPromise=null}};var at=class e extends n.EventEmitter{api;channel;profile;listenHost;listenPort;path;logger;tcpRtpFraming;active=!1;flow;connectedClients=new Set;nativeStreamActive=!1;clientConnectionServer;streamMetadata=null;clientResources=new Map;isRtspDebugEnabled(){return this.api.client.getDebugConfig().debugRtsp||function(e,t){if(null==e)return t;const s=e.trim().toLowerCase();return"1"===s||"true"===s||"yes"===s||"on"===s||"0"!==s&&"false"!==s&&"no"!==s&&"off"!==s&&t}(process.env.BAICHUAN_DEBUG_RTSP,!1)}rtspDebugLog(e){this.isRtspDebugEnabled()&&this.logger.debug(`[BaichuanRtspServer] ${e}`)}firstFramePromise=null;firstFrameResolve=null;firstFrameReceived=!1;firstAudioPromise=null;firstAudioResolve=null;firstAudioDetected=!1;hasAudio=!1;audioInfo=null;audioPrimingFrame=null;tempStreamGenerator=null;nativeFanout=null;noClientAutoStopTimer;static isAdtsAacFrame(e){return e.length>=2&&255===e[0]&&!(240&~e[1])}static parseAdtsSamplingInfo(t){if(t.length<7)return null;if(!e.isAdtsAacFrame(t))return null;const s=t[2]>>2&15,r=[96e3,88200,64e3,48e3,44100,32e3,24e3,22050,16e3,12e3,11025,8e3,7350][s]??null;if(!r)return null;const n=(1&t[2])<<2|t[3]>>6&3,A=0===n?1:n,i=(t[2]>>6&3)+1<<11|s<<7|n<<3;return{sampleRate:r,channels:A,configHex:Buffer.from([i>>8&255,255&i]).toString("hex")}}static parseInterleavedChannels(e){const t=e.match(/interleaved\s*=\s*(\d+)\s*-\s*(\d+)/i);if(!t)return null;const s=Number.parseInt(t[1],10),r=Number.parseInt(t[2],10);return Number.isFinite(s)&&Number.isFinite(r)?{rtp:s,rtcp:r}:null}static splitAnnexBNals(e){const t=[],s=e.length,r=t=>{if(t+3<=s&&0===e[t]&&0===e[t+1]){if(1===e[t+2])return 3;if(t+4<=s&&0===e[t+2]&&1===e[t+3])return 4}return 0};let n=0;for(;n<s;){if(r(n))break;n++}for(;n<s;){const A=r(n);if(!A){n++;continue}const i=n+A;let o=i;for(;o<s;){if(r(o))break;o++}if(i<o){const s=e.subarray(i,o);s.length>0&&t.push(s)}n=o}return t}static stripAdtsHeader(t){if(!e.isAdtsAacFrame(t))return null;if(t.length<7)return null;const s=!(1&~t[1])?7:9;return t.length<=s?null:t.subarray(s)}constructor(e){super(),this.api=e.api,this.channel=e.channel,this.profile=e.profile,this.listenHost=e.listenHost??"127.0.0.1",this.listenPort=e.listenPort??8554,this.path=e.path??`/stream/${this.profile}`,this.logger=e.logger??console,this.tcpRtpFraming=e.tcpRtpFraming??"rfc4571";const t=this.api.client.getTransport();this.flow=At(t,"H264")}clearNoClientAutoStopTimer(){this.noClientAutoStopTimer&&(clearTimeout(this.noClientAutoStopTimer),this.noClientAutoStopTimer=void 0)}setFlowVideoType(e,t){if(this.flow.videoType===e)return;const s=this.api.client.getTransport();this.flow.stopKeepAlive(),this.flow=At(s,e),this.rtspDebugLog(`Using RTSP flow ${this.flow.key} (${t})`)}async start(){if(this.active)throw new Error("RTSP server is already active");try{const e=(await this.api.getStreamMetadata(this.channel)).streams.find((e=>e.profile===this.profile));if(e){this.streamMetadata={frameRate:e.frameRate||25,width:e.width,height:e.height};const t=String(e.videoEncType??"").trim().toLowerCase(),s=t.includes("265")||t.includes("hevc")?"H265":"H264";this.setFlowVideoType(s,"metadata")}}catch(e){this.logger.warn(`[BaichuanRtspServer] Could not get stream metadata: ${e}`),this.streamMetadata={frameRate:25,width:1920,height:1080},this.setFlowVideoType("H264","metadata unavailable")}this.clientConnectionServer=A.createServer((e=>{this.handleRtspConnection(e)})),await new Promise(((e,t)=>{this.clientConnectionServer.listen(this.listenPort,this.listenHost,(()=>{const t=this.clientConnectionServer.address();t&&"object"==typeof t&&"port"in t&&(this.listenPort=t.port),e()})),this.clientConnectionServer.on("error",(e=>{t(e)}))})),this.active=!0,this.logger.info(`[BaichuanRtspServer] RTSP server started on ${this.listenHost}:${this.listenPort}, path: ${this.path}`)}handleRtspConnection(t){const s=`${t.remoteAddress}:${t.remotePort}`;this.logger.info(`[BaichuanRtspServer] RTSP client connected: ${s}`);let r,n="",A=Buffer.alloc(0),i=!1,o=null,a=null;const c=()=>{this.removeClient(s);const e=this.clientResources.get(s);if(e){if(e.ffmpeg)try{e.ffmpeg.stdin?.end(),e.ffmpeg.kill("SIGTERM"),setTimeout((()=>{try{e.ffmpeg?.kill("SIGKILL")}catch{}}),1e3)}catch{}if(e.udpSocket)try{e.udpSocket.close()}catch{}if(e.udpSocketAudio)try{e.udpSocketAudio.close()}catch{}if(e.rtspSocket&&!e.rtspSocket.destroyed)try{e.rtspSocket.destroy()}catch{}this.clientResources.delete(s)}if(r){try{r.stdin?.end(),r.kill("SIGTERM"),setTimeout((()=>{try{r?.kill("SIGKILL")}catch{}}),1e3)}catch{}r=void 0}if(o){try{o.close()}catch{}o=null}if(a){try{a.close()}catch{}a=null}};t.on("close",c),t.on("error",(e=>{e&&"object"==typeof e&&"code"in e&&"EPIPE"!==e.code&&this.logger.error("[BaichuanRtspServer] RTSP client error:",e),c()})),t.on("data",(async l=>{for(A=Buffer.concat([A,l]);A.includes("\r\n\r\n");){const l=A.indexOf("\r\n\r\n"),h=A.subarray(0,l).toString();if(A=A.subarray(l+4),!h.trim())continue;const g=h.split("\r\n"),d=g[0]?.split(" ");if(!d||d.length<3)continue;const u=d[0],E=d[1],I=d[2],C=h.match(/CSeq:\s*(\d+)/i),B=C?parseInt(C[1]??"0",10):0,Q=(e,s,r={},n)=>{let A=`${I} ${e} ${s}\r\n`;A+=`CSeq: ${B}\r\n`;for(const[e,t]of Object.entries(r))A+=`${e}: ${t}\r\n`;n&&(A+=`Content-Length: ${Buffer.byteLength(n,"utf8")}\r\n`),A+="\r\n",n&&(A+=n),t.write(A)};if(this.rtspDebugLog(`RTSP ${u} ${E}`),"OPTIONS"===u)Q(200,"OK",{Public:"DESCRIBE, SETUP, TEARDOWN, PLAY, PAUSE, OPTIONS"});else if("DESCRIBE"===u){if(!this.firstFrameReceived&&0===this.connectedClients.size){try{this.nativeStreamActive||await this.startNativeStream()}catch(e){this.logger.warn(`[BaichuanRtspServer] Failed to start native stream for SDP priming: ${e}`)}const{hasParamSets:e}=this.flow.getFmtp();if(!e){const e="udp"===this.api.client.getTransport()?4e3:1500;try{await Promise.race([this.firstFramePromise||Promise.resolve(),new Promise((t=>setTimeout(t,e)))])}catch{}}}{const{fmtp:e,hasParamSets:t}=this.flow.getFmtp(),r=e.length>160?`${e.slice(0,160)}...`:e;this.logger.info(`[BaichuanRtspServer] DESCRIBE SDP for ${s} path=${this.path} codec=${this.flow.sdpCodec} hasParamSets=${t} fmtp=${r}`),t||this.rtspDebugLog(`DESCRIBE responding without parameter sets yet (client=${s}, path=${this.path}, flow=${this.flow.key})`)}const e=this.generateSdp();Q(200,"OK",{"Content-Type":"application/sdp","Content-Base":`rtsp://${this.listenHost}:${this.listenPort}${this.path}/`},e)}else if("SETUP"===u){const A=E?.includes("track0"),c=E?.includes("track1");if(!A&&!c){Q(404,"Not Found",{Session:n||`session_${Date.now()}_${Math.random().toString(36).substring(7)}`});continue}if(c&&!this.hasAudio){Q(404,"Not Found",{Session:n||`session_${Date.now()}_${Math.random().toString(36).substring(7)}`});continue}this.connectedClients.add(s),this.emit("client",s),this.clearNoClientAutoStopTimer(),1!==this.connectedClients.size||this.nativeStreamActive||await this.startNativeStream();const l=h.match(/Transport:\s*([^\r\n]+)/i),g=(l?.[1]??"").trim();i=!g||(g.includes("TCP")||g.includes("tcp")),n||(n=`session_${Date.now()}_${Math.random().toString(36).substring(7)}`);const d=this.clientResources.get(s);if(d?d.rtspSocket=t:this.clientResources.set(s,{ffmpeg:void 0,udpSocket:null,udpSocketAudio:null,rtspSocket:t,pipelineStarted:!1,seenFirstVideoKeyframe:!1,setupTrack0:!1,setupTrack1:!1,isPlaying:!1}),i){const t=this.clientResources.get(s),r=e.parseInterleavedChannels(g);if(t)if(c){const e=r??{rtp:2,rtcp:3};t.track1RtpChannel=e.rtp,t.track1RtcpChannel=e.rtcp}else{const e=r??{rtp:0,rtcp:1};t.track0RtpChannel=e.rtp,t.track0RtcpChannel=e.rtcp}}{const e=this.clientResources.get(s);e&&!e.pipelineStarted&&(e.pipelineStarted=!0,await this.startClientFfmpeg(s,t,i,((e,t,n)=>{r=e,o=t,a=n;const A=this.clientResources.get(s);A&&(A.ffmpeg=e,A.udpSocket=t,A.udpSocketAudio=n)})))}{const e=this.clientResources.get(s);e&&(c?e.setupTrack1=!0:e.setupTrack0=!0,this.rtspDebugLog(`SETUP done for ${s}: track0=${!!e.setupTrack0} track1=${!!e.setupTrack1} playing=${!!e.isPlaying}`))}if(i){const e=this.clientResources.get(s),t=c?{rtp:2,rtcp:3}:{rtp:0,rtcp:1};Q(200,"OK",{Transport:`RTP/AVP/TCP;unicast;interleaved=${`${c?e?.track1RtpChannel??t.rtp:e?.track0RtpChannel??t.rtp}-${c?e?.track1RtcpChannel??t.rtcp:e?.track0RtcpChannel??t.rtcp}`}`,Session:n})}else Q(200,"OK",{Transport:"RTP/AVP/UDP;unicast;client_port=5004-5005;server_port=5004-5005",Session:n})}else if("PLAY"===u){{const e=this.clientResources.get(s);e&&(e.isPlaying=!0,this.rtspDebugLog(`PLAY for ${s}: track0=${!!e.setupTrack0} track1=${!!e.setupTrack1} playing=${!!e.isPlaying}`))}Q(200,"OK",{Session:n,Range:"npt=0.000-"})}else"TEARDOWN"===u?(c(),Q(200,"OK",{Session:n}),t.end()):Q(501,"Not Implemented")}}))}generateSdp(){const e=this.flow.sdpCodec;let t="v=0\r\n";t+=`o=- ${Date.now()} ${Date.now()} IN IP4 ${this.listenHost}\r\n`,t+="s=Baichuan Stream\r\n",t+=`c=IN IP4 ${this.listenHost}\r\n`,t+="t=0 0\r\n",t+="m=video 0 RTP/AVP 96\r\n",t+=`a=rtpmap:96 ${e}/90000\r\n`,this.streamMetadata?.frameRate&&(t+=`a=framerate:${this.streamMetadata.frameRate}\r\n`),this.streamMetadata?.width&&this.streamMetadata?.height&&(t+=`a=framesize:96 ${this.streamMetadata.width}-${this.streamMetadata.height}\r\n`),t+="a=control:track0\r\n";const{fmtp:s,hasParamSets:r}=this.flow.getFmtp();if(r||this.logger.warn(`[BaichuanRtspServer] SDP missing parameter sets for flow ${this.flow.key}`),s&&(t+=`a=fmtp:96 ${s}\r\n`),this.hasAudio){t+="m=audio 0 RTP/AVP 97\r\n";const e=this.audioInfo,s=e?.sampleRate??8e3,r=e?.channels??1,n=e?.configHex??"";t+=`a=rtpmap:97 mpeg4-generic/${s}/${r}\r\n`,n&&(t+=`a=fmtp:97 streamtype=5; profile-level-id=15; mode=AAC-hbr; config=${n}; SizeLength=13; IndexLength=3; IndexDeltaLength=3;\r\n`),t+="a=control:track1\r\n"}return t+="a=setup:passive\r\n",t+="a=connection:new\r\n",t}async startClientFfmpeg(t,s,r,n){let A=this.streamMetadata;if(!A||!A.frameRate)try{const e=(await this.api.getStreamMetadata(this.channel)).streams.find((e=>e.profile===this.profile));e&&(A={frameRate:e.frameRate||25,width:e.width,height:e.height},this.rtspDebugLog(`Fetched metadata for profile ${this.profile}: ${A.frameRate} fps`))}catch(e){this.logger.warn(`[BaichuanRtspServer] Could not fetch stream metadata: ${e}`),A={frameRate:25,width:1920,height:1080}}const o=this.flow.ffmpegFormat;let a=0,c=0,l=null,g=null;const d=r,u=(e,t)=>{if("rfc4571"===(r?"rtsp-interleaved":this.tcpRtpFraming)){const e=Buffer.alloc(2);return e.writeUInt16BE(65535&t.length,0),Buffer.concat([e,t])}const s=Buffer.alloc(4);return s[0]=36,s[1]=255&e,s[2]=t.length>>8&255,s[3]=255&t.length,Buffer.concat([s,t])};if(r&&!d){a=5e4+Math.floor(1e4*Math.random()),l=i.createSocket("udp4"),await new Promise(((e,t)=>{l.once("listening",(()=>e())),l.once("error",t),l.bind(a,"127.0.0.1")}));const e=(e,r)=>{if(!s||s.destroyed||!s.writable)return!1;if(r.length<12)return!1;if(2!==(r[0]>>6&3))return!1;const n=this.clientResources.get(t);if(!n?.isPlaying)return!1;const A=n?.track0RtpChannel??0,i=n?.track1RtpChannel??2;if(e===A&&!n?.setupTrack0)return!1;if(e===i&&!n?.setupTrack1)return!1;try{return s.write(u(e,r))}catch(e){if(e&&"object"==typeof e&&"code"in e&&"EPIPE"===e.code)return!1}return!1};if(l){const s=this.clientResources.get(t),r=s?.track0RtpChannel??0;let n=0,A=!1,i=!1;l.on("message",(s=>{A||(A=!0,this.rtspDebugLog(`First video RTP packet received from ffmpeg for client ${t} (len=${s.length})`));e(r,s)&&!i&&(i=!0,this.rtspDebugLog(`First video RTP packet forwarded via TCP interleaved for client ${t}`)),n++,n%1e3==0&&this.rtspDebugLog(`Forwarded ${n} RTP packets to client ${t} via TCP interleaved`)}))}if(this.hasAudio){c=a+2+2*Math.floor(1e3*Math.random()),g=i.createSocket("udp4"),await new Promise(((e,t)=>{g.once("listening",(()=>e())),g.once("error",t),g.bind(c,"127.0.0.1")}));let s=0,r=!1,n=!1;g.on("message",(A=>{const i=this.clientResources.get(t),o=i?.track1RtpChannel??2;s++,r||(r=!0,this.rtspDebugLog(`First audio RTP packet received from ffmpeg for client ${t} (len=${A.length})`));e(o,A)&&!n&&(n=!0,this.rtspDebugLog(`First audio RTP packet forwarded via TCP interleaved for client ${t}`)),s%1e3==0&&this.rtspDebugLog(`Forwarded ${s} audio RTP packets to client ${t} via TCP interleaved`)}))}}const E=this.clientResources.get(t),I=this.isRtspDebugEnabled(),C=e=>this.rtspDebugLog(e),B=(e,t)=>{if(!s||s.destroyed||!s.writable)return!1;try{return s.write(u(e,t))}catch(e){if(e&&"object"==typeof e&&"code"in e&&"EPIPE"===e.code)return!1}return!1},Q=(e,t,s,r,n)=>{const A=Buffer.alloc(12);return A[0]=128,A[1]=(t?128:0)|127&e,A.writeUInt16BE(65535&s,2),A.writeUInt32BE(r>>>0,4),A.writeUInt32BE(n>>>0,8),A},p=(e,t,s)=>{const r=e?97:96;if(E?.isPlaying&&(!e||E?.setupTrack1)&&(e||E?.setupTrack0))if(e){void 0===E.rtpAudioSeq&&(E.rtpAudioSeq=Math.floor(65536*Math.random())),void 0===E.rtpAudioTimestamp&&(E.rtpAudioTimestamp=0),void 0===E.rtpAudioSsrc&&(E.rtpAudioSsrc=4294967295*Math.random()>>>0);const e=Q(r,s,E.rtpAudioSeq,E.rtpAudioTimestamp,E.rtpAudioSsrc);E.rtpAudioSeq=E.rtpAudioSeq+1&65535,B(E?.track1RtpChannel??2,Buffer.concat([e,t]))}else{void 0===E.rtpVideoSeq&&(E.rtpVideoSeq=Math.floor(65536*Math.random())),void 0===E.rtpVideoTimestamp&&(E.rtpVideoTimestamp=0),void 0===E.rtpVideoSsrc&&(E.rtpVideoSsrc=4294967295*Math.random()>>>0);const e=Q(r,s,E.rtpVideoSeq,E.rtpVideoTimestamp,E.rtpVideoSsrc);E.rtpVideoSeq=E.rtpVideoSeq+1&65535,B(E?.track0RtpChannel??0,Buffer.concat([e,t]))}},f=1200,m=t=>{const s=e.splitAnnexBNals(t);for(const e of s){if(e.length<1)continue;if(5===(31&(e[0]??0)))return!0}return!1},y=(e,t)=>{if(e.length<=f)return void p(!1,e,t);const s=e[0],r=31&s,n=224&s|28,A=e.subarray(1);let i=0;for(;i<A.length;){const e=A.length-i,s=Math.min(e,1198),o=0===i,a=i+s>=A.length,c=(o?128:0)|(a?64:0)|r,l=A.subarray(i,i+s),h=Buffer.concat([Buffer.from([n,c]),l]);p(!1,h,t&&a),i+=s}},w=(e,t)=>{if(e.length<=f)return void p(!1,e,t);if(e.length<3)return;const s=e[0],r=s>>1&63,n=129&s|98,A=e[1],i=e.subarray(2);let o=0;for(;o<i.length;){const e=i.length-o,s=Math.min(e,1197),a=0===o,c=o+s>=i.length,l=(a?128:0)|(c?64:0)|63&r,h=i.subarray(o,o+s),g=Buffer.concat([Buffer.from([n,A,l]),h]);p(!1,g,t&&c),o+=s}},S=A?.frameRate&&A.frameRate>0?A.frameRate:25,D=Math.max(1,Math.round(9e4/S)),b=e=>{if(!E)return;if(null==e)return;if(!Number.isFinite(e))return;if(void 0===E.rtpVideoTimestamp&&(E.rtpVideoTimestamp=0),void 0===E.rtpVideoBaseTimestamp&&(E.rtpVideoBaseTimestamp=E.rtpVideoTimestamp),void 0===E.rtpVideoBaseMicroseconds)return E.rtpVideoBaseMicroseconds=e>>>0,void(E.rtpVideoLastTimestamp=E.rtpVideoTimestamp);const t=(e>>>0)-(E.rtpVideoBaseMicroseconds>>>0)>>>0;let s=((E.rtpVideoBaseTimestamp??0)>>>0)+Math.round(9e4*t/1e6)>>>0;const r=E.rtpVideoLastTimestamp;void 0!==r&&s<=r>>>0&&(s=1+(r>>>0)>>>0),E.rtpVideoTimestamp=s,E.rtpVideoLastTimestamp=s},v=(t,s,r=!0)=>{const n=e.splitAnnexBNals(s);if(0!==n.length){for(let e=0;e<n.length;e++){const s=n[e],r=e===n.length-1;"H265"===t?w(s,r):y(s,r)}r&&void 0!==E?.rtpVideoTimestamp&&void 0===E?.rtpVideoBaseMicroseconds&&(E.rtpVideoTimestamp=E.rtpVideoTimestamp+D>>>0)}},N=t=>{const s=e.stripAdtsHeader(t);if(!s)return;const r=Buffer.from([0,16]),n=8191&s.length,A=Buffer.alloc(2);A[0]=n>>5&255,A[1]=(31&n)<<3;const i=Buffer.concat([r,A,s]);p(!0,i,!0),void 0!==E?.rtpAudioTimestamp&&(E.rtpAudioTimestamp=E.rtpAudioTimestamp+1024>>>0)},R=e=>{const t=He(e);for(const e of t){if(e.length<2)continue;const t=e[0];if(void 0===t)continue;if(128&t)continue;if(xe(t>>1&63))return!0}return!1};let k,T;if(d&&n(void 0,null,null),!d){const e=["-hide_banner","-loglevel","error","-fflags","+genpts+igndts"],s=A?.frameRate||25;if(s>0&&(e.push("-r",s.toString()),this.rtspDebugLog(`Using frame rate ${s} fps for client ${t}`)),e.push("-f",o,"-i","pipe:0"),this.hasAudio&&e.push("-f","aac","-i","pipe:3"),r){if(e.push("-map","0:v:0","-c:v","copy","-vsync","cfr","-avoid_negative_ts","make_zero","-f","rtp","-payload_type","96",`rtp://127.0.0.1:${a}?pkt_size=1300`),this.hasAudio&&g&&c){const t=this.audioInfo,s=t?.sampleRate??8e3,r=t?.channels??1;e.push("-map","1:a:0","-c:a","aac","-profile:a","aac_low","-ar",String(s),"-ac",String(r),"-flags:a","+global_header","-f","rtp","-payload_type","97",`rtp://127.0.0.1:${c}?pkt_size=1300`)}}else e.push("-map","0:v:0","-c:v","copy","-vsync","cfr","-avoid_negative_ts","make_zero","-f","rtp","-payload_type","96","rtp://127.0.0.1:5004?pkt_size=1300");const i=["pipe","ignore","pipe"];this.hasAudio&&i.push("pipe"),this.rtspDebugLog(`Spawning ffmpeg for client ${t}: ffmpeg ${e.join(" ")}`),k=(0,h.spawn)("ffmpeg",e,{stdio:i});try{const e=this.flow.getParameterSetsAnnexB();e&&e.length>0&&k?.stdin&&(k.stdin.write(e),this.rtspDebugLog(`Wrote video parameter sets to ffmpeg stdin for client ${t} (len=${e.length})`))}catch(e){this.logger.warn(`[BaichuanRtspServer] Failed to write video parameter sets to ffmpeg for client ${t}: ${e}`)}if(k.on("error",(e=>{this.logger.error(`[BaichuanRtspServer] Failed to spawn ffmpeg for client ${t}:`,e)})),k.on("close",((e,s)=>{this.rtspDebugLog(`ffmpeg exited for client ${t} (code=${e}, signal=${s})`)})),n(k,l,g),k.stdin?.on("error",(e=>{const s=e?.code;"EPIPE"!==s&&"ERR_STREAM_WRITE_AFTER_END"!==s?this.logger.error(`[BaichuanRtspServer] FFmpeg stdin error for client ${t}:`,e):this.rtspDebugLog(`FFmpeg stdin error (${s}) for client ${t}`)})),T=this.hasAudio?k.stdio?.[3]:void 0,T?.on?.("error",(e=>{const s=e?.code;"EPIPE"!==s&&"ERR_STREAM_WRITE_AFTER_END"!==s?this.logger.error(`[BaichuanRtspServer] FFmpeg audio pipe error for client ${t}:`,e):this.rtspDebugLog(`FFmpeg audio pipe error (${s}) for client ${t}`)})),T&&this.audioPrimingFrame)try{T.write(this.audioPrimingFrame)}catch{}}this.rtspDebugLog(`Creating native stream iterator for client ${t}`);const F=this.nativeFanout?this.nativeFanout.subscribe(t):Ke(this.api,this.channel,this.profile);this.tempStreamGenerator=null;let M=0,U=Date.now();const L=A&&A.frameRate>0?1e3/A.frameRate:40;(async()=>{try{this.rtspDebugLog(`Starting to feed frames to client ${t} (target FPS: ${A?.frameRate||25}, interval: ${L}ms)`);let s=0,r=!1,n=!1,i=!1,o=!1,a=!1;for await(const A of F){if(!this.connectedClients.has(t)){this.rtspDebugLog(`Client ${t} disconnected, stopping frame feed`);break}const c=k?.stdin;if(!d&&(!c||c.destroyed||c.writableEnded||c.writableFinished)){this.rtspDebugLog(`FFmpeg stdin closed for client ${t}`);break}if(0===A.data.length)continue;if(!A.audio&&!i&&(i=!0,I)){const e=A.data.subarray(0,16).toString("hex");C(`First video frame received from generator for client ${t} (len=${A.data.length}, videoType=${String(A.videoType??this.flow.videoType)}, head=${e})`)}if(A.audio){if(s++,1===s&&this.rtspDebugLog(`Audio frames detected (codec: ${A.codec||"unknown"}, sampleRate: ${A.sampleRate||"unknown"})`),s%100==0&&this.rtspDebugLog(`Received ${s} audio frames (not sent to RTSP yet)`),d){if(!E?.seenFirstVideoKeyframe)continue;if(this.hasAudio&&e.isAdtsAacFrame(A.data)){if(I&&!n){n=!0;const e=A.data.subarray(0,16).toString("hex");C(`First audio ADTS frame packetized to RTP for client ${t} (len=${A.data.length}, head=${e})`)}N(A.data)}continue}if(this.hasAudio&&T&&!T.writableEnded&&!T.writableFinished){const s=T;if(!s)continue;if(e.isAdtsAacFrame(A.data))try{if(!n){n=!0;const e=A.data.subarray(0,16).toString("hex");this.rtspDebugLog(`First audio frame written to ffmpeg pipe for client ${t} (len=${A.data.length}, head=${e})`)}s.write(A.data)||await new Promise((e=>s.once("drain",(()=>e()))))}catch{}}continue}if("H264"===A.videoType||"H265"===A.videoType){const e="H264"===A.videoType?we(A.data):Ue(A.data);0===M&&this.setFlowVideoType(A.videoType,"first video frame");if(this.flow.getFmtp().hasParamSets)this.firstFrameReceived||this.markFirstFrameReceived();else{this.flow.extractParameterSets(e);this.flow.getFmtp().hasParamSets&&this.markFirstFrameReceived()}}M++,M%100==0&&this.rtspDebugLog(`Sent ${M} frames to client ${t} (frame size: ${A.data.length} bytes)`);const l=Date.now(),h=L-(l-U);if(h>0&&await new Promise((e=>setTimeout(e,Math.min(h,2*L)))),U=Date.now(),d){const e=A.videoType??this.flow.videoType,s="H264"===e?we(A.data):Ue(A.data);if(!E?.seenFirstVideoKeyframe)if("H265"===e){const{hasParamSets:r}=this.flow.getFmtp();if(!r){I&&!o&&(o=!0,C(`H265 gating: waiting for VPS/SPS/PPS before sending RTP to client ${t}`));continue}if(!E?.rtpSentVideoConfig){const t=this.flow.getParameterSetsAnnexB();t&&t.length>0&&(v(e,t,!1),E.rtpSentVideoConfig=!0)}E.h265WaitStartMs||(E.h265WaitStartMs=Date.now());const n=R(s),A=Date.now()-E.h265WaitStartMs;if(!n&&A<2e3){I&&!a&&(a=!0,C(`H265 gating: waiting for IRAP (or timeout) for client ${t}`));continue}E.seenFirstVideoKeyframe=!0}else{const{hasParamSets:r}=this.flow.getFmtp();if(!r){I&&!o&&(o=!0,C(`H264 gating: waiting for SPS/PPS before sending RTP to client ${t}`));continue}if(!E?.rtpSentVideoConfig){const t=this.flow.getParameterSetsAnnexB();t&&t.length>0&&(v(e,t,!1),E.rtpSentVideoConfig=!0)}if(!m(s))continue;E.seenFirstVideoKeyframe=!0}const n=A.microseconds;if(b(n),!E?.rtpSentVideoConfig){const t=this.flow.getParameterSetsAnnexB();t&&t.length>0&&(v(e,t,!1),E.rtpSentVideoConfig=!0)}if(!r&&(r=!0,I)){const e=A.data.subarray(0,16).toString("hex");C(`First video access unit packetized to RTP for client ${t} (len=${A.data.length}, head=${e})`)}v(e,s,!0)}else try{if(c&&!c.destroyed&&!c.writableEnded&&!c.writableFinished){if(!r){r=!0;const e=A.data.subarray(0,16).toString("hex");this.rtspDebugLog(`First video frame written to ffmpeg stdin for client ${t} (len=${A.data.length}, head=${e})`)}c.write("H264"===A.videoType?we(A.data):A.data)||await new Promise((e=>{c?c.once("drain",(()=>e())):e()}))}}catch(e){const s=e?.code;if("EPIPE"===s||"ERR_STREAM_WRITE_AFTER_END"===s){this.rtspDebugLog(`EPIPE writing to ffmpeg for client ${t}`);break}this.logger.error(`[BaichuanRtspServer] Error writing frame to ffmpeg for client ${t}:`,e)}}this.rtspDebugLog(`Finished feeding frames to client ${t} (total: ${M} frames)`)}catch(e){this.logger.error(`[BaichuanRtspServer] Error in feedFrames for client ${t}:`,e)}})().catch((e=>{this.logger.error(`[BaichuanRtspServer] Error feeding frames to client ${t}:`,e)})),k?.stderr?.on("data",(e=>{const s=e.toString();(s.includes("error")||s.includes("Error"))&&this.logger.error(`[BaichuanRtspServer] FFmpeg error for client ${t}: ${s}`)}))}async startNativeStream(){this.nativeStreamActive||(this.nativeStreamActive=!0,this.firstFrameReceived=!1,this.firstAudioDetected=!1,this.hasAudio=!1,this.audioInfo=null,this.audioPrimingFrame=null,this.firstFramePromise=new Promise((e=>{this.firstFrameResolve=e})),this.firstAudioPromise=new Promise((e=>{this.firstAudioResolve=e})),this.rtspDebugLog(`Starting native stream for profile ${this.profile} (waiting for camera to start transmitting...)`),await this.flow.startKeepAlive(this.api),this.nativeFanout=new ot({maxQueueItems:200,createSource:()=>Ke(this.api,this.channel,this.profile),onFrame:t=>{if(t.audio){if(!this.hasAudio&&"tcp"===this.api.client.getTransport()&&e.isAdtsAacFrame(t.data)){const s=e.parseAdtsSamplingInfo(t.data);s&&(this.hasAudio=!0,this.audioInfo={codec:"aac-adts",sampleRate:s.sampleRate,channels:s.channels,configHex:s.configHex},this.audioPrimingFrame=Buffer.from(t.data),this.markFirstAudioDetected(),this.rtspDebugLog(`Audio detected (AAC/ADTS ${s.sampleRate}Hz ch=${s.channels}); advertising RTSP track1 as mpeg4-generic`))}return}if(0===t.data.length)return;"H264"!==t.videoType&&"H265"!==t.videoType||this.setFlowVideoType(t.videoType,"native stream"),this.flow.extractParameterSets(t.data);const{hasParamSets:s}=this.flow.getFmtp();s&&this.markFirstFrameReceived()},onError:e=>{this.logger.warn(`[BaichuanRtspServer] Shared native stream error: ${e}`)}}),this.nativeFanout.start(),this.clearNoClientAutoStopTimer(),this.noClientAutoStopTimer=setTimeout((()=>{0===this.connectedClients.size&&(this.rtspDebugLog("Auto-stopping primed native stream (no clients connected)"),this.stopNativeStream())}),15e3),this.noClientAutoStopTimer?.unref?.())}markFirstFrameReceived(){!this.firstFrameReceived&&this.firstFrameResolve&&(this.firstFrameReceived=!0,this.rtspDebugLog(`First frame received from camera for profile ${this.profile}`),this.firstFrameResolve(),this.firstFrameResolve=null)}markFirstAudioDetected(){!this.firstAudioDetected&&this.firstAudioResolve&&(this.firstAudioDetected=!0,this.firstAudioResolve(),this.firstAudioResolve=null)}async stopNativeStream(){if(this.nativeStreamActive){if(this.rtspDebugLog("Stopping native stream"),this.flow.stopKeepAlive(),this.clearNoClientAutoStopTimer(),this.nativeStreamActive=!1,this.firstFrameReceived=!1,this.firstFramePromise=null,this.firstFrameResolve&&(this.firstFrameResolve=null),this.firstAudioDetected=!1,this.firstAudioPromise=null,this.firstAudioResolve&&(this.firstAudioResolve=null),this.nativeFanout){const e=this.nativeFanout;this.nativeFanout=null,await e.stop()}if(this.tempStreamGenerator){try{await this.tempStreamGenerator.return(void 0)}catch{}this.tempStreamGenerator=null}}}removeClient(e){this.connectedClients.has(e)&&(this.connectedClients.delete(e),this.emit("clientDisconnected",e),this.logger.info(`[BaichuanRtspServer] RTSP client disconnected: ${e}`),0===this.connectedClients.size&&this.stopNativeStream())}async waitUntilReady(e=3e4){return new Promise(((t,s)=>{if(!this.clientConnectionServer)return void s(new Error("RTSP server not started"));const r=setTimeout((()=>{s(new Error(`Timeout waiting for RTSP server to be ready (${e}ms). Camera may be sleeping or not responding.`))}),e),n=()=>{const e=new A.Socket;e.setTimeout(1e3),e.on("connect",(()=>{e.destroy(),this.nativeStreamActive&&this.firstFramePromise?(this.rtspDebugLog("Port is listening, waiting for camera to start transmitting frames..."),this.firstFramePromise.then((()=>{clearTimeout(r),t()})).catch((e=>{clearTimeout(r),s(e)}))):(clearTimeout(r),t())})),e.on("timeout",(()=>{e.destroy(),setTimeout(n,500)})),e.on("error",(()=>{e.destroy(),setTimeout(n,500)})),e.connect(this.listenPort,this.listenHost)};n()}))}async stop(){if(!this.active)return;this.logger.info(`[BaichuanRtspServer] Stopping RTSP server on ${this.listenHost}:${this.listenPort}...`),await this.stopNativeStream();const e=Array.from(this.connectedClients);for(const t of e){const e=this.clientResources.get(t);if(e){if(e.ffmpeg)try{e.ffmpeg.stdin?.end(),e.ffmpeg.kill("SIGTERM"),setTimeout((()=>{try{e.ffmpeg?.kill("SIGKILL")}catch{}}),1e3)}catch{}if(e.udpSocket)try{e.udpSocket.close()}catch{}if(e.rtspSocket&&!e.rtspSocket.destroyed)try{e.rtspSocket.destroy()}catch{}}}this.clientResources.clear(),this.clientConnectionServer&&(await new Promise((e=>{this.clientConnectionServer?.close((()=>{e()}))})),this.clientConnectionServer=void 0),this.active=!1,this.connectedClients.clear(),this.emit("close"),this.logger.info("[BaichuanRtspServer] RTSP server stopped")}getRtspUrl(){return`rtsp://${this.listenHost}:${this.listenPort}${this.path}`}isActive(){return this.active}getClientCount(){return this.connectedClients.size}};function ct(e){if(e instanceof Error)return e.stack||e.message;try{return JSON.stringify(e)}catch{return String(e)}}async function lt(e){try{return{ok:!0,value:await e()}}catch(e){return{ok:!1,error:ct(e)}}}function ht(e){a.mkdirSync(e,{recursive:!0})}function gt(e,t){ht(c.dirname(e)),a.writeFileSync(e,JSON.stringify(t,null,2))}function dt(e,t){ht(c.dirname(e)),a.appendFileSync(e,JSON.stringify(t)+"\n")}function ut(e){return new Promise((t=>setTimeout(t,e)))}function Et(){return(new Date).toISOString().replace(/[:.]/g,"-")}function It(e,t){if("H264"===e){return Se(t).map((e=>31&(e[0]??0)))}return He(t).map((e=>Pe(e))).filter((e=>"number"==typeof e))}async function Ct(e){const t=e.outDir;ht(t);const[s,r]=await Promise.all([e.native?lt((()=>async function(e){const{api:t}=e,s=e.channel??0,r={kind:"native",channel:s,transport:t.client.getTransport?.(),encKind:t.client.enc?.kind,collectedAt:(new Date).toISOString()},[n,A,i,o,a,c,l]=await Promise.all([lt((()=>t.getInfo(s))),lt((()=>t.getPorts())),lt((()=>t.getStreamMetadata(s))),lt((()=>t.getAbilityInfo())),lt((()=>t.getDeviceCapabilities(s,{probe:!1}))),lt((()=>t.getTalkAbility(s))),lt((()=>t.getTwoWayAudioConfig(s)))]);if(r.info=n,r.ports=A,r.streamMetadata=i,r.abilityInfo=o,r.deviceCapabilities=a,r.talkAbility=c,r.twoWayAudio=l,c?.ok&&c.value){const e=c.value,t={duplex:Array.isArray(e.duplexList)?e.duplexList[0]:void 0,audioStreamMode:Array.isArray(e.audioStreamModeList)?e.audioStreamModeList[0]:void 0,audioConfig:Array.isArray(e.audioConfigList)?e.audioConfigList[0]:void 0};r.intercomRecommended=t}return r}(e.native))):Promise.resolve(void 0),e.cgi?lt((()=>async function(e){const{cgi:t}=e,s=e.channel??0,r={kind:"cgi",channel:s,collectedAt:(new Date).toISOString()},[n,A,i,o,a,c,l]=await Promise.all([lt((()=>t.getInfo(s))),lt((()=>t.GetNetPort())),lt((()=>t.GetAbility())),lt((()=>t.GetEnc(s))),lt((()=>t.GetChannelstatus())),lt((()=>t.GetChnTypeInfo(s))),lt((()=>t.GetAiState(s)))]);return r.info=n,r.netPort=A,r.ability=i,r.enc=o,r.channelStatus=a,r.channelTypeInfo=c,r.aiState=l,r.devicesInfo=await lt((()=>t.getDevicesInfo())),r}(e.cgi))):Promise.resolve(void 0)]),n={createdAt:(new Date).toISOString(),native:s,cgi:r,...e.extra?{extra:e.extra}:{}},A=c.join(t,"diagnostics.json");return gt(A,n),{outDir:t,diagnosticsPath:A}}function Bt(e,t){return new Promise((s=>{ht(c.dirname(t));const r=a.createWriteStream(t,{flags:"a"}),n=(0,h.spawn)("ffmpeg",e,{stdio:["ignore","ignore","pipe"]});n.on("error",(e=>{r.write(`ffmpeg spawn error: ${e instanceof Error?e.message:String(e)}\n`),r.end(),s({ok:!1,error:e instanceof Error?e.message:String(e)})}));let A="";n.stderr.on("data",(e=>{const t=e.toString();A+=t,r.write(t)})),n.on("close",(e=>{r.end(),s(0!==e?{ok:!1,error:`ffmpeg exited with code ${e}\n${A.slice(-4e3)}`}:{ok:!0})}))}))}async function Qt(e){const t=["-hide_banner","-loglevel","warning","-stats",..."rtsp"===e.kind?["-rtsp_transport","tcp"]:[],"-i",e.url,"-t",String(e.durationSeconds),"-c","copy","-y",e.outputMp4];return await Bt(t,e.logPath)}async function pt(e){const t=`fps=1/${Math.max(.25,e.snapshotIntervalSeconds)}`,s=["-hide_banner","-loglevel","warning","-stats",..."rtsp"===e.kind?["-rtsp_transport","tcp"]:[],"-i",e.url,"-t",String(e.durationSeconds),"-vf",t,"-q:v","2","-y",e.snapshotsPattern];return await Bt(s,e.logPath)}async function ft(e){const t=["-hide_banner","-loglevel","warning","-stats","-f","H265"===e.videoType?"hevc":"h264","-i",e.snapshotAnnexBPath,"-frames:v","1","-q:v","2","-y",e.outputJpegPath];await Bt(t,e.logPath)}async function mt(e,t){const s=await a.promises.readdir(t,{withFileTypes:!0}),r=[];for(const n of s){const s=c.join(t,n.name),A=c.relative(e,s).replace(/\\/g,"/");n.isDirectory()?(r.push({absPath:s,relPath:A,isDir:!0}),r.push(...await mt(e,s))):n.isFile()&&r.push({absPath:s,relPath:A,isDir:!1})}return r}async function yt(e){const{sourceDir:t,zipPath:s}=e;await a.promises.mkdir(c.dirname(s),{recursive:!0});const r=new d.u,n=await mt(t,t),A=n.filter((e=>e.isDir)),i=n.filter((e=>!e.isDir));for(const e of A){const t=e.relPath.endsWith("/")?e.relPath:e.relPath+"/";r.addEmptyDirectory(t)}for(const e of i)r.addFile(e.absPath,e.relPath);const o=a.createWriteStream(s);await new Promise(((e,t)=>{o.on("error",t),r.outputStream.on("error",t),o.on("close",e),r.outputStream.pipe(o),r.end()}))}var wt={resolution_index:[0,7],tv_system:[7,1],framerate:[8,7],audio_index:[15,2],ai_pd:[17,1],ai_fd:[18,1],ai_vd:[19,1],ai_ad:[20,1],encoder_type_index:[21,2],is_schedule_record:[23,1],is_motion_record:[24,1],is_rf_record:[25,1],is_doorbell_record:[26,1],ai_other:[27,1]},St={resolution_index:[0,7],tv_system:[7,1],framerate:[8,7],audio_index:[15,2],ai_pd:[17,1],ai_fd:[18,1],ai_vd:[19,1],ai_ad:[20,1],encoder_type_index:[21,2],is_schedule_record:[23,1],is_motion_record:[24,1],is_rf_record:[25,1],is_doorbell_record:[26,1],is_ai_other_record:[27,1],picture_layout_index:[28,7],package_delivered:[35,1],package_takenaway:[36,1]},Dt={cam:{2:wt,3:wt,4:wt,7:wt,9:wt,10:wt},hub:{0:St,1:{...St,package_event:[37,1]},2:{resolution_index:[0,7],tv_system:[7,1],framerate:[8,7],audio_index:[15,2],ai_pd:[17,1],ai_fd:[18,1],ai_vd:[19,1],ai_ad:[20,1],ai_other:[21,2],encoder_type_index:[23,1],is_schedule_record:[24,1],is_motion_record:[25,1],is_rf_record:[26,1],is_doorbell_record:[27,1],picture_layout_index:[28,7],package_delivered:[35,1],package_takenaway:[36,1],package_event:[37,1],upload_flag:[38,1]}}};function bt(e,t,s){const r=Dt[e],n=r[t]??r[Math.max(...Object.keys(r).map((e=>Number(e))))];if(!n)return;const A=function(e,t){if(!e)return;if(!/^[0-9a-fA-F]+$/.test(e))return;const s=4*e.length,r=BigInt(`0x${e}`).toString(2).padStart(s,"0").split("").reverse().join(""),n=BigInt(`0b${r}`),A={};for(const[e,[s,r]]of Object.entries(t)){const t=BigInt(s),i=((n&(1n<<BigInt(r))-1n<<t)>>t).toString(2).padStart(r,"0").split("").reverse().join("");A[e]=Number.parseInt(i,2)}return A}(s,n);if(!A)return;return{raw:A,flags:{aiPerson:1===A.ai_pd,aiVehicle:1===A.ai_vd,aiAnimal:1===A.ai_ad,aiFace:1===A.ai_fd,aiOther:1===A.is_ai_other_record||1===A.ai_other||(A.ai_other??0)>0,schedule:1===A.is_schedule_record,motion:1===A.is_motion_record,rf:1===A.is_rf_record,doorbell:1===A.is_doorbell_record,package:1===A.package_event||1===A.package_delivered||1===A.package_takenaway}}}function vt(e,t){if(!/^\d{8}$/.test(e))return;if(!/^\d{6}$/.test(t))return;const s=Number.parseInt(e.slice(0,4),10),r=Number.parseInt(e.slice(4,6),10),n=Number.parseInt(e.slice(6,8),10),A=Number.parseInt(t.slice(0,2),10),i=Number.parseInt(t.slice(2,4),10),o=Number.parseInt(t.slice(4,6),10);return[s,r,n,A,i,o].every(Number.isFinite)?new Date(s,r-1,n,A,i,o):void 0}function Nt(e){const t=e.lastIndexOf(".");if(t<=0||t===e.length-1)return;const s=e.slice(t+1),r=e.slice(0,t).split("/").filter(Boolean).at(-1);if(!r)return;const n=r.split("_"),A=n[0]??"";if(!A.startsWith("Rec")||6!==A.length)return;const i=A[3],o="M"===i?"main":"S"===i?"sub":"unknown",a=Number.parseInt(A.slice(4,6),16);if(!Number.isFinite(a))return;let c,l,h,g="cam",d="",u="",E="",I="";if(6===n.length)d=n[1]??"",u=n[2]??"",E=n[3]??"",I=n[4]??"";else if(7===n.length)d=n[1]??"",u=n[2]??"",E=n[3]??"",c=n[4],I=n[5]??"";else{if(9!==n.length)return;g="hub",d=n[1]??"",u=n[2]??"",E=n[3]??"",c=n[4],l=n[5],h=n[6],I=n[7]??""}d=d.toLowerCase().replace("dst","");const C=vt(d,u);if(!C)return;const B="000000"===E?C:vt(d,E);if(!B)return;const Q=Math.max(0,B.getTime()-C.getTime()),p={baseName:r,ext:s,streamHint:o,version:a,devType:g,start:C,end:B,durationMs:Q},f=bt(g,a,I);return f&&(p.flags=f.flags,p.rawFlags=f.raw),null!=c&&(p.animalTypeRaw=c),null!=l&&(p.widthRaw=l),null!=h&&(p.heightRaw=h),p}function Rt(e){if(null==e)return;const t=Number(e);return Number.isFinite(t)?t:void 0}function kt(e){if("number"==typeof e)return e>0;if("string"==typeof e){const t=Number(e);return Number.isFinite(t)?t>0:e.length>0&&"0"!==e}return Boolean(e)}function Tt(e,t){if(!e||"object"!=typeof e)return;const s=e,r=s[t],n=s.Host,A={...n&&"object"==typeof n?n:{},...r&&"object"==typeof r?r:{}};return Object.keys(A).length?A:void 0}function Ft(e,t){if(!e)return!1;for(const[s,r]of Object.entries(e))if(t.test(s)&&kt(r))return!0;return!1}function Mt(e){if(!e)return;const t=e.match(/<Support[^>]*>([\s\S]*?)<\/Support>/i);if(!t)return;const s=t[1]??"",r=s.match(/<ptzMode>([^<]*)<\/ptzMode>/i)?.[1],n=[];for(const e of s.matchAll(/<item[^>]*>([\s\S]*?)<\/item>/gi)){const t=e[1]??"",s={chnID:Rt(t.match(/<chnID>([^<]*)<\/chnID>/i)?.[1])??0};for(const e of t.matchAll(/<([A-Za-z0-9_]+)>([^<]*)<\/\1>/g)){const t=e[1],r=e[2];if(!t)continue;if("chnID"===t)continue;const n=Rt(r);s[t]=n??r}n.push(s)}const A={items:n};void 0!==r&&(A.ptzMode=r);const i=(e,t)=>{const r=(e=>{const t=s.match(new RegExp(`<${e}>([^<]*)<\\/${e}>`,"i"));return Rt(t?.[1])})(t);void 0!==r&&(A[e]=r)};i("IOInputPortNum","IOInputPortNum"),i("IOOutputPortNum","IOOutputPortNum"),i("diskNum","diskNum"),i("channelNum","channelNum"),i("audioNum","audioNum"),i("ptzCfg","ptzCfg"),i("B485","B485"),i("autoUpdate","autoUpdate"),i("pushAlarm","pushAlarm"),i("ftp","ftp"),i("ftpTest","ftpTest"),i("email","email"),i("wifi","wifi"),i("record","record"),i("wifiTest","wifiTest"),i("rtsp","rtsp"),i("onvif","onvif"),i("audioTalk","audioTalk");const o=(e=>{const t=s.match(new RegExp(`<${e}>([^<]*)<\\/${e}>`,"i"));return t?.[1]})("subVersion");return void 0!==o&&(A.subVersion=o),A}function Ut(e){const{channel:t}=e,s=Tt(e.abilities,t),r=function(e,t){if(!e?.items?.length)return;const s=e=>{const t=e;let s=0;null==t.name&&(s+=2);const r=["ptzType","ptzControl","ptzPreset","ledCtrl","lightType","battery","audioVersion","motion","encCtrl","newIspCfg","remoteAbility"];for(const e of r)void 0!==t[e]&&(s+=3);return s+=Math.min(10,Math.max(0,Object.keys(t).length-1)),s};return(t=>{const r=e.items.filter((e=>e.chnID===t));if(r.length)return r.slice().sort(((e,t)=>s(t)-s(e)))[0]})(t)}(e.support,t),n=e.support?.ptzMode,A="string"==typeof n?n.toLowerCase():void 0,i=r?r.ptzType:void 0,o=r?r.ptzControl:void 0,a=kt(i)||kt(o)||kt(r?.ptzPreset),c=("none"===A||"0"===A)&&!a,l=!!r&&kt(r.battery),h=!!r&&kt(r.ptzPreset),g=r?r.doorbellVersion:void 0,d=Number.isFinite(Number(g))?Number(g)>0:kt(g),u=r?r.lightType:void 0,E="number"==typeof u?u:"string"==typeof u?Number(u):void 0,I=a||!!A&&("none"!==A&&"0"!==A),C=!!A&&(A.includes("pt")||"pt"===A||"ptz"===A),B=!!A&&A.includes("z"),Q=Ft(s,/battery/i),p=Ft(s,/white\s*led|whiteLed|flood\s*light|floodlight/i),f=Ft(s,/audio\s*alarm|audioAlarm|siren|pushAlarn|audioPlay/i),m=kt(e.support?.audioTalk)||!!r&&kt(r.ipcAudioTalk),y=Ft(s,/ptz/i),w=Ft(s,/zoom|zoomFocus|StartZoomFocus/i),S=Ft(s,/preset/i),D=Ft(s,/(^|_)pir/i)||Ft(s,/rfAlarm/i)||Ft(s,/mdWithPir/i),b=!!r&&(kt(r.rfCfg)||kt(r.newRfCfg)||kt(r.rfVersion)||kt(r.battery)),v=!c&&(C||y),N=!c&&(C||y),R=!c&&(B||w),k=!c&&(h||S),T={channel:t,hasPan:v,hasTilt:N,hasZoom:R,hasPresets:k,hasPtz:!c&&(I||v||N||R||k),hasBattery:l||Q,hasIntercom:m,hasSiren:f,hasFloodlight:Number.isFinite(E)?E>0:p,hasPir:D||b,isDoorbell:d};return void 0!==A&&(T.ptzMode=A),T}function Lt(e){if(null!=e){if("boolean"==typeof e)return e;if("number"==typeof e)return 1===e;if("string"==typeof e){const t=e.trim().toLowerCase();if("1"===t||"true"===t||"yes"===t||"on"===t)return!0;if("0"===t||"false"===t||"no"===t||"off"===t)return!1}}}function Ht(e){const t=function(e){if(!e||0===e.length)return[];const t=e[0]?.value;if(!t)return[];let s=t?.status??t?.Channelstatus??t?.ChannelStatus??t?.channelStatus??t?.channelstatus;if(!Array.isArray(s))if(Array.isArray(t))s=t;else if(s=t?.channels??t?.Channels??t?.channel??t?.Channel,!Array.isArray(s)){const e=Object.keys(t).filter((e=>/^channel\d+$/i.test(e)||/^ch\d+$/i.test(e)));e.length>0&&(s=e.map((e=>{const s=t[e];return"object"==typeof s&&null!==s?s:{channel:parseInt(e.replace(/\D/g,""),10)}})))}return Array.isArray(s)?s:[]}(e);if(!t.length)return[];const s=[];for(const e of t){if("object"!=typeof e||null===e)continue;const t=e?.channel??e?.id??e?.channelId??e?.Channel??e?.ID??e?.ChannelId;if("number"!=typeof t||!Number.isFinite(t))continue;const r="string"==typeof e?.name?e.name:void 0,n="string"==typeof e?.uid?e.uid:void 0,A="string"==typeof e?.typeInfo?e.typeInfo:void 0,i=Lt(e?.online),o=Lt(e?.sleep);s.push({channel:t,...void 0!==i?{online:i}:{},...void 0!==o?{sleep:o}:{},...r?{name:r}:{},...n?{uid:n}:{},...A?{typeInfo:A}:{}})}return s.sort(((e,t)=>e.channel-t.channel)),s}function Pt(e){return new Promise((t=>setTimeout(t,e)))}function xt(e,t){const s=new RegExp(`<${t}\\b[^>]*>([\\s\\S]*?)<\\/${t}>`,"g"),r=[];let n;for(;n=s.exec(e);)r.push(n[1]??"");return r}function Yt(e){const t=Number.parseInt(P(e,"year")??"",10),s=Number.parseInt(P(e,"month")??"",10),r=Number.parseInt(P(e,"day")??"",10),n=Number.parseInt(P(e,"hour")??"",10),A=Number.parseInt(P(e,"minute")??"",10),i=Number.parseInt(P(e,"second")??"",10);if([t,s,r,n,A,i].every(Number.isFinite))return new Date(t,s-1,r,n,A,i)}function Vt(e,t){return`<${e}><year>${t.getFullYear()}</year><month>${t.getMonth()+1}</month><day>${t.getDate()}</day><hour>${t.getHours()}</hour><minute>${t.getMinutes()}</minute><second>${t.getSeconds()}</second></${e}>`}function Ot(e){const t=[],s=xt(e,"FileInfo");for(const e of s){const s=P(e,"Id")??P(e,"ID")??P(e,"id"),r=P(e,"name")??P(e,"fileName"),n=(s??r)?.trim();if(!n)continue;const A={fileName:n};null!=r&&r.trim()&&(A.name=r.trim()),null!=s&&s.trim()&&(A.id=s.trim());const i=P(e,"type")??P(e,"recordType")??P(e,"alarmType");null!=i&&(A.recordType=i);const o=P(e,"size")??P(e,"fileSize"),a=o?Number.parseInt(o,10):void 0;null!=a&&Number.isFinite(a)&&(A.sizeBytes=a);const c=xt(e,"startTime")[0],l=xt(e,"endTime")[0],h=c?Yt(c):void 0,g=l?Yt(l):void 0;h&&(A.startTime=h),g&&(A.endTime=g);const d=Nt(A.name??A.fileName);d&&(A.parsedFileName=d,A.startTime||(A.startTime=d.start),A.endTime||(A.endTime=d.end)),t.push(A)}const r=xt(e,"File");for(const e of r){const s=P(e,"fileName")??P(e,"name");if(!s)continue;const r=P(e,"size")??P(e,"fileSize"),n=r?Number.parseInt(r,10):void 0,A=P(e,"type")??P(e,"recordType")??P(e,"alarmType"),i=xt(e,"startTime")[0],o=xt(e,"endTime")[0],a={fileName:s};null!=n&&Number.isFinite(n)&&(a.sizeBytes=n),null!=A&&(a.recordType=A);const c=i?Yt(i):void 0,l=o?Yt(o):void 0;c&&(a.startTime=c),l&&(a.endTime=l);const h=Nt(a.fileName);h&&(a.parsedFileName=h,a.startTime||(a.startTime=h.start),a.endTime||(a.endTime=h.end)),t.push(a)}if(0===t.length){const s=/<fileName>([\s\S]*?)<\/fileName>/g;let r;for(;r=s.exec(e);){const e=(r[1]??"").trim();if(!e)continue;const s={fileName:e},n=Nt(e);n&&(s.parsedFileName=n,s.startTime=n.start,s.endTime=n.end),t.push(s)}}if(0===t.length){const s=xt(e,"alarmVideo");for(const e of s){const s=P(e,"fileName")??P(e,"name");if(!s)continue;const r={fileName:s},n=P(e,"alarmType");null!=n&&(r.recordType=n);const A=xt(e,"startTime")[0],i=xt(e,"endTime")[0],o=A?Yt(A):void 0,a=i?Yt(i):void 0;o&&(r.startTime=o),a&&(r.endTime=a);const c=Nt(r.fileName);c&&(r.parsedFileName=c,r.startTime||(r.startTime=c.start),r.endTime||(r.endTime=c.end)),t.push(r)}}const n=new Set;return t.filter((e=>!n.has(e.fileName)&&(n.add(e.fileName),!0)))}function Gt(e){const t=P(e,"audioType"),s=Number.parseInt(P(e,"sampleRate")??"",10),r=Number.parseInt(P(e,"samplePrecision")??"",10),n=Number.parseInt(P(e,"lengthPerEncoder")??"",10),A=P(e,"soundTrack"),i=P(e,"priority");if(!(t&&Number.isFinite(s)&&Number.isFinite(r)&&Number.isFinite(n)&&A))return null;const o={audioType:t,sampleRate:s,samplePrecision:r,lengthPerEncoder:n,soundTrack:A};if(void 0!==i){const e=Number.parseInt(i,10);Number.isFinite(e)&&(o.priority=e)}return o}function Jt(e,t){const s=4+e.length,r=s%8==0?0:8-s%8,n=12+e.length+r,A=Buffer.alloc(n);return A.writeUInt32LE(1651978544,0),A.writeUInt16LE(s,4),A.writeUInt16LE(s,6),A.writeUInt16LE(256,8),A.writeUInt16LE(t,10),e.copy(A,12),A}var Wt=class{client;logger;httpClient;host;username;password;rebootAfterDisconnectionsPerMinute;disconnectStormVoluntaryAtMs=[];disconnectStormRebootInFlight;disconnectStormLastRebootAtMs;simpleEventListeners=new Set;simpleEventSubscribed=!1;simpleEventSubscribeInFlight;simpleEventUnsubscribeInFlight;simpleEventResubscribeTimer;simpleEventResubscribeInFlight;simpleEventResubscribeIntervalMs=3e5;statePollingInterval;lastMotionState;lastAiState;aiStatePollingDisabled=!1;aiStatePollingDisabledLogged=!1;rtspServers=new Set;activeVideoMsgNums=new Map;lastSleepProbe;constructor(e){this.logger=e.logger??console,this.client=new ge(e),this.host=e.host,this.username=e.username,this.password=e.password,this.httpClient=new de({host:e.host,username:e.username,password:e.password,timeoutMs:6e5}),this.client.on("event",(e=>{const t=function(e){const t=e.timestamp??Date.now();if("motion"===e.type)return{type:"motion",channel:e.channel,timestamp:t};if("visitor"===e.type)return{type:"doorbell",channel:e.channel,timestamp:t};if("daynight"===e.type)return{type:"daynight",channel:e.channel,timestamp:t};if("ai"===e.type){const s=e.ai,r=s?.type;return{type:r?{people:"people",vehicle:"vehicle",dog_cat:"animal",face:"face",package:"package",other:"other"}[r]:"other",channel:e.channel,timestamp:t}}return null}(e);if(t)for(const e of this.simpleEventListeners)try{e(t)}catch(e){(this.logger.warn??this.logger.error).call(this.logger,"[ReolinkBaichuanApi] onSimpleEvent handler error",e)}}));const t=e.rebootAfterDisconnectionsPerMinute;"number"==typeof t&&Number.isFinite(t)&&t>0&&(this.rebootAfterDisconnectionsPerMinute=Math.floor(t),this.client.on("close",(()=>{try{this.maybeRebootOnDisconnectStorm()}catch{}})))}async runAllDiagnosticsConsecutively(e){const t=e.channel??0,s=e.outDir,r=(new Date).toISOString().replace(/[:.]/g,"-"),n=(0,c.join)(s,r);(this.logger.log??console.log).call(this.logger,"[Diagnostics] starting run",{outDir:s,runDir:n,channel:t,durationSeconds:e.durationSeconds,selection:e.selection});const A=!0===e.cgi||"object"==typeof e.cgi&&null!=e.cgi,i=A?new ue({host:("object"==typeof e.cgi?e.cgi.host:void 0)??this.host,username:("object"==typeof e.cgi?e.cgi.username:void 0)??this.username,password:("object"==typeof e.cgi?e.cgi.password:void 0)??this.password,..."object"==typeof e.cgi&&null!=e.cgi.port?{port:e.cgi.port}:{},..."object"==typeof e.cgi&&null!=e.cgi.useHttps?{useHttps:e.cgi.useHttps}:{},..."object"==typeof e.cgi&&null!=e.cgi.insecureTLS?{insecureTLS:e.cgi.insecureTLS}:{},..."object"==typeof e.cgi&&null!=e.cgi.timeoutMs?{timeoutMs:e.cgi.timeoutMs}:{}}):void 0,o=await Ct({outDir:n,native:{api:this,channel:t},...i?{cgi:{cgi:i,channel:t}}:{},...e.extra?{extra:e.extra}:{}});(this.logger.log??console.log).call(this.logger,"[Diagnostics] diagnostics bundle collected",{diagnosticsPath:o.diagnosticsPath,runDir:o.outDir,cgiEnabled:A});const l=(0,c.join)(n,"streams"),h=!0===e.rtsp||"object"==typeof e.rtsp&&null!=e.rtsp?{host:("object"==typeof e.rtsp?e.rtsp.host:void 0)??this.host,username:("object"==typeof e.rtsp?e.rtsp.username:void 0)??this.username,password:("object"==typeof e.rtsp?e.rtsp.password:void 0)??this.password,..."object"==typeof e.rtsp&&null!=e.rtsp.port?{port:e.rtsp.port}:{}}:void 0;await async function(e){const t=e.channel??0,s=Math.max(250,Math.round(1e3*e.durationSeconds)),r=e.snapshotIntervalSeconds??2,n=e.logger,A=(e,t,s)=>{const r=n?.[e]??n?.log;r&&(void 0!==s?r.call(n,t,s):r.call(n,t))},i=function(e){const t=[];for(const s of e??[])"main"!==s&&"sub"!==s&&"ext"!==s||t.includes(s)||t.push(s);return t}(e.selection.profiles),o=i.length?i:["main","sub","ext"],l=e.outDir;ht(l),A("log","[Diagnostics] stream sampling start",{outDir:l,channel:t,durationSeconds:e.durationSeconds,snapshotIntervalSeconds:r,selection:e.selection});const h=c.join(l,"events.ndjson");dt(h,{t:Date.now(),type:"sampling_start",channel:t,durationSeconds:e.durationSeconds,snapshotIntervalSeconds:r,selection:e.selection});for(const n of o)for(const i of e.selection.kinds){const o=`${i}_${n}`,g=c.join(l,o);if(ht(g),dt(h,{t:Date.now(),type:"stream_begin",kind:i,profile:n,channel:t}),A("log","[Diagnostics] stream begin",{kind:i,profile:n,channel:t}),"native"!==i)if("rtsp"!==i)if("rtmp"!==i);else{const s=e.rtmp?.urlsByProfile?.[n];if(!s){dt(h,{t:Date.now(),type:"stream_skip",kind:i,profile:n,reason:"rtmp url missing"}),A("warn","[Diagnostics] stream skip (rtmp url missing)",{kind:i,profile:n,channel:t});continue}const o=c.join(g,`clip_${Et()}.mp4`),a=c.join(g,"ffmpeg_record.log"),l=c.join(g,"snapshots");ht(l);const d=c.join(l,"snap_%05d.jpg");dt(h,{t:Date.now(),type:"rtmp_url",kind:i,profile:n,url:s});const[u,E]=await Promise.all([Qt({kind:"rtmp",url:s,outputMp4:o,durationSeconds:e.durationSeconds,logPath:a}),pt({kind:"rtmp",url:s,snapshotsPattern:d,durationSeconds:e.durationSeconds,snapshotIntervalSeconds:r,logPath:c.join(g,"ffmpeg_snapshots.log")})]);dt(h,{t:Date.now(),type:"rtmp_done",kind:i,profile:n,mp4Path:o,record:u,snapshots:E}),A("log","[Diagnostics] stream done",{kind:i,profile:n,channel:t,mp4Path:o,record:u,snapshots:E})}else{if(!e.rtsp){dt(h,{t:Date.now(),type:"stream_skip",kind:i,profile:n,reason:"rtsp config missing"}),A("warn","[Diagnostics] stream skip (rtsp config missing)",{kind:i,profile:n,channel:t});continue}const s=Ee({host:e.rtsp.host,username:e.rtsp.username,password:e.rtsp.password,channel:t,stream:n,...null!=e.rtsp.port?{port:e.rtsp.port}:{}}),o=c.join(g,`clip_${Et()}.mp4`),a=c.join(g,"ffmpeg_record.log"),l=c.join(g,"snapshots");ht(l);const d=c.join(l,"snap_%05d.jpg");dt(h,{t:Date.now(),type:"rtsp_url",kind:i,profile:n,url:s});const[u,E]=await Promise.all([Qt({kind:"rtsp",url:s,outputMp4:o,durationSeconds:e.durationSeconds,logPath:a}),pt({kind:"rtsp",url:s,snapshotsPattern:d,durationSeconds:e.durationSeconds,snapshotIntervalSeconds:r,logPath:c.join(g,"ffmpeg_snapshots.log")})]);dt(h,{t:Date.now(),type:"rtsp_done",kind:i,profile:n,mp4Path:o,record:u,snapshots:E}),A("log","[Diagnostics] stream done",{kind:i,profile:n,channel:t,mp4Path:o,record:u,snapshots:E})}else{const o=e.native?.api;if(!o){dt(h,{t:Date.now(),type:"stream_skip",kind:i,profile:n,reason:"native api missing"}),A("warn","[Diagnostics] stream skip (native api missing)",{kind:i,profile:n,channel:t});continue}const l=c.join(g,"raw_frames"),d=c.join(g,"snapshots");ht(l),ht(d);const u=e.limits?.maxNativeRawFrames??400,E=e.limits?.maxNativeRawBytes??52428800;let I=0,C=0;const B="sub"===n?1:0,Q=e=>{if(!e?.header)return;if(3!==e.header.cmdId)return;if(e.header.streamType!==B)return;if(I>=u)return;const t=Buffer.isBuffer(e.payload)&&e.payload.length?e.payload:e.body;if(!Buffer.isBuffer(t)||0===t.length)return;if(C+t.length>E)return;I++,C+=t.length;const s=String(I).padStart(6,"0"),r=c.join(l,`frame_${s}.bin`);try{a.writeFileSync(r,t)}catch{}dt(h,{t:Date.now(),type:"native_raw_frame",kind:i,profile:n,idx:I,bytes:t.length,header:e.header,bodyLen:e.body?.length??0,payloadLen:e.payload?.length??0})};o.client.on("frame",Q);const p=new Ze({client:o.client,api:o,channel:t,profile:n}),f=c.join(g,`clip_${Et()}`),m=f+".annexb",y=f+".audio.bin",w=f+".json",S=a.createWriteStream(m,{flags:"w"}),D=a.createWriteStream(y,{flags:"w"});let b,v=null,N=0,R=0,k=0,T=null;const F=e=>{if(!e||!Buffer.isBuffer(e.data))return;b||(b=e.videoType),N++;try{S.write(e.data)}catch{}e.isKeyframe&&null==v&&(v=Date.now());const t=It(e.videoType,e.data);dt(h,{t:Date.now(),type:"native_access_unit",kind:i,profile:n,isKeyframe:!!e.isKeyframe,videoType:e.videoType,microseconds:e.microseconds,bytes:e.data.length,nalTypes:t});const s=Date.now();if(e.isKeyframe&&s-k>=1e3*r){k=s;const t=Et(),r=c.join(d,`snap_${t}.${"H265"===e.videoType?"h265":"h264"}`);try{a.writeFileSync(r,e.data),dt(h,{t:Date.now(),type:"native_snapshot_saved",kind:i,profile:n,path:r});const s=c.join(d,`snap_${t}.jpg`);ft({videoType:e.videoType,snapshotAnnexBPath:r,outputJpegPath:s,logPath:c.join(g,"ffmpeg_snapshot.log")})}catch{}}},M=e=>{if(Buffer.isBuffer(e)&&0!==e.length){R++;try{D.write(e)}catch{}dt(h,{t:Date.now(),type:"native_audio",kind:i,profile:n,bytes:e.length})}};p.on("videoAccessUnit",F),p.on("audioFrame",M),p.on("error",(e=>{dt(h,{t:Date.now(),type:"native_error",kind:i,profile:n,error:ct(e)})}));try{for(await p.start(),dt(h,{t:Date.now(),type:"native_started",kind:i,profile:n}),T=Date.now();Date.now()-T<s;)await ut(200)}finally{try{await p.stop()}catch{}o.client.removeListener("frame",Q);try{S.end()}catch{}try{D.end()}catch{}const s={kind:i,profile:n,channel:t,durationSeconds:e.durationSeconds,videoAccessUnits:N,audioFrames:R,videoType:b,firstKeyframeLatencyMs:null==v||null==T?null:Math.max(0,v-T),rawFrames:I,rawBytes:C};gt(w,s),dt(h,{t:Date.now(),type:"native_done",...s}),A("log","[Diagnostics] stream done",s)}}}dt(h,{t:Date.now(),type:"sampling_done"})}({outDir:l,durationSeconds:e.durationSeconds,...null!=e.snapshotIntervalSeconds?{snapshotIntervalSeconds:e.snapshotIntervalSeconds}:{},channel:t,selection:e.selection,...h?{rtsp:h}:{},...e.rtmp?{rtmp:e.rtmp}:{},native:{api:this},...e.limits?{limits:e.limits}:{},logger:this.logger}),(this.logger.log??console.log).call(this.logger,"[Diagnostics] stream sampling completed",{streamsDir:l});const g=(0,c.join)(s,`${r}.zip`);return(this.logger.log??console.log).call(this.logger,"[Diagnostics] creating zip bundle",{zipPath:g}),await yt({sourceDir:n,zipPath:g}),(this.logger.log??console.log).call(this.logger,"[Diagnostics] zip bundle created",{zipPath:g}),{runDir:o.outDir,zipPath:g,diagnosticsPath:o.diagnosticsPath,streamsDir:l}}async maybeRebootOnDisconnectStorm(){const e=this.rebootAfterDisconnectionsPerMinute;if(null==e)return;const t=this.client.getLastDisconnectInfo?.();if(!t?.voluntary)return;const s=Date.now(),r=s-6e4;for(;this.disconnectStormVoluntaryAtMs.length&&this.disconnectStormVoluntaryAtMs[0]<r;)this.disconnectStormVoluntaryAtMs.shift();if(this.disconnectStormVoluntaryAtMs.push(s),this.disconnectStormVoluntaryAtMs.length<e)return;if(this.disconnectStormRebootInFlight)return;const n=6e5;null!=this.disconnectStormLastRebootAtMs&&s-this.disconnectStormLastRebootAtMs<n||(this.disconnectStormLastRebootAtMs=s,(this.logger.warn??this.logger.error).call(this.logger,"[ReolinkBaichuanApi] disconnect storm detected; rebooting device",{transport:t.transport,reason:t.reason,voluntaryDisconnectsInWindow:this.disconnectStormVoluntaryAtMs.length,windowMs:6e4,threshold:e,cooldownMs:n,method:"auto"}),this.disconnectStormRebootInFlight=this.rebootFromDisconnectStorm("auto").catch((e=>{(this.logger.warn??this.logger.error).call(this.logger,"[ReolinkBaichuanApi] disconnect-storm reboot failed",e)})).finally((()=>{this.disconnectStormRebootInFlight=void 0})))}async rebootFromDisconnectStorm(e){let t;if("auto"===e||"baichuan"===e)try{return void await this.reboot()}catch(s){if(t=s,"baichuan"===e)throw s}if("auto"===e||"cgi"===e){const e=new ue({host:this.host,username:this.username,password:this.password,timeoutMs:6e4});try{return await e.login(),void await e.Reboot()}catch(e){throw t=e,e}finally{try{await e.logout()}catch{}}}throw t instanceof Error?t:new Error(String(t??"disconnect-storm reboot failed"))}async onSimpleEvent(e){this.simpleEventListeners.add(e),await this.ensureSimpleEventSubscribed(),this.startSimpleEventResubscribeTimer()}async offSimpleEvent(e){if(e?this.simpleEventListeners.delete(e):this.simpleEventListeners.clear(),0===this.simpleEventListeners.size)this.stopSimpleEventResubscribeTimer(),await this.ensureSimpleEventUnsubscribed();else{"udp"===this.client.getTransport?.()||this.startStatePolling()}}startSimpleEventResubscribeTimer(){this.simpleEventResubscribeTimer||0!==this.simpleEventListeners.size&&(this.simpleEventResubscribeTimer=setInterval((()=>{this.renewSimpleEventSubscription()}),this.simpleEventResubscribeIntervalMs))}stopSimpleEventResubscribeTimer(){this.simpleEventResubscribeTimer&&(clearInterval(this.simpleEventResubscribeTimer),this.simpleEventResubscribeTimer=void 0)}async renewSimpleEventSubscription(){if(0!==this.simpleEventListeners.size)return this.simpleEventResubscribeInFlight||(this.simpleEventResubscribeInFlight=(async()=>{try{await this.subscribeEvents(),this.simpleEventSubscribed=!0,(this.logger.debug??this.logger.log).call(this.logger,"[ReolinkBaichuanApi] renewed simple event subscription",{intervalMs:this.simpleEventResubscribeIntervalMs})}catch(e){(this.logger.debug??this.logger.log).call(this.logger,"[ReolinkBaichuanApi] failed to renew event subscription",e)}})().finally((()=>{this.simpleEventResubscribeInFlight=void 0}))),await this.simpleEventResubscribeInFlight}async ensureSimpleEventSubscribed(){if(0!==this.simpleEventListeners.size&&!this.simpleEventSubscribed)return this.simpleEventSubscribeInFlight||(this.simpleEventSubscribeInFlight=(async()=>{this.client.subscribed||await this.subscribeEvents(),this.simpleEventSubscribed=!0;if(!("udp"===this.client.getTransport?.())){const e=this.client.getConfiguredChannel?.()??0;await this.checkAndDispatchCurrentState(e),this.startStatePolling()}})().finally((()=>{this.simpleEventSubscribeInFlight=void 0}))),await this.simpleEventSubscribeInFlight}async ensureSimpleEventUnsubscribed(){if(this.simpleEventSubscribed||this.client.subscribed){if(this.simpleEventUnsubscribeInFlight)return await this.simpleEventUnsubscribeInFlight;if(this.simpleEventSubscribeInFlight)try{await this.simpleEventSubscribeInFlight}catch{}return this.simpleEventUnsubscribeInFlight=(async()=>{await this.unsubscribeEvents(),this.simpleEventSubscribed=!1,this.stopSimpleEventResubscribeTimer(),this.stopStatePolling()})().finally((()=>{this.simpleEventUnsubscribeInFlight=void 0})),await this.simpleEventUnsubscribeInFlight}}normalizeChannel(e){return null==e?0:e}async login(e){await this.client.login(e)}async close(){this.stopStatePolling(),await this.cleanup(),await this.client.close()}async cleanup(){const e=Array.from(this.rtspServers);this.rtspServers.clear(),await Promise.allSettled(e.map((async e=>{try{await e.stop()}catch(e){this.logger.error("[ReolinkBaichuanApi] Error stopping RTSP server during cleanup:",e)}}))),e.length>0&&this.logger.info(`[ReolinkBaichuanApi] Cleaned up ${e.length} RTSP server(s)`)}async sendXml(e,t=3){this.client.loggedIn||await this.client.login();try{const s=await this.client.sendFrame(e);if(400===s.header.responseCode){if(t>0){if(0===s.body.length)try{this.client.loggedIn=!1,await this.client.login()}catch{}const r=1500;return await new Promise((e=>setTimeout(e,r))),await this.sendXml(e,t-1)}if(0===s.body.length)throw new Error("Baichuan request failed (responseCode 400, empty body). Possible causes: camera sleeping/waking (battery), expired session, or invalid username/password.")}if(0===s.body.length)return"";return this.client.tryDecryptXml(s.body,s.header.channelId,this.client.enc)}catch(e){throw e}}async getTalkAbility(e){return function(e){const t=xt(e,"TalkAbility")[0];if(!t)throw new Error("TalkAbility XML not found in response");return{duplexList:xt(t,"duplexList").map((e=>P(e,"duplex"))).filter((e=>!!e)),audioStreamModeList:xt(t,"audioStreamModeList").map((e=>P(e,"audioStreamMode"))).filter((e=>!!e)),audioConfigList:xt(t,"audioConfig").map(Gt).filter((e=>!!e))}}(await this.sendXml({cmdId:10,...void 0!==e?{channel:e}:{}}))}async createTalkSession(e=0,t){this.client.loggedIn||await this.client.login();const s="udp"===this.client.getTransport?.()?e:void 0,r=await this.getTalkAbility(e),n=r.audioConfigList.find((e=>"adpcm"===e.audioType.toLowerCase()))??r.audioConfigList[0];if(!n)throw new Error(`Talk not supported on channel ${e} (no audioConfig in TalkAbility)`);const A=r.duplexList[0]??"FDX",i=r.audioStreamModeList[0]??"followVideoStream",o={channel:e,duplex:A,audioStreamMode:i,audioConfig:n},a=Math.floor(n.lengthPerEncoder/2),c=a+4;if(a<=0||c<=4)throw new Error(`Invalid talk audio config: lengthPerEncoder=${n.lengthPerEncoder}`);const l=function(e){const t=e.audioConfig;return`<?xml version="1.0" encoding="UTF-8" ?>\n<body>\n<TalkConfig version="1.1">\n<channelId>${e.channel}</channelId>\n<duplex>${U(e.duplex)}</duplex>\n<audioStreamMode>${U(e.audioStreamMode)}</audioStreamMode>\n<audioConfig>\n<audioType>${U(t.audioType)}</audioType>\n<sampleRate>${t.sampleRate}</sampleRate>\n<samplePrecision>${t.samplePrecision}</samplePrecision>\n<lengthPerEncoder>${t.lengthPerEncoder}</lengthPerEncoder>\n<soundTrack>${U(t.soundTrack)}</soundTrack>\n</audioConfig>\n</TalkConfig>\n</body>`}(o);await(async()=>{const t=await this.client.sendFrame({cmdId:201,channel:e,...null!=s?{channelIdOverride:s}:{},payloadXml:l,messageClass:p});if(422!==t.header.responseCode){if(200!==t.header.responseCode)throw new Error(`TalkConfig rejected (responseCode ${t.header.responseCode})`)}else{await this.client.sendFrame({cmdId:11,channel:e,...null!=s?{channelIdOverride:s}:{},payloadXml:"",messageClass:p});const t=await this.client.sendFrame({cmdId:201,channel:e,...null!=s?{channelIdOverride:s}:{},payloadXml:l,messageClass:p});if(200!==t.header.responseCode)throw new Error(`TalkConfig rejected after reset (responseCode ${t.header.responseCode})`)}})();const h={channel:e,audioConfig:n,blockSize:a,fullBlockSize:c};let g=Buffer.alloc(0),d=!1,u=!1,E=Date.now();const I=Math.max(1,Math.min(8,Math.floor(t?.blocksPerPayload??1))),C=async t=>{if(0===t.length)return;if(t.length>I)throw new Error(`Internal error: too many blocks in payload (${t.length})`);const r=[];let A=0;for(const e of t)r.push(Jt(e,a)),A+=Math.max(0,2*(e.length-4)+1);await this.client.sendBinaryPayloadNoReply({cmdId:202,channel:e,...null!=s?{channelIdOverride:s}:{},extensionXml:H(e),payload:Buffer.concat(r),messageClass:p});const i=A/n.sampleRate*1e3,o=Date.now();o>E?E=o+i:E+=i;const c=E-Date.now();c>0&&await Pt(c)},B=async()=>{if(!u){u=!0;try{for(;;){if(!(g.length>=c)){if(d){if(g.length>0){const e=Buffer.alloc(c,255);g.copy(e,0),g=Buffer.alloc(0),await C([e])}break}break}{const e=[];for(;e.length<I&&g.length>=c;)e.push(g.subarray(0,c)),g=g.subarray(c);await C(e)}}}finally{u=!1}}};return{info:h,sendAudio:async e=>{if(d)throw new Error("Talk session is closed");0!==e.length&&(g=0===g.length?e:Buffer.concat([g,e]),await B())},stop:async()=>{if(d)return;d=!0,await B();const t=E-Date.now();t>0?await Pt(t+100):await Pt(100);const r=await this.client.sendFrame({cmdId:11,channel:e,...null!=s?{channelIdOverride:s}:{},payloadXml:"",messageClass:p});if(200!==r.header.responseCode)throw new Error(`TalkReset rejected (responseCode ${r.header.responseCode})`)}}}async sendBinary(e){return await this.client.login(),await this.client.sendBinary(e)}async getNetPort(){const e={},t=(await this.sendXml({cmdId:37})).matchAll(/<([A-Za-z]+)Port[^>]*>([\s\S]*?)<\/\1Port>/g);for(const s of t){const t=(s[1]??"").toLowerCase(),r=s[2]??"",n={};for(const e of r.matchAll(/<([A-Za-z]+)>(-?\d+)<\/\1>/g)){const t=(e[1]??"").toLowerCase(),s=Number(e[2]);Number.isFinite(s)&&(n[t]=s)}Object.keys(n).length&&(e[t]=n)}return e}async getPorts(){return this.getNetPort()}async setPortEnabled(e){const t=`${e.port[0].toUpperCase()}${e.port.slice(1)}Port`,s=`<?xml version="1.0" encoding="UTF-8" ?><body><${t} version="1.1"><enable>${e.enable?1:0}</enable></${t}></body>`;await this.sendXml({cmdId:36,payloadXml:s})}async getInfo(e,t){const s={cmdId:null==e?80:318};void 0!==e&&(s.channel=e),null!=t?.timeoutMs&&(s.timeoutMs=t.timeoutMs);return function(e,t){const s={};for(const r of t){const t=P(e,r);void 0!==t&&(s[r]=t)}return s}(await this.sendXml(s),t?.tags?.length?t.tags:["type","hardwareVersion","firmwareVersion","itemNo","serialNumber","name"])}async getChannelIdentity(e,t){const s=await this.getInfo(e,{...null!=t?.timeoutMs?{timeoutMs:t.timeoutMs}:{},tags:["type","name"]});return{channel:e,model:(s.type??"").trim(),name:(s.name??"").trim()}}async getNvrChannelsInfo(e){const t=e?.source??"cgi",s=e?.timeoutMs??3500,r=e?.maxChannels??16,n=e?.cgiTimeoutMs??3e4;if("cgi"===t){const e=new ue({host:this.host,username:this.username,password:this.password,timeoutMs:n});try{await e.login();const t=Number.isFinite(r)&&r>0?r:16,s=[{cmd:"GetChannelstatus",action:0},...Array.from({length:t},((e,t)=>({cmd:"GetChnTypeInfo",action:0,param:{channel:t}})))],n=await e.callMany(s),A=Ht(n.length?[n[0]]:[]),i=new Map;for(const e of A)i.set(e.channel,e);const o=A.map((e=>e.channel)),a=o.length?[...new Set(o)].sort(((e,t)=>e-t)):Array.from({length:t},((e,t)=>t)),c=[];for(const e of a){const s=i.get(e);let r,A,o;if(e>=0&&e<t){const t=n[1+e],s=t?.value;s&&"object"==typeof s&&("string"==typeof s.typeInfo&&s.typeInfo.trim()&&(r=s.typeInfo.trim()),"string"==typeof s.firmVer&&s.firmVer.trim()&&(A=s.firmVer.trim()),"string"==typeof s.boardInfo&&s.boardInfo.trim()&&(o=s.boardInfo.trim()))}const a=s?.name?.trim(),l=(r??s?.typeInfo)?.trim(),h=s?.uid?.trim();c.push({channel:e,...l?{model:l}:{},...a?{name:a}:{},...h?{uid:h}:{},...void 0!==s?.online?{online:s.online}:{},...void 0!==s?.sleep?{sleep:s.sleep}:{},...A?{firmwareVersion:A}:{},...o?{boardInfo:o}:{},source:"cgi"})}return c}finally{}}let A=[];try{const e=await this.getAbilityInfo();A=Object.keys(e??{}).filter((e=>"Host"!==e)).map((e=>Number(e))).filter((e=>Number.isFinite(e))).sort(((e,t)=>e-t))}catch{}if(0===A.length){const e=Number.isFinite(r)&&r>0?r:16;A=Array.from({length:e},((e,t)=>t))}const i=[];for(const e of A)try{const t=await this.getInfo(e,{timeoutMs:s,tags:["type","name","firmwareVersion"]}),r=(t.type??"").trim(),n=(t.name??"").trim(),A=(t.firmwareVersion??"").trim();if(!!!(r||n||A))continue;i.push({channel:e,...r?{model:r}:{},...n?{name:n}:{},...A?{firmwareVersion:A}:{},source:"baichuan"})}catch{}return i.sort(((e,t)=>e.channel-t.channel))}async getEncXml(e,t){const s=this.normalizeChannel(e);return await this.sendXml({cmdId:56,channel:s,...null!=t?.timeoutMs?{timeoutMs:t.timeoutMs}:{}})}async getStreamMetadata(e){const t=this.normalizeChannel(e),s=await this.getEncXml(t),r=[];let n=!0;const A=this.client.getDebugConfig?.(),i=!0===A?.debugParamSets,o=e=>e.width>0&&e.height>0&&(e.frameRate>0||e.bitRate>0),a=(e,s)=>{if(!i)return;if(!s)return void(this.logger.warn??this.logger.log).call(this.logger,`[ReolinkBaichuanApi] getStreamMetadata(debugParamSets): channel=${t} tag=<${e}> missing`);const r=s,n=P(r,"width")??P(r,"Width"),A=P(r,"height")??P(r,"Height"),a=P(r,"frame")??P(r,"Frame"),c=P(r,"bitRate")??P(r,"BitRate"),l=P(r,"videoEncType")??P(r,"VideoEncType"),h=P(r,"audio")??P(r,"Audio"),g=P(r,"enable")??P(r,"Enable"),d=Number(n??"0"),u=Number(A??"0"),E=Number(a??"0"),I=Number(c??"0"),C=Number(h??"0"),B=void 0===g||"1"===g||"true"===g,Q=B&&o({width:d,height:u,frameRate:E,bitRate:I}),p=1400,f=r.length<=p?r:r.slice(0,p)+`\n...truncated (+${r.length-p} chars)`;(this.logger.warn??this.logger.log).call(this.logger,`[ReolinkBaichuanApi] getStreamMetadata(debugParamSets): channel=${t} tag=<${e}> enabled=${B} plausible=${Q} width=${d} height=${u} frame=${E} bitRate=${I} audio=${C} videoEncType=${l??"?"} rawFields=${JSON.stringify({widthText:n,heightText:A,frameText:a,bitRateText:c,videoEncTypeText:l,audioText:h,enableText:g})} blockXml=${JSON.stringify(f)}`)};if(i){const e=1600,r=s.length<=e?s:s.slice(0,e)+`\n...truncated (+${s.length-e} chars)`,n={mainStream:/<mainStream\b/.test(s),subStream:/<subStream\b/.test(s),extStream:/<extStream\b/.test(s),thirdStream:/<thirdStream\b/.test(s),externStream:/<externStream\b/.test(s),extraStream:/<extraStream\b/.test(s)};(this.logger.warn??this.logger.log).call(this.logger,`[ReolinkBaichuanApi] getStreamMetadata(debugParamSets): channel=${t} xmlLen=${s.length} tagsPresent=${JSON.stringify(n)} xmlHead=${JSON.stringify(r)}`)}const c={0:"H.264",1:"H.265",2:"MJPEG",3:"MPEG4"},l=s.match(/<mainStream[^>]*>([\s\S]*?)<\/mainStream>/);if(l){const e=l[1]??"";a("mainStream",e);const t=Number(P(e,"width")??"0"),s=Number(P(e,"height")??"0"),A=Number(P(e,"videoEncType")??"0"),i=Number(P(e,"frame")??"0"),h=Number(P(e,"bitRate")??"0"),g=Number(P(e,"audio")??"0"),d=P(e,"enable");(void 0===d||"1"===d||"true"===d)&&o({width:t,height:s,frameRate:i,bitRate:h})&&(r.push({profile:"main",audio:g,width:t,height:s,videoEncType:c[A]??`Unknown(${A})`,videoEncTypeInt:A,frameRate:i,bitRate:h}),n=n&&1===g)}const h=s.match(/<subStream[^>]*>([\s\S]*?)<\/subStream>/);if(h){const e=h[1]??"";a("subStream",e);const t=Number(P(e,"width")??"0"),s=Number(P(e,"height")??"0"),A=Number(P(e,"videoEncType")??"0"),i=Number(P(e,"frame")??"0"),l=Number(P(e,"bitRate")??"0"),g=Number(P(e,"audio")??"0"),d=P(e,"enable");(void 0===d||"1"===d||"true"===d)&&o({width:t,height:s,frameRate:i,bitRate:l})&&(r.push({profile:"sub",audio:g,width:t,height:s,videoEncType:c[A]??`Unknown(${A})`,videoEncTypeInt:A,frameRate:i,bitRate:l}),n=n&&1===g)}const g=["extStream","thirdStream","externStream","extraStream"];for(const e of g){const t=s.match(new RegExp(`<${e}[^>]*>([\\s\\S]*?)<\\/${e}>`));if(!t)continue;const A=t[1]??"";a(e,A);const i=Number(P(A,"width")??"0"),l=Number(P(A,"height")??"0"),h=Number(P(A,"videoEncType")??"0"),g=Number(P(A,"frame")??"0"),d=Number(P(A,"bitRate")??"0"),u=Number(P(A,"audio")??"0"),E=P(A,"enable");(void 0===E||"1"===E||"true"===E)&&o({width:i,height:l,frameRate:g,bitRate:d})&&(r.push({profile:"ext",audio:u,width:i,height:l,videoEncType:c[h]??`Unknown(${h})`,videoEncTypeInt:h,frameRate:g,bitRate:d}),n=n&&1===u);break}return{channel:t,streams:r,audioEnabled:n}}async setEncXml(e,t){const s="number"==typeof e?this.normalizeChannel(e):0,r="number"==typeof e?t:e;await this.sendXml({cmdId:57,channel:s,payloadXml:r})}async setStreamVideoCodec(e,t,s){const r="number"==typeof e?this.normalizeChannel(e):this.normalizeChannel(s),n="number"==typeof e?t:e,A="H.265"===("number"==typeof e?s:t)?1:0,i="main"===n?["mainStream"]:"sub"===n?["subStream"]:["extStream","thirdStream","externStream","extraStream"],o=await this.getEncXml(r);let a=null;for(const e of i){const t=new RegExp(`(<${e}[^>]*>[\\s\\S]*?<videoEncType>)(\\d+)(</videoEncType>)`);if(!t.test(o))continue;const s=o.replace(t,`$1${A}$3`);if(s!==o){a=s;break}}if(!a)throw new Error(`Could not find <videoEncType> for profile=${n} (tags=${i.join(",")}) in GetEnc XML (channel=${r}).`);await this.setEncXml(r,a)}async setNetPort(e){null!=e.onvifEnable&&await this.setPortEnabled({port:"onvif",enable:1===e.onvifEnable}),null!=e.rtmpEnable&&await this.setPortEnabled({port:"rtmp",enable:1===e.rtmpEnable}),null!=e.rtspEnable&&await this.setPortEnabled({port:"rtsp",enable:1===e.rtspEnable})}async reboot(e){const t={cmdId:23};void 0!==e&&(t.channel=e),await this.sendXml(t)}async ping(){await this.sendXml({cmdId:93})}async getGeneralXml(e){const t={cmdId:104};return void 0!==e&&(t.channel=e),await this.sendXml(t)}async setGeneralXml(e,t){const s="number"==typeof e||void 0===e?e:void 0,r="string"==typeof e?e:t;await this.sendXml({cmdId:105,...void 0===s?{}:{channel:s},payloadXml:r})}static buildChannelExtensionXml(e){return`<?xml version="1.0" encoding="UTF-8" ?><Extension version="1.1"><channelId>${U(String(e))}</channelId></Extension>`}async getMotionState(e){const t=P(await this.sendXml({cmdId:46,...void 0!==e?{channel:e}:{}}),"enable");return"1"===t||"true"===t}async getOsd(e){const t=this.normalizeChannel(e),s=await this.sendXml({cmdId:26,channel:t});return{channel:t,osdChannel:{enable:Number(P(s,"enable")??"0"),name:P(s,"name")??"",pos:P(s,"pos")??""},osdTime:{enable:Number(P(s,"timeEnable")??"0"),pos:P(s,"timePos")??""},watermark:Number(P(s,"watermark")??"0")}}async setOsd(e,t){const s="number"==typeof e?this.normalizeChannel(e):this.normalizeChannel(t),r="number"==typeof e?t:e,n=`<?xml version="1.0" encoding="UTF-8" ?><body><Osd version="1.1"><channel>${s}</channel><osdChannel><enable>${r.osdChannel.enable}</enable><name>${U(r.osdChannel.name)}</name><pos>${U(r.osdChannel.pos)}</pos></osdChannel><osdTime><enable>${r.osdTime.enable}</enable><pos>${U(r.osdTime.pos)}</pos></osdTime><watermark>${r.watermark}</watermark></Osd></body>`;await this.sendXml({cmdId:25,channel:s,payloadXml:n})}async getAiState(e){const t=this.normalizeChannel(e),s=["people","vehicle","dog_cat","face","package"];let r;const n=async(e,s)=>{const r=`<?xml version="1.0" encoding="UTF-8" ?><body><AiDetectCfg version="1.1"><chn>${t}</chn><type>${U(e)}</type></AiDetectCfg></body>`;return await this.sendXml({cmdId:342,channel:t,payloadXml:r,...null!=s?{channelIdOverride:s}:{}},0)};for(const e of s)try{const s=await n(e,t);if(s)return{channel:t,alarm_state:Number(P(s,"alarm_state")??"0"),support:Number(P(s,"support")??"0")}}catch(e){r=e}for(const e of s)try{const s=await n(e,void 0);if(s)return{channel:t,alarm_state:Number(P(s,"alarm_state")??"0"),support:Number(P(s,"support")??"0")}}catch(e){r=e}throw r instanceof Error?r:new Error(String(r??"getAiState failed"))}async getSnapshot(e=0){const t=`<body><Snap version="1.1"><channelId>${e}</channelId><logicChannel>${e}</logicChannel><time>0</time><fullFrame>0</fullFrame><streamType>main</streamType></Snap></body>`;return await this.client.login(),await this.client.sendBinary({cmdId:109,channel:e,payloadXml:t,extensionXml:L(e),timeoutMs:15e3})}async listRecordings(e){await this.client.login();const t=this.normalizeChannel(e.channel),s=e.uid,r=e.streamType??"mainStream",n=e.recordType??"manual, sched, io, md, people, face, vehicle, dog_cat, visitor, other, package",A=e.maxIterations??50,i=e.fallbackToAlarmVideo??!0,o=`<?xml version="1.0" encoding="UTF-8" ?>\n<body>\n<FileInfoList version="1.1">\n<FileInfo>\n<uid>${U(s)}</uid>\n<searchAITrack>1</searchAITrack>\n<channelId>${t}</channelId>\n<logicChnBitmap>255</logicChnBitmap>\n<streamType>${U(r)}</streamType>\n<recordType>${U(n)}</recordType>\n${Vt("startTime",e.start)}\n${Vt("endTime",e.end)}\n</FileInfo>\n</FileInfoList>\n</body>`,a=P(await this.sendXml({cmdId:14,channel:t,payloadXml:o}),"handle");if(!a)throw new Error("FileInfoList open did not return <handle>");const c=Number.parseInt(a,10);if(!Number.isFinite(c))throw new Error(`FileInfoList open returned invalid handle: ${a}`);const l=`<?xml version="1.0" encoding="UTF-8" ?>\n<body>\n<FileInfoList version="1.1">\n<FileInfo>\n<channelId>${t}</channelId>\n<uid>${U(s)}</uid>\n<searchAITrack>1</searchAITrack>\n<handle>${c}</handle>\n</FileInfo>\n</FileInfoList>\n</body>`,h=[];try{let e=!1;for(let s=0;s<A&&!e;s++){const s=await this.sendXml({cmdId:15,channel:t,payloadXml:l});h.push(...Ot(s));const r=P(s,"bFinished")??P(s,"finished");e=null==r||"1"===r.trim()}}finally{try{await this.sendXml({cmdId:16,channel:t,payloadXml:l})}catch{}}const g=new Set,d=h.filter((e=>!g.has(e.fileName)&&(g.add(e.fileName),!0)));if(d.length>0||!i)return d;const u=s.split("_")[0]??s,E="subStream"===r?1:0,I=e=>`<?xml version="1.0" encoding="UTF-8" ?>\n<body>\n<findAlarmVideo version="1.1">\n<channelId>${t}</channelId>\n<fileHandle>${U(e)}</fileHandle>\n</findAlarmVideo>\n</body>`,C=[];let B=e.start;for(let s=0;s<A;s++){const s=await this.sendXml({cmdId:272,channel:t,payloadXml:(Q=B,p=e.end,`<?xml version="1.0" encoding="UTF-8" ?>\n<body>\n<findAlarmVideo version="1.1">\n<channelId>${t}</channelId>\n<uid>${U(u)}</uid>\n<logicChnBitmap>255</logicChnBitmap>\n<streamType>${E}</streamType>\n<notSearchVideo>0</notSearchVideo>\n${Vt("startTime",Q)}\n${Vt("endTime",p)}\n<alarmType>md, pir, io, people, face, vehicle, dog_cat, visitor, other, package, cry, crossline, intrusion, loitering, legacy, loss</alarmType>\n</findAlarmVideo>\n</body>`)}),r=P(s,"fileHandle")?.trim();if(!r)break;const n=I(r);try{const e=await this.sendXml({cmdId:273,channel:t,payloadXml:n}),s=Ot(e);C.push(...s);const r=P(e,"bFinished")?.trim();if("1"===r)break;const A=[...s].reverse().find((e=>null!=e.startTime));if(!A?.startTime)break;B=A.startTime}finally{try{await this.sendXml({cmdId:274,channel:t,payloadXml:n})}catch{}}}var Q,p;const f=new Set;return C.filter((e=>!f.has(e.fileName)&&(f.add(e.fileName),!0)))}async listRecordingFileNames(e){return(await this.listRecordings(e)).map((e=>e.fileName))}async getVodRtmpUrl(e){await this.client.login();const t=this.normalizeChannel(e.channel),s=e.streamType??"mainStream",r=e.ensureEnabled??!0;let n=e.rtmpPort;try{const e=(await this.getNetPort()).rtmp,t="number"==typeof e?.enable?e.enable:void 0,s="number"==typeof e?.port?e.port:void 0;null==n&&null!=s&&Number.isFinite(s)&&s>0&&(n=s),r&&0===t&&await this.setPortEnabled({port:"rtmp",enable:!0})}catch{}null==n&&(n=1935);const A="subStream"===s?1:0;let i=e.fileName.trim();const o=i.indexOf("Mp4Record/");o>=0&&(i=i.slice(o)),i=i.replace(/^\/+/,"");const a=i.replace(/\//g,"%20").replace(/ /g,"%20"),c=encodeURIComponent(this.username),l=encodeURIComponent(this.password);return`rtmp://${this.host}:${n}/vod/${a}?channel=${t}&stream=${A}&user=${c}&password=${l}`}async predownloadRecordingMp4(e){await this.client.login();const t=this.normalizeChannel(e.channel),s=e.streamType??"mainStream",r=e.ensureAwake??!1,n=e.ffmpegPath??"ffmpeg",A=e.overwrite??!0;await(0,g.mkdir)((0,c.dirname)(e.outputPath),{recursive:!0});const i=async()=>{r&&await this.wakeUp(t,{waitAfterWakeMs:1500,attempts:3});const i=await this.getVodRtmpUrl({channel:t,fileName:e.fileName,streamType:s,ensureEnabled:!0});await new Promise(((t,s)=>{const r=(0,h.spawn)(n,["-hide_banner","-loglevel","error",...A?["-y"]:[],"-rtmp_live","live","-i",i,"-c","copy","-movflags","frag_keyframe+empty_moov","-f","mp4",e.outputPath]);let o="";r.stderr.on("data",(e=>{o+=String(e)})),r.on("close",(e=>{if(0===e)return t();s(new Error(`ffmpeg exited with code ${e}\n${o}`))})),r.on("error",s)}))};try{await i()}catch(e){if(r)try{await this.wakeUp(t,{waitAfterWakeMs:3e3,attempts:3,reconnect:!0})}catch{}await i()}}async generateMp4Screenshot(e){const t=e.ffmpegPath??"ffmpeg",s=Number.isFinite(e.atSeconds)&&e.atSeconds>=0?e.atSeconds:0;await(0,g.mkdir)((0,c.dirname)(e.outputPath),{recursive:!0}),await new Promise(((r,n)=>{const A=(0,h.spawn)(t,["-hide_banner","-loglevel","error","-y","-ss",String(s),"-i",e.inputPath,"-frames:v","1","-q:v","2",e.outputPath]);let i="";A.stderr.on("data",(e=>{i+=String(e)})),A.on("close",(e=>{if(0===e)return r();n(new Error(`ffmpeg screenshot exited with code ${e}\n${i}`))})),A.on("error",n)}))}async downloadRecording(e){await this.client.login();const t=this.normalizeChannel(e.channel),s=e.uid,r=e.fileName,n=r.includes("/")?r.split("/").filter(Boolean).at(-1)??r:r,A=`<?xml version="1.0" encoding="UTF-8" ?>\n<body>\n<FileInfoList version="1.1">\n<FileInfo>\n<channelId>${t}</channelId>\n<uid>${U(s)}</uid>\n<fileName>${U(r)}</fileName>\n<name>${U(n)}</name>\n<Id>${U(r)}</Id>\n</FileInfo>\n</FileInfoList>\n</body>`,i=e.fallbackToHttp??!1;try{return await this.client.sendBinary({cmdId:13,channel:t,messageClass:f,extensionXml:H(t),payloadXml:A,timeoutMs:e.timeoutMs??12e4})}catch(e){if(!i)throw e;const t=r.replaceAll("/","_").replaceAll("\\","_");try{const e=/Rec(\w{3})(?:_|_DST)(\d{8})_(\d{6})_.*/.exec(r),s=e?`${e[2]}${e[3]}`:void 0,n=[],A=e=>{const t=e?.trim();t&&(n.includes(t)||n.push(t))};let i;A(r),A(r.replace(/^\/mnt\/[a-zA-Z0-9]+\//,"")),A(r.replace(/^\//,""));for(const e of n)try{return await this.httpClient.downloadVod(e,t,s)}catch(e){i=e;if((e instanceof Error?e.message:String(e)).startsWith("HTTP 404"))continue;throw e}throw i instanceof Error?i:new Error(String(i))}catch(t){const s=e instanceof Error?e.message:String(e),r=t instanceof Error?t.message:String(t);throw new Error(`downloadRecording failed (baichuan then http). baichuanErr=${s}; httpErr=${r}`)}}}async subscribeEvents(){await this.client.login();const e=this.client.getConfiguredChannel?.()??0,t=[{label:`channelId=${e} bodyLen=0`,params:{cmdId:31,channelIdOverride:e,messageClass:p}},{label:"push channelId=251 bodyLen=0",params:{cmdId:31,channelIdOverride:251,messageClass:p}},{label:"host channelId=250 bodyLen=0",params:{cmdId:31,channelIdOverride:250,messageClass:p}},{label:"legacy Extension channelId=251",params:{cmdId:31,channelIdOverride:250,messageClass:p,extensionXml:'<?xml version="1.0" encoding="UTF-8" ?><Extension version="1.1"><channelId>251</channelId></Extension>'}}];let s;for(const e of t){const t=await this.client.sendFrame({...e.params,timeoutMs:1e4});if(s=t.header.responseCode,200===t.header.responseCode)return this.client.subscribed=!0,void this.client.refreshKeepAlive?.();(this.logger.debug??this.logger.log).call(this.logger,`[ReolinkBaichuanApi] subscribeEvents rejected (${e.label}) responseCode=${t.header.responseCode}`)}throw this.client.subscribed=!1,this.client.refreshKeepAlive?.(),new Error(`subscribeEvents failed: camera rejected cmdId=31 (last responseCode=${s??"unknown"})`)}async subscribeToAllEvents(e){await this.client.login();const t=e?.preferCgi??!0,s=e?.maxChannels??16,r=e?.timeoutMs??1e4;let n=[];try{const e=await this.getNvrChannelsInfo({source:t?"cgi":"baichuan",maxChannels:s}),r=e.filter((e=>Boolean((e.uid??"").trim())||Boolean((e.name??"").trim())||!0===e.online||!0===e.sleep)).map((e=>e.channel)).filter((e=>Number.isInteger(e)&&e>=0));n=(r.length?r:e.map((e=>e.channel))).filter((e=>Number.isInteger(e)&&e>=0)).slice(0,s)}catch{}if(!n.length){n=[this.client.getConfiguredChannel?.()??0]}n=[...new Set(n)].sort(((e,t)=>e-t));let A,i=0;for(const e of n){const t=await this.client.sendFrame({cmdId:31,channelIdOverride:e,messageClass:p,timeoutMs:r});A=t.header.responseCode,200===t.header.responseCode?i++:(this.logger.debug??this.logger.log).call(this.logger,`[ReolinkBaichuanApi] subscribeToAllEvents rejected (channel=${e}) responseCode=${t.header.responseCode}`)}if(i>0)return this.client.subscribed=!0,void this.client.refreshKeepAlive?.();try{return void await this.subscribeEvents()}catch{}throw this.client.subscribed=!1,this.client.refreshKeepAlive?.(),new Error(`subscribeToAllEvents failed: camera rejected cmdId=31 for all channels (last responseCode=${A??"unknown"})`)}async unsubscribeEvents(){this.client.subscribed=!1,this.client.refreshKeepAlive?.()}async checkAndDispatchCurrentState(e=0){try{const t=await this.getMotionState(e);if(t!==this.lastMotionState&&(this.lastMotionState=t,t)){const t={type:"motion",channel:e,timestamp:Date.now()};this.dispatchSimpleEvent(t)}if(!this.aiStatePollingDisabled)try{const t=await this.getAiState(e);if(t&&void 0!==t.alarm_state){if((!this.lastAiState||this.lastAiState.alarm_state!==t.alarm_state||this.lastAiState.support!==t.support)&&(this.lastAiState=t,1===t.alarm_state)){const t={type:"other",channel:e,timestamp:Date.now()};this.dispatchSimpleEvent(t)}}}catch(e){this.aiStatePollingDisabled=!0;const t=String(e&&"object"==typeof e&&"message"in e?e.message:e);t.includes("not supported")||t.includes("unsupported")||(this.logger.debug??this.logger.log)?.call(this.logger,"[ReolinkBaichuanApi] getAiState failed; disabling AI polling",e),this.aiStatePollingDisabledLogged||(this.aiStatePollingDisabledLogged=!0,this.logger.debug?.("[ReolinkBaichuanApi] AI polling disabled after getAiState failure",e))}}catch(e){(this.logger.warn??this.logger.error)?.call(this.logger,"[ReolinkBaichuanApi] Error checking current state",e)}}dispatchSimpleEvent(e){for(const t of this.simpleEventListeners)try{t(e)}catch(e){(this.logger.warn??this.logger.error)?.call(this.logger,"[ReolinkBaichuanApi] onSimpleEvent handler error",e)}}startStatePolling(){if(0===this.simpleEventListeners.size)return;"udp"===this.client.getTransport?.()||this.statePollingInterval||(this.statePollingInterval=setInterval((async()=>{try{if(0===this.simpleEventListeners.size)return void this.stopStatePolling();const e=this.client.getConfiguredChannel?.()??0;await this.checkAndDispatchCurrentState(e)}catch(e){this.logger.debug?.("[ReolinkBaichuanApi] state polling tick failed",e)}}),5e3))}stopStatePolling(){this.statePollingInterval&&(clearInterval(this.statePollingInterval),this.statePollingInterval=void 0)}async getEvents(e){const t=await this.sendXml({cmdId:33,...void 0!==e?{channel:e}:{}}),s=this.normalizeChannel(e),r=Date.now(),n={channel:s};if(t.includes("<AlarmEventList")){const e=t.matchAll(/<AlarmEvent\b[^>]*>([\s\S]*?)<\/AlarmEvent>/g);for(const t of e){const e=t[1]??"",A=P(e,"channelId");if((void 0!==A?Number(A):s)!==s)continue;const i=(P(e,"status")??"").trim().toUpperCase(),o=(P(e,"AItype")??P(e,"aiType")??P(e,"aitype")??"").trim();i.includes("MD")&&(n.motion={state:1,timestamp:r,source:"md"}),i.includes("PIR")&&(n.motion={state:1,timestamp:r,source:"pir"});const a=o?o.split(",").map((e=>e.trim())).find((e=>e.length>0&&"none"!==e.toLowerCase())):void 0;(a||i.includes("AI"))&&(n.ai={channel:s,alarm_state:1,type:a}),i.includes("VIS")&&(n.visitor={detected:!0,timestamp:r})}return n}const A=(P(t,"status")??"").trim().toUpperCase(),i=(P(t,"AItype")??P(t,"aiType")??P(t,"aitype")??"").trim();return A.includes("MD")&&(n.motion={state:1,timestamp:r,source:"md"}),A.includes("PIR")&&(n.motion={state:1,timestamp:r,source:"pir"}),(i||A.includes("AI"))&&(n.ai={channel:s,alarm_state:1,type:i||void 0}),A.includes("VIS")&&(n.visitor={detected:!0,timestamp:r}),n}async getTwoWayAudioConfig(e){const t=P(await this.sendXml({cmdId:10,...void 0!==e?{channel:e}:{}}),"audioStreamMode"),s={channel:e??0,enabled:"mixAudioStream"===t||"followVideoStream"===t};return t&&(s.mode=t),s}async startTwoWayAudio(e){await this.sendXml({cmdId:10,...void 0!==e?{channel:e}:{}})}async sendAudioData(e,t){const s={cmdId:10,payloadXml:""};void 0!==t&&(s.channel=t),await this.client.sendBinary(s)}async stopTwoWayAudio(e){}async startVideoStream(e,t="sub"){const s=this.normalizeChannel(e),r=s,n={main:{handle:0,streamType:0,streamName:"mainStream"},sub:{handle:256,streamType:1,streamName:"subStream"},ext:{handle:1024,streamType:0,streamName:"externStream"}}[t];if(!n)throw new Error(`Invalid stream profile: ${t}`);if(!n.streamName)throw new Error(`Stream name not found for profile: ${t}, config: ${JSON.stringify(n)}`);const A=n.streamName;if("string"!=typeof A)throw new Error(`streamName is not a string: ${typeof A}, value: ${A}, config: ${JSON.stringify(n)}`);const i=function(e,t,s){if(!t||"string"!=typeof t)throw new Error(`buildPreviewXml: streamType is required (string) but got: ${typeof t} = ${t}`);return`<?xml version="1.0" encoding="UTF-8" ?>\n<body>\n<Preview version="1.0">\n${void 0!==s?`<channelId>${s}</channelId>\n`:""}<handle>${e}</handle>\n<streamType>${U(t)}</streamType>\n</Preview>\n</body>`}(n.handle,A,r),o="udp"===this.client.getTransport?.()?3:1;let a;for(let e=1;e<=o;e++){const A=this.client.peekNextMsgNum();this.client.subscribeVideoStream(3,A);try{const e={cmdId:3,channel:s,channelIdOverride:r,extensionXml:L(r),payloadXml:i,messageClass:p,streamType:n.streamType},A=await this.client.sendFrame(e);if(200!==A.header.responseCode)throw new Error(`Video stream request rejected (response_code ${A.header.responseCode}). Neolink expects response_code 200, camera returned ${A.header.responseCode}`);return void this.activeVideoMsgNums.set(`${s}:${t}`,A.header.msgNum)}catch(t){a=t;try{this.client.unsubscribeVideoStream(3,A)}catch{}if(e<o){await new Promise((e=>setTimeout(e,250)));continue}}}throw a instanceof Error?a:new Error(String(a))}getActiveVideoMsgNum(e,t="sub"){const s=this.normalizeChannel(e);return this.activeVideoMsgNums.get(`${s}:${t}`)}async stopVideoStream(e,t="sub"){const s=this.normalizeChannel(e),r=s,n={main:{handle:0,streamType:0},sub:{handle:256,streamType:1},ext:{handle:1024,streamType:0}}[t],A=function(e,t){return`<?xml version="1.0" encoding="UTF-8" ?>\n<body>\n<Preview version="1.0">\n${void 0!==t?`<channelId>${t}</channelId>\n`:""}<handle>${e}</handle>\n</Preview>\n</body>`}(n.handle,r),i=`${s}:${t}`,o=this.activeVideoMsgNums.get(i);this.activeVideoMsgNums.delete(i);try{await this.client.sendFrame({cmdId:4,channel:s,channelIdOverride:r,extensionXml:L(r),payloadXml:A,messageClass:p,streamType:n.streamType,...void 0!==o?{msgNumOverride:o}:{},timeoutMs:2e3})}catch{}finally{try{void 0!==o&&this.client.unsubscribeVideoStream(3,o)}catch{}}}async getPtzPresets(e){const t=this.normalizeChannel(e),s=t,r=await this.sendXml({cmdId:190,channel:t,channelIdOverride:s,extensionXml:L(s),messageClass:p,streamType:0});return this.parsePtzPresetList(r).filter((e=>void 0===e.enable||"1"===e.enable)).filter((e=>void 0===e.name||""!==String(e.name).trim())).map((e=>({id:e.id,name:e.name??`Preset ${e.id}`})))}parsePtzPresetList(e){const t=[],s=e.matchAll(/<preset\b[^>]*>([\s\S]*?)<\/preset>/gi);for(const e of s){const s=e[1]??"",r=/<id>([^<]*)<\/id>/i.exec(s)?.[1];if(!r)continue;const n=Number(r);if(!Number.isFinite(n))continue;const A=/<name>([^<]*)<\/name>/i.exec(s),i=/<enable>([^<]*)<\/enable>/i.exec(s),o={id:n},a=A?.[1],c=i?.[1];void 0!==a&&(o.name=a),void 0!==c&&(o.enable=c),t.push(o)}return t}async getPtzPresetsRaw(e){const t=this.normalizeChannel(e),s=t,r=await this.sendXml({cmdId:190,channel:t,channelIdOverride:s,extensionXml:L(s),messageClass:p,streamType:0});return this.parsePtzPresetList(r)}async ptz(e,t){const s="number"==typeof e?this.normalizeChannel(e):0,r="number"==typeof e?t:e,n=s;let A,i;if("stop"===r.action)A="stop";else{const e={Left:"left",Right:"right",Up:"up",Down:"down"}[r.command];if(!e)throw new Error(`Unsupported PTZ command for MSG_ID_PTZ_CONTROL: ${r.command}`);A=e}if("stop"===A)i=0;else{const e=r.speed;i=void 0===e?32:e>0&&e<=1?Math.max(1,64*e):e}const o=function(e,t,s){return`<?xml version="1.0" encoding="UTF-8" ?>\n<body>\n<PtzControl version="1.1">\n<channelId>${e}</channelId>\n<command>${U(t)}</command>\n<speed>${s}</speed>\n</PtzControl>\n</body>`}(n,A,i),a=L(n),c=await this.client.sendFrame({cmdId:18,channel:s,channelIdOverride:n,extensionXml:a,payloadXml:o,messageClass:p,streamType:0});if(200!==c.header.responseCode){let e="";if(c.body.length>0)try{const t=this.client.tryDecryptXml;if(t){const s=t.call(this.client,c.body,c.header.channelId,this.client.enc);s&&(e=` - Error details: ${s.substring(0,200)}`)}}catch{}throw new Error(`PTZ control rejected (response_code ${c.header.responseCode})${e}`)}if("start"===r.action&&"stop"!==A){const e=r.autoStopMs??500;e>0&&setTimeout((()=>{this.ptz(s,{action:"stop",command:r.command}).catch((()=>{}))}),e)}}async moveToPtzPreset(e,t){const s=void 0===t?this.normalizeChannel(void 0):this.normalizeChannel(e),r=s,n=function(e,t,s,r){return x(e,t,s,void 0===r?void 0:{name:r})}(r,void 0===t?e:t,"toPos"),A=L(r),i=await this.client.sendFrame({cmdId:19,channel:s,channelIdOverride:r,extensionXml:A,payloadXml:n,messageClass:p,streamType:0});if(200!==i.header.responseCode)throw new Error(`PTZ preset move rejected (response_code ${i.header.responseCode})`)}async setPtzPreset(e,t,s){const r="string"==typeof t?this.normalizeChannel(s):this.normalizeChannel(e),n=r,A=x(n,"string"==typeof t?e:t,"setPos",{name:"string"==typeof t?t:s,enable:1}),i=L(n),o=await this.client.sendFrame({cmdId:19,channel:r,channelIdOverride:n,extensionXml:i,payloadXml:A,messageClass:p,streamType:0});if(200!==o.header.responseCode)throw new Error(`PTZ preset save rejected (response_code ${o.header.responseCode})`)}async deletePtzPreset(e,t){const s=void 0===t?this.normalizeChannel(void 0):this.normalizeChannel(e),r=void 0===t?e:t,n=s,A=L(n);let i;try{const e=await this.getPtzPresetsRaw(s);i=e.find((e=>e.id===r))?.name}catch{}const o=[{label:"command=delPos",payloadXml:x(n,r,"delPos")},{label:"enable=0 (no name)",payloadXml:x(n,r,"setPos",{enable:0})},{label:"name='' (no enable)",payloadXml:x(n,r,"setPos",{name:""})},{label:"enable=0 name=''",payloadXml:x(n,r,"setPos",{name:"",enable:0})},...i?[{label:"enable=0 name=current",payloadXml:x(n,r,"setPos",{name:i,enable:0})}]:[],{label:"enable=0 name='Preset N'",payloadXml:x(n,r,"setPos",{name:`Preset ${r}`,enable:0})}];let a,c=!1;for(const e of o)try{const t=await this.client.sendFrame({cmdId:19,channel:s,channelIdOverride:n,extensionXml:A,payloadXml:e.payloadXml,messageClass:p,streamType:0});if(200!==t.header.responseCode)throw new Error(`PTZ preset delete rejected (response_code ${t.header.responseCode})`);c=!0;try{const e=(await this.getPtzPresetsRaw(s)).find((e=>e.id===r));if(!e)return;const t=void 0!==e.name&&""===String(e.name).trim(),n=void 0!==e.enable&&"0"===String(e.enable).trim();if(t||n)return}catch(e){a=e}}catch(e){a=e}if(!c)throw a instanceof Error?a:new Error("PTZ preset delete failed");this.logger.warn("PTZ presets (baichuan): deletePtzPreset did not take effect (firmware ignored request)",{channel:s,channelId:n,presetId:r})}async getPtzPosition(e){const t=this.normalizeChannel(e),s=await this.sendXml({cmdId:433,channel:t}),r=P(s,"pPos"),n=P(s,"tPos"),A={};return void 0!==r&&(A.pan=Number(r)),void 0!==n&&(A.tilt=Number(n)),A}async getZoomFocus(e){const t=this.normalizeChannel(e),s=t,r=await this.sendXml({cmdId:294,channel:t,channelIdOverride:s,extensionXml:L(s),messageClass:p,streamType:0}),n=e=>{const t=new RegExp(`<${e}>([\\s\\S]*?)</${e}>`).exec(r),s=t?.[1];if(!s)return;const n=P(s,"maxPos"),A=P(s,"minPos"),i=P(s,"curPos");return void 0!==n&&void 0!==A&&void 0!==i?{maxPos:Number(n),minPos:Number(A),curPos:Number(i)}:void 0},A={},i=n("zoom"),o=n("focus");return i&&(A.zoom=i),o&&(A.focus=o),A}async zoomToFactor(e,t){const s=void 0===t?0:this.normalizeChannel(e),r=void 0===t?e:t,n=s,A=(await this.getZoomFocus(s)).zoom;if(!A)throw new Error("Camera did not return <zoom> info (zoom may be unsupported)");const i=Math.round(1e3*r),o=function(e,t){return`<?xml version="1.0" encoding="UTF-8" ?>\n<body>\n<StartZoomFocus version="1.1">\n<channelId>${e}</channelId>\n<command>zoomPos</command>\n<movePos>${Math.trunc(t)}</movePos>\n</StartZoomFocus>\n</body>`}(n,Math.min(A.maxPos,Math.max(A.minPos,i))),a=L(n),c=await this.client.sendFrame({cmdId:295,channel:s,channelIdOverride:n,extensionXml:a,payloadXml:o,messageClass:p,streamType:0});if(200!==c.header.responseCode)throw new Error(`Zoom rejected (response_code ${c.header.responseCode})`)}parseBatteryInfoXml(e,t){const s=e=>{if(void 0===e)return;const t=Number(e);return Number.isFinite(t)?t:void 0},r=xt(e,"BatteryInfo"),n=r.find((e=>P(e,"channelId")===String(t)))??r[0]??e,A={},i=s(P(n,"batteryPercent"));void 0!==i&&(A.batteryPercent=i);const o=P(n,"chargeStatus");void 0!==o&&(A.chargeStatus=o);const a=P(n,"adapterStatus");void 0!==a&&(A.adapterStatus=a);const c=s(P(n,"voltage"));void 0!==c&&(A.voltage=c);const l=s(P(n,"current"));void 0!==l&&(A.current=l);const h=s(P(n,"temperature"));void 0!==h&&(A.temperature=h);const g=s(P(n,"lowPower"));void 0!==g&&(A.lowPower=g);const d=s(P(n,"batteryVersion"));return void 0!==d&&(A.batteryVersion=d),A}getSleepStatus(e){const t=e?.windowMs??e?.idleMs??1e4,s=new Set(e?.nonWakingCmdIds??e?.ignoreCmdIds??[w,252,y,291]),r=this.client.getTransport?.();if("udp"!==r)return{state:"unknown",reason:"sleep inference supported only for UDP/battery"};if(this.activeVideoMsgNums.size>0||this.rtspServers.size>0||this.client.isDeviceStreamingActive?.())return{state:"awake",reason:"active streaming"};const n=this.client.isSocketConnected?.()??!1,A=Date.now(),i=A-t,o=(this.client.getRxHistory?.()??[]).filter((e=>e.atMs>=i)),a=(this.client.getTxHistory?.()??[]).filter((e=>e.atMs>=i));if(0===o.length&&0===a.length)return{state:"sleeping",reason:`no rx/tx activity in last ${t}ms${n?"":" (socket disconnected)"}`,idleMs:t};const c=o.find((e=>!s.has(e.cmdId)));if(c)return{state:"awake",reason:`waking rx cmdId=${c.cmdId} responseCode=${c.responseCode} seen ${A-c.atMs}ms ago`,lastRxAtMs:c.atMs,idleMs:A-c.atMs};const l=a.find((e=>!s.has(e.cmdId)));return l?{state:"awake",reason:`waking tx cmdId=${l.cmdId} seen ${A-l.atMs}ms ago`,idleMs:A-l.atMs}:{state:"sleeping",reason:`only non-waking cmdIds observed in last ${t}ms (non-waking: ${Array.from(s).join(",")})`,idleMs:t}}async probeSleepStatus(e){const t=this.client.getTransport?.();if("udp"!==t)return{state:"unknown",reason:"sleep probe supported only for UDP/battery"};if(this.activeVideoMsgNums.size>0||this.rtspServers.size>0||this.client.isDeviceStreamingActive?.())return{state:"awake",reason:"active streaming"};const s=Date.now(),r=e?.minIntervalMs??5e3;if(this.lastSleepProbe&&s-this.lastSleepProbe.atMs<r)return{...this.lastSleepProbe.status,reason:`${this.lastSleepProbe.status.reason} (cached)`};if(!this.client.isSocketConnected()){const e={state:"unknown",reason:"udp socket not connected"};return this.lastSleepProbe={atMs:s,status:e},e}if(!this.client.loggedIn){const e={state:"unknown",reason:"not logged in"};return this.lastSleepProbe={atMs:s,status:e},e}const n=this.normalizeChannel(e?.channel),A=e?.timeoutMs??700,i=Math.max(1,e?.attempts??1),o=e?.cmdId??y;for(let e=0;e<i;e++)try{const e=await this.client.sendFrame({cmdId:o,channel:n,timeoutMs:A}),t={state:200===e.header.responseCode?"awake":"unknown",reason:`probe cmdId=${o} responseCode=${e.header.responseCode}`};return this.lastSleepProbe={atMs:Date.now(),status:t},t}catch(t){const s=t instanceof Error?t.message:String(t);if(s.includes("Baichuan timeout")||s.toLowerCase().includes("timeout")){const e={state:"sleeping",reason:`probe timeout cmdId=${o} timeoutMs=${A}`};return this.lastSleepProbe={atMs:Date.now(),status:e},e}if(e===i-1){const e={state:"unknown",reason:`probe error cmdId=${o}: ${s}`};return this.lastSleepProbe={atMs:Date.now(),status:e},e}}const a={state:"unknown",reason:"probe exhausted"};return this.lastSleepProbe={atMs:Date.now(),status:a},a}async getBatteryStatus(e){const t=this.normalizeChannel(e);if("sleeping"===this.getSleepStatus({channel:t}).state)return{channel:t,sleeping:!0};try{const e=await Promise.race([this.sendXml({cmdId:y,channel:t}),new Promise(((e,t)=>setTimeout((()=>t(new Error("Timeout"))),5e3)))]),s={channel:t,sleeping:!1};return Object.assign(s,this.parseBatteryInfoXml(e,t)),s}catch(e){const s={channel:t};return"sleeping"===this.getSleepStatus({channel:t}).state&&(s.sleeping=!0),e instanceof Error&&"Timeout"===e.message&&null==s.sleeping&&(s.sleeping=!0),s}}async getBatteryInfo(e){const t=this.normalizeChannel(e),s=this.client.getTransport?.();if(!("udp"!==s||this.client.isSocketConnected?.()&&this.client.loggedIn))return{channel:t,sleeping:!0};const r=await this.client.sendXml({cmdId:y,channel:t}),n={channel:t};return Object.assign(n,this.parseBatteryInfoXml(r,t)),n}async wakeUp(e,t){const s=this.normalizeChannel(e),r="number"==typeof t?{waitAfterWakeMs:t}:t??{},n=r.timeoutMs??2e4,A=r.attempts??3,i=r.waitAfterWakeMs??1500,o=r.backoffMs??1500,a="udp"===this.client.getTransport?.(),c=r.reconnect??a;let l;for(let e=1;e<=A;e++)try{return await this.getEncXml(s,{timeoutMs:n}),void(i>0&&await new Promise((e=>setTimeout(e,i))))}catch(t){l=t;const s=t instanceof Error?t.message:String(t),r=s.includes("Baichuan timeout"),n=s.toLowerCase().includes("socket closed")||s.toLowerCase().includes("stream closed");if(e<A){if(c&&(r||n))try{this.client.loggedIn=!1,await this.client.close()}catch{}o>0&&await new Promise((e=>setTimeout(e,o)));continue}}throw l instanceof Error?l:new Error(String(l))}async isSleeping(e){const t=this.normalizeChannel(e);try{return await Promise.race([this.getBatteryInfo(t),new Promise(((e,t)=>setTimeout((()=>t(new Error("Timeout"))),5e3)))]),!1}catch(e){return!0}}async getPirInfo(e){const t=this.normalizeChannel(e),s=await this.sendXml({cmdId:212,channel:t}),r=e=>{if(void 0===e)return;const t=e.trim().toLowerCase();if("true"===t)return 1;if("false"===t)return 0;const s=Number(t);return Number.isFinite(s)?s:void 0},n=P(s,"enable"),A=P(s,"sensiValue"),i=P(s,"reduceFalseAlarm"),o=P(s,"interval"),a=P(s,"intervalSecMax"),c={channel:t};if(void 0!==n){const e=r(n);void 0!==e&&(c.enable=e)}if(void 0!==A&&(c.sensitive=Number(A)),void 0!==i){const e=r(i);void 0!==e&&(c.reduceAlarm=e)}if(void 0!==o){const e=r(o);void 0!==e&&(c.interval=e)}if(void 0!==a){const e=r(a);void 0!==e&&(c.intervalMax=e)}return{enabled:(e=>{if(void 0===e)return!1;const t=e.trim().toLowerCase();return"1"===t||"true"===t})(n),state:c}}async setPirInfo(e,t){const s="number"==typeof e?e:t,r="number"==typeof e?t:e,n=this.normalizeChannel(s);let A=await this.sendXml({cmdId:212,channel:n});if(void 0!==r.enable&&(A=A.replace(/<enable>[^<]*<\/enable>/,`<enable>${r.enable}</enable>`)),void 0!==r.sensitive){const e=(i=r.sensitive,Math.trunc(101-i));A=A.replace(/<sensiValue>[^<]*<\/sensiValue>/,`<sensiValue>${e}</sensiValue>`)}var i;if(void 0!==r.reduceAlarm){const e=(e=>{if(null==e)return;if("boolean"==typeof e)return e?1:0;const t=Number(e);return Number.isFinite(t)?t:void 0})(r.reduceAlarm);void 0!==e&&(A=A.replace(/<reduceFalseAlarm>[^<]*<\/reduceFalseAlarm>/,`<reduceFalseAlarm>${e}</reduceFalseAlarm>`))}void 0!==r.interval&&(A=A.replace(/<interval>[^<]*<\/interval>/,`<interval>${r.interval}</interval>`)),await this.sendXml({cmdId:213,channel:n,payloadXml:A})}async setMotionDetection(e,t,s){const r="number"==typeof e?e:s,n="number"==typeof e?t:e,A="number"==typeof e?s:t,i=this.normalizeChannel(r);let o=await this.sendXml({cmdId:46,channel:i});void 0!==n&&(o=o.replace(/<enable>[^<]*<\/enable>/,`<enable>${n?"1":"0"}</enable>`)),void 0!==A&&(o=o.replace(/<sensitivityDefault>[^<]*<\/sensitivityDefault>/,`<sensitivityDefault>${A}</sensitivityDefault>`)),await this.sendXml({cmdId:47,channel:i,payloadXml:o})}async setAiDetection(e,t,s,r){const n="number"==typeof e?e:r,A="number"==typeof e?t:e,i="number"==typeof e?s:t,o="number"==typeof e?r:s,a=this.normalizeChannel(n),c=`<?xml version="1.0" encoding="UTF-8" ?>\n <body>\n <AiDetectCfg version="1.1">\n <chn>${a}</chn>\n <type>${U(A)}</type>\n </AiDetectCfg>\n </body>`;let l=await this.sendXml({cmdId:342,channel:a,payloadXml:c});void 0!==i&&(l=l.replace(/<sensitivity>[^<]*<\/sensitivity>/,`<sensitivity>${i}</sensitivity>`)),void 0!==o&&(l=l.replace(/<stayTime>[^<]*<\/stayTime>/,`<stayTime>${o}</stayTime>`)),await this.sendXml({cmdId:343,channel:a,payloadXml:l})}async getSiren(e){try{const t=await this.sendXml({cmdId:547,...void 0!==e?{channel:e}:{}});return{enabled:"1"===P(t,"status")}}catch{return{enabled:!1}}}async setSiren(e,t,s){const r="boolean"==typeof e?s??0:e,n="boolean"==typeof e?e:t,A="boolean"==typeof e?t:s,i=void 0!==r?r+1:void 0;let o;if(void 0!==A)o=V(i,A);else{o=Y(i,n?1:0)}try{await this.sendXml({cmdId:263,...void 0!==r?{channel:r}:{},payloadXml:o})}catch(e){if(!0!==n||void 0!==A)throw e;o=V(i,2),await this.sendXml({cmdId:263,...void 0!==r?{channel:r}:{},payloadXml:o})}}async getWhiteLedState(e){const t=this.normalizeChannel(e),s=await this.sendXml({cmdId:S,channel:t}),r=P(s,"enable"),n=P(s,"state"),A=P(s,"status"),i=P(s,"brightness_cur"),o={enabled:"1"===r||"1"===n||"1"===A};return void 0!==i&&(o.brightness=Number(i)),o}async setWhiteLedState(e,t,s){const r="number"==typeof e?e:s??0,n="number"==typeof e?t:e,A="number"==typeof e?s:t,i=this.normalizeChannel(r);if(void 0!==n)try{const e=O(i,n?1:0,n?180:0);await this.sendXml({cmdId:288,channel:i,payloadXml:e})}catch(e){let t=await this.sendXml({cmdId:S,channel:i});/<enable>[^<]*<\/enable>/i.test(t)&&(t=t.replace(/<enable>[^<]*<\/enable>/i,`<enable>${n?1:0}</enable>`)),/<state>[^<]*<\/state>/i.test(t)&&(t=t.replace(/<state>[^<]*<\/state>/i,`<state>${n?1:0}</state>`)),/<status>[^<]*<\/status>/i.test(t)&&(t=t.replace(/<status>[^<]*<\/status>/i,`<status>${n?1:0}</status>`)),await this.sendXml({cmdId:290,channel:i,payloadXml:t})}if(void 0!==A){let e=await this.sendXml({cmdId:S,channel:i});/<brightness_cur>[^<]*<\/brightness_cur>/i.test(e)&&(e=e.replace(/<brightness_cur>[^<]*<\/brightness_cur>/i,`<brightness_cur>${A}</brightness_cur>`)),/<enable>[^<]*<\/enable>/i.test(e)&&(e=e.replace(/<enable>[^<]*<\/enable>/i,"<enable>1</enable>")),await this.sendXml({cmdId:290,channel:i,payloadXml:e})}}async getAbilityInfo(){const e=this.client.username,t=`<?xml version="1.0" encoding="UTF-8" ?>\n<Extension version="1.1">\n<userName>${U(e)}</userName>\n<token>system, streaming, PTZ, IO, security, replay, disk, network, alarm, record, video, image</token>\n</Extension>`;const s=await this.sendXml({cmdId:151,extensionXml:t}),r={},n=["system","streaming","PTZ","IO","security","replay","disk","network","alarm","record","video","image"];for(const e of n){const t=new RegExp(`<${e}[^>]*>([\\s\\S]*?)<\\/${e}>`,"i"),n=s.match(t);if(n){const e=(n[1]??"").matchAll(/<subModule[^>]*>([\s\S]*?)<\/subModule>/g);for(const t of e){const e=t[1]??"",s=P(e,"channelId")||P(e,"chnID"),n=P(e,"abilityValue");if(n){const e=s?Number(s):"Host";r[e]||(r[e]={});const t=n.split(",").map((e=>e.trim())).filter(Boolean);for(const s of t)r[e][s]=1}}}}const A=s.match(/<AbilityInfo[^>]*>([\s\S]*?)<\/AbilityInfo>/);if(A){const e=(A[1]??"").matchAll(/<([A-Za-z]+)[^>]*>([^<]*)<\/\1>/g);r.Host||(r.Host={});for(const t of e){const e=t[1],s=t[2];if(e&&void 0!==s&&!["image","video","subModule"].includes(e)&&"channelId"!==e&&"abilityValue"!==e){const t=Number(s);r.Host[e]=Number.isNaN(t)?s:t}}}return r.Host&&0===Object.keys(r.Host).length&&delete r.Host,r}async getAbilityVersion(e,t){const s=(await this.getAbilityInfo())[null!=t?t:"Host"];if(!s)return 0;const r=s[e];if("number"==typeof r)return r;if("string"==typeof r){const e=Number(r);return Number.isNaN(e)?0:e}return 0}async getSupportInfo(){return Mt(await this.sendXml({cmdId:199}))}async getDeviceCapabilities(e,t){const s=null!=e,r=this.normalizeChannel(e),n=t?.probe??!0,A=t?.probeSiren??!0,i=t?.probeFloodlight??!0,[o,a]=await Promise.allSettled([this.getAbilityInfo(),this.getSupportInfo()]),c="fulfilled"===o.status?o.value:void 0,l="fulfilled"===a.status?a.value:void 0,h=c?s?{..."object"==typeof c.Host?{Host:c.Host}:{},..."object"==typeof c[r]?{[r]:c[r]}:{}}:c:void 0,g=l?s?{...l,items:(l.items??[]).filter((e=>e.chnID===r))}:l:void 0,d={channel:r};h&&(d.abilities=h),g&&(d.support=g);const u=Ut(d),E=Tt(h,r),I=e=>{if("number"==typeof e)return e>0;if("string"==typeof e){const t=Number(e);return Number.isFinite(t)?t>0:e.length>0&&"0"!==e}return Boolean(e)},C=g?{rtsp:I(g.rtsp),onvif:I(g.onvif),wifi:I(g.wifi),record:I(g.record),ftp:I(g.ftp),email:I(g.email),pushAlarm:I(g.pushAlarm),audioTalk:I(g.audioTalk)}:void 0;if(n&&A&&!u.hasSiren){const e=async()=>{try{return await this.sendXml({cmdId:547,channel:r,timeoutMs:1e3}),!0}catch{return!1}},t=async()=>{try{const e=Y(r+1,0);return await this.sendXml({cmdId:263,channel:r,payloadXml:e,timeoutMs:1e3}),!0}catch{return!1}};(await e()||await t())&&(u.hasSiren=!0)}if(n&&i&&!u.hasFloodlight){const e=(g?.items??[]).filter((e=>e.chnID===r||e.chnID===r+1)),t=e=>{const t=e?.lightType;if("number"==typeof t)return t;if("string"==typeof t){const e=Number(t);return Number.isFinite(e)?e:void 0}},s=e.map((e=>t(e))).filter((e=>Number.isFinite(e)));if(s.some((e=>0===e)));else if(s.some((e=>e>0)))u.hasFloodlight=!0;else try{const e=await this.sendXml({cmdId:S,channel:r,timeoutMs:1e3});/(<FloodlightTask\b|<FloodlightManual\b|<FloodlightStatusList\b|<WhiteLed\b)/i.test(e)&&(u.hasFloodlight=!0)}catch{}}let B,Q;try{const e=(P(await this.sendXml({cmdId:299,channel:r,timeoutMs:1500}),"detectType")??"").trim();if(e){const t=e.split(",").map((e=>e.trim())).filter(Boolean);t.length>0&&(B=t)}}catch{}if(u.hasPresets){const e=(await Promise.allSettled([this.getPtzPresets(r)]))[0];"fulfilled"===e?.status&&(Q=e.value,u.hasPresets=Q.length>0)}const p={channel:r,channelId1Based:r+1,transport:this.client.getTransport(),encryptionKind:this.client.enc.kind,loggedIn:this.client.loggedIn,subscribed:this.client.subscribed,abilitiesAvailable:Boolean(h),supportAvailable:Boolean(g)};E&&(p.abilityMergedKeyCount=Object.keys(E).length),g?.items&&(p.supportItemCount=g.items.length);const f={capabilities:u,debug:p};return h&&(f.abilities=h),g&&(f.support=g),Q&&(f.presets=Q),B&&(f.objects=B),C&&(f.features=C),f}async createRtspStream(e,t,s){const r="number"==typeof e?this.normalizeChannel(e):0,n="number"==typeof e?t:e,A="number"==typeof e?s:t;let i;try{const e=await this.getStreamMetadata(r);if(Array.isArray(e)){const t=e.find((e=>e.profile===n));t?.videoEncType&&(i=t.videoEncType)}else if(e&&"object"==typeof e&&"streams"in e){const t=e.streams;if(Array.isArray(t)){const e=t.find((e=>e?.profile===n));e?.videoEncType&&(i=e.videoEncType)}}}catch(e){this.logger.warn(`[ReolinkBaichuanApi] Could not fetch stream metadata, will auto-detect codec: ${e instanceof Error?e.message:e}`)}const o={api:this,channel:r,profile:n,...void 0!==A?.listenHost?{listenHost:A.listenHost}:{},...void 0!==A?.listenPort?{listenPort:A.listenPort}:{},...void 0!==A?.path?{path:A.path}:{},logger:this.logger},a=new at(o);return await a.start(),this.rtspServers.add(a),a.once("close",(()=>{this.rtspServers.delete(a)})),a}};function _t(e,t,s){const r=[];let n=0;const A=(e,r)=>{if(4===t)return"be"===s?e.readUInt32BE(r):e.readUInt32LE(r);if(2===t)return"be"===s?e.readUInt16BE(r):e.readUInt16LE(r);if(3===t){const t=e[r],n=e[r+1],A=e[r+2];return"be"===s?(t<<16|n<<8|A)>>>0:(A<<16|n<<8|t)>>>0}return e.readUInt8(r)};for(;n+t<=e.length;){const s=A(e,n);if(n+=t,!s)return[];if(n+s>e.length)return[];const i=e.subarray(n,n+s);n+=s,i.length&&r.push(i)}return n!==e.length?[]:r}function qt(e,t){if(!t.length)return Number.POSITIVE_INFINITY;let s=0;for(const r of t)if(r.length){if(128&r[0])s+=10;else if("H264"===e){const e=31&r[0];(e<1||e>23)&&s++}else if("H265"===e){if(r.length<2){s++;continue}const e=r[0]>>1&63;e>=0&&e<=29||e>=32&&e<=40||e>=48&&e<=50||s++}}else s++;return s}function $t(e,t){if(!e?.length)return[];const s=[],r=function(e,t=64){if(!e?.length)return-1;const s=Math.min(e.length,Math.max(0,t));for(let t=0;t+3<s;t++)if(0===e[t]&&0===e[t+1]){if(1===e[t+2])return t;if(0===e[t+2]&&1===e[t+3])return t}return-1}(e,64);if(r>=0){const t=function(e){const t=[],s=e.length,r=t=>{if(t+3<=s&&0===e[t]&&0===e[t+1]){if(1===e[t+2])return 3;if(t+4<=s&&0===e[t+2]&&1===e[t+3])return 4}return 0};let n=0;for(;n<s&&!r(n);)n++;for(;n<s;){const A=r(n);if(!A){n++;continue}const i=n+A;let o=i;for(;o<s&&!r(o);)o++;if(i<o){const s=e.subarray(i,o);s.length>0&&t.push(s)}n=o}return t}(0===r?e:e.subarray(r));t.length&&s.push(t)}s.push(_t(e,4,"be")),s.push(_t(e,4,"le")),s.push(_t(e,3,"be")),s.push(_t(e,3,"le")),s.push(_t(e,2,"be")),s.push(_t(e,2,"le")),s.push(_t(e,1,"be"));const n=function(e){if(e.length>=4&&0===e[0]&&0===e[1]){if(1===e[2])return e.subarray(3);if(0===e[2]&&1===e[3])return e.subarray(4)}return e}(e);n.length&&s.push([n]);let A=[],i=Number.POSITIVE_INFINITY;for(const e of s){if(!e.length)continue;const s=qt(t,e);if(s<i&&(i=s,A=e,0===i))break}return A}function zt(e){const t=$t(e,"H264");let s,r,n;for(const e of t){if(e.length<1)continue;const t=31&e[0];if(7===t){if(s=e,e.length>=4){n=Buffer.from([e[1],e[2],e[3]]).toString("hex")}}else 8===t&&(r=e)}const A={};return s&&(A.sps=s),r&&(A.pps=r),n&&(A.profileLevelId=n),A}function Xt(e){const t=$t(e,"H265");let s,r,n;for(const e of t){if(e.length<2)continue;const t=e[0]>>1&63;32===t?s=e:33===t?r=e:34===t&&(n=e)}const A={};return s&&(A.vps=s),r&&(A.sps=r),n&&(A.pps=n),A}var jt=[96e3,88200,64e3,48e3,44100,32e3,24e3,22050,16e3,12e3,11025,8e3,7350];function Zt(e){if(e.length<7)return null;if(255!==e[0]||240&~e[1])return null;const t=!(1&~e[1]),s=((192&e[2])>>6)+1,r=(60&e[2])>>2,n=jt[r]??0,A=(1&e[2])<<2|(192&e[3])>>6;if(!n||!A)return null;const i=t?7:9;if(e.length<i)return null;return{headerLength:i,sampleRate:n,channels:A,configHex:((31&s)<<11|(15&r)<<7|(15&A)<<3).toString(16).padStart(4,"0")}}var Kt=class{constructor(e){this.payloadType=e,this.seq=r.randomBytes(2).readUInt16BE(0)}seq=0;timestamp=0;ssrc=r.randomBytes(4).readUInt32BE(0);setTimestamp(e){this.timestamp=e>>>0}getTimestamp(){return this.timestamp>>>0}advanceTimestamp(e){this.timestamp=this.timestamp+(e>>>0)>>>0}writePacket(e,t){const s=Buffer.alloc(12);return s[0]=128,s[1]=(t?128:0)|127&this.payloadType,s.writeUInt16BE(65535&this.seq,2),s.writeUInt32BE(this.timestamp>>>0,4),s.writeUInt32BE(this.ssrc>>>0,8),this.seq=this.seq+1&65535,Buffer.concat([s,e])}};function es(e,t,s,r,n){const A=s.maxRtpPayload,i=[];if(e.length<=A)return i.push(t.writePacket(e,r&&n)),i;const o=e[0],a=31&o,c=128&o|96&o|28,l=e.subarray(1);let h=0;for(;h<l.length;){const e=l.length-h,s=Math.min(e,A-2),o=0===h,g=h+s>=l.length,d=(o?128:0)|(g?64:0)|31&a,u=Buffer.concat([Buffer.from([c,d]),l.subarray(h,h+s)]);i.push(t.writePacket(u,r&&n&&g)),h+=s}return i}function ts(e,t,s,r,n){const A=s.maxRtpPayload,i=[];if(e.length<=A)return i.push(t.writePacket(e,r&&n)),i;if(e.length<3)return i;const o=e[0],a=o>>1&63,c=129&o|98,l=e[1],h=e.subarray(2);let g=0;for(;g<h.length;){const e=h.length-g,s=Math.min(e,A-3),o=0===g,d=g+s>=h.length,u=(o?128:0)|(d?64:0)|63&a,E=Buffer.concat([Buffer.from([c,l,u]),h.subarray(g,g+s)]);i.push(t.writePacket(E,r&&n&&d)),g+=s}return i}var ss=class e{constructor(e,t,s,r=25,n=1200){this.logger=e,this.videoPayloadType=t,this.maxRtpPayload=n,this.videoRtp=new Kt(t),void 0!==s&&(this.audioRtp=new Kt(s)),this.fallbackVideoIncrement=Math.max(1,Math.round(this.videoClockRate/Math.max(1,r))),this.fallbackVideoDeltaUs=Math.max(1,Math.round(1e6*this.fallbackVideoIncrement/this.videoClockRate))}clients=new Set;closed=!1;videoRtp;audioRtp;videoLastUsRaw;videoUsWrapOffset=0;videoLastAbsUs;videoAvgDeltaUs;videoClockRate=9e4;fallbackVideoIncrement;fallbackVideoDeltaUs;maxTrustedDeltaUs=5e5;emaAlpha=.1;videoTimingLogState={lastUntrustedDeltaLogMs:0,lastWrapLogMs:0,lastResetLogMs:0,untrustedDeltaCount:0,wrapCount:0,resetCount:0};cachedH264ParamSetsAnnexB;cachedH265ParamSetsAnnexB;addClient(e){if(this.closed)return void e.destroy();const t={socket:e,needsKeyframe:!0,sentVideoConfig:!1};this.clients.add(t);const s=()=>{this.clients.delete(t);try{e.destroy()}catch{}};e.on("error",s),e.on("close",s)}static ANNEXB_START_CODE=Buffer.from([0,0,0,1]);static joinAnnexBNals(...t){const s=t.filter((e=>!!e&&e.length>0));if(!s.length)return;const r=[];for(const t of s)r.push(e.ANNEXB_START_CODE,t);return Buffer.concat(r)}updateVideoParamSetsFromAccessUnit(t,s){if(!s?.length)return;if("H264"===t){const{sps:t,pps:r}=zt(s);return void(t&&r&&(this.cachedH264ParamSetsAnnexB=e.joinAnnexBNals(t,r)))}const{vps:r,sps:n,pps:A}=Xt(s);r&&n&&A&&(this.cachedH265ParamSetsAnnexB=e.joinAnnexBNals(r,n,A))}sendCachedVideoConfigToClient(e,t){if(this.closed)return;if(t.sentVideoConfig)return;const s="H265"===e?this.cachedH265ParamSetsAnnexB:this.cachedH264ParamSetsAnnexB;if(!s?.length)return;const r=$t(s,e);if(!r.length)return;const n={maxRtpPayload:this.maxRtpPayload};for(let s=0;s<r.length;s++){const A=r[s],i=s===r.length-1,o="H265"===e?ts(A,this.videoRtp,n,!1,i):es(A,this.videoRtp,n,!1,i);for(const e of o)this.writeRtpPacketToClient(t,e)}t.sentVideoConfig=!0}close(){if(!this.closed){this.closed=!0;for(const e of Array.from(this.clients))try{e.socket.destroy()}catch{}this.clients.clear()}}writeRtpPacketToClient(e,t){if(e.socket.destroyed||!e.socket.writable)return;const s=Buffer.alloc(2);s.writeUInt16BE(65535&t.length,0);const r=Buffer.concat([s,t]);try{e.socket.write(r)}catch{try{e.socket.destroy()}catch{}}}writeRtpPacketToClients(e,t){for(const s of this.clients)t(s)&&this.writeRtpPacketToClient(s,e)}resetVideoTimestampMapping(){this.videoLastUsRaw=void 0,this.videoUsWrapOffset=0,this.videoLastAbsUs=void 0,this.videoAvgDeltaUs=void 0}logVideoTiming(e,t){const s=Date.now(),r=5e3,n=this.videoTimingLogState;if("untrusted-delta"===e){if(n.untrustedDeltaCount++,s-n.lastUntrustedDeltaLogMs<r)return;return n.lastUntrustedDeltaLogMs=s,void this.logger.warn(`[rfc4571] video timing: ${t} (untrustedDeltaCount=${n.untrustedDeltaCount})`)}if("wrap"===e){if(n.wrapCount++,s-n.lastWrapLogMs<r)return;return n.lastWrapLogMs=s,void this.logger.warn(`[rfc4571] video timing: ${t} (wrapCount=${n.wrapCount})`)}n.resetCount++,s-n.lastResetLogMs<r||(n.lastResetLogMs=s,this.logger.warn(`[rfc4571] video timing: ${t} (resetCount=${n.resetCount})`))}advanceVideoTimestampFallback(){this.videoRtp.advanceTimestamp(this.fallbackVideoIncrement)}setVideoTimestampFromMicroseconds(e){if(null==e)return void this.advanceVideoTimestampFallback();if(!Number.isFinite(e))return void this.advanceVideoTimestampFallback();const t=e>>>0;if(void 0!==this.videoLastUsRaw){const e=this.videoLastUsRaw;if(t<e){e>4026531840&&t<268435455?(this.videoUsWrapOffset+=4294967296,this.logVideoTiming("wrap",`detected u32 wrap (lastUsRaw=${e} curUsRaw=${t} wrapOffset=${this.videoUsWrapOffset})`)):(this.logVideoTiming("reset",`detected backwards jump; resetting mapping (lastUsRaw=${e} curUsRaw=${t})`),this.resetVideoTimestampMapping())}}this.videoLastUsRaw=t;const s=this.videoUsWrapOffset+t;if(void 0===this.videoLastAbsUs)return this.videoLastAbsUs=s,void(void 0===this.videoAvgDeltaUs&&(this.videoAvgDeltaUs=this.fallbackVideoDeltaUs));const r=s-this.videoLastAbsUs;this.videoLastAbsUs=s;let n;if(Number.isFinite(r)&&r>0&&r<=this.maxTrustedDeltaUs){const e=this.videoAvgDeltaUs??r;this.videoAvgDeltaUs=e+(r-e)*this.emaAlpha,n=r}else this.logVideoTiming("untrusted-delta",`discarded deltaUs=${r} (absUs=${s} lastAbsUs=${this.videoLastAbsUs} avgDeltaUs=${this.videoAvgDeltaUs??"n/a"}); using fallback`),n=this.videoAvgDeltaUs??this.fallbackVideoDeltaUs;const A=Math.max(1,Math.round(n*this.videoClockRate/1e6));this.videoRtp.advanceTimestamp(A)}sendVideoAccessUnit(e,t,s,r){if(this.closed)return;this.updateVideoParamSetsFromAccessUnit(e,t);const n=$t(t,e);if(!n.length)return;let A=!1;if("H264"===e)for(const e of n){if(5===(31&e[0])){A=!0;break}}else for(const e of n){if(e.length<2)continue;const t=e[0]>>1&63;if(t>=16&&t<=23){A=!0;break}}const i=s||A,o=e=>!!i||!e.needsKeyframe;let a=!1;for(const e of this.clients)if(o(e)){a=!0;break}if(!a){for(const t of this.clients)t.needsKeyframe&&this.sendCachedVideoConfigToClient(e,t);return}this.setVideoTimestampFromMicroseconds(r);for(const t of this.clients)t.needsKeyframe&&this.sendCachedVideoConfigToClient(e,t);const c={maxRtpPayload:this.maxRtpPayload};for(let t=0;t<n.length;t++){const s=n[t],r=t===n.length-1,A="H265"===e?ts(s,this.videoRtp,c,!0,r):es(s,this.videoRtp,c,!0,r);for(const e of A)this.writeRtpPacketToClients(e,o)}if(i)for(const e of this.clients)e.needsKeyframe=!1}sendAudioAdtsFrame(e){if(this.closed)return{};if(!this.audioRtp)return{};const{packets:t,config:s}=function(e,t){const s=Zt(e);if(!s)return{packets:[]};const r=e.subarray(s.headerLength);if(!r.length)return{packets:[]};const n=Buffer.from([0,16]),A=8191&r.length,i=Buffer.alloc(2);i[0]=A>>5&255,i[1]=(31&A)<<3;const o=Buffer.concat([n,i,r]);return{packets:[t.writePacket(o,!0)],config:{sampleRate:s.sampleRate,channels:s.channels,configHex:s.configHex}}}(e,this.audioRtp);for(const e of t)this.writeRtpPacketToClients(e,(e=>!e.needsKeyframe));return t.length&&this.audioRtp.advanceTimestamp(1024),s?{parsed:s}:{}}sendAudioRtpPacket(e){if(this.closed)return;if(!e||e.length<12)return;2===(e[0]>>6&3)&&this.writeRtpPacketToClients(e,(e=>!e.needsKeyframe))}static parseRtpPayload(e){if(!e||e.length<12)return;if(2!==(e[0]>>6&3))return;const t=!!(32&e[0]),s=!!(16&e[0]);let r=12+4*(15&e[0]);if(r>e.length)return;if(s){if(r+4>e.length)return;if(r+=4+4*e.readUInt16BE(r+2),r>e.length)return}let n=e.length;if(t){const t=e[e.length-1];if(t<=0||t>e.length)return;if(n=e.length-t,n<r)return}return n<=r?void 0:e.subarray(r,n)}static isH264KeyframeLikeRtpPacket(t){const s=e.parseRtpPayload(t);if(!s||s.length<1)return!1;const r=31&s[0];if(r>=1&&r<=23)return 5===r||7===r||8===r;if(24===r){let e=1;for(;e+2<=s.length;){const t=s.readUInt16BE(e);if(e+=2,!t||e+t>s.length)break;const r=31&s[e];if(5===r||7===r||8===r)return!0;e+=t}return!1}if(28===r&&s.length>=2){const e=s[1],t=31&e;return!!!!(128&e)&&(5===t||7===t||8===t)}return!1}static isH265KeyframeLikeRtpPacket(t){const s=e.parseRtpPayload(t);if(!s||s.length<2)return!1;const r=s[0]>>1&63,n=e=>e>=16&&e<=21||(32===e||33===e||34===e);if(49===r&&s.length>=3){const e=s[2];return!!!!(128&e)&&n(63&e)}return n(r)}sendVideoRtpPacket(t,s){if(this.closed)return;if(!s||s.length<12)return;if(2!==(s[0]>>6&3))return;const r="H265"===t?e.isH265KeyframeLikeRtpPacket(s):e.isH264KeyframeLikeRtpPacket(s);if(this.writeRtpPacketToClients(s,(e=>!!r||!e.needsKeyframe)),r)for(const e of this.clients)e.needsKeyframe=!1}};async function rs(e){const{api:t,channel:s,profile:r,logger:n,expectedVideoType:i,host:o="127.0.0.1",videoPayloadType:a=96,audioPayloadType:c=97,keyframeTimeoutMs:l=5e3,uptimeRestartMs:h=1e4,idleTeardownMs:g=2500,closeApiOnTeardown:d=!0,username:u,password:E,requireAuth:I=!1}=e,C=`[native-rfc4571 ch=${s} profile=${r}]`,B=e=>n.warn(`${C} ${e}`);B(`starting (host=${o} videoPT=${a} audioPT=${c} expectedVideoType=${i??"n/a"} keyframeTimeoutMs=${l} uptimeRestartMs=${h} idleTeardownMs=${g})`);const Q=new Ze({client:t.client,api:t,channel:s,profile:r,logger:n});await Q.start(),B("baichuan stream started; waiting for keyframe to extract parameter sets");const p=await(async()=>await new Promise(((e,t)=>{const n=setTimeout((()=>{o(),t(new Error(`Timeout waiting for keyframe on native stream channel=${s} profile=${r}`))}),l),A=e=>{o(),t(e instanceof Error?e:new Error(String(e)))},i=t=>{if(!t?.isKeyframe)return;const s=t.videoType,r=t.data;if("H264"===s){const{sps:t,pps:n,profileLevelId:A}=zt(r);if(!t||!n)return;return o(),void e({videoType:s,accessUnit:r,...A?{profileLevelId:A}:{},h264:{sps:t,pps:n}})}const{vps:n,sps:A,pps:i}=Xt(r);n&&A&&i&&(o(),e({videoType:s,accessUnit:r,h265:{vps:n,sps:A,pps:i}}))},o=()=>{clearTimeout(n),Q.removeListener("error",A),Q.removeListener("videoAccessUnit",i)};Q.on("error",A),Q.on("videoAccessUnit",i)})))();i&&p.videoType!==i&&B(`expectedVideoType mismatch (expected=${i} actual=${p.videoType})`),B(`video detected: codec=${p.videoType} (primed via keyframe)`);let f,m=25;try{const e=await t.getStreamMetadata(s),n=(Array.isArray(e)?e:Array.isArray(e?.streams)?e.streams:[]).find((e=>e?.profile===r)),A=Number(n?.frameRate);Number.isFinite(A)&&A>0&&(m=A)}catch{}B(`video framerate hint: ${m} fps`);f=await(async()=>await new Promise((e=>{let t=!1,s=3;const r=setTimeout((()=>{i(),t&&n.warn("Native audio frames seen but not ADTS AAC; cannot advertise audio track."),e(void 0)}),5e3),A=r=>{t=!0;const A=Zt(r);if(A)i(),e({sampleRate:A.sampleRate,channels:A.channels,configHex:A.configHex});else if(s-- >0){const e=r.subarray(0,Math.min(16,r.length)).toString("hex");n.warn(`Native audioFrame not ADTS: len=${r.length} head=${e}`)}},i=()=>{clearTimeout(r),Q.removeListener("audioFrame",A)};Q.on("audioFrame",A)})))(),B(f?`audio detected: codec=aac sampleRate=${f.sampleRate} channels=${f.channels}`:"audio not detected/advertised (no ADTS AAC config within timeout)");const y={videoType:p.videoType,payloadType:a,..."H264"===p.videoType?{h264:{sps:p.h264.sps,pps:p.h264.pps,...p.profileLevelId?{profileLevelId:p.profileLevelId}:{}}}:{h265:{vps:p.h265.vps,sps:p.h265.sps,pps:p.h265.pps}}},w=f?{codec:"aac",payloadType:c,sampleRate:f.sampleRate,channels:f.channels,configHex:f.configHex}:void 0,S=function(e,t){let s="v=0\r\n";if(s+="o=- 0 0 IN IP4 0.0.0.0\r\n",s+="s=No Name\r\n",s+="t=0 0\r\n",s+=`m=video 0 RTP/AVP ${e.payloadType}\r\n`,s+="c=IN IP4 0.0.0.0\r\n",s+=`a=rtpmap:${e.payloadType} ${e.videoType}/90000\r\n`,"H264"===e.videoType&&e.h264){const t=e.h264.sps.toString("base64"),r=e.h264.pps.toString("base64"),n=e.h264.profileLevelId?`profile-level-id=${e.h264.profileLevelId};`:"";s+=`a=fmtp:${e.payloadType} packetization-mode=1;${n}sprop-parameter-sets=${t},${r}\r\n`}if("H265"===e.videoType&&e.h265){const t=e.h265.vps.toString("base64"),r=e.h265.sps.toString("base64"),n=e.h265.pps.toString("base64");s+=`a=fmtp:${e.payloadType} sprop-vps=${t};sprop-sps=${r};sprop-pps=${n}\r\n`}return"aac"===t?.codec&&(s+=`m=audio 0 RTP/AVP ${t.payloadType}\r\n`,s+="c=IN IP4 0.0.0.0\r\n",s+="b=AS:128\r\n",s+=`a=rtpmap:${t.payloadType} MPEG4-GENERIC/${t.sampleRate}/${t.channels}\r\n`,s+=`a=fmtp:${t.payloadType} profile-level-id=1; mode=AAC-hbr; sizelength=13; indexlength=3; indexdeltalength=3; config=${t.configHex}\r\n`),"opus"===t?.codec&&(s+=`m=audio 0 RTP/AVP ${t.payloadType}\r\n`,s+="c=IN IP4 0.0.0.0\r\n",s+="b=AS:128\r\n",s+=`a=rtpmap:${t.payloadType} opus/${t.sampleRate}/${t.channels}\r\n`),s}(y,w),D=()=>new ss(n,a,w?c:void 0,m);let b=D();B(`SDP ready (video=${p.videoType}/90000 pt=${a}${w?`, audio=aac/${w.sampleRate}/${w.channels} pt=${c}`:", audio=none"})`);let v=0;const N=new Set;let R,k=!1,T=!1,F=Date.now();const M=()=>{F=Date.now()},U=()=>{R&&(clearTimeout(R),R=void 0)};let L;const H=e=>{g&&(R||(R=setTimeout((()=>{R=void 0,0===v&&e(new Error("No RFC4571 clients (idle)")).catch((()=>{}))}),g)))},P=A.createServer(),x=async e=>{if(k)return;if(T)return;T=!0,M(),U();const t=e?.message||e?.toString?.()||e,s=P.address(),r=s&&"string"!=typeof s?`${s.address}:${s.port}`:"unbound";B(t?`uptime watchdog: restarting (addr=${r} clients=${v} reason=${t})`:`uptime watchdog: restarting (addr=${r} clients=${v})`);for(const e of Array.from(N))try{e.destroy()}catch{}N.clear();try{b.close()}catch{}b=D();try{await Q.stop()}catch{}try{await Q.start()}catch(e){return T=!1,void Y(e).catch((()=>{}))}T=!1,M(),B("uptime watchdog: restart complete"),0===v&&H(Y)},Y=async e=>{if(k)return;k=!0,L&&(clearInterval(L),L=void 0),U();const s=e?.message||e?.toString?.()||e,r=P.address(),n=r&&"string"!=typeof r?`${r.address}:${r.port}`:"unbound";B(s?`teardown requested (addr=${n} clients=${v} reason=${s})`:`teardown requested (addr=${n} clients=${v})`),b.close();try{await Q.stop()}catch{}if(d)try{await t.close()}catch{}try{P.close()}catch{}B("teardown complete")};P.on("connection",(e=>{M();const t=`${e.remoteAddress??"unknown"}:${e.remotePort??"unknown"}`;B(`client connecting (remote=${t} requireAuth=${I})`);const s=()=>{v++,U(),N.add(e),e.on("data",(()=>M()));try{const t=e.write.bind(e);e.write=(...e)=>(M(),t(...e))}catch{}b.addClient(e),B(`client connected (remote=${t} clients=${v})`)};if(I){let r=!1,n=Buffer.alloc(0);const A=setTimeout((()=>{r||(B(`client authentication timeout (remote=${t})`),e.destroy())}),5e3),i=o=>{if(M(),!r){n=Buffer.concat([n,o]);const a=n.toString("utf8").match(/^([^:]+):([^\n]+)\n/);if(a){const[,o,c]=a;if(o!==u||c!==E)return B(`client authentication failed (remote=${t})`),void e.destroy();{r=!0,clearTimeout(A),s();const t=a[0].length,o=n.subarray(t);e.removeListener("data",i),e.on("data",(()=>M())),o.length>0&&e.emit("data",o)}}else if(n.length>1024)return B(`client authentication buffer overflow (remote=${t})`),void e.destroy()}};e.on("data",i)}else s();let r=!0;const n=()=>{r&&(r=!1,v=Math.max(0,v-1),N.delete(e),B(`client disconnected (remote=${t} clients=${v})`),0===v&&H(Y))};e.once("close",n),e.once("error",n)})),Q.on("videoAccessUnit",(e=>{M();try{b.sendVideoAccessUnit(e.videoType,e.data,e.isKeyframe,e.microseconds)}catch(e){Y(e).catch((()=>{}))}})),w&&Q.on("audioFrame",(e=>{M();try{b.sendAudioAdtsFrame(e)}catch(e){Y(e).catch((()=>{}))}})),Q.on("error",(e=>{T||Y(e).catch((()=>{}))})),Q.on("close",(e=>{T||Y(e).catch((()=>{}))})),await new Promise(((e,t)=>{P.once("error",t),P.listen(0,o,(()=>e()))}));const V=P.address();if(!V||"string"==typeof V)throw new Error("Failed to bind RFC TCP server");const O=V.port;if(!O)throw new Error("Failed to bind RFC TCP server");B(`listening (addr=${o}:${O})`);const G=w?{codec:"aac",sampleRate:w.sampleRate,channels:w.channels}:void 0;return H(Y),(()=>{if(!h||h<=0)return;if(L)return;const e=Math.max(250,Math.min(1e3,Math.floor(h/2)));L=setInterval((()=>{if(k||T)return;const e=Date.now()-F;e<h||x(new Error(`No stream activity for ${e}ms (threshold=${h}ms)`)).catch((()=>{}))}),e)})(),{host:o,port:O,sdp:S,videoType:p.videoType,...G?{audio:G}:{},username:u,password:E,server:P,videoStream:Q,close:Y}}var ns=Buffer.from([0,0,0,1]),As=Buffer.from([0,0,1]);function is(e){const t=[];for(let s=0;s<e.length-3;s++)0===e[s]&&0===e[s+1]&&(1===e[s+2]?(t.push({idx:s,len:3}),s+=2):0===e[s+2]&&1===e[s+3]&&(t.push({idx:s,len:4}),s+=3));if(0===t.length)return[];const s=[];for(let r=0;r<t.length;r++){const n=t[r],A=n.idx+n.len,i=t[r+1],o=i?i.idx:e.length;o>A&&s.push(e.subarray(A,o))}return s}function os(e){if(e.length<1)return null;const t=e[0];return void 0===t?null:31&t}n.EventEmitter}},t={};function s(r){var n=t[r];if(void 0!==n)return n.exports;var A=t[r]={id:r,loaded:!1,exports:{}};return e[r].call(A.exports,A,A.exports,s),A.loaded=!0,A.exports}s.d=(e,t)=>{for(var r in t)s.o(t,r)&&!s.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},s.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),s.nmd=e=>(e.paths=[],e.children||(e.children=[]),e);var r=s(7927),n=exports="undefined"==typeof exports?{}:exports;for(var A in r)n[A]=r[A];r.__esModule&&Object.defineProperty(n,"__esModule",{value:!0})})();
3
3
  //# sourceMappingURL=main.nodejs.js.map